Skip to content

Commit 39608fe

Browse files
committed
ENH: Fix template keys output in normalization workflow, when cohort present
1 parent 557b689 commit 39608fe

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

smriprep/workflows/norm.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,29 @@ def init_anat_norm_wf(
133133
workflow.__desc__ += (', ', '.')[template == templates[-1][0]]
134134

135135
inputnode = pe.Node(niu.IdentityInterface(fields=[
136-
'moving_image', 'moving_mask', 'moving_segmentation', 'moving_tpms',
137-
'lesion_mask', 'orig_t1w']),
138-
name='inputnode')
139-
out_fields = ['standardized', 'anat2std_xfm', 'std2anat_xfm',
140-
'std_mask', 'std_dseg', 'std_tpms', 'template', 'template_spec']
136+
'lesion_mask',
137+
'moving_image',
138+
'moving_mask',
139+
'moving_segmentation',
140+
'moving_tpms',
141+
'orig_t1w',
142+
'template',
143+
]), name='inputnode')
144+
inputnode.iterables = [('template', templates)]
145+
146+
out_fields = [
147+
'anat2std_xfm',
148+
'standardized',
149+
'std2anat_xfm',
150+
'std_dseg',
151+
'std_mask',
152+
'std_tpms',
153+
'template',
154+
'template_spec',
155+
]
141156
poutputnode = pe.Node(niu.IdentityInterface(fields=out_fields), name='poutputnode')
142157

143158
split_desc = pe.Node(TemplateDesc(), run_without_submitting=True, name='split_desc')
144-
split_desc.iterables = [('template', templates)]
145159

146160
tf_select = pe.Node(TemplateFlowSelect(resolution=1 + debug),
147161
name='tf_select', run_without_submitting=True)
@@ -169,6 +183,8 @@ def init_anat_norm_wf(
169183
iterfield=['input_image'], name='std_tpms')
170184

171185
workflow.connect([
186+
(inputnode, split_desc, [('template', 'template')]),
187+
(inputnode, poutputnode, [('template', 'template')]),
172188
(inputnode, trunc_mov, [('moving_image', 'op1')]),
173189
(inputnode, registration, [
174190
('moving_mask', 'moving_mask'),
@@ -198,8 +214,7 @@ def init_anat_norm_wf(
198214
(std_mask, poutputnode, [('output_image', 'std_mask')]),
199215
(std_dseg, poutputnode, [('output_image', 'std_dseg')]),
200216
(std_tpms, poutputnode, [('output_image', 'std_tpms')]),
201-
(split_desc, poutputnode, [('name', 'template'),
202-
('spec', 'template_spec')]),
217+
(split_desc, poutputnode, [('spec', 'template_spec')]),
203218
])
204219

205220
# Provide synchronized output

0 commit comments

Comments
 (0)