This is an archive of the old MediaWiki-based ImageJ wiki. The current website can be found at imagej.net.

Classic Watershed

Classic Watershed (IJPB-plugins)
Author Ignacio Arganda-Carreras, David Legland
Maintainer Ignacio Arganda-Carreras
Source on GitHub
Initial release July 3rd, 2014
Latest version July 23rd, 2019 (MorphoLibJ v1.4.1)
Development status stable, active
Category Segmentation, Mathematical morphology
Error creating thumbnail: Unable to save thumbnail to destination
Overlay of watershed lines on blurred blobs.

Introduction

Schematic overview of watershed flooding in 1D
Classic Watershed is an ImageJ/Fiji plugin to perform watershed segmentation of grayscale 2D/3D images using flooding simulations as described by Pierre Soille and Luc M. Vincent (1990)[1].


The basic idea consists of considering the input image as topographic surface and placing a water source in each regional minimum of its relief. Next the entire relief is flooded from the sources and dams are placed where the different water sources meet.

All points in the surface at a given minimum constitute the catchment basin associated with that minimum. The watersheds are the zones dividing adjacent catchment basins.

The first image points that are reached by water are the points at the lowest grayscale value h_{min}, then all image pixels are progressively reached up to the highest level h_{max}.

Usage

The Classic Watershed plugin runs on any grayscale image (8, 16 and 32-bit) in 2D and 3D.

At least one image needs to be open in order to run the plugin.

Error creating thumbnail: Unable to save thumbnail to destination
Main dialog of the Classic Watershed plugin

Image parameters:

  • Input image: grayscale image to flood, usually the gradient of an image.
  • Mask image (optional): binary image of the same dimensions as the input image which can be used to restrict the areas of application of the algorithm. Set to "None" to run the method on the whole input image.

Morphological parameters:

  • Use diagonal connectivity: select to allow the flooding in diagonal directions (8-connectivity in 2D and 26-connectivity in 3D).
  • Min h: minimum grayscale value to start flooding from (by default, set to the minimum value of the image type).
  • Max h: maximum grayscale value to reach with flooding (by default, set to the maximum value of the image type).

Output:

  • Labeled image containing the resulting catchment basins (with integer values 1, 2, 3...) and watershed lines (with 0 value).

Over-segmentation

Normally, Classic Watershed will lead to an over-segmentation of the input image, especially for noisy images with many regional minima. In that case, it is recommended to either pre-process the image before running the plugin, or merge regions based on a similarity criterion afterwards. Several denoising methods are available in Fiji/ImageJ, namely: median filtering, Gaussian blur, bilateral filtering, etc.

Example

This short macro runs the plugin twice in the blobs sample, first without pre-processing and then after applying a Gaussian blur of radius 3:

// load the Blobs sample image
run("Blobs (25K)");
// invert LUT and pixel values to have dark blobs
run("Invert LUT");
run("Invert");
// run plugin on image
run("Classic Watershed", "input=blobs mask=None use min=0 max=150");
// apply LUT to facilitate result visualization
run("3-3-2 RGB");
// pre-process image with Gaussian blur
selectWindow("blobs.gif");
run("Gaussian Blur...", "sigma=3");
rename("blobs-blur.gif");
// apply plugin on pre-processed image
run("Classic Watershed", "input=blobs-blur mask=None use min=0 max=150");
// apply LUT to facilitate result visualization
run("3-3-2 RGB");

Installation

The Classic Watershed plugin is part of the MorphoLibJ library. To install it, you just need to add the IJPB-plugins update site:

1) Select Help  › Update... from the Fiji menu to start the updater.

2) Click on Manage update sites. This brings up a dialog where you can activate additional update sites.

3) Activate the IJPB-plugins update site and close the dialog. Now you should see an additional jar file for download.

4) Click Apply changes and restart Fiji.

You should now find the plugin under the sub-menu Plugins  › MorphoLibJ  › Segmentation.

Note: Classic Watershed is only one of the plugins included in the MorphoLibJ suite. By following these installation steps, you will be installing as well the rest of plugins in the suite.

References

  1. Soille, Pierre and Vincent, Luc M (1990). "Determining watersheds in digital pictures via flooding simulations". Proc. SPIE 1360: 240-250. doi:10.1117/12.24211. 

See also

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (http://www.gnu.org/licenses/gpl.txt).

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.