Skip to content

OmeZarrImageSource ​

A multiscale image opened from an OME-Zarr store.

Instances are created with fromHttp or fromFileSystem rather than the constructor. Both factories read the store's metadata up front so the returned source already knows its axes, resolution levels, and channel count. OME-Zarr versions 0.4 and 0.5 are supported and the version is detected from metadata when not given.

A source is handed to a layer which streams chunks from it on demand.

ts
const source = await OmeZarrImageSource.fromHttp({
  url: "https://example.com/image.ome.zarr",
});

const layer = new ImageLayer({
  source,
  sliceCoords: { t: 0, z: 0, c: [0] },
});

Types ​

SourceDimensionMap ​

Per-axis dimension metadata for a multiscale image source.

Maps the spatial axes x, y, z and the non-spatial axes c and t onto the source's stored dimensions.

PropertyDescription
x: SourceDimensionThe x spatial dimension.
y: SourceDimensionThe y spatial dimension.
z?: SourceDimensionThe z spatial dimension if present.
c?: SourceDimensionThe channel dimension if present.
t?: SourceDimensionThe time dimension if present.
numLods: numberNumber of levels of detail in the pyramid.

SourceDimension ​

One dimension of a multiscale image source.

PropertyDescription
name: stringAxis name from the source metadata.
index: numberPosition of the axis in the stored arrays.
unit?: stringPhysical unit if declared in the metadata.
lods: SourceDimensionLod[]Per-LOD metadata ordered finest first.

SourceDimensionLod ​

Metadata for one dimension at one level of detail.

Combines array metadata with the OME-Zarr coordinate transform.

PropertyDescription
size: numberExtent of the dimension in array elements.
chunkSize: numberChunk extent along the dimension in elements.
scale: numberWorld units per array element.
translation: numberWorld coordinate of the first element.

HttpOmeZarrImageSourceProps ​

Input to OmeZarrImageSource.fromHttp.

PropertyDescription
url: stringURL of the OME-Zarr root group.
version?: OmeZarrVersionOME-Zarr version. Detected from metadata when omitted.

FileSystemOmeZarrImageSourceProps ​

Input to OmeZarrImageSource.fromFileSystem.

PropertyDescription
directory: FileSystemDirectoryHandleDirectory handle with read permission.
version?: OmeZarrVersionOME-Zarr version. Detected from metadata when omitted.
path?: `/${string}`Image path within the directory. Defaults to the root.

Properties ​

location ​

The zarr store location the image was opened from.

ts
readonly location: Location<Readable>;

version? ​

The OME-Zarr version passed at creation if any.

ts
readonly optional version?: "0.5" | "0.4";

Accessors ​

loader OmeZarrImageLoader ​

The chunk loader that streams this image's data.

ts
get loader(): OmeZarrImageLoader;

Methods ​

getDimensions() SourceDimensionMap ​

Returns per-axis dimension metadata for the image.

Each axis entry lists one record per level of detail with its size, chunk size, scale, and translation. Use these to convert between array indices and world coordinates, pick slice coordinates, and frame cameras around the image extent.

ts
getDimensions(): SourceDimensionMap;

getChannelCount() number ​

Returns the number of channels in the image.

ts
getChannelCount(): number;

fromHttp() Promise<OmeZarrImageSource> ​

Opens an OME-Zarr image over HTTP(S).

ts
static fromHttp(props): Promise<OmeZarrImageSource>;
ParameterDescription
props: HttpOmeZarrImageSourcePropsThe store url and optional version.

fromFileSystem() Promise<OmeZarrImageSource> ​

Opens an OME-Zarr image from a local directory.

Uses the File System Access API so it only works in Chromium-based browsers. Pass the handle returned by window.showDirectoryPicker(). The optional path lets an application ask once for root permission and open many images.

ts
static fromFileSystem(props): Promise<OmeZarrImageSource>;
ParameterDescription
props: FileSystemOmeZarrImageSourcePropsThe directory handle, optional version, and path.

Released under the MIT License