@cornerstonejs/tools 2.0.0-beta.2 → 2.0.0-beta.4
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/getSvgDrawingHelper.js +1 -1
- package/dist/cjs/drawingSvg/getSvgDrawingHelper.js.map +1 -1
- package/dist/cjs/enums/Events.d.ts +1 -0
- package/dist/cjs/enums/Events.js +1 -0
- package/dist/cjs/enums/Events.js.map +1 -1
- package/dist/cjs/eventDispatchers/mouseEventHandlers/mouseDown.js +6 -1
- package/dist/cjs/eventDispatchers/mouseEventHandlers/mouseDown.js.map +1 -1
- package/dist/cjs/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.d.ts +2 -0
- package/dist/cjs/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.js +41 -0
- package/dist/cjs/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.js.map +1 -0
- package/dist/cjs/eventDispatchers/shared/getToolsWithActionsForMouseEvent.d.ts +3 -0
- package/dist/cjs/eventDispatchers/shared/getToolsWithActionsForMouseEvent.js +39 -0
- package/dist/cjs/eventDispatchers/shared/getToolsWithActionsForMouseEvent.js.map +1 -0
- package/dist/cjs/eventDispatchers/shared/getToolsWithModesForMouseEvent.d.ts +1 -1
- package/dist/cjs/eventDispatchers/shared/getToolsWithModesForTouchEvent.d.ts +1 -1
- package/dist/cjs/eventListeners/keyboard/keyDownListener.js +1 -2
- package/dist/cjs/eventListeners/keyboard/keyDownListener.js.map +1 -1
- package/dist/cjs/eventListeners/mouse/mouseDownListener.js +5 -1
- package/dist/cjs/eventListeners/mouse/mouseDownListener.js.map +1 -1
- package/dist/cjs/eventListeners/mouse/mouseMoveListener.js +5 -1
- package/dist/cjs/eventListeners/mouse/mouseMoveListener.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +5 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js +4 -8
- package/dist/cjs/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.js +2 -3
- package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentations.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/addSegmentations.js +1 -5
- package/dist/cjs/stateManagement/segmentation/addSegmentations.js.map +1 -1
- package/dist/cjs/store/ToolGroupManager/ToolGroup.d.ts +2 -0
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js +36 -2
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/cjs/store/state.js +1 -5
- package/dist/cjs/store/state.js.map +1 -1
- package/dist/cjs/synchronizers/callbacks/stackImageSyncCallback.js +1 -1
- package/dist/cjs/synchronizers/callbacks/stackImageSyncCallback.js.map +1 -1
- package/dist/cjs/synchronizers/synchronizers/createVOISynchronizer.d.ts +1 -1
- package/dist/cjs/tools/AdvancedMagnifyTool.d.ts +36 -0
- package/dist/cjs/tools/AdvancedMagnifyTool.js +448 -0
- package/dist/cjs/tools/AdvancedMagnifyTool.js.map +1 -0
- package/dist/cjs/tools/AdvancedMagnifyViewport.d.ts +76 -0
- package/dist/cjs/tools/AdvancedMagnifyViewport.js +352 -0
- package/dist/cjs/tools/AdvancedMagnifyViewport.js.map +1 -0
- package/dist/cjs/tools/AdvancedMagnifyViewportManager.d.ts +36 -0
- package/dist/cjs/tools/AdvancedMagnifyViewportManager.js +133 -0
- package/dist/cjs/tools/AdvancedMagnifyViewportManager.js.map +1 -0
- package/dist/cjs/tools/MagnifyTool.js +2 -2
- package/dist/cjs/tools/MagnifyTool.js.map +1 -1
- package/dist/cjs/tools/OrientationMarkerTool.d.ts +88 -0
- package/dist/cjs/tools/OrientationMarkerTool.js +193 -0
- package/dist/cjs/tools/OrientationMarkerTool.js.map +1 -0
- package/dist/cjs/tools/OverlayGridTool.d.ts +31 -0
- package/dist/cjs/tools/OverlayGridTool.js +170 -0
- package/dist/cjs/tools/OverlayGridTool.js.map +1 -0
- package/dist/cjs/tools/ReferenceLinesTool.d.ts +3 -0
- package/dist/cjs/tools/ReferenceLinesTool.js +71 -2
- package/dist/cjs/tools/ReferenceLinesTool.js.map +1 -1
- package/dist/cjs/tools/annotation/AngleTool.js +2 -1
- package/dist/cjs/tools/annotation/AngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/BidirectionalTool.js +1 -1
- package/dist/cjs/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/cjs/tools/annotation/CircleROITool.d.ts +1 -2
- package/dist/cjs/tools/annotation/CircleROITool.js +8 -8
- package/dist/cjs/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/CobbAngleTool.d.ts +31 -5
- package/dist/cjs/tools/annotation/CobbAngleTool.js +268 -71
- package/dist/cjs/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/DragProbeTool.js +4 -3
- package/dist/cjs/tools/annotation/DragProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.d.ts +2 -3
- package/dist/cjs/tools/annotation/EllipticalROITool.js +20 -16
- package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/LengthTool.js +1 -1
- package/dist/cjs/tools/annotation/LengthTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.d.ts +1 -2
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +22 -9
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/ProbeTool.d.ts +1 -2
- package/dist/cjs/tools/annotation/ProbeTool.js +10 -9
- package/dist/cjs/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.d.ts +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.js +9 -9
- package/dist/cjs/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/cjs/tools/base/AnnotationDisplayTool.js +4 -0
- package/dist/cjs/tools/base/AnnotationDisplayTool.js.map +1 -1
- package/dist/cjs/tools/base/AnnotationTool.d.ts +1 -1
- package/dist/cjs/tools/base/AnnotationTool.js.map +1 -1
- package/dist/cjs/tools/displayTools/Contour/contourConfigCache.d.ts +1 -1
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js +3 -0
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/cjs/tools/index.d.ts +4 -1
- package/dist/cjs/tools/index.js +7 -1
- package/dist/cjs/tools/index.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/eraseCircle.d.ts +1 -1
- package/dist/cjs/tools/segmentation/strategies/eraseRectangle.d.ts +1 -1
- package/dist/cjs/tools/segmentation/strategies/eraseSphere.d.ts +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillCircle.d.ts +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillRectangle.d.ts +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillSphere.d.ts +1 -1
- package/dist/cjs/types/AnnotationGroupSelector.d.ts +1 -1
- package/dist/cjs/types/AnnotationStyle.d.ts +7 -7
- package/dist/cjs/types/AnnotationTypes.d.ts +4 -4
- package/dist/cjs/types/BoundsIJK.d.ts +1 -1
- package/dist/cjs/types/CINETypes.d.ts +2 -2
- package/dist/cjs/types/CalculatorTypes.d.ts +1 -1
- package/dist/cjs/types/ContourTypes.d.ts +3 -3
- package/dist/cjs/types/CursorTypes.d.ts +2 -2
- package/dist/cjs/types/EventTypes.d.ts +88 -80
- package/dist/cjs/types/FloodFillTypes.d.ts +5 -5
- package/dist/cjs/types/IDistance.d.ts +1 -1
- package/dist/cjs/types/IPoints.d.ts +1 -1
- package/dist/cjs/types/ISetToolModeOptions.d.ts +5 -5
- package/dist/cjs/types/IToolClassReference.d.ts +1 -1
- package/dist/cjs/types/IToolGroup.d.ts +3 -0
- package/dist/cjs/types/ITouchPoints.d.ts +1 -1
- package/dist/cjs/types/InteractionTypes.d.ts +1 -1
- package/dist/cjs/types/InternalToolTypes.d.ts +3 -3
- package/dist/cjs/types/JumpToSliceOptions.d.ts +1 -1
- package/dist/cjs/types/LabelmapTypes.d.ts +3 -3
- package/dist/cjs/types/PlanarBoundingBox.d.ts +1 -1
- package/dist/cjs/types/SVGDrawingHelper.d.ts +1 -1
- package/dist/cjs/types/ScrollOptions.d.ts +1 -1
- package/dist/cjs/types/SegmentationStateTypes.d.ts +15 -15
- package/dist/cjs/types/ToolAction.d.ts +8 -0
- package/dist/cjs/types/ToolAction.js +3 -0
- package/dist/cjs/types/ToolAction.js.map +1 -0
- package/dist/cjs/types/ToolHandle.d.ts +3 -3
- package/dist/cjs/types/ToolProps.d.ts +4 -4
- package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +55 -0
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/cjs/utilities/getModalityUnit.d.ts +1 -1
- package/dist/cjs/utilities/getModalityUnit.js +5 -2
- package/dist/cjs/utilities/getModalityUnit.js.map +1 -1
- package/dist/cjs/utilities/getToolsWithModesForElement.d.ts +1 -1
- package/dist/cjs/utilities/index.d.ts +2 -2
- package/dist/cjs/utilities/index.js +4 -3
- package/dist/cjs/utilities/index.js.map +1 -1
- package/dist/cjs/utilities/math/angle/angleBetweenLines.d.ts +3 -1
- package/dist/cjs/utilities/math/angle/angleBetweenLines.js +18 -1
- package/dist/cjs/utilities/math/angle/angleBetweenLines.js.map +1 -1
- package/dist/cjs/utilities/math/basic/BasicStatsCalculator.js.map +1 -1
- package/dist/cjs/utilities/math/circle/_types.d.ts +1 -1
- package/dist/cjs/utilities/math/ellipse/getCanvasEllipseCorners.d.ts +1 -1
- package/dist/cjs/utilities/math/ellipse/pointInEllipse.d.ts +1 -1
- package/dist/cjs/utilities/math/ellipse/pointInEllipsoidWithConstraint.d.ts +1 -1
- package/dist/cjs/utilities/math/polyline/planarFreehandROIInternalTypes.d.ts +3 -3
- package/dist/cjs/utilities/math/sphere/pointInSphere.d.ts +1 -1
- package/dist/cjs/utilities/pointInShapeCallback.d.ts +3 -3
- package/dist/cjs/utilities/rectangleROITool/getBoundsIJKFromRectangleAnnotations.d.ts +1 -1
- package/dist/cjs/utilities/segmentation/createLabelmapVolumeForViewport.d.ts +8 -8
- package/dist/cjs/utilities/segmentation/createLabelmapVolumeForViewport.js +1 -2
- package/dist/cjs/utilities/segmentation/createLabelmapVolumeForViewport.js.map +1 -1
- package/dist/cjs/utilities/segmentation/rectangleROIThresholdVolumeByRange.d.ts +2 -2
- package/dist/cjs/utilities/segmentation/thresholdVolumeByRange.d.ts +1 -1
- package/dist/cjs/utilities/segmentation/utilities.d.ts +1 -1
- package/dist/cjs/utilities/stackPrefetch/index.d.ts +3 -2
- package/dist/cjs/utilities/stackPrefetch/index.js +8 -6
- package/dist/cjs/utilities/stackPrefetch/index.js.map +1 -1
- package/dist/cjs/utilities/stackPrefetch/stackContextPrefetch.d.ts +16 -0
- package/dist/cjs/utilities/stackPrefetch/stackContextPrefetch.js +227 -0
- package/dist/cjs/utilities/stackPrefetch/stackContextPrefetch.js.map +1 -0
- package/dist/cjs/utilities/stackPrefetch/stackPrefetch.d.ts +7 -1
- package/dist/cjs/utilities/stackPrefetch/stackPrefetch.js +23 -93
- package/dist/cjs/utilities/stackPrefetch/stackPrefetch.js.map +1 -1
- package/dist/cjs/utilities/stackPrefetch/stackPrefetchUtils.d.ts +14 -0
- package/dist/cjs/utilities/stackPrefetch/stackPrefetchUtils.js +85 -0
- package/dist/cjs/utilities/stackPrefetch/stackPrefetchUtils.js.map +1 -0
- package/dist/esm/drawingSvg/getSvgDrawingHelper.js +1 -1
- package/dist/esm/drawingSvg/getSvgDrawingHelper.js.map +1 -1
- package/dist/esm/enums/Events.d.ts +1 -0
- package/dist/esm/enums/Events.js +1 -0
- package/dist/esm/enums/Events.js.map +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDown.js +6 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDown.js.map +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.d.ts +2 -0
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.js +35 -0
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.js.map +1 -0
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForMouseEvent.d.ts +3 -0
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForMouseEvent.js +32 -0
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForMouseEvent.js.map +1 -0
- package/dist/esm/eventDispatchers/shared/getToolsWithModesForMouseEvent.d.ts +1 -1
- package/dist/esm/eventDispatchers/shared/getToolsWithModesForTouchEvent.d.ts +1 -1
- package/dist/esm/eventListeners/keyboard/keyDownListener.js +1 -2
- package/dist/esm/eventListeners/keyboard/keyDownListener.js.map +1 -1
- package/dist/esm/eventListeners/mouse/mouseDownListener.js +5 -1
- package/dist/esm/eventListeners/mouse/mouseDownListener.js.map +1 -1
- package/dist/esm/eventListeners/mouse/mouseMoveListener.js +5 -1
- package/dist/esm/eventListeners/mouse/mouseMoveListener.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js +4 -5
- package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +2 -3
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/addSegmentations.js +1 -2
- package/dist/esm/stateManagement/segmentation/addSegmentations.js.map +1 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.d.ts +2 -0
- package/dist/esm/store/ToolGroupManager/ToolGroup.js +36 -3
- package/dist/esm/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/esm/store/state.js +9 -2
- package/dist/esm/store/state.js.map +1 -1
- package/dist/esm/synchronizers/callbacks/stackImageSyncCallback.js +1 -1
- package/dist/esm/synchronizers/callbacks/stackImageSyncCallback.js.map +1 -1
- package/dist/esm/synchronizers/synchronizers/createVOISynchronizer.d.ts +1 -1
- package/dist/esm/tools/AdvancedMagnifyTool.d.ts +36 -0
- package/dist/esm/tools/AdvancedMagnifyTool.js +440 -0
- package/dist/esm/tools/AdvancedMagnifyTool.js.map +1 -0
- package/dist/esm/tools/AdvancedMagnifyViewport.d.ts +76 -0
- package/dist/esm/tools/AdvancedMagnifyViewport.js +346 -0
- package/dist/esm/tools/AdvancedMagnifyViewport.js.map +1 -0
- package/dist/esm/tools/AdvancedMagnifyViewportManager.d.ts +36 -0
- package/dist/esm/tools/AdvancedMagnifyViewportManager.js +128 -0
- package/dist/esm/tools/AdvancedMagnifyViewportManager.js.map +1 -0
- package/dist/esm/tools/MagnifyTool.js +2 -2
- package/dist/esm/tools/MagnifyTool.js.map +1 -1
- package/dist/esm/tools/OrientationMarkerTool.d.ts +88 -0
- package/dist/esm/tools/OrientationMarkerTool.js +185 -0
- package/dist/esm/tools/OrientationMarkerTool.js.map +1 -0
- package/dist/esm/tools/OverlayGridTool.d.ts +31 -0
- package/dist/esm/tools/OverlayGridTool.js +165 -0
- package/dist/esm/tools/OverlayGridTool.js.map +1 -0
- package/dist/esm/tools/ReferenceLinesTool.d.ts +3 -0
- package/dist/esm/tools/ReferenceLinesTool.js +71 -2
- package/dist/esm/tools/ReferenceLinesTool.js.map +1 -1
- package/dist/esm/tools/annotation/AngleTool.js +2 -1
- package/dist/esm/tools/annotation/AngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/BidirectionalTool.js +1 -1
- package/dist/esm/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/esm/tools/annotation/CircleROITool.d.ts +1 -2
- package/dist/esm/tools/annotation/CircleROITool.js +8 -8
- package/dist/esm/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/CobbAngleTool.d.ts +31 -5
- package/dist/esm/tools/annotation/CobbAngleTool.js +275 -72
- package/dist/esm/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/DragProbeTool.js +4 -3
- package/dist/esm/tools/annotation/DragProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.d.ts +2 -3
- package/dist/esm/tools/annotation/EllipticalROITool.js +20 -16
- package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/esm/tools/annotation/LengthTool.js +1 -1
- package/dist/esm/tools/annotation/LengthTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.d.ts +1 -2
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +22 -9
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/esm/tools/annotation/ProbeTool.d.ts +1 -2
- package/dist/esm/tools/annotation/ProbeTool.js +10 -9
- package/dist/esm/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.d.ts +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.js +9 -9
- package/dist/esm/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/esm/tools/base/AnnotationDisplayTool.js +3 -0
- package/dist/esm/tools/base/AnnotationDisplayTool.js.map +1 -1
- package/dist/esm/tools/base/AnnotationTool.d.ts +1 -1
- package/dist/esm/tools/base/AnnotationTool.js.map +1 -1
- package/dist/esm/tools/displayTools/Contour/contourConfigCache.d.ts +1 -1
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js +4 -1
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/esm/tools/index.d.ts +4 -1
- package/dist/esm/tools/index.js +4 -1
- package/dist/esm/tools/index.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/eraseCircle.d.ts +1 -1
- package/dist/esm/tools/segmentation/strategies/eraseRectangle.d.ts +1 -1
- package/dist/esm/tools/segmentation/strategies/eraseSphere.d.ts +1 -1
- package/dist/esm/tools/segmentation/strategies/fillCircle.d.ts +1 -1
- package/dist/esm/tools/segmentation/strategies/fillRectangle.d.ts +1 -1
- package/dist/esm/tools/segmentation/strategies/fillSphere.d.ts +1 -1
- package/dist/esm/types/AnnotationGroupSelector.d.ts +1 -1
- package/dist/esm/types/AnnotationStyle.d.ts +7 -7
- package/dist/esm/types/AnnotationTypes.d.ts +4 -4
- package/dist/esm/types/BoundsIJK.d.ts +1 -1
- package/dist/esm/types/CINETypes.d.ts +2 -2
- package/dist/esm/types/CalculatorTypes.d.ts +1 -1
- package/dist/esm/types/ContourTypes.d.ts +3 -3
- package/dist/esm/types/CursorTypes.d.ts +2 -2
- package/dist/esm/types/EventTypes.d.ts +88 -80
- package/dist/esm/types/FloodFillTypes.d.ts +5 -5
- package/dist/esm/types/IDistance.d.ts +1 -1
- package/dist/esm/types/IPoints.d.ts +1 -1
- package/dist/esm/types/ISetToolModeOptions.d.ts +5 -5
- package/dist/esm/types/IToolClassReference.d.ts +1 -1
- package/dist/esm/types/IToolGroup.d.ts +3 -0
- package/dist/esm/types/ITouchPoints.d.ts +1 -1
- package/dist/esm/types/InteractionTypes.d.ts +1 -1
- package/dist/esm/types/InternalToolTypes.d.ts +3 -3
- package/dist/esm/types/JumpToSliceOptions.d.ts +1 -1
- package/dist/esm/types/LabelmapTypes.d.ts +3 -3
- package/dist/esm/types/PlanarBoundingBox.d.ts +1 -1
- package/dist/esm/types/SVGDrawingHelper.d.ts +1 -1
- package/dist/esm/types/ScrollOptions.d.ts +1 -1
- package/dist/esm/types/SegmentationStateTypes.d.ts +15 -15
- package/dist/esm/types/ToolAction.d.ts +8 -0
- package/dist/esm/types/ToolAction.js +2 -0
- package/dist/esm/types/ToolAction.js.map +1 -0
- package/dist/esm/types/ToolHandle.d.ts +3 -3
- package/dist/esm/types/ToolProps.d.ts +4 -4
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +55 -0
- package/dist/esm/types/index.d.ts +2 -1
- package/dist/esm/utilities/getModalityUnit.d.ts +1 -1
- package/dist/esm/utilities/getModalityUnit.js +5 -2
- package/dist/esm/utilities/getModalityUnit.js.map +1 -1
- package/dist/esm/utilities/getToolsWithModesForElement.d.ts +1 -1
- package/dist/esm/utilities/index.d.ts +2 -2
- package/dist/esm/utilities/index.js +2 -2
- package/dist/esm/utilities/index.js.map +1 -1
- package/dist/esm/utilities/math/angle/angleBetweenLines.d.ts +3 -1
- package/dist/esm/utilities/math/angle/angleBetweenLines.js +19 -2
- package/dist/esm/utilities/math/angle/angleBetweenLines.js.map +1 -1
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.js.map +1 -1
- package/dist/esm/utilities/math/circle/_types.d.ts +1 -1
- package/dist/esm/utilities/math/ellipse/getCanvasEllipseCorners.d.ts +1 -1
- package/dist/esm/utilities/math/ellipse/pointInEllipse.d.ts +1 -1
- package/dist/esm/utilities/math/ellipse/pointInEllipsoidWithConstraint.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/planarFreehandROIInternalTypes.d.ts +3 -3
- package/dist/esm/utilities/math/sphere/pointInSphere.d.ts +1 -1
- package/dist/esm/utilities/pointInShapeCallback.d.ts +3 -3
- package/dist/esm/utilities/rectangleROITool/getBoundsIJKFromRectangleAnnotations.d.ts +1 -1
- package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.d.ts +8 -8
- package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.js +1 -2
- package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.js.map +1 -1
- package/dist/esm/utilities/segmentation/rectangleROIThresholdVolumeByRange.d.ts +2 -2
- package/dist/esm/utilities/segmentation/thresholdVolumeByRange.d.ts +1 -1
- package/dist/esm/utilities/segmentation/utilities.d.ts +1 -1
- package/dist/esm/utilities/stackPrefetch/index.d.ts +3 -2
- package/dist/esm/utilities/stackPrefetch/index.js +3 -2
- package/dist/esm/utilities/stackPrefetch/index.js.map +1 -1
- package/dist/esm/utilities/stackPrefetch/stackContextPrefetch.d.ts +16 -0
- package/dist/esm/utilities/stackPrefetch/stackContextPrefetch.js +220 -0
- package/dist/esm/utilities/stackPrefetch/stackContextPrefetch.js.map +1 -0
- package/dist/esm/utilities/stackPrefetch/stackPrefetch.d.ts +7 -1
- package/dist/esm/utilities/stackPrefetch/stackPrefetch.js +12 -79
- package/dist/esm/utilities/stackPrefetch/stackPrefetch.js.map +1 -1
- package/dist/esm/utilities/stackPrefetch/stackPrefetchUtils.d.ts +14 -0
- package/dist/esm/utilities/stackPrefetch/stackPrefetchUtils.js +77 -0
- package/dist/esm/utilities/stackPrefetch/stackPrefetchUtils.js.map +1 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/drawingSvg/getSvgDrawingHelper.ts +4 -1
- package/src/enums/Events.ts +9 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDown.ts +11 -2
- package/src/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.ts +72 -0
- package/src/eventDispatchers/shared/getToolsWithActionsForMouseEvent.ts +66 -0
- package/src/eventListeners/keyboard/keyDownListener.ts +1 -2
- package/src/eventListeners/mouse/mouseDownListener.ts +7 -1
- package/src/eventListeners/mouse/mouseMoveListener.ts +7 -1
- package/src/index.ts +6 -0
- package/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts +4 -5
- package/src/stateManagement/segmentation/SegmentationStateManager.ts +2 -3
- package/src/stateManagement/segmentation/addSegmentationRepresentations.ts +0 -1
- package/src/stateManagement/segmentation/addSegmentations.ts +1 -2
- package/src/store/ToolGroupManager/ToolGroup.ts +80 -4
- package/src/store/state.ts +9 -3
- package/src/synchronizers/callbacks/stackImageSyncCallback.ts +1 -1
- package/src/tools/AdvancedMagnifyTool.ts +725 -0
- package/src/tools/AdvancedMagnifyViewport.ts +624 -0
- package/src/tools/AdvancedMagnifyViewportManager.ts +291 -0
- package/src/tools/MagnifyTool.ts +2 -2
- package/src/tools/OrientationMarkerTool.ts +235 -0
- package/src/tools/OverlayGridTool.ts +357 -0
- package/src/tools/ReferenceLinesTool.ts +131 -3
- package/src/tools/annotation/AngleTool.ts +4 -1
- package/src/tools/annotation/BidirectionalTool.ts +1 -1
- package/src/tools/annotation/CircleROITool.ts +13 -20
- package/src/tools/annotation/CobbAngleTool.ts +422 -99
- package/src/tools/annotation/DragProbeTool.ts +6 -13
- package/src/tools/annotation/EllipticalROITool.ts +28 -29
- package/src/tools/annotation/LengthTool.ts +1 -1
- package/src/tools/annotation/PlanarFreehandROITool.ts +35 -20
- package/src/tools/annotation/ProbeTool.ts +17 -30
- package/src/tools/annotation/RectangleROITool.ts +15 -19
- package/src/tools/base/AnnotationDisplayTool.ts +4 -0
- package/src/tools/base/AnnotationTool.ts +2 -1
- package/src/tools/displayTools/Contour/contourDisplay.ts +8 -0
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +1 -1
- package/src/tools/index.ts +6 -0
- package/src/types/EventTypes.ts +23 -0
- package/src/types/IToolGroup.ts +7 -0
- package/src/types/ToolAction.ts +54 -0
- package/src/types/ToolSpecificAnnotationTypes.ts +58 -0
- package/src/types/index.ts +2 -0
- package/src/utilities/getModalityUnit.ts +8 -2
- package/src/utilities/index.ts +2 -1
- package/src/utilities/math/angle/angleBetweenLines.ts +39 -9
- package/src/utilities/segmentation/createLabelmapVolumeForViewport.ts +9 -10
- package/src/utilities/stackPrefetch/index.ts +3 -7
- package/src/utilities/stackPrefetch/stackContextPrefetch.ts +380 -0
- package/src/utilities/stackPrefetch/stackPrefetch.ts +29 -151
- package/src/utilities/stackPrefetch/stackPrefetchUtils.ts +114 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.4",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "dist/umd/index.js",
|
|
6
6
|
"types": "dist/esm/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": "^2.0.0-beta.
|
|
32
|
+
"@cornerstonejs/core": "^2.0.0-beta.4",
|
|
33
33
|
"lodash.clonedeep": "4.5.0",
|
|
34
34
|
"lodash.get": "^4.4.2"
|
|
35
35
|
},
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"type": "individual",
|
|
53
53
|
"url": "https://ohif.org/donate"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "deefd5fb773ca3eb6fc4f2047c15a2b1a3ac82de"
|
|
56
56
|
}
|
|
@@ -38,7 +38,10 @@ function getSvgDrawingHelper(element: HTMLDivElement): SVGDrawingHelper {
|
|
|
38
38
|
function _getSvgLayer(element) {
|
|
39
39
|
const viewportElement = `.${VIEWPORT_ELEMENT}`;
|
|
40
40
|
const internalDivElement = element.querySelector(viewportElement);
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
// Using :scope to make sure the right svg layer is selected otherwise it
|
|
43
|
+
// may select one from a nested viewport (eg: AdvancedMagnifyTool).
|
|
44
|
+
const svgLayer = internalDivElement.querySelector(':scope > .svg-layer');
|
|
42
45
|
|
|
43
46
|
return svgLayer;
|
|
44
47
|
}
|
package/src/enums/Events.ts
CHANGED
|
@@ -18,6 +18,15 @@ enum Events {
|
|
|
18
18
|
*/
|
|
19
19
|
TOOL_ACTIVATED = 'CORNERSTONE_TOOLS_TOOL_ACTIVATED',
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Triggers on the eventTarget when a mode of a tool is changed (active, passive, enabled and disabled).
|
|
23
|
+
*
|
|
24
|
+
* Make use of {@link EventTypes.ToolModeChangedEventType | Tool Mode Changed Event Type }
|
|
25
|
+
* for typing your event listeners for this tool activated event, and see what event
|
|
26
|
+
* detail is included in {@link EventTypes.ToolModeChangedEventDetail | Tool Mode Changed Event Detail}.
|
|
27
|
+
*/
|
|
28
|
+
TOOL_MODE_CHANGED = 'CORNERSTONE_TOOLS_TOOL_MODE_CHANGED',
|
|
29
|
+
|
|
21
30
|
///////////////////////////////////////
|
|
22
31
|
// Annotations
|
|
23
32
|
///////////////////////////////////////
|
|
@@ -20,6 +20,7 @@ import filterToolsWithAnnotationsForElement from '../../store/filterToolsWithAnn
|
|
|
20
20
|
import filterMoveableAnnotationTools from '../../store/filterMoveableAnnotationTools';
|
|
21
21
|
import getActiveToolForMouseEvent from '../shared/getActiveToolForMouseEvent';
|
|
22
22
|
import getToolsWithModesForMouseEvent from '../shared/getToolsWithModesForMouseEvent';
|
|
23
|
+
import mouseDownAnnotationAction from './mouseDownAnnotationAction';
|
|
23
24
|
|
|
24
25
|
const { Active, Passive } = ToolModes;
|
|
25
26
|
|
|
@@ -39,8 +40,10 @@ const { Active, Passive } = ToolModes;
|
|
|
39
40
|
* - Next we check any tools are interactable (e.g. moving an entire length annotation rather than one of its handles:
|
|
40
41
|
* `filterMoveableAnnotationTools`). If interactable tools are found, the first tool found consumes the event and the
|
|
41
42
|
* event does not propagate further.
|
|
42
|
-
* -
|
|
43
|
+
* - If the `activeTool` has `postMouseDownCallback`, this is called. If the callback returns `true`,
|
|
43
44
|
* the event does not propagate further.
|
|
45
|
+
* - Finally, look for annotations actions that could handle the event such as showing a dropdown to allow the user
|
|
46
|
+
* change the magnifying glass zoom factor.
|
|
44
47
|
*
|
|
45
48
|
* If the event is not consumed the event will bubble to the `mouseDownActivate` handler.
|
|
46
49
|
*
|
|
@@ -133,7 +136,7 @@ export default function mouseDown(evt: EventTypes.MouseDownEventType) {
|
|
|
133
136
|
);
|
|
134
137
|
|
|
135
138
|
toggleAnnotationSelection(annotation.annotationUID, isMultiSelect);
|
|
136
|
-
tool.toolSelectedCallback(evt, annotation, 'Mouse');
|
|
139
|
+
tool.toolSelectedCallback(evt, annotation, 'Mouse', canvasCoords);
|
|
137
140
|
|
|
138
141
|
return;
|
|
139
142
|
}
|
|
@@ -148,6 +151,12 @@ export default function mouseDown(evt: EventTypes.MouseDownEventType) {
|
|
|
148
151
|
}
|
|
149
152
|
}
|
|
150
153
|
|
|
154
|
+
const actionExecuted = mouseDownAnnotationAction(evt);
|
|
155
|
+
|
|
156
|
+
if (actionExecuted) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
151
160
|
// Don't stop propagation so that mouseDownActivate can handle the event
|
|
152
161
|
}
|
|
153
162
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { getEnabledElement } from '@cornerstonejs/core';
|
|
2
|
+
import { state } from '../../store';
|
|
3
|
+
import { ToolModes } from '../../enums';
|
|
4
|
+
import { EventTypes } from '../../types';
|
|
5
|
+
|
|
6
|
+
// Util
|
|
7
|
+
import filterToolsWithAnnotationsForElement from '../../store/filterToolsWithAnnotationsForElement';
|
|
8
|
+
import filterMoveableAnnotationTools from '../../store/filterMoveableAnnotationTools';
|
|
9
|
+
import getToolsWithActionsForMouseEvent from '../shared/getToolsWithActionsForMouseEvent';
|
|
10
|
+
|
|
11
|
+
const { Active, Passive } = ToolModes;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Look for active or passive annotations with an action that could handle the
|
|
15
|
+
* event based on the bindings and invoke the first one found.
|
|
16
|
+
*
|
|
17
|
+
* @param evt - The normalized mouseDown event.
|
|
18
|
+
* @returns True if an action has executed or false otherwise
|
|
19
|
+
*/
|
|
20
|
+
export default function mouseDownAnnotationAction(
|
|
21
|
+
evt: EventTypes.MouseDownEventType
|
|
22
|
+
): boolean {
|
|
23
|
+
// If a tool has locked the current state it is dealing with an interaction within its own eventLoop.
|
|
24
|
+
if (state.isInteractingWithTool) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const eventDetail = evt.detail;
|
|
29
|
+
const { element } = eventDetail;
|
|
30
|
+
const enabledElement = getEnabledElement(element);
|
|
31
|
+
const { canvas: canvasCoords } = eventDetail.currentPoints;
|
|
32
|
+
|
|
33
|
+
if (!enabledElement) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Find all tools that might respond to this mouse down
|
|
38
|
+
const toolsWithActions = getToolsWithActionsForMouseEvent(evt, [
|
|
39
|
+
Active,
|
|
40
|
+
Passive,
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
const tools = Array.from(toolsWithActions.keys());
|
|
44
|
+
|
|
45
|
+
// Filter tools with annotations for this element
|
|
46
|
+
const annotationToolsWithAnnotations = filterToolsWithAnnotationsForElement(
|
|
47
|
+
element,
|
|
48
|
+
tools
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
// Only moveable annotations (unlocked, visible and close to the canvas coordinates) may trigger actions
|
|
52
|
+
const moveableAnnotationTools = filterMoveableAnnotationTools(
|
|
53
|
+
element,
|
|
54
|
+
annotationToolsWithAnnotations,
|
|
55
|
+
canvasCoords
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
// If there are annotation tools that are interactable, select the first one
|
|
59
|
+
// that isn't locked. If there's only one annotation tool, select it.
|
|
60
|
+
if (moveableAnnotationTools.length > 0) {
|
|
61
|
+
const { tool, annotation } = moveableAnnotationTools[0];
|
|
62
|
+
const action = toolsWithActions.get(tool);
|
|
63
|
+
const method =
|
|
64
|
+
typeof action.method === 'string' ? tool[action.method] : action.method;
|
|
65
|
+
|
|
66
|
+
method.call(tool, evt, annotation);
|
|
67
|
+
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ToolGroupManager } from '../../store';
|
|
2
|
+
import { ToolModes } from '../../enums';
|
|
3
|
+
import { ToolAction, EventTypes } from '../../types';
|
|
4
|
+
|
|
5
|
+
import { keyEventListener } from '../../eventListeners';
|
|
6
|
+
import getMouseModifier from './getMouseModifier';
|
|
7
|
+
|
|
8
|
+
type ModesFilter = Array<ToolModes>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Given the mouse event and a list of tool modes, find all tool instances
|
|
12
|
+
* with actions that were added to the tool group associated with the viewport
|
|
13
|
+
* that triggered the event.
|
|
14
|
+
*
|
|
15
|
+
* @param evt - mouseDown event triggered by a cornerstone viewport
|
|
16
|
+
* @param toolModes - List of tool modes used to filter the tools registered
|
|
17
|
+
* in the viewport's tool group
|
|
18
|
+
*/
|
|
19
|
+
export default function getToolsWithActionsForMouseEvent(
|
|
20
|
+
evt: EventTypes.MouseMoveEventType,
|
|
21
|
+
toolModes: ToolModes[]
|
|
22
|
+
): Map<any, ToolAction> {
|
|
23
|
+
const toolsWithActions = new Map();
|
|
24
|
+
const { renderingEngineId, viewportId } = evt.detail;
|
|
25
|
+
const toolGroup = ToolGroupManager.getToolGroupForViewport(
|
|
26
|
+
viewportId,
|
|
27
|
+
renderingEngineId
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
if (!toolGroup) {
|
|
31
|
+
return toolsWithActions;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const toolGroupToolNames = Object.keys(toolGroup.toolOptions);
|
|
35
|
+
const defaultMousePrimary = toolGroup.getDefaultMousePrimary();
|
|
36
|
+
const mouseEvent = evt.detail.event;
|
|
37
|
+
const mouseButton = mouseEvent?.buttons ?? defaultMousePrimary;
|
|
38
|
+
const modifierKey =
|
|
39
|
+
getMouseModifier(mouseEvent) || keyEventListener.getModifierKey();
|
|
40
|
+
|
|
41
|
+
for (let j = 0; j < toolGroupToolNames.length; j++) {
|
|
42
|
+
const toolName = toolGroupToolNames[j];
|
|
43
|
+
const tool = toolGroup.getToolInstance(toolName);
|
|
44
|
+
const actions = tool.configuration?.actions;
|
|
45
|
+
|
|
46
|
+
if (!actions?.length || !toolModes.includes(tool.mode)) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const action = actions.find(
|
|
51
|
+
(action) =>
|
|
52
|
+
action.bindings.length &&
|
|
53
|
+
action.bindings.some(
|
|
54
|
+
(binding) =>
|
|
55
|
+
binding.mouseButton === mouseButton &&
|
|
56
|
+
binding.modifierKey === modifierKey
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
if (action) {
|
|
61
|
+
toolsWithActions.set(tool, action);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return toolsWithActions;
|
|
66
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _cloneDeep from 'lodash.clonedeep';
|
|
2
1
|
import { getEnabledElement, triggerEvent } from '@cornerstonejs/core';
|
|
3
2
|
import Events from '../../enums/Events';
|
|
4
3
|
import { KeyDownEventDetail, KeyUpEventDetail } from '../../types/EventTypes';
|
|
@@ -97,7 +96,7 @@ function _onKeyUp(evt: KeyboardEvent): void {
|
|
|
97
96
|
state.element.addEventListener('keydown', keyListener);
|
|
98
97
|
|
|
99
98
|
// Restore `state` to `defaultState`
|
|
100
|
-
state =
|
|
99
|
+
state = structuredClone(defaultState);
|
|
101
100
|
triggerEvent(eventDetail.element, Events.KEY_UP, eventDetail);
|
|
102
101
|
}
|
|
103
102
|
|
|
@@ -262,7 +262,13 @@ function _onMouseDrag(evt: MouseEvent) {
|
|
|
262
262
|
deltaPoints,
|
|
263
263
|
};
|
|
264
264
|
|
|
265
|
-
triggerEvent(state.element, MOUSE_DRAG, eventDetail);
|
|
265
|
+
const consumed = !triggerEvent(state.element, MOUSE_DRAG, eventDetail);
|
|
266
|
+
|
|
267
|
+
// Events.MOUSE_DRAG was consumed, thus no other listener should handle this event.
|
|
268
|
+
if (consumed) {
|
|
269
|
+
evt.stopImmediatePropagation();
|
|
270
|
+
evt.preventDefault();
|
|
271
|
+
}
|
|
266
272
|
|
|
267
273
|
// Update the last points
|
|
268
274
|
state.lastPoints = _copyPoints(currentPoints);
|
|
@@ -27,7 +27,13 @@ function mouseMoveListener(evt: MouseEvent) {
|
|
|
27
27
|
event: evt,
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
triggerEvent(element, eventName, eventDetail);
|
|
30
|
+
const consumed = !triggerEvent(element, eventName, eventDetail);
|
|
31
|
+
|
|
32
|
+
// Events.MOUSE_MOVE was consumed, thus no other listener should handle this event.
|
|
33
|
+
if (consumed) {
|
|
34
|
+
evt.stopImmediatePropagation();
|
|
35
|
+
evt.preventDefault();
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
export default mouseMoveListener;
|
package/src/index.ts
CHANGED
|
@@ -54,10 +54,13 @@ import {
|
|
|
54
54
|
AngleTool,
|
|
55
55
|
CobbAngleTool,
|
|
56
56
|
MagnifyTool,
|
|
57
|
+
AdvancedMagnifyTool,
|
|
57
58
|
ReferenceCursors,
|
|
58
59
|
ReferenceLines,
|
|
59
60
|
PaintFillTool,
|
|
60
61
|
ScaleOverlayTool,
|
|
62
|
+
OrientationMarkerTool,
|
|
63
|
+
OverlayGridTool,
|
|
61
64
|
} from './tools';
|
|
62
65
|
|
|
63
66
|
import * as Enums from './enums';
|
|
@@ -88,6 +91,7 @@ export {
|
|
|
88
91
|
LengthTool,
|
|
89
92
|
CrosshairsTool,
|
|
90
93
|
ReferenceLinesTool,
|
|
94
|
+
OverlayGridTool,
|
|
91
95
|
ProbeTool,
|
|
92
96
|
RectangleROITool,
|
|
93
97
|
EllipticalROITool,
|
|
@@ -98,6 +102,7 @@ export {
|
|
|
98
102
|
AngleTool,
|
|
99
103
|
CobbAngleTool,
|
|
100
104
|
MagnifyTool,
|
|
105
|
+
AdvancedMagnifyTool,
|
|
101
106
|
ReferenceCursors,
|
|
102
107
|
ReferenceLines,
|
|
103
108
|
ScaleOverlayTool,
|
|
@@ -110,6 +115,7 @@ export {
|
|
|
110
115
|
RectangleROIThresholdTool,
|
|
111
116
|
RectangleROIStartEndThresholdTool,
|
|
112
117
|
BrushTool,
|
|
118
|
+
OrientationMarkerTool,
|
|
113
119
|
// Synchronizers
|
|
114
120
|
synchronizers,
|
|
115
121
|
Synchronizer,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import cloneDeep from 'lodash.clonedeep';
|
|
2
1
|
import {
|
|
3
2
|
Annotation,
|
|
4
3
|
Annotations,
|
|
@@ -314,14 +313,14 @@ class FrameOfReferenceSpecificAnnotationManager implements IAnnotationManager {
|
|
|
314
313
|
const toolSpecificAnnotations =
|
|
315
314
|
frameOfReferenceSpecificAnnotations[toolName];
|
|
316
315
|
|
|
317
|
-
return
|
|
316
|
+
return structuredClone(toolSpecificAnnotations);
|
|
318
317
|
} else if (groupKey) {
|
|
319
318
|
const frameOfReferenceSpecificAnnotations = annotations[groupKey];
|
|
320
319
|
|
|
321
|
-
return
|
|
320
|
+
return structuredClone(frameOfReferenceSpecificAnnotations);
|
|
322
321
|
}
|
|
323
322
|
|
|
324
|
-
return
|
|
323
|
+
return structuredClone(annotations);
|
|
325
324
|
};
|
|
326
325
|
|
|
327
326
|
/**
|
|
@@ -361,7 +360,7 @@ class FrameOfReferenceSpecificAnnotationManager implements IAnnotationManager {
|
|
|
361
360
|
annotations[groupKey] = <GroupSpecificAnnotations>state;
|
|
362
361
|
} else {
|
|
363
362
|
// Set entire annotations
|
|
364
|
-
this.annotations = <AnnotationState>
|
|
363
|
+
this.annotations = <AnnotationState>structuredClone(state);
|
|
365
364
|
}
|
|
366
365
|
};
|
|
367
366
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { utilities as csUtils } from '@cornerstonejs/core';
|
|
2
|
-
import cloneDeep from 'lodash.clonedeep';
|
|
3
2
|
|
|
4
3
|
import CORNERSTONE_COLOR_LUT from '../../constants/COLOR_LUT';
|
|
5
4
|
|
|
@@ -52,7 +51,7 @@ export default class SegmentationStateManager {
|
|
|
52
51
|
if (!uid) {
|
|
53
52
|
uid = csUtils.uuidv4();
|
|
54
53
|
}
|
|
55
|
-
this.state =
|
|
54
|
+
this.state = structuredClone(initialDefaultState);
|
|
56
55
|
this.uid = uid;
|
|
57
56
|
}
|
|
58
57
|
|
|
@@ -85,7 +84,7 @@ export default class SegmentationStateManager {
|
|
|
85
84
|
* Reset the state to the default state
|
|
86
85
|
*/
|
|
87
86
|
resetState(): void {
|
|
88
|
-
this.state =
|
|
87
|
+
this.state = structuredClone(initialDefaultState);
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
/**
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _cloneDeep from 'lodash.clonedeep';
|
|
2
1
|
import { SegmentationPublicInput } from '../../types/SegmentationStateTypes';
|
|
3
2
|
import { validateSegmentationInput } from './helpers';
|
|
4
3
|
import { addSegmentation as addSegmentationToState } from './segmentationState';
|
|
@@ -18,7 +17,7 @@ function addSegmentations(
|
|
|
18
17
|
validateSegmentationInput(segmentationInputArray);
|
|
19
18
|
|
|
20
19
|
segmentationInputArray.map((segInput) => {
|
|
21
|
-
const segmentationInput =
|
|
20
|
+
const segmentationInput = structuredClone(segInput);
|
|
22
21
|
|
|
23
22
|
addSegmentationToState(segmentationInput);
|
|
24
23
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MouseBindings, ToolModes } from '../../enums';
|
|
2
|
-
import cloneDeep from 'lodash.clonedeep';
|
|
3
2
|
import get from 'lodash.get';
|
|
4
3
|
import {
|
|
5
4
|
triggerEvent,
|
|
@@ -12,8 +11,11 @@ import {
|
|
|
12
11
|
} from '@cornerstonejs/core';
|
|
13
12
|
import type { Types } from '@cornerstonejs/core';
|
|
14
13
|
import { Events } from '../../enums';
|
|
15
|
-
import {
|
|
16
|
-
|
|
14
|
+
import {
|
|
15
|
+
ToolActivatedEventDetail,
|
|
16
|
+
ToolModeChangedEventDetail,
|
|
17
|
+
} from '../../types/EventTypes';
|
|
18
|
+
import { ToolGroupManager, state } from '../index';
|
|
17
19
|
import {
|
|
18
20
|
IToolBinding,
|
|
19
21
|
IToolClassReference,
|
|
@@ -385,6 +387,7 @@ export default class ToolGroup implements IToolGroup {
|
|
|
385
387
|
};
|
|
386
388
|
|
|
387
389
|
triggerEvent(eventTarget, Events.TOOL_ACTIVATED, eventDetail);
|
|
390
|
+
this._triggerToolModeChangedEvent(toolName, Active, toolBindingsOptions);
|
|
388
391
|
}
|
|
389
392
|
|
|
390
393
|
/**
|
|
@@ -440,6 +443,13 @@ export default class ToolGroup implements IToolGroup {
|
|
|
440
443
|
toolInstance.onSetToolPassive();
|
|
441
444
|
}
|
|
442
445
|
this._renderViewports();
|
|
446
|
+
|
|
447
|
+
// It would make sense to use `toolInstance.mode` as mode when setting a tool
|
|
448
|
+
// as passive because it can still be actived in the end but `Passive` must
|
|
449
|
+
// be used when synchronizing ToolGroups so that other ToolGroups can take the
|
|
450
|
+
// same action (update tool bindings). Should the event have two different modes
|
|
451
|
+
// to handle this special case?
|
|
452
|
+
this._triggerToolModeChangedEvent(toolName, Passive);
|
|
443
453
|
}
|
|
444
454
|
|
|
445
455
|
/**
|
|
@@ -473,6 +483,7 @@ export default class ToolGroup implements IToolGroup {
|
|
|
473
483
|
}
|
|
474
484
|
|
|
475
485
|
this._renderViewports();
|
|
486
|
+
this._triggerToolModeChangedEvent(toolName, Enabled);
|
|
476
487
|
}
|
|
477
488
|
|
|
478
489
|
/**
|
|
@@ -505,6 +516,7 @@ export default class ToolGroup implements IToolGroup {
|
|
|
505
516
|
toolInstance.onSetToolDisabled();
|
|
506
517
|
}
|
|
507
518
|
this._renderViewports();
|
|
519
|
+
this._triggerToolModeChangedEvent(toolName, Disabled);
|
|
508
520
|
}
|
|
509
521
|
|
|
510
522
|
/**
|
|
@@ -666,7 +678,50 @@ export default class ToolGroup implements IToolGroup {
|
|
|
666
678
|
configurationPath
|
|
667
679
|
);
|
|
668
680
|
|
|
669
|
-
return
|
|
681
|
+
return structuredClone(_configuration);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
*
|
|
686
|
+
* @param newToolGroupId - Id of the new (clone) tool group
|
|
687
|
+
* @param fnToolFilter - Function to filter which tools from this tool group
|
|
688
|
+
* should be added to the new (clone) one. Example: only annotations tools
|
|
689
|
+
* can be filtered and added to the new tool group.
|
|
690
|
+
* @returns A new tool group that is a clone of this one
|
|
691
|
+
*/
|
|
692
|
+
public clone(
|
|
693
|
+
newToolGroupId,
|
|
694
|
+
fnToolFilter: (toolName: string) => void = null
|
|
695
|
+
): IToolGroup {
|
|
696
|
+
let toolGroup = ToolGroupManager.getToolGroup(newToolGroupId);
|
|
697
|
+
|
|
698
|
+
if (toolGroup) {
|
|
699
|
+
console.warn(`ToolGroup ${newToolGroupId} already exists`);
|
|
700
|
+
return toolGroup;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
toolGroup = ToolGroupManager.createToolGroup(newToolGroupId);
|
|
704
|
+
fnToolFilter = fnToolFilter ?? (() => true);
|
|
705
|
+
|
|
706
|
+
Object.keys(this._toolInstances)
|
|
707
|
+
.filter(fnToolFilter)
|
|
708
|
+
.forEach((toolName) => {
|
|
709
|
+
const sourceToolInstance = this._toolInstances[toolName];
|
|
710
|
+
const sourceToolOptions = this.toolOptions[toolName];
|
|
711
|
+
const sourceToolMode = sourceToolInstance.mode;
|
|
712
|
+
|
|
713
|
+
toolGroup.addTool(toolName);
|
|
714
|
+
|
|
715
|
+
(toolGroup as unknown as ToolGroup).setToolMode(
|
|
716
|
+
toolName,
|
|
717
|
+
sourceToolMode,
|
|
718
|
+
{
|
|
719
|
+
bindings: sourceToolOptions.bindings ?? [],
|
|
720
|
+
}
|
|
721
|
+
);
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
return toolGroup;
|
|
670
725
|
}
|
|
671
726
|
|
|
672
727
|
/**
|
|
@@ -692,6 +747,27 @@ export default class ToolGroup implements IToolGroup {
|
|
|
692
747
|
getRenderingEngine(renderingEngineId).renderViewport(viewportId);
|
|
693
748
|
});
|
|
694
749
|
}
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* Trigger ToolModeChangedEvent when changing the tool mode
|
|
753
|
+
* @param toolName - Tool name
|
|
754
|
+
* @param mode - Tool mode
|
|
755
|
+
* @param toolBindingsOptions - Binding options used when a tool is activated
|
|
756
|
+
*/
|
|
757
|
+
private _triggerToolModeChangedEvent(
|
|
758
|
+
toolName: string,
|
|
759
|
+
mode: ToolModes,
|
|
760
|
+
toolBindingsOptions?: SetToolBindingsType
|
|
761
|
+
): void {
|
|
762
|
+
const eventDetail: ToolModeChangedEventDetail = {
|
|
763
|
+
toolGroupId: this.id,
|
|
764
|
+
toolName,
|
|
765
|
+
mode,
|
|
766
|
+
toolBindingsOptions,
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
triggerEvent(eventTarget, Events.TOOL_MODE_CHANGED, eventDetail);
|
|
770
|
+
}
|
|
695
771
|
}
|
|
696
772
|
|
|
697
773
|
function hasSameBinding(
|
package/src/store/state.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _cloneDeep from 'lodash.clonedeep';
|
|
2
|
-
|
|
3
1
|
import { IToolGroup, IToolClassReference } from '../types';
|
|
4
2
|
import Synchronizer from './SynchronizerManager/Synchronizer';
|
|
5
3
|
import svgNodeCache, { resetSvgNodeCache } from './svgNodeCache';
|
|
@@ -46,7 +44,15 @@ let state: ICornerstoneTools3dState = {
|
|
|
46
44
|
|
|
47
45
|
function resetCornerstoneToolsState(): void {
|
|
48
46
|
resetSvgNodeCache();
|
|
49
|
-
state =
|
|
47
|
+
state = {
|
|
48
|
+
...structuredClone({
|
|
49
|
+
...defaultState,
|
|
50
|
+
svgNodeCache: {},
|
|
51
|
+
}),
|
|
52
|
+
svgNodeCache: {
|
|
53
|
+
...defaultState.svgNodeCache,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
export {
|
|
@@ -85,7 +85,7 @@ export default async function stackImageSyncCallback(
|
|
|
85
85
|
const frameOfReferenceUID2 = tViewport.getFrameOfReferenceUID();
|
|
86
86
|
if (
|
|
87
87
|
frameOfReferenceUID1 === frameOfReferenceUID2 &&
|
|
88
|
-
options
|
|
88
|
+
options?.useInitialPosition !== false
|
|
89
89
|
) {
|
|
90
90
|
registrationMatrixMat4 = mat4.identity(mat4.create());
|
|
91
91
|
} else {
|