waterz
August 14, 2025 ยท View on GitHub
Pronounced water-zed. A simple watershed and region agglomeration library for affinity graphs.
Based on the watershed implementation of Aleksandar Zlateski and Chandan Singh.
Install from PyPI
pip install waterz
Install locally
Install c++ dependencies:
# linux
sudo apt install libboost-dev
# macos
brew install boost
Then
# make and activate env then:
pip install -e .
or
uv sync
Usage
import waterz
import numpy as np
# affinities is a [3,depth,height,width] numpy array of float32
affinities = ...
thresholds = [0, 100, 200]
segmentations = waterz.agglomerate(affinities, thresholds)
Development
Release to pypi
upgrade the version number in the pyproject.toml file, then
git tag v0.9.5
git push origin v0.9.5