Package qupath.lib.roi
Class ROIs
java.lang.Object
qupath.lib.roi.ROIs
This class consists exclusively of static methods that operate on or return regions of interest (ROIs).
These methods should be used rather than constructors for individual ROI types.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ROI
createAreaROI
(Shape shape, ImagePlane plane) Deprecated.static ROI
createEllipseROI
(double x, double y, double width, double height) Create an ellipse ROI defined by its bounding box on the default image plane.static ROI
createEllipseROI
(double x, double y, double width, double height, ImagePlane plane) Create an ellipse ROI defined by its bounding box.static ROI
createEllipseROI
(ImageRegion region) Create an ellipse ROI defined by its bounding box.static ROI
Create an 'empty' ROI with no length or area on the default image plane.static ROI
createLineROI
(double x, double y, double x2, double y2) Create a line ROI with start and end coordinates on the default image plane.static ROI
createLineROI
(double x, double y, double x2, double y2, ImagePlane plane) Create a line ROI with start and end coordinates.static ROI
createLineROI
(double x, double y, ImagePlane plane) Create a ROI representing a line with zero length.static ROI
Create an empty points ROI on the default image plane.static ROI
createPointsROI
(double[] x, double[] y) Create a points ROI from an array of x and y coordinates on the default image plane.static ROI
createPointsROI
(double[] x, double[] y, ImagePlane plane) Create a points ROI from an array of x and y coordinates.static ROI
createPointsROI
(double x, double y) Create a points ROI containing a single point on the default image plane.static ROI
createPointsROI
(double x, double y, ImagePlane plane) Create a points ROI containing a single point.static ROI
createPointsROI
(List<? extends Point2> points) Create a points ROI from a list of points on the default image plane.static ROI
createPointsROI
(List<? extends Point2> points, ImagePlane plane) Create a points ROI from a list of points.static ROI
createPointsROI
(ImagePlane plane) Create an empty points ROI.static ROI
createPolygonROI
(double[] x, double[] y) Create a polygon ROI from an array of x and y coordinates on the default image planestatic ROI
createPolygonROI
(double[] x, double[] y, ImagePlane plane) Create a polygon ROI from an array of x and y coordinates.static PolygonROI
createPolygonROI
(double x, double y) Create an empty, closed polygon ROI consisting of a single point on the default image plane.static PolygonROI
createPolygonROI
(double x, double y, ImagePlane plane) Create an empty, closed polygon ROI consisting of a single point.static PolygonROI
createPolygonROI
(List<? extends Point2> points) Create a closed polygon ROI from a list of points on the default image plane.static PolygonROI
createPolygonROI
(List<? extends Point2> points, ImagePlane plane) Create a closed polygon ROI from a list of points.static ROI
createPolylineROI
(double[] x, double[] y) Create a polyline ROI from an array of x and y coordinates on the default image plane.static ROI
createPolylineROI
(double[] x, double[] y, ImagePlane plane) Create a polyline ROI from an array of x and y coordinates.static PolylineROI
createPolylineROI
(double x, double y) Create an empty polyline ROI consisting of a single point on the default iamge plane.static PolylineROI
createPolylineROI
(double x, double y, ImagePlane plane) Create an empty polyline ROI consisting of a single point.static PolylineROI
createPolylineROI
(List<? extends Point2> points) Create a polyline ROI from a list of points on the default image plane.static PolylineROI
createPolylineROI
(List<? extends Point2> points, ImagePlane plane) Create a polyline ROI from a list of points.static ROI
createRectangleROI
(double x, double y, double width, double height) Create a rectangle ROI defined by its bounding box on the default image plane.static ROI
createRectangleROI
(double x, double y, double width, double height, ImagePlane plane) Create a rectangle ROI defined by its bounding box.static ROI
createRectangleROI
(ImageRegion region) Create a rectangle ROI that matches an ImageRegion.
-
Constructor Details
-
ROIs
public ROIs()
-
-
Method Details
-
createEmptyROI
Create an 'empty' ROI with no length or area on the default image plane.The only guarantee is that it will return
isEmpty() == true
- Returns:
-
createRectangleROI
public static ROI createRectangleROI(double x, double y, double width, double height, ImagePlane plane) Create a rectangle ROI defined by its bounding box.- Parameters:
x
- x coordinate of the top left of the rectangley
- y coordinate of the top left of the rectanglewidth
- width of the rectangleheight
- height of the rectangleplane
- the image plane where the rectangle should be located- Returns:
- a new rectangle ROI
-
createRectangleROI
Create a rectangle ROI defined by its bounding box on the default image plane.- Parameters:
x
- x coordinate of the top left of the rectangley
- y coordinate of the top left of the rectanglewidth
- width of the rectangleheight
- height of the rectangle- Returns:
- a new rectangle ROI
- Since:
- v0.6.0
- See Also:
-
createRectangleROI
Create a rectangle ROI that matches an ImageRegion.- Parameters:
region
- an image region defining the rectangle location- Returns:
- a new rectangle ROI
-
createEllipseROI
public static ROI createEllipseROI(double x, double y, double width, double height, ImagePlane plane) Create an ellipse ROI defined by its bounding box.- Parameters:
x
- x coordinate of the top left of the ellipse bounding boxy
- y coordinate of the top left of the ellipse bounding boxwidth
- width of the ellipse bounding boxheight
- height of the ellipse bounding boxplane
- the image plane where the rectangle should be located- Returns:
- a new ellipse ROI
-
createEllipseROI
Create an ellipse ROI defined by its bounding box on the default image plane.- Parameters:
x
- x coordinate of the top left of the ellipse bounding boxy
- y coordinate of the top left of the ellipse bounding boxwidth
- width of the ellipse bounding boxheight
- height of the ellipse bounding box- Returns:
- a new ellipse ROI
- Since:
- v0.6.0
- See Also:
-
createEllipseROI
Create an ellipse ROI defined by its bounding box.- Parameters:
region
- an image region defining the ellipse location- Returns:
- a new ellipse ROI
-
createLineROI
Create a line ROI with start and end coordinates.- Parameters:
x
- the start x coordinatey
- the start y coordinatex2
- the end x coordinatey2
- the end y coordinateplane
- the plane containing the ROI- Returns:
- a new line ROI
-
createLineROI
Create a line ROI with start and end coordinates on the default image plane.- Parameters:
x
- the start x coordinatey
- the start y coordinatex2
- the end x coordinatey2
- the end y coordinate- Returns:
- a new line ROI
- Since:
- v0.6.0
- See Also:
-
createLineROI
Create a ROI representing a line with zero length.- Parameters:
x
- the start and end x coordinatey
- the start and end y coordinateplane
- the plane containing the ROI- Returns:
- a new line ROI
-
createPointsROI
Create an empty points ROI.- Parameters:
plane
- the plane that should contain the ROI- Returns:
- a new points ROI
-
createPointsROI
Create an empty points ROI on the default image plane.- Returns:
- a new points ROI
- Since:
- v0.6.0
- See Also:
-
createPointsROI
Create a points ROI containing a single point.- Parameters:
x
- x coordinate of the pointy
- y coordinate of the pointplane
- the plane that should contain the ROI- Returns:
- a new point ROI
-
createPointsROI
Create a points ROI containing a single point on the default image plane.- Parameters:
x
- x coordinate of the pointy
- y coordinate of the point- Returns:
- a new point ROI
- Since:
- v0.6.0
- See Also:
-
createPointsROI
Create a points ROI from a list of points.- Parameters:
points
- a list of points to includeplane
- the image plane containing the ROI- Returns:
- a new points ROI
-
createPointsROI
Create a points ROI from a list of points on the default image plane.- Parameters:
points
- a list of points to include- Returns:
- a new points ROI
- Since:
- v0.6.0
- See Also:
-
createPointsROI
public static ROI createPointsROI(double[] x, double[] y, ImagePlane plane) throws IllegalArgumentException Create a points ROI from an array of x and y coordinates.- Parameters:
x
- x coordinates for the pointsy
- y coordinates for the pointsplane
- the image plane to contain the ROI- Returns:
- a new points ROI
- Throws:
IllegalArgumentException
- if x and y have a different length
-
createPointsROI
Create a points ROI from an array of x and y coordinates on the default image plane.- Parameters:
x
- x coordinates for the pointsy
- y coordinates for the points- Returns:
- a new points ROI
- Throws:
IllegalArgumentException
- if x and y have a different length- Since:
- v0.6.0
- See Also:
-
createPolygonROI
Create a closed polygon ROI from a list of points.- Parameters:
points
- the vertices of the polygonplane
- the plane containing the ROI- Returns:
- a new polygon ROI
-
createPolygonROI
Create a closed polygon ROI from a list of points on the default image plane.- Parameters:
points
- the vertices of the polygon- Returns:
- a new polygon ROI
- Since:
- v0.6.0
- See Also:
-
createPolygonROI
public static ROI createPolygonROI(double[] x, double[] y, ImagePlane plane) throws IllegalArgumentException Create a polygon ROI from an array of x and y coordinates.- Parameters:
x
- x coordinates of the polygon verticesy
- y coordinates of the polygon verticesplane
- the plane containing the ROI- Returns:
- a new polygon ROI
- Throws:
IllegalArgumentException
- if x and y have a different length
-
createPolygonROI
Create a polygon ROI from an array of x and y coordinates on the default image plane- Parameters:
x
- x coordinates of the polygon verticesy
- y coordinates of the polygon vertices- Returns:
- a new polygon ROI
- Throws:
IllegalArgumentException
- if x and y have a different length- Since:
- v0.6.0
- See Also:
-
createPolygonROI
Create an empty, closed polygon ROI consisting of a single point.- Parameters:
x
- x coordinate for the only polygon pointy
- y coordinate for the only polygon pointplane
- the image plane containing the ROI- Returns:
- a new polygon ROI
-
createPolygonROI
Create an empty, closed polygon ROI consisting of a single point on the default image plane.- Parameters:
x
- x coordinate for the only polygon pointy
- y coordinate for the only polygon point- Returns:
- a new polygon ROI
- Since:
- v0.6.0
- See Also:
-
createPolylineROI
Create a polyline ROI from a list of points.- Parameters:
points
- the vertices of the polylineplane
- the plane containing the ROI- Returns:
- a new polyline ROI
-
createPolylineROI
Create a polyline ROI from a list of points on the default image plane.- Parameters:
points
- the vertices of the polyline- Returns:
- a new polyline ROI
- Since:
- v0.6.0
- See Also:
-
createPolylineROI
Create an empty polyline ROI consisting of a single point.- Parameters:
x
- x coordinate of the pointy
- y coordinate of the pointplane
- the image plane containing the ROI- Returns:
- a new polyline ROI
-
createPolylineROI
Create an empty polyline ROI consisting of a single point on the default iamge plane.- Parameters:
x
- x coordinate of the pointy
- y coordinate of the point- Returns:
- a new polyline ROI
- Since:
- v0.6.0
- See Also:
-
createPolylineROI
public static ROI createPolylineROI(double[] x, double[] y, ImagePlane plane) throws IllegalArgumentException Create a polyline ROI from an array of x and y coordinates.- Parameters:
x
- x coordinates of the polyline verticesy
- y coordinates of the polyline vertices- Returns:
- a new polygon ROI
- Throws:
IllegalArgumentException
- if x and y have a different length
-
createPolylineROI
Create a polyline ROI from an array of x and y coordinates on the default image plane.- Parameters:
x
- x coordinates of the polyline verticesy
- y coordinates of the polyline vertices- Returns:
- a new polygon ROI
- Throws:
IllegalArgumentException
- if x and y have a different length- Since:
- v0.6.0
- See Also:
-
createAreaROI
Deprecated.v0.6.0, useRoiTools.getShapeROI(Shape, ImagePlane, double)
instead. This method does not necessarily give the expected results for shapes that do not represent an area.Create an area ROI representing a 2D shape.The resulting ROI may consist of multiple disconnected regions, possibly containing holes.
- Parameters:
shape
- the shape for the ROIplane
- the plane that should contain the ROI- Returns:
- a new ROI representing the shape
-
RoiTools.getShapeROI(Shape, ImagePlane, double)
instead.