labels_copy = labels_copy.astype(np.int32)
// New values for new ordering
label_values = np.unique(labels_copy)
for label in label_values[label_values != 0]:
maskim = (labels_copy == label)
out += peak_local_max(image * maskim, min_distance=min_distance,
threshold_abs=threshold_abs,
After Change
// operating on each label separately
if labels is not None:
labels = relabel_sequential(labels)[0]
for label in range(1, labels.max()+1):
maskim = labels == label
out += peak_local_max(image * maskim, min_distance=min_distance,
threshold_abs=threshold_abs,