dwv.image. View

new View(image)

View class.

Parameters:
NameTypeDescription
imageImage

The associated image. Need to set the window lookup table once created (either directly or with helper methods).

Methods

addEventListener(type, callback)

Add an event listener to this class.

Parameters:
NameTypeDescription
typestring

The event type.

callbackobject

The method associated with the provided event type, will be called with the fired event.

addWindowLut(wlut)

Add the window LUT to the list.

Parameters:
NameTypeDescription
wlutWindow

The window LUT of the image.

addWindowPresets(presets)

Add window presets to the existing ones.

Parameters:
NameTypeDescription
presetsobject

The window presets.

canSetPosition(position) → {boolean}

Check is the provided position can be set.

Parameters:
NameTypeDescription
positiondwv.math.Point

The position.

Returns:

True is the position is in bounds.

Type: 
boolean

clone() → {dwv.image.View}

Clone the image using all meta data and the original data buffer.

Returns:

A full copy of this {dwv.image.View}.

Type: 
dwv.image.View

decrementIndex(dim, silent) → {boolean}

Decrement the provided dimension.

Parameters:
NameTypeDescription
dimnumber

The dimension to increment.

silentboolean

Do not send event.

Returns:

False if not in bounds.

Type: 
boolean

decrementScrollIndex(silent) → {boolean}

Decrement the scroll dimension index.

Parameters:
NameTypeDescription
silentboolean

Do not send event.

Returns:

False if not in bounds.

Type: 
boolean

generateImageData(array, index)

Generate display image data to be given to a canvas.

Parameters:
NameTypeDescription
arrayArray

The array to fill in.

indexdwv.math.Index

Optional index at which to generate, otherwise generates at current index.

getAlphaFunction() → {function}

Get the alpha function.

Returns:

The function.

Type: 
function

getColourMap() → {object}

Get the colour map of the image.

Returns:

The colour map of the image.

Type: 
object

getCurrentIndex() → {dwv.math.Index}

Get the current index.

Returns:

The current index.

Type: 
dwv.math.Index

getCurrentPosition() → {dwv.math.Point}

Get the current position.

Returns:

The current position.

Type: 
dwv.math.Point

getCurrentWindowLut(rsi) → {Window}

Get the window LUT of the image. Warning: can be undefined in no window/level was set.

Parameters:
NameTypeDescription
rsiobject

Optional image rsi, will take the one of the current slice otherwise.

Returns:

The window LUT of the image.

Type: 
Window

getImage() → {Image}

Get the associated image.

Returns:

The associated image.

Type: 
Image

getOrientation() → {dwv.math.Matrix33}

Get the view orientation.

Returns:

The orientation matrix.

Type: 
dwv.math.Matrix33

getOrigin(position) → {dwv.math.Point}

Get the origin at a given position.

Parameters:
NameTypeDescription
positiondwv.math.Point

The position.

Returns:

The origin.

Type: 
dwv.math.Point

getPlaybackMilliseconds(recommendedDisplayFrameRate) → {number}

Get the milliseconds per frame from frame rate.

Parameters:
NameTypeDescription
recommendedDisplayFrameRatenumber

Recommended Display Frame Rate.

Returns:

The milliseconds per frame.

Type: 
number

getScrollIndex() → {number}

Get the scroll dimension index.

Returns:

The index.

Type: 
number

getWindowLevelMinMax() → {object}

Get the image window/level that covers the full data range. Warning: uses the latest set rescale LUT or the default linear one.

Returns:

A min/max window level.

Type: 
object

getWindowPresets() → {object}

Get the window presets.

Returns:

The window presets.

Type: 
object

getWindowPresetsNames() → {object}

Get the window presets names.

Returns:

The list of window presets names.

Type: 
object

incrementIndex(dim, silent) → {boolean}

Increment the provided dimension.

Parameters:
NameTypeDescription
dimnumber

The dimension to increment.

silentboolean

Do not send event.

Returns:

False if not in bounds.

Type: 
boolean

incrementScrollIndex(silent) → {boolean}

Increment the scroll dimension index.

Parameters:
NameTypeDescription
silentboolean

Do not send event.

Returns:

False if not in bounds.

Type: 
boolean

init()

Initialise the view: set initial index.

removeEventListener(type, callback)

Remove an event listener from this class.

Parameters:
NameTypeDescription
typestring

The event type.

callbackobject

The method associated with the provided event type.

setAlphaFunction(func)

Set alpha function.

Parameters:
NameTypeDescription
funcfunction

The function.

setColourMap(map)

Set the colour map of the image.

Parameters:
NameTypeDescription
mapobject

The colour map of the image.

setCurrentIndex(index, silent) → {boolean}

Set the current index.

Parameters:
NameTypeDescription
indexdwv.math.Index

The new index.

silentboolean

Flag to fire event or not.

Returns:

False if not in bounds.

Type: 
boolean

setCurrentPosition(position, silent) → {boolean}

Set the current position.

Parameters:
NameTypeDescription
positiondwv.math.Point

The new position.

silentboolean

Flag to fire event or not.

Returns:

False if not in bounds

Type: 
boolean

setDefaultColourMap(map)

Set the default colour map.

Parameters:
NameTypeDescription
mapobject

The colour map.

setImage(inImage)

Set the associated image.

Parameters:
NameTypeDescription
inImageImage

The associated image.

setInitialIndex()

Set the initial index to 0.

setOrientation(mat33)

Set the view orientation.

Parameters:
NameTypeDescription
mat33dwv.math.Matrix33

The orientation matrix.

setWindowLevel(center, width, name, silent)

Set the view window/level.

Parameters:
NameTypeDescription
centernumber

The window center.

widthnumber

The window width.

namestring

Associated preset name, defaults to 'manual'. Warning: uses the latest set rescale LUT or the default linear one.

silentboolean

Flag to launch events with skipGenerate.

setWindowLevelMinMax()

Set the image window/level to cover the full data range. Warning: uses the latest set rescale LUT or the default linear one.

setWindowLevelPreset(name, silent)

Set the window level to the preset with the input name.

Parameters:
NameTypeDescription
namestring

The name of the preset to activate.

silentboolean

Flag to launch events with skipGenerate.

setWindowLevelPresetById(id, silent)

Set the window level to the preset with the input id.

Parameters:
NameTypeDescription
idnumber

The id of the preset to activate.

silentboolean

Flag to launch events with skipGenerate.

setWindowPresets(presets)

Set the window presets.

Parameters:
NameTypeDescription
presetsobject

The window presets.

(inner) alphaFunction(_value, _index) → {number}

Per value alpha function.

Parameters:
NameTypeDescription
_value*

The pixel value. Can be a number for monochrome data or an array for RGB data.

_indexnumber

The data index of the value.

Returns:

The coresponding alpha [0,255].

Type: 
number

Events

alphafuncchange

Alpha func change event.

Type:
  • object

colourchange

Color change event.

Type:
  • object
Properties
NameTypeDescription
valueArray

The changed value.

wcnumber

The new window center value.

wwnumber

The new window wdth value.

positionchange

Position change event.

Type:
  • object
Properties
NameTypeDescription
valueArray

The changed value as [index, pixelValue].

diffDimsArray

An array of modified indices.

wlchange

Window/level change event.

Type:
  • object
Properties
NameTypeDescription
valueArray

The changed value.

wcnumber

The new window center value.

wwnumber

The new window wdth value.

skipGenerateboolean

Flag to skip view generation.

wlpresetadd

Window/level add preset event.

Type:
  • object
Properties
NameTypeDescription
namestring

The name of the preset.