T - element type of inputB - element type of maskpublic class WatershedBinary<T extends BooleanType<T>,B extends BooleanType<B>> extends AbstractUnaryHybridCF<RandomAccessibleInterval<T>,ImgLabeling<Integer,IntType>> implements Ops.Image.Watershed, Contingent
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. Sigma must have the same dimension as the input image. 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.
SpecialOp.FlavorNAME| Constructor and Description |
|---|
WatershedBinary() |
| Modifier and Type | Method and Description |
|---|---|
void |
compute(RandomAccessibleInterval<T> in,
ImgLabeling<Integer,IntType> out)
Computes the output given some input.
|
boolean |
conforms()
True if the contingency holds; i.e., the current circumstances conform to
the contingency's requirements.
|
ImgLabeling<Integer,IntType> |
createOutput(RandomAccessibleInterval<T> in)
Create an output object given some input.
|
void |
initialize()
Initializes the object.
|
in, out, setInput, setOutputops, setEnvironmentclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitops, setEnvironmentcalculate, calculate, createOutput, getIndependentInstance, run, runcomputein, setInputrunsetOutputcandidates, filterArity, oppublic void compute(RandomAccessibleInterval<T> in, ImgLabeling<Integer,IntType> out)
UnaryComputerOpcompute in interface UnaryComputerOp<RandomAccessibleInterval<T extends BooleanType<T>>,ImgLabeling<Integer,IntType>>in - Argument to the computation, which must be non-nullout - Object where the computation's result will be stored, which
must be non-null and a different object than inputpublic boolean conforms()
Contingentconforms in interface Contingentpublic ImgLabeling<Integer,IntType> createOutput(RandomAccessibleInterval<T> in)
UnaryOutputFactorycreateOutput in interface UnaryOutputFactory<RandomAccessibleInterval<T extends BooleanType<T>>,ImgLabeling<Integer,IntType>>in - which determines how to create the outputpublic void initialize()
Initializableinitialize in interface InitializableCopyright © 2014–2022 ImageJ. All rights reserved.