LayerGroup

Layer group.

  • Display position: {x,y},
  • Plane position: Index (access: get(i)),
  • (world) Position: Point3D (access: getX, getY, getZ).

Display -> World:

  • planePos = viewLayer.displayToPlanePos(displayPos) -> compensate for layer scale and offset,
  • pos = viewController.getPositionFromPlanePoint(planePos).

World -> Display:

  • planePos = viewController.getOffset3DFromPlaneOffset(pos) no need yet for a planePos to displayPos...

Constructor

new LayerGroup(containerDiv, withInfoLayeropt)

Parameters:
NameTypeAttributesDescription
containerDivHTMLElement

The associated HTML div.

withInfoLayerboolean<optional>

Optional with info layer flag, default to false.

Classes

LayerGroup

Methods

addDrawLayer() → {DrawLayer}

Add a draw layer.

The new layer will be marked as the active draw layer.

Returns:

The created layer.

Type: 
DrawLayer

addEventListener(type, callback)

Add an event listener to this class.

Parameters:
NameTypeDescription
typestring

The event type.

callbackfunction

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

addInfoData(data, dataId)

Add info data.

Parameters:
NameTypeDescription
dataInfoData

The data to add.

dataIdstring

The associated data ID.

addScale(scaleStep, center)

Add scale to the layers. Scale cannot go lower than 0.1.

Parameters:
NameTypeDescription
scaleStepnumber

The scale to add.

centerPoint3D

The scale center Point3D.

addTranslation(translation)

Add translation to the layers.

Parameters:
NameTypeDescription
translationScalar3D

The translation as {x,y,z}.

addViewLayer() → {ViewLayer}

Add a view layer.

The new layer will be marked as the active view layer.

Returns:

The created layer.

Type: 
ViewLayer

bindInfoData(dataId)

Bind info data.

Parameters:
NameTypeDescription
dataIdstring

The associated data ID.

canScroll() → {boolean}

Can one of the view layers be scrolled.

Returns:

True if one view layer can be scrolled.

Type: 
boolean

display(flag)

Display the layer.

Parameters:
NameTypeDescription
flagboolean

Whether to display the layer or not.

draw()

Draw the layer.

empty()

Empty the layer list.

fitToContainer(divToWorldSizeRatio)

Fit to container: set the layers div to world size ratio.

Parameters:
NameTypeDescription
divToWorldSizeRationumber

The ratio.

flipScaleZ()

Flip all layers along the Z axis without offset compensation.

getActiveDrawLayer() → {DrawLayer|undefined}

Get the active draw layer.

Returns:

The layer.

Type: 
DrawLayer | undefined

getActiveLayer() → {ViewLayer|DrawLayer|undefined}

Get the active image layer.

Returns:

The layer.

Type: 
ViewLayer | DrawLayer | undefined

getActiveViewLayer() → {ViewLayer|undefined}

Get the active image layer.

Returns:

The layer.

Type: 
ViewLayer | undefined

getAddedScale() → {Scalar3D}

Get the added scale: the scale added to the base scale.

Returns:

The scale as {x,y,z}.

Type: 
Scalar3D

getBaseScale() → {Scalar3D}

Get the base scale.

Returns:

The scale as {x,y,z}.

Type: 
Scalar3D

getBaseViewLayer() → {ViewLayer|undefined}

Get the base view layer.

Returns:

The layer.

Type: 
ViewLayer | undefined

getDivId() → {string|undefined}

Get the Id of the container div.

Returns:

The id of the div.

Type: 
string | undefined

getDivToWorldSizeRatio() → {number|undefined}

Calculate the div to world size ratio needed to fit the largest data.

Returns:

The ratio.

Type: 
number | undefined

getDrawLayerById(id) → {DrawLayer|undefined}

Get a draw layer associated to a data id.

Parameters:
NameTypeDescription
idstring

The layer id.

Returns:

The layer.

Type: 
DrawLayer | undefined

getDrawLayers(callbackFnopt) → {Array.<DrawLayer>}

Get a list of draw layers according to an input callback function.

Parameters:
NameTypeAttributesDescription
callbackFnfunction<optional>

A function that takes a DrawLayer as input and returns a boolean. If undefined, returns all draw layers.

Returns:

The layers that satisfy the callbackFn.

Type: 
Array.<DrawLayer>

getDrawLayersByDataId(dataId) → {Array.<DrawLayer>}

Get the draw layers associated to a data id.

Parameters:
NameTypeDescription
dataIdstring

The data id.

Returns:

The layers.

Type: 
Array.<DrawLayer>

getMaxWorldSize() → {Scalar2D|undefined}

Get the largest data world (mm) size.

Returns:

The largest size as {x,y}.

Type: 
Scalar2D | undefined

getNumberOfLayers() → {number}

Get the number of layers handled by this class.

Returns:

The number of layers.

Type: 
number

getNumberOfViewLayers() → {number}

Get the number of view layers handled by this class.

Returns:

The number of layers.

Type: 
number

getOffset() → {Scalar3D}

Get the layer offset.

Returns:

The offset as {x,y,z}.

Type: 
Scalar3D

getPositionHelper() → {PositionHelper|undefined}

Get the position helper.

Returns:

The position helper or undefined if no layers.

Type: 
PositionHelper | undefined

getScale() → {Scalar3D}

Get the layer scale.

Returns:

The scale as {x,y,z}.

Type: 
Scalar3D

getShowCrosshair() → {boolean}

Get the showCrosshair flag.

Returns:

True to display the crosshair.

Type: 
boolean

getViewDataIndices() → {Array.<string>}

Get the view layers data indices.

Returns:

The list of indices.

Type: 
Array.<string>

getViewLayerById(id) → {ViewLayer|undefined}

