Skip to main content

Class: SliceIntersectionTool

SliceIntersectionTool ("Slice Intersections") renders and manipulates slice plane intersection lines on Generic (PLANAR_NEXT) viewports.

The tool thinks in PLANES, not viewports: viewports showing the same plane family over the same frame of reference (e.g. CT axial + PT axial + a 2D axial stack) form one plane group. Each viewport shows exactly one line per OTHER plane group - never duplicate near-identical lines - and:

  • dragging a line translates every member of that group (each along its own normal; stacks snap to their closest image),
  • rotation handles reorient the volume-backed members together (stacks cannot reorient and keep following translations only),
  • slab handles adjust the slab of the volume-backed members.

Every rendered line is the true plane-plane intersection of the target viewport plane and the group leader plane. The tool stores no persistent world point, has no shared "center", and does not render in 3D viewports.

Extends

Constructors

new SliceIntersectionTool()

new SliceIntersectionTool(toolProps, defaultToolProps): SliceIntersectionTool

Parameters

toolProps: PublicToolProps = {}

defaultToolProps: SharedToolProp = ...

Returns

SliceIntersectionTool

Overrides

AnnotationTool.constructor

Defined in

tools/src/tools/SliceIntersectionTool.ts:316

Properties

configuration

configuration: Record<string, any>

The configuration for this tool. IBaseTool contains some default configuration values, and you can use configurationTyped to get the typed version of this.

Inherited from

AnnotationTool.configuration

Defined in

tools/src/tools/base/BaseTool.ts:51


editData

editData: object

annotation

annotation: Annotation

handleIndex?

optional handleIndex: number

hasMoved?

optional hasMoved: boolean

movingTextBox?

optional movingTextBox: boolean

newAnnotation?

optional newAnnotation: boolean

viewportIdsToRender?

optional viewportIdsToRender: string[]

Inherited from

AnnotationTool.editData

Defined in

tools/src/tools/base/AnnotationTool.ts:67


eventDispatchDetail

protected eventDispatchDetail: object

renderingEngineId

renderingEngineId: string

viewportId

viewportId: string

Inherited from

AnnotationTool.eventDispatchDetail

Defined in

tools/src/tools/base/AnnotationTool.ts:61


isDrawing

isDrawing: boolean

Inherited from

AnnotationTool.isDrawing

Defined in

tools/src/tools/base/AnnotationTool.ts:65


isHandleOutsideImage

isHandleOutsideImage: boolean

Inherited from

AnnotationTool.isHandleOutsideImage

Defined in

tools/src/tools/base/AnnotationTool.ts:66


isPrimary

isPrimary: boolean = false

Primary tool - this is set to true when this tool is primary

Inherited from

AnnotationTool.isPrimary

Defined in

tools/src/tools/base/BaseTool.ts:61


isSuvScaled()

isSuvScaled: (viewport, targetId, imageId?) => boolean = AnnotationTool.isSuvScaled

Returns true if the viewport is scaled to SUV units

Parameters

viewport: StackViewport | VolumeViewport

The viewport

targetId: string

The annotation targetId

imageId?: string

The annotation imageId

Returns

boolean

Inherited from

AnnotationTool.isSuvScaled

Defined in

tools/src/tools/base/AnnotationTool.ts:596


memo

protected memo: Memo

A memo recording the starting state of a tool. This will be updated as changes are made, and reflects the fact that a memo has been created.

Inherited from

AnnotationTool.memo

Defined in

tools/src/tools/base/BaseTool.ts:67


mode

mode: ToolModes

Tool Mode - Active/Passive/Enabled/Disabled/

Inherited from

AnnotationTool.mode

Defined in

tools/src/tools/base/BaseTool.ts:59


supportedInteractionTypes

supportedInteractionTypes: InteractionTypes[]

Supported Interaction Types - currently only Mouse

Inherited from

AnnotationTool.supportedInteractionTypes

Defined in

tools/src/tools/base/BaseTool.ts:44


toolGroupId

toolGroupId: string

ToolGroup ID the tool instance belongs to

Inherited from

AnnotationTool.toolGroupId

Defined in

tools/src/tools/base/BaseTool.ts:57


