Skip to content

Commit 4ba04c5

Browse files
committed
♻️ Add an identity interface for "reorient" to avoid duplicate cross-graph node
1 parent 87e7bb9 commit 4ba04c5

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

CPAC/longitudinal/wf/anat.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from networkx.classes.digraph import DiGraph
2323
from nipype import config as nipype_config
2424
from nipype.interfaces import fsl
25-
from nipype.interfaces.utility import Merge
25+
from nipype.interfaces.utility import IdentityInterface, Merge
2626

2727
from CPAC.longitudinal.preproc import subject_specific_template
2828
from CPAC.longitudinal.robust_template import mri_robust_template
@@ -454,6 +454,9 @@ def anat_longitudinal_wf(
454454
)
455455
raise ValueError(msg)
456456

457+
reorient_T1w = pe.Node(IdentityInterface(fields=[head_output]), "reorient_T1w")
458+
wf.connect(wholehead_template_node, head_output, reorient_T1w, head_output)
459+
457460
rpool.set_data(
458461
"longitudinal-template_space-longitudinal_desc-brain_T1w",
459462
brain_template_node,
@@ -462,16 +465,22 @@ def anat_longitudinal_wf(
462465
"",
463466
brain_template_node.name,
464467
)
465-
466-
for desc in ["head", "reorient"]:
467-
rpool.set_data(
468-
f"longitudinal-template_space-longitudinal_desc-{desc}_T1w",
469-
wholehead_template_node,
470-
head_output,
471-
{},
472-
"",
473-
wholehead_template_node.name,
474-
)
468+
rpool.set_data(
469+
"longitudinal-template_space-longitudinal_desc-head_T1w",
470+
wholehead_template_node,
471+
head_output,
472+
{},
473+
"",
474+
wholehead_template_node.name,
475+
)
476+
rpool.set_data(
477+
"longitudinal-template_space-longitudinal_desc-reorient_T1w",
478+
reorient_T1w,
479+
head_output,
480+
{},
481+
"",
482+
reorient_T1w.name,
483+
)
475484

476485
pipeline_blocks = [mask_longitudinal_T1w_brain]
477486
pipeline_blocks = build_T1w_registration_stack(

0 commit comments

Comments
 (0)