Skip to content

77even/VesselKnit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VesselKnit

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

About

Connectivity-preserving voxelization of vessel STL meshes into NIfTI masks.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages