reduce_peaks

Import packages

[3]:
import numpy as np
import porespy as ps
import scipy.ndimage as spim
import matplotlib.pyplot as plt
import skimage
from edt import edt

np.random.seed(0)
ps.visualization.set_mpl_style()

Generate image for testing

[4]:
im = ps.generators.blobs(shape=[200, 200])
dt = edt(im)
peaks = ps.filters.find_peaks(dt, r_max=4)

plt.figure(figsize=[4, 4])
plt.axis(False)
plt.imshow(peaks/im);
../../../_images/examples_filters_howtos_reduce_peaks_4_0.svg

Apply filter function

[5]:
x = ps.filters.reduce_peaks(peaks=peaks)
plt.figure(figsize=[4, 4])
plt.axis(False)
plt.imshow(x/im);
../../../_images/examples_filters_howtos_reduce_peaks_6_0.svg