Tool Types
In order to make development of new Tools quick, easy and relatively boilerplate-free, all Tools extend
one of three base classes, which provide the functionality required to integrate seamlessly into the Cornerstone Tools framework.
Base classes have two types of methods of interest to Tool developers:
@abstract
methods: These methods must be implemented by subclasses.@virtual
methods: These methods have default functionality, but may be overridden by subclasses to alter functionality.
Check the api
docs for full documentation of the api.
Base Tool
The BaseTool
is the top level parent of all Tools in Cornerstone Tools. It takes care of initializing the Tool's configuration, applying mixins, and providing @virtual
functions for mouse/touch interaction for Active
tools.
- Virtual Methods:
preMouseDownCallback
postMouseDownCallback
preTouchStartCallback
postTouchStartCallback
Base Annotation Tool
The BaseAnnotationTool
is an extension of BaseTool
for Tools that create and manipulate annotation data.
- Abstract Methods:
createNewMeasurement
pointNearTool
distanceFromPoint
renderToolData
- Virtual Methods:
mouseMoveCallback
handleSelectedCallback
toolSelectedCallback
updateCachedStats
Brush Tool
The BaseBrushTool
is an extension of BaseTool
for Tools which edit the brush
colormap
data, used for displaying segmentations. Unlike subclasses of BaseAnnotationTool
, subclasses of BaseBrushTool
don't manage the rendering of their own data. Rendering of the segmentation masks is centralized at src/eventListeners/onImageRenderedBrushEventHandler.js
. If at least one subclass of BaseBrushTool
is either Active
, Enabled
or Passive
, the segmentation data is rendered to the canvas.
- Abstract Methods:
renderBrush
_paint
Base Segmentation Tool
The BaseSegmentationTool
is an extension of BaseTool
for Tools which edit the labelmap
data, used for displaying segmentation.
Unlike subclasses of BaseAnnotationTool
, subclasses of BaseSegmentationTool
don't manage the rendering of their own data.
Rendering of the segmentation masks is centralized at src/eventListeners/onImageRenderedBrushEventHandler.js
.
If at least one subclass of BaseSegmentationTool
is either Active
, Enabled
or Passive
, the segmentation data is rendered to the canvas.
- Abstract Methods:
_changeCursor