Meshes
qim3d.mesh
qim3d.mesh.from_volume
Convert a 3D numpy array to a mesh object using the volumetric_isocontour function from Pygel3D.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
volume |
ndarray
|
A 3D numpy array representing a volume. |
required |
mesh_precision |
float
|
Scaling factor for adjusting the resolution of the mesh. Default is 1.0 (no scaling). |
1.0
|
**kwargs |
any
|
Additional arguments to pass to the Pygel3D volumetric_isocontour function. |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
If the input volume is not a 3D numpy array or if the input volume is empty. |
Returns:
Type | Description |
---|---|
Manifold
|
hmesh.Manifold: A Pygel3D mesh object representing the input volume. |
Example
Convert a 3D numpy array to a Pygel3D mesh object:
import qim3d
# Generate a 3D blob
synthetic_blob = qim3d.generate.volume()
# Convert the 3D numpy array to a Pygel3D mesh object
mesh = qim3d.mesh.from_volume(synthetic_blob, mesh_precision=0.5)
# Visualize the generated mesh
qim3d.viz.mesh(mesh)
