PixelRange

Description

struct Tinman.Terrain.Imaging.PixelRange

The PixelRange structure is used to map raw pixel values to normalized pixel values.

A pixel range is defined by two tiepoints, each containing a raw pixel value and a normalized pixel value. By carefully choosing the tiepoints, one can easily perform arbitrary linear transformations on pixel values.

See also

VerticalRange

Public / Constants

Default​Float32


public static readonly attribute DefaultFloat32 → (PixelRange)

Default normalization range for 32-bit floating point sample values.

The range is [-10000..10000].

Default​Int16


public static readonly attribute DefaultInt16 → (PixelRange)

Default normalization range for 16-bit signed integer sample values.

The range is [-32768..32767].

Default​Int8


public static readonly attribute DefaultInt8 → (PixelRange)

Default normalization range for 8-bit signed integer sample values.

The range is [-128..127].

Default​UInt16


public static readonly attribute DefaultUInt16 → (PixelRange)

Default normalization range for 16-bit unsigned integer sample values.

The range is [0..65535].

Default​UInt8


public static readonly attribute DefaultUInt8 → (PixelRange)

Default normalization range for 8-bit unsigned integer sample values.

The range is [0..255].

Identity


public static readonly attribute Identity → (PixelRange)

The identity pixel range.

The range is [0..16777215].

Invalid


public static readonly attribute Invalid → (PixelRange)

An invalid pixel range.

Public / Constructors

Default


public static method Default → (1)

format in : PixelFormat

The pixel format.

returns → PixelRange

The default pixel range.

Returns the default pixel range for the given pixel format.

Pixel​Range


public constructor PixelRange → (4)

rawA in : float64

Raw pixel value to map to pixelA opt.

rawB in : float64

Raw pixel value to map to pixelB opt.

pixelA opt : float64 = 0

Normalized pixel value to map to rawA in.

pixelB opt : float64 = 16777215

Normalized pixel value to map to rawB in.

Creates a new instance of PixelRange.

Public / Methods

Pixel


[Pure]
public method Pixel → (1)

value in : float64

The raw pixel value.

returns → float64

The normalized pixel value in the range [0..16777215].

Computes the normalized pixel value for the given raw pixel value.

Raw


[Pure]
public method Raw → (1)

value in : float64

The normalized pixel value in the range [0..16777215].

returns → float64

The raw pixel value.

Computes the raw pixel value for the given normalized pixel value.

Public / Attributes

Is​Invalid


public attribute IsInvalid → (get)

value : bool

true if this pixel range is invalid, false if it is valid.

Is this pixel range invalid?

Pixel​A


public readonly attribute PixelA → (float64)

The normalized pixel value that is mapped to RawA.

The valid range for normalized pixel values is [0..16777215]. However, the pixel range values used for mapping can be outside of this interval.

Pixel​B


public readonly attribute PixelB → (float64)

The normalized pixel value that is mapped to RawB.

The valid range for normalized pixel values is [0..16777215]. However, the pixel range values used for mapping can be outside of this interval.

Raw​A


public readonly attribute RawA → (float64)

The raw pixel value that is mapped to PixelA.

Raw​B


public readonly attribute RawB → (float64)

The raw pixel value that is mapped to PixelB.

Transform


public attribute Transform → (get)

value : Vec2D

The linear transform.

Returns a linear transform that maps RawA to PixelA and RawB to PixelB.

The linear transform is defined as follows:

f(x) = x * m + b
x    = (f(x) - b) / m

where f(x) is the normalized pixel value (see PixelA and PixelB) and x is the raw pixel value (see RawA and RawB). The coefficients m and b are returned as Vec2D.X and Vec2D.Y, respectively.

Transform​Inv


public attribute TransformInv → (get)

value : Vec2D

The linear transform.

Returns a linear transform that maps PixelA to RawA and PixelB to RawB.

The linear transform is defined as follows:

f(x) = x * m + b
x    = (f(x) - b) / m

where x is the normalized pixel value (see PixelA and PixelB) and f(x) is the raw pixel value (see RawA and RawB). The coefficients m and b are returned as Vec2D.X and Vec2D.Y, respectively.

Configuration

Config


public static attribute Config → (get)

value : IConfigurator<PixelRange>

[not-null]
The configurator object.

The configurator object for this type.