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