Package qupath.lib.roi
Class EllipseROI
java.lang.Object
qupath.lib.roi.EllipseROI
- All Implemented Interfaces:
- Serializable,- ROI
ROI implementing a circle, or (unrotated) ellipse.
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from interface qupath.lib.roi.interfaces.ROIROI.RoiType
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionbooleancontains(double xx, double yy) Test is the ROI contains specified x, y coordinates.protected ShapeCreate aShapeobject to represent the ROI.Deprecated.booleanSince ellipses aren't represented internally with simple polygon points, this currently returns only 4 points (rather more diamond-like that would be ideal).doublegetArea()Get the area of this ROI.doubleReturns the height of the ROI bounding box.doubleReturns the width of the ROI bounding box.doubleReturns the x coordinate for the top left of the ROI bounding box.doubleReturns the y coordinate for the top left of the ROI bounding box.intgetC()Get channel index, or -1 if the ROI relates to all available channels.doubleReturns the x coordinate for the ROI centroid.doubleReturns the y coordinate for the ROI centroid.Default implementation using JTS.Returns a org.locationtech.jts.geom.Geometry object.Get the ImagePlane, which contains the values for c, z and t in a single object.doubleGet ROI length.intReturns 4 (since the ellipse is defined by its bounding box).Get a String representation of the kind of ROI we have, e.g.Get the RoiType, used to distinguish between points, lines and areas.doublegetScaledArea(double pixelWidth, double pixelHeight) Get scaled area of the ROI, for use with calibrated pixel sizes.doublegetScaledLength(double pixelWidth, double pixelHeight) Get the scaled length, for use with calibrated pixel sizes.getShape()Returns a java.awt.Shape representing this ROI, if possible.protected ShapeGet a (possibly cached) shape representation of the ROI.doubleCalculate the solidity, defined as ROI area / convex hull area.intgetT()Get time point index.intgetZ()Get z-stack slice index.inthashCode()booleanintersects(double x, double y, double width, double height) Test if the ROI intersects a specified region.protected booleanintersectsBounds(double x, double y, double width, double height) Quick check whether the specified rectangle intersects with the bounds of this ROI.booleanisArea()Returns true if this ROI encloses an area.booleanisCircle()Query if the width and height of the ellipse bounding box are the same, assuming 'square' pixels.booleanisCircle(double pixelWidth, double pixelHeight) Query if the width and height of the ellipse bounding box are the same, optionally using 'non-square' pixels.booleanisEmpty()True if the bounding box has zero areabooleanisLine()Returns true if this ROI consists of line segments and does not enclose an area.booleanisPoint()Returns true if this ROI represents distinct (unconnected) points.scale(double scaleX, double scaleY, double originX, double originY) Create a scaled version of this ROI.toString()translate(double dx, double dy) Create a translated version of this ROI.updatePlane(ImagePlane plane) Create a new ROI defining the same region on a differentImagePlane.Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface qupath.lib.roi.interfaces.ROIgetScaledArea, getScaledLength, intersects, scale
- 
Field Details- 
xprotected double x
- 
yprotected double y
- 
x2protected double x2
- 
y2protected double y2
 
- 
- 
Method Details- 
containspublic boolean contains(double xx, double yy) Description copied from interface:ROITest is the ROI contains specified x, y coordinates. Only Area ROIs can return true, i.e. whereROI.isArea()returns true. All other ROIs (points, lines) return false.
- 
intersectspublic boolean intersects(double x, double y, double width, double height) Description copied from interface:ROITest if the ROI intersects a specified region.Note that this test is intended as a fast initial filter; a more detailed test using ROI.getGeometry()is recommended when exact results are needed.- Specified by:
- intersectsin interface- ROI
- Parameters:
- x- the x coordinate of the region bounding box
- y- the y coordinate of the region bounding box
- width- the width of the region bounding box
- height- the height of the region bounding box
- Returns:
- true if the ROI intersects the region, false otherwise
 
- 
getRoiNameDescription copied from interface:ROIGet a String representation of the kind of ROI we have, e.g. "Rectangle", "Ellipse", "Polygon"- Specified by:
- getRoiNamein interface- ROI
- Returns:
 
- 
isCirclepublic boolean isCircle()Query if the width and height of the ellipse bounding box are the same, assuming 'square' pixels.- Returns:
 
- 
isCirclepublic boolean isCircle(double pixelWidth, double pixelHeight) Query if the width and height of the ellipse bounding box are the same, optionally using 'non-square' pixels.- Parameters:
- pixelWidth-
- pixelHeight-
- Returns:
 
- 
getScaledAreapublic double getScaledArea(double pixelWidth, double pixelHeight) Description copied from interface:ROIGet scaled area of the ROI, for use with calibrated pixel sizes.- Specified by:
- getScaledAreain interface- ROI
- Parameters:
- pixelWidth-
- pixelHeight-
- Returns:
- See Also:
 
- 
getScaledLengthpublic double getScaledLength(double pixelWidth, double pixelHeight) Description copied from interface:ROIGet the scaled length, for use with calibrated pixel sizes.- Specified by:
- getScaledLengthin interface- ROI
- Parameters:
- pixelWidth-
- pixelHeight-
- Returns:
- See Also:
 
- 
getNumPointspublic int getNumPoints()Returns 4 (since the ellipse is defined by its bounding box). Note this behavior may change.- Specified by:
- getNumPointsin interface- ROI
- Returns:
 
