ngff_zarr.to_ngff_imageΒΆ

Module ContentsΒΆ

FunctionsΒΆ

_extract_array_from_group

Extract the full-resolution array from a zarr Group.

to_ngff_image

Create an image with pixel array and metadata to following the OME-NGFF data model.

APIΒΆ

ngff_zarr.to_ngff_image._extract_array_from_group(group: zarr.core.group.Group)ΒΆ

Extract the full-resolution array from a zarr Group.

For multi-level TIFFs (e.g., pyramidal OME-TIFF), tifffile returns a zarr Group containing multiple arrays (one per resolution level). This function extracts the full-resolution array, using multiscales metadata if available.

ngff_zarr.to_ngff_image.to_ngff_image(
data: numpy.typing.ArrayLike | collections.abc.MutableMapping | str | zarr.core.array.Array | zarr.core.group.Group,
dims: collections.abc.Sequence[ngff_zarr.v04.zarr_metadata.SupportedDims] | None = None,
scale: collections.abc.Mapping[collections.abc.Hashable, float] | None = None,
translation: collections.abc.Mapping[collections.abc.Hashable, float] | None = None,
name: str = 'image',
axes_units: collections.abc.Mapping[str, ngff_zarr.v04.zarr_metadata.Units] | None = None,
channel_names: collections.abc.Sequence[str] | None = None,
) ngff_zarr.ngff_image.NgffImageΒΆ

Create an image with pixel array and metadata to following the OME-NGFF data model.

Parameters:
  • data (ArrayLike, ZarrArray, ZarrGroup, MutableMapping, str) – Multi-dimensional array that provides the image pixel values. It can be a numpy.ndarray or another type that behaves like a numpy.ndarray, i.e. an ArrayLike. If a ZarrArray, MutableMapping, or str, it will be loaded into Dask lazily as a zarr Array. If a ZarrGroup, the first array in the group will be used.

  • dims (sequence of hashable, optional) – Tuple specifying the data dimensions. Values should drawn from: {β€˜t’, β€˜z’, β€˜y’, β€˜x’, β€˜c’} for time, third spatial direction, second spatial direction, first spatial dimension, and channel or component, respectively spatial dimension, and time, respectively.

  • scale (dict of floats, optional) – Pixel spacing for the spatial dims

  • translation (dict of floats, optional) – Origin or offset of the center of the first pixel.

  • name (str, optional) – Name of the resulting image

  • axes_units (dict of str, optional) – Units to associate with the axes. Should be drawn from UDUNITS-2, enumerated at https://ngff.openmicroscopy.org/latest/#axes-md

  • channel_names (sequence of str, optional) – Optional list of channel names. Length should match the number of channels in the data (size of β€˜c’ dimension).

Returns:

Representation of an image (pixel data + metadata) for a single scale of an NGFF-OME-Zarr multiscale dataset

Return type:

NgffImage