bundles / skimage latest / skimage / util / shape / view_as_blocks
function
skimage.util.shape:view_as_blocks
source: /dev/scikit-image/src/skimage/util/shape.py :8
Signature
def view_as_blocks ( arr_in , block_shape ) Summary
Block view of the input n-dimensional array (using re-striding).
Extended Summary
Blocks are non-overlapping views of the input array.
Parameters
arr_in: ndarray, shape (M[, ...])Input array.
block_shape: tupleThe shape of the block. Each dimension must divide evenly into the corresponding dimensions of
arr_in.
Returns
arr_out: ndarrayBlock view of the input array.
Examples
import numpy as np from skimage.util.shape import view_as_blocks A = np.arange(4*4).reshape(4,4) A B = view_as_blocks(A, block_shape=(2, 2)) B[0, 0] B[0, 1]✓
B[1, 0, 1, 1]
✗A = np.arange(4*4*6).reshape(4,4,6) A # doctest: +NORMALIZE_WHITESPACE B = view_as_blocks(A, block_shape=(1, 2, 2)) B.shape B[2:, 0, 2] # doctest: +NORMALIZE_WHITESPACE✓
Aliases
-
skimage.util.view_as_blocks