@@ -80,6 +80,16 @@ def init_dwi_preproc_wf(dwi_file, has_fieldmap=False):
80
80
f"Creating DWI preprocessing workflow for <{ dwi_file .name } >"
81
81
)
82
82
83
+ if has_fieldmap :
84
+ from sdcflows .fieldmaps import get_identifier
85
+
86
+ estimator_key = get_identifier (dwi_file )
87
+ if not estimator_key :
88
+ has_fieldmap = False
89
+ config .loggers .workflow .critical (
90
+ f"None of the available B0 fieldmaps are associated to <{ dwi_file } >"
91
+ )
92
+
83
93
# Build workflow
84
94
workflow = Workflow (name = _get_wf_name (dwi_file .name ))
85
95
@@ -157,8 +167,7 @@ def init_dwi_preproc_wf(dwi_file, has_fieldmap=False):
157
167
158
168
ds_report_reg = pe .Node (
159
169
DerivativesDataSink (
160
- base_directory = str (config .execution .output_dir ),
161
- datatype = "figures" ,
170
+ base_directory = str (config .execution .output_dir ), datatype = "figures" ,
162
171
),
163
172
name = "ds_report_reg" ,
164
173
run_without_submitting = True ,
@@ -216,9 +225,6 @@ def _bold_reg_suffix(fallback):
216
225
from sdcflows .workflows .apply .registration import init_coeff2epi_wf
217
226
from sdcflows .workflows .apply .correction import init_unwarp_wf
218
227
219
- # TODO: Requires nipreps/sdcflows#148
220
- # from sdcflows.utils.fieldmap import get_identifier
221
-
222
228
coeff2epi_wf = init_coeff2epi_wf (
223
229
omp_nthreads = config .nipype .omp_nthreads , write_coeff = True
224
230
)
@@ -230,12 +236,12 @@ def _bold_reg_suffix(fallback):
230
236
name = "output_select" ,
231
237
run_without_submitting = True ,
232
238
)
233
- # estimator_key = get_identifier(dwi_file)
234
- # if len(estimator_key) != 1:
235
- # raise RuntimeError (
236
- # f"Incorrect number of fieldmap estimator IDs ({len( estimator_key)}). "
237
- # )
238
- # output_select.inputs.key = estimator_key
239
+ output_select . inputs . key = estimator_key [ 0 ]
240
+ if len (estimator_key ) > 1 :
241
+ config . loggers . workflow . warning (
242
+ f"Several fieldmaps < { ', ' . join ( estimator_key )} > are "
243
+ f"'IntendedFor' < { dwi_file } >, using { estimator_key [ 0 ] } "
244
+ )
239
245
240
246
# fmt: off
241
247
workflow .connect ([
0 commit comments