Metadata-Version: 2.1
Name: mwatershed
Version: 0.5.2
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Dist: numpy >=1.18.0
Requires-Dist: bumpversion ; extra == 'dev'
Requires-Dist: wheel ; extra == 'dev'
Requires-Dist: ruff ; extra == 'dev'
Requires-Dist: black ; extra == 'dev'
Requires-Dist: Sphinx ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: pytest-runner ; extra == 'dev'
Requires-Dist: matplotlib >=3.1.0 ; extra == 'dev'
Requires-Dist: maturin ; extra == 'dev'
Requires-Dist: pip ; extra == 'dev'
Provides-Extra: dev
License-File: LICENSE
License-File: AUTHORS.rst
Summary: A rusty mutex watershed
Author-email: William Hunter Patton <pattonw@hhmi.org>
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# mwatershed

[![](https://img.shields.io/pypi/pyversions/mwatershed.svg)](https://pypi.python.org/pypi/mwatershed)
[![](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)


## A rusty mutex watershed


* Free software: MIT License

### Installation

`pip install git+https://github.com/pattonw/mwatershed`

### Features

* 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

### Usage

```python
components = mwatershed.agglom(
    affinities: NDArray[np.float64],
    offsets: list[list[int]],
    seeds: NDArray[np.uint64],
    edges: Optional[list[tuple[usize, usize, f64]]] = None,
)
```
where:
* `affinities` is a `k+1` dimensional array of non `nan` affinities with leading dimension having size `n`
* `offsets` is a list of length `n` of offset tuples of `k` integers
* `seeds` is a `k` dimensional array of fragment ids. Note `seeds.shape` must be equal to `affinities.shape[1:]`. Any entry not equal to 0 is guaranteed to stay that way, any entry equal to zero has no priors.
* `edges` is a list of `(u, v, aff)` tuples to insert arbitrary extra affinities between fragment ids

### Credits

This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [`pattonw/cookiecutter-rust-pypackage`](https://github.com/pattonw/cookiecutter-rust-pypackage) project template.





