- distance_transform_lin(im, axis=0, mode='both')[source]#
Replaces each void voxel with the linear distance to the nearest solid voxel along the specified axis.
im (ndarray) – The image of the porous material with
Truevalues indicating the void phase (or phase of interest).
axis (int) – The direction along which the distance should be measured, the default is 0 (i.e. along the x-direction).
mode (str) –
Controls how the distance is measured. Options are:
Distances are measured in the increasing direction along the specified axis
Distances are measured in the reverse direction. ‘backward’ is also accepted.
Distances are calculated in both directions (by recursively calling itself), then reporting the minimum value of the two results.
image – A copy of
imwith each foreground voxel containing the distance to the nearest background along the specified axis.
- Return type:
Click here to view online example.