wsidata.TileRequest#

class TileRequest(x, y, level, width, height, dsize)#

Bases: NamedTuple

A specification for reading a single tile from the WSI.

Produced by shapes2tiles() to describe how to read each tile from the slide pyramid.

Parameters:
xint

The x-coordinate of the tile’s top-left corner at level 0.

yint

The y-coordinate of the tile’s top-left corner at level 0.

levelint

The pyramid level to read from.

widthint

The width of the region to read, in pixels at the given level.

heightint

The height of the region to read, in pixels at the given level.

dsizetuple of (int, int) or None

Target (width, height) for resizing after read (matches cv2.resize convention). None means no resize needed.

dsize#

Alias for field number 5

height#

Alias for field number 4

level#

Alias for field number 2

resize(img)#

Resize a region read for this request to dsize, if set.

Shrinking uses INTER_AREA, which averages the pixels each output pixel covers; INTER_LINEAR samples at the output pixel centres and aliases. Enlarging keeps INTER_LINEAR, as INTER_AREA degrades to nearest neighbour there. A region can shrink along one axis and grow along the other, so it is shrunk first, then grown.

width#

Alias for field number 3

x#

Alias for field number 0

y#

Alias for field number 1