TileSpec and MegaTileSpec dataclasses as well as the GridLayout enum and the MegaTileRegion container.
TileSpec Encapsulates tile size, stride, target resolution, and measurement unit. Used by TileExtractor.
GridLayout Enum for rectangular vs. hexagonal tiling grids.
MegaTileSpec Describes a mega tile — a grid of smaller tiles — including grid dimensions, per-tile specification, layout, stride, and valid-tile-ratio bounds. Used by MegaTileExtractor.
MegaTileRegion Immutable container returned by the mega-tile extractor. Holds the top-left location, grid shape, per-tile RegionSpec list, tile-availability mask, and aggregate tissue statistics.
Example:
GridLayout
RECTANGULAR
Standard row-major rectangular grid.
HEXAGONAL
Offset hex grid — odd rows are shifted right by half a tile width, producing a honeycomb pattern.
MegaTileSpec
rows × cols individual tiles into a single logical region that can be extracted from a WSI. The per-tile geometry is delegated to TileSpec.
Number of tiles as
(rows, cols).Size, stride, resolution, and unit for each individual tile.
Rectangular or hexagonal arrangement. Defaults to
RECTANGULAR.Stride expressed in number of tiles as
(stride_rows, stride_cols). None defaults to megatile_shape (no overlap).Minimum fraction of tiles that must pass the tissue-mask threshold for the mega tile to be kept. Defaults to
0.5.Optional upper bound on the valid-tile fraction.
None means no upper limit.megatile_shape
(rows, cols) in number of tilesmegatile_stride
(stride_rows, stride_cols)rows
cols
num_tiles
effective_stride
megatile_shape when not set.
tuple[int, int]:
(stride_rows, stride_cols) in tiles.MegaTileRegion
MegaTileExtractor.
Absolute slide coordinates of the top-left corner of the mega tile.
The specification that produced this mega tile (grid shape, tile spec, layout, stride, and valid-ratio bounds).
Per-tile region specifications, ordered row-major (
tile_specs[row * cols + col]).Boolean array of shape
(rows, cols) indicating which tiles passed the tissue threshold.Fraction of tiles that are valid (tissue).
grid_shape
(rows, cols) — number of tiles in each direction.

