Skip to content

top_hatTopHatTopHattop_hattop_hat🔗

Short description🔗

top_hatTopHatTopHattop_hattop_hat — Compute the top hat of regions.

Signature🔗

top_hat( region Region, region StructElement, out region RegionTopHat )void TopHat( const HObject& Region, const HObject& StructElement, HObject* RegionTopHat )static void HOperatorSet.TopHat( HObject region, HObject structElement, out HObject regionTopHat )def top_hat( region: HObject, struct_element: HObject ) -> HObject

Herror top_hat( const Hobject Region, const Hobject StructElement, Hobject* RegionTopHat )

Herror T_top_hat( const Hobject Region, const Hobject StructElement, Hobject* RegionTopHat )

HRegion HRegion::TopHat( const HRegion& StructElement ) const

HRegion HRegion.TopHat( HRegion structElement )

Description🔗

top_hatTopHat computes the openingOpening of Regionregionregion with StructElementstructElementstruct_element. The difference between the original region and the result of the opening is called the top hat. In contrast to openingOpening, which splits regions under certain circumstances, top_hatTopHat computes the regions removed by such a splitting.

The position of StructElementstructElementstruct_element is meaningless, since an opening operation is invariant with respect to the choice of the reference point.

Structuring elements (StructElementstructElementstruct_element) can be generated with operators such as gen_circleGenCircle, gen_rectangle1GenRectangle1, gen_rectangle2GenRectangle2, gen_ellipseGenEllipse, draw_regionDrawRegion, gen_region_polygonGenRegionPolygon, gen_region_pointsGenRegionPoints, etc.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

Parameters🔗

Regionregionregion (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Regions to be processed.

StructElementstructElementstruct_element (input_object) region → objectHObjectHRegionHObjectHobject

Structuring element (position independent).

RegionTopHatregionTopHatregion_top_hat (output_object) region(-array) → objectHObjectHRegionHObjectHobject *

Result of the top hat operator.

Result🔗

top_hatTopHat returns 2 (H_MSG_TRUE) if all parameters are correct. The behavior in case of empty or no input region can be set via:

  • no region: set_system('no_object_result',<RegionResult>)

  • empty region: set_system('empty_region_result',<RegionResult>)

Otherwise, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

thresholdThreshold, regiongrowingRegiongrowing, connectionConnection, union1Union1, watershedsWatersheds, class_ndim_normClassNdimNorm, gen_circleGenCircle, gen_ellipseGenEllipse, gen_rectangle1GenRectangle1, gen_rectangle2GenRectangle2, draw_regionDrawRegion, gen_region_pointsGenRegionPoints, gen_region_polygon_filledGenRegionPolygonFilled

Possible successors

reduce_domainReduceDomain, select_shapeSelectShape, area_centerAreaCenter, connectionConnection

Alternatives

openingOpening, differenceDifference

See also

bottom_hatBottomHat, gray_tophatGrayTophat, openingOpening

Module🔗

Foundation