spateo.tdr.morphometrics.shape_similarity#

Module Contents#

Functions#

rough_subspace(→ list)

Rough subspace segmentation.

subspace_surface_fitting(→ numpy.ndarray)

Determines the best fitting plane/surface over a set of 3D points based on ordinary least squares regression. Reference: https://gist.github.com/amroamroamro/1db8d69b4b65e8bc66a6

dist_global_centroid_to_subspace(→ numpy.ndarray)

Calculate the average distance from the centroid to the surface of subspace based on KDtree.

cos_global_centroid_to_subspace(→ numpy.ndarray)

Calculate the cosine of the included angle from the centroid to the pcs of subspace.

calculate_eigenvector(→ Tuple[numpy.ndarray, ...)

Calculate the subspace eigenvectors.

model_eigenvector(→ Tuple[numpy.ndarray, numpy.ndarray])

Calculate the subspace eigenvectors of the 3D point cloud model.

pairwise_shape_similarity(→ float)

Calculate the shape similarity of pairwise 3D point cloud models based on the eigenvectors of the 3D point cloud model subspace.

spateo.tdr.morphometrics.shape_similarity.rough_subspace(pcs: numpy.ndarray, n: int = 20) list[source]#

Rough subspace segmentation. Using the minimal spatial segmentation algorithm to divide points cloud into several subspace

spateo.tdr.morphometrics.shape_similarity.subspace_surface_fitting(pcs: numpy.ndarray, order: Literal[linear, quadratic, cubic] = 'linear') numpy.ndarray[source]#

Determines the best fitting plane/surface over a set of 3D points based on ordinary least squares regression. Reference: https://gist.github.com/amroamroamro/1db8d69b4b65e8bc66a6

spateo.tdr.morphometrics.shape_similarity.dist_global_centroid_to_subspace(centroid: tuple | list | numpy.ndarray, subspace_surface: numpy.ndarray, **kwargs) numpy.ndarray[source]#

Calculate the average distance from the centroid to the surface of subspace based on KDtree.

spateo.tdr.morphometrics.shape_similarity.cos_global_centroid_to_subspace(global_centroid: tuple | list | numpy.ndarray, subspace_pcs: numpy.ndarray) numpy.ndarray[source]#

Calculate the cosine of the included angle from the centroid to the pcs of subspace.

spateo.tdr.morphometrics.shape_similarity.calculate_eigenvector(vetorspaces: numpy.ndarray, m: int = 10, s: int = 5) Tuple[numpy.ndarray, numpy.ndarray][source]#

Calculate the subspace eigenvectors.

spateo.tdr.morphometrics.shape_similarity.model_eigenvector(model_pcs: numpy.ndarray, n_subspace: int = 20, m: int = 10, s: int = 5) Tuple[numpy.ndarray, numpy.ndarray][source]#

Calculate the subspace eigenvectors of the 3D point cloud model.

spateo.tdr.morphometrics.shape_similarity.pairwise_shape_similarity(model1_pcs: numpy.ndarray, model2_pcs: numpy.ndarray, n_subspace: int = 20, m: int = 10, s: int = 5) float[source]#

Calculate the shape similarity of pairwise 3D point cloud models based on the eigenvectors of the 3D point cloud model subspace. References: Hu Xiaotong, Wang Jiandong. Similarity analysis of three-dimensional point cloud based on eigenvector of subspace.

Parameters:
model1_pcs

The coordinates of the 3D point cloud model1.

model2_pcs

The coordinates of the 3D point cloud model2.

n_subspace

The number of subspaces initially divided is ``n_subspace``**3.

m

The number of eigenvalues contained in the eigenvector is m*s.

s

The number of eigenvalues contained in the eigenvector is m*s.

Returns:

Shape similarity score.

Return type:

similarity_score