wsidata.shapes2tiles#
- shapes2tiles(wsi, shape_key, image_size=None)#
Convert arbitrary shapes into tile read specifications.
When a
TileSpecis stored for shape_key, tiles are derived from it directly (uniform grid). Otherwise, each shape’s bounding box is used and the optimal pyramid level is selected per-shape.- Parameters:
- wsiWSIData
The whole-slide image data object.
- shape_keystr
Key into
wsi.shapesfor the shape collection.- image_sizetuple of (int, int), optional
Desired output
(width, height). Only used when no TileSpec is available. When given, the best pyramid level is chosen so the read region is closest to image_size, and the returnedTileRequestis populated withdsize=image_sizefor later resizing by the code that executes the request.
- Returns:
- list[TileRequest]
One
TileOpper shape, with coordinates at level 0.