Voxelize vessel STL meshes into NIfTI masks without breakage -- connectivity-preserving, calibre-faithful.
Project description
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
pip install vesselknit
Optional extras: [dicom] for DICOM input, [all] for everything.
Python ≥ 3.9.
Usage
vesselknit --stl vessel.stl --reference ct_scan/ --output vessel.nii.gz
Multiple STLs into one multi-label volume, with connectivity repair:
vesselknit \
--stl portal_vein.stl --label 1 \
--stl hepatic_vein.stl --label 2 \
--reference ct_scan/ --output vessels.nii.gz \
--bridge-26conn
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 for multi-label and
connectivity-repair examples.
License
Apache 2.0 © 2026 Justin
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vesselknit-1.0.0.tar.gz.
File metadata
- Download URL: vesselknit-1.0.0.tar.gz
- Upload date:
- Size: 26.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf368d57fb54412aca490ddd5bb622b28d9206a2cb688a07458a74e5ccef7726
|
|
| MD5 |
ada364e4eda3ae7b3ad959d8058d4c64
|
|
| BLAKE2b-256 |
8c816e725bcb61ec96731087a73f4864d623a5392d2a88d3f9ad209ae15f2a5f
|
Provenance
The following attestation bundles were made for vesselknit-1.0.0.tar.gz:
Publisher:
publish.yml on 77even/VesselKnit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vesselknit-1.0.0.tar.gz -
Subject digest:
bf368d57fb54412aca490ddd5bb622b28d9206a2cb688a07458a74e5ccef7726 - Sigstore transparency entry: 1871755727
- Sigstore integration time:
-
Permalink:
77even/VesselKnit@26a7e5ac7f74b4cf607d4a962030b2be381e6b29 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/77even
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@26a7e5ac7f74b4cf607d4a962030b2be381e6b29 -
Trigger Event:
push
-
Statement type:
File details
Details for the file vesselknit-1.0.0-py3-none-any.whl.
File metadata
- Download URL: vesselknit-1.0.0-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98c798a638a8262e87d6a6bb6f2a3fbeba7d3e2947982309b7a09d12d44af4ee
|
|
| MD5 |
2fcb0ebb00600d73d4f5d47931d793aa
|
|
| BLAKE2b-256 |
c8e2c9b6a66372f21eec43a3fbdce7883bdcc0cdc864f5e0efc343e05f8a1af5
|
Provenance
The following attestation bundles were made for vesselknit-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on 77even/VesselKnit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vesselknit-1.0.0-py3-none-any.whl -
Subject digest:
98c798a638a8262e87d6a6bb6f2a3fbeba7d3e2947982309b7a09d12d44af4ee - Sigstore transparency entry: 1871755831
- Sigstore integration time:
-
Permalink:
77even/VesselKnit@26a7e5ac7f74b4cf607d4a962030b2be381e6b29 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/77even
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@26a7e5ac7f74b4cf607d4a962030b2be381e6b29 -
Trigger Event:
push
-
Statement type: