WindowCenterAndWidth

WindowCenterAndWidth class.
Pseudo-code:

 if (x <= c - 0.5 - (w-1)/2), then y = ymin
 else if (x > c - 0.5 + (w-1)/2), then y = ymax,
 else y = ((x - (c - 0.5)) / (w-1) + 0.5) * (ymax - ymin) + ymin

Constructor

new WindowCenterAndWidth(center, width)

Parameters:
NameTypeDescription
centernumber

The window center.

widthnumber

The window width.

Classes

WindowCenterAndWidth

Methods

apply(value) → {number}

Apply the window level on an input value.

Parameters:
NameTypeDescription
valuenumber

The value to rescale as an integer.

Returns:

The leveled value, in the [ymin, ymax] range (default [0,255]).

Type: 
number

equals(rhs) → {boolean}

Check for window level equality.

Parameters:
NameTypeDescription
rhsWindowCenterAndWidth

The other window level to compare to.

Returns:

True if both window level are equal.

Type: 
boolean

getCenter() → {number}

Get the window center.

Returns:

The window center.

Type: 
number

getWidth() → {number}

Get the window width.

Returns:

The window width.

Type: 
number

setRange(min, max)

Set the output value range.

Parameters:
NameTypeDescription
minstring

The output value minimum.

maxstring

The output value maximum.

setSignedOffset(offset)

Set the signed offset.

Parameters:
NameTypeDescription
offsetnumber

The signed data offset, typically: slope * ( size / 2).

toString() → {string}

Get a string representation of the window level.

Returns:

The window level as a string.

Type: 
string