dwv.ctrl. ViewController

new ViewController(view, index)

View controller.

Parameters:
NameTypeDescription
viewdwv.image.View

The associated view.

indexnumber

The associated data index.

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.

addWindowLevelPresets(presets) → {object}

Add window/level presets to the view.

Parameters:
NameTypeDescription
presetsobject

A preset object.

Returns:

The list of presets.

Type: 
object

applyHiddenSegments()

Apply the hidden segments list by setting the corresponding alpha function.

canQuantifyImage() → {boolean}

Can the image values be quantified?

Returns:

True if possible.

Type: 
boolean

canScroll() → {boolean}

Can the data be scrolled?

Returns:

True if the data has either the third dimension or above greater than one.

Type: 
boolean

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

canWindowLevel() → {boolean}

Can window and level be applied to the data?

Returns:

True if possible.

Type: 
boolean

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

deleteSegment(segmentNumber, exeCallback)

Delete a segment.

Parameters:
NameTypeDescription
segmentNumbernumber

The segment number.

exeCallbackfunction

The post execution callback.

equalImageMeta(meta) → {boolean}

Compare the input meta data to the associated image one.

Parameters:
NameTypeDescription
metaobject

The meta data.

Returns:

True if the associated image has equal meta data.

Type: 
boolean

generateImageData(array, position)

Generate display image data to be given to a canvas.

Parameters:
NameTypeDescription
arrayArray

The array to fill in.

positiondwv.math.Point

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

get2DSpacing() → {Array}

Get the current spacing.

Returns:

The 2D spacing.

Type: 
Array

getColourMap() → {object}

Get the colour map.

Returns:

The colour map.

Type: 
object

getCurrentIndex() → {dwv.math.Index}

Get the current index.

Returns:

The current index.

Type: 
dwv.math.Index

getCurrentOrientedIndex() → {dwv.math.Index}

Get the current oriented index.

Returns:

The index.

Type: 
dwv.math.Index

getCurrentPosition() → {dwv.math.Point}

Get the current position.

Returns:

The position.

Type: 
dwv.math.Point

getCurrentScrollIndexValue() → {object}

Get the current scroll index value.

Returns:

The value.

Type: 
object

getCurrentScrollPosition() → {object}

Get the current scroll position value.

Returns:

The value.

Type: 
object

getImageRegionValues(min, max) → {Array}

Get some values from the associated image in a region.

Parameters:
NameTypeDescription
mindwv.math.Point2D

Minimum point.

maxdwv.math.Point2D

Maximum point.

Returns:

A list of values.

Type: 
Array

getImageRescaledDataRange() → {object}

Get the image rescaled data range.

Returns:

The range as {min, max}.

Type: 
object

getImageSize() → {dwv.image.Size}

Get the image size.

Returns:

The size.

Type: 
dwv.image.Size

getImageVariableRegionValues(regions) → {Array}

Get some values from the associated image in variable regions.

Parameters:
NameTypeDescription
regionsArray

A list of regions.

Returns:

A list of values.

Type: 
Array

getImageWorldSize() → {object}

Get the image world (mm) 2D size.

Returns:

The 2D size as {x,y}.

Type: 
object

getMaskSegmentHelper() → {object}

Get the mask segment helper.

Returns:

The helper.

Type: 
object

getOffset3DFromPlaneOffset(offset2D) → {dwv.math.Vector3D}

Get a 3D offset from a plane one.

Parameters:
NameTypeDescription
offset2Dobject

The plane offset as {x,y}.

Returns:

The 3D world offset.

Type: 
dwv.math.Vector3D

getPixelUnit() → {string}

Get the image pixel unit.

Returns:

The unit

Type: 
string

getPlaneHelper() → {object}

Get the plane helper.

Returns:

The helper.

Type: 
object

getPlanePositionFromPlanePoint(point2D) → {dwv.math.Point3D}

Get a plane 3D position from a plane 2D position: does not compensate for the image origin. Needed for setting the scale center...

Parameters:
NameTypeDescription
point2Ddwv.math.Point2D

The 2D position as {x,y}.

Returns:

The 3D point.

Type: 
dwv.math.Point3D

getPlanePositionFromPosition(point3D) → {object}

Get a 2D (x,y) position from a position.

Parameters:
NameTypeDescription
point3Ddwv.math.Point3D

The 3D position.

Returns:

The 2D position.

Type: 
object

getPositionFromPlanePoint(x, y) → {dwv.math.Point}

Get a position from a 2D (x,y) position.

Parameters:
NameTypeDescription
xnumber

The column position.

ynumber

The row position.

Returns:

The associated position.

Type: 
dwv.math.Point

getRescaledImageValue(position) → {number|undefined}

Get the image rescaled value at the input position.

Parameters:
NameTypeDescription
positiondwv.math.Point

the input position.

Returns:

The image value or undefined if out of bounds or no quantifiable (for ex RGB).

Type: 
number | undefined

getScrollIndex() → {number}

Get the scroll index.

Returns:

The index.

Type: 
number

getWindowLevel() → {object}

Get the window/level.

Returns:

The window center and width.

Type: 
object

getWindowLevelPresetsNames() → {Array}

Get the window/level presets names.

Returns:

The presets names.

Type: 
Array

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

initialise()

Initialise the controller.

isMask() → {boolean}

Check is the associated image is a mask.

Returns:

True if the associated image is a mask.

Type: 
boolean

isPlaying() → {boolean}

Check if the controller is playing.

Returns:

True if the controler is playing.

Type: 
boolean

play()

Scroll play: loop through all slices.

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.

setColourMap(colourMap)

Set the colour map.

Parameters:
NameTypeDescription
colourMapobject

The colour map.

setColourMapFromName(name)

Set the colour map from a name.

Parameters:
NameTypeDescription
namestring

The name of the colour map to set.

setCurrentIndex(index, silent) → {boolean}

Set the current index.

Parameters:
NameTypeDescription
indexdwv.math.Index

The index.

silentboolean

If true, does not fire a positionchange event.

Returns:

False if not in bounds.

Type: 
boolean

setCurrentPosition(pos, silent) → {boolean}

Set the current position.

Parameters:
NameTypeDescription
posdwv.math.Point

The position.

silentboolean

If true, does not fire a positionchange event.

Returns:

False if not in bounds.

Type: 
boolean

setImage(img, index)

Set the associated image.

Parameters:
NameTypeDescription
imgImage

The associated image.

indexnumber

The data index of the image.

setViewAlphaFunction(func)

Set the view per value alpha function.

Parameters:
NameTypeDescription
funcfunction

The function.

setWindowLevel(wc, ww)

Set the window/level.

Parameters:
NameTypeDescription
wcnumber

The window center.

wwnumber

The window width.

setWindowLevelPreset(name)

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

Parameters:
NameTypeDescription
namestring

The name of the preset to activate.

setWindowLevelPresetById(id)

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

Parameters:
NameTypeDescription
idnumber

The id of the preset to activate.

stop()

Stop scroll playing.