activeCursorTool

static activeCursorTool: any

Set to the tool that is currently drawing the active cursor. This will be either primary mouse button tool if no tool is currently being directly interacted with, OR the tool that is directly interacted with. This logic ensures that there is only a single tool at a time drawing, which prevents tools not getting mouse updates from over-writing the cursor.

  • If the tool bound to the primary button is a cursor drawing tool, use that tool and there is NOT a tool currently drawing directly
  • If there is a tool currently drawing directly, then that tool should display a cursor EVEN if it normally doesn't have a custom cursor
  • When a tool finishes drawing direct, it should stop being the active cursor tool unless it is also the primary tool

Inherited from

AnnotationTool.activeCursorTool

Defined in

tools/src/tools/base/BaseTool.ts:41


defaults

static defaults: object

Has the defaults associated with the base tool.

configuration

configuration: object

configuration.activeStrategy

activeStrategy: any = undefined

configuration.defaultStrategy

defaultStrategy: any = undefined

configuration.strategies

strategies: object = {}

configuration.strategyOptions

strategyOptions: object = {}

Inherited from

AnnotationTool.defaults

Defined in

tools/src/tools/base/BaseTool.ts:72


toolLabel

static toolLabel: string = 'Slice Intersections'

User-facing label for this tool.

Defined in

tools/src/tools/SliceIntersectionTool.ts:285


toolName

static toolName: any

Overrides

AnnotationTool.toolName

Defined in

tools/src/tools/SliceIntersectionTool.ts:283

Accessors

configurationTyped

get configurationTyped(): ToolConfiguration

Returns

ToolConfiguration

Inherited from

AnnotationTool.configurationTyped

Defined in

tools/src/tools/base/BaseTool.ts:52


toolName

get toolName(): string

Newer method for getting the tool name as a property

Returns

string

Inherited from

AnnotationTool.toolName

Defined in

tools/src/tools/base/BaseTool.ts:142

Methods

_activateModify()

protected _activateModify(element): void

Wires the standard modify-interaction listeners (_dragCallback on drag, _endCallback on mouse/touch end) on the element and flags the global interaction state. Tools with tool-specific listener sets may override this.

Parameters

element: HTMLDivElement

Returns

void

Inherited from

AnnotationTool._activateModify

Defined in

tools/src/tools/base/AnnotationTool.ts:215


_alignPlaneGroups()

protected _alignPlaneGroups(): void

Snaps every member of each plane group to its group leader's plane (each member translating along its own normal only), so the single rendered line is true for all members and the group moves as one from then on.

Returns

void

Defined in

tools/src/tools/SliceIntersectionTool.ts:589


_computeLinesForTarget()

protected _computeLinesForTarget(targetViewport): RenderedIntersectionLine[]

Computes the plane-group lines to render into a target viewport. Pure geometry: every line is the actual plane-plane intersection of the target plane and the group leader plane.

Parameters

targetViewport: Viewport

Returns

RenderedIntersectionLine[]

Defined in

tools/src/tools/SliceIntersectionTool.ts:737


_deactivateModify()

protected _deactivateModify(element): void

Removes the listeners wired by _activateModify and clears the global interaction state.

Parameters

element: HTMLDivElement

Returns

void

Inherited from

AnnotationTool._deactivateModify

Defined in

tools/src/tools/base/AnnotationTool.ts:249


_dragCallback()

_dragCallback(evt): void

Drag handler wired by _activateModify. Tools that use the shared modify listeners assign this (typically as an arrow-function field). Loosely typed on purpose: tools narrow the event parameter to the interaction events they actually handle, and the base class only wires the callback as an EventListener.

Parameters

evt: InteractionEventType

Returns

void

Overrides

AnnotationTool._dragCallback

Defined in

tools/src/tools/SliceIntersectionTool.ts:1483


_endCallback()

_endCallback(evt): void

End-of-interaction handler wired by _activateModify. Tools that use the shared modify listeners assign this (typically as an arrow-function field). Loosely typed for the same reason as _dragCallback.

Parameters

evt: InteractionEventType

Returns

void

Overrides

AnnotationTool._endCallback

Defined in

