spateo.tdr.models.models_individual.voxel
#
Module Contents#
Functions#
|
Voxelize the point cloud. |
|
Construct a volumetric mesh based on surface mesh. |
- spateo.tdr.models.models_individual.voxel.voxelize_pc(pc: pyvista.PolyData, voxel_size: numpy.ndarray | None = None) pyvista.UnstructuredGrid [source]#
Voxelize the point cloud.
- Parameters:
- pc
A point cloud model.
- voxel_size
The size of the voxelized points. The shape of voxel_size is (pc.n_points, 3).
- Returns:
A voxel model.
- Return type:
voxel
- spateo.tdr.models.models_individual.voxel.voxelize_mesh(mesh: pyvista.PolyData | pyvista.UnstructuredGrid, voxel_pc: pyvista.PolyData | pyvista.UnstructuredGrid = None, key_added: str = 'groups', label: str = 'voxel', color: str | None = 'gainsboro', alpha: float | int = 1.0, smooth: int | None = 200) Tuple[pyvista.UnstructuredGrid | Any, str | None] [source]#
Construct a volumetric mesh based on surface mesh.
- Parameters:
- mesh
A surface mesh model.
- voxel_pc
A voxel model which contains the
voxel_pc.cell_data['obs_index']
andvoxel_pc.cell_data[key_added]
.- key_added
The key under which to add the labels.
- label
The label of reconstructed voxel model.
- color
Color to use for plotting mesh. The default color is
'gainsboro'
.- alpha
The opacity of the color to use for plotting model. The default alpha is
0.8
.- smooth
The smoothness of the voxel model.
- Returns:
- A reconstructed voxel model, which contains the following properties:
voxel_model.cell_data[key_added], the label array; voxel_model.cell_data[f’{key_added}_rgba’], the rgba colors of the label array. voxel_model.cell_data[‘obs_index’], the cell labels if not (voxel_pc is None).
plot_cmap: Recommended colormap parameter values for plotting.
- Return type:
voxel_model