public class RegionLabeling.BinaryRegion extends Object implements Comparable<RegionLabeling.BinaryRegion>, Iterable<Point>
RegionLabeling
represents a connected
component or binary region.
It supports iteration over the contained points, e.g., by
BinaryRegion R = ...; for (Point p : R) { // process p ... }
Modifier and Type | Method and Description |
---|---|
protected void |
addInnerContour(Contour contr) |
protected void |
addPixel(int u,
int v)
Use this method to add a single pixel to this region.
|
void |
clearProperties()
Removes all properties attached to this region.
|
int |
compareTo(RegionLabeling.BinaryRegion r2) |
Rectangle |
getBoundingBox()
Get the x/y axes-parallel bounding box as a rectangle
(including the extremal coordinates).
|
Point2D |
getCenter()
Deprecated.
Returns the centroid of this region as a 2D point.
Use
getCenterPoint or getXc and getYc instead. |
Point2D |
getCenterPoint()
Returns the centroid of this region as a 2D point.
|
List<Contour> |
getInnerContours()
Get all inner contours of this region.
|
int |
getLabel()
Get the label associated with this region.
|
Contour |
getOuterContour()
Get the (single) outer contour of this region.
|
double |
getProperty(String name)
Retrieves the specified region property.
|
Iterable<Point> |
getRegionPoints()
Deprecated.
Replaced by BinaryRegion implementing
Iterable<Point> . |
int |
getSize()
Get the size of this region.
|
long |
getX1Sum()
Returns the sum of the x-values of the points
contained in this region.
|
long |
getX2Sum()
Returns the sum of the squared x-values of the points
contained in this region.
|
double |
getXc()
Get the x-value of the region's centroid.
|
long |
getY1Sum()
Returns the sum of the y-values of the points
contained in this region.
|
long |
getY2Sum()
Returns the sum of the squared y-values of the points
contained in this region.
|
double |
getYc()
Get the y-value of the region's centroid.
|
Iterator<Point> |
iterator() |
protected void |
makeInnerContours() |
protected void |
setOuterContour(Contour contr) |
void |
setProperty(String name,
double val)
Sets the specified property of this region to the given value.
|
String |
toString() |
protected void |
update()
Call this method to update the region's statistics.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public double getXc()
public double getYc()
public long getX1Sum()
public long getY1Sum()
public long getX2Sum()
public long getY2Sum()
public int getLabel()
public int getSize()
public Rectangle getBoundingBox()
public Point2D getCenter()
getCenterPoint
or getXc
and getYc
instead.public Point2D getCenterPoint()
getXc
, getYc
.public Iterable<Point> getRegionPoints()
Iterable<Point>
.protected void addPixel(int u, int v)
u
- x-positionv
- y-positionprotected void update()
public Contour getOuterContour()
protected void setOuterContour(Contour contr)
public List<Contour> getInnerContours()
protected void makeInnerContours()
protected void addInnerContour(Contour contr)
public int compareTo(RegionLabeling.BinaryRegion r2)
compareTo
in interface Comparable<RegionLabeling.BinaryRegion>
public void setProperty(String name, double val)
name
- Chosen name of the property.val
- Value associated with this property.public double getProperty(String name)
IllegalArgumentException
is thrown if the property
is not defined for this region.name
- The name of the property.public void clearProperties()
Copyright © 2006–2017, Wilhelm Burger, Mark J. Burge (BSD 2-Clause Simplified License)