tools/src/tools/SliceIntersectionTool.ts:1478


_getMprFamily()

protected _getMprFamily(viewport): MprPlaneFamily

Returns the sticky MPR family of a planar viewport, classifying it from the dominant axis of its plane normal on first sight. The assignment is kept for the lifetime of the tool (until disabled or explicitly refreshed), so rotating a plane past 45 degrees never moves the viewport to a different family.

Parameters

viewport: Viewport

Returns

MprPlaneFamily

Defined in

tools/src/tools/SliceIntersectionTool.ts:490


_getPlaneGroups()

protected _getPlaneGroups(): SliceIntersectionPlaneGroup[]

Groups the tool-group planar viewports by (frame of reference, sticky plane family), cached per pass (see the pass-cache fields). In the debug perViewportLines mode every viewport is its own group.

Returns

SliceIntersectionPlaneGroup[]

Defined in

tools/src/tools/SliceIntersectionTool.ts:513


_getToolGroupViewports()

protected _getToolGroupViewports(): Viewport[]

Returns

Viewport[]

Defined in

tools/src/tools/SliceIntersectionTool.ts:1973


_getViewportsInfo()

protected _getViewportsInfo(): IViewportId[]

Returns

IViewportId[]

Defined in

tools/src/tools/SliceIntersectionTool.ts:1969


addNewAnnotation()

addNewAnnotation(evt): SliceIntersectionAnnotation

The tool never creates real annotations from clicks in empty space: clicking empty canvas never jumps and never stores a point.

Parameters

evt: InteractionEventType

Returns

SliceIntersectionAnnotation

Overrides

AnnotationTool.addNewAnnotation

Defined in

tools/src/tools/SliceIntersectionTool.ts:1133


applyActiveStrategy()

applyActiveStrategy(enabledElement, operationData): any

Applies the active strategy function to the enabled element with the specified operation data.

Parameters

enabledElement: IEnabledElement

The element that is being operated on.

operationData: unknown

The data that needs to be passed to the strategy.

Returns

any

The result of the strategy.

Inherited from

AnnotationTool.applyActiveStrategy

Defined in

tools/src/tools/base/BaseTool.ts:162


applyActiveStrategyCallback()

applyActiveStrategyCallback(enabledElement, operationData, callbackType, ...extraArgs): any

Applies the active strategy, with a given event type being applied. The event type function is found by indexing it on the active strategy function.

Parameters

enabledElement: IEnabledElement

The element that is being operated on.

operationData: unknown

The data that needs to be passed to the strategy.

callbackType: string

the type of the callback

• ...extraArgs: any[]

Returns

any

The result of the strategy.

Inherited from

AnnotationTool.applyActiveStrategyCallback

Defined in

tools/src/tools/base/BaseTool.ts:186


cancel()

cancel(element): void

cancel Used to cancel the ongoing tool drawing and manipulation

Parameters

element: HTMLDivElement

Returns

void

Overrides

AnnotationTool.cancel

Defined in

tools/src/tools/SliceIntersectionTool.ts:1408


createAnnotation()

protected createAnnotation(evt, points?, ...annotationBaseData?): Annotation

Creates an annotation containing the basic data set.

Parameters

evt: InteractionEventType

points?: Point3[]

• ...annotationBaseData?: any[]

Returns

Annotation

Inherited from

AnnotationTool.createAnnotation

Defined in

tools/src/tools/base/AnnotationDisplayTool.ts:178


createMemo()

protected createMemo(element, annotation, options?): void

Creates a memo on the given annotation.

Parameters

element: any

annotation: any

options?: any

Returns

void

Inherited from

AnnotationTool.createMemo

Defined in

tools/src/tools/base/AnnotationTool.ts:814


doneEditMemo()

doneEditMemo(): void

This clears and edit memo storage to allow for further history functions to be called. Calls the complete function if present, and pushes the memo to the history memo stack.

This should be called when a tool has finished making a change which should be separated from future/other changes in terms of the history. Usually that means on endCallback (mouse up), but some tools also make changes on the initial creation of an object or have alternate flows and the doneEditMemo has to be called on mouse down or other initiation events to ensure that new changes are correctly recorded.

