7
7
from ....interfaces .freesurfer import AddXFormToHeader , Info
8
8
from ....interfaces .io import DataSink
9
9
from .utils import getdefaultconfig
10
+ from ....pipeline .engine .base import logger
10
11
11
12
def create_skullstripped_recon_flow (name = "skullstripped_recon_all" ):
12
13
"""Performs recon-all on voulmes that are already skull stripped.
@@ -84,9 +85,8 @@ def create_reconall_workflow(name="ReconAll", plugin_args=None):
84
85
85
86
Example
86
87
-------
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()
90
90
>>> recon_all.inputs.inputspec.subject_id = 'subj1'
91
91
>>> recon_all.inputs.inputspec.subjects_dir = '.'
92
92
>>> recon_all.inputs.inputspec.T1_files = 'T1.nii.gz'
@@ -105,6 +105,17 @@ def create_reconall_workflow(name="ReconAll", plugin_args=None):
105
105
Outpus::
106
106
postdatasink_outputspec.subject_id : name of the datasinked output folder in the subjects directory
107
107
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}.
108
119
"""
109
120
reconall = pe .Workflow (name = name )
110
121
@@ -136,7 +147,8 @@ def create_reconall_workflow(name="ReconAll", plugin_args=None):
136
147
137
148
# check freesurfer version and set parameters
138
149
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 ):
140
152
# assuming that dev is 6.0
141
153
fsvernum = 6.0
142
154
fs_version = 'v6.0'
@@ -150,13 +162,17 @@ def create_reconall_workflow(name="ReconAll", plugin_args=None):
150
162
else :
151
163
# 5.3 is default
152
164
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" ))
155
174
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
160
176
th3 = False
161
177
shrink = None
162
178
distance = 50
@@ -165,7 +181,7 @@ def create_reconall_workflow(name="ReconAll", plugin_args=None):
165
181
entorhinal = False
166
182
rb_date = "2008-03-26"
167
183
168
- print ("FreeSurfer Version: {0}" .format (fs_version ))
184
+ logger . info ("FreeSurfer Version: {0}" .format (fs_version ))
169
185
170
186
def setconfig (reg_template = None ,
171
187
reg_template_withskull = None ,
0 commit comments