Operator Reference

watersheds_thresholdwatersheds_thresholdWatershedsThresholdWatershedsThresholdwatersheds_threshold (Operator)

watersheds_thresholdwatersheds_thresholdWatershedsThresholdWatershedsThresholdwatersheds_threshold — Extract watershed basins from an image using a threshold.

Signature

watersheds_threshold(Image : Basins : Threshold : )

Herror watersheds_threshold(const Hobject Image, Hobject* Basins, const Hlong Threshold)

Herror T_watersheds_threshold(const Hobject Image, Hobject* Basins, const Htuple Threshold)

void WatershedsThreshold(const HObject& Image, HObject* Basins, const HTuple& Threshold)

HRegion HImage::WatershedsThreshold(const HTuple& Threshold) const

HRegion HImage::WatershedsThreshold(Hlong Threshold) const

static void HOperatorSet.WatershedsThreshold(HObject image, out HObject basins, HTuple threshold)

HRegion HImage.WatershedsThreshold(HTuple threshold)

HRegion HImage.WatershedsThreshold(int threshold)

def watersheds_threshold(image: HObject, threshold: Union[float, int]) -> HObject

Description

The operator watersheds_thresholdwatersheds_thresholdWatershedsThresholdWatershedsThresholdwatersheds_threshold segments regions (basins) that are separated from each other by a watershed that has a height of at least ThresholdThresholdThresholdthresholdthreshold.

In the first step, watersheds_thresholdwatersheds_thresholdWatershedsThresholdWatershedsThresholdwatersheds_threshold computes the watersheds without applying a threshold, resulting in the same basins that would be obtained when calling watershedswatershedsWatershedsWatershedswatersheds (for more details please refer to the description of watershedswatershedsWatershedsWatershedswatersheds). In the second step, the basins are successively merged if they are separated by a watershed that is smaller than ThresholdThresholdThresholdthresholdthreshold. Let and be the minimum gray values of two neighboring basins and W the minimum gray value of the watershed that separates the two basins. The watershed is eliminated and the two basins are merged if The thus obtained basins are returned in BasinsBasinsBasinsbasinsbasins.

If ThresholdThresholdThresholdthresholdthreshold is set to 0, watersheds_thresholdwatersheds_thresholdWatershedsThresholdWatershedsThresholdwatersheds_threshold is comparable to watershedswatershedsWatershedsWatershedswatersheds except that no watersheds but only expanded basins are returned. If ThresholdThresholdThresholdthresholdthreshold is set to the maximum gray value range of ImageImageImageimageimage then no two basins are separated by a watershed exceeding ThresholdThresholdThresholdthresholdthreshold, and hence, BasinsBasinsBasinsbasinsbasins will contain only one region.

Execution Information

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

ImageImageImageimageimage (input_object)  singlechannelimage objectHImageHObjectHObjectHobject (byte / uint2 / real)

Image to be segmented.

BasinsBasinsBasinsbasinsbasins (output_object)  region-array objectHRegionHObjectHObjectHobject *

Segments found (dark basins).

ThresholdThresholdThresholdthresholdthreshold (input_control)  number HTupleUnion[float, int]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Threshold for the watersheds.

Default: 10

Suggested values: 0, 5, 10, 20, 30, 50

Restriction: Threshold >= 0

Result

watershedswatershedsWatershedsWatershedswatersheds always returns 2 ( H_MSG_TRUE) . The behavior with respect to the input image and output regions can be determined by setting the values of the flags 'no_object_result'"no_object_result""no_object_result""no_object_result""no_object_result", 'empty_region_result'"empty_region_result""empty_region_result""empty_region_result""empty_region_result", and 'store_empty_region'"store_empty_region""store_empty_region""store_empty_region""store_empty_region" with set_systemset_systemSetSystemSetSystemset_system. If necessary, an exception is raised.

Possible Predecessors

binomial_filterbinomial_filterBinomialFilterBinomialFilterbinomial_filter, gauss_filtergauss_filterGaussFilterGaussFiltergauss_filter, smooth_imagesmooth_imageSmoothImageSmoothImagesmooth_image, invert_imageinvert_imageInvertImageInvertImageinvert_image

Possible Successors

expand_regionexpand_regionExpandRegionExpandRegionexpand_region, select_shapeselect_shapeSelectShapeSelectShapeselect_shape, reduce_domainreduce_domainReduceDomainReduceDomainreduce_domain, openingopeningOpeningOpeningopening

Alternatives

watershedswatershedsWatershedsWatershedswatersheds, pouringpouringPouringPouringpouring, watersheds_markerwatersheds_markerWatershedsMarkerWatershedsMarkerwatersheds_marker

Module

Foundation