Skip to main content

Class: FrameOfReferenceSpecificAnnotationManager

This is the default annotation manager. It stores annotations by default based on the FrameOfReferenceUID. However, it is possible to override the getAnnotationStateKey function to store annotations based on any other property of the element. When you write your custom annotation manager, you can use the setAnnotationManager function to set your custom annotation.

Note that this class is a singleton and should not be instantiated directly. To get the stored annotations information you can use ToolState helpers.

Implements​

Constructors​

new FrameOfReferenceSpecificAnnotationManager()​

new FrameOfReferenceSpecificAnnotationManager(uid?): FrameOfReferenceSpecificAnnotationManager

Parameters​

• uid?: string

The uid of the state manager. If omitted it is autogenerated.

Returns​

FrameOfReferenceSpecificAnnotationManager

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:40

Properties​

uid​

readonly uid: string

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:34

Methods​

_imageVolumeModifiedHandler()​

_imageVolumeModifiedHandler(evt): void

When a volume is modified we invalidate all of the annotations on the volume's FrameOfReferenceUID. This is mainly to update statistics calculations when an annotation is drawn whilst data is still loading.

Parameters​

• evt: ImageVolumeModifiedEvent

The IMAGE_VOLUME_MODIFIED rendering event.

Returns​

void

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:87


addAnnotation()​

addAnnotation(annotation, groupKey?): void

Adds an annotation to the specified group.

Parameters​

• annotation: Annotation

The annotation to add.

• groupKey?: string

The annotation group key to add the annotation to (in default manager it is FrameOfReferenceUID).

Returns​

void

Implementation of​

IAnnotationManager.addAnnotation

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:213


getAllAnnotations()​

getAllAnnotations(): Annotations

return all annotations as a single array

Returns​

Annotations

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:401


getAnnotation()​

getAnnotation(annotationUID): Annotation

Returns the annotation with the specified UID.

Parameters​

• annotationUID: string

The unique identifier of the annotation.

Returns​

Annotation

The retrieved annotation.

Implementation of​

IAnnotationManager.getAnnotation

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:159


getAnnotations()​

getAnnotations(groupKey, toolName?): Annotations | GroupSpecificAnnotations

Returns the annotations associated with the specified group, if the toolName is specified, it will return the annotations for the specified tool.

Parameters​

• groupKey: string

The annotation group key to retrieve annotations for (in default manager it is FrameOfReferenceUID).

• toolName?: string

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

Returns​

Annotations | GroupSpecificAnnotations

The annotations associated with the specified group (default FrameOfReferenceUID) and tool, or all annotations for the group (FrameOfReferenceUID) if the tool name is not provided. WARNING: The list returned here is internal tool data, not a copy, so do NOT modify it.

Implementation of​

IAnnotationManager.getAnnotations

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:133


getFramesOfReference()​

getFramesOfReference(): string[]

Returns all the available frameOfReferences inside the state manager

Returns​

string[]

  • All the added frames of references inside the manager

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:119


getGroupKey()​

getGroupKey(annotationGroupSelector): string

Annotations are stored in Groups. Our default annotation manager groups the annotations based on FrameOfReferenceUID, but it is possible that you can group them based on different aspects or you only have one group totally.

This function returns the group key associated with the specified annotationGroupSelector. The annotationGroupSelector can be an HTML element or a string.

Parameters​

• annotationGroupSelector: AnnotationGroupSelector

element or a string that is provided to the annotation manager to get the key.

Returns​

string

  • The annotation state key for the element.

Implementation of​

IAnnotationManager.getGroupKey

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:63


getNumberOfAllAnnotations()​

getNumberOfAllAnnotations(): number

Returns the total number of annotations across all groups.

Returns​

number

The number of all annotations in the state

Implementation of​

IAnnotationManager.getNumberOfAllAnnotations

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:414


getNumberOfAnnotations()​

getNumberOfAnnotations(groupKey, toolName?): number

Returns the number of annotations associated with the specified group. If the toolName is specified, it will return the number of annotations

Parameters​

• groupKey: string

The annotation group key to retrieve annotations for (in default manager it is FrameOfReferenceUID).

• toolName?: string

The name of the tool to retrieve data for.

Returns​

number

The number of annotations for a given tool in the state

Implementation of​

IAnnotationManager.getNumberOfAnnotations

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:187


removeAllAnnotations()​

removeAllAnnotations(): Annotations

Removes all annotations.

Returns​

Annotations

The removed annotations

Implementation of​

IAnnotationManager.removeAllAnnotations

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:433


removeAnnotation()​

removeAnnotation(annotationUID): void

Removes the annotation with the specified UID.

Parameters​

• annotationUID: string

The unique identifier of the annotation to remove.

Returns​

void

Implementation of​

IAnnotationManager.removeAnnotation

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:254


removeAnnotations()​

removeAnnotations(groupKey, toolName?): Annotations

Removes all annotations associated with the specified group.

Parameters​

• groupKey: string

The group key to remove annotations for (in default manager it is FrameOfReferenceUID).

• toolName?: string

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

Returns​

Annotations

The removed annotations

Implementation of​

IAnnotationManager.removeAnnotations

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:291


restoreAnnotations()​

restoreAnnotations(state, groupKey?, toolName?): void

Restores a section of the annotations. Useful for loading in serialized data.

  • If no arguments are given, the entire AnnotationState instance is restored.
  • If the FrameOfReferenceUID is given, the corresponding FrameOfReferenceSpecificAnnotations instance is restored.
  • If both the FrameOfReferenceUID and the toolName are are given, the corresponding Annotations instance is restored.

Parameters​

• state: Annotations | GroupSpecificAnnotations | AnnotationState

• groupKey?: string

A filter string for restoring only the annotations of a specific frame of reference.

• toolName?: string

A filter string for restoring annotation for a specific tool on a specific frame of reference.

Returns​

void

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:369


saveAnnotations()​

saveAnnotations(groupKey?, toolName?): Annotations | GroupSpecificAnnotations | AnnotationState

Returns a section of the annotations. Useful for serialization. If both groupKey (default manager is FrameOfReferenceUID) and toolName are provided, returns the corresponding Annotations instance for that groupKey (FrameOfReferenceUID) and toolName. If only groupKey is provided, returns the corresponding FrameOfReferenceSpecificAnnotations instance for that groupKey. If neither groupKey nor toolName is provided, returns the entire AnnotationState object.

Parameters​

• groupKey?: string

Optional. The group key (e.g. FrameOfReferenceUID) to retrieve annotations for.

• toolName?: string

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

Returns​

Annotations | GroupSpecificAnnotations | AnnotationState

A section of the annotations.

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:331


setPreprocessingFn()​

setPreprocessingFn(preprocessingFn): void

Parameters​

• preprocessingFn

Returns​

void

Defined in​

tools/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts:444