@cornerstonejs/tools 1.50.3 → 1.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/eventListeners/annotations/annotationCompletedListener.d.ts +2 -0
- package/dist/cjs/eventListeners/annotations/annotationCompletedListener.js +35 -0
- package/dist/cjs/eventListeners/annotations/annotationCompletedListener.js.map +1 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts +2 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +174 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/index.d.ts +1 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/index.js +9 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/index.js.map +1 -0
- package/dist/cjs/eventListeners/annotations/index.d.ts +2 -1
- package/dist/cjs/eventListeners/annotations/index.js +3 -1
- package/dist/cjs/eventListeners/annotations/index.js.map +1 -1
- package/dist/cjs/eventListeners/index.d.ts +2 -2
- package/dist/cjs/eventListeners/index.js +2 -1
- package/dist/cjs/eventListeners/index.js.map +1 -1
- package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.d.ts +3 -0
- package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +89 -0
- package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js.map +1 -0
- package/dist/cjs/eventListeners/segmentation/segmentationDataModifiedEventListener.js +5 -53
- package/dist/cjs/eventListeners/segmentation/segmentationDataModifiedEventListener.js.map +1 -1
- package/dist/cjs/init.js +2 -0
- package/dist/cjs/init.js.map +1 -1
- package/dist/cjs/stateManagement/annotation/helpers/state.d.ts +3 -1
- package/dist/cjs/stateManagement/annotation/helpers/state.js +21 -1
- package/dist/cjs/stateManagement/annotation/helpers/state.js.map +1 -1
- package/dist/cjs/store/ToolGroupManager/ToolGroup.d.ts +1 -0
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js +3 -0
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/cjs/store/addTool.d.ts +1 -0
- package/dist/cjs/store/addTool.js +6 -1
- package/dist/cjs/store/addTool.js.map +1 -1
- package/dist/cjs/store/index.d.ts +2 -2
- package/dist/cjs/store/index.js +2 -1
- package/dist/cjs/store/index.js.map +1 -1
- package/dist/cjs/store/removeEnabledElement.js +1 -2
- package/dist/cjs/store/removeEnabledElement.js.map +1 -1
- package/dist/cjs/tools/AdvancedMagnifyTool.js +3 -10
- package/dist/cjs/tools/AdvancedMagnifyTool.js.map +1 -1
- package/dist/cjs/tools/annotation/AngleTool.js +5 -18
- package/dist/cjs/tools/annotation/AngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/ArrowAnnotateTool.js +9 -28
- package/dist/cjs/tools/annotation/ArrowAnnotateTool.js.map +1 -1
- package/dist/cjs/tools/annotation/BidirectionalTool.js +7 -22
- package/dist/cjs/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/cjs/tools/annotation/CircleROITool.js +7 -22
- package/dist/cjs/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/CobbAngleTool.js +5 -18
- package/dist/cjs/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.js +7 -22
- package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/KeyImageTool.js +5 -12
- package/dist/cjs/tools/annotation/KeyImageTool.js.map +1 -1
- package/dist/cjs/tools/annotation/LengthTool.js +5 -18
- package/dist/cjs/tools/annotation/LengthTool.js.map +1 -1
- package/dist/cjs/tools/annotation/LivewireContourTool.d.ts +4 -1
- package/dist/cjs/tools/annotation/LivewireContourTool.js +30 -22
- package/dist/cjs/tools/annotation/LivewireContourTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts +2 -1
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js +11 -0
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.d.ts +2 -10
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +6 -22
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/ProbeTool.js +8 -23
- package/dist/cjs/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.js +8 -22
- package/dist/cjs/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/SplineROITool.d.ts +8 -9
- package/dist/cjs/tools/annotation/SplineROITool.js +27 -10
- package/dist/cjs/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/UltrasoundDirectionalTool.js +5 -18
- package/dist/cjs/tools/annotation/UltrasoundDirectionalTool.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +7 -6
- package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js +8 -5
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/editLoopCommon.js +8 -8
- package/dist/cjs/tools/annotation/planarFreehandROITool/editLoopCommon.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js +6 -5
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
- package/dist/cjs/tools/base/ContourBaseTool.d.ts +2 -8
- package/dist/cjs/tools/base/ContourBaseTool.js.map +1 -1
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.d.ts +3 -2
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js +13 -1
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/RectangleROIStartEndThresholdTool.js +3 -9
- package/dist/cjs/tools/segmentation/RectangleROIStartEndThresholdTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/RectangleROIThresholdTool.js +3 -9
- package/dist/cjs/tools/segmentation/RectangleROIThresholdTool.js.map +1 -1
- package/dist/cjs/types/AnnotationRenderContext.d.ts +11 -0
- package/dist/cjs/types/AnnotationRenderContext.js +3 -0
- package/dist/cjs/types/AnnotationRenderContext.js.map +1 -0
- package/dist/cjs/types/IToolGroup.d.ts +2 -1
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/cjs/utilities/contourSegmentation/areSameSegment.d.ts +2 -0
- package/dist/cjs/utilities/contourSegmentation/areSameSegment.js +12 -0
- package/dist/cjs/utilities/contourSegmentation/areSameSegment.js.map +1 -0
- package/dist/cjs/utilities/contourSegmentation/index.d.ts +2 -0
- package/dist/cjs/utilities/contourSegmentation/index.js +11 -0
- package/dist/cjs/utilities/contourSegmentation/index.js.map +1 -0
- package/dist/cjs/utilities/contourSegmentation/isContourSegmentationAnnotation.d.ts +3 -0
- package/dist/cjs/utilities/contourSegmentation/isContourSegmentationAnnotation.js +8 -0
- package/dist/cjs/utilities/contourSegmentation/isContourSegmentationAnnotation.js.map +1 -0
- package/dist/cjs/utilities/contours/areCoplanarContours.d.ts +2 -0
- package/dist/cjs/utilities/contours/areCoplanarContours.js +19 -0
- package/dist/cjs/utilities/contours/areCoplanarContours.js.map +1 -0
- package/dist/cjs/utilities/contours/index.d.ts +2 -1
- package/dist/cjs/utilities/contours/index.js +3 -1
- package/dist/cjs/utilities/contours/index.js.map +1 -1
- package/dist/cjs/utilities/contours/reverseIfAntiClockwise.js +3 -22
- package/dist/cjs/utilities/contours/reverseIfAntiClockwise.js.map +1 -1
- package/dist/cjs/utilities/math/aabb/index.d.ts +1 -0
- package/dist/cjs/utilities/math/aabb/index.js +3 -1
- package/dist/cjs/utilities/math/aabb/index.js.map +1 -1
- package/dist/cjs/utilities/math/aabb/intersectAABB.d.ts +2 -0
- package/dist/cjs/utilities/math/aabb/intersectAABB.js +10 -0
- package/dist/cjs/utilities/math/aabb/intersectAABB.js.map +1 -0
- package/dist/cjs/utilities/math/point/distanceToPointSquared.js +4 -1
- package/dist/cjs/utilities/math/point/distanceToPointSquared.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/areLineSegmentsIntersecting.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/areLineSegmentsIntersecting.js +59 -0
- package/dist/cjs/utilities/math/polyline/areLineSegmentsIntersecting.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/combinePolyline.d.ts +4 -0
- package/dist/cjs/utilities/math/polyline/combinePolyline.js +213 -0
- package/dist/cjs/utilities/math/polyline/combinePolyline.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/containsPoint.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/containsPoint.js +36 -0
- package/dist/cjs/utilities/math/polyline/containsPoint.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getAABB.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getAABB.js +18 -0
- package/dist/cjs/utilities/math/polyline/getAABB.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getArea.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/{calculateAreaOfPoints.js → getArea.js} +3 -3
- package/dist/cjs/utilities/math/polyline/getArea.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getClosestLineSegmentIntersection.d.ts +5 -0
- package/dist/cjs/utilities/math/polyline/getClosestLineSegmentIntersection.js +51 -0
- package/dist/cjs/utilities/math/polyline/getClosestLineSegmentIntersection.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.js +28 -0
- package/dist/cjs/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js +20 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsIndexes.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsIndexes.js +22 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsIndexes.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.js +21 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getNormal2.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getNormal2.js +12 -0
- package/dist/cjs/utilities/math/polyline/getNormal2.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getNormal3.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getNormal3.js +29 -0
- package/dist/cjs/utilities/math/polyline/getNormal3.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getSignedArea.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getSignedArea.js +20 -0
- package/dist/cjs/utilities/math/polyline/getSignedArea.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/index.d.ts +14 -3
- package/dist/cjs/utilities/math/polyline/index.js +28 -6
- package/dist/cjs/utilities/math/polyline/index.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/intersectPolyline.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/intersectPolyline.js +20 -0
- package/dist/cjs/utilities/math/polyline/intersectPolyline.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/isClosed.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/isClosed.js +39 -0
- package/dist/cjs/utilities/math/polyline/isClosed.js.map +1 -0
- package/dist/esm/eventListeners/annotations/annotationCompletedListener.js +9 -0
- package/dist/esm/eventListeners/annotations/annotationCompletedListener.js.map +1 -0
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +153 -0
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -0
- package/dist/esm/eventListeners/annotations/contourSegmentation/index.js +2 -0
- package/dist/esm/eventListeners/annotations/contourSegmentation/index.js.map +1 -0
- package/dist/esm/eventListeners/annotations/index.js +2 -1
- package/dist/esm/eventListeners/annotations/index.js.map +1 -1
- package/dist/esm/eventListeners/index.js +2 -2
- package/dist/esm/eventListeners/index.js.map +1 -1
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +61 -0
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js.map +1 -0
- package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js +5 -53
- package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js.map +1 -1
- package/dist/esm/init.js +3 -1
- package/dist/esm/init.js.map +1 -1
- package/dist/esm/stateManagement/annotation/helpers/state.js +19 -1
- package/dist/esm/stateManagement/annotation/helpers/state.js.map +1 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.js +3 -0
- package/dist/esm/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/esm/store/addTool.js +4 -0
- package/dist/esm/store/addTool.js.map +1 -1
- package/dist/esm/store/index.js +2 -2
- package/dist/esm/store/index.js.map +1 -1
- package/dist/esm/store/removeEnabledElement.js +1 -2
- package/dist/esm/store/removeEnabledElement.js.map +1 -1
- package/dist/esm/tools/AdvancedMagnifyTool.js +4 -11
- package/dist/esm/tools/AdvancedMagnifyTool.js.map +1 -1
- package/dist/esm/tools/annotation/AngleTool.js +6 -19
- package/dist/esm/tools/annotation/AngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js +10 -29
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js.map +1 -1
- package/dist/esm/tools/annotation/BidirectionalTool.js +8 -23
- package/dist/esm/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/esm/tools/annotation/CircleROITool.js +8 -23
- package/dist/esm/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/CobbAngleTool.js +6 -19
- package/dist/esm/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +8 -23
- package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/esm/tools/annotation/KeyImageTool.js +6 -13
- package/dist/esm/tools/annotation/KeyImageTool.js.map +1 -1
- package/dist/esm/tools/annotation/LengthTool.js +6 -19
- package/dist/esm/tools/annotation/LengthTool.js.map +1 -1
- package/dist/esm/tools/annotation/LivewireContourTool.js +31 -23
- package/dist/esm/tools/annotation/LivewireContourTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js +11 -0
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +7 -23
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/esm/tools/annotation/ProbeTool.js +9 -24
- package/dist/esm/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.js +9 -23
- package/dist/esm/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/SplineROITool.js +26 -9
- package/dist/esm/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js +6 -19
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +7 -6
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js +8 -5
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/editLoopCommon.js +8 -8
- package/dist/esm/tools/annotation/planarFreehandROITool/editLoopCommon.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js +6 -5
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
- package/dist/esm/tools/base/ContourBaseTool.js.map +1 -1
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js +13 -1
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +4 -10
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js.map +1 -1
- package/dist/esm/tools/segmentation/RectangleROIThresholdTool.js +4 -10
- package/dist/esm/tools/segmentation/RectangleROIThresholdTool.js.map +1 -1
- package/dist/esm/types/AnnotationRenderContext.js +2 -0
- package/dist/esm/types/AnnotationRenderContext.js.map +1 -0
- package/dist/esm/utilities/contourSegmentation/areSameSegment.js +9 -0
- package/dist/esm/utilities/contourSegmentation/areSameSegment.js.map +1 -0
- package/dist/esm/utilities/contourSegmentation/index.js +3 -0
- package/dist/esm/utilities/contourSegmentation/index.js.map +1 -0
- package/dist/esm/utilities/contourSegmentation/isContourSegmentationAnnotation.js +4 -0
- package/dist/esm/utilities/contourSegmentation/isContourSegmentationAnnotation.js.map +1 -0
- package/dist/esm/utilities/contours/areCoplanarContours.js +16 -0
- package/dist/esm/utilities/contours/areCoplanarContours.js.map +1 -0
- package/dist/esm/utilities/contours/index.js +2 -1
- package/dist/esm/utilities/contours/index.js.map +1 -1
- package/dist/esm/utilities/contours/reverseIfAntiClockwise.js +3 -22
- package/dist/esm/utilities/contours/reverseIfAntiClockwise.js.map +1 -1
- package/dist/esm/utilities/math/aabb/index.js +1 -0
- package/dist/esm/utilities/math/aabb/index.js.map +1 -1
- package/dist/esm/utilities/math/aabb/intersectAABB.js +7 -0
- package/dist/esm/utilities/math/aabb/intersectAABB.js.map +1 -0
- package/dist/esm/utilities/math/point/distanceToPointSquared.js +4 -1
- package/dist/esm/utilities/math/point/distanceToPointSquared.js.map +1 -1
- package/dist/esm/utilities/math/polyline/areLineSegmentsIntersecting.js +56 -0
- package/dist/esm/utilities/math/polyline/areLineSegmentsIntersecting.js.map +1 -0
- package/dist/esm/utilities/math/polyline/combinePolyline.js +187 -0
- package/dist/esm/utilities/math/polyline/combinePolyline.js.map +1 -0
- package/dist/esm/utilities/math/polyline/containsPoint.js +30 -0
- package/dist/esm/utilities/math/polyline/containsPoint.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getAABB.js +15 -0
- package/dist/esm/utilities/math/polyline/getAABB.js.map +1 -0
- package/dist/esm/utilities/math/polyline/{calculateAreaOfPoints.js → getArea.js} +2 -2
- package/dist/esm/utilities/math/polyline/getArea.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getClosestLineSegmentIntersection.js +45 -0
- package/dist/esm/utilities/math/polyline/getClosestLineSegmentIntersection.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.js +22 -0
- package/dist/esm/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js +14 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsIndexes.js +16 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsIndexes.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentsIntersection.js +18 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentsIntersection.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getNormal2.js +6 -0
- package/dist/esm/utilities/math/polyline/getNormal2.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getNormal3.js +26 -0
- package/dist/esm/utilities/math/polyline/getNormal3.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getSignedArea.js +17 -0
- package/dist/esm/utilities/math/polyline/getSignedArea.js.map +1 -0
- package/dist/esm/utilities/math/polyline/index.js +14 -3
- package/dist/esm/utilities/math/polyline/index.js.map +1 -1
- package/dist/esm/utilities/math/polyline/intersectPolyline.js +14 -0
- package/dist/esm/utilities/math/polyline/intersectPolyline.js.map +1 -0
- package/dist/esm/utilities/math/polyline/isClosed.js +13 -0
- package/dist/esm/utilities/math/polyline/isClosed.js.map +1 -0
- package/dist/types/eventListeners/annotations/annotationCompletedListener.d.ts +3 -0
- package/dist/types/eventListeners/annotations/annotationCompletedListener.d.ts.map +1 -0
- package/dist/types/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts +3 -0
- package/dist/types/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts.map +1 -0
- package/dist/types/eventListeners/annotations/contourSegmentation/index.d.ts +2 -0
- package/dist/types/eventListeners/annotations/contourSegmentation/index.d.ts.map +1 -0
- package/dist/types/eventListeners/annotations/index.d.ts +2 -1
- package/dist/types/eventListeners/annotations/index.d.ts.map +1 -1
- package/dist/types/eventListeners/index.d.ts +2 -2
- package/dist/types/eventListeners/index.d.ts.map +1 -1
- package/dist/types/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.d.ts +4 -0
- package/dist/types/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.d.ts.map +1 -0
- package/dist/types/eventListeners/segmentation/segmentationDataModifiedEventListener.d.ts.map +1 -1
- package/dist/types/init.d.ts.map +1 -1
- package/dist/types/stateManagement/annotation/helpers/state.d.ts +3 -1
- package/dist/types/stateManagement/annotation/helpers/state.d.ts.map +1 -1
- package/dist/types/store/ToolGroupManager/ToolGroup.d.ts +1 -0
- package/dist/types/store/ToolGroupManager/ToolGroup.d.ts.map +1 -1
- package/dist/types/store/addTool.d.ts +1 -0
- package/dist/types/store/addTool.d.ts.map +1 -1
- package/dist/types/store/index.d.ts +2 -2
- package/dist/types/store/index.d.ts.map +1 -1
- package/dist/types/store/removeEnabledElement.d.ts.map +1 -1
- package/dist/types/tools/AdvancedMagnifyTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/AngleTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/ArrowAnnotateTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/BidirectionalTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/CircleROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/CobbAngleTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/EllipticalROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/KeyImageTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/LengthTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/LivewireContourTool.d.ts +4 -1
- package/dist/types/tools/annotation/LivewireContourTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts +2 -1
- package/dist/types/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts +2 -10
- package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/ProbeTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/RectangleROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/SplineROITool.d.ts +8 -9
- package/dist/types/tools/annotation/SplineROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/UltrasoundDirectionalTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/closedContourEditLoop.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/drawLoop.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/editLoopCommon.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/openContourEditLoop.d.ts.map +1 -1
- package/dist/types/tools/base/ContourBaseTool.d.ts +2 -8
- package/dist/types/tools/base/ContourBaseTool.d.ts.map +1 -1
- package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts +3 -2
- package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/RectangleROIStartEndThresholdTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/RectangleROIThresholdTool.d.ts.map +1 -1
- package/dist/types/types/AnnotationRenderContext.d.ts +12 -0
- package/dist/types/types/AnnotationRenderContext.d.ts.map +1 -0
- package/dist/types/types/IToolGroup.d.ts +2 -1
- package/dist/types/types/IToolGroup.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utilities/contourSegmentation/areSameSegment.d.ts +3 -0
- package/dist/types/utilities/contourSegmentation/areSameSegment.d.ts.map +1 -0
- package/dist/types/utilities/contourSegmentation/index.d.ts +3 -0
- package/dist/types/utilities/contourSegmentation/index.d.ts.map +1 -0
- package/dist/types/utilities/contourSegmentation/isContourSegmentationAnnotation.d.ts +4 -0
- package/dist/types/utilities/contourSegmentation/isContourSegmentationAnnotation.d.ts.map +1 -0
- package/dist/types/utilities/contours/areCoplanarContours.d.ts +3 -0
- package/dist/types/utilities/contours/areCoplanarContours.d.ts.map +1 -0
- package/dist/types/utilities/contours/index.d.ts +2 -1
- package/dist/types/utilities/contours/index.d.ts.map +1 -1
- package/dist/types/utilities/contours/reverseIfAntiClockwise.d.ts.map +1 -1
- package/dist/types/utilities/math/aabb/index.d.ts +1 -0
- package/dist/types/utilities/math/aabb/index.d.ts.map +1 -1
- package/dist/types/utilities/math/aabb/intersectAABB.d.ts +3 -0
- package/dist/types/utilities/math/aabb/intersectAABB.d.ts.map +1 -0
- package/dist/types/utilities/math/point/distanceToPointSquared.d.ts.map +1 -1
- package/dist/types/utilities/math/polyline/areLineSegmentsIntersecting.d.ts +3 -0
- package/dist/types/utilities/math/polyline/areLineSegmentsIntersecting.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/combinePolyline.d.ts +5 -0
- package/dist/types/utilities/math/polyline/combinePolyline.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/containsPoint.d.ts +3 -0
- package/dist/types/utilities/math/polyline/containsPoint.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getAABB.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getAABB.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getArea.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getArea.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getClosestLineSegmentIntersection.d.ts +6 -0
- package/dist/types/utilities/math/polyline/getClosestLineSegmentIntersection.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getLineSegmentIntersectionsIndexes.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getLineSegmentIntersectionsIndexes.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getLineSegmentsIntersection.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getLineSegmentsIntersection.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getNormal2.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getNormal2.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getNormal3.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getNormal3.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getSignedArea.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getSignedArea.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/index.d.ts +14 -3
- package/dist/types/utilities/math/polyline/index.d.ts.map +1 -1
- package/dist/types/utilities/math/polyline/intersectPolyline.d.ts +3 -0
- package/dist/types/utilities/math/polyline/intersectPolyline.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/isClosed.d.ts +3 -0
- package/dist/types/utilities/math/polyline/isClosed.d.ts.map +1 -0
- package/dist/umd/index.js +1 -2
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/eventListeners/annotations/annotationCompletedListener.ts +13 -0
- package/src/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.ts +273 -0
- package/src/eventListeners/annotations/contourSegmentation/index.ts +1 -0
- package/src/eventListeners/annotations/index.ts +6 -1
- package/src/eventListeners/index.ts +2 -0
- package/src/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.ts +117 -0
- package/src/eventListeners/segmentation/segmentationDataModifiedEventListener.ts +5 -99
- package/src/init.ts +12 -1
- package/src/stateManagement/annotation/helpers/state.ts +42 -2
- package/src/store/ToolGroupManager/ToolGroup.ts +10 -0
- package/src/store/addTool.ts +11 -0
- package/src/store/index.ts +2 -1
- package/src/store/removeEnabledElement.ts +2 -1
- package/src/tools/AdvancedMagnifyTool.ts +4 -21
- package/src/tools/annotation/AngleTool.ts +8 -32
- package/src/tools/annotation/ArrowAnnotateTool.ts +12 -45
- package/src/tools/annotation/BidirectionalTool.ts +11 -39
- package/src/tools/annotation/CircleROITool.ts +10 -34
- package/src/tools/annotation/CobbAngleTool.ts +9 -32
- package/src/tools/annotation/EllipticalROITool.ts +10 -34
- package/src/tools/annotation/KeyImageTool.ts +9 -23
- package/src/tools/annotation/LengthTool.ts +9 -33
- package/src/tools/annotation/LivewireContourTool.ts +58 -33
- package/src/tools/annotation/PlanarFreehandContourSegmentationTool.ts +22 -1
- package/src/tools/annotation/PlanarFreehandROITool.ts +10 -53
- package/src/tools/annotation/ProbeTool.ts +11 -36
- package/src/tools/annotation/RectangleROITool.ts +11 -33
- package/src/tools/annotation/SplineROITool.ts +53 -24
- package/src/tools/annotation/UltrasoundDirectionalTool.ts +8 -29
- package/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts +9 -11
- package/src/tools/annotation/planarFreehandROITool/drawLoop.ts +8 -5
- package/src/tools/annotation/planarFreehandROITool/editLoopCommon.ts +9 -8
- package/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts +7 -6
- package/src/tools/base/ContourBaseTool.ts +5 -8
- package/src/tools/base/ContourSegmentationBaseTool.ts +29 -6
- package/src/tools/segmentation/RectangleROIStartEndThresholdTool.ts +3 -13
- package/src/tools/segmentation/RectangleROIThresholdTool.ts +3 -14
- package/src/types/AnnotationRenderContext.ts +13 -0
- package/src/types/IToolGroup.ts +3 -1
- package/src/types/index.ts +3 -0
- package/src/utilities/contourSegmentation/areSameSegment.ts +24 -0
- package/src/utilities/contourSegmentation/index.ts +2 -0
- package/src/utilities/contourSegmentation/isContourSegmentationAnnotation.ts +8 -0
- package/src/utilities/contours/areCoplanarContours.ts +39 -0
- package/src/utilities/contours/index.ts +2 -0
- package/src/utilities/contours/reverseIfAntiClockwise.ts +6 -25
- package/src/utilities/math/aabb/index.ts +1 -0
- package/src/utilities/math/aabb/intersectAABB.ts +19 -0
- package/src/utilities/math/point/distanceToPointSquared.ts +6 -1
- package/src/utilities/math/polyline/areLineSegmentsIntersecting.ts +118 -0
- package/src/utilities/math/polyline/combinePolyline.ts +350 -0
- package/src/utilities/math/polyline/containsPoint.ts +63 -0
- package/src/utilities/math/polyline/getAABB.ts +20 -0
- package/src/utilities/math/polyline/{calculateAreaOfPoints.ts → getArea.ts} +1 -1
- package/src/utilities/math/polyline/getClosestLineSegmentIntersection.ts +72 -0
- package/src/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.ts +42 -0
- package/src/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.ts +30 -0
- package/src/utilities/math/polyline/getLineSegmentIntersectionsIndexes.ts +35 -0
- package/src/utilities/math/polyline/getLineSegmentsIntersection.ts +47 -0
- package/src/utilities/math/polyline/getNormal2.ts +17 -0
- package/src/utilities/math/polyline/getNormal3.ts +53 -0
- package/src/utilities/math/polyline/getSignedArea.ts +47 -0
- package/src/utilities/math/polyline/index.ts +27 -8
- package/src/utilities/math/polyline/intersectPolyline.ts +34 -0
- package/src/utilities/math/polyline/isClosed.ts +26 -0
- package/dist/cjs/utilities/math/polyline/calculateAreaOfPoints.d.ts +0 -2
- package/dist/cjs/utilities/math/polyline/calculateAreaOfPoints.js.map +0 -1
- package/dist/cjs/utilities/math/polyline/getIntersectionWithPolyline.d.ts +0 -9
- package/dist/cjs/utilities/math/polyline/getIntersectionWithPolyline.js +0 -160
- package/dist/cjs/utilities/math/polyline/getIntersectionWithPolyline.js.map +0 -1
- package/dist/cjs/utilities/math/polyline/pointInPolyline.d.ts +0 -2
- package/dist/cjs/utilities/math/polyline/pointInPolyline.js +0 -15
- package/dist/cjs/utilities/math/polyline/pointInPolyline.js.map +0 -1
- package/dist/esm/utilities/math/polyline/calculateAreaOfPoints.js.map +0 -1
- package/dist/esm/utilities/math/polyline/getIntersectionWithPolyline.js +0 -154
- package/dist/esm/utilities/math/polyline/getIntersectionWithPolyline.js.map +0 -1
- package/dist/esm/utilities/math/polyline/pointInPolyline.js +0 -12
- package/dist/esm/utilities/math/polyline/pointInPolyline.js.map +0 -1
- package/dist/types/utilities/math/polyline/calculateAreaOfPoints.d.ts +0 -3
- package/dist/types/utilities/math/polyline/calculateAreaOfPoints.d.ts.map +0 -1
- package/dist/types/utilities/math/polyline/getIntersectionWithPolyline.d.ts +0 -10
- package/dist/types/utilities/math/polyline/getIntersectionWithPolyline.d.ts.map +0 -1
- package/dist/types/utilities/math/polyline/pointInPolyline.d.ts +0 -3
- package/dist/types/utilities/math/polyline/pointInPolyline.d.ts.map +0 -1
- package/dist/umd/index.js.LICENSE.txt +0 -6
- package/src/utilities/math/polyline/getIntersectionWithPolyline.ts +0 -275
- package/src/utilities/math/polyline/pointInPolyline.ts +0 -19
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const contourSegUtils = __importStar(require("../../utilities/contourSegmentation"));
|
|
27
|
+
const contourSegmentation_1 = require("./contourSegmentation");
|
|
28
|
+
function annotationCompletedListener(evt) {
|
|
29
|
+
const annotation = evt.detail.annotation;
|
|
30
|
+
if (contourSegUtils.isContourSegmentationAnnotation(annotation)) {
|
|
31
|
+
(0, contourSegmentation_1.contourSegmentationCompleted)(evt);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.default = annotationCompletedListener;
|
|
35
|
+
//# sourceMappingURL=annotationCompletedListener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotationCompletedListener.js","sourceRoot":"","sources":["../../../../src/eventListeners/annotations/annotationCompletedListener.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,qFAAuE;AACvE,+DAAqE;AAErE,SAAwB,2BAA2B,CACjD,GAAiC;IAEjC,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC;IAEzC,IAAI,eAAe,CAAC,+BAA+B,CAAC,UAAU,CAAC,EAAE;QAC/D,IAAA,kDAA4B,EAAC,GAAG,CAAC,CAAC;KACnC;AACH,CAAC;AARD,8CAQC"}
|
package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const core_1 = require("@cornerstonejs/core");
|
|
27
|
+
const utilities_1 = require("../../../utilities");
|
|
28
|
+
const viewportFilters_1 = require("../../../utilities/viewportFilters");
|
|
29
|
+
const annotationState_1 = require("../../../stateManagement/annotation/annotationState");
|
|
30
|
+
const contourUtils = __importStar(require("../../../utilities/contours"));
|
|
31
|
+
const contourSegUtils = __importStar(require("../../../utilities/contourSegmentation"));
|
|
32
|
+
const store_1 = require("../../../store");
|
|
33
|
+
const tools_1 = require("../../../tools");
|
|
34
|
+
const DEFAULT_CONTOUR_SEG_TOOLNAME = 'PlanarFreehandContourSegmentationTool';
|
|
35
|
+
function contourSegmentationCompletedListener(evt) {
|
|
36
|
+
const sourceAnnotation = evt.detail
|
|
37
|
+
.annotation;
|
|
38
|
+
if (!contourSegUtils.isContourSegmentationAnnotation(sourceAnnotation)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const viewport = (0, utilities_1.getViewportForAnnotation)(sourceAnnotation);
|
|
42
|
+
const contourSegmentationAnnotations = getValidContourSegmentationAnnotations(sourceAnnotation);
|
|
43
|
+
if (!contourSegmentationAnnotations.length) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const sourcePolyline = convertContourPolylineToCanvasSpace(sourceAnnotation.data.contour.polyline, viewport);
|
|
47
|
+
const targetAnnotationInfo = findIntersectingContour(viewport, sourcePolyline, contourSegmentationAnnotations);
|
|
48
|
+
if (!targetAnnotationInfo) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (!isFreehandContourSegToolRegistered(viewport)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const { targetAnnotation, targetPolyline } = targetAnnotationInfo;
|
|
55
|
+
processContours(viewport, sourceAnnotation, sourcePolyline, targetAnnotation, targetPolyline);
|
|
56
|
+
}
|
|
57
|
+
exports.default = contourSegmentationCompletedListener;
|
|
58
|
+
function isFreehandContourSegToolRegistered(viewport) {
|
|
59
|
+
const { toolName } = tools_1.PlanarFreehandContourSegmentationTool;
|
|
60
|
+
if (!(0, store_1.hasTool)(tools_1.PlanarFreehandContourSegmentationTool)) {
|
|
61
|
+
console.warn(`${toolName} is not registered in cornerstone`);
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
const toolGroup = store_1.ToolGroupManager.getToolGroupForViewport(viewport.id, viewport.renderingEngineId);
|
|
65
|
+
if (!toolGroup.hasTool(toolName)) {
|
|
66
|
+
console.warn(`Tool ${toolName} not added to ${toolGroup.id} toolGroup`);
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
if (!toolGroup.getToolOptions(toolName)) {
|
|
70
|
+
console.warn(`Tool ${toolName} must be in active/passive state`);
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
function convertContourPolylineToCanvasSpace(polyline, viewport) {
|
|
76
|
+
const numPoints = polyline.length;
|
|
77
|
+
const projectedPolyline = new Array(numPoints);
|
|
78
|
+
for (let i = 0; i < numPoints; i++) {
|
|
79
|
+
projectedPolyline[i] = viewport.worldToCanvas(polyline[i]);
|
|
80
|
+
}
|
|
81
|
+
return projectedPolyline;
|
|
82
|
+
}
|
|
83
|
+
function convertPolylineToWorldSpace(polyline, viewport) {
|
|
84
|
+
const numPoints = polyline.length;
|
|
85
|
+
const projectedPolyline = new Array(numPoints);
|
|
86
|
+
for (let i = 0; i < numPoints; i++) {
|
|
87
|
+
projectedPolyline[i] = viewport.canvasToWorld(polyline[i]);
|
|
88
|
+
}
|
|
89
|
+
return projectedPolyline;
|
|
90
|
+
}
|
|
91
|
+
function getValidContourSegmentationAnnotations(sourceAnnotation) {
|
|
92
|
+
const { annotationUID: sourceAnnotationUID } = sourceAnnotation;
|
|
93
|
+
const { FrameOfReferenceUID } = sourceAnnotation.metadata;
|
|
94
|
+
const toolName = undefined;
|
|
95
|
+
const annotationsGroups = (0, annotationState_1.getAnnotations)(toolName, FrameOfReferenceUID);
|
|
96
|
+
const toolNames = Object.keys(annotationsGroups);
|
|
97
|
+
return toolNames.reduce((validAnnotations, toolName) => {
|
|
98
|
+
const toolAnnotations = annotationsGroups[toolName].filter((targetAnnotation) => targetAnnotation.annotationUID &&
|
|
99
|
+
targetAnnotation.annotationUID !== sourceAnnotationUID &&
|
|
100
|
+
contourSegUtils.isContourSegmentationAnnotation(targetAnnotation) &&
|
|
101
|
+
contourSegUtils.areSameSegment(targetAnnotation, sourceAnnotation) &&
|
|
102
|
+
contourUtils.areCoplanarContours(targetAnnotation, sourceAnnotation));
|
|
103
|
+
return validAnnotations.concat(toolAnnotations);
|
|
104
|
+
}, []);
|
|
105
|
+
}
|
|
106
|
+
function findIntersectingContour(viewport, sourcePolyline, contourSegmentationAnnotations) {
|
|
107
|
+
const sourceAABB = utilities_1.math.polyline.getAABB(sourcePolyline);
|
|
108
|
+
for (let i = 0; i < contourSegmentationAnnotations.length; i++) {
|
|
109
|
+
const targetAnnotation = contourSegmentationAnnotations[i];
|
|
110
|
+
const targetPolyline = convertContourPolylineToCanvasSpace(targetAnnotation.data.contour.polyline, viewport);
|
|
111
|
+
const targetAABB = utilities_1.math.polyline.getAABB(targetPolyline);
|
|
112
|
+
const polylinesIntersect = utilities_1.math.aabb.intersectAABB(sourceAABB, targetAABB) &&
|
|
113
|
+
utilities_1.math.polyline.intersectPolyline(sourcePolyline, targetPolyline);
|
|
114
|
+
if (polylinesIntersect) {
|
|
115
|
+
return { targetAnnotation, targetPolyline };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function processContours(viewport, sourceAnnotation, sourcePolyline, targetAnnotation, targetPolyline) {
|
|
120
|
+
const sourceStartPoint = sourcePolyline[0];
|
|
121
|
+
const mergePolylines = utilities_1.math.polyline.containsPoint(targetPolyline, sourceStartPoint);
|
|
122
|
+
const newPolylines = [];
|
|
123
|
+
if (mergePolylines) {
|
|
124
|
+
const mergedPolyline = utilities_1.math.polyline.mergePolylines(targetPolyline, sourcePolyline);
|
|
125
|
+
newPolylines.push(mergedPolyline);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
const subtractedPolylines = utilities_1.math.polyline.subtractPolylines(targetPolyline, sourcePolyline);
|
|
129
|
+
subtractedPolylines.forEach((newPolyline) => newPolylines.push(newPolyline));
|
|
130
|
+
}
|
|
131
|
+
(0, annotationState_1.removeAnnotation)(sourceAnnotation.annotationUID);
|
|
132
|
+
(0, annotationState_1.removeAnnotation)(targetAnnotation.annotationUID);
|
|
133
|
+
const { element } = viewport;
|
|
134
|
+
const enabledElement = (0, core_1.getEnabledElement)(element);
|
|
135
|
+
const { renderingEngine } = enabledElement;
|
|
136
|
+
const { metadata, data } = targetAnnotation;
|
|
137
|
+
const { handles, segmentation } = data;
|
|
138
|
+
const { textBox } = handles;
|
|
139
|
+
for (let i = 0; i < newPolylines.length; i++) {
|
|
140
|
+
const polyline = convertPolylineToWorldSpace(newPolylines[i], viewport);
|
|
141
|
+
const startPoint = polyline[0];
|
|
142
|
+
const endPoint = polyline[polyline.length - 1];
|
|
143
|
+
const newAnnotation = {
|
|
144
|
+
metadata: Object.assign(Object.assign({}, metadata), { toolName: DEFAULT_CONTOUR_SEG_TOOLNAME }),
|
|
145
|
+
data: {
|
|
146
|
+
cachedStats: {},
|
|
147
|
+
handles: {
|
|
148
|
+
points: [startPoint, endPoint],
|
|
149
|
+
textBox: textBox ? Object.assign({}, textBox) : undefined,
|
|
150
|
+
},
|
|
151
|
+
contour: {
|
|
152
|
+
polyline,
|
|
153
|
+
closed: true,
|
|
154
|
+
},
|
|
155
|
+
segmentation: Object.assign({}, segmentation),
|
|
156
|
+
},
|
|
157
|
+
annotationUID: core_1.utilities.uuidv4(),
|
|
158
|
+
highlighted: true,
|
|
159
|
+
invalidated: true,
|
|
160
|
+
isLocked: false,
|
|
161
|
+
isVisible: undefined,
|
|
162
|
+
};
|
|
163
|
+
(0, annotationState_1.addAnnotation)(newAnnotation, element);
|
|
164
|
+
const updatedTtoolNames = new Set([
|
|
165
|
+
DEFAULT_CONTOUR_SEG_TOOLNAME,
|
|
166
|
+
targetAnnotation.metadata.toolName,
|
|
167
|
+
]);
|
|
168
|
+
for (const toolName of updatedTtoolNames.values()) {
|
|
169
|
+
const viewportIdsToRender = (0, viewportFilters_1.getViewportIdsWithToolToRender)(element, toolName);
|
|
170
|
+
(0, utilities_1.triggerAnnotationRenderForViewportIds)(renderingEngine, viewportIdsToRender);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=contourSegmentationCompleted.js.map
|
package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contourSegmentationCompleted.js","sourceRoot":"","sources":["../../../../../src/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAI6B;AAE7B,kDAI4B;AAC5B,wEAAoF;AACpF,yFAI6D;AAE7D,0EAA4D;AAC5D,wFAA0E;AAC1E,0CAAyE;AACzE,0CAAuE;AAEvE,MAAM,4BAA4B,GAAG,uCAAuC,CAAC;AAE7E,SAAwB,oCAAoC,CAC1D,GAAiC;IAEjC,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM;SAChC,UAA2C,CAAC;IAE/C,IAAI,CAAC,eAAe,CAAC,+BAA+B,CAAC,gBAAgB,CAAC,EAAE;QACtE,OAAO;KACR;IAED,MAAM,QAAQ,GAAG,IAAA,oCAAwB,EAAC,gBAAgB,CAAC,CAAC;IAC5D,MAAM,8BAA8B,GAClC,sCAAsC,CAAC,gBAAgB,CAAC,CAAC;IAE3D,IAAI,CAAC,8BAA8B,CAAC,MAAM,EAAE;QAC1C,OAAO;KACR;IAED,MAAM,cAAc,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,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC/C,MAAM,aAAa,GAAG;YACpB,QAAQ,kCACH,QAAQ,KACX,QAAQ,EAAE,4BAA4B,GACvC;YACD,IAAI,EAAE;gBACJ,WAAW,EAAE,EAAE;gBACf,OAAO,EAAE;oBACP,MAAM,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;oBAC9B,OAAO,EAAE,OAAO,CAAC,CAAC,mBAAM,OAAO,EAAG,CAAC,CAAC,SAAS;iBAC9C;gBACD,OAAO,EAAE;oBACP,QAAQ;oBACR,MAAM,EAAE,IAAI;iBACb;gBACD,YAAY,oBACP,YAAY,CAChB;aACF;YACD,aAAa,EAAE,gBAAO,CAAC,MAAM,EAAY;YACzC,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,IAAI;YACjB,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,SAAS;SACrB,CAAC;QAEF,IAAA,+BAAa,EAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAGtC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;YAChC,4BAA4B;YAC5B,gBAAgB,CAAC,QAAQ,CAAC,QAAQ;SACnC,CAAC,CAAC;QAEH,KAAK,MAAM,QAAQ,IAAI,iBAAiB,CAAC,MAAM,EAAE,EAAE;YACjD,MAAM,mBAAmB,GAAG,IAAA,gDAA8B,EACxD,OAAO,EACP,QAAQ,CACT,CAAC;YACF,IAAA,iDAAqC,EACnC,eAAe,EACf,mBAAmB,CACpB,CAAC;SACH;KACF;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as contourSegmentationCompleted } from './contourSegmentationCompleted';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.contourSegmentationCompleted = void 0;
|
|
7
|
+
var contourSegmentationCompleted_1 = require("./contourSegmentationCompleted");
|
|
8
|
+
Object.defineProperty(exports, "contourSegmentationCompleted", { enumerable: true, get: function () { return __importDefault(contourSegmentationCompleted_1).default; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/eventListeners/annotations/contourSegmentation/index.ts"],"names":[],"mappings":";;;;;;AAAA,+EAAyF;AAAhF,6JAAA,OAAO,OAAgC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import annotationCompletedListener from './annotationCompletedListener';
|
|
1
2
|
import annotationSelectionListener from './annotationSelectionListener';
|
|
2
3
|
import annotationModifiedListener from './annotationModifiedListener';
|
|
3
|
-
export { annotationSelectionListener, annotationModifiedListener };
|
|
4
|
+
export { annotationCompletedListener, annotationSelectionListener, annotationModifiedListener, };
|
|
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.annotationModifiedListener = exports.annotationSelectionListener = void 0;
|
|
6
|
+
exports.annotationModifiedListener = exports.annotationSelectionListener = exports.annotationCompletedListener = void 0;
|
|
7
|
+
const annotationCompletedListener_1 = __importDefault(require("./annotationCompletedListener"));
|
|
8
|
+
exports.annotationCompletedListener = annotationCompletedListener_1.default;
|
|
7
9
|
const annotationSelectionListener_1 = __importDefault(require("./annotationSelectionListener"));
|
|
8
10
|
exports.annotationSelectionListener = annotationSelectionListener_1.default;
|
|
9
11
|
const annotationModifiedListener_1 = __importDefault(require("./annotationModifiedListener"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/eventListeners/annotations/index.ts"],"names":[],"mappings":";;;;;;AAAA,gGAAwE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/eventListeners/annotations/index.ts"],"names":[],"mappings":";;;;;;AAAA,gGAAwE;AAKtE,sCALK,qCAA2B,CAKL;AAJ7B,gGAAwE;AAKtE,sCALK,qCAA2B,CAKL;AAJ7B,8FAAsE;AAKpE,qCALK,oCAA0B,CAKL"}
|
|
@@ -3,5 +3,5 @@ import touchEventListeners from './touch';
|
|
|
3
3
|
import wheelEventListener from './wheel';
|
|
4
4
|
import keyEventListener from './keyboard';
|
|
5
5
|
import { segmentationDataModifiedEventListener, segmentationRepresentationModifiedEventListener, segmentationRepresentationRemovedEventListener, segmentationModifiedListener, imageChangeEventListener } from './segmentation';
|
|
6
|
-
import { annotationSelectionListener, annotationModifiedListener } from './annotations';
|
|
7
|
-
export { mouseEventListeners, touchEventListeners, wheelEventListener, keyEventListener, segmentationRepresentationModifiedEventListener, segmentationModifiedListener, segmentationRepresentationRemovedEventListener, segmentationDataModifiedEventListener, imageChangeEventListener, annotationSelectionListener, annotationModifiedListener, };
|
|
6
|
+
import { annotationCompletedListener, annotationSelectionListener, annotationModifiedListener } from './annotations';
|
|
7
|
+
export { mouseEventListeners, touchEventListeners, wheelEventListener, keyEventListener, segmentationRepresentationModifiedEventListener, segmentationModifiedListener, segmentationRepresentationRemovedEventListener, segmentationDataModifiedEventListener, imageChangeEventListener, annotationCompletedListener, annotationSelectionListener, annotationModifiedListener, };
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.annotationModifiedListener = exports.annotationSelectionListener = exports.imageChangeEventListener = exports.segmentationDataModifiedEventListener = exports.segmentationRepresentationRemovedEventListener = exports.segmentationModifiedListener = exports.segmentationRepresentationModifiedEventListener = exports.keyEventListener = exports.wheelEventListener = exports.touchEventListeners = exports.mouseEventListeners = void 0;
|
|
6
|
+
exports.annotationModifiedListener = exports.annotationSelectionListener = exports.annotationCompletedListener = exports.imageChangeEventListener = exports.segmentationDataModifiedEventListener = exports.segmentationRepresentationRemovedEventListener = exports.segmentationModifiedListener = exports.segmentationRepresentationModifiedEventListener = exports.keyEventListener = exports.wheelEventListener = exports.touchEventListeners = exports.mouseEventListeners = void 0;
|
|
7
7
|
const mouse_1 = __importDefault(require("./mouse"));
|
|
8
8
|
exports.mouseEventListeners = mouse_1.default;
|
|
9
9
|
const touch_1 = __importDefault(require("./touch"));
|
|
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "segmentationRepresentationRemovedEventListener",
|
|
|
19
19
|
Object.defineProperty(exports, "segmentationModifiedListener", { enumerable: true, get: function () { return segmentation_1.segmentationModifiedListener; } });
|
|
20
20
|
Object.defineProperty(exports, "imageChangeEventListener", { enumerable: true, get: function () { return segmentation_1.imageChangeEventListener; } });
|
|
21
21
|
const annotations_1 = require("./annotations");
|
|
22
|
+
Object.defineProperty(exports, "annotationCompletedListener", { enumerable: true, get: function () { return annotations_1.annotationCompletedListener; } });
|
|
22
23
|
Object.defineProperty(exports, "annotationSelectionListener", { enumerable: true, get: function () { return annotations_1.annotationSelectionListener; } });
|
|
23
24
|
Object.defineProperty(exports, "annotationModifiedListener", { enumerable: true, get: function () { return annotations_1.annotationModifiedListener; } });
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/eventListeners/index.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA0C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/eventListeners/index.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA0C;AAmBxC,8BAnBK,eAAmB,CAmBL;AAlBrB,oDAA0C;AAmBxC,8BAnBK,eAAmB,CAmBL;AAlBrB,oDAAyC;AAmBvC,6BAnBK,eAAkB,CAmBL;AAlBpB,0DAA0C;AAmBxC,2BAnBK,kBAAgB,CAmBL;AAlBlB,iDAMwB;AAgBtB,sHArBA,oDAAqC,OAqBA;AAHrC,gIAjBA,8DAA+C,OAiBA;AAE/C,+HAlBA,6DAA8C,OAkBA;AAD9C,6GAhBA,2CAA4B,OAgBA;AAG5B,yGAlBA,uCAAwB,OAkBA;AAhB1B,+CAIuB;AAarB,4GAhBA,yCAA2B,OAgBA;AAC3B,4GAhBA,yCAA2B,OAgBA;AAC3B,2GAhBA,wCAA0B,OAgBA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const core_1 = require("@cornerstonejs/core");
|
|
30
|
+
const SegmentationRepresentations_1 = __importDefault(require("../../../enums/SegmentationRepresentations"));
|
|
31
|
+
const SegmentationState = __importStar(require("../../../stateManagement/segmentation/segmentationState"));
|
|
32
|
+
const stackVolumeCheck_1 = require("../../../tools/segmentation/strategies/utils/stackVolumeCheck");
|
|
33
|
+
const ToolGroupManager_1 = require("../../../store/ToolGroupManager");
|
|
34
|
+
const onLabelmapSegmentationDataModified = function (evt) {
|
|
35
|
+
const { segmentationId, modifiedSlicesToUse } = evt.detail;
|
|
36
|
+
const { representationData, type } = SegmentationState.getSegmentation(segmentationId);
|
|
37
|
+
const toolGroupIds = SegmentationState.getToolGroupIdsWithSegmentation(segmentationId);
|
|
38
|
+
if (type !== SegmentationRepresentations_1.default.Labelmap) {
|
|
39
|
+
throw new Error(`onLabelmapSegmentationDataModifiedListener: representationType ${type} not supported yet`);
|
|
40
|
+
}
|
|
41
|
+
if ((0, stackVolumeCheck_1.isVolumeSegmentation)(representationData[type])) {
|
|
42
|
+
const segmentationVolume = core_1.cache.getVolume(representationData[type].volumeId);
|
|
43
|
+
if (!segmentationVolume) {
|
|
44
|
+
console.warn('segmentation not found in cache');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const { imageData, vtkOpenGLTexture } = segmentationVolume;
|
|
48
|
+
let slicesToUpdate;
|
|
49
|
+
if (modifiedSlicesToUse && Array.isArray(modifiedSlicesToUse)) {
|
|
50
|
+
slicesToUpdate = modifiedSlicesToUse;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const numSlices = imageData.getDimensions()[2];
|
|
54
|
+
slicesToUpdate = [...Array(numSlices).keys()];
|
|
55
|
+
}
|
|
56
|
+
slicesToUpdate.forEach((i) => {
|
|
57
|
+
vtkOpenGLTexture.setUpdatedFrame(i);
|
|
58
|
+
});
|
|
59
|
+
imageData.modified();
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
toolGroupIds.forEach((toolGroupId) => {
|
|
63
|
+
const toolGroupSegmentationRepresentations = SegmentationState.getSegmentationRepresentations(toolGroupId);
|
|
64
|
+
const toolGroup = (0, ToolGroupManager_1.getToolGroup)(toolGroupId);
|
|
65
|
+
const viewportsInfo = toolGroup.getViewportsInfo();
|
|
66
|
+
toolGroupSegmentationRepresentations.forEach((representation) => {
|
|
67
|
+
if (representation.segmentationId !== segmentationId) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
viewportsInfo.forEach(({ viewportId, renderingEngineId }) => {
|
|
71
|
+
const viewport = (0, core_1.getEnabledElementByIds)(viewportId, renderingEngineId).viewport;
|
|
72
|
+
const actorEntry = viewport.getActor(representation.segmentationRepresentationUID);
|
|
73
|
+
if (!actorEntry) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const currentImageId = viewport.getCurrentImageId();
|
|
77
|
+
const segImageData = actorEntry.actor.getMapper().getInputData();
|
|
78
|
+
const { imageIdReferenceMap } = representationData[type];
|
|
79
|
+
const currentSegmentationImageId = imageIdReferenceMap.get(currentImageId);
|
|
80
|
+
const segmentationImage = core_1.cache.getImage(currentSegmentationImageId);
|
|
81
|
+
segImageData.modified();
|
|
82
|
+
core_1.utilities.updateVTKImageDataWithCornerstoneImage(segImageData, segmentationImage);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
exports.default = onLabelmapSegmentationDataModified;
|
|
89
|
+
//# sourceMappingURL=onLabelmapSegmentationDataModified.js.map
|
package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onLabelmapSegmentationDataModified.js","sourceRoot":"","sources":["../../../../../src/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAI6B;AAE7B,6GAAqF;AACrF,2GAA6F;AAM7F,oGAAqG;AACrG,sEAA+D;AAK/D,MAAM,kCAAkC,GAAG,UACzC,GAAsC;IAEtC,MAAM,EAAE,cAAc,EAAE,mBAAmB,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;IAE3D,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAChC,iBAAiB,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAEpD,MAAM,YAAY,GAChB,iBAAiB,CAAC,+BAA+B,CAAC,cAAc,CAAC,CAAC;IAEpE,IAAI,IAAI,KAAK,qCAA2B,CAAC,QAAQ,EAAE;QACjD,MAAM,IAAI,KAAK,CACb,kEAAkE,IAAI,oBAAoB,CAC3F,CAAC;KACH;IAED,IAAI,IAAA,uCAAoB,EAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,EAAE;QAElD,MAAM,kBAAkB,GAAG,YAAK,CAAC,SAAS,CACvC,kBAAkB,CAAC,IAAI,CAAoC,CAAC,QAAQ,CACtE,CAAC;QAEF,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;YAChD,OAAO;SACR;QAED,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,CAAC;QAG3D,IAAI,cAAc,CAAC;QACnB,IAAI,mBAAmB,IAAI,KAAK,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE;YAC7D,cAAc,GAAG,mBAAmB,CAAC;SACtC;aAAM;YACL,MAAM,SAAS,GAAG,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC;YAC/C,cAAc,GAA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AE1C,MAAM,iBAAiB,GAAG,YAAK,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC;oBACrE,YAAY,CAAC,QAAQ,EAAE,CAAC;oBAGxB,gBAAO,CAAC,sCAAsC,CAC5C,YAAY,EACZ,iBAAiB,CAClB,CAAC;gBACJ,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;KACJ;AACH,CAAC,CAAC;AAEF,kBAAe,kCAAkC,CAAC"}
|
|
@@ -26,64 +26,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const core_1 = require("@cornerstonejs/core");
|
|
30
29
|
const triggerSegmentationRender_1 = __importDefault(require("../../utilities/segmentation/triggerSegmentationRender"));
|
|
31
30
|
const SegmentationRepresentations_1 = __importDefault(require("../../enums/SegmentationRepresentations"));
|
|
32
31
|
const SegmentationState = __importStar(require("../../stateManagement/segmentation/segmentationState"));
|
|
33
|
-
const
|
|
34
|
-
const ToolGroupManager_1 = require("../../store/ToolGroupManager");
|
|
32
|
+
const onLabelmapSegmentationDataModified_1 = __importDefault(require("./labelmap/onLabelmapSegmentationDataModified"));
|
|
35
33
|
const onSegmentationDataModified = function (evt) {
|
|
36
|
-
const { segmentationId
|
|
37
|
-
const {
|
|
34
|
+
const { segmentationId } = evt.detail;
|
|
35
|
+
const { type } = SegmentationState.getSegmentation(segmentationId);
|
|
38
36
|
const toolGroupIds = SegmentationState.getToolGroupIdsWithSegmentation(segmentationId);
|
|
39
|
-
if (type
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
if ((0, stackVolumeCheck_1.isVolumeSegmentation)(representationData[type])) {
|
|
43
|
-
const segmentationVolume = core_1.cache.getVolume(representationData[type].volumeId);
|
|
44
|
-
if (!segmentationVolume) {
|
|
45
|
-
console.warn('segmentation not found in cache');
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const { imageData, vtkOpenGLTexture } = segmentationVolume;
|
|
49
|
-
let slicesToUpdate;
|
|
50
|
-
if (modifiedSlicesToUse && Array.isArray(modifiedSlicesToUse)) {
|
|
51
|
-
slicesToUpdate = modifiedSlicesToUse;
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
const numSlices = imageData.getDimensions()[2];
|
|
55
|
-
slicesToUpdate = [...Array(numSlices).keys()];
|
|
56
|
-
}
|
|
57
|
-
slicesToUpdate.forEach((i) => {
|
|
58
|
-
vtkOpenGLTexture.setUpdatedFrame(i);
|
|
59
|
-
});
|
|
60
|
-
imageData.modified();
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
toolGroupIds.forEach((toolGroupId) => {
|
|
64
|
-
const toolGroupSegmentationRepresentations = SegmentationState.getSegmentationRepresentations(toolGroupId);
|
|
65
|
-
const toolGroup = (0, ToolGroupManager_1.getToolGroup)(toolGroupId);
|
|
66
|
-
const viewportsInfo = toolGroup.getViewportsInfo();
|
|
67
|
-
toolGroupSegmentationRepresentations.forEach((representation) => {
|
|
68
|
-
if (representation.segmentationId !== segmentationId) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
viewportsInfo.forEach(({ viewportId, renderingEngineId }) => {
|
|
72
|
-
const viewport = (0, core_1.getEnabledElementByIds)(viewportId, renderingEngineId).viewport;
|
|
73
|
-
const actorEntry = viewport.getActor(representation.segmentationRepresentationUID);
|
|
74
|
-
if (!actorEntry) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const currentImageId = viewport.getCurrentImageId();
|
|
78
|
-
const segImageData = actorEntry.actor.getMapper().getInputData();
|
|
79
|
-
const { imageIdReferenceMap } = representationData[type];
|
|
80
|
-
const currentSegmentationImageId = imageIdReferenceMap.get(currentImageId);
|
|
81
|
-
const segmentationImage = core_1.cache.getImage(currentSegmentationImageId);
|
|
82
|
-
segImageData.modified();
|
|
83
|
-
core_1.utilities.updateVTKImageDataWithCornerstoneImage(segImageData, segmentationImage);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
});
|
|
37
|
+
if (type === SegmentationRepresentations_1.default.Labelmap) {
|
|
38
|
+
(0, onLabelmapSegmentationDataModified_1.default)(evt);
|
|
87
39
|
}
|
|
88
40
|
toolGroupIds.forEach((toolGroupId) => {
|
|
89
41
|
(0, triggerSegmentationRender_1.default)(toolGroupId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmentationDataModifiedEventListener.js","sourceRoot":"","sources":["../../../../src/eventListeners/segmentation/segmentationDataModifiedEventListener.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"segmentationDataModifiedEventListener.js","sourceRoot":"","sources":["../../../../src/eventListeners/segmentation/segmentationDataModifiedEventListener.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uHAA+F;AAC/F,0GAAkF;AAClF,wGAA0F;AAE1F,uHAA+F;AAK/F,MAAM,0BAA0B,GAAG,UACjC,GAAsC;IAEtC,MAAM,EAAE,cAAc,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,IAAI,EAAE,GAAG,iBAAiB,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAEnE,MAAM,YAAY,GAChB,iBAAiB,CAAC,+BAA+B,CAAC,cAAc,CAAC,CAAC;IAEpE,IAAI,IAAI,KAAK,qCAA2B,CAAC,QAAQ,EAAE;QACjD,IAAA,4CAAkC,EAAC,GAAG,CAAC,CAAC;KACzC;IAED,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;QACnC,IAAA,mCAAyB,EAAC,WAAW,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,kBAAe,0BAA0B,CAAC"}
|
package/dist/cjs/init.js
CHANGED
|
@@ -72,6 +72,7 @@ function _removeCornerstoneEventListeners() {
|
|
|
72
72
|
}
|
|
73
73
|
function _addCornerstoneToolsEventListeners() {
|
|
74
74
|
_removeCornerstoneToolsEventListeners();
|
|
75
|
+
core_1.eventTarget.addEventListener(enums_1.Events.ANNOTATION_COMPLETED, eventListeners_1.annotationCompletedListener);
|
|
75
76
|
core_1.eventTarget.addEventListener(enums_1.Events.ANNOTATION_MODIFIED, eventListeners_1.annotationModifiedListener);
|
|
76
77
|
core_1.eventTarget.addEventListener(enums_1.Events.ANNOTATION_SELECTION_CHANGE, eventListeners_1.annotationSelectionListener);
|
|
77
78
|
core_1.eventTarget.addEventListener(enums_1.Events.ANNOTATION_SELECTION_CHANGE, eventListeners_1.annotationSelectionListener);
|
|
@@ -81,6 +82,7 @@ function _addCornerstoneToolsEventListeners() {
|
|
|
81
82
|
core_1.eventTarget.addEventListener(enums_1.Events.SEGMENTATION_REPRESENTATION_REMOVED, eventListeners_1.segmentationRepresentationRemovedEventListener);
|
|
82
83
|
}
|
|
83
84
|
function _removeCornerstoneToolsEventListeners() {
|
|
85
|
+
core_1.eventTarget.removeEventListener(enums_1.Events.ANNOTATION_COMPLETED, eventListeners_1.annotationCompletedListener);
|
|
84
86
|
core_1.eventTarget.removeEventListener(enums_1.Events.ANNOTATION_MODIFIED, eventListeners_1.annotationModifiedListener);
|
|
85
87
|
core_1.eventTarget.removeEventListener(enums_1.Events.ANNOTATION_SELECTION_CHANGE, eventListeners_1.annotationSelectionListener);
|
|
86
88
|
core_1.eventTarget.removeEventListener(enums_1.Events.ANNOTATION_SELECTION_CHANGE, eventListeners_1.annotationSelectionListener);
|
package/dist/cjs/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAyD;AACzD,kFAAoF;AACpF,wFAAsG;AACtG,mCAAiD;AACjD,mC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AmB,CAC7B,cAAY,CAAC,mBAAmB,EAChC,2CAA0B,CAC3B,CAAC;IAEF,kBAAW,CAAC,mBAAmB,CAC7B,cAAY,CAAC,2BAA2B,EACxC,4CAA2B,CAC5B,CAAC;IAEF,kBAAW,CAAC,mBAAmB,CAC7B,cAAY,CAAC,2BAA2B,EACxC,4CAA2B,CAC5B,CAAC;IAMF,kBAAW,CAAC,mBAAmB,CAC7B,cAAY,CAAC,qBAAqB,EAClC,6CAA4B,CAC7B,CAAC;IAEF,kBAAW,CAAC,mBAAmB,CAC7B,cAAY,CAAC,0BAA0B,EACvC,sDAAqC,CACtC,CAAC;IACF,kBAAW,CAAC,mBAAmB,CAC7B,cAAY,CAAC,oCAAoC,EACjD,gEAA+C,CAChD,CAAC;IAEF,kBAAW,CAAC,mBAAmB,CAC7B,cAAY,CAAC,mCAAmC,EAChD,+DAA8C,CAC/C,CAAC;AACJ,CAAC;AAED,kBAAe,IAAI,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Annotation } from '../../../types/AnnotationTypes';
|
|
2
2
|
declare function triggerAnnotationAddedForElement(annotation: Annotation, element: HTMLDivElement): void;
|
|
3
3
|
declare function triggerAnnotationAddedForFOR(annotation: Annotation): void;
|
|
4
|
-
|
|
4
|
+
declare function triggerAnnotationModified(annotation: Annotation, element: HTMLDivElement): void;
|
|
5
|
+
declare function triggerAnnotationCompleted(annotation: Annotation): void;
|
|
6
|
+
export { triggerAnnotationAddedForElement, triggerAnnotationAddedForFOR, triggerAnnotationModified, triggerAnnotationCompleted, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.triggerAnnotationAddedForFOR = exports.triggerAnnotationAddedForElement = void 0;
|
|
3
|
+
exports.triggerAnnotationCompleted = exports.triggerAnnotationModified = exports.triggerAnnotationAddedForFOR = exports.triggerAnnotationAddedForElement = void 0;
|
|
4
4
|
const core_1 = require("@cornerstonejs/core");
|
|
5
5
|
const enums_1 = require("../../../enums");
|
|
6
6
|
const ToolGroupManager_1 = require("../../../store/ToolGroupManager");
|
|
@@ -45,4 +45,24 @@ function triggerAnnotationAddedForFOR(annotation) {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
exports.triggerAnnotationAddedForFOR = triggerAnnotationAddedForFOR;
|
|
48
|
+
function triggerAnnotationModified(annotation, element) {
|
|
49
|
+
const enabledElement = (0, core_1.getEnabledElement)(element);
|
|
50
|
+
const { viewportId, renderingEngineId } = enabledElement;
|
|
51
|
+
const eventType = enums_1.Events.ANNOTATION_MODIFIED;
|
|
52
|
+
const eventDetail = {
|
|
53
|
+
annotation,
|
|
54
|
+
viewportId,
|
|
55
|
+
renderingEngineId,
|
|
56
|
+
};
|
|
57
|
+
(0, core_1.triggerEvent)(core_1.eventTarget, eventType, eventDetail);
|
|
58
|
+
}
|
|
59
|
+
exports.triggerAnnotationModified = triggerAnnotationModified;
|
|
60
|
+
function triggerAnnotationCompleted(annotation) {
|
|
61
|
+
const eventType = enums_1.Events.ANNOTATION_COMPLETED;
|
|
62
|
+
const eventDetail = {
|
|
63
|
+
annotation,
|
|
64
|
+
};
|
|
65
|
+
(0, core_1.triggerEvent)(core_1.eventTarget, eventType, eventDetail);
|
|
66
|
+
}
|
|
67
|
+
exports.triggerAnnotationCompleted = triggerAnnotationCompleted;
|
|
48
68
|
//# sourceMappingURL=state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../../src/stateManagement/annotation/helpers/state.ts"],"names":[],"mappings":";;;AAAA,8CAK6B;AAC7B,0CAAwC;AAExC,sEAA4E;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../../src/stateManagement/annotation/helpers/state.ts"],"names":[],"mappings":";;;AAAA,8CAK6B;AAC7B,0CAAwC;AAExC,sEAA4E;AAY5E,SAAS,gCAAgC,CACvC,UAA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AAM,EAAE;QAC7B,IAAA,mBAAY,EAAC,kBAAW,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;QAClD,OAAO;KACR;IAED,iBAAiB,CAAC,OAAO,CAAC,CAAC,EAAE,iBAAiB,EAAE,UAAU,EAAE,EAAE,EAAE;QAC9D,WAAW,CAAC,UAAU,GAAG,UAAU,CAAC;QACpC,WAAW,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAClD,IAAA,mBAAY,EAAC,kBAAW,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC;AAmCC,oEAA4B;AA9B9B,SAAS,yBAAyB,CAChC,UAAsB,EACtB,OAAuB;IAEvB,MAAM,cAAc,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;IAClD,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,cAAc,CAAC;IACzD,MAAM,SAAS,GAAG,cAAM,CAAC,mBAAmB,CAAC;IAC7C,MAAM,WAAW,GAAkC;QACjD,UAAU;QACV,UAAU;QACV,iBAAiB;KAClB,CAAC;IAEF,IAAA,mBAAY,EAAC,kBAAW,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AACpD,CAAC;AAiBC,8DAAyB;AAZ3B,SAAS,0BAA0B,CAAC,UAAsB;IACxD,MAAM,SAAS,GAAG,cAAM,CAAC,oBAAoB,CAAC;IAC9C,MAAM,WAAW,GAAmC;QAClD,UAAU;KACX,CAAC;IAEF,IAAA,mBAAY,EAAC,kBAAW,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AACpD,CAAC;AAMC,gEAA0B"}
|
|
@@ -12,6 +12,7 @@ export default class ToolGroup implements IToolGroup {
|
|
|
12
12
|
getViewportIds(): string[];
|
|
13
13
|
getViewportsInfo(): Array<Types.IViewportId>;
|
|
14
14
|
getToolInstance(toolInstanceName: string): any;
|
|
15
|
+
hasTool(toolName: string): boolean;
|
|
15
16
|
addTool(toolName: string, configuration?: ToolConfiguration): void;
|
|
16
17
|
addToolInstance(toolName: string, parentClassName: string, configuration?: {}): void;
|
|
17
18
|
addViewport(viewportId: string, renderingEngineId?: string): void;
|
|
@@ -34,6 +34,9 @@ class ToolGroup {
|
|
|
34
34
|
}
|
|
35
35
|
return toolInstance;
|
|
36
36
|
}
|
|
37
|
+
hasTool(toolName) {
|
|
38
|
+
return !!this._toolInstances[toolName];
|
|
39
|
+
}
|
|
37
40
|
addTool(toolName, configuration = {}) {
|
|
38
41
|
const toolDefinition = index_1.state.tools[toolName];
|
|
39
42
|
const hasToolName = typeof toolName !== 'undefined' && toolName !== '';
|