Skip to main content

Variable: state

const state: object

Type declaration​

resetAnnotationManager()​

resetAnnotationManager: () => void

Returns​

void

addAnnotation()​

Add the annotation to the annotation manager along with the options that is used to filter the annotation manager and the annotation group that the annotation belongs to.

As a result, our default implementation will add the annotation to the default manager using the FrameOfReferenceUID as the group key.

Parameters​

• annotation: Annotation

The annotation that is being added to the annotations manager.

• annotationGroupSelector: AnnotationGroupSelector

element or FrameOfReferenceUID that is used to group annotations in the annotation manager.

Returns​

string

addChildAnnotation()​

Creates a parent/child association between annotations. A annotation may have only one parent and multiple children (eg: a contour may have multiple holes in it).

Parameters​

• parentAnnotation: Annotation

Parent annotation

• childAnnotation: Annotation

Child annotation

Returns​

void

clearParentAnnotation()​

Removes the association between the annotation passed as parameter and its parent in case it has one (eg: contour holes).

Parameters​

• annotation: Annotation

Annotation

Returns​

void

getAllAnnotations()​

Returns​

Annotations

getAnnotation()​

Get the Annotation object by its UID

Parameters​

• annotationUID: string

The unique identifier of the annotation.

Returns​

Annotation

getAnnotationManager()​

It returns the default annotations manager.

Returns​

any

the singleton default annotations manager.

getAnnotations()​

Returns the annotations for a given tool with the provided options that is used to filter annotations based on the annotation manager.

In our default implementation, the options are the element and/or the FrameOfReferenceUID. Hence, the getAnnotations function will return the annotations for the given tool that are associated with the FrameOfReferenceUID.

Parameters​

• toolName: string

The name of the tool.

• annotationGroupSelector: AnnotationGroupSelector

element or FrameOfReferenceUID that is used to group annotations in the annotation manager.

Returns​

Annotations

The annotations corresponding to the Frame of Reference and the toolName.

getChildAnnotations()​

Returns all children annotation of a given one since annotations can be associated in a parent/child way (eg: polyline holes)

Parameters​

• annotation: Annotation

Annotation

Returns​

Annotation[]

Child annotations

getNumberOfAnnotations()​

Get the number of annotations for a given tool with the provided options that is used to filter annotations based on the annotation manager.

In our default implementation, the options are the element and/or the FrameOfReferenceUID. Hence, the getNumberOfAnnotations function will return the number of annotations for the given tool that are associated with the FrameOfReferenceUID.

Parameters​

• toolName: string

The name of the tool

• annotationGroupSelector: AnnotationGroupSelector

element or FrameOfReferenceUID that is used to group annotations in the annotation manager.

Returns​

number

getParentAnnotation()​

Returns the parent annotation of a given one since annotations can be associated in a parent/child way (eg: polyline holes)

Parameters​

• annotation: Annotation

Annotation

Returns​

Annotation

Parent annotation

invalidateAnnotation()​

Invalidate current and all parent annotations (eg: contour holes)

Parameters​

• annotation: Annotation

Annotation

Returns​

void

removeAllAnnotations()​

It removes all annotations from the default annotation manager

Returns​

void

removeAnnotation()​

Remove the annotation by UID of the annotation.

Note - the annotation state is NOT preserved here in the HistoryMemo state. If you wish to preserve the state, you must call the create annotation memo BEFORE removing the annotation, and pass the deleting: true flag to it.

Parameters​

• annotationUID: string

The unique identifier for the annotation.

Returns​

void

removeAnnotations()​

Removes all annotations associated with the specified group (FrameOfReferenceUID) and tool, or all annotations for the group (FrameOfReferenceUID) if the tool name is not provided.

Parameters​

• toolName: string

Optional. The name of the tool to remove annotations for.

• annotationGroupSelector: AnnotationGroupSelector

The group (FrameOfReferenceUID) to remove annotations for.

Returns​

void

setAnnotationManager()​

Set the annotation manager to be used for rendering, adding, removing, etc.

Parameters​

• annotationManager: IAnnotationManager

The annotation manager to be used

Returns​

void

triggerAnnotationAddedForElement()​

It triggers an event for the element when an annotation is added

Parameters​

• annotation: Annotation

Annotation - The annotation that was added.

• element: HTMLDivElement

The element that the annotation was added to.

Returns​

void

triggerAnnotationAddedForFOR()​

If the annotation has a FrameOfReferenceUID, it triggers the ANNOTATION_ADDED event for all the viewports that has the same FrameOfReferenceUID.

Parameters​

• annotation: Annotation

Annotation - The annotation that was added

Returns​

void

triggerAnnotationCompleted()​

Triggers an annotation completed event.

Parameters​

• annotation: Annotation

Returns​

void

triggerAnnotationModified()​

Triggers an annotation modified event. Note this no longer requires the element, which should be handled by testing to see which viewports this element is shown on.

Parameters​

• annotation: Annotation

• element?: HTMLDivElement

• changeType?: ChangeTypes = ChangeTypes.HandlesUpdated

Returns​

void

triggerAnnotationRemoved()​

Triggers an annotation removed event.

Parameters​

• eventDetail: AnnotationRemovedEventDetail

Event detail

Returns​

void

triggerContourAnnotationCompleted()​

Triggers an annotation completed event for contours (same annotation completed event but with more specific details).

Parameters​

• annotation: Annotation

• contourHoleProcessingEnabled: boolean = false

Returns​

void

Defined in​

tools/src/stateManagement/annotation/index.ts:11