reduce_peaks#

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

Import packages#

import matplotlib.pyplot as plt
import numpy as np
from edt import edt

import porespy as ps

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/28b68f474c088023ba666ef5a735473d3cb576ca7a10fb77a1bd8b22ec168ebb.png

Apply reduce_peaks filter#

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