new View(image)
View class.
Name | Type | Description |
---|---|---|
image | Image | The associated image. Need to set the window lookup table once created (either directly or with helper methods). |
- Source
Methods
addEventListener(type, callback)
Add an event listener to this class.
Name | Type | Description |
---|---|---|
type | string | The event type. |
callback | object | The method associated with the provided event type, will be called with the fired event. |
- Source
addWindowLut(wlut)
Add the window LUT to the list.
Name | Type | Description |
---|---|---|
wlut | Window | The window LUT of the image. |
- Source
addWindowPresets(presets)
Add window presets to the existing ones.
Name | Type | Description |
---|---|---|
presets | object | The window presets. |
- Source
canSetPosition(position) → {boolean}
Check is the provided position can be set.
Name | Type | Description |
---|---|---|
position | dwv. | The position. |
- Source
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.
- Source
A full copy of this {dwv.image.View}.
- Type:
- dwv.
image. View
decrementIndex(dim, silent) → {boolean}
Decrement the provided dimension.
Name | Type | Description |
---|---|---|
dim | number | The dimension to increment. |
silent | boolean | Do not send event. |
- Source
False if not in bounds.
- Type:
- boolean
decrementScrollIndex(silent) → {boolean}
Decrement the scroll dimension index.
Name | Type | Description |
---|---|---|
silent | boolean | Do not send event. |
- Source
False if not in bounds.
- Type:
- boolean
generateImageData(array, index)
Generate display image data to be given to a canvas.
Name | Type | Description |
---|---|---|
array | Array | The array to fill in. |
index | dwv. | Optional index at which to generate, otherwise generates at current index. |
- Source
getAlphaFunction() → {function}
Get the alpha function.
- Source
The function.
- Type:
- function
getColourMap() → {object}
Get the colour map of the image.
- Source
The colour map of the image.
- Type:
- object
getCurrentIndex() → {dwv.math.Index}
Get the current index.
- Source
The current index.
- Type:
- dwv.
math. Index
getCurrentPosition() → {dwv.math.Point}
Get the current position.
- Source
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.
Name | Type | Description |
---|---|---|
rsi | object | Optional image rsi, will take the one of the current slice otherwise. |
- Source
The window LUT of the image.
- Type:
- Window
getImage() → {Image}
Get the associated image.
- Source
The associated image.
- Type:
- Image
getOrientation() → {dwv.math.Matrix33}
Get the view orientation.
- Source
The orientation matrix.
- Type:
- dwv.
math. Matrix33
getOrigin(position) → {dwv.math.Point}
Get the origin at a given position.
Name | Type | Description |
---|---|---|
position | dwv. | The position. |
- Source
The origin.
- Type:
- dwv.
math. Point
getPlaybackMilliseconds(recommendedDisplayFrameRate) → {number}
Get the milliseconds per frame from frame rate.
Name | Type | Description |
---|---|---|
recommendedDisplayFrameRate | number | Recommended Display Frame Rate. |
- Source
The milliseconds per frame.
- Type:
- number
getScrollIndex() → {number}
Get the scroll dimension index.
- Source
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.
- Source
A min/max window level.
- Type:
- object
getWindowPresets() → {object}
Get the window presets.
- Source
The window presets.
- Type:
- object
getWindowPresetsNames() → {object}
Get the window presets names.
- Source
The list of window presets names.
- Type:
- object
incrementIndex(dim, silent) → {boolean}
Increment the provided dimension.
Name | Type | Description |
---|---|---|
dim | number | The dimension to increment. |
silent | boolean | Do not send event. |
- Source
False if not in bounds.
- Type:
- boolean
incrementScrollIndex(silent) → {boolean}
Increment the scroll dimension index.
Name | Type | Description |
---|---|---|
silent | boolean | Do not send event. |
- Source
False if not in bounds.
- Type:
- boolean
init()
Initialise the view: set initial index.
- Source
removeEventListener(type, callback)
Remove an event listener from this class.
Name | Type | Description |
---|---|---|
type | string | The event type. |
callback | object | The method associated with the provided event type. |
- Source
setAlphaFunction(func)
Set alpha function.
Name | Type | Description |
---|---|---|
func | function | The function. |
- Source
setColourMap(map)
Set the colour map of the image.
Name | Type | Description |
---|---|---|
map | object | The colour map of the image. |
- Source
setCurrentIndex(index, silent) → {boolean}
Set the current index.
Name | Type | Description |
---|---|---|
index | dwv. | The new index. |
silent | boolean | Flag to fire event or not. |
- Source
False if not in bounds.
- Type:
- boolean
setCurrentPosition(position, silent) → {boolean}
Set the current position.
Name | Type | Description |
---|---|---|
position | dwv. | The new position. |
silent | boolean | Flag to fire event or not. |
- Source
False if not in bounds
- Type:
- boolean
setDefaultColourMap(map)
Set the default colour map.
Name | Type | Description |
---|---|---|
map | object | The colour map. |
- Source
setImage(inImage)
Set the associated image.
Name | Type | Description |
---|---|---|
inImage | Image | The associated image. |
- Source
setInitialIndex()
Set the initial index to 0.
- Source
setOrientation(mat33)
Set the view orientation.
Name | Type | Description |
---|---|---|
mat33 | dwv. | The orientation matrix. |
- Source
setWindowLevel(center, width, name, silent)
Set the view window/level.
Name | Type | Description |
---|---|---|
center | number | The window center. |
width | number | The window width. |
name | string | Associated preset name, defaults to 'manual'. Warning: uses the latest set rescale LUT or the default linear one. |
silent | boolean | Flag to launch events with skipGenerate. |
- Source
setWindowLevelMinMax()
Set the image window/level to cover the full data range. Warning: uses the latest set rescale LUT or the default linear one.
- Source
setWindowLevelPreset(name, silent)
Set the window level to the preset with the input name.
Name | Type | Description |
---|---|---|
name | string | The name of the preset to activate. |
silent | boolean | Flag to launch events with skipGenerate. |
- Source
setWindowLevelPresetById(id, silent)
Set the window level to the preset with the input id.
Name | Type | Description |
---|---|---|
id | number | The id of the preset to activate. |
silent | boolean | Flag to launch events with skipGenerate. |
- Source
setWindowPresets(presets)
Set the window presets.
Name | Type | Description |
---|---|---|
presets | object | The window presets. |
- Source
(inner) alphaFunction(_value, _index) → {number}
Per value alpha function.
Name | Type | Description |
---|---|---|
_value | * | The pixel value. Can be a number for monochrome data or an array for RGB data. |
_index | number | The data index of the value. |
- Source
The coresponding alpha [0,255].
- Type:
- number
Events
alphafuncchange
Alpha func change event.
- object
- Source
colourchange
Color change event.
- object
Name | Type | Description |
---|---|---|
value | Array | The changed value. |
wc | number | The new window center value. |
ww | number | The new window wdth value. |
- Source
positionchange
Position change event.
- object
Name | Type | Description |
---|---|---|
value | Array | The changed value as [index, pixelValue]. |
diffDims | Array | An array of modified indices. |
- Source
wlchange
Window/level change event.
- object
Name | Type | Description |
---|---|---|
value | Array | The changed value. |
wc | number | The new window center value. |
ww | number | The new window wdth value. |
skipGenerate | boolean | Flag to skip view generation. |
- Source
wlpresetadd
Window/level add preset event.
- object
Name | Type | Description |
---|---|---|
name | string | The name of the preset. |
- Source