If the tool has no end callback, then the doneEditMemo is called from the pre mouse down callback. See ZoomTool for an example of this usage.

Returns

void

Inherited from

AnnotationTool.doneEditMemo

Defined in

tools/src/tools/base/BaseTool.ts:392


doubleClickCallback()

doubleClickCallback(evt): void

Optional double click behavior. Never mutates the WorldCrosshairTool point unless setWorldCrosshairOnIntersectionDoubleClick is enabled.

Parameters

evt: MouseDoubleClickEventType

Returns

void

Defined in

tools/src/tools/SliceIntersectionTool.ts:1282


endGroupRecording()

protected endGroupRecording(): void

Ends a group recording of history memo

Returns

void

Inherited from

AnnotationTool.endGroupRecording

Defined in

tools/src/tools/base/AnnotationTool.ts:827


filterInteractableAnnotationsForElement()

filterInteractableAnnotationsForElement(element, annotations): Annotations

Given the element and annotations which is an array of annotation, it filters the annotations array to only include the annotation based on the viewportType. If the viewport is StackViewport, it filters based on the current imageId of the viewport, if the viewport is volumeViewport, it only returns those that are within the same slice as the current rendered slice in the volume viewport. imageId as the enabledElement.

Parameters

element: HTMLDivElement

The HTML element

annotations: Annotations

The annotations to filter (array of annotation)

Returns

Annotations

The filtered annotations

Overrides

AnnotationTool.filterInteractableAnnotationsForElement

Defined in

tools/src/tools/SliceIntersectionTool.ts:1387


getAnnotationStyle()

protected getAnnotationStyle(context): AnnotationStyle

Get the style that will be applied to all annotations such as length, cobb angle, arrow annotate, etc. when rendered on a canvas or svg layer

Parameters

context

context.annotation: Annotation

context.styleSpecifier: StyleSpecifier

Returns

AnnotationStyle

Inherited from

AnnotationTool.getAnnotationStyle

Defined in

tools/src/tools/base/AnnotationTool.ts:602


getHandleNearImagePoint()

getHandleNearImagePoint(element, _annotation, canvasCoords, proximity): ToolHandle

It checks if the mouse click is near TextBoxHandle or AnnotationHandle itself, and return either it. It prioritize TextBoxHandle over AnnotationHandle. If the mouse click is not near any of the handles, it does not return anything.

Parameters

element: HTMLDivElement

The element that the tool is attached to.

_annotation: Annotation

canvasCoords: Point2

The coordinates of the mouse click on canvas

proximity: number

The distance from the mouse cursor to the point that is considered "near".

Returns

ToolHandle

The handle that is closest to the cursor, or null if the cursor is not near any of the handles.

Overrides

AnnotationTool.getHandleNearImagePoint

Defined in

tools/src/tools/SliceIntersectionTool.ts:1169


getLinkedTextBoxStyle()

getLinkedTextBoxStyle(specifications, annotation?): Record<string, unknown>

It returns the style for the text box

Parameters

specifications: StyleSpecifier

annotation?: Annotation

The annotation for the tool that is currently active.

Returns

Record<string, unknown>

An object of the style settings for the text box.

Inherited from

AnnotationTool.getLinkedTextBoxStyle

Defined in

tools/src/tools/base/AnnotationTool.ts:418


getPlaneGroups()

getPlaneGroups(): SliceIntersectionPlaneGroup[]

Returns the current plane groups (copies).

Returns

SliceIntersectionPlaneGroup[]

Defined in

tools/src/tools/SliceIntersectionTool.ts:375


getReferencedImageId()

protected getReferencedImageId(viewport, worldPos, viewPlaneNormal, viewUp?): string

Parameters

viewport: Viewport

worldPos: Point3

viewPlaneNormal: Point3

viewUp?: Point3

Returns

string

Inherited from

AnnotationTool.getReferencedImageId

Defined in

tools/src/tools/base/AnnotationDisplayTool.ts:223


getState()

getState(): SliceIntersectionState

Returns a copy of the tool state.

Returns

SliceIntersectionState

Defined in

tools/src/tools/SliceIntersectionTool.ts:363


