@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
|
@@ -17,7 +17,6 @@ import ContourSegmentationBaseTool from '../base/ContourSegmentationBaseTool';
|
|
|
17
17
|
import { getCalibratedLengthUnitsAndScale, throttle } from '../../utilities';
|
|
18
18
|
const CLICK_CLOSE_CURVE_SQR_DIST = 10 ** 2;
|
|
19
19
|
class LivewireContourTool extends ContourSegmentationBaseTool {
|
|
20
|
-
static { this.toolName = 'LivewireContour'; }
|
|
21
20
|
constructor(toolProps = {}, defaultToolProps = {
|
|
22
21
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
23
22
|
configuration: {
|
|
@@ -335,12 +334,9 @@ class LivewireContourTool extends ContourSegmentationBaseTool {
|
|
|
335
334
|
const deltaInX = vec3.distance(originalWorldPoint, deltaXPoint);
|
|
336
335
|
const deltaInY = vec3.distance(originalWorldPoint, deltaYPoint);
|
|
337
336
|
const { imageData } = image;
|
|
338
|
-
const {
|
|
337
|
+
const { areaUnit } = getCalibratedLengthUnitsAndScale(image, () => {
|
|
339
338
|
const { maxX: canvasMaxX, maxY: canvasMaxY, minX: canvasMinX, minY: canvasMinY, } = math.polyline.getAABB(canvasCoordinates);
|
|
340
|
-
const topLeftBBWorld = viewport.canvasToWorld([
|
|
341
|
-
canvasMinX,
|
|
342
|
-
canvasMinY,
|
|
343
|
-
]);
|
|
339
|
+
const topLeftBBWorld = viewport.canvasToWorld([canvasMinX, canvasMinY]);
|
|
344
340
|
const topLeftBBIndex = utilities.transformWorldToIndex(imageData, topLeftBBWorld);
|
|
345
341
|
const bottomRightBBWorld = viewport.canvasToWorld([
|
|
346
342
|
canvasMaxX,
|
|
@@ -349,8 +345,7 @@ class LivewireContourTool extends ContourSegmentationBaseTool {
|
|
|
349
345
|
const bottomRightBBIndex = utilities.transformWorldToIndex(imageData, bottomRightBBWorld);
|
|
350
346
|
return [topLeftBBIndex, bottomRightBBIndex];
|
|
351
347
|
});
|
|
352
|
-
|
|
353
|
-
area *= deltaInX * deltaInY;
|
|
348
|
+
const area = math.polyline.getArea(canvasCoordinates) * deltaInX * deltaInY;
|
|
354
349
|
cachedStats[targetId] = {
|
|
355
350
|
Modality: metadata.Modality,
|
|
356
351
|
area,
|
|
@@ -641,6 +636,7 @@ class LivewireContourTool extends ContourSegmentationBaseTool {
|
|
|
641
636
|
});
|
|
642
637
|
}
|
|
643
638
|
}
|
|
639
|
+
LivewireContourTool.toolName = 'LivewireContour';
|
|
644
640
|
export default LivewireContourTool;
|
|
645
641
|
function defaultGetTextLines(data, targetId) {
|
|
646
642
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { utilities } from '@cornerstonejs/core';
|
|
2
3
|
import { triggerSegmentationDataModified } from '../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
3
4
|
import PlanarFreehandROITool from './PlanarFreehandROITool';
|
|
4
5
|
import AnnotationToPointData from '../../utilities/contours/AnnotationToPointData';
|
|
5
6
|
export class PlanarFreehandContourSegmentationTool extends PlanarFreehandROITool {
|
|
6
|
-
static { this.toolName = 'PlanarFreehandContourSegmentationTool'; }
|
|
7
7
|
constructor(toolProps) {
|
|
8
8
|
const initialProps = utilities.deepMerge({
|
|
9
9
|
configuration: {
|
|
@@ -13,9 +13,6 @@ export class PlanarFreehandContourSegmentationTool extends PlanarFreehandROITool
|
|
|
13
13
|
}, toolProps);
|
|
14
14
|
super(initialProps);
|
|
15
15
|
}
|
|
16
|
-
static {
|
|
17
|
-
AnnotationToPointData.register(this);
|
|
18
|
-
}
|
|
19
16
|
isContourSegmentationTool() {
|
|
20
17
|
return true;
|
|
21
18
|
}
|
|
@@ -30,4 +27,9 @@ export class PlanarFreehandContourSegmentationTool extends PlanarFreehandROITool
|
|
|
30
27
|
return renderResult;
|
|
31
28
|
}
|
|
32
29
|
}
|
|
30
|
+
_a = PlanarFreehandContourSegmentationTool;
|
|
31
|
+
PlanarFreehandContourSegmentationTool.toolName = 'PlanarFreehandContourSegmentationTool';
|
|
32
|
+
(() => {
|
|
33
|
+
AnnotationToPointData.register(_a);
|
|
34
|
+
})();
|
|
33
35
|
export default PlanarFreehandContourSegmentationTool;
|
|
@@ -24,7 +24,6 @@ const { pointCanProjectOnLine } = polyline;
|
|
|
24
24
|
const { EPSILON } = CONSTANTS;
|
|
25
25
|
const PARALLEL_THRESHOLD = 1 - EPSILON;
|
|
26
26
|
class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
27
|
-
static { this.toolName = 'PlanarFreehandROI'; }
|
|
28
27
|
constructor(toolProps = {}, defaultToolProps = {
|
|
29
28
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
30
29
|
configuration: {
|
|
@@ -409,7 +408,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
409
408
|
}
|
|
410
409
|
}
|
|
411
410
|
updateClosedCachedStats({ viewport, points, imageData, metadata, cachedStats, targetId, modalityUnit, canvasCoordinates, calibratedScale, deltaInX, deltaInY, }) {
|
|
412
|
-
const {
|
|
411
|
+
const { areaUnit, unit } = calibratedScale;
|
|
413
412
|
const { voxelManager } = viewport.getImageData();
|
|
414
413
|
const indexPoints = points.map((point) => imageData.worldToIndex(point));
|
|
415
414
|
let iMin = Number.MAX_SAFE_INTEGER;
|
|
@@ -427,8 +426,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
427
426
|
kMin = Math.min(kMin, worldPosIndex[2]);
|
|
428
427
|
kMax = Math.max(kMax, worldPosIndex[2]);
|
|
429
428
|
}
|
|
430
|
-
|
|
431
|
-
area *= deltaInX * deltaInY;
|
|
429
|
+
const area = polyline.getArea(canvasCoordinates) * deltaInX * deltaInY;
|
|
432
430
|
const perimeter = PlanarFreehandROITool.calculateLengthInIndex(calibratedScale, indexPoints, closed);
|
|
433
431
|
const iDelta = 0.01 * (iMax - iMin);
|
|
434
432
|
const jDelta = 0.01 * (jMax - jMin);
|
|
@@ -530,6 +528,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
530
528
|
};
|
|
531
529
|
}
|
|
532
530
|
}
|
|
531
|
+
PlanarFreehandROITool.toolName = 'PlanarFreehandROI';
|
|
533
532
|
function defaultGetTextLines(data, targetId) {
|
|
534
533
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
535
534
|
const { area, mean, stdDev, length, perimeter, max, min, isEmptyArea, unit, areaUnit, modalityUnit, } = cachedVolumeStats || {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { vec2, vec3 } from 'gl-matrix';
|
|
2
3
|
import { getEnabledElement, VolumeViewport, utilities as csUtils, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
3
4
|
import { AnnotationTool } from '../base';
|
|
@@ -13,25 +14,12 @@ import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCur
|
|
|
13
14
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
14
15
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
15
16
|
import { getPixelValueUnits } from '../../utilities/getPixelValueUnits';
|
|
17
|
+
import { viewportSupportsImageSlices } from '../../utilities/viewportCapabilities';
|
|
16
18
|
import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScaled';
|
|
17
19
|
const { transformWorldToIndex } = csUtils;
|
|
18
20
|
class ProbeTool extends AnnotationTool {
|
|
19
|
-
static { this.toolName = 'Probe'; }
|
|
20
|
-
static { this.probeDefaults = {
|
|
21
|
-
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
22
|
-
configuration: {
|
|
23
|
-
shadow: true,
|
|
24
|
-
preventHandleOutsideImage: false,
|
|
25
|
-
getTextLines: defaultGetTextLines,
|
|
26
|
-
handleRadius: '6',
|
|
27
|
-
textCanvasOffset: {
|
|
28
|
-
x: 6,
|
|
29
|
-
y: -6,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
}; }
|
|
33
21
|
constructor(toolProps = {}, defaultToolProps) {
|
|
34
|
-
super(toolProps, AnnotationTool.mergeDefaultProps(
|
|
22
|
+
super(toolProps, AnnotationTool.mergeDefaultProps(_a.probeDefaults, defaultToolProps));
|
|
35
23
|
this.addNewAnnotation = (evt) => {
|
|
36
24
|
const eventDetail = evt.detail;
|
|
37
25
|
const { currentPoints, element } = eventDetail;
|
|
@@ -176,17 +164,24 @@ class ProbeTool extends AnnotationTool {
|
|
|
176
164
|
this._calculateCachedStats(annotation, renderingEngine, enabledElement);
|
|
177
165
|
if (viewport instanceof VolumeViewport) {
|
|
178
166
|
const { referencedImageId } = annotation.metadata;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
167
|
+
if (referencedImageId) {
|
|
168
|
+
for (const targetId in data.cachedStats) {
|
|
169
|
+
if (targetId.startsWith('imageId')) {
|
|
170
|
+
const viewports = renderingEngine
|
|
171
|
+
.getViewports()
|
|
172
|
+
.filter(viewportSupportsImageSlices);
|
|
173
|
+
const invalidatedStack = viewports.find((vp) => {
|
|
174
|
+
const currentImageId = vp.getCurrentImageId();
|
|
175
|
+
if (!currentImageId)
|
|
176
|
+
return false;
|
|
177
|
+
const referencedImageURI = csUtils.imageIdToURI(referencedImageId);
|
|
178
|
+
const hasImageURI = vp.hasImageURI(referencedImageURI);
|
|
179
|
+
const currentImageURI = csUtils.imageIdToURI(currentImageId);
|
|
180
|
+
return hasImageURI && currentImageURI !== referencedImageURI;
|
|
181
|
+
});
|
|
182
|
+
if (invalidatedStack) {
|
|
183
|
+
delete data.cachedStats[targetId];
|
|
184
|
+
}
|
|
190
185
|
}
|
|
191
186
|
}
|
|
192
187
|
}
|
|
@@ -225,36 +220,6 @@ class ProbeTool extends AnnotationTool {
|
|
|
225
220
|
return vec2.distance(canvasCoords, annotationCanvasCoordinate) < proximity;
|
|
226
221
|
}
|
|
227
222
|
toolSelectedCallback() { }
|
|
228
|
-
static { this.hydrate = (viewportId, points, options) => {
|
|
229
|
-
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
230
|
-
if (!enabledElement) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, viewUp, instance, viewport, } = this.hydrateBase(ProbeTool, enabledElement, points, options);
|
|
234
|
-
const { toolInstance, ...serializableOptions } = options || {};
|
|
235
|
-
const annotation = {
|
|
236
|
-
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
237
|
-
data: {
|
|
238
|
-
handles: {
|
|
239
|
-
points,
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
|
-
highlighted: false,
|
|
243
|
-
autoGenerated: false,
|
|
244
|
-
invalidated: false,
|
|
245
|
-
isLocked: false,
|
|
246
|
-
isVisible: true,
|
|
247
|
-
metadata: {
|
|
248
|
-
toolName: instance.getToolName(),
|
|
249
|
-
viewPlaneNormal,
|
|
250
|
-
FrameOfReferenceUID,
|
|
251
|
-
referencedImageId,
|
|
252
|
-
...serializableOptions,
|
|
253
|
-
},
|
|
254
|
-
};
|
|
255
|
-
addAnnotation(annotation, viewport.element);
|
|
256
|
-
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
257
|
-
}; }
|
|
258
223
|
getHandleNearImagePoint(element, annotation, canvasCoords, proximity) {
|
|
259
224
|
const enabledElement = getEnabledElement(element);
|
|
260
225
|
const { viewport } = enabledElement;
|
|
@@ -358,6 +323,51 @@ class ProbeTool extends AnnotationTool {
|
|
|
358
323
|
return cachedStats;
|
|
359
324
|
}
|
|
360
325
|
}
|
|
326
|
+
_a = ProbeTool;
|
|
327
|
+
ProbeTool.toolName = 'Probe';
|
|
328
|
+
ProbeTool.probeDefaults = {
|
|
329
|
+
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
330
|
+
configuration: {
|
|
331
|
+
shadow: true,
|
|
332
|
+
preventHandleOutsideImage: false,
|
|
333
|
+
getTextLines: defaultGetTextLines,
|
|
334
|
+
handleRadius: '6',
|
|
335
|
+
textCanvasOffset: {
|
|
336
|
+
x: 6,
|
|
337
|
+
y: -6,
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
};
|
|
341
|
+
ProbeTool.hydrate = (viewportId, points, options) => {
|
|
342
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
343
|
+
if (!enabledElement) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, viewUp, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
|
|
347
|
+
const { toolInstance, ...serializableOptions } = options || {};
|
|
348
|
+
const annotation = {
|
|
349
|
+
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
350
|
+
data: {
|
|
351
|
+
handles: {
|
|
352
|
+
points,
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
highlighted: false,
|
|
356
|
+
autoGenerated: false,
|
|
357
|
+
invalidated: false,
|
|
358
|
+
isLocked: false,
|
|
359
|
+
isVisible: true,
|
|
360
|
+
metadata: {
|
|
361
|
+
toolName: instance.getToolName(),
|
|
362
|
+
viewPlaneNormal,
|
|
363
|
+
FrameOfReferenceUID,
|
|
364
|
+
referencedImageId,
|
|
365
|
+
...serializableOptions,
|
|
366
|
+
},
|
|
367
|
+
};
|
|
368
|
+
addAnnotation(annotation, viewport.element);
|
|
369
|
+
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
370
|
+
};
|
|
361
371
|
function defaultGetTextLines(data, targetId) {
|
|
362
372
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
363
373
|
const { index, value, modalityUnit } = cachedVolumeStats;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { AnnotationTool } from '../base';
|
|
2
3
|
import { getEnabledElement, VolumeViewport, utilities as csUtils, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
3
4
|
import { vec3 } from 'gl-matrix';
|
|
@@ -15,12 +16,12 @@ import * as rectangle from '../../utilities/math/rectangle';
|
|
|
15
16
|
import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
|
|
16
17
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
17
18
|
import { getPixelValueUnits } from '../../utilities/getPixelValueUnits';
|
|
19
|
+
import { viewportSupportsImageSlices } from '../../utilities/viewportCapabilities';
|
|
18
20
|
import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScaled';
|
|
19
21
|
import { BasicStatsCalculator } from '../../utilities/math/basic';
|
|
20
22
|
import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
|
|
21
23
|
const { transformWorldToIndex } = csUtils;
|
|
22
24
|
class RectangleROITool extends AnnotationTool {
|
|
23
|
-
static { this.toolName = 'RectangleROI'; }
|
|
24
25
|
constructor(toolProps = {}, defaultToolProps = {
|
|
25
26
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
26
27
|
configuration: {
|
|
@@ -352,7 +353,9 @@ class RectangleROITool extends AnnotationTool {
|
|
|
352
353
|
const { referencedImageId } = annotation.metadata;
|
|
353
354
|
for (const targetId in data.cachedStats) {
|
|
354
355
|
if (targetId.startsWith('imageId')) {
|
|
355
|
-
const viewports = renderingEngine
|
|
356
|
+
const viewports = renderingEngine
|
|
357
|
+
.getViewports()
|
|
358
|
+
.filter(viewportSupportsImageSlices);
|
|
356
359
|
const invalidatedStack = viewports.find((vp) => {
|
|
357
360
|
const referencedImageURI = csUtils.imageIdToURI(referencedImageId);
|
|
358
361
|
const hasImageURI = vp.hasImageURI(referencedImageURI);
|
|
@@ -456,8 +459,14 @@ class RectangleROITool extends AnnotationTool {
|
|
|
456
459
|
];
|
|
457
460
|
const handles = [pos1Index, pos2Index];
|
|
458
461
|
const calibrate = getCalibratedLengthUnitsAndScale(image, handles);
|
|
459
|
-
const width =
|
|
460
|
-
|
|
462
|
+
const width = _a.calculateLengthInIndex(calibrate, [
|
|
463
|
+
indexHandles[0],
|
|
464
|
+
indexHandles[1],
|
|
465
|
+
]);
|
|
466
|
+
const height = _a.calculateLengthInIndex(calibrate, [
|
|
467
|
+
indexHandles[0],
|
|
468
|
+
indexHandles[2],
|
|
469
|
+
]);
|
|
461
470
|
const area = Math.abs(width * height);
|
|
462
471
|
const { areaUnit } = calibrate;
|
|
463
472
|
const pixelUnitsOptions = {
|
|
@@ -507,40 +516,42 @@ class RectangleROITool extends AnnotationTool {
|
|
|
507
516
|
};
|
|
508
517
|
this._throttledCalculateCachedStats = throttle(this._calculateCachedStats, 100, { trailing: true });
|
|
509
518
|
}
|
|
510
|
-
static { this.hydrate = (viewportId, points, options) => {
|
|
511
|
-
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
512
|
-
if (!enabledElement) {
|
|
513
|
-
return;
|
|
514
|
-
}
|
|
515
|
-
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(RectangleROITool, enabledElement, points, options);
|
|
516
|
-
const { toolInstance, ...serializableOptions } = options || {};
|
|
517
|
-
const annotation = {
|
|
518
|
-
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
519
|
-
data: {
|
|
520
|
-
handles: {
|
|
521
|
-
points,
|
|
522
|
-
activeHandleIndex: null,
|
|
523
|
-
},
|
|
524
|
-
label: '',
|
|
525
|
-
cachedStats: {},
|
|
526
|
-
},
|
|
527
|
-
highlighted: false,
|
|
528
|
-
autoGenerated: false,
|
|
529
|
-
invalidated: false,
|
|
530
|
-
isLocked: false,
|
|
531
|
-
isVisible: true,
|
|
532
|
-
metadata: {
|
|
533
|
-
toolName: instance.getToolName(),
|
|
534
|
-
viewPlaneNormal,
|
|
535
|
-
FrameOfReferenceUID,
|
|
536
|
-
referencedImageId,
|
|
537
|
-
...serializableOptions,
|
|
538
|
-
},
|
|
539
|
-
};
|
|
540
|
-
addAnnotation(annotation, viewport.element);
|
|
541
|
-
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
542
|
-
}; }
|
|
543
519
|
}
|
|
520
|
+
_a = RectangleROITool;
|
|
521
|
+
RectangleROITool.toolName = 'RectangleROI';
|
|
522
|
+
RectangleROITool.hydrate = (viewportId, points, options) => {
|
|
523
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
524
|
+
if (!enabledElement) {
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
|
|
528
|
+
const { toolInstance, ...serializableOptions } = options || {};
|
|
529
|
+
const annotation = {
|
|
530
|
+
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
531
|
+
data: {
|
|
532
|
+
handles: {
|
|
533
|
+
points,
|
|
534
|
+
activeHandleIndex: null,
|
|
535
|
+
},
|
|
536
|
+
label: '',
|
|
537
|
+
cachedStats: {},
|
|
538
|
+
},
|
|
539
|
+
highlighted: false,
|
|
540
|
+
autoGenerated: false,
|
|
541
|
+
invalidated: false,
|
|
542
|
+
isLocked: false,
|
|
543
|
+
isVisible: true,
|
|
544
|
+
metadata: {
|
|
545
|
+
toolName: instance.getToolName(),
|
|
546
|
+
viewPlaneNormal,
|
|
547
|
+
FrameOfReferenceUID,
|
|
548
|
+
referencedImageId,
|
|
549
|
+
...serializableOptions,
|
|
550
|
+
},
|
|
551
|
+
};
|
|
552
|
+
addAnnotation(annotation, viewport.element);
|
|
553
|
+
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
554
|
+
};
|
|
544
555
|
function defaultGetTextLines(data, targetId) {
|
|
545
556
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
546
557
|
const { area, mean, max, stdDev, areaUnit, modalityUnit, min } = cachedVolumeStats;
|
|
@@ -4,7 +4,6 @@ import GrowCutBaseTool from '../base/GrowCutBaseTool';
|
|
|
4
4
|
import { calculateGrowCutSeeds } from '../../utilities/segmentation/growCut/runOneClickGrowCut';
|
|
5
5
|
import { ToolModes } from '../../enums';
|
|
6
6
|
class RegionSegmentPlusTool extends GrowCutBaseTool {
|
|
7
|
-
static { this.toolName = 'RegionSegmentPlus'; }
|
|
8
7
|
constructor(toolProps = {}, defaultToolProps = {
|
|
9
8
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
10
9
|
configuration: {
|
|
@@ -125,4 +124,5 @@ class RegionSegmentPlusTool extends GrowCutBaseTool {
|
|
|
125
124
|
});
|
|
126
125
|
}
|
|
127
126
|
}
|
|
127
|
+
RegionSegmentPlusTool.toolName = 'RegionSegmentPlus';
|
|
128
128
|
export default RegionSegmentPlusTool;
|
|
@@ -7,7 +7,6 @@ import triggerAnnotationRenderForViewportUIDs from '../../utilities/triggerAnnot
|
|
|
7
7
|
import { growCut } from '../../utilities/segmentation';
|
|
8
8
|
import GrowCutBaseTool from '../base/GrowCutBaseTool';
|
|
9
9
|
class RegionSegmentTool extends GrowCutBaseTool {
|
|
10
|
-
static { this.toolName = 'RegionSegment'; }
|
|
11
10
|
constructor(toolProps = {}, defaultToolProps = {
|
|
12
11
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
13
12
|
configuration: {
|
|
@@ -111,4 +110,5 @@ class RegionSegmentTool extends GrowCutBaseTool {
|
|
|
111
110
|
});
|
|
112
111
|
}
|
|
113
112
|
}
|
|
113
|
+
RegionSegmentTool.toolName = 'RegionSegment';
|
|
114
114
|
export default RegionSegmentTool;
|
|
@@ -3,7 +3,6 @@ import SplineROITool from './SplineROITool';
|
|
|
3
3
|
import { Events } from '../../enums';
|
|
4
4
|
import { convertContourSegmentationAnnotation } from '../../utilities/contourSegmentation';
|
|
5
5
|
class SplineContourSegmentationTool extends SplineROITool {
|
|
6
|
-
static { this.toolName = 'SplineContourSegmentationTool'; }
|
|
7
6
|
constructor(toolProps) {
|
|
8
7
|
const initialProps = utilities.deepMerge({
|
|
9
8
|
configuration: {
|
|
@@ -33,4 +32,5 @@ class SplineContourSegmentationTool extends SplineROITool {
|
|
|
33
32
|
convertContourSegmentationAnnotation(annotation);
|
|
34
33
|
}
|
|
35
34
|
}
|
|
35
|
+
SplineContourSegmentationTool.toolName = 'SplineContourSegmentationTool';
|
|
36
36
|
export default SplineContourSegmentationTool;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { getEnabledElement, eventTarget, triggerEvent, utilities, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
2
3
|
import { vec3 } from 'gl-matrix';
|
|
3
4
|
import { addAnnotation, getChildAnnotations, removeAnnotation, } from '../../stateManagement/annotation/annotationState';
|
|
@@ -46,9 +47,6 @@ const splineToolNames = [
|
|
|
46
47
|
'CardinalSplineROI',
|
|
47
48
|
];
|
|
48
49
|
class SplineROITool extends ContourSegmentationBaseTool {
|
|
49
|
-
static { this.toolName = 'SplineROI'; }
|
|
50
|
-
static { this.SplineTypes = SplineTypesEnum; }
|
|
51
|
-
static { this.Actions = SplineToolActions; }
|
|
52
50
|
constructor(toolProps = {}, defaultToolProps = {
|
|
53
51
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
54
52
|
configuration: {
|
|
@@ -118,6 +116,9 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
118
116
|
this.fireChangeOnUpdate = null;
|
|
119
117
|
this.isPointNearTool = (element, annotation, canvasCoords, proximity) => {
|
|
120
118
|
const { instance: spline } = annotation.data.spline;
|
|
119
|
+
if (!spline) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
121
122
|
return spline.isPointNearCurve(canvasCoords, proximity);
|
|
122
123
|
};
|
|
123
124
|
this.toolSelectedCallback = (evt, annotation) => {
|
|
@@ -470,12 +471,9 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
470
471
|
const deltaInX = vec3.distance(originalWorldPoint, deltaXPoint);
|
|
471
472
|
const deltaInY = vec3.distance(originalWorldPoint, deltaYPoint);
|
|
472
473
|
const { imageData } = image;
|
|
473
|
-
const {
|
|
474
|
+
const { areaUnit } = getCalibratedLengthUnitsAndScale(image, () => {
|
|
474
475
|
const { maxX: canvasMaxX, maxY: canvasMaxY, minX: canvasMinX, minY: canvasMinY, } = math.polyline.getAABB(canvasCoordinates);
|
|
475
|
-
const topLeftBBWorld = viewport.canvasToWorld([
|
|
476
|
-
canvasMinX,
|
|
477
|
-
canvasMinY,
|
|
478
|
-
]);
|
|
476
|
+
const topLeftBBWorld = viewport.canvasToWorld([canvasMinX, canvasMinY]);
|
|
479
477
|
const topLeftBBIndex = utilities.transformWorldToIndex(imageData, topLeftBBWorld);
|
|
480
478
|
const bottomRightBBWorld = viewport.canvasToWorld([
|
|
481
479
|
canvasMaxX,
|
|
@@ -484,8 +482,7 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
484
482
|
const bottomRightBBIndex = utilities.transformWorldToIndex(imageData, bottomRightBBWorld);
|
|
485
483
|
return [topLeftBBIndex, bottomRightBBIndex];
|
|
486
484
|
});
|
|
487
|
-
|
|
488
|
-
area *= deltaInX * deltaInY;
|
|
485
|
+
const area = math.polyline.getArea(canvasCoordinates) * deltaInX * deltaInY;
|
|
489
486
|
cachedStats[targetId] = {
|
|
490
487
|
Modality: metadata.Modality,
|
|
491
488
|
area,
|
|
@@ -584,6 +581,9 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
584
581
|
const { lineWidth, lineDash, color, locked: annotationLocked, } = annotationStyle;
|
|
585
582
|
const canvasCoordinates = controlPoints.map((p) => worldToCanvas(p));
|
|
586
583
|
const { drawPreviewEnabled } = this.configuration.spline;
|
|
584
|
+
if (annotation.data.spline && !annotation.data.spline.instance) {
|
|
585
|
+
annotation.data.spline.instance = new (this._getSplineConfig(annotation.data.spline.type).Class)();
|
|
586
|
+
}
|
|
587
587
|
const splineType = annotation.data.spline.type;
|
|
588
588
|
const splineConfig = this._getSplineConfig(splineType);
|
|
589
589
|
const spline = annotation.data.spline.instance;
|
|
@@ -780,54 +780,58 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
780
780
|
}
|
|
781
781
|
return spline;
|
|
782
782
|
}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
instance: splineInstance,
|
|
809
|
-
},
|
|
810
|
-
contour: {
|
|
811
|
-
closed: true,
|
|
812
|
-
},
|
|
783
|
+
}
|
|
784
|
+
_a = SplineROITool;
|
|
785
|
+
SplineROITool.toolName = 'SplineROI';
|
|
786
|
+
SplineROITool.SplineTypes = SplineTypesEnum;
|
|
787
|
+
SplineROITool.Actions = SplineToolActions;
|
|
788
|
+
SplineROITool.hydrate = (viewportId, points, options) => {
|
|
789
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
790
|
+
if (!enabledElement) {
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
if (points.length < SPLINE_MIN_POINTS) {
|
|
794
|
+
console.warn('Spline requires at least 3 control points');
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, viewUp, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
|
|
798
|
+
const splineType = options?.splineType || SplineTypesEnum.CatmullRom;
|
|
799
|
+
const splineConfig = instance._getSplineConfig(splineType);
|
|
800
|
+
const SplineClass = splineConfig.Class;
|
|
801
|
+
const splineInstance = new SplineClass();
|
|
802
|
+
const { toolInstance, ...serializableOptions } = options || {};
|
|
803
|
+
const annotation = {
|
|
804
|
+
annotationUID: options?.annotationUID || utilities.uuidv4(),
|
|
805
|
+
data: {
|
|
806
|
+
handles: {
|
|
807
|
+
points,
|
|
813
808
|
},
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
metadata: {
|
|
820
|
-
toolName: instance.getToolName(),
|
|
821
|
-
viewPlaneNormal,
|
|
822
|
-
FrameOfReferenceUID,
|
|
823
|
-
referencedImageId,
|
|
824
|
-
...serializableOptions,
|
|
809
|
+
label: '',
|
|
810
|
+
cachedStats: {},
|
|
811
|
+
spline: {
|
|
812
|
+
type: splineType,
|
|
813
|
+
instance: splineInstance,
|
|
825
814
|
},
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
815
|
+
contour: {
|
|
816
|
+
closed: true,
|
|
817
|
+
},
|
|
818
|
+
},
|
|
819
|
+
highlighted: false,
|
|
820
|
+
autoGenerated: false,
|
|
821
|
+
invalidated: true,
|
|
822
|
+
isLocked: false,
|
|
823
|
+
isVisible: true,
|
|
824
|
+
metadata: {
|
|
825
|
+
toolName: instance.getToolName(),
|
|
826
|
+
viewPlaneNormal,
|
|
827
|
+
FrameOfReferenceUID,
|
|
828
|
+
referencedImageId,
|
|
829
|
+
...serializableOptions,
|
|
830
|
+
},
|
|
831
|
+
};
|
|
832
|
+
addAnnotation(annotation, viewport.element);
|
|
833
|
+
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
834
|
+
};
|
|
831
835
|
function defaultGetTextLines(data, targetId) {
|
|
832
836
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
833
837
|
const { area, isEmptyArea, areaUnit } = cachedVolumeStats;
|
|
@@ -14,7 +14,6 @@ import { getCalibratedProbeUnitsAndValue } from '../../utilities/getCalibratedUn
|
|
|
14
14
|
import { lineSegment } from '../../utilities/math';
|
|
15
15
|
const { transformWorldToIndex } = csUtils;
|
|
16
16
|
class UltrasoundDirectionalTool extends AnnotationTool {
|
|
17
|
-
static { this.toolName = 'UltrasoundDirectionalTool'; }
|
|
18
17
|
constructor(toolProps = {}, defaultToolProps = {
|
|
19
18
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
20
19
|
configuration: {
|
|
@@ -417,6 +416,7 @@ class UltrasoundDirectionalTool extends AnnotationTool {
|
|
|
417
416
|
return cachedStats;
|
|
418
417
|
}
|
|
419
418
|
}
|
|
419
|
+
UltrasoundDirectionalTool.toolName = 'UltrasoundDirectionalTool';
|
|
420
420
|
function defaultGetTextLines(data, targetId, configuration) {
|
|
421
421
|
const cachedStats = data.cachedStats[targetId];
|
|
422
422
|
const { xValues, yValues, units, isUnitless, isHorizontal } = cachedStats;
|