IDS peak ICV v1.4.0
Loading...
Searching...
No Matches
Region Class Referencefinal

#include <peak_icv/types/peak_icv_region.hpp>

Inheritance diagram for Region:

Public Member Functions

 Region ()
 Creates an empty Region.
 
 Region (const std::vector< peak::common::Point > &points)
 Creates a region from a collection of points.
 
 Region (const peak::common::Rectangle &rect)
 Creates a region from a Rectangle.
 
 ~Region () override
 
 Region (const Region &other)
 
 Region (Region &&other) noexcept
 
Region & operator= (const Region &other)
 
Region & operator= (Region &&other) noexcept
 
bool operator== (const Region &rhs) const
 
bool operator!= (const Region &rhs) const
 
std::vector< peak::common::Point > GetPoints () const
 Returns the points from a region.
 
std::vector< Region > GetConnectedComponents () const
 Calculates the connected components of the region.
 
size_t GetArea () const
 Calculates the area of a region. The area is the number of pixels in the region.
 
peak::common::PointF GetCenterOfGravity () const
 Calculates the center of gravity of a region.
 
Region Intersection (const Region &other) const
 Calculates the intersection of two regions.
 
Region Difference (const Region &other) const
 Calculates the difference of two regions.
 
Region Union (const Region &other) const
 Calculates the union of two regions.
 
Region Dilation (const Region &structuringElement) const
 Performs morphological dilation on the input region using the specified structuring element.
 
Region Erosion (const Region &structuringElement) const
 Performs morphological erosion on the input region using the specified structuring element.
 
Region Scale (const peak::common::Size &inputSize, const peak::common::Size &outputSize, const Interpolation &interpolation=Interpolation::NearestNeighbor) const
 Returns a scaled region.
 

Detailed Description

Represents a region defined by a set of points in the image plane.

The Region class models a geometric area within an image, represented as a collection of discrete points in 2D image coordinates. It serves as a logical grouping of image locations, which may be used for selection, analysis, or rendering purposes.

Painting Behavior

The Region class implements its own drawing logic via the IDrawable interface. When triggered by the Painter, it paints itself onto the target image by rendering only the points that fall within the image bounds.

  • Points inside the image are painted.
  • Points outside the image boundaries are silently ignored.
  • If the Region is empty (i.e., contains no points), the image remains unmodified, and the paint operation completes successfully without any effect.
See also
Concept: Region, which defines the structure and properties of a region.
Since
ids_peak_icv 1.1

Constructor & Destructor Documentation

◆ Region() [1/5]

Region ( )
inline

Creates an empty Region.

Since
ids_peak_icv 1.1

◆ Region() [2/5]

Region ( const std::vector< peak::common::Point > & points)
inlineexplicit

Creates a region from a collection of points.

Since
ids_peak_icv 1.1

◆ Region() [3/5]

Region ( const peak::common::Rectangle & rect)
inlineexplicit

Creates a region from a Rectangle.

Since
ids_peak_icv 1.1

◆ ~Region()

~Region ( )
inlineoverride
Since
ids_peak_icv 1.1

◆ Region() [4/5]

Region ( const Region & other)
inline
Since
ids_peak_icv 1.1

◆ Region() [5/5]

Region ( Region && other)
inlinenoexcept
Since
ids_peak_icv 1.1

Member Function Documentation

◆ Difference()

Region Difference ( const Region & other) const
inline

Calculates the difference of two regions.

See also
Determining the difference
Returns
Returns the difference of two regions.
Since
ids_peak_icv 1.1

◆ Dilation()

Region Dilation ( const Region & structuringElement) const
inline

Performs morphological dilation on the input region using the specified structuring element.

The reference point of the structuring element is at (0, 0).

Returns
Returns the dilated region.
Since
ids_peak_icv 1.1

◆ Erosion()

Region Erosion ( const Region & structuringElement) const
inline

Performs morphological erosion on the input region using the specified structuring element.

The reference point of the structuring element is at (0, 0).

Returns
Returns the eroded region.
Since
ids_peak_icv 1.1

◆ GetArea()

size_t GetArea ( ) const
inline

Calculates the area of a region. The area is the number of pixels in the region.

Returns
Returns the area of a region.
Since
ids_peak_icv 1.1

◆ GetCenterOfGravity()

peak::common::PointF GetCenterOfGravity ( ) const
inline

Calculates the center of gravity of a region.

Returns
Returns the center of gravity as a floating point.
Exceptions
MathErrorExceptionThe center of gravity could not be calculated.
Since
ids_peak_icv 1.1

◆ GetConnectedComponents()

std::vector< Region > GetConnectedComponents ( ) const
inline

Calculates the connected components of the region.

The 8-neighborhood is used to determine the components.

See also
Determining connected components
Returns
Returns the connected components of the region as a region vector.
Since
ids_peak_icv 1.1

◆ GetPoints()

std::vector< peak::common::Point > GetPoints ( ) const
inline

Returns the points from a region.

Since
ids_peak_icv 1.1

◆ Intersection()

Region Intersection ( const Region & other) const
inline

Calculates the intersection of two regions.

See also
Determining the intersection
Returns
Returns the intersection of two regions.
Since
ids_peak_icv 1.1

◆ operator!=()

bool operator!= ( const Region & rhs) const
inline
Since
ids_peak_icv 1.1

◆ operator=() [1/2]

Region & operator= ( const Region & other)
inline
Since
ids_peak_icv 1.1

◆ operator=() [2/2]

Region & operator= ( Region && other)
inlinenoexcept
Since
ids_peak_icv 1.1

◆ operator==()

bool operator== ( const Region & rhs) const
inline
Since
ids_peak_icv 1.1

◆ Scale()

Region Scale ( const peak::common::Size & inputSize,
const peak::common::Size & outputSize,
const Interpolation & interpolation = Interpolation::NearestNeighbor ) const
inline

Returns a scaled region.

The inputSize typically refers to the dimensions of the original image in pixels from which the region was derived (e.g. during segmentation). This is the coordinate space in which the region was initially defined. The size must be at least as large as the extent of the region.

The outputSize represents the dimensions of the target image in pixels where the region will be mapped or rendered after scaling or transformation.

Ensure that any coordinate or size transformations account for the difference between input and output dimensions to maintain spatial consistency.

Parameters
inputSizeThe size in pixels based on the original image.
outputSizeThe size in pixels of a corresponding image to which the original region is scaled.
interpolationThe interpolation method used to scale the image.
Returns
The scaled region.
Exceptions
NotPossibleExceptionThe region extent is greater than the given inputSize or the given outputSize is empty (i.e. width × height == 0).
Since
ids_peak_icv 1.1

◆ Union()

Region Union ( const Region & other) const
inline

Calculates the union of two regions.

See also
Determining the union
Returns
Returns the united region.
Since
ids_peak_icv 1.1