local_thickness_imj#
Local-thickness variant that mimics the algorithm used by ImageJ: brute-force sphere insertion, but skipping voxels that are already engulfed by a previously inserted larger sphere. Faster than local_thickness_bf.
See the local_thickness notebook for a detailed walk-through of the shared concepts; this page focuses on the variant-specific arguments. The wrapper ps.filters.local_thickness dispatches to this function when its method argument selects this variant.
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.local_thickness_imj)
<Signature (im, dt=None, smooth=False, approx=False)>
im#
A boolean image with True indicating the void phase. Both 2D and 3D images are supported.
im = ps.generators.blobs(shape=[200, 200], porosity=0.6, seed=0)
lt = ps.filters.local_thickness_imj(im=im)
fig, ax = plt.subplots(figsize=[5, 5])
ax.imshow(lt / im, origin='lower', interpolation='none')
ax.axis(False);
dt#
Pre-computed distance transform of the void phase. Saves a small amount of time.
from porespy.tools import get_edt
dt = get_edt()(im)
lt = ps.filters.local_thickness_imj(im=im, dt=dt)
smooth#
Trims single-voxel protrusions from the inserted spheres.
lt_smooth = ps.filters.local_thickness_imj(im=im, smooth=True)
lt_rough = ps.filters.local_thickness_imj(im=im, smooth=False)
approx#
When True the algorithm uses a slightly more aggressive engulfment test that skips more voxels. The result is no longer guaranteed to match the reference implementation voxel-for-voxel, but is much faster on large images.
lt_exact = ps.filters.local_thickness_imj(im=im, approx=False)
lt_approx = ps.filters.local_thickness_imj(im=im, approx=True)