Skip to main content

Laplace-Dirichlet Rule-based algorithm for assigning myocardial fiber orientations.

Project description

_

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.

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)

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

fenicsx_ldrb-0.1.19.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

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

fenicsx_ldrb-0.1.19-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file fenicsx_ldrb-0.1.19.tar.gz.

File metadata

  • Download URL: fenicsx_ldrb-0.1.19.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fenicsx_ldrb-0.1.19.tar.gz
Algorithm Hash digest
SHA256 b48f0221b9f18889e83a670f2f7695ceda5034521bf6491f7663e60a32e430b8
MD5 77026bf488d47efc0a09b17346bd3247
BLAKE2b-256 4aeedbb63e27a74746050bced84305fc3009ed31ce366fa3c346d57c26d05287

See more details on using hashes here.

Provenance

The following attestation bundles were made for fenicsx_ldrb-0.1.19.tar.gz:

Publisher: pypi.yml on finsberg/fenicsx-ldrb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fenicsx_ldrb-0.1.19-py3-none-any.whl.

File metadata

  • Download URL: fenicsx_ldrb-0.1.19-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fenicsx_ldrb-0.1.19-py3-none-any.whl
Algorithm Hash digest
SHA256 cab19317cb1fcbdc9e0977b4345ce79a9999310ff559232d5184f83d3119f37d
MD5 fdd35a26de9789f3cdd4adc95b887a06
BLAKE2b-256 42ba7dbfee835bc516b7ce01ad460736143e7a6683007f12bde5d5693df4a4fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for fenicsx_ldrb-0.1.19-py3-none-any.whl:

Publisher: pypi.yml on finsberg/fenicsx-ldrb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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