wsidata.dataset.TileImagesDataset#
- class TileImagesDataset(wsi, key='tiles', target_key=None, transform=None, color_norm=None, target_transform=None, image_size=None)#
Bases:
DatasetDataset for tiles from the whole slide image.
Uses
shapes2tiles()to resolve tile read specifications, supporting both uniform grids (withTileSpec) and arbitrary shape collections.Note
Tiles come out resized. With a
TileSpec, each tile is read at the spec’s level and resized to the spec’s size, andimage_sizeis ignored. Without one, each tile is read at the coarsest level where it is still at leastimage_size, then resized toimage_size.- 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. Deprecated, will be removed in 0.13.0: if you need stain normalization, use torchstain directly in transform.
- image_sizeint or tuple of (int, int), optional
Output (width, height) of tiles from shapes without a
TileSpec; ignored when the shapes have one. See the note above.
- Returns:
- TileImagesDataset