Skip to content

save_tiles

Saves tiles to disk

Tiles addresses and arrays are saved as key-value pairs in (tiles.h5), and the corresponding manifest/header file (tiles.parquet) is also generated

Parameters:

Name Type Description Default
slide_urlpath str

url/path to slide image (virtual slide formats compatible with openslide, .svs, .tif, .scn, ...)

'???'
tiles_urlpath str

url/path to tile manifest (.parquet)

'???'
batch_size int

size in batch dimension to chuck jobs

2000
output_urlpath str

output url/path prefix

'.'
force bool

overwrite outputs if they exist

False
storage_options dict

storage options to reading functions

{}
output_storage_options dict

storage options to writing functions

{}
dask_options dict

dask options

{}
local_config str

url/path to local config yaml file

''

Returns:

Name Type Description
dict

metadata about function call

Source code in src/luna/pathology/cli/save_tiles.py
@timed
@save_metadata
def cli(
    slide_urlpath: str = "???",
    tiles_urlpath: str = "???",
    batch_size: int = 2000,
    output_urlpath: str = ".",
    force: bool = False,
    storage_options: dict = {},
    output_storage_options: dict = {},
    dask_options: dict = {},
    local_config: str = "",
):
    """Saves tiles to disk

    Tiles addresses and arrays are saved as key-value pairs in (tiles.h5),
    and the corresponding manifest/header file (tiles.parquet) is also generated

    Args:
        slide_urlpath (str): url/path to slide image (virtual slide formats compatible with openslide, .svs, .tif, .scn, ...)
        tiles_urlpath (str): url/path to tile manifest (.parquet)
        batch_size (int): size in batch dimension to chuck jobs
        output_urlpath (str): output url/path prefix
        force (bool): overwrite outputs if they exist
        storage_options (dict): storage options to reading functions
        output_storage_options (dict): storage options to writing functions
        dask_options (dict): dask options
        local_config (str): url/path to local config yaml file

    Returns:
        dict: metadata about function call
    """
    config = get_config(vars())

    configure_dask_client(**config["dask_options"])

    properties = _save_tiles(
        config["tiles_urlpath"],
        config["slide_urlpath"],
        config["output_urlpath"],
        config["force"],
        config["batch_size"],
        config["storage_options"],
        config["output_storage_options"],
    )

    return properties