spateo.tdr.models.utilities.label_utils#

Module Contents#

Functions#

add_model_labels(...)

Add rgba color to each point of model based on labels.

spateo.tdr.models.utilities.label_utils.add_model_labels(model: pyvista.PolyData | pyvista.UnstructuredGrid, labels: numpy.ndarray, key_added: str = 'groups', where: Literal[point_data, cell_data] = 'cell_data', colormap: str | list | dict | numpy.ndarray = 'rainbow', alphamap: float | list | dict | numpy.ndarray = 1.0, mask_color: str | None = 'gainsboro', mask_alpha: float | None = 0.0, inplace: bool = False) Tuple[Optional[PolyData or UnstructuredGrid], Optional[Union[str]]][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] or model.point_data[key_added], the labels array;

model.cell_data[f'{key_added}_rgba'] or model.point_data[f'{key_added}_rgba'], the rgba colors of the labels.

plot_cmap: Recommended colormap parameter values for plotting.

Return type:

A model, which contains the following properties