Module ij
Package ij.gui

# Class EllipseRoi

java.lang.Object
ij.gui.Roi
ij.gui.PolygonRoi
ij.gui.EllipseRoi

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Iterable<Point>`

public class EllipseRoi extends PolygonRoi
This class implements the ellipse selection tool.

See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class ij.gui.PolygonRoi

`maxPoints, nPoints, splinePoints, xp, xp2, xpf, xSpline, yp, yp2, ypf, ySpline`

### Fields inherited from class ij.gui.Roi

`ANGLE, asp_bk, aspect, cachedMask, center, clipboard, clipHeight, clipWidth, clipX, clipY, COMPOSITE, constrain, CONSTRUCTING, defaultColor, defaultFillColor, FERET_ARRAY_POINTOFFSET, FERET_ARRAYSIZE, fillColor, flattenScale, 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 Summary

Constructors
Constructor
Description
`EllipseRoi(double x1, double y1, double x2, double y2, double aspectRatio)`
`EllipseRoi(int sx, int sy, ImagePlus imp)`

## Method Summary

Modifier and Type
Method
Description
`void`
`draw(Graphics g)`
`double[]`
`getFeretValues()`
Returns an array with the following values:
[0] "Feret" (maximum caliper width)
[1] "FeretAngle" (angle of diameter with maximum caliper width, between 0 and 180 deg)
[2] "MinFeret" (minimum caliper width)
[3][4] , "FeretX" and "FeretY", the X and Y coordinates of the starting point (leftmost point) of the maximum-caliper-width diameter.
`double`
`getLength()`
Returns the perimeter of this ellipse.
`double[]`
`getParams()`
Returns x1, y1, x2, y2 and aspectRatio as a 5 element array.
`protected void`
`grow(int sx, int sy)`
`protected void`
`handleMouseUp(int screenX, int screenY)`
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.
`protected void`
`moveHandle(int sx, int sy)`
`void`
`nudgeCorner(int key)`
Nudge lower right corner of rectangular and oval ROIs by one pixel based on arrow key press.
`void`
`showStatus()`
`boolean`
`subPixelResolution()`
Always returns true.

### Methods inherited from class ij.gui.PolygonRoi

`addOffset, clipRectMargin, clone, contains, containsPoint, deleteHandle, deletePoint, drawPixels, enableSubPixelResolution, exitConstructingMode, fitSpline, fitSpline, fitSplineForStraightening, getAngle, getClosestPoint, getDebugInfo, getFloatPolygon, getInterpolatedPolygon, getMask, getNCoordinates, getNonSplineCoordinates, getNonSplineFloatPolygon, getPolygon, getUncalibratedLength, getXCoordinates, getYCoordinates, isSplineFit, mouseDownInHandle, mouseMoved, removeSplineFit, resetBoundingRect, setLocation, size, updatePolygon, wipeBack`

### Methods inherited from class ij.gui.Roi

`abortModification, abortPaste, addRoiListener, convertLineToArea, convertToPolygon, copyAttributes, create, create, drawOverlay, drawPixels, endPaste, equals, getAngle, getAntiAlias, getBoundingRect, getBounds, getColor, getContainedFloatPoints, getContainedPoints, getContourCentroid, getConvexHull, getCornerDiameter, getCPosition, getCurrentPasteMode, getDefaultFillColor, getDefaultGroup, getDefaultHandleSize, getDefaultStrokeWidth, getDrawOffset, getFeretsDiameter, getFillColor, getFloatAngle, getFloatBounds, getFloatConvexHull, getFloatHeight, getFloatPolygon, getFloatWidth, getGroup, getGroupName, getGroupNames, getHandleSize, getHashCode, getImage, getImageID, getInterpolatedPolygon, getInterpolatedPolygon, getInverse, getListeners, getMagnification, getName, getPasteMode, getPosition, getPreviousRoi, getProperties, getProperty, getPropertyCount, getPrototypeOverlay, getRotationCenter, getRoundRectArcSize, getScaledStroke, getScaleStrokeWidth, getState, getStatistics, getStroke, getStrokeColor, getStrokeWidth, getTPosition, getType, getTypeAsString, getXBase, getYBase, getZPosition, handleMouseDown, handleMouseDrag, hasHyperStackPosition, isActiveOverlayRoi, isArea, isCursor, isDrawingTool, isInteger, isLine, isLineOrPoint, isVisible, iterator, lineCircleIntersection, magnificationForSubPixel, magnificationForSubPixel, mouseDragged, mouseReleased, notifyListeners, nudge, offScreenX, offScreenXD, offScreenY, offScreenYD, removeRoiListener, resetDefaultHandleSize, saveGroupNames, screenX, screenXD, screenY, screenYD, setAntiAlias, setBounds, setColor, setCornerDiameter, setDefaultColor, setDefaultFillColor, setDefaultGroup, setDefaultStrokeWidth, setDrawOffset, setFillColor, setFlattenScale, setGroup, setGroupName, setGroupNames, setHandleSize, setIgnoreClipRect, setImage, setInstanceColor, setIsCursor, setLineWidth, setLocation, setName, setNonScalable, setPasteMode, setPosition, setPosition, setPosition, setPreviousRoi, setProperties, setProperty, setPrototypeOverlay, setRenderingHint, setRotationCenter, setRoundRectArcSize, setStroke, setStrokeColor, setStrokeWidth, setStrokeWidth, setUnscalableStrokeWidth, startPaste, temporarilyHide, toFloat, toInt, toInt, toIntR, toString, translate, update, updateClipRect, updateWideLine, useLineSubpixelConvention, xor`

