Utilities to generate Purkinje networks from fractal trees and mesh surfaces
Project description
PurkinjeUV
PurkinjeUV is a modular Python package for constructing, simulating, and exporting fractal-based Purkinje networks over anatomical or idealized cardiac surface meshes. It offers a flexible architecture for working with geometries via OBJ, VTK, and GMSH, and supports UV mapping, eikonal solvers, and export utilities.
Table of Contents
- Features
- Installation
- Getting Started
- Examples
- Requirements
- Attributions and Credits
- Citation
- License
- Contributing
Features
- Fractal-based generation of Purkinje networks constrained to 3D surface meshes
- Fast Iterative Method (FIM)-based eikonal solver for activation time simulation
- Surface processing tools, including Laplacian-based UV mapping
- VTK and IGB utilities for visualization and interoperability with scientific tools
- Fully modular and scriptable, suitable for both research and reproducible simulation pipelines
Installation
Install the latest release from PyPI:
pip install purkinje-uv
Documentation
The full documentation is available at:
https://ricardogr07.github.io/purkinje-uv/main
Getting Started
See Getting Started Guide for full documentation.
# Generate a fractal tree and save it to VTU (no activation required)
from pathlib import Path
import numpy as np
from purkinje_uv import FractalTreeParameters, FractalTree, PurkinjeTree
# Parameters: FractalTree reads the mesh from p.meshfile
p = FractalTreeParameters(
meshfile="data/sphere.obj",
init_node_id=0,
second_node_id=1,
l_segment=0.01, # step size on the surface
init_length=0.1,
length=0.1,
branch_angle=0.15,
w=0.1,
N_it=10,
)
# Grow the tree on the surface (UV domain)
ft = FractalTree(params=p)
ft.grow_tree()
# Wrap as a PurkinjeTree and save
out = Path("output")
out.mkdir(parents=True, exist_ok=True)
purk = PurkinjeTree(
nodes=np.asarray(ft.nodes_xyz),
connectivity=np.asarray(ft.connectivity),
end_nodes=np.asarray(ft.end_nodes),
)
purk.save(str(out / "fractal_tree.vtu"))
Visualization:
import pyvista as pv
tree = pv.read("output/fractal_tree.vtu")
tree.plot()
Runnable notebooks:
examples/demo_obj/demo_obj_fractal_tree.ipynbexamples/demo_gmsh/demo_fractal_tree_biventricular.ipynb
Requirements
- Python ≥ 3.10
- Optional:
pyvistafor visualizationcupyfor GPU acceleration (used in FIM solver)gmshandcardiac-geometriesfor realistic biventricular geometries
Attributions and Credits
Based on the work by Francisco Sahli:
- fractal-tree: https://github.com/fsahli/fractal-tree
- purkinje-learning: https://github.com/fsahli/purkinje-learning
References: Sahli Costabal, F., Yao, J., & Kuhl, E. (2016). Predicting the cardiac toxicity of drugs using a hybrid multiscale model of the heart. Journal of the Mechanical Behavior of Biomedical Materials, 62, 217–231. DOI: 10.1016/j.jmbbm.2016.05.004
Maintained by Ricardo García Ramírez (July 2025)
Citation
@article{sahli2016hybrid,
title={Predicting the cardiac toxicity of drugs using a hybrid multiscale model of the heart},
author={Sahli Costabal, Feras and Yao, Jiajian and Kuhl, Ellen},
journal={Journal of the Mechanical Behavior of Biomedical Materials},
volume={62},
pages={217--231},
year={2016},
publisher={Elsevier}
}
@misc{purkinjeuv2025,
author = {Ricardo García Ramírez},
title = {PurkinjeUV: Modular Fractal Purkinje Generator on Surface Meshes},
year = {2025},
howpublished = {\url{https://github.com/ricardogr07/purkinje-uv}}
}
License
Released under the MIT License. See LICENSE.
Contributing
See CONTRIBUTING.md for guidelines.
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
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 purkinje_uv-0.4.0.tar.gz.
File metadata
- Download URL: purkinje_uv-0.4.0.tar.gz
- Upload date:
- Size: 48.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96954cd0c43ff0eb62e2468f5d48d31e8683fa4e47df6703022f50683f2b5a07
|
|
| MD5 |
b3c2c3fa239842d8ea949842e9a5149d
|
|
| BLAKE2b-256 |
c81e4b3a6e1fa1f52d541d2a3d9b77609ddb9077c3d1797c7404844a7bc3b2c8
|
Provenance
The following attestation bundles were made for purkinje_uv-0.4.0.tar.gz:
Publisher:
release.yml on ricardogr07/purkinje-uv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
purkinje_uv-0.4.0.tar.gz -
Subject digest:
96954cd0c43ff0eb62e2468f5d48d31e8683fa4e47df6703022f50683f2b5a07 - Sigstore transparency entry: 421027158
- Sigstore integration time:
-
Permalink:
ricardogr07/purkinje-uv@98d72ae9770a6b9792a292d8c30ed4eacfcdc815 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ricardogr07
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@98d72ae9770a6b9792a292d8c30ed4eacfcdc815 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file purkinje_uv-0.4.0-py3-none-any.whl.
File metadata
- Download URL: purkinje_uv-0.4.0-py3-none-any.whl
- Upload date:
- Size: 50.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fbdebbf0580890ab30291ba47f31d5c1208401e213f4e69afe51e48af8ea57c
|
|
| MD5 |
0339ad9b24d6643f8bc226bf070ae507
|
|
| BLAKE2b-256 |
9d4fa2311bd77f5681151b8e079ca7add53010da4e610dc574785a1814b53c30
|
Provenance
The following attestation bundles were made for purkinje_uv-0.4.0-py3-none-any.whl:
Publisher:
release.yml on ricardogr07/purkinje-uv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
purkinje_uv-0.4.0-py3-none-any.whl -
Subject digest:
8fbdebbf0580890ab30291ba47f31d5c1208401e213f4e69afe51e48af8ea57c - Sigstore transparency entry: 421027194
- Sigstore integration time:
-
Permalink:
ricardogr07/purkinje-uv@98d72ae9770a6b9792a292d8c30ed4eacfcdc815 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ricardogr07
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@98d72ae9770a6b9792a292d8c30ed4eacfcdc815 -
Trigger Event:
workflow_dispatch
-
Statement type: