A repository for tissue segmentation on whole-slide images (WSI). Currently it can run classical and deep-learning methods side-by-side and produce structured output including GeoJSON masks, unsupervised quality metrics, heatmaps.
Annovert can be used to convert the generated GeoJSONs to annotations format of interest including binary masks
First setup the environment see below.
Edit run.py — set your data path and comment out any methods that are not
installed or not wanted to be used — then run:
python run.pyResults are written to outputs/<timestamp>/. Each method gets its own
subdirectory containing predictions (GeoJSON), unsupervised metrics, and
heatmaps.
Raw outputs — GeoJSON masks, per-image heatmaps, and metric JSON files — are saved
directly in outputs/<timestamp>/ and can be inspected at any time. The report and
viewer provide an interactive overview of the same data.
Once you have run the methods, the following functionalities are available. Ensemble fusion is independent of report and viewer, but must be run first if you want the fused mask to appear as a method in them.
Fuse predictions from multiple methods via soft weighted majority voting.
Edit postensemble.py — point member_dirs at the method directories you
want to include — then run:
python postensemble.pyThe fused mask is written alongside the other method outputs in the same
outputs/<timestamp>/ directory.
Generate a self-contained HTML report with thumbnails, overlays, and unsupervised metrics for every method:
python create_report.py --output outputs/<timestamp>Requires the app extra (fastapi + uvicorn) — install it if not already done:
uv sync --extra appLaunch an interactive viewer with overlay toggling, metric cards, and a "Download segmentation report" button:
python -m app --output outputs/<timestamp> --data /path/to/wsi/filesOpens at http://127.0.0.1:8765. Use --port <PORT> to change the port.
- Python 3.12+
- preferred uv
git clone <repo-url> && cd segmenteer
uv sync --extra allThis installs all classical and DL methods with the OpenSlide WSI backend.
# WSI reading backend — pick one
uv sync --extra openslide
uv sync --extra cucim
# Classical methods
uv sync --extra entropymasker
uv sync --extra background-subtractor
uv sync --extra od-gmm
# Deep learning methods
uv sync --extra hest
uv sync --extra grandqc
uv sync --extra rtlucassen
uv sync --extra bigpicture
uv sync --extra fastsam
uv sync --extra trident
# All DL methods at once
uv sync --extra dlAlways use
uv sync --extra <name>, notpip installoruv pip install. Several packages (Trident, SlideSegmenter, tissue-segmentation) are pinned to specific git commits and are only resolved correctly throughuv sync.
These two methods cannot be managed by uv sync — their transitive dependencies
(mapnik / tensorflow-cpu) have no macOS ARM or Python 3.12 wheels, which breaks
the resolver. Install them directly with uv pip install after uv sync:
# HistomicsTK — macOS: brew install libtiff openslide first
uv pip install histomicstk large-image-source-tiff large-image-source-openslide
# BigPicture — macOS ARM: use tensorflow-macos + tensorflow-metal (not tensorflow-cpu)
uv pip install tensorflow-macos tensorflow-metal
uv pip install --no-deps "tissue-segmentation @ git+https://github.com/imi-bigpicture/tissue-segmentation.git@6d97a25a8255f591eb2c705611a32a5f56101a25#subdirectory=tissue_segmentation"
# BigPicture — Linux / Windows
uv pip install tensorflow
uv pip install "tissue-segmentation @ git+https://github.com/imi-bigpicture/tissue-segmentation.git@6d97a25a8255f591eb2c705611a32a5f56101a25#subdirectory=tissue_segmentation"