java.lang.Object
imagingbook.common.regions.BinaryRegion
imagingbook.common.regions.SegmentationBackedRegion
- All Implemented Interfaces:
GenericProperties
,Comparable<BinaryRegion>
,Iterable<Pnt2d>
Defines a binary region that is backed by the label array of a region segmentation. A
SegmentationBackedRegion
instance does not have its own list or array of contained pixel coordinates but
refers to the label array of the associated BinaryRegionSegmentation
instance.- Version:
- 2020/12/21
-
Nested Class Summary
Nested classes/interfaces inherited from interface imagingbook.common.util.GenericProperties
GenericProperties.PropertyKey<T>, GenericProperties.PropertyMap
-
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(int u, int v) Checks if the given pixel position is contained in thisSegmentationBackedRegion
instance.Get the x/y axes-parallel bounding box as a rectangle (including the extremal coordinates).Get all inner contours of this region if available, null otherwise.int
getLabel()
Returns the label (number) of this region.Returns the (single) outer contour of this region if available, null otherwise.int
getSize()
Get the size of this region.long
getX1Sum()
Returns the sum of the x-coordinates of the points contained in this region.long
getX2Sum()
Returns the sum of the squared x-coordinates of the points contained in this region.long
getXYSum()
Returns the sum of the mixed x*y-coordinates of the points contained in this region.long
getY1Sum()
Returns the sum of the y-coordinates of the points contained in this region.long
getY2Sum()
Returns the sum of the squared y-coordinates of the points contained in this region.iterator()
Methods inherited from class imagingbook.common.regions.BinaryRegion
compareTo, contains, getCenter, getCentralMoments, getCovarianceMatrix, getEquivalentEllipse, getMoments, getPropertyMap, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface imagingbook.common.util.GenericProperties
clearAllProperties, getProperty, removeProperty, setProperty
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getLabel
Returns the label (number) of this region.- Returns:
- the region label
-
getSize
Description copied from class:BinaryRegion
Get the size of this region.- Specified by:
getSize
in classBinaryRegion
- Returns:
- the number of region points.
-
getX1Sum
Description copied from class:BinaryRegion
Returns the sum of the x-coordinates of the points contained in this region.- Specified by:
getX1Sum
in classBinaryRegion
- Returns:
- the sum of x-values.
-
getY1Sum
Description copied from class:BinaryRegion
Returns the sum of the y-coordinates of the points contained in this region.- Specified by:
getY1Sum
in classBinaryRegion
- Returns:
- the sum of y-values.
-
getX2Sum
Description copied from class:BinaryRegion
Returns the sum of the squared x-coordinates of the points contained in this region.- Specified by:
getX2Sum
in classBinaryRegion
- Returns:
- the sum of squared x-values.
-
getY2Sum
Description copied from class:BinaryRegion
Returns the sum of the squared y-coordinates of the points contained in this region.- Specified by:
getY2Sum
in classBinaryRegion
- Returns:
- the sum of squared y-values.
-
getXYSum
Description copied from class:BinaryRegion
Returns the sum of the mixed x*y-coordinates of the points contained in this region.- Specified by:
getXYSum
in classBinaryRegion
- Returns:
- the sum of xy-values.
-
getBoundingBox
Description copied from class:BinaryRegion
Get the x/y axes-parallel bounding box as a rectangle (including the extremal coordinates).- Specified by:
getBoundingBox
in classBinaryRegion
- Returns:
- the bounding box rectangle.
-
iterator
-
getOuterContour
Description copied from class:BinaryRegion
Returns the (single) outer contour of this region if available, null otherwise. Points on an outer contour are arranged in clockwise order.- Specified by:
getOuterContour
in classBinaryRegion
- Returns:
- the outer contour or
null
if not available
-
getInnerContours
Description copied from class:BinaryRegion
Get all inner contours of this region if available, null otherwise. Points on inner contours are arranged in counter-clockwise order.- Specified by:
getInnerContours
in classBinaryRegion
- Returns:
- the (possibly empty) list of inner contours or
null
if not available
-
contains
Checks if the given pixel position is contained in thisSegmentationBackedRegion
instance.- Specified by:
contains
in classBinaryRegion
- Parameters:
u
- x-coordinatev
- y-coordinate- Returns:
- true if (u,v) is contained in this region
-