Skip to content

Commit 54e336c

Browse files
committed
fix(workflow): move validation of SBRefs to an earlier point, ensuring the node is conditionally created
1 parent d245877 commit 54e336c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

fmriprep/workflows/bold/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,12 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer,
346346
name='inputnode')
347347
inputnode.inputs.bold_file = bold_file
348348
if sbref_file is not None:
349-
inputnode.inputs.sbref_file = sbref_file
349+
from niworkflows.interfaces.images import ValidateImage
350+
val_sbref = pe.Node(ValidateImage(), name='val_sbref')
351+
val_sbref.inputs.in_file = sbref_file
352+
workflow.connect([
353+
(val_sbref, inputnode, [('out_file', 'sbref_file')]),
354+
])
350355

351356
outputnode = pe.Node(niu.IdentityInterface(
352357
fields=['bold_t1', 'bold_t1_ref', 'bold_mask_t1', 'bold_aseg_t1', 'bold_aparc_t1',

fmriprep/workflows/bold/util.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ def init_bold_reference_wf(omp_nthreads, bold_file=None, pre_mask=False,
112112
inputnode.inputs.bold_file = bold_file
113113

114114
validate = pe.Node(ValidateImage(), name='validate', mem_gb=DEFAULT_MEMORY_MIN_GB)
115-
val_sbref = pe.Node(ValidateImage(), name='val_sbref')
116115

117116
gen_ref = pe.Node(EstimateReferenceImage(), name="gen_ref",
118117
mem_gb=1) # OE: 128x128x128x50 * 64 / 8 ~ 900MB.
@@ -124,9 +123,8 @@ def init_bold_reference_wf(omp_nthreads, bold_file=None, pre_mask=False,
124123
workflow.connect([
125124
(inputnode, enhance_and_skullstrip_bold_wf, [('bold_mask', 'inputnode.pre_mask')]),
126125
(inputnode, validate, [('bold_file', 'in_file')]),
127-
(inputnode, val_sbref, [('sbref_file', 'in_file')]),
126+
(inputnode, gen_ref, [('sbref_file', 'sbref_file')]),
128127
(validate, gen_ref, [('out_file', 'in_file')]),
129-
(val_sbref, gen_ref, [('out_file', 'sbref_file')]),
130128
(gen_ref, validate_ref, [('ref_image', 'in_file')]),
131129
(validate_ref, enhance_and_skullstrip_bold_wf, [('out_file', 'inputnode.in_file')]),
132130
(validate, outputnode, [('out_file', 'bold_file'),

0 commit comments

Comments
 (0)