@cornerstonejs/tools 5.0.0-beta.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/config.d.ts +4 -0
- package/dist/esm/drawingSvg/drawPath.d.ts +3 -0
- package/dist/esm/drawingSvg/drawPath.js +4 -1
- package/dist/esm/eventListeners/keyboard/keyDownListener.js +2 -2
- package/dist/esm/eventListeners/mouse/getMouseEventPoints.d.ts +1 -1
- package/dist/esm/eventListeners/mouse/getMouseEventPoints.js +19 -1
- package/dist/esm/eventListeners/mouse/mouseDoubleClickListener.js +8 -1
- package/dist/esm/eventListeners/mouse/mouseDownListener.js +37 -5
- package/dist/esm/eventListeners/mouse/mouseMoveListener.js +3 -0
- package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js +60 -92
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +49 -21
- package/dist/esm/eventListeners/segmentation/labelmap/performStackLabelmapUpdate.js +7 -13
- package/dist/esm/eventListeners/segmentation/labelmap/performVolumeLabelmapUpdate.js +44 -18
- package/dist/esm/eventListeners/touch/getTouchEventPoints.js +27 -4
- package/dist/esm/eventListeners/touch/touchStartListener.js +27 -9
- package/dist/esm/eventListeners/wheel/wheelListener.js +5 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/init.js +2 -0
- package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js +10 -4
- package/dist/esm/stateManagement/segmentation/SegmentationRenderingEngine.js +23 -20
- package/dist/esm/stateManagement/segmentation/SegmentationRepresentationDisplayRegistry.d.ts +12 -0
- package/dist/esm/stateManagement/segmentation/SegmentationRepresentationDisplayRegistry.js +7 -0
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.d.ts +1 -10
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +28 -149
- package/dist/esm/stateManagement/segmentation/addColorLUT.js +7 -1
- package/dist/esm/stateManagement/segmentation/getCurrentLabelmapImageIdForViewport.js +16 -1
- package/dist/esm/stateManagement/segmentation/helpers/clearSegmentValue.js +9 -7
- package/dist/esm/stateManagement/segmentation/helpers/getSegmentationActor.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/helpers/getSegmentationActor.js +3 -2
- package/dist/esm/stateManagement/segmentation/helpers/getViewportLabelmapRenderMode.d.ts +5 -0
- package/dist/esm/stateManagement/segmentation/helpers/getViewportLabelmapRenderMode.js +58 -0
- package/dist/esm/stateManagement/segmentation/helpers/labelmapImageMapperSupport.d.ts +52 -0
- package/dist/esm/stateManagement/segmentation/helpers/labelmapImageMapperSupport.js +246 -0
- package/dist/esm/stateManagement/segmentation/helpers/labelmapSegmentationState.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/helpers/labelmapSegmentationState.js +1 -0
- package/dist/esm/stateManagement/segmentation/helpers/normalizeSegmentationInput.js +12 -1
- package/dist/esm/stateManagement/segmentation/internalAddSegmentationRepresentation.js +3 -3
- package/dist/esm/stateManagement/segmentation/labelmapModel/index.d.ts +9 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/index.js +7 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapEditTransaction.d.ts +54 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapEditTransaction.js +224 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageIdMapping.d.ts +6 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageIdMapping.js +39 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageReferenceResolver.d.ts +23 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageReferenceResolver.js +269 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLayerStore.d.ts +15 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLayerStore.js +160 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLegacyAdapter.d.ts +4 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLegacyAdapter.js +42 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapSegmentBindings.d.ts +11 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapSegmentBindings.js +73 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/normalizeLabelmapSegmentationData.d.ts +17 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/normalizeLabelmapSegmentationData.js +75 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/privateLabelmap.d.ts +5 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/privateLabelmap.js +106 -0
- package/dist/esm/stateManagement/segmentation/models/SegmentModel.d.ts +11 -0
- package/dist/esm/stateManagement/segmentation/models/SegmentModel.js +19 -0
- package/dist/esm/stateManagement/segmentation/models/SegmentationModel.d.ts +12 -0
- package/dist/esm/stateManagement/segmentation/models/SegmentationModel.js +23 -0
- package/dist/esm/stateManagement/segmentation/removeSegmentationRepresentations.js +6 -10
- package/dist/esm/stateManagement/segmentation/segmentIndex.js +24 -0
- package/dist/esm/stateManagement/segmentation/segmentationEventManager.js +2 -9
- package/dist/esm/stateManagement/segmentation/segmentationState.d.ts +2 -1
- package/dist/esm/stateManagement/segmentation/segmentationState.js +4 -1
- package/dist/esm/store/SynchronizerManager/Synchronizer.d.ts +3 -1
- package/dist/esm/store/state.js +2 -1
- package/dist/esm/synchronizers/callbacks/imageSliceSyncCallback.js +12 -3
- package/dist/esm/synchronizers/callbacks/presentationViewSyncCallback.js +5 -2
- package/dist/esm/synchronizers/callbacks/zoomPanSyncCallback.js +51 -3
- package/dist/esm/synchronizers/synchronizers/createPresentationViewSynchronizer.d.ts +1 -1
- package/dist/esm/tools/AdvancedMagnifyTool.js +4 -1
- package/dist/esm/tools/CrosshairsTool.d.ts +4 -0
- package/dist/esm/tools/CrosshairsTool.js +95 -41
- package/dist/esm/tools/MagnifyTool.js +3 -1
- package/dist/esm/tools/OrientationControllerTool.d.ts +45 -0
- package/dist/esm/tools/OrientationControllerTool.js +454 -0
- package/dist/esm/tools/OrientationMarkerTool.js +4 -4
- package/dist/esm/tools/PanTool.js +26 -3
- package/dist/esm/tools/PlanarRotateTool.js +19 -4
- package/dist/esm/tools/ReferenceCursors.js +7 -1
- package/dist/esm/tools/SculptorTool/CircleSculptCursor.js +1 -1
- package/dist/esm/tools/TrackballRotateTool.js +3 -2
- package/dist/esm/tools/VolumeCroppingControlTool.d.ts +10 -35
- package/dist/esm/tools/VolumeCroppingControlTool.js +179 -699
- package/dist/esm/tools/VolumeCroppingTool.d.ts +34 -32
- package/dist/esm/tools/VolumeCroppingTool.js +813 -532
- package/dist/esm/tools/WindowLevelTool.d.ts +2 -1
- package/dist/esm/tools/WindowLevelTool.js +48 -4
- package/dist/esm/tools/ZoomTool.d.ts +8 -0
- package/dist/esm/tools/ZoomTool.js +92 -11
- package/dist/esm/tools/annotation/AngleTool.js +38 -32
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js +30 -28
- package/dist/esm/tools/annotation/BidirectionalTool.js +51 -49
- package/dist/esm/tools/annotation/CircleROITool.d.ts +1 -0
- package/dist/esm/tools/annotation/CircleROITool.js +89 -51
- package/dist/esm/tools/annotation/CobbAngleTool.js +1 -1
- package/dist/esm/tools/annotation/DragProbeTool.js +1 -1
- package/dist/esm/tools/annotation/ETDRSGridTool.js +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +46 -39
- package/dist/esm/tools/annotation/HeightTool.js +1 -1
- package/dist/esm/tools/annotation/KeyImageTool.js +11 -11
- package/dist/esm/tools/annotation/LabelTool.js +37 -35
- package/dist/esm/tools/annotation/LengthTool.js +35 -33
- package/dist/esm/tools/annotation/LivewireContourSegmentationTool.js +6 -4
- package/dist/esm/tools/annotation/LivewireContourTool.js +4 -8
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js +6 -4
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +3 -4
- package/dist/esm/tools/annotation/ProbeTool.js +66 -56
- package/dist/esm/tools/annotation/RectangleROITool.js +48 -37
- package/dist/esm/tools/annotation/RegionSegmentPlusTool.js +1 -1
- package/dist/esm/tools/annotation/RegionSegmentTool.js +1 -1
- package/dist/esm/tools/annotation/SplineContourSegmentationTool.js +1 -1
- package/dist/esm/tools/annotation/SplineROITool.js +60 -56
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js +1 -1
- package/dist/esm/tools/annotation/UltrasoundPleuraBLineTool/UltrasoundPleuraBLineTool.js +57 -55
- package/dist/esm/tools/annotation/VideoRedactionTool.js +1 -1
- package/dist/esm/tools/base/AnnotationDisplayTool.js +9 -6
- package/dist/esm/tools/base/AnnotationTool.js +2 -1
- package/dist/esm/tools/base/BaseTool.js +16 -10
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js +1 -1
- package/dist/esm/tools/base/GrowCutBaseTool.js +2 -2
- package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.d.ts +2 -4
- package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js +15 -85
- package/dist/esm/tools/displayTools/Labelmap/labelmapActorStyle.d.ts +5 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapActorStyle.js +191 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.d.ts +4 -3
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +48 -209
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/createLabelmapRenderPlan.d.ts +3 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/createLabelmapRenderPlan.js +51 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/index.d.ts +4 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/index.js +3 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/legacyVolumePlan.d.ts +14 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/legacyVolumePlan.js +143 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/planarGenericVolumeLabelmap.d.ts +40 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/planarGenericVolumeLabelmap.js +79 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/removeLabelmapRepresentationFromViewport.d.ts +3 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/removeLabelmapRepresentationFromViewport.js +18 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/resolveLabelmapRenderPlan.d.ts +9 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/resolveLabelmapRenderPlan.js +56 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/stackImagePlan.d.ts +11 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/stackImagePlan.js +35 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/types.d.ts +48 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/types.js +0 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/volumeSliceImageMapperPlan.d.ts +13 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/volumeSliceImageMapperPlan.js +34 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan.d.ts +2 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan.js +1 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRepresentationUID.d.ts +8 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRepresentationUID.js +18 -0
- package/dist/esm/tools/displayTools/Labelmap/removeLabelmapFromElement.js +2 -2
- package/dist/esm/tools/displayTools/Labelmap/removeLabelmapRepresentationData.d.ts +3 -0
- package/dist/esm/tools/displayTools/Labelmap/removeLabelmapRepresentationData.js +16 -0
- package/dist/esm/tools/displayTools/Labelmap/syncStackLabelmapActors.d.ts +2 -0
- package/dist/esm/tools/displayTools/Labelmap/syncStackLabelmapActors.js +135 -0
- package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapImageMapper.d.ts +16 -0
- package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapImageMapper.js +267 -0
- package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapSliceData.d.ts +27 -0
- package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapSliceData.js +185 -0
- package/dist/esm/tools/displayTools/registerBuiltInSegmentationRepresentationDisplays.d.ts +1 -0
- package/dist/esm/tools/displayTools/registerBuiltInSegmentationRepresentationDisplays.js +16 -0
- package/dist/esm/tools/index.d.ts +2 -1
- package/dist/esm/tools/index.js +2 -1
- package/dist/esm/tools/segmentation/BrushTool.d.ts +9 -2
- package/dist/esm/tools/segmentation/BrushTool.js +123 -26
- package/dist/esm/tools/segmentation/CircleScissorsTool.js +19 -36
- package/dist/esm/tools/segmentation/LabelmapBaseTool.d.ts +2 -3
- package/dist/esm/tools/segmentation/LabelmapBaseTool.js +77 -46
- package/dist/esm/tools/segmentation/LabelmapEditWithContour.js +3 -3
- package/dist/esm/tools/segmentation/PaintFillTool.js +11 -4
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.d.ts +2 -0
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +16 -8
- package/dist/esm/tools/segmentation/RectangleScissorsTool.js +13 -6
- package/dist/esm/tools/segmentation/SegmentBidirectionalTool.js +63 -61
- package/dist/esm/tools/segmentation/SegmentSelectTool.js +4 -4
- package/dist/esm/tools/segmentation/SphereScissorsTool.js +11 -31
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.d.ts +7 -0
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.js +47 -24
- package/dist/esm/tools/segmentation/strategies/compositions/circularCursor.js +49 -21
- package/dist/esm/tools/segmentation/strategies/compositions/determineSegmentIndex.js +2 -2
- package/dist/esm/tools/segmentation/strategies/compositions/dynamicThreshold.js +5 -1
- package/dist/esm/tools/segmentation/strategies/compositions/islandRemovalComposition.js +2 -2
- package/dist/esm/tools/segmentation/strategies/compositions/preview.js +2 -2
- package/dist/esm/tools/segmentation/strategies/compositions/setValue.js +14 -6
- package/dist/esm/tools/segmentation/strategies/fillCircle.d.ts +3 -1
- package/dist/esm/tools/segmentation/strategies/fillCircle.js +38 -31
- package/dist/esm/tools/segmentation/strategies/fillSphere.js +11 -3
- package/dist/esm/tools/segmentation/strategies/utils/crossLayerErase.d.ts +4 -0
- package/dist/esm/tools/segmentation/strategies/utils/crossLayerErase.js +23 -0
- package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/handleUseSegmentCenterIndex.js +12 -11
- package/dist/esm/tools/segmentation/strategies/utils/labelmapOverlap.d.ts +4 -0
- package/dist/esm/tools/segmentation/strategies/utils/labelmapOverlap.js +41 -0
- package/dist/esm/tools/segmentation/strategies/utils/overwritePolicy.d.ts +3 -0
- package/dist/esm/tools/segmentation/strategies/utils/overwritePolicy.js +31 -0
- package/dist/esm/tools/segmentation/strategies/utils/segmentSeparation.d.ts +3 -0
- package/dist/esm/tools/segmentation/strategies/utils/segmentSeparation.js +38 -0
- package/dist/esm/tools/segmentation/utils/LazyBrushEditController.d.ts +19 -0
- package/dist/esm/tools/segmentation/utils/LazyBrushEditController.js +55 -0
- package/dist/esm/tools/segmentation/utils/lazyBrushPreview.d.ts +3 -0
- package/dist/esm/tools/segmentation/utils/lazyBrushPreview.js +34 -0
- package/dist/esm/tools/segmentation/utils/shouldUseLazyLabelmapEditing.d.ts +3 -0
- package/dist/esm/tools/segmentation/utils/shouldUseLazyLabelmapEditing.js +42 -0
- package/dist/esm/types/ISynchronizerEventHandler.d.ts +2 -1
- package/dist/esm/types/LabelmapToolOperationData.d.ts +5 -0
- package/dist/esm/types/LabelmapTypes.d.ts +29 -6
- package/dist/esm/types/SegmentationStateTypes.d.ts +6 -0
- package/dist/esm/utilities/calibrateImageSpacing.js +17 -2
- package/dist/esm/utilities/contours/AnnotationToPointData.js +1 -1
- package/dist/esm/utilities/draw3D/addLine3DBetweenPoints.d.ts +7 -0
- package/dist/esm/utilities/draw3D/addLine3DBetweenPoints.js +34 -0
- package/dist/esm/utilities/draw3D/calculateAdaptiveSphereRadius.d.ts +6 -0
- package/dist/esm/utilities/draw3D/calculateAdaptiveSphereRadius.js +7 -0
- package/dist/esm/utilities/draw3D/index.d.ts +2 -0
- package/dist/esm/utilities/draw3D/index.js +2 -0
- package/dist/esm/utilities/drawing/getTextBoxCoordsCanvas.js +22 -14
- package/dist/esm/utilities/getCenterAndRadiusInCanvas.d.ts +6 -0
- package/dist/esm/utilities/getCenterAndRadiusInCanvas.js +26 -0
- package/dist/esm/utilities/getEllipseWorldCoordinates.d.ts +2 -0
- package/dist/esm/utilities/getEllipseWorldCoordinates.js +26 -0
- package/dist/esm/utilities/getSphereBoundsInfo.js +5 -1
- package/dist/esm/utilities/getViewportICamera.d.ts +4 -0
- package/dist/esm/utilities/getViewportICamera.js +23 -0
- package/dist/esm/utilities/getViewportsForAnnotation.js +5 -1
- package/dist/esm/utilities/index.d.ts +2 -1
- package/dist/esm/utilities/index.js +2 -1
- package/dist/esm/utilities/interactionDragCoordinator.d.ts +5 -0
- package/dist/esm/utilities/interactionDragCoordinator.js +16 -0
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.js +9 -7
- package/dist/esm/utilities/pointInSurroundingSphereCallback.js +8 -1
- package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js +121 -118
- package/dist/esm/utilities/segmentation/SegmentStatsCalculator.js +5 -4
- package/dist/esm/utilities/segmentation/VolumetricCalculator.js +1 -1
- package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.js +1 -1
- package/dist/esm/utilities/segmentation/getReferenceVolumeForSegmentation.js +1 -1
- package/dist/esm/utilities/segmentation/getReferenceVolumeForSegmentationVolume.js +11 -2
- package/dist/esm/utilities/segmentation/getSegmentIndexAtLabelmapBorder.js +36 -17
- package/dist/esm/utilities/segmentation/getSegmentIndexAtWorldPoint.js +42 -25
- package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js +3 -30
- package/dist/esm/utilities/segmentation/index.d.ts +2 -1
- package/dist/esm/utilities/segmentation/index.js +2 -1
- package/dist/esm/utilities/segmentation/utilsForWorker.js +6 -2
- package/dist/esm/utilities/segmentation/validateLabelmap.js +1 -1
- package/dist/esm/utilities/stackPrefetch/stackPrefetch.js +0 -1
- package/dist/esm/utilities/touch/index.js +3 -2
- package/dist/esm/utilities/viewportCapabilities.d.ts +16 -0
- package/dist/esm/utilities/viewportCapabilities.js +18 -0
- package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.d.ts +1 -1
- package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.js +12 -4
- package/dist/esm/utilities/viewportFilters/filterViewportsWithSameOrientation.d.ts +1 -1
- package/dist/esm/utilities/viewportFilters/filterViewportsWithSameOrientation.js +11 -4
- package/dist/esm/utilities/viewportFilters/getViewportIdsWithToolToRender.js +1 -1
- package/dist/esm/utilities/viewportPresentation.d.ts +3 -0
- package/dist/esm/utilities/viewportPresentation.js +26 -0
- package/dist/esm/utilities/volumeCropping/computePlanePlaneIntersection.d.ts +6 -0
- package/dist/esm/utilities/volumeCropping/computePlanePlaneIntersection.js +37 -0
- package/dist/esm/utilities/volumeCropping/constants.d.ts +31 -0
- package/dist/esm/utilities/volumeCropping/constants.js +31 -0
- package/dist/esm/utilities/volumeCropping/copyClippingPlanes.d.ts +2 -0
- package/dist/esm/utilities/volumeCropping/copyClippingPlanes.js +6 -0
- package/dist/esm/utilities/volumeCropping/extractVolumeDirectionVectors.d.ts +9 -0
- package/dist/esm/utilities/volumeCropping/extractVolumeDirectionVectors.js +9 -0
- package/dist/esm/utilities/volumeCropping/findLineBoundsIntersection.d.ts +5 -0
- package/dist/esm/utilities/volumeCropping/findLineBoundsIntersection.js +50 -0
- package/dist/esm/utilities/volumeCropping/getColorKeyForPlaneIndex.d.ts +1 -0
- package/dist/esm/utilities/volumeCropping/getColorKeyForPlaneIndex.js +13 -0
- package/dist/esm/utilities/volumeCropping/getOrientationFromNormal.d.ts +2 -0
- package/dist/esm/utilities/volumeCropping/getOrientationFromNormal.js +19 -0
- package/dist/esm/utilities/volumeCropping/index.d.ts +9 -0
- package/dist/esm/utilities/volumeCropping/index.js +9 -0
- package/dist/esm/utilities/volumeCropping/parseCornerKey.d.ts +8 -0
- package/dist/esm/utilities/volumeCropping/parseCornerKey.js +11 -0
- package/dist/esm/utilities/volumeCropping/types.d.ts +5 -0
- package/dist/esm/utilities/volumeCropping/types.js +0 -0
- package/dist/esm/utilities/vtkjs/AnnotatedRhombicuboctahedronActor/index.d.ts +31 -0
- package/dist/esm/utilities/vtkjs/AnnotatedRhombicuboctahedronActor/index.js +391 -0
- package/dist/esm/utilities/vtkjs/OrientationControllerWidget/index.d.ts +69 -0
- package/dist/esm/utilities/vtkjs/OrientationControllerWidget/index.js +804 -0
- package/dist/esm/utilities/vtkjs/RhombicuboctahedronSource/index.d.ts +7 -0
- package/dist/esm/utilities/vtkjs/RhombicuboctahedronSource/index.js +144 -0
- package/dist/esm/utilities/vtkjs/index.d.ts +3 -0
- package/dist/esm/utilities/vtkjs/index.js +3 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +10 -9
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ActorRenderMode, getShouldUseCPURendering, } from '@cornerstonejs/core';
|
|
2
|
+
import { getConfig } from '../../../config';
|
|
3
|
+
const CPU_RENDER_MODES = new Set([
|
|
4
|
+
ActorRenderMode.CPU_IMAGE,
|
|
5
|
+
ActorRenderMode.CPU_VOLUME,
|
|
6
|
+
]);
|
|
7
|
+
function getDefaultActor(viewport) {
|
|
8
|
+
try {
|
|
9
|
+
return viewport.getDefaultActor?.();
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function isCPUViewport(viewport) {
|
|
16
|
+
if (!viewport) {
|
|
17
|
+
return getShouldUseCPURendering();
|
|
18
|
+
}
|
|
19
|
+
const cpuViewport = viewport;
|
|
20
|
+
if (cpuViewport.useCPURendering === true) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
if (cpuViewport._cpuFallbackEnabledElement) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
const defaultActor = getDefaultActor(viewport);
|
|
27
|
+
const renderMode = defaultActor?.actorMapper?.renderMode;
|
|
28
|
+
if (renderMode && CPU_RENDER_MODES.has(renderMode)) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
const actorClassName = typeof defaultActor?.actor?.getClassName === 'function'
|
|
32
|
+
? defaultActor.actor.getClassName()
|
|
33
|
+
: undefined;
|
|
34
|
+
if (actorClassName === 'CanvasActor') {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
return getShouldUseCPURendering();
|
|
38
|
+
}
|
|
39
|
+
export function shouldUseLazyLabelmapEditing(viewport) {
|
|
40
|
+
return (getConfig().segmentation?.overwriteMode !== undefined ||
|
|
41
|
+
isCPUViewport(viewport));
|
|
42
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
2
|
import type { Synchronizer } from '../store';
|
|
3
|
+
import type { SynchronizerOptions } from '../store/SynchronizerManager/Synchronizer';
|
|
3
4
|
export default interface ISynchronizerEventHandler {
|
|
4
|
-
(synchronizer: Synchronizer, sourceViewport: Types.IViewportId, targetViewport: Types.IViewportId, sourceEvent:
|
|
5
|
+
(synchronizer: Synchronizer, sourceViewport: Types.IViewportId, targetViewport: Types.IViewportId, sourceEvent: Event, options?: SynchronizerOptions): Promise<void> | void;
|
|
5
6
|
}
|
|
@@ -2,9 +2,14 @@ import type { Types } from '@cornerstonejs/core';
|
|
|
2
2
|
import type { LabelmapSegmentationDataStack, LabelmapSegmentationDataVolume } from './LabelmapTypes';
|
|
3
3
|
import type vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
|
|
4
4
|
import type { LabelmapMemo } from '../utilities/segmentation/createLabelmapMemo';
|
|
5
|
+
import type { SegmentLabelmapBindingState } from './LabelmapTypes';
|
|
5
6
|
type LabelmapToolOperationData = {
|
|
6
7
|
segmentationId: string;
|
|
7
8
|
segmentIndex: number;
|
|
9
|
+
labelValue?: number;
|
|
10
|
+
labelmapId?: string;
|
|
11
|
+
overwriteSegmentIndices?: number[];
|
|
12
|
+
crossLayerEraseBindings?: SegmentLabelmapBindingState[];
|
|
8
13
|
previewColor?: [number, number, number, number];
|
|
9
14
|
previewSegmentIndex?: number;
|
|
10
15
|
segmentsLocked: number[];
|
|
@@ -14,16 +14,39 @@ export type InactiveLabelmapStyle = {
|
|
|
14
14
|
outlineOpacityInactive?: number;
|
|
15
15
|
};
|
|
16
16
|
export type LabelmapStyle = BaseLabelmapStyle & InactiveLabelmapStyle;
|
|
17
|
-
export type
|
|
18
|
-
|
|
17
|
+
export type LabelmapLayerType = 'volume' | 'stack';
|
|
18
|
+
export type LabelmapLayer = {
|
|
19
|
+
labelmapId: string;
|
|
20
|
+
type: LabelmapLayerType;
|
|
21
|
+
volumeId?: string;
|
|
22
|
+
geometryVolumeId?: string;
|
|
19
23
|
referencedVolumeId?: string;
|
|
24
|
+
referencedImageIds?: string[];
|
|
25
|
+
imageIds?: string[];
|
|
26
|
+
labelToSegmentIndex?: {
|
|
27
|
+
[labelValue: number]: number;
|
|
28
|
+
};
|
|
20
29
|
};
|
|
21
|
-
export type
|
|
22
|
-
|
|
30
|
+
export type SegmentLabelmapBindingState = {
|
|
31
|
+
labelmapId: string;
|
|
32
|
+
labelValue: number;
|
|
23
33
|
};
|
|
24
|
-
export type
|
|
34
|
+
export type LabelmapSegmentationDataShared = {
|
|
35
|
+
referencedImageIds?: string[];
|
|
36
|
+
labelmaps?: {
|
|
37
|
+
[labelmapId: string]: LabelmapLayer;
|
|
38
|
+
};
|
|
39
|
+
segmentBindings?: {
|
|
40
|
+
[segmentIndex: number]: SegmentLabelmapBindingState;
|
|
41
|
+
};
|
|
42
|
+
primaryLabelmapId?: string;
|
|
43
|
+
sourceRepresentationName?: string;
|
|
44
|
+
};
|
|
45
|
+
export type LabelmapSegmentationDataVolume = LabelmapSegmentationDataShared & {
|
|
25
46
|
volumeId?: string;
|
|
26
47
|
referencedVolumeId?: string;
|
|
27
|
-
|
|
48
|
+
};
|
|
49
|
+
export type LabelmapSegmentationDataStack = LabelmapSegmentationDataShared & {
|
|
28
50
|
imageIds?: string[];
|
|
29
51
|
};
|
|
52
|
+
export type LabelmapSegmentationData = LabelmapSegmentationDataShared & LabelmapSegmentationDataVolume & LabelmapSegmentationDataStack;
|
|
@@ -23,9 +23,11 @@ export type Segment = {
|
|
|
23
23
|
export type Segmentation = {
|
|
24
24
|
segmentationId: string;
|
|
25
25
|
label: string;
|
|
26
|
+
fallbackLabel?: string;
|
|
26
27
|
segments: {
|
|
27
28
|
[segmentIndex: number]: Segment;
|
|
28
29
|
};
|
|
30
|
+
segmentOrder?: number[];
|
|
29
31
|
representationData: RepresentationsData;
|
|
30
32
|
cachedStats: {
|
|
31
33
|
[key: string]: unknown;
|
|
@@ -36,6 +38,7 @@ export type LabelmapRenderingConfig = {
|
|
|
36
38
|
ofun: vtkPiecewiseFunction;
|
|
37
39
|
colorLUTIndex: number;
|
|
38
40
|
blendMode?: coreEnums.BlendModes;
|
|
41
|
+
useSliceRendering?: boolean;
|
|
39
42
|
};
|
|
40
43
|
export type ContourRenderingConfig = {};
|
|
41
44
|
export type SurfaceRenderingConfig = {};
|
|
@@ -79,7 +82,9 @@ export type SegmentationPublicInput = {
|
|
|
79
82
|
segments?: {
|
|
80
83
|
[segmentIndex: number]: Partial<Segment>;
|
|
81
84
|
};
|
|
85
|
+
segmentOrder?: number[];
|
|
82
86
|
label?: string;
|
|
87
|
+
fallbackLabel?: string;
|
|
83
88
|
cachedStats?: {
|
|
84
89
|
[key: string]: unknown;
|
|
85
90
|
};
|
|
@@ -91,6 +96,7 @@ export type RepresentationPublicInput = {
|
|
|
91
96
|
config?: {
|
|
92
97
|
colorLUTOrIndex?: Types.ColorLUT | number;
|
|
93
98
|
blendMode?: coreEnums.BlendModes;
|
|
99
|
+
useSliceRendering?: boolean;
|
|
94
100
|
};
|
|
95
101
|
};
|
|
96
102
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { utilities, Enums } from '@cornerstonejs/core';
|
|
2
|
+
import { viewportSupportsStackCalibration, viewportSupportsStackCompatibility, } from './viewportCapabilities';
|
|
2
3
|
const { calibratedPixelSpacingMetadataProvider } = utilities;
|
|
3
4
|
export default function calibrateImageSpacing(imageId, renderingEngine, calibrationOrScale) {
|
|
4
5
|
if (typeof calibrationOrScale === 'number') {
|
|
@@ -8,11 +9,25 @@ export default function calibrateImageSpacing(imageId, renderingEngine, calibrat
|
|
|
8
9
|
};
|
|
9
10
|
}
|
|
10
11
|
calibratedPixelSpacingMetadataProvider.add(imageId, calibrationOrScale);
|
|
11
|
-
const viewports = renderingEngine.
|
|
12
|
+
const viewports = renderingEngine.getViewports().filter((viewport) => {
|
|
13
|
+
return (viewportSupportsStackCalibration(viewport) ||
|
|
14
|
+
viewportSupportsStackCompatibility(viewport));
|
|
15
|
+
});
|
|
12
16
|
viewports.forEach((viewport) => {
|
|
13
17
|
const imageIds = viewport.getImageIds();
|
|
14
18
|
if (imageIds.includes(imageId)) {
|
|
15
|
-
viewport
|
|
19
|
+
if (viewportSupportsStackCalibration(viewport)) {
|
|
20
|
+
viewport.calibrateSpacing(imageId);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const currentImageIdIndex = viewport.getCurrentImageIdIndex();
|
|
24
|
+
void Promise.resolve(viewport.setStack(imageIds, currentImageIdIndex))
|
|
25
|
+
.then(() => {
|
|
26
|
+
viewport.render();
|
|
27
|
+
})
|
|
28
|
+
.catch((error) => {
|
|
29
|
+
console.warn('calibrateImageSpacing: failed to refresh stack-compatible viewport', error);
|
|
30
|
+
});
|
|
16
31
|
}
|
|
17
32
|
});
|
|
18
33
|
}
|
|
@@ -8,7 +8,6 @@ function validateAnnotation(annotation) {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
class AnnotationToPointData {
|
|
11
|
-
static { this.TOOL_NAMES = {}; }
|
|
12
11
|
constructor() {
|
|
13
12
|
}
|
|
14
13
|
static convert(annotation, segment, metadataProvider) {
|
|
@@ -36,5 +35,6 @@ class AnnotationToPointData {
|
|
|
36
35
|
AnnotationToPointData.TOOL_NAMES[toolClass.toolName] = toolClass;
|
|
37
36
|
}
|
|
38
37
|
}
|
|
38
|
+
AnnotationToPointData.TOOL_NAMES = {};
|
|
39
39
|
AnnotationToPointData.register(RectangleROIStartEndThreshold);
|
|
40
40
|
export default AnnotationToPointData;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData';
|
|
2
|
+
import vtkActor from '@kitware/vtk.js/Rendering/Core/Actor';
|
|
3
|
+
import type { Types } from '@cornerstonejs/core';
|
|
4
|
+
export declare function addLine3DBetweenPoints(viewport: Types.IVolumeViewport, point1: Types.Point3, point2: Types.Point3, color?: [number, number, number], uid?: string, showHandles?: boolean): {
|
|
5
|
+
actor: vtkActor | null;
|
|
6
|
+
source: vtkPolyData | null;
|
|
7
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData';
|
|
2
|
+
import vtkPoints from '@kitware/vtk.js/Common/Core/Points';
|
|
3
|
+
import vtkCellArray from '@kitware/vtk.js/Common/Core/CellArray';
|
|
4
|
+
import vtkActor from '@kitware/vtk.js/Rendering/Core/Actor';
|
|
5
|
+
import vtkMapper from '@kitware/vtk.js/Rendering/Core/Mapper';
|
|
6
|
+
export function addLine3DBetweenPoints(viewport, point1, point2, color = [0.7, 0.7, 0.7], uid = '', showHandles = true) {
|
|
7
|
+
if (point1[0] === point2[0] &&
|
|
8
|
+
point1[1] === point2[1] &&
|
|
9
|
+
point1[2] === point2[2]) {
|
|
10
|
+
return { actor: null, source: null };
|
|
11
|
+
}
|
|
12
|
+
const points = vtkPoints.newInstance();
|
|
13
|
+
points.setNumberOfPoints(2);
|
|
14
|
+
points.setPoint(0, point1[0], point1[1], point1[2]);
|
|
15
|
+
points.setPoint(1, point2[0], point2[1], point2[2]);
|
|
16
|
+
const lines = vtkCellArray.newInstance({ values: [2, 0, 1] });
|
|
17
|
+
const polyData = vtkPolyData.newInstance();
|
|
18
|
+
polyData.setPoints(points);
|
|
19
|
+
polyData.setLines(lines);
|
|
20
|
+
const mapper = vtkMapper.newInstance();
|
|
21
|
+
mapper.setInputData(polyData);
|
|
22
|
+
const actor = vtkActor.newInstance();
|
|
23
|
+
actor.setMapper(mapper);
|
|
24
|
+
actor.getProperty().setColor(...color);
|
|
25
|
+
actor.getProperty().setLineWidth(0.5);
|
|
26
|
+
actor.getProperty().setOpacity(1.0);
|
|
27
|
+
actor.getProperty().setInterpolationToFlat();
|
|
28
|
+
actor.getProperty().setAmbient(1.0);
|
|
29
|
+
actor.getProperty().setDiffuse(0.0);
|
|
30
|
+
actor.getProperty().setSpecular(0.0);
|
|
31
|
+
actor.setVisibility(showHandles);
|
|
32
|
+
viewport.addActor({ actor, uid });
|
|
33
|
+
return { actor, source: polyData };
|
|
34
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function calculateAdaptiveSphereRadius(diagonal, config) {
|
|
2
|
+
const scaleFactor = config.sphereRadiusScale || 0.01;
|
|
3
|
+
const adaptiveRadius = diagonal * scaleFactor;
|
|
4
|
+
const minRadius = config.minSphereRadius || 2;
|
|
5
|
+
const maxRadius = config.maxSphereRadius || 50;
|
|
6
|
+
return Math.max(minRadius, Math.min(maxRadius, adaptiveRadius));
|
|
7
|
+
}
|
|
@@ -99,28 +99,36 @@ function _findSvgLayer(element) {
|
|
|
99
99
|
return internalDiv?.querySelector(':scope > .svg-layer') || null;
|
|
100
100
|
}
|
|
101
101
|
function _determineCorners(canvasPoints) {
|
|
102
|
-
const
|
|
103
|
-
|
|
102
|
+
const validPoints = canvasPoints.filter(Boolean);
|
|
103
|
+
const p0 = validPoints[0];
|
|
104
|
+
if (!p0 || validPoints.length < 2) {
|
|
104
105
|
return { left: p0, right: p0, top: p0, bottom: p0 };
|
|
105
106
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
let left = p0;
|
|
108
|
+
let right = p0;
|
|
109
|
+
let top = p0;
|
|
110
|
+
let bottom = p0;
|
|
111
|
+
for (let i = 1; i < validPoints.length; i++) {
|
|
112
|
+
const point = validPoints[i];
|
|
113
|
+
if (point[0] < left[0]) {
|
|
114
|
+
left = point;
|
|
115
|
+
}
|
|
116
|
+
if (point[0] > right[0]) {
|
|
117
|
+
right = point;
|
|
118
|
+
}
|
|
119
|
+
if (point[1] < top[1]) {
|
|
120
|
+
top = point;
|
|
121
|
+
}
|
|
122
|
+
if (point[1] > bottom[1]) {
|
|
123
|
+
bottom = point;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
112
126
|
return {
|
|
113
127
|
left,
|
|
114
128
|
top,
|
|
115
129
|
bottom,
|
|
116
130
|
right,
|
|
117
131
|
};
|
|
118
|
-
function _compareX(a, b) {
|
|
119
|
-
return a[0] < b[0] ? -1 : 1;
|
|
120
|
-
}
|
|
121
|
-
function _compareY(a, b) {
|
|
122
|
-
return a[1] < b[1] ? -1 : 1;
|
|
123
|
-
}
|
|
124
132
|
}
|
|
125
133
|
function _estimateTextBoxSize(textLines) {
|
|
126
134
|
const estimatedPadding = 25;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Types, type VolumeViewport } from '@cornerstonejs/core';
|
|
2
|
+
export declare function getCenterAndRadiusInCanvas(points: Types.Point3[], viewport: Types.IStackViewport | VolumeViewport): {
|
|
3
|
+
center: Types.Point2;
|
|
4
|
+
radius: number;
|
|
5
|
+
};
|
|
6
|
+
export default getCenterAndRadiusInCanvas;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {} from '@cornerstonejs/core';
|
|
2
|
+
import { vec2, vec3 } from 'gl-matrix';
|
|
3
|
+
const EPSILON = 1e-4;
|
|
4
|
+
export function getCenterAndRadiusInCanvas(points, viewport) {
|
|
5
|
+
const canvasPoints = points.map((p) => viewport.worldToCanvas(p));
|
|
6
|
+
const [cBottom, cTop, cLeft, cRight] = canvasPoints;
|
|
7
|
+
const center = [
|
|
8
|
+
(cBottom[0] + cTop[0]) / 2,
|
|
9
|
+
(cBottom[1] + cTop[1]) / 2,
|
|
10
|
+
];
|
|
11
|
+
const worldHeight = vec3.distance(points[0], points[1]);
|
|
12
|
+
const worldWidth = vec3.distance(points[2], points[3]);
|
|
13
|
+
const canvasHeight = vec2.distance(cBottom, cTop);
|
|
14
|
+
const canvasWidth = vec2.distance(cLeft, cRight);
|
|
15
|
+
const scaleX = canvasWidth / worldWidth;
|
|
16
|
+
const scaleY = canvasHeight / worldHeight;
|
|
17
|
+
const worldRadius = worldHeight / 2;
|
|
18
|
+
const radius = Math.abs(scaleX - scaleY) > EPSILON
|
|
19
|
+
? worldRadius * Math.min(scaleX, scaleY)
|
|
20
|
+
: canvasHeight / 2;
|
|
21
|
+
return {
|
|
22
|
+
center: center,
|
|
23
|
+
radius: Math.round(radius),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export default getCenterAndRadiusInCanvas;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { vec3 } from 'gl-matrix';
|
|
2
|
+
export default function getEllipseWorldCoordinates(points, viewport) {
|
|
3
|
+
const camera = viewport.getCamera();
|
|
4
|
+
const { viewUp, viewPlaneNormal } = camera;
|
|
5
|
+
const viewRight = vec3.create();
|
|
6
|
+
vec3.cross(viewRight, viewUp, viewPlaneNormal);
|
|
7
|
+
const [centerWorld, endWorld] = points;
|
|
8
|
+
const centerToEndDistance = vec3.distance(centerWorld, endWorld);
|
|
9
|
+
const bottomWorld = vec3.create();
|
|
10
|
+
const topWorld = vec3.create();
|
|
11
|
+
const leftWorld = vec3.create();
|
|
12
|
+
const rightWorld = vec3.create();
|
|
13
|
+
for (let i = 0; i <= 2; i++) {
|
|
14
|
+
bottomWorld[i] = centerWorld[i] - viewUp[i] * centerToEndDistance;
|
|
15
|
+
topWorld[i] = centerWorld[i] + viewUp[i] * centerToEndDistance;
|
|
16
|
+
leftWorld[i] = centerWorld[i] - viewRight[i] * centerToEndDistance;
|
|
17
|
+
rightWorld[i] = centerWorld[i] + viewRight[i] * centerToEndDistance;
|
|
18
|
+
}
|
|
19
|
+
const ellipseWorldCoordinates = [
|
|
20
|
+
bottomWorld,
|
|
21
|
+
topWorld,
|
|
22
|
+
leftWorld,
|
|
23
|
+
rightWorld,
|
|
24
|
+
];
|
|
25
|
+
return ellipseWorldCoordinates;
|
|
26
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { utilities as csUtils } from '@cornerstonejs/core';
|
|
2
2
|
import { vec3 } from 'gl-matrix';
|
|
3
3
|
import { getBoundingBoxAroundShapeIJK } from './boundingBox';
|
|
4
|
+
import getViewportICamera from './getViewportICamera';
|
|
4
5
|
const { transformWorldToIndex } = csUtils;
|
|
5
6
|
function _getSphereBoundsInfo(circlePoints, imageData, directionVectors) {
|
|
6
7
|
const [bottom, top] = circlePoints;
|
|
@@ -32,7 +33,10 @@ function getSphereBoundsInfoFromViewport(circlePoints, imageData, viewport) {
|
|
|
32
33
|
if (!viewport) {
|
|
33
34
|
throw new Error('viewport is required in order to calculate the sphere bounds');
|
|
34
35
|
}
|
|
35
|
-
const camera = viewport
|
|
36
|
+
const camera = getViewportICamera(viewport);
|
|
37
|
+
if (!camera.viewUp || !camera.viewPlaneNormal) {
|
|
38
|
+
throw new Error('viewport view plane is required in order to calculate the sphere bounds');
|
|
39
|
+
}
|
|
36
40
|
const viewUp = vec3.fromValues(camera.viewUp[0], camera.viewUp[1], camera.viewUp[2]);
|
|
37
41
|
const viewPlaneNormal = vec3.fromValues(camera.viewPlaneNormal[0], camera.viewPlaneNormal[1], camera.viewPlaneNormal[2]);
|
|
38
42
|
const viewRight = vec3.create();
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Types } from '@cornerstonejs/core';
|
|
2
|
+
type ViewportICamera = Pick<Types.ICamera, 'focalPoint' | 'position' | 'viewPlaneNormal' | 'viewUp'>;
|
|
3
|
+
export default function getViewportICamera(viewport: Types.IViewport, viewReference?: Types.ViewReference): Partial<ViewportICamera>;
|
|
4
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { utilities } from '@cornerstonejs/core';
|
|
2
|
+
export default function getViewportICamera(viewport, viewReference = viewport.getViewReference()) {
|
|
3
|
+
const genericViewport = viewport;
|
|
4
|
+
const camera = (genericViewport.getResolvedView?.()?.toICamera?.() ||
|
|
5
|
+
viewport.getCamera?.() ||
|
|
6
|
+
{});
|
|
7
|
+
const focalPoint = utilities.clonePoint3(viewReference?.cameraFocalPoint || camera.focalPoint);
|
|
8
|
+
const viewPlaneNormal = utilities.clonePoint3(viewReference?.viewPlaneNormal || camera.viewPlaneNormal);
|
|
9
|
+
const viewUp = utilities.clonePoint3(viewReference?.viewUp || camera.viewUp);
|
|
10
|
+
const position = utilities.clonePoint3(camera.position ||
|
|
11
|
+
(focalPoint &&
|
|
12
|
+
viewPlaneNormal && [
|
|
13
|
+
focalPoint[0] - viewPlaneNormal[0],
|
|
14
|
+
focalPoint[1] - viewPlaneNormal[1],
|
|
15
|
+
focalPoint[2] - viewPlaneNormal[2],
|
|
16
|
+
]));
|
|
17
|
+
return {
|
|
18
|
+
focalPoint,
|
|
19
|
+
position,
|
|
20
|
+
viewPlaneNormal,
|
|
21
|
+
viewUp,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getEnabledElements, utilities as csUtils } from '@cornerstonejs/core';
|
|
2
|
+
import getViewportICamera from './getViewportICamera';
|
|
2
3
|
const { isEqual } = csUtils;
|
|
3
4
|
export default function getViewportsForAnnotation(annotation) {
|
|
4
5
|
const { metadata } = annotation;
|
|
@@ -6,7 +7,10 @@ export default function getViewportsForAnnotation(annotation) {
|
|
|
6
7
|
.filter((enabledElement) => {
|
|
7
8
|
if (enabledElement.FrameOfReferenceUID === metadata.FrameOfReferenceUID) {
|
|
8
9
|
const viewport = enabledElement.viewport;
|
|
9
|
-
const { viewPlaneNormal, viewUp } = viewport
|
|
10
|
+
const { viewPlaneNormal, viewUp } = getViewportICamera(viewport);
|
|
11
|
+
if (!viewPlaneNormal) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
10
14
|
return (isEqual(viewPlaneNormal, metadata.viewPlaneNormal) &&
|
|
11
15
|
(!metadata.viewUp || isEqual(viewUp, metadata.viewUp)));
|
|
12
16
|
}
|
|
@@ -22,6 +22,7 @@ import * as viewportFilters from './viewportFilters';
|
|
|
22
22
|
import * as orientation from './orientation';
|
|
23
23
|
import * as cine from './cine';
|
|
24
24
|
import * as boundingBox from './boundingBox';
|
|
25
|
+
import * as draw3D from './draw3D';
|
|
25
26
|
import * as planarFreehandROITool from './planarFreehandROITool';
|
|
26
27
|
import * as rectangleROITool from './rectangleROITool';
|
|
27
28
|
import { stackPrefetch, stackContextPrefetch } from './stackPrefetch';
|
|
@@ -42,4 +43,4 @@ import { moveAnnotationToViewPlane } from './moveAnnotationToViewPlane';
|
|
|
42
43
|
import { safeStructuredClone } from './safeStructuredClone';
|
|
43
44
|
import getOrCreateImageVolume from './segmentation/getOrCreateImageVolume';
|
|
44
45
|
import * as usFanExtraction from '../tools/annotation/UltrasoundPleuraBLineTool/utils/fanExtraction';
|
|
45
|
-
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, getCalibratedLengthUnitsAndScale, getCalibratedProbeUnitsAndValue, getCalibratedAspect, getPixelValueUnits, getPixelValueUnitsImageId, segmentation, contours, triggerAnnotationRenderForViewportIds, triggerAnnotationRenderForToolGroupIds, triggerAnnotationRender, getSphereBoundsInfo, getAnnotationNearPoint, getViewportForAnnotation, getAnnotationNearPointOnEnabledElement, viewport, cine, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, usFanExtraction, setAnnotationLabel, moveAnnotationToViewPlane, safeStructuredClone, getOrCreateImageVolume, };
|
|
46
|
+
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, getCalibratedLengthUnitsAndScale, getCalibratedProbeUnitsAndValue, getCalibratedAspect, getPixelValueUnits, getPixelValueUnitsImageId, segmentation, contours, triggerAnnotationRenderForViewportIds, triggerAnnotationRenderForToolGroupIds, triggerAnnotationRender, getSphereBoundsInfo, getAnnotationNearPoint, getViewportForAnnotation, getAnnotationNearPointOnEnabledElement, viewport, cine, boundingBox, draw3D, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, usFanExtraction, setAnnotationLabel, moveAnnotationToViewPlane, safeStructuredClone, getOrCreateImageVolume, };
|
|
@@ -22,6 +22,7 @@ import * as viewportFilters from './viewportFilters';
|
|
|
22
22
|
import * as orientation from './orientation';
|
|
23
23
|
import * as cine from './cine';
|
|
24
24
|
import * as boundingBox from './boundingBox';
|
|
25
|
+
import * as draw3D from './draw3D';
|
|
25
26
|
import * as planarFreehandROITool from './planarFreehandROITool';
|
|
26
27
|
import * as rectangleROITool from './rectangleROITool';
|
|
27
28
|
import { stackPrefetch, stackContextPrefetch } from './stackPrefetch';
|
|
@@ -42,4 +43,4 @@ import { moveAnnotationToViewPlane } from './moveAnnotationToViewPlane';
|
|
|
42
43
|
import { safeStructuredClone } from './safeStructuredClone';
|
|
43
44
|
import getOrCreateImageVolume from './segmentation/getOrCreateImageVolume';
|
|
44
45
|
import * as usFanExtraction from '../tools/annotation/UltrasoundPleuraBLineTool/utils/fanExtraction';
|
|
45
|
-
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, getCalibratedLengthUnitsAndScale, getCalibratedProbeUnitsAndValue, getCalibratedAspect, getPixelValueUnits, getPixelValueUnitsImageId, segmentation, contours, triggerAnnotationRenderForViewportIds, triggerAnnotationRenderForToolGroupIds, triggerAnnotationRender, getSphereBoundsInfo, getAnnotationNearPoint, getViewportForAnnotation, getAnnotationNearPointOnEnabledElement, viewport, cine, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, usFanExtraction, setAnnotationLabel, moveAnnotationToViewPlane, safeStructuredClone, getOrCreateImageVolume, };
|
|
46
|
+
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, getCalibratedLengthUnitsAndScale, getCalibratedProbeUnitsAndValue, getCalibratedAspect, getPixelValueUnits, getPixelValueUnitsImageId, segmentation, contours, triggerAnnotationRenderForViewportIds, triggerAnnotationRenderForToolGroupIds, triggerAnnotationRender, getSphereBoundsInfo, getAnnotationNearPoint, getViewportForAnnotation, getAnnotationNearPointOnEnabledElement, viewport, cine, boundingBox, draw3D, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, usFanExtraction, setAnnotationLabel, moveAnnotationToViewPlane, safeStructuredClone, getOrCreateImageVolume, };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
type DragOwner = 'orientation-controller';
|
|
2
|
+
export declare function beginOwnedDrag(viewportId: string, owner: DragOwner): boolean;
|
|
3
|
+
export declare function endOwnedDrag(viewportId: string, owner: DragOwner): void;
|
|
4
|
+
export declare function isDragOwnedBy(viewportId: string, owner: DragOwner): boolean;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const dragOwnerByViewportId = new Map();
|
|
2
|
+
export function beginOwnedDrag(viewportId, owner) {
|
|
3
|
+
if (dragOwnerByViewportId.has(viewportId)) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
dragOwnerByViewportId.set(viewportId, owner);
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
export function endOwnedDrag(viewportId, owner) {
|
|
10
|
+
if (dragOwnerByViewportId.get(viewportId) === owner) {
|
|
11
|
+
dragOwnerByViewportId.delete(viewportId);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function isDragOwnedBy(viewportId, owner) {
|
|
15
|
+
return dragOwnerByViewportId.get(viewportId) === owner;
|
|
16
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { utilities } from '@cornerstonejs/core';
|
|
2
3
|
import { Calculator, InstanceCalculator } from './Calculator';
|
|
3
4
|
const { PointsManager } = utilities;
|
|
@@ -204,20 +205,21 @@ function basicGetStatistics(state, unit) {
|
|
|
204
205
|
return named;
|
|
205
206
|
}
|
|
206
207
|
export class BasicStatsCalculator extends Calculator {
|
|
207
|
-
static { this.state = createBasicStatsState(true); }
|
|
208
208
|
static statsInit(options) {
|
|
209
209
|
if (!options.storePointData) {
|
|
210
210
|
this.state.pointsInShape = null;
|
|
211
211
|
}
|
|
212
212
|
this.state = createBasicStatsState(options.storePointData);
|
|
213
213
|
}
|
|
214
|
-
static { this.statsCallback = ({ value: newValue, pointLPS = null, pointIJK = null, }) => {
|
|
215
|
-
basicStatsCallback(this.state, newValue, pointLPS, pointIJK);
|
|
216
|
-
}; }
|
|
217
|
-
static { this.getStatistics = (options) => {
|
|
218
|
-
return basicGetStatistics(this.state, options?.unit);
|
|
219
|
-
}; }
|
|
220
214
|
}
|
|
215
|
+
_a = BasicStatsCalculator;
|
|
216
|
+
BasicStatsCalculator.state = createBasicStatsState(true);
|
|
217
|
+
BasicStatsCalculator.statsCallback = ({ value: newValue, pointLPS = null, pointIJK = null, }) => {
|
|
218
|
+
basicStatsCallback(_a.state, newValue, pointLPS, pointIJK);
|
|
219
|
+
};
|
|
220
|
+
BasicStatsCalculator.getStatistics = (options) => {
|
|
221
|
+
return basicGetStatistics(_a.state, options?.unit);
|
|
222
|
+
};
|
|
221
223
|
export class InstanceBasicStatsCalculator extends InstanceCalculator {
|
|
222
224
|
constructor(options) {
|
|
223
225
|
super(options);
|
|
@@ -2,6 +2,7 @@ import { utilities as csUtils } from '@cornerstonejs/core';
|
|
|
2
2
|
import { vec3 } from 'gl-matrix';
|
|
3
3
|
import { pointInSphere } from './math/sphere';
|
|
4
4
|
import { getBoundingBoxAroundShape } from './boundingBox';
|
|
5
|
+
import getViewportICamera from './getViewportICamera';
|
|
5
6
|
const { transformWorldToIndex } = csUtils;
|
|
6
7
|
export function pointInSurroundingSphereCallback(imageData, circlePoints, callback, viewport) {
|
|
7
8
|
const { boundsIJK, centerWorld, radiusWorld } = _getBounds(circlePoints, imageData, viewport);
|
|
@@ -51,7 +52,13 @@ function _getBounds(circlePoints, imageData, viewport) {
|
|
|
51
52
|
function _computeBoundsIJKWithCamera(imageData, viewport, circlePoints, centerWorld, radiusWorld) {
|
|
52
53
|
const [bottom, top] = circlePoints;
|
|
53
54
|
const dimensions = imageData.getDimensions();
|
|
54
|
-
const camera = viewport
|
|
55
|
+
const camera = getViewportICamera(viewport);
|
|
56
|
+
if (!camera.viewUp || !camera.viewPlaneNormal) {
|
|
57
|
+
return getBoundingBoxAroundShape([
|
|
58
|
+
transformWorldToIndex(imageData, top),
|
|
59
|
+
transformWorldToIndex(imageData, bottom),
|
|
60
|
+
], dimensions);
|
|
61
|
+
}
|
|
55
62
|
const viewUp = vec3.fromValues(camera.viewUp[0], camera.viewUp[1], camera.viewUp[2]);
|
|
56
63
|
const viewPlaneNormal = vec3.fromValues(camera.viewPlaneNormal[0], camera.viewPlaneNormal[1], camera.viewPlaneNormal[2]);
|
|
57
64
|
const viewRight = vec3.create();
|