This algorithm applies a watershed using as a landscape image either, in dark objects mode, the
input image directly or, in bright objects mode, its negative.
A contrast level parameter is used to reduce the number of markers for the watershed process and
thus of false positive separation lines.
This algorithm is a high-level combination of numerical reconstruction and watershed algorithms.
There is a limitation to the separation ability: if some particles overlap too much, they are not
separated by the algorithm. A sensible criteria is that the distance between particle centroids should be
larger than their greatest radius.
This algorithm can be used on the gradient modulus to compute best-fit contours.
Note: This algorithm requires up to 8 times the size of the input image as free memory.
If the system does not have enough free memory, this algorithm will fail during its computation. In this case,
the HExtremaWatershedByBlock should be used instead.
// Command constructor.HExtremaWatershed();// Get method of the inputGrayImage parameter.
std::shared_ptr< iolink::ImageView> inputGrayImage()const;// Set method of the inputGrayImage parameter.void setInputGrayImage( std::shared_ptr< iolink::ImageView> inputGrayImage );// Get method of the objectLightness parameter.HExtremaWatershed::ObjectLightness objectLightness()const;// Set method of the objectLightness parameter.void setObjectLightness(constHExtremaWatershed::ObjectLightness& objectLightness );// Get method of the contrastValue parameter.int32_t contrastValue()const;// Set method of the contrastValue parameter.void setContrastValue(constint32_t& contrastValue );// Get method of the outputType parameter.HExtremaWatershed::OutputType outputType()const;// Set method of the outputType parameter.void setOutputType(constHExtremaWatershed::OutputType& outputType );// Get method of the algorithmMode parameter.HExtremaWatershed::AlgorithmMode algorithmMode()const;// Set method of the algorithmMode parameter.void setAlgorithmMode(constHExtremaWatershed::AlgorithmMode& algorithmMode );// Get method of the neighborhood parameter.HExtremaWatershed::Neighborhood neighborhood()const;// Set method of the neighborhood parameter.void setNeighborhood(constHExtremaWatershed::Neighborhood& neighborhood );// Get method of the outputImage parameter.
std::shared_ptr< iolink::ImageView> outputImage()const;// Set method of the outputImage parameter.void setOutputImage( std::shared_ptr< iolink::ImageView> outputImage );// Method to launch the command.void execute();
// Property of the inputGrayImage parameter.HExtremaWatershed.input_gray_image
// Property of the objectLightness parameter.HExtremaWatershed.object_lightness
// Property of the contrastValue parameter.HExtremaWatershed.contrast_value
// Property of the outputType parameter.HExtremaWatershed.output_type
// Property of the algorithmMode parameter.HExtremaWatershed.algorithm_mode
// Property of the neighborhood parameter.HExtremaWatershed.neighborhood
// Property of the outputImage parameter.HExtremaWatershed.output_image
// Method to launch the command.
execute()
// Command constructor.HExtremaWatershed()// Property of the inputGrayImage parameter.HExtremaWatershed.inputGrayImage
// Property of the objectLightness parameter.HExtremaWatershed.objectLightness
// Property of the contrastValue parameter.HExtremaWatershed.contrastValue
// Property of the outputType parameter.HExtremaWatershed.outputType
// Property of the algorithmMode parameter.HExtremaWatershed.algorithmMode
// Property of the neighborhood parameter.HExtremaWatershed.neighborhood
// Property of the outputImage parameter.HExtremaWatershed.outputImage
// Method to launch the command.Execute()
Parameters
Class Name
HExtremaWatershed
Parameter Name
Description
Type
Supported Values
Default Value
inputGrayImage
The input grayscale image.
Image
Grayscale
nullptr
objectLightness
The lightness of objects to separate.
DARK_OBJECTS
The watershed is directly applied on the input image in order to separate dark areas.
BRIGHT_OBJECTS
The watershed is applied on the negative of the input image in order to separate bright areas.
Enumeration
DARK_OBJECTS
outputType
The type of result image.
SEPARATED_OBJECTS
The result image is a grayscale image representing the original from which separation lines are added to dark objects or subtracted from bright objects (split areas).
WATERSHED_RIDGES
The result image is a binary image representing the separation lines (watershed).
SEPARATED_BASINS
The result image is a label image representing the catchment areas (labeled complement of the watershed).
CONTIGUOUS_BASINS
The result image is a label image representing the catchment areas with separation lines filled by a label.
Enumeration
SEPARATED_OBJECTS
algorithmMode
The mode for applying the watershed algorithm.
REPEATABLE
The result is repeatable but slower to compute.
FAST
The result is faster to compute but not repeatable because of asynchronous parallel computation. Since a watershed problem does not generally have a unique solution, two processings of the same image can lead to two different results (both exact).
Enumeration
REPEATABLE
contrastValue
The depth of the valley used to select the markers of the watershed.
Int32
>=0
30
neighborhood
The 3D neighborhood configuration. This parameter is ignored with a 2D input image.
CONNECTIVITY_6
The structuring element is composed of voxels with a common face with the voxel of interest.
CONNECTIVITY_18
The structuring element is composed of voxels with at least one common edge.
CONNECTIVITY_26
The structuring element is a full cube.
Enumeration
CONNECTIVITY_26
outputImage
The output grayscale, binary or label image. Its dimensions are forced to the same values as the input image. Its type depends on the outputType parameter.