getStyle()

getStyle(property, specifications, annotation?): unknown

It takes the property (color, lineDash, etc.) and based on the state of the annotation (selected, highlighted etc.) it returns the appropriate value based on the central toolStyle settings for each level of specification.

Parameters

property: string

The name of the style property to get.

specifications: StyleSpecifier

annotation?: Annotation

The annotation for the tool that is currently active.

Returns

unknown

The value of the property.

Inherited from

AnnotationTool.getStyle

Defined in

tools/src/tools/base/AnnotationDisplayTool.ts:260


getTargetId()

protected getTargetId(viewport, data?): string

Get the target Id for the viewport which will be used to store the cached statistics scoped to that target in the annotations. For StackViewport, targetId is usually derived from the imageId. For VolumeViewport, it's derived from the volumeId. This method allows prioritizing a specific volumeId from the tool's configuration if available in the cachedStats.

Parameters

viewport: Viewport

viewport to get the targetId for

data?

Optional: The annotation's data object, containing cachedStats.

data.cachedStats?: Record<string, unknown>

Returns

string

targetId

Inherited from

AnnotationTool.getTargetId

Defined in

tools/src/tools/base/BaseTool.ts:300


getTargetImageData()

protected getTargetImageData(targetId): IImageData | CPUIImageData

Get the image that is displayed for the targetId in the cachedStats which can be

  • imageId:<imageId>
  • volumeId:<volumeId>
  • videoId:<basePathForVideo>/frames/<frameSpecifier>

Parameters

targetId: string

annotation targetId stored in the cached stats

Returns

IImageData | CPUIImageData

The image data for the target.

Inherited from

AnnotationTool.getTargetImageData

Defined in

tools/src/tools/base/BaseTool.ts:241


getToolName()

getToolName(): string

Returns the name of the tool

Returns

string

The name of the tool.

Inherited from

AnnotationTool.getToolName

Defined in

tools/src/tools/base/BaseTool.ts:150


handleSelectedCallback()

handleSelectedCallback(evt, _annotation, _handle, _interactionType): void

handleSelectedCallback Custom callback for when a handle is selected.

Parameters

evt: InteractionEventType

The normalized mouse event

_annotation: Annotation

The annotation selected.

_handle: ToolHandle

The selected handle (either Types.Point3 in space for annotations, or TextBoxHandle object for text boxes).

_interactionType: InteractionTypes = 'Mouse'

The interaction type the handle was selected with.

Returns

void

Overrides

AnnotationTool.handleSelectedCallback

Defined in

tools/src/tools/SliceIntersectionTool.ts:1247


isPointNearTool()

isPointNearTool(element, _annotation, canvasCoords, _proximity, _interactionType?): boolean

Returns true if the provided canvas coordinate tool is near the annotation

Parameters

element: HTMLDivElement

The HTML element

_annotation: SliceIntersectionAnnotation

The annotation to check

canvasCoords: Point2

The canvas coordinate to check

_proximity: number

The minimum proximity to consider the point near

_interactionType?: string

The interaction type used to select the tool.

Returns

boolean

boolean if the point is near.

Overrides

AnnotationTool.isPointNearTool

Defined in

tools/src/tools/SliceIntersectionTool.ts:1149


mouseMoveCallback()

mouseMoveCallback(evt, _filteredToolAnnotations?): boolean

Hover: highlights the plane-group line under the cursor and shows its handles.

Parameters

evt: MouseMoveEventType

_filteredToolAnnotations?: Annotations

Returns

boolean

Overrides

AnnotationTool.mouseMoveCallback

Defined in

tools/src/tools/SliceIntersectionTool.ts:1341


onCameraModified()

onCameraModified(evt): void

Lines are pure derivations of the camera planes, so a camera change just needs an annotation re-render. To keep slice scrolling responsive, the re-render is targeted: only viewports that display a line whose group leader is the modified viewport (plus the modified viewport itself) are refreshed.

Parameters

evt: CameraModifiedEvent

Returns

void

Defined in

tools/src/tools/SliceIntersectionTool.ts:449


onImageSpacingCalibrated()

onImageSpacingCalibrated(evt): void

