Skip to content

Commit

Permalink
FIX: Derivative coregistration inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mgxd committed Aug 10, 2023
1 parent daab431 commit 1f762ed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
8 changes: 5 additions & 3 deletions nibabies/workflows/anatomical/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,11 @@ def init_infant_anat_wf(
name='deriv_buffer',
)
if derivatives:

Check warning on line 350 in nibabies/workflows/anatomical/base.py

View check run for this annotation

Codecov / codecov/patch

nibabies/workflows/anatomical/base.py#L350

Added line #L350 was not covered by tests
wf.connect(
coregistration_wf, 'outputnode.t1w2t2w_xfm', coreg_deriv_wf, 'inputnode.t1w2t2w_xfm'
)
wf.connect([
(coregistration_wf, coreg_deriv_wf, [('outputnode.t1w2t2w_xfm', 'inputnode.t1w2t2w_xfm')]),
(t1w_preproc_wf, coreg_deriv_wf, [('outputnode.anat_preproc', 'inputnode.t1w_ref')]),
(t2w_preproc_wf, coreg_deriv_wf, [('outputnode.anat_preproc', 'inputnode.t2w_ref')]),
])

# Derivative mask is present
if derivatives.mask:
Expand Down
16 changes: 9 additions & 7 deletions nibabies/workflows/anatomical/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,13 @@ def init_coregister_derivatives_wf(
workflow = pe.Workflow(name=name)
inputnode = pe.Node(

Check warning on line 241 in nibabies/workflows/anatomical/registration.py

View check run for this annotation

Codecov / codecov/patch

nibabies/workflows/anatomical/registration.py#L240-L241

Added lines #L240 - L241 were not covered by tests
niu.IdentityInterface(
fields=['t1w_ref', 't2w_ref', 't1w_mask', 't1w_aseg', 't2w_aseg', 't1w2t2w_xfm']
fields=['t1w_ref', 't2w_ref', 't1w2t2w_xfm', 't1w_mask', 't1w_aseg', 't2w_aseg']
),
name='inputnode',
)
outputnode = pe.Node(niu.IdentityInterface(fields=['t2w_mask', 't1w_aseg']), name='outputnode')
outputnode = pe.Node(

Check warning on line 247 in nibabies/workflows/anatomical/registration.py

View check run for this annotation

Codecov / codecov/patch

nibabies/workflows/anatomical/registration.py#L247

Added line #L247 was not covered by tests
niu.IdentityInterface(fields=['t2w_mask', 't1w_aseg', 't2w_aseg']), name='outputnode'
)

if t1w_mask:
t1wmask2t2w = pe.Node(ApplyTransforms(interpolation="MultiLabel"), name='t1wmask2t2w')

Check warning on line 252 in nibabies/workflows/anatomical/registration.py

View check run for this annotation

Codecov / codecov/patch

nibabies/workflows/anatomical/registration.py#L251-L252

Added lines #L251 - L252 were not covered by tests
Expand All @@ -259,18 +261,18 @@ def init_coregister_derivatives_wf(
# fmt:on
if t1w_aseg:

Check warning on line 262 in nibabies/workflows/anatomical/registration.py

View check run for this annotation

Codecov / codecov/patch

nibabies/workflows/anatomical/registration.py#L262

Added line #L262 was not covered by tests
# fmt:off
t1waseg2t2w = pe.Node(ApplyTransforms(interpolation="MultiLabel"), name='t2wmask2t1w')
t1waseg2t2w = pe.Node(ApplyTransforms(interpolation="MultiLabel"), name='t1waseg2t2w')
workflow.connect([

Check warning on line 265 in nibabies/workflows/anatomical/registration.py

View check run for this annotation

Codecov / codecov/patch

nibabies/workflows/anatomical/registration.py#L264-L265

Added lines #L264 - L265 were not covered by tests
(inputnode, t1waseg2t2w, [
('t2w_aseg', 'input_image'),
('t1w_aseg', 'input_image'),
('t1w2t2w_xfm', 'transforms'),
('t1w_ref', 'reference_image')]),
(t1waseg2t2w, outputnode, [('output_image', 't1w_aseg')])
('t2w_ref', 'reference_image')]),
(t1waseg2t2w, outputnode, [('output_image', 't2w_aseg')])
])
# fmt:on
if t2w_aseg:

Check warning on line 273 in nibabies/workflows/anatomical/registration.py

View check run for this annotation

Codecov / codecov/patch

nibabies/workflows/anatomical/registration.py#L273

Added line #L273 was not covered by tests
# fmt:off
t2waseg2t1w = pe.Node(ApplyTransforms(interpolation="MultiLabel"), name='t2wmask2t1w')
t2waseg2t1w = pe.Node(ApplyTransforms(interpolation="MultiLabel"), name='t2waseg2t1w')
workflow.connect([

Check warning on line 276 in nibabies/workflows/anatomical/registration.py

View check run for this annotation

Codecov / codecov/patch

nibabies/workflows/anatomical/registration.py#L275-L276

Added lines #L275 - L276 were not covered by tests
(inputnode, t2waseg2t1w, [
('t2w_aseg', 'input_image'),
Expand Down

0 comments on commit 1f762ed

Please sign in to comment.