Skip to content

generate_tiles

Rasterize a slide into smaller tiles, saving tile metadata as rows in a csv file

Necessary data for the manifest file are: address, x_coord, y_coord, xy_extent, tile_size, tile_units

 Inputs: input_slide_image: slide image (virtual slide formats compatible with openslide, .svs, .tif, .scn, ...) Outputs: slide_tiles  Example: generate_tiles 10001.svs -rts 244 -rmg 10 -o 10001/tiles

Source code in src/luna/pathology/cli/generate_tiles.py
@timed
@save_metadata
def cli(
    slide_urlpath: str = "???",
    tile_size: int = "???",  # type: ignore
    requested_magnification: Optional[int] = None,
    storage_options: dict = {},
    output_storage_options: dict = {},
    dask_options: dict = {},
    local_config: str = "",
    output_urlpath: str = ".",
    force: bool = False,
) -> dict:
    """Rasterize a slide into smaller tiles, saving tile metadata as rows in a csv file

    Necessary data for the manifest file are:
    address, x_coord, y_coord, xy_extent, tile_size, tile_units

    \b
    Inputs:
        input_slide_image: slide image (virtual slide formats compatible with openslide, .svs, .tif, .scn, ...)
    Outputs:
        slide_tiles
    \b
    Example:
        generate_tiles 10001.svs
            -rts 244 -rmg 10
            -o 10001/tiles
    """
    config = get_config(vars())

    configure_dask_client(**config["dask_options"])

    properties = __generate_tiles(
        config["slide_urlpath"],
        config["tile_size"],
        config["output_urlpath"],
        config["force"],
        config["requested_magnification"],
        config["storage_options"],
        config["output_storage_options"],
    )

    return properties