On Image Calibration, take all the annotation from the AnnotationState manager, and invalidate them to force them to be re-rendered and their stats to be recalculated. Then use the old and new imageData (non-calibrated and calibrated) to calculate the new position for the annotations in the space of the new imageData.

Parameters

evt: ImageSpacingCalibratedEvent

The calibration event

Returns

void

Inherited from

AnnotationTool.onImageSpacingCalibrated

Defined in

tools/src/tools/base/AnnotationDisplayTool.ts:89


onSetToolActive()

onSetToolActive(): void

Returns

void

Defined in

tools/src/tools/SliceIntersectionTool.ts:404


onSetToolDisabled()

onSetToolDisabled(): void

Returns

void

Defined in

tools/src/tools/SliceIntersectionTool.ts:412


onSetToolEnabled()

onSetToolEnabled(): void

Returns

void

Defined in

tools/src/tools/SliceIntersectionTool.ts:397


onSetToolPassive()

onSetToolPassive(): void

Returns

void

Defined in

tools/src/tools/SliceIntersectionTool.ts:408


redo()

redo(): void

Redo an action (undo the undo)

Returns

void

Inherited from

AnnotationTool.redo

Defined in

tools/src/tools/base/BaseTool.ts:339


refreshPlaneFamilies()

refreshPlaneFamilies(): void

Clears the sticky family classification so viewports are re-classified from their current plane normals (e.g. after programmatically re-orienting a viewport to a different plane family).

Returns

void

Defined in

tools/src/tools/SliceIntersectionTool.ts:387


renderAnnotation()

renderAnnotation(enabledElement, svgDrawingHelper): boolean

renderAnnotation it used to draw the tool's annotation in each request animation frame

Parameters

enabledElement: IEnabledElement

The Cornerstone's enabledElement.

svgDrawingHelper: SVGDrawingHelper

The svgDrawingHelper providing the context for drawing.

Returns

boolean

Overrides

AnnotationTool.renderAnnotation

Defined in

tools/src/tools/SliceIntersectionTool.ts:629


renderLinkedTextBoxAnnotation()

protected renderLinkedTextBoxAnnotation(options): boolean

Renders a linked text box for an annotation using shared visibility, placement, and worldBoundingBox logic. Call from renderAnnotation when the tool uses a linked text box (e.g. Length, RectangleROI). The caller must supply textLines and canvasCoordinates; when text box visibility is off, this method resets data.handles.textBox and returns false.

Parameters

options

options.annotation: Annotation

Annotation whose text box to render

options.canvasCoordinates: Point2[]

Canvas anchor points for the link line (and for placement when placementPoints omitted)

options.enabledElement: IEnabledElement

Cornerstone enabled element

options.placementPoints?: Point2[]

Optional; when provided, used for getTextBoxCoordsCanvas only (e.g. circle ROI uses corners for placement, center for link)

options.styleSpecifier: StyleSpecifier

Style specifier for getLinkedTextBoxStyle

options.svgDrawingHelper: SVGDrawingHelper

SVG drawing helper

options.textBoxUID?: string

Optional UID for the text box SVG group (default '1')

options.textLines: string[]

Lines to display (caller responsibility to compute/skip when empty)

Returns

boolean

true if the text box was drawn, false if visibility was off (textBox was reset)

Inherited from

AnnotationTool.renderLinkedTextBoxAnnotation

Defined in

tools/src/tools/base/AnnotationTool.ts:485


setActiveStrategy()

setActiveStrategy(strategyName): void

Sets the active strategy for a tool. Strategies are multiple implementations of tool behavior that can be switched by tool configuration.

Parameters

strategyName: string

name of the strategy to be set as active

Returns

void

Inherited from

AnnotationTool.setActiveStrategy

Defined in

tools/src/tools/base/BaseTool.ts:227


setConfiguration()

setConfiguration(newConfiguration): void

merges the new configuration with the tool configuration

Parameters

newConfiguration: Record<string, any>

Returns

void

Inherited from

AnnotationTool.setConfiguration

Defined in

tools/src/tools/base/BaseTool.ts:213


startGroupRecording()

protected startGroupRecording(): void

