morphogen.mesh.surface

Triangulated surfaces extracted from level-set or phase images (marching cubes).

class morphogen.mesh.surface.SurfaceMesh(vertices: 'np.ndarray', faces: 'np.ndarray')[source]

Bases: object

face_normals() → ndarray[source]
area() → float[source]
volume() → float[source]

Enclosed volume (divergence theorem; positive for outward-oriented surfaces).

morphogen.mesh.surface.surface_mesh(image: VoxelImage, *, level: float = 0.0, phase: int = 1, closed: bool = True) → SurfaceMesh[source]

Surface of phase 1 from a level-set image (negative inside) or a phase image.

Phase images (integers) and partial-volume images (floats named fraction) are converted to 0.5 - indicator. With closed=True the solid is closed by caps on the faces of the box (watertight surface, e.g. for additive manufacturing).