public class PolygonRoi extends Roi
Modifier and Type | Field and Description |
---|---|
protected int |
maxPoints |
protected int |
nPoints |
protected int |
splinePoints |
protected int[] |
xp |
protected int[] |
xp2 |
protected float[] |
xpf |
protected float[] |
xSpline |
protected int[] |
yp |
protected int[] |
yp2 |
protected float[] |
ypf |
protected float[] |
ySpline |
ANGLE, asp_bk, aspect, cachedMask, center, clipboard, clipHeight, clipWidth, clipX, clipY, COMPOSITE, constrain, CONSTRUCTING, defaultFillColor, fillColor, FREELINE, FREEROI, HANDLE_SIZE, handleColor, ic, ignoreClipRect, imp, instanceColor, LINE, lineWidth, mag, MOVING, MOVING_HANDLE, nonScalable, NORMAL, NOT_PASTING, oldHeight, oldWidth, oldX, oldY, onePixelWide, OVAL, overlay, pasteMode, POINT, POLYGON, POLYLINE, previousRoi, RECTANGLE, RESIZING, ROIColor, stroke, strokeColor, TRACED_ROI, type, updateFullWindow, wideLine, xMax, yMax
Constructor and Description |
---|
PolygonRoi(float[] xPoints,
float[] yPoints,
int nPoints,
int type)
Creates a new polygon or polyline ROI from float x and y arrays.
|
PolygonRoi(FloatPolygon p,
int type)
Creates a new polygon or polyline ROI from a FloatPolygon.
|
PolygonRoi(int[] xPoints,
int[] yPoints,
int nPoints,
ImagePlus imp,
int type)
Deprecated.
|
PolygonRoi(int[] xPoints,
int[] yPoints,
int nPoints,
int type)
Creates a new polygon or polyline ROI from x and y coordinate arrays.
|
PolygonRoi(int sx,
int sy,
ImagePlus imp)
Starts the process of creating a new user-generated polygon or polyline ROI.
|
PolygonRoi(java.awt.Polygon p,
int type)
Creates a new polygon or polyline ROI from a Polygon.
|
PolygonRoi(java.lang.String filename,
java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
protected void |
addOffset() |
protected int |
clipRectMargin() |
java.lang.Object |
clone()
Returns a copy of this PolygonRoi.
|
boolean |
contains(int x,
int y) |
void |
deleteHandle(double ox,
double oy) |
void |
draw(java.awt.Graphics g) |
void |
drawPixels(ImageProcessor ip)
Draws the selection outline on the specified ImageProcessor.
|
void |
enableSubPixelResolution() |
void |
exitConstructingMode() |
void |
fitSpline() |
void |
fitSpline(int evaluationPoints) |
void |
fitSplineForStraightening() |
double |
getAngle()
Returns the angle in degrees between the first two segments of this polyline.
|
java.awt.Polygon |
getConvexHull()
Uses the gift wrap algorithm to find the
convex hull and returns it as a Polygon.
|
java.lang.String |
getDebugInfo() |
boolean |
getDrawOffset()
Returns true if this is a PolygonRoi that supports sub-pixel
resolution and polygons are drawn on zoomed images offset
down and to the right by 0.5 pixels..
|
FloatPolygon |
getFloatPolygon()
Returns this polygon or polyline as float arrays.
|
FloatPolygon |
getInterpolatedPolygon(double interval,
boolean smooth)
Returns, as a FloatPolygon, an interpolated version of
this selection with points spaced 'interval' pixels apart.
|
double |
getLength()
Returns the perimeter (for ROIs) or length (for lines).
|
ImageProcessor |
getMask()
Override Roi.nudge() to support splines.
|
int |
getNCoordinates()
Returns the number of XY coordinates.
|
java.awt.Polygon |
getNonSplineCoordinates() |
FloatPolygon |
getNonSplineFloatPolygon() |
java.awt.Polygon |
getPolygon()
Returns this PolygonRoi as a Polygon.
|
double |
getUncalibratedLength() |
int[] |
getXCoordinates()
Obsolete; replaced by either getPolygon() or getFloatPolygon().
|
int[] |
getYCoordinates()
Obsolete; replaced by either getPolygon() or getFloatPolygon().
|
protected void |
grow(int sx,
int sy) |
protected void |
handleMouseUp(int sx,
int sy)
With segmented selections, ignore first mouse up and finalize
when user double-clicks, control-clicks or clicks in start box.
|
int |
isHandle(int sx,
int sy)
Returns a handle number if the specified screen coordinates are
inside or near a handle, otherwise returns -1.
|
boolean |
isSplineFit()
Returns 'true' if this selection has been fitted with a spline.
|
protected void |
mouseDownInHandle(int handle,
int sx,
int sy) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
protected void |
moveHandle(int sx,
int sy) |
void |
removeSplineFit() |
PolygonRoi |
rescale(double fromBinSize,
double toBinSize) |
void |
setDrawOffset(boolean drawOffset) |
void |
setLocation(double x,
double y)
Set the location of the ROI in image coordinates.
|
boolean |
subPixelResolution()
Returns true if this is a slection that supports sub-pixel resolution.
|
protected void |
updatePolygon() |
abortPaste, copyAttributes, drawOverlay, drawPixels, endPaste, equals, forwardTraverse, getAngle, getArea, getBoundingRect, getBounds, getCentroid, getColor, getCornerDiameter, getCPosition, getCurrentPasteMode, getDefaultFillColor, getFeretsDiameter, getFeretValues, getFillColor, getFloatAngle, getFloatBounds, getFloatHeight, getFloatWidth, getHashCode, getImage, getImageID, getInterpolatedPolygon, getInterpolatedPolygon, getMagnification, getName, getNextRoi, getPasteMode, getPosition, getPreviousRoi, getProperties, getProperty, getPropertyCount, getPrototypeOverlay, getRoundRectArcSize, getScaledStroke, getState, getStroke, getStrokeColor, getStrokeWidth, getTPosition, getType, getTypeAsString, getXBase, getYBase, getZPosition, handleMouseDown, handleMouseDrag, isActiveOverlayRoi, isArea, isDrawingTool, isLine, isVisible, mouseDragged, mouseReleased, nudge, nudgeCorner, saveRoi, screenX, screenXD, screenY, screenYD, setColor, setCornerDiameter, setDefaultFillColor, setFillColor, setIgnoreClipRect, setImage, setInstanceColor, setLineWidth, setLocation, setName, setNextRoi, setNonScalable, setPasteMode, setPosition, setPosition, setPreviousRoi, setProperties, setProperty, setPrototypeOverlay, setRoundRectArcSize, setStroke, setStrokeColor, setStrokeWidth, setStrokeWidth, showStatus, startPaste, temporarilyHide, toFloat, toInt, toInt, toIntR, toString, update, updateClipRect, updateWideLine
protected int maxPoints
protected int[] xp
protected int[] yp
protected float[] xpf
protected float[] ypf
protected int[] xp2
protected int[] yp2
protected int nPoints
protected float[] xSpline
protected float[] ySpline
protected int splinePoints
public PolygonRoi(int[] xPoints, int[] yPoints, int nPoints, int type)
public PolygonRoi(float[] xPoints, float[] yPoints, int nPoints, int type)
public PolygonRoi(java.lang.String filename, java.lang.String name)
public PolygonRoi(java.awt.Polygon p, int type)
public PolygonRoi(FloatPolygon p, int type)
public PolygonRoi(int[] xPoints, int[] yPoints, int nPoints, ImagePlus imp, int type)
public PolygonRoi(int sx, int sy, ImagePlus imp)
public PolygonRoi rescale(double fromBinSize, double toBinSize)
public void drawPixels(ImageProcessor ip)
Roi
drawPixels
in class Roi
ImageProcessor.setColor(java.awt.Color)
,
ImageProcessor.setLineWidth(int)
protected void updatePolygon()
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in class Roi
public void exitConstructingMode()
protected void moveHandle(int sx, int sy)
moveHandle
in class Roi
protected void mouseDownInHandle(int handle, int sx, int sy)
mouseDownInHandle
in class Roi
public void deleteHandle(double ox, double oy)
public void fitSpline(int evaluationPoints)
public void fitSpline()
public void removeSplineFit()
public boolean isSplineFit()
public void fitSplineForStraightening()
public double getUncalibratedLength()
protected void handleMouseUp(int sx, int sy)
handleMouseUp
in class Roi
protected void addOffset()
public int isHandle(int sx, int sy)
public ImageProcessor getMask()
public double getLength()
public double getAngle()
public int getNCoordinates()
public int[] getXCoordinates()
public int[] getYCoordinates()
public java.awt.Polygon getNonSplineCoordinates()
public FloatPolygon getNonSplineFloatPolygon()
public java.awt.Polygon getPolygon()
getPolygon
in class Roi
ImageProcessor.setRoi(java.awt.Rectangle)
,
ImageProcessor.drawPolygon(java.awt.Polygon)
,
ImageProcessor.fillPolygon(java.awt.Polygon)
public FloatPolygon getFloatPolygon()
getFloatPolygon
in class Roi
public boolean subPixelResolution()
Roi
subPixelResolution
in class Roi
public java.awt.Polygon getConvexHull()
getConvexHull
in class Roi
public FloatPolygon getInterpolatedPolygon(double interval, boolean smooth)
Roi
getInterpolatedPolygon
in class Roi
protected int clipRectMargin()
clipRectMargin
in class Roi
public java.lang.Object clone()
public boolean getDrawOffset()
Roi
getDrawOffset
in class Roi
public void setDrawOffset(boolean drawOffset)
setDrawOffset
in class Roi
public void setLocation(double x, double y)
Roi
setLocation
in class Roi
public void enableSubPixelResolution()
enableSubPixelResolution
in class Roi
public java.lang.String getDebugInfo()
getDebugInfo
in class Roi