@@ -13,11 +13,10 @@ def transpose(samples_over_fibres):
13
13
a = a .reshape (- 1 , 1 )
14
14
return a .T .tolist ()
15
15
16
-
17
- def create_dmri_preprocessing (name = "dMRI_preprocessing" , fieldmap_registration = False ):
16
+ def create_dmri_preprocessing (name = "dMRI_preprocessing" , use_fieldmap = True , fieldmap_registration = False ):
18
17
"""Creates a workflow that chains the necessary pipelines to
19
- correct for motion, eddy currents, and susceptibility
20
- artifacts in EPI dMRI sequences.
18
+ correct for motion, eddy currents, and, if selected, susceptibility
19
+ artifacts in EPI dMRI sequences.
21
20
22
21
.. warning::
23
22
@@ -63,9 +62,9 @@ def create_dmri_preprocessing(name="dMRI_preprocessing", fieldmap_registration=F
63
62
64
63
65
64
Optional arguments::
66
-
65
+ use_fieldmap - True if there are fieldmap files that should be used (default True)
67
66
fieldmap_registration - True if registration to fieldmap should be performed (default False)
68
-
67
+
69
68
70
69
"""
71
70
@@ -83,17 +82,42 @@ def create_dmri_preprocessing(name="dMRI_preprocessing", fieldmap_registration=F
83
82
84
83
motion = create_motion_correct_pipeline ()
85
84
eddy = create_eddy_correct_pipeline ()
86
- susceptibility = create_susceptibility_correct_pipeline (
85
+
86
+ if use_fieldmap : # we have a fieldmap, so lets use it (yay!)
87
+ susceptibility = create_susceptibility_correct_pipeline (
87
88
fieldmap_registration = fieldmap_registration )
88
-
89
- pipeline .connect ([
90
- (inputnode , motion , [('in_file' , 'inputnode.in_file' ), (
91
- 'in_bvec' , 'inputnode.in_bvec' ), ('ref_num' , 'inputnode.ref_num' )]), (inputnode , eddy , [('ref_num' , 'inputnode.ref_num' )]), (motion , eddy , [('outputnode.motion_corrected' , 'inputnode.in_file' )]), (eddy , susceptibility , [('outputnode.eddy_corrected' , 'inputnode.in_file' )]), (inputnode , susceptibility , [('ref_num' , 'inputnode.ref_num' ), ('fieldmap_mag' , 'inputnode.fieldmap_mag' ), ('fieldmap_pha' , 'inputnode.fieldmap_pha' ), ('te_diff' , 'inputnode.te_diff' ), ('epi_echospacing' , 'inputnode.epi_echospacing' ), ('epi_rev_encoding' , 'inputnode.epi_rev_encoding' ), ('pi_accel_factor' , 'inputnode.pi_accel_factor' ), ('vsm_sigma' , 'inputnode.vsm_sigma' )]), (motion , outputnode , [('outputnode.out_bvec' , 'bvec_rotated' )]), (susceptibility , outputnode , [('outputnode.epi_corrected' , 'dmri_corrected' )])
92
- ])
89
+
90
+ pipeline .connect ([
91
+ (inputnode , motion , [('in_file' , 'inputnode.in_file' ),
92
+ ('in_bvec' , 'inputnode.in_bvec' ),
93
+ ('ref_num' , 'inputnode.ref_num' )]),
94
+ (inputnode , eddy , [('ref_num' , 'inputnode.ref_num' )]),
95
+ (motion , eddy , [('outputnode.motion_corrected' , 'inputnode.in_file' )]),
96
+ (eddy , susceptibility , [('outputnode.eddy_corrected' , 'inputnode.in_file' )]),
97
+ (inputnode , susceptibility , [('ref_num' , 'inputnode.ref_num' ),
98
+ ('fieldmap_mag' , 'inputnode.fieldmap_mag' ),
99
+ ('fieldmap_pha' , 'inputnode.fieldmap_pha' ),
100
+ ('te_diff' , 'inputnode.te_diff' ),
101
+ ('epi_echospacing' , 'inputnode.epi_echospacing' ),
102
+ ('epi_rev_encoding' , 'inputnode.epi_rev_encoding' ),
103
+ ('pi_accel_factor' , 'inputnode.pi_accel_factor' ),
104
+ ('vsm_sigma' , 'inputnode.vsm_sigma' )]),
105
+ (motion , outputnode , [('outputnode.out_bvec' , 'bvec_rotated' )]),
106
+ (susceptibility , outputnode , [('outputnode.epi_corrected' , 'dmri_corrected' )])
107
+ ])
108
+ else : # we don't have a fieldmap, so we just carry on without it :(
109
+ pipeline .connect ([
110
+ (inputnode , motion , [('in_file' , 'inputnode.in_file' ),
111
+ ('in_bvec' , 'inputnode.in_bvec' ),
112
+ ('ref_num' , 'inputnode.ref_num' )]),
113
+ (inputnode , eddy , [('ref_num' , 'inputnode.ref_num' )]),
114
+ (motion , eddy , [('outputnode.motion_corrected' , 'inputnode.in_file' )]),
115
+ (motion , outputnode , [('outputnode.out_bvec' , 'bvec_rotated' )]),
116
+ (eddy , outputnode , [('outputnode.eddy_corrected' , 'dmri_corrected' )])
117
+ ])
93
118
94
119
return pipeline
95
120
96
-
97
121
def create_bedpostx_pipeline (name = "bedpostx" ):
98
122
"""Creates a pipeline that does the same as bedpostx script from FSL -
99
123
calculates diffusion model parameters (distributions not MLE) voxelwise for
0 commit comments