Skip to content

Commit 1f762ed

Browse files
committed
FIX: Derivative coregistration inconsistencies
1 parent daab431 commit 1f762ed

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

nibabies/workflows/anatomical/base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,11 @@ def init_infant_anat_wf(
348348
name='deriv_buffer',
349349
)
350350
if derivatives:
351-
wf.connect(
352-
coregistration_wf, 'outputnode.t1w2t2w_xfm', coreg_deriv_wf, 'inputnode.t1w2t2w_xfm'
353-
)
351+
wf.connect([
352+
(coregistration_wf, coreg_deriv_wf, [('outputnode.t1w2t2w_xfm', 'inputnode.t1w2t2w_xfm')]),
353+
(t1w_preproc_wf, coreg_deriv_wf, [('outputnode.anat_preproc', 'inputnode.t1w_ref')]),
354+
(t2w_preproc_wf, coreg_deriv_wf, [('outputnode.anat_preproc', 'inputnode.t2w_ref')]),
355+
])
354356

355357
# Derivative mask is present
356358
if derivatives.mask:

nibabies/workflows/anatomical/registration.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,13 @@ def init_coregister_derivatives_wf(
240240
workflow = pe.Workflow(name=name)
241241
inputnode = pe.Node(
242242
niu.IdentityInterface(
243-
fields=['t1w_ref', 't2w_ref', 't1w_mask', 't1w_aseg', 't2w_aseg', 't1w2t2w_xfm']
243+
fields=['t1w_ref', 't2w_ref', 't1w2t2w_xfm', 't1w_mask', 't1w_aseg', 't2w_aseg']
244244
),
245245
name='inputnode',
246246
)
247-
outputnode = pe.Node(niu.IdentityInterface(fields=['t2w_mask', 't1w_aseg']), name='outputnode')
247+
outputnode = pe.Node(
248+
niu.IdentityInterface(fields=['t2w_mask', 't1w_aseg', 't2w_aseg']), name='outputnode'
249+
)
248250

249251
if t1w_mask:
250252
t1wmask2t2w = pe.Node(ApplyTransforms(interpolation="MultiLabel"), name='t1wmask2t2w')
@@ -259,18 +261,18 @@ def init_coregister_derivatives_wf(
259261
# fmt:on
260262
if t1w_aseg:
261263
# fmt:off
262-
t1waseg2t2w = pe.Node(ApplyTransforms(interpolation="MultiLabel"), name='t2wmask2t1w')
264+
t1waseg2t2w = pe.Node(ApplyTransforms(interpolation="MultiLabel"), name='t1waseg2t2w')
263265
workflow.connect([
264266
(inputnode, t1waseg2t2w, [
265-
('t2w_aseg', 'input_image'),
267+
('t1w_aseg', 'input_image'),
266268
('t1w2t2w_xfm', 'transforms'),
267-
('t1w_ref', 'reference_image')]),
268-
(t1waseg2t2w, outputnode, [('output_image', 't1w_aseg')])
269+
('t2w_ref', 'reference_image')]),
270+
(t1waseg2t2w, outputnode, [('output_image', 't2w_aseg')])
269271
])
270272
# fmt:on
271273
if t2w_aseg:
272274
# fmt:off
273-
t2waseg2t1w = pe.Node(ApplyTransforms(interpolation="MultiLabel"), name='t2wmask2t1w')
275+
t2waseg2t1w = pe.Node(ApplyTransforms(interpolation="MultiLabel"), name='t2waseg2t1w')
274276
workflow.connect([
275277
(inputnode, t2waseg2t1w, [
276278
('t2w_aseg', 'input_image'),

0 commit comments

Comments
 (0)