Fix coordinate extraction

This commit is contained in:
Johannes Schönberger
2016-01-29 09:26:12 +01:00
parent bd2ecff62f
commit fe9d7c73a1
+3 -2
View File
@@ -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]