@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 { getEnabledElement } from '@cornerstonejs/core';
|
|
1
|
+
import { StackViewport, getEnabledElement } from '@cornerstonejs/core';
|
|
2
2
|
import type { Types } from '@cornerstonejs/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -19,6 +19,11 @@ function removeLabelmapFromElement(
|
|
|
19
19
|
const enabledElement = getEnabledElement(element);
|
|
20
20
|
const { viewport } = enabledElement;
|
|
21
21
|
|
|
22
|
+
if (viewport instanceof StackViewport) {
|
|
23
|
+
// Todo: we don't have stack segmentation yet
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
(viewport as Types.IVolumeViewport).removeVolumeActors([
|
|
23
28
|
segmentationRepresentationUID,
|
|
24
29
|
]);
|
|
@@ -143,26 +143,20 @@ class SegmentationDisplayTool extends BaseTool {
|
|
|
143
143
|
const config = this._getMergedRepresentationsConfig(toolGroupId);
|
|
144
144
|
|
|
145
145
|
const viewportsRenderList = [];
|
|
146
|
+
const display =
|
|
147
|
+
representation.type === Representations.Labelmap
|
|
148
|
+
? labelmapDisplay
|
|
149
|
+
: contourDisplay;
|
|
150
|
+
|
|
146
151
|
for (const viewport of toolGroupViewports) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
config
|
|
153
|
-
)
|
|
154
|
-
);
|
|
155
|
-
} else if (representation.type == Representations.Contour) {
|
|
156
|
-
viewportsRenderList.push(
|
|
157
|
-
contourDisplay.render(
|
|
158
|
-
viewport as Types.IVolumeViewport,
|
|
159
|
-
representation,
|
|
160
|
-
config
|
|
161
|
-
)
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
152
|
+
const renderedViewport = display.render(
|
|
153
|
+
viewport as Types.IVolumeViewport,
|
|
154
|
+
representation,
|
|
155
|
+
config
|
|
156
|
+
);
|
|
165
157
|
|
|
158
|
+
viewportsRenderList.push(renderedViewport);
|
|
159
|
+
}
|
|
166
160
|
return viewportsRenderList;
|
|
167
161
|
}
|
|
168
162
|
);
|
package/src/tools/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseTool, AnnotationTool } from './base';
|
|
1
|
+
import { BaseTool, AnnotationTool, AnnotationDisplayTool } from './base';
|
|
2
2
|
import PanTool from './PanTool';
|
|
3
3
|
import TrackballRotateTool from './TrackballRotateTool';
|
|
4
4
|
import WindowLevelTool from './WindowLevelTool';
|
|
@@ -43,6 +43,7 @@ export {
|
|
|
43
43
|
// ~~ BASE
|
|
44
44
|
BaseTool,
|
|
45
45
|
AnnotationTool,
|
|
46
|
+
AnnotationDisplayTool,
|
|
46
47
|
// Manipulation Tools
|
|
47
48
|
PanTool,
|
|
48
49
|
TrackballRotateTool,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cache, getEnabledElement, StackViewport } from '@cornerstonejs/core';
|
|
2
|
+
import { vec3 } from 'gl-matrix';
|
|
2
3
|
|
|
3
4
|
import type { Types } from '@cornerstonejs/core';
|
|
4
5
|
import type {
|
|
@@ -8,7 +9,10 @@ import type {
|
|
|
8
9
|
SVGDrawingHelper,
|
|
9
10
|
} from '../../types';
|
|
10
11
|
import { BaseTool } from '../base';
|
|
11
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
fillInsideSphere,
|
|
14
|
+
thresholdInsideSphere,
|
|
15
|
+
} from './strategies/fillSphere';
|
|
12
16
|
import { eraseInsideSphere } from './strategies/eraseSphere';
|
|
13
17
|
import {
|
|
14
18
|
thresholdInsideCircle,
|
|
@@ -59,10 +63,11 @@ class BrushTool extends BaseTool {
|
|
|
59
63
|
configuration: {
|
|
60
64
|
strategies: {
|
|
61
65
|
FILL_INSIDE_CIRCLE: fillInsideCircle,
|
|
62
|
-
THRESHOLD_INSIDE_CIRCLE: thresholdInsideCircle,
|
|
63
66
|
ERASE_INSIDE_CIRCLE: eraseInsideCircle,
|
|
64
67
|
FILL_INSIDE_SPHERE: fillInsideSphere,
|
|
65
68
|
ERASE_INSIDE_SPHERE: eraseInsideSphere,
|
|
69
|
+
THRESHOLD_INSIDE_CIRCLE: thresholdInsideCircle,
|
|
70
|
+
THRESHOLD_INSIDE_SPHERE: thresholdInsideSphere,
|
|
66
71
|
},
|
|
67
72
|
strategySpecificConfiguration: {
|
|
68
73
|
THRESHOLD_INSIDE_CIRCLE: {
|
|
@@ -277,24 +282,42 @@ class BrushTool extends BaseTool {
|
|
|
277
282
|
const enabledElement = getEnabledElement(element);
|
|
278
283
|
const { viewport } = enabledElement;
|
|
279
284
|
const { canvasToWorld } = viewport;
|
|
285
|
+
const camera = viewport.getCamera();
|
|
280
286
|
const { brushSize } = this.configuration;
|
|
281
|
-
// Center of circle in canvas Coordinates
|
|
282
287
|
|
|
283
|
-
const
|
|
288
|
+
const viewUp = vec3.fromValues(
|
|
289
|
+
camera.viewUp[0],
|
|
290
|
+
camera.viewUp[1],
|
|
291
|
+
camera.viewUp[2]
|
|
292
|
+
);
|
|
293
|
+
const viewPlaneNormal = vec3.fromValues(
|
|
294
|
+
camera.viewPlaneNormal[0],
|
|
295
|
+
camera.viewPlaneNormal[1],
|
|
296
|
+
camera.viewPlaneNormal[2]
|
|
297
|
+
);
|
|
298
|
+
const viewRight = vec3.create();
|
|
284
299
|
|
|
285
|
-
|
|
300
|
+
vec3.cross(viewRight, viewUp, viewPlaneNormal);
|
|
301
|
+
|
|
302
|
+
// in the world coordinate system, the brushSize is the radius of the circle
|
|
303
|
+
// in mm
|
|
304
|
+
const centerCursorInWorld: Types.Point3 = canvasToWorld([
|
|
286
305
|
centerCanvas[0],
|
|
287
|
-
centerCanvas[1] + radius,
|
|
288
|
-
];
|
|
289
|
-
const topCanvas: Types.Point2 = [centerCanvas[0], centerCanvas[1] - radius];
|
|
290
|
-
const leftCanvas: Types.Point2 = [
|
|
291
|
-
centerCanvas[0] - radius,
|
|
292
|
-
centerCanvas[1],
|
|
293
|
-
];
|
|
294
|
-
const rightCanvas: Types.Point2 = [
|
|
295
|
-
centerCanvas[0] + radius,
|
|
296
306
|
centerCanvas[1],
|
|
297
|
-
];
|
|
307
|
+
]);
|
|
308
|
+
|
|
309
|
+
const bottomCursorInWorld = vec3.create();
|
|
310
|
+
const topCursorInWorld = vec3.create();
|
|
311
|
+
const leftCursorInWorld = vec3.create();
|
|
312
|
+
const rightCursorInWorld = vec3.create();
|
|
313
|
+
|
|
314
|
+
// Calculate the bottom and top points of the circle in world coordinates
|
|
315
|
+
for (let i = 0; i <= 2; i++) {
|
|
316
|
+
bottomCursorInWorld[i] = centerCursorInWorld[i] - viewUp[i] * brushSize;
|
|
317
|
+
topCursorInWorld[i] = centerCursorInWorld[i] + viewUp[i] * brushSize;
|
|
318
|
+
leftCursorInWorld[i] = centerCursorInWorld[i] - viewRight[i] * brushSize;
|
|
319
|
+
rightCursorInWorld[i] = centerCursorInWorld[i] + viewRight[i] * brushSize;
|
|
320
|
+
}
|
|
298
321
|
|
|
299
322
|
const { brushCursor } = this._hoverData;
|
|
300
323
|
const { data } = brushCursor;
|
|
@@ -304,10 +327,10 @@ class BrushTool extends BaseTool {
|
|
|
304
327
|
}
|
|
305
328
|
|
|
306
329
|
data.handles.points = [
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
330
|
+
bottomCursorInWorld,
|
|
331
|
+
topCursorInWorld,
|
|
332
|
+
leftCursorInWorld,
|
|
333
|
+
rightCursorInWorld,
|
|
311
334
|
];
|
|
312
335
|
|
|
313
336
|
data.invalidated = false;
|
|
@@ -90,7 +90,10 @@ class PaintFillTool extends BaseTool {
|
|
|
90
90
|
|
|
91
91
|
const index = transformWorldToIndex(segmentation.imageData, worldPos);
|
|
92
92
|
|
|
93
|
-
const fixedDimension = this.getFixedDimension(
|
|
93
|
+
const fixedDimension = this.getFixedDimension(
|
|
94
|
+
viewPlaneNormal,
|
|
95
|
+
direction as number[]
|
|
96
|
+
);
|
|
94
97
|
|
|
95
98
|
if (fixedDimension === undefined) {
|
|
96
99
|
console.warn('Oblique paint fill not yet supported');
|
|
@@ -169,8 +172,12 @@ class PaintFillTool extends BaseTool {
|
|
|
169
172
|
for (let b = 0; b < boundaries.length; b++) {
|
|
170
173
|
const j = boundaries[b][1];
|
|
171
174
|
|
|
172
|
-
if (j < minJ)
|
|
173
|
-
|
|
175
|
+
if (j < minJ) {
|
|
176
|
+
minJ = j;
|
|
177
|
+
}
|
|
178
|
+
if (j > maxJ) {
|
|
179
|
+
maxJ = j;
|
|
180
|
+
}
|
|
174
181
|
}
|
|
175
182
|
|
|
176
183
|
const framesModified = [];
|
|
@@ -4,6 +4,7 @@ import { fillInsideSphere } from './fillSphere';
|
|
|
4
4
|
|
|
5
5
|
type OperationData = {
|
|
6
6
|
points: [Types.Point3, Types.Point3, Types.Point3, Types.Point3];
|
|
7
|
+
imageVolume: Types.IImageVolume;
|
|
7
8
|
volume: Types.IImageVolume;
|
|
8
9
|
segmentIndex: number;
|
|
9
10
|
segmentationId: string;
|
|
@@ -11,6 +12,7 @@ type OperationData = {
|
|
|
11
12
|
viewPlaneNormal: Types.Point3;
|
|
12
13
|
viewUp: Types.Point3;
|
|
13
14
|
constraintFn: () => boolean;
|
|
15
|
+
strategySpecificConfiguration: any;
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
export function eraseInsideSphere(
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import { getBoundingBoxAroundShape } from '../../../utilities/boundingBox';
|
|
10
10
|
import { triggerSegmentationDataModified } from '../../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
11
11
|
import { pointInShapeCallback } from '../../../utilities';
|
|
12
|
+
import isWithinThreshold from './utils/isWithinThreshold';
|
|
12
13
|
|
|
13
14
|
const { transformWorldToIndex } = csUtils;
|
|
14
15
|
|
|
@@ -117,19 +118,6 @@ function fillCircle(
|
|
|
117
118
|
triggerSegmentationDataModified(segmentationId, arrayOfSlices);
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
function isWithinThreshold(
|
|
121
|
-
index: number,
|
|
122
|
-
imageVolume: Types.IImageVolume,
|
|
123
|
-
strategySpecificConfiguration: any
|
|
124
|
-
) {
|
|
125
|
-
const { THRESHOLD_INSIDE_CIRCLE } = strategySpecificConfiguration;
|
|
126
|
-
|
|
127
|
-
const voxelValue = imageVolume.getScalarData()[index];
|
|
128
|
-
const { threshold } = THRESHOLD_INSIDE_CIRCLE;
|
|
129
|
-
|
|
130
|
-
return threshold[0] <= voxelValue && voxelValue <= threshold[1];
|
|
131
|
-
}
|
|
132
|
-
|
|
133
121
|
/**
|
|
134
122
|
* Fill inside the circular region segment inside the segmentation defined by the operationData.
|
|
135
123
|
* It fills the segmentation pixels inside the defined circle.
|
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import { utilities as csUtils } from '@cornerstonejs/core';
|
|
2
3
|
|
|
3
4
|
import { triggerSegmentationDataModified } from '../../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
4
5
|
import { pointInSurroundingSphereCallback } from '../../../utilities';
|
|
6
|
+
import isWithinThreshold from './utils/isWithinThreshold';
|
|
5
7
|
|
|
6
8
|
type OperationData = {
|
|
7
9
|
points: [Types.Point3, Types.Point3, Types.Point3, Types.Point3];
|
|
8
10
|
volume: Types.IImageVolume;
|
|
11
|
+
imageVolume: Types.IImageVolume;
|
|
9
12
|
segmentIndex: number;
|
|
10
13
|
segmentationId: string;
|
|
11
14
|
segmentsLocked: number[];
|
|
12
15
|
viewPlaneNormal: Types.Point3;
|
|
13
16
|
viewUp: Types.Point3;
|
|
17
|
+
strategySpecificConfiguration: any;
|
|
14
18
|
constraintFn: () => boolean;
|
|
15
19
|
};
|
|
16
20
|
|
|
17
21
|
function fillSphere(
|
|
18
22
|
enabledElement: Types.IEnabledElement,
|
|
19
23
|
operationData: OperationData,
|
|
20
|
-
_inside = true
|
|
24
|
+
_inside = true,
|
|
25
|
+
threshold = false
|
|
21
26
|
): void {
|
|
22
27
|
const { viewport } = enabledElement;
|
|
23
28
|
const {
|
|
24
29
|
volume: segmentation,
|
|
25
30
|
segmentsLocked,
|
|
26
31
|
segmentIndex,
|
|
32
|
+
imageVolume,
|
|
33
|
+
strategySpecificConfiguration,
|
|
27
34
|
segmentationId,
|
|
28
35
|
points,
|
|
29
36
|
} = operationData;
|
|
@@ -32,13 +39,30 @@ function fillSphere(
|
|
|
32
39
|
const scalarData = segmentation.getScalarData();
|
|
33
40
|
const scalarIndex = [];
|
|
34
41
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
let callback;
|
|
43
|
+
|
|
44
|
+
if (threshold) {
|
|
45
|
+
callback = ({ value, index, pointIJK }) => {
|
|
46
|
+
if (segmentsLocked.includes(value)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (
|
|
51
|
+
isWithinThreshold(index, imageVolume, strategySpecificConfiguration)
|
|
52
|
+
) {
|
|
53
|
+
scalarData[index] = segmentIndex;
|
|
54
|
+
scalarIndex.push(index);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
} else {
|
|
58
|
+
callback = ({ index, value }) => {
|
|
59
|
+
if (segmentsLocked.includes(value)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
scalarData[index] = segmentIndex;
|
|
63
|
+
scalarIndex.push(index);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
42
66
|
|
|
43
67
|
pointInSurroundingSphereCallback(
|
|
44
68
|
imageData,
|
|
@@ -74,6 +98,30 @@ export function fillInsideSphere(
|
|
|
74
98
|
fillSphere(enabledElement, operationData, true);
|
|
75
99
|
}
|
|
76
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Fill inside the circular region segment inside the segmentation defined by the operationData.
|
|
103
|
+
* It fills the segmentation pixels inside the defined circle.
|
|
104
|
+
* @param enabledElement - The element for which the segment is being filled.
|
|
105
|
+
* @param operationData - EraseOperationData
|
|
106
|
+
*/
|
|
107
|
+
export function thresholdInsideSphere(
|
|
108
|
+
enabledElement: Types.IEnabledElement,
|
|
109
|
+
operationData: OperationData
|
|
110
|
+
): void {
|
|
111
|
+
const { volume, imageVolume } = operationData;
|
|
112
|
+
|
|
113
|
+
if (
|
|
114
|
+
!csUtils.isEqual(volume.dimensions, imageVolume.dimensions) ||
|
|
115
|
+
!csUtils.isEqual(volume.direction, imageVolume.direction)
|
|
116
|
+
) {
|
|
117
|
+
throw new Error(
|
|
118
|
+
'Only source data the same dimensions/size/orientation as the segmentation currently supported.'
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
fillSphere(enabledElement, operationData, true, true);
|
|
123
|
+
}
|
|
124
|
+
|
|
77
125
|
/**
|
|
78
126
|
* Fill outside a sphere with the given segment index in the given operation data. The
|
|
79
127
|
* operation data contains the sphere required points.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Types } from '@cornerstonejs/core';
|
|
2
|
+
|
|
3
|
+
function isWithinThreshold(
|
|
4
|
+
index: number,
|
|
5
|
+
imageVolume: Types.IImageVolume,
|
|
6
|
+
strategySpecificConfiguration: any
|
|
7
|
+
) {
|
|
8
|
+
const { THRESHOLD_INSIDE_CIRCLE } = strategySpecificConfiguration;
|
|
9
|
+
|
|
10
|
+
const voxelValue = imageVolume.getScalarData()[index];
|
|
11
|
+
const { threshold } = THRESHOLD_INSIDE_CIRCLE;
|
|
12
|
+
|
|
13
|
+
return threshold[0] <= voxelValue && voxelValue <= threshold[1];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default isWithinThreshold;
|
package/src/types/CINETypes.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Types } from '@cornerstonejs/core';
|
|
2
|
-
|
|
3
1
|
type PlayClipOptions = {
|
|
4
2
|
framesPerSecond?: number;
|
|
5
3
|
frameTimeVector?: number[];
|
|
@@ -7,6 +5,11 @@ type PlayClipOptions = {
|
|
|
7
5
|
loop?: boolean;
|
|
8
6
|
dynamicCineEnabled?: boolean;
|
|
9
7
|
frameTimeVectorSpeedMultiplier?: number;
|
|
8
|
+
// How many CINE frames to wait for a rendered event to occur before
|
|
9
|
+
// trying to display the image after the next one
|
|
10
|
+
// A CINE frame is attempted every 1 / fps seconds
|
|
11
|
+
// The default is 30 tries, or 1.25 seconds at 24 fps
|
|
12
|
+
waitForRendered?: number;
|
|
10
13
|
};
|
|
11
14
|
|
|
12
15
|
interface ToolData {
|
|
@@ -26,6 +29,9 @@ type CinePlayContext = {
|
|
|
26
29
|
get numScrollSteps(): number;
|
|
27
30
|
get currentStepIndex(): number;
|
|
28
31
|
get frameTimeVectorEnabled(): boolean;
|
|
32
|
+
// How many times has the wait for rendered been tried without showing
|
|
33
|
+
// the next image.
|
|
34
|
+
waitForRenderedCount?: number;
|
|
29
35
|
scroll(delta: number): void;
|
|
30
36
|
};
|
|
31
37
|
|
package/src/types/EventTypes.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Annotation } from './AnnotationTypes';
|
|
|
3
3
|
import IPoints from './IPoints';
|
|
4
4
|
import ITouchPoints from './ITouchPoints';
|
|
5
5
|
import IDistance from './IDistance';
|
|
6
|
+
import { SetToolBindingsType } from './ISetToolModeOptions';
|
|
6
7
|
import { Swipe } from '../enums/Touch';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -70,6 +71,18 @@ type InteractionStartEventDetail = InteractionEventDetail;
|
|
|
70
71
|
|
|
71
72
|
type InteractionEndEventDetail = InteractionEventDetail;
|
|
72
73
|
|
|
74
|
+
/**
|
|
75
|
+
* The data that is passed to the event handler when a tool is activated.
|
|
76
|
+
*/
|
|
77
|
+
type ToolActivatedEventDetail = {
|
|
78
|
+
/** unique id of the toolGroup */
|
|
79
|
+
toolGroupId: string;
|
|
80
|
+
/** Tool name */
|
|
81
|
+
toolName: string;
|
|
82
|
+
/** Tool binding options */
|
|
83
|
+
toolBindingsOptions: SetToolBindingsType;
|
|
84
|
+
};
|
|
85
|
+
|
|
73
86
|
/**
|
|
74
87
|
* The data that is passed to the event handler when a new annotation is added
|
|
75
88
|
* to the annotations.
|
|
@@ -411,6 +424,11 @@ type NormalizedMouseEventType = Types.CustomEventType<MouseCustomEventDetail>;
|
|
|
411
424
|
*/
|
|
412
425
|
type NormalizedTouchEventType = Types.CustomEventType<TouchCustomEventDetail>;
|
|
413
426
|
|
|
427
|
+
/**
|
|
428
|
+
* The ToolActivated event type
|
|
429
|
+
*/
|
|
430
|
+
type ToolActivatedEventType = Types.CustomEventType<ToolActivatedEventDetail>;
|
|
431
|
+
|
|
414
432
|
/**
|
|
415
433
|
* The AnnotationAdded event type
|
|
416
434
|
*/
|
|
@@ -611,6 +629,8 @@ export {
|
|
|
611
629
|
NormalizedInteractionEventDetail,
|
|
612
630
|
NormalizedMouseEventType,
|
|
613
631
|
NormalizedTouchEventType,
|
|
632
|
+
ToolActivatedEventDetail,
|
|
633
|
+
ToolActivatedEventType,
|
|
614
634
|
AnnotationAddedEventDetail,
|
|
615
635
|
AnnotationAddedEventType,
|
|
616
636
|
AnnotationCompletedEventDetail,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ToolModes, MouseBindings, KeyboardBindings } from '../enums';
|
|
2
2
|
|
|
3
|
-
type ToolBindingMouseType = typeof MouseBindings[keyof typeof MouseBindings];
|
|
3
|
+
type ToolBindingMouseType = (typeof MouseBindings)[keyof typeof MouseBindings];
|
|
4
4
|
|
|
5
5
|
type ToolBindingKeyboardType =
|
|
6
|
-
typeof KeyboardBindings[keyof typeof KeyboardBindings];
|
|
6
|
+
(typeof KeyboardBindings)[keyof typeof KeyboardBindings];
|
|
7
7
|
|
|
8
8
|
type IToolBinding = {
|
|
9
9
|
/** Mouse button bindings e.g., MouseBindings.Primary/Secondary etc. */
|
package/src/types/IToolGroup.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
2
|
import { SetToolBindingsType, ToolOptionsType } from './ISetToolModeOptions';
|
|
3
3
|
import { MouseBindings } from '../enums';
|
|
4
|
+
import { ToolConfiguration } from '../types';
|
|
4
5
|
/**
|
|
5
6
|
* ToolGroup interface
|
|
6
7
|
*/
|
|
@@ -19,8 +20,10 @@ export default interface IToolGroup {
|
|
|
19
20
|
getViewportsInfo: () => Array<Types.IViewportId>;
|
|
20
21
|
/** Get the toolInstance of the toolName */
|
|
21
22
|
getToolInstance: { (toolName: string): any };
|
|
22
|
-
/** Add a tool to toolGroup with its configuration */
|
|
23
|
-
addTool: {
|
|
23
|
+
/** Add a tool to toolGroup with its configuration and custom calculator if wanted */
|
|
24
|
+
addTool: {
|
|
25
|
+
(toolName: string, toolConfiguration?: ToolConfiguration): void;
|
|
26
|
+
};
|
|
24
27
|
/** Add tool instance, if you want to create more than one instance from the same tool e.g., brush/eraser tool */
|
|
25
28
|
addToolInstance: {
|
|
26
29
|
(ttoolName: string, parentClassName: string, configuration?: any): void;
|
|
@@ -62,7 +65,7 @@ export default interface IToolGroup {
|
|
|
62
65
|
setToolConfiguration: {
|
|
63
66
|
(
|
|
64
67
|
toolName: string,
|
|
65
|
-
configuration:
|
|
68
|
+
configuration: ToolConfiguration,
|
|
66
69
|
overwrite?: boolean
|
|
67
70
|
): void;
|
|
68
71
|
};
|
package/src/types/ToolProps.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { Calculator } from '../utilities/math/basic';
|
|
2
|
+
|
|
1
3
|
type SharedToolProp = {
|
|
2
4
|
/** supported interactions for the tool */
|
|
3
5
|
supportedInteractionTypes?: Array<string>;
|
|
4
6
|
/** tool specific tool configuration */
|
|
5
|
-
configuration?:
|
|
7
|
+
configuration?: ToolConfiguration;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type ToolConfiguration = Record<string, any> & {
|
|
11
|
+
statsCalculator?: Calculator;
|
|
6
12
|
};
|
|
7
13
|
|
|
8
14
|
export type ToolProps = SharedToolProp;
|
package/src/types/index.ts
CHANGED
|
@@ -21,7 +21,11 @@ import type * as AnnotationStyle from './AnnotationStyle';
|
|
|
21
21
|
import type ToolHandle from './ToolHandle';
|
|
22
22
|
import type { AnnotationHandle, TextBoxHandle } from './ToolHandle';
|
|
23
23
|
import type InteractionTypes from './InteractionTypes';
|
|
24
|
-
import type {
|
|
24
|
+
import type {
|
|
25
|
+
ToolProps,
|
|
26
|
+
PublicToolProps,
|
|
27
|
+
ToolConfiguration,
|
|
28
|
+
} from './ToolProps';
|
|
25
29
|
import type { SVGCursorDescriptor, SVGPoint } from './CursorTypes';
|
|
26
30
|
import type JumpToSliceOptions from './JumpToSliceOptions';
|
|
27
31
|
import type ScrollOptions from './ScrollOptions';
|
|
@@ -52,6 +56,7 @@ import IToolClassReference from './IToolClassReference';
|
|
|
52
56
|
import { ContourSegmentationData } from './ContourTypes';
|
|
53
57
|
import IAnnotationManager from './IAnnotationManager';
|
|
54
58
|
import AnnotationGroupSelector from './AnnotationGroupSelector';
|
|
59
|
+
import { Statistics } from './CalculatorTypes';
|
|
55
60
|
|
|
56
61
|
export type {
|
|
57
62
|
// AnnotationState
|
|
@@ -68,6 +73,7 @@ export type {
|
|
|
68
73
|
PlanarBoundingBox,
|
|
69
74
|
ToolProps,
|
|
70
75
|
PublicToolProps,
|
|
76
|
+
ToolConfiguration,
|
|
71
77
|
// Event data
|
|
72
78
|
EventTypes,
|
|
73
79
|
IPoints,
|
|
@@ -114,4 +120,6 @@ export type {
|
|
|
114
120
|
FloodFillOptions,
|
|
115
121
|
// Contour
|
|
116
122
|
ContourSegmentationData,
|
|
123
|
+
//Statistics
|
|
124
|
+
Statistics,
|
|
117
125
|
};
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
VolumeViewport,
|
|
7
7
|
cache,
|
|
8
8
|
BaseVolumeViewport,
|
|
9
|
+
Enums,
|
|
9
10
|
} from '@cornerstonejs/core';
|
|
10
11
|
|
|
11
12
|
import { Types } from '@cornerstonejs/core';
|
|
@@ -14,6 +15,7 @@ import { addToolState, getToolState } from './state';
|
|
|
14
15
|
import { CINETypes } from '../../types';
|
|
15
16
|
import scroll from '../scroll';
|
|
16
17
|
|
|
18
|
+
const { ViewportStatus } = Enums;
|
|
17
19
|
const { triggerEvent } = csUtils;
|
|
18
20
|
|
|
19
21
|
const debounced = true;
|
|
@@ -193,7 +195,9 @@ function stopClip(element: HTMLDivElement): void {
|
|
|
193
195
|
|
|
194
196
|
function _stopClip(element: HTMLDivElement, stopDynamicCine: boolean): void {
|
|
195
197
|
const enabledElement = getEnabledElement(element);
|
|
196
|
-
if (!enabledElement)
|
|
198
|
+
if (!enabledElement) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
197
201
|
const { viewport } = enabledElement;
|
|
198
202
|
const cineToolData = getToolState(viewport.element);
|
|
199
203
|
|
|
@@ -313,7 +317,8 @@ function _getVolumeFromViewport(viewport): Types.IImageVolume {
|
|
|
313
317
|
}
|
|
314
318
|
|
|
315
319
|
function _createStackViewportCinePlayContext(
|
|
316
|
-
viewport: StackViewport
|
|
320
|
+
viewport: StackViewport,
|
|
321
|
+
waitForRendered: number
|
|
317
322
|
): CINETypes.CinePlayContext {
|
|
318
323
|
const imageIds = viewport.getImageIds();
|
|
319
324
|
|
|
@@ -328,7 +333,16 @@ function _createStackViewportCinePlayContext(
|
|
|
328
333
|
// It is always in acquired orientation
|
|
329
334
|
return true;
|
|
330
335
|
},
|
|
336
|
+
waitForRenderedCount: 0,
|
|
331
337
|
scroll(delta: number): void {
|
|
338
|
+
if (
|
|
339
|
+
this.waitForRenderedCount <= waitForRendered &&
|
|
340
|
+
viewport.viewportStatus !== ViewportStatus.RENDERED
|
|
341
|
+
) {
|
|
342
|
+
this.waitForRenderedCount++;
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
this.waitForRenderedCount = 0;
|
|
332
346
|
scroll(viewport, { delta, debounceLoading: debounced });
|
|
333
347
|
},
|
|
334
348
|
};
|
|
@@ -417,7 +431,10 @@ function _createCinePlayContext(
|
|
|
417
431
|
playClipOptions: CINETypes.PlayClipOptions
|
|
418
432
|
): CINETypes.CinePlayContext {
|
|
419
433
|
if (viewport instanceof StackViewport) {
|
|
420
|
-
return _createStackViewportCinePlayContext(
|
|
434
|
+
return _createStackViewportCinePlayContext(
|
|
435
|
+
viewport,
|
|
436
|
+
playClipOptions.waitForRendered ?? 30
|
|
437
|
+
);
|
|
421
438
|
}
|
|
422
439
|
|
|
423
440
|
if (viewport instanceof VolumeViewport) {
|
|
@@ -40,13 +40,16 @@ function getDataInTime(
|
|
|
40
40
|
|
|
41
41
|
if (options.maskVolumeId) {
|
|
42
42
|
const segmentationVolume = cache.getVolume(options.maskVolumeId);
|
|
43
|
+
const segScalarData = segmentationVolume.getScalarData();
|
|
44
|
+
const indexArray = [];
|
|
45
|
+
|
|
46
|
+
// Get the index of every non-zero voxel in mask
|
|
47
|
+
for (let i = 0, len = segScalarData.length; i < len; i++) {
|
|
48
|
+
if (segScalarData[i] !== 0) {
|
|
49
|
+
indexArray.push(i);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
43
52
|
|
|
44
|
-
// Get the index of every non-zero voxel in mask by mapping indexes to
|
|
45
|
-
// new array, then using the array to filter
|
|
46
|
-
const indexArray = segmentationVolume
|
|
47
|
-
.getScalarData()
|
|
48
|
-
.map((_, i) => i)
|
|
49
|
-
.filter((i) => segmentationVolume.getScalarData()[i] !== 0);
|
|
50
53
|
const dataInTime = _getTimePointDataMask(frames, indexArray, dynamicVolume);
|
|
51
54
|
|
|
52
55
|
return dataInTime;
|
|
@@ -23,10 +23,16 @@ const getCalibratedLengthUnits = (handles, image): string => {
|
|
|
23
23
|
const { calibration, hasPixelSpacing } = image;
|
|
24
24
|
// Anachronistic - moving to using calibration consistently, but not completed yet
|
|
25
25
|
const units = hasPixelSpacing ? 'mm' : PIXEL_UNITS;
|
|
26
|
-
if (!calibration || !calibration.type)
|
|
27
|
-
|
|
26
|
+
if (!calibration || !calibration.type) {
|
|
27
|
+
return units;
|
|
28
|
+
}
|
|
29
|
+
if (calibration.type === CalibrationTypes.UNCALIBRATED) {
|
|
30
|
+
return PIXEL_UNITS;
|
|
31
|
+
}
|
|
28
32
|
// TODO - handle US regions properly
|
|
29
|
-
if (calibration.SequenceOfUltrasoundRegions)
|
|
33
|
+
if (calibration.SequenceOfUltrasoundRegions) {
|
|
34
|
+
return 'US Region';
|
|
35
|
+
}
|
|
30
36
|
return `${units} ${calibration.type}`;
|
|
31
37
|
};
|
|
32
38
|
|
|
@@ -37,8 +43,12 @@ const SQUARE = '\xb2';
|
|
|
37
43
|
const getCalibratedAreaUnits = (handles, image): string => {
|
|
38
44
|
const { calibration, hasPixelSpacing } = image;
|
|
39
45
|
const units = (hasPixelSpacing ? 'mm' : PIXEL_UNITS) + SQUARE;
|
|
40
|
-
if (!calibration || !calibration.type)
|
|
41
|
-
|
|
46
|
+
if (!calibration || !calibration.type) {
|
|
47
|
+
return units;
|
|
48
|
+
}
|
|
49
|
+
if (calibration.SequenceOfUltrasoundRegions) {
|
|
50
|
+
return 'US Region';
|
|
51
|
+
}
|
|
42
52
|
return `${units} ${calibration.type}`;
|
|
43
53
|
};
|
|
44
54
|
|