TracktableAnalysis module

Module contents

template<class SearchBoxT, class PointIteratorT, class OutputIteratorT>
int tracktable::cluster_with_dbscan(PointIteratorT input_begin, PointIteratorT input_end, SearchBoxT search_box_half_span, int minimum_cluster_size, OutputIteratorT output_sink)

Generate cluster labels for a set of points.

This function runs DBSCAN on a list of points and returns its results as a vector of integers, one for each input point.

When you call cluster_with_dbscan you must indicate the type of point (and thus the coordinate space) that you want to use for the clustering. This lets you choose (for example) to run in Cartesian space rather than longitude/latitude space if you’re sure your points don’t run into the poles or the longitude discontinuity at +/= 180.

Here’s an example::

typedef tracktable::cartesian2d::BasePoint point2d; std::vector<tracktable::cartesian2d::BasePoint> my_points; std::vector<std::pair<int, int>> cluster_labels; point2d search_box(0.5, 0.5); int min_cluster_size = 10;

int num_clusters = cluster_with_dbscan<point2d>( my_points.begin(), my_points.end(), search_box, min_cluster_size, std::back_inserter(cluster_labels) );

The search box must be specified in the coordinate system in which you want to do the clustering.

You can also pass in points as a std::pair<MyPoint, Foo> where Foo is your own arbitrary ID. In that case, the returned labels will be (Foo, int).

Return

Number of clusters discovered

Parameters
  • [in] input_begin: Iterator for beginning of input points

  • [in] input_end: Iterator for end of input points

  • [in] search_box_half_span: Distance defining “nearby” in all dimensions

  • [in] minimum_cluster_size: Minimum number of neighbors for core points

  • [out] output_cluster_labels: (Vertex ID, Cluster ID) for each point