@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
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { addVolumesToViewports, Enums, cache, volumeLoader, utilities, } from '@cornerstonejs/core';
|
|
2
|
+
import { triggerSegmentationDataModified, triggerSegmentationModified, } from '../../../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
3
|
+
import { getLabelmaps, getOrCreateLabelmapVolume, } from '../../../../stateManagement/segmentation/helpers/labelmapSegmentationState';
|
|
4
|
+
import { addVolumesAsIndependentComponents } from '../addVolumesAsIndependentComponents';
|
|
5
|
+
import { createLabelmapRepresentationUID } from '../labelmapRepresentationUID';
|
|
6
|
+
import { createLabelmapRenderPlan } from './createLabelmapRenderPlan';
|
|
7
|
+
import { addLabelmapToPlanarGenericViewport, isPlanarNextVolumeViewport, } from './planarGenericVolumeLabelmap';
|
|
8
|
+
const { uuidv4 } = utilities;
|
|
9
|
+
function createLegacyVolumeLabelmapPlan({ config, isVolumeImageMapper, renderMode, segmentation, segmentationId, useSliceRendering, viewport, }) {
|
|
10
|
+
return createLabelmapRenderPlan({
|
|
11
|
+
isVolumeImageMapper,
|
|
12
|
+
kind: 'legacy-volume',
|
|
13
|
+
renderMode,
|
|
14
|
+
segmentationId,
|
|
15
|
+
useSliceRendering,
|
|
16
|
+
viewport,
|
|
17
|
+
getExpectedRepresentationUIDs: () => getExpectedVolumeLabelmapRepresentationUIDs(segmentation, segmentationId),
|
|
18
|
+
mount: ({ labelMapData }) => mountLegacyVolumeLabelmap({
|
|
19
|
+
config,
|
|
20
|
+
labelMapData,
|
|
21
|
+
segmentation,
|
|
22
|
+
segmentationId,
|
|
23
|
+
viewport,
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function getExpectedVolumeLabelmapRepresentationUIDs(segmentation, segmentationId) {
|
|
28
|
+
return getLabelmaps(segmentation)
|
|
29
|
+
.filter(canResolveLayerAsVolume)
|
|
30
|
+
.map((layer) => createLabelmapRepresentationUID({
|
|
31
|
+
segmentationId,
|
|
32
|
+
referencedId: layer.labelmapId,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
async function mountLegacyVolumeLabelmap({ config, labelMapData, segmentation, segmentationId, viewport, }) {
|
|
36
|
+
const { id: viewportId } = viewport;
|
|
37
|
+
const visibility = true;
|
|
38
|
+
const immediateRender = false;
|
|
39
|
+
const suppressEvents = true;
|
|
40
|
+
const volumeCompatibleViewport = viewport;
|
|
41
|
+
const labelmapLayers = getVolumeBackedLabelmapLayers(segmentation);
|
|
42
|
+
if (!labelmapLayers.length) {
|
|
43
|
+
const volumeLabelMapData = labelMapData;
|
|
44
|
+
const volumeId = ensureVolumeHasVolumeId(volumeLabelMapData, segmentation);
|
|
45
|
+
if (!cache.getVolume(volumeId)) {
|
|
46
|
+
await handleMissingVolume(labelMapData);
|
|
47
|
+
}
|
|
48
|
+
labelmapLayers.push({
|
|
49
|
+
labelmapId: volumeId,
|
|
50
|
+
type: 'volume',
|
|
51
|
+
volumeId,
|
|
52
|
+
imageIds: cache.getVolume(volumeId)?.imageIds,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
let blendMode = config?.blendMode ?? Enums.BlendModes.MAXIMUM_INTENSITY_BLEND;
|
|
56
|
+
let useIndependentComponents = blendMode === Enums.BlendModes.LABELMAP_EDGE_PROJECTION_BLEND;
|
|
57
|
+
if (useIndependentComponents) {
|
|
58
|
+
const referenceVolumeId = volumeCompatibleViewport.getVolumeId?.();
|
|
59
|
+
const baseVolume = cache.getVolume(referenceVolumeId);
|
|
60
|
+
const segVolume = cache.getVolume(labelmapLayers[0]?.volumeId);
|
|
61
|
+
const segDims = segVolume.dimensions;
|
|
62
|
+
const refDims = baseVolume.dimensions;
|
|
63
|
+
if (segDims[0] !== refDims[0] ||
|
|
64
|
+
segDims[1] !== refDims[1] ||
|
|
65
|
+
segDims[2] !== refDims[2]) {
|
|
66
|
+
useIndependentComponents = false;
|
|
67
|
+
blendMode = Enums.BlendModes.MAXIMUM_INTENSITY_BLEND;
|
|
68
|
+
console.debug('Dimensions mismatch - falling back to regular volume addition');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const volumeInputs = labelmapLayers.map((layer) => ({
|
|
72
|
+
volumeId: layer.volumeId,
|
|
73
|
+
visibility,
|
|
74
|
+
representationUID: createLabelmapRepresentationUID({
|
|
75
|
+
segmentationId,
|
|
76
|
+
referencedId: layer.labelmapId,
|
|
77
|
+
}),
|
|
78
|
+
useIndependentComponents,
|
|
79
|
+
blendMode,
|
|
80
|
+
}));
|
|
81
|
+
if (isPlanarNextVolumeViewport(viewport)) {
|
|
82
|
+
return addLabelmapToPlanarGenericViewport({
|
|
83
|
+
blendMode,
|
|
84
|
+
labelmapLayers,
|
|
85
|
+
segmentationId,
|
|
86
|
+
viewport,
|
|
87
|
+
visibility,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (!volumeInputs[0].useIndependentComponents) {
|
|
91
|
+
await addVolumesToViewports(viewport.getRenderingEngine(), volumeInputs, [viewportId], immediateRender, suppressEvents);
|
|
92
|
+
triggerSegmentationDataModified(segmentationId);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
return addVolumesAsIndependentComponents({
|
|
96
|
+
viewport: volumeCompatibleViewport,
|
|
97
|
+
volumeInputs,
|
|
98
|
+
segmentationId,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function canResolveLayerAsVolume(layer) {
|
|
102
|
+
return Boolean(layer.volumeId || layer.geometryVolumeId || layer.imageIds?.length);
|
|
103
|
+
}
|
|
104
|
+
function getVolumeBackedLabelmapLayers(segmentation) {
|
|
105
|
+
return getLabelmaps(segmentation)
|
|
106
|
+
.map((layer) => {
|
|
107
|
+
if (layer.volumeId) {
|
|
108
|
+
return layer;
|
|
109
|
+
}
|
|
110
|
+
const volume = getOrCreateLabelmapVolume(layer);
|
|
111
|
+
if (!volume?.volumeId) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
...layer,
|
|
116
|
+
volumeId: volume.volumeId,
|
|
117
|
+
};
|
|
118
|
+
})
|
|
119
|
+
.filter((layer) => Boolean(layer));
|
|
120
|
+
}
|
|
121
|
+
function ensureVolumeHasVolumeId(labelMapData, segmentation) {
|
|
122
|
+
let { volumeId } = labelMapData;
|
|
123
|
+
if (!volumeId) {
|
|
124
|
+
volumeId = uuidv4();
|
|
125
|
+
segmentation.representationData.Labelmap = {
|
|
126
|
+
...segmentation.representationData.Labelmap,
|
|
127
|
+
volumeId,
|
|
128
|
+
};
|
|
129
|
+
labelMapData.volumeId = volumeId;
|
|
130
|
+
triggerSegmentationModified(segmentation.segmentationId);
|
|
131
|
+
}
|
|
132
|
+
return volumeId;
|
|
133
|
+
}
|
|
134
|
+
async function handleMissingVolume(labelMapData) {
|
|
135
|
+
const stackData = labelMapData;
|
|
136
|
+
const hasImageIds = stackData.imageIds.length > 0;
|
|
137
|
+
if (!hasImageIds) {
|
|
138
|
+
throw new Error('cannot create labelmap, no imageIds found for the volume labelmap');
|
|
139
|
+
}
|
|
140
|
+
const volume = await volumeLoader.createAndCacheVolumeFromImages(labelMapData.volumeId ?? uuidv4(), stackData.imageIds);
|
|
141
|
+
return volume;
|
|
142
|
+
}
|
|
143
|
+
export { createLegacyVolumeLabelmapPlan };
|
package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/planarGenericVolumeLabelmap.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Types, Enums } from '@cornerstonejs/core';
|
|
2
|
+
import type { LabelmapRenderPlanMountResult } from './types';
|
|
3
|
+
type PlanarNextVolumeViewport = Types.IViewport & {
|
|
4
|
+
getCurrentImageIdIndex?: () => number;
|
|
5
|
+
getDefaultActor?: () => (Types.ActorEntry & {
|
|
6
|
+
actorMapper?: {
|
|
7
|
+
renderMode?: Types.ActorRenderMode;
|
|
8
|
+
};
|
|
9
|
+
}) | undefined;
|
|
10
|
+
getVolumeId: () => string | undefined;
|
|
11
|
+
getViewReference: (specifier?: Types.ViewReferenceSpecifier) => Types.ViewReference;
|
|
12
|
+
getViewState: () => {
|
|
13
|
+
orientation?: unknown;
|
|
14
|
+
};
|
|
15
|
+
getActors?: () => Types.ActorEntry[];
|
|
16
|
+
render?: () => void;
|
|
17
|
+
addDisplaySet: (displaySetId: string, options: {
|
|
18
|
+
orientation?: unknown;
|
|
19
|
+
role?: 'source' | 'overlay';
|
|
20
|
+
}) => Promise<void>;
|
|
21
|
+
setDisplaySetPresentation: (dataId: string, props: {
|
|
22
|
+
blendMode?: Enums.BlendModes;
|
|
23
|
+
visible?: boolean;
|
|
24
|
+
}) => void;
|
|
25
|
+
setViewReference: (viewReference: Types.ViewReference) => void;
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
declare function isPlanarNextVolumeViewport(viewport: Types.IViewport): viewport is PlanarNextVolumeViewport;
|
|
29
|
+
declare function addLabelmapToPlanarGenericViewport(args: {
|
|
30
|
+
blendMode: Enums.BlendModes;
|
|
31
|
+
labelmapLayers: Array<{
|
|
32
|
+
imageIds?: string[];
|
|
33
|
+
labelmapId: string;
|
|
34
|
+
volumeId?: string;
|
|
35
|
+
}>;
|
|
36
|
+
segmentationId: string;
|
|
37
|
+
viewport: PlanarNextVolumeViewport;
|
|
38
|
+
visibility: boolean;
|
|
39
|
+
}): Promise<LabelmapRenderPlanMountResult>;
|
|
40
|
+
export { addLabelmapToPlanarGenericViewport, isPlanarNextVolumeViewport, type PlanarNextVolumeViewport, };
|
package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/planarGenericVolumeLabelmap.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ActorRenderMode, Enums, cache, utilities, } from '@cornerstonejs/core';
|
|
2
|
+
import { createLabelmapRepresentationUID } from '../labelmapRepresentationUID';
|
|
3
|
+
function isPlanarNextVolumeViewport(viewport) {
|
|
4
|
+
const genericViewport = viewport;
|
|
5
|
+
return (genericViewport.type === Enums.ViewportType.PLANAR_NEXT &&
|
|
6
|
+
typeof genericViewport.getVolumeId === 'function' &&
|
|
7
|
+
typeof genericViewport.getViewReference === 'function' &&
|
|
8
|
+
typeof genericViewport.getViewState === 'function' &&
|
|
9
|
+
typeof genericViewport.addDisplaySet === 'function' &&
|
|
10
|
+
typeof genericViewport.setDisplaySetPresentation === 'function' &&
|
|
11
|
+
typeof genericViewport.setViewReference === 'function');
|
|
12
|
+
}
|
|
13
|
+
async function addLabelmapToPlanarGenericViewport(args) {
|
|
14
|
+
const { blendMode, labelmapLayers, segmentationId, viewport, visibility } = args;
|
|
15
|
+
const sourceVolumeRenderMode = getPlanarNextVolumeRenderMode(viewport);
|
|
16
|
+
if (!sourceVolumeRenderMode) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const sourceVolumeId = viewport.getVolumeId();
|
|
20
|
+
const sourceViewReference = sourceVolumeId
|
|
21
|
+
? viewport.getViewReference({ volumeId: sourceVolumeId })
|
|
22
|
+
: viewport.getViewReference();
|
|
23
|
+
const requestedOrientation = viewport.getViewState().orientation;
|
|
24
|
+
const currentImageIdIndex = Math.max(0, viewport.getCurrentImageIdIndex?.() ?? 0);
|
|
25
|
+
let firstActorEntry;
|
|
26
|
+
for (const layer of labelmapLayers) {
|
|
27
|
+
if (!layer.volumeId) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const volume = cache.getVolume(layer.volumeId);
|
|
31
|
+
if (!volume) {
|
|
32
|
+
throw new Error(`imageVolume with id: ${layer.volumeId} does not exist, you need to create/allocate the volume first`);
|
|
33
|
+
}
|
|
34
|
+
const representationUID = createLabelmapRepresentationUID({
|
|
35
|
+
segmentationId,
|
|
36
|
+
referencedId: layer.labelmapId,
|
|
37
|
+
});
|
|
38
|
+
const dataId = representationUID;
|
|
39
|
+
utilities.genericViewportDataSetMetadataProvider.add(dataId, {
|
|
40
|
+
kind: 'planar',
|
|
41
|
+
imageIds: volume.imageIds,
|
|
42
|
+
initialImageIdIndex: Math.min(currentImageIdIndex, Math.max(volume.imageIds.length - 1, 0)),
|
|
43
|
+
reference: {
|
|
44
|
+
kind: 'segmentation',
|
|
45
|
+
segmentationId,
|
|
46
|
+
representationUID,
|
|
47
|
+
labelmapId: layer.labelmapId,
|
|
48
|
+
},
|
|
49
|
+
volumeId: layer.volumeId,
|
|
50
|
+
});
|
|
51
|
+
await viewport.addDisplaySet(dataId, {
|
|
52
|
+
orientation: requestedOrientation,
|
|
53
|
+
role: 'overlay',
|
|
54
|
+
});
|
|
55
|
+
viewport.setDisplaySetPresentation(dataId, {
|
|
56
|
+
blendMode,
|
|
57
|
+
visible: visibility,
|
|
58
|
+
});
|
|
59
|
+
firstActorEntry ||= viewport
|
|
60
|
+
.getActors?.()
|
|
61
|
+
.find((actorEntry) => actorEntry.representationUID === representationUID);
|
|
62
|
+
}
|
|
63
|
+
viewport.setViewReference(sourceViewReference);
|
|
64
|
+
viewport.render?.();
|
|
65
|
+
if (firstActorEntry) {
|
|
66
|
+
return {
|
|
67
|
+
uid: firstActorEntry.uid,
|
|
68
|
+
actor: firstActorEntry.actor,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function getPlanarNextVolumeRenderMode(viewport) {
|
|
73
|
+
const renderMode = viewport.getDefaultActor?.()?.actorMapper?.renderMode;
|
|
74
|
+
if (renderMode === ActorRenderMode.CPU_VOLUME ||
|
|
75
|
+
renderMode === ActorRenderMode.VTK_VOLUME_SLICE) {
|
|
76
|
+
return renderMode;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export { addLabelmapToPlanarGenericViewport, isPlanarNextVolumeViewport, };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getLabelmapActorEntries } from '../../../../stateManagement/segmentation/helpers/getSegmentationActor';
|
|
2
|
+
import removeLabelmapRepresentationData from '../removeLabelmapRepresentationData';
|
|
3
|
+
import { removeVolumeLabelmapImageMapperActors } from '../volumeLabelmapImageMapper';
|
|
4
|
+
function removeLabelmapRepresentationFromViewport(viewport, segmentationId) {
|
|
5
|
+
removeVolumeLabelmapImageMapperActors(viewport, segmentationId);
|
|
6
|
+
const labelmapActorEntries = getLabelmapActorEntries(viewport.id, segmentationId) ?? [];
|
|
7
|
+
const legacyActorEntryUIDs = [];
|
|
8
|
+
labelmapActorEntries.forEach((actorEntry) => {
|
|
9
|
+
if (removeLabelmapRepresentationData(viewport, segmentationId, actorEntry)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
legacyActorEntryUIDs.push(actorEntry.uid);
|
|
13
|
+
});
|
|
14
|
+
if (legacyActorEntryUIDs.length) {
|
|
15
|
+
viewport.removeActors(legacyActorEntryUIDs);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export { removeLabelmapRepresentationFromViewport };
|
package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/resolveLabelmapRenderPlan.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import type { Segmentation } from '../../../../types/SegmentationStateTypes';
|
|
3
|
+
import type { LabelmapRenderPlan, LabelmapRenderPlanRepresentation } from './types';
|
|
4
|
+
declare function resolveLabelmapRenderPlan({ viewport, segmentation, representation, }: {
|
|
5
|
+
viewport: Types.IViewport;
|
|
6
|
+
segmentation: Segmentation;
|
|
7
|
+
representation: LabelmapRenderPlanRepresentation;
|
|
8
|
+
}): LabelmapRenderPlan;
|
|
9
|
+
export { resolveLabelmapRenderPlan };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import getViewportLabelmapRenderMode from '../../../../stateManagement/segmentation/helpers/getViewportLabelmapRenderMode';
|
|
2
|
+
import { canRenderVolumeViewportLabelmapAsImage, getVolumeViewportLabelmapImageMapperState, shouldUseSliceRendering, } from '../../../../stateManagement/segmentation/helpers/labelmapImageMapperSupport';
|
|
3
|
+
import { createLabelmapRenderPlan } from './createLabelmapRenderPlan';
|
|
4
|
+
import { createLegacyVolumeLabelmapPlan } from './legacyVolumePlan';
|
|
5
|
+
import { createStackImageLabelmapPlan } from './stackImagePlan';
|
|
6
|
+
import { createVolumeSliceImageMapperPlan } from './volumeSliceImageMapperPlan';
|
|
7
|
+
function resolveLabelmapRenderPlan({ viewport, segmentation, representation, }) {
|
|
8
|
+
const { segmentationId, config } = representation;
|
|
9
|
+
const useSliceRendering = shouldUseSliceRendering(segmentation, config);
|
|
10
|
+
const renderMode = getViewportLabelmapRenderMode(viewport, {
|
|
11
|
+
useSliceRendering,
|
|
12
|
+
});
|
|
13
|
+
const isVolumeImageMapper = useSliceRendering && canRenderVolumeViewportLabelmapAsImage(viewport);
|
|
14
|
+
if (renderMode === 'unsupported') {
|
|
15
|
+
return createLabelmapRenderPlan({
|
|
16
|
+
isVolumeImageMapper,
|
|
17
|
+
kind: 'unsupported',
|
|
18
|
+
renderMode,
|
|
19
|
+
segmentationId,
|
|
20
|
+
unsupportedStateKey: useSliceRendering
|
|
21
|
+
? getVolumeViewportLabelmapImageMapperState(viewport).key
|
|
22
|
+
: undefined,
|
|
23
|
+
useSliceRendering,
|
|
24
|
+
viewport,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (isVolumeImageMapper) {
|
|
28
|
+
return createVolumeSliceImageMapperPlan({
|
|
29
|
+
isVolumeImageMapper,
|
|
30
|
+
renderMode,
|
|
31
|
+
segmentation,
|
|
32
|
+
segmentationId,
|
|
33
|
+
useSliceRendering,
|
|
34
|
+
viewport,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (renderMode === 'volume') {
|
|
38
|
+
return createLegacyVolumeLabelmapPlan({
|
|
39
|
+
config,
|
|
40
|
+
isVolumeImageMapper,
|
|
41
|
+
renderMode,
|
|
42
|
+
segmentation,
|
|
43
|
+
segmentationId,
|
|
44
|
+
useSliceRendering,
|
|
45
|
+
viewport,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return createStackImageLabelmapPlan({
|
|
49
|
+
isVolumeImageMapper,
|
|
50
|
+
renderMode,
|
|
51
|
+
segmentationId,
|
|
52
|
+
useSliceRendering,
|
|
53
|
+
viewport,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export { resolveLabelmapRenderPlan };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import type { ViewportLabelmapRenderMode } from '../../../../stateManagement/segmentation/helpers/getViewportLabelmapRenderMode';
|
|
3
|
+
import type { LabelmapRenderPlan } from './types';
|
|
4
|
+
declare function createStackImageLabelmapPlan({ isVolumeImageMapper, renderMode, segmentationId, useSliceRendering, viewport, }: {
|
|
5
|
+
isVolumeImageMapper: boolean;
|
|
6
|
+
renderMode: ViewportLabelmapRenderMode;
|
|
7
|
+
segmentationId: string;
|
|
8
|
+
useSliceRendering: boolean;
|
|
9
|
+
viewport: Types.IViewport;
|
|
10
|
+
}): LabelmapRenderPlan;
|
|
11
|
+
export { createStackImageLabelmapPlan };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { getCurrentLabelmapImageIdsForViewport } from '../../../../stateManagement/segmentation/getCurrentLabelmapImageIdForViewport';
|
|
2
|
+
import { triggerSegmentationDataModified } from '../../../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
3
|
+
import { syncStackLabelmapActors } from '../syncStackLabelmapActors';
|
|
4
|
+
import { createLabelmapRepresentationUID } from '../labelmapRepresentationUID';
|
|
5
|
+
import { createLabelmapRenderPlan } from './createLabelmapRenderPlan';
|
|
6
|
+
function createStackImageLabelmapPlan({ isVolumeImageMapper, renderMode, segmentationId, useSliceRendering, viewport, }) {
|
|
7
|
+
return createLabelmapRenderPlan({
|
|
8
|
+
isVolumeImageMapper,
|
|
9
|
+
kind: 'legacy-stack-image',
|
|
10
|
+
renderMode,
|
|
11
|
+
segmentationId,
|
|
12
|
+
updateAfterMount: false,
|
|
13
|
+
useSliceRendering,
|
|
14
|
+
viewport,
|
|
15
|
+
canRenderCurrentViewport: () => hasCurrentStackLabelmapImageIds(viewport, segmentationId),
|
|
16
|
+
getExpectedRepresentationUIDs: () => getExpectedStackLabelmapRepresentationUIDs(viewport, segmentationId),
|
|
17
|
+
mount: () => mountStackLabelmapActors(viewport, segmentationId),
|
|
18
|
+
update: () => syncStackLabelmapActors(viewport, segmentationId),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function hasCurrentStackLabelmapImageIds(viewport, segmentationId) {
|
|
22
|
+
return !!getCurrentLabelmapImageIdsForViewport(viewport.id, segmentationId)
|
|
23
|
+
?.length;
|
|
24
|
+
}
|
|
25
|
+
function getExpectedStackLabelmapRepresentationUIDs(viewport, segmentationId) {
|
|
26
|
+
return (getCurrentLabelmapImageIdsForViewport(viewport.id, segmentationId)?.map((imageId) => createLabelmapRepresentationUID({
|
|
27
|
+
segmentationId,
|
|
28
|
+
referencedId: imageId,
|
|
29
|
+
})) ?? []);
|
|
30
|
+
}
|
|
31
|
+
async function mountStackLabelmapActors(viewport, segmentationId) {
|
|
32
|
+
syncStackLabelmapActors(viewport, segmentationId);
|
|
33
|
+
triggerSegmentationDataModified(segmentationId);
|
|
34
|
+
}
|
|
35
|
+
export { createStackImageLabelmapPlan };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import type { LabelmapSegmentationData } from '../../../../types/LabelmapTypes';
|
|
3
|
+
import type { LabelmapRepresentation } from '../../../../types/SegmentationStateTypes';
|
|
4
|
+
import type { ViewportLabelmapRenderMode } from '../../../../stateManagement/segmentation/helpers/getViewportLabelmapRenderMode';
|
|
5
|
+
type LabelmapRenderPlanKind = 'legacy-volume' | 'legacy-stack-image' | 'volume-slice-image-mapper' | 'unsupported';
|
|
6
|
+
type LabelmapRenderPlanRepresentation = Pick<LabelmapRepresentation, 'segmentationId' | 'config'>;
|
|
7
|
+
type LabelmapRenderPlanMountResult = void | {
|
|
8
|
+
uid: string;
|
|
9
|
+
actor: any;
|
|
10
|
+
};
|
|
11
|
+
type LabelmapRenderPlanReconcileArgs = {
|
|
12
|
+
actorEntries?: Types.ActorEntry[];
|
|
13
|
+
labelMapData: LabelmapSegmentationData;
|
|
14
|
+
};
|
|
15
|
+
type LabelmapRenderPlanMountArgs = {
|
|
16
|
+
labelMapData: LabelmapSegmentationData;
|
|
17
|
+
};
|
|
18
|
+
type LabelmapRenderPlanUpdateArgs = {
|
|
19
|
+
actorEntries?: Types.ActorEntry[];
|
|
20
|
+
};
|
|
21
|
+
type LabelmapRenderPlan = {
|
|
22
|
+
kind: LabelmapRenderPlanKind;
|
|
23
|
+
renderMode: ViewportLabelmapRenderMode;
|
|
24
|
+
useSliceRendering: boolean;
|
|
25
|
+
isVolumeImageMapper: boolean;
|
|
26
|
+
unsupportedStateKey?: string;
|
|
27
|
+
getExpectedRepresentationUIDs: () => string[];
|
|
28
|
+
mount: (args: LabelmapRenderPlanMountArgs) => Promise<LabelmapRenderPlanMountResult>;
|
|
29
|
+
needsRemount: (actorEntries?: Types.ActorEntry[]) => boolean;
|
|
30
|
+
reconcile: (args: LabelmapRenderPlanReconcileArgs) => Promise<Types.ActorEntry[] | undefined>;
|
|
31
|
+
remove: () => void;
|
|
32
|
+
update: (args: LabelmapRenderPlanUpdateArgs) => void;
|
|
33
|
+
};
|
|
34
|
+
type CreateLabelmapRenderPlanArgs = {
|
|
35
|
+
isVolumeImageMapper: boolean;
|
|
36
|
+
kind: LabelmapRenderPlanKind;
|
|
37
|
+
renderMode: ViewportLabelmapRenderMode;
|
|
38
|
+
segmentationId: string;
|
|
39
|
+
unsupportedStateKey?: string;
|
|
40
|
+
updateAfterMount?: boolean;
|
|
41
|
+
useSliceRendering: boolean;
|
|
42
|
+
viewport: Types.IViewport;
|
|
43
|
+
canRenderCurrentViewport?: () => boolean;
|
|
44
|
+
getExpectedRepresentationUIDs?: () => string[];
|
|
45
|
+
mount?: (args: LabelmapRenderPlanMountArgs) => Promise<LabelmapRenderPlanMountResult>;
|
|
46
|
+
update?: (args: LabelmapRenderPlanUpdateArgs) => void;
|
|
47
|
+
};
|
|
48
|
+
export type { CreateLabelmapRenderPlanArgs, LabelmapRenderPlan, LabelmapRenderPlanKind, LabelmapRenderPlanMountArgs, LabelmapRenderPlanMountResult, LabelmapRenderPlanRepresentation, LabelmapRenderPlanReconcileArgs, LabelmapRenderPlanUpdateArgs, };
|
|
File without changes
|
package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/volumeSliceImageMapperPlan.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import type { ViewportLabelmapRenderMode } from '../../../../stateManagement/segmentation/helpers/getViewportLabelmapRenderMode';
|
|
3
|
+
import type { Segmentation } from '../../../../types/SegmentationStateTypes';
|
|
4
|
+
import type { LabelmapRenderPlan } from './types';
|
|
5
|
+
declare function createVolumeSliceImageMapperPlan({ isVolumeImageMapper, renderMode, segmentation, segmentationId, useSliceRendering, viewport, }: {
|
|
6
|
+
isVolumeImageMapper: boolean;
|
|
7
|
+
renderMode: ViewportLabelmapRenderMode;
|
|
8
|
+
segmentation: Segmentation;
|
|
9
|
+
segmentationId: string;
|
|
10
|
+
useSliceRendering: boolean;
|
|
11
|
+
viewport: Types.IViewport;
|
|
12
|
+
}): LabelmapRenderPlan;
|
|
13
|
+
export { createVolumeSliceImageMapperPlan };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { triggerSegmentationDataModified } from '../../../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
2
|
+
import { addVolumeLabelmapImageMapperActors, getVolumeLabelmapImageMapperRepresentationUIDs, updateVolumeLabelmapImageMapperActors, } from '../volumeLabelmapImageMapper';
|
|
3
|
+
import { createLabelmapRenderPlan } from './createLabelmapRenderPlan';
|
|
4
|
+
function createVolumeSliceImageMapperPlan({ isVolumeImageMapper, renderMode, segmentation, segmentationId, useSliceRendering, viewport, }) {
|
|
5
|
+
return createLabelmapRenderPlan({
|
|
6
|
+
isVolumeImageMapper,
|
|
7
|
+
kind: 'volume-slice-image-mapper',
|
|
8
|
+
renderMode,
|
|
9
|
+
segmentationId,
|
|
10
|
+
useSliceRendering,
|
|
11
|
+
viewport,
|
|
12
|
+
getExpectedRepresentationUIDs: () => getVolumeLabelmapImageMapperRepresentationUIDs(viewport, segmentationId, segmentation),
|
|
13
|
+
mount: () => mountVolumeLabelmapImageMapper({
|
|
14
|
+
viewport,
|
|
15
|
+
segmentation,
|
|
16
|
+
segmentationId,
|
|
17
|
+
}),
|
|
18
|
+
update: ({ actorEntries }) => updateVolumeLabelmapImageMapperActors({
|
|
19
|
+
viewport,
|
|
20
|
+
segmentation,
|
|
21
|
+
segmentationId,
|
|
22
|
+
actorEntries,
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async function mountVolumeLabelmapImageMapper({ viewport, segmentation, segmentationId, }) {
|
|
27
|
+
await addVolumeLabelmapImageMapperActors({
|
|
28
|
+
viewport,
|
|
29
|
+
segmentation,
|
|
30
|
+
segmentationId,
|
|
31
|
+
});
|
|
32
|
+
triggerSegmentationDataModified(segmentationId);
|
|
33
|
+
}
|
|
34
|
+
export { createVolumeSliceImageMapperPlan };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { removeLabelmapRepresentationFromViewport, resolveLabelmapRenderPlan, } from './labelmapRenderPlan/index';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare function getLabelmapRepresentationPrefix(segmentationId: string): string;
|
|
2
|
+
declare function createLabelmapRepresentationUID({ segmentationId, referencedId, sliceStateKey, }: {
|
|
3
|
+
segmentationId: string;
|
|
4
|
+
referencedId?: string;
|
|
5
|
+
sliceStateKey?: string;
|
|
6
|
+
}): string;
|
|
7
|
+
declare function isLabelmapRepresentationUID(representationUID: unknown, segmentationId: string): representationUID is string;
|
|
8
|
+
export { createLabelmapRepresentationUID, getLabelmapRepresentationPrefix, isLabelmapRepresentationUID, };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SegmentationRepresentations } from '../../../enums';
|
|
2
|
+
function getLabelmapRepresentationPrefix(segmentationId) {
|
|
3
|
+
return `${segmentationId}-${SegmentationRepresentations.Labelmap}`;
|
|
4
|
+
}
|
|
5
|
+
function createLabelmapRepresentationUID({ segmentationId, referencedId, sliceStateKey, }) {
|
|
6
|
+
return [
|
|
7
|
+
getLabelmapRepresentationPrefix(segmentationId),
|
|
8
|
+
referencedId,
|
|
9
|
+
sliceStateKey,
|
|
10
|
+
]
|
|
11
|
+
.filter(Boolean)
|
|
12
|
+
.join('-');
|
|
13
|
+
}
|
|
14
|
+
function isLabelmapRepresentationUID(representationUID, segmentationId) {
|
|
15
|
+
return (typeof representationUID === 'string' &&
|
|
16
|
+
representationUID.startsWith(getLabelmapRepresentationPrefix(segmentationId)));
|
|
17
|
+
}
|
|
18
|
+
export { createLabelmapRepresentationUID, getLabelmapRepresentationPrefix, isLabelmapRepresentationUID, };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getEnabledElement } from '@cornerstonejs/core';
|
|
2
|
-
import {
|
|
2
|
+
import { removeLabelmapRepresentationFromViewport } from './labelmapRenderPlan';
|
|
3
3
|
function removeLabelmapFromElement(element, segmentationId) {
|
|
4
4
|
const enabledElement = getEnabledElement(element);
|
|
5
5
|
const { viewport } = enabledElement;
|
|
6
|
-
|
|
6
|
+
removeLabelmapRepresentationFromViewport(viewport, segmentationId);
|
|
7
7
|
}
|
|
8
8
|
export default removeLabelmapFromElement;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { utilities } from '@cornerstonejs/core';
|
|
2
|
+
import { isLabelmapRepresentationUID } from './labelmapRepresentationUID';
|
|
3
|
+
function removeLabelmapRepresentationData(viewport, segmentationId, actorEntry) {
|
|
4
|
+
const representationUID = actorEntry.representationUID;
|
|
5
|
+
if (!isLabelmapRepresentationUID(representationUID, segmentationId)) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
const dataViewport = viewport;
|
|
9
|
+
if (typeof dataViewport.removeData !== 'function') {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
utilities.genericViewportDataSetMetadataProvider.remove(representationUID);
|
|
13
|
+
dataViewport.removeData(representationUID);
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
export default removeLabelmapRepresentationData;
|