local_thickness¶

local_thickness
(im, sizes=25, mode='hybrid', divs=1)[source]¶ For each voxel, this function calculates the radius of the largest sphere that both engulfs the voxel and fits entirely within the foreground.
This is not the same as a simple distance transform, which finds the largest sphere that could be centered on each voxel.
 Parameters:
im (ndarray) – A binary image with the phase of interest set to True
sizes (array_like or scalar) – The sizes to invade. If a list of values of provided they are used directly. If a scalar is provided then that number of points spanning the min and max of the distance transform are used.
mode (str) –
Controls with method is used to compute the result. Options are:
 ’hybrid’
(default) Performs a distance transform of the void space, thresholds to find voxels larger than
sizes[i]
, trims the resulting mask ifaccess_limitations
isTrue
, then dilates it using the efficient fftmethod to obtain the nonwetting fluid configuration. ’dt’
Same as ‘hybrid’, except uses a second distance transform, relative to the thresholded mask, to find the invading fluid configuration. The choice of ‘dt’ or ‘hybrid’ depends on speed, which is system and installation specific.
 ’mio’
Using a single morphological image opening step to obtain the invading fluid confirguration directly, then trims if
access_limitations
isTrue
. This method is not ideal and is included for comparison purposes.
divs (int or array_like) – The number of times to divide the image for parallel processing. If
1
then parallel processing does not occur.2
is equivalent to[2, 2, 2]
for a 3D image. The number of cores used is specified inporespy.settings.ncores
and defaults to all cores.
 Returns:
image – A copy of
im
with the pore size values in each voxel. Return type:
ndarray
See also
Notes
The term foreground is used since this function can be applied to both pore space or the solid, whichever is set to
True
.This function is identical to
porosimetry
withaccess_limited
set toFalse
.The way local thickness is found in PoreSpy differs from the traditional method (i.e. used in ImageJ https://imagej.net/Local_Thickness). Our approach is probably slower, but it allows for the same code to be used for
local_thickness
andporosimetry
, since we can ‘trim’ invaded regions that are not connected to the inlets in theporosimetry
function. This is not needed inlocal_thickness
however.Examples
Click here to view online example.