Metadata-Version: 2.2
Name: splineops
Version: 2.1.0
Summary: Projection-based antialiased resizing for N-D scientific arrays.
Author: Pablo Garcia-Amorena, Philippe Thévenaz, Arrate Muñoz Barrutia, Daniel Sage, Dimitris Perdios, Thomas Debarre, Michael Unser
License: BSD 3-Clause License
         
         Copyright (c) 2024, splineops
         Copyright (c) 2023-2024, EPFL (Dimitris Perdios, Pablo Garcia-Amorena)
         Copyright (c) 2021-2022, EPFL (Dimitris Perdios)
         
         Redistribution and use in source and binary forms, with or without
         modification, are permitted provided that the following conditions are met:
         
         1. Redistributions of source code must retain the above copyright notice, this
            list of conditions and the following disclaimer.
         
         2. Redistributions in binary form must reproduce the above copyright notice,
            this list of conditions and the following disclaimer in the documentation
            and/or other materials provided with the distribution.
         
         3. Neither the name of the copyright holder nor the names of its
            contributors may be used to endorse or promote products derived from
            this software without specific prior written permission.
         
         THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
         DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
         FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
         DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
         SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
         CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
         OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
         OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         
Classifier: Topic :: Scientific/Engineering :: Image Processing
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Project-URL: Homepage, https://splineops.github.io/
Project-URL: Source, https://github.com/splineops/splineops
Project-URL: Issues, https://github.com/splineops/splineops/issues
Project-URL: Download, https://github.com/splineops/splineops.git
Requires-Python: >=3.11
Requires-Dist: numpy>=1.26
Requires-Dist: scipy>=1.15
Requires-Dist: matplotlib>=3.8
Provides-Extra: visualization
Requires-Dist: pooch>=1.8; extra == "visualization"
Requires-Dist: IPython>=8.26; extra == "visualization"
Provides-Extra: tests
Requires-Dist: tox>=4.13; extra == "tests"
Requires-Dist: pytest>=6.0; extra == "tests"
Requires-Dist: pytest-cov>=5.0; extra == "tests"
Requires-Dist: hypothesis>=6.100; extra == "tests"
Provides-Extra: dev
Requires-Dist: splineops[tests,visualization]; extra == "dev"
Requires-Dist: black>=23.10; extra == "dev"
Requires-Dist: mypy>=1.8; extra == "dev"
Requires-Dist: build; extra == "dev"
Provides-Extra: dev-cupy
Requires-Dist: splineops[dev]; extra == "dev-cupy"
Requires-Dist: cupy>=12.2; extra == "dev-cupy"
Provides-Extra: docs-core
Requires-Dist: splineops[visualization]; extra == "docs-core"
Requires-Dist: sphinx>=7.3; extra == "docs-core"
Requires-Dist: sphinx-gallery>=0.17; extra == "docs-core"
Requires-Dist: sphinx-prompt>=1.8; extra == "docs-core"
Requires-Dist: sphinx-copybutton>=0.5; extra == "docs-core"
Requires-Dist: sphinx-remove-toctrees>=1.0; extra == "docs-core"
Requires-Dist: sphinx-design>=0.6; extra == "docs-core"
Requires-Dist: pydata-sphinx-theme>=0.15; extra == "docs-core"
Requires-Dist: myst-parser>=3.0; extra == "docs-core"
Requires-Dist: imageio-ffmpeg>=0.5; extra == "docs-core"
Provides-Extra: docs
Requires-Dist: splineops[docs-core]; extra == "docs"
Requires-Dist: Pillow>=10.0; extra == "docs"
Requires-Dist: scikit-image>=0.25; extra == "docs"
Requires-Dist: opencv-python-headless>=4.8; extra == "docs"
Requires-Dist: torch>=2.0; extra == "docs"
Description-Content-Type: text/markdown

# SplineOps

**Projection-based antialiased resizing for N-D scientific arrays.**

