Skip to main content

Selection

Annotations can be selected and deselected. This is achieved by holding down the Shift key (by default) and clicking on annotations.

API

There are various APIs for selecting and deselecting annotations along with get/set methods

import { annotations } from '@cornerstonejs/tools';

// selection of an annotation
annotations.selection.setAnnotationSelected(
annotationUID,
(selected = true),
(preserveSelected = false)
);

// get all the selected annotations
annotations.selection.getAnnotationsSelected();

// get all selected annotations from a specific tool
annotations.selection.getAnnotationsSelectedByToolName(toolName);

Read more

TIP

Read more about the selection API here