Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Ensure 2mm template is added when running CIFTI #381

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion nibabies/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,14 @@ def test_config_spaces():
assert [str(s) for s in spaces.get_standard(full_spec=True)] == [
'MNIInfant:cohort-1:res-native', # Default output space
'MNI152NLin6Asym:res-2',
'MNIInfant:cohort-1:res-2', # CIFTI: MNIInfant (2x2x2) -> MNI152NLin6Asym (2x2x2)
]

assert [
format_reference((s.fullname, s.spec))
for s in spaces.references
if s.standard and s.dim == 3
] == ['MNIInfant_cohort-1_res-native', 'MNI152NLin6Asym_res-2', 'MNIInfant_cohort-1']
] == ['MNIInfant_cohort-1_res-native', 'MNI152NLin6Asym_res-2', 'MNIInfant_cohort-1_res-2']
_reset_config()


Expand Down
6 changes: 3 additions & 3 deletions nibabies/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ def init_workflow_spaces(execution_spaces: SpatialReferences, age_months: int):
spaces.add(Reference('MNI152NLin6Asym', {'res': vol_res}))
# Ensure a non-native version of MNIInfant is added as a target
cohort = cohort_by_months('MNIInfant', age_months)
spaces.add(Reference('MNIInfant', {'cohort': cohort}))
spaces.add(Reference('MNIInfant', {'cohort': cohort, 'res': 2}))

return spaces

Expand Down Expand Up @@ -955,10 +955,10 @@ def get_MNIInfant_key(spaces: SpatialReferences) -> str:
key = None
for space in spaces.references:
# str formats as <reference.name>:<reference.spec>
if 'MNIInfant' in str(space) and 'res-native' not in str(space):
if 'MNIInfant' in str(space) and 'res-2' in str(space):
key = str(space)
break

if key is None:
raise KeyError(f'MNIInfant not found in SpatialReferences: {spaces}')
raise KeyError(f'MNIInfant (resolution 2x2x2) not found in SpatialReferences: {spaces}')
return key
Loading