Skip to main content

_

Create and publish a Docker image pre-commit Test package PyPI version GitHub License Ruff

Laplace-Dirichlet Rule-Based (LDRB) algorithm for assigning myocardial fiber orientations

A software for assigning myocardial fiber orientations based on the Laplace Dirichlet Ruled-Based algorithm based on FEniCSx.

Bayer, J.D., Blake, R.C., Plank, G. and Trayanova, N.A., 2012. A novel rule-based algorithm for assigning myocardial fiber orientation to computational heart models. Annals of biomedical engineering, 40(10), pp.2243-2254.(https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3518842/)

Getting started

For example if you have a bi-ventricular geometry (e.g from cardiac-geometries), you can generate fibers as follows

import cardiac_geometries
import ldrb
import dolfinx

# Generate an idealized BiV geometry
geo = cardiac_geometries.mesh.biv_ellipsoid(outdir=geodir)
# Generate fibers with 60/-60 fibers angles on the endo- and epicardium
system = ldrb.dolfinx_ldrb(
    mesh=geo.mesh,
    ffun=geo.ffun,
    markers=geo.markers,
    alpha_endo_lv=60,
    alpha_epi_lv=-60,
    beta_endo_lv=0,
    beta_epi_lv=0,
    fiber_space="P_2",
)
# Visualize fibers in Paraview
with dolfinx.io.VTXWriter(
    geo.mesh.comm,
    outdir / f"microstructure-viz.bp",
    [system.f0, system.s0, system.n0],
    engine="BP4",
) as vtx:
    vtx.write(0.0)

If you now open the file microstructure-viz.bp in Paraview (using the ADIOS2VTXReader), select Glyph and choose f0 as orientation array you can see the fiber orientations similar to the following figure (here I have also added a Calculator to compute the fiber angle) _

Note that you can achieve the the same results using the command line interface

ldrb mesh.xdmf --markers-file markers.json --fiber-space P_2 --alpha-endo-lv 60 --alpha-epi-lv -60 --beta-endo-lv 0 --beta-epi-lv 0

Note that if you don't specify a different angle for the RV or Septum, then the same angle as the LV will be used.

Geometries with outflow tracts

For biventricular geometries that include the outflow tracts and the four valves, such as the UK Biobank atlas, you can use the rule-based method of Doste et al. (2019). It defines the longitudinal direction in each ventricle as a blend of the directions from the apex to the inflow and to the outflow valve, and uses separate angles in the LV, RV and outflow tracts

system = ldrb.dolfinx_doste(
    mesh=geo.mesh,
    ffun=geo.ffun,
    markers={"lv": 1, "rv": 2, "epi": 3, "mv": 4, "av": 5, "tv": 6, "pv": 7},
    fiber_space="P_2",
)

The apex of each ventricle is the point on its endocardium farthest from the inflow valve, unless you pass its coordinates with apex_lv and apex_rv. The default angles are the ones from the paper, see ldrb.doste for the convention.

Installation

pip

Note that you can install the package with pip, but then you need to install FEniCSx separatly, see download

python3 -m pip install fenicsx-ldrb

conda

The package can also be installed with conda, i.e

conda install -c conda-forge fenicsx-ldrb

Docker

To pull the latest docker image you can do

docker pull ghcr.io/finsberg/fenicsx-ldrb:main

or choose a specific version e.g

docker pull ghcr.io/finsberg/fenicsx-ldrb:v0.1.4

Note that you can also run the cli directly using docker e.g

docker run --rm -v $PWD:/home/shared -w /home/shared -it ghcr.io/finsberg/fenicsx-ldrb ldrb --help

Documentation

See https://finsberg.github.io/fenicsx-ldrb

License

MIT

Contributors

Henrik Finsberg (henriknf@simula.no)

Metadata

Release files for fenicsx-ldrb 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fenicsx-ldrb 0.2.0
File Size Uploaded Provenance Actions
fenicsx_ldrb-0.2.0.tar.gz 28.2 kB With provenance Details for fenicsx_ldrb-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fenicsx-ldrb 0.2.0
File Interpreter ABI Platform Actions
fenicsx_ldrb-0.2.0-py3-none-any.whl Python 3 none any Details for fenicsx_ldrb-0.2.0-py3-none-any.whl

Total release size: 53.4 kB

Release files / fenicsx_ldrb-0.2.0.tar.gz

Download URL fenicsx_ldrb-0.2.0.tar.gz
Size 28.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1d6d1d75b3a7275885c082602cf363d26fbc35bdb62f173286031f462fd8332c
BLAKE2b-256 checksum
How to use checksums
d02c1b6db187735f5441ad2c95b3aa8da2f8a3d52eef1b92a7f0f9e8afa10095
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / fenicsx_ldrb-0.2.0-py3-none-any.whl

Download URL fenicsx_ldrb-0.2.0-py3-none-any.whl
Size 25.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
942d22e4fa3b3b111a483e73cac80d4fb06adcaf542f212921b6dafa0eee8f7c
BLAKE2b-256 checksum
How to use checksums
05fc7736d8bbddb39e04f0fda4bd4efc9826fbde3a37f3a96be323fa50ecc515
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for fenicsx-ldrb 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fenicsx_ldrb-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page