From 383372339889c55446a239411e165577973d3ff0 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 18 Dec 2024 16:14:23 -0500 Subject: [PATCH] fix: Use consistent skull-stripping pre- and post- SDC --- fmriprep/workflows/bold/fit.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/fmriprep/workflows/bold/fit.py b/fmriprep/workflows/bold/fit.py index c874b3fe..660fc024 100644 --- a/fmriprep/workflows/bold/fit.py +++ b/fmriprep/workflows/bold/fit.py @@ -27,7 +27,7 @@ import nibabel as nb from nipype.interfaces import utility as niu from nipype.pipeline import engine as pe -from niworkflows.func.util import init_enhance_and_skullstrip_bold_wf +from niworkflows.func.util import init_enhance_and_skullstrip_bold_wf, init_skullstrip_bold_wf from niworkflows.interfaces.header import ValidateImage from niworkflows.interfaces.nitransforms import ConcatenateXFMs from niworkflows.interfaces.utility import KeySelect @@ -553,7 +553,8 @@ def init_bold_fit_wf( ) unwarp_wf.inputs.inputnode.metadata = layout.get_metadata(bold_file) - # fmt:off + skullstrip_bold_wf = init_skullstrip_bold_wf() + workflow.connect([ (inputnode, fmap_select, [ ('fmap_ref', 'fmap_ref'), @@ -578,8 +579,11 @@ def init_bold_fit_wf( (unwarp_wf, ds_coreg_boldref_wf, [ ('outputnode.corrected', 'inputnode.boldref'), ]), - (unwarp_wf, ds_boldmask_wf, [ - ('outputnode.corrected_mask', 'inputnode.boldmask'), + (unwarp_wf, skullstrip_bold_wf, [ + ('outputnode.corrected', 'inputnode.in_file'), + ]), + (skullstrip_bold_wf, ds_boldmask_wf, [ + ('outputnode.mask_file', 'inputnode.boldmask'), ]), (fmap_select, func_fit_reports_wf, [('fmap_ref', 'inputnode.fmap_ref')]), (fmap_select, summary, [('sdc_method', 'distortion_correction')]), @@ -587,10 +591,8 @@ def init_bold_fit_wf( ('boldref2fmap_xfm', 'inputnode.boldref2fmap_xfm'), ]), (unwarp_wf, func_fit_reports_wf, [('outputnode.fieldmap', 'inputnode.fieldmap')]), - ]) - # fmt:on + ]) # fmt:skip else: - # fmt:off workflow.connect([ (enhance_boldref_wf, ds_coreg_boldref_wf, [ ('outputnode.bias_corrected_file', 'inputnode.boldref'), @@ -598,8 +600,7 @@ def init_bold_fit_wf( (enhance_boldref_wf, ds_boldmask_wf, [ ('outputnode.mask_file', 'inputnode.boldmask'), ]), - ]) - # fmt:on + ]) # fmt:skip else: config.loggers.workflow.info('Found coregistration reference - skipping Stage 3') regref_buffer.inputs.boldref = precomputed['coreg_boldref']