Skip to main content

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

Project description

CI github pages

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.

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/)

# Generate an example geometry using https://github.com/ComputationalPhysiology/cardiac_geometries
import cardiac_geometries  # pip install cardiac-geometries
import ldrb

geo = cardiac_geometries.mesh.create_biv_ellipsoid(char_length=0.2)

# Decide on the angles you want to use
angles = dict(
    alpha_endo_lv=30,  # Fiber angle on the LV endocardium
    alpha_epi_lv=-30,  # Fiber angle on the LV epicardium
    beta_endo_lv=0,  # Sheet angle on the LV endocardium
    beta_epi_lv=0,  # Sheet angle on the LV epicardium
    alpha_endo_sept=60,  # Fiber angle on the Septum endocardium
    alpha_epi_sept=-60,  # Fiber angle on the Septum epicardium
    beta_endo_sept=0,  # Sheet angle on the Septum endocardium
    beta_epi_sept=0,  # Sheet angle on the Septum epicardium
    alpha_endo_rv=80,  # Fiber angle on the RV endocardium
    alpha_epi_rv=-80,  # Fiber angle on the RV epicardium
    beta_endo_rv=0,  # Sheet angle on the RV endocardium
    beta_epi_rv=0,  # Sheet angle on the RV epicardium
)

# Convert markers to correct format
markers = {
    "base": geo.markers["BASE"][0],
    "lv": geo.markers["ENDO_LV"][0],
    "rv": geo.markers["ENDO_RV"][0],
    "epi": geo.markers["EPI"][0],
}

# Choose space for the fiber fields
# This is a string on the form {family}_{degree}
fiber_space = "P_2"

# Compute the microstructure
fiber, sheet, sheet_normal = ldrb.dolfin_ldrb(
    mesh=geo.mesh, fiber_space=fiber_space, ffun=geo.ffun, markers=markers, **angles
)
# Store files using a built in xdmf viewer that also works for functions
# defined in quadrature spaces
ldrb.fiber_to_xdmf(fiber, "fiber")
# And visualize it in Paraview

_

Installation

pip

In order to install the software you need to have installed FEniCS (versions older than 2016 are not supported)

The package can be installed with pip.

python -m pip install ldrb

or if you need the most recent version you can install the source

python -m pip install git+https://github.com/finsberg/ldrb.git

Conda

ldrb is also available on conda

conda install -c conda-forge ldrb

Docker

If you don't already have FEniCS installed you can use one of the provided docker images, e.g

docker pull ghcr.io/finsberg/ldrb:latest

to pull the image and use the following command to start a container and sharing your current directory

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

Documentation

Documentation is hosted at http://finsberg.github.io/ldrb

Getting started

Check out the demos

License

ldrb is licensed under the GNU LGPL, version 3 or (at your option) any later version. ldrb is Copyright (2011-2019) by the authors and Simula Research Laboratory.

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

ldrb-2023.5.0.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

ldrb-2023.5.0-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file ldrb-2023.5.0.tar.gz.

File metadata

  • Download URL: ldrb-2023.5.0.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for ldrb-2023.5.0.tar.gz
Algorithm Hash digest
SHA256 456420da56eb43ca2537742662aab55346e58734ab6e006484ae2fcc96413118
MD5 5762b5688096da63b3f66a22418826f2
BLAKE2b-256 a903484393ed8cc7e51d662d42cd935c2cf72a18192bccbdcd6e2d62cbfb6776

See more details on using hashes here.

File details

Details for the file ldrb-2023.5.0-py3-none-any.whl.

File metadata

  • Download URL: ldrb-2023.5.0-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for ldrb-2023.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e612d57484f59ea9c4730354cba656d4c124f8e794802877a30da99d4dc6b112
MD5 e22acb504579889a084ae039209e56b0
BLAKE2b-256 70f05820e78f9c31b7315eebae93fd690b40012050cef7c930d7e8d4f1abb7b2

See more details on using hashes here.

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