fill_surface_pores#
Sets all surface pores in the input image to False. Surface pores are clusters of void that touch a face but do not span between opposite faces.
import matplotlib.pyplot as plt
import porespy as ps
ps.visualization.set_mpl_style()
The arguments and their defaults are:
import inspect
inspect.signature(ps.filters.fill_surface_pores)
<Signature (im: numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[~_ScalarT]], axis=None, conn: Literal['max', 'min'] = 'min')>
im#
A boolean image with True indicating the void phase. Surface pores are removed in-place semantics: a copy is made internally, but pass a copy if you want to preserve the original.
im = ps.generators.blobs(shape=[200, 200], porosity=0.5, seed=0)
filled = ps.filters.fill_surface_pores(im=im.copy())
fig, ax = plt.subplots(1, 2, figsize=[10, 5])
ax[0].imshow(im, origin='lower', interpolation='none')
ax[0].set_title('original')
ax[0].axis(False)
ax[1].imshow(filled, origin='lower', interpolation='none')
ax[1].set_title('after fill_surface_pores')
ax[1].axis(False);
axis#
Restricts the spanning test to a single direction. Only surface pores that fail to span along the chosen axis are filled.
filled_all = ps.filters.fill_surface_pores(im=im.copy())
filled_x = ps.filters.fill_surface_pores(im=im.copy(), axis=0)
fig, ax = plt.subplots(1, 2, figsize=[10, 5])
ax[0].imshow(filled_all, origin='lower', interpolation='none')
ax[0].set_title('axis = None')
ax[0].axis(False)
ax[1].imshow(filled_x, origin='lower', interpolation='none')
ax[1].set_title('axis = 0')
ax[1].axis(False);
conn#
Controls voxel connectivity. 'min' (default) requires shared faces; 'max' accepts edges and corners as well.
filled_min = ps.filters.fill_surface_pores(im=im.copy(), conn='min')
filled_max = ps.filters.fill_surface_pores(im=im.copy(), conn='max')
fig, ax = plt.subplots(1, 2, figsize=[10, 5])
ax[0].imshow(filled_min, origin='lower', interpolation='none')
ax[0].set_title("conn = 'min'")
ax[0].axis(False)
ax[1].imshow(filled_max, origin='lower', interpolation='none')
ax[1].set_title("conn = 'max'")
ax[1].axis(False);