See docs here
pip install mwatershed
- A mutex watershed implementation for affinities
- Should handle up to 6 dimensional arrays of fragments (7 dimensions if you include offsets in affinities) but only tested on 2 and 3 dimensions
components = mwatershed.agglom(
affinities: NDArray[np.float64],
offsets: list[list[int]],
seeds: NDArray[np.uint64],
edges: Optional[list[tuple[usize, usize, f64]]] = None,
)where:
affinitiesis ak+1dimensional array of nonnanaffinities with leading dimension having sizenoffsetsis a list of lengthnof offset tuples ofkintegersseedsis akdimensional array of fragment ids. Noteseeds.shapemust be equal toaffinities.shape[1:]. Any entry not equal to 0 is guaranteed to stay that way, any entry equal to zero has no priors.edgesis a list of(u, v, aff)tuples to insert arbitrary extra affinities between fragment ids