All Projects → brainglobe → bg-atlasapi

brainglobe / bg-atlasapi

Licence: BSD-3-Clause license
A lightweight python module to interact with atlases for systems neuroscience

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to bg-atlasapi

brainreg
Automated 3D brain registration with support for multiple species and atlases.
Stars: ✭ 73 (+35.19%)
Mutual labels:  neuroscience, registration, microscopy, brain, atlases
Brayns
Visualizer for large-scale and interactive ray-tracing of neurons
Stars: ✭ 232 (+329.63%)
Mutual labels:  visualisation, neuroscience, brain
MIRACL
Multi-modal Image Registration And Connectivity anaLysis
Stars: ✭ 23 (-57.41%)
Mutual labels:  neuroscience, brain, atlases
cellfinder
Automated 3D cell detection and registration of whole-brain images
Stars: ✭ 122 (+125.93%)
Mutual labels:  neuroscience, registration, microscopy
Open Computational Neuroscience Resources
A publicly-editable collection of open computational neuroscience resources
Stars: ✭ 234 (+333.33%)
Mutual labels:  neuroscience, brain
Visbrain
A multi-purpose GPU-accelerated open-source suite for brain data visualization
Stars: ✭ 172 (+218.52%)
Mutual labels:  neuroscience, brain
Pyllusion
A Parametric Framework to Generate Visual Illusions using Python
Stars: ✭ 35 (-35.19%)
Mutual labels:  neuroscience, brain
ANTsR
Advanced Normalization Tools in R
Stars: ✭ 101 (+87.04%)
Mutual labels:  registration, brain
visualqc
VisualQC : assistive tool to ease the quality control workflow of neuroimaging data.
Stars: ✭ 56 (+3.7%)
Mutual labels:  neuroscience, registration
BRAINSTools
A suite of tools for medical image processing focused on brain analysis
Stars: ✭ 94 (+74.07%)
Mutual labels:  registration, brain
mrivis
medical image visualization library and development toolkit
Stars: ✭ 19 (-64.81%)
Mutual labels:  neuroscience, registration
Amap Python
Automated mouse atlas propagation
Stars: ✭ 20 (-62.96%)
Mutual labels:  neuroscience, registration
Awesome Neuroscience
A curated list of awesome neuroscience libraries, software and any content related to the domain.
Stars: ✭ 734 (+1259.26%)
Mutual labels:  neuroscience, brain
ColeAnticevicNetPartition
Public release of The Cole-Anticevic Brain-wide Network Partition (CAB-NP)
Stars: ✭ 48 (-11.11%)
Mutual labels:  neuroscience, brain
Fieldtrip
The MATLAB toolbox for MEG, EEG and iEEG analysis
Stars: ✭ 481 (+790.74%)
Mutual labels:  neuroscience, brain
MITK-Diffusion
MITK Diffusion - Official part of the Medical Imaging Interaction Toolkit
Stars: ✭ 47 (-12.96%)
Mutual labels:  registration, brain
BrainPrep
Preprocessing pipeline on Brain MR Images through FSL and ANTs, including registration, skull-stripping, bias field correction, enhancement and segmentation.
Stars: ✭ 107 (+98.15%)
Mutual labels:  registration, brain
syncopy
Systems Neuroscience Computing in Python: user-friendly analysis of large-scale electrophysiology data
Stars: ✭ 19 (-64.81%)
Mutual labels:  neuroscience, brain
NEURON-UI
NEURON User Interface
Stars: ✭ 14 (-74.07%)
Mutual labels:  neuroscience, brain
PyRhO
A virtual optogenetics laboratory
Stars: ✭ 30 (-44.44%)
Mutual labels:  neuroscience, brain

BG-atlasAPI

Python Version PyPI Wheel Development Status Tests Coverage Status Code style: black DOI License

banner

The brainglobe atlas API (BG-AtlasAPI) provides a common interface for programmers to download and process brain atlas data from multiple sources.

Atlases available

A number of atlases are in development, but those available currently are:

Installation

BG-AtlasAPI works with Python >3.6, and can be installed from PyPI with:

pip install bg-atlasapi

Usage

Full information can be found in the documentation

Python API

List of atlases

To see a list of atlases use bg_atlasapi.show_atlases

