porespy.filters.local_thickness#
- porespy.filters.local_thickness(im: numpy.typing.NDArray, dt: numpy.typing.NDArray = None, method: Literal['bf', 'conv', 'dt', 'legacy'] = 'bf', smooth: bool = True, mask: numpy.typing.NDArray = None, approx: bool = False, sizes: int = _DEFAULT_SIZES, return_indices: bool = False)#
Insert a maximally inscribed sphere at every pixel labelled by sphere radius
This is a wrapper method for computing local thickness via a variety of different methods.
- Parameters:
im (ndarray) – Boolean image of the porous material
dt (ndarray, optional) – The distance transform of the image
method (str) –
Which method to use to compute the local thickness. Options are:
Method
Description
’dt’
Uses distance transforms to perform erosion and dilation for each radius in the image
’bf’
Uses brute-force to inserts spheres at each voxel
’conv’
Uses FFT-based convolution to perform erosion and dilation for each radius in the image
’legacy’
Reproduces the former fractional-radius distance-transform method
sizes (array_like or scalar) – The positive integer radii to evaluate. If an integer N is provided, up to N integer radii are selected at evenly spaced intervals between 1 and
floor(dt.max()). If omitted or None, every integer radius in that range is used. Formethod='legacy', omitting this argument uses the former default of 25 logarithmically-spaced fractional radii; an explicit None uses all unique distance-transform values.smooth (bool, optional) – Indicates if protrusions should be removed from the faces of the spheres or not. Default is True.
mask (ndarray, optional) – This is only used if the method is bf or imj. A boolean mask indicating which sites to insert spheres at. If not provided then all True values in im are used.
approx (bool, optional) – Retained for compatibility with imj and has no effect.
return_indices (bool, optional) – If True, return
(sizes, indices)instead of a float image, wheresizes[indices]reconstructs the usual result. The index image uses the smallest suitable unsigned integer dtype. Default is False.
- Returns:
lt – The local thickness of the image with each voxel labelled according to the radius of the largest sphere which overlaps it, or
(sizes, indices)when return_indices is True.- Return type:
ndarray or tuple[ndarray, ndarray]
Examples
Click here to view online example.