@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
|
@@ -19,12 +19,13 @@ declare class WindowLevelTool extends BaseTool {
|
|
|
19
19
|
lower: any;
|
|
20
20
|
upper: any;
|
|
21
21
|
};
|
|
22
|
-
getNewRange({ viewport, deltaPointsCanvas, volumeId, lower, upper }: {
|
|
22
|
+
getNewRange({ viewport, deltaPointsCanvas, volumeId, lower, upper, voiLutFunction, }: {
|
|
23
23
|
viewport: any;
|
|
24
24
|
deltaPointsCanvas: any;
|
|
25
25
|
volumeId: any;
|
|
26
26
|
lower: any;
|
|
27
27
|
upper: any;
|
|
28
|
+
voiLutFunction: any;
|
|
28
29
|
}): {
|
|
29
30
|
lower: number;
|
|
30
31
|
upper: number;
|
|
@@ -45,7 +45,10 @@ class WindowLevelTool extends BaseTool {
|
|
|
45
45
|
const { viewport } = enabledElement;
|
|
46
46
|
let volumeId, lower, upper, modality, newRange, viewportsContainingVolumeUID;
|
|
47
47
|
let isPreScaled = false;
|
|
48
|
-
const properties = viewport
|
|
48
|
+
const properties = getViewportVOIProperties(viewport);
|
|
49
|
+
if (!properties?.voiRange) {
|
|
50
|
+
throw new Error('Viewport is not a valid type');
|
|
51
|
+
}
|
|
49
52
|
if (viewport instanceof VolumeViewport) {
|
|
50
53
|
volumeId = viewport.getVolumeId();
|
|
51
54
|
viewportsContainingVolumeUID =
|
|
@@ -86,12 +89,13 @@ class WindowLevelTool extends BaseTool {
|
|
|
86
89
|
volumeId,
|
|
87
90
|
lower,
|
|
88
91
|
upper,
|
|
92
|
+
voiLutFunction: properties.VOILUTFunction,
|
|
89
93
|
});
|
|
90
94
|
}
|
|
91
95
|
if (newRange.lower >= newRange.upper) {
|
|
92
96
|
return;
|
|
93
97
|
}
|
|
94
|
-
viewport
|
|
98
|
+
setViewportVOIProperties(viewport, {
|
|
95
99
|
voiRange: newRange,
|
|
96
100
|
});
|
|
97
101
|
viewport.render();
|
|
@@ -120,7 +124,7 @@ class WindowLevelTool extends BaseTool {
|
|
|
120
124
|
upper = isPreScaled ? Math.max(upper, 0.1) : upper;
|
|
121
125
|
return { lower, upper };
|
|
122
126
|
}
|
|
123
|
-
getNewRange({ viewport, deltaPointsCanvas, volumeId, lower, upper }) {
|
|
127
|
+
getNewRange({ viewport, deltaPointsCanvas, volumeId, lower, upper, voiLutFunction, }) {
|
|
124
128
|
const multiplier = this._getMultiplierFromDynamicRange(viewport, volumeId) ||
|
|
125
129
|
DEFAULT_MULTIPLIER;
|
|
126
130
|
const wwDelta = deltaPointsCanvas[0] * multiplier;
|
|
@@ -129,7 +133,6 @@ class WindowLevelTool extends BaseTool {
|
|
|
129
133
|
windowWidth += wwDelta;
|
|
130
134
|
windowCenter += wcDelta;
|
|
131
135
|
windowWidth = Math.max(windowWidth, 1);
|
|
132
|
-
const voiLutFunction = viewport.getProperties().VOILUTFunction;
|
|
133
136
|
return utilities.windowLevel.toLowHighRange(windowWidth, windowCenter, voiLutFunction);
|
|
134
137
|
}
|
|
135
138
|
_getMultiplierFromDynamicRange(viewport, volumeId) {
|
|
@@ -206,3 +209,44 @@ class WindowLevelTool extends BaseTool {
|
|
|
206
209
|
}
|
|
207
210
|
WindowLevelTool.toolName = 'WindowLevel';
|
|
208
211
|
export default WindowLevelTool;
|
|
212
|
+
function getViewportVOIProperties(viewport) {
|
|
213
|
+
const legacyViewport = viewport;
|
|
214
|
+
if (typeof legacyViewport.getProperties === 'function') {
|
|
215
|
+
return legacyViewport.getProperties();
|
|
216
|
+
}
|
|
217
|
+
const target = getDataPresentationTarget(viewport);
|
|
218
|
+
if (!target) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const dataPresentation = target.viewport.getDisplaySetPresentation?.(target.dataId);
|
|
222
|
+
const defaultVOIRange = target.viewport.getDefaultVOIRange?.(target.dataId);
|
|
223
|
+
return {
|
|
224
|
+
...(dataPresentation || {}),
|
|
225
|
+
voiRange: dataPresentation?.voiRange ?? defaultVOIRange,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function setViewportVOIProperties(viewport, props) {
|
|
229
|
+
const legacyViewport = viewport;
|
|
230
|
+
if (typeof legacyViewport.setProperties === 'function') {
|
|
231
|
+
legacyViewport.setProperties(props);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
const target = getDataPresentationTarget(viewport);
|
|
235
|
+
if (!target) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
target.viewport.setDisplaySetPresentation?.(target.dataId, props);
|
|
239
|
+
}
|
|
240
|
+
function getDataPresentationTarget(viewport) {
|
|
241
|
+
const genericViewport = viewport;
|
|
242
|
+
const dataId = genericViewport.getSourceDataId?.();
|
|
243
|
+
if (!dataId ||
|
|
244
|
+
typeof genericViewport.getDisplaySetPresentation !== 'function' ||
|
|
245
|
+
typeof genericViewport.setDisplaySetPresentation !== 'function') {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
viewport: genericViewport,
|
|
250
|
+
dataId,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
@@ -17,5 +17,13 @@ declare class ZoomTool extends BaseTool {
|
|
|
17
17
|
_dragPerspectiveProjection: (evt: EventTypes.InteractionEventType, viewport: Types.IStackViewport | Types.IVolumeViewport, camera: Types.ICamera, pinch?: boolean) => void;
|
|
18
18
|
_zoom(evt: EventTypes.MouseWheelEventType): void;
|
|
19
19
|
_panCallback(evt: EventTypes.InteractionEventType): void;
|
|
20
|
+
_dragViewportZoom(evt: EventTypes.InteractionEventType, viewport: {
|
|
21
|
+
getZoom(): number;
|
|
22
|
+
setZoom(...args: unknown[]): void;
|
|
23
|
+
}): void;
|
|
24
|
+
_applyViewportZoomDelta(viewport: {
|
|
25
|
+
getZoom(): number;
|
|
26
|
+
setZoom(...args: unknown[]): void;
|
|
27
|
+
}, element: HTMLDivElement, deltaY: number, canvasPoint?: Types.Point2): void;
|
|
20
28
|
}
|
|
21
29
|
export default ZoomTool;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { vec3 } from 'gl-matrix';
|
|
2
2
|
import vtkMath from '@kitware/vtk.js/Common/Core/Math';
|
|
3
|
-
import { getConfiguration } from '@cornerstonejs/core';
|
|
3
|
+
import { getConfiguration, viewportHasPan, viewportHasZoom, } from '@cornerstonejs/core';
|
|
4
4
|
import { Enums, getEnabledElement } from '@cornerstonejs/core';
|
|
5
5
|
import { BaseTool } from './base';
|
|
6
6
|
import { Events } from '../enums';
|
|
@@ -22,7 +22,11 @@ class ZoomTool extends BaseTool {
|
|
|
22
22
|
const { element, currentPoints } = eventData;
|
|
23
23
|
const worldPos = currentPoints.world;
|
|
24
24
|
const enabledElement = getEnabledElement(element);
|
|
25
|
-
const
|
|
25
|
+
const viewport = enabledElement.viewport;
|
|
26
|
+
const camera = getLegacyCamera(viewport);
|
|
27
|
+
if (!hasLegacyCameraPosition(camera)) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
26
30
|
const { focalPoint } = camera;
|
|
27
31
|
this.initialMousePosWorld = worldPos;
|
|
28
32
|
let dirVec = vec3.fromValues(focalPoint[0] - worldPos[0], focalPoint[1] - worldPos[1], focalPoint[2] - worldPos[2]);
|
|
@@ -145,17 +149,27 @@ class ZoomTool extends BaseTool {
|
|
|
145
149
|
const { element, currentPoints } = evt.detail;
|
|
146
150
|
const enabledElement = getEnabledElement(element);
|
|
147
151
|
const { viewport } = enabledElement;
|
|
148
|
-
const camera = viewport
|
|
152
|
+
const camera = getLegacyCamera(viewport);
|
|
149
153
|
const worldPos = currentPoints.world;
|
|
154
|
+
if (!hasLegacyCameraPosition(camera)) {
|
|
155
|
+
if (viewportHasZoom(viewport)) {
|
|
156
|
+
this._dragViewportZoom(evt, viewport);
|
|
157
|
+
viewport.render();
|
|
158
|
+
}
|
|
159
|
+
if (this.configuration.pan) {
|
|
160
|
+
this._panCallback(evt);
|
|
161
|
+
}
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
150
164
|
const { focalPoint } = camera;
|
|
151
165
|
this.initialMousePosWorld = worldPos;
|
|
152
166
|
let dirVec = vec3.fromValues(focalPoint[0] - worldPos[0], focalPoint[1] - worldPos[1], focalPoint[2] - worldPos[2]);
|
|
153
167
|
dirVec = vec3.normalize(vec3.create(), dirVec);
|
|
154
168
|
this.dirVec = dirVec;
|
|
155
|
-
if (camera.parallelProjection) {
|
|
169
|
+
if (hasLegacyParallelCamera(camera) && camera.parallelProjection) {
|
|
156
170
|
this._dragParallelProjection(evt, viewport, camera, true);
|
|
157
171
|
}
|
|
158
|
-
else {
|
|
172
|
+
else if (hasLegacyPerspectiveCamera(camera)) {
|
|
159
173
|
this._dragPerspectiveProjection(evt, viewport, camera, true);
|
|
160
174
|
}
|
|
161
175
|
viewport.render();
|
|
@@ -168,8 +182,14 @@ class ZoomTool extends BaseTool {
|
|
|
168
182
|
const { element } = evt.detail;
|
|
169
183
|
const enabledElement = getEnabledElement(element);
|
|
170
184
|
const { viewport } = enabledElement;
|
|
171
|
-
const camera = viewport
|
|
172
|
-
if (camera
|
|
185
|
+
const camera = getLegacyCamera(viewport);
|
|
186
|
+
if (!hasLegacyParallelCamera(camera)) {
|
|
187
|
+
if (!viewportHasZoom(viewport)) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
this._dragViewportZoom(evt, viewport);
|
|
191
|
+
}
|
|
192
|
+
else if (camera.parallelProjection) {
|
|
173
193
|
this._dragParallelProjection(evt, viewport, camera);
|
|
174
194
|
}
|
|
175
195
|
else {
|
|
@@ -181,9 +201,20 @@ class ZoomTool extends BaseTool {
|
|
|
181
201
|
const { element, points } = evt.detail;
|
|
182
202
|
const enabledElement = getEnabledElement(element);
|
|
183
203
|
const { viewport } = enabledElement;
|
|
184
|
-
const camera = viewport
|
|
204
|
+
const camera = getLegacyCamera(viewport);
|
|
185
205
|
const wheelData = evt.detail.wheel;
|
|
186
206
|
const direction = wheelData.direction;
|
|
207
|
+
if (!hasLegacyParallelCamera(camera)) {
|
|
208
|
+
if (!viewportHasZoom(viewport)) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const canvasPoint = this.configuration.zoomToCenter
|
|
212
|
+
? undefined
|
|
213
|
+
: points.canvas;
|
|
214
|
+
this._applyViewportZoomDelta(viewport, element, -direction * 5, canvasPoint);
|
|
215
|
+
viewport.render();
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
187
218
|
const eventDetails = {
|
|
188
219
|
detail: {
|
|
189
220
|
element,
|
|
@@ -211,7 +242,20 @@ class ZoomTool extends BaseTool {
|
|
|
211
242
|
const { element, deltaPoints } = evt.detail;
|
|
212
243
|
const enabledElement = getEnabledElement(element);
|
|
213
244
|
const deltaPointsWorld = deltaPoints.world;
|
|
214
|
-
const
|
|
245
|
+
const viewport = enabledElement.viewport;
|
|
246
|
+
const camera = getLegacyCamera(viewport);
|
|
247
|
+
if (!hasLegacyCameraPosition(camera)) {
|
|
248
|
+
if (!viewportHasPan(viewport)) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const pan = viewport.getPan();
|
|
252
|
+
viewport.setPan([
|
|
253
|
+
pan[0] + deltaPoints.canvas[0],
|
|
254
|
+
pan[1] + deltaPoints.canvas[1],
|
|
255
|
+
]);
|
|
256
|
+
viewport.render();
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
215
259
|
const { focalPoint, position } = camera;
|
|
216
260
|
const updatedPosition = [
|
|
217
261
|
position[0] - deltaPointsWorld[0],
|
|
@@ -223,12 +267,49 @@ class ZoomTool extends BaseTool {
|
|
|
223
267
|
focalPoint[1] - deltaPointsWorld[1],
|
|
224
268
|
focalPoint[2] - deltaPointsWorld[2],
|
|
225
269
|
];
|
|
226
|
-
|
|
270
|
+
viewport.setCamera({
|
|
227
271
|
focalPoint: updatedFocalPoint,
|
|
228
272
|
position: updatedPosition,
|
|
229
273
|
});
|
|
230
|
-
|
|
274
|
+
viewport.render();
|
|
275
|
+
}
|
|
276
|
+
_dragViewportZoom(evt, viewport) {
|
|
277
|
+
const { element, deltaPoints, startPoints } = evt.detail;
|
|
278
|
+
const canvasPoint = this.configuration.zoomToCenter
|
|
279
|
+
? undefined
|
|
280
|
+
: startPoints?.canvas;
|
|
281
|
+
this._applyViewportZoomDelta(viewport, element, deltaPoints.canvas[1], canvasPoint);
|
|
282
|
+
}
|
|
283
|
+
_applyViewportZoomDelta(viewport, element, deltaY, canvasPoint) {
|
|
284
|
+
const currentZoom = viewport.getZoom();
|
|
285
|
+
const zoomScale = 5 / Math.max(element.clientHeight, 1);
|
|
286
|
+
const k = deltaY * zoomScale * (this.configuration.invert ? -1 : 1);
|
|
287
|
+
const denominator = Math.max(1 - k, 0.01);
|
|
288
|
+
const unclampedZoom = currentZoom / denominator;
|
|
289
|
+
const zoom = Math.min(Math.max(unclampedZoom, this.configuration.minZoomScale), this.configuration.maxZoomScale);
|
|
290
|
+
viewport.setZoom(zoom, canvasPoint);
|
|
231
291
|
}
|
|
232
292
|
}
|
|
293
|
+
function getLegacyCamera(viewport) {
|
|
294
|
+
const maybeViewport = viewport;
|
|
295
|
+
return typeof maybeViewport.getCamera === 'function'
|
|
296
|
+
? maybeViewport.getCamera()
|
|
297
|
+
: undefined;
|
|
298
|
+
}
|
|
299
|
+
function hasLegacyCameraPosition(camera) {
|
|
300
|
+
return Boolean(camera &&
|
|
301
|
+
Array.isArray(camera.focalPoint) &&
|
|
302
|
+
Array.isArray(camera.position));
|
|
303
|
+
}
|
|
304
|
+
function hasLegacyParallelCamera(camera) {
|
|
305
|
+
return Boolean(hasLegacyCameraPosition(camera) &&
|
|
306
|
+
typeof camera.parallelProjection === 'boolean' &&
|
|
307
|
+
typeof camera.parallelScale === 'number' &&
|
|
308
|
+
Array.isArray(camera.viewPlaneNormal));
|
|
309
|
+
}
|
|
310
|
+
function hasLegacyPerspectiveCamera(camera) {
|
|
311
|
+
return Boolean(hasLegacyCameraPosition(camera) &&
|
|
312
|
+
Array.isArray(camera.viewPlaneNormal));
|
|
313
|
+
}
|
|
233
314
|
ZoomTool.toolName = 'Zoom';
|
|
234
315
|
export default ZoomTool;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { ChangeTypes, Events } from '../../enums';
|
|
2
3
|
import { getEnabledElement, utilities as csUtils, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
3
4
|
import { AnnotationTool } from '../base';
|
|
@@ -15,7 +16,6 @@ import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCur
|
|
|
15
16
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
16
17
|
import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
|
|
17
18
|
class AngleTool extends AnnotationTool {
|
|
18
|
-
static { this.toolName = 'Angle'; }
|
|
19
19
|
constructor(toolProps = {}, defaultToolProps = {
|
|
20
20
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
21
21
|
configuration: {
|
|
@@ -375,36 +375,6 @@ class AngleTool extends AnnotationTool {
|
|
|
375
375
|
};
|
|
376
376
|
this._throttledCalculateCachedStats = throttle(this._calculateCachedStats, 100, { trailing: true });
|
|
377
377
|
}
|
|
378
|
-
static { this.hydrate = (viewportId, points, options) => {
|
|
379
|
-
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
380
|
-
if (!enabledElement) {
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(AngleTool, enabledElement, points, options);
|
|
384
|
-
const { toolInstance, ...serializableOptions } = options || {};
|
|
385
|
-
const annotation = {
|
|
386
|
-
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
387
|
-
data: {
|
|
388
|
-
handles: {
|
|
389
|
-
points,
|
|
390
|
-
},
|
|
391
|
-
},
|
|
392
|
-
highlighted: false,
|
|
393
|
-
autoGenerated: false,
|
|
394
|
-
invalidated: false,
|
|
395
|
-
isLocked: false,
|
|
396
|
-
isVisible: true,
|
|
397
|
-
metadata: {
|
|
398
|
-
toolName: instance.getToolName(),
|
|
399
|
-
viewPlaneNormal,
|
|
400
|
-
FrameOfReferenceUID,
|
|
401
|
-
referencedImageId,
|
|
402
|
-
...serializableOptions,
|
|
403
|
-
},
|
|
404
|
-
};
|
|
405
|
-
addAnnotation(annotation, viewport.element);
|
|
406
|
-
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
407
|
-
}; }
|
|
408
378
|
handleSelectedCallback(evt, annotation, handle) {
|
|
409
379
|
const eventDetail = evt.detail;
|
|
410
380
|
const { element } = eventDetail;
|
|
@@ -446,7 +416,11 @@ class AngleTool extends AnnotationTool {
|
|
|
446
416
|
for (let i = 0; i < targetIds.length; i++) {
|
|
447
417
|
const targetId = targetIds[i];
|
|
448
418
|
const angle = angleBetweenLines([worldPos1, worldPos2], [worldPos2, worldPos3]);
|
|
449
|
-
const
|
|
419
|
+
const image = this.getTargetImageData(targetId);
|
|
420
|
+
if (!image) {
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
const { dimensions, imageData } = image;
|
|
450
424
|
this.isHandleOutsideImage = [worldPos1, worldPos2, worldPos3]
|
|
451
425
|
.map((worldPos) => csUtils.transformWorldToIndex(imageData, worldPos))
|
|
452
426
|
.some((index) => !csUtils.indexWithinDimensions(index, dimensions));
|
|
@@ -462,6 +436,38 @@ class AngleTool extends AnnotationTool {
|
|
|
462
436
|
return cachedStats;
|
|
463
437
|
}
|
|
464
438
|
}
|
|
439
|
+
_a = AngleTool;
|
|
440
|
+
AngleTool.toolName = 'Angle';
|
|
441
|
+
AngleTool.hydrate = (viewportId, points, options) => {
|
|
442
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
443
|
+
if (!enabledElement) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
|
|
447
|
+
const { toolInstance, ...serializableOptions } = options || {};
|
|
448
|
+
const annotation = {
|
|
449
|
+
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
450
|
+
data: {
|
|
451
|
+
handles: {
|
|
452
|
+
points,
|
|
453
|
+
},
|
|
454
|
+
},
|
|
455
|
+
highlighted: false,
|
|
456
|
+
autoGenerated: false,
|
|
457
|
+
invalidated: false,
|
|
458
|
+
isLocked: false,
|
|
459
|
+
isVisible: true,
|
|
460
|
+
metadata: {
|
|
461
|
+
toolName: instance.getToolName(),
|
|
462
|
+
viewPlaneNormal,
|
|
463
|
+
FrameOfReferenceUID,
|
|
464
|
+
referencedImageId,
|
|
465
|
+
...serializableOptions,
|
|
466
|
+
},
|
|
467
|
+
};
|
|
468
|
+
addAnnotation(annotation, viewport.element);
|
|
469
|
+
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
470
|
+
};
|
|
465
471
|
function defaultGetTextLines(data, targetId) {
|
|
466
472
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
467
473
|
const { angle } = cachedVolumeStats;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { ChangeTypes, Events } from '../../enums';
|
|
2
3
|
import { getEnabledElement, utilities as csUtils, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
3
4
|
import { AnnotationTool } from '../base';
|
|
@@ -14,7 +15,6 @@ import { isAnnotationVisible } from '../../stateManagement/annotation/annotation
|
|
|
14
15
|
import { setAnnotationLabel } from '../../utilities';
|
|
15
16
|
import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
|
|
16
17
|
class ArrowAnnotateTool extends AnnotationTool {
|
|
17
|
-
static { this.toolName = 'ArrowAnnotate'; }
|
|
18
18
|
constructor(toolProps = {}, defaultToolProps = {
|
|
19
19
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
20
20
|
configuration: {
|
|
@@ -345,33 +345,6 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
345
345
|
return renderStatus;
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
|
-
static { this.hydrate = (viewportId, points, label, options) => {
|
|
349
|
-
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
350
|
-
if (!enabledElement) {
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(ArrowAnnotateTool, enabledElement, points, options);
|
|
354
|
-
const { toolInstance, ...serializableOptions } = options || {};
|
|
355
|
-
const annotation = this.createAnnotation({
|
|
356
|
-
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
357
|
-
data: {
|
|
358
|
-
label: label || '',
|
|
359
|
-
handles: {
|
|
360
|
-
points,
|
|
361
|
-
},
|
|
362
|
-
},
|
|
363
|
-
autoGenerated: false,
|
|
364
|
-
metadata: {
|
|
365
|
-
toolName: instance.getToolName(),
|
|
366
|
-
viewPlaneNormal,
|
|
367
|
-
FrameOfReferenceUID,
|
|
368
|
-
referencedImageId,
|
|
369
|
-
...serializableOptions,
|
|
370
|
-
},
|
|
371
|
-
});
|
|
372
|
-
addAnnotation(annotation, viewport.element);
|
|
373
|
-
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
374
|
-
}; }
|
|
375
348
|
handleSelectedCallback(evt, annotation, handle) {
|
|
376
349
|
const eventDetail = evt.detail;
|
|
377
350
|
const { element } = eventDetail;
|
|
@@ -410,6 +383,35 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
410
383
|
csUtils.indexWithinDimensions(index2, dimensions));
|
|
411
384
|
}
|
|
412
385
|
}
|
|
386
|
+
_a = ArrowAnnotateTool;
|
|
387
|
+
ArrowAnnotateTool.toolName = 'ArrowAnnotate';
|
|
388
|
+
ArrowAnnotateTool.hydrate = (viewportId, points, label, options) => {
|
|
389
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
390
|
+
if (!enabledElement) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
|
|
394
|
+
const { toolInstance, ...serializableOptions } = options || {};
|
|
395
|
+
const annotation = _a.createAnnotation({
|
|
396
|
+
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
397
|
+
data: {
|
|
398
|
+
label: label || '',
|
|
399
|
+
handles: {
|
|
400
|
+
points,
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
autoGenerated: false,
|
|
404
|
+
metadata: {
|
|
405
|
+
toolName: instance.getToolName(),
|
|
406
|
+
viewPlaneNormal,
|
|
407
|
+
FrameOfReferenceUID,
|
|
408
|
+
referencedImageId,
|
|
409
|
+
...serializableOptions,
|
|
410
|
+
},
|
|
411
|
+
});
|
|
412
|
+
addAnnotation(annotation, viewport.element);
|
|
413
|
+
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
414
|
+
};
|
|
413
415
|
function getTextCallback(doneChangingTextCallback) {
|
|
414
416
|
return doneChangingTextCallback(prompt('Enter your annotation:'));
|
|
415
417
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { vec2, vec3 } from 'gl-matrix';
|
|
2
3
|
import { getEnabledElement, utilities as csUtils, getEnabledElementByViewportId, utilities, } from '@cornerstonejs/core';
|
|
3
4
|
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
@@ -17,7 +18,6 @@ import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnota
|
|
|
17
18
|
import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
|
|
18
19
|
const { transformWorldToIndex } = csUtils;
|
|
19
20
|
class BidirectionalTool extends AnnotationTool {
|
|
20
|
-
static { this.toolName = 'Bidirectional'; }
|
|
21
21
|
constructor(toolProps = {}, defaultToolProps = {
|
|
22
22
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
23
23
|
configuration: {
|
|
@@ -593,13 +593,13 @@ class BidirectionalTool extends AnnotationTool {
|
|
|
593
593
|
const handles1 = handles.slice(0, 2);
|
|
594
594
|
const handles2 = handles.slice(2, 4);
|
|
595
595
|
const calibrate = getCalibratedLengthUnitsAndScale(image, handles);
|
|
596
|
-
const dist1 =
|
|
597
|
-
const dist2 =
|
|
596
|
+
const dist1 = _a.calculateLengthInIndex(calibrate, handles1);
|
|
597
|
+
const dist2 = _a.calculateLengthInIndex(calibrate, handles2);
|
|
598
598
|
const { unit } = calibrate;
|
|
599
599
|
const length = dist1 > dist2 ? dist1 : dist2;
|
|
600
600
|
const width = dist1 > dist2 ? dist2 : dist1;
|
|
601
601
|
const widthUnit = unit;
|
|
602
|
-
this.isHandleOutsideImage = !
|
|
602
|
+
this.isHandleOutsideImage = !_a.isInsideVolume(dimensions, handles);
|
|
603
603
|
cachedStats[targetId] = {
|
|
604
604
|
length,
|
|
605
605
|
width,
|
|
@@ -660,54 +660,56 @@ class BidirectionalTool extends AnnotationTool {
|
|
|
660
660
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
661
661
|
return annotation;
|
|
662
662
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
663
|
+
}
|
|
664
|
+
_a = BidirectionalTool;
|
|
665
|
+
BidirectionalTool.toolName = 'Bidirectional';
|
|
666
|
+
BidirectionalTool.hydrate = (viewportId, axis, options) => {
|
|
667
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
668
|
+
if (!enabledElement) {
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = _a.hydrateBase(_a, enabledElement, axis[0], options);
|
|
672
|
+
const [majorAxis, minorAxis] = axis;
|
|
673
|
+
const [major0, major1] = majorAxis;
|
|
674
|
+
const [minor0, minor1] = minorAxis;
|
|
675
|
+
const points = [major0, major1, minor0, minor1];
|
|
676
|
+
const { toolInstance, ...serializableOptions } = options || {};
|
|
677
|
+
const annotation = {
|
|
678
|
+
annotationUID: options?.annotationUID || utilities.uuidv4(),
|
|
679
|
+
data: {
|
|
680
|
+
handles: {
|
|
681
|
+
points,
|
|
682
|
+
activeHandleIndex: null,
|
|
683
|
+
textBox: {
|
|
684
|
+
hasMoved: false,
|
|
685
|
+
worldPosition: [0, 0, 0],
|
|
686
|
+
worldBoundingBox: {
|
|
687
|
+
topLeft: [0, 0, 0],
|
|
688
|
+
topRight: [0, 0, 0],
|
|
689
|
+
bottomLeft: [0, 0, 0],
|
|
690
|
+
bottomRight: [0, 0, 0],
|
|
689
691
|
},
|
|
690
692
|
},
|
|
691
|
-
cachedStats: {},
|
|
692
693
|
},
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
694
|
+
cachedStats: {},
|
|
695
|
+
},
|
|
696
|
+
highlighted: false,
|
|
697
|
+
autoGenerated: false,
|
|
698
|
+
invalidated: false,
|
|
699
|
+
isLocked: false,
|
|
700
|
+
isVisible: true,
|
|
701
|
+
metadata: {
|
|
702
|
+
toolName: instance.getToolName(),
|
|
703
|
+
viewPlaneNormal,
|
|
704
|
+
FrameOfReferenceUID,
|
|
705
|
+
referencedImageId,
|
|
706
|
+
...serializableOptions,
|
|
707
|
+
},
|
|
708
|
+
};
|
|
709
|
+
addAnnotation(annotation, viewport.element);
|
|
710
|
+
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
711
|
+
return annotation;
|
|
712
|
+
};
|
|
711
713
|
function defaultGetTextLines(data, targetId) {
|
|
712
714
|
const { cachedStats, label } = data;
|
|
713
715
|
const { length, width, unit } = cachedStats[targetId];
|
|
@@ -18,6 +18,7 @@ declare class CircleROITool extends AnnotationTool {
|
|
|
18
18
|
constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps);
|
|
19
19
|
addNewAnnotation: (evt: EventTypes.InteractionEventType) => CircleROIAnnotation;
|
|
20
20
|
isPointNearTool: (element: HTMLDivElement, annotation: CircleROIAnnotation, canvasCoords: Types.Point2, proximity: number) => boolean;
|
|
21
|
+
_pointInEllipseCanvas(ellipse: any, location: Types.Point2): boolean;
|
|
21
22
|
toolSelectedCallback: (evt: EventTypes.InteractionEventType, annotation: CircleROIAnnotation) => void;
|
|
22
23
|
handleSelectedCallback: (evt: EventTypes.InteractionEventType, annotation: CircleROIAnnotation, handle: ToolHandle) => void;
|
|
23
24
|
_endCallback: (evt: EventTypes.InteractionEventType) => void;
|