find_surface_pores#

Locates clusters of void voxels that touch a surface but do not span the domain 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.find_surface_pores)
<Signature (im: NDArray, axis: int = None, conn: Literal['max', 'min'] = 'min')>

im#

A boolean image with True indicating the void phase. By default surface pores are clusters that touch some face but not opposite faces in any direction.

im = ps.generators.blobs(shape=[200, 200], porosity=0.5, seed=0)
surf = ps.filters.find_surface_pores(im=im)

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(surf, origin='lower', interpolation='none')
ax[1].set_title('surface pores')
ax[1].axis(False);
../../../_images/31236a69ae95b2a0fe3e3c107c27e8f3b6d9a97d4d31c8e62a8417e94c4d4d05.png

axis#

Restricts the test to a single direction. With axis=0 a cluster is considered spanning only if it touches both im[0, ...] and im[-1, ...]; clusters that touch a face but do not span are flagged as surface pores.

surf_all = ps.filters.find_surface_pores(im=im)
surf_x = ps.filters.find_surface_pores(im=im, axis=0)
surf_y = ps.filters.find_surface_pores(im=im, axis=1)

fig, ax = plt.subplots(1, 3, figsize=[15, 5])
ax[0].imshow(surf_all, origin='lower', interpolation='none')
ax[0].set_title('axis = None')
ax[0].axis(False)
ax[1].imshow(surf_x, origin='lower', interpolation='none')
ax[1].set_title('axis = 0')
ax[1].axis(False)
ax[2].imshow(surf_y, origin='lower', interpolation='none')
ax[2].set_title('axis = 1')
ax[2].axis(False);
../../../_images/fe27b18f52d1cc131d5f3b86fb673d5c8d4cb4bbc95c0d1b133f9cf1d8e2d5e5.png

conn#

Controls voxel connectivity. 'min' (default) means voxels must share a face to be connected; 'max' also accepts edges and corners.

surf_min = ps.filters.find_surface_pores(im=im, conn='min')
surf_max = ps.filters.find_surface_pores(im=im, conn='max')

fig, ax = plt.subplots(1, 2, figsize=[10, 5])
ax[0].imshow(surf_min, origin='lower', interpolation='none')
ax[0].set_title("conn = 'min'")
ax[0].axis(False)
ax[1].imshow(surf_max, origin='lower', interpolation='none')
ax[1].set_title("conn = 'max'")
ax[1].axis(False);
../../../_images/6069901b52e4e9534e23b4d725ea77766527d3f42b8ced1c98bfc0bf86404d18.png