77from ....interfaces .freesurfer import AddXFormToHeader , Info
88from ....interfaces .io import DataSink
99from .utils import getdefaultconfig
10+ from ....pipeline .engine .base import logger
1011
1112def create_skullstripped_recon_flow (name = "skullstripped_recon_all" ):
1213 """Performs recon-all on voulmes that are already skull stripped.
@@ -84,9 +85,8 @@ def create_reconall_workflow(name="ReconAll", plugin_args=None):
8485
8586 Example
8687 -------
87- >>> from nipype.workflows.smri.freesurfer import create_skullstripped_recon_flow
88- >>> import nipype.interfaces.freesurfer as fs
89- >>> recon_all = create_skullstripped_recon_flow()
88+ >>> from nipype.workflows.smri.freesurfer import create_reconall_workflow
89+ >>> recon_all = create_reconall_workflow()
9090 >>> recon_all.inputs.inputspec.subject_id = 'subj1'
9191 >>> recon_all.inputs.inputspec.subjects_dir = '.'
9292 >>> recon_all.inputs.inputspec.T1_files = 'T1.nii.gz'
@@ -105,6 +105,17 @@ def create_reconall_workflow(name="ReconAll", plugin_args=None):
105105 Outpus::
106106 postdatasink_outputspec.subject_id : name of the datasinked output folder in the subjects directory
107107
108+ Note:
109+ The input subject_id is not passed to the commands in the workflow. Commands
110+ that require subject_id are reading implicit inputs from
111+ {SUBJECTS_DIR}/{subject_id}. For those commands the subject_id is set to the
112+ default value and SUBJECTS_DIR is set to the node directory. The implicit
113+ inputs are then copied to the node directory in order to mimic a SUBJECTS_DIR
114+ structure. For example, if the command implicitly reads in brainmask.mgz, the
115+ interface would copy that input file to
116+ {node_dir}/{subject_id}/mri/brainmask.mgz and set SUBJECTS_DIR to node_dir.
117+ The workflow only uses the input subject_id to datasink the outputs to
118+ {subjects_dir}/{subject_id}.
108119 """
109120 reconall = pe .Workflow (name = name )
110121
@@ -136,7 +147,8 @@ def create_reconall_workflow(name="ReconAll", plugin_args=None):
136147
137148 # check freesurfer version and set parameters
138149 fs_version_full = Info .version ()
139- if 'v6.0' in fs_version_full or 'dev' in fs_version_full :
150+ if fs_version_full and ('v6.0' in fs_version_full or
151+ 'dev' in fs_version_full ):
140152 # assuming that dev is 6.0
141153 fsvernum = 6.0
142154 fs_version = 'v6.0'
@@ -150,13 +162,17 @@ def create_reconall_workflow(name="ReconAll", plugin_args=None):
150162 else :
151163 # 5.3 is default
152164 fsvernum = 5.3
153- if 'v5.3' in fs_version_full :
154- fs_version = 'v5.3'
165+ if fs_version_full :
166+ if 'v5.3' in fs_version_full :
167+ fs_version = 'v5.3'
168+ else :
169+ fs_version = fs_version_full .split ('-' )[- 1 ]
170+ logger .info (("Warning: Workflow may not work properly if "
171+ "FREESURFER_HOME environmental variable is not "
172+ "set or if you are using an older version of "
173+ "FreeSurfer" ))
155174 else :
156- fs_vesion = fs_version_full .split ('-' )[- 1 ]
157- print ("Warning: Workflow may not work properly if FREESURFER_HOME " +
158- "environmental variable is not set or if you are using an older " +
159- "version of FreeSurfer" )
175+ fs_version = 5.3 # assume version 5.3
160176 th3 = False
161177 shrink = None
162178 distance = 50
@@ -165,7 +181,7 @@ def create_reconall_workflow(name="ReconAll", plugin_args=None):
165181 entorhinal = False
166182 rb_date = "2008-03-26"
167183
168- print ("FreeSurfer Version: {0}" .format (fs_version ))
184+ logger . info ("FreeSurfer Version: {0}" .format (fs_version ))
169185
170186 def setconfig (reg_template = None ,
171187 reg_template_withskull = None ,
0 commit comments