find_peaks#
- find_peaks(dt, r_max=4, strel=None, sigma=None, divs=1)[source]#
Finds local maxima in the distance transform
- Parameters:
dt (ndarray) – The distance transform of the pore space. This may be calculated and filtered using any means desired.
r_max (scalar) – The radius of the spherical element used in the maximum filter. This controls the localness of any maxima. The default is 4 voxels.
strel (ndarray) – Instead of supplying
r_max
, this argument allows a custom structuring element allowing control over both size and shape.sigma (float or list of floats) – If given, then a gaussian filter is applied to the distance transform using this value for the kernel (i.e.
scipy.ndimage.gaussian_filter(dt, sigma)
)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 – An array of booleans with
True
values at the location of any local maxima.- Return type:
ndarray
Notes
It is also possible ot the
peak_local_max
function from theskimage.feature
module as follows:peaks = peak_local_max(image=dt, min_distance=r, exclude_border=0, indices=False)
The skimage function automatically uses a square structuring element which is significantly faster than using a circular or spherical element.
Examples
Click here to view online example.