@cornerstonejs/tools 1.50.3 → 1.51.0
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/eventListeners/annotations/annotationCompletedListener.d.ts +2 -0
- package/dist/cjs/eventListeners/annotations/annotationCompletedListener.js +35 -0
- package/dist/cjs/eventListeners/annotations/annotationCompletedListener.js.map +1 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts +2 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +174 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/index.d.ts +1 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/index.js +9 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/index.js.map +1 -0
- package/dist/cjs/eventListeners/annotations/index.d.ts +2 -1
- package/dist/cjs/eventListeners/annotations/index.js +3 -1
- package/dist/cjs/eventListeners/annotations/index.js.map +1 -1
- package/dist/cjs/eventListeners/index.d.ts +2 -2
- package/dist/cjs/eventListeners/index.js +2 -1
- package/dist/cjs/eventListeners/index.js.map +1 -1
- package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.d.ts +3 -0
- package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +89 -0
- package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js.map +1 -0
- package/dist/cjs/eventListeners/segmentation/segmentationDataModifiedEventListener.js +5 -53
- package/dist/cjs/eventListeners/segmentation/segmentationDataModifiedEventListener.js.map +1 -1
- package/dist/cjs/init.js +2 -0
- package/dist/cjs/init.js.map +1 -1
- package/dist/cjs/stateManagement/annotation/helpers/state.d.ts +3 -1
- package/dist/cjs/stateManagement/annotation/helpers/state.js +21 -1
- package/dist/cjs/stateManagement/annotation/helpers/state.js.map +1 -1
- package/dist/cjs/store/ToolGroupManager/ToolGroup.d.ts +1 -0
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js +3 -0
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/cjs/store/addTool.d.ts +1 -0
- package/dist/cjs/store/addTool.js +6 -1
- package/dist/cjs/store/addTool.js.map +1 -1
- package/dist/cjs/store/index.d.ts +2 -2
- package/dist/cjs/store/index.js +2 -1
- package/dist/cjs/store/index.js.map +1 -1
- package/dist/cjs/store/removeEnabledElement.js +1 -2
- package/dist/cjs/store/removeEnabledElement.js.map +1 -1
- package/dist/cjs/tools/AdvancedMagnifyTool.js +3 -10
- package/dist/cjs/tools/AdvancedMagnifyTool.js.map +1 -1
- package/dist/cjs/tools/annotation/AngleTool.js +5 -18
- package/dist/cjs/tools/annotation/AngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/ArrowAnnotateTool.js +9 -28
- package/dist/cjs/tools/annotation/ArrowAnnotateTool.js.map +1 -1
- package/dist/cjs/tools/annotation/BidirectionalTool.js +7 -22
- package/dist/cjs/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/cjs/tools/annotation/CircleROITool.js +7 -22
- package/dist/cjs/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/CobbAngleTool.js +5 -18
- package/dist/cjs/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.js +7 -22
- package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/KeyImageTool.js +5 -12
- package/dist/cjs/tools/annotation/KeyImageTool.js.map +1 -1
- package/dist/cjs/tools/annotation/LengthTool.js +5 -18
- package/dist/cjs/tools/annotation/LengthTool.js.map +1 -1
- package/dist/cjs/tools/annotation/LivewireContourTool.d.ts +4 -1
- package/dist/cjs/tools/annotation/LivewireContourTool.js +30 -22
- package/dist/cjs/tools/annotation/LivewireContourTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts +2 -1
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js +11 -0
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.d.ts +2 -10
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +6 -22
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/ProbeTool.js +8 -23
- package/dist/cjs/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.js +8 -22
- package/dist/cjs/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/SplineROITool.d.ts +8 -9
- package/dist/cjs/tools/annotation/SplineROITool.js +27 -10
- package/dist/cjs/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/UltrasoundDirectionalTool.js +5 -18
- package/dist/cjs/tools/annotation/UltrasoundDirectionalTool.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +7 -6
- package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js +8 -5
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/editLoopCommon.js +8 -8
- package/dist/cjs/tools/annotation/planarFreehandROITool/editLoopCommon.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js +6 -5
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
- package/dist/cjs/tools/base/ContourBaseTool.d.ts +2 -8
- package/dist/cjs/tools/base/ContourBaseTool.js.map +1 -1
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.d.ts +3 -2
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js +13 -1
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/RectangleROIStartEndThresholdTool.js +3 -9
- package/dist/cjs/tools/segmentation/RectangleROIStartEndThresholdTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/RectangleROIThresholdTool.js +3 -9
- package/dist/cjs/tools/segmentation/RectangleROIThresholdTool.js.map +1 -1
- package/dist/cjs/types/AnnotationRenderContext.d.ts +11 -0
- package/dist/cjs/types/AnnotationRenderContext.js +3 -0
- package/dist/cjs/types/AnnotationRenderContext.js.map +1 -0
- package/dist/cjs/types/IToolGroup.d.ts +2 -1
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/cjs/utilities/contourSegmentation/areSameSegment.d.ts +2 -0
- package/dist/cjs/utilities/contourSegmentation/areSameSegment.js +12 -0
- package/dist/cjs/utilities/contourSegmentation/areSameSegment.js.map +1 -0
- package/dist/cjs/utilities/contourSegmentation/index.d.ts +2 -0
- package/dist/cjs/utilities/contourSegmentation/index.js +11 -0
- package/dist/cjs/utilities/contourSegmentation/index.js.map +1 -0
- package/dist/cjs/utilities/contourSegmentation/isContourSegmentationAnnotation.d.ts +3 -0
- package/dist/cjs/utilities/contourSegmentation/isContourSegmentationAnnotation.js +8 -0
- package/dist/cjs/utilities/contourSegmentation/isContourSegmentationAnnotation.js.map +1 -0
- package/dist/cjs/utilities/contours/areCoplanarContours.d.ts +2 -0
- package/dist/cjs/utilities/contours/areCoplanarContours.js +19 -0
- package/dist/cjs/utilities/contours/areCoplanarContours.js.map +1 -0
- package/dist/cjs/utilities/contours/index.d.ts +2 -1
- package/dist/cjs/utilities/contours/index.js +3 -1
- package/dist/cjs/utilities/contours/index.js.map +1 -1
- package/dist/cjs/utilities/contours/reverseIfAntiClockwise.js +3 -22
- package/dist/cjs/utilities/contours/reverseIfAntiClockwise.js.map +1 -1
- package/dist/cjs/utilities/math/aabb/index.d.ts +1 -0
- package/dist/cjs/utilities/math/aabb/index.js +3 -1
- package/dist/cjs/utilities/math/aabb/index.js.map +1 -1
- package/dist/cjs/utilities/math/aabb/intersectAABB.d.ts +2 -0
- package/dist/cjs/utilities/math/aabb/intersectAABB.js +10 -0
- package/dist/cjs/utilities/math/aabb/intersectAABB.js.map +1 -0
- package/dist/cjs/utilities/math/point/distanceToPointSquared.js +4 -1
- package/dist/cjs/utilities/math/point/distanceToPointSquared.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/areLineSegmentsIntersecting.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/areLineSegmentsIntersecting.js +59 -0
- package/dist/cjs/utilities/math/polyline/areLineSegmentsIntersecting.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/combinePolyline.d.ts +4 -0
- package/dist/cjs/utilities/math/polyline/combinePolyline.js +213 -0
- package/dist/cjs/utilities/math/polyline/combinePolyline.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/containsPoint.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/containsPoint.js +36 -0
- package/dist/cjs/utilities/math/polyline/containsPoint.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getAABB.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getAABB.js +18 -0
- package/dist/cjs/utilities/math/polyline/getAABB.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getArea.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/{calculateAreaOfPoints.js → getArea.js} +3 -3
- package/dist/cjs/utilities/math/polyline/getArea.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getClosestLineSegmentIntersection.d.ts +5 -0
- package/dist/cjs/utilities/math/polyline/getClosestLineSegmentIntersection.js +51 -0
- package/dist/cjs/utilities/math/polyline/getClosestLineSegmentIntersection.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.js +28 -0
- package/dist/cjs/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js +20 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsIndexes.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsIndexes.js +22 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsIndexes.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.js +21 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getNormal2.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getNormal2.js +12 -0
- package/dist/cjs/utilities/math/polyline/getNormal2.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getNormal3.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getNormal3.js +29 -0
- package/dist/cjs/utilities/math/polyline/getNormal3.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getSignedArea.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getSignedArea.js +20 -0
- package/dist/cjs/utilities/math/polyline/getSignedArea.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/index.d.ts +14 -3
- package/dist/cjs/utilities/math/polyline/index.js +28 -6
- package/dist/cjs/utilities/math/polyline/index.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/intersectPolyline.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/intersectPolyline.js +20 -0
- package/dist/cjs/utilities/math/polyline/intersectPolyline.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/isClosed.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/isClosed.js +39 -0
- package/dist/cjs/utilities/math/polyline/isClosed.js.map +1 -0
- package/dist/esm/eventListeners/annotations/annotationCompletedListener.js +9 -0
- package/dist/esm/eventListeners/annotations/annotationCompletedListener.js.map +1 -0
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +153 -0
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -0
- package/dist/esm/eventListeners/annotations/contourSegmentation/index.js +2 -0
- package/dist/esm/eventListeners/annotations/contourSegmentation/index.js.map +1 -0
- package/dist/esm/eventListeners/annotations/index.js +2 -1
- package/dist/esm/eventListeners/annotations/index.js.map +1 -1
- package/dist/esm/eventListeners/index.js +2 -2
- package/dist/esm/eventListeners/index.js.map +1 -1
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +61 -0
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js.map +1 -0
- package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js +5 -53
- package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js.map +1 -1
- package/dist/esm/init.js +3 -1
- package/dist/esm/init.js.map +1 -1
- package/dist/esm/stateManagement/annotation/helpers/state.js +19 -1
- package/dist/esm/stateManagement/annotation/helpers/state.js.map +1 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.js +3 -0
- package/dist/esm/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/esm/store/addTool.js +4 -0
- package/dist/esm/store/addTool.js.map +1 -1
- package/dist/esm/store/index.js +2 -2
- package/dist/esm/store/index.js.map +1 -1
- package/dist/esm/store/removeEnabledElement.js +1 -2
- package/dist/esm/store/removeEnabledElement.js.map +1 -1
- package/dist/esm/tools/AdvancedMagnifyTool.js +4 -11
- package/dist/esm/tools/AdvancedMagnifyTool.js.map +1 -1
- package/dist/esm/tools/annotation/AngleTool.js +6 -19
- package/dist/esm/tools/annotation/AngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js +10 -29
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js.map +1 -1
- package/dist/esm/tools/annotation/BidirectionalTool.js +8 -23
- package/dist/esm/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/esm/tools/annotation/CircleROITool.js +8 -23
- package/dist/esm/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/CobbAngleTool.js +6 -19
- package/dist/esm/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +8 -23
- package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/esm/tools/annotation/KeyImageTool.js +6 -13
- package/dist/esm/tools/annotation/KeyImageTool.js.map +1 -1
- package/dist/esm/tools/annotation/LengthTool.js +6 -19
- package/dist/esm/tools/annotation/LengthTool.js.map +1 -1
- package/dist/esm/tools/annotation/LivewireContourTool.js +31 -23
- package/dist/esm/tools/annotation/LivewireContourTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js +11 -0
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +7 -23
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/esm/tools/annotation/ProbeTool.js +9 -24
- package/dist/esm/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.js +9 -23
- package/dist/esm/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/SplineROITool.js +26 -9
- package/dist/esm/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js +6 -19
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +7 -6
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js +8 -5
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/editLoopCommon.js +8 -8
- package/dist/esm/tools/annotation/planarFreehandROITool/editLoopCommon.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js +6 -5
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
- package/dist/esm/tools/base/ContourBaseTool.js.map +1 -1
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js +13 -1
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +4 -10
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js.map +1 -1
- package/dist/esm/tools/segmentation/RectangleROIThresholdTool.js +4 -10
- package/dist/esm/tools/segmentation/RectangleROIThresholdTool.js.map +1 -1
- package/dist/esm/types/AnnotationRenderContext.js +2 -0
- package/dist/esm/types/AnnotationRenderContext.js.map +1 -0
- package/dist/esm/utilities/contourSegmentation/areSameSegment.js +9 -0
- package/dist/esm/utilities/contourSegmentation/areSameSegment.js.map +1 -0
- package/dist/esm/utilities/contourSegmentation/index.js +3 -0
- package/dist/esm/utilities/contourSegmentation/index.js.map +1 -0
- package/dist/esm/utilities/contourSegmentation/isContourSegmentationAnnotation.js +4 -0
- package/dist/esm/utilities/contourSegmentation/isContourSegmentationAnnotation.js.map +1 -0
- package/dist/esm/utilities/contours/areCoplanarContours.js +16 -0
- package/dist/esm/utilities/contours/areCoplanarContours.js.map +1 -0
- package/dist/esm/utilities/contours/index.js +2 -1
- package/dist/esm/utilities/contours/index.js.map +1 -1
- package/dist/esm/utilities/contours/reverseIfAntiClockwise.js +3 -22
- package/dist/esm/utilities/contours/reverseIfAntiClockwise.js.map +1 -1
- package/dist/esm/utilities/math/aabb/index.js +1 -0
- package/dist/esm/utilities/math/aabb/index.js.map +1 -1
- package/dist/esm/utilities/math/aabb/intersectAABB.js +7 -0
- package/dist/esm/utilities/math/aabb/intersectAABB.js.map +1 -0
- package/dist/esm/utilities/math/point/distanceToPointSquared.js +4 -1
- package/dist/esm/utilities/math/point/distanceToPointSquared.js.map +1 -1
- package/dist/esm/utilities/math/polyline/areLineSegmentsIntersecting.js +56 -0
- package/dist/esm/utilities/math/polyline/areLineSegmentsIntersecting.js.map +1 -0
- package/dist/esm/utilities/math/polyline/combinePolyline.js +187 -0
- package/dist/esm/utilities/math/polyline/combinePolyline.js.map +1 -0
- package/dist/esm/utilities/math/polyline/containsPoint.js +30 -0
- package/dist/esm/utilities/math/polyline/containsPoint.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getAABB.js +15 -0
- package/dist/esm/utilities/math/polyline/getAABB.js.map +1 -0
- package/dist/esm/utilities/math/polyline/{calculateAreaOfPoints.js → getArea.js} +2 -2
- package/dist/esm/utilities/math/polyline/getArea.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getClosestLineSegmentIntersection.js +45 -0
- package/dist/esm/utilities/math/polyline/getClosestLineSegmentIntersection.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.js +22 -0
- package/dist/esm/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js +14 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsIndexes.js +16 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsIndexes.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentsIntersection.js +18 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentsIntersection.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getNormal2.js +6 -0
- package/dist/esm/utilities/math/polyline/getNormal2.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getNormal3.js +26 -0
- package/dist/esm/utilities/math/polyline/getNormal3.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getSignedArea.js +17 -0
- package/dist/esm/utilities/math/polyline/getSignedArea.js.map +1 -0
- package/dist/esm/utilities/math/polyline/index.js +14 -3
- package/dist/esm/utilities/math/polyline/index.js.map +1 -1
- package/dist/esm/utilities/math/polyline/intersectPolyline.js +14 -0
- package/dist/esm/utilities/math/polyline/intersectPolyline.js.map +1 -0
- package/dist/esm/utilities/math/polyline/isClosed.js +13 -0
- package/dist/esm/utilities/math/polyline/isClosed.js.map +1 -0
- package/dist/types/eventListeners/annotations/annotationCompletedListener.d.ts +3 -0
- package/dist/types/eventListeners/annotations/annotationCompletedListener.d.ts.map +1 -0
- package/dist/types/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts +3 -0
- package/dist/types/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts.map +1 -0
- package/dist/types/eventListeners/annotations/contourSegmentation/index.d.ts +2 -0
- package/dist/types/eventListeners/annotations/contourSegmentation/index.d.ts.map +1 -0
- package/dist/types/eventListeners/annotations/index.d.ts +2 -1
- package/dist/types/eventListeners/annotations/index.d.ts.map +1 -1
- package/dist/types/eventListeners/index.d.ts +2 -2
- package/dist/types/eventListeners/index.d.ts.map +1 -1
- package/dist/types/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.d.ts +4 -0
- package/dist/types/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.d.ts.map +1 -0
- package/dist/types/eventListeners/segmentation/segmentationDataModifiedEventListener.d.ts.map +1 -1
- package/dist/types/init.d.ts.map +1 -1
- package/dist/types/stateManagement/annotation/helpers/state.d.ts +3 -1
- package/dist/types/stateManagement/annotation/helpers/state.d.ts.map +1 -1
- package/dist/types/store/ToolGroupManager/ToolGroup.d.ts +1 -0
- package/dist/types/store/ToolGroupManager/ToolGroup.d.ts.map +1 -1
- package/dist/types/store/addTool.d.ts +1 -0
- package/dist/types/store/addTool.d.ts.map +1 -1
- package/dist/types/store/index.d.ts +2 -2
- package/dist/types/store/index.d.ts.map +1 -1
- package/dist/types/store/removeEnabledElement.d.ts.map +1 -1
- package/dist/types/tools/AdvancedMagnifyTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/AngleTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/ArrowAnnotateTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/BidirectionalTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/CircleROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/CobbAngleTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/EllipticalROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/KeyImageTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/LengthTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/LivewireContourTool.d.ts +4 -1
- package/dist/types/tools/annotation/LivewireContourTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts +2 -1
- package/dist/types/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts +2 -10
- package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/ProbeTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/RectangleROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/SplineROITool.d.ts +8 -9
- package/dist/types/tools/annotation/SplineROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/UltrasoundDirectionalTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/closedContourEditLoop.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/drawLoop.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/editLoopCommon.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/openContourEditLoop.d.ts.map +1 -1
- package/dist/types/tools/base/ContourBaseTool.d.ts +2 -8
- package/dist/types/tools/base/ContourBaseTool.d.ts.map +1 -1
- package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts +3 -2
- package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/RectangleROIStartEndThresholdTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/RectangleROIThresholdTool.d.ts.map +1 -1
- package/dist/types/types/AnnotationRenderContext.d.ts +12 -0
- package/dist/types/types/AnnotationRenderContext.d.ts.map +1 -0
- package/dist/types/types/IToolGroup.d.ts +2 -1
- package/dist/types/types/IToolGroup.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utilities/contourSegmentation/areSameSegment.d.ts +3 -0
- package/dist/types/utilities/contourSegmentation/areSameSegment.d.ts.map +1 -0
- package/dist/types/utilities/contourSegmentation/index.d.ts +3 -0
- package/dist/types/utilities/contourSegmentation/index.d.ts.map +1 -0
- package/dist/types/utilities/contourSegmentation/isContourSegmentationAnnotation.d.ts +4 -0
- package/dist/types/utilities/contourSegmentation/isContourSegmentationAnnotation.d.ts.map +1 -0
- package/dist/types/utilities/contours/areCoplanarContours.d.ts +3 -0
- package/dist/types/utilities/contours/areCoplanarContours.d.ts.map +1 -0
- package/dist/types/utilities/contours/index.d.ts +2 -1
- package/dist/types/utilities/contours/index.d.ts.map +1 -1
- package/dist/types/utilities/contours/reverseIfAntiClockwise.d.ts.map +1 -1
- package/dist/types/utilities/math/aabb/index.d.ts +1 -0
- package/dist/types/utilities/math/aabb/index.d.ts.map +1 -1
- package/dist/types/utilities/math/aabb/intersectAABB.d.ts +3 -0
- package/dist/types/utilities/math/aabb/intersectAABB.d.ts.map +1 -0
- package/dist/types/utilities/math/point/distanceToPointSquared.d.ts.map +1 -1
- package/dist/types/utilities/math/polyline/areLineSegmentsIntersecting.d.ts +3 -0
- package/dist/types/utilities/math/polyline/areLineSegmentsIntersecting.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/combinePolyline.d.ts +5 -0
- package/dist/types/utilities/math/polyline/combinePolyline.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/containsPoint.d.ts +3 -0
- package/dist/types/utilities/math/polyline/containsPoint.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getAABB.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getAABB.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getArea.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getArea.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getClosestLineSegmentIntersection.d.ts +6 -0
- package/dist/types/utilities/math/polyline/getClosestLineSegmentIntersection.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getLineSegmentIntersectionsIndexes.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getLineSegmentIntersectionsIndexes.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getLineSegmentsIntersection.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getLineSegmentsIntersection.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getNormal2.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getNormal2.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getNormal3.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getNormal3.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getSignedArea.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getSignedArea.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/index.d.ts +14 -3
- package/dist/types/utilities/math/polyline/index.d.ts.map +1 -1
- package/dist/types/utilities/math/polyline/intersectPolyline.d.ts +3 -0
- package/dist/types/utilities/math/polyline/intersectPolyline.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/isClosed.d.ts +3 -0
- package/dist/types/utilities/math/polyline/isClosed.d.ts.map +1 -0
- package/dist/umd/index.js +1 -2
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/eventListeners/annotations/annotationCompletedListener.ts +13 -0
- package/src/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.ts +273 -0
- package/src/eventListeners/annotations/contourSegmentation/index.ts +1 -0
- package/src/eventListeners/annotations/index.ts +6 -1
- package/src/eventListeners/index.ts +2 -0
- package/src/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.ts +117 -0
- package/src/eventListeners/segmentation/segmentationDataModifiedEventListener.ts +5 -99
- package/src/init.ts +12 -1
- package/src/stateManagement/annotation/helpers/state.ts +42 -2
- package/src/store/ToolGroupManager/ToolGroup.ts +10 -0
- package/src/store/addTool.ts +11 -0
- package/src/store/index.ts +2 -1
- package/src/store/removeEnabledElement.ts +2 -1
- package/src/tools/AdvancedMagnifyTool.ts +4 -21
- package/src/tools/annotation/AngleTool.ts +8 -32
- package/src/tools/annotation/ArrowAnnotateTool.ts +12 -45
- package/src/tools/annotation/BidirectionalTool.ts +11 -39
- package/src/tools/annotation/CircleROITool.ts +10 -34
- package/src/tools/annotation/CobbAngleTool.ts +9 -32
- package/src/tools/annotation/EllipticalROITool.ts +10 -34
- package/src/tools/annotation/KeyImageTool.ts +9 -23
- package/src/tools/annotation/LengthTool.ts +9 -33
- package/src/tools/annotation/LivewireContourTool.ts +58 -33
- package/src/tools/annotation/PlanarFreehandContourSegmentationTool.ts +22 -1
- package/src/tools/annotation/PlanarFreehandROITool.ts +10 -53
- package/src/tools/annotation/ProbeTool.ts +11 -36
- package/src/tools/annotation/RectangleROITool.ts +11 -33
- package/src/tools/annotation/SplineROITool.ts +53 -24
- package/src/tools/annotation/UltrasoundDirectionalTool.ts +8 -29
- package/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts +9 -11
- package/src/tools/annotation/planarFreehandROITool/drawLoop.ts +8 -5
- package/src/tools/annotation/planarFreehandROITool/editLoopCommon.ts +9 -8
- package/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts +7 -6
- package/src/tools/base/ContourBaseTool.ts +5 -8
- package/src/tools/base/ContourSegmentationBaseTool.ts +29 -6
- package/src/tools/segmentation/RectangleROIStartEndThresholdTool.ts +3 -13
- package/src/tools/segmentation/RectangleROIThresholdTool.ts +3 -14
- package/src/types/AnnotationRenderContext.ts +13 -0
- package/src/types/IToolGroup.ts +3 -1
- package/src/types/index.ts +3 -0
- package/src/utilities/contourSegmentation/areSameSegment.ts +24 -0
- package/src/utilities/contourSegmentation/index.ts +2 -0
- package/src/utilities/contourSegmentation/isContourSegmentationAnnotation.ts +8 -0
- package/src/utilities/contours/areCoplanarContours.ts +39 -0
- package/src/utilities/contours/index.ts +2 -0
- package/src/utilities/contours/reverseIfAntiClockwise.ts +6 -25
- package/src/utilities/math/aabb/index.ts +1 -0
- package/src/utilities/math/aabb/intersectAABB.ts +19 -0
- package/src/utilities/math/point/distanceToPointSquared.ts +6 -1
- package/src/utilities/math/polyline/areLineSegmentsIntersecting.ts +118 -0
- package/src/utilities/math/polyline/combinePolyline.ts +350 -0
- package/src/utilities/math/polyline/containsPoint.ts +63 -0
- package/src/utilities/math/polyline/getAABB.ts +20 -0
- package/src/utilities/math/polyline/{calculateAreaOfPoints.ts → getArea.ts} +1 -1
- package/src/utilities/math/polyline/getClosestLineSegmentIntersection.ts +72 -0
- package/src/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.ts +42 -0
- package/src/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.ts +30 -0
- package/src/utilities/math/polyline/getLineSegmentIntersectionsIndexes.ts +35 -0
- package/src/utilities/math/polyline/getLineSegmentsIntersection.ts +47 -0
- package/src/utilities/math/polyline/getNormal2.ts +17 -0
- package/src/utilities/math/polyline/getNormal3.ts +53 -0
- package/src/utilities/math/polyline/getSignedArea.ts +47 -0
- package/src/utilities/math/polyline/index.ts +27 -8
- package/src/utilities/math/polyline/intersectPolyline.ts +34 -0
- package/src/utilities/math/polyline/isClosed.ts +26 -0
- package/dist/cjs/utilities/math/polyline/calculateAreaOfPoints.d.ts +0 -2
- package/dist/cjs/utilities/math/polyline/calculateAreaOfPoints.js.map +0 -1
- package/dist/cjs/utilities/math/polyline/getIntersectionWithPolyline.d.ts +0 -9
- package/dist/cjs/utilities/math/polyline/getIntersectionWithPolyline.js +0 -160
- package/dist/cjs/utilities/math/polyline/getIntersectionWithPolyline.js.map +0 -1
- package/dist/cjs/utilities/math/polyline/pointInPolyline.d.ts +0 -2
- package/dist/cjs/utilities/math/polyline/pointInPolyline.js +0 -15
- package/dist/cjs/utilities/math/polyline/pointInPolyline.js.map +0 -1
- package/dist/esm/utilities/math/polyline/calculateAreaOfPoints.js.map +0 -1
- package/dist/esm/utilities/math/polyline/getIntersectionWithPolyline.js +0 -154
- package/dist/esm/utilities/math/polyline/getIntersectionWithPolyline.js.map +0 -1
- package/dist/esm/utilities/math/polyline/pointInPolyline.js +0 -12
- package/dist/esm/utilities/math/polyline/pointInPolyline.js.map +0 -1
- package/dist/types/utilities/math/polyline/calculateAreaOfPoints.d.ts +0 -3
- package/dist/types/utilities/math/polyline/calculateAreaOfPoints.d.ts.map +0 -1
- package/dist/types/utilities/math/polyline/getIntersectionWithPolyline.d.ts +0 -10
- package/dist/types/utilities/math/polyline/getIntersectionWithPolyline.d.ts.map +0 -1
- package/dist/types/utilities/math/polyline/pointInPolyline.d.ts +0 -3
- package/dist/types/utilities/math/polyline/pointInPolyline.d.ts.map +0 -1
- package/dist/umd/index.js.LICENSE.txt +0 -6
- package/src/utilities/math/polyline/getIntersectionWithPolyline.ts +0 -275
- package/src/utilities/math/polyline/pointInPolyline.ts +0 -19
|
@@ -3,8 +3,6 @@ import { AnnotationTool } from '../base';
|
|
|
3
3
|
import {
|
|
4
4
|
getEnabledElement,
|
|
5
5
|
VolumeViewport,
|
|
6
|
-
eventTarget,
|
|
7
|
-
triggerEvent,
|
|
8
6
|
utilities as csUtils,
|
|
9
7
|
} from '@cornerstonejs/core';
|
|
10
8
|
import type { Types } from '@cornerstonejs/core';
|
|
@@ -22,6 +20,10 @@ import {
|
|
|
22
20
|
} from '../../stateManagement/annotation/annotationState';
|
|
23
21
|
import { isAnnotationLocked } from '../../stateManagement/annotation/annotationLocking';
|
|
24
22
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
23
|
+
import {
|
|
24
|
+
triggerAnnotationCompleted,
|
|
25
|
+
triggerAnnotationModified,
|
|
26
|
+
} from '../../stateManagement/annotation/helpers/state';
|
|
25
27
|
import {
|
|
26
28
|
drawCircle as drawCircleSvg,
|
|
27
29
|
drawEllipseByCoordinates as drawEllipseSvg,
|
|
@@ -51,10 +53,6 @@ import {
|
|
|
51
53
|
} from '../../types';
|
|
52
54
|
import { EllipticalROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
53
55
|
|
|
54
|
-
import {
|
|
55
|
-
AnnotationCompletedEventDetail,
|
|
56
|
-
AnnotationModifiedEventDetail,
|
|
57
|
-
} from '../../types/EventTypes';
|
|
58
56
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
59
57
|
import { pointInShapeCallback } from '../../utilities/';
|
|
60
58
|
import { StyleSpecifier } from '../../types/AnnotationStyle';
|
|
@@ -446,8 +444,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
446
444
|
|
|
447
445
|
resetElementCursor(element);
|
|
448
446
|
|
|
449
|
-
const
|
|
450
|
-
const { renderingEngine } = enabledElement;
|
|
447
|
+
const { renderingEngine } = getEnabledElement(element);
|
|
451
448
|
|
|
452
449
|
this.editData = null;
|
|
453
450
|
this.isDrawing = false;
|
|
@@ -462,13 +459,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
462
459
|
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
|
|
463
460
|
|
|
464
461
|
if (newAnnotation) {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
const eventDetail: AnnotationCompletedEventDetail = {
|
|
468
|
-
annotation,
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
462
|
+
triggerAnnotationCompleted(annotation);
|
|
472
463
|
}
|
|
473
464
|
};
|
|
474
465
|
|
|
@@ -652,8 +643,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
652
643
|
annotation.highlighted = false;
|
|
653
644
|
data.handles.activeHandleIndex = null;
|
|
654
645
|
|
|
655
|
-
const
|
|
656
|
-
const { renderingEngine } = enabledElement;
|
|
646
|
+
const { renderingEngine } = getEnabledElement(element);
|
|
657
647
|
|
|
658
648
|
triggerAnnotationRenderForViewportIds(
|
|
659
649
|
renderingEngine,
|
|
@@ -661,13 +651,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
661
651
|
);
|
|
662
652
|
|
|
663
653
|
if (newAnnotation) {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
const eventDetail: AnnotationCompletedEventDetail = {
|
|
667
|
-
annotation,
|
|
668
|
-
};
|
|
669
|
-
|
|
670
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
654
|
+
triggerAnnotationCompleted(annotation);
|
|
671
655
|
}
|
|
672
656
|
|
|
673
657
|
this.editData = null;
|
|
@@ -995,7 +979,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
995
979
|
enabledElement
|
|
996
980
|
) => {
|
|
997
981
|
const data = annotation.data;
|
|
998
|
-
const {
|
|
982
|
+
const { element } = viewport;
|
|
999
983
|
|
|
1000
984
|
const { points } = data.handles;
|
|
1001
985
|
|
|
@@ -1136,15 +1120,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
1136
1120
|
annotation.invalidated = false;
|
|
1137
1121
|
|
|
1138
1122
|
// Dispatching annotation modified
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
const eventDetail: AnnotationModifiedEventDetail = {
|
|
1142
|
-
annotation,
|
|
1143
|
-
viewportId,
|
|
1144
|
-
renderingEngineId,
|
|
1145
|
-
};
|
|
1146
|
-
|
|
1147
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
1123
|
+
triggerAnnotationModified(annotation, element);
|
|
1148
1124
|
|
|
1149
1125
|
return cachedStats;
|
|
1150
1126
|
};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { Events } from '../../enums';
|
|
2
|
-
import {
|
|
3
|
-
getEnabledElement,
|
|
4
|
-
triggerEvent,
|
|
5
|
-
eventTarget,
|
|
6
|
-
utilities as csUtils,
|
|
7
|
-
} from '@cornerstonejs/core';
|
|
2
|
+
import { getEnabledElement, utilities as csUtils } from '@cornerstonejs/core';
|
|
8
3
|
import type { Types } from '@cornerstonejs/core';
|
|
9
4
|
|
|
10
5
|
import { AnnotationTool } from '../base';
|
|
@@ -14,11 +9,14 @@ import {
|
|
|
14
9
|
removeAnnotation,
|
|
15
10
|
} from '../../stateManagement/annotation/annotationState';
|
|
16
11
|
|
|
12
|
+
import {
|
|
13
|
+
triggerAnnotationCompleted,
|
|
14
|
+
triggerAnnotationModified,
|
|
15
|
+
} from '../../stateManagement/annotation/helpers/state';
|
|
17
16
|
import { drawArrow as drawArrowSvg } from '../../drawingSvg';
|
|
18
17
|
import { state } from '../../store';
|
|
19
18
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
20
19
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
21
|
-
import { AnnotationCompletedEventDetail } from '../../types/EventTypes';
|
|
22
20
|
|
|
23
21
|
import { resetElementCursor } from '../../cursors/elementCursor';
|
|
24
22
|
|
|
@@ -146,13 +144,7 @@ class KeyImageTool extends AnnotationTool {
|
|
|
146
144
|
}
|
|
147
145
|
annotation.data.text = text;
|
|
148
146
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const eventDetail: AnnotationCompletedEventDetail = {
|
|
152
|
-
annotation,
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
147
|
+
triggerAnnotationCompleted(annotation);
|
|
156
148
|
|
|
157
149
|
triggerAnnotationRenderForViewportIds(
|
|
158
150
|
renderingEngine,
|
|
@@ -276,8 +268,8 @@ class KeyImageTool extends AnnotationTool {
|
|
|
276
268
|
_doneChangingTextCallback(element, annotation, updatedText): void {
|
|
277
269
|
annotation.data.text = updatedText;
|
|
278
270
|
|
|
279
|
-
const
|
|
280
|
-
|
|
271
|
+
const enabledElement = getEnabledElement(element);
|
|
272
|
+
const { renderingEngine } = enabledElement;
|
|
281
273
|
|
|
282
274
|
const viewportIdsToRender = getViewportIdsWithToolToRender(
|
|
283
275
|
element,
|
|
@@ -286,13 +278,7 @@ class KeyImageTool extends AnnotationTool {
|
|
|
286
278
|
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
|
|
287
279
|
|
|
288
280
|
// Dispatching annotation modified
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
triggerEvent(eventTarget, eventType, {
|
|
292
|
-
annotation,
|
|
293
|
-
viewportId,
|
|
294
|
-
renderingEngineId,
|
|
295
|
-
});
|
|
281
|
+
triggerAnnotationModified(annotation, element);
|
|
296
282
|
}
|
|
297
283
|
|
|
298
284
|
_activateModify = (element: HTMLDivElement) => {
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { Events } from '../../enums';
|
|
2
|
-
import {
|
|
3
|
-
getEnabledElement,
|
|
4
|
-
triggerEvent,
|
|
5
|
-
eventTarget,
|
|
6
|
-
utilities as csUtils,
|
|
7
|
-
} from '@cornerstonejs/core';
|
|
2
|
+
import { getEnabledElement, utilities as csUtils } from '@cornerstonejs/core';
|
|
8
3
|
import type { Types } from '@cornerstonejs/core';
|
|
9
4
|
|
|
10
5
|
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
@@ -18,6 +13,10 @@ import {
|
|
|
18
13
|
} from '../../stateManagement/annotation/annotationState';
|
|
19
14
|
import { isAnnotationLocked } from '../../stateManagement/annotation/annotationLocking';
|
|
20
15
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
16
|
+
import {
|
|
17
|
+
triggerAnnotationCompleted,
|
|
18
|
+
triggerAnnotationModified,
|
|
19
|
+
} from '../../stateManagement/annotation/helpers/state';
|
|
21
20
|
import * as lineSegment from '../../utilities/math/line';
|
|
22
21
|
|
|
23
22
|
import {
|
|
@@ -29,10 +28,6 @@ import { state } from '../../store';
|
|
|
29
28
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
30
29
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
31
30
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
32
|
-
import {
|
|
33
|
-
AnnotationCompletedEventDetail,
|
|
34
|
-
AnnotationModifiedEventDetail,
|
|
35
|
-
} from '../../types/EventTypes';
|
|
36
31
|
|
|
37
32
|
import {
|
|
38
33
|
resetElementCursor,
|
|
@@ -366,13 +361,7 @@ class LengthTool extends AnnotationTool {
|
|
|
366
361
|
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
|
|
367
362
|
|
|
368
363
|
if (newAnnotation) {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
const eventDetail: AnnotationCompletedEventDetail = {
|
|
372
|
-
annotation,
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
364
|
+
triggerAnnotationCompleted(annotation);
|
|
376
365
|
}
|
|
377
366
|
|
|
378
367
|
this.editData = null;
|
|
@@ -454,13 +443,7 @@ class LengthTool extends AnnotationTool {
|
|
|
454
443
|
);
|
|
455
444
|
|
|
456
445
|
if (newAnnotation) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
const eventDetail: AnnotationCompletedEventDetail = {
|
|
460
|
-
annotation,
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
446
|
+
triggerAnnotationCompleted(annotation);
|
|
464
447
|
}
|
|
465
448
|
|
|
466
449
|
this.editData = null;
|
|
@@ -792,7 +775,7 @@ class LengthTool extends AnnotationTool {
|
|
|
792
775
|
|
|
793
776
|
_calculateCachedStats(annotation, renderingEngine, enabledElement) {
|
|
794
777
|
const data = annotation.data;
|
|
795
|
-
const {
|
|
778
|
+
const { element } = enabledElement.viewport;
|
|
796
779
|
|
|
797
780
|
const worldPos1 = data.handles.points[0];
|
|
798
781
|
const worldPos2 = data.handles.points[1];
|
|
@@ -840,14 +823,7 @@ class LengthTool extends AnnotationTool {
|
|
|
840
823
|
annotation.invalidated = false;
|
|
841
824
|
|
|
842
825
|
// Dispatching annotation modified
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
const eventDetail: AnnotationModifiedEventDetail = {
|
|
846
|
-
annotation,
|
|
847
|
-
viewportId,
|
|
848
|
-
renderingEngineId,
|
|
849
|
-
};
|
|
850
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
826
|
+
triggerAnnotationModified(annotation, element);
|
|
851
827
|
|
|
852
828
|
return cachedStats;
|
|
853
829
|
}
|
|
@@ -2,8 +2,8 @@ import { vec3 } from 'gl-matrix';
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
getEnabledElement,
|
|
5
|
-
eventTarget,
|
|
6
5
|
triggerEvent,
|
|
6
|
+
eventTarget,
|
|
7
7
|
utilities as csUtils,
|
|
8
8
|
VolumeViewport,
|
|
9
9
|
} from '@cornerstonejs/core';
|
|
@@ -24,7 +24,10 @@ import type {
|
|
|
24
24
|
import { math, triggerAnnotationRenderForViewportIds } from '../../utilities';
|
|
25
25
|
import findHandlePolylineIndex from '../../utilities/contours/findHandlePolylineIndex';
|
|
26
26
|
import { LivewireContourAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
AnnotationCompletedEventDetail,
|
|
29
|
+
AnnotationModifiedEventDetail,
|
|
30
|
+
} from '../../types/EventTypes';
|
|
28
31
|
import reverseIfAntiClockwise from '../../utilities/contours/reverseIfAntiClockwise';
|
|
29
32
|
|
|
30
33
|
import { LivewireScissors } from '../../utilities/livewire/LivewireScissors';
|
|
@@ -369,25 +372,66 @@ class LivewireContourTool extends ContourSegmentationBaseTool {
|
|
|
369
372
|
|
|
370
373
|
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
|
|
371
374
|
|
|
372
|
-
const
|
|
373
|
-
?
|
|
374
|
-
:
|
|
375
|
+
const changeType = newAnnotation
|
|
376
|
+
? ChangeTypes.Completed
|
|
377
|
+
: ChangeTypes.HandlesUpdated;
|
|
378
|
+
|
|
379
|
+
this.triggerChangeEvent(annotation, enabledElement, changeType);
|
|
380
|
+
|
|
381
|
+
this.editData = null;
|
|
382
|
+
this.scissors = null;
|
|
383
|
+
this.scissorsRight = null;
|
|
384
|
+
this.isDrawing = false;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Triggers an annotation completed event.
|
|
389
|
+
*/
|
|
390
|
+
triggerAnnotationCompleted = (
|
|
391
|
+
annotation: LivewireContourAnnotation
|
|
392
|
+
): void => {
|
|
393
|
+
const eventType = Events.ANNOTATION_COMPLETED;
|
|
394
|
+
const eventDetail: AnnotationCompletedEventDetail = {
|
|
395
|
+
annotation,
|
|
396
|
+
changeType: ChangeTypes.Completed,
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
triggerEvent(eventTarget, eventType, eventDetail);
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Triggers an annotation modified event.
|
|
404
|
+
*/
|
|
405
|
+
triggerAnnotationModified = (
|
|
406
|
+
annotation: LivewireContourAnnotation,
|
|
407
|
+
enabledElement: Types.IEnabledElement,
|
|
408
|
+
changeType = ChangeTypes.StatsUpdated
|
|
409
|
+
): void => {
|
|
375
410
|
const { viewportId, renderingEngineId } = enabledElement;
|
|
376
|
-
const
|
|
411
|
+
const eventType = Events.ANNOTATION_MODIFIED;
|
|
412
|
+
const eventDetail: AnnotationModifiedEventDetail = {
|
|
377
413
|
annotation,
|
|
378
414
|
viewportId,
|
|
379
415
|
renderingEngineId,
|
|
380
|
-
changeType
|
|
381
|
-
? ChangeTypes.Completed
|
|
382
|
-
: ChangeTypes.HandlesUpdated,
|
|
416
|
+
changeType,
|
|
383
417
|
};
|
|
384
418
|
|
|
385
|
-
triggerEvent(eventTarget, eventType,
|
|
419
|
+
triggerEvent(eventTarget, eventType, eventDetail);
|
|
420
|
+
};
|
|
386
421
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
422
|
+
/**
|
|
423
|
+
* Triggers an annotation complete or modified event based on changeType.
|
|
424
|
+
*/
|
|
425
|
+
triggerChangeEvent = (
|
|
426
|
+
annotation: LivewireContourAnnotation,
|
|
427
|
+
enabledElement: Types.IEnabledElement,
|
|
428
|
+
changeType = ChangeTypes.StatsUpdated
|
|
429
|
+
): void => {
|
|
430
|
+
if (changeType === ChangeTypes.Completed) {
|
|
431
|
+
this.triggerAnnotationCompleted(annotation);
|
|
432
|
+
} else {
|
|
433
|
+
this.triggerAnnotationModified(annotation, enabledElement, changeType);
|
|
434
|
+
}
|
|
391
435
|
};
|
|
392
436
|
|
|
393
437
|
private _mouseDownCallback = (evt: EventTypes.InteractionEventType): void => {
|
|
@@ -671,25 +715,6 @@ class LivewireContourTool extends ContourSegmentationBaseTool {
|
|
|
671
715
|
return annotation.annotationUID;
|
|
672
716
|
};
|
|
673
717
|
|
|
674
|
-
/**
|
|
675
|
-
* Triggers an annotation modified event.
|
|
676
|
-
*/
|
|
677
|
-
triggerAnnotationModified = (
|
|
678
|
-
annotation: LivewireContourAnnotation,
|
|
679
|
-
enabledElement: Types.IEnabledElement
|
|
680
|
-
): void => {
|
|
681
|
-
const { viewportId, renderingEngineId } = enabledElement;
|
|
682
|
-
const eventType = Events.ANNOTATION_MODIFIED;
|
|
683
|
-
|
|
684
|
-
const eventDetail: AnnotationModifiedEventDetail = {
|
|
685
|
-
annotation,
|
|
686
|
-
viewportId,
|
|
687
|
-
renderingEngineId,
|
|
688
|
-
};
|
|
689
|
-
|
|
690
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
691
|
-
};
|
|
692
|
-
|
|
693
718
|
private _activateModify = (element) => {
|
|
694
719
|
state.isInteractingWithTool = true;
|
|
695
720
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { SplineContourSegmentationAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
1
2
|
import { utilities } from '@cornerstonejs/core';
|
|
2
|
-
import { PublicToolProps } from '../../types';
|
|
3
|
+
import type { PublicToolProps, AnnotationRenderContext } from '../../types';
|
|
3
4
|
import PlanarFreehandROITool from './PlanarFreehandROITool';
|
|
5
|
+
import { triggerSegmentationDataModified } from '../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
4
6
|
|
|
5
7
|
class PlanarFreehandContourSegmentationTool extends PlanarFreehandROITool {
|
|
6
8
|
static toolName;
|
|
@@ -28,6 +30,25 @@ class PlanarFreehandContourSegmentationTool extends PlanarFreehandROITool {
|
|
|
28
30
|
// Re-enable contour segmentation behavior disabled by PlanarFreehandROITool
|
|
29
31
|
return true;
|
|
30
32
|
}
|
|
33
|
+
|
|
34
|
+
protected renderAnnotationInstance(
|
|
35
|
+
renderContext: AnnotationRenderContext
|
|
36
|
+
): boolean {
|
|
37
|
+
const { annotation } = renderContext;
|
|
38
|
+
const { invalidated } = annotation;
|
|
39
|
+
const renderResult = super.renderAnnotationInstance(renderContext);
|
|
40
|
+
|
|
41
|
+
// Trigger the event only for invalid annotations
|
|
42
|
+
if (invalidated) {
|
|
43
|
+
const { segmentationId } = (<SplineContourSegmentationAnnotation>(
|
|
44
|
+
annotation
|
|
45
|
+
)).data.segmentation;
|
|
46
|
+
|
|
47
|
+
triggerSegmentationDataModified(segmentationId);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return renderResult;
|
|
51
|
+
}
|
|
31
52
|
}
|
|
32
53
|
|
|
33
54
|
PlanarFreehandContourSegmentationTool.toolName =
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CONSTANTS,
|
|
3
3
|
getEnabledElement,
|
|
4
|
-
triggerEvent,
|
|
5
|
-
eventTarget,
|
|
6
4
|
VolumeViewport,
|
|
7
5
|
utilities as csUtils,
|
|
8
6
|
} from '@cornerstonejs/core';
|
|
@@ -14,7 +12,6 @@ import {
|
|
|
14
12
|
getCalibratedScale,
|
|
15
13
|
} from '../../utilities/getCalibratedUnits';
|
|
16
14
|
import { roundNumber } from '../../utilities';
|
|
17
|
-
import { Events } from '../../enums';
|
|
18
15
|
import { polyline } from '../../utilities/math';
|
|
19
16
|
import { filterAnnotationsForDisplay } from '../../utilities/planar';
|
|
20
17
|
import throttle from '../../utilities/throttle';
|
|
@@ -26,10 +23,6 @@ import registerClosedContourEditLoop from './planarFreehandROITool/closedContour
|
|
|
26
23
|
import registerOpenContourEditLoop from './planarFreehandROITool/openContourEditLoop';
|
|
27
24
|
import registerOpenContourEndEditLoop from './planarFreehandROITool/openContourEndEditLoop';
|
|
28
25
|
import registerRenderMethods from './planarFreehandROITool/renderMethods';
|
|
29
|
-
import {
|
|
30
|
-
AnnotationCompletedEventDetail,
|
|
31
|
-
AnnotationModifiedEventDetail,
|
|
32
|
-
} from '../../types/EventTypes';
|
|
33
26
|
import type {
|
|
34
27
|
EventTypes,
|
|
35
28
|
ToolHandle,
|
|
@@ -39,13 +32,15 @@ import type {
|
|
|
39
32
|
PublicToolProps,
|
|
40
33
|
ToolProps,
|
|
41
34
|
SVGDrawingHelper,
|
|
35
|
+
AnnotationRenderContext,
|
|
42
36
|
} from '../../types';
|
|
37
|
+
import { triggerAnnotationModified } from '../../stateManagement/annotation/helpers/state';
|
|
43
38
|
import { drawLinkedTextBox } from '../../drawingSvg';
|
|
44
39
|
import { PlanarFreehandROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
45
40
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
46
41
|
import { PlanarFreehandROICommonData } from '../../utilities/math/polyline/planarFreehandROIInternalTypes';
|
|
47
42
|
|
|
48
|
-
import {
|
|
43
|
+
import { getLineSegmentIntersectionsCoordinates } from '../../utilities/math/polyline';
|
|
49
44
|
import pointInShapeCallback from '../../utilities/pointInShapeCallback';
|
|
50
45
|
import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScaled';
|
|
51
46
|
import { getModalityUnit } from '../../utilities/getModalityUnit';
|
|
@@ -403,40 +398,6 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
403
398
|
}
|
|
404
399
|
};
|
|
405
400
|
|
|
406
|
-
/**
|
|
407
|
-
* Triggers an annotation modified event.
|
|
408
|
-
*/
|
|
409
|
-
triggerAnnotationModified = (
|
|
410
|
-
annotation: PlanarFreehandROIAnnotation,
|
|
411
|
-
enabledElement: Types.IEnabledElement
|
|
412
|
-
): void => {
|
|
413
|
-
const { viewportId, renderingEngineId } = enabledElement;
|
|
414
|
-
// Dispatching annotation modified
|
|
415
|
-
const eventType = Events.ANNOTATION_MODIFIED;
|
|
416
|
-
|
|
417
|
-
const eventDetail: AnnotationModifiedEventDetail = {
|
|
418
|
-
annotation,
|
|
419
|
-
viewportId,
|
|
420
|
-
renderingEngineId,
|
|
421
|
-
};
|
|
422
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* Triggers an annotation completed event.
|
|
427
|
-
*/
|
|
428
|
-
triggerAnnotationCompleted = (
|
|
429
|
-
annotation: PlanarFreehandROIAnnotation
|
|
430
|
-
): void => {
|
|
431
|
-
const eventType = Events.ANNOTATION_COMPLETED;
|
|
432
|
-
|
|
433
|
-
const eventDetail: AnnotationCompletedEventDetail = {
|
|
434
|
-
annotation,
|
|
435
|
-
};
|
|
436
|
-
|
|
437
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
438
|
-
};
|
|
439
|
-
|
|
440
401
|
/**
|
|
441
402
|
* @override We need to override this method as the tool doesn't always have
|
|
442
403
|
* `handles`, which means `filterAnnotationsForDisplay` fails inside
|
|
@@ -569,13 +530,9 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
569
530
|
return super.getAnnotationStyle(context);
|
|
570
531
|
}
|
|
571
532
|
|
|
572
|
-
protected renderAnnotationInstance(
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
annotation: Annotation;
|
|
576
|
-
annotationStyle: Record<string, any>;
|
|
577
|
-
svgDrawingHelper: SVGDrawingHelper;
|
|
578
|
-
}): boolean {
|
|
533
|
+
protected renderAnnotationInstance(
|
|
534
|
+
renderContext: AnnotationRenderContext
|
|
535
|
+
): boolean {
|
|
579
536
|
const { enabledElement, targetId, svgDrawingHelper, annotationStyle } =
|
|
580
537
|
renderContext;
|
|
581
538
|
const annotation = renderContext.annotation as PlanarFreehandROIAnnotation;
|
|
@@ -701,6 +658,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
701
658
|
enabledElement
|
|
702
659
|
) => {
|
|
703
660
|
const { data } = annotation;
|
|
661
|
+
const { element } = viewport;
|
|
704
662
|
const { cachedStats } = data;
|
|
705
663
|
const { polyline: points } = data.contour;
|
|
706
664
|
|
|
@@ -737,8 +695,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
737
695
|
const deltaInY = vec3.distance(originalWorldPoint, deltaYPoint);
|
|
738
696
|
|
|
739
697
|
const scale = getCalibratedScale(image);
|
|
740
|
-
let area =
|
|
741
|
-
polyline.calculateAreaOfPoints(canvasCoordinates) / scale / scale;
|
|
698
|
+
let area = polyline.getArea(canvasCoordinates) / scale / scale;
|
|
742
699
|
// Convert from canvas_pixels ^2 to mm^2
|
|
743
700
|
area *= deltaInX * deltaInY;
|
|
744
701
|
|
|
@@ -806,7 +763,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
806
763
|
if (point[1] != curRow) {
|
|
807
764
|
intersectionCounter = 0;
|
|
808
765
|
curRow = point[1];
|
|
809
|
-
intersections =
|
|
766
|
+
intersections = getLineSegmentIntersectionsCoordinates(
|
|
810
767
|
canvasCoordinates,
|
|
811
768
|
point,
|
|
812
769
|
[canvasPosEnd[0], point[1]]
|
|
@@ -866,7 +823,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
866
823
|
};
|
|
867
824
|
}
|
|
868
825
|
|
|
869
|
-
|
|
826
|
+
triggerAnnotationModified(annotation, element);
|
|
870
827
|
|
|
871
828
|
annotation.invalidated = false;
|
|
872
829
|
|
|
@@ -4,8 +4,6 @@ import { vec2 } from 'gl-matrix';
|
|
|
4
4
|
import {
|
|
5
5
|
getEnabledElement,
|
|
6
6
|
VolumeViewport,
|
|
7
|
-
triggerEvent,
|
|
8
|
-
eventTarget,
|
|
9
7
|
utilities as csUtils,
|
|
10
8
|
} from '@cornerstonejs/core';
|
|
11
9
|
import type { Types } from '@cornerstonejs/core';
|
|
@@ -16,6 +14,10 @@ import {
|
|
|
16
14
|
getAnnotations,
|
|
17
15
|
removeAnnotation,
|
|
18
16
|
} from '../../stateManagement/annotation/annotationState';
|
|
17
|
+
import {
|
|
18
|
+
triggerAnnotationCompleted,
|
|
19
|
+
triggerAnnotationModified,
|
|
20
|
+
} from '../../stateManagement/annotation/helpers/state';
|
|
19
21
|
import { getCalibratedProbeUnitsAndValue } from '../../utilities/getCalibratedUnits';
|
|
20
22
|
import {
|
|
21
23
|
drawHandles as drawHandlesSvg,
|
|
@@ -29,10 +31,6 @@ import {
|
|
|
29
31
|
resetElementCursor,
|
|
30
32
|
hideElementCursor,
|
|
31
33
|
} from '../../cursors/elementCursor';
|
|
32
|
-
import {
|
|
33
|
-
AnnotationCompletedEventDetail,
|
|
34
|
-
AnnotationModifiedEventDetail,
|
|
35
|
-
} from '../../types/EventTypes';
|
|
36
34
|
|
|
37
35
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
38
36
|
|
|
@@ -278,10 +276,7 @@ class ProbeTool extends AnnotationTool {
|
|
|
278
276
|
|
|
279
277
|
const { annotation, viewportIdsToRender, newAnnotation } = this.editData;
|
|
280
278
|
|
|
281
|
-
const
|
|
282
|
-
const { renderingEngine } = enabledElement;
|
|
283
|
-
|
|
284
|
-
const { viewportId } = enabledElement;
|
|
279
|
+
const { viewportId, renderingEngine } = getEnabledElement(element);
|
|
285
280
|
this.eventDispatchDetail = {
|
|
286
281
|
viewportId,
|
|
287
282
|
renderingEngineId: renderingEngine.id,
|
|
@@ -304,13 +299,7 @@ class ProbeTool extends AnnotationTool {
|
|
|
304
299
|
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
|
|
305
300
|
|
|
306
301
|
if (newAnnotation) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const eventDetail: AnnotationCompletedEventDetail = {
|
|
310
|
-
annotation,
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
302
|
+
triggerAnnotationCompleted(annotation);
|
|
314
303
|
}
|
|
315
304
|
};
|
|
316
305
|
|
|
@@ -345,8 +334,7 @@ class ProbeTool extends AnnotationTool {
|
|
|
345
334
|
annotation.highlighted = false;
|
|
346
335
|
data.handles.activeHandleIndex = null;
|
|
347
336
|
|
|
348
|
-
const
|
|
349
|
-
const { renderingEngine } = enabledElement;
|
|
337
|
+
const { renderingEngine } = getEnabledElement(element);
|
|
350
338
|
|
|
351
339
|
triggerAnnotationRenderForViewportIds(
|
|
352
340
|
renderingEngine,
|
|
@@ -354,13 +342,7 @@ class ProbeTool extends AnnotationTool {
|
|
|
354
342
|
);
|
|
355
343
|
|
|
356
344
|
if (newAnnotation) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
const eventDetail: AnnotationCompletedEventDetail = {
|
|
360
|
-
annotation,
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
345
|
+
triggerAnnotationCompleted(annotation);
|
|
364
346
|
}
|
|
365
347
|
|
|
366
348
|
this.editData = null;
|
|
@@ -540,7 +522,8 @@ class ProbeTool extends AnnotationTool {
|
|
|
540
522
|
|
|
541
523
|
_calculateCachedStats(annotation, renderingEngine, enabledElement) {
|
|
542
524
|
const data = annotation.data;
|
|
543
|
-
const {
|
|
525
|
+
const { renderingEngineId, viewport } = enabledElement;
|
|
526
|
+
const { element } = viewport;
|
|
544
527
|
|
|
545
528
|
const worldPos = data.handles.points[0];
|
|
546
529
|
const { cachedStats } = data;
|
|
@@ -655,15 +638,7 @@ class ProbeTool extends AnnotationTool {
|
|
|
655
638
|
annotation.invalidated = false;
|
|
656
639
|
|
|
657
640
|
// Dispatching annotation modified
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
const eventDetail: AnnotationModifiedEventDetail = {
|
|
661
|
-
annotation,
|
|
662
|
-
viewportId,
|
|
663
|
-
renderingEngineId,
|
|
664
|
-
};
|
|
665
|
-
|
|
666
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
641
|
+
triggerAnnotationModified(annotation, element);
|
|
667
642
|
}
|
|
668
643
|
|
|
669
644
|
return cachedStats;
|