@cornerstonejs/tools 2.0.0-beta.2 → 2.0.0-beta.3
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/cjs/drawingSvg/getSvgDrawingHelper.js +1 -1
- package/dist/cjs/drawingSvg/getSvgDrawingHelper.js.map +1 -1
- package/dist/cjs/enums/Events.d.ts +1 -0
- package/dist/cjs/enums/Events.js +1 -0
- package/dist/cjs/enums/Events.js.map +1 -1
- package/dist/cjs/eventDispatchers/mouseEventHandlers/mouseDown.js +6 -1
- package/dist/cjs/eventDispatchers/mouseEventHandlers/mouseDown.js.map +1 -1
- package/dist/cjs/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.d.ts +2 -0
- package/dist/cjs/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.js +41 -0
- package/dist/cjs/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.js.map +1 -0
- package/dist/cjs/eventDispatchers/shared/getToolsWithActionsForMouseEvent.d.ts +3 -0
- package/dist/cjs/eventDispatchers/shared/getToolsWithActionsForMouseEvent.js +39 -0
- package/dist/cjs/eventDispatchers/shared/getToolsWithActionsForMouseEvent.js.map +1 -0
- package/dist/cjs/eventListeners/mouse/mouseDownListener.js +5 -1
- package/dist/cjs/eventListeners/mouse/mouseDownListener.js.map +1 -1
- package/dist/cjs/eventListeners/mouse/mouseMoveListener.js +5 -1
- package/dist/cjs/eventListeners/mouse/mouseMoveListener.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +5 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/store/ToolGroupManager/ToolGroup.d.ts +2 -0
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js +35 -0
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/cjs/synchronizers/callbacks/stackImageSyncCallback.js +1 -1
- package/dist/cjs/synchronizers/callbacks/stackImageSyncCallback.js.map +1 -1
- package/dist/cjs/tools/AdvancedMagnifyTool.d.ts +36 -0
- package/dist/cjs/tools/AdvancedMagnifyTool.js +448 -0
- package/dist/cjs/tools/AdvancedMagnifyTool.js.map +1 -0
- package/dist/cjs/tools/AdvancedMagnifyViewport.d.ts +76 -0
- package/dist/cjs/tools/AdvancedMagnifyViewport.js +352 -0
- package/dist/cjs/tools/AdvancedMagnifyViewport.js.map +1 -0
- package/dist/cjs/tools/AdvancedMagnifyViewportManager.d.ts +36 -0
- package/dist/cjs/tools/AdvancedMagnifyViewportManager.js +133 -0
- package/dist/cjs/tools/AdvancedMagnifyViewportManager.js.map +1 -0
- package/dist/cjs/tools/MagnifyTool.js +2 -2
- package/dist/cjs/tools/MagnifyTool.js.map +1 -1
- package/dist/cjs/tools/OrientationMarkerTool.d.ts +88 -0
- package/dist/cjs/tools/OrientationMarkerTool.js +193 -0
- package/dist/cjs/tools/OrientationMarkerTool.js.map +1 -0
- package/dist/cjs/tools/OverlayGridTool.d.ts +31 -0
- package/dist/cjs/tools/OverlayGridTool.js +170 -0
- package/dist/cjs/tools/OverlayGridTool.js.map +1 -0
- package/dist/cjs/tools/ReferenceLinesTool.d.ts +3 -0
- package/dist/cjs/tools/ReferenceLinesTool.js +71 -2
- package/dist/cjs/tools/ReferenceLinesTool.js.map +1 -1
- package/dist/cjs/tools/annotation/AngleTool.js +2 -1
- package/dist/cjs/tools/annotation/AngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/BidirectionalTool.js +1 -1
- package/dist/cjs/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/cjs/tools/annotation/CircleROITool.d.ts +1 -2
- package/dist/cjs/tools/annotation/CircleROITool.js +8 -8
- package/dist/cjs/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/CobbAngleTool.d.ts +31 -5
- package/dist/cjs/tools/annotation/CobbAngleTool.js +268 -71
- package/dist/cjs/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/DragProbeTool.js +4 -3
- package/dist/cjs/tools/annotation/DragProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.d.ts +2 -3
- package/dist/cjs/tools/annotation/EllipticalROITool.js +20 -16
- package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/LengthTool.js +1 -1
- package/dist/cjs/tools/annotation/LengthTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.d.ts +1 -2
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +22 -9
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/ProbeTool.d.ts +1 -2
- package/dist/cjs/tools/annotation/ProbeTool.js +10 -9
- package/dist/cjs/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.d.ts +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.js +9 -9
- package/dist/cjs/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/cjs/tools/base/AnnotationDisplayTool.js +4 -0
- package/dist/cjs/tools/base/AnnotationDisplayTool.js.map +1 -1
- package/dist/cjs/tools/base/AnnotationTool.d.ts +1 -1
- package/dist/cjs/tools/base/AnnotationTool.js.map +1 -1
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js +3 -0
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/cjs/tools/index.d.ts +4 -1
- package/dist/cjs/tools/index.js +7 -1
- package/dist/cjs/tools/index.js.map +1 -1
- package/dist/cjs/types/EventTypes.d.ts +9 -1
- package/dist/cjs/types/IToolGroup.d.ts +3 -0
- package/dist/cjs/types/ToolAction.d.ts +8 -0
- package/dist/cjs/types/ToolAction.js +3 -0
- package/dist/cjs/types/ToolAction.js.map +1 -0
- package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +55 -0
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/cjs/utilities/getModalityUnit.js +5 -2
- package/dist/cjs/utilities/getModalityUnit.js.map +1 -1
- package/dist/cjs/utilities/index.d.ts +2 -2
- package/dist/cjs/utilities/index.js +4 -3
- package/dist/cjs/utilities/index.js.map +1 -1
- package/dist/cjs/utilities/math/angle/angleBetweenLines.d.ts +3 -1
- package/dist/cjs/utilities/math/angle/angleBetweenLines.js +18 -1
- package/dist/cjs/utilities/math/angle/angleBetweenLines.js.map +1 -1
- package/dist/cjs/utilities/stackPrefetch/index.d.ts +3 -2
- package/dist/cjs/utilities/stackPrefetch/index.js +8 -6
- package/dist/cjs/utilities/stackPrefetch/index.js.map +1 -1
- package/dist/cjs/utilities/stackPrefetch/stackContextPrefetch.d.ts +16 -0
- package/dist/cjs/utilities/stackPrefetch/stackContextPrefetch.js +227 -0
- package/dist/cjs/utilities/stackPrefetch/stackContextPrefetch.js.map +1 -0
- package/dist/cjs/utilities/stackPrefetch/stackPrefetch.d.ts +7 -1
- package/dist/cjs/utilities/stackPrefetch/stackPrefetch.js +23 -93
- package/dist/cjs/utilities/stackPrefetch/stackPrefetch.js.map +1 -1
- package/dist/cjs/utilities/stackPrefetch/stackPrefetchUtils.d.ts +14 -0
- package/dist/cjs/utilities/stackPrefetch/stackPrefetchUtils.js +85 -0
- package/dist/cjs/utilities/stackPrefetch/stackPrefetchUtils.js.map +1 -0
- package/dist/esm/drawingSvg/getSvgDrawingHelper.js +1 -1
- package/dist/esm/drawingSvg/getSvgDrawingHelper.js.map +1 -1
- package/dist/esm/enums/Events.d.ts +1 -0
- package/dist/esm/enums/Events.js +1 -0
- package/dist/esm/enums/Events.js.map +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDown.js +6 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDown.js.map +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.d.ts +2 -0
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.js +35 -0
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.js.map +1 -0
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForMouseEvent.d.ts +3 -0
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForMouseEvent.js +32 -0
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForMouseEvent.js.map +1 -0
- package/dist/esm/eventListeners/mouse/mouseDownListener.js +5 -1
- package/dist/esm/eventListeners/mouse/mouseDownListener.js.map +1 -1
- package/dist/esm/eventListeners/mouse/mouseMoveListener.js +5 -1
- package/dist/esm/eventListeners/mouse/mouseMoveListener.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.d.ts +2 -0
- package/dist/esm/store/ToolGroupManager/ToolGroup.js +35 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/esm/synchronizers/callbacks/stackImageSyncCallback.js +1 -1
- package/dist/esm/synchronizers/callbacks/stackImageSyncCallback.js.map +1 -1
- package/dist/esm/tools/AdvancedMagnifyTool.d.ts +36 -0
- package/dist/esm/tools/AdvancedMagnifyTool.js +440 -0
- package/dist/esm/tools/AdvancedMagnifyTool.js.map +1 -0
- package/dist/esm/tools/AdvancedMagnifyViewport.d.ts +76 -0
- package/dist/esm/tools/AdvancedMagnifyViewport.js +346 -0
- package/dist/esm/tools/AdvancedMagnifyViewport.js.map +1 -0
- package/dist/esm/tools/AdvancedMagnifyViewportManager.d.ts +36 -0
- package/dist/esm/tools/AdvancedMagnifyViewportManager.js +128 -0
- package/dist/esm/tools/AdvancedMagnifyViewportManager.js.map +1 -0
- package/dist/esm/tools/MagnifyTool.js +2 -2
- package/dist/esm/tools/MagnifyTool.js.map +1 -1
- package/dist/esm/tools/OrientationMarkerTool.d.ts +88 -0
- package/dist/esm/tools/OrientationMarkerTool.js +185 -0
- package/dist/esm/tools/OrientationMarkerTool.js.map +1 -0
- package/dist/esm/tools/OverlayGridTool.d.ts +31 -0
- package/dist/esm/tools/OverlayGridTool.js +165 -0
- package/dist/esm/tools/OverlayGridTool.js.map +1 -0
- package/dist/esm/tools/ReferenceLinesTool.d.ts +3 -0
- package/dist/esm/tools/ReferenceLinesTool.js +71 -2
- package/dist/esm/tools/ReferenceLinesTool.js.map +1 -1
- package/dist/esm/tools/annotation/AngleTool.js +2 -1
- package/dist/esm/tools/annotation/AngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/BidirectionalTool.js +1 -1
- package/dist/esm/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/esm/tools/annotation/CircleROITool.d.ts +1 -2
- package/dist/esm/tools/annotation/CircleROITool.js +8 -8
- package/dist/esm/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/CobbAngleTool.d.ts +31 -5
- package/dist/esm/tools/annotation/CobbAngleTool.js +275 -72
- package/dist/esm/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/DragProbeTool.js +4 -3
- package/dist/esm/tools/annotation/DragProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.d.ts +2 -3
- package/dist/esm/tools/annotation/EllipticalROITool.js +20 -16
- package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/esm/tools/annotation/LengthTool.js +1 -1
- package/dist/esm/tools/annotation/LengthTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.d.ts +1 -2
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +22 -9
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/esm/tools/annotation/ProbeTool.d.ts +1 -2
- package/dist/esm/tools/annotation/ProbeTool.js +10 -9
- package/dist/esm/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.d.ts +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.js +9 -9
- package/dist/esm/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/esm/tools/base/AnnotationDisplayTool.js +3 -0
- package/dist/esm/tools/base/AnnotationDisplayTool.js.map +1 -1
- package/dist/esm/tools/base/AnnotationTool.d.ts +1 -1
- package/dist/esm/tools/base/AnnotationTool.js.map +1 -1
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js +4 -1
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/esm/tools/index.d.ts +4 -1
- package/dist/esm/tools/index.js +4 -1
- package/dist/esm/tools/index.js.map +1 -1
- package/dist/esm/types/EventTypes.d.ts +9 -1
- package/dist/esm/types/IToolGroup.d.ts +3 -0
- package/dist/esm/types/ToolAction.d.ts +8 -0
- package/dist/esm/types/ToolAction.js +2 -0
- package/dist/esm/types/ToolAction.js.map +1 -0
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +55 -0
- package/dist/esm/types/index.d.ts +2 -1
- package/dist/esm/utilities/getModalityUnit.js +5 -2
- package/dist/esm/utilities/getModalityUnit.js.map +1 -1
- package/dist/esm/utilities/index.d.ts +2 -2
- package/dist/esm/utilities/index.js +2 -2
- package/dist/esm/utilities/index.js.map +1 -1
- package/dist/esm/utilities/math/angle/angleBetweenLines.d.ts +3 -1
- package/dist/esm/utilities/math/angle/angleBetweenLines.js +19 -2
- package/dist/esm/utilities/math/angle/angleBetweenLines.js.map +1 -1
- package/dist/esm/utilities/stackPrefetch/index.d.ts +3 -2
- package/dist/esm/utilities/stackPrefetch/index.js +3 -2
- package/dist/esm/utilities/stackPrefetch/index.js.map +1 -1
- package/dist/esm/utilities/stackPrefetch/stackContextPrefetch.d.ts +16 -0
- package/dist/esm/utilities/stackPrefetch/stackContextPrefetch.js +220 -0
- package/dist/esm/utilities/stackPrefetch/stackContextPrefetch.js.map +1 -0
- package/dist/esm/utilities/stackPrefetch/stackPrefetch.d.ts +7 -1
- package/dist/esm/utilities/stackPrefetch/stackPrefetch.js +12 -79
- package/dist/esm/utilities/stackPrefetch/stackPrefetch.js.map +1 -1
- package/dist/esm/utilities/stackPrefetch/stackPrefetchUtils.d.ts +14 -0
- package/dist/esm/utilities/stackPrefetch/stackPrefetchUtils.js +77 -0
- package/dist/esm/utilities/stackPrefetch/stackPrefetchUtils.js.map +1 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/drawingSvg/getSvgDrawingHelper.ts +4 -1
- package/src/enums/Events.ts +9 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDown.ts +11 -2
- package/src/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.ts +72 -0
- package/src/eventDispatchers/shared/getToolsWithActionsForMouseEvent.ts +66 -0
- package/src/eventListeners/mouse/mouseDownListener.ts +7 -1
- package/src/eventListeners/mouse/mouseMoveListener.ts +7 -1
- package/src/index.ts +6 -0
- package/src/store/ToolGroupManager/ToolGroup.ts +79 -2
- package/src/synchronizers/callbacks/stackImageSyncCallback.ts +1 -1
- package/src/tools/AdvancedMagnifyTool.ts +725 -0
- package/src/tools/AdvancedMagnifyViewport.ts +624 -0
- package/src/tools/AdvancedMagnifyViewportManager.ts +291 -0
- package/src/tools/MagnifyTool.ts +2 -2
- package/src/tools/OrientationMarkerTool.ts +235 -0
- package/src/tools/OverlayGridTool.ts +357 -0
- package/src/tools/ReferenceLinesTool.ts +131 -3
- package/src/tools/annotation/AngleTool.ts +4 -1
- package/src/tools/annotation/BidirectionalTool.ts +1 -1
- package/src/tools/annotation/CircleROITool.ts +13 -20
- package/src/tools/annotation/CobbAngleTool.ts +422 -99
- package/src/tools/annotation/DragProbeTool.ts +6 -13
- package/src/tools/annotation/EllipticalROITool.ts +28 -29
- package/src/tools/annotation/LengthTool.ts +1 -1
- package/src/tools/annotation/PlanarFreehandROITool.ts +35 -20
- package/src/tools/annotation/ProbeTool.ts +17 -30
- package/src/tools/annotation/RectangleROITool.ts +15 -19
- package/src/tools/base/AnnotationDisplayTool.ts +4 -0
- package/src/tools/base/AnnotationTool.ts +2 -1
- package/src/tools/displayTools/Contour/contourDisplay.ts +8 -0
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +1 -1
- package/src/tools/index.ts +6 -0
- package/src/types/EventTypes.ts +23 -0
- package/src/types/IToolGroup.ts +7 -0
- package/src/types/ToolAction.ts +54 -0
- package/src/types/ToolSpecificAnnotationTypes.ts +58 -0
- package/src/types/index.ts +2 -0
- package/src/utilities/getModalityUnit.ts +8 -2
- package/src/utilities/index.ts +2 -1
- package/src/utilities/math/angle/angleBetweenLines.ts +39 -9
- package/src/utilities/stackPrefetch/index.ts +3 -7
- package/src/utilities/stackPrefetch/stackContextPrefetch.ts +380 -0
- package/src/utilities/stackPrefetch/stackPrefetch.ts +29 -151
- package/src/utilities/stackPrefetch/stackPrefetchUtils.ts +114 -0
|
@@ -166,26 +166,19 @@ class DragProbeTool extends ProbeTool {
|
|
|
166
166
|
),
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
-
if (
|
|
169
|
+
if (
|
|
170
|
+
!data.cachedStats[targetId] ||
|
|
171
|
+
data.cachedStats[targetId].value == null
|
|
172
|
+
) {
|
|
170
173
|
data.cachedStats[targetId] = {
|
|
171
174
|
Modality: null,
|
|
172
175
|
index: null,
|
|
173
176
|
value: null,
|
|
174
177
|
};
|
|
175
178
|
|
|
176
|
-
this._calculateCachedStats(
|
|
177
|
-
annotation,
|
|
178
|
-
renderingEngine,
|
|
179
|
-
enabledElement,
|
|
180
|
-
modalityUnitOptions
|
|
181
|
-
);
|
|
179
|
+
this._calculateCachedStats(annotation, renderingEngine, enabledElement);
|
|
182
180
|
} else if (annotation.invalidated) {
|
|
183
|
-
this._calculateCachedStats(
|
|
184
|
-
annotation,
|
|
185
|
-
renderingEngine,
|
|
186
|
-
enabledElement,
|
|
187
|
-
modalityUnitOptions
|
|
188
|
-
);
|
|
181
|
+
this._calculateCachedStats(annotation, renderingEngine, enabledElement);
|
|
189
182
|
}
|
|
190
183
|
|
|
191
184
|
// If rendering engine has been destroyed while rendering
|
|
@@ -47,7 +47,6 @@ import {
|
|
|
47
47
|
TextBoxHandle,
|
|
48
48
|
PublicToolProps,
|
|
49
49
|
ToolProps,
|
|
50
|
-
InteractionTypes,
|
|
51
50
|
SVGDrawingHelper,
|
|
52
51
|
} from '../../types';
|
|
53
52
|
import { EllipticalROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
@@ -55,8 +54,6 @@ import { EllipticalROIAnnotation } from '../../types/ToolSpecificAnnotationTypes
|
|
|
55
54
|
import {
|
|
56
55
|
AnnotationCompletedEventDetail,
|
|
57
56
|
AnnotationModifiedEventDetail,
|
|
58
|
-
MouseDragEventType,
|
|
59
|
-
MouseMoveEventType,
|
|
60
57
|
} from '../../types/EventTypes';
|
|
61
58
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
62
59
|
import { pointInShapeCallback } from '../../utilities/';
|
|
@@ -128,7 +125,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
128
125
|
viewportIdsToRender: Array<string>;
|
|
129
126
|
handleIndex?: number;
|
|
130
127
|
movingTextBox?: boolean;
|
|
131
|
-
|
|
128
|
+
centerWorld?: Array<number>;
|
|
132
129
|
canvasWidth?: number;
|
|
133
130
|
canvasHeight?: number;
|
|
134
131
|
originalHandleCanvas?: Array<number>;
|
|
@@ -241,7 +238,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
241
238
|
this.editData = {
|
|
242
239
|
annotation,
|
|
243
240
|
viewportIdsToRender,
|
|
244
|
-
|
|
241
|
+
centerWorld: worldPos,
|
|
245
242
|
newAnnotation: true,
|
|
246
243
|
hasMoved: false,
|
|
247
244
|
};
|
|
@@ -368,6 +365,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
368
365
|
let handleIndex;
|
|
369
366
|
|
|
370
367
|
let centerCanvas;
|
|
368
|
+
let centerWorld;
|
|
371
369
|
let canvasWidth;
|
|
372
370
|
let canvasHeight;
|
|
373
371
|
let originalHandleCanvas;
|
|
@@ -376,8 +374,8 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
376
374
|
movingTextBox = true;
|
|
377
375
|
} else {
|
|
378
376
|
const { points } = data.handles;
|
|
379
|
-
const
|
|
380
|
-
const { worldToCanvas } =
|
|
377
|
+
const { viewport } = getEnabledElement(element);
|
|
378
|
+
const { worldToCanvas, canvasToWorld } = viewport;
|
|
381
379
|
|
|
382
380
|
handleIndex = points.findIndex((p) => p === handle);
|
|
383
381
|
|
|
@@ -392,6 +390,8 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
392
390
|
(pointsCanvas[2][0] + pointsCanvas[3][0]) / 2,
|
|
393
391
|
(pointsCanvas[0][1] + pointsCanvas[1][1]) / 2,
|
|
394
392
|
];
|
|
393
|
+
|
|
394
|
+
centerWorld = canvasToWorld(centerCanvas);
|
|
395
395
|
}
|
|
396
396
|
|
|
397
397
|
// Find viewports to render on drag.
|
|
@@ -406,7 +406,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
406
406
|
handleIndex,
|
|
407
407
|
canvasWidth,
|
|
408
408
|
canvasHeight,
|
|
409
|
-
|
|
409
|
+
centerWorld,
|
|
410
410
|
originalHandleCanvas,
|
|
411
411
|
movingTextBox,
|
|
412
412
|
};
|
|
@@ -483,7 +483,8 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
483
483
|
const { canvasToWorld } = viewport;
|
|
484
484
|
|
|
485
485
|
//////
|
|
486
|
-
const { annotation, viewportIdsToRender,
|
|
486
|
+
const { annotation, viewportIdsToRender, centerWorld } = this.editData;
|
|
487
|
+
const centerCanvas = viewport.worldToCanvas(centerWorld as Types.Point3);
|
|
487
488
|
const { data } = annotation;
|
|
488
489
|
|
|
489
490
|
const dX = Math.abs(currentCanvasPoints[0] - centerCanvas[0]);
|
|
@@ -557,17 +558,18 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
557
558
|
_dragHandle = (evt: EventTypes.InteractionEventType): void => {
|
|
558
559
|
const eventDetail = evt.detail;
|
|
559
560
|
const { element } = eventDetail;
|
|
560
|
-
const
|
|
561
|
-
const { canvasToWorld } =
|
|
561
|
+
const { viewport } = getEnabledElement(element);
|
|
562
|
+
const { canvasToWorld, worldToCanvas } = viewport;
|
|
562
563
|
|
|
563
564
|
const {
|
|
564
565
|
annotation,
|
|
565
566
|
canvasWidth,
|
|
566
567
|
canvasHeight,
|
|
567
568
|
handleIndex,
|
|
568
|
-
|
|
569
|
+
centerWorld,
|
|
569
570
|
originalHandleCanvas,
|
|
570
571
|
} = this.editData;
|
|
572
|
+
const centerCanvas = viewport.worldToCanvas(centerWorld as Types.Point3);
|
|
571
573
|
const { data } = annotation;
|
|
572
574
|
const { points } = data.handles;
|
|
573
575
|
|
|
@@ -800,21 +802,11 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
800
802
|
|
|
801
803
|
const { centerPointRadius } = this.configuration;
|
|
802
804
|
|
|
803
|
-
const modalityUnitOptions = {
|
|
804
|
-
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
805
|
-
|
|
806
|
-
isSuvScaled: this.isSuvScaled(
|
|
807
|
-
viewport,
|
|
808
|
-
targetId,
|
|
809
|
-
annotation.metadata.referencedImageId
|
|
810
|
-
),
|
|
811
|
-
};
|
|
812
|
-
|
|
813
805
|
// If cachedStats does not exist, or the unit is missing (as part of import/hydration etc.),
|
|
814
806
|
// force to recalculate the stats from the points
|
|
815
807
|
if (
|
|
816
808
|
!data.cachedStats[targetId] ||
|
|
817
|
-
data.cachedStats[targetId].areaUnit
|
|
809
|
+
data.cachedStats[targetId].areaUnit == null
|
|
818
810
|
) {
|
|
819
811
|
data.cachedStats[targetId] = {
|
|
820
812
|
Modality: null,
|
|
@@ -829,16 +821,14 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
829
821
|
annotation,
|
|
830
822
|
viewport,
|
|
831
823
|
renderingEngine,
|
|
832
|
-
enabledElement
|
|
833
|
-
modalityUnitOptions
|
|
824
|
+
enabledElement
|
|
834
825
|
);
|
|
835
826
|
} else if (annotation.invalidated) {
|
|
836
827
|
this._throttledCalculateCachedStats(
|
|
837
828
|
annotation,
|
|
838
829
|
viewport,
|
|
839
830
|
renderingEngine,
|
|
840
|
-
enabledElement
|
|
841
|
-
modalityUnitOptions
|
|
831
|
+
enabledElement
|
|
842
832
|
);
|
|
843
833
|
// If the invalidated data is as a result of volumeViewport manipulation
|
|
844
834
|
// of the tools, we need to invalidate the related viewports data, so that
|
|
@@ -1013,8 +1003,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
1013
1003
|
annotation,
|
|
1014
1004
|
viewport,
|
|
1015
1005
|
renderingEngine,
|
|
1016
|
-
enabledElement
|
|
1017
|
-
modalityUnitOptions: ModalityUnitOptions
|
|
1006
|
+
enabledElement
|
|
1018
1007
|
) => {
|
|
1019
1008
|
const data = annotation.data;
|
|
1020
1009
|
const { viewportId, renderingEngineId } = enabledElement;
|
|
@@ -1107,6 +1096,16 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
1107
1096
|
scale /
|
|
1108
1097
|
scale;
|
|
1109
1098
|
|
|
1099
|
+
const modalityUnitOptions = {
|
|
1100
|
+
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
1101
|
+
|
|
1102
|
+
isSuvScaled: this.isSuvScaled(
|
|
1103
|
+
viewport,
|
|
1104
|
+
targetId,
|
|
1105
|
+
annotation.metadata.referencedImageId
|
|
1106
|
+
),
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1110
1109
|
const modalityUnit = getModalityUnit(
|
|
1111
1110
|
metadata.Modality,
|
|
1112
1111
|
annotation.metadata.referencedImageId,
|
|
@@ -662,7 +662,7 @@ class LengthTool extends AnnotationTool {
|
|
|
662
662
|
// force to recalculate the stats from the points
|
|
663
663
|
if (
|
|
664
664
|
!data.cachedStats[targetId] ||
|
|
665
|
-
data.cachedStats[targetId].unit
|
|
665
|
+
data.cachedStats[targetId].unit == null
|
|
666
666
|
) {
|
|
667
667
|
data.cachedStats[targetId] = {
|
|
668
668
|
length: null,
|
|
@@ -44,14 +44,13 @@ import {
|
|
|
44
44
|
AnnotationStyle,
|
|
45
45
|
PublicToolProps,
|
|
46
46
|
ToolProps,
|
|
47
|
-
InteractionTypes,
|
|
48
47
|
SVGDrawingHelper,
|
|
49
48
|
} from '../../types';
|
|
50
|
-
import {
|
|
49
|
+
import { drawLinkedTextBox } from '../../drawingSvg';
|
|
51
50
|
import { PlanarFreehandROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
52
51
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
53
52
|
import { PlanarFreehandROICommonData } from '../../utilities/math/polyline/planarFreehandROIInternalTypes';
|
|
54
|
-
|
|
53
|
+
|
|
55
54
|
import { getIntersectionCoordinatesWithPolyline } from '../../utilities/math/polyline/getIntersectionWithPolyline';
|
|
56
55
|
import pointInShapeCallback from '../../utilities/pointInShapeCallback';
|
|
57
56
|
import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScaled';
|
|
@@ -679,20 +678,11 @@ class PlanarFreehandROITool extends AnnotationTool {
|
|
|
679
678
|
return;
|
|
680
679
|
}
|
|
681
680
|
|
|
682
|
-
const modalityUnitOptions = {
|
|
683
|
-
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
684
|
-
isSuvScaled: this.isSuvScaled(
|
|
685
|
-
viewport,
|
|
686
|
-
targetId,
|
|
687
|
-
annotation.metadata.referencedImageId
|
|
688
|
-
),
|
|
689
|
-
};
|
|
690
|
-
|
|
691
681
|
if (!this.commonData?.movingTextBox) {
|
|
692
682
|
const { data } = annotation;
|
|
693
683
|
if (
|
|
694
684
|
!data.cachedStats[targetId] ||
|
|
695
|
-
data.cachedStats[targetId].areaUnit
|
|
685
|
+
data.cachedStats[targetId].areaUnit == null
|
|
696
686
|
) {
|
|
697
687
|
data.cachedStats[targetId] = {
|
|
698
688
|
Modality: null,
|
|
@@ -707,16 +697,14 @@ class PlanarFreehandROITool extends AnnotationTool {
|
|
|
707
697
|
annotation,
|
|
708
698
|
viewport,
|
|
709
699
|
renderingEngine,
|
|
710
|
-
enabledElement
|
|
711
|
-
modalityUnitOptions
|
|
700
|
+
enabledElement
|
|
712
701
|
);
|
|
713
702
|
} else if (annotation.invalidated) {
|
|
714
703
|
this._throttledCalculateCachedStats(
|
|
715
704
|
annotation,
|
|
716
705
|
viewport,
|
|
717
706
|
renderingEngine,
|
|
718
|
-
enabledElement
|
|
719
|
-
modalityUnitOptions
|
|
707
|
+
enabledElement
|
|
720
708
|
);
|
|
721
709
|
}
|
|
722
710
|
}
|
|
@@ -731,8 +719,7 @@ class PlanarFreehandROITool extends AnnotationTool {
|
|
|
731
719
|
annotation,
|
|
732
720
|
viewport,
|
|
733
721
|
renderingEngine,
|
|
734
|
-
enabledElement
|
|
735
|
-
modalityUnitOptions: ModalityUnitOptions
|
|
722
|
+
enabledElement
|
|
736
723
|
) => {
|
|
737
724
|
const data = annotation.data;
|
|
738
725
|
const { cachedStats, polyline: points } = data;
|
|
@@ -752,9 +739,28 @@ class PlanarFreehandROITool extends AnnotationTool {
|
|
|
752
739
|
|
|
753
740
|
const { imageData, metadata } = image;
|
|
754
741
|
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
742
|
+
|
|
743
|
+
// Using an arbitrary start point (canvasPoint), calculate the
|
|
744
|
+
// mm spacing for the canvas in the X and Y directions.
|
|
745
|
+
const canvasPoint = canvasCoordinates[0];
|
|
746
|
+
const originalWorldPoint = viewport.canvasToWorld(canvasPoint);
|
|
747
|
+
const deltaXPoint = viewport.canvasToWorld([
|
|
748
|
+
canvasPoint[0] + 1,
|
|
749
|
+
canvasPoint[1],
|
|
750
|
+
]);
|
|
751
|
+
const deltaYPoint = viewport.canvasToWorld([
|
|
752
|
+
canvasPoint[0],
|
|
753
|
+
canvasPoint[1] + 1,
|
|
754
|
+
]);
|
|
755
|
+
|
|
756
|
+
const deltaInX = vec3.distance(originalWorldPoint, deltaXPoint);
|
|
757
|
+
const deltaInY = vec3.distance(originalWorldPoint, deltaYPoint);
|
|
758
|
+
|
|
755
759
|
const scale = getCalibratedScale(image);
|
|
756
|
-
|
|
760
|
+
let area =
|
|
757
761
|
polyline.calculateAreaOfPoints(canvasCoordinates) / scale / scale;
|
|
762
|
+
// Convert from canvas_pixels ^2 to mm^2
|
|
763
|
+
area *= deltaInX * deltaInY;
|
|
758
764
|
|
|
759
765
|
const worldPosIndex = csUtils.transformWorldToIndex(imageData, points[0]);
|
|
760
766
|
worldPosIndex[0] = Math.floor(worldPosIndex[0]);
|
|
@@ -850,6 +856,15 @@ class PlanarFreehandROITool extends AnnotationTool {
|
|
|
850
856
|
boundsIJK
|
|
851
857
|
);
|
|
852
858
|
|
|
859
|
+
const modalityUnitOptions = {
|
|
860
|
+
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
861
|
+
isSuvScaled: this.isSuvScaled(
|
|
862
|
+
viewport,
|
|
863
|
+
targetId,
|
|
864
|
+
annotation.metadata.referencedImageId
|
|
865
|
+
),
|
|
866
|
+
};
|
|
867
|
+
|
|
853
868
|
const modalityUnit = getModalityUnit(
|
|
854
869
|
metadata.Modality,
|
|
855
870
|
annotation.metadata.referencedImageId,
|
|
@@ -442,36 +442,19 @@ class ProbeTool extends AnnotationTool {
|
|
|
442
442
|
|
|
443
443
|
const color = this.getStyle('color', styleSpecifier, annotation);
|
|
444
444
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
viewport,
|
|
450
|
-
targetId,
|
|
451
|
-
annotation.metadata.referencedImageId
|
|
452
|
-
),
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
if (!data.cachedStats[targetId]) {
|
|
445
|
+
if (
|
|
446
|
+
!data.cachedStats[targetId] ||
|
|
447
|
+
data.cachedStats[targetId].value == null
|
|
448
|
+
) {
|
|
456
449
|
data.cachedStats[targetId] = {
|
|
457
450
|
Modality: null,
|
|
458
451
|
index: null,
|
|
459
452
|
value: null,
|
|
460
453
|
};
|
|
461
454
|
|
|
462
|
-
this._calculateCachedStats(
|
|
463
|
-
annotation,
|
|
464
|
-
renderingEngine,
|
|
465
|
-
enabledElement,
|
|
466
|
-
modalityUnitOptions
|
|
467
|
-
);
|
|
455
|
+
this._calculateCachedStats(annotation, renderingEngine, enabledElement);
|
|
468
456
|
} else if (annotation.invalidated) {
|
|
469
|
-
this._calculateCachedStats(
|
|
470
|
-
annotation,
|
|
471
|
-
renderingEngine,
|
|
472
|
-
enabledElement,
|
|
473
|
-
modalityUnitOptions
|
|
474
|
-
);
|
|
457
|
+
this._calculateCachedStats(annotation, renderingEngine, enabledElement);
|
|
475
458
|
|
|
476
459
|
// If the invalidated data is as a result of volumeViewport manipulation
|
|
477
460
|
// of the tools, we need to invalidate the related stackViewports data if
|
|
@@ -554,14 +537,9 @@ class ProbeTool extends AnnotationTool {
|
|
|
554
537
|
return renderStatus;
|
|
555
538
|
};
|
|
556
539
|
|
|
557
|
-
_calculateCachedStats(
|
|
558
|
-
annotation,
|
|
559
|
-
renderingEngine,
|
|
560
|
-
enabledElement,
|
|
561
|
-
modalityUnitOptions: ModalityUnitOptions
|
|
562
|
-
) {
|
|
540
|
+
_calculateCachedStats(annotation, renderingEngine, enabledElement) {
|
|
563
541
|
const data = annotation.data;
|
|
564
|
-
const { viewportId, renderingEngineId } = enabledElement;
|
|
542
|
+
const { viewportId, renderingEngineId, viewport } = enabledElement;
|
|
565
543
|
|
|
566
544
|
const worldPos = data.handles.points[0];
|
|
567
545
|
const { cachedStats } = data;
|
|
@@ -571,6 +549,15 @@ class ProbeTool extends AnnotationTool {
|
|
|
571
549
|
for (let i = 0; i < targetIds.length; i++) {
|
|
572
550
|
const targetId = targetIds[i];
|
|
573
551
|
|
|
552
|
+
const modalityUnitOptions = {
|
|
553
|
+
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
554
|
+
isSuvScaled: this.isSuvScaled(
|
|
555
|
+
viewport,
|
|
556
|
+
targetId,
|
|
557
|
+
annotation.metadata.referencedImageId
|
|
558
|
+
),
|
|
559
|
+
};
|
|
560
|
+
|
|
574
561
|
const image = this.getTargetIdImage(targetId, renderingEngine);
|
|
575
562
|
|
|
576
563
|
// If image does not exists for the targetId, skip. This can be due
|
|
@@ -45,7 +45,6 @@ import {
|
|
|
45
45
|
TextBoxHandle,
|
|
46
46
|
ToolProps,
|
|
47
47
|
PublicToolProps,
|
|
48
|
-
InteractionTypes,
|
|
49
48
|
SVGDrawingHelper,
|
|
50
49
|
} from '../../types';
|
|
51
50
|
import { RectangleROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
@@ -659,21 +658,11 @@ class RectangleROITool extends AnnotationTool {
|
|
|
659
658
|
|
|
660
659
|
const { viewPlaneNormal, viewUp } = viewport.getCamera();
|
|
661
660
|
|
|
662
|
-
const modalityUnitOptions = {
|
|
663
|
-
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
664
|
-
|
|
665
|
-
isSuvScaled: this.isSuvScaled(
|
|
666
|
-
viewport,
|
|
667
|
-
targetId,
|
|
668
|
-
annotation.metadata.referencedImageId
|
|
669
|
-
),
|
|
670
|
-
};
|
|
671
|
-
|
|
672
661
|
// If cachedStats does not exist, or the unit is missing (as part of import/hydration etc.),
|
|
673
662
|
// force to recalculate the stats from the points
|
|
674
663
|
if (
|
|
675
664
|
!data.cachedStats[targetId] ||
|
|
676
|
-
data.cachedStats[targetId].areaUnit
|
|
665
|
+
data.cachedStats[targetId].areaUnit == null
|
|
677
666
|
) {
|
|
678
667
|
data.cachedStats[targetId] = {
|
|
679
668
|
Modality: null,
|
|
@@ -689,8 +678,7 @@ class RectangleROITool extends AnnotationTool {
|
|
|
689
678
|
viewPlaneNormal,
|
|
690
679
|
viewUp,
|
|
691
680
|
renderingEngine,
|
|
692
|
-
enabledElement
|
|
693
|
-
modalityUnitOptions
|
|
681
|
+
enabledElement
|
|
694
682
|
);
|
|
695
683
|
} else if (annotation.invalidated) {
|
|
696
684
|
this._throttledCalculateCachedStats(
|
|
@@ -698,8 +686,7 @@ class RectangleROITool extends AnnotationTool {
|
|
|
698
686
|
viewPlaneNormal,
|
|
699
687
|
viewUp,
|
|
700
688
|
renderingEngine,
|
|
701
|
-
enabledElement
|
|
702
|
-
modalityUnitOptions
|
|
689
|
+
enabledElement
|
|
703
690
|
);
|
|
704
691
|
|
|
705
692
|
// If the invalidated data is as a result of volumeViewport manipulation
|
|
@@ -881,11 +868,10 @@ class RectangleROITool extends AnnotationTool {
|
|
|
881
868
|
viewPlaneNormal,
|
|
882
869
|
viewUp,
|
|
883
870
|
renderingEngine,
|
|
884
|
-
enabledElement
|
|
885
|
-
modalityUnitOptions
|
|
871
|
+
enabledElement
|
|
886
872
|
) => {
|
|
887
873
|
const { data } = annotation;
|
|
888
|
-
const { viewportId, renderingEngineId } = enabledElement;
|
|
874
|
+
const { viewportId, renderingEngineId, viewport } = enabledElement;
|
|
889
875
|
|
|
890
876
|
const worldPos1 = data.handles.points[0];
|
|
891
877
|
const worldPos2 = data.handles.points[3];
|
|
@@ -954,6 +940,16 @@ class RectangleROITool extends AnnotationTool {
|
|
|
954
940
|
|
|
955
941
|
const area = Math.abs(worldWidth * worldHeight) / (scale * scale);
|
|
956
942
|
|
|
943
|
+
const modalityUnitOptions = {
|
|
944
|
+
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
945
|
+
|
|
946
|
+
isSuvScaled: this.isSuvScaled(
|
|
947
|
+
viewport,
|
|
948
|
+
targetId,
|
|
949
|
+
annotation.metadata.referencedImageId
|
|
950
|
+
),
|
|
951
|
+
};
|
|
952
|
+
|
|
957
953
|
const modalityUnit = getModalityUnit(
|
|
958
954
|
metadata.Modality,
|
|
959
955
|
annotation.metadata.referencedImageId,
|
|
@@ -102,6 +102,10 @@ abstract class AnnotationDisplayTool extends BaseTool {
|
|
|
102
102
|
|
|
103
103
|
// for this specific tool
|
|
104
104
|
toolSpecificAnnotations.forEach((annotation) => {
|
|
105
|
+
if (!annotation.metadata?.referencedImageId) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
105
109
|
// if the annotation is drawn on the same imageId
|
|
106
110
|
const referencedImageURI = utilities.imageIdToURI(
|
|
107
111
|
annotation.metadata.referencedImageId
|
|
@@ -94,7 +94,8 @@ abstract class AnnotationTool extends AnnotationDisplayTool {
|
|
|
94
94
|
abstract toolSelectedCallback(
|
|
95
95
|
evt: EventTypes.InteractionEventType,
|
|
96
96
|
annotation: Annotation,
|
|
97
|
-
interactionType: InteractionTypes
|
|
97
|
+
interactionType: InteractionTypes,
|
|
98
|
+
canvasCoords?: Types.Point2
|
|
98
99
|
): void;
|
|
99
100
|
|
|
100
101
|
/**
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
getEnabledElementByIds,
|
|
3
3
|
Types,
|
|
4
4
|
utilities as csUtils,
|
|
5
|
+
StackViewport,
|
|
5
6
|
} from '@cornerstonejs/core';
|
|
6
7
|
|
|
7
8
|
import Representations from '../../../enums/SegmentationRepresentations';
|
|
@@ -128,6 +129,13 @@ async function render(
|
|
|
128
129
|
const contourData = segmentation.representationData[Representations.Contour];
|
|
129
130
|
const { geometryIds } = contourData;
|
|
130
131
|
|
|
132
|
+
|
|
133
|
+
// We don't have a good way to handle stack viewports for contours at the moment.
|
|
134
|
+
// Plus, if we add a segmentation to one viewport, it gets added to all the viewports in the toolGroup too.
|
|
135
|
+
if (viewport instanceof StackViewport) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
131
139
|
if (!geometryIds?.length) {
|
|
132
140
|
console.warn(
|
|
133
141
|
`No contours found for segmentationId ${segmentationId}. Skipping render.`
|
package/src/tools/index.ts
CHANGED
|
@@ -10,7 +10,9 @@ import VolumeRotateMouseWheelTool from './VolumeRotateMouseWheelTool';
|
|
|
10
10
|
import MIPJumpToClickTool from './MIPJumpToClickTool';
|
|
11
11
|
import CrosshairsTool from './CrosshairsTool';
|
|
12
12
|
import MagnifyTool from './MagnifyTool';
|
|
13
|
+
import AdvancedMagnifyTool from './AdvancedMagnifyTool';
|
|
13
14
|
import ReferenceLinesTool from './ReferenceLinesTool';
|
|
15
|
+
import OverlayGridTool from './OverlayGridTool';
|
|
14
16
|
//
|
|
15
17
|
import BidirectionalTool from './annotation/BidirectionalTool';
|
|
16
18
|
import LengthTool from './annotation/LengthTool';
|
|
@@ -38,6 +40,7 @@ import RectangleROIThresholdTool from './segmentation/RectangleROIThresholdTool'
|
|
|
38
40
|
import RectangleROIStartEndThresholdTool from './segmentation/RectangleROIStartEndThresholdTool';
|
|
39
41
|
import BrushTool from './segmentation/BrushTool';
|
|
40
42
|
import PaintFillTool from './segmentation/PaintFillTool';
|
|
43
|
+
import OrientationMarkerTool from './OrientationMarkerTool';
|
|
41
44
|
|
|
42
45
|
export {
|
|
43
46
|
// ~~ BASE
|
|
@@ -58,6 +61,7 @@ export {
|
|
|
58
61
|
// Annotation Tools
|
|
59
62
|
CrosshairsTool,
|
|
60
63
|
ReferenceLinesTool,
|
|
64
|
+
OverlayGridTool,
|
|
61
65
|
BidirectionalTool,
|
|
62
66
|
LengthTool,
|
|
63
67
|
ProbeTool,
|
|
@@ -79,7 +83,9 @@ export {
|
|
|
79
83
|
RectangleROIStartEndThresholdTool,
|
|
80
84
|
BrushTool,
|
|
81
85
|
MagnifyTool,
|
|
86
|
+
AdvancedMagnifyTool,
|
|
82
87
|
ReferenceLines,
|
|
83
88
|
PaintFillTool,
|
|
84
89
|
ScaleOverlayTool,
|
|
90
|
+
OrientationMarkerTool,
|
|
85
91
|
};
|
package/src/types/EventTypes.ts
CHANGED
|
@@ -5,6 +5,7 @@ import ITouchPoints from './ITouchPoints';
|
|
|
5
5
|
import IDistance from './IDistance';
|
|
6
6
|
import { SetToolBindingsType } from './ISetToolModeOptions';
|
|
7
7
|
import { Swipe } from '../enums/Touch';
|
|
8
|
+
import { ToolModes } from '../enums';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* The normalized interaction event detail
|
|
@@ -71,6 +72,20 @@ type InteractionStartEventDetail = InteractionEventDetail;
|
|
|
71
72
|
|
|
72
73
|
type InteractionEndEventDetail = InteractionEventDetail;
|
|
73
74
|
|
|
75
|
+
/**
|
|
76
|
+
* The data that is passed to the event handler when tool mode changes
|
|
77
|
+
*/
|
|
78
|
+
type ToolModeChangedEventDetail = {
|
|
79
|
+
/** unique id of the toolGroup */
|
|
80
|
+
toolGroupId: string;
|
|
81
|
+
/** Tool name */
|
|
82
|
+
toolName: string;
|
|
83
|
+
/** Tool mode */
|
|
84
|
+
mode: ToolModes;
|
|
85
|
+
/** Tool binding options */
|
|
86
|
+
toolBindingsOptions?: SetToolBindingsType;
|
|
87
|
+
};
|
|
88
|
+
|
|
74
89
|
/**
|
|
75
90
|
* The data that is passed to the event handler when a tool is activated.
|
|
76
91
|
*/
|
|
@@ -424,6 +439,12 @@ type NormalizedMouseEventType = Types.CustomEventType<MouseCustomEventDetail>;
|
|
|
424
439
|
*/
|
|
425
440
|
type NormalizedTouchEventType = Types.CustomEventType<TouchCustomEventDetail>;
|
|
426
441
|
|
|
442
|
+
/**
|
|
443
|
+
* The ToolModeChanged event type
|
|
444
|
+
*/
|
|
445
|
+
type ToolModeChangedEventType =
|
|
446
|
+
Types.CustomEventType<ToolModeChangedEventDetail>;
|
|
447
|
+
|
|
427
448
|
/**
|
|
428
449
|
* The ToolActivated event type
|
|
429
450
|
*/
|
|
@@ -629,6 +650,8 @@ export {
|
|
|
629
650
|
NormalizedInteractionEventDetail,
|
|
630
651
|
NormalizedMouseEventType,
|
|
631
652
|
NormalizedTouchEventType,
|
|
653
|
+
ToolModeChangedEventDetail,
|
|
654
|
+
ToolModeChangedEventType,
|
|
632
655
|
ToolActivatedEventDetail,
|
|
633
656
|
ToolActivatedEventType,
|
|
634
657
|
AnnotationAddedEventDetail,
|
package/src/types/IToolGroup.ts
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Annotation } from './AnnotationTypes';
|
|
2
|
+
import type { InteractionEventType } from './EventTypes';
|
|
3
|
+
import type { SetToolBindingsType } from './ISetToolModeOptions';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An action that may be defined at the tool configuration level
|
|
7
|
+
*
|
|
8
|
+
* Annotations can have actions that run a specific task (ex: showing a dropdown
|
|
9
|
+
* containing a list of all predefined zoom levels - advanced magnifier glass).
|
|
10
|
+
* Each action must have at least one binding option (mouse button + [modifier(s)])
|
|
11
|
+
* and a action runs if and only if no other tool is using that same binding options
|
|
12
|
+
* to draw an annotation because action has lower priority.
|
|
13
|
+
*
|
|
14
|
+
* Actions are defined in the following way in a annotation tool constructor:
|
|
15
|
+
*
|
|
16
|
+
* class MyAnnotationTool extends AnnotationTool {
|
|
17
|
+
* constructor(
|
|
18
|
+
* toolProps: PublicToolProps = {},
|
|
19
|
+
* defaultToolProps: ToolProps = {
|
|
20
|
+
* configuration: {
|
|
21
|
+
* actions: [
|
|
22
|
+
* {
|
|
23
|
+
* method: 'myAction',
|
|
24
|
+
* bindings: [
|
|
25
|
+
* {
|
|
26
|
+
* mouseButton: MouseBindings.Secondary,
|
|
27
|
+
* modifierKey: KeyboardBindings.Shift,
|
|
28
|
+
* }
|
|
29
|
+
* ]
|
|
30
|
+
* }
|
|
31
|
+
* ]
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* ) {
|
|
35
|
+
* super(toolProps, defaultToolProps);
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* public myAction(evt: EventTypes.InteractionEventType, annotation: MyAnnotation) {
|
|
39
|
+
* // action code
|
|
40
|
+
* }
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* The "method" property may be a string or a javascript function. In case it is
|
|
44
|
+
* a string a function with same name must exists in the tool class. In both ways
|
|
45
|
+
* (string or function) the function is called in the tool's context (`this`)
|
|
46
|
+
*/
|
|
47
|
+
type ToolAction = {
|
|
48
|
+
method:
|
|
49
|
+
| string
|
|
50
|
+
| ((evt: InteractionEventType, annotation: Annotation) => void);
|
|
51
|
+
bindings: SetToolBindingsType[];
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default ToolAction;
|