loki2.inference.wsi_meta
Helper functions to load WSI metadata for Loki2.
This module provides utilities for extracting and processing metadata from whole slide images, including MPP (microns per pixel) and magnification.
Module Contents
- loki2.inference.wsi_meta.load_wsi_meta(wsi_path: pathlib.Path, wsi_properties: Dict[str, Any] | None, resolution: float, logger: logging.Logger) Tuple[Dict[str, float], float]
Load WSI metadata and compute target MPP.
- Parameters:
wsi_path – Path to the WSI file.
wsi_properties – WSI properties dictionary. Optional keys: “slide_mpp”, “magnification”.
resolution – Target resolution of the network (MPP).
logger – Logger instance for logging messages.
- Returns:
WSI properties dictionary with ‘mpp’ and ‘magnification’
Target MPP for processing
- Return type:
Tuple[Dict[str, float], float]
- Raises:
NotImplementedError – If MPP or magnification cannot be determined.
RuntimeError – If WSI MPP is invalid or incompatible with network resolution.