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)
[17:44:24] ERROR    PARDISO solver not installed, run `pip install pypardiso`. Otherwise,          _workspace.py:56
                    simulations will be slow. Apple M chips not supported.                                         

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/e97ad1ff6ff2088e6e481064d87de40cefd382888ffdc1947b55cc76137ae607.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/7cdcbc0bfd3d3daf793ff2ade73c4eefb7aa82c803400bb4b15d9fa552f17bed.png