IDS peak ICV v1.5.0
Loading...
Searching...
No Matches
Region Class Reference
Inheritance diagram for Region:

Public Member Functions

Region create_from_points (cls, Union[PointArray, npt.NDArray[np.int_]] points)
 Creates a region from points.
 
Region create_from_rectangle (cls, Rectangle rect)
 Creates a Region from a Rectangle.
 
None __init__ (self, *Any args, **Any kwargs)
 In order to create an empty Region create it with no arguments, in all other cases please refer to the classmethods.
 
bool __eq__ (self, object other)
 Check if two regions are equal.
 
bool __ne__ (self, object other)
 Check if two regions are not equal.
 
PointArray points (self)
 Get the points of the region.
 
RegionArray connected_components (self)
 Calculate the connected components of the region.
 
int area (self)
 Calculate the area of the region.
 
Point center_of_gravity (self)
 Calculate the center of gravity of the region.
 
Region intersection (self, Region other_region)
 Computes the intersection of two regions.
 
Region difference (self, Region other_region)
 Computes the difference of two regions.
 
Region union (self, Region other_region)
 Computes the union of two regions.
 
Region dilation (self, Region structuring_element)
 Computes the dilation of the input region with the given structuring element.
 
Region erosion (self, Region structuring_element)
 Computes the erosion of the input region with the given structuring element.
 
None __del__ (self)
 Destructor for Region class.
 

Protected Member Functions

None _draw (self, Image image, DrawingOptions drawing_options)
 Only region points inside the image are painted.
 

Protected Attributes

 _handle = peak_icv_region_handle(None)
 
np.ndarray|None _points = None
 
np.ndarray|None _connected_components = None
 

Detailed Description

Represents a region consisting of a set of points in the image plane.

See also
Region
Since
ids_peak_icv 1.0

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self,
*Any args,
**Any kwargs )

In order to create an empty Region create it with no arguments, in all other cases please refer to the classmethods.

Since
ids_peak_icv 1.0

◆ __del__()

None __del__ ( self)

Destructor for Region class.

Member Function Documentation

◆ __eq__()

bool __eq__ ( self,
object other )

Check if two regions are equal.

Parameters
otherAnother Region object
Returns
True if regions are equal, False otherwise
Since
ids_peak_icv 1.0

◆ __ne__()

bool __ne__ ( self,
object other )

Check if two regions are not equal.

Parameters
otherAnother Region object
Returns
True if regions are not equal, False otherwise
Since
ids_peak_icv 1.0

◆ _draw()

None _draw ( self,
Image image,
DrawingOptions drawing_options )
protected

Only region points inside the image are painted.

Region points outside the image are ignored. In case of an empty region, the image is not modified.

Since
ids_peak_icv 1.0

Reimplemented from IDrawable.

◆ area()

int area ( self)

Calculate the area of the region.

The area is the number of pixels in the region.

Returns
Area of the region.
Since
ids_peak_icv 1.0

◆ center_of_gravity()

Point center_of_gravity ( self)

Calculate the center of gravity of the region.

Returns
Center of gravity as a PointF object.
Exceptions
MathErrorExceptionIf the center of gravity could not be computed.
Since
ids_peak_icv 1.0

◆ connected_components()

RegionArray connected_components ( self)

Calculate the connected components of the region.

The 8-neighborhood is used to determine the components.

See also
Determining connected components
Returns
List of connected components as Region objects.
Since
ids_peak_icv 1.0

◆ create_from_points()

Region create_from_points ( cls,
Union[PointArray, npt.NDArray[np.int_]] points )

Creates a region from points.

Parameters
pointsNumPy Array of Point objects representing the region's points OR NumPy Array of Points [x,y]
Returns
A region instance.
Exceptions
OutOfRangeExceptionIf a point at a given index has an invalid length.
NotSupportedExceptionIf the parameter `points` is not a NumPy array of Point objects or a two-dimensional NumPy array.
Since
ids_peak_icv 1.0

◆ create_from_rectangle()

Region create_from_rectangle ( cls,
Rectangle rect )

Creates a Region from a Rectangle.

Parameters
rectRectangle to create the region from
Returns
A region instance.
Exceptions
NotSupportedExceptionIf the contents of rectangle are not integers.
Since
ids_peak_icv 1.0

◆ difference()

Region difference ( self,
Region other_region )

Computes the difference of two regions.

Returns
The difference of two regions.
Since
ids_peak_icv 1.0

◆ dilation()

Region dilation ( self,
Region structuring_element )

Computes the dilation of the input region with the given structuring element.

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

Parameters
structuring_element
Returns
The dilated region.
Since
ids_peak_icv 1.0

◆ erosion()

Region erosion ( self,
Region structuring_element )

Computes the erosion of the input region with the given structuring element.

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

Parameters
structuring_element
Returns
The eroded region.
Since
ids_peak_icv 1.0

◆ intersection()

Region intersection ( self,
Region other_region )

Computes the intersection of two regions.

Returns
The intersection of two regions.
Since
ids_peak_icv 1.0

◆ points()

PointArray points ( self)

Get the points of the region.

Returns
List of Point objects representing the region's points.
Since
ids_peak_icv 1.0

◆ union()

Region union ( self,
Region other_region )

Computes the union of two regions.

Returns
The united region.
Since
ids_peak_icv 1.0

Field Documentation

◆ _connected_components

_connected_components = None
protected

◆ _handle

_handle = peak_icv_region_handle(None)
protected

◆ _points

_points = None
protected