code: def __init__(
      self,
      image_name,
      modalities,
      model_filename=None,
      name="label_norm",
  ):
      super(DiscreteLabelNormalisationLayer, self).__init__(name=name)
      # mapping is a complete cache of the model file, the total number of
      # modalities are listed in self.modalities
      self.image_name = image_name
      self.modalities = None
      if isinstance(modalities, (list, tuple)):
          if len(modalities) > 1:
              raise NotImplementedError(
                  "Currently supports single modality discrete labels."
              )
          self.modalities = modalities
      else:
          self.modalities = (modalities,)
      if model_filename is None:
          model_filename = os.path.join(".", "histogram_ref_file.txt")
      self.model_file = os.path.abspath(model_filename)
      self._key = None
      assert not os.path.isdir(self.model_file), (
          "model_filename is a directory, "
          "please change histogram_ref_file to a filename."
      )
      self.label_map = hs.read_mapping_file(self.model_file)
  
file_path: NiftyNet/niftynet/layer/discrete_label_normalisation.py
imports: from __future__ import absolute_import, print_function, division
  import os
  import numpy
  import tensorflow
  import niftynet.utilities.histogram_standardisation
  from niftynet.layer.base_layer import DataDependentLayer
  from niftynet.layer.base_layer import Invertible
  from niftynet.utilities.user_parameters_helper import standardise_string
  from niftynet.utilities.util_common import print_progress_bar
label_desc: Use image node_id 1 to create a new DiscreteLabelNormalisationLayer object from inherited base classes: DataDependentLayer, Invertible with example: obj = DiscreteLabelNormalisationLayer(image_name, modalities, model_filename, name)