Skip to content

Image Stack Protocol

Source

Image stack protocol and type variables.

ImageStack

Bases: Protocol

An interface for extracting patches from an image stack.

Attributes:

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.