SplineOps is designed for precise, repeatable downsampling of regular-grid
2-D images and 3-D volumes. It combines explicit coordinate semantics, a
readable Python reference implementation, a native CPU backend, and reusable
plans for fixed-geometry workloads.

## Installation

SplineOps requires Python 3.11 or newer:

```shell
python -m pip install splineops
```

Published wheels include the native resize extension on supported platforms.

## Quick start

```python
import numpy as np
from splineops import resize

volume = np.random.default_rng(0).random((64, 192, 192), dtype=np.float32)
coarse = resize(
    volume,
    output_size=(32, 96, 96),
    method="cubic-antialiasing",
)
```

The `*-antialiasing` methods project the input spline onto a coarser spline
space instead of treating downsampling as interpolation alone. For repeated
arrays with the same geometry, `ResizePlan` reuses setup and workspace state.

## When to use SplineOps

SplineOps is a good fit when:

- continuous-valued 2-D or 3-D NumPy data must be downsampled;
- coordinate, boundary, and output-shape semantics must be explicit;
- aliasing matters; or
- many arrays share one resize geometry.

Another tool may be a better fit when:

- differentiable GPU execution is required;
- physical-space image metadata must be managed automatically;
- ordinary display-image scaling is the only goal; or
- categorical labels are being resampled, where nearest-neighbour semantics
  are normally appropriate.

## Public maturity

| Module | Status | Public position |
| --- | --- | --- |
| `resize`, `ResizePlan` | Stable | Native N-D interpolation and projection antialiasing with a Python reference path |
| `TensorSpline` | Stabilizing | Continuous tensor-product models evaluated at arbitrary coordinates |
| Affine, differentials, smoothing, regression, pyramids, wavelets | Experimental | Available for research while their contracts and reference coverage mature |

Experimental describes API and validation maturity, not the importance of the
underlying methods. See the [project status](https://splineops.github.io/project-status.html)
for exact evidence and remaining graduation work.

## Numerical and performance position

SplineOps does not claim to be the fastest generic 2-D image resizer. OpenCV,
PyTorch, or other libraries can be faster when their coordinate, boundary,
kernel, and antialiasing conventions are acceptable.

SplineOps is strongest when the spline model matters: defined grids and
boundaries, N-D projection antialiasing, native/reference parity, and repeated
fixed-geometry execution. Cross-library reports include semantic differences
as well as timings; numerical difference from SplineOps is not treated as an
independent accuracy metric.

## Backends

- NumPy is supported across the package.
- The native C++ backend accelerates resize on CPU.
- CuPy interoperability is experimental and limited to parts of `TensorSpline`.

Set `SPLINEOPS_ACCEL=never` to force the Python resize reference or
`SPLINEOPS_ACCEL=always` to require the native extension. See the
[backend contract](https://splineops.github.io/backend-support.html) for exact
scope.

## Documentation

- [Getting started](https://splineops.github.io/quickstart.html)
- [Resize guide](https://splineops.github.io/user-guide/02_resize.html)
- [Volume downsampling tutorial](https://splineops.github.io/volume-downsampling.html)
- [Performance evidence](https://splineops.github.io/performance.html)
- [API reference](https://splineops.github.io/api/index.html)
- [Provenance](https://splineops.github.io/provenance.html)
- [Changelog](https://github.com/splineops/splineops/blob/main/CHANGELOG.md)

SplineOps modernizes spline methods developed across the Biomedical Imaging
Group at EPFL and its collaborators. Method citations, implementation history,
and source provenance are recorded explicitly.

## Development

```shell
git clone https://github.com/splineops/splineops.git
cd splineops
python -m venv .venv
source .venv/bin/activate
python -m pip install -e '.[dev]'
python -m pytest -q
```

Reproducible resize evidence commands include:

```shell
python scripts/benchmark_resize_pr.py --profile smoke --output-dir /tmp/splineops-smoke
python scripts/benchmark_resize_native.py --backend both --output-csv /tmp/splineops-native.csv
python scripts/benchmark_resize_libraries.py --output-csv /tmp/splineops-libraries.csv
```
