Skip to content

Commit 5137852

Browse files
committed
FIX: Ensure T2w is passed into coreg workflow
1 parent bc35adf commit 5137852

File tree

1 file changed

+22
-21
lines changed
  • nibabies/workflows/anatomical

1 file changed

+22
-21
lines changed

nibabies/workflows/anatomical/base.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def init_infant_anat_wf(
220220
t1w_aseg = False
221221
if t2w_mask:
222222
t1w_mask = False
223-
223+
# Otherwise, prioritize T1 derivatives
224224
if t1w_mask:
225225
t2w_mask = False
226226
if t1w_aseg:
@@ -384,26 +384,27 @@ def init_infant_anat_wf(
384384
])
385385

386386
# Derivative mask is present
387-
if derivatives.mask:
388-
if t1w_mask:
389-
t1w_template_wf.inputs.inputnode.anat_mask = derivatives.t1w_mask
390-
t1w_template_wf.inputs.inputnode.mask_reference = derivatives.references['t1w_mask']
391-
# fmt:off
392-
wf.connect([
393-
(t1w_template_wf, coregistration_wf, [('outputnode.anat_mask', 'inputnode.in_mask')]),
394-
(t2w_preproc_wf, coregistration_wf, [('outputnode.anat_preproc', 'inputnode.in_t2w')]),
395-
(t1w_template_wf, coreg_deriv_wf, [('outputnode.anat_mask', 'inputnode.t1w_mask')]),
396-
(coreg_deriv_wf, deriv_buffer, [('outputnode.t2w_mask', 't2w_mask')])
397-
])
398-
# fmt:on
399-
elif t2w_mask:
400-
t2w_template_wf.inputs.inputnode.anat_mask = derivatives.t2w_mask
401-
t2w_template_wf.inputs.inputnode.mask_reference = derivatives.references['t2w_mask']
402-
403-
wf.connect([
404-
(t2w_template_wf, coregistration_wf, [('outputnode.anat_mask', 'inputnode.in_mask')]),
405-
(t2w_template_wf, deriv_buffer, [('outputnode.anat_mask', 't2w_mask')]),
406-
])
387+
if t1w_mask:
388+
t1w_template_wf.inputs.inputnode.anat_mask = derivatives.t1w_mask
389+
t1w_template_wf.inputs.inputnode.mask_reference = derivatives.references['t1w_mask']
390+
# fmt:off
391+
wf.connect([
392+
(t1w_template_wf, coregistration_wf, [('outputnode.anat_mask', 'inputnode.in_mask')]),
393+
(t2w_preproc_wf, coregistration_wf, [('outputnode.anat_preproc', 'inputnode.in_t2w')]),
394+
(t1w_template_wf, coreg_deriv_wf, [('outputnode.anat_mask', 'inputnode.t1w_mask')]),
395+
(coreg_deriv_wf, deriv_buffer, [('outputnode.t2w_mask', 't2w_mask')])
396+
])
397+
# fmt:on
398+
elif t2w_mask:
399+
t2w_template_wf.inputs.inputnode.anat_mask = derivatives.t2w_mask
400+
t2w_template_wf.inputs.inputnode.mask_reference = derivatives.references['t2w_mask']
401+
# fmt:on
402+
wf.connect([
403+
(t2w_template_wf, coregistration_wf, [('outputnode.anat_mask', 'inputnode.in_mask')]),
404+
(t2w_preproc_wf, coregistration_wf, [('outputnode.anat_preproc', 'inputnode.in_t2w')]),
405+
(t2w_template_wf, deriv_buffer, [('outputnode.anat_mask', 't2w_mask')]),
406+
])
407+
# fmt:off
407408
else:
408409
# Run brain extraction on the T2w
409410
brain_extraction_wf = init_infant_brain_extraction_wf(

0 commit comments

Comments
 (0)