@@ -33,7 +33,7 @@ def check_deps(workflow):
33
33
34
34
def get_parser ():
35
35
"""Build parser object."""
36
- from niworkflows .utils .spaces import Reference , SpatialReferences , OutputReferencesAction
36
+ from niworkflows .utils .spaces import Reference , OutputReferencesAction
37
37
from packaging .version import Version
38
38
from ..__about__ import __version__
39
39
from .version import check_latest , is_flagged
@@ -102,19 +102,21 @@ def get_parser():
102
102
'--longitudinal' , action = 'store_true' ,
103
103
help = 'treat dataset as longitudinal - may increase runtime' )
104
104
g_conf .add_argument (
105
- '--output-spaces' , nargs = '*' , action = OutputReferencesAction , default = SpatialReferences (),
105
+ '--output-spaces' , nargs = '*' , action = OutputReferencesAction ,
106
106
help = """\
107
107
Standard and non-standard spaces to resample anatomical and functional images to. \
108
108
Standard spaces may be specified by the form \
109
109
``<SPACE>[:cohort-<label>][:res-<resolution>][...]``, where ``<SPACE>`` is \
110
110
a keyword designating a spatial reference, and may be followed by optional, \
111
111
colon-separated parameters. \
112
112
Non-standard spaces imply specific orientations and sampling grids. \
113
+ The default value of this flag (meaning, if the argument is not include in the command line) \
114
+ is ``--output-spaces orig`` - the original space and sampling grid of the original DWI data. \
113
115
Important to note, the ``res-*`` modifier does not define the resolution used for \
114
- the spatial normalization. To generate no DWI outputs, use this option without specifying \
115
- any spatial references. For further details, please check out \
116
- https://www.nipreps.org/dmriprep /en/%s/spaces.html""" % (currentv .base_version
117
- if is_release else 'latest' ))
116
+ the spatial normalization. To generate no DWI outputs (if that is intended for some reason), \
117
+ use this option without specifying any spatial references. For further details, please check out \
118
+ https://fmriprep.readthedocs.io /en/%s/spaces.html""" % (currentv .base_version
119
+ if is_release else 'latest' ))
118
120
119
121
# ANTs options
120
122
g_ants = parser .add_argument_group ('Specific options for ANTs registrations' )
@@ -416,7 +418,11 @@ def build_workflow(opts, retval):
416
418
retval ['return_code' ] = 1
417
419
return retval
418
420
419
- output_spaces = parse_spaces (opts )
421
+ # Initialize --output-spaces if not defined
422
+ output_spaces = opts .output_spaces
423
+ if opts .output_spaces is None :
424
+ from niworkflows .utils .spaces import Reference , SpatialReferences
425
+ output_spaces = SpatialReferences ([Reference ("orig" , {})])
420
426
421
427
# Set up some instrumental utilities
422
428
run_uuid = '%s_%s' % (strftime ('%Y%m%d-%H%M%S' ), uuid .uuid4 ())
@@ -563,23 +569,6 @@ def build_workflow(opts, retval):
563
569
return retval
564
570
565
571
566
- def parse_spaces (opts ):
567
- """Ensure the spaces are correctly parsed."""
568
- from sys import stderr
569
- from collections import OrderedDict
570
- # Set the default template to 'MNI152NLin2009cAsym'
571
- output_spaces = opts .output_spaces or OrderedDict ([('MNI152NLin2009cAsym' , {})])
572
-
573
- FS_SPACES = set (['fsnative' , 'fsaverage' , 'fsaverage6' , 'fsaverage5' ])
574
- if opts .run_reconall and not list (FS_SPACES .intersection (output_spaces .keys ())):
575
- print ("""\
576
- Although ``--fs-no-reconall`` was not set (i.e., FreeSurfer is to be run), no FreeSurfer \
577
- output space (valid values are: %s) was selected. Adding default "fsaverage5" to the \
578
- list of output spaces.""" % ', ' .join (FS_SPACES ), file = stderr )
579
- output_spaces ['fsaverage5' ] = {}
580
- return output_spaces
581
-
582
-
583
572
if __name__ == '__main__' :
584
573
raise RuntimeError ("dmriprep/cli/run.py should not be run directly;\n "
585
574
"Please `pip install` dmriprep and use the `dmriprep` command" )
0 commit comments