Displaying data in common coordinate framework - CCF reference space


I would like to ask how I can display some MRI and morphological data that I have brought to Common Coordinate Framework with Allen Brain tools. (Like making some heat maps in different mouse brain regions).

Your help is appreciated.


What kind of format are your data in?
brainrender can deal with data from many different formats so perhaps we can find a way to visualise your data too.
Docs: https://docs.brainrender.info/
Disclaimer: I’m the creator of brainrender :slight_smile:


Ciao Federico,

My data are in Nifti format and I would like them to overlay the mouse brain structures (preferably the structures be transparent). I would appreciate any help with that in anticipo.
The brainrender seems like a practical tool, so I’ll try to use it.


Okay, that should be fairly easy to achieve with brainrender.
If you get stuck anywhere get in touch!

1 Like

Do you have any example code of loading .nii file into brainrender and rendering the data?
Unfortunately, I couldn’t find one on the github.


Hi, sorry for the delayed reply.

To load the data as a numpy array you should be able to use brainio (pip install brainio):

from brainio import brainio


which yields a 3D numpy array with the volumetric data.
You can then render these in brainrender with a Volume Actor.
So all together you code should look something like this:

from brainio import brainio
from brainrender import Scene
from brainrender.actors import Volume

data = brainio.load_any('data path')
actor = Volume(data)

scene = Scene()

I haven’t tested this code, but it should work. If you get stuck a good place to start with is the definition of the Volume class.

1 Like

Hi Federico,

Thank you for your reply! I tried using the code you provided but it is not adding the NIFTI data to the scene. I wonder if there is a middle step I’m missing which leads to this problem.
Besides, with some NIFTI images I get this error:
ValueError: axes don’t match array