@cornerstonejs/tools 0.56.1 → 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/dist/cjs/tools/CrosshairsTool.d.ts +1 -0
- package/dist/cjs/tools/CrosshairsTool.js +4 -1
- package/dist/cjs/tools/CrosshairsTool.js.map +1 -1
- package/dist/esm/tools/CrosshairsTool.d.ts +1 -0
- package/dist/esm/tools/CrosshairsTool.js +4 -1
- package/dist/esm/tools/CrosshairsTool.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- 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
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import AnnotationGroupSelector from './AnnotationGroupSelector';
|
|
2
|
+
import {
|
|
3
|
+
Annotation,
|
|
4
|
+
Annotations,
|
|
5
|
+
GroupSpecificAnnotations,
|
|
6
|
+
} from './AnnotationTypes';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The interface for any annotation manager (custom or default)
|
|
10
|
+
*/
|
|
11
|
+
interface IAnnotationManager {
|
|
12
|
+
/**
|
|
13
|
+
* Annotations are stored in Groups. Our default annotation manager
|
|
14
|
+
* groups the annotations based on FrameOfReferenceUID, but it is possible
|
|
15
|
+
* that you can group them based on different aspects or you only have one group
|
|
16
|
+
* totally.
|
|
17
|
+
*
|
|
18
|
+
* This function returns the group key associated with the specified
|
|
19
|
+
* annotationGroupSelector. The annotationGroupSelector can be an HTML element
|
|
20
|
+
* or a string.
|
|
21
|
+
*
|
|
22
|
+
* @param annotationGroupSelector - The annotation group selector.
|
|
23
|
+
* @returns The group key associated with the element.
|
|
24
|
+
*/
|
|
25
|
+
getGroupKey: (annotationGroupSelector: AnnotationGroupSelector) => string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Adds an annotation to the specified group.
|
|
29
|
+
* @param annotation - The annotation to add.
|
|
30
|
+
* @param groupKey - The group key to add the annotation to.
|
|
31
|
+
*/
|
|
32
|
+
addAnnotation: (annotation: Annotation, groupKey: string) => void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Returns the annotations associated with the specified group, if the
|
|
36
|
+
* toolName is specified, it will return the annotations for the specified
|
|
37
|
+
* tool.
|
|
38
|
+
* @param groupKey - The group key to retrieve annotations for.
|
|
39
|
+
* @param toolName - The name of the tool to retrieve annotations for.
|
|
40
|
+
*
|
|
41
|
+
* @returns The annotations associated with the specified group and tool.
|
|
42
|
+
*/
|
|
43
|
+
getAnnotations: (
|
|
44
|
+
groupKey: string,
|
|
45
|
+
toolName?: string
|
|
46
|
+
) => GroupSpecificAnnotations | Annotations;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Returns the annotation with the specified UID.
|
|
50
|
+
* @param annotationUID - The UID of the annotation to retrieve.
|
|
51
|
+
* @returns The annotation with the specified UID.
|
|
52
|
+
*/
|
|
53
|
+
getAnnotation: (annotationUID: string) => Annotation;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Removes the annotation with the specified UID.
|
|
57
|
+
* @param annotationUID - The UID of the annotation to remove.
|
|
58
|
+
*/
|
|
59
|
+
removeAnnotation: (annotationUID: string) => void;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Removes all annotations associated with the specified group.
|
|
63
|
+
* @param groupKey - The group key to remove annotations for.
|
|
64
|
+
*/
|
|
65
|
+
removeAnnotations: (groupKey: string) => void;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Removes all annotations.
|
|
69
|
+
*/
|
|
70
|
+
removeAllAnnotations: () => void;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Returns the number of annotations associated with the specified group.
|
|
74
|
+
* If the toolName is specified, it will return the number of annotations
|
|
75
|
+
*
|
|
76
|
+
* @param groupKey - The group key to count annotations for.
|
|
77
|
+
* @param toolName - The name of the tool to count annotations for.
|
|
78
|
+
* @returns The number of annotations associated with the specified group.
|
|
79
|
+
*/
|
|
80
|
+
getNumberOfAnnotations: (groupKey: string, toolName?: string) => number;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Returns the total number of annotations across all groups.
|
|
84
|
+
* @returns The total number of annotations across all groups.
|
|
85
|
+
*/
|
|
86
|
+
getNumberOfAllAnnotations: () => number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default IAnnotationManager;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Distance in page, client, canvas and world
|
|
3
|
+
* coordinates.
|
|
4
|
+
*/
|
|
5
|
+
type IDistance = {
|
|
6
|
+
/** page distance */
|
|
7
|
+
page: number;
|
|
8
|
+
/** client distance */
|
|
9
|
+
client: number;
|
|
10
|
+
/** canvas distance */
|
|
11
|
+
canvas: number;
|
|
12
|
+
/** world distance */
|
|
13
|
+
world: number;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default IDistance;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Types } from '@cornerstonejs/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Points in page, client, canvas and world
|
|
5
|
+
* coordinates.
|
|
6
|
+
*/
|
|
7
|
+
type IPoints = {
|
|
8
|
+
/** page coordinates of the point */
|
|
9
|
+
page: Types.Point2;
|
|
10
|
+
/** client coordinates of the point */
|
|
11
|
+
client: Types.Point2;
|
|
12
|
+
/** canvas coordinates of the point */
|
|
13
|
+
canvas: Types.Point2;
|
|
14
|
+
/** world coordinates of the point */
|
|
15
|
+
world: Types.Point3;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default IPoints;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ToolModes, MouseBindings, KeyboardBindings } from '../enums';
|
|
2
|
+
|
|
3
|
+
type ToolBindingMouseType = typeof MouseBindings[keyof typeof MouseBindings];
|
|
4
|
+
|
|
5
|
+
type ToolBindingKeyboardType =
|
|
6
|
+
typeof KeyboardBindings[keyof typeof KeyboardBindings];
|
|
7
|
+
|
|
8
|
+
type IToolBinding = {
|
|
9
|
+
/** Mouse button bindings e.g., MouseBindings.Primary/Secondary etc. */
|
|
10
|
+
mouseButton?: ToolBindingMouseType;
|
|
11
|
+
/** Keyboard bindings e.g., KeyboardBindings.Shift/Ctrl etc. */
|
|
12
|
+
modifierKey?: ToolBindingKeyboardType;
|
|
13
|
+
/** Number of touch points */
|
|
14
|
+
numTouchPoints?: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type SetToolBindingsType = {
|
|
18
|
+
/** bindings for the toolGroup's tool when it is set to be active */
|
|
19
|
+
bindings: IToolBinding[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type ToolOptionsType = {
|
|
23
|
+
/** bindings for the toolGroup's tool when it is set to be active */
|
|
24
|
+
bindings: IToolBinding[];
|
|
25
|
+
/** mode of the tool */
|
|
26
|
+
mode: ToolModes;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { IToolBinding, SetToolBindingsType, ToolOptionsType };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Types } from '@cornerstonejs/core';
|
|
2
|
+
import { Synchronizer } from '../store';
|
|
3
|
+
|
|
4
|
+
export default interface ISynchronizerEventHandler {
|
|
5
|
+
(
|
|
6
|
+
synchronizer: Synchronizer,
|
|
7
|
+
sourceViewport: Types.IViewportId,
|
|
8
|
+
targetViewport: Types.IViewportId,
|
|
9
|
+
sourceEvent: any
|
|
10
|
+
): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import { SetToolBindingsType, ToolOptionsType } from './ISetToolModeOptions';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ToolGroup interface
|
|
6
|
+
*/
|
|
7
|
+
export default interface IToolGroup {
|
|
8
|
+
/** Unserializable instantiated tool classes, keyed by name */
|
|
9
|
+
_toolInstances: Record<string, any>;
|
|
10
|
+
/** ToolGroup ID */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Viewports Info inside the ToolGroup - including viewportId and renderingEngineId */
|
|
13
|
+
viewportsInfo: Array<Types.IViewportId>;
|
|
14
|
+
/** Options for each tool including bindings and mode */
|
|
15
|
+
toolOptions: Record<string, any>;
|
|
16
|
+
/** Get viewportIds in the toolGroup*/
|
|
17
|
+
getViewportIds: () => string[];
|
|
18
|
+
/** Get viewports info in the toolGroup*/
|
|
19
|
+
getViewportsInfo: () => Array<Types.IViewportId>;
|
|
20
|
+
/** Get the toolInstance of the toolName */
|
|
21
|
+
getToolInstance: { (toolName: string): any };
|
|
22
|
+
/** Add a tool to toolGroup with its configuration */
|
|
23
|
+
addTool: { (toolName: string, toolConfiguration?: any): void };
|
|
24
|
+
/** Add tool instance, if you want to create more than one instance from the same tool e.g., brush/eraser tool */
|
|
25
|
+
addToolInstance: {
|
|
26
|
+
(ttoolName: string, parentClassName: string, configuration?: any): void;
|
|
27
|
+
};
|
|
28
|
+
/** Add viewports to share the tools for the ToolGroup */
|
|
29
|
+
addViewport: {
|
|
30
|
+
(viewportId: string, renderingEngineId?: string): void;
|
|
31
|
+
};
|
|
32
|
+
/** Remove viewports from the ToolGroup */
|
|
33
|
+
removeViewports: {
|
|
34
|
+
(renderingEngineId: string, viewportId?: string): void;
|
|
35
|
+
};
|
|
36
|
+
/** Setting the tool to be Active by its name*/
|
|
37
|
+
setToolActive: {
|
|
38
|
+
(toolName: string, toolBindingsOption?: SetToolBindingsType): void;
|
|
39
|
+
};
|
|
40
|
+
/** Setting the tool to be Passive by its name*/
|
|
41
|
+
setToolPassive: {
|
|
42
|
+
(toolName: string): void;
|
|
43
|
+
};
|
|
44
|
+
/** Setting the tool to be Enabled by its name*/
|
|
45
|
+
setToolEnabled: {
|
|
46
|
+
(toolName: string): void;
|
|
47
|
+
};
|
|
48
|
+
/** Setting the tool to be Disabled by its name*/
|
|
49
|
+
setToolDisabled: {
|
|
50
|
+
(toolName: string): void;
|
|
51
|
+
};
|
|
52
|
+
/** Returns the Tool options including tool bindings and tool mode*/
|
|
53
|
+
getToolOptions: {
|
|
54
|
+
(toolName: string): ToolOptionsType;
|
|
55
|
+
};
|
|
56
|
+
getActivePrimaryMouseButtonTool: {
|
|
57
|
+
(): undefined | string;
|
|
58
|
+
};
|
|
59
|
+
setViewportsCursorByToolName: {
|
|
60
|
+
(toolName: string, strategyName?: string): void;
|
|
61
|
+
};
|
|
62
|
+
setToolConfiguration: {
|
|
63
|
+
(
|
|
64
|
+
toolName: string,
|
|
65
|
+
configuration: Record<any, any>,
|
|
66
|
+
overwrite?: boolean
|
|
67
|
+
): void;
|
|
68
|
+
};
|
|
69
|
+
getToolConfiguration: {
|
|
70
|
+
(toolName: string, configurationPath: string): any;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import IPoints from './IPoints';
|
|
2
|
+
|
|
3
|
+
type ITouchPoints = IPoints & {
|
|
4
|
+
/** Native Touch object properties which are JSON serializable*/
|
|
5
|
+
touch: {
|
|
6
|
+
identifier: string;
|
|
7
|
+
radiusX: number;
|
|
8
|
+
radiusY: number;
|
|
9
|
+
force: number;
|
|
10
|
+
rotationAngle: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default ITouchPoints;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Types } from '@cornerstonejs/core';
|
|
2
|
+
import { AnnotationTool } from '../tools';
|
|
3
|
+
import { Annotation, Annotations } from './AnnotationTypes';
|
|
4
|
+
|
|
5
|
+
type ToolAnnotationsPair = {
|
|
6
|
+
tool: AnnotationTool;
|
|
7
|
+
annotations: Annotations;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type ToolAnnotationPair = {
|
|
11
|
+
tool: AnnotationTool;
|
|
12
|
+
annotation: Annotation;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type ToolsWithMoveableHandles = ToolAnnotationPair & {
|
|
16
|
+
handle: Types.Point3;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { ToolsWithMoveableHandles, ToolAnnotationsPair, ToolAnnotationPair };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { vtkColorTransferFunction } from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction';
|
|
2
|
+
import type { vtkPiecewiseFunction } from '@kitware/vtk.js/Common/DataModel/PiecewiseFunction';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Label map config for the label map representation
|
|
6
|
+
*/
|
|
7
|
+
export type LabelmapConfig = {
|
|
8
|
+
/** whether to render segmentation outline */
|
|
9
|
+
renderOutline?: boolean;
|
|
10
|
+
/** thickness of the outline when segmentation is active */
|
|
11
|
+
outlineWidthActive?: number;
|
|
12
|
+
/** thickness of the outline when segmentation is inactive */
|
|
13
|
+
outlineWidthInactive?: number;
|
|
14
|
+
/** whether to render segmentation filling */
|
|
15
|
+
renderFill?: boolean;
|
|
16
|
+
/** whether to render segmentation filling when inactive */
|
|
17
|
+
renderFillInactive?: boolean;
|
|
18
|
+
/** alpha of the fill */
|
|
19
|
+
fillAlpha?: number;
|
|
20
|
+
/** alpha of the fill when inactive */
|
|
21
|
+
fillAlphaInactive?: number;
|
|
22
|
+
/** alpha of outline for active segmentation */
|
|
23
|
+
outlineOpacity?: number;
|
|
24
|
+
/** alpha of outline for inactive segmentation */
|
|
25
|
+
outlineOpacityInactive?: number;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Labelmap representation type
|
|
30
|
+
*/
|
|
31
|
+
export type LabelmapRenderingConfig = {
|
|
32
|
+
/** color transfer function */
|
|
33
|
+
cfun?: vtkColorTransferFunction;
|
|
34
|
+
/** opacity transfer function */
|
|
35
|
+
ofun?: vtkPiecewiseFunction;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type LabelmapSegmentationData = {
|
|
39
|
+
volumeId: string;
|
|
40
|
+
referencedVolumeId?: string;
|
|
41
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type SVGDrawingHelper = {
|
|
2
|
+
svgLayerElement: HTMLDivElement;
|
|
3
|
+
svgNodeCacheForCanvas: Record<string, unknown>;
|
|
4
|
+
getSvgNode: (cacheKey: string) => SVGGElement | undefined;
|
|
5
|
+
appendNode: (svgNode: SVGElement, cacheKey: string) => void;
|
|
6
|
+
setNodeTouched: (cacheKey: string) => void;
|
|
7
|
+
clearUntouched: () => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default SVGDrawingHelper;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import * as Enums from '../enums';
|
|
2
|
+
import { ContourConfig, ContourSegmentationData } from './ContourTypes';
|
|
3
|
+
import type {
|
|
4
|
+
LabelmapConfig,
|
|
5
|
+
LabelmapRenderingConfig,
|
|
6
|
+
LabelmapSegmentationData,
|
|
7
|
+
} from './LabelmapTypes';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Four elements RGBA as 0-255
|
|
11
|
+
*/
|
|
12
|
+
export type Color = [number, number, number, number];
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Color LUT Array - Array of colors
|
|
16
|
+
* [[0,0,0,0], [200,200,200,200], ....]
|
|
17
|
+
*/
|
|
18
|
+
export type ColorLUT = Array<Color>;
|
|
19
|
+
|
|
20
|
+
export type SegmentSpecificRepresentationConfig = {
|
|
21
|
+
[key: number]: RepresentationConfig;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Segmentation Config
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export type RepresentationConfig = {
|
|
28
|
+
/** labelmap configuration */
|
|
29
|
+
LABELMAP?: LabelmapConfig;
|
|
30
|
+
/** contour configuration */
|
|
31
|
+
CONTOUR?: ContourConfig;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type SegmentationRepresentationConfig = {
|
|
35
|
+
/** Whether to render Inactive segmentations */
|
|
36
|
+
renderInactiveSegmentations: boolean;
|
|
37
|
+
/** Representations configuration */
|
|
38
|
+
representations: RepresentationConfig;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type SegmentationRepresentationData = {
|
|
42
|
+
LABELMAP?: LabelmapSegmentationData;
|
|
43
|
+
CONTOUR?: ContourSegmentationData;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Global Segmentation Data which is used for the segmentation
|
|
48
|
+
*/
|
|
49
|
+
export type Segmentation = {
|
|
50
|
+
/** segmentation id */
|
|
51
|
+
segmentationId: string;
|
|
52
|
+
/** segmentation main representation type */
|
|
53
|
+
type: Enums.SegmentationRepresentations;
|
|
54
|
+
/** segmentation label */
|
|
55
|
+
label: string;
|
|
56
|
+
/**
|
|
57
|
+
* Active segment index in the segmentation, this index will get used
|
|
58
|
+
* inside the segmentation tools
|
|
59
|
+
*/
|
|
60
|
+
activeSegmentIndex: number;
|
|
61
|
+
/**
|
|
62
|
+
* Locked segments in the segmentation, if a segment is locked no tool
|
|
63
|
+
* will be able to modify it
|
|
64
|
+
*/
|
|
65
|
+
segmentsLocked: Set<number>;
|
|
66
|
+
/**
|
|
67
|
+
* If there is any derived statistics for the segmentation (e.g., mean, volume, etc)
|
|
68
|
+
*/
|
|
69
|
+
cachedStats: { [key: string]: number };
|
|
70
|
+
segmentLabels: { [key: string]: string };
|
|
71
|
+
/**
|
|
72
|
+
* Representations of the segmentation. Each segmentation "can" be viewed
|
|
73
|
+
* in various representations. For instance, if a DICOM SEG is loaded, the main
|
|
74
|
+
* representation is the labelmap. However, for DICOM RT the main representation
|
|
75
|
+
* is contours, and other representations can be derived from the contour (currently
|
|
76
|
+
* only labelmap representation is supported)
|
|
77
|
+
*/
|
|
78
|
+
representationData: SegmentationRepresentationData;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Representation state of the segmentation which is common between all
|
|
83
|
+
* representations (we don't need to separate these states for each representation)
|
|
84
|
+
*/
|
|
85
|
+
export type ToolGroupSpecificRepresentationState = {
|
|
86
|
+
/**
|
|
87
|
+
* Segmentation Representation UID
|
|
88
|
+
*/
|
|
89
|
+
segmentationRepresentationUID: string;
|
|
90
|
+
/**
|
|
91
|
+
* The segmentationId that this representation is derived from
|
|
92
|
+
*/
|
|
93
|
+
segmentationId: string;
|
|
94
|
+
/**
|
|
95
|
+
* The representation type
|
|
96
|
+
*/
|
|
97
|
+
type: Enums.SegmentationRepresentations;
|
|
98
|
+
/**
|
|
99
|
+
* Whether the segmentation is the active (manipulatable) segmentation or not
|
|
100
|
+
* which means it is inactive
|
|
101
|
+
*/
|
|
102
|
+
active: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Hidden segment indices in the segmentation
|
|
105
|
+
*/
|
|
106
|
+
segmentsHidden: Set<number>;
|
|
107
|
+
/**
|
|
108
|
+
* The index of the colorLUT from the state that this segmentationData is
|
|
109
|
+
* using to render
|
|
110
|
+
*/
|
|
111
|
+
colorLUTIndex: number;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* ToolGroup Specific Segmentation Data for segmentations. As one segmentation
|
|
116
|
+
* can be represented in various ways (currently only labelmap is supported)
|
|
117
|
+
* we store ToolGroup specific segmentation data in this object
|
|
118
|
+
*/
|
|
119
|
+
export type ToolGroupSpecificLabelmapRepresentation =
|
|
120
|
+
ToolGroupSpecificRepresentationState & {
|
|
121
|
+
config: LabelmapRenderingConfig;
|
|
122
|
+
// Todo: we need to merge all these configs into one to make it easier
|
|
123
|
+
segmentationRepresentationSpecificConfig?: RepresentationConfig;
|
|
124
|
+
segmentSpecificConfig?: SegmentSpecificRepresentationConfig;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export type ToolGroupSpecificContourRepresentation =
|
|
128
|
+
ToolGroupSpecificRepresentationState & {
|
|
129
|
+
config: LabelmapRenderingConfig;
|
|
130
|
+
segmentationRepresentationSpecificConfig?: RepresentationConfig;
|
|
131
|
+
segmentSpecificConfig?: SegmentSpecificRepresentationConfig;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export type ToolGroupSpecificRepresentation =
|
|
135
|
+
ToolGroupSpecificLabelmapRepresentation; // | other ones
|
|
136
|
+
|
|
137
|
+
export type ToolGroupSpecificRepresentations =
|
|
138
|
+
Array<ToolGroupSpecificRepresentation>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Segmentation State stored inside the cornerstone3DTools
|
|
142
|
+
*
|
|
143
|
+
* ```js
|
|
144
|
+
* {
|
|
145
|
+
* colorLUT: [],
|
|
146
|
+
* globalConfig: {
|
|
147
|
+
* renderInactiveSegmentations: false,
|
|
148
|
+
* representations: {
|
|
149
|
+
* LABELMAP: {
|
|
150
|
+
* renderFill: true,
|
|
151
|
+
* renderOutline: true,
|
|
152
|
+
* },
|
|
153
|
+
* },
|
|
154
|
+
* },
|
|
155
|
+
* segmentations: [
|
|
156
|
+
* {
|
|
157
|
+
* segmentationId: 'segmentation1',
|
|
158
|
+
* mainType: 'Labelmap',
|
|
159
|
+
* activeSegmentIndex: 0,
|
|
160
|
+
* segmentsLocked: new Set(),
|
|
161
|
+
* label: 'segmentation1',
|
|
162
|
+
* cachedStats: {},
|
|
163
|
+
* representationData: {
|
|
164
|
+
* LABELMAP: {
|
|
165
|
+
* volumeId: 'segmentation1',
|
|
166
|
+
* },
|
|
167
|
+
* CONTOUR: {
|
|
168
|
+
* geometryIds: ['contourSet1', 'contourSet2'],
|
|
169
|
+
* },
|
|
170
|
+
* },
|
|
171
|
+
* },
|
|
172
|
+
* {
|
|
173
|
+
* segmentationId: 'segmentation2',
|
|
174
|
+
* type: 'Labelmap',
|
|
175
|
+
* activeSegmentIndex: 1,
|
|
176
|
+
* segmentsLocked: new Set(),
|
|
177
|
+
* label: 'segmentation2',
|
|
178
|
+
* cachedStats: {},
|
|
179
|
+
* representationData: {
|
|
180
|
+
* CONTOUR: {
|
|
181
|
+
* points: Float32Array,
|
|
182
|
+
* },
|
|
183
|
+
* },
|
|
184
|
+
* },
|
|
185
|
+
* ],
|
|
186
|
+
* toolGroups: {
|
|
187
|
+
* toolGroupUID1: {
|
|
188
|
+
* segmentationRepresentations: [
|
|
189
|
+
* {
|
|
190
|
+
* segmentationRepresentationUID: '12123123123132',
|
|
191
|
+
* segmentationId: '123123',
|
|
192
|
+
* type: 'Labelmap',
|
|
193
|
+
* active: true,
|
|
194
|
+
* colorLUTIndex: 0,
|
|
195
|
+
* visibility: true,
|
|
196
|
+
* segmentsHidden: Set(),
|
|
197
|
+
* // LabelmapRenderingConfig
|
|
198
|
+
* config: {
|
|
199
|
+
* "cfun",
|
|
200
|
+
* "ofun",
|
|
201
|
+
* },
|
|
202
|
+
* },
|
|
203
|
+
* ],
|
|
204
|
+
* config: {
|
|
205
|
+
* renderInactiveSegmentations: false,
|
|
206
|
+
* representations: {
|
|
207
|
+
* LABELMAP: {
|
|
208
|
+
* renderFill: true,
|
|
209
|
+
* renderOutline: true,
|
|
210
|
+
* },
|
|
211
|
+
* },
|
|
212
|
+
* },
|
|
213
|
+
* },
|
|
214
|
+
* },
|
|
215
|
+
* }
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
export type SegmentationState = {
|
|
219
|
+
/** Array of colorLUT for segmentation to render */
|
|
220
|
+
colorLUT: ColorLUT[];
|
|
221
|
+
/** segmentations */
|
|
222
|
+
segmentations: Segmentation[];
|
|
223
|
+
/** global segmentation state with config */
|
|
224
|
+
globalConfig: SegmentationRepresentationConfig;
|
|
225
|
+
/**
|
|
226
|
+
* ToolGroup specific segmentation state with config
|
|
227
|
+
*/
|
|
228
|
+
toolGroups: {
|
|
229
|
+
/** toolGroupId and their toolGroup specific segmentation state with config */
|
|
230
|
+
[key: string]: {
|
|
231
|
+
segmentationRepresentations: ToolGroupSpecificRepresentations;
|
|
232
|
+
config: SegmentationRepresentationConfig;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
export type SegmentationPublicInput = {
|
|
238
|
+
segmentationId: string;
|
|
239
|
+
representation: {
|
|
240
|
+
type: Enums.SegmentationRepresentations;
|
|
241
|
+
data: LabelmapSegmentationData | ContourSegmentationData;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export type RepresentationPublicInput = {
|
|
246
|
+
segmentationId: string;
|
|
247
|
+
type: Enums.SegmentationRepresentations;
|
|
248
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
|
|
3
|
+
/** Handle position in the world coordinates */
|
|
4
|
+
type AnnotationHandle = Types.Point3;
|
|
5
|
+
|
|
6
|
+
/** TextBox handle type specifying its location
|
|
7
|
+
* in the world including bottomLeft and topRight
|
|
8
|
+
* and bottomRight and topLeft points, and its
|
|
9
|
+
* center world coordinates.
|
|
10
|
+
*/
|
|
11
|
+
type TextBoxHandle = {
|
|
12
|
+
hasMoved: boolean;
|
|
13
|
+
worldBoundingBox: {
|
|
14
|
+
bottomLeft: Types.Point3;
|
|
15
|
+
bottomRight: Types.Point3;
|
|
16
|
+
topLeft: Types.Point3;
|
|
17
|
+
topRight: Types.Point3;
|
|
18
|
+
};
|
|
19
|
+
worldPosition: Types.Point3;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** Tool Handle type can be either AnnotationHandle or TextBoxHandle */
|
|
23
|
+
type ToolHandle = AnnotationHandle | TextBoxHandle;
|
|
24
|
+
|
|
25
|
+
export default ToolHandle;
|
|
26
|
+
export type { AnnotationHandle, TextBoxHandle };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type SharedToolProp = {
|
|
2
|
+
/** supported interactions for the tool */
|
|
3
|
+
supportedInteractionTypes?: Array<string>;
|
|
4
|
+
/** tool specific tool configuration */
|
|
5
|
+
configuration?: Record<string, any>;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type ToolProps = SharedToolProp;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Tool specific tool properties which includes the supported interaction types
|
|
12
|
+
* and the configuration.
|
|
13
|
+
*/
|
|
14
|
+
export type PublicToolProps = SharedToolProp & {
|
|
15
|
+
name?: string;
|
|
16
|
+
};
|