Package qupath.lib.regions
Class RegionRequest
java.lang.Object
qupath.lib.regions.ImageRegion
qupath.lib.regions.RegionRequest
Class for defining an image region that can also be used to request these region from an
ImageServer
.
In addition to the information contained within an ImageRegion
, also contains the path to the image
(and optionally an additional image name stored within it) and a downsample value.
- Author:
- Pete Bankhead
-
Method Summary
Modifier and TypeMethodDescriptionstatic List
<RegionRequest> createAllRequests
(ImageServer<?> server, double downsample) Create requests for the full width and height of anImageServer
, for all planes (z-slices and time points).static RegionRequest
createInstance
(String path, double downsample, int x, int y, int width, int height) Create a request for a region specified in terms of its bounding box, using the first z-slice and time point.static RegionRequest
createInstance
(String path, double downsample, int x, int y, int width, int height, int z, int t) Create a request for a region specified in terms of its bounding box, z-slice and time point.static RegionRequest
createInstance
(String path, double downsample, int x, int y, int width, int height, ImagePlane plane) Create a request for a region specified in terms of its bounding box andImagePlane
.static RegionRequest
createInstance
(String path, double downsample, Collection<? extends ROI> rois) Create a request that contains the pixels of the specifiedROI
s.static RegionRequest
createInstance
(String path, double downsample, ImageRegion region) Create a request corresponding to a specifiedImageRegion
.static RegionRequest
createInstance
(String path, double downsample, ROI roi) Create a request that contains the pixels of the specifiedROI
.static RegionRequest
createInstance
(String path, RegionRequest request) Create a request that matches another request but with a different path.static RegionRequest
createInstance
(ImageServer<?> server) Create a request for the full width and height of anImageServer
, for the default plane (first z-slice, time point) and first resolution level downsample (usually 1, but not always).static RegionRequest
createInstance
(ImageServer<?> server, double downsample) Create a request for the full width and height of anImageServer
, for the default plane (first z-slice, time point).boolean
double
Get the requested downsample factor, defining the resolution at which pixels should be returned.getPath()
Get the requested ImageServer path, used as an identifier.int
hashCode()
intersect2D
(int x, int y, int width, int height) Intersect to the specified 2D region.intersect2D
(ImageRegion region) Intersect to the specified 2D region, ignoring z and t.boolean
overlapsRequest
(RegionRequest request) Returns true if the region specified by this request overlaps with that of another request.pad2D
(int xPad, int yPad) Add symmetric padding to the x and y dimensions of a request.Add symmetric padding to the x and y dimensions of a request.toString()
translate
(int dx, int dy) Create aRegionRequest
equivalent to this one with the x and y coordinates updated by translation.updateDownsample
(double downsample) Create aRegionRequest
equivalent to this one with the updated downsample value.updatePath
(String path) Create aRegionRequest
equivalent to this one with the updated path.updateT
(int t) Create aRegionRequest
equivalent to this one with the updated t value.updateZ
(int z) Create aRegionRequest
equivalent to this one with the updated z value.Methods inherited from class qupath.lib.regions.ImageRegion
contains, createInstance, createInstance, createInstance, getHeight, getImagePlane, getMaxX, getMaxY, getMinX, getMinY, getPlane, getT, getWidth, getX, getY, getZ, intersects, intersects
-
Method Details
-
toString
- Overrides:
toString
in classImageRegion
-
createInstance
Create a request for the full width and height of anImageServer
, for the default plane (first z-slice, time point) and first resolution level downsample (usually 1, but not always).- Parameters:
server
-- Returns:
-
createInstance
Create a request for the full width and height of anImageServer
, for the default plane (first z-slice, time point).- Parameters:
server
-downsample
-- Returns:
-
createAllRequests
Create requests for the full width and height of anImageServer
, for all planes (z-slices and time points).- Parameters:
server
-downsample
-- Returns:
-
createInstance
Create a request that contains the pixels of the specifiedROI
. This is calculated using theROI
bounding box.- Parameters:
path
-downsample
-roi
-- Returns:
-
createInstance
public static RegionRequest createInstance(String path, double downsample, Collection<? extends ROI> rois) Create a request that contains the pixels of the specifiedROI
s. This is calculated using theROI
bounding boxes.- Parameters:
path
-downsample
-rois
-- Returns:
- Throws:
IllegalArgumentException
- if theROI
s do not all fall on the sameImagePlane
.
-
createInstance
Create a request that matches another request but with a different path.- Parameters:
path
-request
-- Returns:
-
createInstance
Create a request corresponding to a specifiedImageRegion
. This may also be used to construct a request based on an existing request, but changing either the path or downsample.- Parameters:
path
-downsample
-region
-- Returns:
-
createInstance
public static RegionRequest createInstance(String path, double downsample, int x, int y, int width, int height, int z, int t) Create a request for a region specified in terms of its bounding box, z-slice and time point.- Parameters:
path
-downsample
-x
-y
-width
-height
-z
-t
-- Returns:
-
createInstance
public static RegionRequest createInstance(String path, double downsample, int x, int y, int width, int height, ImagePlane plane) Create a request for a region specified in terms of its bounding box andImagePlane
.- Parameters:
path
-downsample
-x
-y
-width
-height
-plane
-- Returns:
-
createInstance
public static RegionRequest createInstance(String path, double downsample, int x, int y, int width, int height) Create a request for a region specified in terms of its bounding box, using the first z-slice and time point.- Parameters:
path
-downsample
-x
-y
-width
-height
-- Returns:
-
overlapsRequest
Returns true if the region specified by this request overlaps with that of another request. The test includes insuring that they refer to the same image by checking the paths are the same.- Parameters:
request
-- Returns:
-
getPath
Get the requested ImageServer path, used as an identifier.- Returns:
- See Also:
-
getDownsample
public double getDownsample()Get the requested downsample factor, defining the resolution at which pixels should be returned.- Returns:
-
intersect2D
Intersect to the specified 2D region, ignoring z and t.- Parameters:
region
- the region defining the x, y, width and height of the maximum permitted bounding box.- Returns:
- the clipped
RegionRequest
, which may be this if no clipping is required.
-
intersect2D
Intersect to the specified 2D region.- Parameters:
x
- x-coordinate of the second region's bounding boxy
- y-coordinate of the second region's bounding boxwidth
- width of the second region's bounding boxheight
- height of the second region's bounding box- Returns:
- the clipped
RegionRequest
, which may be this if no clipping is required.
-
updateZ
Create aRegionRequest
equivalent to this one with the updated z value.- Parameters:
z
- requested z position- Returns:
RegionRequest
with the specified z value (may be this object unchanged).
-
updateT
Create aRegionRequest
equivalent to this one with the updated t value.- Parameters:
t
- requested t position- Returns:
RegionRequest
with the specified t value (may be this object unchanged).
-
updateDownsample
Create aRegionRequest
equivalent to this one with the updated downsample value.- Parameters:
downsample
- requested downsample position- Returns:
RegionRequest
with the specified downsample value (may be this object unchanged).
-
updatePath
Create aRegionRequest
equivalent to this one with the updated path.- Parameters:
path
- requested path position- Returns:
RegionRequest
with the specified path value (may be this object unchanged).
-
translate
Create aRegionRequest
equivalent to this one with the x and y coordinates updated by translation.- Parameters:
dx
- value to add to the x coordinatedy
- value to add to the y coordinate- Returns:
RegionRequest
with the specified path value (may be this object unchanged).
-
pad2D
Add symmetric padding to the x and y dimensions of a request.- Parameters:
xPad
- padding to add along the x dimension; the width will be adjusted byxPad * 2
yPad
- padding to add along the y dimension; the height will be adjusted byyPad * 2
- Returns:
RegionRequest
with the specified padding (may be this object unchanged if the padding is zero).
-
pad2D
Add symmetric padding to the x and y dimensions of a request.- Parameters:
padding
- padding to add- Returns:
RegionRequest
with the specified padding (may be this object unchanged if the padding is zero).
-
hashCode
public int hashCode()- Overrides:
hashCode
in classImageRegion
-
equals
- Overrides:
equals
in classImageRegion
-