@cornerstonejs/tools 1.36.3 → 1.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/drawingSvg/drawEllipse.js +1 -1
- package/dist/cjs/drawingSvg/drawEllipse.js.map +1 -1
- package/dist/cjs/drawingSvg/drawEllipseByCoordinates.js +2 -3
- package/dist/cjs/drawingSvg/drawEllipseByCoordinates.js.map +1 -1
- package/dist/cjs/enums/StrategyCallbacks.d.ts +13 -0
- package/dist/cjs/enums/StrategyCallbacks.js +17 -0
- package/dist/cjs/enums/StrategyCallbacks.js.map +1 -0
- package/dist/cjs/enums/index.d.ts +2 -1
- package/dist/cjs/enums/index.js +3 -1
- package/dist/cjs/enums/index.js.map +1 -1
- package/dist/cjs/eventDispatchers/keyboardEventHandlers/keyDown.js +17 -7
- package/dist/cjs/eventDispatchers/keyboardEventHandlers/keyDown.js.map +1 -1
- package/dist/cjs/eventDispatchers/shared/getActiveToolForKeyboardEvent.js +4 -1
- package/dist/cjs/eventDispatchers/shared/getActiveToolForKeyboardEvent.js.map +1 -1
- package/dist/cjs/eventDispatchers/shared/getToolsWithActionsForKeyboardEvents.d.ts +3 -0
- package/dist/cjs/eventDispatchers/shared/getToolsWithActionsForKeyboardEvents.js +33 -0
- package/dist/cjs/eventDispatchers/shared/getToolsWithActionsForKeyboardEvents.js.map +1 -0
- package/dist/cjs/eventDispatchers/shared/getToolsWithActionsForMouseEvent.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/config/segmentationColor.js +8 -1
- package/dist/cjs/stateManagement/segmentation/config/segmentationColor.js.map +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.js +1 -2
- package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/cjs/tools/base/AnnotationTool.js.map +1 -1
- package/dist/cjs/tools/base/BaseTool.d.ts +2 -0
- package/dist/cjs/tools/base/BaseTool.js +7 -1
- package/dist/cjs/tools/base/BaseTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/BrushTool.d.ts +45 -3
- package/dist/cjs/tools/segmentation/BrushTool.js +197 -71
- package/dist/cjs/tools/segmentation/BrushTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/CircleScissorsTool.js +3 -1
- package/dist/cjs/tools/segmentation/CircleScissorsTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/SphereScissorsTool.js +3 -0
- package/dist/cjs/tools/segmentation/SphereScissorsTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/BrushStrategy.d.ts +87 -0
- package/dist/cjs/tools/segmentation/strategies/BrushStrategy.js +137 -0
- package/dist/cjs/tools/segmentation/strategies/BrushStrategy.js.map +1 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/determineSegmentIndex.d.ts +6 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/determineSegmentIndex.js +53 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/determineSegmentIndex.js.map +1 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/dynamicThreshold.d.ts +6 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/dynamicThreshold.js +41 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/dynamicThreshold.js.map +1 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/erase.d.ts +5 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/erase.js +12 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/erase.js.map +1 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/index.d.ts +35 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/index.js +24 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/index.js.map +1 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/islandRemoval.d.ts +5 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/islandRemoval.js +129 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/islandRemoval.js.map +1 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/preview.d.ts +8 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/preview.js +84 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/preview.js.map +1 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/regionFill.d.ts +5 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/regionFill.js +27 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/regionFill.js.map +1 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/setValue.d.ts +8 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/setValue.js +33 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/setValue.js.map +1 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/threshold.d.ts +5 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/threshold.js +24 -0
- package/dist/cjs/tools/segmentation/strategies/compositions/threshold.js.map +1 -0
- package/dist/cjs/tools/segmentation/strategies/eraseCircle.d.ts +2 -7
- package/dist/cjs/tools/segmentation/strategies/eraseCircle.js +7 -4
- package/dist/cjs/tools/segmentation/strategies/eraseCircle.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/eraseSphere.d.ts +2 -7
- package/dist/cjs/tools/segmentation/strategies/eraseSphere.js +7 -6
- package/dist/cjs/tools/segmentation/strategies/eraseSphere.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillCircle.d.ts +13 -8
- package/dist/cjs/tools/segmentation/strategies/fillCircle.js +68 -90
- package/dist/cjs/tools/segmentation/strategies/fillCircle.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillRectangle.js +3 -9
- package/dist/cjs/tools/segmentation/strategies/fillRectangle.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillSphere.d.ts +6 -9
- package/dist/cjs/tools/segmentation/strategies/fillSphere.js +53 -64
- package/dist/cjs/tools/segmentation/strategies/fillSphere.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/utils/getStrategyData.d.ts +3 -0
- package/dist/cjs/tools/segmentation/strategies/utils/getStrategyData.js +6 -0
- package/dist/cjs/tools/segmentation/strategies/utils/getStrategyData.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/utils/isWithinThreshold.d.ts +2 -2
- package/dist/cjs/tools/segmentation/strategies/utils/isWithinThreshold.js +2 -2
- package/dist/cjs/tools/segmentation/strategies/utils/isWithinThreshold.js.map +1 -1
- package/dist/cjs/types/BoundsIJK.d.ts +1 -1
- package/dist/cjs/types/FloodFillTypes.d.ts +4 -4
- package/dist/cjs/types/LabelmapToolOperationData.d.ts +7 -2
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/cjs/utilities/math/ellipse/getCanvasEllipseCorners.d.ts +2 -3
- package/dist/cjs/utilities/math/ellipse/index.d.ts +2 -2
- package/dist/cjs/utilities/math/ellipse/index.js +26 -2
- package/dist/cjs/utilities/math/ellipse/index.js.map +1 -1
- package/dist/cjs/utilities/math/ellipse/pointInEllipse.d.ts +4 -1
- package/dist/cjs/utilities/math/ellipse/pointInEllipse.js +30 -17
- package/dist/cjs/utilities/math/ellipse/pointInEllipse.js.map +1 -1
- package/dist/cjs/utilities/math/sphere/pointInSphere.d.ts +1 -0
- package/dist/cjs/utilities/math/sphere/pointInSphere.js +2 -1
- package/dist/cjs/utilities/math/sphere/pointInSphere.js.map +1 -1
- package/dist/cjs/utilities/segmentation/brushThresholdForToolGroup.d.ts +1 -1
- package/dist/cjs/utilities/segmentation/brushThresholdForToolGroup.js +5 -5
- package/dist/cjs/utilities/segmentation/brushThresholdForToolGroup.js.map +1 -1
- package/dist/esm/drawingSvg/drawEllipse.js +1 -1
- package/dist/esm/drawingSvg/drawEllipse.js.map +1 -1
- package/dist/esm/drawingSvg/drawEllipseByCoordinates.js +2 -3
- package/dist/esm/drawingSvg/drawEllipseByCoordinates.js.map +1 -1
- package/dist/esm/enums/StrategyCallbacks.js +15 -0
- package/dist/esm/enums/StrategyCallbacks.js.map +1 -0
- package/dist/esm/enums/index.js +2 -1
- package/dist/esm/enums/index.js.map +1 -1
- package/dist/esm/eventDispatchers/keyboardEventHandlers/keyDown.js +17 -7
- package/dist/esm/eventDispatchers/keyboardEventHandlers/keyDown.js.map +1 -1
- package/dist/esm/eventDispatchers/shared/getActiveToolForKeyboardEvent.js +4 -1
- package/dist/esm/eventDispatchers/shared/getActiveToolForKeyboardEvent.js.map +1 -1
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForKeyboardEvents.js +29 -0
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForKeyboardEvents.js.map +1 -0
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForMouseEvent.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/config/segmentationColor.js +8 -1
- package/dist/esm/stateManagement/segmentation/config/segmentationColor.js.map +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +1 -2
- package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/esm/tools/base/AnnotationTool.js.map +1 -1
- package/dist/esm/tools/base/BaseTool.js +5 -1
- package/dist/esm/tools/base/BaseTool.js.map +1 -1
- package/dist/esm/tools/segmentation/BrushTool.js +208 -87
- package/dist/esm/tools/segmentation/BrushTool.js.map +1 -1
- package/dist/esm/tools/segmentation/CircleScissorsTool.js +3 -0
- package/dist/esm/tools/segmentation/CircleScissorsTool.js.map +1 -1
- package/dist/esm/tools/segmentation/SphereScissorsTool.js +3 -0
- package/dist/esm/tools/segmentation/SphereScissorsTool.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.js +136 -0
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.js.map +1 -0
- package/dist/esm/tools/segmentation/strategies/compositions/determineSegmentIndex.js +48 -0
- package/dist/esm/tools/segmentation/strategies/compositions/determineSegmentIndex.js.map +1 -0
- package/dist/esm/tools/segmentation/strategies/compositions/dynamicThreshold.js +35 -0
- package/dist/esm/tools/segmentation/strategies/compositions/dynamicThreshold.js.map +1 -0
- package/dist/esm/tools/segmentation/strategies/compositions/erase.js +7 -0
- package/dist/esm/tools/segmentation/strategies/compositions/erase.js.map +1 -0
- package/dist/esm/tools/segmentation/strategies/compositions/index.js +19 -0
- package/dist/esm/tools/segmentation/strategies/compositions/index.js.map +1 -0
- package/dist/esm/tools/segmentation/strategies/compositions/islandRemoval.js +124 -0
- package/dist/esm/tools/segmentation/strategies/compositions/islandRemoval.js.map +1 -0
- package/dist/esm/tools/segmentation/strategies/compositions/preview.js +77 -0
- package/dist/esm/tools/segmentation/strategies/compositions/preview.js.map +1 -0
- package/dist/esm/tools/segmentation/strategies/compositions/regionFill.js +21 -0
- package/dist/esm/tools/segmentation/strategies/compositions/regionFill.js.map +1 -0
- package/dist/esm/tools/segmentation/strategies/compositions/setValue.js +28 -0
- package/dist/esm/tools/segmentation/strategies/compositions/setValue.js.map +1 -0
- package/dist/esm/tools/segmentation/strategies/compositions/threshold.js +19 -0
- package/dist/esm/tools/segmentation/strategies/compositions/threshold.js.map +1 -0
- package/dist/esm/tools/segmentation/strategies/eraseCircle.js +6 -8
- package/dist/esm/tools/segmentation/strategies/eraseCircle.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/eraseSphere.js +6 -7
- package/dist/esm/tools/segmentation/strategies/eraseSphere.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/fillCircle.js +64 -88
- package/dist/esm/tools/segmentation/strategies/fillCircle.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/fillRectangle.js +3 -9
- package/dist/esm/tools/segmentation/strategies/fillRectangle.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/fillSphere.js +53 -64
- package/dist/esm/tools/segmentation/strategies/fillSphere.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js +7 -1
- package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/isWithinThreshold.js +2 -2
- package/dist/esm/tools/segmentation/strategies/utils/isWithinThreshold.js.map +1 -1
- package/dist/esm/utilities/math/ellipse/index.js +2 -2
- package/dist/esm/utilities/math/ellipse/index.js.map +1 -1
- package/dist/esm/utilities/math/ellipse/pointInEllipse.js +28 -16
- package/dist/esm/utilities/math/ellipse/pointInEllipse.js.map +1 -1
- package/dist/esm/utilities/math/sphere/pointInSphere.js +2 -1
- package/dist/esm/utilities/math/sphere/pointInSphere.js.map +1 -1
- package/dist/esm/utilities/segmentation/brushThresholdForToolGroup.js +11 -5
- package/dist/esm/utilities/segmentation/brushThresholdForToolGroup.js.map +1 -1
- package/dist/types/drawingSvg/drawEllipseByCoordinates.d.ts.map +1 -1
- package/dist/types/enums/StrategyCallbacks.d.ts +14 -0
- package/dist/types/enums/StrategyCallbacks.d.ts.map +1 -0
- package/dist/types/enums/index.d.ts +2 -1
- package/dist/types/eventDispatchers/keyboardEventHandlers/keyDown.d.ts.map +1 -1
- package/dist/types/eventDispatchers/shared/getActiveToolForKeyboardEvent.d.ts.map +1 -1
- package/dist/types/eventDispatchers/shared/getToolsWithActionsForKeyboardEvents.d.ts +4 -0
- package/dist/types/eventDispatchers/shared/getToolsWithActionsForKeyboardEvents.d.ts.map +1 -0
- package/dist/types/eventDispatchers/shared/getToolsWithActionsForMouseEvent.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/config/segmentationColor.d.ts.map +1 -1
- package/dist/types/tools/annotation/EllipticalROITool.d.ts.map +1 -1
- package/dist/types/tools/base/AnnotationTool.d.ts.map +1 -1
- package/dist/types/tools/base/BaseTool.d.ts +2 -0
- package/dist/types/tools/base/BaseTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/BrushTool.d.ts +45 -3
- package/dist/types/tools/segmentation/BrushTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/CircleScissorsTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/SphereScissorsTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/BrushStrategy.d.ts +88 -0
- package/dist/types/tools/segmentation/strategies/BrushStrategy.d.ts.map +1 -0
- package/dist/types/tools/segmentation/strategies/compositions/determineSegmentIndex.d.ts +7 -0
- package/dist/types/tools/segmentation/strategies/compositions/determineSegmentIndex.d.ts.map +1 -0
- package/dist/types/tools/segmentation/strategies/compositions/dynamicThreshold.d.ts +7 -0
- package/dist/types/tools/segmentation/strategies/compositions/dynamicThreshold.d.ts.map +1 -0
- package/dist/types/tools/segmentation/strategies/compositions/erase.d.ts +6 -0
- package/dist/types/tools/segmentation/strategies/compositions/erase.d.ts.map +1 -0
- package/dist/types/tools/segmentation/strategies/compositions/index.d.ts +36 -0
- package/dist/types/tools/segmentation/strategies/compositions/index.d.ts.map +1 -0
- package/dist/types/tools/segmentation/strategies/compositions/islandRemoval.d.ts +6 -0
- package/dist/types/tools/segmentation/strategies/compositions/islandRemoval.d.ts.map +1 -0
- package/dist/types/tools/segmentation/strategies/compositions/preview.d.ts +9 -0
- package/dist/types/tools/segmentation/strategies/compositions/preview.d.ts.map +1 -0
- package/dist/types/tools/segmentation/strategies/compositions/regionFill.d.ts +6 -0
- package/dist/types/tools/segmentation/strategies/compositions/regionFill.d.ts.map +1 -0
- package/dist/types/tools/segmentation/strategies/compositions/setValue.d.ts +9 -0
- package/dist/types/tools/segmentation/strategies/compositions/setValue.d.ts.map +1 -0
- package/dist/types/tools/segmentation/strategies/compositions/threshold.d.ts +6 -0
- package/dist/types/tools/segmentation/strategies/compositions/threshold.d.ts.map +1 -0
- package/dist/types/tools/segmentation/strategies/eraseCircle.d.ts +2 -7
- package/dist/types/tools/segmentation/strategies/eraseCircle.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/eraseSphere.d.ts +2 -7
- package/dist/types/tools/segmentation/strategies/eraseSphere.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/fillCircle.d.ts +13 -8
- package/dist/types/tools/segmentation/strategies/fillCircle.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/fillRectangle.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/fillSphere.d.ts +6 -9
- package/dist/types/tools/segmentation/strategies/fillSphere.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/utils/getStrategyData.d.ts +3 -0
- package/dist/types/tools/segmentation/strategies/utils/getStrategyData.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/utils/isWithinThreshold.d.ts +2 -2
- package/dist/types/tools/segmentation/strategies/utils/isWithinThreshold.d.ts.map +1 -1
- package/dist/types/types/BoundsIJK.d.ts +1 -1
- package/dist/types/types/BoundsIJK.d.ts.map +1 -1
- package/dist/types/types/FloodFillTypes.d.ts +4 -4
- package/dist/types/types/FloodFillTypes.d.ts.map +1 -1
- package/dist/types/types/LabelmapToolOperationData.d.ts +7 -2
- package/dist/types/types/LabelmapToolOperationData.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utilities/math/ellipse/getCanvasEllipseCorners.d.ts +2 -3
- package/dist/types/utilities/math/ellipse/getCanvasEllipseCorners.d.ts.map +1 -1
- package/dist/types/utilities/math/ellipse/index.d.ts +2 -2
- package/dist/types/utilities/math/ellipse/index.d.ts.map +1 -1
- package/dist/types/utilities/math/ellipse/pointInEllipse.d.ts +4 -1
- package/dist/types/utilities/math/ellipse/pointInEllipse.d.ts.map +1 -1
- package/dist/types/utilities/math/sphere/pointInSphere.d.ts +1 -0
- package/dist/types/utilities/math/sphere/pointInSphere.d.ts.map +1 -1
- package/dist/types/utilities/segmentation/brushThresholdForToolGroup.d.ts +1 -1
- package/dist/types/utilities/segmentation/brushThresholdForToolGroup.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/drawingSvg/drawEllipse.ts +8 -8
- package/src/drawingSvg/drawEllipseByCoordinates.ts +4 -4
- package/src/enums/StrategyCallbacks.ts +52 -0
- package/src/enums/index.js +2 -0
- package/src/eventDispatchers/keyboardEventHandlers/keyDown.ts +22 -11
- package/src/eventDispatchers/shared/getActiveToolForKeyboardEvent.ts +6 -2
- package/src/eventDispatchers/shared/getToolsWithActionsForKeyboardEvents.ts +53 -0
- package/src/eventDispatchers/shared/getToolsWithActionsForMouseEvent.ts +0 -2
- package/src/stateManagement/segmentation/config/segmentationColor.ts +8 -1
- package/src/tools/annotation/EllipticalROITool.ts +1 -3
- package/src/tools/base/AnnotationTool.ts +0 -1
- package/src/tools/base/BaseTool.ts +32 -2
- package/src/tools/segmentation/BrushTool.ts +298 -68
- package/src/tools/segmentation/CircleScissorsTool.ts +3 -1
- package/src/tools/segmentation/SphereScissorsTool.ts +3 -0
- package/src/tools/segmentation/strategies/BrushStrategy.ts +364 -0
- package/src/tools/segmentation/strategies/compositions/determineSegmentIndex.ts +86 -0
- package/src/tools/segmentation/strategies/compositions/dynamicThreshold.ts +58 -0
- package/src/tools/segmentation/strategies/compositions/erase.ts +11 -0
- package/src/tools/segmentation/strategies/compositions/index.ts +19 -0
- package/src/tools/segmentation/strategies/compositions/islandRemoval.ts +179 -0
- package/src/tools/segmentation/strategies/compositions/preview.ts +138 -0
- package/src/tools/segmentation/strategies/compositions/regionFill.ts +45 -0
- package/src/tools/segmentation/strategies/compositions/setValue.ts +50 -0
- package/src/tools/segmentation/strategies/compositions/threshold.ts +35 -0
- package/src/tools/segmentation/strategies/eraseCircle.ts +10 -19
- package/src/tools/segmentation/strategies/eraseSphere.ts +10 -18
- package/src/tools/segmentation/strategies/fillCircle.ts +141 -164
- package/src/tools/segmentation/strategies/fillRectangle.ts +3 -13
- package/src/tools/segmentation/strategies/fillSphere.ts +105 -120
- package/src/tools/segmentation/strategies/utils/getStrategyData.ts +15 -1
- package/src/tools/segmentation/strategies/utils/isWithinThreshold.ts +5 -5
- package/src/types/BoundsIJK.ts +1 -1
- package/src/types/FloodFillTypes.ts +4 -4
- package/src/types/LabelmapToolOperationData.ts +20 -1
- package/src/types/index.ts +2 -0
- package/src/utilities/math/ellipse/getCanvasEllipseCorners.ts +2 -2
- package/src/utilities/math/ellipse/index.ts +2 -2
- package/src/utilities/math/ellipse/pointInEllipse.ts +52 -18
- package/src/utilities/math/sphere/pointInSphere.ts +10 -2
- package/src/utilities/segmentation/brushThresholdForToolGroup.ts +12 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.37.1",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cornerstonejs/core": "^1.
|
|
32
|
+
"@cornerstonejs/core": "^1.37.1",
|
|
33
33
|
"comlink": "^4.4.1",
|
|
34
34
|
"lodash.clonedeep": "4.5.0",
|
|
35
35
|
"lodash.get": "^4.4.2"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"type": "individual",
|
|
54
54
|
"url": "https://ohif.org/donate"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "81e281d066bc2d92c2b7eb7cebbaae49da439fa8"
|
|
57
57
|
}
|
|
@@ -12,20 +12,20 @@ function drawEllipse(
|
|
|
12
12
|
corner2: Types.Point2,
|
|
13
13
|
options = {},
|
|
14
14
|
dataId = ''
|
|
15
|
-
){
|
|
16
|
-
const top: Types.Point2 = [
|
|
17
|
-
const bottom: Types.Point2 = [
|
|
18
|
-
const left: Types.Point2 = [
|
|
19
|
-
const right: Types.Point2 = [
|
|
15
|
+
) {
|
|
16
|
+
const top: Types.Point2 = [(corner1[0] + corner2[0]) / 2, corner1[1]];
|
|
17
|
+
const bottom: Types.Point2 = [(corner1[0] + corner2[0]) / 2, corner2[1]];
|
|
18
|
+
const left: Types.Point2 = [corner1[0], (corner1[1] + corner2[1]) / 2];
|
|
19
|
+
const right: Types.Point2 = [corner2[0], (corner1[1] + corner2[1]) / 2];
|
|
20
20
|
|
|
21
21
|
drawEllipseByCoordinates(
|
|
22
22
|
svgDrawingHelper,
|
|
23
23
|
annotationUID,
|
|
24
24
|
ellipseUID,
|
|
25
25
|
[bottom, top, left, right],
|
|
26
|
-
options = {},
|
|
27
|
-
dataId = ''
|
|
28
|
-
)
|
|
26
|
+
(options = {}),
|
|
27
|
+
(dataId = '')
|
|
28
|
+
);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export default drawEllipse;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
2
|
|
2
1
|
import type { Types } from '@cornerstonejs/core';
|
|
3
2
|
import { SVGDrawingHelper } from '../types';
|
|
4
3
|
|
|
@@ -35,9 +34,10 @@ function drawEllipseByCoordinates(
|
|
|
35
34
|
|
|
36
35
|
const w = Math.hypot(left[0] - right[0], left[1] - right[1]);
|
|
37
36
|
const h = Math.hypot(top[0] - bottom[0], top[1] - bottom[1]);
|
|
38
|
-
const angle =
|
|
37
|
+
const angle =
|
|
38
|
+
(Math.atan2(left[1] - right[1], left[0] - right[0]) * 180) / Math.PI;
|
|
39
39
|
|
|
40
|
-
const center = [(left[0] + right[0]) / 2
|
|
40
|
+
const center = [(left[0] + right[0]) / 2, (top[1] + bottom[1]) / 2];
|
|
41
41
|
const radiusX = w / 2;
|
|
42
42
|
const radiusY = h / 2;
|
|
43
43
|
|
|
@@ -48,7 +48,7 @@ function drawEllipseByCoordinates(
|
|
|
48
48
|
ry: `${radiusY}`,
|
|
49
49
|
stroke: color,
|
|
50
50
|
fill: 'transparent',
|
|
51
|
-
|
|
51
|
+
transform: `rotate(${angle} ${center[0]} ${center[1]})`,
|
|
52
52
|
'stroke-width': strokeWidth,
|
|
53
53
|
'stroke-dasharray': lineDash,
|
|
54
54
|
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the names of the strategy callbacks used for performing enhanced
|
|
3
|
+
* strategy operations.
|
|
4
|
+
*/
|
|
5
|
+
enum StrategyCallbacks {
|
|
6
|
+
/**
|
|
7
|
+
* startStrategy is called at the start of a strategy, typically on mouse down
|
|
8
|
+
* Note this is separate from preview and the endings for preview, which could
|
|
9
|
+
* be called alternatively, but this may be nested within a preview.
|
|
10
|
+
*/
|
|
11
|
+
OnInteractionStart = 'onInteractionStart',
|
|
12
|
+
/**
|
|
13
|
+
* finishStrategy is called at the end of a strategy being applied, usually on
|
|
14
|
+
* mouse up.
|
|
15
|
+
*/
|
|
16
|
+
OnInteractionEnd = 'onInteractionEnd',
|
|
17
|
+
/**
|
|
18
|
+
* The preview can be used for tools to show what would happen on accepting
|
|
19
|
+
* before the change is actually done. For example, a spline tool might
|
|
20
|
+
* show a preview state, and allow that to be accepted or rejected.
|
|
21
|
+
*/
|
|
22
|
+
Preview = 'preview',
|
|
23
|
+
RejectPreview = 'rejectPreview',
|
|
24
|
+
AcceptPreview = 'acceptPreview',
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Fills the given reygion
|
|
28
|
+
*/
|
|
29
|
+
Fill = 'fill',
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The default strategy function, often synonymous with fill
|
|
33
|
+
*/
|
|
34
|
+
StrategyFunction = 'strategyFunction',
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* For threshold functions, this creates the thresold test. Mostly an internal
|
|
38
|
+
* detail, but might be useful to share between strategies.
|
|
39
|
+
*/
|
|
40
|
+
CreateIsInThreshold = 'createIsInThreshold',
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Some strategy functions need to initialize some data before being runnable.
|
|
44
|
+
* This is mostly an internal detail, just useful to have an enum here for this.
|
|
45
|
+
*/
|
|
46
|
+
Initialize = 'initialize',
|
|
47
|
+
|
|
48
|
+
// Internal Details
|
|
49
|
+
INTERNAL_setValue = 'setValue',
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default StrategyCallbacks;
|
package/src/enums/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import AnnotationStyleStates from './AnnotationStyleStates';
|
|
|
4
4
|
import Events from './Events';
|
|
5
5
|
import SegmentationRepresentations from './SegmentationRepresentations';
|
|
6
6
|
import { Swipe } from './Touch';
|
|
7
|
+
import StrategyCallbacks from './StrategyCallbacks';
|
|
7
8
|
|
|
8
9
|
export {
|
|
9
10
|
MouseBindings,
|
|
@@ -13,4 +14,5 @@ export {
|
|
|
13
14
|
Events,
|
|
14
15
|
SegmentationRepresentations,
|
|
15
16
|
Swipe,
|
|
17
|
+
StrategyCallbacks,
|
|
16
18
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ToolGroupManager } from '../../store';
|
|
2
2
|
import getActiveToolForKeyboardEvent from '../shared/getActiveToolForKeyboardEvent';
|
|
3
|
+
import getToolsWithActionsForKeyboardEvent from '../shared/getToolsWithActionsForKeyboardEvents';
|
|
3
4
|
import { KeyDownEventType } from '../../types/EventTypes';
|
|
5
|
+
import ToolModes from '../../enums/ToolModes';
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* KeyDown event listener to handle viewport cursor icon changes
|
|
@@ -11,19 +13,28 @@ export default function keyDown(evt: KeyDownEventType): void {
|
|
|
11
13
|
// get the active tool given the key and mouse button
|
|
12
14
|
const activeTool = getActiveToolForKeyboardEvent(evt);
|
|
13
15
|
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
if (activeTool) {
|
|
17
|
+
const { renderingEngineId, viewportId } = evt.detail;
|
|
18
|
+
|
|
19
|
+
const toolGroup = ToolGroupManager.getToolGroupForViewport(
|
|
20
|
+
viewportId,
|
|
21
|
+
renderingEngineId
|
|
22
|
+
);
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
const toolName = activeTool.getToolName();
|
|
25
|
+
if (Object.keys(toolGroup.toolOptions).includes(toolName)) {
|
|
26
|
+
toolGroup.setViewportsCursorByToolName(toolName);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
19
29
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
);
|
|
30
|
+
const activeToolsWithEventBinding = getToolsWithActionsForKeyboardEvent(evt, [
|
|
31
|
+
ToolModes.Active,
|
|
32
|
+
]);
|
|
24
33
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
if (activeToolsWithEventBinding?.size) {
|
|
35
|
+
const { element } = evt.detail;
|
|
36
|
+
for (const [key, value] of [...activeToolsWithEventBinding.entries()]) {
|
|
37
|
+
key[value.method](element);
|
|
38
|
+
}
|
|
28
39
|
}
|
|
29
40
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToolGroupManager } from '../../store';
|
|
2
|
-
import { ToolModes
|
|
2
|
+
import { ToolModes } from '../../enums';
|
|
3
3
|
import { keyEventListener } from '../../eventListeners';
|
|
4
4
|
import { EventTypes } from '../../types';
|
|
5
5
|
import { getMouseButton } from '../../eventListeners/mouse/mouseDownListener';
|
|
@@ -24,6 +24,7 @@ export default function getActiveToolForKeyboardEvent(
|
|
|
24
24
|
const mouseButton = getMouseButton();
|
|
25
25
|
|
|
26
26
|
// If any keyboard modifier key is also pressed
|
|
27
|
+
// TODO - get the real modifier key
|
|
27
28
|
const modifierKey = keyEventListener.getModifierKey();
|
|
28
29
|
|
|
29
30
|
const toolGroup = ToolGroupManager.getToolGroupForViewport(
|
|
@@ -42,6 +43,9 @@ export default function getActiveToolForKeyboardEvent(
|
|
|
42
43
|
const toolName = toolGroupToolNames[j];
|
|
43
44
|
const toolOptions = toolGroup.toolOptions[toolName];
|
|
44
45
|
|
|
46
|
+
if (toolOptions.mode !== Active) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
45
49
|
// tool has binding that matches the mouse button, if mouseEvent is undefined
|
|
46
50
|
// it uses the primary button
|
|
47
51
|
const correctBinding =
|
|
@@ -52,7 +56,7 @@ export default function getActiveToolForKeyboardEvent(
|
|
|
52
56
|
binding.modifierKey === modifierKey
|
|
53
57
|
);
|
|
54
58
|
|
|
55
|
-
if (
|
|
59
|
+
if (correctBinding) {
|
|
56
60
|
return toolGroup.getToolInstance(toolName);
|
|
57
61
|
}
|
|
58
62
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ToolGroupManager } from '../../store';
|
|
2
|
+
import { ToolModes } from '../../enums';
|
|
3
|
+
import { EventTypes } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Given the normalized mouse event and a filter of modes,
|
|
7
|
+
* find all the tools on the element that are in one of the specified modes.
|
|
8
|
+
* If the evtButton is specified, only tools with a matching binding will be returned.
|
|
9
|
+
* @param evt - The normalized mouseDown event.
|
|
10
|
+
* @param modesFilter - An array of entries from the `ToolModes` enum.
|
|
11
|
+
*/
|
|
12
|
+
export default function getToolsWithModesForKeyboardEvent(
|
|
13
|
+
evt: EventTypes.KeyDownEventType,
|
|
14
|
+
toolModes: ToolModes[]
|
|
15
|
+
) {
|
|
16
|
+
const toolsWithActions = new Map();
|
|
17
|
+
const { renderingEngineId, viewportId } = evt.detail;
|
|
18
|
+
const toolGroup = ToolGroupManager.getToolGroupForViewport(
|
|
19
|
+
viewportId,
|
|
20
|
+
renderingEngineId
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
if (!toolGroup) {
|
|
24
|
+
return toolsWithActions;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const toolGroupToolNames = Object.keys(toolGroup.toolOptions);
|
|
28
|
+
const key = evt.detail.key;
|
|
29
|
+
|
|
30
|
+
for (let j = 0; j < toolGroupToolNames.length; j++) {
|
|
31
|
+
const toolName = toolGroupToolNames[j];
|
|
32
|
+
const tool = toolGroup.getToolInstance(toolName);
|
|
33
|
+
const actionsConfig = tool.configuration?.actions;
|
|
34
|
+
if (!actionsConfig) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const actions = Object.values(actionsConfig);
|
|
38
|
+
|
|
39
|
+
if (!actions?.length || !toolModes.includes(tool.mode)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const action = actions.find((action: any) =>
|
|
44
|
+
action.bindings.some((binding) => binding.key === key)
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
if (action) {
|
|
48
|
+
toolsWithActions.set(tool, action);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return toolsWithActions;
|
|
53
|
+
}
|
|
@@ -5,8 +5,6 @@ import { ToolAction, EventTypes } from '../../types';
|
|
|
5
5
|
import { keyEventListener } from '../../eventListeners';
|
|
6
6
|
import getMouseModifier from './getMouseModifier';
|
|
7
7
|
|
|
8
|
-
type ModesFilter = Array<ToolModes>;
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* Given the mouse event and a list of tool modes, find all tool instances
|
|
12
10
|
* with actions that were added to the tool group associated with the viewport
|
|
@@ -96,7 +96,14 @@ function getColorForSegmentIndex(
|
|
|
96
96
|
|
|
97
97
|
// get colorLUT
|
|
98
98
|
const colorLUT = SegmentationState.getColorLUT(colorLUTIndex);
|
|
99
|
-
|
|
99
|
+
let colorValue = colorLUT[segmentIndex];
|
|
100
|
+
if (!colorValue) {
|
|
101
|
+
if (typeof segmentIndex !== 'number') {
|
|
102
|
+
throw new Error(`Can't create colour for LUT index ${segmentIndex}`);
|
|
103
|
+
}
|
|
104
|
+
colorValue = colorLUT[segmentIndex] = [0, 0, 0, 0];
|
|
105
|
+
}
|
|
106
|
+
return colorValue;
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
function setColorForSegmentIndex(
|
|
@@ -785,9 +785,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
785
785
|
const rotation = Math.abs(
|
|
786
786
|
viewport.getRotation() - (data.initialRotation || 0)
|
|
787
787
|
);
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
canvasCorners = <Array<Types.Point2>>(
|
|
788
|
+
const canvasCorners = <Array<Types.Point2>>(
|
|
791
789
|
getCanvasEllipseCorners(canvasCoordinates) // bottom, top, left, right, keep as is
|
|
792
790
|
);
|
|
793
791
|
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from '@cornerstonejs/core';
|
|
7
7
|
import { Types } from '@cornerstonejs/core';
|
|
8
8
|
import ToolModes from '../../enums/ToolModes';
|
|
9
|
+
import StrategyCallbacks from '../../enums/StrategyCallbacks';
|
|
9
10
|
import { InteractionTypes, ToolProps, PublicToolProps } from '../../types';
|
|
10
11
|
|
|
11
12
|
export interface IBaseTool {
|
|
@@ -73,7 +74,8 @@ abstract class BaseTool implements IBaseTool {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
/**
|
|
76
|
-
*
|
|
77
|
+
* Applies the active strategy function to the enabled element with the specified
|
|
78
|
+
* operation data.
|
|
77
79
|
* @param enabledElement - The element that is being operated on.
|
|
78
80
|
* @param operationData - The data that needs to be passed to the strategy.
|
|
79
81
|
* @returns The result of the strategy.
|
|
@@ -83,7 +85,35 @@ abstract class BaseTool implements IBaseTool {
|
|
|
83
85
|
operationData: unknown
|
|
84
86
|
): any {
|
|
85
87
|
const { strategies, activeStrategy } = this.configuration;
|
|
86
|
-
return strategies[activeStrategy]
|
|
88
|
+
return strategies[activeStrategy]?.call(
|
|
89
|
+
this,
|
|
90
|
+
enabledElement,
|
|
91
|
+
operationData
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Applies the active strategy, with a given event type being applied.
|
|
97
|
+
* The event type function is found by indexing it on the active strategy
|
|
98
|
+
* function.
|
|
99
|
+
*
|
|
100
|
+
* @param enabledElement - The element that is being operated on.
|
|
101
|
+
* @param operationData - The data that needs to be passed to the strategy.
|
|
102
|
+
* @param callbackType - the type of the callback
|
|
103
|
+
*
|
|
104
|
+
* @returns The result of the strategy.
|
|
105
|
+
*/
|
|
106
|
+
public applyActiveStrategyCallback(
|
|
107
|
+
enabledElement: Types.IEnabledElement,
|
|
108
|
+
operationData: unknown,
|
|
109
|
+
callbackType: StrategyCallbacks | string
|
|
110
|
+
): any {
|
|
111
|
+
const { strategies, activeStrategy } = this.configuration;
|
|
112
|
+
return strategies[activeStrategy][callbackType]?.call(
|
|
113
|
+
this,
|
|
114
|
+
enabledElement,
|
|
115
|
+
operationData
|
|
116
|
+
);
|
|
87
117
|
}
|
|
88
118
|
|
|
89
119
|
/**
|