@cornerstonejs/tools 0.56.2 → 0.56.3
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/package.json +5 -4
- package/src/constants/COLOR_LUT.ts +262 -0
- package/src/constants/index.ts +3 -0
- package/src/cursors/ImageMouseCursor.ts +39 -0
- package/src/cursors/MouseCursor.ts +114 -0
- package/src/cursors/SVGCursorDescriptor.ts +462 -0
- package/src/cursors/SVGMouseCursor.ts +145 -0
- package/src/cursors/elementCursor.ts +69 -0
- package/src/cursors/index.ts +24 -0
- package/src/cursors/setCursorForElement.ts +33 -0
- package/src/drawingSvg/_getHash.ts +9 -0
- package/src/drawingSvg/_setAttributesIfNecessary.ts +13 -0
- package/src/drawingSvg/_setNewAttributesIfValid.ts +10 -0
- package/src/drawingSvg/clearByToolType.ts +26 -0
- package/src/drawingSvg/draw.ts +16 -0
- package/src/drawingSvg/drawArrow.ts +82 -0
- package/src/drawingSvg/drawCircle.ts +62 -0
- package/src/drawingSvg/drawEllipse.ts +71 -0
- package/src/drawingSvg/drawHandles.ts +87 -0
- package/src/drawingSvg/drawLine.ts +70 -0
- package/src/drawingSvg/drawLink.ts +76 -0
- package/src/drawingSvg/drawLinkedTextBox.ts +64 -0
- package/src/drawingSvg/drawPolyline.ts +80 -0
- package/src/drawingSvg/drawRect.ts +70 -0
- package/src/drawingSvg/drawTextBox.ts +213 -0
- package/src/drawingSvg/getSvgDrawingHelper.ts +98 -0
- package/src/drawingSvg/index.ts +23 -0
- package/src/enums/AnnotationStyleStates.ts +22 -0
- package/src/enums/Events.ts +242 -0
- package/src/enums/SegmentationRepresentations.ts +12 -0
- package/src/enums/ToolBindings.ts +37 -0
- package/src/enums/ToolModes.ts +31 -0
- package/src/enums/Touch.ts +8 -0
- package/src/enums/index.js +16 -0
- package/src/eventDispatchers/annotationModifiedEventDispatcher.ts +41 -0
- package/src/eventDispatchers/cameraModifiedEventDispatcher.ts +41 -0
- package/src/eventDispatchers/imageRenderedEventDispatcher.ts +37 -0
- package/src/eventDispatchers/imageSpacingCalibratedEventDispatcher.ts +50 -0
- package/src/eventDispatchers/index.js +15 -0
- package/src/eventDispatchers/keyboardEventHandlers/index.js +4 -0
- package/src/eventDispatchers/keyboardEventHandlers/keyDown.ts +29 -0
- package/src/eventDispatchers/keyboardEventHandlers/keyUp.ts +33 -0
- package/src/eventDispatchers/keyboardToolEventDispatcher.ts +28 -0
- package/src/eventDispatchers/mouseEventHandlers/index.js +19 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseClick.ts +13 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDoubleClick.ts +13 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDown.ts +196 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDownActivate.ts +35 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDrag.ts +25 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseMove.ts +70 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseUp.ts +9 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseWheel.ts +13 -0
- package/src/eventDispatchers/mouseToolEventDispatcher.ts +64 -0
- package/src/eventDispatchers/shared/customCallbackHandler.ts +73 -0
- package/src/eventDispatchers/shared/getActiveToolForKeyboardEvent.ts +58 -0
- package/src/eventDispatchers/shared/getActiveToolForMouseEvent.ts +61 -0
- package/src/eventDispatchers/shared/getActiveToolForTouchEvent.ts +64 -0
- package/src/eventDispatchers/shared/getMouseModifier.ts +30 -0
- package/src/eventDispatchers/shared/getToolsWithModesForMouseEvent.ts +56 -0
- package/src/eventDispatchers/shared/getToolsWithModesForTouchEvent.ts +54 -0
- package/src/eventDispatchers/touchEventHandlers/index.js +15 -0
- package/src/eventDispatchers/touchEventHandlers/touchDrag.ts +23 -0
- package/src/eventDispatchers/touchEventHandlers/touchEnd.ts +9 -0
- package/src/eventDispatchers/touchEventHandlers/touchPress.ts +13 -0
- package/src/eventDispatchers/touchEventHandlers/touchStart.ts +174 -0
- package/src/eventDispatchers/touchEventHandlers/touchStartActivate.ts +36 -0
- package/src/eventDispatchers/touchEventHandlers/touchTap.ts +9 -0
- package/src/eventDispatchers/touchToolEventDispatcher.ts +51 -0
- package/src/eventListeners/annotations/annotationModifiedListener.ts +22 -0
- package/src/eventListeners/annotations/annotationSelectionListener.ts +29 -0
- package/src/eventListeners/annotations/index.ts +4 -0
- package/src/eventListeners/index.ts +28 -0
- package/src/eventListeners/keyboard/index.ts +16 -0
- package/src/eventListeners/keyboard/keyDownListener.ts +99 -0
- package/src/eventListeners/mouse/getMouseEventPoints.ts +66 -0
- package/src/eventListeners/mouse/index.ts +55 -0
- package/src/eventListeners/mouse/mouseDoubleClickListener.ts +55 -0
- package/src/eventListeners/mouse/mouseDownListener.ts +519 -0
- package/src/eventListeners/mouse/mouseMoveListener.ts +33 -0
- package/src/eventListeners/segmentation/index.ts +11 -0
- package/src/eventListeners/segmentation/segmentationDataModifiedEventListener.ts +61 -0
- package/src/eventListeners/segmentation/segmentationModifiedEventListener.ts +32 -0
- package/src/eventListeners/segmentation/segmentationRepresentationModifiedEventListener.ts +15 -0
- package/src/eventListeners/segmentation/segmentationRepresentationRemovedEventListener.ts +16 -0
- package/src/eventListeners/touch/getTouchEventPoints.ts +75 -0
- package/src/eventListeners/touch/index.ts +37 -0
- package/src/eventListeners/touch/preventGhostClick.js +72 -0
- package/src/eventListeners/touch/touchStartListener.ts +499 -0
- package/src/eventListeners/wheel/index.ts +27 -0
- package/src/eventListeners/wheel/normalizeWheel.ts +69 -0
- package/src/eventListeners/wheel/wheelListener.ts +51 -0
- package/src/index.ts +133 -0
- package/src/init.ts +187 -0
- package/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts +399 -0
- package/src/stateManagement/annotation/annotationLocking.ts +178 -0
- package/src/stateManagement/annotation/annotationSelection.ts +163 -0
- package/src/stateManagement/annotation/annotationState.ts +180 -0
- package/src/stateManagement/annotation/annotationVisibility.ts +156 -0
- package/src/stateManagement/annotation/config/ToolStyle.ts +265 -0
- package/src/stateManagement/annotation/config/getFont.ts +36 -0
- package/src/stateManagement/annotation/config/getState.ts +26 -0
- package/src/stateManagement/annotation/config/helpers.ts +55 -0
- package/src/stateManagement/annotation/config/index.ts +5 -0
- package/src/stateManagement/annotation/helpers/state.ts +83 -0
- package/src/stateManagement/annotation/index.ts +15 -0
- package/src/stateManagement/index.js +40 -0
- package/src/stateManagement/segmentation/SegmentationStateManager.ts +491 -0
- package/src/stateManagement/segmentation/activeSegmentation.ts +60 -0
- package/src/stateManagement/segmentation/addSegmentationRepresentations.ts +77 -0
- package/src/stateManagement/segmentation/addSegmentations.ts +27 -0
- package/src/stateManagement/segmentation/config/index.ts +29 -0
- package/src/stateManagement/segmentation/config/segmentationColor.ts +132 -0
- package/src/stateManagement/segmentation/config/segmentationConfig.ts +195 -0
- package/src/stateManagement/segmentation/config/segmentationVisibility.ts +171 -0
- package/src/stateManagement/segmentation/helpers/index.ts +3 -0
- package/src/stateManagement/segmentation/helpers/normalizeSegmentationInput.ts +35 -0
- package/src/stateManagement/segmentation/helpers/validateSegmentationInput.ts +41 -0
- package/src/stateManagement/segmentation/index.ts +22 -0
- package/src/stateManagement/segmentation/removeSegmentationsFromToolGroup.ts +85 -0
- package/src/stateManagement/segmentation/segmentIndex.ts +38 -0
- package/src/stateManagement/segmentation/segmentLocking.ts +72 -0
- package/src/stateManagement/segmentation/segmentationState.ts +429 -0
- package/src/stateManagement/segmentation/triggerSegmentationEvents.ts +157 -0
- package/src/store/SynchronizerManager/Synchronizer.ts +344 -0
- package/src/store/SynchronizerManager/createSynchronizer.ts +41 -0
- package/src/store/SynchronizerManager/destroy.ts +14 -0
- package/src/store/SynchronizerManager/destroySynchronizer.ts +25 -0
- package/src/store/SynchronizerManager/getAllSynchronizers.ts +12 -0
- package/src/store/SynchronizerManager/getSynchronizer.ts +13 -0
- package/src/store/SynchronizerManager/getSynchronizersForViewport.ts +44 -0
- package/src/store/SynchronizerManager/index.js +15 -0
- package/src/store/ToolGroupManager/ToolGroup.ts +679 -0
- package/src/store/ToolGroupManager/createToolGroup.ts +33 -0
- package/src/store/ToolGroupManager/destroy.ts +24 -0
- package/src/store/ToolGroupManager/destroyToolGroup.ts +26 -0
- package/src/store/ToolGroupManager/getAllToolGroups.ts +12 -0
- package/src/store/ToolGroupManager/getToolGroup.ts +14 -0
- package/src/store/ToolGroupManager/getToolGroupForViewport.ts +44 -0
- package/src/store/ToolGroupManager/getToolGroupsWithToolName.ts +33 -0
- package/src/store/ToolGroupManager/index.ts +17 -0
- package/src/store/addEnabledElement.ts +137 -0
- package/src/store/addTool.ts +56 -0
- package/src/store/cancelActiveManipulations.ts +30 -0
- package/src/store/filterMoveableAnnotationTools.ts +61 -0
- package/src/store/filterToolsWithAnnotationsForElement.ts +51 -0
- package/src/store/filterToolsWithMoveableHandles.ts +51 -0
- package/src/store/index.ts +29 -0
- package/src/store/removeEnabledElement.ts +132 -0
- package/src/store/state.ts +57 -0
- package/src/store/svgNodeCache.ts +7 -0
- package/src/synchronizers/callbacks/areViewportsCoplanar .ts +12 -0
- package/src/synchronizers/callbacks/cameraSyncCallback.ts +33 -0
- package/src/synchronizers/callbacks/stackImageSyncCallback.ts +157 -0
- package/src/synchronizers/callbacks/voiSyncCallback.ts +51 -0
- package/src/synchronizers/callbacks/zoomPanSyncCallback.ts +43 -0
- package/src/synchronizers/index.ts +11 -0
- package/src/synchronizers/synchronizers/createCameraPositionSynchronizer.ts +25 -0
- package/src/synchronizers/synchronizers/createStackImageSynchronizer.ts +25 -0
- package/src/synchronizers/synchronizers/createVOISynchronizer.ts +24 -0
- package/src/synchronizers/synchronizers/createZoomPanSynchronizer.ts +25 -0
- package/src/synchronizers/synchronizers/index.ts +11 -0
- package/src/tools/CrosshairsTool.ts +2693 -0
- package/src/tools/MIPJumpToClickTool.ts +99 -0
- package/src/tools/MagnifyTool.ts +319 -0
- package/src/tools/PanTool.ts +58 -0
- package/src/tools/PlanarRotateTool.ts +77 -0
- package/src/tools/ReferenceCursors.ts +466 -0
- package/src/tools/ReferenceLinesTool.ts +279 -0
- package/src/tools/ScaleOverlayTool.ts +685 -0
- package/src/tools/StackScrollTool.ts +97 -0
- package/src/tools/StackScrollToolMouseWheelTool.ts +58 -0
- package/src/tools/TrackballRotateTool.ts +141 -0
- package/src/tools/VolumeRotateMouseWheelTool.ts +86 -0
- package/src/tools/WindowLevelTool.ts +260 -0
- package/src/tools/ZoomTool.ts +293 -0
- package/src/tools/annotation/AngleTool.ts +835 -0
- package/src/tools/annotation/ArrowAnnotateTool.ts +820 -0
- package/src/tools/annotation/BidirectionalTool.ts +1350 -0
- package/src/tools/annotation/CircleROITool.ts +1070 -0
- package/src/tools/annotation/CobbAngleTool.ts +815 -0
- package/src/tools/annotation/DragProbeTool.ts +213 -0
- package/src/tools/annotation/EllipticalROITool.ts +1223 -0
- package/src/tools/annotation/LengthTool.ts +861 -0
- package/src/tools/annotation/PlanarFreehandROITool.ts +636 -0
- package/src/tools/annotation/ProbeTool.ts +681 -0
- package/src/tools/annotation/RectangleROITool.ts +1028 -0
- package/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts +488 -0
- package/src/tools/annotation/planarFreehandROITool/drawLoop.ts +462 -0
- package/src/tools/annotation/planarFreehandROITool/editLoopCommon.ts +331 -0
- package/src/tools/annotation/planarFreehandROITool/findOpenUShapedContourVectorToPeak.ts +74 -0
- package/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts +612 -0
- package/src/tools/annotation/planarFreehandROITool/openContourEndEditLoop.ts +74 -0
- package/src/tools/annotation/planarFreehandROITool/renderMethods.ts +407 -0
- package/src/tools/base/AnnotationDisplayTool.ts +228 -0
- package/src/tools/base/AnnotationTool.ts +307 -0
- package/src/tools/base/BaseTool.ts +215 -0
- package/src/tools/base/index.ts +4 -0
- package/src/tools/displayTools/Contour/addContourToElement.ts +135 -0
- package/src/tools/displayTools/Contour/contourDisplay.ts +252 -0
- package/src/tools/displayTools/Contour/index.ts +3 -0
- package/src/tools/displayTools/Contour/removeContourFromElement.ts +35 -0
- package/src/tools/displayTools/Labelmap/addLabelmapToElement.ts +57 -0
- package/src/tools/displayTools/Labelmap/index.ts +4 -0
- package/src/tools/displayTools/Labelmap/labelmapConfig.ts +37 -0
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +461 -0
- package/src/tools/displayTools/Labelmap/removeLabelmapFromElement.ts +27 -0
- package/src/tools/displayTools/Labelmap/validateRepresentationData.ts +30 -0
- package/src/tools/displayTools/SegmentationDisplayTool.ts +198 -0
- package/src/tools/index.ts +84 -0
- package/src/tools/segmentation/BrushTool.ts +474 -0
- package/src/tools/segmentation/CircleScissorsTool.ts +365 -0
- package/src/tools/segmentation/PaintFillTool.ts +370 -0
- package/src/tools/segmentation/RectangleROIStartEndThresholdTool.ts +471 -0
- package/src/tools/segmentation/RectangleROIThresholdTool.ts +281 -0
- package/src/tools/segmentation/RectangleScissorsTool.ts +382 -0
- package/src/tools/segmentation/SphereScissorsTool.ts +368 -0
- package/src/tools/segmentation/strategies/eraseCircle.ts +30 -0
- package/src/tools/segmentation/strategies/eraseRectangle.ts +81 -0
- package/src/tools/segmentation/strategies/eraseSphere.ts +27 -0
- package/src/tools/segmentation/strategies/fillCircle.ts +185 -0
- package/src/tools/segmentation/strategies/fillRectangle.ts +110 -0
- package/src/tools/segmentation/strategies/fillSphere.ts +88 -0
- package/src/tools/segmentation/strategies/index.ts +9 -0
- package/src/types/AnnotationGroupSelector.ts +7 -0
- package/src/types/AnnotationStyle.ts +42 -0
- package/src/types/AnnotationTypes.ts +109 -0
- package/src/types/BoundsIJK.ts +5 -0
- package/src/types/CINETypes.ts +32 -0
- package/src/types/ContourTypes.ts +26 -0
- package/src/types/CursorTypes.ts +12 -0
- package/src/types/EventTypes.ts +657 -0
- package/src/types/FloodFillTypes.ts +19 -0
- package/src/types/IAnnotationManager.ts +89 -0
- package/src/types/IDistance.ts +16 -0
- package/src/types/IPoints.ts +18 -0
- package/src/types/ISetToolModeOptions.ts +29 -0
- package/src/types/ISynchronizerEventHandler.ts +11 -0
- package/src/types/IToolClassReference.ts +5 -0
- package/src/types/IToolGroup.ts +72 -0
- package/src/types/ITouchPoints.ts +14 -0
- package/src/types/InteractionTypes.ts +6 -0
- package/src/types/InternalToolTypes.ts +19 -0
- package/src/types/JumpToSliceOptions.ts +7 -0
- package/src/types/LabelmapTypes.ts +41 -0
- package/src/types/PlanarBoundingBox.ts +8 -0
- package/src/types/SVGDrawingHelper.ts +10 -0
- package/src/types/ScrollOptions.ts +9 -0
- package/src/types/SegmentationStateTypes.ts +248 -0
- package/src/types/ToolHandle.ts +26 -0
- package/src/types/ToolProps.ts +16 -0
- package/src/types/ToolSpecificAnnotationTypes.ts +311 -0
- package/src/types/index.ts +115 -0
- package/src/utilities/boundingBox/extend2DBoundingBoxInViewAxis.ts +29 -0
- package/src/utilities/boundingBox/getBoundingBoxAroundShape.ts +57 -0
- package/src/utilities/boundingBox/index.ts +4 -0
- package/src/utilities/calibrateImageSpacing.ts +46 -0
- package/src/utilities/cine/events.ts +9 -0
- package/src/utilities/cine/index.ts +5 -0
- package/src/utilities/cine/playClip.ts +435 -0
- package/src/utilities/cine/state.ts +18 -0
- package/src/utilities/clip.js +30 -0
- package/src/utilities/debounce.js +217 -0
- package/src/utilities/drawing/getTextBoxCoordsCanvas.ts +45 -0
- package/src/utilities/drawing/index.ts +3 -0
- package/src/utilities/dynamicVolume/getDataInTime.ts +110 -0
- package/src/utilities/dynamicVolume/index.ts +2 -0
- package/src/utilities/getAnnotationNearPoint.ts +130 -0
- package/src/utilities/getModalityUnit.ts +11 -0
- package/src/utilities/getToolsWithModesForElement.ts +52 -0
- package/src/utilities/index.ts +68 -0
- package/src/utilities/isObject.js +29 -0
- package/src/utilities/math/angle/angleBetweenLines.ts +29 -0
- package/src/utilities/math/circle/_types.ts +6 -0
- package/src/utilities/math/circle/getCanvasCircleCorners.ts +23 -0
- package/src/utilities/math/circle/getCanvasCircleRadius.ts +16 -0
- package/src/utilities/math/circle/index.ts +4 -0
- package/src/utilities/math/ellipse/getCanvasEllipseCorners.ts +26 -0
- package/src/utilities/math/ellipse/index.ts +4 -0
- package/src/utilities/math/ellipse/pointInEllipse.ts +38 -0
- package/src/utilities/math/ellipse/pointInEllipsoidWithConstraint.ts +35 -0
- package/src/utilities/math/index.ts +8 -0
- package/src/utilities/math/line/distanceToPoint.ts +24 -0
- package/src/utilities/math/line/distanceToPointSquared.ts +44 -0
- package/src/utilities/math/line/index.ts +5 -0
- package/src/utilities/math/line/intersectLine.ts +92 -0
- package/src/utilities/math/midPoint.ts +24 -0
- package/src/utilities/math/point/distanceToPoint.ts +22 -0
- package/src/utilities/math/point/index.ts +3 -0
- package/src/utilities/math/polyline/addCanvasPointsToArray.ts +62 -0
- package/src/utilities/math/polyline/calculateAreaOfPoints.ts +23 -0
- package/src/utilities/math/polyline/getIntersectionWithPolyline.ts +182 -0
- package/src/utilities/math/polyline/getSubPixelSpacingAndXYDirections.ts +99 -0
- package/src/utilities/math/polyline/index.ts +19 -0
- package/src/utilities/math/polyline/planarFreehandROIInternalTypes.ts +36 -0
- package/src/utilities/math/polyline/pointCanProjectOnLine.ts +57 -0
- package/src/utilities/math/polyline/pointsAreWithinCloseContourProximity.ts +15 -0
- package/src/utilities/math/rectangle/distanceToPoint.ts +82 -0
- package/src/utilities/math/rectangle/index.ts +3 -0
- package/src/utilities/math/sphere/index.ts +3 -0
- package/src/utilities/math/sphere/pointInSphere.ts +31 -0
- package/src/utilities/math/vec2/findClosestPoint.ts +40 -0
- package/src/utilities/math/vec2/index.ts +4 -0
- package/src/utilities/math/vec2/liangBarksyClip.ts +84 -0
- package/src/utilities/orientation/getOrientationStringLPS.ts +52 -0
- package/src/utilities/orientation/index.ts +4 -0
- package/src/utilities/orientation/invertOrientationStringLPS.ts +21 -0
- package/src/utilities/planar/filterAnnotationsForDisplay.ts +68 -0
- package/src/utilities/planar/filterAnnotationsWithinSlice.ts +85 -0
- package/src/utilities/planar/getPointInLineOfSightWithCriteria.ts +104 -0
- package/src/utilities/planar/getWorldWidthAndHeightFromCorners.ts +51 -0
- package/src/utilities/planar/getWorldWidthAndHeightFromTwoPoints.ts +51 -0
- package/src/utilities/planar/index.ts +18 -0
- package/src/utilities/planarFreehandROITool/index.ts +7 -0
- package/src/utilities/planarFreehandROITool/interpolateAnnotation.ts +87 -0
- package/src/utilities/planarFreehandROITool/interpolatePoints.ts +214 -0
- package/src/utilities/planarFreehandROITool/interpolation/algorithms/bspline.ts +55 -0
- package/src/utilities/planarFreehandROITool/interpolation/interpolateSegmentPoints.ts +90 -0
- package/src/utilities/pointInShapeCallback.ts +138 -0
- package/src/utilities/pointInSurroundingSphereCallback.ts +188 -0
- package/src/utilities/rectangleROITool/getBoundsIJKFromRectangleAnnotations.ts +76 -0
- package/src/utilities/rectangleROITool/index.ts +3 -0
- package/src/utilities/scroll.ts +62 -0
- package/src/utilities/segmentation/brushSizeForToolGroup.ts +72 -0
- package/src/utilities/segmentation/brushThresholdForToolGroup.ts +65 -0
- package/src/utilities/segmentation/createLabelmapVolumeForViewport.ts +74 -0
- package/src/utilities/segmentation/createMergedLabelmapForIndex.ts +65 -0
- package/src/utilities/segmentation/floodFill.ts +194 -0
- package/src/utilities/segmentation/getDefaultRepresentationConfig.ts +20 -0
- package/src/utilities/segmentation/index.ts +33 -0
- package/src/utilities/segmentation/isValidRepresentationConfig.ts +22 -0
- package/src/utilities/segmentation/rectangleROIThresholdVolumeByRange.ts +91 -0
- package/src/utilities/segmentation/thresholdSegmentationByRange.ts +129 -0
- package/src/utilities/segmentation/thresholdVolumeByRange.ts +150 -0
- package/src/utilities/segmentation/triggerSegmentationRender.ts +206 -0
- package/src/utilities/segmentation/utilities.ts +116 -0
- package/src/utilities/stackPrefetch/index.ts +8 -0
- package/src/utilities/stackPrefetch/stackPrefetch.ts +405 -0
- package/src/utilities/stackPrefetch/state.ts +17 -0
- package/src/utilities/throttle.js +69 -0
- package/src/utilities/touch/index.ts +246 -0
- package/src/utilities/triggerAnnotationRender.ts +237 -0
- package/src/utilities/triggerAnnotationRenderForViewportIds.ts +18 -0
- package/src/utilities/viewport/index.ts +5 -0
- package/src/utilities/viewport/isViewportPreScaled.ts +24 -0
- package/src/utilities/viewport/jumpToSlice.ts +73 -0
- package/src/utilities/viewport/jumpToWorld.ts +58 -0
- package/src/utilities/viewportFilters/filterViewportsWithFrameOfReferenceUID.ts +28 -0
- package/src/utilities/viewportFilters/filterViewportsWithParallelNormals.ts +26 -0
- package/src/utilities/viewportFilters/filterViewportsWithSameOrientation.ts +15 -0
- package/src/utilities/viewportFilters/filterViewportsWithToolEnabled.ts +72 -0
- package/src/utilities/viewportFilters/getViewportIdsWithToolToRender.ts +45 -0
- package/src/utilities/viewportFilters/index.ts +11 -0
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "0.56.
|
|
3
|
+
"version": "0.56.3",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "dist/umd/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
7
7
|
"module": "dist/esm/index.js",
|
|
8
8
|
"repository": "https://github.com/cornerstonejs/cornerstone3D-beta",
|
|
9
9
|
"files": [
|
|
10
|
-
"dist/"
|
|
10
|
+
"dist/",
|
|
11
|
+
"src/"
|
|
11
12
|
],
|
|
12
13
|
"directories": {
|
|
13
14
|
"test": "test"
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@cornerstonejs/core": "^0.36.
|
|
29
|
+
"@cornerstonejs/core": "^0.36.4",
|
|
29
30
|
"lodash.clonedeep": "4.5.0",
|
|
30
31
|
"lodash.get": "^4.4.2"
|
|
31
32
|
},
|
|
@@ -51,5 +52,5 @@
|
|
|
51
52
|
"type": "individual",
|
|
52
53
|
"url": "https://ohif.org/donate"
|
|
53
54
|
},
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "5ed87dec106ae42aca083b8b40d83ad22b0ca905"
|
|
55
56
|
}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cornerstone Color LUT used for Segmentations
|
|
3
|
+
*/
|
|
4
|
+
const CORNERSTONE_COLOR_LUT = [
|
|
5
|
+
[0, 0, 0, 0],
|
|
6
|
+
[221, 84, 84, 255],
|
|
7
|
+
[77, 228, 121, 255],
|
|
8
|
+
[166, 70, 235, 255],
|
|
9
|
+
[189, 180, 116, 255],
|
|
10
|
+
[109, 182, 196, 255],
|
|
11
|
+
[204, 101, 157, 255],
|
|
12
|
+
[123, 211, 94, 255],
|
|
13
|
+
[93, 87, 218, 255],
|
|
14
|
+
[225, 128, 80, 255],
|
|
15
|
+
[73, 232, 172, 255],
|
|
16
|
+
[181, 119, 186, 255],
|
|
17
|
+
[176, 193, 112, 255],
|
|
18
|
+
[105, 153, 200, 255],
|
|
19
|
+
[208, 97, 120, 255],
|
|
20
|
+
[90, 215, 101, 255],
|
|
21
|
+
[135, 83, 222, 255],
|
|
22
|
+
[229, 178, 76, 255],
|
|
23
|
+
[122, 183, 181, 255],
|
|
24
|
+
[190, 115, 171, 255],
|
|
25
|
+
[149, 197, 108, 255],
|
|
26
|
+
[100, 118, 205, 255],
|
|
27
|
+
[212, 108, 93, 255],
|
|
28
|
+
[86, 219, 141, 255],
|
|
29
|
+
[183, 79, 226, 255],
|
|
30
|
+
[233, 233, 72, 255],
|
|
31
|
+
[118, 167, 187, 255],
|
|
32
|
+
[194, 111, 146, 255],
|
|
33
|
+
[116, 201, 104, 255],
|
|
34
|
+
[115, 96, 209, 255],
|
|
35
|
+
[216, 147, 89, 255],
|
|
36
|
+
[82, 223, 188, 255],
|
|
37
|
+
[230, 75, 224, 255],
|
|
38
|
+
[163, 184, 121, 255],
|
|
39
|
+
[114, 143, 191, 255],
|
|
40
|
+
[198, 107, 114, 255],
|
|
41
|
+
[99, 206, 122, 255],
|
|
42
|
+
[153, 92, 213, 255],
|
|
43
|
+
[220, 192, 85, 255],
|
|
44
|
+
[78, 215, 227, 255],
|
|
45
|
+
[234, 71, 173, 255],
|
|
46
|
+
[141, 188, 117, 255],
|
|
47
|
+
[110, 113, 195, 255],
|
|
48
|
+
[202, 128, 103, 255],
|
|
49
|
+
[95, 210, 157, 255],
|
|
50
|
+
[195, 88, 217, 255],
|
|
51
|
+
[206, 224, 81, 255],
|
|
52
|
+
[74, 166, 231, 255],
|
|
53
|
+
[185, 120, 139, 255],
|
|
54
|
+
[113, 192, 113, 255],
|
|
55
|
+
[133, 106, 199, 255],
|
|
56
|
+
[207, 162, 98, 255],
|
|
57
|
+
[91, 214, 198, 255],
|
|
58
|
+
[221, 84, 198, 255],
|
|
59
|
+
[159, 228, 77, 255],
|
|
60
|
+
[70, 111, 235, 255],
|
|
61
|
+
[189, 119, 116, 255],
|
|
62
|
+
[109, 196, 138, 255],
|
|
63
|
+
[165, 101, 204, 255],
|
|
64
|
+
[211, 201, 94, 255],
|
|
65
|
+
[87, 191, 218, 255],
|
|
66
|
+
[225, 80, 153, 255],
|
|
67
|
+
[106, 232, 73, 255],
|
|
68
|
+
[124, 119, 186, 255],
|
|
69
|
+
[193, 142, 112, 255],
|
|
70
|
+
[105, 200, 168, 255],
|
|
71
|
+
[203, 97, 208, 255],
|
|
72
|
+
[184, 215, 90, 255],
|
|
73
|
+
[83, 147, 222, 255],
|
|
74
|
+
[229, 76, 101, 255],
|
|
75
|
+
[122, 183, 130, 255],
|
|
76
|
+
[146, 115, 190, 255],
|
|
77
|
+
[197, 171, 108, 255],
|
|
78
|
+
[100, 205, 205, 255],
|
|
79
|
+
[212, 93, 177, 255],
|
|
80
|
+
[141, 219, 86, 255],
|
|
81
|
+
[79, 97, 226, 255],
|
|
82
|
+
[233, 99, 72, 255],
|
|
83
|
+
[118, 187, 150, 255],
|
|
84
|
+
[173, 111, 194, 255],
|
|
85
|
+
[197, 201, 104, 255],
|
|
86
|
+
[96, 171, 209, 255],
|
|
87
|
+
[216, 89, 137, 255],
|
|
88
|
+
[94, 223, 82, 255],
|
|
89
|
+
[107, 75, 230, 255],
|
|
90
|
+
[184, 153, 121, 255],
|
|
91
|
+
[114, 191, 175, 255],
|
|
92
|
+
[198, 107, 191, 255],
|
|
93
|
+
[166, 206, 99, 255],
|
|
94
|
+
[92, 132, 213, 255],
|
|
95
|
+
[220, 85, 91, 255],
|
|
96
|
+
[78, 227, 115, 255],
|
|
97
|
+
[159, 71, 234, 255],
|
|
98
|
+
[188, 176, 117, 255],
|
|
99
|
+
[110, 185, 195, 255],
|
|
100
|
+
[202, 103, 161, 255],
|
|
101
|
+
[129, 210, 95, 255],
|
|
102
|
+
[88, 88, 217, 255],
|
|
103
|
+
[224, 123, 81, 255],
|
|
104
|
+
[74, 231, 166, 255],
|
|
105
|
+
[177, 120, 185, 255],
|
|
106
|
+
[179, 192, 113, 255],
|
|
107
|
+
[106, 156, 199, 255],
|
|
108
|
+
[207, 98, 125, 255],
|
|
109
|
+
[91, 214, 96, 255],
|
|
110
|
+
[130, 84, 221, 255],
|
|
111
|
+
[228, 171, 77, 255],
|
|
112
|
+
[70, 235, 221, 255],
|
|
113
|
+
[189, 116, 174, 255],
|
|
114
|
+
[153, 196, 109, 255],
|
|
115
|
+
[101, 123, 204, 255],
|
|
116
|
+
[211, 104, 94, 255],
|
|
117
|
+
[87, 218, 136, 255],
|
|
118
|
+
[177, 80, 225, 255],
|
|
119
|
+
[232, 225, 73, 255],
|
|
120
|
+
[119, 169, 186, 255],
|
|
121
|
+
[193, 112, 149, 255],
|
|
122
|
+
[121, 200, 105, 255],
|
|
123
|
+
[111, 97, 208, 255],
|
|
124
|
+
[215, 142, 90, 255],
|
|
125
|
+
[83, 222, 181, 255],
|
|
126
|
+
[229, 76, 229, 255],
|
|
127
|
+
[165, 183, 122, 255],
|
|
128
|
+
[115, 146, 190, 255],
|
|
129
|
+
[197, 108, 119, 255],
|
|
130
|
+
[100, 205, 118, 255],
|
|
131
|
+
[148, 93, 212, 255],
|
|
132
|
+
[219, 186, 86, 255],
|
|
133
|
+
[79, 220, 226, 255],
|
|
134
|
+
[233, 72, 179, 255],
|
|
135
|
+
[144, 187, 118, 255],
|
|
136
|
+
[111, 118, 194, 255],
|
|
137
|
+
[201, 124, 104, 255],
|
|
138
|
+
[96, 209, 153, 255],
|
|
139
|
+
[189, 89, 216, 255],
|
|
140
|
+
[211, 223, 82, 255],
|
|
141
|
+
[75, 172, 230, 255],
|
|
142
|
+
[184, 121, 142, 255],
|
|
143
|
+
[117, 191, 114, 255],
|
|
144
|
+
[130, 107, 198, 255],
|
|
145
|
+
[206, 157, 99, 255],
|
|
146
|
+
[92, 213, 193, 255],
|
|
147
|
+
[220, 85, 203, 255],
|
|
148
|
+
[165, 227, 78, 255],
|
|
149
|
+
[71, 118, 234, 255],
|
|
150
|
+
[188, 117, 117, 255],
|
|
151
|
+
[110, 195, 135, 255],
|
|
152
|
+
[161, 103, 202, 255],
|
|
153
|
+
[210, 195, 95, 255],
|
|
154
|
+
[88, 195, 217, 255],
|
|
155
|
+
[224, 81, 158, 255],
|
|
156
|
+
[113, 231, 74, 255],
|
|
157
|
+
[123, 120, 185, 255],
|
|
158
|
+
[192, 139, 113, 255],
|
|
159
|
+
[106, 199, 164, 255],
|
|
160
|
+
[198, 98, 207, 255],
|
|
161
|
+
[188, 214, 91, 255],
|
|
162
|
+
[84, 153, 221, 255],
|
|
163
|
+
[228, 77, 108, 255],
|
|
164
|
+
[70, 235, 84, 255],
|
|
165
|
+
[143, 116, 189, 255],
|
|
166
|
+
[196, 167, 109, 255],
|
|
167
|
+
[101, 204, 199, 255],
|
|
168
|
+
[211, 94, 182, 255],
|
|
169
|
+
[147, 218, 87, 255],
|
|
170
|
+
[80, 104, 225, 255],
|
|
171
|
+
[232, 93, 73, 255],
|
|
172
|
+
[119, 186, 147, 255],
|
|
173
|
+
[170, 112, 193, 255],
|
|
174
|
+
[200, 200, 105, 255],
|
|
175
|
+
[97, 175, 208, 255],
|
|
176
|
+
[215, 90, 142, 255],
|
|
177
|
+
[100, 222, 83, 255],
|
|
178
|
+
[101, 76, 229, 255],
|
|
179
|
+
[183, 150, 122, 255],
|
|
180
|
+
[115, 190, 171, 255],
|
|
181
|
+
[197, 108, 194, 255],
|
|
182
|
+
[170, 205, 100, 255],
|
|
183
|
+
[93, 138, 212, 255],
|
|
184
|
+
[219, 86, 97, 255],
|
|
185
|
+
[79, 226, 110, 255],
|
|
186
|
+
[153, 72, 233, 255],
|
|
187
|
+
[187, 173, 118, 255],
|
|
188
|
+
[111, 187, 194, 255],
|
|
189
|
+
[201, 104, 165, 255],
|
|
190
|
+
[134, 209, 96, 255],
|
|
191
|
+
[89, 95, 216, 255],
|
|
192
|
+
[223, 117, 82, 255],
|
|
193
|
+
[75, 230, 159, 255],
|
|
194
|
+
[174, 121, 184, 255],
|
|
195
|
+
[182, 191, 114, 255],
|
|
196
|
+
[107, 160, 198, 255],
|
|
197
|
+
[206, 99, 130, 255],
|
|
198
|
+
[92, 213, 92, 255],
|
|
199
|
+
[124, 85, 220, 255],
|
|
200
|
+
[227, 165, 78, 255],
|
|
201
|
+
[71, 234, 214, 255],
|
|
202
|
+
[188, 117, 176, 255],
|
|
203
|
+
[156, 195, 110, 255],
|
|
204
|
+
[103, 128, 202, 255],
|
|
205
|
+
[210, 100, 95, 255],
|
|
206
|
+
[88, 217, 131, 255],
|
|
207
|
+
[170, 81, 224, 255],
|
|
208
|
+
[231, 218, 74, 255],
|
|
209
|
+
[120, 172, 185, 255],
|
|
210
|
+
[192, 113, 153, 255],
|
|
211
|
+
[125, 199, 106, 255],
|
|
212
|
+
[107, 98, 207, 255],
|
|
213
|
+
[214, 137, 91, 255],
|
|
214
|
+
[84, 221, 175, 255],
|
|
215
|
+
[222, 77, 228, 255],
|
|
216
|
+
[194, 235, 70, 255],
|
|
217
|
+
[116, 149, 189, 255],
|
|
218
|
+
[196, 109, 123, 255],
|
|
219
|
+
[101, 204, 114, 255],
|
|
220
|
+
[143, 94, 211, 255],
|
|
221
|
+
[218, 180, 87, 255],
|
|
222
|
+
[80, 225, 225, 255],
|
|
223
|
+
[232, 73, 186, 255],
|
|
224
|
+
[147, 186, 119, 255],
|
|
225
|
+
[112, 122, 193, 255],
|
|
226
|
+
[200, 121, 105, 255],
|
|
227
|
+
[97, 208, 148, 255],
|
|
228
|
+
[184, 90, 215, 255],
|
|
229
|
+
[216, 222, 83, 255],
|
|
230
|
+
[76, 178, 229, 255],
|
|
231
|
+
[183, 122, 145, 255],
|
|
232
|
+
[121, 190, 115, 255],
|
|
233
|
+
[126, 108, 197, 255],
|
|
234
|
+
[205, 153, 100, 255],
|
|
235
|
+
[93, 212, 187, 255],
|
|
236
|
+
[219, 86, 208, 255],
|
|
237
|
+
[171, 226, 79, 255],
|
|
238
|
+
[72, 126, 233, 255],
|
|
239
|
+
[187, 118, 121, 255],
|
|
240
|
+
[111, 194, 132, 255],
|
|
241
|
+
[157, 104, 201, 255],
|
|
242
|
+
[209, 190, 96, 255],
|
|
243
|
+
[89, 200, 216, 255],
|
|
244
|
+
[223, 82, 164, 255],
|
|
245
|
+
[120, 230, 75, 255],
|
|
246
|
+
[121, 121, 184, 255],
|
|
247
|
+
[191, 136, 114, 255],
|
|
248
|
+
[107, 198, 160, 255],
|
|
249
|
+
[192, 99, 206, 255],
|
|
250
|
+
[193, 213, 92, 255],
|
|
251
|
+
[85, 158, 220, 255],
|
|
252
|
+
[227, 78, 115, 255],
|
|
253
|
+
[71, 234, 78, 255],
|
|
254
|
+
[141, 117, 188, 255],
|
|
255
|
+
[195, 163, 110, 255],
|
|
256
|
+
[103, 202, 194, 255],
|
|
257
|
+
[210, 95, 186, 255],
|
|
258
|
+
[153, 217, 88, 255],
|
|
259
|
+
[81, 111, 224, 255],
|
|
260
|
+
];
|
|
261
|
+
|
|
262
|
+
export default CORNERSTONE_COLOR_LUT;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { utilities } from '@cornerstonejs/core';
|
|
2
|
+
import MouseCursor from './MouseCursor';
|
|
3
|
+
|
|
4
|
+
const DEFAULT_NAME = 'image-cursor';
|
|
5
|
+
|
|
6
|
+
export default class ImageMouseCursor extends MouseCursor {
|
|
7
|
+
private url: string;
|
|
8
|
+
private x: number;
|
|
9
|
+
private y: number;
|
|
10
|
+
|
|
11
|
+
constructor(
|
|
12
|
+
url: string,
|
|
13
|
+
x?: number,
|
|
14
|
+
y?: number,
|
|
15
|
+
name?: string | undefined,
|
|
16
|
+
fallback?: MouseCursor | undefined
|
|
17
|
+
) {
|
|
18
|
+
super(
|
|
19
|
+
name || ImageMouseCursor.getUniqueInstanceName(DEFAULT_NAME),
|
|
20
|
+
fallback
|
|
21
|
+
);
|
|
22
|
+
this.url = url;
|
|
23
|
+
this.x = Number(x) || 0;
|
|
24
|
+
this.y = Number(y) || 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
getStyleProperty(): string {
|
|
28
|
+
const { url, x, y } = this;
|
|
29
|
+
let style = `url('${url}')`;
|
|
30
|
+
if (x >= 0 && y >= 0 && (x > 0 || y > 0)) {
|
|
31
|
+
style += ` ${x} ${y}`;
|
|
32
|
+
}
|
|
33
|
+
return this.addFallbackStyleProperty(style);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static getUniqueInstanceName(prefix: string): string {
|
|
37
|
+
return `${prefix}-${utilities.getRuntimeId(ImageMouseCursor)}`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
const DEFINED_CURSORS = Symbol('DefinedCursors');
|
|
2
|
+
const STANDARD_CURSORS = new Set([
|
|
3
|
+
'alias',
|
|
4
|
+
'all-scroll',
|
|
5
|
+
'auto',
|
|
6
|
+
'cell',
|
|
7
|
+
'col-resize',
|
|
8
|
+
'context-menu',
|
|
9
|
+
'copy',
|
|
10
|
+
'crosshair',
|
|
11
|
+
'default',
|
|
12
|
+
'e-resize',
|
|
13
|
+
'ew-resize',
|
|
14
|
+
'grab',
|
|
15
|
+
'grabbing',
|
|
16
|
+
'help',
|
|
17
|
+
'move',
|
|
18
|
+
'ne-resize',
|
|
19
|
+
'nesw-resize',
|
|
20
|
+
'no-drop',
|
|
21
|
+
'none',
|
|
22
|
+
'not-allowed',
|
|
23
|
+
'n-resize',
|
|
24
|
+
'ns-resize',
|
|
25
|
+
'nw-resize',
|
|
26
|
+
'nwse-resize',
|
|
27
|
+
'pointer',
|
|
28
|
+
'progress',
|
|
29
|
+
'row-resize',
|
|
30
|
+
'se-resize',
|
|
31
|
+
's-resize',
|
|
32
|
+
'sw-resize',
|
|
33
|
+
'text',
|
|
34
|
+
'vertical-text',
|
|
35
|
+
'wait',
|
|
36
|
+
'w-resize',
|
|
37
|
+
'zoom-in',
|
|
38
|
+
'zoom-out',
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
export default class MouseCursor {
|
|
42
|
+
private name: string;
|
|
43
|
+
private fallback: MouseCursor | undefined;
|
|
44
|
+
|
|
45
|
+
constructor(name: string, fallback?: MouseCursor | undefined) {
|
|
46
|
+
this.name = name + '';
|
|
47
|
+
this.fallback = fallback;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
getName(): string {
|
|
51
|
+
return this.name + '';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
addFallbackStyleProperty(style: string): string {
|
|
55
|
+
const { fallback } = this;
|
|
56
|
+
if (fallback instanceof MouseCursor) {
|
|
57
|
+
return `${style}, ${fallback.getStyleProperty()}`;
|
|
58
|
+
}
|
|
59
|
+
return style + '';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
getStyleProperty(): string {
|
|
63
|
+
return this.addFallbackStyleProperty(this.name) + '';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static getDefinedCursor(name: string): MouseCursor | undefined {
|
|
67
|
+
const definedCursors = getDefinedCursors(
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
MouseCursor as Record<symbol, Map<string, MouseCursor>>,
|
|
70
|
+
DEFINED_CURSORS
|
|
71
|
+
);
|
|
72
|
+
let mouseCursor = definedCursors.get(name);
|
|
73
|
+
if (mouseCursor instanceof MouseCursor) {
|
|
74
|
+
return mouseCursor;
|
|
75
|
+
}
|
|
76
|
+
if (STANDARD_CURSORS.has(name)) {
|
|
77
|
+
mouseCursor = new MouseCursor(name);
|
|
78
|
+
definedCursors.set(name, mouseCursor);
|
|
79
|
+
return mouseCursor;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static setDefinedCursor(name: string, cursor: MouseCursor): boolean {
|
|
84
|
+
if (cursor instanceof MouseCursor) {
|
|
85
|
+
const definedCursors = getDefinedCursors(
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
MouseCursor as Record<symbol, Map<string, MouseCursor>>,
|
|
88
|
+
DEFINED_CURSORS
|
|
89
|
+
);
|
|
90
|
+
definedCursors.set(name, cursor);
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/*
|
|
98
|
+
* Helpers
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
function getDefinedCursors(
|
|
102
|
+
context: Record<symbol, Map<string, MouseCursor>>,
|
|
103
|
+
symbol: symbol
|
|
104
|
+
): Map<string, MouseCursor> {
|
|
105
|
+
let definedCursors = context[symbol];
|
|
106
|
+
if (!(definedCursors instanceof Map)) {
|
|
107
|
+
definedCursors = new Map();
|
|
108
|
+
Object.defineProperty(context, symbol, { value: definedCursors });
|
|
109
|
+
}
|
|
110
|
+
return definedCursors;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const standardCursorNames = STANDARD_CURSORS.values();
|
|
114
|
+
export { standardCursorNames };
|