spateo.tdr.models.utilities.label_utils
#
Module Contents#
Functions#
|
Add rgba color to each point of model based on labels. |
- spateo.tdr.models.utilities.label_utils.add_model_labels(model: Union[pyvista.PolyData, pyvista.UnstructuredGrid, pyvista.UniformGrid], labels: numpy.ndarray, key_added: str = 'groups', where: Literal[point_data, cell_data] = 'cell_data', colormap: Union[str, list, dict, numpy.ndarray] = 'rainbow', alphamap: Union[float, list, dict, numpy.ndarray] = 1.0, mask_color: Optional[str] = 'gainsboro', mask_alpha: Optional[float] = 0.0, inplace: bool = False) PolyData or UnstructuredGrid [source]#
Add rgba color to each point of model based on labels.
- Parameters
- model
A reconstructed model.
- labels
An array of labels of interest.
- key_added
The key under which to add the labels.
- where
The location where the label information is recorded in the model.
- colormap
Colors to use for plotting data.
- alphamap
The opacity of the color to use for plotting data.
- mask_color
Color to use for plotting mask information.
- mask_alpha
The opacity of the color to use for plotting mask information.
- inplace
Updates model in-place.
- Returns
model.cell_data[key_added]
ormodel.point_data[key_added]
, the labels array;model.cell_data[f'{key_added}_rgba']
ormodel.point_data[f'{key_added}_rgba']
, the rgba colors of the labels.- Return type
A model, which contains the following properties