fix python2 formatting
@@ -25,6 +25,9 @@ class DiscreteLabelNormalisationLayer(DataDependentLayer, Invertible):
# modalities are listed in self.modalities
self.image_name = image_name
self.modalities = modalities
+ if isinstance(modalities, tuple) and len(modalities) > 1:
+ raise NotImplementedError(
+ "Currently supports single modality discrete labels.")
self.model_file = os.path.abspath(model_filename)
assert not os.path.isdir(self.model_file), \
"model_filename is a directory, please change histogram_ref_file"
@@ -33,8 +36,8 @@ class DiscreteLabelNormalisationLayer(DataDependentLayer, Invertible):
@property
def key(self):
# provide a readable key for the label mapping item
- key_from = "{}_{}-from".format(self.image_name, self.modalities)
- key_to = "{}_{}-to".format(self.image_name, self.modalities)
+ key_from = "{}_{}-from".format(self.image_name, self.modalities[0])
+ key_to = "{}_{}-to".format(self.image_name, self.modalities[0])
return standardise_string(key_from), standardise_string(key_to)
def layer_op(self, image, mask=None):
