Skip to content

Commit 0d72d3e

Browse files
committed
fix: fnirt doesn't require two stages and added config file option
1 parent 9c4e9ad commit 0d72d3e

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

examples/fmri_openfmri.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ def num_copes(files):
306306
wf.connect(datasource, 'anat', registration, 'inputspec.anatomical_image')
307307
registration.inputs.inputspec.target_image = fsl.Info.standard_image('MNI152_T1_2mm.nii.gz')
308308
registration.inputs.inputspec.target_image_brain = fsl.Info.standard_image('MNI152_T1_2mm_brain.nii.gz')
309+
registration.inputs.inputspec.config_file = 'T1_2_MNI152_2mm'
309310

310311
def merge_files(copes, varcopes):
311312
out_files = []

nipype/workflows/fmri/fsl/preprocess.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,8 @@ def create_reg_workflow(name='registration'):
11051105
'mean_image',
11061106
'anatomical_image',
11071107
'target_image',
1108-
'target_image_brain']),
1108+
'target_image_brain',
1109+
'config_file']),
11091110
name='inputspec')
11101111
outputnode = pe.Node(interface=util.IdentityInterface(fields=['func2anat_transform',
11111112
'anat2target_transform',
@@ -1155,7 +1156,8 @@ def create_reg_workflow(name='registration'):
11551156
register.connect(inputnode, 'mean_image', mean2anatbbr, 'in_file')
11561157
register.connect(binarize, 'out_file', mean2anatbbr, 'wm_seg')
11571158
register.connect(inputnode, 'anatomical_image', mean2anatbbr, 'reference')
1158-
register.connect(mean2anat, 'out_matrix_file', mean2anatbbr, 'in_matrix_file')
1159+
register.connect(mean2anat, 'out_matrix_file',
1160+
mean2anatbbr, 'in_matrix_file')
11591161

11601162
"""
11611163
Calculate affine transform from anatomical to target
@@ -1166,7 +1168,8 @@ def create_reg_workflow(name='registration'):
11661168
anat2target_affine.inputs.searchr_y = [-180, 180]
11671169
anat2target_affine.inputs.searchr_z = [-180, 180]
11681170
register.connect(stripper, 'out_file', anat2target_affine, 'in_file')
1169-
register.connect(inputnode, 'target_image_brain', anat2target_affine, 'reference')
1171+
register.connect(inputnode, 'target_image_brain',
1172+
anat2target_affine, 'reference')
11701173

11711174
"""
11721175
Calculate nonlinear transform from anatomical to target
@@ -1177,21 +1180,20 @@ def create_reg_workflow(name='registration'):
11771180
register.connect(anat2target_affine, 'out_matrix_file',
11781181
anat2target_nonlinear, 'affine_file')
11791182
anat2target_nonlinear.inputs.warp_resolution = (8, 8, 8)
1180-
register.connect(inputnode, 'anatomical_image', anat2target_nonlinear, 'in_file')
1183+
register.connect(inputnode, 'anatomical_image',
1184+
anat2target_nonlinear, 'in_file')
1185+
register.connect(inputnode, 'config_file',
1186+
anat2target_nonlinear, 'config_file')
11811187
register.connect(inputnode, 'target_image',
11821188
anat2target_nonlinear, 'ref_file')
11831189

11841190
"""
11851191
Transform the mean image. First to anatomical and then to target
11861192
"""
11871193

1188-
warp2anat = pe.Node(fsl.ApplyWarp(interp='spline'), name='warp2anat')
1189-
register.connect(inputnode, 'mean_image', warp2anat, 'in_file')
1190-
register.connect(inputnode, 'anatomical_image', warp2anat, 'ref_file')
1191-
register.connect(mean2anatbbr, 'out_matrix_file', warp2anat, 'premat')
1192-
1193-
warpmean = warp2anat.clone(name='warpmean')
1194-
register.connect(warp2anat, 'out_file', warpmean, 'in_file')
1194+
warpmean = pe.Node(fsl.ApplyWarp(interp='spline'), name='warpmean')
1195+
register.connect(inputnode, 'mean_image', warpmean, 'in_file')
1196+
register.connect(mean2anatbbr, 'out_matrix_file', warpmean, 'premat')
11951197
register.connect(inputnode, 'target_image', warpmean, 'ref_file')
11961198
register.connect(anat2target_nonlinear, 'fieldcoeff_file',
11971199
warpmean, 'field_file')
@@ -1200,15 +1202,11 @@ def create_reg_workflow(name='registration'):
12001202
Transform the remaining images. First to anatomical and then to target
12011203
"""
12021204

1203-
warpall2anat = pe.MapNode(fsl.ApplyWarp(interp='spline'),
1204-
iterfield=['in_file'],
1205-
name='warpall2anat')
1206-
register.connect(inputnode, 'source_files', warpall2anat, 'in_file')
1207-
register.connect(inputnode, 'anatomical_image', warpall2anat, 'ref_file')
1208-
register.connect(mean2anatbbr, 'out_matrix_file', warpall2anat, 'premat')
1209-
1210-
warpall = warpall2anat.clone(name='warpall')
1211-
register.connect(warpall2anat, 'out_file', warpall, 'in_file')
1205+
warpall = pe.MapNode(fsl.ApplyWarp(interp='spline'),
1206+
iterfield=['in_file'],
1207+
name='warpall')
1208+
register.connect(inputnode, 'source_files', warpall, 'in_file')
1209+
register.connect(mean2anatbbr, 'out_matrix_file', warpall, 'premat')
12121210
register.connect(inputnode, 'target_image', warpall, 'ref_file')
12131211
register.connect(anat2target_nonlinear, 'fieldcoeff_file',
12141212
warpall, 'field_file')

0 commit comments

Comments
 (0)