java.lang.Object
imagingbook.common.ij.RoiUtils
This class defines static ROI-related utility methods to interface with ImageJ.
- Version:
- 2022/09/22
-
Method Summary
Modifier and TypeMethodDescriptionstatic Pnt2d[]
getOutlinePointsFloat
(Roi roi) Retrieves the outline of the specified ROI as an array ofPnt2d
points withdouble
coordinates.static Pnt2d[]
getOutlinePointsInt
(Roi roi) Retrieves the outline of the specified ROI as an array ofPnt2d
points withint
coordinates.static Pnt2d[]
getPoints
(FloatPolygon poly) Extracts the points of an ImageJFloatPolygon
.static Pnt2d[]
getPoints
(FloatPolygon poly, double offset) Extracts the points of an ImageJFloatPolygon
.static PointRoi
toPointRoi
(Pnt2d[] points)
-
Method Details
-
getOutlinePointsInt
Retrieves the outline of the specified ROI as an array ofPnt2d
points withint
coordinates. Note that unless the ROI is of typePolygonRoi
orPointRoi
only the corner points of the bounding box are returned. Interpolated contour points are returned for a instance ofOvalRoi
.- Parameters:
roi
- the ROI- Returns:
- the ROI's polygon coordinates
-
getOutlinePointsFloat
Retrieves the outline of the specified ROI as an array ofPnt2d
points withdouble
coordinates. Returned coordinates are measured relative to the pixel center, e.g., (5.0, 3.0) is assumed to be in the middle of pixel (5, 3). This method retrieves ROI points withRoi.getFloatPolygon()
but applies type-dependent correction for consistent point rendering.- Parameters:
roi
- theRoi
- Returns:
- the ROI's outline coordinates
-
getPoints
Extracts the points of an ImageJFloatPolygon
.- Parameters:
poly
- the original polygonoffset
- x/y offset to add to coordinates (typically -0.5 for "area ROIs")- Returns:
- the polygon's vertex points
-
getPoints
Extracts the points of an ImageJFloatPolygon
. CallsgetPoints(FloatPolygon, double)
with zero offset.- Parameters:
poly
- the original polygon- Returns:
- the polygon's vertex points
-
toPointRoi
- Parameters:
points
- v- Returns:
- a
PointRoi
instance
-