Adding a custom parcellation map

Sometimes you might want to use a custom parcellation map to perform feature queries in siibra. For this example, we retrieve a freely available AICHA - Atlas of Intrinsic Connectivity of Homotopic Areas (Tzourio-Mazoyer N, Landeau B, Papathanassiou D, Crivello F, Etard O, Delcroix N, Mazoyer B, Joliot M (2002) Automated anatomical labeling of activations in SPM using a macroscopic anatomical parcellation of the MNI MRI single-subject brain. Neuroimage 15:273-289.). This atlas provided in the MNI ICBM 152 space.

import siibra
from nilearn import plotting

Load the custom parcellation map from the online resource. For the retrieval, siibra’s zipfile connector is very helpful. We can use the resulting NIfTI to create a custom parcellation map inside siibra.

# connect to the online zip file
conn = siibra.retrieval.ZipfileConnector(
    "http://www.gin.cnrs.fr/wp-content/uploads/aicha_v1.zip"
)

# the NIfTI file is easily retrieved:
nifti = conn.get("AICHA/AICHA.nii")
# and create a volume on space MNI152 (note that this assumes our
# external knowledge that the map is in MNI152 space)
volume = siibra.volumes.from_nifti(nifti, 'mni152', "AICHA")

# The text file with label mappings has a custom format. We provide a tsv
# decoder to extract the list of region/label pairs since the txt file is tab
# separated.
volume_info = conn.get("AICHA/AICHA_vol1.txt", decode_func=siibra.retrieval.requests.DECODERS['.tsv'])
volume_info
nom_c nom_l color vol_vox vol_mm3 xv yv zv xmm ymm zmm
0 G_Frontal_Sup-1-L G_Frontal_Sup-1-L 1 139 1112 53 96 43 -15.985612 64.935252 13.079137
1 G_Frontal_Sup-1-R G_Frontal_Sup-1-R 2 25 200 39 97 42 12.880000 67.680000 10.640000
2 G_Frontal_Sup-2-L G_Frontal_Sup-2-L 3 1072 8576 51 87 57 -11.919776 46.501866 40.483209
3 G_Frontal_Sup-2-R G_Frontal_Sup-2-R 4 1113 8904 39 86 57 12.044924 45.584906 40.700809
4 G_Frontal_Sup-3-L G_Frontal_Sup-3-L 5 57 456 55 72 67 -19.789474 16.210526 61.438596
... ... ... ... ... ... ... ... ... ... ... ...
379 N_Thalamus-7-R N_Thalamus-7-R 380 37 296 41 50 41 8.756757 -26.486486 9.783784
380 N_Thalamus-8-L N_Thalamus-8-L 381 44 352 48 50 44 -4.909091 -26.272727 14.045455
381 N_Thalamus-8-R N_Thalamus-8-R 382 30 240 44 51 43 3.533333 -25.333333 13.133333
382 N_Thalamus-9-L N_Thalamus-9-L 383 276 2208 48 58 33 -5.391304 -10.710145 -7.311594
383 N_Thalamus-9-R N_Thalamus-9-R 384 219 1752 43 58 33 4.785388 -10.273973 -6.438356

384 rows × 11 columns



Now we use this to add a custom map to siibra.

regionnames = [
    name.replace('-R', ' right').replace('-L', ' left')
    for name in volume_info['nom_l']
]
labels = [int(label) for label in volume_info['color']]
custom_map = siibra.volumes.parcellationmap.from_volume(
    name="AICHA - Atlas of Intrinsic Connectivity of Homotopic Areas",
    volume=volume,
    regionnames=regionnames,
    regionlabels=labels
)

let’s plot the final map

plotting.plot_roi(custom_map.fetch())
007 adding custom parcellation
<nilearn.plotting.displays._slicers.OrthoSlicer object at 0x7fc4a96f0880>

We can already use this map to find spatial features, such as BigBrain intensity profiles, gene expressions, volume of interests, sections…

