Skip to main content
eLife logoLink to eLife
. 2021 Mar 19;10:e65751. doi: 10.7554/eLife.65751

Visualizing anatomically registered data with brainrender

Federico Claudi 1,, Adam L Tyson 1, Luigi Petrucco 2,3, Troy W Margrie 1, Ruben Portugues 2,3,4, Tiago Branco 1,
Editors: Mackenzie W Mathis5, Kate M Wassum6
PMCID: PMC8079143  PMID: 33739286

Abstract

Three-dimensional (3D) digital brain atlases and high-throughput brain-wide imaging techniques generate large multidimensional datasets that can be registered to a common reference frame. Generating insights from such datasets depends critically on visualization and interactive data exploration, but this a challenging task. Currently available software is dedicated to single atlases, model species or data types, and generating 3D renderings that merge anatomically registered data from diverse sources requires extensive development and programming skills. Here, we present brainrender: an open-source Python package for interactive visualization of multidimensional datasets registered to brain atlases. Brainrender facilitates the creation of complex renderings with different data types in the same visualization and enables seamless use of different atlas sources. High-quality visualizations can be used interactively and exported as high-resolution figures and animated videos. By facilitating the visualization of anatomically registered data, brainrender should accelerate the analysis, interpretation, and dissemination of brain-wide multidimensional data.

Research organism: None

Introduction

Understanding how nervous systems generate behavior benefits from gathering multidimensional data from different individual animals. These data range from neural activity recordings and anatomical connectivity, to cellular and subcellular information such as morphology and gene expression profiles. These different types of data should ideally all be in register so that, for example, neural activity in one brain region can be interpreted in light of the connectivity of that region or the cell types it contains. Such registration, however, is challenging. Often it is not technically feasible to obtain multidimensional data in a single experiment, and registration to a common reference frame must be performed post hoc. Even for the same experiment type, registration is necessary to allow comparisons across individual animals (Simmons and Swanson, 2009).

While different types of references can in principle be used, neuroanatomical location is a natural and most commonly used reference frame (Chon et al., 2019; Oh et al., 2014; Arganda-Carreras et al., 2018; Kunst et al., 2019). In recent years, several high-resolution three-dimensional (3D) digital brain atlases have been generated for model species commonly used in neuroscience (Wang et al., 2020; Oh et al., 2014; Arganda-Carreras et al., 2018; Kunst et al., 2019). These atlases provide a framework for registering different types of data across macro- and microscopic scales. A key output of this process is the visualization of all datasets in register. Given the intrinsically 3D geometry of brain structures and individual neurons, 3D renderings are more readily understandable and can provide more information when compared to two dimensional images. Exploring interactive 3D visualizations of the brain gives an overview of the relationship between datasets and brain regions and helps generating intuitive insights about these relationships. This is particularly important for large-scale datasets such as the ones generated by open-science projects like MouseLight (Winnubst et al., 2019) and the Allen Mouse Connectome (Oh et al., 2014). In addition, high-quality 3D visualizations facilitate the communication of experimental results registered to brain anatomy.

Generating custom 3D visualizations of atlas data requires programmatic access to the atlas. While some of the recently developed atlases provide an API (Application Programming Interface) for accessing atlas data (Wang et al., 2020; Kunst et al., 2019), rendering these data in 3D remains a demanding and time-consuming task that requires significant programming skills. Moreover, visualization of user-generated data registered onto the atlas requires an interface between the user data and the atlas data, which further requires advanced programming knowledge and extensive development. There is therefore the need for software that can simplify the process of visualizing 3D anatomical data from available atlases and from new experimental datasets.

Currently, existing software packages such as cocoframer (Lein et al., 2007), BrainMesh (Yaoyao, 2020), and SHARPTRACK (Shamash et al., 2018) provide some functionality for 3D rendering of anatomical data. These packages, however, are only compatible with a single atlas and cannot be used to render data from different atlases or different animal species. Achieving this requires adapting the existing software to the different atlases datasets or developing new dedicated software all together, at the cost of significant additional efforts, often duplicated. An important limitation of the currently available software is that it frequently does not support rendering of non-atlas data, such as data from publicly available datasets (e.g. MouseLight) or produced by individual laboratories. This capability is essential for easily mapping newly generated data onto brain anatomy at high resolution and produce visualizations of multidimensional datasets. More advanced software such as natverse (Bates et al., 2020) offers extensive data visualization and analysis functionality, but currently, it is mostly restricted to data obtained from the Drosophila brain. Simple Neurite Tracer (Arshadi et al., 2020), an ImageJ-based software, can render neuronal morphological data from public and user-generated datasets and is compatible with several reference atlases. However, this software does not support visualization of data other than neuronal morphological reconstructions nor can it be easily adapted to work with different or new atlases beyond the ones already supported. Finally, software such as MagellanMapper (Young et al., 2020) can be used to visualize and analyze large 3D brain imaging datasets, but the visualization is restricted to one data item (i.e. images from one individual brain). It is therefore not possible to combine data from different sources into a single visualization. Ideally, a rendering software should work with 3D mesh data instead of 3D voxel image data to allow the creation of high-quality renderings and facilitate the integration of data from different sources.

An additional consideration is that existing software tools for programmatic neuroanatomical renderings have been developed in programming languages such as R and Matlab, and there is currently no available alternative in Python. The popularity of Python within the neuroscientific community has grown tremendously in recent years (Muller et al., 2015). Building on Python’s simple syntax and free, high-quality data processing and analysis packages, several open-source tools directly aimed at neuroscientists have been written in Python and are increasingly used (e.g., Mathis et al., 2018; Pachitariu et al., 2017; Tyson and Rousseau, 2020b). Developing a python-based software for universal generation of 3D renderings of anatomically registered data can therefore take advantage of the increasing strength and depth of the python neuroscience community for testing and further development.

For these reasons, we have developed brainrender: an open-source python package for creating high-resolution, interactive 3D renderings of anatomically registered data. Brainrender is written in Python and integrated with BrainGlobe’s AtlasAPI (Claudi et al., 2020) to interface natively with different atlases without need for modification. Brainrender supports the visualization of data acquired with different techniques and at different scales. Data from multiple sources can be combined in a single rendering to produce rich and informative visualizations of multidimensional data. Brainrender can also be used to create high-resolution, publication-ready images and videos (see Tyson and Rousseau, 2020b; Adkins et al., 2020), as well as interactive online visualizations to facilitate the dissemination of anatomically registered data. Finally, using brainrender requires minimal programming skills, which should accelerate the adoption of this new software by the research community. All brainrender code is available at the GitHub repository together with extensive online documentation and examples.

Results

Design principles and implementation

A core design goal for brainrender was to generate a visualization software compatible with any reference atlas, thus providing a generic and flexible tool (Figure 1A). To achieve this goal, brainrender has been developed as part of the BrainGlobe’s computational neuroanatomy software suite. In particular, we integrated brainrender directly with BrainGlobe’s AtlasAPI (Claudi et al., 2020). The AtlasAPI can download and access atlas data from several supported atlases in an unified format. Brainrender uses the AtlasAPI to access 3D mesh data from individual brain regions as well as metadata about the hierarchical organization of the brain’s structures (Figure 1B). Thus, the same programming interface can be used to access data from any atlas (see code examples in Figure 2), including recently developed ones (e.g. the enhanced and unified mouse brain atlas, Chon et al., 2019).

Figure 1. Design principles.

Figure 1.

(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).

Figure 2. Code examples.

