@@ -236,8 +236,8 @@ def init_bold_fit_wf(
236
236
# Boolean used to update workflow self-descriptions
237
237
multiecho = len (bold_series ) > 1
238
238
239
- have_hmcref = 'hmc_boldref' in precomputed
240
- have_coregref = 'coreg_boldref' in precomputed
239
+ hmc_boldref = precomputed . get ( 'hmc_boldref' )
240
+ coreg_boldref = precomputed . get ( 'coreg_boldref' )
241
241
# Can contain
242
242
# 1) boldref2fmap
243
243
# 2) boldref2anat
@@ -304,12 +304,19 @@ def init_bold_fit_wf(
304
304
niu .IdentityInterface (fields = ['boldref' , 'boldmask' ]), name = 'regref_buffer'
305
305
)
306
306
307
- # Set default buffer values; can be overridden by workflows
308
- hmcref_buffer .inputs .boldref = precomputed .get ('hmc_boldref' )
307
+ if hmc_boldref :
308
+ hmcref_buffer .inputs .boldref = hmc_boldref
309
+ config .loggers .workflow .debug ('Reusing motion correction reference: %s' , hmc_boldref )
310
+ if hmc_xforms :
311
+ hmc_buffer .inputs .hmc_xforms = hmc_xforms
312
+ config .loggers .workflow .debug ('Reusing motion correction transforms: %s' , hmc_xforms )
313
+ if boldref2fmap_xform :
314
+ fmapreg_buffer .inputs .boldref2fmap_xfm = boldref2fmap_xform
315
+ config .loggers .workflow .debug ('Reusing BOLD-to-fieldmap transform: %s' , boldref2fmap_xform )
316
+ if coreg_boldref :
317
+ regref_buffer .inputs .boldref = coreg_boldref
318
+ config .loggers .workflow .debug ('Reusing coregistration reference: %s' , coreg_boldref )
309
319
fmapref_buffer .inputs .sbref_files = sbref_files
310
- hmc_buffer .inputs .hmc_xforms = hmc_xforms
311
- fmapreg_buffer .inputs .boldref2fmap_xfm = boldref2fmap_xform
312
- regref_buffer .inputs .boldref = precomputed .get ('coreg_boldref' )
313
320
314
321
summary = pe .Node (
315
322
FunctionalSummary (
@@ -344,7 +351,7 @@ def init_bold_fit_wf(
344
351
345
352
func_fit_reports_wf = init_func_fit_reports_wf (
346
353
# TODO: Enable sdc report even if we find coregref
347
- sdc_correction = not (have_coregref or fieldmap_id is None ),
354
+ sdc_correction = not (coreg_boldref or fieldmap_id is None ),
348
355
freesurfer = config .workflow .run_reconall ,
349
356
output_dir = config .execution .fmriprep_dir ,
350
357
)
@@ -384,7 +391,7 @@ def init_bold_fit_wf(
384
391
niu .IdentityInterface (fields = ['in_file' ]),
385
392
name = 'hmc_boldref_source_buffer' ,
386
393
)
387
- if not have_hmcref :
394
+ if not hmc_boldref :
388
395
config .loggers .workflow .info ('Stage 1: Adding HMC boldref workflow' )
389
396
hmc_boldref_wf = init_raw_boldref_wf (
390
397
name = 'hmc_boldref_wf' ,
@@ -458,7 +465,7 @@ def init_bold_fit_wf(
458
465
459
466
# Stage 3: Create coregistration reference
460
467
# Fieldmap correction only happens during fit if this stage is needed
461
- if not have_coregref :
468
+ if not coreg_boldref :
462
469
config .loggers .workflow .info ('Stage 3: Adding coregistration boldref workflow' )
463
470
464
471
# Select initial boldref, enhance contrast, and generate mask
@@ -600,7 +607,7 @@ def init_bold_fit_wf(
600
607
# TODO: Allow precomputed bold masks to be passed
601
608
# Also needs consideration for how it interacts above
602
609
skullstrip_precomp_ref_wf = init_skullstrip_bold_wf (name = 'skullstrip_precomp_ref_wf' )
603
- skullstrip_precomp_ref_wf .inputs .inputnode .in_file = precomputed [ ' coreg_boldref' ]
610
+ skullstrip_precomp_ref_wf .inputs .inputnode .in_file = coreg_boldref
604
611
workflow .connect ([
605
612
(skullstrip_precomp_ref_wf , regref_buffer , [('outputnode.mask_file' , 'boldmask' )])
606
613
]) # fmt:skip
0 commit comments