Package qupath.lib.awt.common
Class AwtTools
java.lang.Object
qupath.lib.awt.common.AwtTools
A collection of static methods useful when working with AWT shapes and
ImageRegions
.- Author:
- Pete Bankhead
-
Method Summary
Modifier and TypeMethodDescriptionstatic Rectangle
getBounds
(ImageRegion region) Create aRectangle
corresponding to the x,y,width,height of anImageRegion
.static Rectangle
getBounds
(ImageRegion region, Rectangle rect) Set the bounds of an existingRectangle
to the x,y,width,height of anImageRegion
.static Rectangle
static Rectangle2D
getBounds2D
(ROI roi) Create aRectangle2D
corresponding to bounding box of aROI
.static Rectangle2D
getBounds2D
(ROI roi, Rectangle2D rect) Set the bounds of an existingRectangle2D
to the x,y,width,height of aROI
.static ImageRegion
getImageRegion
(Rectangle rectangle, int z, int t) Create anImageRegion
corresponding to a specifiedRectangle
bounding box.static ImageRegion
getImageRegion
(Shape shape, int z, int t) Create anImageRegion
corresponding to a the bounding box of aShape
.
-
Method Details
-
getBounds
Create aRectangle
corresponding to the x,y,width,height of anImageRegion
.- Parameters:
region
-- Returns:
-
getBounds
Set the bounds of an existingRectangle
to the x,y,width,height of anImageRegion
.If no
Rectangle
is provided, a new one will be created.- Parameters:
region
-rect
-- Returns:
-
getBounds2D
Create aRectangle2D
corresponding to bounding box of aROI
.- Parameters:
roi
-- Returns:
-
getBounds2D
Set the bounds of an existingRectangle2D
to the x,y,width,height of aROI
.If no
Rectangle2D
is provided, a new one will be created.- Parameters:
roi
-rect
-- Returns:
-
getBounds
Create aRectangle
corresponding to bounding box of aROI
.This differs from
getBounds2D(ROI)
in that the bounding box must consist of integer values.- Parameters:
roi
-- Returns:
-
getImageRegion
Create anImageRegion
corresponding to a specifiedRectangle
bounding box.- Parameters:
rectangle
-z
- the z position of the regiont
- the t position of the region- Returns:
-
getImageRegion
Create anImageRegion
corresponding to a the bounding box of aShape
.- Parameters:
shape
-z
- the z position of the regiont
- the t position of the region- Returns:
-