|Classic Watershed (IJPB-plugins)|
|Author||Ignacio Arganda-Carreras, David Legland|
|Initial release||July 3rd, 2014|
|Latest version||October 23rd, 2018 (MorphoLibJ v1.4.0)|
|Development status||stable, active|
|Category||Segmentation, Mathematical morphology|
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 , then all image pixels are progressively reached up to the highest level .
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.
- 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.
- 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).
- Labeled image containing the resulting catchment basins (with integer values 1, 2, 3...) and watershed lines (with 0 value).
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.
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");
1) Select 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 . ▶ ▶
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.
- 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.
- Marker-controlled Watershed, a plugin to perform watershed by flooding from specific seed points or markers.
- Morphological Segmentation, a plugin with a graphical user interface to segment images based on morphological operations and the watershed algorithm.
- Serge Beucher's site, with graphic descriptions and animations of the watershed algorithms.
- G. Bertrand's Topological Watershed site, with papers, lecture slides and source code.
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.