diff --git a/fsl/data/fixlabels.py b/fsl/data/fixlabels.py index 86eaadb675474c2d0412be727f9096452e80b718..4dc1821a2af125213b3102f2d47e3d0a933732fb 100644 --- a/fsl/data/fixlabels.py +++ b/fsl/data/fixlabels.py @@ -237,7 +237,8 @@ def saveLabelFile(allLabels, :arg dirname: If provided, is output as the first line of the file. Intended to be a relative path to the MELODIC analysis - directory with which this label file is associated. + directory with which this label file is associated. If + not provided, a ``'.'`` is output as the first line. :arg listBad: If ``True`` (the default), the last line of the file will contain a comma separated list of components which @@ -251,8 +252,10 @@ def saveLabelFile(allLabels, noisyComps = [] # The first line - the melodic directory name - if dirname is not None: - lines.append(dirname) + if dirname is None: + dirname = '.' + + lines.append(dirname) # A line for each component for i, labels in enumerate(allLabels): diff --git a/fsl/data/volumelabels.py b/fsl/data/volumelabels.py index b31af600bddd756b69c47a9e5885cb11db23dfd4..14648702b454b306f752d18e9a3657f610dc2e27 100644 --- a/fsl/data/volumelabels.py +++ b/fsl/data/volumelabels.py @@ -38,6 +38,7 @@ class VolumeLabels(notifier.Notifier): clear load save + numComponents hasLabel hasComponent getLabels @@ -95,6 +96,12 @@ class VolumeLabels(notifier.Notifier): self.clear() + def numComponents(self): + """Returns the number of components (a.k.a. volumes) that this + ``VolumeLabels`` instance is managing. + """ + return self.__ncomps + def getDisplayLabel(self, label): """Returns the display name for the given label. """