Skip to main content

Compute vessel centerline with VTK.

Project description

Vessel Centerline

Compute vessel centerline with VTK.

Goal

A python package to extract the centerline of blood vessels starting from 3D model. This is the workflow followed by the provided scripts:

  • Load the 3D model (.stl of .vtp file).
  • Cap the holes in surface.
  • Set the input point and the target points or find them automatically.
  • Compute the centerline from the source to each target point.
  • Save the centerline to file.

Package

API

Modules:

The API is organized around these modules:

  • cap_polydata: functions to perform 3D model capping.
  • centerline_geometry: functions to compute geometric analysis of the centerline.
  • find_points: functions to find the center points of the cap surfaces, to be used as target and source points.
  • polydata_centerlines: functions to extract centerlines from a single source to multiple targets.
  • centerline_io: input/output functions and complete workflow to extract the centerline: from model loading to output file saving.

In each module you'll find documented functions. You can get the help for each function using the python build-in help function or via your editor, if supports doc strings:

$ python3
>>> import vessel_centerline.module
>>> help(vessel_centerline.module.function)

Prerequisites

  • Python3
  • pip

Installation:

Install with pip

pip install vessel-centerline

Install from the repository (using uv)

clone the repository:

git clone [github remote url]
cd vessel_centerline

build the package:

uv build

install the package locally:

pip install dist/vessel_centerline-0.1.0-py3-none-any.whl

Import in your code

import vessel_centerline

Usage examples

  • examples/cap_surface.py: example on how to cap the polydata surface and save the model.
  • examples/points_search.py: example on how to find points coordinates that can be used ad source and targets for the centerline.
  • examples/centerline_and_geometry.py: example on how to compute the centarline and the geometric analysis.

Command-line interface (CLI)

Prerequisites

  • Python3
  • uv

Clone the repository:

git clone [github remote url]
cd vessel_centerline

Usage

There are some arguments to specify:

  • --search-points : this option allows to search for points coordinates that can be used as input and targets for the centarline. Using this option, the centerline is not calculated, it just logs the coordinate of each point found.
  • --save-output-files : save the results of centerline and geometric computation to output files.
  • --model-path : path to input 3D model (.stl or .vtp).
  • --source-point : list of source point coordinates [x, y, z] (only one pont).
  • --target-points : list of target points coorfinates [[x, y, z], [x, y, z], ...] (one or more points).
  • --source-orientation : used to set the source point if the points are extracted automatically. The argument must be one of the following: "up", "down", "left", "right".

You have to pass either --source-point and --target-points or --source-orientation, both are not accepted. Otherwise you should pass --search-points to find the points coordinates.

Run this command for points search:

uv run python main.py --model-path /path/to/model --search-points

Run one of these commands for centerline computation:

uv run python main.py --model-path /path/to/model --source-orientation "up"|"down"|"left"|"right"

or

uv run python main.py --model-path /path/to/model --source-point "[x, y, z]" --target-points "[x, y, z]" "[x, y, z]" ...

Output

At the end of the script the centerline is saved as .vtp file. File path and file name are the same as those of the input model, only the extension .centerline.vtp is added to identify the centerline. The output can be checked and visualized with visualization engines such as ParaView.

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

vessel_centerline-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

vessel_centerline-0.1.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file vessel_centerline-0.1.0.tar.gz.

File metadata

  • Download URL: vessel_centerline-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for vessel_centerline-0.1.0.tar.gz
Algorithm Hash digest
SHA256 194a941af4e955a42c53a528068e498c31a5ffc7b58dc3d1e079d99843469afa
MD5 4efd5540231479932926b352527cbd9c
BLAKE2b-256 9f0bd12815994f97d53815b0f74583a1498b5b3c012ee456699d4b55e66e81f6

See more details on using hashes here.

File details

Details for the file vessel_centerline-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vessel_centerline-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4318ea400afef9895fb383784eccf5ea0e91a8998e77b63a3b18972829e65833
MD5 339df7701413a5ac235bb46eb329f101
BLAKE2b-256 7cebc496d98ba8dea1dd5e39a2d95055e97262c3c987365fe7d5b9bab37cf20a

See more details on using hashes here.

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