from bg_atlasapi import show_atlases
show_atlases()
#                                Brainglobe Atlases
# ╭──────────────────────────────────┬────────────┬───────────────┬──────────────╮
# │ Name                             │ Downloaded │ Local version │    Latest    │
# │                                  │            │               │   version    │
# ├──────────────────────────────────┼────────────┼───────────────┼──────────────┤
# │ allen_human_500um                │     ✔      │      0.1      │     0.1      │
# │ mpin_zfish_1um                   │     ✔      │      0.3      │     0.3      │
# │ allen_mouse_50um                 │     ✔      │      0.3      │     0.3      │
# │ kim_unified_25um                 │     ✔      │      0.1      │     0.1      │
# │ allen_mouse_25um                 │     ✔      │      0.3      │     0.3      │
# │ allen_mouse_10um                 │     ✔      │      0.3      │     0.3      │
# │ example_mouse_100um              │    ---     │      ---      │     0.3      │
# ╰──────────────────────────────────┴────────────┴───────────────┴──────────────╯

Using the atlases

All the features of each atlas can be accessed via the BrainGlobeAtlas class.

e.g. for the 25um Allen Mouse Brain Atlas:

from bg_atlasapi.bg_atlas import BrainGlobeAtlas
atlas = BrainGlobeAtlas("allen_mouse_25um")

The various files associated with the atlas can then be accessed as attributes of the class:

# reference image
reference_image = atlas.reference
print(reference_image.shape)
# (528, 320, 456)

# annotation image
annotation_image = atlas.annotation
print(annotation_image.shape)
# (528, 320, 456)

# a hemispheres image (value 1 in left hemisphere, 2 in right) can be generated
hemispheres_image = atlas.hemispheres
print(hemispheres_image.shape)
# (528, 320, 456)

Brain regions

There are multiple ways to work with individual brain regions. To see a dataframe of each brain region, with it's unique ID, acronym and full name, use atlas.lookup_df:

atlas.lookup_df.head(8)
#      acronym         id                           name
# 0       root        997                           root
# 1       grey          8  Basic cell groups and regions
# 2         CH        567                       Cerebrum
# 3        CTX        688                Cerebral cortex
# 4      CTXpl        695                 Cortical plate
# 5  Isocortex        315                      Isocortex
# 6        FRP        184  Frontal pole, cerebral cortex
# 7       FRP1         68          Frontal pole, layer 1

Each brain region can also be access by the acronym, e.g. for primary visual cortex (VISp):

from pprint import pprint
VISp = atlas.structures["VISp"]
pprint(VISp)
# {'acronym': 'VISp',
#  'id': 385,
#  'mesh': None,
#  'mesh_filename': PosixPath('/home/user/.brainglobe/allen_mouse_25um_v0.3/meshes/385.obj'),
#  'name': 'Primary visual area',
#  'rgb_triplet': [8, 133, 140],
#  'structure_id_path': [997, 8, 567, 688, 695, 315, 669, 385]}

Note on coordinates in bg-atlasapi

Working with both image coordinates and cartesian coordinates in the same space can be confusing! In bg-atlasapi, the origin is always assumed to be in the upper left corner of the image (sectioning along the first dimension), the "ij" convention. This means that when plotting meshes and points using cartesian systems, you might encounter confusing behaviors coming from the fact that in cartesian plots one axis is inverted with respect to ij coordinates (vertical axis increases going up, image row indexes increase going down). To make things as consistent as possible, in bg-atlasapi the 0 of the meshes coordinates is assumed to coincide with the 0 index of the images stack, and meshes coordinates increase following the direction stack indexes increase. To deal with transformations between your data space and bg-atlasapi, you might find helpful the bg-space package.

Contributing to bg-atlasapi

Contributors to bg-atlaspi are absolutely encouraged, whether you want to fix bugs, add/request new features or simply ask questions.

If you would like to contribute to bg-atlasapi (or any of the downstream tools like brainrender etc.) please get in touch by opening a new issue or pull request on GitHub. Please also see the contributing guide.

Someone might have already asked a question you might have, so if you're not sure where to start, check out the issues (and the issues of the other repositories)


The BrainGlobe project is generously supported by the Sainsbury Wellcome Centre and the Institute of Neuroscience, Technical University of Munich, with funding from Wellcome, the Gatsby Charitable Foundation and the Munich Cluster for Systems Neurology - Synergy.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].