region = custom_map.parcellation.get_region('S_Rolando-1 left')
profiles = siibra.features.get(
    region,
    siibra.features.cellular.BigBrainIntensityProfile
)[0]
print(f"{len(profiles)} intensity profiles found.")
2146 intensity profiles found.

On the other hand, some features are only anchored to a semantic region object and the link to the custom region is not directly known to siibra. However, siibra circumvents this by comparing volumes of these regions to assign a link between them.

volume = region.get_regional_mask('mni152')
receptor_density = siibra.features.get(
    volume,
    siibra.features.molecular.ReceptorDensityFingerprint
)
print(f"{len(receptor_density)} layerwise cell density found.")

# The relation of volume to the anatomical anchor is provided in
# `anchor.last_match_description`
for d in receptor_density:
    print(d.anchor.last_match_description)
6 layerwise cell density found.
'FilteredVolume Mask of 'Area 44 (IFG) (Julich-Brain Cytoarchitectonic Atlas (v3.0.3))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric' and 'FilteredVolume Mask of 'Area 44 (IFG) (Julich-Brain Cytoarchitectonic Atlas (v2.9))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric' and 'FilteredVolume Mask of 'Area 44 (IFG) (Julich-Brain Cytoarchitectonic Atlas (v1.18))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric'
'FilteredVolume Mask of 'Area PFt (IPL) (Julich-Brain Cytoarchitectonic Atlas (v3.0.3))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric' and 'FilteredVolume Mask of 'Area PFt (IPL) (Julich-Brain Cytoarchitectonic Atlas (v3.1))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric' and 'FilteredVolume Mask of 'Area PFt (IPL) (Julich-Brain Cytoarchitectonic Atlas (v2.9))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric'
'FilteredVolume Mask of 'Area 3b (PostCG) (Julich-Brain Cytoarchitectonic Atlas (v3.0.3))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric' and 'FilteredVolume Mask of 'Area 3b (PostCG) (Julich-Brain Cytoarchitectonic Atlas (v1.18))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric' and 'FilteredVolume Mask of 'Area 3b (PostCG) (Julich-Brain Cytoarchitectonic Atlas (v2.9))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric' and 'FilteredVolume Mask of 'Area 3b (PostCG) (Julich-Brain Cytoarchitectonic Atlas (v3.1))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric'
'FilteredVolume Mask of 'Area 4p (PreCG) (Julich-Brain Cytoarchitectonic Atlas (v1.18))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric' and 'FilteredVolume Mask of 'Area 4p (PreCG) (Julich-Brain Cytoarchitectonic Atlas (v3.1))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric' and 'FilteredVolume Mask of 'Area 4p (PreCG) (Julich-Brain Cytoarchitectonic Atlas (v3.0.3))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric' and 'FilteredVolume Mask of 'Area 4p (PreCG) (Julich-Brain Cytoarchitectonic Atlas (v2.9))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric'
'FilteredVolume Mask of 'Area 44 (IFG) (Julich-Brain Cytoarchitectonic Atlas (v3.0.3))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric' and 'FilteredVolume Mask of 'Area 44 (IFG) (Julich-Brain Cytoarchitectonic Atlas (v2.9))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric' and 'FilteredVolume Mask of 'Area 44 (IFG) (Julich-Brain Cytoarchitectonic Atlas (v1.18))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric'
'FilteredVolume Mask of 'Area PFop (IPL) (Julich-Brain Cytoarchitectonic Atlas (v2.9))' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' (built by merging the mask  of its descendants) in space MNI 152 ICBM 2009c Nonlinear Asymmetric' overlaps with 'FilteredVolume Mask of 'S_Rolando-1 left (AICHA Atlas of Intrinsic Connectivity of Homotopic Areas)' in 'MNI 152 ICBM 2009c Nonlinear Asymmetric' in space MNI 152 ICBM 2009c Nonlinear Asymmetric'

To get a more detailed assignment scores, one can make use of map assignment discussed in Anatomical Assignment, see Assign modes in activation maps to brain regions.

Total running time of the script: (5 minutes 10.178 seconds)

Estimated memory usage: 917 MB

Gallery generated by Sphinx-Gallery