Skip to content

2. Pre processing

philshams edited this page Aug 24, 2018 · 12 revisions

Go from an unprocessed image of many brain slices, to a folder of nice-looking, properly oriented, and ordered brain slice images.

Skip this step if you already have this. Note that all testing was done using .tif files with either 3 (RGB) or 1 channel(s).


In all cases, do the following:

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';

  • Set the names of the images (e.g. here, all .tif files in the folder)

image_file_names = dir([image_folder filesep '*.tif']);

  • If you would like to adjust the contrast levels of your slice images, set

adjust_histology_contrast = true;


There are four ways to pre-process data, depending on whether your histology images are already cropped into images of individual slices and on whether they have already been downsampled to 10 microns per pixel.

  • If you have individually cropped images of brain slices, but not at 10 microns / pixel

image_file_are_individual_slices = true; and use_already_downsampled_image = 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, and press spacebar again to view and save or revert the modified image.

  • If you have individually cropped images of brain slices, but not at 10 microns / pixel

image_file_are_individual_slices = true; and use_already_downsampled_image = true;

  • If you have images of several brain slices, not at 10 microns / pixel

image_file_are_individual_slices = false; and use_already_downsampled_image = 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, and press spacebar again to view and save or revert the modified image.

  • If you have images of several brain slices, at 10 microns / pixel

image_file_are_individual_slices = false; and use_already_downsampled_image = true;