The laplace_post.py module#
Summary#
Read laplace fields from d3plot files. |
|
Use surface normal for transmural direction. |
|
Create a orthonormal coordinate system. |
|
Compute left atrium fibers coordinate system. |
|
Compute right atrium fibers coordinate system. |
|
Define rotation bounds from input parameters. |
|
Rotate by alpha and beta angles. |
|
Compute the fiber coordinate system from the Laplace solutions. |
Description#
Postprocessing script related to Laplace solving (UHC, fibers).
Module detail#
- laplace_post.read_laplace_solution(directory: str, field_list: list[str], read_heatflux: bool = False) pyvista.UnstructuredGrid#
Read laplace fields from d3plot files.
- laplace_post.update_transmural_by_normal(grid: pyvista.UnstructuredGrid, surface: pyvista.PolyData) numpy.ndarray#
Use surface normal for transmural direction.
- Parameters:
- grid
pv.UnstructuredGrid Atrium grid.
- surface
pv.PolyData Atrium endocardium surface.
- grid
- Returns:
np.ndarrayCell transmural direction vector.
Notes
Assume mesh is coarse compared to the thickness. Solid cell normal is interpolated from closest surface normal.
- laplace_post.orthogonalization(e1: numpy.ndarray, e2: numpy.ndarray) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]#
Create a orthonormal coordinate system.
- Parameters:
- e1
np.ndarray First unit (N,M) vector of the coordinate system.
- e2
np.ndarray Second unit (N,M) vector of the coordinate system.
- e1
- Returns:
tuple[np.ndarray,np.ndarray,np.ndarray]Local orthonormal coordinate system
e1, e2, e3.
Notes
e3 is orthogonal to the plane spanned by e1 and e2 following the right hand rule. Project e2 onto e1, and subtract to ensure orthogonality.
- laplace_post.compute_la_fiber_cs(directory: str, settings: ansys.health.heart.settings.settings.AtrialFiber, endo_surface: pyvista.PolyData = None) pyvista.UnstructuredGrid#
Compute left atrium fibers coordinate system.
- Parameters:
- Returns:
pv.UnstructuredGridPV object with fiber coordinates system.
Notes
This method is described in Modeling cardiac muscle fibers in ventricular and atrial electrophysiology simulations.
- laplace_post.compute_ra_fiber_cs(directory: str, settings: ansys.health.heart.settings.settings.AtrialFiber, endo_surface: pyvista.PolyData = None) pyvista.UnstructuredGrid#
Compute right atrium fibers coordinate system.
- Parameters:
- Returns:
pv.UnstructuredGridPV object with the fiber coordinates system.
Notes
This method is described in Modeling cardiac muscle fibers in ventricular and atrial electrophysiology simulations.
- laplace_post.set_rotation_bounds(w: numpy.ndarray, endo: float, epi: float, outflow_tracts: list[float, float] = None) tuple[numpy.ndarray, numpy.ndarray]#
Define rotation bounds from input parameters.
- Parameters:
- Returns:
tuple[np.ndarray,np.ndarray]Cell-wise rotation bounds for endocardium and epicardium.
- laplace_post.compute_rotation_angle(grid: pyvista.UnstructuredGrid, w: numpy.ndarray, rotation: list[float, float], outflow_tracts: list[float, float] = None) numpy.ndarray#
Rotate by alpha and beta angles.
- Parameters:
- Returns:
np.ndarrayCell-wise rotation angles.
Notes
Compute for all cells, but filter by left/right mask outside of this function.
- laplace_post.compute_ventricle_fiber_by_drbm(directory: str, settings: dict = {'alpha_left': [60, -60], 'alpha_right': [90, -25], 'alpha_ot': None, 'beta_left': [-65, 25], 'beta_right': [-65, 25], 'beta_ot': None}, left_only: bool = False) pyvista.UnstructuredGrid#
Compute the fiber coordinate system from the Laplace solutions.
- Parameters:
- directory
str Directory of d3plot/tprint files.
- settings
dict[str,list[float] |None] Rotation angles for fiber generation. The defaults are
{"alpha_left": [60, -60], "alpha_right": [90, -25], "alpha_ot": None, "beta_left": [-65, 25], "beta_right": [-65, 25], "beta_ot": None}.- left_onlybool, default:
False Whether to only compute fibers on the left ventricle.
- directory
- Returns:
pv.UnstructuredGridGrid containing
fiber,cross-fiber, andsheetvectors.
Notes
The D-RBM method is described in Modeling cardiac muscle fibers in ventricular and atrial electrophysiology simulations.