@@ -76,6 +76,8 @@ def hmc_pipeline(name='motion_correct'):
76
76
rot_bvec = pe .Node (niu .Function (input_names = ['in_bvec' , 'in_matrix' ],
77
77
output_names = ['out_file' ], function = rotate_bvecs ),
78
78
name = 'Rotate_Bvec' )
79
+ thres = pe .MapNode (fsl .Threshold (thresh = 0.0 ), iterfield = ['in_file' ],
80
+ name = 'RemoveNegative' )
79
81
merge = pe .Node (fsl .Merge (dimension = 't' ), name = 'MergeDWIs' )
80
82
outputnode = pe .Node (niu .IdentityInterface (fields = ['out_file' ,
81
83
'out_bvec' , 'out_xfms' ]),
@@ -91,7 +93,8 @@ def hmc_pipeline(name='motion_correct'):
91
93
,(inputnode , rot_bvec , [('in_bvec' , 'in_bvec' )])
92
94
,(flirt , rot_bvec , [('out_matrix_file' , 'in_matrix' )])
93
95
,(pick_ref , flirt , [('out' , 'reference' )])
94
- ,(flirt , merge , [('out_file' , 'in_files' )])
96
+ ,(flirt , thres , [('out_file' , 'in_file' )])
97
+ ,(thres , merge , [('out_file' , 'in_files' )])
95
98
,(merge , outputnode , [('merged_file' , 'out_file' )])
96
99
,(rot_bvec , outputnode , [('out_file' , 'out_bvec' )])
97
100
,(flirt , outputnode , [('out_matrix_file' , 'out_xfms' )])
@@ -207,9 +210,11 @@ def ecc_pipeline(name='eddy_correct'):
207
210
return wf
208
211
209
212
def sdc_fmb (name = 'fmb_correction' ,
210
- fugue_params = dict (smooth3d = 2.0 , despike_2dfilter = True ),
213
+ fugue_params = dict (smooth3d = 2.0 ),
211
214
bmap_params = dict (delta_te = 2.46e-3 ),
212
- epi_params = dict ()):
215
+ epi_params = dict (echospacing = 0.77e-3 ,
216
+ acc_factor = 3 ,
217
+ enc_dir = 'y-' )):
213
218
"""
214
219
SDC stands for susceptibility distortion correction. FMB stands for fieldmap-based.
215
220
@@ -233,6 +238,8 @@ def sdc_fmb(name='fmb_correction',
233
238
inputnode = pe .Node (niu .IdentityInterface (fields = ['in_file' , 'in_bval' , 'in_mask' ,
234
239
'bmap_pha' , 'bmap_mag' ]),
235
240
name = 'inputnode' )
241
+ outputnode = pe .Node (niu .IdentityInterface (fields = ['out_file' , 'out_vsm' ]),
242
+ name = 'outputnode' )
236
243
237
244
238
245
firstmag = pe .Node (fsl .ExtractROI (t_min = 0 , t_size = 1 ), name = 'GetFirst' )
@@ -265,37 +272,58 @@ def sdc_fmb(name='fmb_correction',
265
272
266
273
cleanup = cleanup_edge_pipeline ()
267
274
275
+ addvol = pe .Node (niu .Function (input_names = ['in_file' ], output_names = ['out_file' ],
276
+ function = add_empty_vol ), name = 'AddEmptyVol' )
277
+
278
+ vsm = pe .Node (fsl .FUGUE (save_shift = True , ** fugue_params ),
279
+ name = "ComputeVSM" )
280
+ vsm .inputs .asym_se_time = bmap_params ['delta_te' ]
281
+ vsm .inputs .dwell_time = epi_params ['echospacing' ] / (1.0 * epi_params ['acc_factor' ])
282
+
283
+ split = pe .Node (fsl .Split (dimension = 't' ), name = 'SplitDWIs' )
284
+ merge = pe .Node (fsl .Merge (dimension = 't' ), name = 'MergeDWIs' )
285
+ unwarp = pe .MapNode (fsl .FUGUE (icorr = True , forward_warping = False ),
286
+ iterfield = ['in_file' ], name = 'UnwarpDWIs' )
287
+ unwarp .inputs .unwarp_direction = epi_params ['enc_dir' ]
288
+ thres = pe .MapNode (fsl .Threshold (thresh = 0.0 ), iterfield = ['in_file' ],
289
+ name = 'RemoveNegative' )
290
+
268
291
wf = pe .Workflow (name = name )
269
292
wf .connect ([
270
- (inputnode , pha2rads , [('bmap_pha' , 'in_file' )])
271
- ,(inputnode , firstmag , [('bmap_mag' , 'in_file' )])
272
- ,(inputnode , avg_b0 , [('in_file' , 'in_dwi' ),
293
+ (inputnode , pha2rads , [('bmap_pha' , 'in_file' )])
294
+ ,(inputnode , firstmag , [('bmap_mag' , 'in_file' )])
295
+ ,(inputnode , avg_b0 , [('in_file' , 'in_dwi' ),
273
296
('in_bval' , 'in_bval' )])
274
- ,(firstmag , n4 , [('roi_file' , 'input_image' )])
275
- ,(n4 , bet , [('output_image' , 'in_file' )])
276
- ,(bet , dilate , [('mask_file' , 'in_file' )])
277
- ,(pha2rads , prelude , [('out_file' , 'phase_file' )])
278
- ,(n4 , prelude , [('output_image' , 'magnitude_file' )])
279
- ,(dilate , prelude , [('out_file' , 'mask_file' )])
280
- ,(prelude , rad2rsec , [('unwrapped_phase_file' , 'in_file' )])
281
-
282
- ,(avg_b0 , flirt , [('out_file' , 'reference' )])
283
- ,(inputnode , flirt , [('in_mask' , 'ref_weight' )])
284
- ,(n4 , flirt , [('output_image' , 'in_file' )])
285
- ,(dilate , flirt , [('out_file' , 'in_weight' )])
286
-
287
- ,(avg_b0 , applyxfm , [('out_file' , 'reference' )])
288
- ,(rad2rsec , applyxfm , [('out_file' , 'in_file' )])
289
- ,(flirt , applyxfm , [('out_matrix_file' , 'in_matrix_file' )])
290
-
291
- ,(applyxfm , pre_fugue , [('out_file' , 'fmap_in_file' )])
292
- ,(inputnode , pre_fugue , [('in_mask' , 'mask_file' )])
293
-
294
- ,(pre_fugue , demean , [('fmap_out_file' , 'in_file' )])
295
- ,(inputnode , demean , [('in_mask' , 'in_mask' )])
296
-
297
- ,(demean , cleanup , [('out_file' , 'inputnode.in_file' )])
298
- ,(inputnode , cleanup , [('in_mask' , 'inputnode.in_mask' )])
297
+ ,(firstmag , n4 , [('roi_file' , 'input_image' )])
298
+ ,(n4 , bet , [('output_image' , 'in_file' )])
299
+ ,(bet , dilate , [('mask_file' , 'in_file' )])
300
+ ,(pha2rads , prelude , [('out_file' , 'phase_file' )])
301
+ ,(n4 , prelude , [('output_image' , 'magnitude_file' )])
302
+ ,(dilate , prelude , [('out_file' , 'mask_file' )])
303
+ ,(prelude , rad2rsec , [('unwrapped_phase_file' , 'in_file' )])
304
+ ,(avg_b0 , flirt , [('out_file' , 'reference' )])
305
+ ,(inputnode , flirt , [('in_mask' , 'ref_weight' )])
306
+ ,(n4 , flirt , [('output_image' , 'in_file' )])
307
+ ,(dilate , flirt , [('out_file' , 'in_weight' )])
308
+ ,(avg_b0 , applyxfm , [('out_file' , 'reference' )])
309
+ ,(rad2rsec , applyxfm , [('out_file' , 'in_file' )])
310
+ ,(flirt , applyxfm , [('out_matrix_file' , 'in_matrix_file' )])
311
+ ,(applyxfm , pre_fugue , [('out_file' , 'fmap_in_file' )])
312
+ ,(inputnode , pre_fugue , [('in_mask' , 'mask_file' )])
313
+ ,(pre_fugue , demean , [('fmap_out_file' , 'in_file' )])
314
+ ,(inputnode , demean , [('in_mask' , 'in_mask' )])
315
+ ,(demean , cleanup , [('out_file' , 'inputnode.in_file' )])
316
+ ,(inputnode , cleanup , [('in_mask' , 'inputnode.in_mask' )])
317
+ ,(cleanup , addvol , [('outputnode.out_file' , 'in_file' )])
318
+ ,(inputnode , vsm , [('in_mask' , 'mask_file' )])
319
+ ,(addvol , vsm , [('out_file' , 'fmap_in_file' )])
320
+ ,(inputnode , split , [('in_file' , 'in_file' )])
321
+ ,(split , unwarp , [('out_files' , 'in_file' )])
322
+ ,(vsm , unwarp , [('shift_out_file' , 'shift_in_file' )])
323
+ ,(unwarp , thres , [('unwarped_file' , 'in_file' )])
324
+ ,(thres , merge , [('out_file' , 'in_files' )])
325
+ ,(merge , outputnode , [('merged_file' , 'out_file' )])
326
+ ,(vsm , outputnode , [('shift_out_file' , 'out_vsm' )])
299
327
])
300
328
return wf
301
329
0 commit comments