@cornerstonejs/tools 1.48.2 → 1.49.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/enums/AnnotationStyleStates.d.ts +2 -1
- package/dist/cjs/enums/AnnotationStyleStates.js +1 -0
- package/dist/cjs/enums/AnnotationStyleStates.js.map +1 -1
- package/dist/cjs/enums/ChangeTypes.d.ts +8 -0
- package/dist/cjs/enums/ChangeTypes.js +12 -0
- package/dist/cjs/enums/ChangeTypes.js.map +1 -0
- package/dist/cjs/enums/Events.d.ts +2 -0
- package/dist/cjs/enums/Events.js +2 -0
- package/dist/cjs/enums/Events.js.map +1 -1
- package/dist/cjs/enums/index.d.ts +2 -1
- package/dist/cjs/enums/index.js +3 -1
- package/dist/cjs/enums/index.js.map +1 -1
- package/dist/cjs/eventDispatchers/annotationInterpolationEventDispatcher.d.ts +5 -0
- package/dist/cjs/eventDispatchers/annotationInterpolationEventDispatcher.js +23 -0
- package/dist/cjs/eventDispatchers/annotationInterpolationEventDispatcher.js.map +1 -0
- package/dist/cjs/eventDispatchers/index.d.ts +2 -1
- package/dist/cjs/eventDispatchers/index.js +3 -1
- package/dist/cjs/eventDispatchers/index.js.map +1 -1
- package/dist/cjs/init.js +3 -0
- package/dist/cjs/init.js.map +1 -1
- package/dist/cjs/stateManagement/annotation/config/getState.js +3 -0
- package/dist/cjs/stateManagement/annotation/config/getState.js.map +1 -1
- package/dist/cjs/tools/annotation/LivewireContourTool.d.ts +1 -1
- package/dist/cjs/tools/annotation/LivewireContourTool.js +1 -1
- package/dist/cjs/tools/annotation/LivewireContourTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js +1 -0
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.d.ts +2 -2
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +9 -4
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/SplineROITool.d.ts +4 -1
- package/dist/cjs/tools/annotation/SplineROITool.js +50 -20
- package/dist/cjs/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +12 -3
- package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js +9 -5
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js +3 -3
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
- package/dist/cjs/tools/base/ContourBaseTool.js +4 -0
- package/dist/cjs/tools/base/ContourBaseTool.js.map +1 -1
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js +21 -9
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/cjs/tools/displayTools/Contour/contourConfig.js +8 -3
- package/dist/cjs/tools/displayTools/Contour/contourConfig.js.map +1 -1
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js +0 -1
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/cjs/types/AnnotationStyle.d.ts +2 -2
- package/dist/cjs/types/AnnotationTypes.d.ts +1 -0
- package/dist/cjs/types/ContourSegmentationAnnotation.d.ts +1 -0
- package/dist/cjs/types/ContourTypes.d.ts +3 -0
- package/dist/cjs/types/EventTypes.d.ts +19 -1
- package/dist/cjs/types/InterpolationTypes.d.ts +18 -0
- package/dist/cjs/types/InterpolationTypes.js +3 -0
- package/dist/cjs/types/InterpolationTypes.js.map +1 -0
- package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +14 -0
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/cjs/utilities/contours/PointsArray.d.ts +29 -0
- package/dist/cjs/utilities/contours/PointsArray.js +104 -0
- package/dist/cjs/utilities/contours/PointsArray.js.map +1 -0
- package/dist/cjs/utilities/contours/index.d.ts +3 -1
- package/dist/cjs/utilities/contours/index.js +28 -1
- package/dist/cjs/utilities/contours/index.js.map +1 -1
- package/dist/cjs/utilities/contours/interpolation/acceptAutogeneratedInterpolations.d.ts +3 -0
- package/dist/cjs/utilities/contours/interpolation/acceptAutogeneratedInterpolations.js +11 -0
- package/dist/cjs/utilities/contours/interpolation/acceptAutogeneratedInterpolations.js.map +1 -0
- package/dist/cjs/utilities/contours/interpolation/createPolylineToolData.d.ts +2 -0
- package/dist/cjs/utilities/contours/interpolation/createPolylineToolData.js +39 -0
- package/dist/cjs/utilities/contours/interpolation/createPolylineToolData.js.map +1 -0
- package/dist/cjs/utilities/contours/interpolation/findAnnotationForInterpolation.d.ts +7 -0
- package/dist/cjs/utilities/contours/interpolation/findAnnotationForInterpolation.js +107 -0
- package/dist/cjs/utilities/contours/interpolation/findAnnotationForInterpolation.js.map +1 -0
- package/dist/cjs/utilities/contours/interpolation/getInterpolationData.d.ts +7 -0
- package/dist/cjs/utilities/contours/interpolation/getInterpolationData.js +30 -0
- package/dist/cjs/utilities/contours/interpolation/getInterpolationData.js.map +1 -0
- package/dist/cjs/utilities/contours/interpolation/getInterpolationDataCollection.d.ts +4 -0
- package/dist/cjs/utilities/contours/interpolation/getInterpolationDataCollection.js +21 -0
- package/dist/cjs/utilities/contours/interpolation/getInterpolationDataCollection.js.map +1 -0
- package/dist/cjs/utilities/contours/interpolation/index.d.ts +2 -0
- package/dist/cjs/utilities/contours/interpolation/index.js +9 -0
- package/dist/cjs/utilities/contours/interpolation/index.js.map +1 -0
- package/dist/cjs/utilities/contours/interpolation/interpolate.d.ts +3 -0
- package/dist/cjs/utilities/contours/interpolation/interpolate.js +343 -0
- package/dist/cjs/utilities/contours/interpolation/interpolate.js.map +1 -0
- package/dist/cjs/utilities/contours/reverseIfAntiClockwise.d.ts +2 -0
- package/dist/cjs/utilities/contours/reverseIfAntiClockwise.js +34 -0
- package/dist/cjs/utilities/contours/reverseIfAntiClockwise.js.map +1 -0
- package/dist/cjs/utilities/getViewportForAnnotation.d.ts +2 -0
- package/dist/cjs/utilities/getViewportForAnnotation.js +19 -0
- package/dist/cjs/utilities/getViewportForAnnotation.js.map +1 -0
- package/dist/cjs/utilities/index.d.ts +2 -1
- package/dist/cjs/utilities/index.js +3 -1
- package/dist/cjs/utilities/index.js.map +1 -1
- package/dist/cjs/utilities/planar/filterAnnotationsForDisplay.js +2 -1
- package/dist/cjs/utilities/planar/filterAnnotationsForDisplay.js.map +1 -1
- package/dist/cjs/utilities/planarFreehandROITool/index.d.ts +3 -3
- package/dist/cjs/utilities/planarFreehandROITool/index.js +4 -4
- package/dist/cjs/utilities/planarFreehandROITool/index.js.map +1 -1
- package/dist/cjs/utilities/planarFreehandROITool/smoothAnnotation.d.ts +3 -0
- package/dist/cjs/utilities/planarFreehandROITool/{interpolateAnnotation.js → smoothAnnotation.js} +5 -5
- package/dist/cjs/utilities/planarFreehandROITool/smoothAnnotation.js.map +1 -0
- package/dist/cjs/utilities/planarFreehandROITool/{interpolatePoints.d.ts → smoothPoints.d.ts} +1 -1
- package/dist/cjs/utilities/planarFreehandROITool/{interpolatePoints.js → smoothPoints.js} +11 -8
- package/dist/cjs/utilities/planarFreehandROITool/smoothPoints.js.map +1 -0
- package/dist/cjs/utilities/polyData/utils.d.ts +2 -1
- package/dist/cjs/utilities/polyData/utils.js +4 -2
- package/dist/cjs/utilities/polyData/utils.js.map +1 -1
- package/dist/cjs/utilities/segmentation/InterpolationManager/InterpolationManager.d.ts +11 -0
- package/dist/cjs/utilities/segmentation/InterpolationManager/InterpolationManager.js +159 -0
- package/dist/cjs/utilities/segmentation/InterpolationManager/InterpolationManager.js.map +1 -0
- package/dist/cjs/utilities/segmentation/InterpolationManager/deleteRelatedAnnotations.d.ts +2 -0
- package/dist/cjs/utilities/segmentation/InterpolationManager/deleteRelatedAnnotations.js +96 -0
- package/dist/cjs/utilities/segmentation/InterpolationManager/deleteRelatedAnnotations.js.map +1 -0
- package/dist/cjs/utilities/triggerAnnotationRenderForViewportIds.js +7 -2
- package/dist/cjs/utilities/triggerAnnotationRenderForViewportIds.js.map +1 -1
- package/dist/esm/enums/AnnotationStyleStates.js +1 -0
- package/dist/esm/enums/AnnotationStyleStates.js.map +1 -1
- package/dist/esm/enums/ChangeTypes.js +10 -0
- package/dist/esm/enums/ChangeTypes.js.map +1 -0
- package/dist/esm/enums/Events.js +2 -0
- package/dist/esm/enums/Events.js.map +1 -1
- package/dist/esm/enums/index.js +2 -1
- package/dist/esm/enums/index.js.map +1 -1
- package/dist/esm/eventDispatchers/annotationInterpolationEventDispatcher.js +18 -0
- package/dist/esm/eventDispatchers/annotationInterpolationEventDispatcher.js.map +1 -0
- package/dist/esm/eventDispatchers/index.js +2 -1
- package/dist/esm/eventDispatchers/index.js.map +1 -1
- package/dist/esm/init.js +3 -0
- package/dist/esm/init.js.map +1 -1
- package/dist/esm/stateManagement/annotation/config/getState.js +3 -0
- package/dist/esm/stateManagement/annotation/config/getState.js.map +1 -1
- package/dist/esm/tools/annotation/LivewireContourTool.js +2 -2
- package/dist/esm/tools/annotation/LivewireContourTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js +1 -0
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +9 -4
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/esm/tools/annotation/SplineROITool.js +49 -21
- package/dist/esm/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +11 -2
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js +8 -4
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js +2 -2
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
- package/dist/esm/tools/base/ContourBaseTool.js +4 -0
- package/dist/esm/tools/base/ContourBaseTool.js.map +1 -1
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js +12 -1
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/esm/tools/displayTools/Contour/contourConfig.js +8 -3
- package/dist/esm/tools/displayTools/Contour/contourConfig.js.map +1 -1
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js +0 -1
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/esm/types/InterpolationTypes.js +2 -0
- package/dist/esm/types/InterpolationTypes.js.map +1 -0
- package/dist/esm/utilities/contours/PointsArray.js +98 -0
- package/dist/esm/utilities/contours/PointsArray.js.map +1 -0
- package/dist/esm/utilities/contours/index.js +3 -1
- package/dist/esm/utilities/contours/index.js.map +1 -1
- package/dist/esm/utilities/contours/interpolation/acceptAutogeneratedInterpolations.js +5 -0
- package/dist/esm/utilities/contours/interpolation/acceptAutogeneratedInterpolations.js.map +1 -0
- package/dist/esm/utilities/contours/interpolation/createPolylineToolData.js +36 -0
- package/dist/esm/utilities/contours/interpolation/createPolylineToolData.js.map +1 -0
- package/dist/esm/utilities/contours/interpolation/findAnnotationForInterpolation.js +102 -0
- package/dist/esm/utilities/contours/interpolation/findAnnotationForInterpolation.js.map +1 -0
- package/dist/esm/utilities/contours/interpolation/getInterpolationData.js +27 -0
- package/dist/esm/utilities/contours/interpolation/getInterpolationData.js.map +1 -0
- package/dist/esm/utilities/contours/interpolation/getInterpolationDataCollection.js +15 -0
- package/dist/esm/utilities/contours/interpolation/getInterpolationDataCollection.js.map +1 -0
- package/dist/esm/utilities/contours/interpolation/index.js +3 -0
- package/dist/esm/utilities/contours/interpolation/index.js.map +1 -0
- package/dist/esm/utilities/contours/interpolation/interpolate.js +314 -0
- package/dist/esm/utilities/contours/interpolation/interpolate.js.map +1 -0
- package/dist/esm/utilities/contours/reverseIfAntiClockwise.js +31 -0
- package/dist/esm/utilities/contours/reverseIfAntiClockwise.js.map +1 -0
- package/dist/esm/utilities/getViewportForAnnotation.js +16 -0
- package/dist/esm/utilities/getViewportForAnnotation.js.map +1 -0
- package/dist/esm/utilities/index.js +2 -1
- package/dist/esm/utilities/index.js.map +1 -1
- package/dist/esm/utilities/planar/filterAnnotationsForDisplay.js +1 -1
- package/dist/esm/utilities/planar/filterAnnotationsForDisplay.js.map +1 -1
- package/dist/esm/utilities/planarFreehandROITool/index.js +3 -3
- package/dist/esm/utilities/planarFreehandROITool/index.js.map +1 -1
- package/dist/esm/utilities/planarFreehandROITool/{interpolateAnnotation.js → smoothAnnotation.js} +4 -4
- package/dist/esm/utilities/planarFreehandROITool/smoothAnnotation.js.map +1 -0
- package/dist/esm/utilities/planarFreehandROITool/{interpolatePoints.js → smoothPoints.js} +9 -6
- package/dist/esm/utilities/planarFreehandROITool/smoothPoints.js.map +1 -0
- package/dist/esm/utilities/polyData/utils.js +4 -2
- package/dist/esm/utilities/polyData/utils.js.map +1 -1
- package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js +150 -0
- package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js.map +1 -0
- package/dist/esm/utilities/segmentation/InterpolationManager/deleteRelatedAnnotations.js +67 -0
- package/dist/esm/utilities/segmentation/InterpolationManager/deleteRelatedAnnotations.js.map +1 -0
- package/dist/esm/utilities/triggerAnnotationRenderForViewportIds.js +7 -2
- package/dist/esm/utilities/triggerAnnotationRenderForViewportIds.js.map +1 -1
- package/dist/types/enums/AnnotationStyleStates.d.ts +2 -1
- package/dist/types/enums/AnnotationStyleStates.d.ts.map +1 -1
- package/dist/types/enums/ChangeTypes.d.ts +9 -0
- package/dist/types/enums/ChangeTypes.d.ts.map +1 -0
- package/dist/types/enums/Events.d.ts +2 -0
- package/dist/types/enums/Events.d.ts.map +1 -1
- package/dist/types/enums/index.d.ts +2 -1
- package/dist/types/eventDispatchers/annotationInterpolationEventDispatcher.d.ts +6 -0
- package/dist/types/eventDispatchers/annotationInterpolationEventDispatcher.d.ts.map +1 -0
- package/dist/types/eventDispatchers/index.d.ts +2 -1
- package/dist/types/init.d.ts.map +1 -1
- package/dist/types/stateManagement/annotation/config/getState.d.ts.map +1 -1
- package/dist/types/tools/annotation/LivewireContourTool.d.ts +1 -1
- package/dist/types/tools/annotation/LivewireContourTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts +2 -2
- package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/SplineROITool.d.ts +4 -1
- package/dist/types/tools/annotation/SplineROITool.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/base/ContourBaseTool.d.ts.map +1 -1
- package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Contour/contourConfig.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Contour/contourDisplay.d.ts.map +1 -1
- package/dist/types/types/AnnotationStyle.d.ts +2 -2
- package/dist/types/types/AnnotationStyle.d.ts.map +1 -1
- package/dist/types/types/AnnotationTypes.d.ts +1 -0
- package/dist/types/types/AnnotationTypes.d.ts.map +1 -1
- package/dist/types/types/ContourSegmentationAnnotation.d.ts +1 -0
- package/dist/types/types/ContourSegmentationAnnotation.d.ts.map +1 -1
- package/dist/types/types/ContourTypes.d.ts +3 -0
- package/dist/types/types/ContourTypes.d.ts.map +1 -1
- package/dist/types/types/EventTypes.d.ts +19 -1
- package/dist/types/types/EventTypes.d.ts.map +1 -1
- package/dist/types/types/InterpolationTypes.d.ts +19 -0
- package/dist/types/types/InterpolationTypes.d.ts.map +1 -0
- package/dist/types/types/ToolSpecificAnnotationTypes.d.ts +14 -0
- package/dist/types/types/ToolSpecificAnnotationTypes.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/contours/PointsArray.d.ts +30 -0
- package/dist/types/utilities/contours/PointsArray.d.ts.map +1 -0
- package/dist/types/utilities/contours/index.d.ts +3 -1
- package/dist/types/utilities/contours/index.d.ts.map +1 -1
- package/dist/types/utilities/contours/interpolation/acceptAutogeneratedInterpolations.d.ts +4 -0
- package/dist/types/utilities/contours/interpolation/acceptAutogeneratedInterpolations.d.ts.map +1 -0
- package/dist/types/utilities/contours/interpolation/createPolylineToolData.d.ts +3 -0
- package/dist/types/utilities/contours/interpolation/createPolylineToolData.d.ts.map +1 -0
- package/dist/types/utilities/contours/interpolation/findAnnotationForInterpolation.d.ts +8 -0
- package/dist/types/utilities/contours/interpolation/findAnnotationForInterpolation.d.ts.map +1 -0
- package/dist/types/utilities/contours/interpolation/getInterpolationData.d.ts +8 -0
- package/dist/types/utilities/contours/interpolation/getInterpolationData.d.ts.map +1 -0
- package/dist/types/utilities/contours/interpolation/getInterpolationDataCollection.d.ts +5 -0
- package/dist/types/utilities/contours/interpolation/getInterpolationDataCollection.d.ts.map +1 -0
- package/dist/types/utilities/contours/interpolation/index.d.ts +3 -0
- package/dist/types/utilities/contours/interpolation/index.d.ts.map +1 -0
- package/dist/types/utilities/contours/interpolation/interpolate.d.ts +4 -0
- package/dist/types/utilities/contours/interpolation/interpolate.d.ts.map +1 -0
- package/dist/types/utilities/contours/reverseIfAntiClockwise.d.ts +3 -0
- package/dist/types/utilities/contours/reverseIfAntiClockwise.d.ts.map +1 -0
- package/dist/types/utilities/getViewportForAnnotation.d.ts +3 -0
- package/dist/types/utilities/getViewportForAnnotation.d.ts.map +1 -0
- package/dist/types/utilities/index.d.ts +2 -1
- package/dist/types/utilities/index.d.ts.map +1 -1
- package/dist/types/utilities/planar/filterAnnotationsForDisplay.d.ts.map +1 -1
- package/dist/types/utilities/planarFreehandROITool/index.d.ts +3 -3
- package/dist/types/utilities/planarFreehandROITool/index.d.ts.map +1 -1
- package/dist/types/utilities/planarFreehandROITool/smoothAnnotation.d.ts +4 -0
- package/dist/types/utilities/planarFreehandROITool/smoothAnnotation.d.ts.map +1 -0
- package/dist/types/utilities/planarFreehandROITool/{interpolatePoints.d.ts → smoothPoints.d.ts} +2 -2
- package/dist/types/utilities/planarFreehandROITool/smoothPoints.d.ts.map +1 -0
- package/dist/types/utilities/polyData/utils.d.ts +2 -1
- package/dist/types/utilities/polyData/utils.d.ts.map +1 -1
- package/dist/types/utilities/segmentation/InterpolationManager/InterpolationManager.d.ts +12 -0
- package/dist/types/utilities/segmentation/InterpolationManager/InterpolationManager.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/InterpolationManager/deleteRelatedAnnotations.d.ts +3 -0
- package/dist/types/utilities/segmentation/InterpolationManager/deleteRelatedAnnotations.d.ts.map +1 -0
- package/dist/types/utilities/triggerAnnotationRenderForViewportIds.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/enums/AnnotationStyleStates.ts +3 -0
- package/src/enums/ChangeTypes.ts +32 -0
- package/src/enums/Events.ts +16 -0
- package/src/enums/index.js +2 -0
- package/src/eventDispatchers/annotationInterpolationEventDispatcher.ts +42 -0
- package/src/eventDispatchers/index.js +2 -0
- package/src/init.ts +3 -0
- package/src/stateManagement/annotation/config/getState.ts +16 -2
- package/src/tools/annotation/LivewireContourTool.ts +3 -8
- package/src/tools/annotation/PlanarFreehandContourSegmentationTool.ts +6 -0
- package/src/tools/annotation/PlanarFreehandROITool.ts +47 -25
- package/src/tools/annotation/SplineROITool.ts +80 -28
- package/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts +15 -3
- package/src/tools/annotation/planarFreehandROITool/drawLoop.ts +10 -6
- package/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts +3 -3
- package/src/tools/base/ContourBaseTool.ts +4 -0
- package/src/tools/base/ContourSegmentationBaseTool.ts +11 -1
- package/src/tools/displayTools/Contour/contourConfig.ts +8 -3
- package/src/tools/displayTools/Contour/contourDisplay.ts +1 -3
- package/src/types/AnnotationStyle.ts +3 -1
- package/src/types/AnnotationTypes.ts +2 -0
- package/src/types/ContourSegmentationAnnotation.ts +1 -0
- package/src/types/ContourTypes.ts +8 -0
- package/src/types/EventTypes.ts +43 -0
- package/src/types/InterpolationTypes.ts +42 -0
- package/src/types/ToolSpecificAnnotationTypes.ts +15 -0
- package/src/types/index.ts +6 -0
- package/src/utilities/contours/PointsArray.ts +165 -0
- package/src/utilities/contours/index.ts +4 -1
- package/src/utilities/contours/interpolation/acceptAutogeneratedInterpolations.ts +16 -0
- package/src/utilities/contours/interpolation/createPolylineToolData.ts +56 -0
- package/src/utilities/contours/interpolation/findAnnotationForInterpolation.ts +225 -0
- package/src/utilities/contours/interpolation/getInterpolationData.ts +75 -0
- package/src/utilities/contours/interpolation/getInterpolationDataCollection.ts +31 -0
- package/src/utilities/contours/interpolation/index.ts +3 -0
- package/src/utilities/contours/interpolation/interpolate.ts +695 -0
- package/src/utilities/contours/reverseIfAntiClockwise.ts +50 -0
- package/src/utilities/getViewportForAnnotation.ts +29 -0
- package/src/utilities/index.ts +2 -0
- package/src/utilities/livewire/LivewireScissors.ts +1 -1
- package/src/utilities/planar/filterAnnotationsForDisplay.ts +6 -1
- package/src/utilities/planarFreehandROITool/index.ts +3 -3
- package/src/utilities/planarFreehandROITool/{interpolateAnnotation.ts → smoothAnnotation.ts} +5 -3
- package/src/utilities/planarFreehandROITool/{interpolatePoints.ts → smoothPoints.ts} +12 -6
- package/src/utilities/polyData/utils.ts +12 -5
- package/src/utilities/segmentation/InterpolationManager/InterpolationManager.ts +207 -0
- package/src/utilities/segmentation/InterpolationManager/deleteRelatedAnnotations.ts +97 -0
- package/src/utilities/triggerAnnotationRenderForViewportIds.ts +7 -2
- package/dist/cjs/utilities/planarFreehandROITool/interpolateAnnotation.d.ts +0 -3
- package/dist/cjs/utilities/planarFreehandROITool/interpolateAnnotation.js.map +0 -1
- package/dist/cjs/utilities/planarFreehandROITool/interpolatePoints.js.map +0 -1
- package/dist/esm/utilities/planarFreehandROITool/interpolateAnnotation.js.map +0 -1
- package/dist/esm/utilities/planarFreehandROITool/interpolatePoints.js.map +0 -1
- package/dist/types/utilities/planarFreehandROITool/interpolateAnnotation.d.ts +0 -4
- package/dist/types/utilities/planarFreehandROITool/interpolateAnnotation.d.ts.map +0 -1
- package/dist/types/utilities/planarFreehandROITool/interpolatePoints.d.ts.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getEnabledElement } from '@cornerstonejs/core';
|
|
2
|
-
import type { Types } from '@cornerstonejs/core';
|
|
3
2
|
import {
|
|
4
3
|
resetElementCursor,
|
|
5
4
|
hideElementCursor,
|
|
@@ -9,14 +8,15 @@ import { EventTypes } from '../../../types';
|
|
|
9
8
|
import { state } from '../../../store';
|
|
10
9
|
import { vec3 } from 'gl-matrix';
|
|
11
10
|
import {
|
|
12
|
-
|
|
11
|
+
shouldSmooth,
|
|
13
12
|
getInterpolatedPoints,
|
|
14
|
-
} from '../../../utilities/planarFreehandROITool/
|
|
13
|
+
} from '../../../utilities/planarFreehandROITool/smoothPoints';
|
|
15
14
|
import triggerAnnotationRenderForViewportIds from '../../../utilities/triggerAnnotationRenderForViewportIds';
|
|
16
15
|
import { PlanarFreehandROIAnnotation } from '../../../types/ToolSpecificAnnotationTypes';
|
|
17
16
|
import findOpenUShapedContourVectorToPeak from './findOpenUShapedContourVectorToPeak';
|
|
18
17
|
import { polyline } from '../../../utilities/math';
|
|
19
18
|
import { removeAnnotation } from '../../../stateManagement/annotation/annotationState';
|
|
19
|
+
import reverseIfAntiClockwise from '../../../utilities/contours/reverseIfAntiClockwise';
|
|
20
20
|
|
|
21
21
|
const {
|
|
22
22
|
addCanvasPointsToArray,
|
|
@@ -216,10 +216,14 @@ function completeDrawClosedContour(element: HTMLDivElement): boolean {
|
|
|
216
216
|
// Remove last point which will be a duplicate now.
|
|
217
217
|
canvasPoints.pop();
|
|
218
218
|
|
|
219
|
-
const
|
|
220
|
-
?
|
|
219
|
+
const clockwise = this.configuration.makeClockWise
|
|
220
|
+
? reverseIfAntiClockwise(canvasPoints)
|
|
221
221
|
: canvasPoints;
|
|
222
222
|
|
|
223
|
+
const updatedPoints = shouldSmooth(this.configuration, annotation)
|
|
224
|
+
? getInterpolatedPoints(this.configuration, clockwise)
|
|
225
|
+
: clockwise;
|
|
226
|
+
|
|
223
227
|
// Note: -> This is pretty expensive and may not scale well with hundreds of
|
|
224
228
|
// contours. A future optimisation if we use this for segmentation is to re-do
|
|
225
229
|
// this rendering with the GPU rather than SVG.
|
|
@@ -286,7 +290,7 @@ function completeDrawOpenContour(element: HTMLDivElement): boolean {
|
|
|
286
290
|
const enabledElement = getEnabledElement(element);
|
|
287
291
|
const { viewport, renderingEngine } = enabledElement;
|
|
288
292
|
|
|
289
|
-
const updatedPoints =
|
|
293
|
+
const updatedPoints = shouldSmooth(this.configuration, annotation)
|
|
290
294
|
? getInterpolatedPoints(this.configuration, canvasPoints)
|
|
291
295
|
: canvasPoints;
|
|
292
296
|
|
|
@@ -11,9 +11,9 @@ import { PlanarFreehandROIAnnotation } from '../../../types/ToolSpecificAnnotati
|
|
|
11
11
|
import { vec3, vec2 } from 'gl-matrix';
|
|
12
12
|
import { polyline } from '../../../utilities/math';
|
|
13
13
|
import {
|
|
14
|
-
|
|
14
|
+
shouldSmooth,
|
|
15
15
|
getInterpolatedPoints,
|
|
16
|
-
} from '../../../utilities/planarFreehandROITool/
|
|
16
|
+
} from '../../../utilities/planarFreehandROITool/smoothPoints';
|
|
17
17
|
import triggerAnnotationRenderForViewportIds from '../../../utilities/triggerAnnotationRenderForViewportIds';
|
|
18
18
|
import findOpenUShapedContourVectorToPeak from './findOpenUShapedContourVectorToPeak';
|
|
19
19
|
|
|
@@ -542,7 +542,7 @@ function completeOpenContourEdit(element: HTMLDivElement) {
|
|
|
542
542
|
const { fusedCanvasPoints, prevCanvasPoints } = this.editData;
|
|
543
543
|
|
|
544
544
|
if (fusedCanvasPoints) {
|
|
545
|
-
const updatedPoints =
|
|
545
|
+
const updatedPoints = shouldSmooth(this.configuration)
|
|
546
546
|
? getInterpolatedPoints(
|
|
547
547
|
this.configuration,
|
|
548
548
|
fusedCanvasPoints,
|
|
@@ -114,6 +114,7 @@ abstract class ContourBaseTool extends AnnotationTool {
|
|
|
114
114
|
viewUp
|
|
115
115
|
);
|
|
116
116
|
|
|
117
|
+
const referencedSliceIndex = viewport.getCurrentImageIdIndex();
|
|
117
118
|
const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
|
|
118
119
|
|
|
119
120
|
return <ContourAnnotation>{
|
|
@@ -125,6 +126,7 @@ abstract class ContourBaseTool extends AnnotationTool {
|
|
|
125
126
|
viewUp: <Types.Point3>[...viewUp],
|
|
126
127
|
FrameOfReferenceUID,
|
|
127
128
|
referencedImageId,
|
|
129
|
+
referencedSliceIndex,
|
|
128
130
|
},
|
|
129
131
|
data: {
|
|
130
132
|
handles: {
|
|
@@ -146,6 +148,8 @@ abstract class ContourBaseTool extends AnnotationTool {
|
|
|
146
148
|
closed: false,
|
|
147
149
|
},
|
|
148
150
|
},
|
|
151
|
+
interpolationUID: '',
|
|
152
|
+
autoGenerated: false,
|
|
149
153
|
};
|
|
150
154
|
}
|
|
151
155
|
|
|
@@ -16,6 +16,7 @@ import { ContourSegmentationAnnotation } from '../../types/ContourSegmentationAn
|
|
|
16
16
|
import { StyleSpecifier } from '../../types/AnnotationStyle';
|
|
17
17
|
import { SegmentationRepresentations } from '../../enums';
|
|
18
18
|
import ContourBaseTool from './ContourBaseTool';
|
|
19
|
+
import { InterpolationManager } from '../../utilities/contours/interpolation';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* A base contour segmentation class responsible for rendering, registering
|
|
@@ -24,6 +25,9 @@ import ContourBaseTool from './ContourBaseTool';
|
|
|
24
25
|
abstract class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
25
26
|
constructor(toolProps: PublicToolProps, defaultToolProps: ToolProps) {
|
|
26
27
|
super(toolProps, defaultToolProps);
|
|
28
|
+
if (this.configuration.interpolation?.enabled) {
|
|
29
|
+
InterpolationManager.addTool(this.getToolName());
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
/**
|
|
@@ -155,6 +159,7 @@ abstract class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
|
155
159
|
);
|
|
156
160
|
|
|
157
161
|
const { active } = segmentationRepresentation;
|
|
162
|
+
const { autoGenerated } = annotation;
|
|
158
163
|
const segmentsLocked = segmentLocking.getLockedSegments(segmentationId);
|
|
159
164
|
const annotationLocked = segmentsLocked.includes(segmentIndex as never);
|
|
160
165
|
|
|
@@ -207,7 +212,12 @@ abstract class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
|
207
212
|
let lineOpacity = 1;
|
|
208
213
|
let fillOpacity = 0;
|
|
209
214
|
|
|
210
|
-
if (
|
|
215
|
+
if (autoGenerated) {
|
|
216
|
+
lineWidth = mergedConfig.outlineWidthAutoGenerated ?? lineWidth;
|
|
217
|
+
lineDash = mergedConfig.outlineDashAutoGenerated ?? lineDash;
|
|
218
|
+
lineOpacity = mergedConfig.outlineOpacity ?? lineOpacity;
|
|
219
|
+
fillOpacity = mergedConfig.fillAlphaAutoGenerated ?? fillOpacity;
|
|
220
|
+
} else if (active) {
|
|
211
221
|
lineWidth = mergedConfig.outlineWidthActive ?? lineWidth;
|
|
212
222
|
lineDash = mergedConfig.outlineDashActive ?? lineDash;
|
|
213
223
|
lineOpacity = mergedConfig.outlineOpacity ?? lineOpacity;
|
|
@@ -2,13 +2,18 @@ import { ContourConfig } from '../../../types/ContourTypes';
|
|
|
2
2
|
|
|
3
3
|
const defaultContourConfig: ContourConfig = {
|
|
4
4
|
renderOutline: true,
|
|
5
|
+
outlineWidthAutoGenerated: 3,
|
|
5
6
|
outlineWidthActive: 2,
|
|
6
|
-
outlineWidthInactive:
|
|
7
|
+
outlineWidthInactive: 1,
|
|
7
8
|
outlineOpacity: 1,
|
|
8
9
|
outlineOpacityInactive: 0.85,
|
|
10
|
+
outlineDashActive: undefined,
|
|
11
|
+
outlineDashInactive: undefined,
|
|
12
|
+
outlineDashAutoGenerated: '5,3',
|
|
9
13
|
renderFill: true,
|
|
10
|
-
fillAlpha:
|
|
11
|
-
fillAlphaInactive: 0,
|
|
14
|
+
fillAlpha: 0.5,
|
|
15
|
+
fillAlphaInactive: 0.3,
|
|
16
|
+
fillAlphaAutoGenerated: 0.3,
|
|
12
17
|
};
|
|
13
18
|
|
|
14
19
|
function getDefaultContourConfig(): ContourConfig {
|
|
@@ -76,9 +76,7 @@ async function render(
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
if (!geometryIds?.length) {
|
|
79
|
-
|
|
80
|
-
`No contours found for segmentationId ${segmentationId}. Skipping render.`
|
|
81
|
-
);
|
|
79
|
+
// This is a normal occurrence when contours activated, but not yet drawn
|
|
82
80
|
return;
|
|
83
81
|
}
|
|
84
82
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
type Modes = '' | 'Active' | 'Passive' | 'Enabled';
|
|
2
|
-
type States = '' | 'Highlighted' | 'Selected' | 'Locked';
|
|
2
|
+
type States = '' | 'Highlighted' | 'Selected' | 'Locked' | 'AutoGenerated';
|
|
3
3
|
|
|
4
4
|
type Properties =
|
|
5
5
|
| 'color'
|
|
6
|
+
| 'colorAutoGenerated'
|
|
6
7
|
| 'lineWidth'
|
|
8
|
+
| 'lineWidthAutoGenerated'
|
|
7
9
|
| 'lineDash'
|
|
8
10
|
| 'textBoxFontFamily'
|
|
9
11
|
| 'textBoxFontSize'
|
|
@@ -11,6 +11,8 @@ type Annotation = {
|
|
|
11
11
|
isVisible?: boolean;
|
|
12
12
|
/** Has annotation data been invalidated (e.g., as a result of mouse interactions) */
|
|
13
13
|
invalidated?: boolean;
|
|
14
|
+
/** If the annotation is auto generated from other annotations*/
|
|
15
|
+
autoGenerated?: boolean;
|
|
14
16
|
/** Metadata for annotation */
|
|
15
17
|
metadata: {
|
|
16
18
|
/**
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Label map config for the label map representation
|
|
3
3
|
*/
|
|
4
4
|
export type ContourConfig = {
|
|
5
|
+
/** thickness of the outline when segmentation is auto generated */
|
|
6
|
+
outlineWidthAutoGenerated?: number;
|
|
5
7
|
/** thickness of the outline when segmentation is active */
|
|
6
8
|
outlineWidthActive?: number;
|
|
7
9
|
/** thickness of the outline when segmentation is inactive */
|
|
@@ -14,6 +16,10 @@ export type ContourConfig = {
|
|
|
14
16
|
outlineDashActive?: string;
|
|
15
17
|
/** dash style of the outline when segmentation is inactive */
|
|
16
18
|
outlineDashInactive?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Dash style of the outline when segmentation is auto-generated
|
|
21
|
+
*/
|
|
22
|
+
outlineDashAutoGenerated?: string;
|
|
17
23
|
/** outline visibility */
|
|
18
24
|
renderOutline?: boolean;
|
|
19
25
|
/** render fill */
|
|
@@ -22,6 +28,8 @@ export type ContourConfig = {
|
|
|
22
28
|
fillAlpha?: number;
|
|
23
29
|
/** fillAlphaInactive */
|
|
24
30
|
fillAlphaInactive?: number;
|
|
31
|
+
/** fillAlphaAutoGenerated */
|
|
32
|
+
fillAlphaAutoGenerated?: number;
|
|
25
33
|
};
|
|
26
34
|
|
|
27
35
|
/**
|
package/src/types/EventTypes.ts
CHANGED
|
@@ -6,6 +6,8 @@ import IDistance from './IDistance';
|
|
|
6
6
|
import { SetToolBindingsType } from './ISetToolModeOptions';
|
|
7
7
|
import { Swipe } from '../enums/Touch';
|
|
8
8
|
import { ToolModes } from '../enums';
|
|
9
|
+
import { InterpolationROIAnnotation } from './ToolSpecificAnnotationTypes';
|
|
10
|
+
import { ChangeTypes } from '../enums';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* The normalized interaction event detail
|
|
@@ -118,6 +120,7 @@ type AnnotationAddedEventDetail = {
|
|
|
118
120
|
type AnnotationCompletedEventDetail = {
|
|
119
121
|
/** The annotation that is being added to the annotations manager. */
|
|
120
122
|
annotation: Annotation;
|
|
123
|
+
changeType?: ChangeTypes.Completed;
|
|
121
124
|
};
|
|
122
125
|
|
|
123
126
|
/**
|
|
@@ -130,6 +133,8 @@ type AnnotationModifiedEventDetail = {
|
|
|
130
133
|
renderingEngineId: string;
|
|
131
134
|
/** The annotation that is being added to the annotations manager. */
|
|
132
135
|
annotation: Annotation;
|
|
136
|
+
/** The type of this change */
|
|
137
|
+
changeType?: ChangeTypes;
|
|
133
138
|
};
|
|
134
139
|
|
|
135
140
|
/**
|
|
@@ -187,6 +192,28 @@ type AnnotationRenderedEventDetail = {
|
|
|
187
192
|
renderingEngineId: string;
|
|
188
193
|
};
|
|
189
194
|
|
|
195
|
+
type AnnotationInterpolationCompletedEventDetail = {
|
|
196
|
+
/** The annotation that is being updated with a change in label. */
|
|
197
|
+
annotation: InterpolationROIAnnotation;
|
|
198
|
+
/** The HTML element that the annotation was rendered on. */
|
|
199
|
+
element: HTMLDivElement;
|
|
200
|
+
/** unique id of the viewport */
|
|
201
|
+
viewportId: string;
|
|
202
|
+
/** unique id of the rendering engine */
|
|
203
|
+
renderingEngineId: string;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
type AnnotationInterpolationRemovedEventDetail = {
|
|
207
|
+
/** The annotations that is being removed . */
|
|
208
|
+
annotations: Array<InterpolationROIAnnotation>;
|
|
209
|
+
/** The HTML element that the annotation was rendered on. */
|
|
210
|
+
element: HTMLDivElement;
|
|
211
|
+
/** unique id of the viewport */
|
|
212
|
+
viewportId: string;
|
|
213
|
+
/** unique id of the rendering engine */
|
|
214
|
+
renderingEngineId: string;
|
|
215
|
+
};
|
|
216
|
+
|
|
190
217
|
/**
|
|
191
218
|
* EventDetail for when a Segmentation Data is modified by a tool
|
|
192
219
|
*/
|
|
@@ -498,6 +525,18 @@ type AnnotationLockChangeEventType =
|
|
|
498
525
|
type AnnotationVisibilityChangeEventType =
|
|
499
526
|
Types.CustomEventType<AnnotationVisibilityChangeEventDetail>;
|
|
500
527
|
|
|
528
|
+
/**
|
|
529
|
+
* The Annotation interpolation process completed event type
|
|
530
|
+
*/
|
|
531
|
+
type AnnotationInterpolationCompletedEventType =
|
|
532
|
+
Types.CustomEventType<AnnotationInterpolationCompletedEventDetail>;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* The Annotation interpolation removed event type
|
|
536
|
+
*/
|
|
537
|
+
type AnnotationInterpolationRemovedEventType =
|
|
538
|
+
Types.CustomEventType<AnnotationInterpolationRemovedEventDetail>;
|
|
539
|
+
|
|
501
540
|
/**
|
|
502
541
|
* Event for when SegmentationData is modified
|
|
503
542
|
*/
|
|
@@ -670,6 +709,10 @@ export {
|
|
|
670
709
|
AnnotationVisibilityChangeEventDetail,
|
|
671
710
|
AnnotationLockChangeEventType,
|
|
672
711
|
AnnotationVisibilityChangeEventType,
|
|
712
|
+
AnnotationInterpolationCompletedEventDetail,
|
|
713
|
+
AnnotationInterpolationCompletedEventType,
|
|
714
|
+
AnnotationInterpolationRemovedEventDetail,
|
|
715
|
+
AnnotationInterpolationRemovedEventType,
|
|
673
716
|
SegmentationDataModifiedEventType,
|
|
674
717
|
SegmentationRepresentationModifiedEventDetail,
|
|
675
718
|
SegmentationRepresentationModifiedEventType,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Types } from '@cornerstonejs/core';
|
|
2
|
+
import { Annotation } from './AnnotationTypes';
|
|
3
|
+
import { InterpolationROIAnnotation } from './ToolSpecificAnnotationTypes';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A base viewport and annotation information used to start interpolating
|
|
7
|
+
* between slices.
|
|
8
|
+
*/
|
|
9
|
+
export type InterpolationViewportData = {
|
|
10
|
+
/** The annotation that was just completed. */
|
|
11
|
+
annotation: InterpolationROIAnnotation;
|
|
12
|
+
/** The type of event, whether initializing the label or updating it. */
|
|
13
|
+
interpolationUID: string;
|
|
14
|
+
/** The viewport that this interpolation is occurring within */
|
|
15
|
+
viewport: Types.IViewport;
|
|
16
|
+
sliceData: Types.ImageSliceData;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type ImageInterpolationData = {
|
|
20
|
+
sliceIndex: number;
|
|
21
|
+
annotations?: Annotation[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The selector object for accepting interpolation results. This object
|
|
26
|
+
* can be specified to select a sub-set of interpolation results.
|
|
27
|
+
*/
|
|
28
|
+
export type AcceptInterpolationSelector = {
|
|
29
|
+
/**
|
|
30
|
+
* Specify the tool names to apply this to, defaulting to all
|
|
31
|
+
* interpolation tools registered
|
|
32
|
+
*/
|
|
33
|
+
toolNames?: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Applies just to the given segmentation
|
|
36
|
+
*/
|
|
37
|
+
segmentationId?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Applies just to the given segment index.
|
|
40
|
+
*/
|
|
41
|
+
segmentIndex?: number;
|
|
42
|
+
};
|
|
@@ -264,6 +264,21 @@ export type PlanarFreehandROIAnnotation = ContourAnnotation & {
|
|
|
264
264
|
export type PlanarFreehandContourSegmentationAnnotation =
|
|
265
265
|
PlanarFreehandROIAnnotation & ContourSegmentationAnnotationData;
|
|
266
266
|
|
|
267
|
+
export type InterpolationROIAnnotation = ContourAnnotation & {
|
|
268
|
+
metadata: {
|
|
269
|
+
cameraPosition?: Types.Point3;
|
|
270
|
+
cameraFocalPoint?: Types.Point3;
|
|
271
|
+
viewPlaneNormal?: Types.Point3;
|
|
272
|
+
viewUp?: Types.Point3;
|
|
273
|
+
annotationUID?: string;
|
|
274
|
+
FrameOfReferenceUID: string;
|
|
275
|
+
referencedImageId?: string;
|
|
276
|
+
toolName: string;
|
|
277
|
+
referencedSliceIndex?: number;
|
|
278
|
+
};
|
|
279
|
+
interpolationUID?: string;
|
|
280
|
+
};
|
|
281
|
+
|
|
267
282
|
export interface ArrowAnnotation extends Annotation {
|
|
268
283
|
data: {
|
|
269
284
|
text: string;
|
package/src/types/index.ts
CHANGED
|
@@ -70,6 +70,10 @@ import {
|
|
|
70
70
|
LabelmapToolOperationDataStack,
|
|
71
71
|
LabelmapToolOperationDataVolume,
|
|
72
72
|
} from './LabelmapToolOperationData';
|
|
73
|
+
import type {
|
|
74
|
+
InterpolationViewportData,
|
|
75
|
+
ImageInterpolationData,
|
|
76
|
+
} from './InterpolationTypes';
|
|
73
77
|
|
|
74
78
|
// Splines
|
|
75
79
|
import type { CardinalSplineProps } from './CardinalSplineProps';
|
|
@@ -94,6 +98,8 @@ export type {
|
|
|
94
98
|
BidirectionalData,
|
|
95
99
|
CanvasCoordinates,
|
|
96
100
|
IAnnotationManager,
|
|
101
|
+
InterpolationViewportData,
|
|
102
|
+
ImageInterpolationData,
|
|
97
103
|
GroupSpecificAnnotations,
|
|
98
104
|
AnnotationState,
|
|
99
105
|
AnnotationStyle,
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import { vec2, vec3 } from 'gl-matrix';
|
|
3
|
+
|
|
4
|
+
export type PolyDataPointConfiguration = {
|
|
5
|
+
dimensions?: 2 | 3;
|
|
6
|
+
initialSize?: number;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* PointsArray is a TypedArray based representation of n dimensional points with
|
|
11
|
+
* custom sub-classes to represent the version of this based on Point2 and Point3
|
|
12
|
+
* gl-matrix implementation.
|
|
13
|
+
* This representation is efficient for storing large numbers of points and for
|
|
14
|
+
* transferring them amongst systems and is planned to have more methods added
|
|
15
|
+
* for generic manipulation of data.
|
|
16
|
+
*/
|
|
17
|
+
export abstract class PointsArray<T> {
|
|
18
|
+
data: Float32Array;
|
|
19
|
+
dimensions = 3;
|
|
20
|
+
public length = 0;
|
|
21
|
+
|
|
22
|
+
constructor(configuration: PolyDataPointConfiguration = {}) {
|
|
23
|
+
const { initialSize = 1024, dimensions = 3 } = configuration;
|
|
24
|
+
this.data = new Float32Array(initialSize * dimensions);
|
|
25
|
+
this.dimensions = dimensions;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
protected forEach(func: (value: T, index: number) => void, point: T) {
|
|
29
|
+
for (let i = 0; i < this.length; i++) {
|
|
30
|
+
func(this.getPoint(i, point), i);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
abstract getPoint(index: number, point: T): T;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Reverse the points in place
|
|
38
|
+
*/
|
|
39
|
+
public reverse() {
|
|
40
|
+
const midLength = Math.floor(this.length / 2);
|
|
41
|
+
|
|
42
|
+
for (let i = 0; i < midLength; i++) {
|
|
43
|
+
const indexStart = i * this.dimensions;
|
|
44
|
+
const indexEnd = (this.length - 1 - i) * this.dimensions;
|
|
45
|
+
for (let dimension = 0; dimension < this.dimensions; dimension++) {
|
|
46
|
+
const valueStart = this.data[indexStart + dimension];
|
|
47
|
+
this.data[indexStart + dimension] = this.data[indexEnd + dimension];
|
|
48
|
+
this.data[indexEnd + dimension] = valueStart;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
protected map(f: (value, index: number) => T, factory: (index: number) => T) {
|
|
54
|
+
const mapData = [];
|
|
55
|
+
for (let i = 0; i < this.length; i++) {
|
|
56
|
+
mapData.push(f(this.getPoint(i, factory(i)), i));
|
|
57
|
+
}
|
|
58
|
+
return mapData;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Create an PointsArray3 from the x,y,z individual arrays */
|
|
62
|
+
public static fromXYZ({ x, y, z }: Types.PointsXYZ): PointsArray3 {
|
|
63
|
+
const array = new PointsArray3({ initialSize: x.length });
|
|
64
|
+
let offset = 0;
|
|
65
|
+
for (let i = 0; i < x.length; i++) {
|
|
66
|
+
array.data[offset++] = x[i];
|
|
67
|
+
array.data[offset++] = y[i];
|
|
68
|
+
array.data[offset++] = z[i];
|
|
69
|
+
}
|
|
70
|
+
array.length = x.length;
|
|
71
|
+
return array;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A version of this with support for Types.Point2 and vec2 generation and extraction.
|
|
77
|
+
*
|
|
78
|
+
* This class is designed to allow for efficient storage and manipulation of
|
|
79
|
+
* large sets of Point2 type data but stored as a single Float32Array.
|
|
80
|
+
*/
|
|
81
|
+
export class PointsArray2 extends PointsArray<Types.Point2> {
|
|
82
|
+
constructor(configuration = {}) {
|
|
83
|
+
super({ ...configuration, dimensions: 2 });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public forEach(
|
|
87
|
+
func: (value: Types.Point2, index: number) => void,
|
|
88
|
+
point = vec2.create() as Types.Point2
|
|
89
|
+
) {
|
|
90
|
+
super.forEach(func, point);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public getPoint(index: number, point = vec2.create() as Types.Point2) {
|
|
94
|
+
if (index >= this.length) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const index2 = index * 2;
|
|
98
|
+
point[0] = this.data[index2];
|
|
99
|
+
point[1] = this.data[index2 + 1];
|
|
100
|
+
return point;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public get points() {
|
|
104
|
+
return this.map(
|
|
105
|
+
(point) => point,
|
|
106
|
+
() => vec2.create() as Types.Point2
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* A version of PointsArray designed to work with Types.Point3 and vec3 data,
|
|
113
|
+
* but efficiently storing the data internally as a Float32Array.
|
|
114
|
+
* A good use case for this would be storing contour data or function results
|
|
115
|
+
* of type `(number)=>Point3` as these can be quite large and can benefit from
|
|
116
|
+
* directly using the Float32Array representation for both the Point3 values and
|
|
117
|
+
* the internal storage of the Point3[] data.
|
|
118
|
+
*
|
|
119
|
+
* For example, a 64k length array of `PointsArray3` data is just a bit over 256k of data as
|
|
120
|
+
* stored with this class, but when stored as a Point3[], is at least 1 meg in size
|
|
121
|
+
* because each number is 64 bits, and each Point3[] requires a list of values, adding
|
|
122
|
+
* at least another 8 bytes per value, and at least another 64 bytes per array.
|
|
123
|
+
*/
|
|
124
|
+
export class PointsArray3 extends PointsArray<Types.Point3> {
|
|
125
|
+
constructor(configuration = {}) {
|
|
126
|
+
super({ ...configuration, dimensions: 3 });
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
public forEach(
|
|
130
|
+
func: (value: Types.Point3, index: number) => void,
|
|
131
|
+
point = vec3.create() as Types.Point3
|
|
132
|
+
) {
|
|
133
|
+
super.forEach(func, point);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
public getPoint(index: number, point = vec3.create() as Types.Point3) {
|
|
137
|
+
if (index >= this.length) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const index2 = index * 3;
|
|
141
|
+
point[0] = this.data[index2];
|
|
142
|
+
point[1] = this.data[index2 + 1];
|
|
143
|
+
point[2] = this.data[index2 + 2];
|
|
144
|
+
return point;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
public get points() {
|
|
148
|
+
return this.map(
|
|
149
|
+
(point) => point,
|
|
150
|
+
() => vec3.create() as Types.Point3
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
public getXYZ(): Types.PointsXYZ {
|
|
155
|
+
const x = [];
|
|
156
|
+
const y = [];
|
|
157
|
+
const z = [];
|
|
158
|
+
this.forEach((point) => {
|
|
159
|
+
x.push(point[0]);
|
|
160
|
+
y.push(point[1]);
|
|
161
|
+
z.push(point[2]);
|
|
162
|
+
});
|
|
163
|
+
return { x, y, z };
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -2,8 +2,9 @@ import contourFinder from './contourFinder';
|
|
|
2
2
|
import mergePoints from './mergePoints';
|
|
3
3
|
import detectContourHoles from './detectContourHoles';
|
|
4
4
|
import { generateContourSetsFromLabelmap } from './generateContourSetsFromLabelmap';
|
|
5
|
-
|
|
6
5
|
import AnnotationToPointData from './AnnotationToPointData';
|
|
6
|
+
import acceptAutogeneratedInterpolations from './interpolation/acceptAutogeneratedInterpolations';
|
|
7
|
+
import * as interpolation from './interpolation';
|
|
7
8
|
|
|
8
9
|
export {
|
|
9
10
|
contourFinder,
|
|
@@ -11,4 +12,6 @@ export {
|
|
|
11
12
|
detectContourHoles,
|
|
12
13
|
generateContourSetsFromLabelmap,
|
|
13
14
|
AnnotationToPointData,
|
|
15
|
+
interpolation,
|
|
16
|
+
acceptAutogeneratedInterpolations,
|
|
14
17
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import InterpolationManager from '../../segmentation/InterpolationManager/InterpolationManager';
|
|
2
|
+
import type { AcceptInterpolationSelector } from '../../../types/InterpolationTypes';
|
|
3
|
+
import type AnnotationGroupSelector from '../../../types/AnnotationGroupSelector';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Accepts interpolated annotations, marking them as autoGenerated false.
|
|
7
|
+
*
|
|
8
|
+
* @param annotationGroupSelector - viewport or FOR to select annotations for
|
|
9
|
+
* @param selector - nested selection criteria
|
|
10
|
+
*/
|
|
11
|
+
export default function acceptAutogeneratedInterpolations(
|
|
12
|
+
annotationGroupSelector: AnnotationGroupSelector,
|
|
13
|
+
selector: AcceptInterpolationSelector
|
|
14
|
+
) {
|
|
15
|
+
InterpolationManager.acceptAutoGenerated(annotationGroupSelector, selector);
|
|
16
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Types, utilities as csUtils } from '@cornerstonejs/core';
|
|
2
|
+
import { InterpolationROIAnnotation } from '../../../types/ToolSpecificAnnotationTypes';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new annotation instance given the tool data, based on the referenced tool
|
|
6
|
+
* data type.
|
|
7
|
+
* Note that this object takes ownership of the polyline and handlePoints data, that is,
|
|
8
|
+
* directly assigns them internally to the result.
|
|
9
|
+
*
|
|
10
|
+
* @param polyline - data for the polyline, owned hereafter by the annotation
|
|
11
|
+
* @param handlePoints - data for the edit handles, if any, owned hereafter by the annotation
|
|
12
|
+
* @param referencedToolData - for base data for the new tool
|
|
13
|
+
|
|
14
|
+
*/
|
|
15
|
+
export default function createPolylineToolData(
|
|
16
|
+
polyline,
|
|
17
|
+
handlePoints,
|
|
18
|
+
referencedToolData
|
|
19
|
+
) {
|
|
20
|
+
const annotation: InterpolationROIAnnotation = csUtils.deepMerge(
|
|
21
|
+
{
|
|
22
|
+
data: {},
|
|
23
|
+
metadata: {},
|
|
24
|
+
},
|
|
25
|
+
referencedToolData
|
|
26
|
+
);
|
|
27
|
+
Object.assign(annotation, {
|
|
28
|
+
highlighted: false,
|
|
29
|
+
invalidated: true,
|
|
30
|
+
autoGenerated: true,
|
|
31
|
+
annotationUID: undefined,
|
|
32
|
+
cachedStats: {},
|
|
33
|
+
});
|
|
34
|
+
Object.assign(annotation.data, {
|
|
35
|
+
handles: {
|
|
36
|
+
points: handlePoints || [],
|
|
37
|
+
activeHandleIndex: null,
|
|
38
|
+
textBox: {
|
|
39
|
+
hasMoved: false,
|
|
40
|
+
worldPosition: <Types.Point3>[0, 0, 0],
|
|
41
|
+
worldBoundingBox: {
|
|
42
|
+
topLeft: <Types.Point3>[0, 0, 0],
|
|
43
|
+
topRight: <Types.Point3>[0, 0, 0],
|
|
44
|
+
bottomLeft: <Types.Point3>[0, 0, 0],
|
|
45
|
+
bottomRight: <Types.Point3>[0, 0, 0],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
contour: {
|
|
50
|
+
polyline,
|
|
51
|
+
closed: true,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return annotation;
|
|
56
|
+
}
|