Note
Go to the end to download the full example code.
Find brain regions in a parcellation
We can use Parcellation objects to find child brain regions.
We start by selecting an atlas and a parcellation.
import siibra
atlas = siibra.atlases.get('human')
julich_brain = atlas.parcellations.get('julich 2.9')
The most basic way is to search for all regions matching a particular string:
julich_brain.find('V1')
[Area hOc1 (V1, 17, CalcS), Area hOc1 (V1, 17, CalcS) left, Area hOc1 (V1, 17, CalcS) right]
You can filter the children and querying the root node by:
julich_brain.find('v1', filter_children=True)
[Area hOc1 (V1, 17, CalcS)]
For more powerful searches, regular expressions can be used with ‘/<pattern>/<flags>’ or using re.compile(). Find hOc2 or hOc4 in the right hemisphere:
julich_brain.find('/hOc[24].*right/')
[Area hOc4v (LingG) right, Area hOc4d (Cuneus) right, Area hOc2 (V2, 18) right, Area hOc4lp (LOC) right, Area hOc4la (LOC) right]
Searching for more general brain regions, we see that areas often appear three times: Julich-Brain defines them separately for the left and right hemisphere, and additionally defines a common parent region.
for r in julich_brain.find('amygdala'):
print(r.name)
amygdala
MF (Amygdala)
CM (Amygdala)
SF (Amygdala)
LB (Amygdala)
IF (Amygdala)
VTM (Amygdala)
SF (Amygdala) left
CM (Amygdala) left
IF (Amygdala) left
MF (Amygdala) left
LB (Amygdala) left
SF (Amygdala) right
LB (Amygdala) right
VTM (Amygdala) left
IF (Amygdala) right
MF (Amygdala) right
CM (Amygdala) right
VTM (Amygdala) right
Regions can also be search right away from the atlas object. However, it will return matching regions from all its known parcellations. search all regions known by the atlas
for r in atlas.find_regions('amygdala'):
print(f"{r.name:30.30} {r.parcellation}")
amygdala Julich-Brain Cytoarchitectonic Atlas (v3.1)
amygdala Julich-Brain Cytoarchitectonic Atlas (BigBrain)
cerebral nuclei Julich-Brain Cytoarchitectonic Atlas (BigBrain)
Component 21: Amygdala DiFuMo Atlas (256 dimensions)
Component 120: Amygdala DiFuMo Atlas (512 dimensions)
Component 105: Amygdala inferi DiFuMo Atlas (512 dimensions)
Component 425: Amygdala anteri DiFuMo Atlas (1024 dimensions)
Component 678: Amygdala poster DiFuMo Atlas (1024 dimensions)
Amygdala MarsAtlas cortical parcellation model
In fact, siibra provides a package-level function to search through regions of all parcellations.
siibra.find_regions('amygdala')
[Component 425: Amygdala anterior, Component 678: Amygdala posterior, Component 21: Amygdala, Component 120: Amygdala, Component 105: Amygdala inferior, amygdala, MF (Amygdala), LB (Amygdala), CM (Amygdala), SF (Amygdala), IF (Amygdala), VTM (Amygdala), amygdala, MF (Amygdala), IF (Amygdala), SF (Amygdala), CM (Amygdala), LB (Amygdala), VTM (Amygdala), amygdala, MF (Amygdala), CM (Amygdala), SF (Amygdala), LB (Amygdala), IF (Amygdala), VTM (Amygdala), amygdala, SF (Amygdala), CM (Amygdala), LB (Amygdala), IF (Amygdala), MF (Amygdala), VTM (Amygdala), amygdala, SF (Amygdala), LB (Amygdala), MF (Amygdala), CM (Amygdala), IF (Amygdala), VTM (Amygdala), Astr (Amygdala), Pallial amygdala, Amygdala, amygdala]
Often however, we want to access one particular region, given a unique specification, and not obtain a list of many possible matches. This can be done using the get_region method. It assumes that the provided region specification is unique, and returns the single exact match. Note that if the specification is not unique, this method will raise an exception!
julich_brain.get_region('v1 left')
Area hOc1 (V1, 17, CalcS) left
siibra provides a package-level shortcut function for this as well:
siibra.get_region('julich 2.9', 'v1 left')
Area hOc1 (V1, 17, CalcS) left
In case that the given specification matches multiple regions, which however represent the children of the same parent, get_region will return the parent object. In that case, the returned region can be a full subtree:
julich_brain.get_region('amygdala')
amygdala
Atlas objects provide direct access to the get_region() method of their parcellations. This way the above can also be done without explicitly accessing the parcellation object:
atlas.get_region('amygdala', parcellation='julich')
amygdala
Total running time of the script: (0 minutes 0.534 seconds)