Note
Go to the end to download the full example code.
Utilizing locations of interest
siibra provides common locations of interests on reference spaces as objects. These location objects can be used to query features or assignment to the maps, see Assigning coordinates to brain regions and Assign modes in activation maps to brain regions. The conversion of these locations to other spaces are done in the background but one can also be invoked when needed.
import siibra
from nilearn import plotting
import numpy as np
The simplest location type is a point. It can have a uncertainty variable or can be exact.
point = siibra.Point((27.75, -32.0, 63.725), space='mni152')
point_uncertain = siibra.Point((27.75, -32.0, 63.725), space='mni152', sigma_mm=3.)
point_uncertain
<Point((27.75, -32.0, 63.725), space='minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2', sigma_mm=3.0)>
We can create a PointCloud from several points or a set of coordinates.
siibra.PointCloud(
[(27.75, -32.0, 63.725), (27.75, -32.0, 63.725)],
space='mni152',
sigma_mm=[0.0, 3.]
)
<PointCloud(["<Point((27.75, -32.0, 63.725), space='minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2', sigma_mm=0.0)>", "<Point((27.75, -32.0, 63.725), space='minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2', sigma_mm=3.0)>"]), space='minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2'>
There are several helper properties and methods for locations, some specific to the location type. For example, we can warp the points to another space (currently limited only between MNI152, COLIN27, and BigBrain).
print(point.warp('bigbrain'))
print(point.warp('colin27'))
Point in BigBrain microscopic template (histology) [13.141,-5.65729,41.6915]
Point in MNI Colin 27 [26.5659,-40.0247,64.2493]
To explore further, let us first create a random pointcloud
ptset = siibra.PointCloud(
np.array([
np.random.randn(10000) * 3 - 27.75,
np.random.randn(10000) * 3 - 32.0,
np.random.randn(10000) * 3 + 63.725
]).T,
space='mni152'
)
We can display these points as a kernel density estimated volume
kde_volume = siibra.volumes.from_pointcloud(ptset)
plotting.view_img(kde_volume.fetch())
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/numpy/core/fromnumeric.py:784: UserWarning:
Warning: 'partition' will ignore the 'mask' of the MaskedArray.
Moreover, a location object can be used to query features. While we can also, query with the pointcloud, let us use the bounding box that encloses these points. We will query for image features and print the assignment of the anatomical anchors to our BoundingBox
bbox = ptset.boundingbox
features_of_interest = siibra.features.get(bbox, 'image')
for f in features_of_interest:
print(f.last_match_description)
'Bounding box from (-86.55,-91.19,-61.17)mm to (22.83,85.56,75.21)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-14.89,-58.79)mm to (68.44,-14.87,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-13.97,-58.79)mm to (68.44,-13.95,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-13.13,-58.79)mm to (68.44,-13.11,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-12.11,-58.79)mm to (68.44,-12.09,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-10.91,-58.79)mm to (68.43,-10.89,62.10)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-10.05,-58.79)mm to (68.43,-10.03,62.10)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-9.13,-58.79)mm to (68.44,-9.11,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-8.11,-58.79)mm to (68.44,-8.09,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-7.11,-58.79)mm to (68.44,-7.09,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-6.11,-58.79)mm to (68.44,-6.09,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-4.95,-58.79)mm to (68.44,-4.93,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-3.93,-58.79)mm to (68.44,-3.91,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-3.07,-58.79)mm to (68.44,-3.05,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-1.89,-58.79)mm to (68.44,-1.87,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-0.87,-58.79)mm to (68.44,-0.85,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,-0.03,-58.79)mm to (68.44,-0.01,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,1.09,-58.79)mm to (68.44,1.11,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,1.99,-58.79)mm to (68.44,2.01,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,2.87,-58.79)mm to (68.44,2.89,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,3.93,-58.79)mm to (68.44,3.95,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,4.97,-58.79)mm to (68.44,4.99,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-70.68,5.91,-58.79)mm to (68.44,5.93,62.11)mm in BigBrain microscopic template (histology) space' overlaps with 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-96.10,-132.10,-78.10)mm to (96.90,96.90,114.90)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space' contains 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-96.10,-132.10,-78.10)mm to (96.90,96.90,114.90)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space' contains 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-95.98,-131.98,-77.98)mm to (96.92,96.92,114.92)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space' contains 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
'Bounding box from (-96.10,-132.10,-78.10)mm to (96.90,96.90,114.90)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space' contains 'Bounding box from (-39.40,-43.87,50.75)mm to (-17.75,-18.89,74.88)mm in MNI 152 ICBM 2009c Nonlinear Asymmetric space'
And now let us simply select the features that overlaps with our BoundingBox
selected_features = [
f
for f in features_of_interest
if "overlaps" in str(f.last_match_result[0].qualification)
]
for f in selected_features:
print(f.name)
The Enriched Connectome - Block face images of full sagittal human brain sections (blockface)
#2757: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#2803: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#2845: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#2896: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#2956: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#2999: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3045: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3096: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3146: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3196: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3254: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3305: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3348: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3407: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3458: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3500: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3556: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3601: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3645: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3698: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3750: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
#3797: selected 1 micron scans of BigBrain histological sections (v1.0) (cell body staining)
Total running time of the script: (0 minutes 10.846 seconds)
Estimated memory usage: 363 MB