From c5ac705123f302026dfbc3cc3353a8b3f38154bc Mon Sep 17 00:00:00 2001 From: kpk09 Date: Sun, 25 Jan 2015 00:19:12 +0000 Subject: [PATCH] Fixed bug in feature.peak_local_max: num_peaks should now be usable for ND arrays. --- skimage/feature/peak.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]