Skip to content

Commit 7878af8

Browse files
committed
FIX: Apply to single anat, fix select / preproc connections
1 parent 5eee41a commit 7878af8

File tree

1 file changed

+16
-14
lines changed
  • nibabies/workflows/anatomical

1 file changed

+16
-14
lines changed

nibabies/workflows/anatomical/fit.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -969,9 +969,9 @@ def init_infant_anat_fit_wf(
969969

970970
if concat_xfms:
971971
LOGGER.info(f'ANAT Stage 5b: Concatenating normalization for {concat_xfms}')
972-
# 1. Select intermediate's transforms
972+
973973
select_infant_mni = pe.Node(
974-
KeySelect(fields=['template', 'anat2std_xfm', 'std2anat_xfm'], key=intermediate),
974+
KeySelect(fields=['anat2std_xfm', 'std2anat_xfm'], key=intermediate),
975975
name='select_infant_mni',
976976
run_without_submitting=True,
977977
)
@@ -983,15 +983,15 @@ def init_infant_anat_fit_wf(
983983
)
984984

985985
workflow.connect([
986-
(concat_template_buffer, select_infant_mni, [('out', 'template')]),
986+
(concat_template_buffer, select_infant_mni, [('out', 'keys')]),
987987
(concat_anat2std_buffer, select_infant_mni, [('out', 'anat2std_xfm')]),
988988
(concat_std2anat_buffer, select_infant_mni, [('out', 'std2anat_xfm')]),
989989
(select_infant_mni, concat_reg_wf, [
990-
('template', 'inputnode.intermediate'),
990+
('key', 'inputnode.intermediate'),
991991
('anat2std_xfm', 'inputnode.anat2std_xfm'),
992992
('std2anat_xfm', 'inputnode.std2anat_xfm'),
993993
]),
994-
(anat_buffer, concat_reg_wf, [('anat_preproc', 'inputnode.anat_preproc')]),
994+
(anat_preproc_buffer, concat_reg_wf, [('anat_preproc', 'inputnode.anat_preproc')]),
995995
(sourcefile_buffer, ds_concat_reg_wf, [
996996
('anat_source_files', 'inputnode.source_files')
997997
]),
@@ -1806,9 +1806,13 @@ def init_infant_single_anat_fit_wf(
18061806
concat_xfms = []
18071807
found_xfms = {}
18081808
intermediate = None # The intermediate space when concatenating xfms - includes cohort
1809-
intermediate_targets = {
1810-
'MNI152NLin6Asym',
1811-
} # TODO: 'MNI152NLin2009cAsym'
1809+
intermediate_targets = (
1810+
{
1811+
'MNI152NLin6Asym', # TODO: 'MNI152NLin2009cAsym'
1812+
}
1813+
if config.workflow.multi_step_reg
1814+
else set()
1815+
)
18121816

18131817
for template in spaces.get_spaces(nonstandard=False, dim=(3,)):
18141818
# resolution / spec will not differentiate here
@@ -1882,13 +1886,12 @@ def init_infant_single_anat_fit_wf(
18821886

18831887
if concat_xfms:
18841888
LOGGER.info(f'ANAT Stage 5b: Concatenating normalization for {concat_xfms}')
1885-
# 1. Select intermediate's transforms
1889+
18861890
select_infant_mni = pe.Node(
1887-
KeySelect(fields=['template', 'anat2std_xfm', 'std2anat_xfm']),
1891+
KeySelect(fields=['anat2std_xfm', 'std2anat_xfm'], key=intermediate),
18881892
name='select_infant_mni',
18891893
run_without_submitting=True,
18901894
)
1891-
select_infant_mni.inputs.key = intermediate
18921895

18931896
concat_reg_wf = init_concat_registrations_wf(templates=concat_xfms)
18941897
ds_concat_reg_wf = init_ds_template_registration_wf(
@@ -1899,15 +1902,14 @@ def init_infant_single_anat_fit_wf(
18991902

19001903
workflow.connect([
19011904
(concat_template_buffer, select_infant_mni, [('out', 'keys')]),
1902-
(concat_template_buffer, select_infant_mni, [('out', 'template')]),
19031905
(concat_anat2std_buffer, select_infant_mni, [('out', 'anat2std_xfm')]),
19041906
(concat_std2anat_buffer, select_infant_mni, [('out', 'std2anat_xfm')]),
19051907
(select_infant_mni, concat_reg_wf, [
1906-
('template', 'inputnode.intermediate'),
1908+
('key', 'inputnode.intermediate'),
19071909
('anat2std_xfm', 'inputnode.anat2std_xfm'),
19081910
('std2anat_xfm', 'inputnode.std2anat_xfm'),
19091911
]),
1910-
(anat_buffer, concat_reg_wf, [('anat_preproc', 'inputnode.anat_preproc')]),
1912+
(anat_preproc_buffer, concat_reg_wf, [('anat_preproc', 'inputnode.anat_preproc')]),
19111913
(sourcefile_buffer, ds_concat_reg_wf, [
19121914
('anat_source_files', 'inputnode.source_files')
19131915
]),

0 commit comments

Comments
 (0)