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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic ROIcreateAreaROI(Shape shape, ImagePlane plane) Deprecated.static ROIcreateEllipseROI(double x, double y, double width, double height) Create an ellipse ROI defined by its bounding box on the default image plane.static ROIcreateEllipseROI(double x, double y, double width, double height, ImagePlane plane) Create an ellipse ROI defined by its bounding box.static ROIcreateEllipseROI(ImageRegion region) Create an ellipse ROI defined by its bounding box.static ROICreate an 'empty' ROI with no length or area on the default image plane.static ROIcreateLineROI(double x, double y, double x2, double y2) Create a line ROI with start and end coordinates on the default image plane.static ROIcreateLineROI(double x, double y, double x2, double y2, ImagePlane plane) Create a line ROI with start and end coordinates.static ROIcreateLineROI(double x, double y, ImagePlane plane) Create a ROI representing a line with zero length.static ROICreate an empty points ROI on the default image plane.static ROIcreatePointsROI(double[] x, double[] y) Create a points ROI from an array of x and y coordinates on the default image plane.static ROIcreatePointsROI(double[] x, double[] y, ImagePlane plane) Create a points ROI from an array of x and y coordinates.static ROIcreatePointsROI(double x, double y) Create a points ROI containing a single point on the default image plane.static ROIcreatePointsROI(double x, double y, ImagePlane plane) Create a points ROI containing a single point.static ROIcreatePointsROI(List<? extends Point2> points) Create a points ROI from a list of points on the default image plane.static ROIcreatePointsROI(List<? extends Point2> points, ImagePlane plane) Create a points ROI from a list of points.static ROIcreatePointsROI(ImagePlane plane) Create an empty points ROI.static ROIcreatePolygonROI(double[] x, double[] y) Create a polygon ROI from an array of x and y coordinates on the default image planestatic ROIcreatePolygonROI(double[] x, double[] y, ImagePlane plane) Create a polygon ROI from an array of x and y coordinates.static PolygonROIcreatePolygonROI(double x, double y) Create an empty, closed polygon ROI consisting of a single point on the default image plane.static PolygonROIcreatePolygonROI(double x, double y, ImagePlane plane) Create an empty, closed polygon ROI consisting of a single point.static PolygonROIcreatePolygonROI(List<? extends Point2> points) Create a closed polygon ROI from a list of points on the default image plane.static PolygonROIcreatePolygonROI(List<? extends Point2> points, ImagePlane plane) Create a closed polygon ROI from a list of points.static ROIcreatePolylineROI(double[] x, double[] y) Create a polyline ROI from an array of x and y coordinates on the default image plane.static ROIcreatePolylineROI(double[] x, double[] y, ImagePlane plane) Create a polyline ROI from an array of x and y coordinates.static PolylineROIcreatePolylineROI(double x, double y) Create an empty polyline ROI consisting of a single point on the default iamge plane.static PolylineROIcreatePolylineROI(double x, double y, ImagePlane plane) Create an empty polyline ROI consisting of a single point.static PolylineROIcreatePolylineROI(List<? extends Point2> points) Create a polyline ROI from a list of points on the default image plane.static PolylineROIcreatePolylineROI(List<? extends Point2> points, ImagePlane plane) Create a polyline ROI from a list of points.static ROIcreateRectangleROI(double x, double y, double width, double height) Create a rectangle ROI defined by its bounding box on the default image plane.static ROIcreateRectangleROI(double x, double y, double width, double height, ImagePlane plane) Create a rectangle ROI defined by its bounding box.static ROIcreateRectangleROI(ImageRegion region) Create a rectangle ROI that matches an ImageRegion.
- 
Constructor Details- 
ROIspublic ROIs()
 
- 
- 
Method Details- 
createEmptyROICreate an 'empty' ROI with no length or area on the default image plane.The only guarantee is that it will return isEmpty() == true- Returns:
 
- 
createRectangleROIpublic 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 rectangle
- y- y coordinate of the top left of the rectangle
- width- width of the rectangle
- height- height of the rectangle
- plane- the image plane where the rectangle should be located
- Returns:
- a new rectangle ROI
 
- 
createRectangleROICreate a rectangle ROI defined by its bounding box on the default image plane.- Parameters:
- x- x coordinate of the top left of the rectangle
- y- y coordinate of the top left of the rectangle
- width- width of the rectangle
- height- height of the rectangle
- Returns:
- a new rectangle ROI
- Since:
- v0.6.0
- See Also:
 
- 
createRectangleROICreate a rectangle ROI that matches an ImageRegion.- Parameters:
- region- an image region defining the rectangle location
- Returns:
- a new rectangle ROI
 
- 
createEllipseROIpublic 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 box
- y- y coordinate of the top left of the ellipse bounding box
- width- width of the ellipse bounding box
- height- height of the ellipse bounding box
- plane- the image plane where the rectangle should be located
- Returns:
- a new ellipse ROI
 
