siibra.core.parcellation
Hierarchal brain regions and metadata.
Module Contents
Classes
Representation of a region with name and more optional attributes |
|
- class siibra.core.parcellation.Parcellation(identifier: str, name: str, species: siibra.commons.Species | str, regions: List[siibra.core.region.Region] | siibra.core.region.Region = (), shortname: str = '', description: str = '', version: ParcellationVersion = None, modality: str = None, publications: list = [], datasets: list = [])
-
Representation of a region with name and more optional attributes
- property id
- property is_newest_version
- __getitem__(regionspec: str | int)
Retrieve a region object from the parcellation by labelindex or partial name.
- __lt__(other)
We sort parcellations by their version
- static find_regions(region_spec: str, parents_only=True)
Find regions that match the given region specification in the subtree headed by each parcellation in the registry. .. note:
Use Region.find() to search for a region in an instance of a parcellation.
- get_map(space=None, maptype: str | siibra.commons.MapType = MapType.LABELLED, spec: str = '')
Get the maps for the parcellation in the requested template space.
This might in general include multiple 3D volumes. For example, the Julich-Brain atlas provides two separate maps, one per hemisphere. Per default, multiple maps are concatenated into a 4D array, but you can choose to retrieve a dict of 3D volumes instead using return_dict=True.
- Parameters:
maptype (MapType) – Type of map requested (e.g., statistical or labelled). Use MapType.STATISTICAL to request probability maps. Defaults to MapType.LABELLED.
spec (str, optional) – In case of multiple matching maps for the given parcellation, space and type, use this field to specify keywords matching the desired parcellation map name. Otherwise, siibra will default to the first in the list of matches (and inform with a log message)
- Returns:
A ParcellationMap representing the volumetric map or a SparseMap representing the list of statistical maps.
- Return type:
- get_region(regionspec: str | siibra.core.region.Region, find_topmost: bool = True, allow_tuple: bool = False)
Given a unique specification, return the corresponding region.
The spec could be a (possibly incomplete) name, or a region object. This method is meant to definitely determine a valid region. Therefore, if no match is found, it raises a ValueError. If multiple matches are found, the method tries to return only the common parent node. If there is no common parent, an exception is raised, except when allow_tuple=True - then a tuple of matched regions is returned.
- Parameters:
a string with a possibly inexact name (matched both against the name and the identifier key)
a Region object
find_topmost (bool, default: True) – If True, will automatically return the parent of a decoded region the decoded region is its only child.
allow_tuple (bool, default: False) – If multiple candidates without a common parent are found, return a tuple of matches instead of raising an exception.
- Returns:
A region object defined in the parcellation.
Note
If the spec exactly matched with more than one region, the first will be returned.
- Return type:
- Raises:
RuntimeError – If the spec matches multiple regions
ValueError – If the spec cannot be matched against any region.
- matches(spec)
Checks whether this region matches the given region specification.
- class siibra.core.parcellation.ParcellationVersion(name, parcellation, collection=None, prev_id=None, next_id=None, deprecated=False)
- __eq__(other)
Return self==value.
- __iter__()
- __lt__(other: ParcellationVersion)
< operator, useful for sorting by version FIXME: this is only by name, not recursing into parcellations, to avoid importing the registry here.
- __repr__()
Return repr(self).
- __str__()
Return str(self).