mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-09 11:33:41 +08:00
Using numpy.argwhere makes code easier to read
This commit is contained in:
@@ -146,7 +146,7 @@ def peak_local_max(image, min_distance=10, threshold_abs=0, threshold_rel=0.1,
|
||||
peak_threshold = max(np.max(image.ravel()) * threshold_rel, threshold_abs)
|
||||
|
||||
# get coordinates of peaks
|
||||
coordinates = np.transpose((image > peak_threshold).nonzero())
|
||||
coordinates = np.argwhere(image > peak_threshold)
|
||||
|
||||
if coordinates.shape[0] > num_peaks:
|
||||
intensities = image.flat[np.ravel_multi_index(coordinates.transpose(),image.shape)]
|
||||
|
||||
Reference in New Issue
Block a user