Skip to main content

Class: OMEZarrImageData

Defined in: @tissuumaps-storage/src/ome-zarr/OMEZarrImageData.ts:36

Loaded OME-Zarr image data

Images with a channel axis are multi-channel: they provide one tile source per channel, addressed by channel index, along with the per-channel rendering metadata (name, visibility, color, contrast limits) that the tile sources resolve from the image's omero metadata. Images without a channel axis provide a single tile source that is not addressed by channel, and no per-channel metadata: the channel accessors reject them.

Extracts one sample per pixel from the raw OME-Zarr data of its tiles, which the renderer contrast-stretches and colorizes. Integer tiles of up to 32 bits and floating-point tiles are passed through as they are; 64-bit integer tiles are rejected.

Multi-channel image data carries one precomputed value histogram per channel, computed at load time from a downsampled resolution level (see OMEZarrImageDataProvider.load), from which the renderer derives default contrast limits for channels whose omero window is incomplete, except for uint8 channels, which fall back to the full [0, 255] range instead (see OMEZarrImageData.getChannelContrastLimits).

Implements​

Constructors​

Constructor​

new OMEZarrImageData(tileSources, histograms?): OMEZarrImageData

Defined in: @tissuumaps-storage/src/ome-zarr/OMEZarrImageData.ts:49

Parameters​

tileSources​

OMEZarrTileSource | OMEZarrTileSource[]

One ready tile source per channel, in channel order, each rendering only its channel (c), for images with a channel axis; the single ready tile source for images without one

histograms?​

(ImageChannelHistogram | undefined)[]

One precomputed value histogram per channel, in channel order (undefined for channels without one), for images with a channel axis; undefined for images without one

Returns​

OMEZarrImageData

Methods​

close()​

close(): void

Defined in: @tissuumaps-storage/src/ome-zarr/OMEZarrImageData.ts:238

Releases all resources held by this data object

Returns​

void

Implementation of​

ImageData.close


getChannelColor()​

getChannelColor(c): Color | undefined

Defined in: @tissuumaps-storage/src/ome-zarr/OMEZarrImageData.ts:163

Returns the color of a channel from the image's omero metadata

Channel colors are 6-digit hex strings with an optional #, which the tile source validates and parses. Channels without a valid color have no color, leaving the renderer to derive one from the channel index, even if other channels of the image have one.

Parameters​

c​

number

The channel index (0-based)

Returns​

Color | undefined

The channel's color, or undefined if it has no valid one

Throws​

Error if the image has no channel axis, or if c is out of bounds

Implementation of​

ImageData.getChannelColor


getChannelContrastLimits()​

getChannelContrastLimits(c): [number, number] | undefined

Defined in: @tissuumaps-storage/src/ome-zarr/OMEZarrImageData.ts:225

Returns the rendering window of a channel from the image's omero metadata

uint8 channels without a complete window fall back to the full [0, 255] range, like other viewers show them, rather than to the quantile-based limits the renderer would otherwise derive from their histogram (see OMEZarrImageData.getChannelHistogram).

Parameters​

c​

number

The channel index (0-based)

Returns​

[number, number] | undefined

The channel's window [start, end] widened to a non-empty range if necessary; [0, 255] for uint8 channels without a start or an end; or undefined for other channels without a start or an end

Throws​

Error if the image has no channel axis, or if c is out of bounds

Implementation of​

ImageData.getChannelContrastLimits


getChannelDataTypeRange()​

getChannelDataTypeRange(c): [number, number] | undefined

Defined in: @tissuumaps-storage/src/ome-zarr/OMEZarrImageData.ts:200

Returns the range the dtype of a channel can hold

Parameters​

c​

number

The channel index (0-based)

Returns​

[number, number] | undefined

The full range of an integer dtype of at most 32 bits, undefined for every other dtype

Throws​

Error if the image has no channel axis, or if c is out of bounds

Implementation of​

ImageData.getChannelDataTypeRange


getChannelHistogram()​

getChannelHistogram(c): ImageChannelHistogram | undefined

Defined in: @tissuumaps-storage/src/ome-zarr/OMEZarrImageData.ts:187

Returns the precomputed value histogram of a channel

The histogram is computed once at load time from a downsampled resolution level of the channel's plane (see OMEZarrImageDataProvider.load) and spans the channel's actual value range at that level, so that the default contrast limits the renderer derives from it are as precise as its bins.

Parameters​

c​

number

The channel index (0-based)

Returns​

ImageChannelHistogram | undefined

The channel's histogram, as bin counts and the value range the bins span, or undefined if none was computed (64-bit integer data, or planes with fewer than two distinct finite values)

Throws​

Error if the image has no channel axis, or if c is out of bounds

Implementation of​

ImageData.getChannelHistogram


getChannelName()​

getChannelName(c): string | undefined

Defined in: @tissuumaps-storage/src/ome-zarr/OMEZarrImageData.ts:133

Returns the label of a channel from the image's omero metadata

Parameters​

c​

number

The channel index (0-based)

Returns​

string | undefined

The channel's label, or undefined if it has none

Throws​

Error if the image has no channel axis, or if c is out of bounds

Implementation of​

ImageData.getChannelName


getChannelVisibility()​

getChannelVisibility(c): boolean | undefined

Defined in: @tissuumaps-storage/src/ome-zarr/OMEZarrImageData.ts:146

Returns whether a channel is active in the image's omero metadata

Parameters​

c​

number

The channel index (0-based)

Returns​

boolean | undefined

The channel's active flag, or undefined if it has none

Throws​

Error if the image has no channel axis, or if c is out of bounds

Implementation of​

ImageData.getChannelVisibility


getSizeC()​

getSizeC(): number | undefined

Defined in: @tissuumaps-storage/src/ome-zarr/OMEZarrImageData.ts:61

Returns the number of channels, or undefined for images without a channel axis

Returns​

number | undefined

Implementation of​

ImageData.getSizeC


getTileData()​

getTileData(event): Promise<{ height: number; values: TypedArray; width: number; }>

Defined in: @tissuumaps-storage/src/ome-zarr/OMEZarrImageData.ts:105

Extracts the samples of an invalidated tile from its raw OME-Zarr data

The tile has to belong to an OMEZarrTileSource rendering a single channel, whose tile data (chunks) holds exactly one two-dimensional (height x width) tile read from the Zarr array (with the channel, z-slice and timepoint already selected) instead of a rendered image. 64-bit integer tiles are rejected (see OMEZarrImageData).

Parameters​

event​

TileInvalidatedEvent

The tile invalidation event

Returns​

Promise<{ height: number; values: TypedArray; width: number; }>

The samples of the invalidated tile, one per raster pixel in row-major order, along with the width and height of the raster in pixels

Throws​

Error if the tile data does not hold exactly one tile, or if the tile holds 64-bit integers

Implementation of​

ImageData.getTileData


getTileSource()​

getTileSource(c?): string | object | CustomTileSource

Defined in: @tissuumaps-storage/src/ome-zarr/OMEZarrImageData.ts:77

Returns the tile source of a channel, or the only tile source of an image without a channel axis

Parameters​

c?​

number

The channel index (0-based), required for images with a channel axis and to be omitted otherwise

Returns​

string | object | CustomTileSource

The tile source

Throws​

Error if c is omitted for an image with a channel axis, passed for an image without one, or out of bounds

Implementation of​

ImageData.getTileSource