@cornerstonejs/tools 1.50.2 → 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
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { utilities } from '@cornerstonejs/core';
|
|
2
|
-
import {
|
|
2
|
+
import type {
|
|
3
3
|
Annotation,
|
|
4
4
|
EventTypes,
|
|
5
5
|
PublicToolProps,
|
|
6
6
|
ToolProps,
|
|
7
|
+
AnnotationRenderContext,
|
|
7
8
|
} from '../../types';
|
|
8
9
|
import {
|
|
9
10
|
config as segmentationConfig,
|
|
@@ -12,10 +13,12 @@ import {
|
|
|
12
13
|
segmentIndex as segmentIndexController,
|
|
13
14
|
activeSegmentation,
|
|
14
15
|
} from '../../stateManagement/segmentation';
|
|
15
|
-
import { ContourSegmentationAnnotation } from '../../types/ContourSegmentationAnnotation';
|
|
16
|
-
import {
|
|
16
|
+
import type { ContourSegmentationAnnotation } from '../../types/ContourSegmentationAnnotation';
|
|
17
|
+
import type { SplineContourSegmentationAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
18
|
+
import type { StyleSpecifier } from '../../types/AnnotationStyle';
|
|
17
19
|
import { SegmentationRepresentations } from '../../enums';
|
|
18
20
|
import ContourBaseTool from './ContourBaseTool';
|
|
21
|
+
import { triggerSegmentationDataModified } from '../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
19
22
|
import { InterpolationManager } from '../../utilities/contours/interpolation';
|
|
20
23
|
|
|
21
24
|
/**
|
|
@@ -93,9 +96,9 @@ abstract class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
|
93
96
|
const annotationUID = super.addAnnotation(annotation, element);
|
|
94
97
|
|
|
95
98
|
if (this.isContourSegmentationTool()) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
);
|
|
99
|
+
const contourSegAnnotation = annotation as ContourSegmentationAnnotation;
|
|
100
|
+
|
|
101
|
+
this._registerContourSegmentationAnnotation(contourSegAnnotation);
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
return annotationUID;
|
|
@@ -140,6 +143,26 @@ abstract class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
|
140
143
|
return utilities.deepMerge(annotationStyle, contourSegmentationStyle);
|
|
141
144
|
}
|
|
142
145
|
|
|
146
|
+
protected renderAnnotationInstance(
|
|
147
|
+
renderContext: AnnotationRenderContext
|
|
148
|
+
): boolean {
|
|
149
|
+
const { annotation } = renderContext;
|
|
150
|
+
const { invalidated } = annotation;
|
|
151
|
+
|
|
152
|
+
// Render the annotation before triggering events
|
|
153
|
+
const renderResult = super.renderAnnotationInstance(renderContext);
|
|
154
|
+
|
|
155
|
+
if (invalidated && this.isContourSegmentationTool()) {
|
|
156
|
+
const { segmentationId } = (<SplineContourSegmentationAnnotation>(
|
|
157
|
+
annotation
|
|
158
|
+
)).data.segmentation;
|
|
159
|
+
|
|
160
|
+
triggerSegmentationDataModified(segmentationId);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return renderResult;
|
|
164
|
+
}
|
|
165
|
+
|
|
143
166
|
/**
|
|
144
167
|
* Return the annotation style based on global, toolGroup, segmentation
|
|
145
168
|
* and segment segmentation configurations.
|
|
@@ -3,23 +3,20 @@ import {
|
|
|
3
3
|
cache,
|
|
4
4
|
StackViewport,
|
|
5
5
|
metaData,
|
|
6
|
-
triggerEvent,
|
|
7
|
-
eventTarget,
|
|
8
6
|
utilities as csUtils,
|
|
9
7
|
} from '@cornerstonejs/core';
|
|
10
8
|
import type { Types } from '@cornerstonejs/core';
|
|
11
9
|
|
|
12
10
|
import { vec3 } from 'gl-matrix';
|
|
13
|
-
import { Events } from '../../enums';
|
|
14
11
|
import { addAnnotation, getAnnotations } from '../../stateManagement';
|
|
15
12
|
import { isAnnotationLocked } from '../../stateManagement/annotation/annotationLocking';
|
|
13
|
+
import { triggerAnnotationModified } from '../../stateManagement/annotation/helpers/state';
|
|
16
14
|
import {
|
|
17
15
|
drawHandles as drawHandlesSvg,
|
|
18
16
|
drawRect as drawRectSvg,
|
|
19
17
|
} from '../../drawingSvg';
|
|
20
18
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
21
19
|
import throttle from '../../utilities/throttle';
|
|
22
|
-
import { AnnotationModifiedEventDetail } from '../../types/EventTypes';
|
|
23
20
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
24
21
|
import { hideElementCursor } from '../../cursors/elementCursor';
|
|
25
22
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
@@ -266,7 +263,7 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
|
|
|
266
263
|
|
|
267
264
|
_calculateCachedStatsTool(annotation, enabledElement) {
|
|
268
265
|
const data = annotation.data;
|
|
269
|
-
const {
|
|
266
|
+
const { element, viewport } = enabledElement;
|
|
270
267
|
|
|
271
268
|
const { cachedStats } = data;
|
|
272
269
|
const targetId = this.getTargetId(viewport);
|
|
@@ -280,14 +277,7 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
|
|
|
280
277
|
annotation.invalidated = false;
|
|
281
278
|
|
|
282
279
|
// Dispatching annotation modified
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
const eventDetail: AnnotationModifiedEventDetail = {
|
|
286
|
-
annotation,
|
|
287
|
-
viewportId,
|
|
288
|
-
renderingEngineId,
|
|
289
|
-
};
|
|
290
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
280
|
+
triggerAnnotationModified(annotation, element);
|
|
291
281
|
|
|
292
282
|
return cachedStats;
|
|
293
283
|
}
|
|
@@ -2,15 +2,12 @@ import {
|
|
|
2
2
|
getEnabledElement,
|
|
3
3
|
cache,
|
|
4
4
|
StackViewport,
|
|
5
|
-
triggerEvent,
|
|
6
|
-
eventTarget,
|
|
7
5
|
utilities as csUtils,
|
|
8
6
|
} from '@cornerstonejs/core';
|
|
9
7
|
import type { Types } from '@cornerstonejs/core';
|
|
10
8
|
|
|
11
9
|
import { addAnnotation, getAnnotations } from '../../stateManagement';
|
|
12
10
|
import { isAnnotationLocked } from '../../stateManagement/annotation/annotationLocking';
|
|
13
|
-
import { Events } from '../../enums';
|
|
14
11
|
|
|
15
12
|
import {
|
|
16
13
|
drawHandles as drawHandlesSvg,
|
|
@@ -20,6 +17,7 @@ import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters'
|
|
|
20
17
|
import { hideElementCursor } from '../../cursors/elementCursor';
|
|
21
18
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
22
19
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
20
|
+
import { triggerAnnotationModified } from '../../stateManagement/annotation/helpers/state';
|
|
23
21
|
import {
|
|
24
22
|
PublicToolProps,
|
|
25
23
|
ToolProps,
|
|
@@ -27,7 +25,6 @@ import {
|
|
|
27
25
|
SVGDrawingHelper,
|
|
28
26
|
} from '../../types';
|
|
29
27
|
import { RectangleROIThresholdAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
30
|
-
import { AnnotationModifiedEventDetail } from '../../types/EventTypes';
|
|
31
28
|
import RectangleROITool from '../annotation/RectangleROITool';
|
|
32
29
|
import { StyleSpecifier } from '../../types/AnnotationStyle';
|
|
33
30
|
|
|
@@ -172,7 +169,7 @@ class RectangleROIThresholdTool extends RectangleROITool {
|
|
|
172
169
|
svgDrawingHelper: SVGDrawingHelper
|
|
173
170
|
): boolean => {
|
|
174
171
|
let renderStatus = false;
|
|
175
|
-
const { viewport
|
|
172
|
+
const { viewport } = enabledElement;
|
|
176
173
|
const { element } = viewport;
|
|
177
174
|
let annotations = getAnnotations(this.getToolName(), element);
|
|
178
175
|
|
|
@@ -216,15 +213,7 @@ class RectangleROIThresholdTool extends RectangleROITool {
|
|
|
216
213
|
// Todo: This is not correct way to add the event trigger,
|
|
217
214
|
// this will trigger on all mouse hover too. Problem is that we don't
|
|
218
215
|
// have a cached stats mechanism for this tool yet?
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const eventDetail: AnnotationModifiedEventDetail = {
|
|
222
|
-
annotation,
|
|
223
|
-
viewportId: viewport.id,
|
|
224
|
-
renderingEngineId,
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
216
|
+
triggerAnnotationModified(annotation, element);
|
|
228
217
|
|
|
229
218
|
let activeHandleCanvasCoords;
|
|
230
219
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import type { Annotation } from './AnnotationTypes';
|
|
3
|
+
import type SVGDrawingHelper from './SVGDrawingHelper';
|
|
4
|
+
|
|
5
|
+
type AnnotationRenderContext = {
|
|
6
|
+
enabledElement: Types.IEnabledElement;
|
|
7
|
+
targetId: string;
|
|
8
|
+
annotation: Annotation;
|
|
9
|
+
annotationStyle: Record<string, any>;
|
|
10
|
+
svgDrawingHelper: SVGDrawingHelper;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default AnnotationRenderContext;
|
package/src/types/IToolGroup.ts
CHANGED
|
@@ -20,6 +20,8 @@ export default interface IToolGroup {
|
|
|
20
20
|
getViewportsInfo: () => Array<Types.IViewportId>;
|
|
21
21
|
/** Get the toolInstance of the toolName */
|
|
22
22
|
getToolInstance: { (toolName: string): any };
|
|
23
|
+
/** Check if a tool is already added to the tool group */
|
|
24
|
+
hasTool(toolName: string): boolean;
|
|
23
25
|
/** Add a tool to toolGroup with its configuration and custom calculator if wanted */
|
|
24
26
|
addTool: {
|
|
25
27
|
(toolName: string, toolConfiguration?: ToolConfiguration): void;
|
|
@@ -70,7 +72,7 @@ export default interface IToolGroup {
|
|
|
70
72
|
): void;
|
|
71
73
|
};
|
|
72
74
|
getToolConfiguration: {
|
|
73
|
-
(toolName: string, configurationPath
|
|
75
|
+
(toolName: string, configurationPath?: string): any;
|
|
74
76
|
};
|
|
75
77
|
getDefaultMousePrimary: {
|
|
76
78
|
(): MouseBindings;
|
package/src/types/index.ts
CHANGED
|
@@ -63,6 +63,7 @@ import type IToolClassReference from './IToolClassReference';
|
|
|
63
63
|
import type { ContourSegmentationData } from './ContourTypes';
|
|
64
64
|
import type IAnnotationManager from './IAnnotationManager';
|
|
65
65
|
import type AnnotationGroupSelector from './AnnotationGroupSelector';
|
|
66
|
+
import type AnnotationRenderContext from './AnnotationRenderContext';
|
|
66
67
|
import type { Statistics } from './CalculatorTypes';
|
|
67
68
|
import type { CanvasCoordinates } from '../utilities/math/ellipse/getCanvasEllipseCorners';
|
|
68
69
|
import {
|
|
@@ -106,6 +107,8 @@ export type {
|
|
|
106
107
|
ToolSpecificAnnotationTypes,
|
|
107
108
|
JumpToSliceOptions,
|
|
108
109
|
AnnotationGroupSelector,
|
|
110
|
+
// Rendering
|
|
111
|
+
AnnotationRenderContext,
|
|
109
112
|
// Geometry
|
|
110
113
|
PlanarBoundingBox,
|
|
111
114
|
ToolProps,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ContourSegmentationAnnotation } from '../../types/ContourSegmentationAnnotation';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check if two contour segmentations are from same segmentId,
|
|
5
|
+
* segmentationRepresentationUID and segmentIndex.
|
|
6
|
+
* @param firstAnnotation - First annotation
|
|
7
|
+
* @param secondAnnotation - Second annotation
|
|
8
|
+
* @returns True if they are from same segmentId, segmentationRepresentationUID
|
|
9
|
+
* and segmentIndex or false otherwise.
|
|
10
|
+
*/
|
|
11
|
+
export default function areSameSegment(
|
|
12
|
+
firstAnnotation: ContourSegmentationAnnotation,
|
|
13
|
+
secondAnnotation: ContourSegmentationAnnotation
|
|
14
|
+
) {
|
|
15
|
+
const { segmentation: firstSegmentation } = firstAnnotation.data;
|
|
16
|
+
const { segmentation: secondSegmentation } = secondAnnotation.data;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
firstSegmentation.segmentationId === secondSegmentation.segmentationId &&
|
|
20
|
+
firstSegmentation.segmentationRepresentationUID ===
|
|
21
|
+
secondSegmentation.segmentationRepresentationUID &&
|
|
22
|
+
firstSegmentation.segmentIndex === secondSegmentation.segmentIndex
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Annotation } from '../../types';
|
|
2
|
+
import { ContourSegmentationAnnotation } from '../../types/ContourSegmentationAnnotation';
|
|
3
|
+
|
|
4
|
+
export default function isContourSegmentationAnnotation(
|
|
5
|
+
annotation: Annotation
|
|
6
|
+
): annotation is ContourSegmentationAnnotation {
|
|
7
|
+
return !!(<ContourSegmentationAnnotation>annotation).data?.segmentation;
|
|
8
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { glMatrix, vec3 } from 'gl-matrix';
|
|
2
|
+
import { ContourAnnotation } from '../../types/ContourAnnotation';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Check if two contour segmentation annotations are coplanar.
|
|
6
|
+
*
|
|
7
|
+
* A plane may be represented by a normal and a distance then to know if they
|
|
8
|
+
* are coplanar we need to:
|
|
9
|
+
* - check if the normals of the two annotations are pointing to the same
|
|
10
|
+
* direction or to opposite directions (dot product equal to 1 or -1
|
|
11
|
+
* respectively)
|
|
12
|
+
* - Get one point from each polyline and project it onto the normal to get
|
|
13
|
+
* the distance from the origin (0, 0, 0).
|
|
14
|
+
*/
|
|
15
|
+
export default function areCoplanarContours(
|
|
16
|
+
firstAnnotation: ContourAnnotation,
|
|
17
|
+
secondAnnotation: ContourAnnotation
|
|
18
|
+
) {
|
|
19
|
+
const { viewPlaneNormal: firstViewPlaneNormal } = firstAnnotation.metadata;
|
|
20
|
+
const { viewPlaneNormal: secondViewPlaneNormal } = secondAnnotation.metadata;
|
|
21
|
+
const dot = vec3.dot(firstViewPlaneNormal, secondViewPlaneNormal);
|
|
22
|
+
const parallelPlanes = glMatrix.equals(1, Math.abs(dot));
|
|
23
|
+
|
|
24
|
+
if (!parallelPlanes) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { polyline: firstPolyline } = firstAnnotation.data.contour;
|
|
29
|
+
const { polyline: secondPolyline } = secondAnnotation.data.contour;
|
|
30
|
+
|
|
31
|
+
// Choose one of the normals and calculate the distance of a point from each
|
|
32
|
+
// polyline along that normal. Both normal cannot be used with absolute dot
|
|
33
|
+
// product values because one of the view planes may be flipped or one of the
|
|
34
|
+
// points may be at the same distance but in the opposite direction
|
|
35
|
+
const firstDistance = vec3.dot(firstViewPlaneNormal, firstPolyline[0]);
|
|
36
|
+
const secondDistance = vec3.dot(firstViewPlaneNormal, secondPolyline[0]);
|
|
37
|
+
|
|
38
|
+
return glMatrix.equals(firstDistance, secondDistance);
|
|
39
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import areCoplanarContours from './areCoplanarContours';
|
|
1
2
|
import contourFinder from './contourFinder';
|
|
2
3
|
import mergePoints from './mergePoints';
|
|
3
4
|
import detectContourHoles from './detectContourHoles';
|
|
@@ -8,6 +9,7 @@ import * as interpolation from './interpolation';
|
|
|
8
9
|
import findHandlePolylineIndex from './findHandlePolylineIndex';
|
|
9
10
|
|
|
10
11
|
export {
|
|
12
|
+
areCoplanarContours,
|
|
11
13
|
contourFinder,
|
|
12
14
|
mergePoints,
|
|
13
15
|
detectContourHoles,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Types } from '@cornerstonejs/core';
|
|
2
|
+
import { getSignedArea } from '../math/polyline';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* _reverseIfAntiClockwise - If the contour's nodes run anti-clockwise,
|
|
@@ -13,36 +14,16 @@ export default function reverseIfAntiClockwise(
|
|
|
13
14
|
points: Types.Point2[],
|
|
14
15
|
...otherListsToReverse: unknown[][]
|
|
15
16
|
) {
|
|
16
|
-
const
|
|
17
|
-
if (!length) {
|
|
18
|
-
return points;
|
|
19
|
-
}
|
|
20
|
-
let xSum = 0;
|
|
21
|
-
for (const point of points) {
|
|
22
|
-
xSum += point[0];
|
|
23
|
-
}
|
|
24
|
-
const xMean = xSum / length;
|
|
25
|
-
|
|
26
|
-
let checkSum = 0;
|
|
17
|
+
const signedArea = getSignedArea(points);
|
|
27
18
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
i++;
|
|
31
|
-
j++;
|
|
32
|
-
if (i >= length) {
|
|
33
|
-
i = 0;
|
|
34
|
-
}
|
|
35
|
-
if (j >= length) {
|
|
36
|
-
j = 0;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Checksum will be less than zero for anti-clockwise
|
|
41
|
-
if (checkSum < 0) {
|
|
19
|
+
// signedArea will be less than zero for anti-clockwise
|
|
20
|
+
if (signedArea < 0) {
|
|
42
21
|
if (otherListsToReverse) {
|
|
43
22
|
otherListsToReverse.forEach((list) => list.reverse());
|
|
44
23
|
}
|
|
24
|
+
|
|
45
25
|
return points.slice().reverse();
|
|
46
26
|
}
|
|
27
|
+
|
|
47
28
|
return points;
|
|
48
29
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Types } from '@cornerstonejs/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check if two axis-aligned bounding boxes intersect
|
|
5
|
+
* @param aabb1 - First AABB
|
|
6
|
+
* @param aabb2 - Second AABB
|
|
7
|
+
* @returns True if they intersect or false otherwise
|
|
8
|
+
*/
|
|
9
|
+
export default function intersectAABB(
|
|
10
|
+
aabb1: Types.AABB2,
|
|
11
|
+
aabb2: Types.AABB2
|
|
12
|
+
): boolean {
|
|
13
|
+
return (
|
|
14
|
+
aabb1.minX <= aabb2.maxX &&
|
|
15
|
+
aabb1.maxX >= aabb2.minX &&
|
|
16
|
+
aabb1.minY <= aabb2.maxY &&
|
|
17
|
+
aabb1.maxY >= aabb2.minY
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -16,6 +16,11 @@ export default function distanceToPointSquared(p1: Point, p2: Point): number {
|
|
|
16
16
|
|
|
17
17
|
const [x1, y1, z1 = 0] = p1;
|
|
18
18
|
const [x2, y2, z2 = 0] = p2;
|
|
19
|
+
const dx = x2 - x1;
|
|
20
|
+
const dy = y2 - y1;
|
|
21
|
+
const dz = z2 - z1;
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
// Time to square 10M numbers:
|
|
24
|
+
// (n * n) = 161ms | (n ** 2) = 199ms | Math.pow(n, 2) = 29529ms
|
|
25
|
+
return dx * dx + dy * dy + dz * dz;
|
|
21
26
|
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
|
|
3
|
+
// ATTENTION: this is an internal function and it should not be added to "polyline"
|
|
4
|
+
// namespace.
|
|
5
|
+
//
|
|
6
|
+
// TODO: there is a similar function in math.lineSegment.intersectLine but we
|
|
7
|
+
// need to investigate why it is 6x slower than this one when thousands of
|
|
8
|
+
// intersections are calculated. Also that one may return [NaN, NaN] for
|
|
9
|
+
// collinear points.
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Checks whether the line (`p1`,`q1`) intersects the line (`p2`,`q2`) via an
|
|
13
|
+
* orientation algorithm.
|
|
14
|
+
*
|
|
15
|
+
* Credit and details: geeksforgeeks.org/check-if-two-given-line-segments-intersect/
|
|
16
|
+
*
|
|
17
|
+
* @param p1 - Start point of line segment 1
|
|
18
|
+
* @param q1 - End point of line segment 1
|
|
19
|
+
* @param p2 - Start point of line segment 2
|
|
20
|
+
* @param q2 - End point of line segment 2
|
|
21
|
+
* @returns True if the line segments intersect or false otherwise
|
|
22
|
+
*/
|
|
23
|
+
export default function areLineSegmentsIntersecting(
|
|
24
|
+
p1: Types.Point2,
|
|
25
|
+
q1: Types.Point2,
|
|
26
|
+
p2: Types.Point2,
|
|
27
|
+
q2: Types.Point2
|
|
28
|
+
): boolean {
|
|
29
|
+
let result = false;
|
|
30
|
+
|
|
31
|
+
// Line 1 AABB
|
|
32
|
+
const line1MinX = p1[0] < q1[0] ? p1[0] : q1[0];
|
|
33
|
+
const line1MinY = p1[1] < q1[1] ? p1[1] : q1[1];
|
|
34
|
+
const line1MaxX = p1[0] > q1[0] ? p1[0] : q1[0];
|
|
35
|
+
const line1MaxY = p1[1] > q1[1] ? p1[1] : q1[1];
|
|
36
|
+
|
|
37
|
+
// Line 2 AABB
|
|
38
|
+
const line2MinX = p2[0] < q2[0] ? p2[0] : q2[0];
|
|
39
|
+
const line2MinY = p2[1] < q2[1] ? p2[1] : q2[1];
|
|
40
|
+
const line2MaxX = p2[0] > q2[0] ? p2[0] : q2[0];
|
|
41
|
+
const line2MaxY = p2[1] > q2[1] ? p2[1] : q2[1];
|
|
42
|
+
|
|
43
|
+
// If AABBs do not intersect it is impossible for the lines to intersect.
|
|
44
|
+
// Checking AABB before doing any math makes it run ~12% faster.
|
|
45
|
+
if (
|
|
46
|
+
line1MinX > line2MaxX ||
|
|
47
|
+
line1MaxX < line2MinX ||
|
|
48
|
+
line1MinY > line2MaxY ||
|
|
49
|
+
line1MaxY < line2MinY
|
|
50
|
+
) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const orient = [
|
|
55
|
+
orientation(p1, q1, p2),
|
|
56
|
+
orientation(p1, q1, q2),
|
|
57
|
+
orientation(p2, q2, p1),
|
|
58
|
+
orientation(p2, q2, q1),
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
// General Case
|
|
62
|
+
if (orient[0] !== orient[1] && orient[2] !== orient[3]) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Special Cases
|
|
67
|
+
if (orient[0] === 0 && onSegment(p1, p2, q1)) {
|
|
68
|
+
// If p1, q1 and p2 are colinear and p2 lies on segment p1q1
|
|
69
|
+
result = true;
|
|
70
|
+
} else if (orient[1] === 0 && onSegment(p1, q2, q1)) {
|
|
71
|
+
// If p1, q1 and p2 are colinear and q2 lies on segment p1q1
|
|
72
|
+
result = true;
|
|
73
|
+
} else if (orient[2] === 0 && onSegment(p2, p1, q2)) {
|
|
74
|
+
// If p2, q2 and p1 are colinear and p1 lies on segment p2q2
|
|
75
|
+
result = true;
|
|
76
|
+
} else if (orient[3] === 0 && onSegment(p2, q1, q2)) {
|
|
77
|
+
// If p2, q2 and q1 are colinear and q1 lies on segment p2q2
|
|
78
|
+
result = true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Checks the orientation of 3 points, returns a 0, 1 or 2 based on
|
|
86
|
+
* the orientation of the points.
|
|
87
|
+
*/
|
|
88
|
+
function orientation(
|
|
89
|
+
p: Types.Point2,
|
|
90
|
+
q: Types.Point2,
|
|
91
|
+
r: Types.Point2
|
|
92
|
+
): number {
|
|
93
|
+
// Take the cross product between vectors PQ and QR
|
|
94
|
+
const orientationValue =
|
|
95
|
+
(q[1] - p[1]) * (r[0] - q[0]) - (q[0] - p[0]) * (r[1] - q[1]);
|
|
96
|
+
|
|
97
|
+
if (orientationValue === 0) {
|
|
98
|
+
return 0; // Colinear
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return orientationValue > 0 ? 1 : 2;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Checks if point `q` lies on the segment (`p`,`r`).
|
|
106
|
+
*/
|
|
107
|
+
function onSegment(p: Types.Point2, q: Types.Point2, r: Types.Point2): boolean {
|
|
108
|
+
if (
|
|
109
|
+
q[0] <= Math.max(p[0], r[0]) &&
|
|
110
|
+
q[0] >= Math.min(p[0], r[0]) &&
|
|
111
|
+
q[1] <= Math.max(p[1], r[1]) &&
|
|
112
|
+
q[1] >= Math.min(p[1], r[1])
|
|
113
|
+
) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return false;
|
|
118
|
+
}
|