Metadata-Version: 2.4
Name: supervoxel-splitter
Version: 0.1.0
Summary: Pluggable supervoxel splitting algorithms with a uniform interface.
License: MIT License
        
        Copyright (c) 2026 CAVE
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/CAVEconnectome/supervoxel-splitter
Project-URL: Issues, https://github.com/CAVEconnectome/supervoxel-splitter/issues
Project-URL: Source, https://github.com/CAVEconnectome/supervoxel-splitter
Keywords: connectomics,segmentation,supervoxel,watershed,geodesic,image-processing
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.14
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: scipy>=1.6
Requires-Dist: fastremap
Requires-Dist: connected-components-3d
Requires-Dist: scikit-image
Requires-Dist: edt
Provides-Extra: fast
Requires-Dist: dijkstra3d; extra == "fast"
Provides-Extra: learned
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: build; extra == "dev"
Dynamic: license-file

# supervoxel-splitter

[![codecov](https://codecov.io/gh/CAVEconnectome/supervoxel-splitter/graph/badge.svg)](https://codecov.io/gh/CAVEconnectome/supervoxel-splitter)

Pluggable supervoxel-splitting algorithms behind a uniform `Splitter` interface.

## What it does

Given a 3-D foreground mask, source seeds, and sink seeds, return a labeled
volume that partitions the foreground into a source side and a sink side.
Useful for proofreading workflows that need to split a single supervoxel
without touching the rest of the segmentation.

The package ships multiple techniques behind the same `Splitter` protocol:

- **GeodesicSplitter** — anisotropic geodesic carve via an EDT-derived speed
  field. Default technique; preserves the neck-aware behavior used in
  PyChunkedGraph today.
- **WatershedSplitter** — seeded watershed on the distance transform.
- **NoopSplitter** — reference implementation; documents the protocol shape
  for downstream plugin authors (e.g. a learned splitter).

## Install

Requires Python 3.14 or newer.

```
pip install supervoxel-splitter           # core
pip install "supervoxel-splitter[fast]"   # adds dijkstra3d as the geodesic backend
```

## The uniform interface

Every splitter satisfies the same `Splitter` protocol. Technique-specific
knobs live on the constructor; `split()` itself stays clean.

```python
from supervoxel_splitter import GeodesicSplitter

splitter = GeodesicSplitter(backend="dj3d")
result = splitter.split(
    mask=foreground_3d_bool,
    sources=src_seeds_xyz,
    sinks=snk_seeds_xyz,
    voxel_size=(4.0, 4.0, 40.0),
)

# result.labels: uint8 in {0, SOURCE, SINK, STRAY}
# result.side_of_label: {SOURCE: 1, SINK: 2}
# result.diagnostics: per-stage timings, label counts, etc.
```

Plugin authors implement the protocol structurally — no base class to
inherit:

```python
class MyLearnedSplitter:
    def __init__(self, *, model_path):
        ...
    def split(self, mask, sources, sinks, *,
              voxel_size=(1.0, 1.0, 1.0),
              vol_order="xyz", vox_order="xyz", seed_order="xyz"):
        ...
        return SplitResult(...)

assert isinstance(MyLearnedSplitter(model_path="..."), Splitter)
```

## Boundary

The package knows nothing about ChunkedGraph, BigTable, IDs, or edges. It
takes voxels in and gives labels back. New-ID minting, edge updates, and
persistence are the consumer's responsibility.

## Status

v0.1.0 covers `GeodesicSplitter`. `WatershedSplitter` and `NoopSplitter` ship
as small reference impls demonstrating the protocol; production-quality
parity with geodesic is out of scope for v0.1.0.

## License

MIT.