Get a view layer associated to a data id.

Parameters:
NameTypeDescription
idstring

The layer id.

Returns:

The layer.

Type: 
ViewLayer | undefined

getViewLayers(callbackFnopt) → {Array.<ViewLayer>}

Get the view layers that satisfy the input callback function.

Parameters:
NameTypeAttributesDescription
callbackFnfunction<optional>

A function that takes a ViewLayer as input and returns a boolean. If undefined, returns all view layers.

Returns:

The layers that satisfy the callbackFn.

Type: 
Array.<ViewLayer>

getViewLayersByDataId(dataId) → {Array.<ViewLayer>}

Get the view layers associated to a data id.

Parameters:
NameTypeDescription
dataIdstring

The data id.

Returns:

The layers.

Type: 
Array.<ViewLayer>

getViewLayersFromActive(callbackFnopt) → {Array.<ViewLayer>}

Get the view layers that satisfy the input callback function starting from the active layer.

Parameters:
NameTypeAttributesDescription
callbackFnfunction<optional>

A function that takes a ViewLayer as input and returns a boolean. If undefined, returns all view layers.

Returns:

The layers that satisfy the callbackFn.

Type: 
Array.<ViewLayer>

hasAnyLayerWithValidPosition() → {boolean}

Check if any layer has a valid position.

Returns:

True if any layer has a valid position.

Type: 
boolean

includes(id) → {boolean}

Check if this layerGroup contains a layer with the input id.

Parameters:
NameTypeDescription
idstring

The layer id to look for.

Returns:

True if this group contains a layer with the input id.

Type: 
boolean

isPositionInBounds(position) → {boolean}

Can the input position be set on one of the view layers.

Parameters:
NameTypeDescription
positionPoint

The input position.

Returns:

True if one view layer accepts the input position.

Type: 
boolean

moreThanOne(dim) → {boolean}

Does one of the view layer have more than one slice in the given dimension.

Parameters:
NameTypeDescription
dimnumber

The input dimension.

Returns:

True if one view layer has more than one slice.

Type: 
boolean

removeEventListener(type, callback)

Remove an event listener from this class.

Parameters:
NameTypeDescription
typestring

The event type.

callbackfunction

The function associated with the provided event type.

removeLayer(layer)

Remove a layer from this layer group. Warning: if current active layer, the index will be set to undefined. Call one of the setActive methods to define the active index.

Parameters:
NameTypeDescription
layerViewLayer | DrawLayer

The layer to remove.

removeLayersByDataId(dataId)

Remove all layers for a specific data.

Parameters:
NameTypeDescription
dataIdstring

The data to remove its layers.

removeTooltipDiv()

Remove the tooltip html div.

reset()

Reset the stage to its initial scale and no offset.

Deprecated
  • Since v0.35, prefer resetZoomPan.

resetViews()

Reset the position and window level of all view layers.

resetZoomPan()

Reset the zoom and pan of all layers.

searchViewLayers(meta) → {Array.<ViewLayer>}

Search view layers for equal image meta data.

Parameters:
NameTypeDescription
metaobject

The meta data to find.

Returns:

The list of view layers that contain matched data.

Type: 
Array.<ViewLayer>

setActiveLayer(index)

Set the active layer.

Parameters:
NameTypeDescription
indexnumber

The index of the layer to set as active.

setActiveLayerByDataId(dataId)

Set the active layer with a data id.

Parameters:
NameTypeDescription
dataIdstring

The data id.

setActiveLayerById(id)

Set the active layer with a layer id.

Parameters:
NameTypeDescription
idstring

The layer id.

setImageSmoothing(flag)

Set the imageSmoothing flag value.

Parameters:
NameTypeDescription
flagboolean

True to enable smoothing.

setOffset(newOffset)

Set the layers' offset.

Parameters:
NameTypeDescription
newOffsetScalar3D

The offset as {x,y,z}.

setScale(newScale, centeropt)

Set the layers' scale.

Parameters:
NameTypeAttributesDescription
newScaleScalar3D

The scale to apply as {x,y,z}.

centerPoint3D<optional>

The scale center Point3D.

setShowCrosshair(flag)

Set the showCrosshair flag.

Parameters:
NameTypeDescription
flagboolean

True to display the crosshair.

shouldBind() → {boolean}

Returns whether or not a layer group should have its zoom/pan/etc synced to other views. Used for things like Secondary Capture where there is no meaningful real-world scale.

Returns:

Whether to sync the zoom/pan.

Type: 
boolean

showTooltip(point)

Displays a tooltip in a temporary span. Works with css to hide/show the span only on mouse hover.

Parameters:
NameTypeDescription
pointPoint2D

The update point.

someViewLayer(callbackFn) → {boolean}

Test if one of the view layers satisfies an input callbackFn.

Parameters:
NameTypeDescription
callbackFnfunction

A function that takes a ViewLayer as input and returns a boolean.

Returns:

True if one of the ViewLayers satisfies the callbackFn.

Type: 
boolean

unbindInfoData()

Unbind info data.

updateLayersToPositionChange(event)

Update layers (but not the event source layer) to a position change.

Parameters:
NameTypeDescription
eventobject

The position change event.

Events

activelayerchange

Active layer change event.

Type:
  • object
Properties
NameTypeDescription
typestring

The event type.

valueArray

The changed value.

offsetchange

Offset change event.

Type:
  • object
Properties
NameTypeDescription
typestring

The event type.

valueArray

The changed value.

removelayer

Remove layer event.

Type:
  • object
Properties
NameTypeDescription
typestring

The event type.

layeridstring

The layer id.

layergroupidstring

The layer group id.

zoomchange

Zoom change event.

Type:
  • object
Properties
NameTypeDescription
typestring

The event type.

valueArray

The changed value.