T
- element type of inputB
- element type of maskpublic class Watershed<T extends RealType<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 grayscale image with arbitrary number of dimensions, defining the heightmap. 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. 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.Flavor
NAME
Constructor and Description |
---|
Watershed() |
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, setOutput
ops, setEnvironment
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
ops, setEnvironment
calculate, calculate, createOutput, getIndependentInstance, run, run
compute
in, setInput
run
setOutput
candidates, filterArity, op
public void compute(RandomAccessibleInterval<T> in, ImgLabeling<Integer,IntType> out)
UnaryComputerOp
compute
in interface UnaryComputerOp<RandomAccessibleInterval<T extends RealType<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 input
public boolean conforms()
Contingent
conforms
in interface Contingent
public ImgLabeling<Integer,IntType> createOutput(RandomAccessibleInterval<T> in)
UnaryOutputFactory
createOutput
in interface UnaryOutputFactory<RandomAccessibleInterval<T extends RealType<T>>,ImgLabeling<Integer,IntType>>
in
- which determines how to create the outputpublic void initialize()
Initializable
initialize
in interface Initializable
Copyright © 2014–2022 ImageJ. All rights reserved.