diff --git a/smriprep/cli/utils.py b/smriprep/cli/utils.py index 2b0a0c6cf2..c624b17d90 100644 --- a/smriprep/cli/utils.py +++ b/smriprep/cli/utils.py @@ -38,12 +38,6 @@ def output_space(value): """Parse one element of ``--output-spaces``.""" tpl_args = value.split(':') template = tpl_args[0] - spaces = [] - for modifier in tpl_args[1:]: - spec = {} - mitems = modifier.split('-', 1) - spec[mitems[0]] = len(mitems) == 1 or mitems[1] - spaces.append((template, spec)) if template in ParseTemplates.EXCEPTIONS or template in LEGACY_SPACES: return [(template, {})] @@ -53,6 +47,14 @@ def output_space(value): Template identifier "{}" not found. Please, make sure TemplateFlow is \ correctly installed and contains the given template identifiers.""".format(template)) + spaces = [] + for modifiers in tpl_args[1:]: + spec = {} + for modifier in modifiers.split(','): + mitems = modifier.split('-', 1) + spec[mitems[0]] = len(mitems) == 1 or mitems[1] + spaces.append((template, spec)) + if not spaces: spaces.append((template, {})) return spaces