Skip to main content

Class: ImageUtils

Defined in: utils/ImageUtils.ts:6

Utility methods for image channel defaults

Constructors

Constructor

new ImageUtils(): ImageUtils

Returns

ImageUtils

Methods

getDataTypeRange()

static getDataTypeRange(values): [number, number]

Defined in: utils/ImageUtils.ts:18

Returns the value range that the type of the given array can hold, for use as default contrast limits of image channel data

Integer typed arrays span their full integer range, floating-point typed arrays are taken to hold normalized values in [0, 1], and plain arrays are taken to hold 8-bit values.

Parameters

values

NumericArray

The array whose value range to return

Returns

[number, number]

The value range, as [min, max]


getDefaultChannelColor()

static getDefaultChannelColor(c): Color

Defined in: utils/ImageUtils.ts:61

Returns a default color for a channel, for use when no channel colors are known

The first six channels map to red, green, blue, yellow, cyan, and magenta. Further channels are assigned hues 128 degrees apart, with saturation and brightness decreasing by 0.05 every ten channels. Channel indices wrap around after 100, so that saturation and brightness stay above 0.5. Colors are not guaranteed to be unique.

Resembles ImageChannel.getDefaultChannelColor in QuPath v0.7.0, except that yellow, cyan, and magenta have been replaced by pure versions (255 for the two highest components, 0 for the lowest), and that QuPath wraps after 360 channels instead, yielding dim colors and eventually black.

Parameters

c

number

The channel index, a non-negative integer

Returns

Color

The default color for the channel