@cornerstonejs/tools 2.0.0-beta.1 → 2.0.0-beta.2
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/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 +1 -0
- package/dist/cjs/enums/Events.js +1 -0
- package/dist/cjs/enums/Events.js.map +1 -1
- package/dist/cjs/eventDispatchers/shared/getMouseModifier.js +10 -5
- package/dist/cjs/eventDispatchers/shared/getMouseModifier.js.map +1 -1
- 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 +2 -1
- package/dist/cjs/eventListeners/mouse/mouseDownListener.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 +3 -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 +3 -3
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js +9 -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/MIPJumpToClickTool.js +4 -2
- package/dist/cjs/tools/MIPJumpToClickTool.js.map +1 -1
- 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/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 +31 -14
- 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 +29 -14
- package/dist/cjs/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/cjs/tools/annotation/CircleROITool.d.ts +0 -1
- package/dist/cjs/tools/annotation/CircleROITool.js +56 -53
- package/dist/cjs/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/CobbAngleTool.d.ts +0 -1
- package/dist/cjs/tools/annotation/CobbAngleTool.js +26 -11
- package/dist/cjs/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/DragProbeTool.js +13 -1
- package/dist/cjs/tools/annotation/DragProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.d.ts +0 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.js +48 -46
- 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 +26 -11
- package/dist/cjs/tools/annotation/LengthTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.d.ts +0 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +50 -51
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/ProbeTool.d.ts +0 -1
- package/dist/cjs/tools/annotation/ProbeTool.js +18 -13
- package/dist/cjs/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.d.ts +0 -1
- package/dist/cjs/tools/annotation/RectangleROITool.js +46 -48
- package/dist/cjs/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/cjs/tools/base/AnnotationTool.d.ts +2 -1
- 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/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 +2 -2
- package/dist/cjs/tools/index.js +2 -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 +8 -1
- package/dist/cjs/types/ISetToolModeOptions.d.ts +2 -2
- package/dist/cjs/types/IToolGroup.d.ts +3 -2
- package/dist/cjs/types/ToolProps.d.ts +5 -1
- package/dist/cjs/types/index.d.ts +3 -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/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/stackPrefetch.js +4 -4
- package/dist/cjs/utilities/stackPrefetch/stackPrefetch.js.map +1 -1
- 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/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 +1 -0
- package/dist/esm/enums/Events.js +1 -0
- package/dist/esm/enums/Events.js.map +1 -1
- package/dist/esm/eventDispatchers/shared/getMouseModifier.js +10 -5
- package/dist/esm/eventDispatchers/shared/getMouseModifier.js.map +1 -1
- 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 +2 -1
- package/dist/esm/eventListeners/mouse/mouseDownListener.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 +3 -3
- package/dist/esm/store/ToolGroupManager/ToolGroup.js +10 -3
- 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/MIPJumpToClickTool.js +4 -2
- package/dist/esm/tools/MIPJumpToClickTool.js.map +1 -1
- 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/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 +31 -14
- 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 +29 -14
- package/dist/esm/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/esm/tools/annotation/CircleROITool.d.ts +0 -1
- package/dist/esm/tools/annotation/CircleROITool.js +55 -53
- package/dist/esm/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/CobbAngleTool.d.ts +0 -1
- package/dist/esm/tools/annotation/CobbAngleTool.js +26 -11
- package/dist/esm/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/DragProbeTool.js +13 -1
- package/dist/esm/tools/annotation/DragProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.d.ts +0 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +47 -46
- 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 +26 -11
- package/dist/esm/tools/annotation/LengthTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.d.ts +0 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +49 -51
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/esm/tools/annotation/ProbeTool.d.ts +0 -1
- package/dist/esm/tools/annotation/ProbeTool.js +18 -13
- package/dist/esm/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.d.ts +0 -1
- package/dist/esm/tools/annotation/RectangleROITool.js +45 -48
- package/dist/esm/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/esm/tools/base/AnnotationTool.d.ts +2 -1
- 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/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 +2 -2
- package/dist/esm/tools/index.js +2 -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 +8 -1
- package/dist/esm/types/ISetToolModeOptions.d.ts +2 -2
- package/dist/esm/types/IToolGroup.d.ts +3 -2
- package/dist/esm/types/ToolProps.d.ts +5 -1
- package/dist/esm/types/index.d.ts +3 -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/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/stackPrefetch.js +4 -4
- package/dist/esm/utilities/stackPrefetch/stackPrefetch.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/drawingSvg/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/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 +13 -0
- package/src/eventDispatchers/shared/getMouseModifier.ts +15 -5
- package/src/eventListeners/keyboard/keyDownListener.ts +13 -0
- package/src/eventListeners/mouse/mouseDownListener.ts +3 -1
- package/src/eventListeners/touch/touchStartListener.ts +15 -5
- package/src/index.ts +2 -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 +21 -5
- 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/MIPJumpToClickTool.ts +6 -2
- package/src/tools/PlanarRotateTool.ts +3 -1
- package/src/tools/ReferenceCursors.ts +85 -29
- package/src/tools/ScaleOverlayTool.ts +3 -1
- package/src/tools/annotation/AngleTool.ts +38 -19
- package/src/tools/annotation/ArrowAnnotateTool.ts +16 -1
- package/src/tools/annotation/BidirectionalTool.ts +37 -23
- package/src/tools/annotation/CircleROITool.ts +83 -89
- package/src/tools/annotation/CobbAngleTool.ts +31 -16
- package/src/tools/annotation/DragProbeTool.ts +19 -1
- package/src/tools/annotation/EllipticalROITool.ts +63 -71
- package/src/tools/annotation/LengthTool.ts +32 -17
- package/src/tools/annotation/PlanarFreehandROITool.ts +56 -59
- package/src/tools/annotation/ProbeTool.ts +26 -19
- package/src/tools/annotation/RectangleROITool.ts +67 -75
- package/src/tools/base/AnnotationTool.ts +39 -17
- package/src/tools/base/index.ts +2 -1
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +3 -0
- package/src/tools/displayTools/Labelmap/removeLabelmapFromElement.ts +6 -1
- package/src/tools/displayTools/SegmentationDisplayTool.ts +12 -18
- package/src/tools/index.ts +2 -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 +20 -0
- package/src/types/ISetToolModeOptions.ts +2 -2
- package/src/types/IToolGroup.ts +6 -3
- package/src/types/ToolProps.ts +7 -1
- package/src/types/index.ts +9 -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/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/stackPrefetch.ts +10 -4
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { vec3 } from 'gl-matrix';
|
|
1
|
+
import { vec3, mat4 } from 'gl-matrix';
|
|
2
2
|
import {
|
|
3
3
|
getRenderingEngine,
|
|
4
4
|
Types,
|
|
@@ -8,28 +8,27 @@ import {
|
|
|
8
8
|
import { Synchronizer } from '../../store';
|
|
9
9
|
import { jumpToSlice } from '../../utilities';
|
|
10
10
|
import areViewportsCoplanar from './areViewportsCoplanar ';
|
|
11
|
+
|
|
12
|
+
const getSpatialRegistration = (targetId, sourceId) =>
|
|
13
|
+
utilities.spatialRegistrationMetadataProvider.get(
|
|
14
|
+
'spatialRegistrationModule',
|
|
15
|
+
[targetId, sourceId]
|
|
16
|
+
);
|
|
17
|
+
|
|
11
18
|
/**
|
|
12
19
|
* Synchronizer callback to synchronize the source viewport image to the
|
|
13
|
-
* target viewports closest image in its stack.
|
|
20
|
+
* target viewports closest image in its stack.
|
|
14
21
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
22
|
+
* This synchronizer does a setup (which can already be predefined as required)
|
|
23
|
+
* to register the target and soruce viewports. The registration will default
|
|
24
|
+
* to the identity registration if the same FOR is present in both viewports,
|
|
25
|
+
* unless the option `useInitialPosition` is set in the target viewport.
|
|
19
26
|
*
|
|
20
|
-
*
|
|
21
|
-
* registrationMetadataProvider to
|
|
22
|
-
* for mapping between the source and target viewport if so it is used to
|
|
23
|
-
* and is applied to the imagePositionPatient of the source viewport's to
|
|
24
|
-
* get the imagePositionPatient of the target viewport's closest image in
|
|
25
|
-
* its stack.
|
|
26
|
-
* Note for 2) The consuming apps using Cornerstone3D (OHIF, etc) are responsible
|
|
27
|
-
* to provide such data in the registrationMetadataProvider. This can be done
|
|
27
|
+
* The consuming apps using Cornerstone3D (OHIF, etc) MAY provide such data in
|
|
28
|
+
* the registrationMetadataProvider to override the data here. This can be done
|
|
28
29
|
* by various methods 1) Using spatialRegistrationModule inside dicom 2) assuming
|
|
29
30
|
* the user has actually manually scrolled the target viewport to the correct
|
|
30
31
|
* slice before initiating the synchronization 3) using some other method
|
|
31
|
-
* But overall, the consuming app is responsible for providing the data.
|
|
32
|
-
*
|
|
33
32
|
*
|
|
34
33
|
* @param synchronizerInstance - The Instance of the Synchronizer
|
|
35
34
|
* @param sourceViewport - The list of IDs defining the source viewport.
|
|
@@ -53,13 +52,16 @@ export default async function stackImageSyncCallback(
|
|
|
53
52
|
sourceViewport.viewportId
|
|
54
53
|
) as Types.IStackViewport;
|
|
55
54
|
|
|
55
|
+
const options = synchronizerInstance.getOptions(targetViewport.viewportId);
|
|
56
|
+
|
|
57
|
+
if (options?.disabled) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
const tViewport = renderingEngine.getViewport(
|
|
57
62
|
targetViewport.viewportId
|
|
58
63
|
) as Types.IStackViewport;
|
|
59
64
|
|
|
60
|
-
const frameOfReferenceUID1 = sViewport.getFrameOfReferenceUID();
|
|
61
|
-
const frameOfReferenceUID2 = tViewport.getFrameOfReferenceUID();
|
|
62
|
-
|
|
63
65
|
const imageId1 = sViewport.getCurrentImageId();
|
|
64
66
|
const imagePlaneModule1 = metaData.get('imagePlaneModule', imageId1);
|
|
65
67
|
const sourceImagePositionPatient = imagePlaneModule1.imagePositionPatient;
|
|
@@ -70,69 +72,62 @@ export default async function stackImageSyncCallback(
|
|
|
70
72
|
return;
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
if
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
// if the frame of reference is different we need to use the registrationMetadataProvider
|
|
76
|
+
// and add that to the imagePositionPatient of the source viewport to get the
|
|
77
|
+
// imagePositionPatient of the target viewport's closest image in its stack
|
|
78
|
+
let registrationMatrixMat4 = getSpatialRegistration(
|
|
79
|
+
targetViewport.viewportId,
|
|
80
|
+
sourceViewport.viewportId
|
|
81
|
+
);
|
|
80
82
|
|
|
83
|
+
if (!registrationMatrixMat4) {
|
|
84
|
+
const frameOfReferenceUID1 = sViewport.getFrameOfReferenceUID();
|
|
85
|
+
const frameOfReferenceUID2 = tViewport.getFrameOfReferenceUID();
|
|
81
86
|
if (
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
frameOfReferenceUID1 === frameOfReferenceUID2 &&
|
|
88
|
+
options.useInitialPosition !== false
|
|
84
89
|
) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
// if the frame of reference is different we need to use the registrationMetadataProvider
|
|
94
|
-
// and add that to the imagePositionPatient of the source viewport to get the
|
|
95
|
-
// imagePositionPatient of the target viewport's closest image in its stack
|
|
96
|
-
const registrationMatrixMat4 =
|
|
97
|
-
utilities.spatialRegistrationMetadataProvider.get(
|
|
98
|
-
'spatialRegistrationModule',
|
|
99
|
-
[targetViewport.viewportId, sourceViewport.viewportId]
|
|
90
|
+
registrationMatrixMat4 = mat4.identity(mat4.create());
|
|
91
|
+
} else {
|
|
92
|
+
utilities.calculateViewportsSpatialRegistration(sViewport, tViewport);
|
|
93
|
+
registrationMatrixMat4 = getSpatialRegistration(
|
|
94
|
+
targetViewport.viewportId,
|
|
95
|
+
sourceViewport.viewportId
|
|
100
96
|
);
|
|
101
|
-
|
|
97
|
+
}
|
|
102
98
|
if (!registrationMatrixMat4) {
|
|
103
|
-
|
|
104
|
-
`No registration matrix found for sourceViewport: ${sourceViewport.viewportId} and targetViewport: ${targetViewport.viewportId}, viewports with different frameOfReferenceUIDs must have a registration matrix in the registrationMetadataProvider. Use calculateViewportsRegistrationMatrix to calculate the matrix.`
|
|
105
|
-
);
|
|
99
|
+
return;
|
|
106
100
|
}
|
|
101
|
+
}
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
// apply the registration matrix to the source viewport's imagePositionPatient
|
|
104
|
+
// to get the target viewport's imagePositionPatient
|
|
105
|
+
const targetImagePositionPatientWithRegistrationMatrix = vec3.transformMat4(
|
|
106
|
+
vec3.create(),
|
|
107
|
+
sourceImagePositionPatient,
|
|
108
|
+
registrationMatrixMat4
|
|
109
|
+
);
|
|
115
110
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
111
|
+
// find the closest image in the target viewport's stack to the
|
|
112
|
+
// targetImagePositionPatientWithRegistrationMatrix
|
|
113
|
+
const closestImageIdIndex2 = _getClosestImageIdIndex(
|
|
114
|
+
targetImagePositionPatientWithRegistrationMatrix,
|
|
115
|
+
targetImageIds
|
|
116
|
+
);
|
|
122
117
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
118
|
+
if (
|
|
119
|
+
closestImageIdIndex2.index !== -1 &&
|
|
120
|
+
tViewport.getCurrentImageIdIndex() !== closestImageIdIndex2.index
|
|
121
|
+
) {
|
|
122
|
+
await jumpToSlice(tViewport.element, {
|
|
123
|
+
imageIndex: closestImageIdIndex2.index,
|
|
124
|
+
});
|
|
131
125
|
}
|
|
132
126
|
}
|
|
133
127
|
|
|
134
128
|
function _getClosestImageIdIndex(targetPoint, imageIds) {
|
|
135
129
|
// todo: this does not assume orientation yet, but that can be added later
|
|
130
|
+
// todo: handle multiframe images
|
|
136
131
|
return imageIds.reduce(
|
|
137
132
|
(closestImageIdIndex, imageId, index) => {
|
|
138
133
|
const { imagePositionPatient } = metaData.get(
|
|
@@ -80,9 +80,13 @@ class MIPJumpToClickTool extends BaseTool {
|
|
|
80
80
|
const { targetViewportIds, toolGroupId } = this.configuration;
|
|
81
81
|
// TODO - consider making this a utility
|
|
82
82
|
const viewports = renderingEngine.getViewports().filter((vp) => {
|
|
83
|
-
if (targetViewportIds?.indexOf(vp.id) >= 0)
|
|
83
|
+
if (targetViewportIds?.indexOf(vp.id) >= 0) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
84
86
|
const foundToolGroup = getToolGroupForViewport(vp.id, renderingEngine.id);
|
|
85
|
-
if (toolGroupId && toolGroupId === foundToolGroup?.id)
|
|
87
|
+
if (toolGroupId && toolGroupId === foundToolGroup?.id) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
86
90
|
return false;
|
|
87
91
|
});
|
|
88
92
|
|
|
@@ -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
|
}
|
|
@@ -72,7 +72,9 @@ class ScaleOverlayTool extends AnnotationDisplayTool {
|
|
|
72
72
|
// get viewports with tool enabled
|
|
73
73
|
const viewportIds = getToolGroup(this.toolGroupId).viewportsInfo;
|
|
74
74
|
|
|
75
|
-
if (!viewportIds)
|
|
75
|
+
if (!viewportIds) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
76
78
|
|
|
77
79
|
// get enabled elements
|
|
78
80
|
const enabledElements = viewportIds.map((e) =>
|
|
@@ -74,6 +74,7 @@ class AngleTool extends AnnotationTool {
|
|
|
74
74
|
configuration: {
|
|
75
75
|
shadow: true,
|
|
76
76
|
preventHandleOutsideImage: false,
|
|
77
|
+
getTextLines: defaultGetTextLines,
|
|
77
78
|
},
|
|
78
79
|
}
|
|
79
80
|
) {
|
|
@@ -219,8 +220,12 @@ class AngleTool extends AnnotationTool {
|
|
|
219
220
|
[canvasCoords[0], canvasCoords[1]]
|
|
220
221
|
);
|
|
221
222
|
|
|
222
|
-
if (distanceToPoint <= proximity)
|
|
223
|
-
|
|
223
|
+
if (distanceToPoint <= proximity) {
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
if (!point3) {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
224
229
|
|
|
225
230
|
const canvasPoint3 = viewport.worldToCanvas(point3);
|
|
226
231
|
|
|
@@ -740,7 +745,22 @@ class AngleTool extends AnnotationTool {
|
|
|
740
745
|
continue;
|
|
741
746
|
}
|
|
742
747
|
|
|
743
|
-
const
|
|
748
|
+
const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
|
|
749
|
+
if (!options.visibility) {
|
|
750
|
+
data.handles.textBox = {
|
|
751
|
+
hasMoved: false,
|
|
752
|
+
worldPosition: <Types.Point3>[0, 0, 0],
|
|
753
|
+
worldBoundingBox: {
|
|
754
|
+
topLeft: <Types.Point3>[0, 0, 0],
|
|
755
|
+
topRight: <Types.Point3>[0, 0, 0],
|
|
756
|
+
bottomLeft: <Types.Point3>[0, 0, 0],
|
|
757
|
+
bottomRight: <Types.Point3>[0, 0, 0],
|
|
758
|
+
},
|
|
759
|
+
};
|
|
760
|
+
continue;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
const textLines = this.configuration.getTextLines(data, targetId);
|
|
744
764
|
|
|
745
765
|
if (!data.handles.textBox.hasMoved) {
|
|
746
766
|
// linked to the vertex by default
|
|
@@ -763,7 +783,7 @@ class AngleTool extends AnnotationTool {
|
|
|
763
783
|
textBoxPosition,
|
|
764
784
|
canvasCoordinates,
|
|
765
785
|
{},
|
|
766
|
-
|
|
786
|
+
options
|
|
767
787
|
);
|
|
768
788
|
|
|
769
789
|
const { x: left, y: top, width, height } = boundingBox;
|
|
@@ -779,20 +799,6 @@ class AngleTool extends AnnotationTool {
|
|
|
779
799
|
return renderStatus;
|
|
780
800
|
};
|
|
781
801
|
|
|
782
|
-
// text line for the current active angle annotation
|
|
783
|
-
_getTextLines(data, targetId) {
|
|
784
|
-
const cachedVolumeStats = data.cachedStats[targetId];
|
|
785
|
-
const { angle } = cachedVolumeStats;
|
|
786
|
-
|
|
787
|
-
if (angle === undefined) {
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
const textLines = [`${roundNumber(angle)} ${String.fromCharCode(176)}`];
|
|
792
|
-
|
|
793
|
-
return textLines;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
802
|
_calculateCachedStats(annotation, renderingEngine, enabledElement) {
|
|
797
803
|
const data = annotation.data;
|
|
798
804
|
const { viewportId, renderingEngineId } = enabledElement;
|
|
@@ -817,7 +823,7 @@ class AngleTool extends AnnotationTool {
|
|
|
817
823
|
);
|
|
818
824
|
|
|
819
825
|
cachedStats[targetId] = {
|
|
820
|
-
angle,
|
|
826
|
+
angle: isNaN(angle) ? 'Incomplete Angle' : angle,
|
|
821
827
|
};
|
|
822
828
|
}
|
|
823
829
|
|
|
@@ -837,5 +843,18 @@ class AngleTool extends AnnotationTool {
|
|
|
837
843
|
}
|
|
838
844
|
}
|
|
839
845
|
|
|
846
|
+
function defaultGetTextLines(data, targetId): string[] {
|
|
847
|
+
const cachedVolumeStats = data.cachedStats[targetId];
|
|
848
|
+
const { angle } = cachedVolumeStats;
|
|
849
|
+
|
|
850
|
+
if (angle === undefined) {
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
const textLines = [`${roundNumber(angle)} ${String.fromCharCode(176)}`];
|
|
855
|
+
|
|
856
|
+
return textLines;
|
|
857
|
+
}
|
|
858
|
+
|
|
840
859
|
AngleTool.toolName = 'Angle';
|
|
841
860
|
export default AngleTool;
|
|
@@ -776,6 +776,21 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
776
776
|
continue;
|
|
777
777
|
}
|
|
778
778
|
|
|
779
|
+
const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
|
|
780
|
+
if (!options.visibility) {
|
|
781
|
+
data.handles.textBox = {
|
|
782
|
+
hasMoved: false,
|
|
783
|
+
worldPosition: <Types.Point3>[0, 0, 0],
|
|
784
|
+
worldBoundingBox: {
|
|
785
|
+
topLeft: <Types.Point3>[0, 0, 0],
|
|
786
|
+
topRight: <Types.Point3>[0, 0, 0],
|
|
787
|
+
bottomLeft: <Types.Point3>[0, 0, 0],
|
|
788
|
+
bottomRight: <Types.Point3>[0, 0, 0],
|
|
789
|
+
},
|
|
790
|
+
};
|
|
791
|
+
continue;
|
|
792
|
+
}
|
|
793
|
+
|
|
779
794
|
// Need to update to sync w/ annotation while unlinked/not moved
|
|
780
795
|
if (!data.handles.textBox.hasMoved) {
|
|
781
796
|
// linked to the point that doesn't have the arrowhead by default
|
|
@@ -798,7 +813,7 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
798
813
|
textBoxPosition,
|
|
799
814
|
canvasCoordinates,
|
|
800
815
|
{},
|
|
801
|
-
|
|
816
|
+
options
|
|
802
817
|
);
|
|
803
818
|
|
|
804
819
|
const { x: left, y: top, width, height } = boundingBox;
|