@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,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { utilities as csUtils, getEnabledElementByViewportId, volumeLoader, } from '@cornerstonejs/core';
|
|
2
2
|
import { SegmentationRepresentations } from '../../enums';
|
|
3
3
|
import vtkColorTransferFunction from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction';
|
|
4
4
|
import vtkPiecewiseFunction from '@kitware/vtk.js/Common/DataModel/PiecewiseFunction';
|
|
5
|
+
import getViewportLabelmapRenderMode from './helpers/getViewportLabelmapRenderMode';
|
|
5
6
|
import { triggerSegmentationModified, triggerSegmentationRemoved, triggerSegmentationRepresentationModified, triggerSegmentationRepresentationRemoved, } from './triggerSegmentationEvents';
|
|
6
7
|
import { segmentationStyle } from './SegmentationStyle';
|
|
7
8
|
import { triggerSegmentationAdded } from './events/triggerSegmentationAdded';
|
|
9
|
+
import { ensureLabelmapState, LabelmapImageReferenceResolver, syncLegacyLabelmapData, } from './labelmapModel';
|
|
8
10
|
const initialDefaultState = {
|
|
9
11
|
colorLUT: [],
|
|
10
12
|
segmentations: [],
|
|
@@ -12,11 +14,10 @@ const initialDefaultState = {
|
|
|
12
14
|
};
|
|
13
15
|
export default class SegmentationStateManager {
|
|
14
16
|
constructor(uid) {
|
|
15
|
-
this._stackLabelmapImageIdReferenceMap = new Map();
|
|
16
|
-
this._labelmapImageIdReferenceMap = new Map();
|
|
17
17
|
uid ||= csUtils.uuidv4();
|
|
18
18
|
this.state = Object.freeze(csUtils.deepClone(initialDefaultState));
|
|
19
19
|
this.uid = uid;
|
|
20
|
+
this.labelmapImageReferenceResolver = new LabelmapImageReferenceResolver(this.getSegmentation.bind(this));
|
|
20
21
|
}
|
|
21
22
|
getState() {
|
|
22
23
|
return this.state;
|
|
@@ -33,8 +34,7 @@ export default class SegmentationStateManager {
|
|
|
33
34
|
return this.state.colorLUT.length;
|
|
34
35
|
}
|
|
35
36
|
resetState() {
|
|
36
|
-
this.
|
|
37
|
-
this._labelmapImageIdReferenceMap.clear();
|
|
37
|
+
this.labelmapImageReferenceResolver.reset();
|
|
38
38
|
this.state = Object.freeze(csUtils.deepClone(initialDefaultState));
|
|
39
39
|
}
|
|
40
40
|
getSegmentation(segmentationId) {
|
|
@@ -48,6 +48,10 @@ export default class SegmentationStateManager {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
Object.assign(segmentation, payload);
|
|
51
|
+
if (segmentation.representationData?.Labelmap) {
|
|
52
|
+
ensureLabelmapState(segmentation);
|
|
53
|
+
syncLegacyLabelmapData(segmentation);
|
|
54
|
+
}
|
|
51
55
|
});
|
|
52
56
|
triggerSegmentationModified(segmentationId);
|
|
53
57
|
}
|
|
@@ -57,9 +61,12 @@ export default class SegmentationStateManager {
|
|
|
57
61
|
}
|
|
58
62
|
this.updateState((state) => {
|
|
59
63
|
const newSegmentation = csUtils.deepClone(segmentation);
|
|
60
|
-
if (newSegmentation.representationData
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
if (newSegmentation.representationData?.Labelmap) {
|
|
65
|
+
ensureLabelmapState(newSegmentation);
|
|
66
|
+
syncLegacyLabelmapData(newSegmentation);
|
|
67
|
+
}
|
|
68
|
+
const labelmapData = newSegmentation.representationData.Labelmap;
|
|
69
|
+
if (labelmapData?.volumeId && !('imageIds' in labelmapData)) {
|
|
63
70
|
const imageIds = this.getLabelmapImageIds(newSegmentation.representationData);
|
|
64
71
|
newSegmentation.representationData
|
|
65
72
|
.Labelmap.imageIds = imageIds;
|
|
@@ -69,6 +76,7 @@ export default class SegmentationStateManager {
|
|
|
69
76
|
triggerSegmentationAdded(segmentation.segmentationId);
|
|
70
77
|
}
|
|
71
78
|
removeSegmentation(segmentationId) {
|
|
79
|
+
this.labelmapImageReferenceResolver.removeSegmentation(segmentationId);
|
|
72
80
|
this.updateState((state) => {
|
|
73
81
|
const filteredSegmentations = state.segmentations.filter((segmentation) => segmentation.segmentationId !== segmentationId);
|
|
74
82
|
state.segmentations.splice(0, state.segmentations.length, ...filteredSegmentations);
|
|
@@ -86,6 +94,7 @@ export default class SegmentationStateManager {
|
|
|
86
94
|
});
|
|
87
95
|
if (existingRepresentations.length > 0) {
|
|
88
96
|
console.debug('A segmentation representation of type', type, 'already exists in viewport', viewportId, 'for segmentation', segmentationId);
|
|
97
|
+
triggerSegmentationRepresentationModified(viewportId, segmentationId, type);
|
|
89
98
|
return;
|
|
90
99
|
}
|
|
91
100
|
this.updateState((state) => {
|
|
@@ -152,148 +161,30 @@ export default class SegmentationStateManager {
|
|
|
152
161
|
if (!segmentation) {
|
|
153
162
|
return;
|
|
154
163
|
}
|
|
155
|
-
const volumeViewport = enabledElement.viewport
|
|
164
|
+
const volumeViewport = getViewportLabelmapRenderMode(enabledElement.viewport) === 'volume';
|
|
156
165
|
const { representationData } = segmentation;
|
|
157
|
-
const isBaseVolumeSegmentation =
|
|
158
|
-
const viewport = enabledElement.viewport;
|
|
166
|
+
const isBaseVolumeSegmentation = !!representationData.Labelmap.volumeId;
|
|
159
167
|
if (!volumeViewport && !isBaseVolumeSegmentation) {
|
|
160
168
|
!this.updateLabelmapSegmentationImageReferences(viewportId, segmentation.segmentationId);
|
|
161
169
|
}
|
|
162
170
|
}
|
|
163
|
-
_updateLabelmapSegmentationReferences(segmentationId, viewport, labelmapImageIds, updateCallback) {
|
|
164
|
-
const referenceImageId = viewport.getCurrentImageId();
|
|
165
|
-
let viewableLabelmapImageIdFound = false;
|
|
166
|
-
for (const labelmapImageId of labelmapImageIds) {
|
|
167
|
-
const viewableImageId = viewport.isReferenceViewable({ referencedImageId: labelmapImageId }, { asOverlay: true });
|
|
168
|
-
if (viewableImageId) {
|
|
169
|
-
viewableLabelmapImageIdFound = true;
|
|
170
|
-
this._stackLabelmapImageIdReferenceMap
|
|
171
|
-
.get(segmentationId)
|
|
172
|
-
.set(referenceImageId, labelmapImageId);
|
|
173
|
-
this._updateLabelmapImageIdReferenceMap({
|
|
174
|
-
segmentationId,
|
|
175
|
-
referenceImageId,
|
|
176
|
-
labelmapImageId,
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
if (updateCallback) {
|
|
181
|
-
updateCallback(viewport, segmentationId, labelmapImageIds);
|
|
182
|
-
}
|
|
183
|
-
return viewableLabelmapImageIdFound
|
|
184
|
-
? this._stackLabelmapImageIdReferenceMap
|
|
185
|
-
.get(segmentationId)
|
|
186
|
-
.get(referenceImageId)
|
|
187
|
-
: undefined;
|
|
188
|
-
}
|
|
189
171
|
updateLabelmapSegmentationImageReferences(viewportId, segmentationId) {
|
|
190
|
-
|
|
191
|
-
if (!segmentation) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
if (!this._stackLabelmapImageIdReferenceMap.has(segmentationId)) {
|
|
195
|
-
this._stackLabelmapImageIdReferenceMap.set(segmentationId, new Map());
|
|
196
|
-
}
|
|
197
|
-
const { representationData } = segmentation;
|
|
198
|
-
if (!representationData.Labelmap) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
const labelmapImageIds = this.getLabelmapImageIds(representationData);
|
|
202
|
-
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
203
|
-
const stackViewport = enabledElement.viewport;
|
|
204
|
-
return this._updateLabelmapSegmentationReferences(segmentationId, stackViewport, labelmapImageIds, null);
|
|
205
|
-
}
|
|
206
|
-
_updateAllLabelmapSegmentationImageReferences(viewportId, segmentationId) {
|
|
207
|
-
const segmentation = this.getSegmentation(segmentationId);
|
|
208
|
-
if (!segmentation) {
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
if (!this._stackLabelmapImageIdReferenceMap.has(segmentationId)) {
|
|
212
|
-
this._stackLabelmapImageIdReferenceMap.set(segmentationId, new Map());
|
|
213
|
-
}
|
|
214
|
-
const { representationData } = segmentation;
|
|
215
|
-
if (!representationData.Labelmap) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
const labelmapImageIds = this.getLabelmapImageIds(representationData);
|
|
219
|
-
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
220
|
-
const stackViewport = enabledElement.viewport;
|
|
221
|
-
this._updateLabelmapSegmentationReferences(segmentationId, stackViewport, labelmapImageIds, (stackViewport, segmentationId, labelmapImageIds) => {
|
|
222
|
-
const imageIds = stackViewport.getImageIds();
|
|
223
|
-
imageIds.forEach((referenceImageId, index) => {
|
|
224
|
-
for (const labelmapImageId of labelmapImageIds) {
|
|
225
|
-
const viewableImageId = stackViewport.isReferenceViewable({ referencedImageId: labelmapImageId, sliceIndex: index }, { asOverlay: true, withNavigation: true });
|
|
226
|
-
if (viewableImageId) {
|
|
227
|
-
this._stackLabelmapImageIdReferenceMap
|
|
228
|
-
.get(segmentationId)
|
|
229
|
-
.set(referenceImageId, labelmapImageId);
|
|
230
|
-
this._updateLabelmapImageIdReferenceMap({
|
|
231
|
-
segmentationId,
|
|
232
|
-
referenceImageId,
|
|
233
|
-
labelmapImageId,
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
});
|
|
172
|
+
return this.labelmapImageReferenceResolver.updateLabelmapSegmentationImageReferences(viewportId, segmentationId);
|
|
239
173
|
}
|
|
240
174
|
getLabelmapImageIds(representationData) {
|
|
241
|
-
|
|
242
|
-
let labelmapImageIds;
|
|
243
|
-
if (labelmapData.imageIds) {
|
|
244
|
-
labelmapImageIds = labelmapData
|
|
245
|
-
.imageIds;
|
|
246
|
-
}
|
|
247
|
-
else if (!labelmapImageIds &&
|
|
248
|
-
labelmapData.volumeId) {
|
|
249
|
-
const volumeId = labelmapData
|
|
250
|
-
.volumeId;
|
|
251
|
-
const volume = cache.getVolume(volumeId);
|
|
252
|
-
labelmapImageIds = volume.imageIds;
|
|
253
|
-
}
|
|
254
|
-
return labelmapImageIds;
|
|
175
|
+
return this.labelmapImageReferenceResolver.getLabelmapImageIds(representationData);
|
|
255
176
|
}
|
|
256
177
|
getLabelmapImageIdsForImageId(imageId, segmentationId) {
|
|
257
|
-
|
|
258
|
-
segmentationId,
|
|
259
|
-
referenceImageId: imageId,
|
|
260
|
-
});
|
|
261
|
-
return this._labelmapImageIdReferenceMap.get(key);
|
|
178
|
+
return this.labelmapImageReferenceResolver.getLabelmapImageIdsForImageId(imageId, segmentationId);
|
|
262
179
|
}
|
|
263
180
|
getCurrentLabelmapImageIdsForViewport(viewportId, segmentationId) {
|
|
264
|
-
|
|
265
|
-
if (!enabledElement) {
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
const stackViewport = enabledElement.viewport;
|
|
269
|
-
const referenceImageId = stackViewport.getCurrentImageId();
|
|
270
|
-
return this.getLabelmapImageIdsForImageId(referenceImageId, segmentationId);
|
|
181
|
+
return this.labelmapImageReferenceResolver.getCurrentLabelmapImageIdsForViewport(viewportId, segmentationId);
|
|
271
182
|
}
|
|
272
183
|
getCurrentLabelmapImageIdForViewport(viewportId, segmentationId) {
|
|
273
|
-
|
|
274
|
-
if (!enabledElement) {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
if (!this._stackLabelmapImageIdReferenceMap.has(segmentationId)) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
const stackViewport = enabledElement.viewport;
|
|
281
|
-
const currentImageId = stackViewport.getCurrentImageId();
|
|
282
|
-
const imageIdReferenceMap = this._stackLabelmapImageIdReferenceMap.get(segmentationId);
|
|
283
|
-
return imageIdReferenceMap.get(currentImageId);
|
|
184
|
+
return this.labelmapImageReferenceResolver.getCurrentLabelmapImageIdForViewport(viewportId, segmentationId);
|
|
284
185
|
}
|
|
285
186
|
getStackSegmentationImageIdsForViewport(viewportId, segmentationId) {
|
|
286
|
-
|
|
287
|
-
if (!segmentation) {
|
|
288
|
-
return [];
|
|
289
|
-
}
|
|
290
|
-
this._updateAllLabelmapSegmentationImageReferences(viewportId, segmentationId);
|
|
291
|
-
const { viewport } = getEnabledElementByViewportId(viewportId);
|
|
292
|
-
const imageIds = viewport.getImageIds();
|
|
293
|
-
const associatedReferenceImageAndLabelmapImageIds = this._stackLabelmapImageIdReferenceMap.get(segmentationId);
|
|
294
|
-
return imageIds.map((imageId) => {
|
|
295
|
-
return associatedReferenceImageAndLabelmapImageIds.get(imageId);
|
|
296
|
-
});
|
|
187
|
+
return this.labelmapImageReferenceResolver.getStackSegmentationImageIdsForViewport(viewportId, segmentationId);
|
|
297
188
|
}
|
|
298
189
|
removeSegmentationRepresentationsInternal(viewportId, specifier) {
|
|
299
190
|
const removedRepresentations = [];
|
|
@@ -359,16 +250,6 @@ export default class SegmentationStateManager {
|
|
|
359
250
|
}
|
|
360
251
|
return removedRepresentations;
|
|
361
252
|
}
|
|
362
|
-
_updateLabelmapImageIdReferenceMap({ segmentationId, referenceImageId, labelmapImageId, }) {
|
|
363
|
-
const key = this._generateMapKey({ segmentationId, referenceImageId });
|
|
364
|
-
if (!this._labelmapImageIdReferenceMap.has(key)) {
|
|
365
|
-
this._labelmapImageIdReferenceMap.set(key, [labelmapImageId]);
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
const currentValues = this._labelmapImageIdReferenceMap.get(key);
|
|
369
|
-
const newValues = Array.from(new Set([...currentValues, labelmapImageId]));
|
|
370
|
-
this._labelmapImageIdReferenceMap.set(key, newValues);
|
|
371
|
-
}
|
|
372
253
|
_setActiveSegmentation(state, viewportId, segmentationId) {
|
|
373
254
|
const viewport = state.viewportSegRepresentations[viewportId];
|
|
374
255
|
if (!viewport) {
|
|
@@ -427,13 +308,14 @@ export default class SegmentationStateManager {
|
|
|
427
308
|
}
|
|
428
309
|
setSegmentationRepresentationVisibility(viewportId, specifier, visible) {
|
|
429
310
|
this.updateState((state) => {
|
|
430
|
-
const viewportRepresentations =
|
|
311
|
+
const viewportRepresentations = state.viewportSegRepresentations[viewportId]?.filter((representation) => representation.segmentationId === specifier.segmentationId &&
|
|
312
|
+
representation.type === specifier.type);
|
|
431
313
|
if (!viewportRepresentations) {
|
|
432
314
|
return;
|
|
433
315
|
}
|
|
434
316
|
viewportRepresentations.forEach((representation) => {
|
|
435
317
|
representation.visible = visible;
|
|
436
|
-
Object.
|
|
318
|
+
Object.values(representation.segments).forEach((segment) => {
|
|
437
319
|
segment.visible = visible;
|
|
438
320
|
});
|
|
439
321
|
});
|
|
@@ -474,9 +356,6 @@ export default class SegmentationStateManager {
|
|
|
474
356
|
});
|
|
475
357
|
return result;
|
|
476
358
|
}
|
|
477
|
-
_generateMapKey({ segmentationId, referenceImageId }) {
|
|
478
|
-
return `${segmentationId}-${referenceImageId}`;
|
|
479
|
-
}
|
|
480
359
|
}
|
|
481
360
|
async function internalComputeVolumeLabelmapFromStack({ imageIds, options, }) {
|
|
482
361
|
const segmentationImageIds = imageIds;
|
|
@@ -2,6 +2,8 @@ import { utilities } from '@cornerstonejs/core';
|
|
|
2
2
|
import { defaultSegmentationStateManager } from './SegmentationStateManager';
|
|
3
3
|
import { getNextColorLUTIndex } from './getNextColorLUTIndex';
|
|
4
4
|
import CORNERSTONE_COLOR_LUT from '../../constants/COLOR_LUT';
|
|
5
|
+
const PREVIEW_COLOR_INDEX = 255;
|
|
6
|
+
const MINIMUM_COLOR_LUT_ENTRIES = PREVIEW_COLOR_INDEX + 1;
|
|
5
7
|
export function addColorLUT(colorLUT, index) {
|
|
6
8
|
const segmentationStateManager = defaultSegmentationStateManager;
|
|
7
9
|
const indexToUse = index ?? getNextColorLUTIndex();
|
|
@@ -16,10 +18,14 @@ export function addColorLUT(colorLUT, index) {
|
|
|
16
18
|
}
|
|
17
19
|
return color;
|
|
18
20
|
});
|
|
19
|
-
if (colorLUTToUse.length <
|
|
21
|
+
if (colorLUTToUse.length < MINIMUM_COLOR_LUT_ENTRIES) {
|
|
20
22
|
const missingColorLUTs = CORNERSTONE_COLOR_LUT.slice(colorLUTToUse.length);
|
|
21
23
|
colorLUTToUse = [...colorLUTToUse, ...missingColorLUTs];
|
|
22
24
|
}
|
|
25
|
+
while (colorLUTToUse.length < MINIMUM_COLOR_LUT_ENTRIES) {
|
|
26
|
+
const paletteIndex = ((colorLUTToUse.length - 1) % (CORNERSTONE_COLOR_LUT.length - 1)) + 1;
|
|
27
|
+
colorLUTToUse.push([...CORNERSTONE_COLOR_LUT[paletteIndex]]);
|
|
28
|
+
}
|
|
23
29
|
segmentationStateManager.addColorLUT(colorLUTToUse, indexToUse);
|
|
24
30
|
return indexToUse;
|
|
25
31
|
}
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { defaultSegmentationStateManager } from './SegmentationStateManager';
|
|
2
|
+
import { getSegmentation } from './getSegmentation';
|
|
3
|
+
import { getActiveSegmentIndex } from './getActiveSegmentIndex';
|
|
4
|
+
import { getLabelmapForSegment } from './helpers/labelmapSegmentationState';
|
|
2
5
|
export function getCurrentLabelmapImageIdForViewport(viewportId, segmentationId) {
|
|
3
6
|
const imageIds = getCurrentLabelmapImageIdsForViewport(viewportId, segmentationId);
|
|
4
7
|
if (!imageIds?.length) {
|
|
5
8
|
return;
|
|
6
9
|
}
|
|
7
|
-
|
|
10
|
+
if (imageIds.length === 1) {
|
|
11
|
+
return imageIds[0];
|
|
12
|
+
}
|
|
13
|
+
const segmentation = getSegmentation(segmentationId);
|
|
14
|
+
const activeSegmentIndex = getActiveSegmentIndex(segmentationId);
|
|
15
|
+
const activeLayer = activeSegmentIndex
|
|
16
|
+
? getLabelmapForSegment(segmentation, activeSegmentIndex)
|
|
17
|
+
: undefined;
|
|
18
|
+
if (!activeLayer?.imageIds?.length) {
|
|
19
|
+
return imageIds[0];
|
|
20
|
+
}
|
|
21
|
+
return (imageIds.find((imageId) => activeLayer.imageIds.includes(imageId)) ??
|
|
22
|
+
imageIds[0]);
|
|
8
23
|
}
|
|
9
24
|
export function getCurrentLabelmapImageIdsForViewport(viewportId, segmentationId) {
|
|
10
25
|
const segmentationStateManager = defaultSegmentationStateManager;
|
|
@@ -2,16 +2,17 @@ import { cache, utilities } from '@cornerstonejs/core';
|
|
|
2
2
|
import { getSegmentation } from '../getSegmentation';
|
|
3
3
|
import { triggerSegmentationDataModified } from '../triggerSegmentationEvents';
|
|
4
4
|
import { createLabelmapMemo } from '../../../utilities/segmentation/createLabelmapMemo';
|
|
5
|
+
import { getSegmentBinding, getLabelmapForSegment, removeSegmentBinding, } from './labelmapSegmentationState';
|
|
5
6
|
const { DefaultHistoryMemo } = utilities.HistoryMemo;
|
|
6
7
|
export function clearSegmentValue(segmentationId, segmentIndex, options) {
|
|
7
8
|
const segmentation = getSegmentation(segmentationId);
|
|
8
9
|
if (segmentation.representationData.Labelmap) {
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
const items =
|
|
13
|
-
?
|
|
14
|
-
: [cache.
|
|
10
|
+
const binding = getSegmentBinding(segmentation, segmentIndex);
|
|
11
|
+
const layer = getLabelmapForSegment(segmentation, segmentIndex);
|
|
12
|
+
if (binding && layer) {
|
|
13
|
+
const items = layer.volumeId
|
|
14
|
+
? [cache.getVolume(layer.volumeId)]
|
|
15
|
+
: (layer.imageIds ?? []).map((imageId) => cache.getImage(imageId));
|
|
15
16
|
items.forEach((item) => {
|
|
16
17
|
if (!item) {
|
|
17
18
|
return;
|
|
@@ -22,7 +23,7 @@ export function clearSegmentValue(segmentationId, segmentIndex, options) {
|
|
|
22
23
|
: null;
|
|
23
24
|
const useVoxelManager = memo?.voxelManager ?? voxelManager;
|
|
24
25
|
voxelManager.forEach(({ value, index }) => {
|
|
25
|
-
if (value ===
|
|
26
|
+
if (value === binding.labelValue) {
|
|
26
27
|
useVoxelManager.setAtIndex(index, 0);
|
|
27
28
|
}
|
|
28
29
|
});
|
|
@@ -30,6 +31,7 @@ export function clearSegmentValue(segmentationId, segmentIndex, options) {
|
|
|
30
31
|
DefaultHistoryMemo.push(memo);
|
|
31
32
|
}
|
|
32
33
|
});
|
|
34
|
+
removeSegmentBinding(segmentation, segmentIndex);
|
|
33
35
|
}
|
|
34
36
|
triggerSegmentationDataModified(segmentationId);
|
|
35
37
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
2
|
export declare function getLabelmapActorUID(viewportId: string, segmentationId: string): string | undefined;
|
|
3
3
|
export declare function getLabelmapActorEntries(viewportId: string, segmentationId: string): Types.ActorEntry[];
|
|
4
|
-
export declare function getLabelmapActorEntry(viewportId: string, segmentationId: string): Types.ActorEntry;
|
|
4
|
+
export declare function getLabelmapActorEntry(viewportId: string, segmentationId: string, referencedId?: string): Types.ActorEntry;
|
|
5
5
|
export declare function getSurfaceActorEntry(viewportId: string, segmentationId: string, segmentIndex?: number | string): Types.ActorEntry;
|
|
6
6
|
export declare function getSurfaceRepresentationUID(segmentationId: string, segmentIndex?: number | string): string;
|
|
@@ -33,8 +33,9 @@ export function getLabelmapActorUID(viewportId, segmentationId) {
|
|
|
33
33
|
export function getLabelmapActorEntries(viewportId, segmentationId) {
|
|
34
34
|
return getActorEntries(viewportId, (actor) => actor.representationUID?.startsWith(`${segmentationId}-${SegmentationRepresentations.Labelmap}`));
|
|
35
35
|
}
|
|
36
|
-
export function getLabelmapActorEntry(viewportId, segmentationId) {
|
|
37
|
-
return getActorEntry(viewportId, segmentationId, (actor) => actor.representationUID?.startsWith(`${segmentationId}-${SegmentationRepresentations.Labelmap}`)
|
|
36
|
+
export function getLabelmapActorEntry(viewportId, segmentationId, referencedId) {
|
|
37
|
+
return getActorEntry(viewportId, segmentationId, (actor) => actor.representationUID?.startsWith(`${segmentationId}-${SegmentationRepresentations.Labelmap}`) &&
|
|
38
|
+
(!referencedId || actor.referencedId === referencedId));
|
|
38
39
|
}
|
|
39
40
|
export function getSurfaceActorEntry(viewportId, segmentationId, segmentIndex) {
|
|
40
41
|
return getActorEntry(viewportId, segmentationId, (actor) => actor.representationUID ===
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Types } from '@cornerstonejs/core';
|
|
2
|
+
export type ViewportLabelmapRenderMode = 'image' | 'volume' | 'unsupported';
|
|
3
|
+
export default function getViewportLabelmapRenderMode(viewport: Types.IViewport, options?: {
|
|
4
|
+
useSliceRendering?: boolean;
|
|
5
|
+
}): ViewportLabelmapRenderMode;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ActorRenderMode, BaseVolumeViewport, StackViewport, Enums, } from '@cornerstonejs/core';
|
|
2
|
+
import { canRenderVolumeViewportLabelmapAsImage, isSliceRenderingEnabled, } from './labelmapImageMapperSupport';
|
|
3
|
+
export default function getViewportLabelmapRenderMode(viewport, options) {
|
|
4
|
+
const compatibilityViewport = viewport;
|
|
5
|
+
const useSliceRendering = isSliceRenderingEnabled(options);
|
|
6
|
+
if (useSliceRendering && canRenderVolumeViewportLabelmapAsImage(viewport)) {
|
|
7
|
+
return 'image';
|
|
8
|
+
}
|
|
9
|
+
if (viewport instanceof BaseVolumeViewport) {
|
|
10
|
+
return 'volume';
|
|
11
|
+
}
|
|
12
|
+
if (viewport instanceof StackViewport) {
|
|
13
|
+
return 'image';
|
|
14
|
+
}
|
|
15
|
+
const defaultActor = typeof compatibilityViewport.getDefaultActor === 'function'
|
|
16
|
+
? compatibilityViewport.getDefaultActor()
|
|
17
|
+
: undefined;
|
|
18
|
+
const actorMapper = defaultActor?.actorMapper;
|
|
19
|
+
const renderMode = actorMapper?.renderMode;
|
|
20
|
+
if (renderMode === ActorRenderMode.VTK_VOLUME ||
|
|
21
|
+
renderMode === ActorRenderMode.VTK_VOLUME_SLICE) {
|
|
22
|
+
return 'volume';
|
|
23
|
+
}
|
|
24
|
+
if (renderMode === ActorRenderMode.CPU_VOLUME) {
|
|
25
|
+
return 'volume';
|
|
26
|
+
}
|
|
27
|
+
if (renderMode === ActorRenderMode.VTK_IMAGE ||
|
|
28
|
+
renderMode === ActorRenderMode.CPU_IMAGE) {
|
|
29
|
+
return 'image';
|
|
30
|
+
}
|
|
31
|
+
const actorClassName = typeof defaultActor?.actor?.getClassName === 'function'
|
|
32
|
+
? defaultActor.actor.getClassName()
|
|
33
|
+
: undefined;
|
|
34
|
+
if (actorClassName === 'vtkVolume') {
|
|
35
|
+
return 'volume';
|
|
36
|
+
}
|
|
37
|
+
if (actorClassName === 'vtkImageSlice') {
|
|
38
|
+
return 'image';
|
|
39
|
+
}
|
|
40
|
+
if (actorClassName === 'CanvasActor') {
|
|
41
|
+
const defaultActorRenderMode = actorMapper?.renderMode;
|
|
42
|
+
if (defaultActorRenderMode === ActorRenderMode.CPU_VOLUME) {
|
|
43
|
+
return 'volume';
|
|
44
|
+
}
|
|
45
|
+
return 'image';
|
|
46
|
+
}
|
|
47
|
+
if (compatibilityViewport.type === Enums.ViewportType.PLANAR_NEXT) {
|
|
48
|
+
if (compatibilityViewport.getVolumeId?.()) {
|
|
49
|
+
return 'volume';
|
|
50
|
+
}
|
|
51
|
+
return typeof compatibilityViewport.getCurrentImageId === 'function'
|
|
52
|
+
? 'image'
|
|
53
|
+
: 'unsupported';
|
|
54
|
+
}
|
|
55
|
+
return typeof compatibilityViewport.getCurrentImageId === 'function'
|
|
56
|
+
? 'image'
|
|
57
|
+
: 'unsupported';
|
|
58
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Enums, type Types } from '@cornerstonejs/core';
|
|
2
|
+
import type { Segmentation } from '../../../types/SegmentationStateTypes';
|
|
3
|
+
declare const DIRECTION_ALIGNMENT_TOLERANCE = 0.999;
|
|
4
|
+
export declare const LABELMAP_IMAGE_MAPPER_URL_PARAM = "labelmapImageMapper";
|
|
5
|
+
export type VolumeViewportLabelmapImageMapperState = {
|
|
6
|
+
key: string;
|
|
7
|
+
sliceIndex: number;
|
|
8
|
+
supported: boolean;
|
|
9
|
+
};
|
|
10
|
+
type ViewportLabelmapImageMapperCompatibilityViewport = Types.IViewport & {
|
|
11
|
+
getCamera?: () => Pick<Types.ICamera, 'viewPlaneNormal' | 'viewUp'>;
|
|
12
|
+
getCurrentImageIdIndex?: () => number;
|
|
13
|
+
getDisplaySetRenderMode?: (displaySetId: string) => Types.ActorRenderMode | string | undefined;
|
|
14
|
+
getDisplaySetRole?: (displaySetId: string) => 'source' | 'overlay' | undefined;
|
|
15
|
+
getDisplaySetPresentation?: (dataId: string) => {
|
|
16
|
+
blendMode?: Enums.BlendModes;
|
|
17
|
+
slabThickness?: number;
|
|
18
|
+
};
|
|
19
|
+
getDefaultActor?: () => (Types.ActorEntry & {
|
|
20
|
+
actorMapper?: {
|
|
21
|
+
actor?: {
|
|
22
|
+
getMapper?: () => {
|
|
23
|
+
getBlendMode?: () => Enums.BlendModes;
|
|
24
|
+
getSlabThickness?: () => number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
mapper?: {
|
|
28
|
+
getBlendMode?: () => Enums.BlendModes;
|
|
29
|
+
getSlabThickness?: () => number;
|
|
30
|
+
};
|
|
31
|
+
renderMode?: Types.ActorRenderMode;
|
|
32
|
+
};
|
|
33
|
+
}) | undefined;
|
|
34
|
+
getSliceViewInfo?: () => {
|
|
35
|
+
sliceIndex: number;
|
|
36
|
+
};
|
|
37
|
+
getSourceDataId?: () => string | undefined;
|
|
38
|
+
getVolumeId?: () => string | undefined;
|
|
39
|
+
getResolvedView?: () => {
|
|
40
|
+
toICamera?: () => Pick<Types.ICamera, 'viewPlaneNormal' | 'viewUp'>;
|
|
41
|
+
} | undefined;
|
|
42
|
+
type?: string;
|
|
43
|
+
};
|
|
44
|
+
export declare function isSliceRenderingEnabled(options?: {
|
|
45
|
+
useSliceRendering?: boolean;
|
|
46
|
+
}): boolean;
|
|
47
|
+
export declare function shouldUseSliceRendering(segmentation?: Segmentation, options?: {
|
|
48
|
+
useSliceRendering?: boolean;
|
|
49
|
+
}): boolean;
|
|
50
|
+
export declare function canRenderVolumeViewportLabelmapAsImage(viewport: Types.IViewport): viewport is ViewportLabelmapImageMapperCompatibilityViewport;
|
|
51
|
+
export declare function getVolumeViewportLabelmapImageMapperState(viewport: Types.IViewport): VolumeViewportLabelmapImageMapperState;
|
|
52
|
+
export { DIRECTION_ALIGNMENT_TOLERANCE };
|