Class TileRequest

java.lang.Object
qupath.lib.images.servers.TileRequest

public class TileRequest extends Object
A wrapper for a RegionRequest, useful to precisely specify image tiles at a particular resolution.

Why?

Because downsamples can be defined with floating point precision, and are not always unambiguous when calculated as the ratios of pyramid level dimensions (i.e. different apparent horizontal and vertical scaling), a RegionRequest is too fuzzy a way to refer to a specific rectangle of pixels from a specific pyramid level. Rounding errors can easily occur, and different image readers might respond differently to the same request.

Consequently, TileRequests provide a means to reproducibly define coordinates at pyramid levels and not only the full resolution image space. They wrap a RegionRequest, because this is still used for caching purposes.

  • Method Summary

    Modifier and Type
    Method
    Description
    createInstance(String path, int level, double downsample, ImageRegion tileRegion)
    Create a new tile request for a specified region, downsample and resolution level.
    createInstance(ImageServer<?> server, int level, ImageRegion tileRegion)
    Create a new tile request for a specified region and resolution level of an image.
    boolean
     
    double
    Get the downsample value for this tile.
    int
    Get the height of the bounding box for this tile in the full resolution image.
    Get the ImagePlane for this request.
    int
    Get the width of the bounding box for this tile in the full resolution image.
    int
    Get the x-coordinate of the bounding box for this tile in the full resolution image.
    int
    Get the y-coordinate of the bounding box for this tile in the full resolution image.
    int
    Get the resolution level.
    Deprecated.
    v0.4.0 use getImagePlane() instead (changed for better consistency with other classes)
    Get the RegionRequest that this tile represents.
    int
    Get the time point index for this request.
    int
    Get the height of the bounding box for this tile at the tile resolution.
    int
    Get the width of the bounding box for this tile at the tile resolution.
    int
    Get the x-coordinate of the bounding box for this tile at the tile resolution.
    int
    Get the y-coordinate of the bounding box for this tile at the tile resolution.
    int
    Get the z-slice index for this request.
    int
     
     

    Methods inherited from class java.lang.Object

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

    • createInstance

      public static TileRequest createInstance(ImageServer<?> server, int level, ImageRegion tileRegion)
      Create a new tile request for a specified region and resolution level of an image.

      Most of the time this should not be needed: use ImageServer.getTileRequestManager() instead to get the tiles that are actually available for an image.

      Parameters:
      server -
      level -
      tileRegion -
      Returns:
      See Also:
    • createInstance

      public static TileRequest createInstance(String path, int level, double downsample, ImageRegion tileRegion)
      Create a new tile request for a specified region, downsample and resolution level.

      Most of the time this should not be needed: use ImageServer.getTileRequestManager() instead.

      In cases where a new TileRequest is necessary, it is better to use createInstance(ImageServer, int, ImageRegion) where possible. The current method exists for cases where a TileRequest is a useful data structure but it isn't associated with a specific image.

      Parameters:
      path -
      level -
      downsample -
      tileRegion -
      Returns:
      See Also:
    • getRegionRequest

      public RegionRequest getRegionRequest()
      Get the RegionRequest that this tile represents.
      Returns:
    • getDownsample

      public double getDownsample()
      Get the downsample value for this tile.
      Returns:
    • getLevel

      public int getLevel()
      Get the resolution level.
      Returns:
    • getImageX

      public int getImageX()
      Get the x-coordinate of the bounding box for this tile in the full resolution image.
      Returns:
    • getImageY

      public int getImageY()
      Get the y-coordinate of the bounding box for this tile in the full resolution image.
      Returns:
    • getImageWidth

      public int getImageWidth()
      Get the width of the bounding box for this tile in the full resolution image.
      Returns:
    • getImageHeight

      public int getImageHeight()
      Get the height of the bounding box for this tile in the full resolution image.
      Returns:
    • getTileX

      public int getTileX()
      Get the x-coordinate of the bounding box for this tile at the tile resolution.
      Returns:
    • getTileY

      public int getTileY()
      Get the y-coordinate of the bounding box for this tile at the tile resolution.
      Returns:
    • getTileWidth

      public int getTileWidth()
      Get the width of the bounding box for this tile at the tile resolution.
      Returns:
    • getTileHeight

      public int getTileHeight()
      Get the height of the bounding box for this tile at the tile resolution.
      Returns:
    • getZ

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

      public int getT()
      Get the time point index for this request.
      Returns:
    • getImagePlane

      public ImagePlane getImagePlane()
      Get the ImagePlane for this request.
      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 ImagePlane for this request.
      Returns:
    • hashCode

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

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

      public String toString()
      Overrides:
      toString in class Object