Fixed bug in feature.peak_local_max: num_peaks should now be usable for ND arrays.

This commit is contained in:
kpk09
2015-01-25 00:19:12 +00:00
parent 22ffc20fc4
commit c5ac705123
+1 -1
View File
@@ -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]