Watershed

From MIPAV
Jump to: navigation, search

Watershed segmentation in MIPAV is an interactive algorithm that allows automatically segment the image regions of interest. The watershed transformation performs gray scale segmentation using the topographical approach. Interpreting an image as a topographical relief, the algorithm performs flooding starting from regional minima, which are seen as plateaus of constant altitude surrounded only by pixels of higher gray levels. Dams or watershed lines are built when pixels from different basins meet or when the pixel's gray level reaches a certain threshold value which represents the image's background.

Background

An example of watershed segmentation: (a) grey level profile of the image data, (b) watershed segmentation


The user is, first, asked to identify the background pixels and initial region(s) using VOIs. At least two VOIs are required - the first one to specify the image's background and the second one to outline the image region(s) the user wish to segment (this VOI(s) represents the initial region(s)).

Note: The order in which VOIs are defined on the image is important. The first VOI must always outline background pixels.

Watershed algorithm: (a) - the original image with two VOIs: the VOI1 highlights the image background and VOI2 is a group of three VOI delineated inside the objects we wish to segment
(b) this figure illustrates the main steps of the algorithm
(c) the result segmented image


  • Inside each initial VOI, the algorithm finds the seed point and forms the seed vector.
  • For each seed point, it finds the local minimum and labels it as a catchment basin.
  • Then, the algorithm starts filling all catchment basins. E.g. imagine that there is a hole in each local minimum, and that the topographic surface is immersed in water and water starts filling all catchment basins from the bottom. If two catchment basins merge as a result of further immersion or when the pixel gray values from one of the basins reach a threshold determined by the background intensity values, a dam is built all the way to the highest surface altitude and the dam represents the watershed line. See the figure above.
  • The algorithm, first, sorts the pixels in increasing order of their gray values, and then it performs a flooding step.
  • During the sorting step, the algorithm computes a gray-level histogram. And it also creates a vector H of pointers to pixels of gray-level h. For all gray-levels, starting from below pixels having gray-level h are processed (flooded). These pixels are directly accessed through the vector H.
  • Then, the algorithm computes the geodesic influence zones of the already labeled catchment basins at the next level h-1. The geodesic influence zone of a basin Bi are the pixels of gray-level hi which are closer to Bi than to any other catchment basin Bj. See Figures (b) and (c) below.
  • The algorithm assigns the pixels having a certain gray-level hi to the corresponding geodesic influence zone.
  • Pixels that do not belong to the labeled catchment basin or geodesic influence zone represent the background.

Raw watershed segmentation produces a severely over segmented image with hundreds or thousands of catchment basins

To overcome that problem the following techniques are used in this implementation of the algorithm:

  • Smoothing using Gaussian blur to remove small local minima before applying the algorithm.
  • The user is asked to specify the image region(s) he (she) wishes to segment using VOIs.
  • Post-processing that includes merging of found regions.

Image types

You can apply this algorithm to 2D and 3D gray-scale images.

Watershed dialog box

The Watershed dialog box


Energy file - the energy file is generally a gradient magnitude image and the intensity peaks in this image are the watersheds boundaries. The algorithm creates and saves the energy file automatically when you first time run the algorithm for a chosen image.

Use pre-calculated energy file - when you run the algorithm for the same image next time you have an option to open and use the previously saved energy file for your segmentation.


Scale of the Gaussian - specify the scale of the Gaussian for each dimension. The Z Dimension option is only available for 3D images.

Use image resolutions to normalize Z scale - if checked, this option allows using the image resolutions to normalize the voxel size in Z dimension.

OK - applies the Watershed algorithm according to the specifications in this dialog box.

Cancel - disregards any changes that you made in the dialog box and closes this dialog box.

Help - displays online help for this dialog box.

Applying Watershed

Before applying the algorithm,

To run the algorithm

  • Open an image of interest.
  • In the image, delineate at least two VOIs - the first one for background and the second one for the object(s) you wish to segment.
  • In the MIPAV window, select Algorithms > Segmentation >Watershed. The Watershed dialog box appears.
  • Complete the information in the dialog box.
  • Click OK. The algorithm begins to run, and a progress bar appears momentarily with the status. When the algorithm finishes running, the progress bar disappears, and the result appears in a separate image window. See Figure (c).

See also

Morphology

Segmenting Images Using Contours and Masks

References

The following sources were used to create this help.

Watershed ICAEN IOWA - http://www.icaen.uiowa.edu/~dip/LECTURE/Segmentation3.html#watershed]

Watershed ITC.ORG - http://www.itk.org/HTML/WatershedSegmentationExample.html]