@@ -19,38 +19,41 @@ def all_fmb_pipeline(name='hmc_sdc_ecc',
19
19
acc_factor = 3 ,
20
20
enc_dir = 'y-' )):
21
21
"""
22
- Builds a pipeline including three artifact corrections: head-motion correction (HMC),
23
- susceptibility-derived distortion correction (SDC), and Eddy currents-derived distortion
24
- correction (ECC).
22
+ Builds a pipeline including three artifact corrections: head-motion
23
+ correction (HMC), susceptibility-derived distortion correction (SDC),
24
+ and Eddy currents-derived distortion correction (ECC).
25
25
26
26
The displacement fields from each kind of distortions are combined. Thus,
27
27
only one interpolation occurs between input data and result.
28
28
29
- .. warning:: this workflow rotates the gradients table (*b*-vectors) [Leemans09]_.
29
+ .. warning:: this workflow rotates the gradients table (*b*-vectors)
30
+ [Leemans09]_.
30
31
31
32
32
33
"""
33
- inputnode = pe .Node (niu .IdentityInterface (fields = ['in_file' , 'in_bvec' , 'in_bval' ,
34
- 'bmap_pha' , 'bmap_mag' ]), name = 'inputnode' )
35
-
36
- outputnode = pe .Node (niu .IdentityInterface (fields = ['out_file' , 'out_mask' , 'out_bvec' ]),
37
- name = 'outputnode' )
38
-
34
+ inputnode = pe .Node (niu .IdentityInterface (fields = ['in_file' , 'in_bvec' ,
35
+ 'in_bval' , 'bmap_pha' , 'bmap_mag' ]), name = 'inputnode' )
39
36
37
+ outputnode = pe .Node (niu .IdentityInterface (fields = ['out_file' , 'out_mask' ,
38
+ 'out_bvec' ]), name = 'outputnode' )
40
39
avg_b0_0 = pe .Node (niu .Function (input_names = ['in_dwi' , 'in_bval' ],
41
- output_names = ['out_file' ], function = b0_average ), name = 'b0_avg_pre' )
40
+ output_names = ['out_file' ], function = b0_average ),
41
+ name = 'b0_avg_pre' )
42
42
avg_b0_1 = pe .Node (niu .Function (input_names = ['in_dwi' , 'in_bval' ],
43
- output_names = ['out_file' ], function = b0_average ), name = 'b0_avg_post' )
44
- bet_dwi0 = pe .Node (fsl .BET (frac = 0.3 , mask = True , robust = True ), name = 'bet_dwi_pre' )
45
- bet_dwi1 = pe .Node (fsl .BET (frac = 0.3 , mask = True , robust = True ), name = 'bet_dwi_post' )
43
+ output_names = ['out_file' ], function = b0_average ),
44
+ name = 'b0_avg_post' )
45
+ bet_dwi0 = pe .Node (fsl .BET (frac = 0.3 , mask = True , robust = True ),
46
+ name = 'bet_dwi_pre' )
47
+ bet_dwi1 = pe .Node (fsl .BET (frac = 0.3 , mask = True , robust = True ),
48
+ name = 'bet_dwi_post' )
46
49
47
50
hmc = hmc_pipeline ()
48
51
sdc = sdc_fmb (fugue_params = fugue_params , bmap_params = bmap_params ,
49
52
epi_params = epi_params )
50
53
ecc = ecc_pipeline ()
51
54
unwarp = apply_all_corrections ()
52
55
53
- wf = pe .Workflow ('dMRI_Artifacts' )
56
+ wf = pe .Workflow (name = name )
54
57
wf .connect ([
55
58
(inputnode , hmc , [('in_file' , 'inputnode.in_file' ),
56
59
('in_bvec' , 'inputnode.in_bvec' ),
@@ -64,6 +67,7 @@ def all_fmb_pipeline(name='hmc_sdc_ecc',
64
67
,(inputnode , sdc , [('in_bval' , 'inputnode.in_bval' ),
65
68
('bmap_pha' , 'inputnode.bmap_pha' ),
66
69
('bmap_mag' , 'inputnode.bmap_mag' )])
70
+ ,(hmc , ecc , [('outputnode.out_xfms' , 'inputnode.in_xfms' )])
67
71
,(inputnode , ecc , [('in_file' , 'inputnode.in_file' ),
68
72
('in_bval' , 'inputnode.in_bval' )])
69
73
,(bet_dwi0 , ecc , [('mask_file' , 'inputnode.in_mask' )])
@@ -93,34 +97,39 @@ def all_peb_pipeline(name='hmc_sdc_ecc',
93
97
enc_dir = 'y' ,
94
98
epi_factor = 1 )):
95
99
"""
96
- Builds a pipeline including three artifact corrections: head-motion correction (HMC),
97
- susceptibility-derived distortion correction (SDC), and Eddy currents-derived distortion
98
- correction (ECC).
100
+ Builds a pipeline including three artifact corrections: head-motion
101
+ correction (HMC), susceptibility-derived distortion correction (SDC),
102
+ and Eddy currents-derived distortion correction (ECC).
99
103
100
- .. warning:: this workflow rotates the gradients table (*b*-vectors) [Leemans09]_.
104
+ .. warning:: this workflow rotates the gradients table (*b*-vectors)
105
+ [Leemans09]_.
101
106
102
107
103
108
"""
104
- inputnode = pe .Node (niu .IdentityInterface (fields = ['in_file' , 'in_bvec' , 'in_bval' ,
105
- 'alt_file' ]), name = 'inputnode' )
109
+ inputnode = pe .Node (niu .IdentityInterface (fields = ['in_file' , 'in_bvec' ,
110
+ 'in_bval' , ' alt_file' ]), name = 'inputnode' )
106
111
107
112
outputnode = pe .Node (niu .IdentityInterface (fields = ['out_file' , 'out_mask' ,
108
113
'out_bvec' ]), name = 'outputnode' )
109
114
110
115
avg_b0_0 = pe .Node (niu .Function (input_names = ['in_dwi' , 'in_bval' ],
111
- output_names = ['out_file' ], function = b0_average ), name = 'b0_avg_pre' )
116
+ output_names = ['out_file' ], function = b0_average ),
117
+ name = 'b0_avg_pre' )
112
118
avg_b0_1 = pe .Node (niu .Function (input_names = ['in_dwi' , 'in_bval' ],
113
- output_names = ['out_file' ], function = b0_average ), name = 'b0_avg_post' )
114
- bet_dwi0 = pe .Node (fsl .BET (frac = 0.3 , mask = True , robust = True ), name = 'bet_dwi_pre' )
115
- bet_dwi1 = pe .Node (fsl .BET (frac = 0.3 , mask = True , robust = True ), name = 'bet_dwi_post' )
119
+ output_names = ['out_file' ], function = b0_average ),
120
+ name = 'b0_avg_post' )
121
+ bet_dwi0 = pe .Node (fsl .BET (frac = 0.3 , mask = True , robust = True ),
122
+ name = 'bet_dwi_pre' )
123
+ bet_dwi1 = pe .Node (fsl .BET (frac = 0.3 , mask = True , robust = True ),
124
+ name = 'bet_dwi_post' )
116
125
117
126
hmc = hmc_pipeline ()
118
127
sdc = sdc_peb (epi_params = epi_params , altepi_params = altepi_params )
119
128
ecc = ecc_pipeline ()
120
129
121
130
unwarp = apply_all_corrections ()
122
131
123
- wf = pe .Workflow ('dMRI_Artifacts' )
132
+ wf = pe .Workflow (name = name )
124
133
wf .connect ([
125
134
(inputnode , hmc , [('in_file' , 'inputnode.in_file' ),
126
135
('in_bvec' , 'inputnode.in_bvec' ),
@@ -136,6 +145,7 @@ def all_peb_pipeline(name='hmc_sdc_ecc',
136
145
,(inputnode , ecc , [('in_file' , 'inputnode.in_file' ),
137
146
('in_bval' , 'inputnode.in_bval' )])
138
147
,(bet_dwi0 , ecc , [('mask_file' , 'inputnode.in_mask' )])
148
+ ,(hmc , ecc , [('outputnode.out_xfms' , 'inputnode.in_xfms' )])
139
149
,(ecc , avg_b0_1 , [('outputnode.out_file' , 'in_dwi' )])
140
150
,(inputnode , avg_b0_1 , [('in_bval' , 'in_bval' )])
141
151
,(avg_b0_1 , bet_dwi1 , [('out_file' , 'in_file' )])
@@ -173,8 +183,8 @@ def all_fsl_pipeline(name='fsl_all_correct',
173
183
174
184
"""
175
185
176
- inputnode = pe .Node (niu .IdentityInterface (fields = ['in_file' , 'in_bvec' , 'in_bval' ,
177
- 'alt_file' ]), name = 'inputnode' )
186
+ inputnode = pe .Node (niu .IdentityInterface (fields = ['in_file' , 'in_bvec' ,
187
+ 'in_bval' , ' alt_file' ]), name = 'inputnode' )
178
188
179
189
outputnode = pe .Node (niu .IdentityInterface (fields = ['out_file' , 'out_mask' ,
180
190
'out_bvec' ]), name = 'outputnode' )
@@ -205,7 +215,7 @@ def _gen_index(in_file):
205
215
bet_dwi1 = pe .Node (fsl .BET (frac = 0.3 , mask = True , robust = True ),
206
216
name = 'bet_dwi_post' )
207
217
208
- wf = pe .Workflow ('dMRI_Artifacts_FSL' )
218
+ wf = pe .Workflow (name = name )
209
219
wf .connect ([
210
220
(inputnode , avg_b0_0 , [('in_file' , 'in_dwi' ),
211
221
('in_bval' , 'in_bval' )])
@@ -299,10 +309,13 @@ def hmc_pipeline(name='motion_correct'):
299
309
outputnode.out_xfms - list of transformation matrices
300
310
301
311
"""
312
+ from nipype .workflows .data import get_flirt_schedule
313
+
302
314
params = dict (dof = 6 , bgvalue = 0 , save_log = True ,
303
315
searchr_x = [- 3 , 3 ], searchr_y = [- 3 , 3 ], searchr_z = [- 3 , 3 ],
304
316
fine_search = 1 , coarse_search = 2 ,
305
- cost = 'mutualinfo' , cost_func = 'mutualinfo' , bins = 64 )
317
+ #cost='mutualinfo', cost_func='mutualinfo', bins=64,
318
+ schedule = get_flirt_schedule ('hmc' ))
306
319
307
320
inputnode = pe .Node (niu .IdentityInterface (fields = ['in_file' , 'ref_num' ,
308
321
'in_bvec' , 'in_bval' , 'in_mask' ]), name = 'inputnode' )
@@ -401,7 +414,10 @@ def ecc_pipeline(name='eddy_correct'):
401
414
outputnode.out_file - corrected dwi file
402
415
outputnode.out_xfms - list of transformation matrices
403
416
"""
404
- params = dict (dof = 12 , no_search = True , interp = 'spline' , bgvalue = 0 , save_log = True )
417
+
418
+ from nipype .workflows .data import get_flirt_schedule
419
+ params = dict (dof = 12 , no_search = True , interp = 'spline' , bgvalue = 0 ,
420
+ schedule = get_flirt_schedule ('ecc' ))
405
421
# cost='normmi', cost_func='normmi', bins=64,
406
422
407
423
inputnode = pe .Node (niu .IdentityInterface (fields = ['in_file' , 'in_bval' ,
0 commit comments