Interface: ImageData
Defined in: storage/image.ts:25
Loaded image data providing one or more OpenSeadragon-compatible tile sources
Image data is either multi-channel, in which case it provides one tile source
per channel, addressed by channel index; or it is not, in which case it
provides a single tile source that is not addressed by channel.
ImageData.getSizeC returns undefined for image data that is not multi-channel.
Multi-channel image data that implements RasterData.getTileData provides a single sample ("grayscale value") per pixel and channel, which the renderer contrast-stretches and colorizes (see ImageData.getChannelContrastLimits and ImageData.getChannelColor). Multi-channel image data that does not implement it is free to provide grayscale or RGB tile sources per channel, which are drawn as they are.
Extends
Properties
getChannelColor?
optionalgetChannelColor?: (c) =>Color|undefined
Defined in: storage/image.ts:66
Returns the color of a specific channel, or undefined if not available
Channels without a color (neither configured on the image nor returned
here) are colorized with a default color derived from the channel index
(see ImageUtils.getDefaultChannelColor), so that multi-channel image data
without any color information renders as distinguishable channels rather
than as a single white blob. This fallback is data-agnostic: if colors are
available for only some channels, data providers should return suitable
default colors for the remaining ones themselves, so that all channels of
an image are colored consistently and the index-based fallback does not
mix with colors from image metadata.
Parameters
c
number
The channel index (0-based)
Returns
Color | undefined
The channel's color, or undefined if not available
getChannelContrastLimits?
optionalgetChannelContrastLimits?: (c) => [number,number] |undefined
Defined in: storage/image.ts:84
Returns the contrast limits of a specific channel, or undefined if not available
The renderer scales each channel value linearly between the contrast
limits, clamps the result to [0, 1] and multiplies it with the channel's
color. Channels without contrast limits (neither configured on the image
nor returned here) are stretched over the value range that the data type
of their channel data can hold, as returned by
ImageUtils.getDataTypeRange (the full integer range for integer typed
arrays, [0, 1] for floating-point typed arrays, [0, 255] for plain
arrays).
Parameters
c
number
The channel index (0-based)
Returns
[number, number] | undefined
The channel's contrast limits, in the channel's value range, or
undefined if not available
getChannelName?
optionalgetChannelName?: (c) =>string|undefined
Defined in: storage/image.ts:42
Returns the name of a specific channel, or undefined if not available
Parameters
c
number
Returns
string | undefined
getChannelOpacity?
optionalgetChannelOpacity?: (c) =>number|undefined
Defined in: storage/image.ts:48
Returns the opacity of a specific channel, or undefined if not available
Parameters
c
number
Returns
number | undefined
getChannelVisibility?
optionalgetChannelVisibility?: (c) =>boolean|undefined
Defined in: storage/image.ts:45
Returns the visibility of a specific channel, or undefined if not available
Parameters
c
number
Returns
boolean | undefined
getTileData?
optionalgetTileData?: (event) =>Promise<{height:number;values:NumericArray;width:number; }>
Defined in: storage/base.ts:101
Extracts the raw values of an invalidated tile
Provided by raster data whose tiles carry values rather than colors (e.g.
label IDs, or one sample per pixel of an image channel), which the renderer
recolors through a data transfer; raster data whose tiles are drawn as they
are does not provide it. The tile in event already belongs to one of this
raster's tile sources, which identifies the channel for multi-channel data.
The raster does not need to be cropped to the tile's source bounds: it may cover the full tile size, as the renderer crops it when drawing.
Parameters
event
TileInvalidatedEvent
The tile invalidation event
Returns
Promise<{ height: number; values: NumericArray; width: number; }>
The values 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 event does not contain raster data
Inherited from
Methods
close()
close():
void
Defined in: storage/base.ts:18
Releases all resources held by this data object
Returns
void
Inherited from
getSizeC()
getSizeC():
number|undefined
Defined in: storage/image.ts:27
Returns the number of channels in the image, or undefined if not multi-channel
Returns
number | undefined
getTileSource()
getTileSource(
c?):string|object|CustomTileSource
Defined in: storage/image.ts:39
Returns the tile source of a channel, or the only tile source of image data that is not multi-channel
Parameters
c?
number
The channel index (0-based), required for multi-channel image data and to be omitted otherwise
Returns
string | object | CustomTileSource
The tile source, which can be a URL string, a TileSourceConfig object, or a CustomTileSource object
Throws
Error if c is omitted for multi-channel image data, if c is
passed for image data that is not multi-channel, or if c is out of bounds