Skip to content
Snippets Groups Projects
Commit 85d18165 authored by Paul McCarthy's avatar Paul McCarthy
Browse files

loadMelodicLabelFile now supports ICA-AROMA output, that is, just a

comma-separated list of motion ICs. This will be updated soon, as
loadMelodicLabelFile currently assumes that ICs not in this list are
'Signal', which is not the case (they should remain 'Unknown', and
the included ICs should be labelled as 'Motion').
parent d98d8f61
No related branches found
No related tags found
No related merge requests found
...@@ -429,8 +429,8 @@ class MelodicClassification(props.HasProperties): ...@@ -429,8 +429,8 @@ class MelodicClassification(props.HasProperties):
def loadMelodicLabelFile(filename): def loadMelodicLabelFile(filename):
"""Loads component labels from the specified file. The file is assuemd """Loads component labels from the specified file. The file is assuemd
to be of the format generated by FIX or Melview; such a file should to be of the format generated by FIX, Melview or ICA-AROMA; such a file
have a structure resembling the following:: should have a structure resembling the following::
filtered_func_data.ica filtered_func_data.ica
...@@ -473,6 +473,11 @@ def loadMelodicLabelFile(filename): ...@@ -473,6 +473,11 @@ def loadMelodicLabelFile(filename):
[2, 5, 6, 7] [2, 5, 6, 7]
The square brackets may or may not be present, i.e. the
following format is also accepted::
2, 5, 6, 7
In this case, the returned melodic directory path will be In this case, the returned melodic directory path will be
``None``. ``None``.
""" """
...@@ -491,11 +496,16 @@ def loadMelodicLabelFile(filename): ...@@ -491,11 +496,16 @@ def loadMelodicLabelFile(filename):
# If the file contains a single # If the file contains a single
# line, we assume that it is just # line, we assume that it is just
# a list of noise components. # a comma-separated list of noise
# components.
if len(lines) == 1: if len(lines) == 1:
# Remove any leading/trailing
# whitespace or brackets.
line = lines[0].strip(' []')
melDir = None melDir = None
noisyComps = map(int, lines[0][1:-1].split(', ')) noisyComps = [int(i) for i in line.split(',')]
allLabels = [] allLabels = []
for i in range(max(noisyComps)): for i in range(max(noisyComps)):
...@@ -507,7 +517,7 @@ def loadMelodicLabelFile(filename): ...@@ -507,7 +517,7 @@ def loadMelodicLabelFile(filename):
else: else:
melDir = lines[0] melDir = lines[0]
noisyComps = map(int, lines[-1][1:-1].split(', ')) noisyComps = map(int, lines[-1].strip(' []').split(', '))
# The melodic directory path should # The melodic directory path should
# either be an absolute path, or # either be an absolute path, or
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment