Skip to main content

annotation

Index

Namespaces

config

config:

conststyle

style: ToolStyle = ...

getFont

  • getFont - Returns a font string of the form “{fontSize}px fontName” used by canvas.


    Parameters

    • styleSpecifier: StyleSpecifier

      An object containing the specifications such as viewportId, toolGroupId, toolName and annotationUID which are used to get the style if the level of specificity is met (hierarchy is checked from most specific to least specific which is annotationLevel -> viewportLevel -> toolGroupLevel -> default.

    • optionalstate: AnnotationStyleStates

      An optional state to determine the final property name

    • optionalmode: ToolModes

      An optional mode to determine the final property name

    Returns string

    The font string.

getState

  • Given a Annotation object, return the annotationStyle State that it should be in based on its data


    Parameters

    • optionalannotation: Annotation

      The annotation that we want to style.

    Returns AnnotationStyleStates

    The state of the annotation whether it is Default, Highlighted, Locked, or Selected.

locking

locking:

checkAndDefineIsLockedProperty

  • checkAndDefineIsLockedProperty(annotation: Annotation): void
  • Properly initialize the isLocked on annotation, and set it as locked if isLocked is true.


    Parameters

    • annotation: Annotation

      The annotation object to be checked.

    Returns void

getAnnotationsLocked

  • Returns an array of all the annotation that is currently locked


    Returns Annotation[]

    An array of tool specific annotation objects.

getAnnotationsLockedCount

  • getAnnotationsLockedCount(): number
  • Get the number of locked annotation objects in the global set of locked annotation objects.


    Returns number

    The number of locked annotation objects.

isAnnotationLocked

  • isAnnotationLocked(annotation: Annotation): boolean
  • Given a Annotation object, return true if it is locked.


    Parameters

    Returns boolean

    A boolean value.

setAnnotationLocked

  • setAnnotationLocked(annotation: Annotation, locked?: boolean): void
  • Set the “Locked” state of a given annotation instance.

    @triggers

    ANNOTATION_LOCK_CHANGE


    Parameters

    • annotation: Annotation

      The annotation instance which will have its locked state changed. An event will only be triggered if the locked state of the given annotation instance changed.

    • locked: boolean = true

      A boolean value indicating if the instance should be locked (true) or not (false)

    Returns void

unlockAllAnnotations

  • unlockAllAnnotations(): void
  • Clears all the locked annotation


    Returns void

selection

selection:

deselectAnnotation

  • deselectAnnotation(annotationUID?: string): void
  • Deselect one or all annotations.


    Parameters

    • optionalannotationUID: string

      If an annotation is provided that instance will be removed from the internal selection set. If none is given, ALL selections will be cleared.

    Returns void

getAnnotationsSelected

  • getAnnotationsSelected(): string[]
  • Return an array of ALL the selected annotationUIDs


    Returns string[]

    An array of Annotation UIDs

getAnnotationsSelectedByToolName

  • getAnnotationsSelectedByToolName(toolName: string): string[]
  • Given a tool name, return ALL the annotationUIDs for that tool that are selected


    Parameters

    • toolName: string

      The name of the tool you want to get the selected annotation for

    Returns string[]

    An array of annotationUIDs

getAnnotationsSelectedCount

  • getAnnotationsSelectedCount(): number
  • Return the number of the selected annotation


    Returns number

    The size of the selected annotation set

isAnnotationSelected

  • isAnnotationSelected(annotationUID: string): boolean
  • Given an annotationUID, return true if it is selected, false otherwise.


    Parameters

    • annotationUID: string

      Annotation UID

    Returns boolean

    A boolean value.

setAnnotationSelected

  • setAnnotationSelected(annotationUID: string, selected?: boolean, preserveSelected?: boolean): void
  • Set a given annotationUID as selected or deselected based on the provided selected value.


    Parameters

    • annotationUID: string

      The annotation UID to be selected

    • selected: boolean = true

      When true, the annotation is selected. When false, the annotation is deselected.

    • preserveSelected: boolean = false

      When true, preserves existing selections (i.e., the given annotation is appended to the selection set). When false (the default behavior) the currently selected items are discarded (i.e., the given annotation instance replaces the currently selected ones).

    Returns void

state

state:

addAnnotation

  • addAnnotation(element: HTMLDivElement, annotation: Annotation): void
  • Add the annotation to the annotations for the FrameOfReference of the Viewport being viewed by the cornerstone3D enabled element.


    Parameters

    • element: HTMLDivElement

      HTMLDivElement

    • annotation: Annotation

      The annotation that is being added to the annotations manager.

    Returns void

getAnnotation

  • getAnnotation(annotationUID: string, element?: HTMLDivElement): Annotation
  • Get the Annotation object by its UID


    Parameters

    • annotationUID: string

      The unique identifier of the annotation.

    • optionalelement: HTMLDivElement

      The element that the tool is being used on.

    Returns Annotation

    A Annotation object

getAnnotations

  • getAnnotations(element: HTMLDivElement, toolName: string): Annotations
  • Returns the annotations for the FrameOfReference of the Viewport being viewed by the cornerstone3D enabled element.


    Parameters

    • element: HTMLDivElement

      The HTML element.

    • toolName: string

      The name of the tool.

    Returns Annotations

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

getDefaultAnnotationManager

  • getDefaultAnnotationManager(): default
  • It returns the default annotations manager.


    Returns default

    the singleton default annotations manager.

getViewportSpecificAnnotationManager

  • getViewportSpecificAnnotationManager(element?: HTMLDivElement | IEnabledElement): default
  • Given an element, return the FrameOfReferenceSpecificStateManager for that element


    Parameters

    • optionalelement: HTMLDivElement | IEnabledElement

      The element that the state manager is managing the state of.

    Returns default

    The default state manager

removeAllAnnotations

  • removeAllAnnotations(element?: HTMLDivElement): void
  • It removes all annotations from the default annotation manager


    Parameters

    • optionalelement: HTMLDivElement

      Optional element to get the annotation manager from, if not specified it will use the default annotation manager.

    Returns void

removeAnnotation

  • removeAnnotation(annotationUID: string, element?: HTMLDivElement): void
  • Remove the annotation by UID of the annotation.


    Parameters

    • annotationUID: string

      The unique identifier for the annotation.

    • optionalelement: HTMLDivElement

      HTMLDivElement

    Returns void

visibility

visibility:

setAnnotationVisibility

  • setAnnotationVisibility(annotationUID: string, visible?: boolean): void
  • Set the “visible” state of a given annotation instance.


    Parameters

    • annotationUID: string

      The annotation uid which will have its visible state changed. An event will only be triggered if the visible state of the given annotation instance changed.

    • visible: boolean = true

      A boolean value indicating if the instance should be visible (true) or not (false)

    Returns void

checkAndDefineIsVisibleProperty

  • checkAndDefineIsVisibleProperty(annotation: Annotation): void
  • It decorates given annotation with isVisible property. It properly initializes the isVisible on annotation(the property will be create if does not exist yet)


    Parameters

    • annotation: Annotation

      The annotation object to be checked.

    Returns void

isAnnotationVisible

  • isAnnotationVisible(annotationUID: string): boolean | undefined
  • Given an annotation UID, return true if it is visible, false if hidden and undefined if does not exist.


    Parameters

    • annotationUID: string

      The annotation uid to tell if is visible or not.

    Returns boolean | undefined

    A boolean value or value if does not exist.

showAllAnnotations

  • showAllAnnotations(): void
  • Clears all the hidden annotations.


    Returns void