@cornerstonejs/tools 4.22.13 → 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/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 -11
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +28 -166
- 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 +11 -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/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/tools/AdvancedMagnifyTool.js +1 -1
- package/dist/esm/tools/CrosshairsTool.js +5 -5
- package/dist/esm/tools/OrientationControllerTool.js +1 -1
- 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/VolumeCroppingTool.js +3 -2
- 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 +33 -31
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js +30 -28
- package/dist/esm/tools/annotation/BidirectionalTool.js +51 -49
- package/dist/esm/tools/annotation/CircleROITool.js +49 -44
- 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 +42 -37
- 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 +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js +6 -4
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +1 -1
- package/dist/esm/tools/annotation/ProbeTool.js +51 -46
- package/dist/esm/tools/annotation/RectangleROITool.js +42 -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 +51 -49
- 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 -5
- 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/segmentation/BrushTool.d.ts +9 -2
- package/dist/esm/tools/segmentation/BrushTool.js +109 -25
- package/dist/esm/tools/segmentation/CircleScissorsTool.js +13 -6
- package/dist/esm/tools/segmentation/LabelmapBaseTool.d.ts +2 -3
- package/dist/esm/tools/segmentation/LabelmapBaseTool.js +77 -38
- 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 +5 -1
- 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 -15
- 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/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/LabelmapToolOperationData.d.ts +5 -0
- package/dist/esm/types/LabelmapTypes.d.ts +29 -6
- package/dist/esm/types/SegmentationStateTypes.d.ts +4 -0
- package/dist/esm/utilities/calibrateImageSpacing.js +17 -2
- package/dist/esm/utilities/contours/AnnotationToPointData.js +1 -1
- 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/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 +2 -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/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +10 -10
|
@@ -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;
|
|
@@ -466,6 +436,38 @@ class AngleTool extends AnnotationTool {
|
|
|
466
436
|
return cachedStats;
|
|
467
437
|
}
|
|
468
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
|
+
};
|
|
469
471
|
function defaultGetTextLines(data, targetId) {
|
|
470
472
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
471
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];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { AnnotationTool, BaseTool } from '../base';
|
|
2
3
|
import { vec2, vec3 } from 'gl-matrix';
|
|
3
4
|
import { getEnabledElement, VolumeViewport, utilities as csUtils, getEnabledElementByViewportId, EPSILON, } from '@cornerstonejs/core';
|
|
@@ -14,6 +15,7 @@ import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters'
|
|
|
14
15
|
import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
|
|
15
16
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
16
17
|
import { getPixelValueUnits } from '../../utilities/getPixelValueUnits';
|
|
18
|
+
import { viewportSupportsImageSlices } from '../../utilities/viewportCapabilities';
|
|
17
19
|
import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScaled';
|
|
18
20
|
import { getCanvasCircleCorners, getCanvasCircleRadius, } from '../../utilities/math/circle';
|
|
19
21
|
import { getCanvasEllipseCorners, pointInEllipse, } from '../../utilities/math/ellipse';
|
|
@@ -22,7 +24,6 @@ import { getStyleProperty } from '../../stateManagement/annotation/config/helper
|
|
|
22
24
|
import getEllipseWorldCoordinates from '../../utilities/getEllipseWorldCoordinates';
|
|
23
25
|
const { transformWorldToIndex } = csUtils;
|
|
24
26
|
class CircleROITool extends AnnotationTool {
|
|
25
|
-
static { this.toolName = 'CircleROI'; }
|
|
26
27
|
constructor(toolProps = {}, defaultToolProps = {
|
|
27
28
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
28
29
|
configuration: {
|
|
@@ -394,7 +395,9 @@ class CircleROITool extends AnnotationTool {
|
|
|
394
395
|
const { referencedImageId } = annotation.metadata;
|
|
395
396
|
for (const targetId in data.cachedStats) {
|
|
396
397
|
if (targetId.startsWith('imageId')) {
|
|
397
|
-
const viewports = renderingEngine
|
|
398
|
+
const viewports = renderingEngine
|
|
399
|
+
.getViewports()
|
|
400
|
+
.filter(viewportSupportsImageSlices);
|
|
398
401
|
const invalidatedStack = viewports.find((vp) => {
|
|
399
402
|
const referencedImageURI = csUtils.imageIdToURI(referencedImageId);
|
|
400
403
|
const hasImageURI = vp.hasImageURI(referencedImageURI);
|
|
@@ -500,7 +503,7 @@ class CircleROITool extends AnnotationTool {
|
|
|
500
503
|
const { dimensions, imageData, metadata, voxelManager } = image;
|
|
501
504
|
const handles = points.map((point) => imageData.worldToIndex(point));
|
|
502
505
|
const calibrate = getCalibratedLengthUnitsAndScale(image, handles);
|
|
503
|
-
const radius =
|
|
506
|
+
const radius = _a.calculateLengthInIndex(calibrate, handles.slice(0, 2));
|
|
504
507
|
const area = Math.PI * radius * radius;
|
|
505
508
|
const perimeter = 2 * Math.PI * radius;
|
|
506
509
|
const isEmptyArea = radius === 0;
|
|
@@ -611,50 +614,52 @@ class CircleROITool extends AnnotationTool {
|
|
|
611
614
|
1.0;
|
|
612
615
|
return inEllipse;
|
|
613
616
|
}
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
617
|
+
}
|
|
618
|
+
_a = CircleROITool;
|
|
619
|
+
CircleROITool.toolName = 'CircleROI';
|
|
620
|
+
CircleROITool.hydrate = (viewportId, points, options) => {
|
|
621
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
622
|
+
if (!enabledElement) {
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
|
|
626
|
+
const { toolInstance, ...serializableOptions } = options || {};
|
|
627
|
+
const annotation = {
|
|
628
|
+
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
629
|
+
data: {
|
|
630
|
+
handles: {
|
|
631
|
+
points,
|
|
632
|
+
textBox: {
|
|
633
|
+
hasMoved: false,
|
|
634
|
+
worldPosition: [0, 0, 0],
|
|
635
|
+
worldBoundingBox: {
|
|
636
|
+
topLeft: [0, 0, 0],
|
|
637
|
+
topRight: [0, 0, 0],
|
|
638
|
+
bottomLeft: [0, 0, 0],
|
|
639
|
+
bottomRight: [0, 0, 0],
|
|
635
640
|
},
|
|
636
|
-
activeHandleIndex: null,
|
|
637
641
|
},
|
|
638
|
-
|
|
639
|
-
cachedStats: {},
|
|
640
|
-
},
|
|
641
|
-
highlighted: false,
|
|
642
|
-
autoGenerated: false,
|
|
643
|
-
invalidated: false,
|
|
644
|
-
isLocked: false,
|
|
645
|
-
isVisible: true,
|
|
646
|
-
metadata: {
|
|
647
|
-
toolName: instance.getToolName(),
|
|
648
|
-
viewPlaneNormal,
|
|
649
|
-
FrameOfReferenceUID,
|
|
650
|
-
referencedImageId,
|
|
651
|
-
...serializableOptions,
|
|
642
|
+
activeHandleIndex: null,
|
|
652
643
|
},
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
644
|
+
label: '',
|
|
645
|
+
cachedStats: {},
|
|
646
|
+
},
|
|
647
|
+
highlighted: false,
|
|
648
|
+
autoGenerated: false,
|
|
649
|
+
invalidated: false,
|
|
650
|
+
isLocked: false,
|
|
651
|
+
isVisible: true,
|
|
652
|
+
metadata: {
|
|
653
|
+
toolName: instance.getToolName(),
|
|
654
|
+
viewPlaneNormal,
|
|
655
|
+
FrameOfReferenceUID,
|
|
656
|
+
referencedImageId,
|
|
657
|
+
...serializableOptions,
|
|
658
|
+
},
|
|
659
|
+
};
|
|
660
|
+
addAnnotation(annotation, viewport.element);
|
|
661
|
+
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
662
|
+
};
|
|
658
663
|
function defaultGetTextLines(data, targetId) {
|
|
659
664
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
660
665
|
const { radius, radiusUnit, area, mean, stdDev, max, min, isEmptyArea, areaUnit, modalityUnit, } = cachedVolumeStats;
|
|
@@ -17,7 +17,6 @@ import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCur
|
|
|
17
17
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
18
18
|
import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
|
|
19
19
|
class CobbAngleTool extends AnnotationTool {
|
|
20
|
-
static { this.toolName = 'CobbAngle'; }
|
|
21
20
|
constructor(toolProps = {}, defaultToolProps = {
|
|
22
21
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
23
22
|
configuration: {
|
|
@@ -650,6 +649,7 @@ class CobbAngleTool extends AnnotationTool {
|
|
|
650
649
|
return cachedStats;
|
|
651
650
|
}
|
|
652
651
|
}
|
|
652
|
+
CobbAngleTool.toolName = 'CobbAngle';
|
|
653
653
|
function defaultGetTextLines(data, targetId) {
|
|
654
654
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
655
655
|
const { angle } = cachedVolumeStats;
|
|
@@ -5,7 +5,6 @@ import { hideElementCursor } from '../../cursors/elementCursor';
|
|
|
5
5
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
6
6
|
import ProbeTool from './ProbeTool';
|
|
7
7
|
class DragProbeTool extends ProbeTool {
|
|
8
|
-
static { this.toolName = 'DragProbe'; }
|
|
9
8
|
constructor(toolProps = {}, defaultToolProps = {
|
|
10
9
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
11
10
|
configuration: {
|
|
@@ -116,6 +115,7 @@ class DragProbeTool extends ProbeTool {
|
|
|
116
115
|
};
|
|
117
116
|
}
|
|
118
117
|
}
|
|
118
|
+
DragProbeTool.toolName = 'DragProbe';
|
|
119
119
|
function defaultGetTextLines(data, targetId) {
|
|
120
120
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
121
121
|
const { index, value, modalityUnit } = cachedVolumeStats;
|
|
@@ -13,7 +13,6 @@ import { getCanvasCircleRadius } from '../../utilities/math/circle';
|
|
|
13
13
|
import { vec3 } from 'gl-matrix';
|
|
14
14
|
const CROSSHAIR_SIZE = 5;
|
|
15
15
|
class ETDRSGridTool extends AnnotationTool {
|
|
16
|
-
static { this.toolName = 'ETDRSGrid'; }
|
|
17
16
|
constructor(toolProps = {}, defaultToolProps = {
|
|
18
17
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
19
18
|
configuration: {
|
|
@@ -351,4 +350,5 @@ class ETDRSGridTool extends AnnotationTool {
|
|
|
351
350
|
return distance;
|
|
352
351
|
}
|
|
353
352
|
}
|
|
353
|
+
ETDRSGridTool.toolName = 'ETDRSGrid';
|
|
354
354
|
export default ETDRSGridTool;
|