bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / util / _slice_along_axes / slice_along_axes
function
skimage.util._slice_along_axes:slice_along_axes
source: /dev/scikit-image/src/skimage/util/_slice_along_axes.py :4
Signature
def slice_along_axes ( image , slices , axes = None , copy = False ) Summary
Slice an image along given axes.
Parameters
image: ndarrayInput image.
slices: list of (tuple[int, int])For each axis in
axes, a corresponding 2-tuple(min_val, max_val)to slice with (as with Python slices,max_valis non-inclusive).axes: int or tuple, optionalAxes corresponding to the limits given in
slices. If None, axes are in ascending order, up to the length ofslices.copy: bool, optionalIf True, ensure that the output is not a view of
image.
Returns
out: ndarrayThe region of
imagecorresponding to the given slices and axes.
Examples
from skimage import data img = data.camera() img.shape cropped_img = slice_along_axes(img, [(0, 100)]) cropped_img.shape cropped_img = slice_along_axes(img, [(0, 100), (0, 100)]) cropped_img.shape cropped_img = slice_along_axes(img, [(0, 100), (0, 75)], axes=[1, 0]) cropped_img.shape✓
Aliases
-
skimage.util.slice_along_axes