nanomesh.image2mesh.mesher3d
Classes:
|
Container for bounding box coordinates. |
Functions:
|
Get region markers describing the featuers in the volume. |
|
Pad a contour triangle mesh (3D). |
|
Generate a tetrahedral mesh from a 3D segmented image. |
- class nanomesh.image2mesh._mesher3d.BoundingBox(xmin: float, xmax: float, ymin: float, ymax: float, zmin: float, zmax: float)[source]
Bases:
object
Container for bounding box coordinates.
Attributes:
Return center of the bounding box.
Return dimensions of bounding box.
Methods:
from_points
(points)Generate bounding box from set of points or coordinates.
from_shape
(shape)Generate bounding box from data shape.
Return (m,3) array with corner points.
- nanomesh.image2mesh._mesher3d.get_region_markers(vol: Union[Volume, ndarray]) RegionMarkerList [source]
Get region markers describing the featuers in the volume.
The array will be labeled, and points inside the labeled region will be obtained using the skeletonize function. The region markers can be used to flood the connected regions in the tetrahedralization step.
- Parameters
vol (Union[Volume, np.ndarray]) – Segmented integer volume.
- Returns
region_markers – List of tuples. The first element is the label in the source image, and the second the pixel coordinates somewhere in the center of the corresponding region.
- Return type
List[RegionMArker]
- nanomesh.image2mesh._mesher3d.pad(mesh: TriangleMesh, *, side: str, width: int, label: int = None, name: str = None) TriangleMesh [source]
Pad a contour triangle mesh (3D).
Note that tetgen will assign a different label for physically separate regions, even when they are given the same label/name.
- Parameters
mesh (TriangleMesh) – The mesh to pad.
side (str) – Side to pad, must be one of left, right, top, bottom, back, front.
width (int) – Width of the padded area.
label (int, optional) – The label to assign to the padded area. If not defined, generates the next unique label based on the existing ones.
name (str, optional) – Name of the added region. Note that in case of conflicts, the label takes presedence over the name.
- Returns
new_mesh – Padded contour triangle mesh.
- Return type
- Raises
ValueError – When the value of side is invalid.
- nanomesh.image2mesh._mesher3d.volume2mesh(image: np.ndarray | Volume, *, level: float = None, **kwargs) MeshContainer [source]
Generate a tetrahedral mesh from a 3D segmented image.
- Parameters
image ((i,j,k) numpy.ndarray or Volume) – Input image to mesh.
level (float, optional) – Contour value to search for isosurfaces (i.e. the threshold value). By default takes the average of the min and max value. Can be ignored if a binary image is passed as image.
**kwargs – Optional keyword arguments passed to
tetrahedralize()
- Returns
volume_mesh – Instance of
MeshContainer
- Return type