Class ImageRegion

java.lang.Object
qupath.lib.regions.ImageRegion
Direct Known Subclasses:
RegionRequest

public class ImageRegion extends Object
Class for defining an image region.

A boundary box is given in pixel coordinates, while z & t values are given as indices.

Author:
Pete Bankhead
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(int x, int y, int z, int t)
    Check if this region contains a specified coordinate.
    createInstance(int x, int y, int width, int height, int z, int t)
    Create a region based on its bounding box coordinates, z-slice index and time point index.
    createInstance(Collection<? extends ROI> rois)
    Create the smallest region that completely contains the specified ROIs.
    Create the smallest region that completely contains a specified ROI.
    boolean
     
    int
    Get the height of the region bounding box.
    Get the z-slice and time point for this region as an ImagePlane.
    int
    Get the x coordinate of the bottom right of the region bounding box.
    int
    Get the y coordinate of the bottom right of the region bounding box.
    int
    Get the x coordinate of the top left of the region bounding box.
    int
    Get the y coordinate of the top left of the region bounding box.
    Deprecated.
    v0.4.0 use getImagePlane() instead (changed for better consistency with other classes)
    int
    Get the time point index for the region.
    int
    Get the width of the region bounding box.
    int
    Get the x coordinate of the region bounding box (top left).
    int
    Get the y coordinate of the region bounding box (top left).
    int
    Get the z-slice index for the region.
    int
     
    boolean
    intersects(double x2, double y2, double w2, double h2)
    Query if this region intersects with a specified bounding box, ignoring z-slice and time point information.
    boolean
    Returns true if the region specified by this region overlaps with another.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createInstance

      public static ImageRegion createInstance(int x, int y, int width, int height, int z, int t)
      Create a region based on its bounding box coordinates, z-slice index and time point index.
      Parameters:
      x -
      y -
      width -
      height -
      z -
      t -
      Returns:
    • createInstance

      public static ImageRegion createInstance(ROI pathROI)
      Create the smallest region that completely contains a specified ROI.
      Parameters:
      pathROI -
      Returns:
    • createInstance

      public static ImageRegion createInstance(Collection<? extends ROI> rois)
      Create the smallest region that completely contains the specified ROIs.
      Parameters:
      rois -
      Returns:
    • intersects

      public boolean intersects(ImageRegion request)
      Returns true if the region specified by this region overlaps with another.

      If either z or t is < 0 then that value will be ignored.

      Parameters:
      request -
      Returns:
    • intersects

      public boolean intersects(double x2, double y2, double w2, double h2)
      Query if this region intersects with a specified bounding box, ignoring z-slice and time point information.
      Parameters:
      x2 -
      y2 -
      w2 -
      h2 -
      Returns:
    • contains

      public boolean contains(int x, int y, int z, int t)
      Check if this region contains a specified coordinate.
      Parameters:
      x -
      y -
      z -
      t -
      Returns:
    • getX

      public int getX()
      Get the x coordinate of the region bounding box (top left).
      Returns:
    • getY

      public int getY()
      Get the y coordinate of the region bounding box (top left).
      Returns:
    • getWidth

      public int getWidth()
      Get the width of the region bounding box.
      Returns:
    • getHeight

      public int getHeight()
      Get the height of the region bounding box.
      Returns:
    • getZ

      public int getZ()
      Get the z-slice index for the region.
      Returns:
    • getT

      public int getT()
      Get the time point index for the region.
      Returns:
    • getMinX

      public int getMinX()
      Get the x coordinate of the top left of the region bounding box.
      Returns:
    • getMaxX

      public int getMaxX()
      Get the x coordinate of the bottom right of the region bounding box.
      Returns:
    • getMinY

      public int getMinY()
      Get the y coordinate of the top left of the region bounding box.
      Returns:
    • getMaxY

      public int getMaxY()
      Get the y coordinate of the bottom right of the region bounding box.
      Returns:
    • getImagePlane

      public ImagePlane getImagePlane()
      Get the z-slice and time point for this region as an ImagePlane.
      Returns:
      Since:
      v0.4.0 (replaces getPlane() for better consistency with other classes)
    • getPlane

      @Deprecated public ImagePlane getPlane()
      Deprecated.
      v0.4.0 use getImagePlane() instead (changed for better consistency with other classes)
      Get the z-slice and time point for this region as an ImagePlane.
      Returns:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object