spateo.tdr.morphometrics.morphology#

Module Contents#

Functions#

model_morphology(→ Dict[str, Union[float, Any]])

Return the basic morphological characteristics of model,

pc_KDE(→ Tuple[Union[pyvista.DataSet, ...)

Calculate the kernel density of a 3D point cloud model.

spateo.tdr.morphometrics.morphology.model_morphology(model: pyvista.PolyData | pyvista.UnstructuredGrid, pc: Optional[PolyData or UnstructuredGrid] = None) Dict[str, float | Any][source]#

Return the basic morphological characteristics of model, including model volume, model surface area, volume / surface area ratio,etc.

Parameters:
model

A reconstructed surface model or volume model.

pc

A point cloud representing the number of cells.

Returns:

A dictionary containing the following model morphological features:

morphology[‘Length(x)’]: Length (x) of model. morphology[‘Width(y)’]: Width (y) of model. morphology[‘Height(z)’]: Height (z) of model. morphology[‘Surface_area’]: Surface area of model. morphology[‘Volume’]: Volume of model. morphology[‘V/SA_ratio’]: Volume / surface area ratio of model; morphology[‘cell_density’]: Cell density of model.

Return type:

morphology

spateo.tdr.morphometrics.morphology.pc_KDE(pc: pyvista.PolyData, key_added: str = 'kde', kernel: str = 'gaussian', bandwidth: float = 1.0, colormap: str | list | dict = 'hot_r', alphamap: float | list | dict = 1.0, inplace: bool = False) Tuple[pyvista.DataSet | pyvista.PolyData | None, str | None][source]#

Calculate the kernel density of a 3D point cloud model.

Parameters:
pc

A point cloud model.

key_added

The key under which to add the labels.

kernel

The kernel to use. Available kernel are: * ‘gaussian’ * ‘tophat’ * ‘epanechnikov’ * ‘exponential’ * ‘linear’ * ‘cosine’

bandwidth

The bandwidth of the kernel.

colormap

Colors to use for plotting pcd. The default colormap is ‘hot_r’.

alphamap

The opacity of the colors to use for plotting pcd. The default alphamap is 1.0.

inplace

Updates model in-place.

Returns:

Reconstructed 3D point cloud, which contains the following properties:

pc[key_added], the kernel density.

plot_cmap: Recommended colormap parameter values for plotting.

Return type:

pc