Setting up#

Installation and download#

  • First install the brainmapper command line tool by installing the brainglobe-workflows package, following the installation guide.

  • Download the data from here (it will take a long time to download). Thanks to Sepiedeh Keshavarzi for sharing the data.

  • Unzip the data to a directory of your choice (doesn’t matter where). You should end up with a directory called test_brain with two directories, each containing 2800 images.

  • Open a terminal (Linux) or your command prompt (Windows).

  • Navigate to the directory containing the test_brain directory (e.g. using cd).

  • Activate your conda environment.


The test data supplied is purposefully not the “best”. It has a low SNR, and some artefacts such as fluorescent vasculature, and bright spots on the surface of the brain. In addition, the cell classification network was trained on different data, to give you an idea of “real world” performance.

The aim of this tutorial is not to show brainmapper performing perfectly. It is instead to illustrate how it deals with less than perfect data, and how to improve the performance.

With all analysis methods, please test it out on your data to see if it works for you, and feel free to get in touch.

Before you start#

To run brainmapper, you need to know:

  • Where your data is (in this case, it’s the path to the test_brain directory).

  • Which image is the primary signal channel (the one with the labelled cells) and which is the secondary autofluorescence channel. In this case, test_brain/ch00 is the signal channel and test_brain/ch01 is the autofluroescence channel.

  • Where you want to save the output data (we’ll just save it into a directory called brainmapper_output in the same directory as the test_brain).

  • The pixel sizes of your data in microns (see Image definition for details). In this case, our data is 2μm per pixel in the coronal plane and the spacing of each plane is 5μm.

  • The orientation of your data. For atlas registration (using brainreg) the software needs to know how you acquired your data (coronal, sagittal etc.). For this brainmapper uses brainglobe-space. Full details on how to enter your data orientation can also be found in the Image definition section. For this tutorial, the orientation is psl, which means that the data origin is the most posterior, superior, left voxel.

  • Which atlas you want to use (you can see which are available by running brainglobe list). In this case, we want to use a mouse atlas (as that’s what our data is), and we’ll use the 10μm version of the Allen Mouse Brain Atlas.

Now you’re ready to start Running brainmapper.