trim_nearby_peaks#
- trim_nearby_peaks(peaks, dt, f=1)[source]#
Removes peaks that are nearer to another peak than to solid
- Parameters:
peaks (ndarray) – A image containing nonzeros values indicating peaks in the distance transform (
dt
). Ifpeaks
is boolean, a boolean is returned; ifpeaks
have already been labelled, then the original labels are returned, missing the trimmed peaks.dt (ndarray) – The distance transform of the pore space
f (scalar) – Controls how close peaks must be before they are considered near to each other. Sets of peaks are tagged as too near if
d_neighbor < f * d_solid
.
- Returns:
image – An array the same size and type as
peaks
containing a subset of the peaks in the original image.- Return type:
ndarray
Notes
Each pair of peaks is considered simultaneously, so for a triplet of nearby peaks, each pair is considered. This ensures that only the single peak that is furthest from the solid is kept. No iteration is required.
References
[1] Gostick, J. “A versatile and efficient network extraction algorithm using marker-based watershed segmenation”. Physical Review E. (2017)
Examples
Click here to view online example.