Cropping tissue sections from slide scanner images

The aim of this guide is provide instruction for the software tool called SlideCrop (written in Python). This tool can be used to segment tissue sections from very large slide scanner images and provides an alternative to the snapshot tool in Imaris and MetaViewer. The idea is to automatically detect tissue sections in an image and provide a means to crop all or selected tissue sections. The software also provides a batch mode to segment multiple slide images (providing the image content is similar: staining and tissue type). At the present time manual region of interest definition is not provided.

1. Select a slide scanner image to load to the software using the button labelled Browse:


2. The software allows the user to crop data in two ways: automatic segmentation or by drawing regions of interest on the image. The automatic segmentation is performed on a single channel of the image: by default this is the first channel in the data set. Changing the channel in the drop-down under Display options allows a different channel to be loaded. The segmentation will work best on channels where the staining is homogeneous across the tissue sections (e.g. DAPI).

3. Segmentation is performed by first thresholding the image. The threshold level is set by a slider labelled as Threshold in Image processing. Adjust the threshold to create a binary mask (shown in yellow). Behind the scenes this produces a binary image which is then processed further.


4. Next the binary mask, generated by thresholding, is subjected to a morphological operation to fill the holes in the mask. The size of the structuring element used can be changed using the text box marked Fill size.

5. The filled mask is then subjected to morphological erosion. Altering the size of the structuring element using the text box marked Erosion size and number if iterations can help to separate any touching objects.

6. Run the segmentation using the Auto process button. This will produce a new image in the preview window of the segmented tissue sections. The individual objects located are indicated by the red boxes. Pressing the Selectallows the user to interact with each region of interest allowing adjustment of the position and size and deleting of the region if required. Highlighting a line in the Region of interest table indicates that region on the image in yellow.


7. Region of interest can also be created by drawing directly onto the image. Simply press the Draw button to make a rectangle region on the image. Pressing Select will allow the size and position of the region to be adjusted.

8. There are a number of options available when creating the output image. Tiff images of the segmented tissue sections are generated using the button labelled Crop. Use the check boxes in the Region of interest table to choose which regions to crop; use the Select All button to mark all regions for cropping. Selecting the radio button marked All Channels will generate images of every segmented object; choosing Selected Channels allows individual (or multiple) sections to be selected in the table.

9. The resolution of the output image can be scaled by choosing a reduction factor from the drop-down box marked Output scale. Two types of compression are available for the output image: JPEG or LZW (the default option and recommended for fluorescence images).

10. Output images are saved as tiled tiffs in the OME-TIFF format. In order to open this format in ImageJ make sure you update to the newest release of FIJI. The data is written to disk at a rate of around 7-12 Mb/s. A region with a size of 35,000 x 25,000 will have a size on disk (with LZW compression) of 450Mb and will take around 40s to write to disk. FIJI will open the new image in around 2 minutes (opening, computing min/max pixel values and displaying the image).

** After running SlideCrop you will have both the original slide image and full resolution images of each tissue section. If you no longer need the original slide image please delete it to conserve space on the servers.