Constructor
new LayerGroup(containerDiv)
Name | Type | Description |
---|---|---|
containerDiv | HTMLElement | The associated HTML div. |
- Source
Classes
Methods
addDrawLayer() → {DrawLayer}
Add a draw layer.
The new layer will be marked as the active draw layer.
- Source
The created layer.
- Type:
- DrawLayer
addEventListener(type, callback)
Add an event listener to this class.
Name | Type | Description |
---|---|---|
type | string | The event type. |
callback | function | The function associated with the provided event type, will be called with the fired event. |
- Source
addScale(scaleStep, center)
Add scale to the layers. Scale cannot go lower than 0.1.
Name | Type | Description |
---|---|---|
scaleStep | number | The scale to add. |
center | Point3D | The scale center Point3D. |
- Source
addTranslation(translation)
Add translation to the layers.
Name | Type | Description |
---|---|---|
translation | Scalar3D | The translation as {x,y,z}. |
- Source
addViewLayer() → {ViewLayer}
Add a view layer.
The new layer will be marked as the active view layer.
- Source
The created layer.
- Type:
- ViewLayer
canScroll() → {boolean}
Can one of the view layers be scrolled.
- Source
True if one view layer can be scrolled.
- Type:
- boolean
display(flag)
Display the layer.
Name | Type | Description |
---|---|---|
flag | boolean | Whether to display the layer or not. |
- Source
draw()
Draw the layer.
- Source
empty()
Empty the layer list.
- Source
fitToContainer(divToWorldSizeRatio)
Fit to container: set the layers div to world size ratio.
Name | Type | Description |
---|---|---|
divToWorldSizeRatio | number | The ratio. |
- Source
flipScaleZ()
Flip all layers along the Z axis without offset compensation.
- Source
getActiveDrawLayer() → {DrawLayer|undefined}
Get the active draw layer.
- Source
The layer.
- Type:
- DrawLayer |
undefined
getActiveViewLayer() → {ViewLayer|undefined}
Get the active image layer.
- Source
The layer.
- Type:
- ViewLayer |
undefined
getAddedScale() → {Scalar3D}
Get the added scale: the scale added to the base scale.
- Source
The scale as {x,y,z}.
- Type:
- Scalar3D
getBaseScale() → {Scalar3D}
Get the base scale.
- Source
The scale as {x,y,z}.
- Type:
- Scalar3D
getBaseViewLayer() → {ViewLayer|undefined}
Get the base view layer.
- Source
The layer.
- Type:
- ViewLayer |
undefined
getDivId() → {string}
Get the Id of the container div.
- Source
The id of the div.
- Type:
- string
getDivToWorldSizeRatio() → {number|undefined}
Calculate the div to world size ratio needed to fit the largest data.
- Source
The ratio.
- Type:
- number |
undefined
getDrawLayersByDataId(dataId) → {Array.<DrawLayer>}
Get the draw layers associated to a data id.
Name | Type | Description |
---|---|---|
dataId | string | The data id. |
- Source
The layers.
- Type:
- Array.<DrawLayer>
getMaxWorldSize() → {Scalar2D|undefined}
Get the largest data world (mm) size.
- Source
The largest size as {x,y}.
- Type:
- Scalar2D |
undefined
getNumberOfLayers() → {number}
Get the number of layers handled by this class.
- Source
The number of layers.
- Type:
- number
getNumberOfViewLayers() → {number}
Get the number of view layers handled by this class.
- Source
The number of layers.
- Type:
- number
getOffset() → {Scalar3D}
Get the layer offset.
- Source
The offset as {x,y,z}.
- Type:
- Scalar3D
getScale() → {Scalar3D}
Get the layer scale.
- Source
The scale as {x,y,z}.
- Type:
- Scalar3D
getShowCrosshair() → {boolean}
Get the showCrosshair flag.
- Source
True to display the crosshair.
- Type:
- boolean
getViewDataIndices() → {Array.<string>}
Get the view layers data indices.
- Source
The list of indices.
- Type:
- Array.<string>
getViewLayersByDataId(dataId) → {Array.<ViewLayer>}
Get the view layers associated to a data id.
Name | Type | Description |
---|---|---|
dataId | string | The data id. |
- Source
The layers.
- Type:
- Array.<ViewLayer>
includes(id) → {boolean}
Check if this layerGroup contains a layer with the input id.
Name | Type | Description |
---|---|---|
id | string | The layer id to look for. |
- Source
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.
Name | Type | Description |
---|---|---|
position | Point | The input position. |
- Source
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.
Name | Type | Description |
---|---|---|
dim | number | The input dimension. |
- Source
True if one view layer has more than one slice.
- Type:
- boolean
removeEventListener(type, callback)
Remove an event listener from this class.
Name | Type | Description |
---|---|---|
type | string | The event type. |
callback | function | The function associated with the provided event type. |
- Source
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.
- Source
removeLayersByDataId(dataId)
Remove all layers for a specific data.
Name | Type | Description |
---|---|---|
dataId | string | The data to remove its layers. |
- Source
removeTooltipDiv()
Remove the tooltip html div.
- Source
reset()
Reset the stage to its initial scale and no offset.
- Source
searchViewLayers(meta) → {Array.<ViewLayer>}
Search view layers for equal imae meta data.
Name | Type | Description |
---|---|---|
meta | object | The meta data to find. |
- Source
The list of view layers that contain matched data.
- Type:
- Array.<ViewLayer>
setActiveDrawLayer(index)
Set the active draw layer.
Name | Type | Description |
---|---|---|
index | number | The index of the layer to set as active. |
- Source
setActiveDrawLayerByDataId(dataId)
Set the active draw layer with a data id.
Name | Type | Description |
---|---|---|
dataId | string | The data id. |
- Source
setActiveViewLayer(index)
Set the active view layer.
Name | Type | Description |
---|---|---|
index | number | The index of the layer to set as active. |
- Source
setActiveViewLayerByDataId(dataId)
Set the active view layer with a data id.
Name | Type | Description |
---|---|---|
dataId | string | The data id. |
- Source
setImageSmoothing(flag)
Set the imageSmoothing flag value.
Name | Type | Description |
---|---|---|
flag | boolean | True to enable smoothing. |
- Source
setOffset(newOffset)
Set the layers' offset.
Name | Type | Description |
---|---|---|
newOffset | Scalar3D | The offset as {x,y,z}. |
- Source
setScale(newScale, centeropt)
Set the layers' scale.
Name | Type | Attributes | Description |
---|---|---|---|
newScale | Scalar3D | The scale to apply as {x,y,z}. | |
center | Point3D | <optional> | The scale center Point3D. |
- Source
setShowCrosshair(flag)
Set the showCrosshair flag.
Name | Type | Description |
---|---|---|
flag | boolean | True to display the crosshair. |
- Source
showTooltip(point)
Displays a tooltip in a temporary span
. Works with css to hide/show the span only on mouse hover.
Name | Type | Description |
---|---|---|
point | Point2D | The update point. |
- Source
someViewLayer(callbackFn) → {boolean}
Test if one of the view layers satisfies an input callbackFn.
Name | Type | Description |
---|---|---|
callbackFn | function | A function that takes a ViewLayer as input and returns a boolean. |
- Source
True if one of the ViewLayers satisfies the callbackFn.
- Type:
- boolean
updateLayersToPositionChange(event)
Update layers (but not the active view layer) to a position change.
Name | Type | Description |
---|---|---|
event | object | The position change event. |
- Source
Events
activeviewlayerchange
Active view layer change event.
- object
Name | Type | Description |
---|---|---|
value | Array | The changed value. |
- Source
offsetchange
Offset change event.
- object
Name | Type | Description |
---|---|---|
value | Array | The changed value. |
- Source
zoomchange
Zoom change event.
- object
Name | Type | Description |
---|---|---|
value | Array | The changed value. |
- Source