@cornerstonejs/tools 2.0.0-beta.1 → 2.0.0-beta.3
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/drawCircle.js +9 -5
- package/dist/cjs/drawingSvg/drawCircle.js.map +1 -1
- package/dist/cjs/drawingSvg/drawEllipse.js +4 -4
- package/dist/cjs/drawingSvg/drawEllipse.js.map +1 -1
- package/dist/cjs/drawingSvg/drawHandles.js +4 -4
- package/dist/cjs/drawingSvg/drawHandles.js.map +1 -1
- package/dist/cjs/drawingSvg/drawLine.js +4 -4
- package/dist/cjs/drawingSvg/drawLine.js.map +1 -1
- package/dist/cjs/drawingSvg/drawPolyline.js +4 -4
- package/dist/cjs/drawingSvg/drawPolyline.js.map +1 -1
- package/dist/cjs/drawingSvg/drawRect.js +4 -4
- package/dist/cjs/drawingSvg/drawRect.js.map +1 -1
- package/dist/cjs/drawingSvg/drawTextBox.js +4 -4
- package/dist/cjs/drawingSvg/drawTextBox.js.map +1 -1
- package/dist/cjs/drawingSvg/getSvgDrawingHelper.js +1 -1
- package/dist/cjs/drawingSvg/getSvgDrawingHelper.js.map +1 -1
- package/dist/cjs/drawingSvg/index.d.ts +3 -1
- package/dist/cjs/drawingSvg/index.js +5 -1
- package/dist/cjs/drawingSvg/index.js.map +1 -1
- package/dist/cjs/drawingSvg/setAttributesIfNecessary.d.ts +2 -0
- package/dist/cjs/drawingSvg/{_setAttributesIfNecessary.js → setAttributesIfNecessary.js} +5 -5
- package/dist/cjs/drawingSvg/setAttributesIfNecessary.js.map +1 -0
- package/dist/cjs/drawingSvg/setNewAttributesIfValid.d.ts +2 -0
- package/dist/cjs/drawingSvg/{_setNewAttributesIfValid.js → setNewAttributesIfValid.js} +5 -5
- package/dist/cjs/drawingSvg/setNewAttributesIfValid.js.map +1 -0
- package/dist/cjs/enums/Events.d.ts +2 -0
- package/dist/cjs/enums/Events.js +2 -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/getMouseModifier.js +10 -5
- package/dist/cjs/eventDispatchers/shared/getMouseModifier.js.map +1 -1
- 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/eventListeners/keyboard/keyDownListener.js +8 -0
- package/dist/cjs/eventListeners/keyboard/keyDownListener.js.map +1 -1
- package/dist/cjs/eventListeners/mouse/mouseDownListener.js +7 -2
- 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/eventListeners/touch/touchStartListener.js +10 -5
- package/dist/cjs/eventListeners/touch/touchStartListener.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +6 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/stateManagement/annotation/config/ToolStyle.js +1 -0
- package/dist/cjs/stateManagement/annotation/config/ToolStyle.js.map +1 -1
- package/dist/cjs/stateManagement/annotation/config/getState.js +6 -3
- package/dist/cjs/stateManagement/annotation/config/getState.js.map +1 -1
- package/dist/cjs/stateManagement/annotation/config/helpers.js +4 -2
- package/dist/cjs/stateManagement/annotation/config/helpers.js.map +1 -1
- package/dist/cjs/store/SynchronizerManager/Synchronizer.js +10 -2
- package/dist/cjs/store/SynchronizerManager/Synchronizer.js.map +1 -1
- package/dist/cjs/store/ToolGroupManager/ToolGroup.d.ts +5 -3
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js +44 -2
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/cjs/store/ToolGroupManager/getToolGroupsWithToolName.js +2 -1
- package/dist/cjs/store/ToolGroupManager/getToolGroupsWithToolName.js.map +1 -1
- package/dist/cjs/synchronizers/callbacks/stackImageSyncCallback.js +25 -22
- package/dist/cjs/synchronizers/callbacks/stackImageSyncCallback.js.map +1 -1
- package/dist/cjs/synchronizers/callbacks/voiSyncCallback.js +1 -1
- package/dist/cjs/synchronizers/callbacks/voiSyncCallback.js.map +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/MIPJumpToClickTool.js +4 -2
- package/dist/cjs/tools/MIPJumpToClickTool.js.map +1 -1
- 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/PlanarRotateTool.js +2 -1
- package/dist/cjs/tools/PlanarRotateTool.js.map +1 -1
- package/dist/cjs/tools/ReferenceCursors.js +58 -29
- package/dist/cjs/tools/ReferenceCursors.js.map +1 -1
- 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/ScaleOverlayTool.js +2 -1
- package/dist/cjs/tools/ScaleOverlayTool.js.map +1 -1
- package/dist/cjs/tools/annotation/AngleTool.d.ts +0 -1
- package/dist/cjs/tools/annotation/AngleTool.js +33 -15
- package/dist/cjs/tools/annotation/AngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/ArrowAnnotateTool.js +15 -1
- package/dist/cjs/tools/annotation/ArrowAnnotateTool.js.map +1 -1
- package/dist/cjs/tools/annotation/BidirectionalTool.d.ts +0 -1
- package/dist/cjs/tools/annotation/BidirectionalTool.js +30 -15
- package/dist/cjs/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/cjs/tools/annotation/CircleROITool.d.ts +1 -3
- package/dist/cjs/tools/annotation/CircleROITool.js +63 -60
- package/dist/cjs/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/CobbAngleTool.d.ts +31 -6
- package/dist/cjs/tools/annotation/CobbAngleTool.js +294 -82
- package/dist/cjs/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/DragProbeTool.js +17 -4
- package/dist/cjs/tools/annotation/DragProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.d.ts +2 -4
- package/dist/cjs/tools/annotation/EllipticalROITool.js +67 -61
- package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/LengthTool.d.ts +0 -1
- package/dist/cjs/tools/annotation/LengthTool.js +27 -12
- package/dist/cjs/tools/annotation/LengthTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.d.ts +1 -3
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +72 -60
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/ProbeTool.d.ts +1 -3
- package/dist/cjs/tools/annotation/ProbeTool.js +28 -22
- package/dist/cjs/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.d.ts +1 -2
- package/dist/cjs/tools/annotation/RectangleROITool.js +55 -57
- 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 +3 -2
- package/dist/cjs/tools/base/AnnotationTool.js +27 -16
- package/dist/cjs/tools/base/AnnotationTool.js.map +1 -1
- package/dist/cjs/tools/base/index.d.ts +2 -1
- package/dist/cjs/tools/base/index.js +3 -1
- package/dist/cjs/tools/base/index.js.map +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/displayTools/Labelmap/removeLabelmapFromElement.js +3 -0
- package/dist/cjs/tools/displayTools/Labelmap/removeLabelmapFromElement.js.map +1 -1
- package/dist/cjs/tools/displayTools/SegmentationDisplayTool.js +5 -6
- package/dist/cjs/tools/displayTools/SegmentationDisplayTool.js.map +1 -1
- package/dist/cjs/tools/index.d.ts +5 -2
- package/dist/cjs/tools/index.js +8 -1
- package/dist/cjs/tools/index.js.map +1 -1
- package/dist/cjs/tools/segmentation/BrushTool.js +24 -17
- package/dist/cjs/tools/segmentation/BrushTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/PaintFillTool.js +4 -2
- package/dist/cjs/tools/segmentation/PaintFillTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/eraseSphere.d.ts +2 -0
- package/dist/cjs/tools/segmentation/strategies/eraseSphere.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillCircle.js +5 -7
- package/dist/cjs/tools/segmentation/strategies/fillCircle.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillSphere.d.ts +3 -0
- package/dist/cjs/tools/segmentation/strategies/fillSphere.js +38 -10
- package/dist/cjs/tools/segmentation/strategies/fillSphere.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/utils/isWithinThreshold.d.ts +3 -0
- package/dist/cjs/tools/segmentation/strategies/utils/isWithinThreshold.js +10 -0
- package/dist/cjs/tools/segmentation/strategies/utils/isWithinThreshold.js.map +1 -0
- package/dist/cjs/types/CINETypes.d.ts +2 -0
- package/dist/cjs/types/CalculatorTypes.d.ts +6 -0
- package/dist/cjs/types/CalculatorTypes.js +3 -0
- package/dist/cjs/types/CalculatorTypes.js.map +1 -0
- package/dist/cjs/types/EventTypes.d.ts +16 -1
- package/dist/cjs/types/ISetToolModeOptions.d.ts +2 -2
- package/dist/cjs/types/IToolGroup.d.ts +6 -2
- 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/ToolProps.d.ts +5 -1
- package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +55 -0
- package/dist/cjs/types/index.d.ts +4 -2
- package/dist/cjs/utilities/cine/playClip.js +13 -3
- package/dist/cjs/utilities/cine/playClip.js.map +1 -1
- package/dist/cjs/utilities/dynamicVolume/getDataInTime.js +7 -4
- package/dist/cjs/utilities/dynamicVolume/getDataInTime.js.map +1 -1
- package/dist/cjs/utilities/getCalibratedUnits.js +10 -5
- package/dist/cjs/utilities/getCalibratedUnits.js.map +1 -1
- package/dist/cjs/utilities/getModalityUnit.js +5 -2
- package/dist/cjs/utilities/getModalityUnit.js.map +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.d.ts +14 -0
- package/dist/cjs/utilities/math/basic/BasicStatsCalculator.js +44 -0
- package/dist/cjs/utilities/math/basic/BasicStatsCalculator.js.map +1 -0
- package/dist/cjs/utilities/math/basic/Calculator.d.ts +8 -0
- package/dist/cjs/utilities/math/basic/Calculator.js +6 -0
- package/dist/cjs/utilities/math/basic/Calculator.js.map +1 -0
- package/dist/cjs/utilities/math/basic/index.d.ts +3 -0
- package/dist/cjs/utilities/math/basic/index.js +11 -0
- package/dist/cjs/utilities/math/basic/index.js.map +1 -0
- package/dist/cjs/utilities/math/index.d.ts +2 -1
- package/dist/cjs/utilities/math/index.js +3 -1
- package/dist/cjs/utilities/math/index.js.map +1 -1
- package/dist/cjs/utilities/math/midPoint.js +2 -1
- package/dist/cjs/utilities/math/midPoint.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/pointInPolyline.js +2 -1
- package/dist/cjs/utilities/math/polyline/pointInPolyline.js.map +1 -1
- package/dist/cjs/utilities/math/vec2/liangBarksyClip.d.ts +1 -1
- package/dist/cjs/utilities/math/vec2/liangBarksyClip.js +10 -5
- package/dist/cjs/utilities/math/vec2/liangBarksyClip.js.map +1 -1
- package/dist/cjs/utilities/pointInShapeCallback.d.ts +7 -1
- package/dist/cjs/utilities/pointInShapeCallback.js +6 -1
- package/dist/cjs/utilities/pointInShapeCallback.js.map +1 -1
- package/dist/cjs/utilities/roundNumber.js +4 -2
- package/dist/cjs/utilities/roundNumber.js.map +1 -1
- package/dist/cjs/utilities/segmentation/brushSizeForToolGroup.d.ts +2 -2
- package/dist/cjs/utilities/segmentation/brushSizeForToolGroup.js +4 -4
- package/dist/cjs/utilities/segmentation/brushSizeForToolGroup.js.map +1 -1
- package/dist/cjs/utilities/segmentation/thresholdVolumeByRange.js +2 -1
- package/dist/cjs/utilities/segmentation/thresholdVolumeByRange.js.map +1 -1
- package/dist/cjs/utilities/segmentation/utilities.d.ts +1 -2
- package/dist/cjs/utilities/segmentation/utilities.js +4 -1
- package/dist/cjs/utilities/segmentation/utilities.js.map +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 +25 -95
- 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/drawCircle.js +9 -5
- package/dist/esm/drawingSvg/drawCircle.js.map +1 -1
- package/dist/esm/drawingSvg/drawEllipse.js +4 -4
- package/dist/esm/drawingSvg/drawEllipse.js.map +1 -1
- package/dist/esm/drawingSvg/drawHandles.js +4 -4
- package/dist/esm/drawingSvg/drawHandles.js.map +1 -1
- package/dist/esm/drawingSvg/drawLine.js +4 -4
- package/dist/esm/drawingSvg/drawLine.js.map +1 -1
- package/dist/esm/drawingSvg/drawPolyline.js +4 -4
- package/dist/esm/drawingSvg/drawPolyline.js.map +1 -1
- package/dist/esm/drawingSvg/drawRect.js +4 -4
- package/dist/esm/drawingSvg/drawRect.js.map +1 -1
- package/dist/esm/drawingSvg/drawTextBox.js +4 -4
- package/dist/esm/drawingSvg/drawTextBox.js.map +1 -1
- package/dist/esm/drawingSvg/getSvgDrawingHelper.js +1 -1
- package/dist/esm/drawingSvg/getSvgDrawingHelper.js.map +1 -1
- package/dist/esm/drawingSvg/index.d.ts +3 -1
- package/dist/esm/drawingSvg/index.js +3 -1
- package/dist/esm/drawingSvg/index.js.map +1 -1
- package/dist/esm/drawingSvg/setAttributesIfNecessary.d.ts +2 -0
- package/dist/esm/drawingSvg/{_setAttributesIfNecessary.js → setAttributesIfNecessary.js} +3 -3
- package/dist/esm/drawingSvg/setAttributesIfNecessary.js.map +1 -0
- package/dist/esm/drawingSvg/setNewAttributesIfValid.d.ts +2 -0
- package/dist/esm/drawingSvg/{_setNewAttributesIfValid.js → setNewAttributesIfValid.js} +3 -3
- package/dist/esm/drawingSvg/setNewAttributesIfValid.js.map +1 -0
- package/dist/esm/enums/Events.d.ts +2 -0
- package/dist/esm/enums/Events.js +2 -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/getMouseModifier.js +10 -5
- package/dist/esm/eventDispatchers/shared/getMouseModifier.js.map +1 -1
- 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/eventListeners/keyboard/keyDownListener.js +8 -0
- package/dist/esm/eventListeners/keyboard/keyDownListener.js.map +1 -1
- package/dist/esm/eventListeners/mouse/mouseDownListener.js +7 -2
- 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/eventListeners/touch/touchStartListener.js +10 -5
- package/dist/esm/eventListeners/touch/touchStartListener.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/config/ToolStyle.js +1 -0
- package/dist/esm/stateManagement/annotation/config/ToolStyle.js.map +1 -1
- package/dist/esm/stateManagement/annotation/config/getState.js +6 -3
- package/dist/esm/stateManagement/annotation/config/getState.js.map +1 -1
- package/dist/esm/stateManagement/annotation/config/helpers.js +4 -2
- package/dist/esm/stateManagement/annotation/config/helpers.js.map +1 -1
- package/dist/esm/store/SynchronizerManager/Synchronizer.js +10 -2
- package/dist/esm/store/SynchronizerManager/Synchronizer.js.map +1 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.d.ts +5 -3
- package/dist/esm/store/ToolGroupManager/ToolGroup.js +45 -4
- package/dist/esm/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/esm/store/ToolGroupManager/getToolGroupsWithToolName.js +2 -1
- package/dist/esm/store/ToolGroupManager/getToolGroupsWithToolName.js.map +1 -1
- package/dist/esm/synchronizers/callbacks/stackImageSyncCallback.js +26 -23
- package/dist/esm/synchronizers/callbacks/stackImageSyncCallback.js.map +1 -1
- package/dist/esm/synchronizers/callbacks/voiSyncCallback.js +1 -1
- package/dist/esm/synchronizers/callbacks/voiSyncCallback.js.map +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/MIPJumpToClickTool.js +4 -2
- package/dist/esm/tools/MIPJumpToClickTool.js.map +1 -1
- 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/PlanarRotateTool.js +2 -1
- package/dist/esm/tools/PlanarRotateTool.js.map +1 -1
- package/dist/esm/tools/ReferenceCursors.js +58 -29
- package/dist/esm/tools/ReferenceCursors.js.map +1 -1
- 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/ScaleOverlayTool.js +2 -1
- package/dist/esm/tools/ScaleOverlayTool.js.map +1 -1
- package/dist/esm/tools/annotation/AngleTool.d.ts +0 -1
- package/dist/esm/tools/annotation/AngleTool.js +33 -15
- package/dist/esm/tools/annotation/AngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js +15 -1
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js.map +1 -1
- package/dist/esm/tools/annotation/BidirectionalTool.d.ts +0 -1
- package/dist/esm/tools/annotation/BidirectionalTool.js +30 -15
- package/dist/esm/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/esm/tools/annotation/CircleROITool.d.ts +1 -3
- package/dist/esm/tools/annotation/CircleROITool.js +62 -60
- package/dist/esm/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/CobbAngleTool.d.ts +31 -6
- package/dist/esm/tools/annotation/CobbAngleTool.js +301 -83
- package/dist/esm/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/DragProbeTool.js +17 -4
- package/dist/esm/tools/annotation/DragProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.d.ts +2 -4
- package/dist/esm/tools/annotation/EllipticalROITool.js +66 -61
- package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/esm/tools/annotation/LengthTool.d.ts +0 -1
- package/dist/esm/tools/annotation/LengthTool.js +27 -12
- package/dist/esm/tools/annotation/LengthTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.d.ts +1 -3
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +71 -60
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/esm/tools/annotation/ProbeTool.d.ts +1 -3
- package/dist/esm/tools/annotation/ProbeTool.js +28 -22
- package/dist/esm/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.d.ts +1 -2
- package/dist/esm/tools/annotation/RectangleROITool.js +54 -57
- 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 +3 -2
- package/dist/esm/tools/base/AnnotationTool.js +26 -16
- package/dist/esm/tools/base/AnnotationTool.js.map +1 -1
- package/dist/esm/tools/base/index.d.ts +2 -1
- package/dist/esm/tools/base/index.js +2 -1
- package/dist/esm/tools/base/index.js.map +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/displayTools/Labelmap/removeLabelmapFromElement.js +4 -1
- package/dist/esm/tools/displayTools/Labelmap/removeLabelmapFromElement.js.map +1 -1
- package/dist/esm/tools/displayTools/SegmentationDisplayTool.js +5 -6
- package/dist/esm/tools/displayTools/SegmentationDisplayTool.js.map +1 -1
- package/dist/esm/tools/index.d.ts +5 -2
- package/dist/esm/tools/index.js +5 -2
- package/dist/esm/tools/index.js.map +1 -1
- package/dist/esm/tools/segmentation/BrushTool.js +25 -18
- package/dist/esm/tools/segmentation/BrushTool.js.map +1 -1
- package/dist/esm/tools/segmentation/PaintFillTool.js +4 -2
- package/dist/esm/tools/segmentation/PaintFillTool.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/eraseSphere.d.ts +2 -0
- package/dist/esm/tools/segmentation/strategies/eraseSphere.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/fillCircle.js +1 -6
- package/dist/esm/tools/segmentation/strategies/fillCircle.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/fillSphere.d.ts +3 -0
- package/dist/esm/tools/segmentation/strategies/fillSphere.js +33 -9
- package/dist/esm/tools/segmentation/strategies/fillSphere.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/isWithinThreshold.d.ts +3 -0
- package/dist/esm/tools/segmentation/strategies/utils/isWithinThreshold.js +8 -0
- package/dist/esm/tools/segmentation/strategies/utils/isWithinThreshold.js.map +1 -0
- package/dist/esm/types/CINETypes.d.ts +2 -0
- package/dist/esm/types/CalculatorTypes.d.ts +6 -0
- package/dist/esm/types/CalculatorTypes.js +2 -0
- package/dist/esm/types/CalculatorTypes.js.map +1 -0
- package/dist/esm/types/EventTypes.d.ts +16 -1
- package/dist/esm/types/ISetToolModeOptions.d.ts +2 -2
- package/dist/esm/types/IToolGroup.d.ts +6 -2
- 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/ToolProps.d.ts +5 -1
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +55 -0
- package/dist/esm/types/index.d.ts +4 -2
- package/dist/esm/utilities/cine/playClip.js +13 -4
- package/dist/esm/utilities/cine/playClip.js.map +1 -1
- package/dist/esm/utilities/dynamicVolume/getDataInTime.js +7 -4
- package/dist/esm/utilities/dynamicVolume/getDataInTime.js.map +1 -1
- package/dist/esm/utilities/getCalibratedUnits.js +10 -5
- package/dist/esm/utilities/getCalibratedUnits.js.map +1 -1
- package/dist/esm/utilities/getModalityUnit.js +5 -2
- package/dist/esm/utilities/getModalityUnit.js.map +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.d.ts +14 -0
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.js +36 -0
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.js.map +1 -0
- package/dist/esm/utilities/math/basic/Calculator.d.ts +8 -0
- package/dist/esm/utilities/math/basic/Calculator.js +4 -0
- package/dist/esm/utilities/math/basic/Calculator.js.map +1 -0
- package/dist/esm/utilities/math/basic/index.d.ts +3 -0
- package/dist/esm/utilities/math/basic/index.js +4 -0
- package/dist/esm/utilities/math/basic/index.js.map +1 -0
- package/dist/esm/utilities/math/index.d.ts +2 -1
- package/dist/esm/utilities/math/index.js +2 -1
- package/dist/esm/utilities/math/index.js.map +1 -1
- package/dist/esm/utilities/math/midPoint.js +2 -1
- package/dist/esm/utilities/math/midPoint.js.map +1 -1
- package/dist/esm/utilities/math/polyline/pointInPolyline.js +2 -1
- package/dist/esm/utilities/math/polyline/pointInPolyline.js.map +1 -1
- package/dist/esm/utilities/math/vec2/liangBarksyClip.d.ts +1 -1
- package/dist/esm/utilities/math/vec2/liangBarksyClip.js +10 -5
- package/dist/esm/utilities/math/vec2/liangBarksyClip.js.map +1 -1
- package/dist/esm/utilities/pointInShapeCallback.d.ts +7 -1
- package/dist/esm/utilities/pointInShapeCallback.js +6 -1
- package/dist/esm/utilities/pointInShapeCallback.js.map +1 -1
- package/dist/esm/utilities/roundNumber.js +4 -2
- package/dist/esm/utilities/roundNumber.js.map +1 -1
- package/dist/esm/utilities/segmentation/brushSizeForToolGroup.d.ts +2 -2
- package/dist/esm/utilities/segmentation/brushSizeForToolGroup.js +4 -4
- package/dist/esm/utilities/segmentation/brushSizeForToolGroup.js.map +1 -1
- package/dist/esm/utilities/segmentation/thresholdVolumeByRange.js +2 -1
- package/dist/esm/utilities/segmentation/thresholdVolumeByRange.js.map +1 -1
- package/dist/esm/utilities/segmentation/utilities.d.ts +1 -2
- package/dist/esm/utilities/segmentation/utilities.js +4 -1
- package/dist/esm/utilities/segmentation/utilities.js.map +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 +14 -81
- 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/drawCircle.ts +17 -5
- package/src/drawingSvg/drawEllipse.ts +4 -4
- package/src/drawingSvg/drawHandles.ts +4 -4
- package/src/drawingSvg/drawLine.ts +4 -4
- package/src/drawingSvg/drawPolyline.ts +4 -4
- package/src/drawingSvg/drawRect.ts +4 -4
- package/src/drawingSvg/drawTextBox.ts +4 -4
- package/src/drawingSvg/getSvgDrawingHelper.ts +4 -1
- package/src/drawingSvg/index.ts +4 -0
- package/src/drawingSvg/{_setAttributesIfNecessary.ts → setAttributesIfNecessary.ts} +2 -2
- package/src/drawingSvg/{_setNewAttributesIfValid.ts → setNewAttributesIfValid.ts} +2 -2
- package/src/enums/Events.ts +22 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDown.ts +11 -2
- package/src/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.ts +72 -0
- package/src/eventDispatchers/shared/getMouseModifier.ts +15 -5
- package/src/eventDispatchers/shared/getToolsWithActionsForMouseEvent.ts +66 -0
- package/src/eventListeners/keyboard/keyDownListener.ts +13 -0
- package/src/eventListeners/mouse/mouseDownListener.ts +10 -2
- package/src/eventListeners/mouse/mouseMoveListener.ts +7 -1
- package/src/eventListeners/touch/touchStartListener.ts +15 -5
- package/src/index.ts +8 -0
- package/src/stateManagement/annotation/config/ToolStyle.ts +1 -0
- package/src/stateManagement/annotation/config/getState.ts +7 -3
- package/src/stateManagement/annotation/config/helpers.ts +6 -2
- package/src/store/SynchronizerManager/Synchronizer.ts +16 -8
- package/src/store/ToolGroupManager/ToolGroup.ts +99 -6
- package/src/store/ToolGroupManager/getToolGroupsWithToolName.ts +3 -1
- package/src/synchronizers/callbacks/stackImageSyncCallback.ts +63 -68
- package/src/synchronizers/callbacks/voiSyncCallback.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/MIPJumpToClickTool.ts +6 -2
- package/src/tools/MagnifyTool.ts +2 -2
- package/src/tools/OrientationMarkerTool.ts +235 -0
- package/src/tools/OverlayGridTool.ts +357 -0
- package/src/tools/PlanarRotateTool.ts +3 -1
- package/src/tools/ReferenceCursors.ts +85 -29
- package/src/tools/ReferenceLinesTool.ts +131 -3
- package/src/tools/ScaleOverlayTool.ts +3 -1
- package/src/tools/annotation/AngleTool.ts +42 -20
- package/src/tools/annotation/ArrowAnnotateTool.ts +16 -1
- package/src/tools/annotation/BidirectionalTool.ts +38 -24
- package/src/tools/annotation/CircleROITool.ts +94 -107
- package/src/tools/annotation/CobbAngleTool.ts +452 -114
- package/src/tools/annotation/DragProbeTool.ts +25 -14
- package/src/tools/annotation/EllipticalROITool.ts +88 -97
- package/src/tools/annotation/LengthTool.ts +33 -18
- package/src/tools/annotation/PlanarFreehandROITool.ts +90 -78
- package/src/tools/annotation/ProbeTool.ts +43 -49
- package/src/tools/annotation/RectangleROITool.ts +80 -92
- package/src/tools/base/AnnotationDisplayTool.ts +4 -0
- package/src/tools/base/AnnotationTool.ts +41 -18
- package/src/tools/base/index.ts +2 -1
- package/src/tools/displayTools/Contour/contourDisplay.ts +8 -0
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +4 -1
- package/src/tools/displayTools/Labelmap/removeLabelmapFromElement.ts +6 -1
- package/src/tools/displayTools/SegmentationDisplayTool.ts +12 -18
- package/src/tools/index.ts +8 -1
- package/src/tools/segmentation/BrushTool.ts +42 -19
- package/src/tools/segmentation/PaintFillTool.ts +10 -3
- package/src/tools/segmentation/strategies/eraseSphere.ts +2 -0
- package/src/tools/segmentation/strategies/fillCircle.ts +1 -13
- package/src/tools/segmentation/strategies/fillSphere.ts +56 -8
- package/src/tools/segmentation/strategies/utils/isWithinThreshold.ts +16 -0
- package/src/types/CINETypes.ts +8 -2
- package/src/types/CalculatorTypes.ts +7 -0
- package/src/types/EventTypes.ts +43 -0
- package/src/types/ISetToolModeOptions.ts +2 -2
- package/src/types/IToolGroup.ts +13 -3
- package/src/types/ToolAction.ts +54 -0
- package/src/types/ToolProps.ts +7 -1
- package/src/types/ToolSpecificAnnotationTypes.ts +58 -0
- package/src/types/index.ts +11 -1
- package/src/utilities/cine/playClip.ts +20 -3
- package/src/utilities/dynamicVolume/getDataInTime.ts +9 -6
- package/src/utilities/getCalibratedUnits.ts +15 -5
- 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/math/basic/BasicStatsCalculator.ts +60 -0
- package/src/utilities/math/basic/Calculator.ts +8 -0
- package/src/utilities/math/basic/index.ts +4 -0
- package/src/utilities/math/index.ts +10 -1
- package/src/utilities/math/midPoint.ts +3 -1
- package/src/utilities/math/polyline/pointInPolyline.ts +3 -1
- package/src/utilities/math/vec2/liangBarksyClip.ts +15 -5
- package/src/utilities/pointInShapeCallback.ts +15 -3
- package/src/utilities/roundNumber.ts +6 -2
- package/src/utilities/segmentation/brushSizeForToolGroup.ts +22 -4
- package/src/utilities/segmentation/thresholdVolumeByRange.ts +3 -1
- package/src/utilities/segmentation/utilities.ts +8 -1
- package/src/utilities/stackPrefetch/index.ts +3 -7
- package/src/utilities/stackPrefetch/stackContextPrefetch.ts +380 -0
- package/src/utilities/stackPrefetch/stackPrefetch.ts +37 -153
- package/src/utilities/stackPrefetch/stackPrefetchUtils.ts +114 -0
- package/dist/cjs/drawingSvg/_setAttributesIfNecessary.d.ts +0 -2
- package/dist/cjs/drawingSvg/_setAttributesIfNecessary.js.map +0 -1
- package/dist/cjs/drawingSvg/_setNewAttributesIfValid.d.ts +0 -2
- package/dist/cjs/drawingSvg/_setNewAttributesIfValid.js.map +0 -1
- package/dist/esm/drawingSvg/_setAttributesIfNecessary.d.ts +0 -2
- package/dist/esm/drawingSvg/_setAttributesIfNecessary.js.map +0 -1
- package/dist/esm/drawingSvg/_setNewAttributesIfValid.d.ts +0 -2
- package/dist/esm/drawingSvg/_setNewAttributesIfValid.js.map +0 -1
|
@@ -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;
|
|
@@ -104,26 +104,38 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
104
104
|
|
|
105
105
|
onSetToolActive(): void {
|
|
106
106
|
this._disableCursorEnabled = this.configuration.disableCursor;
|
|
107
|
-
if (!this._disableCursorEnabled)
|
|
107
|
+
if (!this._disableCursorEnabled) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
108
110
|
const viewportIds = getToolGroup(this.toolGroupId).viewportsInfo;
|
|
109
|
-
if (!viewportIds)
|
|
111
|
+
if (!viewportIds) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
110
114
|
const enabledElements = viewportIds.map((e) =>
|
|
111
115
|
getEnabledElementByIds(e.viewportId, e.renderingEngineId)
|
|
112
116
|
);
|
|
113
117
|
|
|
114
118
|
enabledElements.forEach((element) => {
|
|
115
|
-
if (element)
|
|
119
|
+
if (element) {
|
|
120
|
+
hideElementCursor(element.viewport.element);
|
|
121
|
+
}
|
|
116
122
|
});
|
|
117
123
|
}
|
|
118
124
|
onSetToolDisabled(): void {
|
|
119
|
-
if (!this._disableCursorEnabled)
|
|
125
|
+
if (!this._disableCursorEnabled) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
120
128
|
const viewportIds = getToolGroup(this.toolGroupId).viewportsInfo;
|
|
121
|
-
if (!viewportIds)
|
|
129
|
+
if (!viewportIds) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
122
132
|
const enabledElements = viewportIds.map((e) =>
|
|
123
133
|
getEnabledElementByIds(e.viewportId, e.renderingEngineId)
|
|
124
134
|
);
|
|
125
135
|
enabledElements.forEach((element) => {
|
|
126
|
-
if (element)
|
|
136
|
+
if (element) {
|
|
137
|
+
resetElementCursor(element.viewport.element);
|
|
138
|
+
}
|
|
127
139
|
});
|
|
128
140
|
}
|
|
129
141
|
|
|
@@ -132,14 +144,18 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
132
144
|
element: HTMLDivElement
|
|
133
145
|
): void => {
|
|
134
146
|
const enabledElement = getEnabledElement(element);
|
|
135
|
-
if (!enabledElement)
|
|
147
|
+
if (!enabledElement) {
|
|
148
|
+
throw new Error('No enabled element found');
|
|
149
|
+
}
|
|
136
150
|
const { viewport, renderingEngine } = enabledElement;
|
|
137
151
|
|
|
138
152
|
this.isDrawing = true;
|
|
139
153
|
|
|
140
154
|
const camera = viewport.getCamera();
|
|
141
155
|
const { viewPlaneNormal, viewUp } = camera;
|
|
142
|
-
if (!viewPlaneNormal || !viewUp)
|
|
156
|
+
if (!viewPlaneNormal || !viewUp) {
|
|
157
|
+
throw new Error('Camera not found');
|
|
158
|
+
}
|
|
143
159
|
|
|
144
160
|
const referencedImageId = this.getReferencedImageId(
|
|
145
161
|
viewport,
|
|
@@ -181,10 +197,14 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
181
197
|
|
|
182
198
|
const annotations = getAnnotations(this.getToolName(), element);
|
|
183
199
|
|
|
184
|
-
if (annotations.length > 0)
|
|
200
|
+
if (annotations.length > 0) {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
185
203
|
const annotationId = addAnnotation(annotation, element);
|
|
186
204
|
|
|
187
|
-
if (annotationId === null)
|
|
205
|
+
if (annotationId === null) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
188
208
|
|
|
189
209
|
const viewportIdsToRender = getViewportIdsWithToolToRender(
|
|
190
210
|
element,
|
|
@@ -212,8 +232,12 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
212
232
|
annotation: Annotation
|
|
213
233
|
): void {
|
|
214
234
|
const worldPos = this._currentCursorWorldPosition;
|
|
215
|
-
if (!worldPos)
|
|
216
|
-
|
|
235
|
+
if (!worldPos) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (!annotation.data?.handles?.points) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
217
241
|
annotation.data.handles.points = [[...worldPos]];
|
|
218
242
|
annotation.invalidated = true;
|
|
219
243
|
|
|
@@ -223,7 +247,9 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
223
247
|
false
|
|
224
248
|
);
|
|
225
249
|
const enabledElement = getEnabledElement(element);
|
|
226
|
-
if (!enabledElement)
|
|
250
|
+
if (!enabledElement) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
227
253
|
const { renderingEngine } = enabledElement;
|
|
228
254
|
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
|
|
229
255
|
}
|
|
@@ -238,7 +264,9 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
238
264
|
| Types.IStackViewport;
|
|
239
265
|
|
|
240
266
|
//only react to changes for element with cursor, otherwise would cause infinite loop
|
|
241
|
-
if (element !== this._elementWithCursor)
|
|
267
|
+
if (element !== this._elementWithCursor) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
242
270
|
//check if camera moved along its normal
|
|
243
271
|
const oldFocalPoint = previousCamera.focalPoint;
|
|
244
272
|
const cameraNormal = camera.viewPlaneNormal;
|
|
@@ -247,14 +275,20 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
247
275
|
const deltaCameraFocalPoint: Types.Point3 = [0, 0, 0];
|
|
248
276
|
vtkMath.subtract(newFocalPoint, oldFocalPoint, deltaCameraFocalPoint);
|
|
249
277
|
//check if focal point changed
|
|
250
|
-
if (deltaCameraFocalPoint.reduce((a, b) => a + b, 0) === 0)
|
|
278
|
+
if (deltaCameraFocalPoint.reduce((a, b) => a + b, 0) === 0) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
251
281
|
//if nomrmal is perpendicular to focal point change, then we are not moving along the normal
|
|
252
282
|
const dotProduct = vtkMath.dot(deltaCameraFocalPoint, cameraNormal);
|
|
253
283
|
//dot product is 0 -> perpendicular
|
|
254
|
-
if (Math.abs(dotProduct) < 1e-2)
|
|
284
|
+
if (Math.abs(dotProduct) < 1e-2) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
255
287
|
|
|
256
288
|
//need to update the position of the annotation since camera changed
|
|
257
|
-
if (!this._currentCanvasPosition)
|
|
289
|
+
if (!this._currentCanvasPosition) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
258
292
|
|
|
259
293
|
const newWorldPos = viewport.canvasToWorld(this._currentCanvasPosition);
|
|
260
294
|
this._currentCursorWorldPosition = newWorldPos;
|
|
@@ -267,15 +301,23 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
267
301
|
annotations: Annotations
|
|
268
302
|
): Annotations {
|
|
269
303
|
//calculate distance of current viewport to annotation
|
|
270
|
-
if (!(annotations instanceof Array) || annotations.length === 0)
|
|
304
|
+
if (!(annotations instanceof Array) || annotations.length === 0) {
|
|
305
|
+
return [];
|
|
306
|
+
}
|
|
271
307
|
const annotation = annotations[0];
|
|
272
308
|
const viewport = getEnabledElement(element)?.viewport;
|
|
273
|
-
if (!viewport)
|
|
309
|
+
if (!viewport) {
|
|
310
|
+
return [];
|
|
311
|
+
}
|
|
274
312
|
const camera = viewport.getCamera();
|
|
275
313
|
const { viewPlaneNormal, focalPoint } = camera;
|
|
276
|
-
if (!viewPlaneNormal || !focalPoint)
|
|
314
|
+
if (!viewPlaneNormal || !focalPoint) {
|
|
315
|
+
return [];
|
|
316
|
+
}
|
|
277
317
|
const points = annotation.data?.handles?.points;
|
|
278
|
-
if (!(points instanceof Array) || points.length !== 1)
|
|
318
|
+
if (!(points instanceof Array) || points.length !== 1) {
|
|
319
|
+
return [];
|
|
320
|
+
}
|
|
279
321
|
const worldPos = points[0];
|
|
280
322
|
const plane = utilities.planar.planeEquation(viewPlaneNormal, focalPoint);
|
|
281
323
|
const distance = utilities.planar.planeDistanceToPoint(plane, worldPos);
|
|
@@ -333,7 +375,9 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
333
375
|
const { handles } = data;
|
|
334
376
|
const { points } = handles;
|
|
335
377
|
|
|
336
|
-
if (!annotationUID)
|
|
378
|
+
if (!annotationUID) {
|
|
379
|
+
return renderStatus;
|
|
380
|
+
}
|
|
337
381
|
styleSpecifier.annotationUID = annotationUID;
|
|
338
382
|
|
|
339
383
|
const lineWidthBase = parseFloat(
|
|
@@ -347,7 +391,9 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
347
391
|
const lineDash = this.getStyle('lineDash', styleSpecifier, annotation);
|
|
348
392
|
const color = this.getStyle('color', styleSpecifier, annotation);
|
|
349
393
|
|
|
350
|
-
if (points[0].some((e) => isNaN(e)))
|
|
394
|
+
if (points[0].some((e) => isNaN(e))) {
|
|
395
|
+
return renderStatus;
|
|
396
|
+
}
|
|
351
397
|
const canvasCoordinates = points.map((p) =>
|
|
352
398
|
viewport.worldToCanvas(p)
|
|
353
399
|
) as [Types.Point2];
|
|
@@ -414,8 +460,9 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
414
460
|
): void {
|
|
415
461
|
const currentMousePosition = this._currentCursorWorldPosition;
|
|
416
462
|
|
|
417
|
-
if (!currentMousePosition || currentMousePosition.some((e) => isNaN(e)))
|
|
463
|
+
if (!currentMousePosition || currentMousePosition.some((e) => isNaN(e))) {
|
|
418
464
|
return;
|
|
465
|
+
}
|
|
419
466
|
|
|
420
467
|
if (viewport instanceof StackViewport) {
|
|
421
468
|
const closestIndex = utilities.getClosestStackImageIndexForPoint(
|
|
@@ -423,12 +470,17 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
423
470
|
viewport
|
|
424
471
|
);
|
|
425
472
|
|
|
426
|
-
if (closestIndex === null)
|
|
427
|
-
|
|
473
|
+
if (closestIndex === null) {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
if (closestIndex !== viewport.getCurrentImageIdIndex()) {
|
|
428
477
|
viewport.setImageIdIndex(closestIndex);
|
|
478
|
+
}
|
|
429
479
|
} else if (viewport instanceof VolumeViewport) {
|
|
430
480
|
const { focalPoint, viewPlaneNormal } = viewport.getCamera();
|
|
431
|
-
if (!focalPoint || !viewPlaneNormal)
|
|
481
|
+
if (!focalPoint || !viewPlaneNormal) {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
432
484
|
const plane = utilities.planar.planeEquation(viewPlaneNormal, focalPoint);
|
|
433
485
|
const currentDistance = utilities.planar.planeDistanceToPoint(
|
|
434
486
|
plane,
|
|
@@ -436,7 +488,9 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
436
488
|
true
|
|
437
489
|
);
|
|
438
490
|
|
|
439
|
-
if (Math.abs(currentDistance) < 0.5)
|
|
491
|
+
if (Math.abs(currentDistance) < 0.5) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
440
494
|
const normalizedViewPlane = vec3.normalize(
|
|
441
495
|
vec3.create(),
|
|
442
496
|
vec3.fromValues(...viewPlaneNormal)
|
|
@@ -456,7 +510,9 @@ class ReferenceCursors extends AnnotationDisplayTool {
|
|
|
456
510
|
if (isInBounds) {
|
|
457
511
|
viewport.setCamera({ focalPoint: newFocalPoint });
|
|
458
512
|
const renderingEngine = viewport.getRenderingEngine();
|
|
459
|
-
if (renderingEngine)
|
|
513
|
+
if (renderingEngine) {
|
|
514
|
+
renderingEngine.renderViewport(viewport.id);
|
|
515
|
+
}
|
|
460
516
|
}
|
|
461
517
|
}
|
|
462
518
|
}
|