Class AwtTools

java.lang.Object
qupath.lib.awt.common.AwtTools

public final class AwtTools extends Object
A collection of static methods useful when working with AWT shapes and ImageRegions.
Author:
Pete Bankhead
  • Method Details

    • getBounds

      public static Rectangle getBounds(ImageRegion region)
      Create a Rectangle corresponding to the x,y,width,height of an ImageRegion.
      Parameters:
      region -
      Returns:
    • getBounds

      public static Rectangle getBounds(ImageRegion region, Rectangle rect)
      Set the bounds of an existing Rectangle to the x,y,width,height of an ImageRegion.

      If no Rectangle is provided, a new one will be created.

      Parameters:
      region -
      rect -
      Returns:
    • getBounds2D

      public static Rectangle2D getBounds2D(ROI roi)
      Create a Rectangle2D corresponding to bounding box of a ROI.
      Parameters:
      roi -
      Returns:
    • getBounds2D

      public static Rectangle2D getBounds2D(ROI roi, Rectangle2D rect)
      Set the bounds of an existing Rectangle2D to the x,y,width,height of a ROI.

      If no Rectangle2D is provided, a new one will be created.

      Parameters:
      roi -
      rect -
      Returns:
    • getBounds

      public static Rectangle getBounds(ROI roi)
      Create a Rectangle corresponding to bounding box of a ROI.

      This differs from getBounds2D(ROI) in that the bounding box must consist of integer values.

      Parameters:
      roi -
      Returns:
    • getImageRegion

      public static ImageRegion getImageRegion(Rectangle rectangle, int z, int t)
      Create an ImageRegion corresponding to a specified Rectangle bounding box.
      Parameters:
      rectangle -
      z - the z position of the region
      t - the t position of the region
      Returns:
    • getImageRegion

      public static ImageRegion getImageRegion(Shape shape, int z, int t)
      Create an ImageRegion corresponding to a the bounding box of a Shape.
      Parameters:
      shape -
      z - the z position of the region
      t - the t position of the region
      Returns: