added explanations to docstring and automatic conversion to float for a boolean input [ci skip]
@@ -94,10 +94,20 @@ def hold_peaks(im, axis=-1):
Parameters
----------
- im : ND-image
- A greyscale image whose peaks are to
+ im : ND-array
+ A greyscale image whose peaks are to be kept and extended throughout a
+ given axis.
+
+ Note: im must be a greyscale image. In case a Boolean image is fed into this
+ method, it will be first converted to float values [0.0,1.0] before proceeding.
+
+ Returns
+ -------
+ result : ND-array
+ A copy of ``im`` with each voxel is replaced with the highest value along
+ the given axis
"""
- A = im
+ A = im.astype(float)
B = np.swapaxes(A, axis, -1)
updown = np.empty((*B.shape[:-1], B.shape[-1] + 1), B.dtype)
updown[..., 0], updown[..., -1] = -1, -1
