Skip to content

Commit 177de34

Browse files
authored
FIX: Clean up default output space handling (#196)
1 parent 4db6f46 commit 177de34

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

nibabies/config.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -697,16 +697,17 @@ def init_spaces(checkpoint=True):
697697
if checkpoint and not spaces.is_cached():
698698
spaces.checkpoint()
699699

700-
if workflow.age_months is not None:
700+
# NiBabies' default volumetric space is MNIInfant
701+
# However, if age is not provided, do not add a default template as we cannot
702+
# make an assumption about cohort.
703+
if (
704+
not any(s.space == 'MNIInfant' for s in spaces.references)
705+
and workflow.age_months is not None
706+
):
701707
from .utils.misc import cohort_by_months
702708

703-
# cohort workaround
704-
if any(
705-
"MNIInfant" in space.split(":")[0]
706-
for space in spaces.get_spaces(nonstandard=False, dim=(3,))
707-
):
708-
cohort = cohort_by_months("MNIInfant", workflow.age_months)
709-
spaces.add(Reference("MNIInfant", {"cohort": cohort}))
709+
cohort = cohort_by_months("MNIInfant", workflow.age_months)
710+
spaces.add(Reference, {"cohort": cohort})
710711

711712
# Ensure user-defined spatial references for outputs are correctly parsed.
712713
# Certain options require normalization to a space not explicitly defined by users.

0 commit comments

Comments
 (0)