Microscopy Image Browser Watershed/Graphcut segmentation

This window give access to semi-automated image segmentation and object separation modes. The image segmentation can be done either using a standard watershed algorithm (Watershed workflow) or using the Graphcut segmentation (Graph Cut workflow). We recommend to use the Graphcut workflow due to its high interactive efficiency. The Object separation workflow allows to separate fused objects in both 2D and 3D. See below details of each mode.

Back to Index --> User Guide --> Menu --> Tools Menu

Contents

General example

A demonstration of the Graphcut segmentation is available in the following video:
https://youtu.be/dMeoIZPaDS4

Mode panel

The Mode panel offers possibility to select a desired working mode for the segmentation.

  • 2D, current slice only, performs segmentation on the slice that is currently shown in the Image View panel
  • 2D, slice-by-slice, performs 2D segmentation for each slice of the dataset individually
  • 3D, volume, performs 3D segmentation for complete or selected portion (see Selected Area section below) of the dataset
  • Aspect ratio for 3D indicates the aspect ratio of the dataset (only for the Watershed and Object separation modes). These values are calculated from the voxel size of the dataset (available from the Menu->Dataset->Parameters). The aspect ratio values are used when watershed is running using the distance map (see below)

Subarea panel

The Subarea panel allows selection of the sub-area of the dataset for processing. If dataset is too big it can be processed in parts or binned using this panel.

  • X: defines the width of the dataset to process. Please use two numbers separated by a colon sign (:)
  • Y: defines the height of the dataset to process
  • Z: defines the z-slices of the dataset to process
  • from Selection button populates the X:, Y:, Z: fields using coordinates of a bounding box that describes the Selection layer
  • Current View button limits the *X:* and *Y:* parameters to the image that is currently displayed in the Image View panel
  • Reset resets the Subarea fields to the dimensions of the dataset
  • Bin x times defines a binning factor for the data before segmentation. It allows to perform faster but with less details during the Watershed and Graph Cut modes.
    Attention! Use of binning during the Object separation mode may give unpredictable results

Image segmentation settings (for the Watershed and Graphcut workflows)

Both the Watershed and Graphcut workflows use provided labels that mark areas belonging to the Object and Background to perform the fine segmentation. Comparing to the Graphcut workflow, the Watershed workflow is a bit less interactive; it requires more time for the each execution and separates only objects that have distinct boundaries, for example membrane enclosed organelles.

On the other hand, the Graphcut workflow spends more time on the image preprocessing (calculation of the superpixels and generation of a graph) but each following interaction is fast. Using this workflow it is possible to separate objects that have both boundaries and intensity contrast. In general the Graphcut workflow is recommended for most of the cases.

Below, description of the Image segmentation settings:

  • Color channel defines a color channel that will be used for segmentation
  • Background defines a material of the model that labels the background
  • Object defines a material of the model that labels the object to be segmented
  • Type of signal defines type of the data: 'black-on-white', when the objects are separated with dark boundaries and 'white-on-black' for the bright boundaries
  • Update lists refreshes the lists of materials
  • Optional pre-processing (only for the Watershed workflow)
    • Gradient filters the image before watershed using the Gradient filter to create borders around objects
    • Eigenvalue of Hessian, pre-processing the data using this option may sometimes be beneficial for the following watershed transfornation. Use the Sigma fields to fine-tune the filter
    • Export to Matlab exports pre-processed data to the main Matlab workspace
    • Preview shows the result of pre-processing in the Image View panel
    • Import from Matlab imports dataset that will be used for image segmentation from Matlab workspace
    • Pre-process starts the data pre-processing process. When pre-processed data is present the color of the button turns to green
    • Clear removes the pre-processed data from the memory
  • Details panel (only for the Graphcut workflow)
    • Type of superpixels define type of the superpixels/supervoxels to calculate. The SLIC mode is most suitable for objects that have distinct contrast, while the Watershed mode is the best for objects that have distinct boundaries (in fact, the objained results are very close to those objained with the Watershed workflow)
    • Size of superpixels, (only for the SLIC superpixels) defines the desired number of pixels that are clustered into a superpixel
    • Compactness, (only for the SLIC superpixels), a number from 0 (line) to 100 (rectangle) that defines the resulting shape of superpixels
    • Reduce number of superpixels, (only for the Watershed superpixels), a number that defines a factor that reduces number of superpixels. The larger number in this field results in the larger superpixels
    • Chop, (only for the SLIC superpixels), calculation of SLIC superpixels requires large amounts of memory. If memory is insufficient for the calculation the dataset can be chopped and the superpixels calculated for each of the chopped parts individually
    • Autosave, autosave results after calculation of superpixels is finished
    • Superpixels/Graph press of this button initiate generation of superpixels and their final organization into a graph
    • Recalculate Graph allows to recalculate the graph using a new coefficient (|Coef|). In general, the laeger coefficients give stronger growth from the seeds
    • Preview superpixels the generated superpixels may be previewed by pressing this button
    • Export press to export superpixels and the generated graph to a disk or Matlab
    • Import press to import superpixels and the generated graph from a disk or Matlab

