-
Notifications
You must be signed in to change notification settings - Fork 78
2. Pre processing
Go from an unprocessed image of many brain slices, to a folder of nice-looking, properly oriented, properly sized, and ordered brain slice images.
You must run this pre-processing for the registration to work, in particular if your images are smaller than the size of the reference atlas (800x1140 pixels) or have a different aspect ratio. Note that all testing was done using .tif files with either 3 (RGB) or 1 channel(s).
Open Process_Histology.m and run the first cell (SET FILE AND PARAMETERS
), after setting the following:
- Set the folder where the images are located, e.g.
image_folder = 'C:\Drive\Histology\sample data\slices';
- Set the folder where the should be saved (which can be the same folder), e.g.
save_folder = 'C:\Drive\Histology\sample data\slices';
Note that if this is not the same as the image folder, if you move back to an image you have already adjusted using the HistologyBrowser function, you will return to the original version and not the adjusted versions.
- Set the names of the images (e.g. here, all .tif files in the folder)
image_file_names = dir([image_folder filesep '*.tif']);
- If the images are not yet of the same resolution as the reference atlas (typically 10 µm/pixel)
use_already_downsampled_image = false;
microns_per_pixel = 3.233 % the resolution of your images;
microns_per_pixel_after_downsampling = 10;
How you pre-process data depends slightly on whether your histology images are already cropped into images of individual slices.
image_files_are_individual_slices = true;
Run the cell LOAD AND PROCESS SLICE PLATE IMAGES
. Each image is downsampled and can now be adjusted. Instructions appear in the console. Notably, press spacebar to adjust the current image's contrast on the current channel. A sub-GUI Adjust Contrast will appear; you can use it to adjust contrast levels. When you're done, press 'Adjust Data,' close this sub-GUI, and press spacebar again. You can now save (by pressing 's') or revert ('r') the modified image. Go through and save all images. Processed images are saved in '/save_folder/processed'
Skip the cell CROP AND SAVE SLICES
.
Run the cell GO THROUGH TO FLIP HORIZONTAL SLICE ORIENTATION, ROTATE, SHARPEN, and CHANGE ORDER
. Instructions appear in the console. Crop images to be under the reference atlas slice size (typically 800 x 1140 pxl), at which point they will be padded with black so that they become that size. Slices should be flipped such that the left and right sides of the brain are consistent across all images in the folder.
image_files_are_individual_slices = false;
Run the cell LOAD AND PROCESS SLICE PLATE IMAGES
. Each image is downsampled and can now be adjusted. Instructions appear in the console. Notably, press spacebar to adjust the current image's contrast on the current channel. A sub-GUI Adjust Contrast will appear; you can use it to adjust contrast levels. When you're done, press 'Adjust Data,' close this sub-GUI, and press spacebar again. You can now save (by pressing 's') or revert ('r') the modified image. Go through and save all images. Processed images are saved in '/save_folder' with the suffix '_processed'
Run the cell CROP AND SAVE SLICES
. Instructions appear in the console. Crop slice images in either anterior to posterior or posterior to anterior order. Cropped images are automatically saved in '/save_folder/processed'. Press space to move on to cropping the next image.
Run the cell GO THROUGH TO FLIP HORIZONTAL SLICE ORIENTATION, ROTATE, SHARPEN, and CHANGE ORDER
. Instructions appear in the console. Crop images to be under the reference atlas slice size (typically 800 x 1140 pxl), at which point they will be padded with black so that they become that size. Slices should be flipped such that the left and right sides of the brain are consistent across all images in the folder.