Cardiac geometries

_

Create and publish a Docker image Test package Test package MPI Pre-commit PyPI version

Cardiac geometries#

Cardiac geometries is a software package built on top of cariac-geometries-core that adds support for creating idealized cardiac geometries for dolfinx.

There are two ways you can use cardiac-geomtries, either using the command line interface, e.g

geox lv-ellipsoid --create-fibers lv-mesh --fiber-space P_2

or using the python API e.g

geo = cardiac_geometries.mesh.lv_ellipsoid(outdir="lv-mesh", create_fibers=True, fiber_space="P_2")

The geometry is saved with io4dolfinx to geometry.h5 using the h5py backend. Pass --io-backend adios2 (or io_backend="adios2" in the python API) to instead write geometry.bp using the adios2 backend. Geometry.from_file reads either file.

The file is self-describing: it holds the mesh, the tags, the fibers and the fields, and records the unit, the names of the tags and what each field means. Geometries made before this (an io4dolfinx file with JSON files beside it) still load, and geox convert turns them into one file. The standard is described in the documentation. Five commands work on the file:

geox convert OLD_FOLDER new.h5 --mapping mapping.toml   # an old geometry into one file of the standard
geox celltype geometry.h5                               # compute the transmural cell type into the file
geox inspect geometry.h5                                # print what the file holds, then check it
geox check geometry.h5                                  # check it against the standard, exit 1 on an error
geox export geometry.h5                                 # write VTU files for ParaView

The generators write ParaView files into OUTDIR/viz/ too (pass --no-export to skip it).

Install#

To install the package you can use pip

python3 -m pip install cardiac-geometriesx

however, this assumes that you already have dolfinx pre-installed. You can also use conda

conda install -c conda-forge cardiac-geometriesx

or the provided docker image

docker pull ghcr.io/computationalphysiology/cardiac-geometriesx:latest

To start a new container interactive you can do

docker run --name geox -v $PWD:/home/shared -w /home/shared -it ghcr.io/computationalphysiology/cardiac-geometriesx:latest

or if you just want to create a mesh and exit you can run the command line interface directly e.g

docker run --rm -v $PWD:/home/shared -w /home/shared -it ghcr.io/computationalphysiology/cardiac-geometriesx:latest geox lv-ellipsoid --create-fibers lv-mesh --fiber-space P_2

Authors#

Henrik Finsberg (henriknf@simula.no)

License#

MIT

Contributing#