From fe9d7c73a1f8a9a46e83b9e6fabdb812d6ab6388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Sun, 24 Jan 2016 10:27:44 +0100 Subject: [PATCH] Fix coordinate extraction --- skimage/feature/peak.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/skimage/feature/peak.py b/skimage/feature/peak.py index 8bac92bf..dd4c824c 100644 --- a/skimage/feature/peak.py +++ b/skimage/feature/peak.py @@ -151,10 +151,11 @@ def peak_local_max(image, min_distance=1, threshold_abs=None, mask &= image > max(thresholds) # get coordinates of peaks - coordinates = np.argwhere(image > peak_threshold) + coordinates = np.transpose(mask.nonzero()) if coordinates.shape[0] > num_peaks: - intensities = image.flat[np.ravel_multi_index(coordinates.transpose(),image.shape)] + intensities = image.flat[np.ravel_multi_index(coordinates.transpose(), + image.shape)] idx_maxsort = np.argsort(intensities)[::-1] coordinates = coordinates[idx_maxsort][:num_peaks]