Pronounced water-zed. A simple watershed and region agglomeration library for affinity graphs.
Based on the watershed implementation of Aleksandar Zlateski and Chandan Singh.
pip install waterzInstall c++ dependencies:
# linux
sudo apt install libboost-dev
# macos
brew install boostThen
# make and activate env then:
pip install -e .or
uv syncimport 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)upgrade the version number in the pyproject.toml file, then
git tag v0.9.5
git push origin v0.9.5