Image Utils
Image stack utility functions.
pad_patch(coords, patch_size, data_shape, patch_data)
Pad patch data with zeros where it is outside the bounds of it's source image.
This ensures the patch data is contained in an array with the expected patch size.
If coords are negative, the start of the patch will be padded with zeros up until
where the start of the image would be, and this is where the patch data starts.
If the coords + patch_size are greater than the bounds of the image then the
end of the patch will be filled with zeros.
Parameters:
-
coords(Sequence[int]) –The coordinates that describe where the patch starts in the spatial dimension of the image.
-
patch_size(Sequence[int]) –The size of the patch in the spatial dimensions.
-
data_shape(Sequence[int]) –The shape of the image the patch originates from, must be in the format SC(Z)YX.
-
patch_data(NDArray[T]) –The patch data to be padded, with axes C(Z)YX.
Returns:
-
NDArray[float32]–The resulting padded patch.