Metadata-Version: 2.5
Name: lazyslide
Version: 0.13.0
Summary: Accessible and interoperable whole slide image analysis
Project-URL: Documentation, https://lazyslide.readthedocs.io
Project-URL: Repository, https://github.com/rendeirolab/lazyslide
Author-email: Yimin Zheng <yzheng@cemm.at>, Ernesto Abila <eabila@cemm.at>, "André F. Rendeiro" <arendeiro@cemm.at>
License-Expression: MIT
License-File: LICENSE
Keywords: WSI,computational pathology,deep learning,digital pathology,foundation models,histopathology,image analysis,scverse,segmentation,spatialdata,whole slide image
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: File Formats
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Image Processing
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Requires-Python: >=3.11
Requires-Dist: huggingface-hub>=0.34.0
Requires-Dist: lazyslide-models>=0.1.0
Requires-Dist: legendkit>=0.3.4
Requires-Dist: matplotlib-scalebar>=0.9.0
Requires-Dist: matplotlib>=3.9.0
Requires-Dist: numba>=0.60.0
Requires-Dist: psutil>=5.9.0
Requires-Dist: rich>=13.0.0
Requires-Dist: scikit-image>=0.23.1
Requires-Dist: scikit-learn>=1.0
Requires-Dist: scipy>=1.15.1
Requires-Dist: seaborn>=0.12.2
Requires-Dist: torch>=2.0.0
Requires-Dist: torchvision>=0.16
Requires-Dist: wsidata>=0.12.0
Provides-Extra: all
Requires-Dist: igraph>=0.11.8; extra == 'all'
Requires-Dist: scanpy>=1.10.4; extra == 'all'
Provides-Extra: docker
Requires-Dist: cucim; extra == 'docker'
Requires-Dist: hf-xet; extra == 'docker'
Requires-Dist: igraph; extra == 'docker'
Requires-Dist: ipython; extra == 'docker'
Requires-Dist: ipywidgets; extra == 'docker'
Requires-Dist: jupyterlab; extra == 'docker'
Requires-Dist: marsilea; extra == 'docker'
Requires-Dist: mpl-fontkit; extra == 'docker'
Requires-Dist: scanpy; extra == 'docker'
Requires-Dist: scyjava; extra == 'docker'
Requires-Dist: spatialdata-plot; extra == 'docker'
Requires-Dist: torchstain; extra == 'docker'
Provides-Extra: models
Requires-Dist: einops-exts>=0.0.4; extra == 'models'
Requires-Dist: einops>=0.8.1; extra == 'models'
Requires-Dist: environs>=14.1.1; extra == 'models'
Requires-Dist: open-clip-torch>=2.32.0; extra == 'models'
Requires-Dist: sacremoses>=0.1.1; extra == 'models'
Requires-Dist: transformers>=4.49.0; extra == 'models'
Description-Content-Type: text/markdown

# LazySlide

<p align="center">
    <picture align="center">
    <img src="https://raw.githubusercontent.com/rendeirolab/lazyslide/main/assets/logo.png" alt="LazySlide logo" width="150px">
    </picture>
</p>
<p align="center">
  <i>Accessible and interoperable whole slide image analysis</i>
</p>


[![Documentation Status](https://readthedocs.org/projects/lazyslide/badge/?version=stable&style=flat-square)](https://lazyslide.readthedocs.io/en/stable)
[![pypi version](https://img.shields.io/pypi/v/lazyslide?color=0098FF&logo=python&logoColor=white&style=flat-square)](https://pypi.org/project/lazyslide)
[![conda version](https://img.shields.io/conda/vn/conda-forge/lazyslide?style=flat-square&logo=anaconda&logoColor=white&color=%2344A833)](https://anaconda.org/conda-forge/lazyslide)
[![PyPI - License](https://img.shields.io/pypi/l/lazyslide?color=FFD43B&style=flat-square)](https://github.com/rendeirolab/lazyslide/blob/main/LICENSE)
[![scverse ecosystem](https://img.shields.io/badge/scverse_ecosystem-gray.svg?style=flat-square&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1cz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kuNCwtNC4yIC0xNS43LC00LjJjLTcuNSwtMCAtMTYuMywzLjkgLTIwLjYsNi40YzQsLTIuMyAxMS45LC0zLjggMjAuMywyLjlaIiBzdHlsZT0iZmlsbDojZmZmO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTojMDAwO3N0cm9rZS13aWR0aDoxcHg7Ii8+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=)](https://scverse.org/packages/#ecosystem)
[![Nature Methods](https://img.shields.io/badge/DOI-10.1038%2Fs41592--026--03044--7-blue?style=flat-square)](https://doi.org/10.1038/s41592-026-03044-7)

[Installation](https://lazyslide.readthedocs.io/en/stable/installation.html) | 
[Tutorials](https://lazyslide.readthedocs.io/en/stable/tutorials/index.html) |
[Preprint](https://doi.org/10.1101/2025.05.28.656548) | 
[Nature Methods](https://doi.org/10.1038/s41592-026-03044-7)

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](https://spatialdata.scverse.org), so results go straight into [scverse](https://scverse.org) tools such as scanpy, anndata and squidpy.

## Key features

- **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](https://github.com/rendeirolab/wsidata)
- **Deep learning ready**: PyTorch datasets for training your own models

![LazySlide overview: tissue segmentation, tiling, foundation-model feature extraction, cell segmentation, spatial domains, zero-shot classification and captioning, genomic data integration](https://raw.githubusercontent.com/rendeirolab/lazyslide/main/assets/Figure.png)

## Installation

LazySlide supports Python 3.11–3.14 on Linux, macOS and Windows.

```bash
pip install lazyslide   # or: uv add lazyslide
```

For extra slide readers (CZI, iSyntax, BioFormats) and gated models, see the [installation guide](https://lazyslide.readthedocs.io/en/stable/installation.html) and [model zoo](https://lazyslide.readthedocs.io/en/stable/avail_models.html).

## Quick start

Detect tissue, tile it and extract features from a sample slide in a few lines of code:

```python
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:

```python
wsi = zs.open_wsi("path/to/slide.svs")
```

## Documentation

New to digital pathology? Start with the [getting started guide](https://lazyslide.readthedocs.io/en/stable/getting-started/index.html). The [documentation](https://lazyslide.readthedocs.io) also has [tutorials](https://lazyslide.readthedocs.io/en/stable/tutorials/index.html), [how-to guides](https://lazyslide.readthedocs.io/en/stable/how-to/index.html), the [API reference](https://lazyslide.readthedocs.io/en/stable/api/index.html) and the [model zoo](https://lazyslide.readthedocs.io/en/stable/avail_models.html).

## Citation

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>

<details><summary>BibTeX</summary>

```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}
}
```

</details>

## Contributing

Contributions to documentation, tests and features are welcome, and so are suggestions. Open an [issue](https://github.com/rendeirolab/lazyslide/issues) or a pull request, and see the [contributing guide](https://lazyslide.readthedocs.io/en/latest/contributing/index.html).

## Licence

LazySlide is released under the [MIT License](https://github.com/rendeirolab/lazyslide/blob/main/LICENSE).
