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