tumourkit.utils.nearest.get_N_closest_pairs_dists

tumourkit.utils.nearest.get_N_closest_pairs_dists(a: List[Tuple[float, float]], b: List[Tuple[float, float]], N: int, threshold: float | None = inf) List[float]

Returns the N closest pairs distances between two sets of points.

Parameters:
  • a (Contour) – The first set of points as a list of (x, y) tuples.

  • b (Contour) – The second set of points as a list of (x, y) tuples.

  • N (int) – The number of closest pairs to return.

  • threshold (float, optional) – An optional threshold to prune the search for distances greater than the threshold.

Returns:

A list of the N closest pairs distances between the two sets of points.

Return type:

List[float]

The function has a complexity of O((n+m)log(m)), where m is the maximum of the lengths of the two sets of points and n is the minimum.