-
Notifications
You must be signed in to change notification settings - Fork 78
7. Analyze other types of regions of interest (e.g. cells)
Visualize & analyze brain regions other regions of interest, such as cells that you clicked using this GUI or ROIs taken from a different source
Registering individual brain slices to the Allen Mouse Brain Atlas can be useful for any slice-based histology experiment. This software package includes two scripts to get you started with custom analyses of ROIs.
The script Analyze_Clicked_Points.m returns a similar output to Display_Probe_Track.m, but unlike the latter does not create any best-fit lines. Instead, it returns the location and brain region of each clicked point for each 'probe' object. This can then be analyzed in whatever way you wish.
To run this code, simply enter the same file location where the clicked points are stored, the name given to the 'probe' object, and which 'probe' objects to analyze:
% file location of object points
save_folder = 'C:\Drive\Histology\sample data\slices\processed';
% name of the saved object points
object_save_name_suffix = 'regions_of_interest_1';
% either set to 'all' or a list of indices from the clicked objects in this file, e.g. [2,3]
objects_to_analyze = 'all';
In addition to a roi_table
reporting the locations and brain regions of each clicked point, this script outputs two useful variables:
-
roi_location
contains the anterior-posterior, dorso-ventral, and medial-lateral coordinate of each clicked point -
roi_annotation
contains the brain region in which each point lies, as well as its corresponding acronym and annotation index.
Plotted below is the output from the same points analyzed in Visualize brain regions traversed by an electrode.
The script Analyze_ROIs.m takes a particular transformed slice's registration data from the processed_images_folder
and an image of the same size that contains ROIs found in that same slice image (roi_location
). In the default case, ROIs are images of 1s and 0s. It uses these two inputs to transform the ROI image and report all the locations and brain regions that it covers.
% file location of transform and transformed image
transform_location = 'C:\Drive\Histology\sample data\slices\slice_1_transform_data';
transformed_slice_location = 'C:\Drive\Histology\sample data\slices\slice_1_transformed.tif';
% file location of ROIs (image / array of the same size as the reference ie 800 x 1140)
roi_location = 'C:\Drive\Histology\sample data\slice_1_ROIs.tif';
There are two straightforward ways to use this function. One is to include the ROI image as an additional channel (or the only channel) in the .tif image that undergoes pre-processing and registration (see Pre-processing histology images and Registering slices to the atlas). In this case, the ROI file will be a channel of the pre-processed and transformed image - e.g. '\processed\transformations\slice_1_transformed.tif'. This is recommended if your ROI detection analysis requires high-resolution images. If you use this method for ROIs marking individual cells, or other sparse, point objects, then uncomment the following line to ensure a one-to-one mapping between ROIs in the original and transformed images:
rois = uint8(imregionalmax(rois));
Alternatively, you can pre-process and register your image, and then use that image (e.g. '\processed\transformations\slice_1_transformed.tif') to generate the ROI file (e.g. through a cell counting program such as ImageJ). The script Analyze_ROIs.m contains some commented-out code in the first cell that can use a set of x and y coordinates from the ImageJ function Analyze Particles to generate an ROI image. The example shown below used this pipeline, in addition to custom code written for its particular application.
As with Analyze_Clicked_Points.m, in addition to a roi_table
reporting the locations and brain regions of each clicked point, this script outputs two useful variables:
-
roi_location
contains the anterior-posterior, dorso-ventral, and medial-lateral coordinate of each clicked point -
roi_annotation
contains the brain region in which each point lies, as well as its corresponding acronym and annotation index.
An example of how these outputted variables could be used. Credit: Daniel Regester and Yoh Isogai