Returns

void

Inherited from

AnnotationTool.startGroupRecording

Defined in

tools/src/tools/base/AnnotationTool.ts:822


toolSelectedCallback()

toolSelectedCallback(evt, _annotation): void

Click on a line selects its plane group; when dragging is enabled the drag translates every member of the group.

Parameters

evt: InteractionEventType

_annotation: Annotation

Returns

void

Overrides

AnnotationTool.toolSelectedCallback

Defined in

tools/src/tools/SliceIntersectionTool.ts:1219


undo()

undo(): void

Undoes an action

Returns

void

Inherited from

AnnotationTool.undo

Defined in

tools/src/tools/base/BaseTool.ts:329


calculateLengthInIndex()

static calculateLengthInIndex(calibrate, indexPoints, closed): number

Calculates the length between two index coordinates using the calibrate information for scaling information.

Parameters

calibrate: any

indexPoints: any

closed: boolean = false

set to true to calculate the closed length, including the line between the first/last index

Returns

number

Inherited from

AnnotationTool.calculateLengthInIndex

Defined in

tools/src/tools/base/BaseTool.ts:415


createAndAddAnnotation()

static createAndAddAnnotation(viewport, ...annotationBaseData): void

Creates and adds an annotation of the given type, firing the annotation modified event on the new annotation. This implicitly uses the static class when you call it on the correct base class. For example, you can call the KeyImageTool.createAnnotation method on KeyImageTool.toolName by calling KeyImageTool.createAndAddAnnotation

Parameters

viewport: any

• ...annotationBaseData: any[]

Returns

void

Inherited from

AnnotationTool.createAndAddAnnotation

Defined in

tools/src/tools/base/AnnotationTool.ts:99


createAnnotation()

static createAnnotation(...annotationBaseData): Annotation

Creates a base annotation object, adding in any annotation base data provided

NOTE: This is the static version of this method and doesn't know about adding any of the dynamic data. Use this version to create a general annotation, and then extend it appropriately with the tool specific data. See this.createAnnotation for details.

Parameters

• ...annotationBaseData: any[]

Returns

Annotation

Inherited from

AnnotationTool.createAnnotation

Defined in

tools/src/tools/base/AnnotationDisplayTool.ts:140


createAnnotationForViewport()

static createAnnotationForViewport<T>(viewport, ...annotationBaseData): T

Creates a new annotation for the given viewport. This just adds the viewport reference data to the metadata, and otherwise returns the static class createAnnotation data.

Type Parameters

T extends Annotation

Parameters

viewport: any

• ...annotationBaseData: any[]

Returns

T

Inherited from

AnnotationTool.createAnnotationForViewport

Defined in

tools/src/tools/base/AnnotationTool.ts:81


createAnnotationMemo()

static createAnnotationMemo(element, annotation, options?): object

Creates an annotation memo storing the current data state on the given annotation object. This will store/recover handles data, text box and contour data, and if the options are set for deletion, will apply that correctly.

Parameters

element: HTMLDivElement

that the annotation is shown on.

annotation: Annotation

to store a memo for the current state.

options?

whether the annotation is being created (newAnnotation) or is in the process of being deleted (deleting)

  • Note the naming on deleting is to indicate the deletion is in progress, as the createAnnotationMemo needs to be called BEFORE the annotation is actually deleted.
  • deleting with a value of false is the same as newAnnotation=true, as it is simply the opposite direction. Use undefined for both newAnnotation and deleting for non-create/delete operations.

options.deleting?: boolean

options.newAnnotation?: boolean

Returns

object

Memo containing the annotation data.

id

id: string = annotationUID

operationType

operationType: string = 'annotation'

restoreMemo()

restoreMemo: () => void

Returns

void

Inherited from

AnnotationTool.createAnnotationMemo

Defined in

tools/src/tools/base/AnnotationTool.ts:719


createAnnotationState()

protected static createAnnotationState(annotation, deleting?): object

Creates an annotation state copy to allow storing the current state of an annotation. Contour and other special keys are handled by safeStructuredClone. Spline is omitted (non-cloneable refs).

Parameters

annotation: Annotation

the annotation to create a clone of

