Metadata-Version: 2.4
Name: vesselknit
Version: 1.0.0
Summary: Voxelize vessel STL meshes into NIfTI masks without breakage -- connectivity-preserving, calibre-faithful.
Author: Justin
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/77even/VesselKnit
Project-URL: Repository, https://github.com/77even/VesselKnit
Project-URL: Issues, https://github.com/77even/VesselKnit/issues
Keywords: stl,nifti,voxelization,vessel,medical-imaging,vtk,segmentation,connectivity,mesh,surface
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Healthcare Industry
Classifier: Operating System :: OS Independent
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: Topic :: Scientific/Engineering :: Medical Science Apps.
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: numpy>=1.21
Requires-Dist: SimpleITK>=2.1
Requires-Dist: vtk>=9.0
Requires-Dist: scipy>=1.7
Provides-Extra: dicom
Requires-Dist: pydicom>=2.3; extra == "dicom"
Provides-Extra: nibabel
Requires-Dist: nibabel>=4.0; extra == "nibabel"
Provides-Extra: progress
Requires-Dist: tqdm>=4.60; extra == "progress"
Provides-Extra: all
Requires-Dist: pydicom>=2.3; extra == "all"
Requires-Dist: nibabel>=4.0; extra == "all"
Requires-Dist: tqdm>=4.60; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pydicom>=2.3; extra == "dev"
Requires-Dist: nibabel>=4.0; extra == "dev"
Requires-Dist: tqdm>=4.60; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

<div align="center">

# VesselKnit

**Voxelize vessel STL meshes into NIfTI masks — without breakage.**

[![PyPI](https://img.shields.io/pypi/v/vesselknit.svg?cacheSeconds=300)](https://pypi.org/project/vesselknit/)
[![Python](https://img.shields.io/pypi/pyversions/vesselknit.svg?cacheSeconds=300)](https://pypi.org/project/vesselknit/)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)

</div>

Rasterizing a thin vessel STL onto a CT/MR grid usually **fractures** it into
disconnected blobs at narrow junctions. VesselKnit keeps the vessel a single
connected structure — faithful to the original mesh in **morphology and
calibre** — via progressive gap-bridging during voxelization plus 26-/6-connectivity
repair. Built for medical-imaging workflows; coordinate alignment (LPS/RAS,
Z-reflection, direction matrix) is automatic.

## Install

```bash
pip install vesselknit
```

Optional extras: `[dicom]` for DICOM input, `[all]` for everything.
Python ≥ 3.9.

## Usage

```bash
vesselknit --stl vessel.stl --reference ct_scan/ --output vessel.nii.gz
```

Multiple STLs into one multi-label volume, with connectivity repair:

```bash
vesselknit \
  --stl portal_vein.stl --label 1 \
  --stl hepatic_vein.stl --label 2 \
  --reference ct_scan/ --output vessels.nii.gz \
  --bridge-26conn
```

```python
from vesselknit import load_reference_image, stl_to_mask, save_nifti

ref = load_reference_image("ct_scan/")      # DICOM dir or .nii.gz
mask = stl_to_mask("vessel.stl", ref)       # (z, y, x) uint8
save_nifti(mask, ref, "vessel.nii.gz")
```

See [`examples/basic_usage.py`](examples/basic_usage.py) for multi-label and
connectivity-repair examples.

## License

[Apache 2.0](LICENSE) © 2026 Justin
