Skip to content

Commit

Permalink
revert region.supported_spaces to a list to have a reproducible order
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmetNSimsek committed Jan 8, 2025
1 parent 4b6da2e commit 8e3952e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions siibra/core/region.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,12 +537,10 @@ def mapped_in_space(self, space, recurse: bool = False) -> bool:
"""
from ..volumes.parcellationmap import Map
for m in Map.registry():
# Use and operant for efficiency (short circuiting logic)
# Put the most inexpensive logic first
if (
self.name in m.regions
and m.space.matches(space)
m.space.matches(space)
and m.parcellation.matches(self.parcellation)
and self.name in m.regions
):
return True
if recurse and not self.is_leaf:
Expand All @@ -551,16 +549,16 @@ def mapped_in_space(self, space, recurse: bool = False) -> bool:
return False

@property
def supported_spaces(self) -> Set[_space.Space]:
def supported_spaces(self) -> List[_space.Space]:
"""
The set of spaces for which a mask could be extracted from an existing
The list of spaces for which a mask could be extracted from an existing
map or combination of masks of its children.
"""
if self._supported_spaces is None:
self._supported_spaces = {
self._supported_spaces = sorted({

Check warning on line 558 in siibra/core/region.py

View check run for this annotation

Codecov / codecov/patch

siibra/core/region.py#L558

Added line #L558 was not covered by tests
s for s in _space.Space.registry()
if self.mapped_in_space(s, recurse=True)
}
})
return self._supported_spaces

@property
Expand Down

0 comments on commit 8e3952e

Please sign in to comment.