Skip to main content

Automated 3D brain registration

Project description

Python Version PyPI Wheel Development Status Travis Coverage Status Code style: black Gitter

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.

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. process 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 visualise your data, open napari and drag your brainreg output directory (the one with the log file) onto the napari window.

Various images should then open, including:

  • Image (downsampled) - the image used for registration
  • Annotations - the atlas labels, warped to your sample brain
  • Boundaries - the boundaries of the atlas regions

If you downsampled additional channels, these will also be loaded.

process

Project details


Download files

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

Source Distribution

brainreg-0.1.4.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

brainreg-0.1.4-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file brainreg-0.1.4.tar.gz.

File metadata

  • Download URL: brainreg-0.1.4.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.10

File hashes

Hashes for brainreg-0.1.4.tar.gz
Algorithm Hash digest
SHA256 e72c5c9102727927dc910040a26108752518c634c0d2da1ef595864745db1d0e
MD5 53158b5f230ae760cf69799ded8a0b8c
BLAKE2b-256 e554ced27cbacc0417215a14808645195d85f844902d4a31d1de11366625db0d

See more details on using hashes here.

File details

Details for the file brainreg-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: brainreg-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.10

File hashes

Hashes for brainreg-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2254254e743f571078a60c9e5e098ae6ab2d44bf5a1f926f3b2c9acb0e0bfd49
MD5 0167bae5302efd44bccd28e4dceaf3a1
BLAKE2b-256 1069fc4d1d908a1ee05b32c13a10a54e1c10a35b37c2683b5f06e2141dd918cb

See more details on using hashes here.

Supported by

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