Figure 2.

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.

The second major design principle was to enable rendering of any data type that can be registered to a reference atlas, either from publicly available datasets or from individual laboratories. Brainrender can directly visualize data produced with any analysis software from the BrainGlobe suite, including cellfinder (Tyson et al., 2020a) and brainreg (Tyson and Rousseau, 2020b). In addition, brainrender provides functionality for easily loading and visualizing commonly used data types such as .npy files with cell coordinates or image data, .obj, and .stl files with 3D mesh data and .json files with streamlines data for mesoscale connectomics. Additional information about the file formats accepted by brainrender can be found in the online documentation. Brainglobe’s software suite also includes imio which can load data from several file types (e.g. tiff and .nii), and additional file formats can be loaded through the numerous packages provided by the python ecosystem. Finally, the existing loading functionality can be easily expanded to support user-specific needs by directly plugging in custom user code into the brainrender interface (Figure 1A).

One of the goals of brainrender is to facilitate the creation of high-resolution images, animated videos, and interactive online visualizations from any anatomically registered data. Brainrender uses vedo as the rendering engine (Musy et al., 2019), a state-of-the-art tool that enables fast, high-quality rendering with minimal hardware requirements.

High-resolution renderings of rich 3D scenes can be produced rapidly (e.g. 10,000 cells in less than 2 s) in standard laptop or desktop configurations. Benchmarking tests across different operating systems and machine configurations show that using a GPU can increase the framerate of interactive renderings by a factor of 3.5 (see Tables 1 and 2 in Materials and methods). This performance increase, however, depends on the complexity of the pre-processing steps, such as data loading and mesh generation, which run on the CPU. As one the main goals of brainrender is to produce high-resolution visualizations, we have made the rendering quality independent of hardware configuration, which only affects the rendering time. Animated videos and online visualizations can be produced with a few lines of code in brainrender. Several options are provided for easily customizing the appearance of rendered objects, thus enabling high-quality, rich data visualizations that combine multiple data sources.

Table 1. Machine configurations used for benchmark tests.

N OS CPU GPU
1 Macos Mojave 10.14.6 2.3 ghz Intel Core i9 Radeon Pro 560 × 4 GB GPU
2 Ubuntu 18.04.2 LTS x86 64 Intel i7-8565U (x) @ 4.5 ghz NO GPU
3 Windows 10 Intel(R) Core i7-7700HQ 2.8 ghz NO GPU
4 Windows 10 Intel(R) Xeon(R) CPU E5-2643 v3 3.4 ghz NVIDIA 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.

Test Machine GPU # actors # vertices FPS Run duration
10 k cells 1 Yes 3 1,029,324 24.76 0.81
2 No 3 1,029,324 22.46 1.16
3 No 3 1,029,324 20.00 1.41
4 Yes 3 1,029,324 100.00 1.34
100 k cells 1 Yes 3 9,849,324 18.87 3.23
2 No 3 9,849,324 14.91 4.34
3 No 3 9,849,324 0.43 7.94
4 Yes 3 9,849,324 1.20 1.13
1 M cells 1 Yes 3 98,049,324 2.65 31.01
2 No 3 98,049,324 2.55 96.49
3 No 3 98,049,324 0.03 86.75
4 Yes 3 9,8049,324 0.13 36.57
Slicing 10 k cells 1 Yes 3 237,751 37.64 0.96
2 No 3 237,751 39.10 1.25
3 No 3 237,751 26.32 1.88
4 Yes 3 237,751 200.00 1.34
Slicing 100 k cells 1 Yes 3 276,092 31.79 7.77
2 No 3 276,092 25.98 9.09
3 No 3 276,092 21.28 16.88
4 Yes 3 276,092 111.11 9.65
Slicing 1 M cells 1 Yes 3 275,069 11.23 91.31
2 No 3 275,069 5.39 104.79
3 No 3 275,069 5.03 158.99
4 Yes 3 275,069 37.04 97.43
Brain regions 1 Yes 1678 1,864,388 9.38 11.78
2 No 1678 1,864,388 7.61 27.40
3 No 1678 1,864,388 6.49 46.79
4 Yes 1678 1,864,388 11.90 35.83
Animation 1 Yes 8 96,615 9.91 18.98
2 No 8 96,615 22.12 12.63
3 No 8 96,615 15.15 11.92
4 Yes 8 96,615 47.62 12.29
Volume 1 Yes 12 49,324 1.79 2.31
2 No 12 49,324 1.66 1.95
3 No 12 49,324 3.55 2.15
4 Yes 12 49,324 23.26 1.21

Finally, we aimed for brainrender to empower scientists with little or no programming experience to generate advanced visualizations of their anatomically registered data. To make brainrender as user-friendly as possible we have produced extensive documentation, tutorials and examples for installing and using the software. We have also developed a graphic user interface (GUI) to access most of brainrender’s core functionality. This GUI can be used to perform actions such as rendering of brain regions and labeled cells (e.g. from cellfinder) and creating images of the rendered data, without writing custom python code (Figure 1C), (Video 1).

Video 1. Example brainrender GUI usage.

Download video file (4.3MB, mp4)

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

Visualizing brain regions and other structures

A key element of any neuroanatomical visualization is the rendering of the entire outline of the brain as well as the borders of brain regions of interest. In brainrender, this can easily be achieved by specifying which brain regions to include in the rendering. The software will then use BrainGlobe’s AtlasAPI to load the 3D data and subsequently renders them (Figure 1B).

Brainrender can also render brain areas defined by factors other than anatomical location, such as gene expression levels or functional properties. These can be loaded either directly as 3D mesh data after processing with dedicated software (e.g., Tyson et al., 2020a; Song et al., 2020; Jin et al., 2019; Figure 3A) or as 3D volumetric data (Figure 3E). For the latter, brainrender takes care of the conversion of voxels into a 3D mesh for rendering. Furthermore, custom 3D meshes can be created to visualize different types of data. For example, brainrender can import JSON files with tractography connectivity data and create ‘streamlines’ to visualize efferent projections from a brain region of interested (Figure 3B).

Figure 3. Visualizing different types of data in brainrender.

Figure 3.

(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.

Brainrender also simplifies visualizing the location of devices implanted in the brain for neural activity recordings or manipulations, such as electrodes or optical fibers. Post hoc histological images taken to confirm the correct placement of the device can be registered to a reference atlas using appropriate software, and the registered data can be imported into brainrender (Figure 3C). This type of visualization greatly facilitates cross-animal comparisons and helps data interpretation within and across research groups.

Finally, brainrender can be used to visualize any object represented by the most commonly used file formats for 3D design (e.g. .obj, .stl), thus ensuring that brainrender can flexibly adapt to the visualization needs of the user (Figure 3D).

Individual neurons and mesoscale connectomics

Recent advances in large field of view and whole-brain imaging allow the generation of brain-wide data at single neuron resolution. Having a platform for visualizing these datasets with ease is critical for exploratory data analyses. Several open-source software packages are available for registering large amounts of such imaging data and automatically identify labeled cells (e.g. expressing fluorescent proteins) (Tyson et al., 2020a; Fürth et al., 2018; Goubran et al., 2019; Renier et al., 2016). This processing step outputs a table of coordinates for a set of labeled cells, which can be directly imported into brainrender to visualize a wealth of anatomical data at cellular resolution (Figure 4A).

Figure 4. Visualizing cell location and morphological data.

Figure 4.

(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.

Beyond the location of cell bodies, visualizing the entire dendritic and axonal arbors of single neurons registered to a reference atlas is important for understanding the distribution of neuronal signals across the brain. Single-cell morphologies are often complex 3D structures and therefore poorly represented in 2D images. Generating 3D interactive renderings is thus important to facilitate the exploration of this type of data. Brainrender can be used to parse and render .swc files containing morphological data, and it is fully integrated with morphapi, a software for downloading morphological data from publicly available datasets (e.g. from neuromorpho.org, Ascoli et al., 2007; Figure 4B).

Producing figures, videos, and interactive visualizations with brainrender

A core goal of brainrender is to facilitate the production of high-quality images, videos, and interactive visualizations of anatomical data. Brainrender leverages the functionality provided by vedo (Musy et al., 2019) to create images directly from the rendered scene. Renderings can also be exported to HTML files to create interactive visualizations that can be hosted online. Finally, functionality is provided to easily export videos from rendered scenes. Animated videos can be created by specifying parameters (e.g. the position of the camera or the transparency of a mesh) at selected keyframes. Brainrender then creates a video by animating the rendering between the keyframes. This approach facilitates the creation of videos while retaining the flexibility necessary to produce richly animated sequences (Videos 25). All example figures and videos in this article were generated directly in brainrender, with no further editing.

Video 2. Animated video created with brainrender.

Download video file (10.1MB, mp4)

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.

Download video file (8.3MB, mp4)

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.

Download video file (6MB, mp4)

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).

Download video file (7.7MB, mp4)

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).

Discussion

In this article, we have presented brainrender, a python software for creating 3D renderings of anatomically registered data.

Brainrender addresses the current lack of python-based and user-friendly tools for rendering anatomical data. Being part with BrainGlobe’s suite of software tools for the analysis of anatomical data brainrender facilitates the development of integrated analysis pipelines and the re-usability of software tools across model species, minimizing the need for additional software development. Finally, brainrender promises to improve how anatomically registered data are disseminated both in scientific publications and in other media (e.g., hosted online).

Limitations and future directions

With brainrender, we aimed to make the rendering process as simple as possible. Nevertheless, some more technically demanding pre-processing steps of raw image data are necessary before they can be visualized in brainrender. In particular, a critical step for visualizing anatomical data is the registration to a reference template (e.g., one of the atlases provided by the AtlasAPI). While this step can be challenging and time-consuming, the brainglobe suite provides software to facilitate this process (e.g., brainreg and bg-space), and alternative software tools have been developed before for this purpose (e.g., Song et al., 2020; Jin et al., 2019). Additional information about data registration can be found in brainglobe’s and brainrender’s online documentation, as well as in the examples in brainrender’s GitHub repository. A related challenge is integrating new anatomical atlases into the AtlasAPI. While we anticipate that most users will not have this need, it is a non-trivial task that requires considerable programming skills. We believe that brainglobe’s AtlasAPI greatly facilitates this process, which is presented in Claudi et al., 2020 and has extensive online documentation.

Brainrender has been optimized for rendering quality instead of rendering performance. Other commonly used software tools like napari (Sofroniew and Lambert, 2020) and ImageJ are dedicated to visualizing N-dimensional image data and perform very well even on large datasets. When comparing brainrender with other software, it is important to note brainrender is intended to work primarily with mesh data and not 3D image data. Although it can display image data (e.g., with the Volume actor), this functionality is not as fully developed as that using mesh data. A direct benchmarking comparison between brainrender and napari shows that brainrender is 5× slower than napari at visualizing image data, but 20× faster at visualizing mesh data. In both cases, however, brainrender achieves superior rendering quality. Other software packages dedicated to high-performance rendering, such as Blender, can handle mesh data with a performance that surpasses brainrender. Their use, however, comes with the large overhead of learning a very complex software to generate what most often will be simple renderings. It also requires that the users themselves take care of downloading, storing, and accessing mesh data from the anatomical atlases. Nevertheless, the rendering performance of brainrender could be a target for improvement in future versions, both for images and for mesh data, through optimizing the Actor classes. While we have designed brainrender usage to require minimal programming expertise, installing python and brainrender may still prove challenging for some users. In the future, we aim to make brainrender a stand-alone application that can be simply downloaded and locally installed, either through Docker containers or through executable files. Further possible improvements include the development of plug-ins for loading of data from file formats other than those already supported, and improvements to the GUI functionality. Moreover, in addition to images and videos, brainrender can be used to export renderings as HTML files and generate online 3D interactive renderings. Currently, however, embedding renderings into a web page remains far from a trivial task. Further developments on this front should make it possible to easily host interactive renderings online, therefore improving how anatomically registered data are disseminated both in scientific publications and in other media. While we plan to continue developing brainrender in the future, we welcome contributions from the community. Users should feel encouraged to contribute irrespective of their programming experience, and we note that the programming ability of many biologists is often better than what they perceive it to be. We especially welcome contributions aimed at improving the user-experience of brainrender, at any level of interaction. Contributions can involve active development of brainrender’s code base, but they can also be bug reports, features request, improvements with the online documentation, and help answering users’ questions.

Materials and methods

Key resources table.

Reagent type (species) or resource Designation Source or reference Identifiers Additional information
Software, algorithm Numpy https://doi.org/10.1038/s41586-020-2649-2 RRID:SCR_008633
Software, algorithm Vtk https://doi.org/10.1016/j.softx.2015.04.001 RRID:SCR_015013
Software, algorithm Vedo https://zenodo.org/record/4287635
Software, algorithm BrainGlobe Atlas API https://doi.org/10.21105/joss.02668
Software, algorithm Pandas https://doi.org/10.5281/zenodo.3509134
Software, algorithm Matplotlib doi: 10.1109/MCSE.2007.55 RRID:SCR_008624
Software, algorithm Jupyter doi:10.3233/978-1-61499-649-1-87 RRID:SCR_018416

Brainrender’s workflow

Brainrender is written in Python three and depends on standard python packages such as numpy, matplotlib, and pandas (Harris et al., 2020; Hunter, 2007; The pandas development team, 2020) and on vedo (Musy et al., 2019) and BrainGlobe’s AtlasAPI (Claudi et al., 2020). Extensive documentation on how to install and use brainrender can be found at docs.brainrender.info, and we provide here a only brief overview of the workflow in brainrender. The GitHub repository also contains detailed examples of Python scripts and Jupyter notebooks (Kluyver et al., 2016). All brainrender’s code is open-source and has been deposited in full in the GitHub repository and at PyPI (a repository of Python software) under a permissive BSD 3-Clause license. We welcome any user to download and inspect the source code, modify it as needed, or contribute to brainrender’s development directly.

Brainrender can be installed in any python environment using python version ≥ 3.6.0. We recommend the creation of an anaconda or virtual environment with an appropriate python version for use with brainrender. Installing brainrender is then as simple as ‘pip install brainrender’ although additional optional packages might have to be installed separately (e.g., to access data from the Allen Institute).

The central element of any visualization produced by brainrender is the Scene. A Scene controls which elements (Actors) are visualized and coordinates the rendering, the position of the camera’s point of view, the generation of screenshots and animations from the rendered scene, and other important actions.

Actors can be added to the scene in several ways. When loading data directly from a file with 3D mesh information (e.g. .obj), an Actor is generated automatically to represent the mesh in the rendering. When rendering data from other sources (e.g. from a .swc file with neuronal morphology or from a table of coordinates of labeled cells), dedicated functions in brainrender parse the input data and generate the corresponding Actors. Actors in brainrender have properties, such as color and transparency, that can be used to specify the appearance of a rendered actor accordingly to the user’s aesthetic preferences. Brainrender’s Scene and Actor functionality use vedo as the rendering engine (GitHub repository; Musy et al., 2019).

