Microscopy Image Browser Graphcut segmentation

This window give access to semi-automated image segmentation using the maxflow/mincut graphcut method.

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.

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


General example

A demonstration of the Graphcut segmentation is available in the following video:


How to use:

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

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

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
  • 3D, volume, grid, a special mode of 3D graphcut, where the dataset is chopped into several subvolumes (defined by Chop edit boxes, see below) and the dataset which is centered at the Image View panel is gets segmented (for convenience, turn on the marker of the center point, toolbar->center marker button). Chopping of large volume into several small subvolumes (e.g.400x400x400 pixels allows effective interactive segmentation of this large volume To segment all subvolumes press the Segment All button

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.
    Attention! The auto update mode is not available for the binned datasets!

Calculation of superpixels/supervoxels

Before the segmentation, the pixels of the opened dataset should be clustered using the SLIC or Watershed algorithms. The picture below 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.

Image segmentation settings

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:

  • Background defines a material of the model that labels the background areas
  • Object defines a material of the model that labels the object to be segmented
  • Update lists refreshes the lists of materials
  • Auto update - enables auto update of the segmentation results each time when material is modified. It is mostly useful for relatively small datasets (~400x400x400 pixels). Important: please do not use the Shift+A key shortcut, but only A shortcut. Also, when this mode is used it is recommended to recalculate the final segmentation by pressing the Segment button. Also the auto update mode is not available if the Bin mode is used.

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 Graphcut segmentation tool: Menu->Tools->Semi-automatic segmentation->Graphcut.
  • Select the Watershed type of superpixels
  • 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
  • Add more seeds to the background and object materials to improve segmentaion
  • Press the Segment button again of use the Auto update mode for instant update of the segmentation results
  • The segmented mitochondria are placed to the Mask layer
  • Optionally smooth mitochondria: Menu->Mask->Smooth Mask


Graph Cut:

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