deleting?: boolean

a flag to indicate that this object is about to be deleted (deleting true), or was just created (deleting false), or neither (deleting undefined).

Returns

object

state information for the given annotation.

annotationUID

annotationUID: string

data

data: AnnotationData

deleting

deleting: boolean

Inherited from

AnnotationTool.createAnnotationState

Defined in

tools/src/tools/base/AnnotationTool.ts:689


createZoomPanMemo()

static createZoomPanMemo(viewport): object

Creates a zoom/pan memo that remembers the original zoom/pan position for the given viewport.

Parameters

viewport: any

Returns

object

restoreMemo()

restoreMemo: () => void

Returns

void

Inherited from

AnnotationTool.createZoomPanMemo

Defined in

tools/src/tools/base/BaseTool.ts:347


endGroupRecording()

static endGroupRecording(): void

Ends a group recording of history memo

Returns

void

Inherited from

AnnotationTool.endGroupRecording

Defined in

tools/src/tools/base/BaseTool.ts:405


hydrateBase()

protected static hydrateBase<T>(ToolClass, enabledElement, points, options): object

Type Parameters

T extends AnnotationTool

Parameters

ToolClass

enabledElement: IEnabledElement

points: Point3[]

options = {}

options.annotationUID?: string

options.referencedImageId?: string

options.toolInstance?: T

options.viewplaneNormal?: Point3

options.viewUp?: Point3

Returns

object

FrameOfReferenceUID

FrameOfReferenceUID: string

instance

instance: T

referencedImageId

referencedImageId: any

viewPlaneNormal

viewPlaneNormal: Point3 = finalViewPlaneNormal

viewport

viewport: StackViewport | VolumeViewport

viewUp

viewUp: Point3 = finalViewUp

Inherited from

AnnotationTool.hydrateBase

Defined in

tools/src/tools/base/AnnotationTool.ts:831


isInsideVolume()

static isInsideVolume(dimensions, indexPoints): boolean

Return true if all the index points are within the dimensions provided.

Parameters

dimensions: any

indexPoints: any

Returns

boolean

Inherited from

AnnotationTool.isInsideVolume

Defined in

tools/src/tools/base/BaseTool.ts:437


isSpecifiedTargetId()

static isSpecifiedTargetId(desiredVolumeId): (_viewport, __namedParameters) => any

A function generator to test if the target id is the desired one. Used for deciding which set of cached stats is appropriate to display for a given viewport.

This relies on the fact that the target id contains a substring which is the desired volume id when the target is a volume. It is also possible to use series query parameters such as /series/{seriesUID}/ to generate specific series selections within a stack viewport.

Parameters

desiredVolumeId: string

Returns

Function

Parameters

_viewport: any

__namedParameters

__namedParameters.targetId: any

Returns

any

Inherited from

AnnotationTool.isSpecifiedTargetId

Defined in

tools/src/tools/base/BaseTool.ts:128


isSuvScaled()

static isSuvScaled(viewport, targetId, imageId?): boolean

Returns true if the viewport is scaled to SUV units

Parameters

viewport: StackViewport | VolumeViewport

The viewport

targetId: string

The annotation targetId

imageId?: string

The annotation imageId

Returns

boolean

Inherited from

AnnotationTool.isSuvScaled

Defined in

tools/src/tools/base/AnnotationTool.ts:581


mergeDefaultProps()

static mergeDefaultProps(defaultProps, additionalProps?): any

Does a deep merge of property options. Allows extending the default values for a child class.

Parameters

defaultProps = {}

this is a base set of defaults to merge into

additionalProps?: any

the additional properties to merge into the default props

Returns

any

defaultProps if additional props not defined, or a merge into a new object containing additionalProps adding onto and overriding defaultProps.

Inherited from

AnnotationTool.mergeDefaultProps

Defined in

tools/src/tools/base/BaseTool.ts:111


startGroupRecording()

static startGroupRecording(): void

Starts a group recording of history memo, so that with a single undo you can undo multiple actions that are related to each other

Returns

void

Inherited from

AnnotationTool.startGroupRecording

Defined in

tools/src/tools/base/BaseTool.ts:400