src.clustering.clusterer

Classes

Clusterer(**kwargs)

Exceptions

ClusteringException([message])

exception src.clustering.clusterer.ClusteringException(message='')
Author:

Alberto M. Esmoris Pena

Class for exceptions related to clustering components See VL3DException.

__init__(message='')
class src.clustering.clusterer.Clusterer(**kwargs)
Author:

Alberto M. Esmoris Pena.

Interface governing any clustering component.

Variables:
  • cluster_name (str) – The name for the computed clusters. It will be used to reference the cluster column in the output point cloud.

  • post_clustering (None or list of callable)

static extract_clustering_args(spec)

Extract the arguments to initialize/instantiate a Clusterer from a key-word specification.

Parameters:

spec – The key-word specification containing the arguments.

Returns:

The arguments to initialize/instantiate a Clusterer.

__init__(**kwargs)

Initialize a Clusterer.

Parameters:

kwargs – The key-word arguments for the initialization of any Clusterer. It must contain the name of the cluster to be computed.

fit(pcloud)

Fit a clustering model to a given input point cloud.

Parameters:

pcloud – The input point cloud to be used to fit the clustering model.

Returns:

The clusterer itself, for fluent programming purposes.

Return type:

Clusteror

abstractmethod cluster(pcloud)

Clustering from a given input point cloud.

Parameters:

pcloud – The input point cloud for which clusters must be found.

Returns:

The point cloud extended with the clusters.

Return type:

PointCloud

post_process(pcloud)

Run the post-processing pipeline on the given input point cloud.

Parameters:

pcloud (PointCloud) – The input point cloud for the components in the post-processing pipeline.

Returns:

The post-processed point cloud. Sometimes it will be exactly the same input point cloud because some post-processing components generate their output directly to a file.

Return type:

PointCloud

fit_cluster_and_post_process(pcloud, out_prefix=None)

Compute the fitting, clustering, and post-processing as a whole.

See Clusterer.fit(), Clusterer.cluster(), and Clusterer.post_process().

Parameters:
  • pcloud (PointCloud) – The input point cloud to be used to fit the clustering model.

  • out_prefix (str or None) – If given, it will be used to replace the default output prefix of the clusterer inside the call’s context.

Returns:

The point cloud extended with the clusters.

Return type:

PointCloud

add_cluster_labels_to_point_cloud(pcloud, c)

Add given cluster labels to the given point cloud. If the feature already exists then it is updated.

Parameters:
  • pcloud (PointCloud) – The point cloud to which the cluster labels must be added.

  • c (np.ndarray) – The cluster labels.

Returns:

The input point cloud (updated inplace to add the cluster labels).

Return type:

PointCloud