Commit 3e750bce authored by Paul McCarthy's avatar Paul McCarthy
Browse files

NewVolumeLabels.numComponents method. Fix to fixlabels.saveLabelFile -

currently dirname has to be output as the first line, as loadLabelFile will
crash on files which don't have it.
parent 08bc7afe
......@@ -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):
......
......@@ -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. """
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment