find_peaks(dt, r_max=4, strel=None, divs=1)[source]

Finds local maxima in the distance transform

  • dt (ND-array) – The distance transform of the pore space. This may be calculated and filtered using any means desired.

  • r_max (scalar) – The size of the structuring element used in the maximum filter. This controls the localness of any maxima. The default is 4 voxels.

  • strel (ND-array) – Specifies the shape of the structuring element used to define the neighborhood when looking for peaks. If None (the default) is specified then a spherical shape is used (or circular in 2D).

  • 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 in porespy.settings.ncores and defaults to all cores.


image – An array of booleans with True values at the location of any local maxima.

Return type



It is also possible ot the peak_local_max function from the skimage.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.