Skip to content

Commit 8e3952e

Browse files
committed
revert region.supported_spaces to a list to have a reproducible order
1 parent 4b6da2e commit 8e3952e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

siibra/core/region.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -537,12 +537,10 @@ def mapped_in_space(self, space, recurse: bool = False) -> bool:
537537
"""
538538
from ..volumes.parcellationmap import Map
539539
for m in Map.registry():
540-
# Use and operant for efficiency (short circuiting logic)
541-
# Put the most inexpensive logic first
542540
if (
543-
self.name in m.regions
544-
and m.space.matches(space)
541+
m.space.matches(space)
545542
and m.parcellation.matches(self.parcellation)
543+
and self.name in m.regions
546544
):
547545
return True
548546
if recurse and not self.is_leaf:
@@ -551,16 +549,16 @@ def mapped_in_space(self, space, recurse: bool = False) -> bool:
551549
return False
552550

553551
@property
554-
def supported_spaces(self) -> Set[_space.Space]:
552+
def supported_spaces(self) -> List[_space.Space]:
555553
"""
556-
The set of spaces for which a mask could be extracted from an existing
554+
The list of spaces for which a mask could be extracted from an existing
557555
map or combination of masks of its children.
558556
"""
559557
if self._supported_spaces is None:
560-
self._supported_spaces = {
558+
self._supported_spaces = sorted({
561559
s for s in _space.Space.registry()
562560
if self.mapped_in_space(s, recurse=True)
563-
}
561+
})
564562
return self._supported_spaces
565563

566564
@property

0 commit comments

Comments
 (0)