ROI
Source: roi.js:8
Region Of Interest shape. Note: should be a closed path.
Constructor
new ROI(points?: Array.<Point2D>): ROIParameters
points(Array.<Point2D>, optional) — Optional initial point list.
Instance Methods
getPoint(index: number): Point2D | undefined
Get a point of the list at a given index.
Parameters
index(number) — The index of the point to get (beware, no size check).
Returns
Point2D| undefined— The Point2D at the given index.
getPoints(): Array.<Point2D>
Get the point list.
Returns
Array.<Point2D>— The list.
getLength(): number
Get the length of the point list.
Returns
number— The length of the point list.
addPoint(point: Point2D)
Add a point to the ROI.
Parameters
point(Point2D) — The Point2D to add.
addPoints(rhs: Array.<Point2D>)
Add points to the ROI.
Parameters
rhs(Array.<Point2D>) — The array of POints2D to add.
getCentroid(): Point2D | undefined
Get the centroid of the roi. Only valid for a non-self-intersecting closed polygon. Ref: https://en.wikipedia.org/wiki/Centroid#Of_a_polygon.
Returns
Point2D| undefined— The centroid point.
contains(point: Point2D, tolerance?: number): boolean
Check if a point is inside the roi (seen as a closed polygon), or within a tolerance of its outline.
Parameters
point(Point2D) — The point to check.tolerance(number, optional, default: 0) — Optional maximum distance to the outline for an outside point, defaults to 0.
Returns
boolean— True if the point is in the roi.