Meshes
qim3d.mesh
qim3d.mesh.from_volume
Convert a volume to a mesh using the Marching Cubes algorithm, with optional thresholding and padding.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
volume |
ndarray
|
The 3D numpy array representing the volume. |
required |
level |
float
|
The threshold value for Marching Cubes. If None, Otsu's method is used. |
None
|
step_size |
int
|
The step size for the Marching Cubes algorithm. |
1
|
allow_degenerate |
bool
|
Whether to allow degenerate (i.e. zero-area) triangles in the end-result. If False, degenerate triangles are removed, at the cost of making the algorithm slower. Default False. |
False
|
padding |
tuple of ints
|
Padding to add around the volume. |
(2, 2, 2)
|
**kwargs |
Any
|
Additional keyword arguments to pass to |
{}
|
Returns:
Name | Type | Description |
---|---|---|
mesh |
Trimesh
|
The generated mesh. |