mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-08 16:16:31 +08:00
Fixed bug in feature.peak_local_max: num_peaks should now be usable for ND arrays.
This commit is contained in:
@@ -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]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user