Skip to main content

Python scripts to use Allen Brain Map data for analysis and rendering

Project description

BrainRender

brainrender is a python package for the visualization of three dimensional neuroanatomical data. It can be used to render data from publicly available dataset (e.g. Allen Brain atlas) as well as user generated experimental data. The goal of brainrender is to faciliate the exploration and dissemination of neuroanatomical data by providing a user-friendly platform to create high-quality 3D renderings.

For more information about brainrender and how to use it, please check the brainrender docs. You can also have a look at the brainrender preprint and the examples and tutorials. You can find interactive examples of data visualisations generated with brainrender here and a gallery of images created with brainrender here.

Installation

To install brainrender, you use an existing python environment or create a new one [with python < 3.8]. Then simply install with:

pip install brainrender - U

If you want the most recent version of brainrender's code, you can get it directly from github with:

pip install -U git+https://github.com/BrancoLab/BrainRender.git

To quickly check that everything worked for your installation, try creating a brainrender scene directly from the terminal.

  brainrender TH STR -c

Usage

brainrender relies on brainglobe's brainatlas-api to fetch structural and morphological data for various brain atlases, including two mice atlases, one zebrafish atlas and one atlas of the human brain. Much of what brainrender can do works across all of these atlases. Basic functionality supported by brainrender inclused the display of anatomical brain region, the position of labelled cells from tracking experiments (e.g. as obtained with tools like cellfinder) and whole-cell neuronal morphological reconstructions. Click on the images below to see aexamples of how to use brainrender:

Brain structures Labelled cells Neuron reconstructions

brain_regions.py

labelled_cells2.py

colored_neurons.py

Mouse brain-specific

Some of brainrenders functionality is specific to the atlases based on the Allen mouse brain atlas. This includes functionality to render publicly available as well as user-generated data.

Publicly available datasets

Brainrender can be used to download a visualize a neuroanatomical data from several publicly available datasets based on the Allen Atlas of the mouse brain. Anatomical and projection data is downloaded from the Allen Brain Atlas reference atlas and connectivity atlas using the Allen API (© 2015 Allen Institute for Brain Science. Allen Brain Atlas API. Available from: https://brain-map.org/api/index.html) ([1], [2]). Brainrender can also be used to download and visualise gene expression data from the Allen database and neurons morphological data from Janelia's mouse light project (see the neurons browser). [3]

Streamlines Tractography

streamlines.py

tractography.py
gene expression MouseLight

gene_expression.py

mouselight.py

User generated

brainrender can be used to visualise the location of implanted neuropixel probes with data from SHARP TRACK.

Neuropixel

sharptrack.py

Exporting

To facilitate the creation of scientific illustrations, brainrender let's you take screenshots of your scenes, create animated videos and embed interactive visualisations scenes in your website.

To learn how to do it, check these examples:

Other

brainrender relies on the powerful vedo(https://vedo.embl.es) (github) rendering engine, thus providing you with the flexibility to render just about anything you might need for your visualisation. As an example, here you can see how to visualise the location of an implanted optic fiber or any other 3d object from an .stl or .obj file.

Optic fibre .stl file visualisation .obj file visualisation

add_optic_cannula.py

add_object_to_scene.py

add_object_to_scene.py

A few more things you can do to improve your visualizations:

Other atlases

In addition to the atlases supported by brainatlas-api, you can easily create new Atlas classes to support the visualisation of your own datasets in brainrender (see here for more details). As a way of example we provide two such classes. One to visualise insect brains from insectbraindb.org and one for C. Elegans connectome data from Daniel Witvliet's recent preprint.

Insect brains C. Elegans connectome

insects_brains.py

celegans_connectome.py

Getting in touch

If you're unsure how to use brainrender, please start by having a look at the user guide and the examples notebooks. If you still have unanswered questions, please do not hesitate to get in touch (the easiest way is to open an issue on github).

For any bug report or feature request, please open an issue with a brief description of the matter. Although brainrender can already to much, we are always happy to add more functionality that could be useful for users. If you spot some feature that is missing, we'd love to hear about is so please get in touch!

Referencing Brain Render

If you found BrainRender useful and decided to include a rendering in your talks, posters or article, please acknowledge BrainRender's contribution by citing the brainrender preprint as:

Brainrender. A python based software for visualisation of neuroanatomical and morphological data.
Federico Claudi, Adam L. Tyson, Tiago Branco
bioRxiv 2020.02.23.961748; doi: https://doi.org/10.1101/2020.02.23.961748 

Similar tools

In R

cocoframer is an R library for interacting with the Allen's Mouse CCF github repository.

mouselightr package generates 3D CCF mouse brain plots, along with MouseLight neuron reconstructions github repository

In Matlab

BrainMesh is a Matlab GUI for rendering 3D mouse brain structure github repository.

References

  • [1] Lein, E.S. et al. (2007) Genome-wide atlas of gene expression in the adult mouse brain, Nature 445: 168-176. doi:10.1038/nature05453
  • [2] Oh, S.W. et al. (2014) A mesoscale connectome of the mouse brain, Nature 508: 207-214. doi:10.1038/nature13186
  • [3] Winnubst, J. et al. (2019) Reconstruction of 1,000 Projection Neurons Reveals New Cell Types and Organization of Long-Range Connectivity in the Mouse Brain, Cell 179: 268-281
  • [4] Knowx et al (2018). High-resolution data-driven model of the mouse connectome. -->

Behind the scenes

Brainrender was deisgned to be a powerful and flexible software for downloading and rendering neuroanatomical data while still being relatively easy to use (using brainrender requires minimal coding experience). This was achieved by:

  1. handling the interaction with the API, SDK and databases services used to find and download the data behind the scenes, requiring minimal user input.
  2. Using vedo to handle the rendering. vedo (github repo) is a powerful rendering engine that produces high quality three dimensional rendering. vedo is also flexible, meaning that it can handle data provided in various file formats, allowing brainrender to render data from various sources.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brainrender-1.0.0.1.dev0.tar.gz (94.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brainrender-1.0.0.1.dev0-py3-none-any.whl (121.6 kB view details)

Uploaded Python 3

File details

Details for the file brainrender-1.0.0.1.dev0.tar.gz.

File metadata

  • Download URL: brainrender-1.0.0.1.dev0.tar.gz
  • Upload date:
  • Size: 94.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.4

File hashes

Hashes for brainrender-1.0.0.1.dev0.tar.gz
Algorithm Hash digest
SHA256 fc44a32e3db30a56d26b5b06e3f67570e6a74c1281c7b83f2db37b207405c797
MD5 d0140f0f6a11f2ac33837c66988a2d3c
BLAKE2b-256 6f282da8a87e62b8a59a624d5d2fd29c2bd3e36b96cfbf6e29f3f9c68fc6a680

See more details on using hashes here.

File details

Details for the file brainrender-1.0.0.1.dev0-py3-none-any.whl.

File metadata

  • Download URL: brainrender-1.0.0.1.dev0-py3-none-any.whl
  • Upload date:
  • Size: 121.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.4

File hashes

Hashes for brainrender-1.0.0.1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd5a892fad110583199cdafe1c5853f43644b5eda82a02667da0084d9784be82
MD5 6290b120dac87bd20e0303490cca79c7
BLAKE2b-256 fe0b3bb30b948fdaecef15a5ac15a611e2f3789564a291c0e76bd54170280f8a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page