Skip to content

Commit ed8804e

Browse files
authored
fix: Use consistent skull-stripping pre- and post- SDC (#3415)
Overall seems safe, the `skullstrip_wf` is extracted from the `enhance_and_skullstrip_wf`, skipping reruns.
2 parents fe6bfa0 + 3833723 commit ed8804e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

fmriprep/workflows/bold/fit.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import nibabel as nb
2828
from nipype.interfaces import utility as niu
2929
from nipype.pipeline import engine as pe
30-
from niworkflows.func.util import init_enhance_and_skullstrip_bold_wf
30+
from niworkflows.func.util import init_enhance_and_skullstrip_bold_wf, init_skullstrip_bold_wf
3131
from niworkflows.interfaces.header import ValidateImage
3232
from niworkflows.interfaces.nitransforms import ConcatenateXFMs
3333
from niworkflows.interfaces.utility import KeySelect
@@ -553,7 +553,8 @@ def init_bold_fit_wf(
553553
)
554554
unwarp_wf.inputs.inputnode.metadata = layout.get_metadata(bold_file)
555555

556-
# fmt:off
556+
skullstrip_bold_wf = init_skullstrip_bold_wf()
557+
557558
workflow.connect([
558559
(inputnode, fmap_select, [
559560
('fmap_ref', 'fmap_ref'),
@@ -578,28 +579,28 @@ def init_bold_fit_wf(
578579
(unwarp_wf, ds_coreg_boldref_wf, [
579580
('outputnode.corrected', 'inputnode.boldref'),
580581
]),
581-
(unwarp_wf, ds_boldmask_wf, [
582-
('outputnode.corrected_mask', 'inputnode.boldmask'),
582+
(unwarp_wf, skullstrip_bold_wf, [
583+
('outputnode.corrected', 'inputnode.in_file'),
584+
]),
585+
(skullstrip_bold_wf, ds_boldmask_wf, [
586+
('outputnode.mask_file', 'inputnode.boldmask'),
583587
]),
584588
(fmap_select, func_fit_reports_wf, [('fmap_ref', 'inputnode.fmap_ref')]),
585589
(fmap_select, summary, [('sdc_method', 'distortion_correction')]),
586590
(fmapreg_buffer, func_fit_reports_wf, [
587591
('boldref2fmap_xfm', 'inputnode.boldref2fmap_xfm'),
588592
]),
589593
(unwarp_wf, func_fit_reports_wf, [('outputnode.fieldmap', 'inputnode.fieldmap')]),
590-
])
591-
# fmt:on
594+
]) # fmt:skip
592595
else:
593-
# fmt:off
594596
workflow.connect([
595597
(enhance_boldref_wf, ds_coreg_boldref_wf, [
596598
('outputnode.bias_corrected_file', 'inputnode.boldref'),
597599
]),
598600
(enhance_boldref_wf, ds_boldmask_wf, [
599601
('outputnode.mask_file', 'inputnode.boldmask'),
600602
]),
601-
])
602-
# fmt:on
603+
]) # fmt:skip
603604
else:
604605
config.loggers.workflow.info('Found coregistration reference - skipping Stage 3')
605606
regref_buffer.inputs.boldref = precomputed['coreg_boldref']

0 commit comments

Comments
 (0)