@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
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { vec3 } from 'gl-matrix';
|
|
2
|
+
import {
|
|
3
|
+
metaData,
|
|
4
|
+
CONSTANTS,
|
|
5
|
+
getRenderingEngine,
|
|
6
|
+
utilities as csUtils,
|
|
7
|
+
} from '@cornerstonejs/core';
|
|
8
|
+
import type { Types } from '@cornerstonejs/core';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
addAnnotation,
|
|
12
|
+
getAnnotations,
|
|
13
|
+
} from '../stateManagement/annotation/annotationState';
|
|
14
|
+
|
|
15
|
+
import { getToolGroup } from '../store/ToolGroupManager';
|
|
16
|
+
|
|
17
|
+
import { drawLine as drawLineSvg } from '../drawingSvg';
|
|
18
|
+
import triggerAnnotationRenderForViewportIds from '../utilities/triggerAnnotationRenderForViewportIds';
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
PublicToolProps,
|
|
22
|
+
ToolProps,
|
|
23
|
+
SVGDrawingHelper,
|
|
24
|
+
Annotation,
|
|
25
|
+
} from '../types';
|
|
26
|
+
import { StyleSpecifier } from '../types/AnnotationStyle';
|
|
27
|
+
import AnnotationDisplayTool from './base/AnnotationDisplayTool';
|
|
28
|
+
|
|
29
|
+
const { EPSILON } = CONSTANTS;
|
|
30
|
+
|
|
31
|
+
export interface OverlayGridAnnotation extends Annotation {
|
|
32
|
+
data: {
|
|
33
|
+
viewportData: Map<string, object>;
|
|
34
|
+
pointSets: Array<object>;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
class OverlayGridTool extends AnnotationDisplayTool {
|
|
42
|
+
static toolName;
|
|
43
|
+
|
|
44
|
+
public touchDragCallback: any;
|
|
45
|
+
public mouseDragCallback: any;
|
|
46
|
+
_throttledCalculateCachedStats: any;
|
|
47
|
+
isDrawing: boolean;
|
|
48
|
+
isHandleOutsideImage: boolean;
|
|
49
|
+
|
|
50
|
+
constructor(
|
|
51
|
+
toolProps: PublicToolProps = {},
|
|
52
|
+
defaultToolProps: ToolProps = {
|
|
53
|
+
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
54
|
+
configuration: {
|
|
55
|
+
sourceImageIds: [],
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
) {
|
|
59
|
+
super(toolProps, defaultToolProps);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
onSetToolEnabled = (): void => {
|
|
63
|
+
this._init();
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
onSetToolActive = (): void => {
|
|
67
|
+
this._init();
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
_init = (): void => {
|
|
71
|
+
const sourceImageIds = this.configuration.sourceImageIds;
|
|
72
|
+
if (!sourceImageIds?.length) {
|
|
73
|
+
console.warn(
|
|
74
|
+
'OverlayGridTool: No sourceImageIds provided in configuration'
|
|
75
|
+
);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const imagePlaneModule = metaData.get(
|
|
80
|
+
'imagePlaneModule',
|
|
81
|
+
sourceImageIds[0]
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
if (!imagePlaneModule) {
|
|
85
|
+
console.warn(
|
|
86
|
+
'OverlayGridTool: No imagePlaneModule found for sourceImageIds'
|
|
87
|
+
);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const { frameOfReferenceUID } = imagePlaneModule;
|
|
92
|
+
|
|
93
|
+
const viewportsInfo = getToolGroup(this.toolGroupId).viewportsInfo;
|
|
94
|
+
|
|
95
|
+
if (!viewportsInfo?.length) {
|
|
96
|
+
console.warn('OverlayGridTool: No viewports found');
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const annotations = getAnnotations(this.getToolName(), frameOfReferenceUID);
|
|
101
|
+
|
|
102
|
+
if (!annotations?.length) {
|
|
103
|
+
const pointSets = sourceImageIds.map((id) => {
|
|
104
|
+
// check if pointSets for the imageId was calculated. If not calculate and store
|
|
105
|
+
return this.calculateImageIdPointSets(id);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const newAnnotation: OverlayGridAnnotation = {
|
|
109
|
+
highlighted: true,
|
|
110
|
+
invalidated: true,
|
|
111
|
+
metadata: {
|
|
112
|
+
toolName: this.getToolName(),
|
|
113
|
+
FrameOfReferenceUID: frameOfReferenceUID,
|
|
114
|
+
referencedImageId: null,
|
|
115
|
+
},
|
|
116
|
+
data: {
|
|
117
|
+
viewportData: new Map(),
|
|
118
|
+
pointSets,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
addAnnotation(newAnnotation, frameOfReferenceUID);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
triggerAnnotationRenderForViewportIds(
|
|
126
|
+
getRenderingEngine(viewportsInfo[0].renderingEngineId),
|
|
127
|
+
viewportsInfo.map(({ viewportId }) => viewportId)
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Calculates the point sets based on the image corners relative to an imageId
|
|
133
|
+
* @param imageId - The imageId to calculate the point sets for
|
|
134
|
+
* @returns
|
|
135
|
+
*/
|
|
136
|
+
calculateImageIdPointSets = (imageId: string) => {
|
|
137
|
+
const {
|
|
138
|
+
imagePositionPatient,
|
|
139
|
+
rows,
|
|
140
|
+
columns,
|
|
141
|
+
rowCosines,
|
|
142
|
+
columnCosines,
|
|
143
|
+
rowPixelSpacing,
|
|
144
|
+
columnPixelSpacing,
|
|
145
|
+
} = metaData.get('imagePlaneModule', imageId);
|
|
146
|
+
|
|
147
|
+
// top left world, top right world, bottom right world, bottom left world
|
|
148
|
+
const topLeft = <Types.Point3>[...imagePositionPatient];
|
|
149
|
+
const topRight = <Types.Point3>[...imagePositionPatient];
|
|
150
|
+
const bottomLeft = <Types.Point3>[...imagePositionPatient];
|
|
151
|
+
const bottomRight = <Types.Point3>[...imagePositionPatient];
|
|
152
|
+
|
|
153
|
+
vec3.scaleAndAdd(
|
|
154
|
+
topRight,
|
|
155
|
+
imagePositionPatient,
|
|
156
|
+
columnCosines,
|
|
157
|
+
columns * columnPixelSpacing
|
|
158
|
+
);
|
|
159
|
+
vec3.scaleAndAdd(
|
|
160
|
+
bottomLeft,
|
|
161
|
+
imagePositionPatient,
|
|
162
|
+
rowCosines,
|
|
163
|
+
rows * rowPixelSpacing
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
vec3.scaleAndAdd(
|
|
167
|
+
bottomRight,
|
|
168
|
+
bottomLeft,
|
|
169
|
+
columnCosines,
|
|
170
|
+
columns * columnPixelSpacing
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
// check if the topLeft and bottomLeft line is parallel to the viewUp
|
|
174
|
+
const pointSet1 = [topLeft, bottomLeft, topRight, bottomRight];
|
|
175
|
+
const pointSet2 = [topLeft, topRight, bottomLeft, bottomRight];
|
|
176
|
+
|
|
177
|
+
return { pointSet1, pointSet2 };
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* it is used to draw the length annotation in each
|
|
182
|
+
* request animation frame. It calculates the updated cached statistics if
|
|
183
|
+
* data is invalidated and cache it.
|
|
184
|
+
*
|
|
185
|
+
* @param enabledElement - The Cornerstone's enabledElement.
|
|
186
|
+
* @param svgDrawingHelper - The svgDrawingHelper providing the context for drawing.
|
|
187
|
+
*/
|
|
188
|
+
renderAnnotation = (
|
|
189
|
+
enabledElement: Types.IEnabledElement,
|
|
190
|
+
svgDrawingHelper: SVGDrawingHelper
|
|
191
|
+
): boolean => {
|
|
192
|
+
const sourceImageIds = this.configuration.sourceImageIds;
|
|
193
|
+
|
|
194
|
+
let renderStatus = false;
|
|
195
|
+
if (!sourceImageIds?.length) {
|
|
196
|
+
return renderStatus;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const { viewport: targetViewport, FrameOfReferenceUID } = enabledElement;
|
|
200
|
+
const targetImageIds = targetViewport.getImageIds();
|
|
201
|
+
if (targetImageIds.length < 2) {
|
|
202
|
+
return renderStatus;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const annotations = getAnnotations(this.getToolName(), FrameOfReferenceUID);
|
|
206
|
+
if (!annotations?.length) {
|
|
207
|
+
return renderStatus;
|
|
208
|
+
}
|
|
209
|
+
const annotation = annotations[0];
|
|
210
|
+
const { annotationUID } = annotation;
|
|
211
|
+
|
|
212
|
+
const { focalPoint, viewPlaneNormal } = targetViewport.getCamera();
|
|
213
|
+
|
|
214
|
+
const styleSpecifier: StyleSpecifier = {
|
|
215
|
+
toolGroupId: this.toolGroupId,
|
|
216
|
+
toolName: this.getToolName(),
|
|
217
|
+
viewportId: enabledElement.viewport.id,
|
|
218
|
+
};
|
|
219
|
+
const imageIdNormal = <Types.Point3>(
|
|
220
|
+
this.getImageIdNormal(sourceImageIds[0])
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
if (this.isParallel(viewPlaneNormal, imageIdNormal)) {
|
|
224
|
+
// If the source and target viewports are parallel, we don't need to render
|
|
225
|
+
return renderStatus;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const targetViewportPlane = csUtils.planar.planeEquation(
|
|
229
|
+
viewPlaneNormal,
|
|
230
|
+
focalPoint
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
const pointSets = annotation.data.pointSets;
|
|
234
|
+
const viewportData = annotation.data.viewportData;
|
|
235
|
+
for (let i = 0; i < sourceImageIds.length; i++) {
|
|
236
|
+
// check if pointSets for the imageId was calculated. If not calculate and store
|
|
237
|
+
const { pointSet1, pointSet2 } = pointSets[i];
|
|
238
|
+
|
|
239
|
+
const targetData =
|
|
240
|
+
viewportData.get(targetViewport.id) ||
|
|
241
|
+
this.initializeViewportData(viewportData, targetViewport.id);
|
|
242
|
+
|
|
243
|
+
// check if pointSetToUse was calculated. If not calculate and store
|
|
244
|
+
if (!targetData.pointSetsToUse[i]) {
|
|
245
|
+
let pointSetToUse = pointSet1;
|
|
246
|
+
|
|
247
|
+
let topBottomVec = vec3.subtract(
|
|
248
|
+
vec3.create(),
|
|
249
|
+
pointSet1[0],
|
|
250
|
+
pointSet1[1]
|
|
251
|
+
);
|
|
252
|
+
topBottomVec = vec3.normalize(
|
|
253
|
+
vec3.create(),
|
|
254
|
+
topBottomVec
|
|
255
|
+
) as Types.Point3;
|
|
256
|
+
|
|
257
|
+
// check if it is perpendicular to the viewPlaneNormal which means
|
|
258
|
+
// the line does not intersect the viewPlaneNormal
|
|
259
|
+
if (this.isPerpendicular(topBottomVec, viewPlaneNormal)) {
|
|
260
|
+
// 'use pointSet2';
|
|
261
|
+
pointSetToUse = pointSet2;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
targetData.pointSetsToUse[i] = pointSetToUse;
|
|
265
|
+
|
|
266
|
+
targetData.lineStartsWorld[i] = csUtils.planar.linePlaneIntersection(
|
|
267
|
+
pointSetToUse[0],
|
|
268
|
+
pointSetToUse[1],
|
|
269
|
+
targetViewportPlane
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
targetData.lineEndsWorld[i] = csUtils.planar.linePlaneIntersection(
|
|
273
|
+
pointSetToUse[2],
|
|
274
|
+
pointSetToUse[3],
|
|
275
|
+
targetViewportPlane
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const lineStartWorld = targetData.lineStartsWorld[i];
|
|
280
|
+
const lineEndWorld = targetData.lineEndsWorld[i];
|
|
281
|
+
|
|
282
|
+
styleSpecifier.annotationUID = annotationUID;
|
|
283
|
+
const lineWidth = this.getStyle('lineWidth', styleSpecifier, annotation);
|
|
284
|
+
const lineDash = this.getStyle('lineDash', styleSpecifier, annotation);
|
|
285
|
+
const color = this.getStyle('color', styleSpecifier, annotation);
|
|
286
|
+
const shadow = this.getStyle('shadow', styleSpecifier, annotation);
|
|
287
|
+
|
|
288
|
+
const canvasCoordinates = [lineStartWorld, lineEndWorld].map((world) =>
|
|
289
|
+
targetViewport.worldToCanvas(world)
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
const dataId = `${annotationUID}-line`;
|
|
293
|
+
const lineUID = `${i}`;
|
|
294
|
+
drawLineSvg(
|
|
295
|
+
svgDrawingHelper,
|
|
296
|
+
annotationUID,
|
|
297
|
+
lineUID,
|
|
298
|
+
canvasCoordinates[0],
|
|
299
|
+
canvasCoordinates[1],
|
|
300
|
+
{
|
|
301
|
+
color,
|
|
302
|
+
width: lineWidth,
|
|
303
|
+
lineDash,
|
|
304
|
+
shadow,
|
|
305
|
+
},
|
|
306
|
+
dataId
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
renderStatus = true;
|
|
311
|
+
|
|
312
|
+
return renderStatus;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
private initializeViewportData = (viewportData, id) => {
|
|
316
|
+
viewportData.set(id, {
|
|
317
|
+
pointSetsToUse: [],
|
|
318
|
+
lineStartsWorld: [],
|
|
319
|
+
lineEndsWorld: [],
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
return viewportData.get(id);
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
private isPerpendicular = (
|
|
326
|
+
vec1: Types.Point3,
|
|
327
|
+
vec2: Types.Point3
|
|
328
|
+
): boolean => {
|
|
329
|
+
const dot = vec3.dot(vec1, vec2);
|
|
330
|
+
return Math.abs(dot) < EPSILON;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
private isParallel(vec1: Types.Point3, vec2: Types.Point3): boolean {
|
|
334
|
+
return Math.abs(vec3.dot(vec1, vec2)) > 1 - EPSILON;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
private getImageIdNormal(imageId: string): vec3 {
|
|
338
|
+
const { imageOrientationPatient } = metaData.get(
|
|
339
|
+
'imagePlaneModule',
|
|
340
|
+
imageId
|
|
341
|
+
);
|
|
342
|
+
const rowCosineVec = vec3.fromValues(
|
|
343
|
+
imageOrientationPatient[0],
|
|
344
|
+
imageOrientationPatient[1],
|
|
345
|
+
imageOrientationPatient[2]
|
|
346
|
+
);
|
|
347
|
+
const colCosineVec = vec3.fromValues(
|
|
348
|
+
imageOrientationPatient[3],
|
|
349
|
+
imageOrientationPatient[4],
|
|
350
|
+
imageOrientationPatient[5]
|
|
351
|
+
);
|
|
352
|
+
return vec3.cross(vec3.create(), rowCosineVec, colCosineVec);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
OverlayGridTool.toolName = 'OverlayGrid';
|
|
357
|
+
export default OverlayGridTool;
|
|
@@ -11,7 +11,6 @@ import { addAnnotation } from '../stateManagement/annotation/annotationState';
|
|
|
11
11
|
import { drawLine as drawLineSvg } from '../drawingSvg';
|
|
12
12
|
import { filterViewportsWithToolEnabled } from '../utilities/viewportFilters';
|
|
13
13
|
import triggerAnnotationRenderForViewportIds from '../utilities/triggerAnnotationRenderForViewportIds';
|
|
14
|
-
|
|
15
14
|
import { PublicToolProps, ToolProps, SVGDrawingHelper } from '../types';
|
|
16
15
|
import { ReferenceLineAnnotation } from '../types/ToolSpecificAnnotationTypes';
|
|
17
16
|
import { StyleSpecifier } from '../types/AnnotationStyle';
|
|
@@ -43,6 +42,7 @@ class ReferenceLines extends AnnotationDisplayTool {
|
|
|
43
42
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
44
43
|
configuration: {
|
|
45
44
|
sourceViewportId: '',
|
|
45
|
+
showFullDimension: false,
|
|
46
46
|
},
|
|
47
47
|
}
|
|
48
48
|
) {
|
|
@@ -177,7 +177,7 @@ class ReferenceLines extends AnnotationDisplayTool {
|
|
|
177
177
|
const bottomLeft = annotation.data.handles.points[2];
|
|
178
178
|
const bottomRight = annotation.data.handles.points[3];
|
|
179
179
|
|
|
180
|
-
const { focalPoint, viewPlaneNormal } = targetViewport.getCamera();
|
|
180
|
+
const { focalPoint, viewPlaneNormal, viewUp } = targetViewport.getCamera();
|
|
181
181
|
const { viewPlaneNormal: sourceViewPlaneNormal } =
|
|
182
182
|
sourceViewport.getCamera();
|
|
183
183
|
|
|
@@ -239,10 +239,21 @@ class ReferenceLines extends AnnotationDisplayTool {
|
|
|
239
239
|
const color = this.getStyle('color', styleSpecifier, annotation);
|
|
240
240
|
const shadow = this.getStyle('shadow', styleSpecifier, annotation);
|
|
241
241
|
|
|
242
|
-
|
|
242
|
+
let canvasCoordinates = [lineStartWorld, lineEndWorld].map((world) =>
|
|
243
243
|
targetViewport.worldToCanvas(world)
|
|
244
244
|
);
|
|
245
245
|
|
|
246
|
+
if (this.configuration.showFullDimension) {
|
|
247
|
+
canvasCoordinates = this.handleFullDimension(
|
|
248
|
+
targetViewport,
|
|
249
|
+
lineStartWorld,
|
|
250
|
+
viewPlaneNormal,
|
|
251
|
+
viewUp,
|
|
252
|
+
lineEndWorld,
|
|
253
|
+
canvasCoordinates
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
246
257
|
const dataId = `${annotationUID}-line`;
|
|
247
258
|
const lineUID = '1';
|
|
248
259
|
drawLineSvg(
|
|
@@ -270,9 +281,126 @@ class ReferenceLines extends AnnotationDisplayTool {
|
|
|
270
281
|
return Math.abs(dot) < EPSILON;
|
|
271
282
|
};
|
|
272
283
|
|
|
284
|
+
private handleFullDimension(
|
|
285
|
+
targetViewport: Types.IStackViewport | Types.IVolumeViewport,
|
|
286
|
+
lineStartWorld: Types.Point3,
|
|
287
|
+
viewPlaneNormal: Types.Point3,
|
|
288
|
+
viewUp: Types.Point3,
|
|
289
|
+
lineEndWorld: Types.Point3,
|
|
290
|
+
canvasCoordinates: Types.Point2[]
|
|
291
|
+
) {
|
|
292
|
+
const renderingEngine = targetViewport.getRenderingEngine();
|
|
293
|
+
const targetId = this.getTargetId(targetViewport);
|
|
294
|
+
const targetImage = this.getTargetIdImage(targetId, renderingEngine);
|
|
295
|
+
|
|
296
|
+
const referencedImageId = this.getReferencedImageId(
|
|
297
|
+
targetViewport,
|
|
298
|
+
lineStartWorld,
|
|
299
|
+
viewPlaneNormal,
|
|
300
|
+
viewUp
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
if (referencedImageId && targetImage) {
|
|
304
|
+
try {
|
|
305
|
+
const { imageData, dimensions } = targetImage;
|
|
306
|
+
|
|
307
|
+
// Calculate bound image coordinates
|
|
308
|
+
const [
|
|
309
|
+
topLeftImageCoord,
|
|
310
|
+
topRightImageCoord,
|
|
311
|
+
bottomRightImageCoord,
|
|
312
|
+
bottomLeftImageCoord,
|
|
313
|
+
] = [
|
|
314
|
+
imageData.indexToWorld([0, 0, 0]) as Types.Point3,
|
|
315
|
+
imageData.indexToWorld([dimensions[0] - 1, 0, 0]) as Types.Point3,
|
|
316
|
+
imageData.indexToWorld([
|
|
317
|
+
dimensions[0] - 1,
|
|
318
|
+
dimensions[1] - 1,
|
|
319
|
+
0,
|
|
320
|
+
]) as Types.Point3,
|
|
321
|
+
imageData.indexToWorld([0, dimensions[1] - 1, 0]) as Types.Point3,
|
|
322
|
+
].map((world) => csUtils.worldToImageCoords(referencedImageId, world));
|
|
323
|
+
|
|
324
|
+
// Calculate line start and end image coordinates
|
|
325
|
+
const [lineStartImageCoord, lineEndImageCoord] = [
|
|
326
|
+
lineStartWorld,
|
|
327
|
+
lineEndWorld,
|
|
328
|
+
].map((world) => csUtils.worldToImageCoords(referencedImageId, world));
|
|
329
|
+
|
|
330
|
+
// Calculate intersection points between line and image bounds
|
|
331
|
+
canvasCoordinates = [
|
|
332
|
+
[topLeftImageCoord, topRightImageCoord],
|
|
333
|
+
[topRightImageCoord, bottomRightImageCoord],
|
|
334
|
+
[bottomLeftImageCoord, bottomRightImageCoord],
|
|
335
|
+
[topLeftImageCoord, bottomLeftImageCoord],
|
|
336
|
+
]
|
|
337
|
+
.map(([start, end]) =>
|
|
338
|
+
this.intersectInfiniteLines(
|
|
339
|
+
start,
|
|
340
|
+
end,
|
|
341
|
+
lineStartImageCoord,
|
|
342
|
+
lineEndImageCoord
|
|
343
|
+
)
|
|
344
|
+
)
|
|
345
|
+
.filter((point) => point && this.isInBound(point, dimensions))
|
|
346
|
+
.map((point) => {
|
|
347
|
+
const world = csUtils.imageToWorldCoords(
|
|
348
|
+
referencedImageId,
|
|
349
|
+
point as Types.Point2
|
|
350
|
+
);
|
|
351
|
+
return targetViewport.worldToCanvas(world);
|
|
352
|
+
});
|
|
353
|
+
} catch (err) {
|
|
354
|
+
console.log(err);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return canvasCoordinates;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// get the intersection point between two infinite lines, not line segments
|
|
361
|
+
intersectInfiniteLines(
|
|
362
|
+
line1Start: Types.Point2,
|
|
363
|
+
line1End: Types.Point2,
|
|
364
|
+
line2Start: Types.Point2,
|
|
365
|
+
line2End: Types.Point2
|
|
366
|
+
) {
|
|
367
|
+
const [x1, y1] = line1Start;
|
|
368
|
+
const [x2, y2] = line1End;
|
|
369
|
+
const [x3, y3] = line2Start;
|
|
370
|
+
const [x4, y4] = line2End;
|
|
371
|
+
|
|
372
|
+
// Compute a1, b1, c1, where line joining points 1 and 2 is "a1 x + b1 y + c1 = 0"
|
|
373
|
+
const a1 = y2 - y1;
|
|
374
|
+
const b1 = x1 - x2;
|
|
375
|
+
const c1 = x2 * y1 - x1 * y2;
|
|
376
|
+
|
|
377
|
+
// Compute a2, b2, c2
|
|
378
|
+
const a2 = y4 - y3;
|
|
379
|
+
const b2 = x3 - x4;
|
|
380
|
+
const c2 = x4 * y3 - x3 * y4;
|
|
381
|
+
|
|
382
|
+
if (Math.abs(a1 * b2 - a2 * b1) < EPSILON) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
const x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
|
|
387
|
+
const y = (a2 * c1 - a1 * c2) / (a1 * b2 - a2 * b1);
|
|
388
|
+
|
|
389
|
+
return [x, y];
|
|
390
|
+
}
|
|
391
|
+
|
|
273
392
|
isParallel(vec1: Types.Point3, vec2: Types.Point3): boolean {
|
|
274
393
|
return Math.abs(vec3.dot(vec1, vec2)) > 1 - EPSILON;
|
|
275
394
|
}
|
|
395
|
+
|
|
396
|
+
isInBound(point: number[], dimensions: Types.Point3): boolean {
|
|
397
|
+
return (
|
|
398
|
+
point[0] >= 0 &&
|
|
399
|
+
point[0] <= dimensions[0] &&
|
|
400
|
+
point[1] >= 0 &&
|
|
401
|
+
point[1] <= dimensions[1]
|
|
402
|
+
);
|
|
403
|
+
}
|
|
276
404
|
}
|
|
277
405
|
|
|
278
406
|
ReferenceLines.toolName = 'ReferenceLines';
|
|
@@ -658,7 +658,10 @@ class AngleTool extends AnnotationTool {
|
|
|
658
658
|
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
659
659
|
|
|
660
660
|
// WE HAVE TO CACHE STATS BEFORE FETCHING TEXT
|
|
661
|
-
if (
|
|
661
|
+
if (
|
|
662
|
+
!data.cachedStats[targetId] ||
|
|
663
|
+
data.cachedStats[targetId].angle == null
|
|
664
|
+
) {
|
|
662
665
|
data.cachedStats[targetId] = {
|
|
663
666
|
angle: null,
|
|
664
667
|
};
|
|
@@ -1073,7 +1073,7 @@ class BidirectionalTool extends AnnotationTool {
|
|
|
1073
1073
|
// force to recalculate the stats from the points
|
|
1074
1074
|
if (
|
|
1075
1075
|
!data.cachedStats[targetId] ||
|
|
1076
|
-
data.cachedStats[targetId].unit
|
|
1076
|
+
data.cachedStats[targetId].unit == null
|
|
1077
1077
|
) {
|
|
1078
1078
|
data.cachedStats[targetId] = {
|
|
1079
1079
|
length: null,
|
|
@@ -44,7 +44,6 @@ import {
|
|
|
44
44
|
TextBoxHandle,
|
|
45
45
|
PublicToolProps,
|
|
46
46
|
ToolProps,
|
|
47
|
-
InteractionTypes,
|
|
48
47
|
SVGDrawingHelper,
|
|
49
48
|
} from '../../types';
|
|
50
49
|
import { CircleROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
@@ -52,8 +51,6 @@ import { CircleROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
|
52
51
|
import {
|
|
53
52
|
AnnotationCompletedEventDetail,
|
|
54
53
|
AnnotationModifiedEventDetail,
|
|
55
|
-
MouseDragEventType,
|
|
56
|
-
MouseMoveEventType,
|
|
57
54
|
} from '../../types/EventTypes';
|
|
58
55
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
59
56
|
import { pointInShapeCallback } from '../../utilities';
|
|
@@ -678,21 +675,11 @@ class CircleROITool extends AnnotationTool {
|
|
|
678
675
|
|
|
679
676
|
const { centerPointRadius } = this.configuration;
|
|
680
677
|
|
|
681
|
-
const modalityUnitOptions = {
|
|
682
|
-
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
683
|
-
|
|
684
|
-
isSuvScaled: this.isSuvScaled(
|
|
685
|
-
viewport,
|
|
686
|
-
targetId,
|
|
687
|
-
annotation.metadata.referencedImageId
|
|
688
|
-
),
|
|
689
|
-
};
|
|
690
|
-
|
|
691
678
|
// If cachedStats does not exist, or the unit is missing (as part of import/hydration etc.),
|
|
692
679
|
// force to recalculate the stats from the points
|
|
693
680
|
if (
|
|
694
681
|
!data.cachedStats[targetId] ||
|
|
695
|
-
data.cachedStats[targetId].areaUnit
|
|
682
|
+
data.cachedStats[targetId].areaUnit == null
|
|
696
683
|
) {
|
|
697
684
|
data.cachedStats[targetId] = {
|
|
698
685
|
Modality: null,
|
|
@@ -710,16 +697,14 @@ class CircleROITool extends AnnotationTool {
|
|
|
710
697
|
annotation,
|
|
711
698
|
viewport,
|
|
712
699
|
renderingEngine,
|
|
713
|
-
enabledElement
|
|
714
|
-
modalityUnitOptions
|
|
700
|
+
enabledElement
|
|
715
701
|
);
|
|
716
702
|
} else if (annotation.invalidated) {
|
|
717
703
|
this._throttledCalculateCachedStats(
|
|
718
704
|
annotation,
|
|
719
705
|
viewport,
|
|
720
706
|
renderingEngine,
|
|
721
|
-
enabledElement
|
|
722
|
-
modalityUnitOptions
|
|
707
|
+
enabledElement
|
|
723
708
|
);
|
|
724
709
|
// If the invalidated data is as a result of volumeViewport manipulation
|
|
725
710
|
// of the tools, we need to invalidate the related viewports data, so that
|
|
@@ -889,8 +874,7 @@ class CircleROITool extends AnnotationTool {
|
|
|
889
874
|
annotation,
|
|
890
875
|
viewport,
|
|
891
876
|
renderingEngine,
|
|
892
|
-
enabledElement
|
|
893
|
-
modalityUnitOptions: ModalityUnitOptions
|
|
877
|
+
enabledElement
|
|
894
878
|
) => {
|
|
895
879
|
const data = annotation.data;
|
|
896
880
|
const { viewportId, renderingEngineId } = enabledElement;
|
|
@@ -985,6 +969,15 @@ class CircleROITool extends AnnotationTool {
|
|
|
985
969
|
(worldHeight / aspect / scale / 2)
|
|
986
970
|
);
|
|
987
971
|
|
|
972
|
+
const modalityUnitOptions = {
|
|
973
|
+
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
974
|
+
isSuvScaled: this.isSuvScaled(
|
|
975
|
+
viewport,
|
|
976
|
+
targetId,
|
|
977
|
+
annotation.metadata.referencedImageId
|
|
978
|
+
),
|
|
979
|
+
};
|
|
980
|
+
|
|
988
981
|
const modalityUnit = getModalityUnit(
|
|
989
982
|
metadata.Modality,
|
|
990
983
|
annotation.metadata.referencedImageId,
|