Skip to main content

Create a fractal tree over a surface discretized by triangles

Project description


This code is to create a fractal tree over a surface discretized by triangles. It was developed to create a representation of the Purkinje network in the ventricles of the human heart.

Note that this is a rewrite of the original code found at

The details of the algorithm are presented in this article. If you are going to use this code, please cite:

Generating Purkinje networks in the human heart. F. Sahli Costabal, D. Hurtado and E. Kuhl. Journal of Biomechanics, doi:10.1016/j.jbiomech.2015.12.025


You can install the library with pip

python3 -m pip install fractal-tree

Note that you also need a way to load the mesh from e.g gmsh or another meshing tool. For this we recommend to use meshio as it support the most common formats.

Getting started

The following illustrates a minimal example, assuming that you have surface mesh called sphere.obj in your current directory.

import meshio
import numpy as np
from fractal_tree import generate_fractal_tree, FractalTreeParameters, Mesh

msh ="sphere.obj")
mesh = Mesh(verts=msh.points, connectivity=msh.cells[0].data)
param = FractalTreeParameters(
results = generate_fractal_tree(mesh, param)

For a more elaborate example you can checkout the gmsh example.



Need help or having issues

Please submit an issue

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

fractal-tree-0.2.1.tar.gz (13.7 kB view hashes)

Uploaded source

Built Distribution

fractal_tree-0.2.1-py3-none-any.whl (13.2 kB view hashes)

Uploaded py3

Supported by

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