In addition to data loaded from external files, brainrender can directly load atlas data containing, for example, the 3D meshes of individual brain regions. This is done via BrainGlobe’s AtlasAPI to allow the same programming interface in brainrender to visualize data from any atlas supported by the AtlasAPI. Brainrender also provides additional functionality to interface with data available from projects that are part of the Allen Institute Mouse Atlas and Mouse Connectome projects (Wang et al., 2020; Oh et al., 2014). These projects provide an SDK (Software Development Kit) to directly download data from their database, and brainrender provides a simple interface for downloading gene expression and connectomics (streamlines) data. All atlas and connectomics data downloaded by brainrender can be loaded directly into a Scene as Actors.

Visualizing morphological data with reconstructions of individual neurons can be done by loading these type of data directly from .swc files or by downloading them in Python using morphapi – software from the BrainGlobe suite that provides a simple and unified interface with several databases of neuron morphologies (e.g., neuromorpho.org, Ascoli et al., 2007). Data downloaded with morphapi can be loaded directly into a brainrender scene for visualization.

Example code

As a demonstration of how easily renderings can be created in brainrender, the Python code (Figure 5) illustrates how to create a Scene and add Actors by loading 3D data from an .obj file and then adding brain regions to the visualization. Brainrender’s GitHub repository provides several simple and concise examples about how to use brainrender to load user data, atlas data, to edit rendered meshes (e.g., to change color or cut them with a plane), to save screenshots from rendered scenes, and to create animated videos.

Figure 5. Code examples.

Figure 5.

(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.

While brainrender is intended to be mainly a visualization tool, simple analyses can be carried out directly by leveraging functionality from either vedo or BrainGlobe’s AtlasAPI. For example, Vedo can access properties of actors added to a brainrender scene, which could be used to measure the distance between two actors or to check if two actors’ meshes intersect (Figure 6A). Similarly, BrainGlobe’s AtlasAPI provides methods to, for example, check whether a point (defined by a set of coordinates) is contained in a brain region of interest or to retrieve brain regions that are above or below a brain region of interest in the atlas’ hierarchy (Figure 6B).

Figure 6. Advanced code examples.

Figure 6.

(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.

The code and data used to generate the figures and videos in this article are made freely available at brainrender’s GitHub repository and provides examples of more advanced usage of brainrender’s functionality.

Benchmark tests

We designed a series of benchmark tests aimed at evaluating brainrender’s performance with different combinations of hardware and operating system. We used five tests designed to cover most aspects of brainrender’s functionality:

  • rendering large numbers (14, 16, 17) of cells using the Points actor.

  • using a plane to ‘slice’ the same number of cells (using the Scene.slice method).

  • rendering more than 1000 individual meshes representing brain regions from the Allen institute’s mouse brain.

  • making a short (3 s, 10 fps) animation of a spinning brain with several brain regions’ meshes displayed.

  • rendering (10 times) a 3D image representing the voxel-wise expression levels of gene Gpr161 in the mouse brain (data from the Allen Institute).

For each test, we estimated the time necessary to complete the test script as well as the frame rate of the interactive rendering. Four machines were used for benchmark tests (see Table 1). The results of the benchmark tests (see Key resource table) illustrate that although a GPU improves performance, in the absence of a dedicated GPU brainrender can handle rich interactive visualizations (for most user cases, the number of rendered mesh vertices is much lower than that used in the tests).

Acknowledgements

We thank Yu Lin Tan for sharing the single neuron morphology shown in 3D. The illustrations of a human, mouse, and zebrafish used in Figures 1, 2, and 3 were obtained from scidraw.io.

Funding Statement

The funders had no role in study design, data collection and interpretation, or the decision to submit the work for publication.

Contributor Information

Federico Claudi, Email: federico.claudi.17@ucl.ac.uk.

Tiago Branco, Email: t.branco@ucl.ac.uk.

Mackenzie W Mathis, EPFL, Switzerland.

Kate M Wassum, University of California, Los Angeles, United States.

Funding Information

This paper was supported by the following grants:

  • Gatsby Charitable Foundation GAT3361 to Troy W Margrie, Tiago Branco.

  • Wellcome 214333/Z/18/Z to Troy W Margrie.

  • Wellcome 214352/Z/18/Z to Tiago Branco.

  • Wellcome 090843/F/09/Z to Troy W Margrie, Tiago Branco.

  • Deutsche Forschungsgemeinschaft 390857198 to Ruben Portugues.

Additional information

Competing interests

No competing interests declared.

Author contributions

Conceptualization, Resources, Software, Validation, Visualization, Methodology, Writing - original draft, Project administration, Writing - review and editing.

Conceptualization, Resources, Software, Writing - original draft.

Conceptualization, Resources, Software, Writing - original draft.

Supervision, Project administration.

Supervision, Project administration.

Supervision, Funding acquisition, Writing - original draft, Project administration, Writing - review and editing.

Additional files

Transparent reporting form

Data availability

All code has been deposited on GitHub and is freely accessible (https://github.com/brainglobe/brainrender).

References

  1. Adkins RS, Aldridge AI, Allen S, Ament SA, An X, Armand E, BRAIN Initiative Cell Census Network (BICCN) A multimodal cell census and atlas of the mammalian primary motor cortex. bioRxiv. 2020 doi: 10.1101/2020.10.19.343129. [DOI] [PMC free article] [PubMed]
  2. Arganda-Carreras I, Manoliu T, Mazuras N, Schulze F, Iglesias JE, Bühler K, Jenett A, Rouyer F, Andrey P. A statistically representative Atlas for mapping neuronal circuits in the Drosophila Adult Brain. Frontiers in Neuroinformatics. 2018;12:13. doi: 10.3389/fninf.2018.00013. [DOI] [PMC free article] [PubMed] [Google Scholar]
  3. Arshadi C, Eddison M, Gunther UA, Harrington KI. SNT: a unifying toolbox for quantification of neuronal anatomy. bioRxiv. 2020 doi: 10.1101/2020.07.13.179325. [DOI] [PubMed]
  4. Ascoli GA, Donohue DE, Halavi M. NeuroMorpho.Org: a central resource for neuronal morphologies. Journal of Neuroscience. 2007;27:9247–9251. doi: 10.1523/JNEUROSCI.2055-07.2007. [DOI] [PMC free article] [PubMed] [Google Scholar]
  5. Bates AS, Manton JD, Jagannathan SR, Costa M, Schlegel P, Rohlfing T, Jefferis GS. The Natverse, a versatile toolbox for combining and analysing neuroanatomical data. eLife. 2020;9:e53350. doi: 10.7554/eLife.53350. [DOI] [PMC free article] [PubMed] [Google Scholar]
  6. Chon U, Vanselow DJ, Cheng KC, Kim Y. Enhanced and unified anatomical labeling for a common mouse brain atlas. Nature Communications. 2019;10:5067. doi: 10.1038/s41467-019-13057-w. [DOI] [PMC free article] [PubMed] [Google Scholar]
  7. Claudi F, Petrucco L, Tyson A, Branco T, Margrie T, Portugues R. BrainGlobe atlas API: a common interface for neuroanatomical atlases. Journal of Open Source Software. 2020;5:2668. doi: 10.21105/joss.02668. [DOI] [Google Scholar]
  8. Ding S‐L, Royall JJ, Sunkin SM, Ng L, Facer BAC, Lesnar P, Guillozet‐Bongaarts A, McMurray B, Szafer A, Dolbeare TA, Stevens A, Tirrell L, Benner T, Caldejon S, Dalley RA, Dee N, Lau C, Nyhus J, Reding M, Riley ZL, Sandman D, Shen E, Kouwe A, Varjabedian A, Write M, Zollei L, Dang C, Knowles JA, Koch C, Phillips JW, Sestan N, Wohnoutka P, Zielke HR, Hohmann JG, Jones AR, Bernard A, Hawrylycz MJ, Hof PR, Fischl B, Lein ES. Comprehensive cellular‐resolution atlas of the adult human brain. Journal of Comparative Neurology. 2016;524:3127–3481. doi: 10.1002/cne.24080. [DOI] [PMC free article] [PubMed] [Google Scholar]
  9. Fürth D, Vaissière T, Tzortzi O, Xuan Y, Märtin A, Lazaridis I, Spigolon G, Fisone G, Tomer R, Deisseroth K, Carlén M, Miller CA, Rumbaugh G, Meletis K. An interactive framework for whole-brain maps at cellular resolution. Nature Neuroscience. 2018;21:139–149. doi: 10.1038/s41593-017-0027-7. [DOI] [PMC free article] [PubMed] [Google Scholar]
  10. Goubran M, Leuze C, Hsueh B, Aswendt M, Ye L, Tian Q, Cheng MY, Crow A, Steinberg GK, McNab JA, Deisseroth K, Zeineh M. Multimodal image registration and connectivity analysis for integration of connectomic data from microscopy to MRI. Nature Communications. 2019;10:5504. doi: 10.1038/s41467-019-13374-0. [DOI] [PMC free article] [PubMed] [Google Scholar]
  11. Harris CR, Millman KJ, van der Walt SJ, Gommers R, Virtanen P, Cournapeau D, Wieser E, Taylor J, Berg S, Smith NJ, Kern R, Picus M, Hoyer S, van Kerkwijk MH, Brett M, Haldane A, Del Río JF, Wiebe M, Peterson P, Gérard-Marchant P, Sheppard K, Reddy T, Weckesser W, Abbasi H, Gohlke C, Oliphant TE. Array programming with NumPy. Nature. 2020;585:357–362. doi: 10.1038/s41586-020-2649-2. [DOI] [PMC free article] [PubMed] [Google Scholar]
  12. Hunter JD. Matplotlib: a 2D graphics environment. Computing in Science & Engineering. 2007;9:90–95. doi: 10.1109/MCSE.2007.55. [DOI] [Google Scholar]
  13. Jin M, Nguyen JD, Weber SJ, Mejias-Aponte CA, Madangopal R. SMART: an open source extension of whole brain for iDISCO+ LSFM intact mouse brain registration and segmentation. bioRxiv. 2019 doi: 10.1101/727529. [DOI] [PMC free article] [PubMed]
  14. Kluyver T, Ragan-Kelley B, Pérez F, Granger B, Bussonnier M, Frederic J, Kelley K. Jupyter Notebooks - a Publishing Format for Reproducible Computational Workflows. In: Loizides F. ernando, Scmidt B. irgit., editors. Positioning and Power in Academic Publishing: Players, Agents and Agendas. Netherlands: IOS Press; 2016. pp. 87–90. [Google Scholar]
  15. Kunst M, Laurell E, Mokayes N, Kramer A, Kubo F, Fernandes AM, Förster D, Dal Maschio M, Baier H. A Cellular-Resolution atlas of the larval zebrafish brain. Neuron. 2019;103:21–38. doi: 10.1016/j.neuron.2019.04.034. [DOI] [PubMed] [Google Scholar]
  16. Lein ES, Hawrylycz MJ, Ao N, Ayres M, Bensinger A, Bernard A, Boe AF, Boguski MS, Brockway KS, Byrnes EJ, Chen L, Chen L, Chen TM, Chin MC, Chong J, Crook BE, Czaplinska A, Dang CN, Datta S, Dee NR, Desaki AL, Desta T, Diep E, Dolbeare TA, Donelan MJ, Dong HW, Dougherty JG, Duncan BJ, Ebbert AJ, Eichele G, Estin LK, Faber C, Facer BA, Fields R, Fischer SR, Fliss TP, Frensley C, Gates SN, Glattfelder KJ, Halverson KR, Hart MR, Hohmann JG, Howell MP, Jeung DP, Johnson RA, Karr PT, Kawal R, Kidney JM, Knapik RH, Kuan CL, Lake JH, Laramee AR, Larsen KD, Lau C, Lemon TA, Liang AJ, Liu Y, Luong LT, Michaels J, Morgan JJ, Morgan RJ, Mortrud MT, Mosqueda NF, Ng LL, Ng R, Orta GJ, Overly CC, Pak TH, Parry SE, Pathak SD, Pearson OC, Puchalski RB, Riley ZL, Rockett HR, Rowland SA, Royall JJ, Ruiz MJ, Sarno NR, Schaffnit K, Shapovalova NV, Sivisay T, Slaughterbeck CR, Smith SC, Smith KA, Smith BI, Sodt AJ, Stewart NN, Stumpf KR, Sunkin SM, Sutram M, Tam A, Teemer CD, Thaller C, Thompson CL, Varnam LR, Visel A, Whitlock RM, Wohnoutka PE, Wolkey CK, Wong VY, Wood M, Yaylaoglu MB, Young RC, Youngstrom BL, Yuan XF, Zhang B, Zwingman TA, Jones AR. Genome-wide atlas of gene expression in the adult mouse brain. Nature. 2007;445:168–176. doi: 10.1038/nature05453. [DOI] [PubMed] [Google Scholar]
  17. Markov DA, Kist AM, Petrucco L, Portugues R. The cerebellum recalibrates a feedback controller involved in motor control. bioRxiv. 2020 doi: 10.1101/2020.02.12.945956. [DOI]
  18. Mathis A, Mamidanna P, Cury KM, Abe T, Murthy VN, Mathis MW, Bethge M. DeepLabCut: markerless pose estimation of user-defined body parts with deep learning. Nature Neuroscience. 2018;21:1281–1289. doi: 10.1038/s41593-018-0209-y. [DOI] [PubMed] [Google Scholar]
  19. Muller E, Bednar JA, Diesmann M, Gewaltig MO, Hines M, Davison AP. Python in neuroscience. Frontiers in Neuroinformatics. 2015;9:11. doi: 10.3389/fninf.2015.00011. [DOI] [PMC free article] [PubMed] [Google Scholar]
  20. Musy M, Dalmasso G, Sullivan B. Visualization Toolkit; 2019. https://pypi.org/project/vedo/ [Google Scholar]
  21. Oh SW, Harris JA, Ng L, Winslow B, Cain N, Mihalas S, Wang Q, Lau C, Kuan L, Henry AM, Mortrud MT, Ouellette B, Nguyen TN, Sorensen SA, Slaughterbeck CR, Wakeman W, Li Y, Feng D, Ho A, Nicholas E, Hirokawa KE, Bohn P, Joines KM, Peng H, Hawrylycz MJ, Phillips JW, Hohmann JG, Wohnoutka P, Gerfen CR, Koch C, Bernard A, Dang C, Jones AR, Zeng H. A mesoscale connectome of the mouse brain. Nature. 2014;508:207–214. doi: 10.1038/nature13186. [DOI] [PMC free article] [PubMed] [Google Scholar]
  22. Pachitariu M, Stringer C, Dipoppa M, Schröder S, Rossi LF, Dalgleish H, Carandini M, Harris KD. Suite2p: beyond 10,000 neurons with standard Two-Photon microscopy. bioRxiv. 2017 doi: 10.1101/061507. [DOI]
  23. Renier N, Adams EL, Kirst C, Wu Z, Azevedo R, Kohl J, Autry AE, Kadiri L, Umadevi Venkataraju K, Zhou Y, Wang VX, Tang CY, Olsen O, Dulac C, Osten P, Tessier-Lavigne M. Mapping of brain activity by automated volume analysis of immediate early genes. Cell. 2016;165:1789–1802. doi: 10.1016/j.cell.2016.05.007. [DOI] [PMC free article] [PubMed] [Google Scholar]
  24. Shamash P, Carandini M, Harris K, Steinmetz N. A tool for analyzing electrode tracks from slice histology. bioRxiv. 2018 doi: 10.1101/447995. [DOI]
  25. Simmons DM, Swanson LW. Comparing histological data from different brains: sources of error and strategies for minimizing them. Brain Research Reviews. 2009;60:349–367. doi: 10.1016/j.brainresrev.2009.02.002. [DOI] [PMC free article] [PubMed] [Google Scholar]
  26. Sofroniew N, Lambert T. Napari/Napari. 0.3.8rc1Zenodo. 2020 doi: 10.5281/zenodo.4046812. [DOI]
  27. Song JH, Choi W, Song YH, Kim JH, Jeong D, Lee SH, Paik SB. Precise mapping of single neurons by calibrated 3D reconstruction of brain slices reveals topographic projection in mouse visual cortex. Cell Reports. 2020;31:107682. doi: 10.1016/j.celrep.2020.107682. [DOI] [PubMed] [Google Scholar]
  28. Steinmetz NA, Zatka-Haas P, Carandini M, Harris KD. Distributed coding of choice, action and engagement across the mouse brain. Nature. 2019;576:266–273. doi: 10.1038/s41586-019-1787-x. [DOI] [PMC free article] [PubMed] [Google Scholar]
  29. The pandas development team Pandas-Dev/Pandas: Pandas. 1.2.3Zenodo. 2020 doi: 10.5281/zenodo.3509134. [DOI]
  30. Tyson AL, Rousseau CV, Niedworok CJ. A deep learning algorithm for 3D cell detection in whole mouse brain image datasets. bioRxiv. 2020a doi: 10.1101/2020.10.21.348771. [DOI] [PMC free article] [PubMed]
  31. Tyson AL, Rousseau CV. brainreg: automated 3D brain registration with support for multiple species and atlases. 0.1.5Zenodo. 2020b doi: 10.5281/zenodo.3991718. [DOI]
  32. Wang Q, Ding SL, Li Y, Royall J, Feng D, Lesnar P, Graddis N, Naeemi M, Facer B, Ho A, Dolbeare T, Blanchard B, Dee N, Wakeman W, Hirokawa KE, Szafer A, Sunkin SM, Oh SW, Bernard A, Phillips JW, Hawrylycz M, Koch C, Zeng H, Harris JA, Ng L. The allen mouse brain common coordinate framework: a 3D reference atlas. Cell. 2020;181:936–953. doi: 10.1016/j.cell.2020.04.007. [DOI] [PMC free article] [PubMed] [Google Scholar]
  33. Winnubst J, Bas E, Ferreira TA, Wu Z, Economo MN, Edson P, Arthur BJ, Bruns C, Rokicki K, Schauder D, Olbris DJ, Murphy SD, Ackerman DG, Arshadi C, Baldwin P, Blake R, Elsayed A, Hasan M, Ramirez D, Dos Santos B, Weldon M, Zafar A, Dudman JT, Gerfen CR, Hantman AW, Korff W, Sternson SM, Spruston N, Svoboda K, Chandrashekar J. Reconstruction of 1,000 projection neurons reveals new cell types and organization of Long-Range connectivity in the mouse brain. Cell. 2019;179:268–281. doi: 10.1016/j.cell.2019.07.042. [DOI] [PMC free article] [PubMed] [Google Scholar]
  34. Yaoyao H. BrainMesh: A Matlab Gui for Rendering 3D Mouse Brain Structures. 3.0Github. 2020 https://github.com/Yaoyao-Hao/BrainMesh
  35. Young DM, Duhn C, Gilson M, Nojima M, Yuruk D, Kumar A, Yu W, Sanders SJ. Whole-Brain image analysis and anatomical atlas 3D generation using MagellanMapper. Current Protocols in Neuroscience. 2020;94:e104. doi: 10.1002/cpns.104. [DOI] [PMC free article] [PubMed] [Google Scholar]

Decision letter

Editor: Mackenzie W Mathis1
Reviewed by: Juan Nunez-Iglesias2

Our editorial process produces two outputs: (i) public reviews designed to be posted alongside the preprint for the benefit of readers; (ii) feedback on the manuscript for the authors, including requests for revisions, shown below. We also include an acceptance summary that explains what the editors found interesting or important about the work.

Acceptance summary:

Claudi et al., present a new tool for visualizing brain maps. In the era of new technologies to clear and analyze brains of model organisms, new tools are becoming increasingly important for researchers to interact with this data. Here, the authors report on a new python-based tool for just this: exploring, visualizing, and rendering this high dimensional (and large) data. Moreover, the authors provide rendering performance benchmarking, open source code, and extensive documentation. We believe this tool will be of great interest to researchers who need to visualize multiple brains within several key model organisms, and is written such that it can be adopted rapidly by the neuroscientific community.

Decision letter after peer review:

Thank you for submitting your article "Brainrender: a python-based software for visualizing anatomically registered data" for consideration by eLife. Your article has been reviewed by three peer reviewers, one of whom is a member of our Board of Reviewing Editors, and the evaluation has been overseen by Kate Wassum as the Senior Editor. The following individual involved in review of your submission has agreed to reveal their identity: Juan Nunez-Iglesias (Reviewer #2).

The reviewers have discussed their reviews with one another, and the Reviewing Editor has drafted this to help you prepare a revised submission.

Essential Revisions:

1) All reviews highlight some additional information required regarding usability (which file types are already supported out of the box, computational resources, run times, minimal example code in methods, how hard/easy is it given one's level of coding, etc.). We agreed these are critical. Please address each of these concerns.

2) 2 of 3 reviewers mention the need for citations of dependencies, so please address both reviewer #1 and #2's specific comments on this below.

3) Lastly, please consider revising the Conclusion/Discussion section. Some text feels redundant, and this space could be used to discuss limitations and future expansions more directly. Each review highlights some very nice strengths and some limitations, so please consider the recommendations when you edit this section.

Please include a key resource table if you have not already done so.

Reviewer #2 (Recommendations for the authors):

The paper does a great job of describing the need for this new software, as well most of the capabilities of the software. I did wonder specifically which file formats, other than.obj and.stl, were supported. Specifically, in subsection “Design principles and implementation”, it would be good to introduce at least one sentence about the exact IO capabilities of brainrender “out of the box”, as well as noting that the full scientific Python ecosystem can provide support for other formats. In fact, a whole section/paragraph about how to import data from custom file formats (e.g. a.czi file?) would be most welcome. I expect the first question of many readers will be "how do I get my data into this to try it out?"

The whole Conclusions section felt rather redundant. Even though this is common in scientific writing, I'd remove most of it, reduce it to one sentence, and instead elaborate on "limitations and future directions". I expect the authors can certainly come up with more ideas there (e.g. IO plugins?), as well as existing bugs (e.g. Video 4 has some distracting flickering on the electrodes – it's unclear to me whether this is expected, but I suspect not). Additionally, I recommend using this section to point out that readers can and should get involved with future development. The line "We welcome any user to.…" should be a paragraph in future directions rather than a one-liner in the Materials and methods. "We welcome users to submit bug reports and feature requests on our GitHub issues page, as well as usage questions on image.sc. Further, given the completely open source nature of the software, we especially welcome users who would like to help us improve the software for their use case…" In my experience, most biologists don't see themselves as capable of doing this, and most of those are wrong, so this is a good space to dispel that notion.

As an aside, the references need work. Many are incomplete, including two from this paper's co-authors (Tyson 2020a/b). Additionally, although NumPy is appropriately cited, several other packages are not:

– matplotlib is used for its colormaps; this should be mentioned in the methods and matplotlib cited.

– Jupyter is used for documentation and the Scene has some Jupyter compatibility, but Jupyter is not cited. Citation info for Jupyter appears to be discussed in this github comment: https://github.com/jupyter/jupyter/issues/190#issuecomment-721264013

– Pandas is used but not cited.

– I notice napari is used but only for its theme – I'd say it's appropriate to not cite it. Indeed, I would recommend the authors remove that dependency and instead copy the very small amount of information that they need from it.

A good resource for citation info in the scientific Python ecosystem is found here:

https://www.scipy.org/citing.html

I would also recommend naming NumPy specifically in the Materials and methods section (as well as the above packages), as I initially missed that the authors had appropriately cited it – just buried under the generic "standard python packages"

Finally, although there is a screenshot of the brainrender UI, *and* the supplementary videos show renderings created with brainrender, there is not a screen-captured video demonstrating the brainrender UI being used to generate a video. I would suggest including one as part of the supplementary materials, as that is something that many readers will be looking for – it is very hard to convey the usability of GUI software using text alone.

All in all, those are all easily fixed points and would encourage publication of the paper.

Reviewer #3 (Recommendations for the authors):

1) Emphasize the importance and difficulty of having accurately registered data. In our experience, this is the hardest part of the process, and it is just lightly discussed as a requirement for using the tool.

2) They state that it is easy to incorporate another atlas through the brainreg software, which can then be used with brainrender. As mentioned, it is our opinion that this is not a straight-forward task and that it would require significant programming skills to implement. Please provide more direction about how this can be done and what the constraints are.

3) One of the stated advantages of this software is the ability to visualize multiple types of data and data from sources that are external to the atlas generators. Such visualizations can potentially be used to reveal consistency and/or novelty across data types. However, ultimately you would want to be able to measure these differences. Including examples about how to extract and compare features across data types and then visualize those differences with brainrender would strengthen the paper.

4) The snapshots of code presented as figures don't add much to the manuscript. Consider highlighting how-to videos instead.

5) As stated in earlier comments, some of the functionality is not clear, particularly for people unfamiliar or new to 3D visualization or coding in general. Even experienced developers would benefit from specs for the various input data types, for example. A little more explanation, particularly in cases where the interface is different (such as with the helper functions used to make some actors), can greatly improve the user experience.

6) Though the purpose of this tool is not to develop a registration algorithm for anatomical reference atlases, or to perform data analysis, we view these steps as the most difficult and necessary steps in this process. 3D rendered data visualizations are informative, but not meaningful without accurate registration to begin with and without quantitative analysis to back it up. As they point out in the introduction, other, similar tools (natverse, MagellanMapper) have both visualization and analysis capabilities.

eLife. 2021 Mar 19;10:e65751. doi: 10.7554/eLife.65751.sa2

Author response


Essential Revisions:

1) All reviews highlight some additional information required regarding usability (which file types are already supported out of the box, computational resources, run times, minimal example code in Materials and methods, how hard/easy is it given one's level of coding, etc.). We agreed these are critical. Please address each of these concerns.

2) 2 of 3 reviewers mention the need for citations of dependencies, so please address both reviewer #1 and #2's specific comments on this below.

3) Lastly, please consider revising the Conclusion/Discussion section. Some text feels redundant, and this space could be used to discuss limitations and future expansions more directly. Each review highlights some very nice strengths and some limitations, so please consider the recommendations when you edit this section.

Please include a key resource table if you have not already done so.

We are grateful for the reviewers’ comments, which we found very helpful for improving the manuscript, as well as some of the code base and online documentation. We have addressed all of the concerns raised by including information about usability where this was missing, running benchmarking tests, citing references relevant to brainrender’s dependencies, and extensively revising the Discussion section to focus on the software’s strengths, limitations and opportunities for future improvements.

We now also include a key resource table.

Reviewer #2 (Recommendations for the authors):

The paper does a great job of describing the need for this new software, as well most of the capabilities of the software. I did wonder specifically which file formats, other than.obj and.stl, were supported. Specifically, in subsection “Design principles and implementation”, it would be good to introduce at least one sentence about the exact IO capabilities of brainrender *out of the box*, as well as noting that the full scientific Python ecosystem can provide support for other formats. In fact, a whole section/paragraph about how to import data from custom file formats (e.g. a.czi file?) would be most welcome. I expect the first question of many readers will be "how do I get my data into this to try it out?"

Yes, this is a very good point and we have now added a whole new section to the online documentation detailing the available options for getting data into brainrender: https://docs.brainrender.info/usage/using-your-data. We have also added new examples to the online repository illustrating how users can load and re-orient their data to visualize them in brainrender alongside atlas data.

In brief, brainrender can load directly cell coordinates and image (volume) data from.npy files, it can load streamlines data from.json (provided that they are in the correct format, as now stated in the online documentation) and it can load neuron morphology data from.swc (using morphapi). As suggested by the reviewer, we now include this information in the manuscript. We now also point out that the wider python ecosystem provides libraries for loading the most used file formats, and that brainglobe provides Imio as a convenient tool for loading anatomical data.

In the revised manuscript we also emphasize the critical data pre-processing steps that must be done before using brainrender (e.g., registration to an atlas template). As pointed out by another reviewer, these can be challenging for some users, and thus we now also briefly mention brainreg and bg-space as two brainglobe’s suite tools that can facilitate these preprocessing steps.

The whole Conclusions section felt rather redundant. Even though this is common in scientific writing, I'd remove most of it, reduce it to one sentence, and instead elaborate on "limitations and future directions". I expect the authors can certainly come up with more ideas there (e.g. IO plugins?), as well as existing bugs (e.g. Video 4 has some distracting flickering on the electrodes – it's unclear to me whether this is expected, but I suspect not). Additionally, I recommend using this section to point out that readers can and should get involved with future development. The line "We welcome any user to.…" should be a paragraph in future directions rather than a one-liner in the Materials and methods. "We welcome users to submit bug reports and feature requests on our GitHub issues page, as well as usage questions on image.sc. Further, given the completely open source nature of the software, we especially welcome users who would like to help us improve the software for their use case…" In my experience, most biologists don't see themselves as capable of doing this, and most of those are wrong, so this is a good space to dispel that notion.

We have taken the reviewer’s advice and substituted the Conclusions section by an expanded subsection “Limitations and future direction”, which now discusses additional topics such as rendering performance and processing steps required before data can be used meaningfully in brainrender.

