Accessible and interoperable whole slide image analysis
Installation | Tutorials | Preprint | Nature Methods
LazySlide is a Python framework for whole slide image (WSI) analysis in digital and computational pathology. From a raw slide to tissue masks, tiles, foundation-model features, cell segmentations and zero-shot predictions in a few lines of code. Everything is stored as SpatialData, so results go straight into scverse tools such as scanpy, anndata and squidpy.
- Preprocessing: tissue detection, tiling at any resolution, artifact QC
- Pathology foundation models: tile features from 30+ models (UNI, Virchow, Prov-GigaPath, H-optimus, …) or any timm model
- Segmentation: cells (InstanSeg, Cellpose, …), tissue and artifacts
- Vision-language models: zero-shot classification and segmentation, slide captioning, text search (CONCH, PLIP, TITAN, …)
- Spatial and multimodal analysis: spatial domains, tile graphs, linking morphology to gene expression
- Any slide format: SVS, NDPI, MRXS, DICOM, CZI, iSyntax and more via wsidata
- Deep learning ready: PyTorch datasets for training your own models
LazySlide supports Python 3.11–3.14 on Linux, macOS and Windows.
pip install lazyslide # or: uv add lazyslideFor extra slide readers (CZI, iSyntax, BioFormats) and gated models, see the installation guide and model zoo.
Detect tissue, tile it and extract features from a sample slide in a few lines of code:
import lazyslide as zs
wsi = zs.datasets.sample()
# Pipeline
zs.pp.find_tissues(wsi)
zs.pp.tile_tissues(wsi, tile_px=256, mpp=0.5)
zs.tl.feature_extraction(wsi, model="resnet50")
# Access the features
features = wsi["resnet50_tiles"]
# Color tiles by feature dimensions 1 and 99
zs.pl.tiles(wsi, feature_key="resnet50", color=["1", "99"])To open your own slide:
wsi = zs.open_wsi("path/to/slide.svs")New to digital pathology? Start with the getting started guide. The documentation also has tutorials, how-to guides, the API reference and the model zoo.
If you use LazySlide in your research, please cite:
Zheng Y, Abila E, Chrenková E, Buljan I, Winkler J, Rendeiro AF. LazySlide: accessible and interoperable whole-slide image analysis. Nature Methods 23, 728–731 (2026). https://doi.org/10.1038/s41592-026-03044-7
BibTeX
@article{zheng2026lazyslide,
title = {LazySlide: accessible and interoperable whole-slide image analysis},
author = {Zheng, Yimin and Abila, Ernesto and Chrenkov{\'a}, Eva and Buljan, Iva and Winkler, Juliane and Rendeiro, Andr{\'e} F.},
journal = {Nature Methods},
volume = {23},
number = {4},
pages = {728--731},
year = {2026},
doi = {10.1038/s41592-026-03044-7}
}Contributions to documentation, tests and features are welcome, and so are suggestions. Open an issue or a pull request, and see the contributing guide.
LazySlide is released under the MIT License.
