1. Neuroscience
Download icon

Visualizing anatomically registered data with brainrender

  1. Federico Claudi  Is a corresponding author
  2. Adam L Tyson
  3. Luigi Petrucco
  4. Troy W Margrie
  5. Ruben Portugues
  6. Tiago Branco  Is a corresponding author
  1. UCL Sainsbury Wellcome Centre, United Kingdom
  2. Institute of Neuroscience, Technical University of Munich, Germany
  3. Max Planck Institute of Neurobiology, Research Group of Sensorimotor Control, Germany
  4. Munich Cluster for Systems Neurology (SyNergy), Germany
Tools and Resources
Cite this article as: eLife 2021;10:e65751 doi: 10.7554/eLife.65751
6 figures, 5 videos, 3 tables and 1 additional file

Figures

Design principles.

(A) Schematic illustration of how different types of data can be loaded into brainrender using either brainrender’s own functions, software packages from the BrainGlobe suite, or custom Python scripts. All data loaded into brainrender is converted to a unified format, which simplifies the process of visualizing data from different sources. (B) Using brainrender with different atlases. Visualization of brain atlas data from three different atlases using brainrender. Left, Allen atlas of the mouse brain showing the superficial (SCs) and motor (SCm) subdivisions of the superior colliculus and the Zona Incerta (data from Wang et al., 2020). Middle, visualization of the cerebellum and tectum in the larval zebrafish brain (data from Kunst et al., 2019). Right, visualization of the precentral gyrus, postcentral gyrus, and temporal lobe of the human brain (data from Ding et al., 2016). (C) The brainrender GUI. Mouse, human, and zebrafish larvae drawings from scidraw.io (doi.org/10.5281/zenodo.3925991, doi.org/10.5281/zenodo.3926189, doi.org/10.5281/zenodo.3926123).

Code examples.

Example python code for visualizing brain regions in the mouse and larval zebrafish brains. The same commands can be used for both atlases and switching between atlases can be done by simply specifying which atlas to use when creating the visualization. Further examples can be found in brainrender’s GitHub repository.

Visualizing different types of data in brainrender.

(A) Spread of fluorescence labeling following viral injection of AAV2-CRE-eGPF in the superior colliculus of two FLEX-TdTomato mice. 3D objects showing the injection sites were created using custom python scripts following acquisition of a 3D image of the entire brain with serial two-photon tomography and registration of the image data to the atlas’ template (with brainreg, Tyson et al., 2020a). (B) Streamlines visualization of efferent projections from the mouse primary motor cortex following injection of an anterogradely transported virus expressing fluorescent proteins (original data from Oh et al., 2014), downloaded from (Neuroinformatics NL with brainrender). (C) Visualization of the location of several implanted neuropixel probes from multiple mice (data from Steinmetz et al., 2019). Dark salmon colored tracks show probes going through both primary/anterior visual cortex (VISp/VISa) and the dorsal lateral geniculate nucleus of the thalamus. (D) Single periaqueductal gray (PAG) neuron. The PAG and superior colliculus are also shown. The neuron’s morphology was reconstructed by targeting the expression of fluorescent proteins in excitatory neurons in the PAG via an intersectional viral strategy, followed by imaging of cleared tissue and manual reconstruction of the neuron’s morphology with Vaa3D software. Data were registered to the Allen atlas with SHARPTRACK (Shamash et al., 2018). The 3D data was saved as a .stl file and loaded directly into brainrender. (E) Gene expression data. Left, expression of genes ‘brn3c’ and ‘nk1688CGt’ in the tectum of the larval zebrafish brain (gene expression data from fishatlas.neuro.mpg.de, 3D objects created with custom python scripts). Right, expression of gene ‘Gpr161’ in the mouse hippocampus (gene expression data from Wang et al., 2020), downloaded with brainrender (3D objects created with brainrender). Colored voxels show voxels with high gene expressions. The CA1 field of the hippocampus is also shown.

Visualizing cell location and morphological data.

(A) Visualizing the location of labeled cells. Left, visualization of fluorescently labeled cells identified using cellfinder (data from Tyson and Rousseau, 2020b). Right, visualization of functionally defined clusters of regions of interest in the brain of a zebrafish larvae during a visuomotor task (data from Markov et al., 2020). (B) Visualizing neuronal morphology data. Left, three secondary motor cortex neurons projecting to the thalamus (data from Winnubst et al., 2019, downloaded with morphapi from neuromorpho.org, Ascoli et al., 2007). Right, morphology of cerebellar neurons in larval zebrafish (data from Kunst et al., 2019), (downloaded with morphapi). In the left panel of (A and B), the brain outline was sliced along the midline to expose the data.

Code examples.

(A) Example code to visualize a set of labeled cells coordinates using the Points actor class. (B) Code example illustrating how to override brainrender’s default settings and how to use custom camera settings. (C) Code example showing how custom mesh objects saved as .obj and .stl files can be visualized in brainrender. (D) Example usage of brainrender’s Animation class to create custom animations. Further examples can be found in brainrender’s GitHub repository.

Advanced code examples.

