Colorizing a map with neurotransmitter receptor densities

Parcellation maps can be colorized with a dictionary of values. This is useful to visualize data features in 3D space. Here we demonstrate it for average densities of the GABAA receptor.

from nilearn import plotting
import siibra
# We start by selecting an atlas and the Julich-Brain parcellation.
atlas = siibra.atlases.MULTILEVEL_HUMAN_ATLAS
julich_brain = atlas.get_parcellation('julich 3')

As in the previous example, we extract all receptor density features linked to Julich-Brain.

fingerprints = siibra.features.get(julich_brain, siibra.features.molecular.ReceptorDensityFingerprint)
fingerprints[0].data
mean std
receptor
AMPA 498 120
kainate 1366 273
NMDA 366 127
GABAA 789 362
GABAB 1961 397
M1 405 229
M2 107 44
M3 707 335
alpha4beta2 31 8
alpha1 441 265
alpha2 400 265
5-HT1A 732 669
5-HT2 370 74
D1 72 36


Colorizing a map requires a dictionary that maps region objects to scalar values. We build a dictionary mapping Julich-Brain regions to average receptor densities measured for GABAA. Note: For each receptor fingerprint, from the regions it is anchored to, we consider those that belong to the julich brain atlas, and store the mean receptor density for each of their leaf nodes.

receptor = 'GABAA'
mapping = {
    c: fp.data['mean'][receptor]
    for fp in fingerprints if receptor in fp.receptors
    for r in fp.anchor.regions
    if r in julich_brain
    for c in r.leaves
}

Now colorize the Julich-Brain maximum probability map and plot it.

colorized_map = julich_brain.get_map(space='mni152').colorize(mapping).fetch()
plotting.view_img(
    colorized_map, cmap='magma',
    title=f"Average densities available for {receptor}", symmetric_cmap=False
)
/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.
  a.partition(kth, axis=axis, kind=kind, order=order)


Alternatively, we can display this map on a surface mesh using nilearn. Note that, you can switch between the hemispheres or variants (inflated or pial) from the plot itself.

plotting.view_img_on_surf(colorized_map, cmap='magma', symmetric_cmap=False, surf_mesh="fsaverage6")
Added README.md to /home/runner/nilearn_data


Dataset created in /home/runner/nilearn_data/fsaverage6

Downloading data from https://osf.io/jzxyr/download ...
 ...done. (2 seconds, 0 min)
Extracting data from /home/runner/nilearn_data/fsaverage6/18247b5dc31f58a90fcbddb5d0911cea/download..... done.


Total running time of the script: (0 minutes 21.674 seconds)

Gallery generated by Sphinx-Gallery