Metadata-Version: 2.4
Name: scikit-surgeryopencvcpp
Version: 0.1.0
Summary: Image-guided surgery functions, in C++, using OpenCV and wrapped in Python.
Author-Email: Matt Clarkson <m.clarkson@ucl.ac.uk>
License-Expression: BSD-3-Clause
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Healthcare Industry
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: C++
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Project-URL: Homepage, https://github.com/UCL/scikit-surgeryopencvcpp
Project-URL: Repository, https://github.com/UCL/scikit-surgeryopencvcpp
Requires-Python: >=3.9
Requires-Dist: numpy>=1.20
Description-Content-Type: text/markdown

# scikit-surgeryopencvcpp

Image-guided surgery functions, in C++, using OpenCV, wrapped in Python.

Part of the [SNAPPY](https://weisslab.cs.ucl.ac.uk/WEISS/PlatformManagement/SNAPPY/wikis/home) software project,
developed at the [Wellcome EPSRC Centre for Interventional and Surgical Sciences](http://www.ucl.ac.uk/weiss),
[University College London (UCL)](http://www.ucl.ac.uk/).

## Features

* Stereo triangulation (Hartley/Zisserman SVD method and midpoint-of-shortest-distance)
* Calibration dot/fiducial detection
* Point masking utilities

## Installing

```bash
pip install scikit-surgeryopencvcpp
```

## Building from source

Requires CMake 3.15+ and a C++17 compiler. All dependencies (OpenCV, pybind11) are fetched automatically via CMake FetchContent.

### Build a wheel (for pip install)

```bash
pip install build
python -m build --wheel
```

This produces a wheel in `dist/` that you can install with:

```bash
pip install dist/scikit_surgeryopencvcpp-*.whl
```

For a faster development cycle (reuses your existing build artifacts):

```bash
pip wheel . -v --no-build-isolation
```

### C++ development (no Python)

```bash
cmake -B build -DBUILD_TESTING=ON -DBUILD_PYTHON_BINDINGS=OFF -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release --parallel
ctest --test-dir build --build-config Release --output-on-failure
```

### Full build with Python bindings

Requires NumPy and pybind11 in your environment:

```bash
pip install numpy pybind11
cmake -B build -DBUILD_TESTING=ON -DBUILD_PYTHON_BINDINGS=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release --parallel
ctest --test-dir build --build-config Release --output-on-failure
```

## Python API

```python
import numpy as np
import sksurgeryopencvpython as sks

# Triangulate stereo point pairs
points_3d = sks.triangulate_points_using_hartley(
    image_points,       # Nx4 array (left_x, left_y, right_x, right_y)
    left_intrinsics,    # 3x3 camera matrix
    right_intrinsics,   # 3x3 camera matrix
    rotation_matrix,    # 3x3 left-to-right rotation
    translation_vector  # 3x1 left-to-right translation
)
```

## Contributing

1. Raise an issue on GitHub
2. Fork the repository
3. Create a feature branch: `<issue-number>-<short-description>`
4. Submit a pull request

## License

Copyright 2018 University College London.
Released under the [BSD-3 license](LICENSE.txt).

## Acknowledgements

Supported by [Wellcome](https://wellcome.ac.uk/) and the [EPSRC](https://www.epsrc.ac.uk/).
