diff --git a/skimage/measure/_sum_blocks.py b/skimage/measure/_sum_blocks.py index e6a478e5..b349f3e6 100644 --- a/skimage/measure/_sum_blocks.py +++ b/skimage/measure/_sum_blocks.py @@ -5,6 +5,12 @@ def sum_blocks(array, factors): """Sums the elements in blocks of integer factors and pads the original array with zeroes if the dimensions are not perfectly divisible by factors. + This function is different from resize and rescale in transform._warps in + the sense that they use interpolation to upsample or downsample on a 2D + array, while this function performs only dawnsampling but on any + n-dimensional array and returns the sum of elements in a block of size + factors in the original array. + Parameters ---------- array : ndarray diff --git a/skimage/transform/_warps.py b/skimage/transform/_warps.py index cca5d1d9..487ed760 100644 --- a/skimage/transform/_warps.py +++ b/skimage/transform/_warps.py @@ -8,6 +8,12 @@ from skimage.util.shape import view_as_blocks, _pad_asymmetric_zeros def resize(image, output_shape, order=1, mode='constant', cval=0.): """Resize image to match a certain size. + Resize performs interpolation to upsample or downsample 2D arrays. For + downsampling any n-dimensional array by performing arithmetic sum or + arithmetic mean, see meassure._sum_blocks.sum_blocks and + transform._warps.downscale_local_means respectively. + + Parameters ---------- image : ndarray @@ -89,6 +95,11 @@ def resize(image, output_shape, order=1, mode='constant', cval=0.): def rescale(image, scale, order=1, mode='constant', cval=0.): """Scale image by a certain factor. + Rescale performs interpolation to upsample or downsample 2D arrays. For + downsampling any n-dimensional array by performing arithmetic sum or + arithmetic mean, see meassure._sum_blocks.sum_blocks and + transform._warps.downscale_local_means respectively. + Parameters ---------- image : ndarray @@ -339,6 +350,12 @@ def downscale_local_means(array, factors): the original array with zeroes if the dimensions are not perfectly divisible by factors and replaces it with mean i.e. average value. + This function is different from resize and rescale in the sense that they + use interpolation to upsample or downsample on a 2D array, while this + function performs only dawnsampling but on any n-dimensional array and + returns the arithmetic mean of elements in a block of size factors in the + original array. + Parameters ---------- array : ndarray