Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into cifti-combos
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Aug 6, 2024
2 parents f3523eb + 1f9a0cf commit 35aa430
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions niworkflows/utils/spaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
]
"""List of supported nonstandard reference spaces."""

NONSTANDARD_2D_REFERENCES = ["fsnative"]
"""List of supported nonstandard 2D reference spaces."""

FSAVERAGE_DENSITY = {
"fsaverage3": "642",
Expand Down Expand Up @@ -117,6 +119,16 @@ class Reference:
>>> Reference('MNIPediatricAsym', {'cohort': 1}).standard
True
>>> # Check dim property
>>> Reference('func').dim
3
>>> Reference('MNI152NLin6Asym').dim
3
>>> Reference('fsnative').dim
2
>>> Reference('onavg').dim
2
>>> # Equality/inequality checks
>>> Reference('func') == Reference('func')
True
Expand All @@ -138,6 +150,7 @@ class Reference:
"""

_standard_spaces = tuple(_tfapi.templates())
_spaces_2d = tuple(_tfapi.templates(suffix="sphere"))

space = attr.ib(default=None, type=str)
"""Name designating this space."""
Expand Down Expand Up @@ -167,8 +180,7 @@ def __attrs_post_init__(self):
spec["den"] = FSAVERAGE_DENSITY[space]
object.__setattr__(self, "spec", spec)

# XXX: This won't cover dhcpAsym, dhcpSym, or onavg
if self.space.startswith("fs"):
if (self.space in self._spaces_2d) or (self.space in NONSTANDARD_2D_REFERENCES):
object.__setattr__(self, "dim", 2)

if self.space in self._standard_spaces:
Expand Down

0 comments on commit 35aa430

Please sign in to comment.