(A) Example code to measure the distance between actors and if a given actor is contained in a target brain region. Left: virus injection volumes (red and gray) reconstructed from virus injections targeted at the superior colliculus (magenta). Gray colored injection volumes show data from the Allen Mouse Connectome Oh et al., 2014. Right: example code to measure the distance between the center of two brainrender actors and to check if an actor’s center is contained in a brain region of interest. (B) Code example illustrating how check if a point (e.g., representing a labeled cell) is in a brain region of interest. Left: visualization of reconstructed probe positions from several individual animals, data from Steinmetz et al., 2019. Probe channels located in the thalamus (red) are highlighted. Right: example code showing how to use BrainGlobe’s AtlasAPI to verify whether a point (here representing a probe channel) is contained in a brain region of interest or any of its substructures. Further examples can be found in brainrender’s GitHub repository.

Videos

Video 1
Example brainrender GUI usage.

Short demonstration of how brainrender's GUI can be used to interactively visualize brain regions, labeled cells, and custom meshes.

Video 2
Animated video created with brainrender.

Visualization of neuronal morphologies for two layer 5b pyramidal neurons in the secondary motor area of the mouse brain. Winnubst et al., 2019, downloaded with morphapi from neuromorpho.org. The secondary motor area and thalamus are also shown.

Video 3
Animated video created with brainrender.

Frontal view of all brain regions in the Allen Mouse Brain atlas as the brain is progressively 'sliced' in the rostro-caudal direction.

Video 4
Animated video created with brainrender.

Visualization of the location of three implanted neuropixel probes from multiple mice (data from Steinmetz et al., 2019). Every 0.5 s, a subset of the probes’ electrodes that detected a neuron's action potential are shown in salmon to visualize neuronal activity.

Video 5
Animated video created with brainrender showing the location of cells labeled by targeted expression of a fluorescent protein identified with cellfinder (data from Tyson et al., 2020a).

In dark blue: streamline visualization of efferent projections from the retrosplenial cortex following injection of an anterogradely transported virus expressing fluorescent proteins (data from Oh et al., 2014).

Tables

Table 1
Machine configurations used for benchmark tests.
NOSCPUGPU
1Macos Mojave 10.14.62.3 ghz Intel Core i9Radeon Pro 560 × 4 GB GPU
2Ubuntu 18.04.2 LTS x86 64Intel i7-8565U (x) @ 4.5 ghzNO GPU
3Windows 10Intel(R) Core i7-7700HQ 2.8 ghzNO GPU
4Windows 10Intel(R) Xeon(R) CPU E5-2643 v3 3.4 ghzNVIDIA geforce GTX 1080 Ti
Table 2
Benchmark tests results.

The number of actors refers to the total number of elements rendered, and the number of vertices refers to the total number of mesh vertices in the rendering.

TestMachineGPU# actors# verticesFPSRun duration
10 k cells1Yes31,029,32424.760.81
2No31,029,32422.461.16
3No31,029,32420.001.41
4Yes31,029,324100.001.34
100 k cells1Yes39,849,32418.873.23
2No39,849,32414.914.34
3No39,849,3240.437.94
4Yes39,849,3241.201.13
1 M cells1Yes398,049,3242.6531.01
2No398,049,3242.5596.49
3No398,049,3240.0386.75
4Yes39,8049,3240.1336.57
Slicing 10 k cells1Yes3237,75137.640.96
2No3237,75139.101.25
3No3237,75126.321.88
4Yes3237,751200.001.34
Slicing 100 k cells1Yes3276,09231.797.77
2No3276,09225.989.09
3No3276,09221.2816.88
4Yes3276,092111.119.65
Slicing 1 M cells1Yes3275,06911.2391.31
2No3275,0695.39104.79
3No3275,0695.03158.99
4Yes3275,06937.0497.43
Brain regions1Yes16781,864,3889.3811.78
2No16781,864,3887.6127.40
3No16781,864,3886.4946.79
4Yes16781,864,38811.9035.83
Animation1Yes896,6159.9118.98
2No896,61522.1212.63
3No896,61515.1511.92
4Yes896,61547.6212.29
Volume1Yes1249,3241.792.31
2No1249,3241.661.95
3No1249,3243.552.15
4Yes1249,32423.261.21
Key resources table
Reagent type (species) or resourceDesignationSource or referenceIdentifiersAdditional information
Software, algorithmNumpyhttps://doi.org/10.1038/s41586-020-2649-2RRID:SCR_008633
Software, algorithmVtkhttps://doi.org/10.1016/j.softx.2015.04.001RRID:SCR_015013
Software, algorithmVedohttps://zenodo.org/record/4287635
Software, algorithmBrainGlobe Atlas APIhttps://doi.org/10.21105/joss.02668
Software, algorithmPandashttps://doi.org/10.5281/zenodo.3509134
Software, algorithmMatplotlibdoi: 10.1109/MCSE.2007.55RRID:SCR_008624
Software, algorithmJupyterdoi:10.3233/978-1-61499-649-1-87RRID:SCR_018416

Additional files

Download links

A two-part list of links to download the article, or parts of the article, in various formats.

Downloads (link to download the article as PDF)

Download citations (links to download the citations from this article in formats compatible with various reference manager tools)

Open citations (links to open the citations from this article in various online reference manager services)