@cornerstonejs/tools 1.50.3 → 1.51.1
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
|
-
triggerEvent,
|
|
7
|
-
eventTarget,
|
|
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';
|
|
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
|
drawHandles as drawHandlesSvg,
|
|
27
29
|
drawLinkedTextBox as drawLinkedTextBoxSvg,
|
|
@@ -48,10 +50,6 @@ import {
|
|
|
48
50
|
SVGDrawingHelper,
|
|
49
51
|
} from '../../types';
|
|
50
52
|
import { RectangleROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
51
|
-
import {
|
|
52
|
-
AnnotationCompletedEventDetail,
|
|
53
|
-
AnnotationModifiedEventDetail,
|
|
54
|
-
} from '../../types/EventTypes';
|
|
55
53
|
import { StyleSpecifier } from '../../types/AnnotationStyle';
|
|
56
54
|
import { getModalityUnit } from '../../utilities/getModalityUnit';
|
|
57
55
|
import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScaled';
|
|
@@ -369,8 +367,7 @@ class RectangleROITool extends AnnotationTool {
|
|
|
369
367
|
|
|
370
368
|
resetElementCursor(element);
|
|
371
369
|
|
|
372
|
-
const
|
|
373
|
-
const { renderingEngine } = enabledElement;
|
|
370
|
+
const { renderingEngine } = getEnabledElement(element);
|
|
374
371
|
|
|
375
372
|
this.editData = null;
|
|
376
373
|
this.isDrawing = false;
|
|
@@ -385,13 +382,7 @@ class RectangleROITool extends AnnotationTool {
|
|
|
385
382
|
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
|
|
386
383
|
|
|
387
384
|
if (newAnnotation) {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
const eventDetail: AnnotationCompletedEventDetail = {
|
|
391
|
-
annotation,
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
385
|
+
triggerAnnotationCompleted(annotation);
|
|
395
386
|
}
|
|
396
387
|
};
|
|
397
388
|
|
|
@@ -520,8 +511,7 @@ class RectangleROITool extends AnnotationTool {
|
|
|
520
511
|
annotation.highlighted = false;
|
|
521
512
|
data.handles.activeHandleIndex = null;
|
|
522
513
|
|
|
523
|
-
const
|
|
524
|
-
const { renderingEngine } = enabledElement;
|
|
514
|
+
const { renderingEngine } = getEnabledElement(element);
|
|
525
515
|
|
|
526
516
|
triggerAnnotationRenderForViewportIds(
|
|
527
517
|
renderingEngine,
|
|
@@ -529,13 +519,7 @@ class RectangleROITool extends AnnotationTool {
|
|
|
529
519
|
);
|
|
530
520
|
|
|
531
521
|
if (newAnnotation) {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
const eventDetail: AnnotationCompletedEventDetail = {
|
|
535
|
-
annotation,
|
|
536
|
-
};
|
|
537
|
-
|
|
538
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
522
|
+
triggerAnnotationCompleted(annotation);
|
|
539
523
|
}
|
|
540
524
|
|
|
541
525
|
this.editData = null;
|
|
@@ -872,7 +856,8 @@ class RectangleROITool extends AnnotationTool {
|
|
|
872
856
|
enabledElement
|
|
873
857
|
) => {
|
|
874
858
|
const { data } = annotation;
|
|
875
|
-
const {
|
|
859
|
+
const { viewport } = enabledElement;
|
|
860
|
+
const { element } = viewport;
|
|
876
861
|
|
|
877
862
|
const worldPos1 = data.handles.points[0];
|
|
878
863
|
const worldPos2 = data.handles.points[3];
|
|
@@ -988,14 +973,7 @@ class RectangleROITool extends AnnotationTool {
|
|
|
988
973
|
annotation.invalidated = false;
|
|
989
974
|
|
|
990
975
|
// Dispatching annotation modified
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
const eventDetail: AnnotationModifiedEventDetail = {
|
|
994
|
-
annotation,
|
|
995
|
-
viewportId,
|
|
996
|
-
renderingEngineId,
|
|
997
|
-
};
|
|
998
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
976
|
+
triggerAnnotationModified(annotation, element);
|
|
999
977
|
|
|
1000
978
|
return cachedStats;
|
|
1001
979
|
};
|
|
@@ -20,14 +20,14 @@ import {
|
|
|
20
20
|
ChangeTypes,
|
|
21
21
|
} from '../../enums';
|
|
22
22
|
import { resetElementCursor } from '../../cursors/elementCursor';
|
|
23
|
-
import {
|
|
23
|
+
import type {
|
|
24
24
|
Annotation,
|
|
25
25
|
EventTypes,
|
|
26
26
|
ToolHandle,
|
|
27
27
|
TextBoxHandle,
|
|
28
28
|
PublicToolProps,
|
|
29
29
|
ToolProps,
|
|
30
|
-
|
|
30
|
+
AnnotationRenderContext,
|
|
31
31
|
} from '../../types';
|
|
32
32
|
import {
|
|
33
33
|
math,
|
|
@@ -41,7 +41,10 @@ import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters'
|
|
|
41
41
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
42
42
|
|
|
43
43
|
import { SplineROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
44
|
-
import {
|
|
44
|
+
import {
|
|
45
|
+
AnnotationCompletedEventDetail,
|
|
46
|
+
AnnotationModifiedEventDetail,
|
|
47
|
+
} from '../../types/EventTypes';
|
|
45
48
|
import { ISpline } from '../../types/ISpline';
|
|
46
49
|
import { CardinalSpline } from './splines/CardinalSpline';
|
|
47
50
|
import { LinearSpline } from './splines/LinearSpline';
|
|
@@ -93,7 +96,10 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
93
96
|
} | null;
|
|
94
97
|
isDrawing: boolean;
|
|
95
98
|
isHandleOutsideImage = false;
|
|
96
|
-
fireChangeOnUpdate:
|
|
99
|
+
fireChangeOnUpdate: {
|
|
100
|
+
annotationUID: string;
|
|
101
|
+
changeType: ChangeTypes;
|
|
102
|
+
} = null;
|
|
97
103
|
|
|
98
104
|
constructor(
|
|
99
105
|
toolProps: PublicToolProps = {},
|
|
@@ -327,9 +333,13 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
327
333
|
removeAnnotation(annotation.annotationUID);
|
|
328
334
|
}
|
|
329
335
|
|
|
330
|
-
this.fireChangeOnUpdate ||=
|
|
331
|
-
|
|
332
|
-
:
|
|
336
|
+
this.fireChangeOnUpdate ||= {
|
|
337
|
+
annotationUID: annotation.annotationUID,
|
|
338
|
+
changeType: newAnnotation
|
|
339
|
+
? ChangeTypes.Completed
|
|
340
|
+
: ChangeTypes.HandlesUpdated,
|
|
341
|
+
};
|
|
342
|
+
|
|
333
343
|
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
|
|
334
344
|
|
|
335
345
|
this.editData = null;
|
|
@@ -509,6 +519,19 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
509
519
|
return annotation.annotationUID;
|
|
510
520
|
}
|
|
511
521
|
|
|
522
|
+
/**
|
|
523
|
+
* Triggers an annotation completed event.
|
|
524
|
+
*/
|
|
525
|
+
triggerAnnotationCompleted = (annotation: SplineROIAnnotation): void => {
|
|
526
|
+
const eventType = Events.ANNOTATION_COMPLETED;
|
|
527
|
+
const eventDetail: AnnotationCompletedEventDetail = {
|
|
528
|
+
annotation,
|
|
529
|
+
changeType: ChangeTypes.Completed,
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
triggerEvent(eventTarget, eventType, eventDetail);
|
|
533
|
+
};
|
|
534
|
+
|
|
512
535
|
/**
|
|
513
536
|
* Triggers an annotation modified event.
|
|
514
537
|
*/
|
|
@@ -518,11 +541,7 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
518
541
|
changeType = ChangeTypes.StatsUpdated
|
|
519
542
|
): void => {
|
|
520
543
|
const { viewportId, renderingEngineId } = enabledElement;
|
|
521
|
-
const eventType =
|
|
522
|
-
changeType === ChangeTypes.Completed
|
|
523
|
-
? Events.ANNOTATION_COMPLETED
|
|
524
|
-
: Events.ANNOTATION_MODIFIED;
|
|
525
|
-
|
|
544
|
+
const eventType = Events.ANNOTATION_MODIFIED;
|
|
526
545
|
const eventDetail: AnnotationModifiedEventDetail = {
|
|
527
546
|
annotation,
|
|
528
547
|
viewportId,
|
|
@@ -533,6 +552,21 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
533
552
|
triggerEvent(eventTarget, eventType, eventDetail);
|
|
534
553
|
};
|
|
535
554
|
|
|
555
|
+
/**
|
|
556
|
+
* Triggers an annotation complete or modified event based on changeType.
|
|
557
|
+
*/
|
|
558
|
+
triggerChangeEvent = (
|
|
559
|
+
annotation: SplineROIAnnotation,
|
|
560
|
+
enabledElement: Types.IEnabledElement,
|
|
561
|
+
changeType = ChangeTypes.StatsUpdated
|
|
562
|
+
): void => {
|
|
563
|
+
if (changeType === ChangeTypes.Completed) {
|
|
564
|
+
this.triggerAnnotationCompleted(annotation);
|
|
565
|
+
} else {
|
|
566
|
+
this.triggerAnnotationModified(annotation, enabledElement, changeType);
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
|
|
536
570
|
private _activateModify = (element) => {
|
|
537
571
|
state.isInteractingWithTool = true;
|
|
538
572
|
|
|
@@ -596,13 +630,9 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
596
630
|
* @param renderContext - Render context that contains the annotation, enabledElement, etc.
|
|
597
631
|
* @returns True if the annotation is rendered or false otherwise
|
|
598
632
|
*/
|
|
599
|
-
protected renderAnnotationInstance(
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
annotation: Annotation;
|
|
603
|
-
annotationStyle: Record<string, any>;
|
|
604
|
-
svgDrawingHelper: SVGDrawingHelper;
|
|
605
|
-
}): boolean {
|
|
633
|
+
protected renderAnnotationInstance(
|
|
634
|
+
renderContext: AnnotationRenderContext
|
|
635
|
+
): boolean {
|
|
606
636
|
const { enabledElement, targetId, svgDrawingHelper, annotationStyle } =
|
|
607
637
|
renderContext;
|
|
608
638
|
const { viewport } = enabledElement;
|
|
@@ -734,11 +764,11 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
734
764
|
annotationStyle.textbox
|
|
735
765
|
);
|
|
736
766
|
|
|
737
|
-
if (this.fireChangeOnUpdate) {
|
|
738
|
-
this.
|
|
767
|
+
if (this.fireChangeOnUpdate?.annotationUID === annotationUID) {
|
|
768
|
+
this.triggerChangeEvent(
|
|
739
769
|
annotation,
|
|
740
770
|
enabledElement,
|
|
741
|
-
this.fireChangeOnUpdate
|
|
771
|
+
this.fireChangeOnUpdate.changeType
|
|
742
772
|
);
|
|
743
773
|
this.fireChangeOnUpdate = null;
|
|
744
774
|
}
|
|
@@ -1058,8 +1088,7 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
1058
1088
|
const deltaInY = vec3.distance(originalWorldPoint, deltaYPoint);
|
|
1059
1089
|
|
|
1060
1090
|
const scale = getCalibratedScale(image);
|
|
1061
|
-
let area =
|
|
1062
|
-
math.polyline.calculateAreaOfPoints(canvasCoordinates) / scale / scale;
|
|
1091
|
+
let area = math.polyline.getArea(canvasCoordinates) / scale / scale;
|
|
1063
1092
|
|
|
1064
1093
|
// Convert from canvas_pixels ^2 to mm^2
|
|
1065
1094
|
area *= deltaInX * deltaInY;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Events } from '../../enums';
|
|
2
2
|
import {
|
|
3
3
|
getEnabledElement,
|
|
4
|
-
triggerEvent,
|
|
5
|
-
eventTarget,
|
|
6
4
|
utilities as csUtils,
|
|
7
5
|
StackViewport,
|
|
8
6
|
} from '@cornerstonejs/core';
|
|
@@ -15,6 +13,10 @@ import {
|
|
|
15
13
|
getAnnotations,
|
|
16
14
|
removeAnnotation,
|
|
17
15
|
} from '../../stateManagement/annotation/annotationState';
|
|
16
|
+
import {
|
|
17
|
+
triggerAnnotationCompleted,
|
|
18
|
+
triggerAnnotationModified,
|
|
19
|
+
} from '../../stateManagement/annotation/helpers/state';
|
|
18
20
|
import { UltrasoundDirectionalAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
19
21
|
|
|
20
22
|
import {
|
|
@@ -27,10 +29,6 @@ import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters'
|
|
|
27
29
|
import { roundNumber } from '../../utilities';
|
|
28
30
|
import { distanceToPoint } from '../../utilities/math/point';
|
|
29
31
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
30
|
-
import {
|
|
31
|
-
AnnotationCompletedEventDetail,
|
|
32
|
-
AnnotationModifiedEventDetail,
|
|
33
|
-
} from '../../types/EventTypes';
|
|
34
32
|
|
|
35
33
|
import {
|
|
36
34
|
resetElementCursor,
|
|
@@ -310,13 +308,7 @@ class UltrasoundDirectionalTool extends AnnotationTool {
|
|
|
310
308
|
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
|
|
311
309
|
|
|
312
310
|
if (newAnnotation) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const eventDetail: AnnotationCompletedEventDetail = {
|
|
316
|
-
annotation,
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
311
|
+
triggerAnnotationCompleted(annotation);
|
|
320
312
|
}
|
|
321
313
|
|
|
322
314
|
this.editData = null;
|
|
@@ -398,13 +390,7 @@ class UltrasoundDirectionalTool extends AnnotationTool {
|
|
|
398
390
|
);
|
|
399
391
|
|
|
400
392
|
if (newAnnotation) {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
const eventDetail: AnnotationCompletedEventDetail = {
|
|
404
|
-
annotation,
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
393
|
+
triggerAnnotationCompleted(annotation);
|
|
408
394
|
}
|
|
409
395
|
|
|
410
396
|
this.editData = null;
|
|
@@ -797,7 +783,7 @@ class UltrasoundDirectionalTool extends AnnotationTool {
|
|
|
797
783
|
|
|
798
784
|
_calculateCachedStats(annotation, renderingEngine, enabledElement) {
|
|
799
785
|
const data = annotation.data;
|
|
800
|
-
const {
|
|
786
|
+
const { element } = enabledElement.viewport;
|
|
801
787
|
|
|
802
788
|
// Until we have all two anchors bail out
|
|
803
789
|
if (data.handles.points.length !== 2) {
|
|
@@ -873,14 +859,7 @@ class UltrasoundDirectionalTool extends AnnotationTool {
|
|
|
873
859
|
annotation.invalidated = false;
|
|
874
860
|
|
|
875
861
|
// Dispatching annotation modified
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
const eventDetail: AnnotationModifiedEventDetail = {
|
|
879
|
-
annotation,
|
|
880
|
-
viewportId,
|
|
881
|
-
renderingEngineId,
|
|
882
|
-
};
|
|
883
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
862
|
+
triggerAnnotationModified(annotation, element);
|
|
884
863
|
|
|
885
864
|
return cachedStats;
|
|
886
865
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { vec3, vec2 } from 'gl-matrix';
|
|
1
2
|
import { getEnabledElement } from '@cornerstonejs/core';
|
|
2
3
|
import type { Types } from '@cornerstonejs/core';
|
|
3
4
|
import { state } from '../../../store';
|
|
@@ -8,19 +9,16 @@ import {
|
|
|
8
9
|
} from '../../../cursors/elementCursor';
|
|
9
10
|
import { EventTypes } from '../../../types';
|
|
10
11
|
import { polyline } from '../../../utilities/math';
|
|
11
|
-
import { vec3, vec2 } from 'gl-matrix';
|
|
12
12
|
import { PlanarFreehandROIAnnotation } from '../../../types/ToolSpecificAnnotationTypes';
|
|
13
13
|
import {
|
|
14
14
|
getInterpolatedPoints,
|
|
15
15
|
shouldSmooth,
|
|
16
16
|
} from '../../../utilities/planarFreehandROITool/smoothPoints';
|
|
17
17
|
import triggerAnnotationRenderForViewportIds from '../../../utilities/triggerAnnotationRenderForViewportIds';
|
|
18
|
+
import { triggerAnnotationModified } from '../../../stateManagement/annotation/helpers/state';
|
|
18
19
|
|
|
19
|
-
const {
|
|
20
|
-
|
|
21
|
-
addCanvasPointsToArray,
|
|
22
|
-
calculateAreaOfPoints,
|
|
23
|
-
} = polyline;
|
|
20
|
+
const { getSubPixelSpacingAndXYDirections, addCanvasPointsToArray, getArea } =
|
|
21
|
+
polyline;
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* Activates the closed contour edit event loop.
|
|
@@ -236,7 +234,7 @@ function finishEditAndStartNewEdit(evt: EventTypes.InteractionEventType): void {
|
|
|
236
234
|
annotation.autoGenerated = false;
|
|
237
235
|
}
|
|
238
236
|
|
|
239
|
-
|
|
237
|
+
triggerAnnotationModified(annotation, element);
|
|
240
238
|
|
|
241
239
|
const lastEditCanvasPoint = editCanvasPoints.pop();
|
|
242
240
|
|
|
@@ -408,8 +406,8 @@ function fuseEditPointsWithClosedContour(
|
|
|
408
406
|
}
|
|
409
407
|
}
|
|
410
408
|
|
|
411
|
-
const areaPointSet1 =
|
|
412
|
-
const areaPointSet2 =
|
|
409
|
+
const areaPointSet1 = getArea(pointSet1);
|
|
410
|
+
const areaPointSet2 = getArea(pointSet2);
|
|
413
411
|
|
|
414
412
|
const pointsToRender: Types.Point2[] =
|
|
415
413
|
areaPointSet1 > areaPointSet2 ? pointSet1 : pointSet2;
|
|
@@ -453,14 +451,14 @@ function completeClosedContourEdit(element: HTMLDivElement) {
|
|
|
453
451
|
);
|
|
454
452
|
annotation.data.contour.polyline = worldPoints;
|
|
455
453
|
annotation.data.contour.closed = true;
|
|
456
|
-
|
|
457
454
|
annotation.invalidated = true;
|
|
455
|
+
|
|
458
456
|
// If any manual update, triggered on an annotation, then it will be treated as non-autogenerated.
|
|
459
457
|
if (annotation.autoGenerated) {
|
|
460
458
|
annotation.autoGenerated = false;
|
|
461
459
|
}
|
|
462
460
|
|
|
463
|
-
|
|
461
|
+
triggerAnnotationModified(annotation, element);
|
|
464
462
|
}
|
|
465
463
|
|
|
466
464
|
this.isEditingClosed = false;
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
getInterpolatedPoints,
|
|
13
13
|
} from '../../../utilities/planarFreehandROITool/smoothPoints';
|
|
14
14
|
import triggerAnnotationRenderForViewportIds from '../../../utilities/triggerAnnotationRenderForViewportIds';
|
|
15
|
+
import { triggerAnnotationCompleted } from '../../../stateManagement/annotation/helpers/state';
|
|
15
16
|
import { PlanarFreehandROIAnnotation } from '../../../types/ToolSpecificAnnotationTypes';
|
|
16
17
|
import findOpenUShapedContourVectorToPeak from './findOpenUShapedContourVectorToPeak';
|
|
17
18
|
import { polyline } from '../../../utilities/math';
|
|
@@ -21,7 +22,7 @@ import reverseIfAntiClockwise from '../../../utilities/contours/reverseIfAntiClo
|
|
|
21
22
|
const {
|
|
22
23
|
addCanvasPointsToArray,
|
|
23
24
|
pointsAreWithinCloseContourProximity,
|
|
24
|
-
|
|
25
|
+
getFirstLineSegmentIntersectionIndexes,
|
|
25
26
|
getSubPixelSpacingAndXYDirections,
|
|
26
27
|
} = polyline;
|
|
27
28
|
|
|
@@ -233,10 +234,11 @@ function completeDrawClosedContour(element: HTMLDivElement): boolean {
|
|
|
233
234
|
|
|
234
235
|
annotation.data.contour.polyline = worldPoints;
|
|
235
236
|
annotation.data.contour.closed = true;
|
|
237
|
+
annotation.invalidated = true;
|
|
236
238
|
const { textBox } = annotation.data.handles;
|
|
237
239
|
|
|
238
240
|
if (!textBox.hasMoved) {
|
|
239
|
-
|
|
241
|
+
triggerAnnotationCompleted(annotation);
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
this.isDrawing = false;
|
|
@@ -261,7 +263,7 @@ function removeCrossedLinesOnCompleteDraw(): void {
|
|
|
261
263
|
const endToStart = [canvasPoints[0], canvasPoints[numPoints - 1]];
|
|
262
264
|
const canvasPointsMinusEnds = canvasPoints.slice(0, -1).slice(1);
|
|
263
265
|
|
|
264
|
-
const lineSegment =
|
|
266
|
+
const lineSegment = getFirstLineSegmentIntersectionIndexes(
|
|
265
267
|
canvasPointsMinusEnds,
|
|
266
268
|
endToStart[0],
|
|
267
269
|
endToStart[1],
|
|
@@ -303,6 +305,7 @@ function completeDrawOpenContour(element: HTMLDivElement): boolean {
|
|
|
303
305
|
|
|
304
306
|
annotation.data.contour.polyline = worldPoints;
|
|
305
307
|
annotation.data.contour.closed = false;
|
|
308
|
+
annotation.invalidated = true;
|
|
306
309
|
const { textBox } = annotation.data.handles;
|
|
307
310
|
|
|
308
311
|
// Add the first and last points to the list of handles. These means they
|
|
@@ -319,7 +322,7 @@ function completeDrawOpenContour(element: HTMLDivElement): boolean {
|
|
|
319
322
|
}
|
|
320
323
|
|
|
321
324
|
if (!textBox.hasMoved) {
|
|
322
|
-
|
|
325
|
+
triggerAnnotationCompleted(annotation);
|
|
323
326
|
}
|
|
324
327
|
|
|
325
328
|
this.isDrawing = false;
|
|
@@ -349,7 +352,7 @@ function findCrossingIndexDuringCreate(
|
|
|
349
352
|
const { canvasPoints } = this.drawData;
|
|
350
353
|
const pointsLessLastOne = canvasPoints.slice(0, -1);
|
|
351
354
|
|
|
352
|
-
const lineSegment =
|
|
355
|
+
const lineSegment = getFirstLineSegmentIntersectionIndexes(
|
|
353
356
|
pointsLessLastOne,
|
|
354
357
|
canvasPos,
|
|
355
358
|
lastCanvasPoint,
|
|
@@ -3,7 +3,8 @@ import { vec2 } from 'gl-matrix';
|
|
|
3
3
|
import { polyline } from '../../../utilities/math';
|
|
4
4
|
import { EventTypes } from '../../../types';
|
|
5
5
|
|
|
6
|
-
const { addCanvasPointsToArray,
|
|
6
|
+
const { addCanvasPointsToArray, getFirstLineSegmentIntersectionIndexes } =
|
|
7
|
+
polyline;
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Check if the `editCanvasPoints` have crossed the `prevCanvasPoints` during
|
|
@@ -28,7 +29,7 @@ function checkForFirstCrossing(
|
|
|
28
29
|
const lastCanvasPoint = lastPoints.canvas;
|
|
29
30
|
const { editCanvasPoints, prevCanvasPoints } = this.editData;
|
|
30
31
|
|
|
31
|
-
const crossedLineSegment =
|
|
32
|
+
const crossedLineSegment = getFirstLineSegmentIntersectionIndexes(
|
|
32
33
|
prevCanvasPoints,
|
|
33
34
|
canvasPos,
|
|
34
35
|
lastCanvasPoint,
|
|
@@ -91,7 +92,7 @@ function checkForFirstCrossing(
|
|
|
91
92
|
];
|
|
92
93
|
|
|
93
94
|
const crossedLineSegmentFromExtendedPoint =
|
|
94
|
-
|
|
95
|
+
getFirstLineSegmentIntersectionIndexes(
|
|
95
96
|
prevCanvasPoints,
|
|
96
97
|
extendedPoint,
|
|
97
98
|
editCanvasPoints[0],
|
|
@@ -133,7 +134,7 @@ function removePointsUpUntilFirstCrossing(isClosedContour: boolean): void {
|
|
|
133
134
|
for (let i = 0; i < editCanvasPoints.length - 1; i++) {
|
|
134
135
|
const firstLine = [editCanvasPoints[i], editCanvasPoints[i + 1]];
|
|
135
136
|
|
|
136
|
-
const didCrossLine = !!
|
|
137
|
+
const didCrossLine = !!getFirstLineSegmentIntersectionIndexes(
|
|
137
138
|
prevCanvasPoints,
|
|
138
139
|
firstLine[0],
|
|
139
140
|
firstLine[1],
|
|
@@ -173,7 +174,7 @@ function checkForSecondCrossing(
|
|
|
173
174
|
// for the second crossing of the prevCanvasPoints, by checking if the last
|
|
174
175
|
// mouse drag crossed these. This class method is only called if the edit loop
|
|
175
176
|
// has already has a crossing earlier in the edit.
|
|
176
|
-
const crossedLineSegment =
|
|
177
|
+
const crossedLineSegment = getFirstLineSegmentIntersectionIndexes(
|
|
177
178
|
prevCanvasPoints,
|
|
178
179
|
canvasPos,
|
|
179
180
|
lastCanvasPoint,
|
|
@@ -199,7 +200,7 @@ function removePointsAfterSecondCrossing(isClosedContour: boolean): void {
|
|
|
199
200
|
for (let i = editCanvasPoints.length - 1; i > 0; i--) {
|
|
200
201
|
const lastLine = [editCanvasPoints[i], editCanvasPoints[i - 1]];
|
|
201
202
|
|
|
202
|
-
const didCrossLine = !!
|
|
203
|
+
const didCrossLine = !!getFirstLineSegmentIntersectionIndexes(
|
|
203
204
|
prevCanvasPoints,
|
|
204
205
|
lastLine[0],
|
|
205
206
|
lastLine[1],
|
|
@@ -255,7 +256,7 @@ function findSnapIndex(): number {
|
|
|
255
256
|
const snapCanvasPosition = prevCanvasPoints[index];
|
|
256
257
|
const lastEditCanvasPoint = editCanvasPoints[editCanvasPoints.length - 1];
|
|
257
258
|
|
|
258
|
-
const crossedLineSegment =
|
|
259
|
+
const crossedLineSegment = getFirstLineSegmentIntersectionIndexes(
|
|
259
260
|
editCanvasPointsLessLastOne,
|
|
260
261
|
snapCanvasPosition,
|
|
261
262
|
lastEditCanvasPoint,
|
|
@@ -290,7 +291,7 @@ function checkAndRemoveCrossesOnEditLine(
|
|
|
290
291
|
|
|
291
292
|
const editCanvasPointsLessLastOne = editCanvasPoints.slice(0, -2);
|
|
292
293
|
|
|
293
|
-
const crossedLineSegment =
|
|
294
|
+
const crossedLineSegment = getFirstLineSegmentIntersectionIndexes(
|
|
294
295
|
editCanvasPointsLessLastOne,
|
|
295
296
|
canvasPos,
|
|
296
297
|
lastCanvasPoint,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { vec3, vec2 } from 'gl-matrix';
|
|
1
2
|
import { getEnabledElement } from '@cornerstonejs/core';
|
|
2
3
|
import type { Types } from '@cornerstonejs/core';
|
|
3
4
|
import { state } from '../../../store';
|
|
@@ -8,7 +9,6 @@ import {
|
|
|
8
9
|
} from '../../../cursors/elementCursor';
|
|
9
10
|
import type { EventTypes } from '../../../types';
|
|
10
11
|
import { PlanarFreehandROIAnnotation } from '../../../types/ToolSpecificAnnotationTypes';
|
|
11
|
-
import { vec3, vec2 } from 'gl-matrix';
|
|
12
12
|
import { polyline } from '../../../utilities/math';
|
|
13
13
|
import {
|
|
14
14
|
shouldSmooth,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from '../../../utilities/planarFreehandROITool/smoothPoints';
|
|
17
17
|
import triggerAnnotationRenderForViewportIds from '../../../utilities/triggerAnnotationRenderForViewportIds';
|
|
18
18
|
import findOpenUShapedContourVectorToPeak from './findOpenUShapedContourVectorToPeak';
|
|
19
|
+
import { triggerAnnotationModified } from '../../../stateManagement/annotation/helpers/state';
|
|
19
20
|
|
|
20
21
|
const { addCanvasPointsToArray, getSubPixelSpacingAndXYDirections } = polyline;
|
|
21
22
|
|
|
@@ -226,7 +227,7 @@ function openContourEditOverwriteEnd(
|
|
|
226
227
|
];
|
|
227
228
|
annotation.data.handles.activeHandleIndex = 1;
|
|
228
229
|
|
|
229
|
-
|
|
230
|
+
triggerAnnotationModified(annotation, element);
|
|
230
231
|
|
|
231
232
|
this.isEditingOpen = false;
|
|
232
233
|
this.editData = undefined;
|
|
@@ -505,7 +506,7 @@ function finishEditOpenOnSecondCrossing(
|
|
|
505
506
|
worldPoints[worldPoints.length - 1],
|
|
506
507
|
];
|
|
507
508
|
|
|
508
|
-
|
|
509
|
+
triggerAnnotationModified(annotation, element);
|
|
509
510
|
|
|
510
511
|
const lastEditCanvasPoint = editCanvasPoints.pop();
|
|
511
512
|
|
|
@@ -553,6 +554,8 @@ function completeOpenContourEdit(element: HTMLDivElement) {
|
|
|
553
554
|
const worldPoints = updatedPoints.map((canvasPoint) =>
|
|
554
555
|
viewport.canvasToWorld(canvasPoint)
|
|
555
556
|
);
|
|
557
|
+
|
|
558
|
+
annotation.invalidated = true;
|
|
556
559
|
annotation.data.contour.polyline = worldPoints;
|
|
557
560
|
annotation.data.contour.closed = false;
|
|
558
561
|
annotation.data.handles.points = [
|
|
@@ -566,9 +569,7 @@ function completeOpenContourEdit(element: HTMLDivElement) {
|
|
|
566
569
|
findOpenUShapedContourVectorToPeak(fusedCanvasPoints, viewport);
|
|
567
570
|
}
|
|
568
571
|
|
|
569
|
-
annotation
|
|
570
|
-
|
|
571
|
-
this.triggerAnnotationModified(annotation, enabledElement);
|
|
572
|
+
triggerAnnotationModified(annotation, element);
|
|
572
573
|
}
|
|
573
574
|
|
|
574
575
|
this.isEditingOpen = false;
|
|
@@ -4,13 +4,14 @@ import {
|
|
|
4
4
|
addAnnotation,
|
|
5
5
|
getAnnotations,
|
|
6
6
|
} from '../../stateManagement/annotation/annotationState';
|
|
7
|
-
import {
|
|
7
|
+
import type {
|
|
8
8
|
Annotation,
|
|
9
9
|
ContourAnnotation,
|
|
10
10
|
EventTypes,
|
|
11
11
|
PublicToolProps,
|
|
12
12
|
ToolProps,
|
|
13
13
|
SVGDrawingHelper,
|
|
14
|
+
AnnotationRenderContext,
|
|
14
15
|
} from '../../types';
|
|
15
16
|
import { drawPolyline as drawPolylineSvg } from '../../drawingSvg';
|
|
16
17
|
import { StyleSpecifier } from '../../types/AnnotationStyle';
|
|
@@ -191,13 +192,9 @@ abstract class ContourBaseTool extends AnnotationTool {
|
|
|
191
192
|
/**
|
|
192
193
|
* Render a contour segmentation instance
|
|
193
194
|
*/
|
|
194
|
-
protected renderAnnotationInstance(
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
annotation: Annotation;
|
|
198
|
-
annotationStyle: Record<string, any>;
|
|
199
|
-
svgDrawingHelper: SVGDrawingHelper;
|
|
200
|
-
}): boolean {
|
|
195
|
+
protected renderAnnotationInstance(
|
|
196
|
+
renderContext: AnnotationRenderContext
|
|
197
|
+
): boolean {
|
|
201
198
|
const { enabledElement, annotationStyle, svgDrawingHelper } = renderContext;
|
|
202
199
|
const annotation = renderContext.annotation as ContourAnnotation;
|
|
203
200
|
const { annotationUID } = annotation;
|