abagen.matching.closest_centroid

abagen.matching.closest_centroid(coords, centroids, return_dist=False)[source]

Returns index of centroids closest to coords (Euclidean distance)

Parameters:
  • coord ((S, 3) array_like) – Coordinates of samples

  • centroids ((N, 3) array_like) – Centroids of parcels

  • return_dist (bool, optional) – Whether to also return distance of closest centroid

Returns:

  • closest ((S,) np.ndarray) – Indices of closest centroid in centroids to coords

  • distance ((S,) np.ndarray) – Distances of closest centroid in centroids to coords. Only returned if return_dist=True