Toolbox for aliging histology images to the Allen CCF mouse atlas.
A video demonstration of this toolbox is available here (note - old interface): https://www.youtube.com/watch?v=HKm_G17Wc6g
Inspiration from SHARP-Track by Philip Shamash (https://www.biorxiv.org/content/10.1101/447995v1).
- download the Allen CCF mouse atlas download here *
- clone this repository
- add both the CCF mouse atlas and repository to the matlab path
- The npy-matlab repository
*(note on where these files came from: they are a re-formatted version of the original atlas, which has been processed with this script)
Open the toolbox menu with:
AP_histology
This is the menu for to run all toolbox functions.
The menu functions are described below.
Set the location of the raw images and save path
- Set the raw image path with
File selection > Set raw image path
- Set the processing save path with
File selection > Set processing save path
- Downsample image sizes (if desired)
- Set white balance and color for each channel
- Extract slices into individual images (if not already)
In the initial dialog box, select the image downsampling factor (e.g. 2 reduces image size to 1/2) and whether images are individual slices (1 = slices, 0 = not slices, e.g. slides)
A montage of images will be shown for each channel, user selects white balance and color:
To create individual slice images from slide imges:
- slices will be automatically detected, left-clicking will select that slice
- right-clicking will draw a manual region to extract
- left-clicking on an existing selected region will unselect it
- spacebar moves to the next slide.
Draw reference line (e.g. the midline):
These reference lines will used to centered and rotate the slice images, which are then saved.
Images can be re-ordered (click to select order)
Images can be flipped (left/right or up/down)
This function is to match histology slices to their corresponding CCF slices. The left plot is the histology slices (scrollable by 1/2), the right plot is the 3D CCF atlas which is rotatable with the arrow keys and scrollable in/out of the plane with the mouse wheel. Typical use would be:
- Rotate the CCF atlas until the rotation matches that of the histology slices. This is usually easiest using a slice with landmarks sensitive to asymmetries, e.g. the hippocampus or anterior commisure.
- Once the angle is set, the CCF slice location can be set with the scroll wheel. For each histology slice, scroll to the matching CCF slice and hit 'Enter' to set that slices' location.
- Once all histology slices are set, close the GUI to save and quit.
This function auto-aligns each corresponding histology and CCF slice by slice outline. Alignments which need manual correction can be fixed in the next step.
If the auto-alignment didn't work on some slices, they can be manually fixed with this function. Placing > 3 corresponding points on the histology and CCF slices creates a new alignment using those control points, and 'Escape' saves and quits.
After manual control-point alignment:
Get trajectory of dyed probe in CCF coordinates and areas.
Draw lines on slices with visible tract marks corresponding to the probe (select the relevant probe by number, e.g. '1' to draw a line for probe 1). Lines for a given probe can be (and usually are) drawn across multiple slices.
The final probe trajectory will be a line of best fit through all marked points, and brain areas will be saved along that trajectory. NOTE: it is unusual that the exact end of the probe can be visualized and accurately established from histology alone, so this step saves the entire trajectory and the next step aligns it to electrophysiology.
Display the histology slices with overlaid boundaries, hover over region to display name
2024-02-16 - Split re-order/flip GUIs: re-ordering is now a simpler click interface 2023-11-02 - Created menu GUI for easier interfacing re-structured/improve much of the code, improved auto-align