### Methods inherited from class java.lang.Object

`finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

## Constructor Details

### EllipseRoi

public EllipseRoi(double x1, double y1, double x2, double y2, double aspectRatio)

### EllipseRoi

public EllipseRoi(int sx, int sy, ImagePlus imp)

## Method Details

### draw

public void draw(Graphics g)

Overrides:
  `draw` in class `PolygonRoi`

### grow

protected void grow(int sx, int sy)

Overrides:
  `grow` in class `PolygonRoi`

### showStatus

public void showStatus()

Overrides:
  `showStatus` in class `Roi`

### nudgeCorner

public void nudgeCorner(int key)
Description copied from class: `Roi`
Nudge lower right corner of rectangular and oval ROIs by one pixel based on arrow key press.

Overrides:
  `nudgeCorner` in class `Roi`

### handleMouseUp

protected void handleMouseUp(int screenX, int screenY)
Description copied from class: `PolygonRoi`
With segmented selections, ignore first mouse up and finalize when user double-clicks, control-clicks or clicks in start box.

Overrides:
  `handleMouseUp` in class `PolygonRoi`

### moveHandle

protected void moveHandle(int sx, int sy)

Overrides:
  `moveHandle` in class `PolygonRoi`

### isHandle

public int isHandle(int sx, int sy)
Description copied from class: `PolygonRoi`
Returns a handle number if the specified screen coordinates are inside or near a handle, otherwise returns -1.

Overrides:
  `isHandle` in class `PolygonRoi`

### getLength

public double getLength()
Returns the perimeter of this ellipse.

Overrides:
  `getLength` in class `PolygonRoi`

### getParams

public double[] getParams()
Returns x1, y1, x2, y2 and aspectRatio as a 5 element array.

### getFeretValues

public double[] getFeretValues()
Description copied from class: `Roi`
Returns an array with the following values:
[0] "Feret" (maximum caliper width)
[1] "FeretAngle" (angle of diameter with maximum caliper width, between 0 and 180 deg)
[2] "MinFeret" (minimum caliper width)
[3][4] , "FeretX" and "FeretY", the X and Y coordinates of the starting point (leftmost point) of the maximum-caliper-width diameter.
[5-7] reserved
All these values and point coordinates are in calibrated image coordinates.

The following array elements are end points of the maximum and minimum caliper diameter, in unscaled image pixel coordinates:
[8][9] "FeretX1", "FeretY1"; unscaled versions of "FeretX" and "FeretY" (subclasses may use any end of the diameter, not necessarily the left one)
[10][11] "FeretX2", "FeretY2", end point of the maxium-caliper-width diameter. Both of these points are vertices of the convex hull.
The final four array elements are the starting and end points of the minimum caliper width,
[12],[13] "MinFeretX", "MinFeretY", and
[14],[15] "MinFeretX2", "MinFeretY2". These two pooints are not sorted by x, but the first point point (MinFeretX, MinFeretY) is guaranteed to be a vertex of the convex hull, while second point (MinFeretX2, MinFeretY2) usually is not a vertex point but at a boundary line of the convex hull.

Overrides:
  `getFeretValues` in class `Roi`

### subPixelResolution

public boolean subPixelResolution()
Always returns true.

Overrides:
  `subPixelResolution` in class `Roi`