- 
duplicateDeprecated.Description copied from interface:ROICreate a duplicate of the ROI.This method is deprecated, since ROIs are (or are moving towards being) immutable... making it pointless to duplicate them. 
- 
updatePlaneDescription copied from interface:ROICreate a new ROI defining the same region on a differentImagePlane. The original ROI is unchanged.- Specified by:
- updatePlanein interface- ROI
- Parameters:
- plane- the new plane to use
- Returns:
 
- 
getAllPointsSince ellipses aren't represented internally with simple polygon points, this currently returns only 4 points (rather more diamond-like that would be ideal). This behavior may change.- Specified by:
- getAllPointsin interface- ROI
- Returns:
 
- 
getShapeDescription copied from interface:ROIReturns a java.awt.Shape representing this ROI, if possible.Note that PointROI throws an UnsupportedOperationException as it cannot adequately be represented by a Shape object. 
- 
createShapeCreate aShapeobject to represent the ROI.- Returns:
- a new Shape object
 
- 
getConvexHullDefault implementation using JTS. Subclasses may replace this with a more efficient implementation.- Specified by:
- getConvexHullin interface- ROI
- Returns:
 
- 
scaleDescription copied from interface:ROICreate a scaled version of this ROI. Coordinates are multiplied by the given scaling factors, while the original ROI is unchanged.- Specified by:
- scalein interface- ROI
- Parameters:
- scaleX- horizontal scale value
- scaleY- vertical scale value
- originX- value subtracted from each x-ordinate prior to scaling, and added back afterwards
- originY- value subtracted from each y-ordinate prior to scaling, and added back afterwards
- Returns:
- See Also:
 
- 
translateDescription copied from interface:ROICreate a translated version of this ROI. The original ROI is unchanged.
- 
getRoiTypeDescription copied from interface:ROIGet the RoiType, used to distinguish between points, lines and areas.- Specified by:
- getRoiTypein interface- ROI
- Returns:
 
- 
getCentroidXpublic double getCentroidX()Description copied from interface:ROIReturns the x coordinate for the ROI centroid.- Returns:
 
- 
getCentroidYpublic double getCentroidY()Description copied from interface:ROIReturns the y coordinate for the ROI centroid.- Returns:
 
- 
isEmptypublic boolean isEmpty()True if the bounding box has zero area
- 
getBoundsXpublic double getBoundsX()Description copied from interface:ROIReturns the x coordinate for the top left of the ROI bounding box.- Returns:
 
- 
getBoundsYpublic double getBoundsY()Description copied from interface:ROIReturns the y coordinate for the top left of the ROI bounding box.- Returns:
 
- 
getBoundsWidthpublic double getBoundsWidth()Description copied from interface:ROIReturns the width of the ROI bounding box.- Returns:
 
- 
getBoundsHeightpublic double getBoundsHeight()Description copied from interface:ROIReturns the height of the ROI bounding box.- Returns:
 
- 
equals
- 
hashCodepublic int hashCode()
- 
getImagePlaneDescription copied from interface:ROIGet the ImagePlane, which contains the values for c, z and t in a single object.- Specified by:
- getImagePlanein interface- ROI
- Returns:
 
- 
getZpublic int getZ()Description copied from interface:ROIGet z-stack slice index.Default is 0 if the image it relates to is not a z-stack. 
- 
getTpublic int getT()Description copied from interface:ROIGet time point index.Default is 0 if the image it relates to is not a time series. 
- 
getCpublic int getC()Description copied from interface:ROIGet channel index, or -1 if the ROI relates to all available channels.(This is not currently used, but may be in the future) 
- 
getShapeInternalGet a (possibly cached) shape representation of the ROI. This may be mutable, and so should not be passed outside the class.- Returns:
 
- 
intersectsBoundsprotected boolean intersectsBounds(double x, double y, double width, double height) Quick check whether the specified rectangle intersects with the bounds of this ROI. This can be used to avoid a more expensive intersection check.- Parameters:
- x- x coordinate of the rectangle to test
- y- y coordinate of the rectangle to test
- width- width of the rectangle to test
- height- height of the rectangle to test
- Returns:
- true if the bounds intersect, false otherwise
 
- 
toString
- 
isLinepublic boolean isLine()Description copied from interface:ROIReturns true if this ROI consists of line segments and does not enclose an area.
- 
isAreapublic boolean isArea()Description copied from interface:ROIReturns true if this ROI encloses an area.
- 
isPointpublic boolean isPoint()Description copied from interface:ROIReturns true if this ROI represents distinct (unconnected) points.
- 
getGeometryDescription copied from interface:ROIReturns a org.locationtech.jts.geom.Geometry object.- Specified by:
- getGeometryin interface- ROI
- Returns:
 
- 
getAreapublic double getArea()Description copied from interface:ROIGet the area of this ROI. For lines and points this returns 0.
- 
getLengthpublic double getLength()Description copied from interface:ROIGet ROI length. This is defined as- perimeter in the case of area ROIs
- total length of line segments in the case of line or polyline ROIs
- 0 in the case of point ROIs
 
- 
getSoliditypublic double getSolidity()Description copied from interface:ROICalculate the solidity, defined as ROI area / convex hull area. Returns Double.NaN if the ROI does not represent an area.- Specified by:
- getSolidityin interface- ROI
- Returns:
 
 
-