wsidata.dataset.TileImagesDataset#

class TileImagesDataset(wsi, key='tiles', target_key=None, transform=None, color_norm=None, target_transform=None, image_size=None)#

Bases: Dataset

Dataset for tiles from the whole slide image.

Uses shapes2tiles() to resolve tile read specifications, supporting both uniform grids (with TileSpec) and arbitrary shape collections.

Note

image_size is used only for pyramid level selection — the reader picks the closest level whose native resolution is ≥ the requested size. No resize is performed after reading; add a Resize step in transform if you need exact output dimensions.

Parameters:
wsiWSIData
keystr

The key of the tile table.

target_keystr

The key of the target table.

transform: callable

The transformation for the input tiles. Use this to resize, augment, or convert tiles (e.g. torchvision.transforms.v2).

target_transform: callable

The transformation for the target.

color_norm: str

The color normalization method.

image_sizeint or tuple of (int, int), optional

Hint for optimal pyramid level selection via shapes2tiles(). Does not resize the output — use transform for that.

Returns:
TileImagesDataset