Class WatershedTransform2D

java.lang.Object
inra.ijpb.watershed.WatershedTransform2D
Direct Known Subclasses:
MarkerControlledWatershedTransform2D

public class WatershedTransform2D
extends java.lang.Object
Class to apply the watershed algorithm to a 2D image. It allows specifying a binary mask to restrict the regions of interest.
Author:
Ignacio Arganda-Carreras
  • Constructor Summary

    Constructors
    Constructor Description
    WatershedTransform2D​(ij.process.ImageProcessor input, ij.process.ImageProcessor mask)
    Construct a watershed transform
    WatershedTransform2D​(ij.process.ImageProcessor input, ij.process.ImageProcessor mask, int connectivity)
    Construct a watershed transform
  • Method Summary

    Modifier and Type Method Description
    ij.process.ImageProcessor apply()
    Apply fast watersheds using flooding simulations, as described by Soille, Pierre, and Luc M.
    ij.process.ImageProcessor apply​(double hMin, double hMax)
    Apply fast watersheds using flooding simulations, as described by Soille, Pierre, and Luc M.
    java.util.ArrayList<PixelRecord> extractPixelValues​(ij.process.ImageProcessor inputImage, double hMin, double hMax)
    Extract pixel values from input image such that they have value h, hMin <= h <= hMax.
    ij.ImagePlus getAnimation​(double hMin, double hMax)
    Apply fast watersheds using flooding simulations, as described by Soille, Pierre, and Luc M.
    int getConnectivity()
    Get the pixel connectivity (4 or 8)
    void setConnectivity​(int conn)
    Set the pixel connectivity (4 or 8)
    void setVerbose​(boolean verbose)
    Set verbose flag

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WatershedTransform2D

      public WatershedTransform2D​(ij.process.ImageProcessor input, ij.process.ImageProcessor mask)
      Construct a watershed transform
      Parameters:
      input - input image (usually a gradient image)
      mask - binary mask to restrict the region of interest (null to use whole input image)
    • WatershedTransform2D

      public WatershedTransform2D​(ij.process.ImageProcessor input, ij.process.ImageProcessor mask, int connectivity)
      Construct a watershed transform
      Parameters:
      input - input image (usually a gradient image)
      mask - binary mask to restrict the region of interest (null to use whole input image)
      connectivity - pixel connectivity (4 or 8)
  • Method Details

    • getConnectivity

      public int getConnectivity()
      Get the pixel connectivity (4 or 8)
      Returns:
      pixel connectivity
    • setConnectivity

      public void setConnectivity​(int conn)
      Set the pixel connectivity (4 or 8)
      Parameters:
      conn - pixel connectivity
    • setVerbose

      public void setVerbose​(boolean verbose)
      Set verbose flag
      Parameters:
      verbose - new verbose flag
    • apply

      public ij.process.ImageProcessor apply()
      Apply fast watersheds using flooding simulations, as described by Soille, Pierre, and Luc M. Vincent. "Determining watersheds in digital pictures via flooding simulations." Lausanne-DL tentative. International Society for Optics and Photonics, 1990.
      Returns:
      image of labeled catchment basins (with dams)
    • apply

      public ij.process.ImageProcessor apply​(double hMin, double hMax)
      Apply fast watersheds using flooding simulations, as described by Soille, Pierre, and Luc M. Vincent. "Determining watersheds in digital pictures via flooding simulations." Lausanne-DL tentative. International Society for Optics and Photonics, 1990. NOTE: this algorithm may have plateaus in the dams.
      Parameters:
      hMin - the minimum value for dynamic
      hMax - the maximum value for dynamic
      Returns:
      image of labeled catchment basins (with dams)
    • extractPixelValues

      public java.util.ArrayList<PixelRecord> extractPixelValues​(ij.process.ImageProcessor inputImage, double hMin, double hMax)
      Extract pixel values from input image such that they have value h, hMin <= h <= hMax. A binary mask is used if it exists.
      Parameters:
      inputImage - input image
      hMin - minimum grayscale height value
      hMax - maximum grayscale height value
      Returns:
      list of input pixel values
    • getAnimation

      public ij.ImagePlus getAnimation​(double hMin, double hMax)
      Apply fast watersheds using flooding simulations, as described by Soille, Pierre, and Luc M. Vincent. "Determining watersheds in digital pictures via flooding simulations." Lausanne-DL tentative. International Society for Optics and Photonics, 1990. This implementation uses a binary mask to restrict regions of application if the mask exists. NOTE: this algorithm may have plateaus in the dams.
      Parameters:
      hMin - minimum grayscale level height
      hMax - maximum grayscale level height
      Returns:
      32-bit stack with the progression of labeled catchment basins (with dams)