Skip to content

Commit

Permalink
do not get top most with find_regions by default
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmetNSimsek committed Nov 29, 2023
1 parent a1ce2d5 commit f0427d2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions siibra/core/atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def find_regions(
regionspec: str,
all_versions: bool = False,
filter_children: bool = True,
find_topmost: bool = True
find_topmost: bool = False
):
"""
Find regions with the given specification in all parcellations offered
Expand All @@ -191,7 +191,7 @@ def find_regions(
If True, matched regions for all versions of a parcellation are returned.
filter_children : bool, default: True
If False, children of matched parents will be returned.
find_topmost : bool, default: True
find_topmost : bool, default: False
If True (requires `filter_children=True`), will return parent
structures if all children are matched, even though the parent
itself might not match the specification.
Expand Down
4 changes: 2 additions & 2 deletions siibra/core/parcellation.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def __lt__(self, other):
def find_regions(
regionspec: str,
filter_children=True,
find_topmost=True
find_topmost=False
):
"""
Find regions that match the given region specification in the subtree
Expand All @@ -346,7 +346,7 @@ def find_regions(
- a Region object
filter_children : bool, default: True
If True, children of matched parents will not be returned
find_topmost : bool, default: True
find_topmost : bool, default: False
If True (requires `filter_children=True`), will return parent
structures if all children are matched, even though the parent
itself might not match the specification.
Expand Down
4 changes: 2 additions & 2 deletions siibra/features/anchor.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ def regions(self) -> Dict[Region, Qualification]:
# decode the region specification into a dict of region objects and assignment qualifications
regions = {
region: Qualification.EXACT
for region in find_regions(self._regionspec)
for region in find_regions(self._regionspec, filter_children=True, find_topmost=False)
if region.species in self.species
}
# add more regions from possible aliases of the region spec
for alt_species, aliases in self.region_aliases.items():
for alias_regionspec, qualificationspec in aliases.items():
for r in find_regions(alias_regionspec):
for r in find_regions(alias_regionspec, filter_children=True, find_topmost=False):
if r.species != alt_species:
continue
if r not in regions:
Expand Down

0 comments on commit f0427d2

Please sign in to comment.