Mapping Histological Slice Sequences to the Allen Mouse Brain Atlas without 3D Reconstruction

Code

This is the matlab implementation of the brain-mapping algorithm developed in this paper.

The following zip file contains code and sample datasets that

1. find the the atlas plane correspondence of each slice in the histological slice sequences.

2. register each experimental image to its corresponding plane found in 1.

3. map neuron locations in an excel spreadsheet to its atlas coordinates with the transformations found in 1 and 2.

Google Drive Link: zip file is about 1GB. We included sample experimental datasets, a preprocessed sectional atlas, a full atlas (posterior to anterior as used in our paper), and an example excel sheet with neuron locations. We also included the Vlfeat toolbox for computing Histogram of Oriented Gradients, the trws computation tool for solving markov random fields.

Sample preprocessing script link for removing the unnecessary background in a slice, for example non-zero intensity pixels which have stain liquid but no actual tissue.

Sample preprocessing script link that downsizes a tif image and allows users to manually remove background and easily-replaced parts in an experimental brain.

Sample script that creates sectional atlas from the full atlas.

File is last updated: 4/24/2022

The file includes two demos for 1. finding the atlas plane correspondence of each slice in the histological slice sequences:

  • sectional brain demo with an experimental brain registered with our program in Jing Ren's paper

    • the sectional brain is registered to a preprocessed sectional atlas containing the dorsal raphe region

  • full brain demo with a full experimental brain in a different study

    • the full brain is registered to the unpreprocessed atlas (only order is changed to posterior-anterior)

    • this full experimental brain is the only full experimental brain we have at hand. the brain is not quality checked, and it is known that many slices are flipped left-right. The result is a worse reflection of the real performance of our algorithm. In this case, the angle around the left-right axis is more reliable than the angle around the superior-interior axis. The result will be improved if the left-right direction is correct.

The updated zip file (5/17/2020) also includes:

  • demo_2d_registration that follows the sectional brain demo above as an example to show how to register experimental slices to its corresponding planes.

  • demo_map_points that is also a demo with the sectional brain and shows how to map neuron locations in a excel sheet with the computed transformation to the atlas.

Include rotate_annotation.m file (09/05/2021)

Include additional missing files to make sure the 2D registration demo would be running successfully (09/07/2021)

Step by step code

Google drive link

This step-wise release allows neuroscientists to understand what the code does better by breaking the whole pipeline to 5 steps. Each step neuroscientists will be able to verify the angle selection and the registeration results or manually input the best angle. My neuroscientist collaborators find this is easier understandable and more usable for real experiments.

Directly email me if you have any questions.

Setup

Requirement

The code has been tested on MATLAB 2016a in Linux environments.

Quick Start

1. Download the google drive zip file, unzip.

2. Run demo_sectional_brain_find_angle_and_slice_match_iterative.m for sectional brain demo.

3. Run demo_full_brain_find_angle_and_slice_match_iterative.m for full brain demo.

4. Run demo_2d_registration for finding 2D nonrigid transformation.

5. Run demo_map_points to obtain 3D coordinates of neurons in an experimental brain in the allen atlas.

Citation

If you use our code and/or preprocessed atlas data and/or experimental data to find plane-wise mapping of an experimental image to the allen atlas and use your own 2D registration code, please cite our paper:

@article{xiong2018mapping,

title={Mapping mouse brain slice sequence to a reference brain without 3D reconstruction},

author={Xiong, Jing and Ren, Jing and Luo, Liqun and Horowitz, Mark},

journal={bioRxiv},

pages={357475},

year={2018},

publisher={Cold Spring Harbor Laboratory}

}

If you use our 2D registration code, please cite the paper above and my thesis, because the 2D registration code includes research that was completed after the above paper and described in the thesis only:

@phdthesis{xiong2019mapping,

title={Mapping histological brain images to the allen mouse brain atlas},

author={Xiong, Jing},

year={2019},

school={Stanford University}

}

If you use our sectional experimental data, please cite our paper:

@article{ren2018anatomically,

title={Anatomically Defined and Functionally Distinct Dorsal Raphe Serotonin Sub-systems},

author={Ren, Jing and Friedmann, Drew and Xiong, Jing and Liu, Cindy D and Ferguson, Brielle R and Weerakkody, Tanya and DeLoach, Katherine E and Ran, Chen and Pun, Albert and Sun, Yanwen and others},

journal={Cell},

volume={175},

number={2},

pages={472--487},

year={2018},

publisher={Elsevier}

}

Q&A

Q: I am trying to use your registration software but am having some trouble.

A: This question does not give any insight on what the real problem is. Please carefully read the readme file and look at the provided image data and atlas data. The program should run without any trouble. A tif file will be generated in the end showing the matching images from the experimental data and the atlas volume.

The general guideline is to make the atlas and your image the more similar the better. Find the section in the atlas that enclose your experimental section (meaning atlas larger but not way too large). Take off everything that is likely to disappear in your experimental data. Take off the corresponding part in the atlas as well. You only need one atlas for all your experimental datasets. But you need to preprocess every experimental dataset - removing unwanted background (extra staining liquid that has nonzero intensity in your image but is not real tissue), remove tissues that are likely to disappear, choose only the slices that have good quality if your data is very corrupted.

Q: I have ~15-22 sections of 60um thickness, taken about every 6 section. Is it possible to use your code to register these sections?

A: The code works for both full brain and sectional brain (for sectional brain, you will need to cut a sectional atlas from the atlas corresponding to your dataset. I've tried 30 slices before and my method works. If you have less data, you may need to play around with the code a little bit. If you have 15~22 slices, choose every third image and skip the bad ones. For example, 1 is selected, 4 is bad, and 5 is good. Then choose 1,5,8,11 ...

I am very confident with the algorithm, but you will need to preprocess the data well, because the program is not magic and will not do data cleaning for you. Also even datasets come from the same lab differ. You can refer to the sample dataset and sample atlas in the zip file as an example on how to clean your data to make the algorithm work.

If you have any question or request about the code and data or are interested in collaboration, please email me at jxiong1@stanford.edu.

License

MIT License