skan.pre: Image preprocessing#
-
skan.pre.
hyperball
(ndim, radius)[source]# Return a binary morphological filter containing pixels within radius.
- Parameters
ndim (int) – The number of dimensions of the filter.
radius (int) – The radius of the filter.
- Returns
ball – The required structural element
- Return type
array of bool, shape [2 * radius + 1,] * ndim
-
skan.pre.
threshold
(image, *, sigma=0.0, radius=0, offset=0.0, method='sauvola', smooth_method='Gaussian')[source]# Use scikit-image filters to “intelligently” threshold an image.
- Parameters
image (array, shape (M, N, ..[, 3])) – Input image, conformant with scikit-image data type specification 1.
sigma (float, optional) – If positive, use Gaussian filtering to smooth the image before thresholding.
radius (int, optional) – If given, use local median thresholding instead of global.
offset (float, optional) – If given, reduce the threshold by this amount. Higher values result in fewer pixels above the threshold.
method ({'sauvola', 'niblack', 'median'}) – Which method to use for thresholding. Sauvola is 100x faster, but median might be more accurate.
smooth_method ({'Gaussian', 'TV'}) – Which method to use for smoothing. Choose from Gaussian smoothing and total variation denoising.
- Returns
thresholded – The thresholded image.
- Return type
image of bool, same shape as image
References