Image Stack Protocol
Image stack protocol and type variables.
ImageStack
Bases: Protocol
An interface for extracting patches from an image stack.
Attributes:
-
source(Path or array) –Origin of the image data.
-
data_shape(Sequence[int]) –The shape of the data, it is expected to be in the order (SC(Z)YX).
-
data_dtype(DTypeLike) –The data type of the image data.
-
original_data_shape(Sequence[int]) –The original shape of the data before it is transformed.
-
original_axes(str) –The original axes order before the data is transformed.
data_dtype
property
Data type of the image data.
data_shape
property
Shape of the image data (SC(Z)YX).
original_axes
property
Original axes of the data.
original_data_shape
property
Original shape of the data.
source
property
Source of the image data.
extract_patch(sample_idx, channels, coords, patch_size)
Extract a patch for a given sample and channels within the image stack.
Parameters:
-
sample_idx(int) –Sample index.
-
channels(sequence of int or None) –Channel indices to extract. If
None, all channels will be extracted. -
coords(sequence of int) –Spatial coordinates of the top-left corner of the patch.
-
patch_size(sequence of int) –Size of the patch in each spatial dimension.
Returns:
-
ndarray–A patch of the image data from a particular sample with dimensions C(Z)YX.