tumourkit.utils.nearest.get_N_closest_pairs_idx
- tumourkit.utils.nearest.get_N_closest_pairs_idx(a: List[Tuple[float, float]], b: List[Tuple[float, float]], N: int, threshold: float | None = inf) Tuple[List[int], List[int]]
Returns the indices of the N closest pairs of points 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 tuple containing two lists of indices, one for each set of points, of the N closest pairs of points between the two sets.
- Return type:
Tuple(List[int], List[int])
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.