tumourkit.segmentation.hovernet.metrics.stats_utils.pair_coordinates

tumourkit.segmentation.hovernet.metrics.stats_utils.pair_coordinates(setA, setB, radius)

Use the Munkres or Kuhn-Munkres algorithm to find the most optimal unique pairing (largest possible match) when pairing points in set B against points in set A, using distance as cost function.

Args:
setA, setB: np.array (float32) of size Nx2 contains the of XY coordinate

of N different points

radius: valid area around a point in setA to consider

a given coordinate in setB a candidate for match

Return:

pairing: pairing is an array of indices where point at index pairing[0] in set A paired with point in set B at index pairing[1] unparedA, unpairedB: remaining poitn in set A and set B unpaired