Graph cut segmentation settings

The Graph cut segmentation is based on Max-flow/min-cut algorithm written by Yuri Boykov and Vladimir Kolmogorov and implemented for Matlab by Michael Rubinstein. The max-flow/min-cut algorithm is applied not to individual pixels but to groups of pixels (superpixels (2D), or supervoxels(3D)) that may be generated either using the SLIC algorithm written by Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurelien Lucchi, Pascal Fua, and Sabine Süsstrunk or by the Waterhed algorithm. The objects that have intensity contrast are best described with the SLIC superpixels, while the objects that have distinct boundaries with the Watershed superpixels. Utilization of superpixels requires some time to calculate them but pays off during the following segmentation.

The picture above shows comparison between two types of superpixels. The upper panels show the SLIC superpixels that were good to segment a dark lipid droplet that has a good intensity contrast. The Watershed superpixels gave better segmentation of objects that were surrounded with boundaries.

How to use:

  1. Use two labels to mark areas that belong to background and the objects of interest
  2. Start the Watershed/Graphcut segmentation tool: Menu->Tools->Watershed/Graphcut segmentation
  3. Set one of the modes: 2D/3D
  4. Generate superpixels/supervoxels (Press the *Superpixels/Graph button)
  5. Check the size of the generated superpixels and modify the size if needed
  6. Press the Segment button to start segmentation

Note! some functions have to be compiled, please check the System Requirements page for details.

Object separation settings

The Object separation mode uses the watershed transformation to brake segmented objects into smaller ones. The specific settings for the Object separation mode are shown below.

  • Object to watershed defines a layer that contains a source object for separation. It could be one of the main layers: Selection, Mask, or Model
  • Use seeds when enabled targets algorithm to the seeded watershed transformation. Some parameters should be additionally specified in the Seeds panel
  • Reduce oversegmentaion (available only for the unseeded watershed transformation) decreases number of resulting objects
  • Seeds panel (only for the seeded watershed transformation)
    • Layer with seeds defines a layer that contains seeds. It could be one of the main layers: Selection, Mask, or Model
    • Watershed source defines type of the information that watershed will use for labeling. When the Image intensity option is selected watershed is using actual image intensities rather than the distance maps. See more in the Steve Eddins's blog on Image Processing.

Image segmentation example

  • Load a sample dataset: Menu->File->Import image from->URL, enter the address: http://mib.helsinki.fi/tutorials/WatershedDemo/watershed_demo1.tif
  • Press the + button in the Segmentation panel to add material to the model and name is as 'Background' (use the right mouse button to call a popup menu)
  • Use the brush tool to label an area that belongs to cytoplasm
  • Press the A button to add selected area to the first material (Background) of the model
  • Press the + button again to add another material and name it as 'Seeds'
  • Draw labels inside mitochondria.
  • Press the A button to add selected area to the second material (Seeds) of the model
  • Start the Watershed segmentation tool: Menu->Tools->Watershed/Graphcut segmentation.
  • Make sure that the proper materials are selected for both Background and Object in the Image segmentation settings
  • Press the Segment button to segment mitochondria
  • The segmented mitochondria are placed to the Mask layer
  • Optionally smooth mitochondria: Menu->Mask->Smooth Mask

Object separation example

The object separation with watershed can be used to separate big objects into smaller ones. For example, some mitochondria from the image segmentation example are fused together. It is possible to separate them using the Object separation mode.

Now the mitochondria are separated, but unfortunately, as usual with watershed, long mitochondria are broken into several small pieces as well. To deal with that the seeded watershed can be used.

Algorithm for image segmentation with watershed

Algorithm for object separation with watershed

References

Watershed: the Image segmentation and Object separation modes:

Graph Cut:

Back to Index --> User Guide --> Menu --> Tools Menu