Automated 3D brain registration
Project description
brainreg
brainreg is an update to amap (itself a port of the original Java software) to include multiple registration backends, and to support the many atlases provided by bg-atlasapi.
Documentation can be found here and a tutorial is here.
If you have any questions, please ask on the forum.
Details
The aim of brainreg is to register the template brain (e.g. from the Allen Reference Atlas) to the sample image. Once this is complete, any other image in the template space can be aligned with the sample (such as region annotations, for segmentation of the sample image). The template to sample transformation can also be inverted, allowing sample images to be aligned in a common coordinate space.
To do this, the template and sample images are filtered, and then registered in a three step process (reorientation, affine registration, and freeform registration.) The resulting transform from template to standard space is then applied to the atlas.
Full details of the process are in the original aMAP paper. Overview of the registration process
Installation
pip install brainreg
Usage
Basic usage
brainreg /path/to/raw/data /path/to/output/directory -x 2 -y 2 -z 5
Arguments
Mandatory
- Path to the directory of the images. (Can also be a text file pointing to the files)
- Output directory for all intermediate and final results
You must also specify the pixel sizes, see Specifying pixel size
Additional options
-d
or--downsample
Paths to N additional channels to downsample to the same coordinate space.--sort-input-file
If set to true, the input text file will be sorted using natural sorting. This means that the file paths will be sorted as would be expected by a human and not purely alphabetically
Misc options
--n-free-cpus
The number of CPU cores on the machine to leave unused by the program to spare resources.--debug
Debug mode. Will increase verbosity of logging and save all intermediate files for diagnosis of software issues.
Atlas
By default, brainreg will use the 25um version of the Allen Mouse Brain Atlas. To use another atlas (e.g. for another species, or another resolution), you must use the --atlas
flag, followed by the string describing the atlas, e.g.:
--atlas allen_mouse_50um
To find out which atlases are available, once brainreg is installed, please run brainglobe list
. The name of the resulting atlases is the string to pass with the --atlas
flag.
Registration backend
To change the registration algorithm used, use the --backend
flag. The default is niftyreg
as that is currently the only option.
Input data orientation
If your data does not match the brainglobe default orientation (the origin voxel is the most anterior, superior, left-most voxel, then you must specify the orientation by using the --orientation
flag. What follows must be a string in the bg-space "initials" form, to describe the origin voxel.
If the origin of your data (first, top left voxel) is the most anterior, superior, left part of the brain, then the orientation string would be "asl" (anterior, superior, left), and you would use:
--orientation asl
Registration options
To change how the actual registration performs, see Registration parameters
Full command-line arguments are available with brainreg -h
, but please
get in touch if you have any questions.
Visualisation
brainreg comes with a plugin (napari-brainreg) for napari to view your data
Sample space
Open napari and drag your brainreg output directory (the one with the log file) onto the napari window.
Various images should then open, including:
Registered image
- the image used for registration, downsampled to atlas resolutionatlas_name
- e.g.allen_mouse_25um
the atlas labels, warped to your sample brainBoundaries
- the boundaries of the atlas regions
If you downsampled additional channels, these will also be loaded.
Most of these images will not be visible by default. Click the little eye icon to toggle visibility.
N.B. If you use a high resolution atlas (such as allen_mouse_10um
), then the files can take a little while to load.
Atlas space
napari-brainreg
also comes with an additional plugin, for visualising your data
in atlas space.
This is typically only used in other software, but you can enable it yourself:
- Open napari
- Navigate to
Plugins
->Plugin Call Order
- In the
Plugin Sorter
window, selectnapari_get_reader
from theselect hook...
dropdown box - Drag
brainreg_standard
(the atlas space viewer plugin) abovebrainreg
(the normal plugin) to ensure that the atlas space plugin is used preferentially.
Citing brainreg
If you find brainreg useful, and use it in your research, please let us know and also cite this repository:
Tyson, A.L., Rousseau, C.V., and Margrie, T.W. (2021). brainreg: automated 3D brain registration with support for multiple species and atlases. 10.5281/zenodo.3991718
Please also cite aMAP (the original pipeline from which this software is based):
Niedworok, C.J., Brown, A.P.Y., Jorge Cardoso, M., Osten, P., Ourselin, S., Modat, M. and Margrie, T.W., (2016). AMAP is a validated pipeline for registration and segmentation of high-resolution mouse brain data. Nature Communications. 7, 1–9. https://doi.org/10.1038/ncomms11879
Lastly, if you can, please cite the BrainGlobe Atlas API that provided the atlas:
Claudi, F., Petrucco, L., Tyson, A. L., Branco, T., Margrie, T. W. and Portugues, R. (2020). BrainGlobe Atlas API: a common interface for neuroanatomical atlases. Journal of Open Source Software, 5(54), 2668, https://doi.org/10.21105/joss.02668
Don't forget to cite the developers of the atlas that you used (e.g. the Allen Brain Atlas)!
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
Built Distribution
File details
Details for the file brainreg-0.2.4.tar.gz
.
File metadata
- Download URL: brainreg-0.2.4.tar.gz
- Upload date:
- Size: 40.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13ecd63a4a25f6f4d3395c8f8a835f27861c5a891dd547eba88d17288371ba57 |
|
MD5 | f7c6078c48fd9b061074e6bc30da8356 |
|
BLAKE2b-256 | 89c2da63b5c9e9c0748c472b21114b7877fc64d8c69d24ddcabd3ef8b8927441 |
File details
Details for the file brainreg-0.2.4-py3-none-any.whl
.
File metadata
- Download URL: brainreg-0.2.4-py3-none-any.whl
- Upload date:
- Size: 40.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6d668a78b1076ac32d1b0c11aa6fe33793bde526d0d7b21329d9c7f205b3400 |
|
MD5 | 5b155351491fbf6b2840dbbea2584a23 |
|
BLAKE2b-256 | 83933b0d03a378416fefd7041c68b1baa7dcac9565ea4ae9d46227be0dd05363 |