morphogen.mesh.voxel

Hexahedral (voxel) finite-element meshes of voxel images.

morphogen.mesh.voxel.HEX_CORNERS = array([[0, 0, 0],        [1, 0, 0],        [1, 1, 0],        [0, 1, 0],        [0, 0, 1],        [1, 0, 1],        [1, 1, 1],        [0, 1, 1]])

Corner offsets of a hexahedron in VTK / Abaqus / Gmsh order.

morphogen.mesh.voxel.HEX_FACES = {'x0': (0, 4, 7, 3), 'x1': (1, 2, 6, 5), 'y0': (0, 1, 5, 4), 'y1': (3, 7, 6, 2), 'z0': (0, 3, 2, 1), 'z1': (4, 5, 6, 7)}

Local nodes of the hexahedron faces lying on each face of the box (outward normals).

class morphogen.mesh.voxel.VoxelMesh(nodes: ~numpy.ndarray, elements: ~numpy.ndarray, phase: ~numpy.ndarray, label: ~numpy.ndarray | None, node_ijk: ~numpy.ndarray, element_ijk: ~numpy.ndarray, grid_shape: tuple[int, int, int], spacing: tuple[float, float, float], node_sets: dict[str, ~numpy.ndarray] = <factory>, metadata: dict = <factory>)[source]

Bases: object

One 8-node hexahedron per selected voxel.

nodes are numbered from 0 here; writers shift to 1-based numbering when the format requires it. node_sets holds the nodes on the six faces of the box.

property n_nodes: int
property n_elements: int
volume() → float[source]
element_sets() → dict[str, ndarray][source]

Elements of each phase, named phase_<p>.

periodic_pairs(axis: int) → ndarray[source]

Pairs (node on the lower face, node on the upper face) facing each other.

boundary_faces(face: str) → ndarray[source]

Quadrilaterals (node indices) of the element faces lying on a box face.

morphogen.mesh.voxel.voxel_mesh(image: VoxelImage, phases=None, *, labels: VoxelImage | None = None) → VoxelMesh[source]

Mesh the voxels of image whose value is in phases (default: all voxels).

labels (e.g. the cell labels of a tessellation) are attached to the elements.