@@ -92,6 +92,7 @@ def init_pepolar_estimate_wf(debug=False, generate_report=True, name="pepolar_es
92
92
from nipype .interfaces .afni import Automask
93
93
from nipype .interfaces .fsl .epi import TOPUP
94
94
from niworkflows .interfaces .nibabel import MergeSeries
95
+ from sdcflows .interfaces .fmap import get_trt
95
96
from ...interfaces .images import RescaleB0
96
97
wf = Workflow (name = name )
97
98
@@ -101,6 +102,10 @@ def init_pepolar_estimate_wf(debug=False, generate_report=True, name="pepolar_es
101
102
name = "outputnode" )
102
103
103
104
concat_blips = pe .Node (MergeSeries (), name = "concat_blips" )
105
+ readout_time = pe .MapNode (niu .Function (
106
+ input_names = ["metadata" , "in_file" ], function = get_trt ), name = "readout_time" ,
107
+ iterfield = ["metadata" , "in_file" ], run_without_submitting = True
108
+ )
104
109
105
110
topup = pe .Node (TOPUP (config = _pkg_fname (
106
111
"dmriprep" , f"data/flirtsch/b02b0{ '_quick' * debug } .cnf" )), name = "topup" )
@@ -112,8 +117,10 @@ def init_pepolar_estimate_wf(debug=False, generate_report=True, name="pepolar_es
112
117
name = "post_mask" )
113
118
wf .connect ([
114
119
(inputnode , concat_blips , [("in_data" , "in_files" )]),
115
- (inputnode , topup , [(("metadata" , _get_ro ), "readout_times" ),
116
- (("metadata" , _get_pedir ), "encoding_direction" )]),
120
+ (inputnode , readout_time , [("in_data" , "in_file" ),
121
+ ("metadata" , "metadata" )]),
122
+ (inputnode , topup , [(("metadata" , _get_pedir ), "encoding_direction" )]),
123
+ (readout_time , topup , [("out" , "readout_times" )]),
117
124
(concat_blips , topup , [("out_file" , "in_file" )]),
118
125
(topup , pre_mask , [("out_corrected" , "in_file" )]),
119
126
(pre_mask , rescale_corrected , [("out_file" , "mask_file" )]),
@@ -127,15 +134,11 @@ def init_pepolar_estimate_wf(debug=False, generate_report=True, name="pepolar_es
127
134
return wf
128
135
129
136
130
- def _get_ro (metadata ):
131
- return [m ["TotalReadoutTime" ] for m in metadata ]
132
-
133
-
134
137
def _get_pedir (metadata ):
135
138
return [m ["PhaseEncodingDirection" ].replace ("j" , "y" ).replace ("i" , "x" ).replace ("k" , "z" )
136
139
for m in metadata ]
137
140
138
141
139
- def _fname2outname (in_file ):
140
- from pathlib import Path
141
- return Path (in_file ).name .rstrip (".gz" ).rstrip (".nii" ).replace ("-" , "_" )
142
+ # def _fname2outname(in_file):
143
+ # from pathlib import Path
144
+ # return Path(in_file).name.rstrip(".gz").rstrip(".nii").replace("-", "_")
0 commit comments