@cornerstonejs/tools 2.0.0-beta.20 → 2.0.0-beta.21
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/esm/cursors/SVGCursorDescriptor.d.ts +1 -1
- package/dist/esm/cursors/SVGCursorDescriptor.js +7 -0
- package/dist/esm/cursors/SVGMouseCursor.d.ts +1 -1
- package/dist/esm/drawingSvg/draw.d.ts +2 -1
- package/dist/esm/drawingSvg/drawArrow.d.ts +1 -1
- package/dist/esm/drawingSvg/drawCircle.d.ts +1 -1
- package/dist/esm/drawingSvg/drawEllipse.d.ts +1 -1
- package/dist/esm/drawingSvg/drawEllipse.js +1 -0
- package/dist/esm/drawingSvg/drawEllipseByCoordinates.d.ts +1 -1
- package/dist/esm/drawingSvg/drawHandle.d.ts +1 -1
- package/dist/esm/drawingSvg/drawHandles.d.ts +1 -1
- package/dist/esm/drawingSvg/drawHeight.d.ts +3 -0
- package/dist/esm/drawingSvg/drawHeight.js +42 -0
- package/dist/esm/drawingSvg/drawLine.d.ts +1 -1
- package/dist/esm/drawingSvg/drawLink.d.ts +1 -1
- package/dist/esm/drawingSvg/drawLinkedTextBox.d.ts +1 -1
- package/dist/esm/drawingSvg/drawPath.d.ts +1 -1
- package/dist/esm/drawingSvg/drawPolyline.d.ts +1 -1
- package/dist/esm/drawingSvg/drawRect.d.ts +1 -1
- package/dist/esm/drawingSvg/drawRect.js +1 -0
- package/dist/esm/drawingSvg/drawRectByCoordinates.d.ts +1 -1
- package/dist/esm/drawingSvg/drawRedactionRect.d.ts +3 -1
- package/dist/esm/drawingSvg/drawTextBox.d.ts +1 -1
- package/dist/esm/drawingSvg/getSvgDrawingHelper.d.ts +1 -1
- package/dist/esm/drawingSvg/getSvgDrawingHelper.js +1 -1
- package/dist/esm/drawingSvg/index.d.ts +2 -1
- package/dist/esm/drawingSvg/index.js +2 -1
- package/dist/esm/enums/ToolBindings.d.ts +3 -1
- package/dist/esm/enums/ToolBindings.js +2 -0
- package/dist/esm/eventDispatchers/keyboardEventHandlers/keyDown.d.ts +1 -1
- package/dist/esm/eventDispatchers/keyboardEventHandlers/keyUp.d.ts +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDown.d.ts +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDownActivate.d.ts +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.d.ts +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDrag.d.ts +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseMove.d.ts +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseWheel.d.ts +2 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseWheel.js +15 -2
- package/dist/esm/eventDispatchers/shared/getActiveToolForKeyboardEvent.d.ts +1 -1
- package/dist/esm/eventDispatchers/shared/getActiveToolForMouseEvent.d.ts +1 -1
- package/dist/esm/eventDispatchers/shared/getActiveToolForMouseEvent.js +3 -4
- package/dist/esm/eventDispatchers/shared/getActiveToolForTouchEvent.d.ts +1 -1
- package/dist/esm/eventDispatchers/shared/getActiveToolForTouchEvent.js +1 -1
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForKeyboardEvents.d.ts +2 -2
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForMouseEvent.d.ts +4 -3
- package/dist/esm/eventDispatchers/shared/getToolsWithModesForMouseEvent.d.ts +3 -3
- package/dist/esm/eventDispatchers/shared/getToolsWithModesForTouchEvent.d.ts +2 -2
- package/dist/esm/eventDispatchers/touchEventHandlers/touchDrag.d.ts +1 -1
- package/dist/esm/eventDispatchers/touchEventHandlers/touchStart.d.ts +1 -1
- package/dist/esm/eventDispatchers/touchEventHandlers/touchStartActivate.d.ts +1 -1
- package/dist/esm/eventListeners/annotations/annotationCompletedListener.d.ts +1 -1
- package/dist/esm/eventListeners/annotations/annotationRemovedListener.d.ts +1 -1
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts +3 -3
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +1 -1
- package/dist/esm/eventListeners/mouse/getMouseEventPoints.d.ts +1 -1
- package/dist/esm/eventListeners/mouse/getMouseEventPoints.js +4 -1
- package/dist/esm/eventListeners/mouse/mouseDownListener.js +9 -1
- package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js +6 -6
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.d.ts +1 -1
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +3 -3
- package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.d.ts +1 -1
- package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js +2 -2
- package/dist/esm/eventListeners/segmentation/segmentationModifiedEventListener.d.ts +1 -1
- package/dist/esm/eventListeners/segmentation/segmentationModifiedEventListener.js +3 -2
- package/dist/esm/eventListeners/segmentation/segmentationRepresentationModifiedEventListener.d.ts +1 -1
- package/dist/esm/eventListeners/segmentation/segmentationRepresentationModifiedEventListener.js +5 -5
- package/dist/esm/eventListeners/segmentation/segmentationRepresentationRemovedEventListener.d.ts +1 -1
- package/dist/esm/eventListeners/segmentation/segmentationRepresentationRemovedEventListener.js +4 -2
- package/dist/esm/eventListeners/touch/getTouchEventPoints.d.ts +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/stateManagement/annotation/AnnotationRenderingEngine.d.ts +20 -0
- package/dist/esm/stateManagement/annotation/AnnotationRenderingEngine.js +112 -0
- package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.d.ts +3 -3
- package/dist/esm/stateManagement/annotation/annotationLocking.d.ts +1 -1
- package/dist/esm/stateManagement/annotation/annotationState.d.ts +2 -2
- package/dist/esm/stateManagement/annotation/annotationVisibility.d.ts +1 -1
- package/dist/esm/stateManagement/annotation/config/ToolStyle.d.ts +1 -1
- package/dist/esm/stateManagement/annotation/config/getFont.d.ts +2 -2
- package/dist/esm/stateManagement/annotation/config/getState.d.ts +1 -1
- package/dist/esm/stateManagement/annotation/config/helpers.d.ts +2 -2
- package/dist/esm/stateManagement/annotation/helpers/state.d.ts +2 -2
- package/dist/esm/stateManagement/annotation/utilities/defineProperties.d.ts +1 -1
- package/dist/esm/stateManagement/index.d.ts +3 -3
- package/dist/esm/stateManagement/index.js +2 -2
- package/dist/esm/{tools/displayTools → stateManagement/segmentation}/SegmentationRenderingEngine.d.ts +3 -3
- package/dist/esm/{tools/displayTools → stateManagement/segmentation}/SegmentationRenderingEngine.js +14 -17
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.d.ts +12 -12
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +27 -19
- package/dist/esm/stateManagement/segmentation/activeSegmentation.d.ts +5 -4
- package/dist/esm/stateManagement/segmentation/activeSegmentation.js +12 -5
- package/dist/esm/stateManagement/segmentation/addRepresentationData.d.ts +3 -3
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentation.d.ts +3 -0
- package/dist/esm/stateManagement/segmentation/{addRepresentation.js → addSegmentationRepresentation.js} +6 -6
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.d.ts +3 -0
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.js +9 -0
- package/dist/esm/stateManagement/segmentation/addSegmentations.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/config/index.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/config/index.js +2 -2
- package/dist/esm/stateManagement/segmentation/config/segmentationColor.js +2 -2
- package/dist/esm/stateManagement/segmentation/config/segmentationConfig.d.ts +5 -5
- package/dist/esm/stateManagement/segmentation/config/segmentationConfig.js +5 -5
- package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.d.ts +5 -5
- package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js +12 -12
- package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.js +3 -7
- package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.js +8 -53
- package/dist/esm/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/helpers/getSegmentationRepresentationRenderingConfig.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/helpers/{getRepresentationRenderingConfig.js → getSegmentationRepresentationRenderingConfig.js} +2 -2
- package/dist/esm/stateManagement/segmentation/helpers/normalizeSegmentationInput.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/helpers/validateSegmentationInput.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/index.d.ts +3 -3
- package/dist/esm/stateManagement/segmentation/index.js +3 -3
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js +3 -3
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js +12 -21
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js +2 -6
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js +8 -13
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js +2 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.js +4 -3
- package/dist/esm/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.js +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/computeAndAddRepresentation.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/removeSegmentationRepresentations.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/{removeRepresentationsFromViewport.js → removeSegmentationRepresentations.js} +9 -6
- package/dist/esm/stateManagement/segmentation/segmentIndex.js +2 -2
- package/dist/esm/stateManagement/segmentation/segmentLocking.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/segmentLocking.js +2 -2
- package/dist/esm/stateManagement/segmentation/segmentationState.d.ts +16 -16
- package/dist/esm/stateManagement/segmentation/segmentationState.js +30 -30
- package/dist/esm/store/SynchronizerManager/Synchronizer.d.ts +7 -3
- package/dist/esm/store/SynchronizerManager/Synchronizer.js +2 -1
- package/dist/esm/store/SynchronizerManager/createSynchronizer.d.ts +3 -3
- package/dist/esm/store/SynchronizerManager/createSynchronizer.js +1 -1
- package/dist/esm/store/SynchronizerManager/getAllSynchronizers.d.ts +1 -1
- package/dist/esm/store/SynchronizerManager/getSynchronizer.d.ts +1 -1
- package/dist/esm/store/SynchronizerManager/getSynchronizersForViewport.d.ts +1 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.d.ts +3 -3
- package/dist/esm/store/ToolGroupManager/ToolGroup.js +5 -2
- package/dist/esm/store/ToolGroupManager/createToolGroup.d.ts +1 -1
- package/dist/esm/store/ToolGroupManager/destroyToolGroup.js +1 -0
- package/dist/esm/store/ToolGroupManager/getAllToolGroups.d.ts +1 -1
- package/dist/esm/store/ToolGroupManager/getToolGroup.d.ts +1 -1
- package/dist/esm/store/ToolGroupManager/getToolGroupForViewport.d.ts +1 -1
- package/dist/esm/store/ToolGroupManager/getToolGroupsWithToolName.d.ts +1 -1
- package/dist/esm/store/addEnabledElement.d.ts +1 -1
- package/dist/esm/store/addEnabledElement.js +1 -1
- package/dist/esm/store/addTool.js +0 -3
- package/dist/esm/store/filterMoveableAnnotationTools.d.ts +1 -1
- package/dist/esm/store/filterToolsWithAnnotationsForElement.d.ts +1 -1
- package/dist/esm/store/filterToolsWithMoveableHandles.d.ts +1 -1
- package/dist/esm/store/removeEnabledElement.d.ts +1 -1
- package/dist/esm/store/removeEnabledElement.js +1 -1
- package/dist/esm/store/state.d.ts +4 -3
- package/dist/esm/store/state.js +1 -1
- package/dist/esm/synchronizers/callbacks/areViewportsCoplanar .d.ts +1 -1
- package/dist/esm/synchronizers/callbacks/cameraSyncCallback.d.ts +2 -2
- package/dist/esm/synchronizers/callbacks/imageSliceSyncCallback.d.ts +2 -2
- package/dist/esm/synchronizers/callbacks/presentationViewSyncCallback.d.ts +1 -1
- package/dist/esm/synchronizers/callbacks/slabThicknessSyncCallback.d.ts +1 -1
- package/dist/esm/synchronizers/callbacks/voiSyncCallback.d.ts +5 -2
- package/dist/esm/synchronizers/callbacks/zoomPanSyncCallback.d.ts +2 -2
- package/dist/esm/synchronizers/synchronizers/createCameraPositionSynchronizer.d.ts +1 -1
- package/dist/esm/synchronizers/synchronizers/createImageSliceSynchronizer.d.ts +1 -1
- package/dist/esm/synchronizers/synchronizers/createPresentationViewSynchronizer.d.ts +2 -2
- package/dist/esm/synchronizers/synchronizers/createPresentationViewSynchronizer.js +1 -1
- package/dist/esm/synchronizers/synchronizers/createSlabThicknessSynchronizer.d.ts +1 -1
- package/dist/esm/synchronizers/synchronizers/createVOISynchronizer.d.ts +1 -1
- package/dist/esm/synchronizers/synchronizers/createZoomPanSynchronizer.d.ts +1 -1
- package/dist/esm/tools/AdvancedMagnifyTool.d.ts +4 -6
- package/dist/esm/tools/AdvancedMagnifyViewport.js +1 -1
- package/dist/esm/tools/AdvancedMagnifyViewportManager.d.ts +3 -2
- package/dist/esm/tools/AdvancedMagnifyViewportManager.js +1 -1
- package/dist/esm/tools/AnnotationEraserTool.d.ts +1 -1
- package/dist/esm/tools/CrosshairsTool.d.ts +5 -5
- package/dist/esm/tools/CrosshairsTool.js +4 -3
- package/dist/esm/tools/MIPJumpToClickTool.d.ts +1 -2
- package/dist/esm/tools/MIPJumpToClickTool.js +2 -3
- package/dist/esm/tools/MagnifyTool.d.ts +2 -3
- package/dist/esm/tools/OrientationMarkerTool.d.ts +41 -58
- package/dist/esm/tools/OrientationMarkerTool.js +8 -7
- package/dist/esm/tools/OverlayGridTool.d.ts +2 -4
- package/dist/esm/tools/OverlayGridTool.js +1 -1
- package/dist/esm/tools/PanTool.d.ts +1 -1
- package/dist/esm/tools/PanTool.js +5 -0
- package/dist/esm/tools/PlanarRotateTool.d.ts +3 -1
- package/dist/esm/tools/PlanarRotateTool.js +18 -4
- package/dist/esm/tools/ReferenceCursors.d.ts +2 -5
- package/dist/esm/tools/ReferenceLinesTool.d.ts +4 -6
- package/dist/esm/tools/ReferenceLinesTool.js +1 -1
- package/dist/esm/tools/ScaleOverlayTool.d.ts +7 -9
- package/dist/esm/tools/ScaleOverlayTool.js +1 -2
- package/dist/esm/tools/SculptorTool/CircleSculptCursor.d.ts +4 -4
- package/dist/esm/tools/SculptorTool.d.ts +1 -1
- package/dist/esm/tools/SegmentationIntersectionTool.d.ts +2 -2
- package/dist/esm/tools/StackScrollTool.d.ts +2 -1
- package/dist/esm/tools/StackScrollTool.js +17 -3
- package/dist/esm/tools/StackScrollToolMouseWheelTool.d.ts +1 -2
- package/dist/esm/tools/StackScrollToolMouseWheelTool.js +1 -2
- package/dist/esm/tools/TrackballRotateTool.d.ts +1 -1
- package/dist/esm/tools/TrackballRotateTool.js +4 -0
- package/dist/esm/tools/VolumeRotateMouseWheelTool.d.ts +2 -3
- package/dist/esm/tools/WindowLevelRegionTool.d.ts +3 -3
- package/dist/esm/tools/WindowLevelRegionTool.js +1 -3
- package/dist/esm/tools/WindowLevelTool.d.ts +1 -1
- package/dist/esm/tools/WindowLevelTool.js +12 -7
- package/dist/esm/tools/ZoomTool.d.ts +2 -2
- package/dist/esm/tools/ZoomTool.js +2 -2
- package/dist/esm/tools/annotation/AngleTool.d.ts +5 -7
- package/dist/esm/tools/annotation/ArrowAnnotateTool.d.ts +5 -7
- package/dist/esm/tools/annotation/BidirectionalTool.d.ts +5 -7
- package/dist/esm/tools/annotation/CircleROITool.d.ts +5 -7
- package/dist/esm/tools/annotation/CircleROITool.js +8 -5
- package/dist/esm/tools/annotation/CobbAngleTool.d.ts +5 -7
- package/dist/esm/tools/annotation/DragProbeTool.d.ts +3 -5
- package/dist/esm/tools/annotation/DragProbeTool.js +0 -5
- package/dist/esm/tools/annotation/EllipticalROITool.d.ts +5 -7
- package/dist/esm/tools/annotation/EllipticalROITool.js +8 -3
- package/dist/esm/tools/annotation/HeightTool.d.ts +36 -0
- package/dist/esm/tools/annotation/HeightTool.js +435 -0
- package/dist/esm/tools/annotation/KeyImageTool.d.ts +4 -6
- package/dist/esm/tools/annotation/LengthTool.d.ts +5 -7
- package/dist/esm/tools/annotation/LengthTool.js +7 -5
- package/dist/esm/tools/annotation/LivewireContourTool.d.ts +3 -4
- package/dist/esm/tools/annotation/LivewireContourTool.js +2 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.d.ts +21 -4
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +155 -113
- package/dist/esm/tools/annotation/ProbeTool.d.ts +4 -6
- package/dist/esm/tools/annotation/ProbeTool.js +14 -29
- package/dist/esm/tools/annotation/RectangleROITool.d.ts +5 -5
- package/dist/esm/tools/annotation/RectangleROITool.js +7 -3
- package/dist/esm/tools/annotation/SplineContourSegmentationTool.d.ts +1 -1
- package/dist/esm/tools/annotation/SplineROITool.d.ts +1 -3
- package/dist/esm/tools/annotation/SplineROITool.js +2 -2
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.d.ts +5 -7
- package/dist/esm/tools/annotation/VideoRedactionTool.d.ts +4 -5
- package/dist/esm/tools/annotation/planarFreehandROITool/findOpenUShapedContourVectorToPeak.d.ts +1 -1
- package/dist/esm/tools/annotation/splines/CardinalSpline.d.ts +1 -1
- package/dist/esm/tools/annotation/splines/CubicSpline.d.ts +1 -1
- package/dist/esm/tools/annotation/splines/QuadraticSpline.d.ts +1 -1
- package/dist/esm/tools/annotation/splines/Spline.d.ts +1 -1
- package/dist/esm/tools/base/AnnotationDisplayTool.d.ts +3 -3
- package/dist/esm/tools/base/AnnotationDisplayTool.js +3 -9
- package/dist/esm/tools/base/AnnotationTool.d.ts +3 -14
- package/dist/esm/tools/base/BaseTool.d.ts +5 -5
- package/dist/esm/tools/base/BaseTool.js +1 -1
- package/dist/esm/tools/base/ContourBaseTool.d.ts +1 -1
- package/dist/esm/tools/base/ContourBaseTool.js +3 -3
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js +10 -10
- package/dist/esm/tools/displayTools/Contour/contourConfig.d.ts +1 -1
- package/dist/esm/tools/displayTools/Contour/contourDisplay.d.ts +2 -2
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js +2 -1
- package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.d.ts +2 -2
- package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js +4 -4
- package/dist/esm/tools/displayTools/Contour/contourHandler/utils.d.ts +1 -1
- package/dist/esm/tools/displayTools/Contour/removeContourFromElement.js +2 -2
- package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.d.ts +1 -1
- package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js +3 -3
- package/dist/esm/tools/displayTools/Labelmap/labelmapConfig.d.ts +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.d.ts +5 -5
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +10 -8
- package/dist/esm/tools/displayTools/Labelmap/validateLabelmap.d.ts +2 -2
- package/dist/esm/tools/displayTools/Surface/surfaceConfig.d.ts +1 -1
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.d.ts +2 -2
- package/dist/esm/tools/distancePointToContour.d.ts +1 -1
- package/dist/esm/tools/index.d.ts +2 -1
- package/dist/esm/tools/index.js +2 -1
- package/dist/esm/tools/segmentation/BrushTool.js +5 -5
- package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.d.ts +20 -15
- package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.js +199 -67
- package/dist/esm/tools/segmentation/CircleScissorsTool.d.ts +3 -3
- package/dist/esm/tools/segmentation/CircleScissorsTool.js +10 -3
- package/dist/esm/tools/segmentation/PaintFillTool.d.ts +1 -1
- package/dist/esm/tools/segmentation/PaintFillTool.js +15 -14
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.d.ts +20 -10
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +174 -55
- package/dist/esm/tools/segmentation/RectangleROIThresholdTool.d.ts +3 -3
- package/dist/esm/tools/segmentation/RectangleScissorsTool.d.ts +4 -3
- package/dist/esm/tools/segmentation/RectangleScissorsTool.js +8 -5
- package/dist/esm/tools/segmentation/SegmentSelectTool.d.ts +2 -2
- package/dist/esm/tools/segmentation/SegmentSelectTool.js +2 -2
- package/dist/esm/tools/segmentation/SphereScissorsTool.d.ts +3 -2
- package/dist/esm/tools/segmentation/SphereScissorsTool.js +12 -4
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.d.ts +4 -5
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.js +3 -1
- package/dist/esm/tools/segmentation/strategies/compositions/determineSegmentIndex.js +6 -3
- package/dist/esm/tools/segmentation/strategies/compositions/dynamicThreshold.js +1 -1
- package/dist/esm/tools/segmentation/strategies/compositions/islandRemoval.js +1 -1
- package/dist/esm/tools/segmentation/strategies/compositions/preview.js +2 -2
- package/dist/esm/tools/segmentation/strategies/compositions/regionFill.js +6 -3
- package/dist/esm/tools/segmentation/strategies/compositions/setValue.js +1 -1
- package/dist/esm/tools/segmentation/strategies/eraseRectangle.d.ts +1 -1
- package/dist/esm/tools/segmentation/strategies/fillCircle.js +1 -1
- package/dist/esm/tools/segmentation/strategies/fillRectangle.d.ts +1 -1
- package/dist/esm/tools/segmentation/strategies/fillRectangle.js +10 -7
- package/dist/esm/tools/segmentation/strategies/fillSphere.js +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.d.ts +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js +7 -24
- package/dist/esm/tools/segmentation/strategies/utils/isWithinThreshold.d.ts +9 -2
- package/dist/esm/tools/segmentation/strategies/utils/stackVolumeCheck.d.ts +3 -3
- package/dist/esm/tools/segmentation/strategies/utils/stackVolumeCheck.js +0 -3
- package/dist/esm/types/AnnotationGroupSelector.d.ts +1 -1
- package/dist/esm/types/AnnotationRenderContext.d.ts +3 -2
- package/dist/esm/types/AnnotationStyle.d.ts +2 -2
- package/dist/esm/types/AnnotationTypes.d.ts +3 -3
- package/dist/esm/types/BoundsIJK.d.ts +1 -1
- package/dist/esm/types/CINETypes.d.ts +1 -0
- package/dist/esm/types/CalculatorTypes.d.ts +1 -1
- package/dist/esm/types/CardinalSplineProps.d.ts +1 -1
- package/dist/esm/types/ClosestPoint.d.ts +1 -1
- package/dist/esm/types/ContourAnnotation.d.ts +1 -1
- package/dist/esm/types/ContourSegmentationAnnotation.d.ts +2 -2
- package/dist/esm/types/ControlPointInfo.d.ts +1 -1
- package/dist/esm/types/EventTypes.d.ts +13 -12
- package/dist/esm/types/FloodFillTypes.d.ts +2 -2
- package/dist/esm/types/IAnnotationManager.d.ts +3 -3
- package/dist/esm/types/IDistance.d.ts +1 -1
- package/dist/esm/types/IPoints.d.ts +2 -2
- package/dist/esm/types/ISetToolModeOptions.d.ts +2 -2
- package/dist/esm/types/ISpline.d.ts +1 -1
- package/dist/esm/types/ISynchronizerEventHandler.d.ts +3 -3
- package/dist/esm/types/IToolClassReference.d.ts +3 -3
- package/dist/esm/types/IToolGroup.d.ts +8 -8
- package/dist/esm/types/ITouchPoints.d.ts +2 -2
- package/dist/esm/types/InteractionTypes.d.ts +1 -1
- package/dist/esm/types/InternalToolTypes.d.ts +4 -4
- package/dist/esm/types/InterpolationTypes.d.ts +3 -3
- package/dist/esm/types/JumpToSliceOptions.d.ts +1 -1
- package/dist/esm/types/LabelmapToolOperationData.d.ts +3 -2
- package/dist/esm/types/PlanarBoundingBox.d.ts +1 -1
- package/dist/esm/types/SVGDrawingHelper.d.ts +1 -1
- package/dist/esm/types/ScrollOptions.d.ts +1 -1
- package/dist/esm/types/SegmentationStateTypes.d.ts +7 -6
- package/dist/esm/types/SplineCurveSegment.d.ts +1 -1
- package/dist/esm/types/SplineLineSegment.d.ts +1 -1
- package/dist/esm/types/ToolAction.d.ts +1 -1
- package/dist/esm/types/ToolHandle.d.ts +1 -1
- package/dist/esm/types/ToolProps.d.ts +1 -1
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +34 -12
- package/dist/esm/types/index.d.ts +2 -2
- package/dist/esm/utilities/annotationFrameRange.d.ts +1 -1
- package/dist/esm/utilities/annotationHydration.d.ts +3 -2
- package/dist/esm/utilities/cine/playClip.d.ts +6 -2
- package/dist/esm/utilities/cine/playClip.js +53 -6
- package/dist/esm/utilities/cine/state.d.ts +1 -1
- package/dist/esm/utilities/contourSegmentation/addContourSegmentationAnnotation.d.ts +1 -1
- package/dist/esm/utilities/contourSegmentation/areSameSegment.d.ts +1 -1
- package/dist/esm/utilities/contourSegmentation/isContourSegmentationAnnotation.d.ts +2 -2
- package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.d.ts +1 -1
- package/dist/esm/utilities/contours/AnnotationToPointData.d.ts +1 -1
- package/dist/esm/utilities/contours/areCoplanarContours.d.ts +1 -1
- package/dist/esm/utilities/contours/findHandlePolylineIndex.d.ts +1 -1
- package/dist/esm/utilities/contours/interpolation/createPolylineToolData.d.ts +1 -1
- package/dist/esm/utilities/contours/interpolation/getInterpolationData.d.ts +1 -1
- package/dist/esm/utilities/contours/interpolation/interpolate.d.ts +1 -1
- package/dist/esm/utilities/contours/reverseIfAntiClockwise.d.ts +1 -1
- package/dist/esm/utilities/contours/updateContourPolyline.d.ts +1 -1
- package/dist/esm/utilities/dynamicVolume/generateImageFromTimeData.d.ts +3 -2
- package/dist/esm/utilities/dynamicVolume/generateImageFromTimeData.js +31 -23
- package/dist/esm/utilities/dynamicVolume/getDataInTime.d.ts +1 -1
- package/dist/esm/utilities/dynamicVolume/getDataInTime.js +14 -9
- package/dist/esm/utilities/getAnnotationNearPoint.d.ts +1 -1
- package/dist/esm/utilities/getCalibratedUnits.d.ts +0 -6
- package/dist/esm/utilities/getCalibratedUnits.js +13 -4
- package/dist/esm/utilities/getPixelValueUnits.d.ts +2 -1
- package/dist/esm/utilities/getPixelValueUnits.js +1 -0
- package/dist/esm/utilities/getSphereBoundsInfo.d.ts +1 -1
- package/dist/esm/utilities/getToolsWithModesForElement.d.ts +1 -1
- package/dist/esm/utilities/getVOIMultipliers.d.ts +1 -1
- package/dist/esm/utilities/index.d.ts +1 -3
- package/dist/esm/utilities/index.js +1 -3
- package/dist/esm/utilities/livewire/LiveWirePath.d.ts +1 -1
- package/dist/esm/utilities/livewire/LivewireScissors.d.ts +1 -1
- package/dist/esm/utilities/math/aabb/distanceToPoint.d.ts +1 -1
- package/dist/esm/utilities/math/aabb/distanceToPointSquared.d.ts +1 -1
- package/dist/esm/utilities/math/aabb/intersectAABB.d.ts +1 -1
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.d.ts +2 -2
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.js +1 -1
- package/dist/esm/utilities/math/basic/Calculator.d.ts +1 -1
- package/dist/esm/utilities/math/circle/getCanvasCircleCorners.d.ts +1 -1
- package/dist/esm/utilities/math/circle/getCanvasCircleRadius.d.ts +1 -1
- package/dist/esm/utilities/math/line/distanceToPointSquared.d.ts +1 -1
- package/dist/esm/utilities/math/midPoint.d.ts +1 -1
- package/dist/esm/utilities/math/point/mirror.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/addCanvasPointsToArray.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/combinePolyline.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/getAABB.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/getLinesIntersection.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/getNormal2.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/getNormal3.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/intersectPolyline.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/planarFreehandROIInternalTypes.d.ts +2 -2
- package/dist/esm/utilities/math/sphere/pointInSphere.d.ts +1 -1
- package/dist/esm/utilities/orientation/getOrientationStringLPS.d.ts +1 -1
- package/dist/esm/utilities/planar/filterAnnotationsForDisplay.d.ts +1 -1
- package/dist/esm/utilities/planar/filterAnnotationsWithinPlane.d.ts +3 -0
- package/dist/esm/utilities/planar/filterAnnotationsWithinPlane.js +26 -0
- package/dist/esm/utilities/planar/filterAnnotationsWithinSlice.d.ts +1 -1
- package/dist/esm/utilities/planar/index.d.ts +3 -1
- package/dist/esm/utilities/planar/index.js +3 -1
- package/dist/esm/utilities/planarFreehandROITool/interpolation/algorithms/bspline.d.ts +1 -1
- package/dist/esm/utilities/planarFreehandROITool/interpolation/interpolateSegmentPoints.d.ts +1 -1
- package/dist/esm/utilities/planarFreehandROITool/smoothAnnotation.d.ts +2 -2
- package/dist/esm/utilities/planarFreehandROITool/smoothPoints.d.ts +11 -3
- package/dist/esm/utilities/polyData/utils.d.ts +1 -1
- package/dist/esm/utilities/scroll.d.ts +4 -3
- package/dist/esm/utilities/scroll.js +3 -10
- package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.d.ts +1 -1
- package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.d.ts +2 -11
- package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.js +1 -1
- package/dist/esm/utilities/segmentation/createMergedLabelmapForIndex.d.ts +1 -1
- package/dist/esm/utilities/segmentation/createMergedLabelmapForIndex.js +7 -7
- package/dist/esm/utilities/segmentation/floodFill.d.ts +1 -1
- package/dist/esm/utilities/segmentation/getDefaultRepresentationConfig.d.ts +1 -1
- package/dist/esm/utilities/segmentation/getSegmentIndexAtLabelmapBorder.js +8 -5
- package/dist/esm/utilities/segmentation/getSegmentIndexAtWorldPoint.d.ts +1 -1
- package/dist/esm/utilities/segmentation/getSegmentIndexAtWorldPoint.js +7 -4
- package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js +4 -5
- package/dist/esm/utilities/segmentation/index.d.ts +2 -2
- package/dist/esm/utilities/segmentation/index.js +2 -2
- package/dist/esm/utilities/segmentation/isValidRepresentationConfig.d.ts +1 -1
- package/dist/esm/utilities/segmentation/rectangleROIThresholdVolumeByRange.d.ts +1 -1
- package/dist/esm/utilities/segmentation/rectangleROIThresholdVolumeByRange.js +3 -2
- package/dist/esm/utilities/segmentation/segmentContourAction.d.ts +1 -1
- package/dist/esm/utilities/segmentation/segmentContourAction.js +4 -4
- package/dist/esm/utilities/segmentation/thresholdSegmentationByRange.d.ts +2 -2
- package/dist/esm/utilities/segmentation/thresholdSegmentationByRange.js +24 -17
- package/dist/esm/utilities/segmentation/thresholdVolumeByRange.d.ts +3 -3
- package/dist/esm/utilities/segmentation/thresholdVolumeByRange.js +21 -12
- package/dist/esm/utilities/segmentation/triggerSegmentationRender.d.ts +3 -3
- package/dist/esm/utilities/segmentation/triggerSegmentationRender.js +7 -5
- package/dist/esm/utilities/segmentation/utilities.d.ts +12 -2
- package/dist/esm/utilities/segmentation/utilities.js +5 -6
- package/dist/esm/utilities/stackPrefetch/stackContextPrefetch.js +30 -25
- package/dist/esm/utilities/stackPrefetch/stackPrefetch.js +3 -8
- package/dist/esm/utilities/stackPrefetch/stackPrefetchUtils.js +2 -3
- package/dist/esm/utilities/stackPrefetch/state.d.ts +20 -1
- package/dist/esm/utilities/touch/index.d.ts +1 -1
- package/dist/esm/utilities/triggerAnnotationRender.d.ts +0 -20
- package/dist/esm/utilities/triggerAnnotationRender.js +1 -112
- package/dist/esm/utilities/viewport/isViewportPreScaled.d.ts +1 -1
- package/dist/esm/utilities/viewport/isViewportPreScaled.js +2 -5
- package/dist/esm/utilities/viewport/jumpToSlice.d.ts +1 -1
- package/dist/esm/utilities/viewport/jumpToSlice.js +4 -6
- package/dist/esm/utilities/voi/colorbar/ColorbarCanvas.d.ts +2 -2
- package/dist/esm/utilities/voi/colorbar/ViewportColorbar.d.ts +1 -1
- package/dist/esm/utilities/voi/colorbar/ViewportColorbar.js +1 -1
- package/dist/esm/utilities/voi/colorbar/types/ColorbarCanvasProps.d.ts +1 -1
- package/dist/esm/utilities/voi/colorbar/types/ColorbarCommonProps.d.ts +1 -1
- package/dist/esm/utilities/voi/colorbar/types/ColorbarProps.d.ts +3 -3
- package/dist/esm/utilities/voi/windowlevel/extractWindowLevelRegionToolData.d.ts +8 -0
- package/dist/esm/utilities/voi/windowlevel/extractWindowLevelRegionToolData.js +4 -10
- package/dist/esm/widgets/types/index.d.ts +2 -2
- package/dist/esm/workers/polySegConverters.js +65 -32
- package/dist/umd/78.index.js +1 -1
- package/dist/umd/78.index.js.map +1 -1
- package/dist/umd/985.index.js +1 -1
- package/dist/umd/985.index.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +5 -7
- package/dist/esm/stateManagement/segmentation/addRepresentation.d.ts +0 -3
- package/dist/esm/stateManagement/segmentation/addRepresentations.d.ts +0 -3
- package/dist/esm/stateManagement/segmentation/addRepresentations.js +0 -9
- package/dist/esm/stateManagement/segmentation/helpers/getRepresentationRenderingConfig.d.ts +0 -2
- package/dist/esm/stateManagement/segmentation/removeRepresentationsFromViewport.d.ts +0 -2
- package/dist/esm/utilities/pointInShapeCallback.d.ts +0 -18
- package/dist/esm/utilities/pointInShapeCallback.js +0 -82
- package/dist/esm/utilities/pointInSurroundingSphereCallback.d.ts +0 -4
- package/dist/esm/utilities/pointInSurroundingSphereCallback.js +0 -63
- package/dist/esm/utilities/segmentation/triggerSegmentationRenderForViewports.d.ts +0 -3
- package/dist/esm/utilities/segmentation/triggerSegmentationRenderForViewports.js +0 -6
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { Events } from '../../enums';
|
|
2
|
+
import { getEnabledElement, utilities as csUtils } from '@cornerstonejs/core';
|
|
3
|
+
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
4
|
+
import { roundNumber } from '../../utilities';
|
|
5
|
+
import { AnnotationTool } from '../base';
|
|
6
|
+
import throttle from '../../utilities/throttle';
|
|
7
|
+
import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement/annotation/annotationState';
|
|
8
|
+
import { isAnnotationLocked } from '../../stateManagement/annotation/annotationLocking';
|
|
9
|
+
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
10
|
+
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
11
|
+
import * as lineSegment from '../../utilities/math/line';
|
|
12
|
+
import { drawHandles as drawHandlesSvg, drawHeight as drawHeightSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, } from '../../drawingSvg';
|
|
13
|
+
import { state } from '../../store';
|
|
14
|
+
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
15
|
+
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
16
|
+
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
17
|
+
import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
|
|
18
|
+
const { transformWorldToIndex } = csUtils;
|
|
19
|
+
class HeightTool extends AnnotationTool {
|
|
20
|
+
constructor(toolProps = {}, defaultToolProps = {
|
|
21
|
+
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
22
|
+
configuration: {
|
|
23
|
+
preventHandleOutsideImage: false,
|
|
24
|
+
getTextLines: defaultGetTextLines,
|
|
25
|
+
},
|
|
26
|
+
}) {
|
|
27
|
+
super(toolProps, defaultToolProps);
|
|
28
|
+
this.addNewAnnotation = (evt) => {
|
|
29
|
+
const eventDetail = evt.detail;
|
|
30
|
+
const { currentPoints, element } = eventDetail;
|
|
31
|
+
const worldPos = currentPoints.world;
|
|
32
|
+
const enabledElement = getEnabledElement(element);
|
|
33
|
+
const { viewport, renderingEngine } = enabledElement;
|
|
34
|
+
hideElementCursor(element);
|
|
35
|
+
this.isDrawing = true;
|
|
36
|
+
const { viewPlaneNormal, viewUp, position: cameraPosition, } = viewport.getCamera();
|
|
37
|
+
const referencedImageId = this.getReferencedImageId(viewport, worldPos, viewPlaneNormal, viewUp);
|
|
38
|
+
const annotation = {
|
|
39
|
+
highlighted: true,
|
|
40
|
+
invalidated: true,
|
|
41
|
+
metadata: {
|
|
42
|
+
...viewport.getViewReference({ points: [worldPos] }),
|
|
43
|
+
toolName: this.getToolName(),
|
|
44
|
+
referencedImageId,
|
|
45
|
+
viewUp,
|
|
46
|
+
cameraPosition,
|
|
47
|
+
},
|
|
48
|
+
data: {
|
|
49
|
+
handles: {
|
|
50
|
+
points: [[...worldPos], [...worldPos]],
|
|
51
|
+
activeHandleIndex: null,
|
|
52
|
+
textBox: {
|
|
53
|
+
hasMoved: false,
|
|
54
|
+
worldPosition: [0, 0, 0],
|
|
55
|
+
worldBoundingBox: {
|
|
56
|
+
topLeft: [0, 0, 0],
|
|
57
|
+
topRight: [0, 0, 0],
|
|
58
|
+
bottomLeft: [0, 0, 0],
|
|
59
|
+
bottomRight: [0, 0, 0],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
label: '',
|
|
64
|
+
cachedStats: {},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
addAnnotation(annotation, element);
|
|
68
|
+
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
69
|
+
this.editData = {
|
|
70
|
+
annotation,
|
|
71
|
+
viewportIdsToRender,
|
|
72
|
+
handleIndex: 1,
|
|
73
|
+
movingTextBox: false,
|
|
74
|
+
newAnnotation: true,
|
|
75
|
+
hasMoved: false,
|
|
76
|
+
};
|
|
77
|
+
this._activateDraw(element);
|
|
78
|
+
evt.preventDefault();
|
|
79
|
+
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
80
|
+
return annotation;
|
|
81
|
+
};
|
|
82
|
+
this.isPointNearTool = (element, annotation, canvasCoords, proximity) => {
|
|
83
|
+
const enabledElement = getEnabledElement(element);
|
|
84
|
+
const { viewport } = enabledElement;
|
|
85
|
+
const { data } = annotation;
|
|
86
|
+
const [point1, point2] = data.handles.points;
|
|
87
|
+
const canvasPoint1 = viewport.worldToCanvas(point1);
|
|
88
|
+
const canvasPoint2 = viewport.worldToCanvas(point2);
|
|
89
|
+
const line = {
|
|
90
|
+
start: {
|
|
91
|
+
x: canvasPoint1[0],
|
|
92
|
+
y: canvasPoint1[1],
|
|
93
|
+
},
|
|
94
|
+
end: {
|
|
95
|
+
x: canvasPoint2[0],
|
|
96
|
+
y: canvasPoint2[1],
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
const distanceToPoint = lineSegment.distanceToPoint([line.start.x, line.start.y], [line.end.x, line.end.y], [canvasCoords[0], canvasCoords[1]]);
|
|
100
|
+
if (distanceToPoint <= proximity) {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
};
|
|
105
|
+
this.toolSelectedCallback = (evt, annotation) => {
|
|
106
|
+
const eventDetail = evt.detail;
|
|
107
|
+
const { element } = eventDetail;
|
|
108
|
+
annotation.highlighted = true;
|
|
109
|
+
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
110
|
+
this.editData = {
|
|
111
|
+
annotation,
|
|
112
|
+
viewportIdsToRender,
|
|
113
|
+
movingTextBox: false,
|
|
114
|
+
};
|
|
115
|
+
this._activateModify(element);
|
|
116
|
+
hideElementCursor(element);
|
|
117
|
+
const enabledElement = getEnabledElement(element);
|
|
118
|
+
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
119
|
+
evt.preventDefault();
|
|
120
|
+
};
|
|
121
|
+
this._endCallback = (evt) => {
|
|
122
|
+
const eventDetail = evt.detail;
|
|
123
|
+
const { element } = eventDetail;
|
|
124
|
+
const { annotation, viewportIdsToRender, newAnnotation, hasMoved } = this.editData;
|
|
125
|
+
const { data } = annotation;
|
|
126
|
+
if (newAnnotation && !hasMoved) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
data.handles.activeHandleIndex = null;
|
|
130
|
+
this._deactivateModify(element);
|
|
131
|
+
this._deactivateDraw(element);
|
|
132
|
+
resetElementCursor(element);
|
|
133
|
+
const enabledElement = getEnabledElement(element);
|
|
134
|
+
const { renderingEngine } = enabledElement;
|
|
135
|
+
if (this.isHandleOutsideImage &&
|
|
136
|
+
this.configuration.preventHandleOutsideImage) {
|
|
137
|
+
removeAnnotation(annotation.annotationUID);
|
|
138
|
+
}
|
|
139
|
+
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
140
|
+
if (newAnnotation) {
|
|
141
|
+
triggerAnnotationCompleted(annotation);
|
|
142
|
+
}
|
|
143
|
+
this.editData = null;
|
|
144
|
+
this.isDrawing = false;
|
|
145
|
+
};
|
|
146
|
+
this._dragCallback = (evt) => {
|
|
147
|
+
this.isDrawing = true;
|
|
148
|
+
const eventDetail = evt.detail;
|
|
149
|
+
const { element } = eventDetail;
|
|
150
|
+
const { annotation, viewportIdsToRender, handleIndex, movingTextBox } = this.editData;
|
|
151
|
+
const { data } = annotation;
|
|
152
|
+
if (movingTextBox) {
|
|
153
|
+
const { deltaPoints } = eventDetail;
|
|
154
|
+
const worldPosDelta = deltaPoints.world;
|
|
155
|
+
const { textBox } = data.handles;
|
|
156
|
+
const { worldPosition } = textBox;
|
|
157
|
+
worldPosition[0] += worldPosDelta[0];
|
|
158
|
+
worldPosition[1] += worldPosDelta[1];
|
|
159
|
+
worldPosition[2] += worldPosDelta[2];
|
|
160
|
+
textBox.hasMoved = true;
|
|
161
|
+
}
|
|
162
|
+
else if (handleIndex === undefined) {
|
|
163
|
+
const { deltaPoints } = eventDetail;
|
|
164
|
+
const worldPosDelta = deltaPoints.world;
|
|
165
|
+
const points = data.handles.points;
|
|
166
|
+
points.forEach((point) => {
|
|
167
|
+
point[0] += worldPosDelta[0];
|
|
168
|
+
point[1] += worldPosDelta[1];
|
|
169
|
+
point[2] += worldPosDelta[2];
|
|
170
|
+
});
|
|
171
|
+
annotation.invalidated = true;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
const { currentPoints } = eventDetail;
|
|
175
|
+
const worldPos = currentPoints.world;
|
|
176
|
+
data.handles.points[handleIndex] = [...worldPos];
|
|
177
|
+
annotation.invalidated = true;
|
|
178
|
+
}
|
|
179
|
+
this.editData.hasMoved = true;
|
|
180
|
+
const enabledElement = getEnabledElement(element);
|
|
181
|
+
const { renderingEngine } = enabledElement;
|
|
182
|
+
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
183
|
+
};
|
|
184
|
+
this.cancel = (element) => {
|
|
185
|
+
if (this.isDrawing) {
|
|
186
|
+
this.isDrawing = false;
|
|
187
|
+
this._deactivateDraw(element);
|
|
188
|
+
this._deactivateModify(element);
|
|
189
|
+
resetElementCursor(element);
|
|
190
|
+
const { annotation, viewportIdsToRender, newAnnotation } = this.editData;
|
|
191
|
+
const { data } = annotation;
|
|
192
|
+
annotation.highlighted = false;
|
|
193
|
+
data.handles.activeHandleIndex = null;
|
|
194
|
+
const enabledElement = getEnabledElement(element);
|
|
195
|
+
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
196
|
+
if (newAnnotation) {
|
|
197
|
+
triggerAnnotationCompleted(annotation);
|
|
198
|
+
}
|
|
199
|
+
this.editData = null;
|
|
200
|
+
return annotation.annotationUID;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
this._activateModify = (element) => {
|
|
204
|
+
state.isInteractingWithTool = true;
|
|
205
|
+
element.addEventListener(Events.MOUSE_UP, this._endCallback);
|
|
206
|
+
element.addEventListener(Events.MOUSE_DRAG, this._dragCallback);
|
|
207
|
+
element.addEventListener(Events.MOUSE_CLICK, this._endCallback);
|
|
208
|
+
element.addEventListener(Events.TOUCH_END, this._endCallback);
|
|
209
|
+
element.addEventListener(Events.TOUCH_DRAG, this._dragCallback);
|
|
210
|
+
element.addEventListener(Events.TOUCH_TAP, this._endCallback);
|
|
211
|
+
};
|
|
212
|
+
this._deactivateModify = (element) => {
|
|
213
|
+
state.isInteractingWithTool = false;
|
|
214
|
+
element.removeEventListener(Events.MOUSE_UP, this._endCallback);
|
|
215
|
+
element.removeEventListener(Events.MOUSE_DRAG, this._dragCallback);
|
|
216
|
+
element.removeEventListener(Events.MOUSE_CLICK, this._endCallback);
|
|
217
|
+
element.removeEventListener(Events.TOUCH_END, this._endCallback);
|
|
218
|
+
element.removeEventListener(Events.TOUCH_DRAG, this._dragCallback);
|
|
219
|
+
element.removeEventListener(Events.TOUCH_TAP, this._endCallback);
|
|
220
|
+
};
|
|
221
|
+
this._activateDraw = (element) => {
|
|
222
|
+
state.isInteractingWithTool = true;
|
|
223
|
+
element.addEventListener(Events.MOUSE_UP, this._endCallback);
|
|
224
|
+
element.addEventListener(Events.MOUSE_DRAG, this._dragCallback);
|
|
225
|
+
element.addEventListener(Events.MOUSE_MOVE, this._dragCallback);
|
|
226
|
+
element.addEventListener(Events.MOUSE_CLICK, this._endCallback);
|
|
227
|
+
element.addEventListener(Events.TOUCH_END, this._endCallback);
|
|
228
|
+
element.addEventListener(Events.TOUCH_DRAG, this._dragCallback);
|
|
229
|
+
element.addEventListener(Events.TOUCH_TAP, this._endCallback);
|
|
230
|
+
};
|
|
231
|
+
this._deactivateDraw = (element) => {
|
|
232
|
+
state.isInteractingWithTool = false;
|
|
233
|
+
element.removeEventListener(Events.MOUSE_UP, this._endCallback);
|
|
234
|
+
element.removeEventListener(Events.MOUSE_DRAG, this._dragCallback);
|
|
235
|
+
element.removeEventListener(Events.MOUSE_MOVE, this._dragCallback);
|
|
236
|
+
element.removeEventListener(Events.MOUSE_CLICK, this._endCallback);
|
|
237
|
+
element.removeEventListener(Events.TOUCH_END, this._endCallback);
|
|
238
|
+
element.removeEventListener(Events.TOUCH_DRAG, this._dragCallback);
|
|
239
|
+
element.removeEventListener(Events.TOUCH_TAP, this._endCallback);
|
|
240
|
+
};
|
|
241
|
+
this.renderAnnotation = (enabledElement, svgDrawingHelper) => {
|
|
242
|
+
let renderStatus = false;
|
|
243
|
+
const { viewport } = enabledElement;
|
|
244
|
+
const { element } = viewport;
|
|
245
|
+
let annotations = getAnnotations(this.getToolName(), element);
|
|
246
|
+
if (!annotations?.length) {
|
|
247
|
+
return renderStatus;
|
|
248
|
+
}
|
|
249
|
+
annotations = this.filterInteractableAnnotationsForElement(element, annotations);
|
|
250
|
+
if (!annotations?.length) {
|
|
251
|
+
return renderStatus;
|
|
252
|
+
}
|
|
253
|
+
const targetId = this.getTargetId(viewport);
|
|
254
|
+
const renderingEngine = viewport.getRenderingEngine();
|
|
255
|
+
const styleSpecifier = {
|
|
256
|
+
toolGroupId: this.toolGroupId,
|
|
257
|
+
toolName: this.getToolName(),
|
|
258
|
+
viewportId: enabledElement.viewport.id,
|
|
259
|
+
};
|
|
260
|
+
for (let i = 0; i < annotations.length; i++) {
|
|
261
|
+
const annotation = annotations[i];
|
|
262
|
+
const { annotationUID, data } = annotation;
|
|
263
|
+
const { points, activeHandleIndex } = data.handles;
|
|
264
|
+
styleSpecifier.annotationUID = annotationUID;
|
|
265
|
+
const { color, lineWidth, lineDash, shadow } = this.getAnnotationStyle({
|
|
266
|
+
annotation,
|
|
267
|
+
styleSpecifier,
|
|
268
|
+
});
|
|
269
|
+
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
270
|
+
let activeHandleCanvasCoords;
|
|
271
|
+
if (!data.cachedStats[targetId] ||
|
|
272
|
+
data.cachedStats[targetId].unit == null) {
|
|
273
|
+
data.cachedStats[targetId] = {
|
|
274
|
+
length: null,
|
|
275
|
+
unit: null,
|
|
276
|
+
};
|
|
277
|
+
this._calculateCachedStats(annotation, renderingEngine, enabledElement);
|
|
278
|
+
}
|
|
279
|
+
else if (annotation.invalidated) {
|
|
280
|
+
this._throttledCalculateCachedStats(annotation, renderingEngine, enabledElement);
|
|
281
|
+
}
|
|
282
|
+
if (!isAnnotationVisible(annotationUID)) {
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
if (!isAnnotationLocked(annotation) &&
|
|
286
|
+
!this.editData &&
|
|
287
|
+
activeHandleIndex !== null) {
|
|
288
|
+
activeHandleCanvasCoords = [canvasCoordinates[activeHandleIndex]];
|
|
289
|
+
}
|
|
290
|
+
if (activeHandleCanvasCoords) {
|
|
291
|
+
const handleGroupUID = '0';
|
|
292
|
+
drawHandlesSvg(svgDrawingHelper, annotationUID, handleGroupUID, canvasCoordinates, {
|
|
293
|
+
color,
|
|
294
|
+
lineDash,
|
|
295
|
+
lineWidth,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
const heightUID = '0';
|
|
299
|
+
drawHeightSvg(svgDrawingHelper, annotationUID, heightUID, canvasCoordinates[0], canvasCoordinates[1], {
|
|
300
|
+
color,
|
|
301
|
+
width: lineWidth,
|
|
302
|
+
lineDash: lineDash,
|
|
303
|
+
});
|
|
304
|
+
renderStatus = true;
|
|
305
|
+
if (!viewport.getRenderingEngine()) {
|
|
306
|
+
console.warn('Rendering Engine has been destroyed');
|
|
307
|
+
return renderStatus;
|
|
308
|
+
}
|
|
309
|
+
const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
|
|
310
|
+
if (!options.visibility) {
|
|
311
|
+
data.handles.textBox = {
|
|
312
|
+
hasMoved: false,
|
|
313
|
+
worldPosition: [0, 0, 0],
|
|
314
|
+
worldBoundingBox: {
|
|
315
|
+
topLeft: [0, 0, 0],
|
|
316
|
+
topRight: [0, 0, 0],
|
|
317
|
+
bottomLeft: [0, 0, 0],
|
|
318
|
+
bottomRight: [0, 0, 0],
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
const textLines = this.configuration.getTextLines(data, targetId);
|
|
324
|
+
if (!data.handles.textBox.hasMoved) {
|
|
325
|
+
const canvasTextBoxCoords = getTextBoxCoordsCanvas(canvasCoordinates);
|
|
326
|
+
data.handles.textBox.worldPosition =
|
|
327
|
+
viewport.canvasToWorld(canvasTextBoxCoords);
|
|
328
|
+
}
|
|
329
|
+
const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
|
|
330
|
+
const textBoxUID = '1';
|
|
331
|
+
const boundingBox = drawLinkedTextBoxSvg(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
|
|
332
|
+
const { x: left, y: top, width, height } = boundingBox;
|
|
333
|
+
data.handles.textBox.worldBoundingBox = {
|
|
334
|
+
topLeft: viewport.canvasToWorld([left, top]),
|
|
335
|
+
topRight: viewport.canvasToWorld([left + width, top]),
|
|
336
|
+
bottomLeft: viewport.canvasToWorld([left, top + height]),
|
|
337
|
+
bottomRight: viewport.canvasToWorld([left + width, top + height]),
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
return renderStatus;
|
|
341
|
+
};
|
|
342
|
+
this._throttledCalculateCachedStats = throttle(this._calculateCachedStats, 100, { trailing: true });
|
|
343
|
+
}
|
|
344
|
+
handleSelectedCallback(evt, annotation, handle) {
|
|
345
|
+
const eventDetail = evt.detail;
|
|
346
|
+
const { element } = eventDetail;
|
|
347
|
+
const { data } = annotation;
|
|
348
|
+
annotation.highlighted = true;
|
|
349
|
+
let movingTextBox = false;
|
|
350
|
+
let handleIndex;
|
|
351
|
+
if (handle.worldPosition) {
|
|
352
|
+
movingTextBox = true;
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
handleIndex = data.handles.points.findIndex((p) => p === handle);
|
|
356
|
+
}
|
|
357
|
+
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
358
|
+
this.editData = {
|
|
359
|
+
annotation,
|
|
360
|
+
viewportIdsToRender,
|
|
361
|
+
handleIndex,
|
|
362
|
+
movingTextBox,
|
|
363
|
+
};
|
|
364
|
+
this._activateModify(element);
|
|
365
|
+
hideElementCursor(element);
|
|
366
|
+
const enabledElement = getEnabledElement(element);
|
|
367
|
+
const { renderingEngine } = enabledElement;
|
|
368
|
+
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
369
|
+
evt.preventDefault();
|
|
370
|
+
}
|
|
371
|
+
_calculateHeight(pos1, pos2) {
|
|
372
|
+
const dx = pos2[0] - pos1[0];
|
|
373
|
+
const dy = pos2[1] - pos1[1];
|
|
374
|
+
const dz = pos2[2] - pos1[2];
|
|
375
|
+
if (dx == 0) {
|
|
376
|
+
if (dy != 0) {
|
|
377
|
+
return Math.abs(dz);
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
return 0;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
else if (dy == 0) {
|
|
384
|
+
return Math.abs(dz);
|
|
385
|
+
}
|
|
386
|
+
else if (dz == 0) {
|
|
387
|
+
return Math.abs(dy);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
_calculateCachedStats(annotation, renderingEngine, enabledElement) {
|
|
391
|
+
const data = annotation.data;
|
|
392
|
+
const { element } = enabledElement.viewport;
|
|
393
|
+
const worldPos1 = data.handles.points[0];
|
|
394
|
+
const worldPos2 = data.handles.points[1];
|
|
395
|
+
const { cachedStats } = data;
|
|
396
|
+
const targetIds = Object.keys(cachedStats);
|
|
397
|
+
for (let i = 0; i < targetIds.length; i++) {
|
|
398
|
+
const targetId = targetIds[i];
|
|
399
|
+
const image = this.getTargetIdImage(targetId, renderingEngine);
|
|
400
|
+
if (!image) {
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
const { imageData, dimensions } = image;
|
|
404
|
+
const index1 = transformWorldToIndex(imageData, worldPos1);
|
|
405
|
+
const index2 = transformWorldToIndex(imageData, worldPos2);
|
|
406
|
+
const handles = [index1, index2];
|
|
407
|
+
const { scale, lengthUnits } = getCalibratedLengthUnitsAndScale(image, handles);
|
|
408
|
+
const height = this._calculateHeight(worldPos1, worldPos2) / scale;
|
|
409
|
+
const outside = this._isInsideVolume(index1, index2, dimensions);
|
|
410
|
+
this.isHandleOutsideImage = outside;
|
|
411
|
+
cachedStats[targetId] = {
|
|
412
|
+
height,
|
|
413
|
+
lengthUnits,
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
annotation.invalidated = false;
|
|
417
|
+
triggerAnnotationModified(annotation, element);
|
|
418
|
+
return cachedStats;
|
|
419
|
+
}
|
|
420
|
+
_isInsideVolume(index1, index2, dimensions) {
|
|
421
|
+
return (csUtils.indexWithinDimensions(index1, dimensions) &&
|
|
422
|
+
csUtils.indexWithinDimensions(index2, dimensions));
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function defaultGetTextLines(data, targetId) {
|
|
426
|
+
const cachedVolumeStats = data.cachedStats[targetId];
|
|
427
|
+
const { height, lengthUnits } = cachedVolumeStats;
|
|
428
|
+
if (height === undefined || height === null || isNaN(height)) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const textLines = [`${roundNumber(height)} ${lengthUnits}`];
|
|
432
|
+
return textLines;
|
|
433
|
+
}
|
|
434
|
+
HeightTool.toolName = 'Height';
|
|
435
|
+
export default HeightTool;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
2
|
import { AnnotationTool } from '../base';
|
|
3
|
-
import { EventTypes, ToolHandle, PublicToolProps, ToolProps, SVGDrawingHelper } from '../../types';
|
|
4
|
-
import { Annotation } from '../../types';
|
|
3
|
+
import type { EventTypes, ToolHandle, PublicToolProps, ToolProps, SVGDrawingHelper } from '../../types';
|
|
4
|
+
import type { Annotation } from '../../types';
|
|
5
5
|
declare class KeyImageTool extends AnnotationTool {
|
|
6
6
|
static toolName: any;
|
|
7
|
-
|
|
8
|
-
mouseDragCallback: any;
|
|
9
|
-
_throttledCalculateCachedStats: any;
|
|
7
|
+
_throttledCalculateCachedStats: Function;
|
|
10
8
|
editData: {
|
|
11
|
-
annotation:
|
|
9
|
+
annotation: Annotation;
|
|
12
10
|
viewportIdsToRender: string[];
|
|
13
11
|
handleIndex?: number;
|
|
14
12
|
movingTextBox?: boolean;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
2
|
import { AnnotationTool } from '../base';
|
|
3
|
-
import { EventTypes, ToolHandle, PublicToolProps, ToolProps, SVGDrawingHelper } from '../../types';
|
|
4
|
-
import { LengthAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
3
|
+
import type { EventTypes, ToolHandle, PublicToolProps, ToolProps, SVGDrawingHelper, Annotation } from '../../types';
|
|
4
|
+
import type { LengthAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
5
5
|
declare class LengthTool extends AnnotationTool {
|
|
6
6
|
static toolName: any;
|
|
7
|
-
|
|
8
|
-
mouseDragCallback: any;
|
|
9
|
-
_throttledCalculateCachedStats: any;
|
|
7
|
+
_throttledCalculateCachedStats: Function;
|
|
10
8
|
editData: {
|
|
11
|
-
annotation:
|
|
9
|
+
annotation: Annotation;
|
|
12
10
|
viewportIdsToRender: string[];
|
|
13
11
|
handleIndex?: number;
|
|
14
12
|
movingTextBox?: boolean;
|
|
@@ -24,7 +22,7 @@ declare class LengthTool extends AnnotationTool {
|
|
|
24
22
|
handleSelectedCallback(evt: EventTypes.InteractionEventType, annotation: LengthAnnotation, handle: ToolHandle): void;
|
|
25
23
|
_endCallback: (evt: EventTypes.InteractionEventType) => void;
|
|
26
24
|
_dragCallback: (evt: EventTypes.InteractionEventType) => void;
|
|
27
|
-
cancel: (element: HTMLDivElement) =>
|
|
25
|
+
cancel: (element: HTMLDivElement) => string;
|
|
28
26
|
_activateModify: (element: HTMLDivElement) => void;
|
|
29
27
|
_deactivateModify: (element: HTMLDivElement) => void;
|
|
30
28
|
_activateDraw: (element: HTMLDivElement) => void;
|
|
@@ -178,8 +178,6 @@ class LengthTool extends AnnotationTool {
|
|
|
178
178
|
annotation.invalidated = true;
|
|
179
179
|
}
|
|
180
180
|
this.editData.hasMoved = true;
|
|
181
|
-
const enabledElement = getEnabledElement(element);
|
|
182
|
-
const { renderingEngine } = enabledElement;
|
|
183
181
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
184
182
|
};
|
|
185
183
|
this.cancel = (element) => {
|
|
@@ -267,7 +265,6 @@ class LengthTool extends AnnotationTool {
|
|
|
267
265
|
styleSpecifier,
|
|
268
266
|
});
|
|
269
267
|
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
270
|
-
let activeHandleCanvasCoords;
|
|
271
268
|
if (!data.cachedStats[targetId] ||
|
|
272
269
|
data.cachedStats[targetId].unit == null) {
|
|
273
270
|
data.cachedStats[targetId] = {
|
|
@@ -279,6 +276,11 @@ class LengthTool extends AnnotationTool {
|
|
|
279
276
|
else if (annotation.invalidated) {
|
|
280
277
|
this._throttledCalculateCachedStats(annotation, renderingEngine, enabledElement);
|
|
281
278
|
}
|
|
279
|
+
if (!viewport.getRenderingEngine()) {
|
|
280
|
+
console.warn('Rendering Engine has been destroyed');
|
|
281
|
+
return renderStatus;
|
|
282
|
+
}
|
|
283
|
+
let activeHandleCanvasCoords;
|
|
282
284
|
if (!isAnnotationVisible(annotationUID)) {
|
|
283
285
|
continue;
|
|
284
286
|
}
|
|
@@ -414,11 +416,11 @@ class LengthTool extends AnnotationTool {
|
|
|
414
416
|
}
|
|
415
417
|
function defaultGetTextLines(data, targetId) {
|
|
416
418
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
417
|
-
const { length,
|
|
419
|
+
const { length, lengthUnits } = cachedVolumeStats;
|
|
418
420
|
if (length === undefined || length === null || isNaN(length)) {
|
|
419
421
|
return;
|
|
420
422
|
}
|
|
421
|
-
const textLines = [`${roundNumber(length)} ${
|
|
423
|
+
const textLines = [`${roundNumber(length)} ${lengthUnits}`];
|
|
422
424
|
return textLines;
|
|
423
425
|
}
|
|
424
426
|
LengthTool.toolName = 'Length';
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
2
|
import { ChangeTypes } from '../../enums';
|
|
3
3
|
import type { EventTypes, ToolHandle, PublicToolProps, ToolProps, SVGDrawingHelper } from '../../types';
|
|
4
|
-
import { LivewireContourAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
4
|
+
import type { LivewireContourAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
5
5
|
import { LivewireScissors } from '../../utilities/livewire/LivewireScissors';
|
|
6
6
|
import { LivewirePath } from '../../utilities/livewire/LiveWirePath';
|
|
7
7
|
import ContourSegmentationBaseTool from '../base/ContourSegmentationBaseTool';
|
|
8
|
+
import type { AnnotationStyle } from '../../types/AnnotationStyle';
|
|
8
9
|
declare class LivewireContourTool extends ContourSegmentationBaseTool {
|
|
9
10
|
static toolName: string;
|
|
10
11
|
protected scissors: LivewireScissors;
|
|
11
12
|
protected scissorsNext: LivewireScissors;
|
|
12
|
-
touchDragCallback: any;
|
|
13
|
-
mouseDragCallback: any;
|
|
14
13
|
editData: {
|
|
15
14
|
annotation: LivewireContourAnnotation;
|
|
16
15
|
viewportIdsToRender: Array<string>;
|
|
@@ -55,7 +54,7 @@ declare class LivewireContourTool extends ContourSegmentationBaseTool {
|
|
|
55
54
|
enabledElement: Types.IEnabledElement;
|
|
56
55
|
targetId: string;
|
|
57
56
|
annotation: LivewireContourAnnotation;
|
|
58
|
-
annotationStyle:
|
|
57
|
+
annotationStyle: AnnotationStyle;
|
|
59
58
|
svgDrawingHelper: SVGDrawingHelper;
|
|
60
59
|
}): boolean;
|
|
61
60
|
protected updateAnnotation(livewirePath: LivewirePath): void;
|
|
@@ -287,10 +287,11 @@ class LivewireContourTool extends ContourSegmentationBaseTool {
|
|
|
287
287
|
const { imageData: vtkImageData } = viewportImageData;
|
|
288
288
|
let worldToSlice;
|
|
289
289
|
let sliceToWorld;
|
|
290
|
-
let { scalarData } = viewportImageData;
|
|
291
290
|
let width;
|
|
292
291
|
let height;
|
|
292
|
+
let scalarData;
|
|
293
293
|
if (!(viewport instanceof VolumeViewport) && scalarData) {
|
|
294
|
+
({ scalarData } = viewportImageData);
|
|
294
295
|
width = viewportImageData.dimensions[0];
|
|
295
296
|
height = viewportImageData.dimensions[1];
|
|
296
297
|
worldToSlice = (point) => {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
2
|
import type { EventTypes, ToolHandle, Annotation, Annotations, PublicToolProps, ToolProps, AnnotationRenderContext } from '../../types';
|
|
3
|
-
import { PlanarFreehandROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
3
|
+
import type { PlanarFreehandROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
4
4
|
import ContourSegmentationBaseTool from '../base/ContourSegmentationBaseTool';
|
|
5
5
|
declare class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
6
6
|
static toolName: any;
|
|
7
|
-
|
|
8
|
-
mouseDragCallback: any;
|
|
9
|
-
_throttledCalculateCachedStats: any;
|
|
7
|
+
_throttledCalculateCachedStats: Function;
|
|
10
8
|
private commonData?;
|
|
11
9
|
isDrawing: boolean;
|
|
12
10
|
isEditingClosed: boolean;
|
|
@@ -37,6 +35,25 @@ declare class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
37
35
|
protected renderAnnotationInstance(renderContext: AnnotationRenderContext): boolean;
|
|
38
36
|
_calculateStatsIfActive(annotation: PlanarFreehandROIAnnotation, targetId: string, viewport: any, renderingEngine: any, enabledElement: any): void;
|
|
39
37
|
private _calculateCachedStats;
|
|
38
|
+
protected updateClosedCachedStats({ viewport, points, imageData, metadata, cachedStats, targetId, pixelValueUnits, canvasCoordinates, calibratedScale, }: {
|
|
39
|
+
viewport: any;
|
|
40
|
+
points: any;
|
|
41
|
+
imageData: any;
|
|
42
|
+
metadata: any;
|
|
43
|
+
cachedStats: any;
|
|
44
|
+
targetId: any;
|
|
45
|
+
pixelValueUnits: any;
|
|
46
|
+
canvasCoordinates: any;
|
|
47
|
+
calibratedScale: any;
|
|
48
|
+
}): void;
|
|
49
|
+
protected updateOpenCachedStats({ targetId, metadata, canvasCoordinates, cachedStats, pixelValueUnits, calibratedScale, }: {
|
|
50
|
+
targetId: any;
|
|
51
|
+
metadata: any;
|
|
52
|
+
canvasCoordinates: any;
|
|
53
|
+
cachedStats: any;
|
|
54
|
+
pixelValueUnits: any;
|
|
55
|
+
calibratedScale: any;
|
|
56
|
+
}): void;
|
|
40
57
|
private _renderStats;
|
|
41
58
|
}
|
|
42
59
|
export default PlanarFreehandROITool;
|