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.
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
Getting Started
Example to generate and visualize a basic fractal Purkinje tree on a sphere mesh:
from purkinje_uv import Parameters
from example_fractal_tree_3d import Fractal_Tree_3D
param = Parameters()
param.meshfile = "data/sphere.obj"
param.save = True
param.filename = "output/fractal_tree"
branches, nodes = Fractal_Tree_3D(param)
Visualization:
import pyvista as pv
tree = pv.read("output/fractal_tree.vtu")
tree.plot()
You can find runnable notebooks under:
examples/demo_obj/demo_obj_fractal_tree.ipynbexamples/demo_gmsh/demo_fractal_tree_biventricular.ipynb
Repository Structure
purkinje_uv/ # Core module
examples/
demo_obj/ # OBJ-based toy examples
demo_gmsh/ # Realistic biventricular geometries via gmsh
data/ # Sample meshes
Requirements
- Python ≥ 3.8
- Optional:
pyvistafor visualizationcupyfor GPU acceleration (used in FIM solver)gmshandcardiac-geometriesfor realistic biventricular geometries
Attributions and Credits
This package is based on the work by Francisco Sahli, and specifically the repository:
- https://github.com/fsahli/fractal-tree
Which implements the methodology from:
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
This project also incorporates structural ideas and processing utilities from the later repository:
This package does not attempt to replicate or replace either of the original works. Instead, it adapts and modularizes key components for clarity, reproducibility, and ease of extension, particularly in the context of modern cardiac simulation workflows and integration with UV-mapped meshes.
All intellectual credit for the core algorithms and the geometric methodology belongs to the original authors.
Maintainer and Modifications
This current repository is maintained by Ricardo García Ramírez as of July 2025. It introduces the following:
- Modular and pip-installable architecture (
purkinje-uv) - Improved demo scripts and Jupyter notebooks
- PyVista-based visualization integration
- Clean separation of mesh handling, branching logic, and exporting
- Explicit support for OBJ and GMSH-based geometries
Citation
If you use this library in your research or publications, please cite the original article as well as the repository:
@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/PurkinjeUV}}
}
License
This repository is released under the MIT License. See the LICENSE file for full terms.
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.2.1.tar.gz.
File metadata
- Download URL: purkinje_uv-0.2.1.tar.gz
- Upload date:
- Size: 24.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
029f2e31e2bdec319fe02d36f28029468cab7b9e2ff346e35a0a7ef1b8006c63
|
|
| MD5 |
abef8d225e7e3059ef9a4a76c98b5b00
|
|
| BLAKE2b-256 |
4e44fcc8b844b9b08dca3029868a4b179aa9b54fab1d73b450a3c65fb7cd8cea
|
Provenance
The following attestation bundles were made for purkinje_uv-0.2.1.tar.gz:
Publisher:
release.yml on ricardogr07/PurkinjeUV
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
purkinje_uv-0.2.1.tar.gz -
Subject digest:
029f2e31e2bdec319fe02d36f28029468cab7b9e2ff346e35a0a7ef1b8006c63 - Sigstore transparency entry: 299635632
- Sigstore integration time:
-
Permalink:
ricardogr07/PurkinjeUV@0393c2de661d9c583cea6354323676aa34bc4012 -
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@0393c2de661d9c583cea6354323676aa34bc4012 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file purkinje_uv-0.2.1-py3-none-any.whl.
File metadata
- Download URL: purkinje_uv-0.2.1-py3-none-any.whl
- Upload date:
- Size: 26.0 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 |
6b5b124bf01029f6f58e16ed869a96ccf2a285c16d2cd5c13115a9777796a6a6
|
|
| MD5 |
273210edfc43ffcad5c19968a146d013
|
|
| BLAKE2b-256 |
25899119d0954eaeb3f3aafb5a2f47b3aa9e97c6c53b956b3436fe65592d858f
|
Provenance
The following attestation bundles were made for purkinje_uv-0.2.1-py3-none-any.whl:
Publisher:
release.yml on ricardogr07/PurkinjeUV
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
purkinje_uv-0.2.1-py3-none-any.whl -
Subject digest:
6b5b124bf01029f6f58e16ed869a96ccf2a285c16d2cd5c13115a9777796a6a6 - Sigstore transparency entry: 299635639
- Sigstore integration time:
-
Permalink:
ricardogr07/PurkinjeUV@0393c2de661d9c583cea6354323676aa34bc4012 -
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@0393c2de661d9c583cea6354323676aa34bc4012 -
Trigger Event:
workflow_dispatch
-
Statement type: