spateo.tdr.models.models_backbone.backbone_utils#

Module Contents#

Functions#

map_points_to_backbone(model, backbone_model[, ...])

Find the closest principal tree node to any point in the model through KDTree.

map_gene_to_backbone(model, tree, key[, nodes_key, ...])

Find the closest principal tree node to any point in the model through KDTree.

_euclidean_distance(N1, N2)

sort_nodes_of_curve(nodes, started_node)

spateo.tdr.models.models_backbone.backbone_utils.map_points_to_backbone(model: pyvista.PolyData | pyvista.UnstructuredGrid, backbone_model: pyvista.PolyData, nodes_key: str = 'nodes', key_added: str | None = 'nodes', inplace: bool = False, **kwargs)[source]#

Find the closest principal tree node to any point in the model through KDTree.

Parameters:
model

The reconstructed model.

backbone_model

The constructed backbone model.

nodes_key

The key that corresponds to the coordinates of the nodes in the backbone.

key_added

The key under which to add the nodes labels.

inplace

Updates model in-place.

**kwargs

Additional parameters that will be passed to scipy.spatial.KDTree. function.

Returns:

model.point_data[key_added], the nodes labels array.

Return type:

A model, which contains the following properties

spateo.tdr.models.models_backbone.backbone_utils.map_gene_to_backbone(model: pyvista.PolyData | pyvista.UnstructuredGrid, tree: pyvista.PolyData, key: str | list, nodes_key: str | None = 'nodes', inplace: bool = False)[source]#

Find the closest principal tree node to any point in the model through KDTree.

Parameters:
model

A reconstructed model contains the gene expression label.

tree

A three-dims principal tree model contains the nodes label.

key

The key that corresponds to the gene expression.

nodes_key

The key that corresponds to the coordinates of the nodes in the tree.

inplace

Updates tree model in-place.

Returns:

tree.point_data[key], the gene expression array.

Return type:

A tree, which contains the following properties

spateo.tdr.models.models_backbone.backbone_utils._euclidean_distance(N1, N2)[source]#
spateo.tdr.models.models_backbone.backbone_utils.sort_nodes_of_curve(nodes, started_node)[source]#