Skip to content

Zarr Image Stack

Source

ImageStack implementation for Zarr-backed images.

ZarrImageStack

ImageStack backed by a zarr array.

Parameters:

  • group (Group) –

    Zarr group containing the array.

  • data_path (str) –

    Path to the array within the group.

  • axes (str) –

    Axis order (e.g. STCZYX).

chunks property

Chunk size per dimension.

Returns:

data_dtype property

Data type of the array.

Returns:

  • DTypeLike

    Type of the data.

original_axes property

Original axes of the data.

Returns:

  • str

    Axis order string.

original_data_shape property

Original shape of the data.

Returns:

  • tuple of int

    Shape in original axis order.

shards property

Shard size per dimension.

Returns:

  • Sequence[int] or None

    Shard size per dimension, or None.

source property

Source URI of the zarr array.

Local zarr URIs starts with the file:// descriptor, and include the path to the zarr file and internal path to the specific array. Source URIs are used during prediction to disk to build destination paths.

Returns:

  • str

    Source URI.

__init__(group, data_path, axes)

Constructor.

Parameters:

  • group (Group) –

    Zarr group containing the array.

  • data_path (str) –

    Path to the array within the group.

  • axes (str) –

    Axis order (e.g. STCZYX).

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.