- 
createEllipseROICreate 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 box
- y- y coordinate of the top left of the ellipse bounding box
- width- width of the ellipse bounding box
- height- height of the ellipse bounding box
- Returns:
- a new ellipse ROI
- Since:
- v0.6.0
- See Also:
 
- 
createEllipseROICreate an ellipse ROI defined by its bounding box.- Parameters:
- region- an image region defining the ellipse location
- Returns:
- a new ellipse ROI
 
- 
createLineROICreate a line ROI with start and end coordinates.- Parameters:
- x- the start x coordinate
- y- the start y coordinate
- x2- the end x coordinate
- y2- the end y coordinate
- plane- the plane containing the ROI
- Returns:
- a new line ROI
 
- 
createLineROICreate a line ROI with start and end coordinates on the default image plane.- Parameters:
- x- the start x coordinate
- y- the start y coordinate
- x2- the end x coordinate
- y2- the end y coordinate
- Returns:
- a new line ROI
- Since:
- v0.6.0
- See Also:
 
- 
createLineROICreate a ROI representing a line with zero length.- Parameters:
- x- the start and end x coordinate
- y- the start and end y coordinate
- plane- the plane containing the ROI
- Returns:
- a new line ROI
 
- 
createPointsROICreate an empty points ROI.- Parameters:
- plane- the plane that should contain the ROI
- Returns:
- a new points ROI
 
- 
createPointsROICreate an empty points ROI on the default image plane.- Returns:
- a new points ROI
- Since:
- v0.6.0
- See Also:
 
- 
createPointsROICreate a points ROI containing a single point.- Parameters:
- x- x coordinate of the point
- y- y coordinate of the point
- plane- the plane that should contain the ROI
- Returns:
- a new point ROI
 
- 
createPointsROICreate a points ROI containing a single point on the default image plane.- Parameters:
- x- x coordinate of the point
- y- y coordinate of the point
- Returns:
- a new point ROI
- Since:
- v0.6.0
- See Also:
 
- 
createPointsROICreate a points ROI from a list of points.- Parameters:
- points- a list of points to include
- plane- the image plane containing the ROI
- Returns:
- a new points ROI
 
- 
createPointsROICreate 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:
 
- 
createPointsROIpublic 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 points
- y- y coordinates for the points
- plane- the image plane to contain the ROI
- Returns:
- a new points ROI
- Throws:
- IllegalArgumentException- if x and y have a different length
 
- 
createPointsROICreate a points ROI from an array of x and y coordinates on the default image plane.- Parameters:
- x- x coordinates for the points
- y- 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:
 
- 
createPolygonROICreate a closed polygon ROI from a list of points.- Parameters:
- points- the vertices of the polygon
- plane- the plane containing the ROI
- Returns:
- a new polygon ROI
 
- 
createPolygonROICreate 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:
 
- 
createPolygonROIpublic 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 vertices
- y- y coordinates of the polygon vertices
- plane- the plane containing the ROI
- Returns:
- a new polygon ROI
- Throws:
- IllegalArgumentException- if x and y have a different length
 
- 
createPolygonROICreate a polygon ROI from an array of x and y coordinates on the default image plane- Parameters:
- x- x coordinates of the polygon vertices
- y- 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:
 
- 
createPolygonROICreate an empty, closed polygon ROI consisting of a single point.- Parameters:
- x- x coordinate for the only polygon point
- y- y coordinate for the only polygon point
- plane- the image plane containing the ROI
- Returns:
- a new polygon ROI
 
- 
createPolygonROICreate an empty, closed polygon ROI consisting of a single point on the default image plane.- Parameters:
- x- x coordinate for the only polygon point
- y- y coordinate for the only polygon point
- Returns:
- a new polygon ROI
- Since:
- v0.6.0
- See Also:
 
- 
createPolylineROICreate a polyline ROI from a list of points.- Parameters:
- points- the vertices of the polyline
- plane- the plane containing the ROI
- Returns:
- a new polyline ROI
 
- 
createPolylineROICreate 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:
 
- 
createPolylineROICreate an empty polyline ROI consisting of a single point.- Parameters:
- x- x coordinate of the point
- y- y coordinate of the point
- plane- the image plane containing the ROI
- Returns:
- a new polyline ROI
 
- 
createPolylineROICreate an empty polyline ROI consisting of a single point on the default iamge plane.- Parameters:
- x- x coordinate of the point
- y- y coordinate of the point
- Returns:
- a new polyline ROI
- Since:
- v0.6.0
- See Also:
 
- 
createPolylineROIpublic 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 vertices
- y- y coordinates of the polyline vertices
- Returns:
- a new polygon ROI
- Throws:
- IllegalArgumentException- if x and y have a different length
 
- 
createPolylineROICreate a polyline ROI from an array of x and y coordinates on the default image plane.- Parameters:
- x- x coordinates of the polyline vertices
- y- 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:
 
- 
createAreaROIDeprecated.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 ROI
- plane- the plane that should contain the ROI
- Returns:
- a new ROI representing the shape
 
 
- 
RoiTools.getShapeROI(Shape, ImagePlane, double)instead.