ViewController

View controller.

Constructor

new ViewController(view)

Parameters:
NameTypeDescription
viewView

The associated view.

Classes

ViewController

Methods

addWindowLevelPresets(presets) → {object}

Add window/level presets to the view.

Parameters:
NameTypeDescription
presetsobject

A preset object.

Returns:

The list of presets.

Type: 
object

bindImageAndLayer(viewLayer)

Bind the view image to the provided layer.

Parameters:
NameTypeDescription
viewLayerViewLayer

The layer to bind.

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

canWindowLevel() → {boolean}

Can window and level be applied to the data?

Deprecated
  • Since v0.33, please use isMonochrome instead.
Returns:

True if possible.

Type: 
boolean

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, indexopt)

Generate display image data to be given to a canvas.

Parameters:
NameTypeAttributesDescription
arrayImageData

The array to fill in.

indexIndex<optional>

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

get2DSpacing() → {Scalar2D}

Get the current view (2D) spacing.

Returns:

The spacing as a 2D array.

Type: 
Scalar2D

getColourMap() → {string}

Get the colour map.

Returns:

The colour map name.

Type: 
string

getContourThickness() → {number}

Get the thickness of the contour in pixels.

Returns:

The contour thickness (integer >= 1).

Type: 
number

getCurrentImageUid() → {string}

Get the SOP image UID of the current image.

Returns:

The UID.

Type: 
string

getCurrentIndex() → {Index}

Get the current index.

Returns:

The current index.

Type: 
Index

getCurrentIndexScrollValue() → {number}

Get the current index scroll value.

Returns:

The value.

Type: 
number

getCurrentOrientedIndex() → {Index}

Get the current oriented index.

Returns:

The index.

Type: 
Index

getCurrentPosition() → {Point}

Get the current position.

Returns:

The position.

Type: 
Point

getCurrentScrollPosition() → {number}

Get the current scroll position value.

Returns:

The value.

Type: 
number

getCurrentWindowPresetName() → {string}

Get the current window level preset name.

Returns:

The preset name.

Type: 
string

getFillOpacity() → {number}

Get the fill opacity relative to the global opacity.

Returns:

The fill opacity (between 0 and 1).

Type: 
number

getImageRegionValues(min, max, index) → {Array}

Get some values from the associated image in a region.

Parameters:
NameTypeDescription
minPoint2D

Minimum point.

maxPoint2D

Maximum point.

indexIndex

The index at which to get the image values (combined with min/max).

Returns:

A list of values.

Type: 
Array

getImageRescaledDataRange() → {object}

Get the image rescaled data range.

Returns:

The range as {min, max}.

Type: 
object

getImageSize() → {Size}

Get the oriented image size.

Returns:

The size.

Type: 
Size

getImageSpacing() → {Spacing}

Get the oriented image spacing.

Returns:

The spacing.

Type: 
Spacing

getImageVariableRegionValues(regions, index) → {Array}

Get some values from the associated image in variable regions.

Parameters:
NameTypeDescription
regionsArray.<Array.<Array.<number>>>

A list of [x, y] pairs (min, max).

indexIndex

The index at which to get the image values (combined with regions min/max).

Returns:

A list of values.

Type: 
Array

getImageWorldSize() → {Scalar2D}

Get the image world (mm) 2D size.

Returns:

The 2D size as {x,y}.

Type: 
Scalar2D

getIndexFromPosition(point) → {Index}

Get the index of a world position.

Parameters:
NameTypeDescription
pointPoint

The 3D position.

Returns:

The index.

Type: 
Index

getLengthUnit() → {string}

Get the image length unit.

Returns:

The unit.

Type: 
string

getModality() → {string}

Get the image modality.

Returns:

The modality.

Type: 
string

getOffset3DFromPlaneOffset(offset2D) → {Vector3D}

Get a 3D offset from a plane one.

Parameters:
NameTypeDescription
offset2DScalar2D

The plane offset as {x,y}.

Returns:

The 3D world offset.

Type: 
Vector3D

getOrigin(positionopt) → {Point3D}

Get the first origin or at a given position.

Parameters:
NameTypeAttributesDescription
positionPoint<optional>

Optional position.

Returns:

The origin.

Type: 
Point3D

getOriginForImageUid(uid) → {Point3D|undefined}

Get the image origin for a image UID.

Parameters:
NameTypeDescription
uidstring

The UID.

Returns:

The origin.

Type: 
Point3D | undefined

getPixelUnit() → {string}

Get the image pixel unit.

Returns:

The unit.

Type: 
string

getPlaneHelper() → {PlaneHelper}

Get the plane helper.

Returns:

The helper.

Type: 
PlaneHelper

getPlanePoints(position) → {Array.<Point3D>}

Get a list of points that define the plane at input position, given this classes orientation.

Parameters:
NameTypeDescription
positionPoint

The position.

Returns:

