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.

Currently the only registration backend is NiftyReg.


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

Overview of the registration process


pip install brainreg

For detailed instructions see Installation


brainreg /path/to/raw/data /path/to/output/directory -x 2 -y 2 -z 5

For more information see User guide or try out the Tutorial