TileServer#

class TileServer(title, layers, renderer=None)[source]#

A Flask app to display Zoomify tiles as a slippery map.

Parameters:
  • title (str) – The title of the tile server, displayed in the browser as the page title.

  • layers (Dict[str, WSIReader | str] | List[WSIReader | str]) – A dictionary mapping layer names to image paths or WSIReader objects to display. May also be a list, in which case generic names ‘layer-1’, ‘layer-2’ etc. will be used. If layer is a single-channel low-res overlay, it will be colourized using the ‘viridis’ colourmap

  • renderer (AnnotationRenderer) –

Examples

>>> from tiatoolbox.wsicore.wsireader import WSIReader
>>> from tiatoolbox.visualization.tileserver import TileServer
>>> wsi = WSIReader.open("CMU-1.svs")
>>> app = TileServer(
...     title="Testing TileServer",
...     layers={
...         "My SVS": wsi,
...     },
... )
>>> app.run()

Methods

index

Serve the index page.

zoomify

Serve a Zoomify tile for a particular layer.

Attributes

index()[source]#

Serve the index page.

Returns:

The index page.

Return type:

flask.Response

zoomify(layer, tile_group, z, x, y)[source]#

Serve a Zoomify tile for a particular layer.

Note that this should not be called directly, but will be called automatically by the Flask framework when a client requests a tile at the registered URL.

Parameters:
  • layer (str) – The layer name.

  • tile_group (int) – The tile group. Currently unused.

  • z (int) – The zoom level.

  • x (int) – The x coordinate.

  • y (int) – The y coordinate.

Returns:

The tile image response.

Return type:

flask.Response