ZoomifyGenerator¶

class ZoomifyGenerator(wsi, tile_size=256, downsample=2, overlap=0)[source]¶

Pyramid tile generator with extra Zoomify specific methods.

Zoomify splits tiles into groups of 256 (due to old file system limitations). The extra tile_group method here is for calculating these tile groups when generating tile paths.

An old description of the Zoomify format can be found here.

Parameters:
  • wsi (WSIReader) – The WSI reader object. Must implement tiatoolbox.wsicore.wsi_Reader.WSIReader.read_rect.

  • tile_size (int) – The size of tiles to generate. Default is 256. Note that the output tile size will be \(\text{tile size} + 2 \times\text{overlap}\).

  • downsample (int) – The downsample factor between levels. Default is 2.

  • overlap (int) – The number of extra pixel to add to each edge of the tile. Default is 0.

Initialize TilePyramidGenerator.

Methods

tile_group

Find the tile group for a tile index.

tile_path

Generate the Zoomify path for a specified tile.

Attributes

tile_group(level, x, y)[source]¶

Find the tile group for a tile index.

Tile groups are numbered from level 0 (tile 0-0-0) and increment every 256 tiles in ZXY axis order.

Parameters:
  • level (int) – The pyramid level of the tile starting from 0 (the whole slide in one tile, 0-0-0).

  • x (int) – The tile index in the x direction.

  • y (int) – The tile index in the y direction.

  • self (ZoomifyGenerator)

Raises:

IndexError – If the level, x, y tile index is out of bounds.

Returns:

The tile group for the specified tile.

Return type:

int

tile_path(level, x, y)[source]¶

Generate the Zoomify path for a specified tile.

Parameters:
  • level (int) – The pyramid level of the tile starting from 0 (the whole slide in one tile, 0-0-0).

  • x (int) – The tile index in the x direction.

  • y (int) – The tile index in the y direction.

  • self (ZoomifyGenerator)

Returns:

A pathlib path object with two parts.

Return type:

pathlib.Path