@cornerstonejs/tools 5.0.0-beta.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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.js +3 -4
- 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/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,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { Events, ChangeTypes } from '../../../enums';
|
|
2
3
|
import { getEnabledElement, utilities, metaData, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
3
4
|
import { AnnotationTool } from '../../base';
|
|
@@ -15,11 +16,6 @@ import { angleFromCenter, calculateInnerFanPercentage, clipInterval, intervalFro
|
|
|
15
16
|
import { calculateFanGeometry } from './utils/fanExtraction';
|
|
16
17
|
const { transformIndexToWorld } = utilities;
|
|
17
18
|
class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
18
|
-
static { this.toolName = 'UltrasoundPleuraBLineTool'; }
|
|
19
|
-
static { this.USPleuraBLineAnnotationType = {
|
|
20
|
-
BLINE: 'bLine',
|
|
21
|
-
PLEURA: 'pleura',
|
|
22
|
-
}; }
|
|
23
19
|
constructor(toolProps = {}, defaultToolProps = {
|
|
24
20
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
25
21
|
configuration: {
|
|
@@ -311,7 +307,7 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
311
307
|
const currentImageId = viewport.getCurrentImageId();
|
|
312
308
|
const unMergedPleuraIntervals = annotations
|
|
313
309
|
.filter((annotation) => annotation.data.annotationType ===
|
|
314
|
-
|
|
310
|
+
_a.USPleuraBLineAnnotationType.PLEURA &&
|
|
315
311
|
annotation.metadata.referencedImageId === currentImageId)
|
|
316
312
|
.map((annotation) => {
|
|
317
313
|
const canvasCoordinates = annotation.data.handles.points.map((p) => viewport.worldToCanvas(p));
|
|
@@ -364,7 +360,7 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
364
360
|
const lineInterval = intervalFromPoints(fanCenter, canvasCoordinates);
|
|
365
361
|
let fanNumber = 0;
|
|
366
362
|
if (annotation.data.annotationType ===
|
|
367
|
-
|
|
363
|
+
_a.USPleuraBLineAnnotationType.BLINE) {
|
|
368
364
|
const uncoveredIntervals = subtractIntervals(bLineIntervalsDisplayed, lineInterval);
|
|
369
365
|
uncoveredIntervals.forEach((interval) => {
|
|
370
366
|
const clippedIntervals = clipInterval(interval, mergedPleuraIntervals);
|
|
@@ -386,7 +382,7 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
386
382
|
});
|
|
387
383
|
}
|
|
388
384
|
else if (annotation.data.annotationType ===
|
|
389
|
-
|
|
385
|
+
_a.USPleuraBLineAnnotationType.PLEURA) {
|
|
390
386
|
const uncoveredIntervals = subtractIntervals(pleuraIntervalsDisplayed, lineInterval);
|
|
391
387
|
uncoveredIntervals.forEach((interval, index) => {
|
|
392
388
|
fanNumber++;
|
|
@@ -407,7 +403,7 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
407
403
|
}
|
|
408
404
|
};
|
|
409
405
|
const pleuraAnnotationsToDraw = annotations.filter((annotation) => annotation.data.annotationType ===
|
|
410
|
-
|
|
406
|
+
_a.USPleuraBLineAnnotationType.PLEURA &&
|
|
411
407
|
annotation.metadata.referencedImageId === currentImageId);
|
|
412
408
|
pleuraAnnotationsToDraw.forEach((annotation) => {
|
|
413
409
|
if (!viewport.getRenderingEngine()) {
|
|
@@ -417,7 +413,7 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
417
413
|
drawAnnotation(annotation);
|
|
418
414
|
});
|
|
419
415
|
const bLineAnnotationsToDraw = annotations.filter((annotation) => annotation.data.annotationType ===
|
|
420
|
-
|
|
416
|
+
_a.USPleuraBLineAnnotationType.BLINE &&
|
|
421
417
|
annotation.metadata.referencedImageId === currentImageId);
|
|
422
418
|
bLineAnnotationsToDraw.forEach((annotation) => {
|
|
423
419
|
if (!viewport.getRenderingEngine()) {
|
|
@@ -433,10 +429,10 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
433
429
|
return renderStatus;
|
|
434
430
|
};
|
|
435
431
|
this.activeAnnotationType =
|
|
436
|
-
|
|
432
|
+
_a.USPleuraBLineAnnotationType.BLINE;
|
|
437
433
|
}
|
|
438
434
|
static filterAnnotations(element, filterFunction = () => true) {
|
|
439
|
-
const annotations = getAnnotations(
|
|
435
|
+
const annotations = getAnnotations(_a.toolName, element);
|
|
440
436
|
if (!annotations?.length) {
|
|
441
437
|
return [];
|
|
442
438
|
}
|
|
@@ -447,7 +443,7 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
447
443
|
return filteredAnnotations;
|
|
448
444
|
}
|
|
449
445
|
static countAnnotations(element, filterFunction = () => true) {
|
|
450
|
-
const annotations = getAnnotations(
|
|
446
|
+
const annotations = getAnnotations(_a.toolName, element);
|
|
451
447
|
const { viewport } = getEnabledElement(element);
|
|
452
448
|
const imageIds = viewport.getImageIds();
|
|
453
449
|
const getImageIdIndex = (imageId) => {
|
|
@@ -479,11 +475,11 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
479
475
|
};
|
|
480
476
|
}
|
|
481
477
|
if (annotationType ===
|
|
482
|
-
|
|
478
|
+
_a.USPleuraBLineAnnotationType.PLEURA) {
|
|
483
479
|
counts.pleura++;
|
|
484
480
|
}
|
|
485
481
|
else if (annotationType ===
|
|
486
|
-
|
|
482
|
+
_a.USPleuraBLineAnnotationType.BLINE) {
|
|
487
483
|
counts.bLine++;
|
|
488
484
|
}
|
|
489
485
|
annotationMapping.set(currentImageId, counts);
|
|
@@ -491,7 +487,7 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
491
487
|
return annotationMapping;
|
|
492
488
|
}
|
|
493
489
|
static deleteAnnotations(element, filterFunction = () => false) {
|
|
494
|
-
const annotations = getAnnotations(
|
|
490
|
+
const annotations = getAnnotations(_a.toolName, element);
|
|
495
491
|
if (!annotations?.length) {
|
|
496
492
|
return;
|
|
497
493
|
}
|
|
@@ -510,50 +506,20 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
510
506
|
}
|
|
511
507
|
deleteLastAnnotationType(element, type) {
|
|
512
508
|
let annotationList;
|
|
513
|
-
const annotations = getAnnotations(
|
|
514
|
-
if (type ===
|
|
509
|
+
const annotations = getAnnotations(_a.toolName, element);
|
|
510
|
+
if (type === _a.USPleuraBLineAnnotationType.PLEURA) {
|
|
515
511
|
annotationList = annotations.filter((annotation) => annotation.data.annotationType ===
|
|
516
|
-
|
|
512
|
+
_a.USPleuraBLineAnnotationType.PLEURA);
|
|
517
513
|
}
|
|
518
|
-
else if (type ===
|
|
514
|
+
else if (type === _a.USPleuraBLineAnnotationType.BLINE) {
|
|
519
515
|
annotationList = annotations.filter((annotation) => annotation.data.annotationType ===
|
|
520
|
-
|
|
516
|
+
_a.USPleuraBLineAnnotationType.BLINE);
|
|
521
517
|
}
|
|
522
518
|
if (annotationList?.length > 0) {
|
|
523
519
|
const annotation = annotationList.pop();
|
|
524
520
|
removeAnnotation(annotation.annotationUID);
|
|
525
521
|
}
|
|
526
522
|
}
|
|
527
|
-
static { this.hydrate = (viewportId, points, options) => {
|
|
528
|
-
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
529
|
-
if (!enabledElement) {
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(UltrasoundPleuraBLineTool, enabledElement, points, options);
|
|
533
|
-
const { toolInstance, ...serializableOptions } = options || {};
|
|
534
|
-
const annotation = {
|
|
535
|
-
annotationUID: options?.annotationUID || utilities.uuidv4(),
|
|
536
|
-
data: {
|
|
537
|
-
handles: {
|
|
538
|
-
points,
|
|
539
|
-
},
|
|
540
|
-
},
|
|
541
|
-
highlighted: false,
|
|
542
|
-
autoGenerated: false,
|
|
543
|
-
invalidated: false,
|
|
544
|
-
isLocked: false,
|
|
545
|
-
isVisible: true,
|
|
546
|
-
metadata: {
|
|
547
|
-
toolName: instance.getToolName(),
|
|
548
|
-
viewPlaneNormal,
|
|
549
|
-
FrameOfReferenceUID,
|
|
550
|
-
referencedImageId,
|
|
551
|
-
...serializableOptions,
|
|
552
|
-
},
|
|
553
|
-
};
|
|
554
|
-
addAnnotation(annotation, viewport.element);
|
|
555
|
-
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
556
|
-
}; }
|
|
557
523
|
handleSelectedCallback(evt, annotation, handle) {
|
|
558
524
|
const eventDetail = evt.detail;
|
|
559
525
|
const { element } = eventDetail;
|
|
@@ -655,7 +621,7 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
655
621
|
const annotations = getAnnotations(this.getToolName(), element) || [];
|
|
656
622
|
const pleuraIntervals = annotations
|
|
657
623
|
.filter((annotation) => annotation.data.annotationType ===
|
|
658
|
-
|
|
624
|
+
_a.USPleuraBLineAnnotationType.PLEURA &&
|
|
659
625
|
annotation.metadata.referencedImageId === currentImageId)
|
|
660
626
|
.map((annotation) => {
|
|
661
627
|
const canvasCoordinates = annotation.data.handles.points.map((p) => viewport.worldToCanvas(p));
|
|
@@ -663,7 +629,7 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
663
629
|
});
|
|
664
630
|
const bLineIntervals = annotations
|
|
665
631
|
.filter((annotation) => annotation.data.annotationType ===
|
|
666
|
-
|
|
632
|
+
_a.USPleuraBLineAnnotationType.BLINE &&
|
|
667
633
|
annotation.metadata.referencedImageId === currentImageId)
|
|
668
634
|
.map((annotation) => {
|
|
669
635
|
const canvasCoordinates = annotation.data.handles.points.map((p) => viewport.worldToCanvas(p));
|
|
@@ -675,11 +641,11 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
675
641
|
const { annotationType } = annotation.data;
|
|
676
642
|
const { bLineColor, pleuraColor } = this.configuration;
|
|
677
643
|
if (annotationType ===
|
|
678
|
-
|
|
644
|
+
_a.USPleuraBLineAnnotationType.BLINE) {
|
|
679
645
|
return bLineColor;
|
|
680
646
|
}
|
|
681
647
|
if (annotationType ===
|
|
682
|
-
|
|
648
|
+
_a.USPleuraBLineAnnotationType.PLEURA) {
|
|
683
649
|
return pleuraColor;
|
|
684
650
|
}
|
|
685
651
|
return bLineColor;
|
|
@@ -746,6 +712,42 @@ class UltrasoundPleuraBLineTool extends AnnotationTool {
|
|
|
746
712
|
utilities.indexWithinDimensions(index2, dimensions));
|
|
747
713
|
}
|
|
748
714
|
}
|
|
715
|
+
_a = UltrasoundPleuraBLineTool;
|
|
716
|
+
UltrasoundPleuraBLineTool.toolName = 'UltrasoundPleuraBLineTool';
|
|
717
|
+
UltrasoundPleuraBLineTool.USPleuraBLineAnnotationType = {
|
|
718
|
+
BLINE: 'bLine',
|
|
719
|
+
PLEURA: 'pleura',
|
|
720
|
+
};
|
|
721
|
+
UltrasoundPleuraBLineTool.hydrate = (viewportId, points, options) => {
|
|
722
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
723
|
+
if (!enabledElement) {
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
|
|
727
|
+
const { toolInstance, ...serializableOptions } = options || {};
|
|
728
|
+
const annotation = {
|
|
729
|
+
annotationUID: options?.annotationUID || utilities.uuidv4(),
|
|
730
|
+
data: {
|
|
731
|
+
handles: {
|
|
732
|
+
points,
|
|
733
|
+
},
|
|
734
|
+
},
|
|
735
|
+
highlighted: false,
|
|
736
|
+
autoGenerated: false,
|
|
737
|
+
invalidated: false,
|
|
738
|
+
isLocked: false,
|
|
739
|
+
isVisible: true,
|
|
740
|
+
metadata: {
|
|
741
|
+
toolName: instance.getToolName(),
|
|
742
|
+
viewPlaneNormal,
|
|
743
|
+
FrameOfReferenceUID,
|
|
744
|
+
referencedImageId,
|
|
745
|
+
...serializableOptions,
|
|
746
|
+
},
|
|
747
|
+
};
|
|
748
|
+
addAnnotation(annotation, viewport.element);
|
|
749
|
+
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
750
|
+
};
|
|
749
751
|
function defaultGetTextLines(data, targetId) {
|
|
750
752
|
return [''];
|
|
751
753
|
}
|
|
@@ -12,7 +12,6 @@ import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCur
|
|
|
12
12
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
13
13
|
import getWorldWidthAndHeightFromTwoPoints from '../../utilities/planar/getWorldWidthAndHeightFromTwoPoints';
|
|
14
14
|
class VideoRedactionTool extends AnnotationTool {
|
|
15
|
-
static { this.toolName = 'VideoRedaction'; }
|
|
16
15
|
constructor(toolConfiguration = {}) {
|
|
17
16
|
super(toolConfiguration, {
|
|
18
17
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
@@ -443,4 +442,5 @@ class VideoRedactionTool extends AnnotationTool {
|
|
|
443
442
|
return `stackTarget:${viewport.uid}`;
|
|
444
443
|
}
|
|
445
444
|
}
|
|
445
|
+
VideoRedactionTool.toolName = 'VideoRedaction';
|
|
446
446
|
export default VideoRedactionTool;
|
|
@@ -3,6 +3,7 @@ import BaseTool from './BaseTool';
|
|
|
3
3
|
import { getAnnotationManager } from '../../stateManagement/annotation/annotationState';
|
|
4
4
|
import triggerAnnotationRender from '../../utilities/triggerAnnotationRender';
|
|
5
5
|
import filterAnnotationsForDisplay from '../../utilities/planar/filterAnnotationsForDisplay';
|
|
6
|
+
import getViewportICamera from '../../utilities/getViewportICamera';
|
|
6
7
|
import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
|
|
7
8
|
import { getState } from '../../stateManagement/annotation/config';
|
|
8
9
|
class AnnotationDisplayTool extends BaseTool {
|
|
@@ -81,17 +82,19 @@ class AnnotationDisplayTool extends BaseTool {
|
|
|
81
82
|
const { world: worldPos } = currentPoints;
|
|
82
83
|
const enabledElement = getEnabledElement(element);
|
|
83
84
|
const { viewport } = enabledElement;
|
|
84
|
-
const camera = viewport.getCamera();
|
|
85
|
-
const { viewPlaneNormal, viewUp, position: cameraPosition } = camera;
|
|
86
|
-
const referencedImageId = this.getReferencedImageId(viewport, worldPos, viewPlaneNormal, viewUp);
|
|
87
85
|
const viewReference = viewport.getViewReference({ points: [worldPos] });
|
|
86
|
+
const { viewPlaneNormal, viewUp, position: cameraPosition, } = getViewportICamera(viewport, viewReference);
|
|
87
|
+
const referencedImageId = viewReference.referencedImageId ||
|
|
88
|
+
(viewPlaneNormal
|
|
89
|
+
? this.getReferencedImageId(viewport, worldPos, viewPlaneNormal, viewUp)
|
|
90
|
+
: undefined);
|
|
88
91
|
const annotation = AnnotationDisplayTool.createAnnotation({
|
|
89
92
|
metadata: {
|
|
90
93
|
toolName: this.getToolName(),
|
|
91
94
|
...viewReference,
|
|
92
|
-
referencedImageId,
|
|
93
|
-
viewUp,
|
|
94
|
-
cameraPosition,
|
|
95
|
+
...(referencedImageId ? { referencedImageId } : {}),
|
|
96
|
+
...(viewUp ? { viewUp } : {}),
|
|
97
|
+
...(cameraPosition ? { cameraPosition } : {}),
|
|
95
98
|
},
|
|
96
99
|
data: {
|
|
97
100
|
handles: {
|
|
@@ -11,6 +11,7 @@ import ChangeTypes from '../../enums/ChangeTypes';
|
|
|
11
11
|
import { setAnnotationSelected } from '../../stateManagement/annotation/annotationSelection';
|
|
12
12
|
import { addContourSegmentationAnnotation } from '../../utilities/contourSegmentation';
|
|
13
13
|
import { safeStructuredClone } from '../../utilities/safeStructuredClone';
|
|
14
|
+
import getViewportICamera from '../../utilities/getViewportICamera';
|
|
14
15
|
const { DefaultHistoryMemo } = csUtils.HistoryMemo;
|
|
15
16
|
class AnnotationTool extends AnnotationDisplayTool {
|
|
16
17
|
static createAnnotationForViewport(viewport, ...annotationBaseData) {
|
|
@@ -291,7 +292,7 @@ class AnnotationTool extends AnnotationDisplayTool {
|
|
|
291
292
|
}
|
|
292
293
|
const { viewport } = enabledElement;
|
|
293
294
|
const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
|
|
294
|
-
const camera = viewport
|
|
295
|
+
const camera = getViewportICamera(viewport);
|
|
295
296
|
const viewPlaneNormal = options.viewplaneNormal ?? camera.viewPlaneNormal;
|
|
296
297
|
const viewUp = options.viewUp ?? camera.viewUp;
|
|
297
298
|
const instance = options.toolInstance || new ToolClass();
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import { utilities as csUtils } from '@cornerstonejs/core';
|
|
1
|
+
import { utilities as csUtils, viewportHasPan, viewportHasZoom, } from '@cornerstonejs/core';
|
|
2
2
|
import ToolModes from '../../enums/ToolModes';
|
|
3
3
|
const { DefaultHistoryMemo } = csUtils.HistoryMemo;
|
|
4
4
|
class BaseTool {
|
|
5
5
|
get configurationTyped() {
|
|
6
6
|
return this.configuration;
|
|
7
7
|
}
|
|
8
|
-
static { this.defaults = {
|
|
9
|
-
configuration: {
|
|
10
|
-
strategies: {},
|
|
11
|
-
defaultStrategy: undefined,
|
|
12
|
-
activeStrategy: undefined,
|
|
13
|
-
strategyOptions: {},
|
|
14
|
-
},
|
|
15
|
-
}; }
|
|
16
8
|
constructor(toolProps, defaultToolProps) {
|
|
17
9
|
this.isPrimary = false;
|
|
18
10
|
const mergedDefaults = BaseTool.mergeDefaultProps(BaseTool.defaults, defaultToolProps);
|
|
@@ -116,6 +108,9 @@ class BaseTool {
|
|
|
116
108
|
DefaultHistoryMemo.redo();
|
|
117
109
|
}
|
|
118
110
|
static createZoomPanMemo(viewport) {
|
|
111
|
+
if (!viewportHasPan(viewport) || !viewportHasZoom(viewport)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
119
114
|
const state = {
|
|
120
115
|
pan: viewport.getPan(),
|
|
121
116
|
zoom: viewport.getZoom(),
|
|
@@ -124,9 +119,12 @@ class BaseTool {
|
|
|
124
119
|
restoreMemo: () => {
|
|
125
120
|
const currentPan = viewport.getPan();
|
|
126
121
|
const currentZoom = viewport.getZoom();
|
|
122
|
+
const renderableViewport = viewport;
|
|
127
123
|
viewport.setZoom(state.zoom);
|
|
128
124
|
viewport.setPan(state.pan);
|
|
129
|
-
|
|
125
|
+
if (typeof renderableViewport.render === 'function') {
|
|
126
|
+
renderableViewport.render();
|
|
127
|
+
}
|
|
130
128
|
state.pan = currentPan;
|
|
131
129
|
state.zoom = currentZoom;
|
|
132
130
|
},
|
|
@@ -174,5 +172,13 @@ class BaseTool {
|
|
|
174
172
|
return true;
|
|
175
173
|
}
|
|
176
174
|
}
|
|
175
|
+
BaseTool.defaults = {
|
|
176
|
+
configuration: {
|
|
177
|
+
strategies: {},
|
|
178
|
+
defaultStrategy: undefined,
|
|
179
|
+
activeStrategy: undefined,
|
|
180
|
+
strategyOptions: {},
|
|
181
|
+
},
|
|
182
|
+
};
|
|
177
183
|
BaseTool.toolName = 'BaseTool';
|
|
178
184
|
export default BaseTool;
|
|
@@ -14,7 +14,6 @@ import { getLockedSegmentIndices } from '../../stateManagement/segmentation/segm
|
|
|
14
14
|
import { getSVGStyleForSegment } from '../../utilities/segmentation/getSVGStyleForSegment';
|
|
15
15
|
import { defaultSegmentationStateManager } from '../../stateManagement/segmentation/SegmentationStateManager';
|
|
16
16
|
class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
17
|
-
static { this.PreviewSegmentIndex = 255; }
|
|
18
17
|
constructor(toolProps, defaultToolProps) {
|
|
19
18
|
super(toolProps, defaultToolProps);
|
|
20
19
|
if (this.configuration.interpolation?.enabled) {
|
|
@@ -163,4 +162,5 @@ class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
|
163
162
|
};
|
|
164
163
|
}
|
|
165
164
|
}
|
|
165
|
+
ContourSegmentationBaseTool.PreviewSegmentIndex = 255;
|
|
166
166
|
export { ContourSegmentationBaseTool as default, ContourSegmentationBaseTool };
|
|
@@ -10,7 +10,6 @@ import { getOrCreateSegmentationVolume } from '../../utilities/segmentation';
|
|
|
10
10
|
import { getCurrentLabelmapImageIdForViewport } from '../../stateManagement/segmentation/getCurrentLabelmapImageIdForViewport';
|
|
11
11
|
const { transformWorldToIndex, transformIndexToWorld } = csUtils;
|
|
12
12
|
class GrowCutBaseTool extends BaseTool {
|
|
13
|
-
static { this.lastGrowCutCommand = null; }
|
|
14
13
|
constructor(toolProps, defaultToolProps) {
|
|
15
14
|
const baseToolProps = csUtils.deepMerge({
|
|
16
15
|
configuration: {
|
|
@@ -209,7 +208,7 @@ class GrowCutBaseTool extends BaseTool {
|
|
|
209
208
|
const derivedVolume = new ImageVolume({
|
|
210
209
|
volumeId,
|
|
211
210
|
dataType: volumeProps.dataType,
|
|
212
|
-
metadata:
|
|
211
|
+
metadata: csUtils.deepClone(volumeProps.metadata),
|
|
213
212
|
dimensions: volumeProps.dimensions,
|
|
214
213
|
spacing: volumeProps.spacing,
|
|
215
214
|
origin: volumeProps.origin,
|
|
@@ -276,5 +275,6 @@ class GrowCutBaseTool extends BaseTool {
|
|
|
276
275
|
});
|
|
277
276
|
}
|
|
278
277
|
}
|
|
278
|
+
GrowCutBaseTool.lastGrowCutCommand = null;
|
|
279
279
|
GrowCutBaseTool.toolName = 'GrowCutBaseTool';
|
|
280
280
|
export default GrowCutBaseTool;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { LabelmapSegmentationData } from '../../../types/LabelmapTypes';
|
|
2
2
|
import type { LabelmapRenderingConfig } from '../../../types/SegmentationStateTypes';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
actor: any;
|
|
6
|
-
}>;
|
|
3
|
+
import { type LabelmapRenderPlanMountResult } from './labelmapRenderPlan';
|
|
4
|
+
declare function addLabelmapToElement(element: HTMLDivElement, labelMapData: LabelmapSegmentationData, segmentationId: string, config: LabelmapRenderingConfig): Promise<LabelmapRenderPlanMountResult>;
|
|
7
5
|
export default addLabelmapToElement;
|
|
@@ -1,91 +1,21 @@
|
|
|
1
|
-
import { getEnabledElement
|
|
2
|
-
import { getCurrentLabelmapImageIdsForViewport } from '../../../stateManagement/segmentation/getCurrentLabelmapImageIdForViewport';
|
|
1
|
+
import { getEnabledElement } from '@cornerstonejs/core';
|
|
3
2
|
import { getSegmentation } from '../../../stateManagement/segmentation/getSegmentation';
|
|
4
|
-
import {
|
|
5
|
-
import { SegmentationRepresentations } from '../../../enums';
|
|
6
|
-
import { addVolumesAsIndependentComponents } from './addVolumesAsIndependentComponents';
|
|
7
|
-
const { uuidv4 } = utilities;
|
|
3
|
+
import { resolveLabelmapRenderPlan, } from './labelmapRenderPlan';
|
|
8
4
|
async function addLabelmapToElement(element, labelMapData, segmentationId, config) {
|
|
9
5
|
const enabledElement = getEnabledElement(element);
|
|
10
|
-
const {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const suppressEvents = true;
|
|
15
|
-
if (viewport instanceof BaseVolumeViewport) {
|
|
16
|
-
const volumeLabelMapData = labelMapData;
|
|
17
|
-
const volumeId = _ensureVolumeHasVolumeId(volumeLabelMapData, segmentationId);
|
|
18
|
-
if (!cache.getVolume(volumeId)) {
|
|
19
|
-
await _handleMissingVolume(labelMapData);
|
|
20
|
-
}
|
|
21
|
-
let blendMode = config?.blendMode ?? Enums.BlendModes.MAXIMUM_INTENSITY_BLEND;
|
|
22
|
-
let useIndependentComponents = blendMode === Enums.BlendModes.LABELMAP_EDGE_PROJECTION_BLEND;
|
|
23
|
-
if (useIndependentComponents) {
|
|
24
|
-
const referenceVolumeId = viewport.getVolumeId();
|
|
25
|
-
const baseVolume = cache.getVolume(referenceVolumeId);
|
|
26
|
-
const segVolume = cache.getVolume(volumeId);
|
|
27
|
-
const segDims = segVolume.dimensions;
|
|
28
|
-
const refDims = baseVolume.dimensions;
|
|
29
|
-
if (segDims[0] !== refDims[0] ||
|
|
30
|
-
segDims[1] !== refDims[1] ||
|
|
31
|
-
segDims[2] !== refDims[2]) {
|
|
32
|
-
useIndependentComponents = false;
|
|
33
|
-
blendMode = Enums.BlendModes.MAXIMUM_INTENSITY_BLEND;
|
|
34
|
-
console.debug('Dimensions mismatch - falling back to regular volume addition');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const volumeInputs = [
|
|
38
|
-
{
|
|
39
|
-
volumeId,
|
|
40
|
-
visibility,
|
|
41
|
-
representationUID: `${segmentationId}-${SegmentationRepresentations.Labelmap}`,
|
|
42
|
-
useIndependentComponents,
|
|
43
|
-
blendMode,
|
|
44
|
-
},
|
|
45
|
-
];
|
|
46
|
-
if (!volumeInputs[0].useIndependentComponents) {
|
|
47
|
-
await addVolumesToViewports(renderingEngine, volumeInputs, [viewportId], immediateRender, suppressEvents);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
const result = await addVolumesAsIndependentComponents({
|
|
51
|
-
viewport,
|
|
52
|
-
volumeInputs,
|
|
53
|
-
segmentationId,
|
|
54
|
-
});
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
6
|
+
const { viewport } = enabledElement;
|
|
7
|
+
const segmentation = getSegmentation(segmentationId);
|
|
8
|
+
if (!segmentation) {
|
|
9
|
+
return;
|
|
57
10
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
function _ensureVolumeHasVolumeId(labelMapData, segmentationId) {
|
|
69
|
-
let { volumeId } = labelMapData;
|
|
70
|
-
if (!volumeId) {
|
|
71
|
-
volumeId = uuidv4();
|
|
72
|
-
const segmentation = getSegmentation(segmentationId);
|
|
73
|
-
segmentation.representationData.Labelmap = {
|
|
74
|
-
...segmentation.representationData.Labelmap,
|
|
75
|
-
volumeId,
|
|
76
|
-
};
|
|
77
|
-
labelMapData.volumeId = volumeId;
|
|
78
|
-
triggerSegmentationModified(segmentationId);
|
|
79
|
-
}
|
|
80
|
-
return volumeId;
|
|
81
|
-
}
|
|
82
|
-
async function _handleMissingVolume(labelMapData) {
|
|
83
|
-
const stackData = labelMapData;
|
|
84
|
-
const hasImageIds = stackData.imageIds.length > 0;
|
|
85
|
-
if (!hasImageIds) {
|
|
86
|
-
throw new Error('cannot create labelmap, no imageIds found for the volume labelmap');
|
|
87
|
-
}
|
|
88
|
-
const volume = await volumeLoader.createAndCacheVolumeFromImages(labelMapData.volumeId || uuidv4(), stackData.imageIds);
|
|
89
|
-
return volume;
|
|
11
|
+
const renderPlan = resolveLabelmapRenderPlan({
|
|
12
|
+
viewport,
|
|
13
|
+
segmentation,
|
|
14
|
+
representation: {
|
|
15
|
+
segmentationId,
|
|
16
|
+
config,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
return renderPlan.mount({ labelMapData });
|
|
90
20
|
}
|
|
91
21
|
export default addLabelmapToElement;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Types } from '@cornerstonejs/core';
|
|
2
|
+
import type { LabelmapRepresentation } from '../../../types/SegmentationStateTypes';
|
|
3
|
+
declare const MAX_NUMBER_COLORS = 255;
|
|
4
|
+
declare function setLabelmapColorAndOpacity(viewportId: string, labelmapActorEntry: Types.ActorEntry, segmentationRepresentation: LabelmapRepresentation): void;
|
|
5
|
+
export { MAX_NUMBER_COLORS, setLabelmapColorAndOpacity };
|