@cornerstonejs/tools 1.36.3 → 1.37.0
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
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { cache } from '@cornerstonejs/core';
|
|
1
|
+
import { cache, utilities } from '@cornerstonejs/core';
|
|
2
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
3
|
import { isVolumeSegmentation } from './stackVolumeCheck';
|
|
3
4
|
import { LabelmapToolOperationDataStack } from '../../../../types';
|
|
4
5
|
|
|
6
|
+
const { VoxelManager } = utilities;
|
|
7
|
+
|
|
5
8
|
function getStrategyData({ operationData, viewport }) {
|
|
6
9
|
let segmentationImageData, segmentationScalarData, imageScalarData;
|
|
10
|
+
let dimensions: Types.Point3;
|
|
7
11
|
if (isVolumeSegmentation(operationData)) {
|
|
8
12
|
const { volumeId, referencedVolumeId } = operationData;
|
|
9
13
|
|
|
@@ -17,6 +21,7 @@ function getStrategyData({ operationData, viewport }) {
|
|
|
17
21
|
({ imageData: segmentationImageData } = segmentationVolume);
|
|
18
22
|
segmentationScalarData = segmentationVolume.getScalarData();
|
|
19
23
|
imageScalarData = imageVolume.getScalarData();
|
|
24
|
+
dimensions = imageVolume.dimensions;
|
|
20
25
|
} else {
|
|
21
26
|
const { imageIdReferenceMap, segmentationRepresentationUID } =
|
|
22
27
|
operationData as LabelmapToolOperationDataStack;
|
|
@@ -46,12 +51,21 @@ function getStrategyData({ operationData, viewport }) {
|
|
|
46
51
|
// This is the pixel data of the image that is being segmented in the cache
|
|
47
52
|
// and we need to use this to for the modification
|
|
48
53
|
imageScalarData = image.getPixelData();
|
|
54
|
+
dimensions = [image.columns, image.rows, 1];
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
return {
|
|
52
58
|
segmentationImageData,
|
|
53
59
|
segmentationScalarData,
|
|
60
|
+
segmentationVoxelManager: VoxelManager.createVolumeVoxelManager(
|
|
61
|
+
dimensions,
|
|
62
|
+
segmentationScalarData
|
|
63
|
+
),
|
|
54
64
|
imageScalarData,
|
|
65
|
+
imageVoxelManager: VoxelManager.createVolumeVoxelManager(
|
|
66
|
+
dimensions,
|
|
67
|
+
imageScalarData
|
|
68
|
+
),
|
|
55
69
|
};
|
|
56
70
|
}
|
|
57
71
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Types } from '@cornerstonejs/core';
|
|
2
|
-
import { TypedArray } from '@kitware/vtk.js/types';
|
|
3
2
|
|
|
4
3
|
function isWithinThreshold(
|
|
5
4
|
index: number,
|
|
6
|
-
imageScalarData:
|
|
5
|
+
imageScalarData: Types.VolumeScalarData,
|
|
7
6
|
strategySpecificConfiguration: any
|
|
8
7
|
) {
|
|
9
|
-
const { THRESHOLD_INSIDE_CIRCLE } = strategySpecificConfiguration;
|
|
8
|
+
const { THRESHOLD, THRESHOLD_INSIDE_CIRCLE } = strategySpecificConfiguration;
|
|
10
9
|
|
|
11
10
|
const voxelValue = imageScalarData[index];
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// Prefer the generic version of the THRESHOLD configuration, but fallback
|
|
12
|
+
// to the older THRESHOLD_INSIDE_CIRCLE version.
|
|
13
|
+
const { threshold } = THRESHOLD || THRESHOLD_INSIDE_CIRCLE;
|
|
14
14
|
return threshold[0] <= voxelValue && voxelValue <= threshold[1];
|
|
15
15
|
}
|
|
16
16
|
|
package/src/types/BoundsIJK.ts
CHANGED
|
@@ -5,13 +5,13 @@ type FloodFillResult = {
|
|
|
5
5
|
boundaries: Types.Point2[] | Types.Point3[];
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
type FloodFillGetter3D = (x: number, y: number, z: number) =>
|
|
9
|
-
type FloodFillGetter2D = (x: number, y: number) =>
|
|
8
|
+
type FloodFillGetter3D = (x: number, y: number, z: number) => unknown;
|
|
9
|
+
type FloodFillGetter2D = (x: number, y: number) => unknown;
|
|
10
10
|
type FloodFillGetter = FloodFillGetter2D | FloodFillGetter3D;
|
|
11
11
|
|
|
12
12
|
type FloodFillOptions = {
|
|
13
|
-
onFlood?: (x, y) => void;
|
|
14
|
-
onBoundary?: (x, y) => void;
|
|
13
|
+
onFlood?: (x: number, y: number, z?: number) => void;
|
|
14
|
+
onBoundary?: (x: number, y: number, z?: number) => void;
|
|
15
15
|
equals?: (a, b) => boolean; // Equality operation for your datastructure. Defaults to a === b.
|
|
16
16
|
diagonals?: boolean; // Whether to flood fill across diagonals. Default false.
|
|
17
17
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
LabelmapSegmentationDataStack,
|
|
3
5
|
LabelmapSegmentationDataVolume,
|
|
@@ -6,12 +8,24 @@ import {
|
|
|
6
8
|
type LabelmapToolOperationData = {
|
|
7
9
|
segmentationId: string;
|
|
8
10
|
segmentIndex: number;
|
|
11
|
+
/**
|
|
12
|
+
* The colours to use for previewing
|
|
13
|
+
*/
|
|
14
|
+
previewColors?: Record<number, [number, number, number, number]>;
|
|
9
15
|
segmentsLocked: number[];
|
|
10
16
|
viewPlaneNormal: number[];
|
|
11
17
|
viewUp: number[];
|
|
12
18
|
strategySpecificConfiguration: any;
|
|
13
|
-
constraintFn: (pointIJK: number) => boolean;
|
|
19
|
+
// constraintFn: (pointIJK: number) => boolean;
|
|
14
20
|
segmentationRepresentationUID: string;
|
|
21
|
+
points: Types.Point3[];
|
|
22
|
+
/**
|
|
23
|
+
* preview is used for sharing preview data between views/interactions with
|
|
24
|
+
* a tool, and needs to be maintained by the tool side in order to be able
|
|
25
|
+
* to accept/reject/update the preview information.
|
|
26
|
+
*/
|
|
27
|
+
preview: any;
|
|
28
|
+
toolGroupId: string;
|
|
15
29
|
};
|
|
16
30
|
|
|
17
31
|
type LabelmapToolOperationDataStack = LabelmapToolOperationData &
|
|
@@ -20,8 +34,13 @@ type LabelmapToolOperationDataStack = LabelmapToolOperationData &
|
|
|
20
34
|
type LabelmapToolOperationDataVolume = LabelmapToolOperationData &
|
|
21
35
|
LabelmapSegmentationDataVolume;
|
|
22
36
|
|
|
37
|
+
type LabelmapToolOperationDataAny =
|
|
38
|
+
| LabelmapToolOperationDataVolume
|
|
39
|
+
| LabelmapToolOperationDataStack;
|
|
40
|
+
|
|
23
41
|
export {
|
|
24
42
|
LabelmapToolOperationData,
|
|
43
|
+
LabelmapToolOperationDataAny,
|
|
25
44
|
LabelmapToolOperationDataStack,
|
|
26
45
|
LabelmapToolOperationDataVolume,
|
|
27
46
|
};
|
package/src/types/index.ts
CHANGED
|
@@ -56,6 +56,7 @@ import type { ContourSegmentationData } from './ContourTypes';
|
|
|
56
56
|
import type IAnnotationManager from './IAnnotationManager';
|
|
57
57
|
import type AnnotationGroupSelector from './AnnotationGroupSelector';
|
|
58
58
|
import type { Statistics } from './CalculatorTypes';
|
|
59
|
+
import type { CanvasCoordinates } from '../utilities/math/ellipse/getCanvasEllipseCorners';
|
|
59
60
|
import {
|
|
60
61
|
LabelmapToolOperationData,
|
|
61
62
|
LabelmapToolOperationDataStack,
|
|
@@ -77,6 +78,7 @@ export type {
|
|
|
77
78
|
// AnnotationState
|
|
78
79
|
Annotation,
|
|
79
80
|
Annotations,
|
|
81
|
+
CanvasCoordinates,
|
|
80
82
|
IAnnotationManager,
|
|
81
83
|
GroupSpecificAnnotations,
|
|
82
84
|
AnnotationState,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
2
|
|
|
3
|
-
type
|
|
3
|
+
export type CanvasCoordinates = [
|
|
4
4
|
Types.Point2, // bottom
|
|
5
5
|
Types.Point2, // top
|
|
6
6
|
Types.Point2, // left
|
|
@@ -15,7 +15,7 @@ type canvasCoordinates = [
|
|
|
15
15
|
* @returns An array of two points.
|
|
16
16
|
*/
|
|
17
17
|
export default function getCanvasEllipseCorners(
|
|
18
|
-
ellipseCanvasPoints:
|
|
18
|
+
ellipseCanvasPoints: CanvasCoordinates
|
|
19
19
|
): Array<Types.Point2> {
|
|
20
20
|
const [bottom, top, left, right] = ellipseCanvasPoints;
|
|
21
21
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import pointInEllipse from './pointInEllipse';
|
|
1
|
+
import pointInEllipse, { precalculatePointInEllipse } from './pointInEllipse';
|
|
2
2
|
import getCanvasEllipseCorners from './getCanvasEllipseCorners';
|
|
3
3
|
|
|
4
|
-
export { pointInEllipse, getCanvasEllipseCorners };
|
|
4
|
+
export { pointInEllipse, precalculatePointInEllipse, getCanvasEllipseCorners };
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
1
2
|
interface Inverts {
|
|
2
3
|
invXRadiusSq?: number;
|
|
3
4
|
invYRadiusSq?: number;
|
|
4
5
|
invZRadiusSq?: number;
|
|
5
6
|
fast?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* If you call the pointInEllipse.precalculateInverts first, then you
|
|
9
|
+
* can call precalculated directly instead of having the extra time for
|
|
10
|
+
* the if conditions.
|
|
11
|
+
*/
|
|
12
|
+
precalculated?: (pointLPS: Types.Point3) => boolean;
|
|
6
13
|
}
|
|
7
14
|
|
|
8
15
|
/**
|
|
@@ -23,7 +30,26 @@ export default function pointInEllipse(
|
|
|
23
30
|
pointLPS,
|
|
24
31
|
inverts: Inverts = {}
|
|
25
32
|
) {
|
|
26
|
-
|
|
33
|
+
if (!inverts.precalculated) {
|
|
34
|
+
precalculatePointInEllipse(ellipse, inverts);
|
|
35
|
+
}
|
|
36
|
+
return inverts.precalculated(pointLPS);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* This will perform some precalculations to make things faster.
|
|
41
|
+
* Ideally, use the 'precalculated' function inside inverts to call the
|
|
42
|
+
* test function. This minimizes re-reading of variables and only needs the
|
|
43
|
+
* LPS passed each time.
|
|
44
|
+
* That is:
|
|
45
|
+
*
|
|
46
|
+
* ```
|
|
47
|
+
* const inverts = precalcualtePointInEllipse(ellipse);
|
|
48
|
+
* if( inverts.precalculated(pointLPS) ) ...
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
const precalculatePointInEllipse = (ellipse, inverts: Inverts = {}) => {
|
|
52
|
+
const { xRadius, yRadius, zRadius } = ellipse;
|
|
27
53
|
|
|
28
54
|
// This will run only once since we are caching the values in the same
|
|
29
55
|
// object that is passed in.
|
|
@@ -37,24 +63,32 @@ export default function pointInEllipse(
|
|
|
37
63
|
inverts.invZRadiusSq = zRadius !== 0 ? 1 / zRadius ** 2 : 0;
|
|
38
64
|
}
|
|
39
65
|
|
|
40
|
-
|
|
66
|
+
const { invXRadiusSq, invYRadiusSq, invZRadiusSq } = inverts;
|
|
67
|
+
const { center } = ellipse;
|
|
68
|
+
const [centerL, centerP, centerS] = center;
|
|
41
69
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
70
|
+
inverts.precalculated = (pointLPS) => {
|
|
71
|
+
// Calculate the sum of normalized squared distances
|
|
72
|
+
const dx = pointLPS[0] - centerL;
|
|
73
|
+
let inside = dx * dx * invXRadiusSq;
|
|
74
|
+
if (inside > 1) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
48
77
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
78
|
+
const dy = pointLPS[1] - centerP;
|
|
79
|
+
inside += dy * dy * invYRadiusSq;
|
|
80
|
+
if (inside > 1) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
54
83
|
|
|
55
|
-
|
|
56
|
-
|
|
84
|
+
const dz = pointLPS[2] - centerS;
|
|
85
|
+
inside += dz * dz * invZRadiusSq;
|
|
57
86
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
87
|
+
// Check if the point is inside the ellipse
|
|
88
|
+
return inside <= 1;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return inverts;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export { precalculatePointInEllipse };
|
|
@@ -4,6 +4,8 @@ import { vec3 } from 'gl-matrix';
|
|
|
4
4
|
type Sphere = {
|
|
5
5
|
center: Types.Point3 | vec3;
|
|
6
6
|
radius: number;
|
|
7
|
+
// Square of the radius
|
|
8
|
+
radius2?: number;
|
|
7
9
|
};
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -12,17 +14,23 @@ type Sphere = {
|
|
|
12
14
|
* ellipse's rotation in different views, we can use a simpler equation
|
|
13
15
|
* which would be faster (no if statements).
|
|
14
16
|
*
|
|
15
|
-
*
|
|
17
|
+
* This is safe to call for point in circle as long as you don't call it with
|
|
18
|
+
* anything off-plane - that is, a circle is a degenerate sphere that is
|
|
19
|
+
* intersected with the primary plane.
|
|
20
|
+
*
|
|
21
|
+
* @param sphere - Sphere object with center and radius and radius squared
|
|
22
|
+
* as radius2 if you are calling this a huge number of times.
|
|
16
23
|
* @param pointLPS - the point to check in world coordinates
|
|
17
24
|
* @returns boolean
|
|
18
25
|
*/
|
|
19
26
|
export default function pointInSphere(sphere: Sphere, pointLPS: vec3): boolean {
|
|
20
27
|
const { center, radius } = sphere;
|
|
28
|
+
const radius2 = sphere.radius2 || radius * radius;
|
|
21
29
|
|
|
22
30
|
return (
|
|
23
31
|
(pointLPS[0] - center[0]) * (pointLPS[0] - center[0]) +
|
|
24
32
|
(pointLPS[1] - center[1]) * (pointLPS[1] - center[1]) +
|
|
25
33
|
(pointLPS[2] - center[2]) * (pointLPS[2] - center[2]) <=
|
|
26
|
-
|
|
34
|
+
radius2
|
|
27
35
|
);
|
|
28
36
|
}
|
|
@@ -6,7 +6,8 @@ import getBrushToolInstances from './utilities';
|
|
|
6
6
|
|
|
7
7
|
export function setBrushThresholdForToolGroup(
|
|
8
8
|
toolGroupId: string,
|
|
9
|
-
threshold: Types.Point2
|
|
9
|
+
threshold: Types.Point2,
|
|
10
|
+
otherArgs: Record<string, unknown> = { isDynamic: false }
|
|
10
11
|
) {
|
|
11
12
|
const toolGroup = getToolGroup(toolGroupId);
|
|
12
13
|
|
|
@@ -15,10 +16,16 @@ export function setBrushThresholdForToolGroup(
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const brushBasedToolInstances = getBrushToolInstances(toolGroupId);
|
|
19
|
+
const configuration = {
|
|
20
|
+
...otherArgs,
|
|
21
|
+
...(threshold !== undefined && { threshold }),
|
|
22
|
+
};
|
|
18
23
|
|
|
19
24
|
brushBasedToolInstances.forEach((tool) => {
|
|
20
|
-
tool.configuration.strategySpecificConfiguration.
|
|
21
|
-
|
|
25
|
+
tool.configuration.strategySpecificConfiguration.THRESHOLD = {
|
|
26
|
+
...tool.configuration.strategySpecificConfiguration.THRESHOLD,
|
|
27
|
+
...configuration,
|
|
28
|
+
};
|
|
22
29
|
});
|
|
23
30
|
|
|
24
31
|
// Trigger an annotation render for any viewports on the toolgroup
|
|
@@ -60,6 +67,6 @@ export function getBrushThresholdForToolGroup(toolGroupId: string) {
|
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
// TODO -> Assumes the
|
|
63
|
-
return brushToolInstance.configuration.strategySpecificConfiguration
|
|
64
|
-
.
|
|
70
|
+
return brushToolInstance.configuration.strategySpecificConfiguration.THRESHOLD
|
|
71
|
+
.threshold;
|
|
65
72
|
}
|