Annotations

.Components. Annotations

new Annotations(options)

Source:
Tutorials:
Provides programmatic interaction with a PMA.UI.View.Viewport instance to manipulate annotations
Parameters:
Name Type Description
options Object
Properties
Name Type Description
context PMA.UI.Components.Context
viewport PMA.UI.View.Viewport
serverUrl string PMA.core server URL
path string Path of an slide to save annotations for
enabled boolean
Fires:

Methods

addAnnotation(annotation)

Source:
Adds an annotation to the current ones (without saving them to the server)
Parameters:
Name Type Description
annotation PMA.UI.Components.Annotations~annotationEntity An annotation object

clearHighlight()

Source:
Clears all highlighted annotations

clearSelection()

Source:
Clears all selected annotations

deleteAnnotation(id)

Source:
Deletes an annotation
Parameters:
Name Type Description
id number The id of the annotation to delete
Fires:

finishDrawing(accept, annotationType)

Source:
Exits drawing mode
Parameters:
Name Type Description
accept boolean True to accept the annotation that was currently being drawn
annotationType PMA.UI.Types.Annotation The annotation type that was drawing

getEnabled() → {boolean}

Source:
Gets the state of the annotation component
Returns:
Type
boolean

getSelection() → {Array.<{metaData: {PointCount: Number}}>}

Source:
Get the currently selected annotations
Returns:
Array of PMA.core annotation instances
Type
Array.<{metaData: {PointCount: Number}}>

hasChanges() → {bool}

Source:
Returns whether any annotation has unsaved changes
Returns:
Type
bool

highlightAnnotation(id)

Source:
Renders the requested annotation using the highlight style
Parameters:
Name Type Description
id Number The id of the annotation to render

listen(eventName, callback)

Source:
Attaches an event listener
Parameters:
Name Type Description
eventName PMA.UI.Components.Events The name of the event to listen to
callback function The function to call when the event occurs

mergeSelection(selectionopt)

Source:
Merges the selected annotations into one geometry
Parameters:
Name Type Attributes Default Description
selection Array.<ol.Feature> <optional>
null An array of annotations to merge. If this parameter is not supplied, the currently selected annotations are used.

replaceAnnotations(annotations)

Source:
Replaces the currently loaded annotations with the provided ones (without saving them to the server)
Parameters:
Name Type Description
annotations Array.<PMA.UI.Components.Annotations~annotationEntity> Array of annotation objects

saveAnnotations()

Source:
Saves all the annotations to PMA.core

selectAnnotation(id)

Source:
Adds the requested annotation in the selection list
Parameters:
Name Type Description
id Number The id of the annotation to select

setEnabled(enabled)

Source:
Enables or disables annotation drawing
Parameters:
Name Type Description
enabled boolean

startDrawing(options)

Source:
Instructs the viewport to enter annotation drawing mode
Parameters:
Name Type Description
options PMA.UI.Components.Annotations~startDrawingOptions Options to start drawing

Type Definitions

annotationEntity

Source:
Properties:
Name Type Attributes Default Description
LayerID Number The layer id
Geometry string The annotation geometry in wkt format
Notes string <optional>
Optional notes for the annotation
Classification string <optional>
Optional classification string (Necrosis, tumor etc)
Color string <optional>
Optional stroke color (e.g. #ff0000)
UpdateInfo string <optional>
Optional update info
FillColor string <optional>
Optional fill color (e.g. #ff0000)
Dimensions Number <optional>
Optional dimensionality of the annotation
LineThickness Number <optional>
1 Optional stroke line thickness
Annotation entity
Type:
  • Object

startDrawingOptions

Source:
Properties:
Name Type Attributes Description
type PMA.UI.Types.Annotation The type of the annotation to start drawing
color string Annotation outline color as HTML hex string
fillColor string Annotation fill color as HTML hex string
penWidth Number The line thickness
notes string Text to add to the annotation
iconRelativePath string <optional>
Relative path to an image that will be used when drawing a point. The base URL is defined by the imageBaseUrl property of the annotations initialization option supplied in the PMA.UI.View.Viewport constructor
feature ol.Feature <optional>
An existing feature to edit. If this argument has a value, the viewport goes into edit mode, instead of drawing a new annotation
size Array.<Number> <optional>
An optional array of [width, height] in microns. Applies only to circles and rectangles. When drawing a circle only width is taken into account and it's the diameter of the circle.
Options parameter required to start drawing
Type:
  • Object