spline_mesher module

class spline_mesher.HexMesh(settings_dict: dict, img_dict: dict, sitk_image: Image | None = None, logger: Logger | None = None)[source]

Bases: object

mesher() Tuple[Dict[uint64, ndarray], Dict[uint64, ndarray], int, Dict[int, ndarray], Dict[int, ndarray], ndarray, ndarray, float64, float64, Dict[uint64, ndarray], Dict[uint64, ndarray], ndarray][source]

Perform the meshing process for cortical and trabecular volumes.

This function is the entry point for the meshing process, which includes reading image data, generating splines, performing sanity checks, and creating the mesh using Gmsh. It also handles the configuration of various meshing parameters and settings.

Returns:

A tuple containing the following elements:
  • nodes (Dict[uint64, ndarray]): Dictionary of node tags.

  • elms (Dict[uint64, ndarray]): Dictionary of element tags.

  • nb_nodes (int): Number of nodes in the model.

  • centroids_cort_dict (Dict[int, ndarray]): Dictionary of cortical element centroids.

  • centroids_trab_dict (Dict[int, ndarray]): Dictionary of trabecular element centroids.

  • elm_vol_cort (ndarray): Array of cortical element volumes.

  • elm_vol_trab (ndarray): Array of trabecular element volumes.

  • radius_roi_cort (float64): Radius of the largest cortical ROI in mm.

  • radius_roi_trab (float64): Radius of the largest trabecular ROI in mm.

  • bnds_bot (Dict[uint64, ndarray]): Dictionary of bottom boundary nodes.

  • bnds_top (Dict[uint64, ndarray]): Dictionary of top boundary nodes.

  • reference_point_coord (ndarray): Coordinates of the reference point in mm.

Return type:

Tuple

Raises:
  • AssertionError – If the number of volumes and centroids does not match.

  • RuntimeError – If negative element volumes are detected, which implies that the simulation would fail.