find_dt_artifacts#

Labels voxels that are closer to the image boundary than to a solid. These are potentially artifacts since solid voxels could potentially lie just beyond the boundary but were cropped.

import inspect

import matplotlib.pyplot as plt
import scipy.ndimage as spim

import porespy as ps

ps.visualization.set_mpl_style()
inspect.signature(ps.filters.find_dt_artifacts)
<Signature (dt: numpy.ndarray[typing.Any, numpy.dtype[+_ScalarType_co]])>

dt#

This function only accepts 1 argument, the distance tranform.

im = ps.generators.blobs(shape=[500, 500])
dt = spim.distance_transform_edt(im)
dt2 = ps.filters.find_dt_artifacts(dt=dt)
fig, ax = plt.subplots(1, 2, figsize=[12, 6])
ax[0].imshow(dt, interpolation='none', origin='lower')
ax[0].axis(False)
ax[1].imshow(dt2/im, interpolation='none', origin='lower')
ax[1].axis(False);