viqa.utils.crop_image¶
- viqa.utils.crop_image(img: ndarray | ImageArray, x: Tuple[int, int], y: Tuple[int, int], z: Tuple[int, int] | None) ndarray | ImageArray [source]¶
Crop the image array.
- Parameters:
img (np.ndarray or ImageArray) – Input image
x (Tuple[int, int]) – Range for the x-axis
y (Tuple[int, int]) – Range for the y-axis
z (Tuple[int, int] or None) – Range for the z-axis
- Returns:
img_crop – Cropped image array
- Return type:
np.ndarray or ImageArray
- Raises:
ValueError – If the image is not 2D or 3D. If the cropped image shape is larger than the original image shape.
- Warns:
RuntimeWarning – If the image is 2D, the parameter z will be ignored.