diff --git a/skimage/feature/peak.py b/skimage/feature/peak.py index e70f6df1..7580efc2 100644 --- a/skimage/feature/peak.py +++ b/skimage/feature/peak.py @@ -149,7 +149,7 @@ def peak_local_max(image, min_distance=10, threshold_abs=0, threshold_rel=0.1, coordinates = np.transpose((image > peak_threshold).nonzero()) if coordinates.shape[0] > num_peaks: - intensities = image[coordinates[:, 0], coordinates[:, 1]] + intensities = image.flat[np.ravel_multi_index(coordinates.transpose(),image.shape)] idx_maxsort = np.argsort(intensities)[::-1] coordinates = coordinates[idx_maxsort][:num_peaks]