fill_closed_pores
#
Remove any isolated void space (not connected to the boundary) from the image which is often needed such as for network extraction or direct numerical simulations
import matplotlib.pyplot as plt
import numpy as np
import porespy as ps
ps.visualization.set_mpl_style()
im
#
The void phase is indicated by True
values. Blind pores are considered as any cluster of void voxels not connected to the boundary of the image.
np.random.seed(2)
im = ps.generators.blobs([100, 100], porosity=0.5)
im1 = ps.filters.fill_closed_pores(im)
fig, ax = plt.subplots(1, 2, figsize=[12, 6])
ax[0].imshow(im, origin='lower', interpolation='none')
ax[0].axis(False)
ax[1].imshow(im1, origin='lower', interpolation='none')
ax[1].axis(False);
conn
#
Controls how ‘connected’ a group of voxels must be. The options are 'min'
which means voxels are only considered connected if they share a face, and 'max'
which means voxels are connected if they share a face, edge or corner.
im1 = ps.filters.fill_closed_pores(im=im, conn='min')
im2 = ps.filters.fill_closed_pores(im=im, conn='max')
fig, ax = plt.subplots(1, 2, figsize=[12, 6])
ax[0].imshow(im1, origin='lower', interpolation='none')
ax[0].axis(False)
ax[0].set_title('conn = 4')
ax[1].imshow(im2, origin='lower', interpolation='none')
ax[1].axis(False)
ax[1].set_title('conn = 8');