spateo.tdr.models.voxel#

Submodules#

Package Contents#

Functions#

voxelize_mesh(→ pyvista.UnstructuredGrid)

Construct a volumetric mesh based on surface mesh.

voxelize_pc(→ pyvista.UnstructuredGrid)

Voxelize the point cloud.

spateo.tdr.models.voxel.voxelize_mesh(mesh: Union[pyvista.PolyData, pyvista.UnstructuredGrid], voxel_pc: Union[pyvista.PolyData, pyvista.UnstructuredGrid] = None, key_added: str = 'groups', label: str = 'voxel', color: Optional[str] = 'gainsboro', alpha: Union[float, int] = 1.0, smooth: Optional[int] = 200) pyvista.UnstructuredGrid[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'] and voxel_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).

Return type

voxel_model

spateo.tdr.models.voxel.voxelize_pc(pc: pyvista.PolyData, voxel_size: Optional[numpy.ndarray] = 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