Skip to main content

Class: WorldCrosshairTool

WorldCrosshairTool ("Reference Point") stores and renders one persistent world-space point of interest per tool group.

The user selected this anatomical/world point; the tool keeps that point stable while viewports scroll, pan, zoom or rotate, unless the user explicitly moves the point. The point is never derived from viewport cameras, camera focal points or slice plane intersections, and the tool deliberately does not react to CAMERA_MODIFIED or view-state resets.

The tool targets the Generic ("next") viewport architecture exclusively: it only operates on direct PLANAR_NEXT viewports through the native view-state API (getResolvedView / setViewReference / setViewState). Legacy stack and volume viewports (and their compatibility adapters) are ignored.

The tool works with a single viewport and renders the point (or its off-slice projection) in linked planar viewports. It does not render slice intersection lines, does not rotate or translate slice planes and does not touch slab thickness: those belong to the SliceIntersectionTool.

Extends

Constructors

new WorldCrosshairTool()

new WorldCrosshairTool(toolProps, defaultToolProps): WorldCrosshairTool

Parameters

toolProps: PublicToolProps = {}

defaultToolProps: SharedToolProp = ...

Returns

WorldCrosshairTool

Overrides

AnnotationTool.constructor

Defined in

tools/src/tools/WorldCrosshairTool.ts:271

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 = 'Reference Point'

User-facing label for this tool.

Defined in

tools/src/tools/WorldCrosshairTool.ts:253


toolName

static toolName: any

Overrides

AnnotationTool.toolName

Defined in

tools/src/tools/WorldCrosshairTool.ts:251

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


_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/WorldCrosshairTool.ts:765


_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/WorldCrosshairTool.ts:796


_getLinkedViewports()

protected _getLinkedViewports(): Viewport[]

Resolves the planar viewports linked to the world point according to the configured link policy. The source viewport (where the point was set) is always considered linked.

Returns

Viewport[]

Defined in

tools/src/tools/WorldCrosshairTool.ts:1215


_getViewportsInfo()

protected _getViewportsInfo(): IViewportId[]

Returns

IViewportId[]

Defined in

tools/src/tools/WorldCrosshairTool.ts:1206


addNewAnnotation()

addNewAnnotation(evt): WorldCrosshairAnnotation

Called on mouse down / touch start in empty space: sets the world point from the event world coordinates and starts a drag so the point can be refined while the button is held. By default this requires shift to be held (clickToSet enables plain clicks), and only planar generic viewports participate.

Parameters

evt: InteractionEventType

Returns

WorldCrosshairAnnotation

Overrides

AnnotationTool.addNewAnnotation

Defined in

tools/src/tools/WorldCrosshairTool.ts:524


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/WorldCrosshairTool.ts:748


clearWorldCrosshair()

clearWorldCrosshair(options): void

Clear command alias for clearWorldPoint.

Parameters

options = {}

options.suppressEvents?: boolean

Returns

void

Defined in

tools/src/tools/WorldCrosshairTool.ts:426


clearWorldPoint()

clearWorldPoint(options): void

Clears the world point, removes the marker from all linked views and emits WORLD_CROSSHAIR_POINT_CLEARED (unless suppressed).

Parameters

options = {}

options.suppressEvents?: boolean

Returns

void

Defined in

tools/src/tools/WorldCrosshairTool.ts:402


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

Double click on the marker jumps linked slice viewports back to the stored world point.

Parameters

evt: MouseDoubleClickEventType

Returns

void

Defined in

tools/src/tools/WorldCrosshairTool.ts:598


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/WorldCrosshairTool.ts:727


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

The annotation object associated with the 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/WorldCrosshairTool.ts:708


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


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(): WorldCrosshairState

Returns a copy of the tool state.

Returns

WorldCrosshairState

Defined in

tools/src/tools/WorldCrosshairTool.ts:467


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


getWorldPoint()

getWorldPoint(): Point3

Returns a copy of the stored world point, or null when no point is set.

Returns

Point3

Defined in

tools/src/tools/WorldCrosshairTool.ts:393


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/WorldCrosshairTool.ts:585


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: WorldCrosshairAnnotation

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/WorldCrosshairTool.ts:683


jumpLinkedViewportsToWorldPoint()

jumpLinkedViewportsToWorldPoint(options): void

Jumps all linked planar viewports to the stored world point by navigating each viewport's view reference (never rotating, never touching slab thickness or zoom). Emits WORLD_CROSSHAIR_JUMPED_TO_POINT.

Parameters

options = {}

options.jumpMode?: WorldCrosshairJumpMode

options.preservePanZoom?: boolean

Returns

void

Defined in

tools/src/tools/WorldCrosshairTool.ts:435


mouseMoveCallback()

mouseMoveCallback(evt, filteredToolAnnotations?): boolean

Hover highlighting, plus continuous live update of the point while shift is held (when configured).

Parameters

evt: MouseMoveEventType

filteredToolAnnotations?: Annotations

Returns

boolean

Overrides

AnnotationTool.mouseMoveCallback

Defined in

tools/src/tools/WorldCrosshairTool.ts:628


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/WorldCrosshairTool.ts:489


onSetToolDisabled()

onSetToolDisabled(): void

Returns

void

Defined in

tools/src/tools/WorldCrosshairTool.ts:497


onSetToolEnabled()

onSetToolEnabled(): void

Returns

void

Defined in

tools/src/tools/WorldCrosshairTool.ts:482


onSetToolPassive()

onSetToolPassive(): void

Returns

void

Defined in

tools/src/tools/WorldCrosshairTool.ts:493


redo()

redo(): void

Redo an action (undo the undo)

Returns

void

Inherited from

AnnotationTool.redo

Defined in

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


renderAnnotation()

renderAnnotation(enabledElement, svgDrawingHelper): boolean

Renders the marker for one linked planar viewport. By default the reference point is drawn as a full vertical and horizontal line intersecting at the projection of the world point onto the viewport plane ('crosshair' marker style); the 'point' style draws a filled dot instead. A point that is not on the currently displayed slice is drawn dashed/faded (and optionally labeled with its signed distance) so it never looks like it lies on the slice.

Parameters

enabledElement: IEnabledElement

svgDrawingHelper: SVGDrawingHelper

Returns

boolean

Overrides

AnnotationTool.renderAnnotation

Defined in

tools/src/tools/WorldCrosshairTool.ts:819


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


setLocked()

setLocked(locked): void

Locks or unlocks the point against interactive changes (click, drag, shift+move). The programmatic API is not affected by the lock.

Parameters

locked: boolean

Returns

void

Defined in

tools/src/tools/WorldCrosshairTool.ts:460


setVisibility()

setVisibility(visible): void

Shows or hides the marker in all linked views without clearing the point.

Parameters

visible: boolean

Returns

void

Defined in

tools/src/tools/WorldCrosshairTool.ts:447


setWorldPoint()

setWorldPoint(worldPoint, options): void

Sets the persistent world point. This is the only way the point changes: it is never recomputed from cameras or plane intersections.

Emits WORLD_CROSSHAIR_POINT_CHANGED only when the point actually changes (beyond a small epsilon). Jumps linked slice viewports to the point when options.jump (or the jumpOnSet configuration) is true.

Parameters

worldPoint: Point3

options = {}

options.frameOfReferenceUID?: string

options.jump?: boolean

options.sourceRenderingEngineId?: string

options.sourceViewportId?: string

options.suppressEvents?: boolean

Returns

void

Defined in

tools/src/tools/WorldCrosshairTool.ts:322


startGroupRecording()

protected startGroupRecording(): void

Returns

void

Inherited from

AnnotationTool.startGroupRecording

Defined in

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


toolSelectedCallback()

toolSelectedCallback(evt, annotation): void

Starts dragging the marker within the active planar viewport. The drag only moves the world point: it never rotates viewports, never translates slice planes through line dragging and never changes slab thickness.

Parameters

evt: InteractionEventType

annotation: Annotation

Returns

void

Overrides

AnnotationTool.toolSelectedCallback

Defined in

tools/src/tools/WorldCrosshairTool.ts:569


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