Incidentally, the “flickering” observed in Video 4 was not a bug: it was meant to show which probe channels detected a spike at any given moment in time (we now realise that the video legends were not appended to the video; we apologise for this and have included video legends in a separate submission file). We have now edited the video so that the highlighted channels are updated every 5seconds (instead of every frame) hopefully improving the video’s quality.

We strongly agree that development should be open to all and in particular to the end users who benefit the most from improvements in the software. We also very much agree with the comment on the perceived programming ability of most biologists. As suggested by the reviewer we have emphasized this point in the discussion and explicitly invited users to contribute regardless of their programming experience. We now write:

“While we plan to continue developing brainrender in the future, we welcome contributions from the community. Users should feel encouraged to contribute irrespective of their programming experience, and we note that the programming ability of many biologists is often better than what they perceive it to be. We especially welcome contributions aimed at improving the user-experience of brainrender, at any level of interaction. Contributions can involve active development of brainrender's code base, but they can also be bug reports, features request, improvements with the online documentation and help answering users' questions.”

As an aside, the references need work. Many are incomplete, including two from this paper's co-authors (Tyson 2020a/b). Additionally, although NumPy is appropriately cited, several other packages are not:

– matplotlib is used for its colormaps; this should be mentioned in the methods and matplotlib cited.

– Jupyter is used for documentation and the Scene has some Jupyter compatibility, but Jupyter is not cited. Citation info for Jupyter appears to be discussed in this github comment: https://github.com/jupyter/jupyter/issues/190#issuecomment-721264013

– Pandas is used but not cited.

– I notice napari is used but only for its theme – I'd say it's appropriate to not cite it. Indeed, I would recommend the authors remove that dependency and instead copy the very small amount of information that they need from it.

A good resource for citation info in the scientific Python ecosystem is found here:

https://www.scipy.org/citing.html

I would also recommend naming NumPy specifically in the methods section (as well as the above packages), as I initially missed that the authors had appropriately cited it – just buried under the generic "standard python packages"

Thank you for pointing these out, we apologize for these shortcomings which we have now corrected. As suggested by the reviewer we have also updated brainrender’s code to remove the dependency on napari.

Finally, although there is a screenshot of the brainrender UI, *and* the supplementary videos show renderings created with brainrender, there is not a screen-captured video demonstrating the brainrender UI being used to generate a video. I would suggest including one as part of the supplementary materials, as that is something that many readers will be looking for – it is very hard to convey the usability of GUI software using text alone.

We have added a supplementary video (Video 5) illustrating the main functionality supported by the GUI.

All in all, those are all easily fixed points and would encourage publication of the paper.

Thank you for the support and for raising these points.

Reviewer #3 (Recommendations for the authors):

1) Emphasize the importance and difficulty of having accurately registered data. In our experience, this is the hardest part of the process, and it is just lightly discussed as a requirement for using the tool.

We have expanded the discussion on data registration in subsection “Limitations and futured directions” of the revised manuscript:

“With brainrender we aimed to make the rendering process as simple as possible. Nevertheless, some more technically demanding pre-processing steps of raw image data are necessary before they can be visualized in brainrender. In particular, a critical step for visualizing anatomical data is the registration to a reference template (e.g., one of the atlases provided by the AtlasAPI). While this step can be challenging and time consuming, the brainglobe suite provides software to facilitate this process (e.g., brainreg and bg-space), and alternative software tools have been developed before for this purpose (e.g., Song et al., (2020), Jin et al., (2019)). Additional information about data registration can be found in brainglobe's and brainrender's online documentation, as well as in the examples in brainrender GitHub repository.”

In addition, we have added a new section to the online documentation detailing how users can visualize their data in brainrender: https://docs.brainrender.info/usage/using-your-data, and we have added new examples to the online repository illustrating how users can load and re-orient their data to visualize them in brainrender alongside atlas data.

2) They state that it is easy to incorporate another atlas through the brainreg software, which can then be used with brainrender. As mentioned, it is our opinion that this is not a straight-forward task and that it would require significant programming skills to implement. Please provide more direction about how this can be done and what the constraints are.

We take the reviewer’s point and we have now removed the wording “new atlases can be easily adapted to work with the API” from the Results section. We have also edited the Discussion to directly address this issue:

“A related challenge is integrating new anatomical atlases into the AtlasAPI. While we anticipate that most users will not have this need, it is a non-trivial task that requires considerable programming skills. We believe that brainglobe’s AtlasAPI greatly facilitates this process, which is presented in Claudi et al. 2020 and has extensive online documentation (https://docs.brainglobe.info/bg-atlasapi/introduction).”

3) One of the stated advantages of this software is the ability to visualize multiple types of data and data from sources that are external to the atlas generators. Such visualizations can potentially be used to reveal consistency and/or novelty across data types. However, ultimately you would want to be able to measure these differences. Including examples about how to extract and compare features across data types and then visualize those differences with brainrender would strengthen the paper.

While noting that brainrender is intended to be mainly a visualisation tool, we have now expanded the subsection “Example code” to include two examples of how simple analyses can be performed with brainrender (new Figure 6). One of the examples shows how compute the distance between the centre of mass of two injection sites, and the other shows how to extract the brain location of specific channels of a silicon probe.

4) The snapshots of code presented as figures don't add much to the manuscript. Consider highlighting how-to videos instead.

We have followed the reviewer’s suggestion and added a supplementary video illustrating how to use brainrender’s GUI (Video 5). Since another reviewer had the opposite opinion on the usefulness of the code snapshots, we have opted to also keep them in the manuscript.

5) As stated in earlier comments, some of the functionality is not clear, particularly for people unfamiliar or new to 3D visualization or coding in general. Even experienced developers would benefit from specs for the various input data types, for example. A little more explanation, particularly in cases where the interface is different (such as with the helper functions used to make some actors), can greatly improve the user experience.

We thank the reviewer for pointing out places in which the code and the documentation were not clear. We have now expanded the online documentation. In particular, the point about clarifying what data types are supported and how data can be loaded into brainrender was also raised by another reviewer, and as we mention in the reply to point 1, the documentation now includes a section dedicated to IO functionality.

We have also addressed the use of helper functions in the documentation. In brief, Streamlines and Neuron actors are most often used to visualize multiple instances of such classes at once. We thus provide helper functions to facilitate the creation of multiple Streamlines and Neuron instances. As we show in the online examples, however, these classes can also be used without the helper function, similar to the other actor classes.

6) Though the purpose of this tool is not to develop a registration algorithm for anatomical reference atlases, or to perform data analysis, we view these steps as the most difficult and necessary steps in this process. 3D rendered data visualizations are informative, but not meaningful without accurate registration to begin with and without quantitative analysis to back it up. As they point out in the introduction, other, similar tools (natverse, MagellanMapper) have both visualization and analysis capabilities.

We agree that 3D data registration is indeed a technically demanding step that is necessary before data can be visualised in brainrender. As we mention in our reply to point 1, the revised manuscript now discusses this explicitly and we have added additional online documentation on this topic: https://docs.brainrender.info/usage/using-your-data/registeringdata.

Associated Data

    This section collects any data citations, data availability statements, or supplementary materials included in this article.

    Supplementary Materials

    Transparent reporting form

    Data Availability Statement

    All code has been deposited on GitHub and is freely accessible (https://github.com/brainglobe/brainrender).


    Articles from eLife are provided here courtesy of eLife Sciences Publications, Ltd

    RESOURCES