reduce_peaks#

Broad or elongated peaks are replaced with single peaks located at the centre of original voxels

Import packages#

import numpy as np
import porespy as ps
import scipy.ndimage as spim
import matplotlib.pyplot as plt
import skimage
from edt import edt
ps.visualization.set_mpl_style()
np.random.seed(0)

peaks#

Find peaks on the test image

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

plt.figure(figsize=[6, 6])
plt.axis(False)
plt.imshow(peaks/im);
../../../_images/36866b0e662a106c54df6554520bbe49101c311c782ac99299013fbba5e9bdb0.svg

Apply reduce_peaks filter#

x = ps.filters.reduce_peaks(peaks=peaks)
plt.figure(figsize=[6, 6])
plt.axis(False)
plt.imshow(x/im);
../../../_images/84fc79ca5a8fa4ea3142d028d80a16d9655f59af29bdbaec3fb13e58bcd68a24.svg