An origin and 2 cosines vectors.

Type: 
Array.<Point3D>

getPlanePositionFromPlanePoint(point2D) → {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
point2DPoint2D

The 2D position.

Returns:

The 3D point.

Type: 
Point3D

getPlanePositionFromPosition(point) → {Point2D}

Get a 2D plane position from a world position.

Parameters:
NameTypeDescription
pointPoint

The 3D position.

Returns:

The 2D position.

Type: 
Point2D

getPositionFromPlanePoint(point2D, kopt) → {Point}

Get a world position from a 2D plane position.

Parameters:
NameTypeAttributesDescription
point2DPoint2D

The input point.

knumber<optional>

Optional slice index, if undefined, uses the current one.

Returns:

The associated position.

Type: 
Point

getPositionHelper() → {PositionHelper}

Get a position helper: returns a new helper based on the current view.

Returns:

The helper.

Type: 
PositionHelper

getRescaledImageValue(position) → {number|undefined}

Get the image rescaled value at the input position.

Parameters:
NameTypeDescription
positionPoint

The input position.

Returns:

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

Type: 
number | undefined

getScrollDimIndex() → {number}

Get the scroll dimension index.

Returns:

The index.

Type: 
number

getSopClassUid() → {string|undefined}

Get the image SOP class UID.

Returns:

The uid.

Type: 
string | undefined

getWindowLevel() → {WindowLevel}

Get the window/level.

Returns:

The window and level.

Type: 
WindowLevel

getWindowLevelPresetsNames() → {Array.<string>}

Get the window/level presets names.

Returns:

The presets names.

Type: 
Array.<string>

includesImageUid(uid) → {boolean}

Check if the image includes an UID.

Parameters:
NameTypeDescription
uidstring

The UID.

Returns:

True if present.

Type: 
boolean

initialise()

Initialise the controller.

isAquisitionOrientation() → {boolean}

Is this view in the same orientation as the image aquisition.

Returns:

True if in aquisition plane.

Type: 
boolean

isMask() → {boolean}

Check is the associated image is a mask.

Returns:

True if the associated image is a mask.

Type: 
boolean

isMonochrome() → {boolean}

Is the data monochrome.

Returns:

True if the data is monochrome.

Type: 
boolean

isPlaying() → {boolean}

Check if the controller is playing.

Returns:

True if the controler is playing.

Type: 
boolean

isPositionInBounds(positionopt) → {boolean}

Check if the current position (default) or the provided position is in bounds.

Parameters:
NameTypeAttributesDescription
positionPoint<optional>

Optional position.

Returns:

True is the position is in bounds.

Type: 
boolean

moreThanOne(dim) → {boolean}

Is the data size larger than one in the given dimension?

Parameters:
NameTypeDescription
dimnumber

The dimension.

Returns:

True if the image size is larger than one in the given dimension.

Type: 
boolean

play()

Scroll play: loop through all slices.

resetPosition()

Reset the position.

resetWindowLevel()

Reset the window level.

setColourMap(name)

Set the colour map.

Parameters:
NameTypeDescription
namestring

The colour map name.

setContourThickness(thickness)

Set the thickness of the contour in pixels. This only has an effect on segmentation views, or any other alpha function that makes use of it.

Parameters:
NameTypeDescription
thicknessnumber

The contour thickness (integer >= 1).

setCurrentIndex(index, silentopt) → {boolean}

Set the current index.

Parameters:
NameTypeAttributesDescription
indexIndex

The index.

silentboolean<optional>

If true, does not fire a positionchange event.

Returns:

False if not in bounds.

Type: 
boolean

setCurrentPosition(pos, silentopt) → {boolean}

Set the current position.

Parameters:
NameTypeAttributesDescription
posPoint

The position.

silentboolean<optional>

If true, does not fire a positionchange event.

Returns:

False if not in bounds.

Type: 
boolean

setFillOpacity(opacity)

Set the fill opacity relative to the global opacity. This only has an effect on segmentation views, or any other alpha function that makes use of it.

Parameters:
NameTypeDescription
opacitynumber

The fill opacity (between 0 and 1).

setImage(img)

Set the associated image.

Parameters:
NameTypeDescription
imgImage

The associated image.

setMaskViewHelper(helper)

Set the mask segment view helper to handle hidden segments.

Parameters:
NameTypeDescription
helperMaskSegmentViewHelper

The helper.

setViewAlphaFunction(func)

Set the view per value alpha function.

Parameters:
NameTypeDescription
funcalphaFn

The function.

setWindowLevel(wl)

Set the window and level.

Parameters:
NameTypeDescription
wlWindowLevel

The window and level.

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.

unbindImageAndLayer(viewLayer)

Unbind the view image to the provided layer.

Parameters:
NameTypeDescription
viewLayerViewLayer

The layer to bind.

updatePlaneHelper()

Update the plane helper if there is a change in the image geometry.