MATLAB code to register CT scans to the Allen Mouse Brain CCF Atlas, and to localize multifiber photometry fibers. This code was written and developed in MATLAB2020b. See Vu et al., 2024. The code used in the original publication has been improved and adpated for public use here. Contact maianhvu@bu.edu with any questions.
Before you begin, download the following program(s)/file(s).
https://imagej.net/software/fiji/
Download the appropriate files to generate the files needed for this pipeline:
-
Allen Mouse Brain CCF (Wang et al., 2020):
- Download average_template_10.nrrd
- Download annotation_10.nrrd
- More info can be found here
-
Kim Lab brain atlas (Chon et al., 2019):
Each of these steps is packaged in a MATLAB App. There are 2 ways to run each of these apps.
- The .mlappinstall file contains the installer for the standalone app and includes the dependencies required.
- If you have the dependencies required in your path (see below), you can alternatively just run the .mlapp file.
This only needs to be run once to generate the atlas files necessary. Be sure you have atlas files (see above) downloaded first. You will end up with the following files in this repository folder (note that the double dots .. means one folder above this one):
- specified_atlas_location_path/MRIAtlas/CCF/average_template_10_coronal.tif -- the atlas
- specified_atlas_location_path/MRIAtlas/CCF/annotation_10_coronal.tif -- the annotated/labeled atlas
- specified_atlas_location_path/MRIAtlas/CCF/ccf_key.mat -- key containing the annotation labels and other information
- specified_atlas_location_path/MRIAtlas/CCF/landmarks.points -- the reference landmarks for registration
- specified_atlas_location_path/MRIAtlas/Chon/Chon_CCF_coronal.tif -- the atlas
- specified_atlas_location_path/MRIAtlas/Chon/Chon_labels_coronal.tif -- the annotated/labeled atlas
- specified_atlas_location_path/MRIAtlas/Chon/chon_key.mat -- key containing the annotation labels and other information
Register a 3D CT image to the atlas. See REGISTER_CT_README.pdf for instructions and more info.
Localize the fibers in a registered CT image. See LOCALIZE_FIBERS_README.pdf for instructions and more info.
- atlas_labels.m
- This function takes as input a m x 3 matrix of coordinates (mm from bregma) or indices (in atlas matrix space) in the order AP-ML-DV, where each row is a different point. It returns the anatomical labels assigned to the point by the Allen Mouse Brain CCF Atlas and the Kim Lab Atlas. Open the function or type 'help atlas_labels' for more info.
- example: output = atlas_labels('coord', [0.8, 2.3, -3.4; 0.5, 2, -2]);
- example: output = atlas_labels('idx', [445 800 413; 475 770 254]);
- howelab_table_labels.m
- Written for members of the Howe Lab, this function takes as input the path to the localized_fibers.mat struct, the struct itself, or the table contained in the "fiber_table" field of the struct, and returns a struct with a single field "table" which contains the same information as the fiber_table field but with fieldnames compatiable with Howe Lab legacy code.
The apps in this repository make use of the following repositories/tools. These have been packaged with the app. We note them here for reference.
- point_to_line
- polyfitn
- Fast_Tiff_Write
- Bio-Formats
- MATLAB Image Processing Toolbox
- MATLAB Statistics and Machine Learning Toolbox
- sec2hms
- https://github.com/cortex-lab/allenCCF: it is from here that we got the annotation labels for the atlases.
- We have created the following files:
- CCF/ccf_key.mat
- Chon/chon_key.mat
- Note that this repository also contains the very useful tool for Slice Histology Alignment, Registration, and Probe Track analysis: SHARP-Track.
- We have created the following files: