@cornerstonejs/tools 5.0.0-beta.1 → 5.0.1
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/config.d.ts +4 -0
- package/dist/esm/drawingSvg/drawPath.d.ts +3 -0
- package/dist/esm/drawingSvg/drawPath.js +4 -1
- package/dist/esm/eventListeners/keyboard/keyDownListener.js +2 -2
- package/dist/esm/eventListeners/mouse/getMouseEventPoints.d.ts +1 -1
- package/dist/esm/eventListeners/mouse/getMouseEventPoints.js +19 -1
- package/dist/esm/eventListeners/mouse/mouseDoubleClickListener.js +8 -1
- package/dist/esm/eventListeners/mouse/mouseDownListener.js +37 -5
- package/dist/esm/eventListeners/mouse/mouseMoveListener.js +3 -0
- package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js +60 -92
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +49 -21
- package/dist/esm/eventListeners/segmentation/labelmap/performStackLabelmapUpdate.js +7 -13
- package/dist/esm/eventListeners/segmentation/labelmap/performVolumeLabelmapUpdate.js +44 -18
- package/dist/esm/eventListeners/touch/getTouchEventPoints.js +27 -4
- package/dist/esm/eventListeners/touch/touchStartListener.js +27 -9
- package/dist/esm/eventListeners/wheel/wheelListener.js +5 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/init.js +2 -0
- package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js +10 -4
- package/dist/esm/stateManagement/segmentation/SegmentationRenderingEngine.js +23 -20
- package/dist/esm/stateManagement/segmentation/SegmentationRepresentationDisplayRegistry.d.ts +12 -0
- package/dist/esm/stateManagement/segmentation/SegmentationRepresentationDisplayRegistry.js +7 -0
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.d.ts +1 -10
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +28 -149
- package/dist/esm/stateManagement/segmentation/addColorLUT.js +7 -1
- package/dist/esm/stateManagement/segmentation/getCurrentLabelmapImageIdForViewport.js +16 -1
- package/dist/esm/stateManagement/segmentation/helpers/clearSegmentValue.js +9 -7
- package/dist/esm/stateManagement/segmentation/helpers/getSegmentationActor.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/helpers/getSegmentationActor.js +3 -2
- package/dist/esm/stateManagement/segmentation/helpers/getViewportLabelmapRenderMode.d.ts +5 -0
- package/dist/esm/stateManagement/segmentation/helpers/getViewportLabelmapRenderMode.js +58 -0
- package/dist/esm/stateManagement/segmentation/helpers/labelmapImageMapperSupport.d.ts +52 -0
- package/dist/esm/stateManagement/segmentation/helpers/labelmapImageMapperSupport.js +246 -0
- package/dist/esm/stateManagement/segmentation/helpers/labelmapSegmentationState.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/helpers/labelmapSegmentationState.js +1 -0
- package/dist/esm/stateManagement/segmentation/helpers/normalizeSegmentationInput.js +12 -1
- package/dist/esm/stateManagement/segmentation/internalAddSegmentationRepresentation.js +3 -3
- package/dist/esm/stateManagement/segmentation/labelmapModel/index.d.ts +9 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/index.js +7 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapEditTransaction.d.ts +54 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapEditTransaction.js +224 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageIdMapping.d.ts +6 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageIdMapping.js +39 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageReferenceResolver.d.ts +23 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageReferenceResolver.js +269 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLayerStore.d.ts +15 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLayerStore.js +160 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLegacyAdapter.d.ts +4 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLegacyAdapter.js +42 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapSegmentBindings.d.ts +11 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapSegmentBindings.js +73 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/normalizeLabelmapSegmentationData.d.ts +17 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/normalizeLabelmapSegmentationData.js +75 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/privateLabelmap.d.ts +5 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/privateLabelmap.js +106 -0
- package/dist/esm/stateManagement/segmentation/models/SegmentModel.d.ts +11 -0
- package/dist/esm/stateManagement/segmentation/models/SegmentModel.js +19 -0
- package/dist/esm/stateManagement/segmentation/models/SegmentationModel.d.ts +12 -0
- package/dist/esm/stateManagement/segmentation/models/SegmentationModel.js +23 -0
- package/dist/esm/stateManagement/segmentation/removeSegmentationRepresentations.js +6 -10
- package/dist/esm/stateManagement/segmentation/segmentIndex.js +24 -0
- package/dist/esm/stateManagement/segmentation/segmentationEventManager.js +2 -9
- package/dist/esm/stateManagement/segmentation/segmentationState.d.ts +2 -1
- package/dist/esm/stateManagement/segmentation/segmentationState.js +4 -1
- package/dist/esm/store/SynchronizerManager/Synchronizer.d.ts +3 -1
- package/dist/esm/store/state.js +2 -1
- package/dist/esm/synchronizers/callbacks/imageSliceSyncCallback.js +12 -3
- package/dist/esm/synchronizers/callbacks/presentationViewSyncCallback.js +5 -2
- package/dist/esm/synchronizers/callbacks/zoomPanSyncCallback.js +51 -3
- package/dist/esm/synchronizers/synchronizers/createPresentationViewSynchronizer.d.ts +1 -1
- package/dist/esm/tools/AdvancedMagnifyTool.js +4 -1
- package/dist/esm/tools/CrosshairsTool.d.ts +4 -0
- package/dist/esm/tools/CrosshairsTool.js +95 -41
- package/dist/esm/tools/MagnifyTool.js +3 -1
- package/dist/esm/tools/OrientationControllerTool.d.ts +45 -0
- package/dist/esm/tools/OrientationControllerTool.js +454 -0
- package/dist/esm/tools/OrientationMarkerTool.js +4 -4
- package/dist/esm/tools/PanTool.js +26 -3
- package/dist/esm/tools/PlanarRotateTool.js +19 -4
- package/dist/esm/tools/ReferenceCursors.js +7 -1
- package/dist/esm/tools/SculptorTool/CircleSculptCursor.js +1 -1
- package/dist/esm/tools/TrackballRotateTool.js +3 -2
- package/dist/esm/tools/VolumeCroppingControlTool.d.ts +10 -35
- package/dist/esm/tools/VolumeCroppingControlTool.js +179 -699
- package/dist/esm/tools/VolumeCroppingTool.d.ts +34 -32
- package/dist/esm/tools/VolumeCroppingTool.js +813 -532
- package/dist/esm/tools/WindowLevelTool.d.ts +2 -1
- package/dist/esm/tools/WindowLevelTool.js +48 -4
- package/dist/esm/tools/ZoomTool.d.ts +8 -0
- package/dist/esm/tools/ZoomTool.js +92 -11
- package/dist/esm/tools/annotation/AngleTool.js +38 -32
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js +30 -28
- package/dist/esm/tools/annotation/BidirectionalTool.js +51 -49
- package/dist/esm/tools/annotation/CircleROITool.d.ts +1 -0
- package/dist/esm/tools/annotation/CircleROITool.js +89 -51
- package/dist/esm/tools/annotation/CobbAngleTool.js +1 -1
- package/dist/esm/tools/annotation/DragProbeTool.js +1 -1
- package/dist/esm/tools/annotation/ETDRSGridTool.js +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +46 -39
- package/dist/esm/tools/annotation/HeightTool.js +1 -1
- package/dist/esm/tools/annotation/KeyImageTool.js +11 -11
- package/dist/esm/tools/annotation/LabelTool.js +37 -35
- package/dist/esm/tools/annotation/LengthTool.js +35 -33
- package/dist/esm/tools/annotation/LivewireContourSegmentationTool.js +6 -4
- package/dist/esm/tools/annotation/LivewireContourTool.js +4 -8
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js +6 -4
- package/dist/esm/tools/annotation/PlanarFreehandROITool.d.ts +2 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +11 -8
- package/dist/esm/tools/annotation/ProbeTool.js +66 -56
- package/dist/esm/tools/annotation/RectangleROITool.js +48 -37
- package/dist/esm/tools/annotation/RegionSegmentPlusTool.js +1 -1
- package/dist/esm/tools/annotation/RegionSegmentTool.js +1 -1
- package/dist/esm/tools/annotation/SplineContourSegmentationTool.js +1 -1
- package/dist/esm/tools/annotation/SplineROITool.js +60 -56
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js +1 -1
- package/dist/esm/tools/annotation/UltrasoundPleuraBLineTool/UltrasoundPleuraBLineTool.js +57 -55
- package/dist/esm/tools/annotation/VideoRedactionTool.js +1 -1
- package/dist/esm/tools/base/AnnotationDisplayTool.js +9 -6
- package/dist/esm/tools/base/AnnotationTool.js +2 -1
- package/dist/esm/tools/base/BaseTool.js +16 -10
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js +1 -1
- package/dist/esm/tools/base/GrowCutBaseTool.js +2 -2
- package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.d.ts +2 -4
- package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js +15 -85
- package/dist/esm/tools/displayTools/Labelmap/labelmapActorStyle.d.ts +5 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapActorStyle.js +191 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.d.ts +4 -3
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +48 -209
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/createLabelmapRenderPlan.d.ts +3 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/createLabelmapRenderPlan.js +51 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/index.d.ts +4 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/index.js +3 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/legacyVolumePlan.d.ts +14 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/legacyVolumePlan.js +143 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/planarGenericVolumeLabelmap.d.ts +40 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/planarGenericVolumeLabelmap.js +79 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/removeLabelmapRepresentationFromViewport.d.ts +3 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/removeLabelmapRepresentationFromViewport.js +18 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/resolveLabelmapRenderPlan.d.ts +9 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/resolveLabelmapRenderPlan.js +56 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/stackImagePlan.d.ts +11 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/stackImagePlan.js +35 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/types.d.ts +48 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/types.js +0 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/volumeSliceImageMapperPlan.d.ts +13 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/volumeSliceImageMapperPlan.js +34 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan.d.ts +2 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan.js +1 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRepresentationUID.d.ts +8 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRepresentationUID.js +18 -0
- package/dist/esm/tools/displayTools/Labelmap/removeLabelmapFromElement.js +2 -2
- package/dist/esm/tools/displayTools/Labelmap/removeLabelmapRepresentationData.d.ts +3 -0
- package/dist/esm/tools/displayTools/Labelmap/removeLabelmapRepresentationData.js +16 -0
- package/dist/esm/tools/displayTools/Labelmap/syncStackLabelmapActors.d.ts +2 -0
- package/dist/esm/tools/displayTools/Labelmap/syncStackLabelmapActors.js +135 -0
- package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapImageMapper.d.ts +16 -0
- package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapImageMapper.js +267 -0
- package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapSliceData.d.ts +27 -0
- package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapSliceData.js +185 -0
- package/dist/esm/tools/displayTools/registerBuiltInSegmentationRepresentationDisplays.d.ts +1 -0
- package/dist/esm/tools/displayTools/registerBuiltInSegmentationRepresentationDisplays.js +16 -0
- package/dist/esm/tools/index.d.ts +2 -1
- package/dist/esm/tools/index.js +2 -1
- package/dist/esm/tools/segmentation/BrushTool.d.ts +9 -2
- package/dist/esm/tools/segmentation/BrushTool.js +123 -26
- package/dist/esm/tools/segmentation/CircleScissorsTool.js +19 -36
- package/dist/esm/tools/segmentation/LabelmapBaseTool.d.ts +2 -3
- package/dist/esm/tools/segmentation/LabelmapBaseTool.js +77 -46
- package/dist/esm/tools/segmentation/LabelmapEditWithContour.js +3 -3
- package/dist/esm/tools/segmentation/PaintFillTool.js +11 -4
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.d.ts +2 -0
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +16 -8
- package/dist/esm/tools/segmentation/RectangleScissorsTool.js +13 -6
- package/dist/esm/tools/segmentation/SegmentBidirectionalTool.js +63 -61
- package/dist/esm/tools/segmentation/SegmentSelectTool.js +4 -4
- package/dist/esm/tools/segmentation/SphereScissorsTool.js +11 -31
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.d.ts +7 -0
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.js +47 -24
- package/dist/esm/tools/segmentation/strategies/compositions/circularCursor.js +49 -21
- package/dist/esm/tools/segmentation/strategies/compositions/determineSegmentIndex.js +2 -2
- package/dist/esm/tools/segmentation/strategies/compositions/dynamicThreshold.js +5 -1
- package/dist/esm/tools/segmentation/strategies/compositions/islandRemovalComposition.js +2 -2
- package/dist/esm/tools/segmentation/strategies/compositions/preview.js +2 -2
- package/dist/esm/tools/segmentation/strategies/compositions/setValue.js +14 -6
- package/dist/esm/tools/segmentation/strategies/fillCircle.d.ts +3 -1
- package/dist/esm/tools/segmentation/strategies/fillCircle.js +38 -31
- package/dist/esm/tools/segmentation/strategies/fillSphere.js +11 -3
- package/dist/esm/tools/segmentation/strategies/utils/crossLayerErase.d.ts +4 -0
- package/dist/esm/tools/segmentation/strategies/utils/crossLayerErase.js +23 -0
- package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/handleUseSegmentCenterIndex.js +12 -11
- package/dist/esm/tools/segmentation/strategies/utils/labelmapOverlap.d.ts +4 -0
- package/dist/esm/tools/segmentation/strategies/utils/labelmapOverlap.js +41 -0
- package/dist/esm/tools/segmentation/strategies/utils/overwritePolicy.d.ts +3 -0
- package/dist/esm/tools/segmentation/strategies/utils/overwritePolicy.js +31 -0
- package/dist/esm/tools/segmentation/strategies/utils/segmentSeparation.d.ts +3 -0
- package/dist/esm/tools/segmentation/strategies/utils/segmentSeparation.js +38 -0
- package/dist/esm/tools/segmentation/utils/LazyBrushEditController.d.ts +19 -0
- package/dist/esm/tools/segmentation/utils/LazyBrushEditController.js +55 -0
- package/dist/esm/tools/segmentation/utils/lazyBrushPreview.d.ts +3 -0
- package/dist/esm/tools/segmentation/utils/lazyBrushPreview.js +34 -0
- package/dist/esm/tools/segmentation/utils/shouldUseLazyLabelmapEditing.d.ts +3 -0
- package/dist/esm/tools/segmentation/utils/shouldUseLazyLabelmapEditing.js +42 -0
- package/dist/esm/types/ISynchronizerEventHandler.d.ts +2 -1
- package/dist/esm/types/LabelmapToolOperationData.d.ts +5 -0
- package/dist/esm/types/LabelmapTypes.d.ts +29 -6
- package/dist/esm/types/SegmentationStateTypes.d.ts +6 -0
- package/dist/esm/utilities/boundingBox/index.d.ts +2 -1
- package/dist/esm/utilities/boundingBox/index.js +2 -1
- package/dist/esm/utilities/boundingBox/snapIndexBounds.d.ts +3 -0
- package/dist/esm/utilities/boundingBox/snapIndexBounds.js +9 -0
- package/dist/esm/utilities/calibrateImageSpacing.js +17 -2
- package/dist/esm/utilities/contours/AnnotationToPointData.js +1 -1
- package/dist/esm/utilities/draw3D/addLine3DBetweenPoints.d.ts +7 -0
- package/dist/esm/utilities/draw3D/addLine3DBetweenPoints.js +34 -0
- package/dist/esm/utilities/draw3D/calculateAdaptiveSphereRadius.d.ts +6 -0
- package/dist/esm/utilities/draw3D/calculateAdaptiveSphereRadius.js +7 -0
- package/dist/esm/utilities/draw3D/index.d.ts +2 -0
- package/dist/esm/utilities/draw3D/index.js +2 -0
- package/dist/esm/utilities/drawing/getTextBoxCoordsCanvas.js +22 -14
- package/dist/esm/utilities/getCenterAndRadiusInCanvas.d.ts +6 -0
- package/dist/esm/utilities/getCenterAndRadiusInCanvas.js +26 -0
- package/dist/esm/utilities/getEllipseWorldCoordinates.d.ts +2 -0
- package/dist/esm/utilities/getEllipseWorldCoordinates.js +26 -0
- package/dist/esm/utilities/getSphereBoundsInfo.js +5 -1
- package/dist/esm/utilities/getViewportICamera.d.ts +4 -0
- package/dist/esm/utilities/getViewportICamera.js +23 -0
- package/dist/esm/utilities/getViewportsForAnnotation.js +5 -1
- package/dist/esm/utilities/index.d.ts +2 -1
- package/dist/esm/utilities/index.js +2 -1
- package/dist/esm/utilities/interactionDragCoordinator.d.ts +5 -0
- package/dist/esm/utilities/interactionDragCoordinator.js +16 -0
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.js +9 -7
- package/dist/esm/utilities/pointInSurroundingSphereCallback.js +8 -1
- package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js +121 -118
- package/dist/esm/utilities/segmentation/SegmentStatsCalculator.js +5 -4
- package/dist/esm/utilities/segmentation/VolumetricCalculator.js +1 -1
- package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.js +1 -1
- package/dist/esm/utilities/segmentation/getReferenceVolumeForSegmentation.js +1 -1
- package/dist/esm/utilities/segmentation/getReferenceVolumeForSegmentationVolume.js +11 -2
- package/dist/esm/utilities/segmentation/getSegmentIndexAtLabelmapBorder.js +36 -17
- package/dist/esm/utilities/segmentation/getSegmentIndexAtWorldPoint.js +42 -25
- package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js +3 -30
- package/dist/esm/utilities/segmentation/index.d.ts +2 -1
- package/dist/esm/utilities/segmentation/index.js +2 -1
- package/dist/esm/utilities/segmentation/utilsForWorker.js +6 -2
- package/dist/esm/utilities/segmentation/validateLabelmap.js +1 -1
- package/dist/esm/utilities/stackPrefetch/stackPrefetch.js +0 -1
- package/dist/esm/utilities/touch/index.js +3 -2
- package/dist/esm/utilities/viewportCapabilities.d.ts +16 -0
- package/dist/esm/utilities/viewportCapabilities.js +18 -0
- package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.d.ts +1 -1
- package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.js +12 -4
- package/dist/esm/utilities/viewportFilters/filterViewportsWithSameOrientation.d.ts +1 -1
- package/dist/esm/utilities/viewportFilters/filterViewportsWithSameOrientation.js +11 -4
- package/dist/esm/utilities/viewportFilters/getViewportIdsWithToolToRender.js +1 -1
- package/dist/esm/utilities/viewportPresentation.d.ts +3 -0
- package/dist/esm/utilities/viewportPresentation.js +26 -0
- package/dist/esm/utilities/volumeCropping/computePlanePlaneIntersection.d.ts +6 -0
- package/dist/esm/utilities/volumeCropping/computePlanePlaneIntersection.js +37 -0
- package/dist/esm/utilities/volumeCropping/constants.d.ts +31 -0
- package/dist/esm/utilities/volumeCropping/constants.js +31 -0
- package/dist/esm/utilities/volumeCropping/copyClippingPlanes.d.ts +2 -0
- package/dist/esm/utilities/volumeCropping/copyClippingPlanes.js +6 -0
- package/dist/esm/utilities/volumeCropping/extractVolumeDirectionVectors.d.ts +9 -0
- package/dist/esm/utilities/volumeCropping/extractVolumeDirectionVectors.js +9 -0
- package/dist/esm/utilities/volumeCropping/findLineBoundsIntersection.d.ts +5 -0
- package/dist/esm/utilities/volumeCropping/findLineBoundsIntersection.js +50 -0
- package/dist/esm/utilities/volumeCropping/getColorKeyForPlaneIndex.d.ts +1 -0
- package/dist/esm/utilities/volumeCropping/getColorKeyForPlaneIndex.js +13 -0
- package/dist/esm/utilities/volumeCropping/getOrientationFromNormal.d.ts +2 -0
- package/dist/esm/utilities/volumeCropping/getOrientationFromNormal.js +19 -0
- package/dist/esm/utilities/volumeCropping/index.d.ts +9 -0
- package/dist/esm/utilities/volumeCropping/index.js +9 -0
- package/dist/esm/utilities/volumeCropping/parseCornerKey.d.ts +8 -0
- package/dist/esm/utilities/volumeCropping/parseCornerKey.js +11 -0
- package/dist/esm/utilities/volumeCropping/types.d.ts +5 -0
- package/dist/esm/utilities/volumeCropping/types.js +0 -0
- package/dist/esm/utilities/vtkjs/AnnotatedRhombicuboctahedronActor/index.d.ts +31 -0
- package/dist/esm/utilities/vtkjs/AnnotatedRhombicuboctahedronActor/index.js +391 -0
- package/dist/esm/utilities/vtkjs/OrientationControllerWidget/index.d.ts +69 -0
- package/dist/esm/utilities/vtkjs/OrientationControllerWidget/index.js +804 -0
- package/dist/esm/utilities/vtkjs/RhombicuboctahedronSource/index.d.ts +7 -0
- package/dist/esm/utilities/vtkjs/RhombicuboctahedronSource/index.js +144 -0
- package/dist/esm/utilities/vtkjs/index.d.ts +3 -0
- package/dist/esm/utilities/vtkjs/index.js +3 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +10 -9
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { getEnabledElement } from '@cornerstonejs/core';
|
|
2
2
|
export default function getTouchEventPoints(evt, element) {
|
|
3
3
|
const elementToUse = element || evt.currentTarget;
|
|
4
|
+
const { viewport } = getEnabledElement(elementToUse) || {};
|
|
5
|
+
if (!viewport) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
4
8
|
const touches = evt.type === 'touchend' ? evt.changedTouches : evt.touches;
|
|
5
|
-
return Object.keys(touches)
|
|
9
|
+
return Object.keys(touches)
|
|
10
|
+
.map((i) => {
|
|
6
11
|
const clientPoint = _clientToPoint(touches[i]);
|
|
7
12
|
const pagePoint = _pageToPoint(touches[i]);
|
|
8
13
|
const canvasPoint = _pagePointsToCanvasPoints(elementToUse, pagePoint);
|
|
9
|
-
const
|
|
10
|
-
|
|
14
|
+
const worldPoint = getWorldPoint(viewport, canvasPoint);
|
|
15
|
+
if (!worldPoint) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
11
18
|
return {
|
|
12
19
|
page: pagePoint,
|
|
13
20
|
client: clientPoint,
|
|
@@ -21,7 +28,8 @@ export default function getTouchEventPoints(evt, element) {
|
|
|
21
28
|
rotationAngle: touches[i].rotationAngle,
|
|
22
29
|
},
|
|
23
30
|
};
|
|
24
|
-
})
|
|
31
|
+
})
|
|
32
|
+
.filter(Boolean);
|
|
25
33
|
}
|
|
26
34
|
function _pagePointsToCanvasPoints(element, pagePoint) {
|
|
27
35
|
const rect = element.getBoundingClientRect();
|
|
@@ -36,3 +44,18 @@ function _pageToPoint(touch) {
|
|
|
36
44
|
function _clientToPoint(touch) {
|
|
37
45
|
return [touch.clientX, touch.clientY];
|
|
38
46
|
}
|
|
47
|
+
function getWorldPoint(viewport, canvasPoint) {
|
|
48
|
+
try {
|
|
49
|
+
return viewport.canvasToWorld(canvasPoint);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (isNoMountedDataError(error)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function isNoMountedDataError(error) {
|
|
59
|
+
return (error instanceof Error &&
|
|
60
|
+
error.message.includes('because no data is mounted'));
|
|
61
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getEnabledElement, triggerEvent } from '@cornerstonejs/core';
|
|
1
|
+
import { getEnabledElement, triggerEvent, utilities, } from '@cornerstonejs/core';
|
|
2
2
|
import Events from '../../enums/Events';
|
|
3
3
|
import { Swipe } from '../../enums/Touch';
|
|
4
4
|
import getTouchEventPoints from './getTouchEventPoints';
|
|
@@ -59,8 +59,8 @@ const defaultTapState = {
|
|
|
59
59
|
tapMaxDistance: 24,
|
|
60
60
|
tapToleranceMs: 300,
|
|
61
61
|
};
|
|
62
|
-
let state =
|
|
63
|
-
let tapState =
|
|
62
|
+
let state = utilities.deepClone(defaultState);
|
|
63
|
+
let tapState = utilities.deepClone(defaultTapState);
|
|
64
64
|
function triggerEventCallback(ele, name, eventDetail) {
|
|
65
65
|
return triggerEvent(ele, name, eventDetail);
|
|
66
66
|
}
|
|
@@ -194,7 +194,7 @@ function _onTouchEnd(evt) {
|
|
|
194
194
|
};
|
|
195
195
|
triggerEventCallback(eventDetail.element, TOUCH_END, eventDetail);
|
|
196
196
|
_checkTouchTap(evt);
|
|
197
|
-
state =
|
|
197
|
+
state = utilities.deepClone(defaultState);
|
|
198
198
|
document.removeEventListener('touchmove', _onTouchDrag);
|
|
199
199
|
document.removeEventListener('touchend', _onTouchEnd);
|
|
200
200
|
}
|
|
@@ -236,7 +236,7 @@ function _checkTouchTap(evt) {
|
|
|
236
236
|
taps: tapState.taps,
|
|
237
237
|
};
|
|
238
238
|
triggerEventCallback(eventDetail.element, TOUCH_TAP, eventDetail);
|
|
239
|
-
tapState =
|
|
239
|
+
tapState = utilities.deepClone(defaultTapState);
|
|
240
240
|
}, tapState.tapToleranceMs);
|
|
241
241
|
}
|
|
242
242
|
function _checkTouchSwipe(evt, deltaPoints) {
|
|
@@ -267,9 +267,22 @@ function _checkTouchSwipe(evt, deltaPoints) {
|
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
function _updateTouchEventsLastPoints(element, lastPoints) {
|
|
270
|
-
const { viewport } = getEnabledElement(element);
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
const { viewport } = getEnabledElement(element) || {};
|
|
271
|
+
if (!viewport) {
|
|
272
|
+
return lastPoints;
|
|
273
|
+
}
|
|
274
|
+
return lastPoints
|
|
275
|
+
.map((lp) => {
|
|
276
|
+
let world;
|
|
277
|
+
try {
|
|
278
|
+
world = viewport.canvasToWorld(lp.canvas);
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
if (isNoMountedDataError(error)) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
throw error;
|
|
285
|
+
}
|
|
273
286
|
return {
|
|
274
287
|
page: lp.page,
|
|
275
288
|
client: lp.client,
|
|
@@ -277,6 +290,11 @@ function _updateTouchEventsLastPoints(element, lastPoints) {
|
|
|
277
290
|
world,
|
|
278
291
|
touch: lp.touch,
|
|
279
292
|
};
|
|
280
|
-
})
|
|
293
|
+
})
|
|
294
|
+
.filter(Boolean);
|
|
295
|
+
}
|
|
296
|
+
function isNoMountedDataError(error) {
|
|
297
|
+
return (error instanceof Error &&
|
|
298
|
+
error.message.includes('because no data is mounted'));
|
|
281
299
|
}
|
|
282
300
|
export default touchStartListener;
|
|
@@ -9,6 +9,10 @@ function wheelListener(evt) {
|
|
|
9
9
|
if (evt.deltaY > -1 && evt.deltaY < 1) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
+
const points = getMouseEventPoints(evt);
|
|
13
|
+
if (!points) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
12
16
|
evt.preventDefault();
|
|
13
17
|
const { spinX, spinY, pixelX, pixelY } = normalizeWheel(evt);
|
|
14
18
|
const direction = spinY < 0 ? -1 : 1;
|
|
@@ -27,7 +31,7 @@ function wheelListener(evt) {
|
|
|
27
31
|
pixelY,
|
|
28
32
|
direction,
|
|
29
33
|
},
|
|
30
|
-
points
|
|
34
|
+
points,
|
|
31
35
|
};
|
|
32
36
|
triggerEvent(element, Events.MOUSE_WHEEL, eventDetail);
|
|
33
37
|
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import * as Types from './types';
|
|
|
12
12
|
import * as annotation from './stateManagement/annotation';
|
|
13
13
|
import * as segmentation from './stateManagement/segmentation';
|
|
14
14
|
import * as splines from './tools/annotation/splines';
|
|
15
|
-
import { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, VolumeCroppingTool, VolumeCroppingControlTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, SegmentBidirectionalTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, KeyImageTool, CrosshairsTool, ReferenceLinesTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, UltrasoundPleuraBLineTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, OverlayGridTool, SegmentationIntersectionTool, EraserTool, SculptorTool, SegmentSelectTool, WindowLevelRegionTool, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, SegmentLabelTool, LabelMapEditWithContourTool } from './tools';
|
|
15
|
+
import { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, VolumeCroppingTool, VolumeCroppingControlTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, SegmentBidirectionalTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, KeyImageTool, CrosshairsTool, ReferenceLinesTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, UltrasoundPleuraBLineTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, OrientationControllerTool, OverlayGridTool, SegmentationIntersectionTool, EraserTool, SculptorTool, SegmentSelectTool, WindowLevelRegionTool, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, SegmentLabelTool, LabelMapEditWithContourTool } from './tools';
|
|
16
16
|
import VideoRedactionTool from './tools/annotation/VideoRedactionTool';
|
|
17
17
|
import * as Enums from './enums';
|
|
18
|
-
export { VideoRedactionTool, init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, SegmentBidirectionalTool, TrackballRotateTool, VolumeCroppingTool, VolumeCroppingControlTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, ZoomTool, StackScrollTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, UltrasoundPleuraBLineTool, KeyImageTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ScaleOverlayTool, SculptorTool, EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, OrientationMarkerTool, SegmentSelectTool, SegmentLabelTool, synchronizers, Synchronizer, SynchronizerManager, PaintFillTool, Types, state, ToolGroupManager, store, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, LabelMapEditWithContourTool, splines, version, };
|
|
18
|
+
export { VideoRedactionTool, init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, SegmentBidirectionalTool, TrackballRotateTool, VolumeCroppingTool, VolumeCroppingControlTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, ZoomTool, StackScrollTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, UltrasoundPleuraBLineTool, KeyImageTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ScaleOverlayTool, SculptorTool, EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, OrientationMarkerTool, OrientationControllerTool, SegmentSelectTool, SegmentLabelTool, synchronizers, Synchronizer, SynchronizerManager, PaintFillTool, Types, state, ToolGroupManager, store, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, LabelMapEditWithContourTool, splines, version, };
|
package/dist/esm/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import * as Types from './types';
|
|
|
12
12
|
import * as annotation from './stateManagement/annotation';
|
|
13
13
|
import * as segmentation from './stateManagement/segmentation';
|
|
14
14
|
import * as splines from './tools/annotation/splines';
|
|
15
|
-
import { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, VolumeCroppingTool, VolumeCroppingControlTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, SegmentBidirectionalTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, KeyImageTool, CrosshairsTool, ReferenceLinesTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, UltrasoundPleuraBLineTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, OverlayGridTool, SegmentationIntersectionTool, EraserTool, SculptorTool, SegmentSelectTool, WindowLevelRegionTool, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, SegmentLabelTool, LabelMapEditWithContourTool, } from './tools';
|
|
15
|
+
import { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, VolumeCroppingTool, VolumeCroppingControlTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, SegmentBidirectionalTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, KeyImageTool, CrosshairsTool, ReferenceLinesTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, UltrasoundPleuraBLineTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, OrientationControllerTool, OverlayGridTool, SegmentationIntersectionTool, EraserTool, SculptorTool, SegmentSelectTool, WindowLevelRegionTool, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, SegmentLabelTool, LabelMapEditWithContourTool, } from './tools';
|
|
16
16
|
import VideoRedactionTool from './tools/annotation/VideoRedactionTool';
|
|
17
17
|
import * as Enums from './enums';
|
|
18
|
-
export { VideoRedactionTool, init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, SegmentBidirectionalTool, TrackballRotateTool, VolumeCroppingTool, VolumeCroppingControlTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, ZoomTool, StackScrollTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, UltrasoundPleuraBLineTool, KeyImageTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ScaleOverlayTool, SculptorTool, EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, OrientationMarkerTool, SegmentSelectTool, SegmentLabelTool, synchronizers, Synchronizer, SynchronizerManager, PaintFillTool, Types, state, ToolGroupManager, store, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, LabelMapEditWithContourTool, splines, version, };
|
|
18
|
+
export { VideoRedactionTool, init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, SegmentBidirectionalTool, TrackballRotateTool, VolumeCroppingTool, VolumeCroppingControlTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, ZoomTool, StackScrollTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, UltrasoundPleuraBLineTool, KeyImageTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ScaleOverlayTool, SculptorTool, EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, OrientationMarkerTool, OrientationControllerTool, SegmentSelectTool, SegmentLabelTool, synchronizers, Synchronizer, SynchronizerManager, PaintFillTool, Types, state, ToolGroupManager, store, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, LabelMapEditWithContourTool, splines, version, };
|
package/dist/esm/init.js
CHANGED
|
@@ -10,11 +10,13 @@ import { defaultSegmentationStateManager } from './stateManagement/segmentation/
|
|
|
10
10
|
import segmentationRepresentationModifiedListener from './eventListeners/segmentation/segmentationRepresentationModifiedListener';
|
|
11
11
|
import { setConfig } from './config';
|
|
12
12
|
import segmentationRemovedListener from './eventListeners/segmentation/segmentationRemovedEventListener';
|
|
13
|
+
import { registerBuiltInSegmentationRepresentationDisplays } from './tools/displayTools/registerBuiltInSegmentationRepresentationDisplays';
|
|
13
14
|
let csToolsInitialized = false;
|
|
14
15
|
export function init(defaultConfiguration = {}) {
|
|
15
16
|
if (csToolsInitialized) {
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
19
|
+
registerBuiltInSegmentationRepresentationDisplays();
|
|
18
20
|
setConfig(defaultConfiguration);
|
|
19
21
|
_addCornerstoneEventListeners();
|
|
20
22
|
_addCornerstoneToolsEventListeners();
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Enums, eventTarget, getEnabledElement, utilities, } from '@cornerstonejs/core';
|
|
2
|
+
function isUnsafeKey(key) {
|
|
3
|
+
return key === '__proto__' || key === 'constructor' || key === 'prototype';
|
|
4
|
+
}
|
|
2
5
|
class FrameOfReferenceSpecificAnnotationManager {
|
|
3
6
|
constructor(uid) {
|
|
4
7
|
this.getGroupKey = (annotationGroupSelector) => {
|
|
@@ -77,6 +80,9 @@ class FrameOfReferenceSpecificAnnotationManager {
|
|
|
77
80
|
const { metadata } = annotation;
|
|
78
81
|
const { FrameOfReferenceUID, toolName } = metadata;
|
|
79
82
|
groupKey = groupKey || FrameOfReferenceUID;
|
|
83
|
+
if (isUnsafeKey(groupKey) || isUnsafeKey(toolName)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
80
86
|
const annotations = this.annotations;
|
|
81
87
|
let frameOfReferenceSpecificAnnotations = annotations[groupKey];
|
|
82
88
|
if (!frameOfReferenceSpecificAnnotations) {
|
|
@@ -146,13 +152,13 @@ class FrameOfReferenceSpecificAnnotationManager {
|
|
|
146
152
|
return;
|
|
147
153
|
}
|
|
148
154
|
const toolSpecificAnnotations = frameOfReferenceSpecificAnnotations[toolName];
|
|
149
|
-
return
|
|
155
|
+
return utilities.deepClone(toolSpecificAnnotations);
|
|
150
156
|
}
|
|
151
157
|
else if (groupKey) {
|
|
152
158
|
const frameOfReferenceSpecificAnnotations = annotations[groupKey];
|
|
153
|
-
return
|
|
159
|
+
return utilities.deepClone(frameOfReferenceSpecificAnnotations);
|
|
154
160
|
}
|
|
155
|
-
return
|
|
161
|
+
return utilities.deepClone(annotations);
|
|
156
162
|
};
|
|
157
163
|
this.restoreAnnotations = (state, groupKey, toolName) => {
|
|
158
164
|
const annotations = this.annotations;
|
|
@@ -168,7 +174,7 @@ class FrameOfReferenceSpecificAnnotationManager {
|
|
|
168
174
|
annotations[groupKey] = state;
|
|
169
175
|
}
|
|
170
176
|
else {
|
|
171
|
-
this.annotations =
|
|
177
|
+
this.annotations = utilities.deepClone(state);
|
|
172
178
|
}
|
|
173
179
|
};
|
|
174
180
|
this.getAllAnnotations = () => {
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { triggerEvent, eventTarget, Enums, getRenderingEngines, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
2
2
|
import { SegmentationRepresentations, Events as csToolsEvents, } from '../../enums';
|
|
3
|
-
import Representations from '../../enums/SegmentationRepresentations';
|
|
4
3
|
import { getSegmentation } from './getSegmentation';
|
|
5
4
|
import { getSegmentationRepresentations } from './getSegmentationRepresentation';
|
|
6
|
-
import surfaceDisplay from '../../tools/displayTools/Surface/surfaceDisplay';
|
|
7
|
-
import contourDisplay from '../../tools/displayTools/Contour/contourDisplay';
|
|
8
|
-
import labelmapDisplay from '../../tools/displayTools/Labelmap/labelmapDisplay';
|
|
9
5
|
import { addTool } from '../../store/addTool';
|
|
10
6
|
import { state } from '../../store/state';
|
|
11
7
|
import PlanarFreehandContourSegmentationTool from '../../tools/annotation/PlanarFreehandContourSegmentationTool';
|
|
12
8
|
import { getToolGroupForViewport } from '../../store/ToolGroupManager';
|
|
13
9
|
import { addDefaultSegmentationListener } from './segmentationEventManager';
|
|
14
|
-
|
|
15
|
-
[Representations.Labelmap]: labelmapDisplay,
|
|
16
|
-
[Representations.Contour]: contourDisplay,
|
|
17
|
-
[Representations.Surface]: surfaceDisplay,
|
|
18
|
-
};
|
|
10
|
+
import { getSegmentationRepresentationDisplay } from './SegmentationRepresentationDisplayRegistry';
|
|
19
11
|
const planarContourToolName = PlanarFreehandContourSegmentationTool.toolName;
|
|
20
12
|
class SegmentationRenderingEngine {
|
|
21
13
|
constructor() {
|
|
@@ -108,22 +100,33 @@ class SegmentationRenderingEngine {
|
|
|
108
100
|
if (representation.type === SegmentationRepresentations.Contour) {
|
|
109
101
|
this._addPlanarFreeHandToolIfAbsent(viewport);
|
|
110
102
|
}
|
|
111
|
-
const display =
|
|
103
|
+
const display = getSegmentationRepresentationDisplay(representation.type);
|
|
112
104
|
const segmentation = getSegmentation(representation.segmentationId);
|
|
113
105
|
const existingRepresentation = segmentation.representationData[representation.type] !== undefined;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
106
|
+
if (!display) {
|
|
107
|
+
console.warn(`No display registered for segmentation representation type ${representation.type}.`);
|
|
108
|
+
return Promise.resolve({
|
|
109
|
+
segmentationId: representation.segmentationId,
|
|
110
|
+
type: representation.type,
|
|
119
111
|
});
|
|
120
112
|
}
|
|
121
|
-
|
|
113
|
+
return display
|
|
114
|
+
.render(viewport, representation)
|
|
115
|
+
.then(() => {
|
|
116
|
+
if (!existingRepresentation) {
|
|
117
|
+
addDefaultSegmentationListener(viewport, representation.segmentationId, representation.type);
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
segmentationId: representation.segmentationId,
|
|
121
|
+
type: representation.type,
|
|
122
|
+
};
|
|
123
|
+
})
|
|
124
|
+
.catch((error) => {
|
|
122
125
|
console.error(error);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
return {
|
|
127
|
+
segmentationId: representation.segmentationId,
|
|
128
|
+
type: representation.type,
|
|
129
|
+
};
|
|
127
130
|
});
|
|
128
131
|
});
|
|
129
132
|
Promise.allSettled(segmentationRenderList).then((results) => {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import type SegmentationRepresentations from '../../enums/SegmentationRepresentations';
|
|
3
|
+
import type { SegmentationRepresentation } from '../../types/SegmentationStateTypes';
|
|
4
|
+
type SegmentationRepresentationUpdateFunction = (segmentationId: string) => Promise<void>;
|
|
5
|
+
export type SegmentationRepresentationDisplay = {
|
|
6
|
+
getUpdateFunction: (viewport: Types.IVolumeViewport | Types.IStackViewport) => SegmentationRepresentationUpdateFunction | void | null;
|
|
7
|
+
render: (viewport: Types.IVolumeViewport | Types.IStackViewport, representation: SegmentationRepresentation) => Promise<void>;
|
|
8
|
+
removeRepresentation: (viewportId: string, segmentationId: string, renderImmediate?: boolean) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare function registerSegmentationRepresentationDisplay(representationType: SegmentationRepresentations, display: SegmentationRepresentationDisplay): void;
|
|
11
|
+
export declare function getSegmentationRepresentationDisplay(representationType: SegmentationRepresentations): SegmentationRepresentationDisplay | undefined;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const segmentationRepresentationDisplays = new Map();
|
|
2
|
+
export function registerSegmentationRepresentationDisplay(representationType, display) {
|
|
3
|
+
segmentationRepresentationDisplays.set(representationType, display);
|
|
4
|
+
}
|
|
5
|
+
export function getSegmentationRepresentationDisplay(representationType) {
|
|
6
|
+
return segmentationRepresentationDisplays.get(representationType);
|
|
7
|
+
}
|
|
@@ -4,8 +4,7 @@ import type { RenderingConfig, RepresentationsData, Segmentation, SegmentationRe
|
|
|
4
4
|
export default class SegmentationStateManager {
|
|
5
5
|
private state;
|
|
6
6
|
readonly uid: string;
|
|
7
|
-
private
|
|
8
|
-
private _labelmapImageIdReferenceMap;
|
|
7
|
+
private readonly labelmapImageReferenceResolver;
|
|
9
8
|
constructor(uid?: string);
|
|
10
9
|
getState(): Readonly<SegmentationState>;
|
|
11
10
|
private updateState;
|
|
@@ -20,9 +19,7 @@ export default class SegmentationStateManager {
|
|
|
20
19
|
private addDefaultSegmentationRepresentation;
|
|
21
20
|
addLabelmapRepresentation(state: SegmentationState, viewportId: string, segmentationId: string, renderingConfig?: RenderingConfig): void;
|
|
22
21
|
processLabelmapRepresentationAddition(viewportId: string, segmentationId: string): Promise<void>;
|
|
23
|
-
_updateLabelmapSegmentationReferences(segmentationId: any, viewport: any, labelmapImageIds: any, updateCallback: any): string | undefined;
|
|
24
22
|
updateLabelmapSegmentationImageReferences(viewportId: any, segmentationId: any): string;
|
|
25
|
-
_updateAllLabelmapSegmentationImageReferences(viewportId: any, segmentationId: any): void;
|
|
26
23
|
getLabelmapImageIds(representationData: RepresentationsData): any;
|
|
27
24
|
getLabelmapImageIdsForImageId(imageId: string, segmentationId: string): string[];
|
|
28
25
|
getCurrentLabelmapImageIdsForViewport(viewportId: string, segmentationId: string): string[] | undefined;
|
|
@@ -43,11 +40,6 @@ export default class SegmentationStateManager {
|
|
|
43
40
|
segmentationId: string;
|
|
44
41
|
type: SegmentationRepresentations;
|
|
45
42
|
}>;
|
|
46
|
-
_updateLabelmapImageIdReferenceMap({ segmentationId, referenceImageId, labelmapImageId, }: {
|
|
47
|
-
segmentationId: any;
|
|
48
|
-
referenceImageId: any;
|
|
49
|
-
labelmapImageId: any;
|
|
50
|
-
}): void;
|
|
51
43
|
_setActiveSegmentation(state: SegmentationState, viewportId: string, segmentationId: string): void;
|
|
52
44
|
setActiveSegmentation(viewportId: string, segmentationId: string): void;
|
|
53
45
|
getActiveSegmentation(viewportId: string): Segmentation | undefined;
|
|
@@ -78,7 +70,6 @@ export default class SegmentationStateManager {
|
|
|
78
70
|
viewportId: string;
|
|
79
71
|
representations: SegmentationRepresentation[];
|
|
80
72
|
}[];
|
|
81
|
-
private _generateMapKey;
|
|
82
73
|
}
|
|
83
74
|
declare function internalComputeVolumeLabelmapFromStack({ imageIds, options, }: {
|
|
84
75
|
imageIds: string[];
|