Class WatershedBinarySingleSigma<T extends BooleanType<T>,​B extends BooleanType<B>>

  • Type Parameters:
    T - element type of input
    B - element type of mask
    All Implemented Interfaces:
    Computers.Arity5<RandomAccessibleInterval<T>,​Boolean,​Boolean,​Double,​RandomAccessibleInterval<B>,​ImgLabeling<Integer,​IntType>>, Consumers.Arity6<RandomAccessibleInterval<T>,​Boolean,​Boolean,​Double,​RandomAccessibleInterval<B>,​ImgLabeling<Integer,​IntType>>

    public class WatershedBinarySingleSigma<T extends BooleanType<T>,​B extends BooleanType<B>>
    extends Object
    implements Computers.Arity5<RandomAccessibleInterval<T>,​Boolean,​Boolean,​Double,​RandomAccessibleInterval<B>,​ImgLabeling<Integer,​IntType>>

    The Watershed algorithm segments and labels a grayscale image analogous to a heightmap. In short, a drop of water following the gradient of an image flows along a path to finally reach a local minimum.

    Lee Vincent, Pierre Soille, Watersheds in digital spaces: An efficient algorithm based on immersion simulations, IEEE Trans. Pattern Anal. Machine Intell., 13(6) 583-598 (1991)

    Input is a binary image with arbitrary number of dimensions. The heightmap is calculated by an inverse distance transform, which can optionally be smoothed with an gaussian filter with parameter sigma to prevent having many small segments in the result. It needs to be defined whether a neighborhood with eight- or four-connectivity (respective to 2D) is used. A binary image can be set as mask which defines the area where computation shall be done. It may make sense to use the input as mask as well. If desired, the watersheds are drawn and labeled as 0. Otherwise the watersheds will be labeled as one of their neighbors.

    Output is a labeling of the different catchment basins.

    Author:
    Simon Schmid (University of Konstanz)
    Implementation Note:
    op names='image.watershed'