Skip to main content

Voxelize vessel STL meshes into NIfTI masks without breakage -- connectivity-preserving, calibre-faithful.

Project description

VesselKnit

Voxelize vessel STL meshes into NIfTI masks — without breakage.

PyPI Python License: Apache 2.0

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vesselknit-1.0.0.tar.gz (26.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vesselknit-1.0.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

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

Hashes for vesselknit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bf368d57fb54412aca490ddd5bb622b28d9206a2cb688a07458a74e5ccef7726
MD5 ada364e4eda3ae7b3ad959d8058d4c64
BLAKE2b-256 8c816e725bcb61ec96731087a73f4864d623a5392d2a88d3f9ad209ae15f2a5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for vesselknit-1.0.0.tar.gz:

Publisher: publish.yml on 77even/VesselKnit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for vesselknit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98c798a638a8262e87d6a6bb6f2a3fbeba7d3e2947982309b7a09d12d44af4ee
MD5 2fcb0ebb00600d73d4f5d47931d793aa
BLAKE2b-256 c8e2c9b6a66372f21eec43a3fbdce7883bdcc0cdc864f5e0efc343e05f8a1af5

See more details on using hashes here.

Provenance

The following attestation bundles were made for vesselknit-1.0.0-py3-none-any.whl:

Publisher: publish.yml on 77even/VesselKnit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page