@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
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { vec3 } from 'gl-matrix';
|
|
2
|
+
import {
|
|
3
|
+
eventTarget,
|
|
4
|
+
Enums,
|
|
5
|
+
getRenderingEngine,
|
|
6
|
+
CONSTANTS,
|
|
7
|
+
} from '@cornerstonejs/core';
|
|
8
|
+
import type { Types } from '@cornerstonejs/core';
|
|
9
|
+
import { AnnotationRemovedEventType } from '../types/EventTypes';
|
|
10
|
+
import { Events as cstEvents } from '../enums';
|
|
11
|
+
import {
|
|
12
|
+
AdvancedMagnifyViewport,
|
|
13
|
+
AutoPanCallback,
|
|
14
|
+
} from './AdvancedMagnifyViewport';
|
|
15
|
+
import { AdvancedMagnifyAnnotation } from '../types/ToolSpecificAnnotationTypes';
|
|
16
|
+
|
|
17
|
+
// Defined the tool name internally instead of importing
|
|
18
|
+
// AdvangedMagnifyTool due to cyclic dependency
|
|
19
|
+
const ADVANCED_MAGNIFY_TOOL_NAME = 'AdvancedMagnify';
|
|
20
|
+
|
|
21
|
+
const PARALLEL_THRESHOLD = 1 - CONSTANTS.EPSILON;
|
|
22
|
+
const { Events } = Enums;
|
|
23
|
+
|
|
24
|
+
export type MagnifyViewportInfo = {
|
|
25
|
+
// Viewport id to be used or new v4 compliant GUID is used instead
|
|
26
|
+
magnifyViewportId?: string;
|
|
27
|
+
// Enabled element where the magnifying glass shall be added to
|
|
28
|
+
sourceEnabledElement: Types.IEnabledElement;
|
|
29
|
+
// Magnifying glass position (center)
|
|
30
|
+
position: Types.Point2;
|
|
31
|
+
// Magnifying glass radius (pixels)
|
|
32
|
+
radius: number;
|
|
33
|
+
// Amount of magnification applied to the magnifying glass image compared to the source viewport.
|
|
34
|
+
zoomFactor: number;
|
|
35
|
+
// Allow panning the viewport when moving an annotation point close to the border of the magnifying glass
|
|
36
|
+
autoPan: {
|
|
37
|
+
// Enable or disable auto pan
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
// Minimum distance to the border before start auto panning
|
|
40
|
+
padding: number;
|
|
41
|
+
// Callback function responsible for updating the annotation (circle)
|
|
42
|
+
// that contains the magnifying viewport
|
|
43
|
+
callback: AutoPanCallback;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
type MagnifyViewportsMapEntry = {
|
|
48
|
+
annotation: AdvancedMagnifyAnnotation;
|
|
49
|
+
magnifyViewport: AdvancedMagnifyViewport;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Manager responsible for creating, storing and destroying magnifying glass
|
|
54
|
+
* viewports. There are no restrictions to create a new instance of it but it
|
|
55
|
+
* should be accessed through getInstance() method.
|
|
56
|
+
*/
|
|
57
|
+
class AdvancedMagnifyViewportManager {
|
|
58
|
+
private static _singleton: AdvancedMagnifyViewportManager;
|
|
59
|
+
private _magnifyViewportsMap: Map<string, MagnifyViewportsMapEntry>;
|
|
60
|
+
|
|
61
|
+
constructor() {
|
|
62
|
+
this._magnifyViewportsMap = new Map();
|
|
63
|
+
this._initialize();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new magnifying glass viewport manager instance when this method is
|
|
68
|
+
* called for the first time or return the instance previously created for
|
|
69
|
+
* any subsequent call (singleton pattern).
|
|
70
|
+
* @returns A magnifying viewport manager instance
|
|
71
|
+
*/
|
|
72
|
+
public static getInstance(): AdvancedMagnifyViewportManager {
|
|
73
|
+
AdvancedMagnifyViewportManager._singleton =
|
|
74
|
+
AdvancedMagnifyViewportManager._singleton ??
|
|
75
|
+
new AdvancedMagnifyViewportManager();
|
|
76
|
+
|
|
77
|
+
return AdvancedMagnifyViewportManager._singleton;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Creates a new magnifying glass viewport instance
|
|
82
|
+
* @param viewportInfo - Viewport data used when creating a new magnifying glass viewport
|
|
83
|
+
* @returns A magnifying glass viewport instance
|
|
84
|
+
*/
|
|
85
|
+
public createViewport = (
|
|
86
|
+
annotation: AdvancedMagnifyAnnotation,
|
|
87
|
+
viewportInfo: MagnifyViewportInfo
|
|
88
|
+
): AdvancedMagnifyViewport => {
|
|
89
|
+
const {
|
|
90
|
+
magnifyViewportId,
|
|
91
|
+
sourceEnabledElement,
|
|
92
|
+
position,
|
|
93
|
+
radius,
|
|
94
|
+
zoomFactor,
|
|
95
|
+
autoPan,
|
|
96
|
+
} = viewportInfo;
|
|
97
|
+
const { viewport: sourceViewport } = sourceEnabledElement;
|
|
98
|
+
const { element: sourceElement } = sourceViewport;
|
|
99
|
+
|
|
100
|
+
const magnifyViewport = new AdvancedMagnifyViewport({
|
|
101
|
+
magnifyViewportId,
|
|
102
|
+
sourceEnabledElement,
|
|
103
|
+
radius,
|
|
104
|
+
position,
|
|
105
|
+
zoomFactor,
|
|
106
|
+
autoPan,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
this._addSourceElementEventListener(sourceElement);
|
|
110
|
+
this._magnifyViewportsMap.set(magnifyViewport.viewportId, {
|
|
111
|
+
annotation,
|
|
112
|
+
magnifyViewport,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
return magnifyViewport;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Find and return a magnifying glass viewport based on its id
|
|
120
|
+
* @param magnifyViewportId - Magnifying glass viewport id
|
|
121
|
+
* @returns A magnifying glass viewport instance
|
|
122
|
+
*/
|
|
123
|
+
public getViewport(magnifyViewportId: string): AdvancedMagnifyViewport {
|
|
124
|
+
return this._magnifyViewportsMap.get(magnifyViewportId)?.magnifyViewport;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Release all magnifying glass viewport instances and remove all event
|
|
129
|
+
* listeners making all objects available to be garbage collected.
|
|
130
|
+
*/
|
|
131
|
+
public dispose() {
|
|
132
|
+
this._removeEventListeners();
|
|
133
|
+
this._destroyViewports();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private _destroyViewport(magnifyViewportId: string) {
|
|
137
|
+
const magnifyViewportMapEntry =
|
|
138
|
+
this._magnifyViewportsMap.get(magnifyViewportId);
|
|
139
|
+
|
|
140
|
+
if (magnifyViewportMapEntry) {
|
|
141
|
+
const { magnifyViewport } = magnifyViewportMapEntry;
|
|
142
|
+
const { viewport: sourceViewport } = magnifyViewport.sourceEnabledElement;
|
|
143
|
+
const { element: sourceElement } = sourceViewport;
|
|
144
|
+
|
|
145
|
+
this._removeSourceElementEventListener(sourceElement);
|
|
146
|
+
|
|
147
|
+
magnifyViewport.dispose();
|
|
148
|
+
this._magnifyViewportsMap.delete(magnifyViewportId);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
private _destroyViewports() {
|
|
153
|
+
const magnifyViewportIds = Array.from(this._magnifyViewportsMap.keys());
|
|
154
|
+
|
|
155
|
+
magnifyViewportIds.forEach((magnifyViewportId) =>
|
|
156
|
+
this._destroyViewport(magnifyViewportId)
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
private _annotationRemovedCallback = (evt: AnnotationRemovedEventType) => {
|
|
161
|
+
const { annotation } = evt.detail;
|
|
162
|
+
|
|
163
|
+
if (annotation.metadata.toolName !== ADVANCED_MAGNIFY_TOOL_NAME) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
this._destroyViewport(annotation.data.magnifyViewportId);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
private _getMagnifyViewportsMapEntriesBySourceViewportId(sourceViewportId) {
|
|
171
|
+
const magnifyViewportsMapEntries = Array.from(
|
|
172
|
+
this._magnifyViewportsMap.values()
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
return magnifyViewportsMapEntries.filter(({ magnifyViewport }) => {
|
|
176
|
+
const { viewport } = magnifyViewport.sourceEnabledElement;
|
|
177
|
+
return viewport.id === sourceViewportId;
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
private _newStackImageCallback = (
|
|
182
|
+
evt: Types.EventTypes.StackNewImageEvent
|
|
183
|
+
) => {
|
|
184
|
+
const { viewportId: sourceViewportId, imageId } = evt.detail;
|
|
185
|
+
const magnifyViewportsMapEntries =
|
|
186
|
+
this._getMagnifyViewportsMapEntriesBySourceViewportId(sourceViewportId);
|
|
187
|
+
|
|
188
|
+
magnifyViewportsMapEntries.forEach(({ annotation }) => {
|
|
189
|
+
annotation.metadata.referencedImageId = imageId;
|
|
190
|
+
annotation.invalidated = true;
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
private _newVolumeImageCallback = (
|
|
195
|
+
evt: Types.EventTypes.VolumeNewImageEvent
|
|
196
|
+
) => {
|
|
197
|
+
const { renderingEngineId, viewportId: sourceViewportId } = evt.detail;
|
|
198
|
+
const renderingEngine = getRenderingEngine(renderingEngineId);
|
|
199
|
+
const sourceViewport = renderingEngine.getViewport(sourceViewportId);
|
|
200
|
+
const { viewPlaneNormal: currentViewPlaneNormal } =
|
|
201
|
+
sourceViewport.getCamera();
|
|
202
|
+
|
|
203
|
+
const magnifyViewportsMapEntries =
|
|
204
|
+
this._getMagnifyViewportsMapEntriesBySourceViewportId(sourceViewportId);
|
|
205
|
+
|
|
206
|
+
magnifyViewportsMapEntries.forEach(({ annotation }) => {
|
|
207
|
+
const { viewPlaneNormal } = annotation.metadata;
|
|
208
|
+
|
|
209
|
+
// Compare the normal to make sure the volume is not rotate in 3D space
|
|
210
|
+
const isParallel =
|
|
211
|
+
Math.abs(vec3.dot(viewPlaneNormal, currentViewPlaneNormal)) >
|
|
212
|
+
PARALLEL_THRESHOLD;
|
|
213
|
+
|
|
214
|
+
if (!isParallel) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const { handles } = annotation.data;
|
|
219
|
+
const worldImagePlanePoint = sourceViewport.canvasToWorld([0, 0]);
|
|
220
|
+
const vecHandleToImagePlane = vec3.sub(
|
|
221
|
+
vec3.create(),
|
|
222
|
+
worldImagePlanePoint,
|
|
223
|
+
handles.points[0]
|
|
224
|
+
);
|
|
225
|
+
const worldDist = vec3.dot(vecHandleToImagePlane, currentViewPlaneNormal);
|
|
226
|
+
const worldDelta = vec3.scale(
|
|
227
|
+
vec3.create(),
|
|
228
|
+
currentViewPlaneNormal,
|
|
229
|
+
worldDist
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
// Move all handle points to the image plane to make the annotation visible
|
|
233
|
+
for (let i = 0, len = handles.points.length; i < len; i++) {
|
|
234
|
+
const point = handles.points[i];
|
|
235
|
+
|
|
236
|
+
point[0] += worldDelta[0];
|
|
237
|
+
point[1] += worldDelta[1];
|
|
238
|
+
point[2] += worldDelta[2];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
annotation.invalidated = true;
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
private _addEventListeners() {
|
|
246
|
+
eventTarget.addEventListener(
|
|
247
|
+
cstEvents.ANNOTATION_REMOVED,
|
|
248
|
+
this._annotationRemovedCallback
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
private _removeEventListeners() {
|
|
253
|
+
eventTarget.removeEventListener(
|
|
254
|
+
cstEvents.ANNOTATION_REMOVED,
|
|
255
|
+
this._annotationRemovedCallback
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
private _addSourceElementEventListener(element) {
|
|
260
|
+
element.addEventListener(
|
|
261
|
+
Events.STACK_NEW_IMAGE,
|
|
262
|
+
this._newStackImageCallback
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
element.addEventListener(
|
|
266
|
+
Events.VOLUME_NEW_IMAGE,
|
|
267
|
+
this._newVolumeImageCallback
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
private _removeSourceElementEventListener(element) {
|
|
272
|
+
element.removeEventListener(
|
|
273
|
+
Events.STACK_NEW_IMAGE,
|
|
274
|
+
this._newStackImageCallback
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
element.removeEventListener(
|
|
278
|
+
Events.VOLUME_NEW_IMAGE,
|
|
279
|
+
this._newVolumeImageCallback
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
private _initialize() {
|
|
284
|
+
this._addEventListeners();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export {
|
|
289
|
+
AdvancedMagnifyViewportManager as default,
|
|
290
|
+
AdvancedMagnifyViewportManager,
|
|
291
|
+
};
|
package/src/tools/MagnifyTool.ts
CHANGED
|
@@ -113,7 +113,7 @@ class MagnifyTool extends BaseTool {
|
|
|
113
113
|
} = this.editData;
|
|
114
114
|
const { viewport } = enabledElement;
|
|
115
115
|
const { element } = viewport;
|
|
116
|
-
const
|
|
116
|
+
const viewportProperties = viewport.getProperties();
|
|
117
117
|
|
|
118
118
|
const { canvas: canvasPos, world: worldPos } = currentPoints;
|
|
119
119
|
|
|
@@ -158,7 +158,7 @@ class MagnifyTool extends BaseTool {
|
|
|
158
158
|
|
|
159
159
|
magnifyViewport.setStack([referencedImageId]).then(() => {
|
|
160
160
|
// match the original viewport voi range
|
|
161
|
-
magnifyViewport.setProperties(
|
|
161
|
+
magnifyViewport.setProperties(viewportProperties);
|
|
162
162
|
|
|
163
163
|
// Use the original viewport for the base for parallelScale
|
|
164
164
|
const { parallelScale } = viewport.getCamera();
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import vtkOrientationMarkerWidget from '@kitware/vtk.js/Interaction/Widgets/OrientationMarkerWidget';
|
|
2
|
+
import vtkAnnotatedCubeActor from '@kitware/vtk.js/Rendering/Core/AnnotatedCubeActor';
|
|
3
|
+
import vtkAxesActor from '@kitware/vtk.js/Rendering/Core/AxesActor';
|
|
4
|
+
import vtkActor from '@kitware/vtk.js/Rendering/Core/Actor';
|
|
5
|
+
import vtkMapper from '@kitware/vtk.js/Rendering/Core/Mapper';
|
|
6
|
+
import vtkXMLPolyDataReader from '@kitware/vtk.js/IO/XML/XMLPolyDataReader';
|
|
7
|
+
import vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData';
|
|
8
|
+
|
|
9
|
+
import { BaseTool } from './base';
|
|
10
|
+
import { getRenderingEngines } from '@cornerstonejs/core';
|
|
11
|
+
import { filterViewportsWithToolEnabled } from '../utilities/viewportFilters';
|
|
12
|
+
|
|
13
|
+
const OverlayMarkerType = {
|
|
14
|
+
ANNOTATED_CUBE: 1,
|
|
15
|
+
AXES: 2,
|
|
16
|
+
CUSTOM: 3,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The OrientationMarker is a tool that includes an orientation marker in viewports
|
|
21
|
+
* when activated
|
|
22
|
+
*/
|
|
23
|
+
class OrientationMarkerTool extends BaseTool {
|
|
24
|
+
static toolName;
|
|
25
|
+
static CUBE = 1;
|
|
26
|
+
static AXIS = 2;
|
|
27
|
+
static VTPFILE = 3;
|
|
28
|
+
orientationMarkers;
|
|
29
|
+
polyDataURL;
|
|
30
|
+
|
|
31
|
+
static OVERLAY_MARKER_TYPES = OverlayMarkerType;
|
|
32
|
+
|
|
33
|
+
configuration_invalidated = true;
|
|
34
|
+
|
|
35
|
+
constructor(
|
|
36
|
+
toolProps = {},
|
|
37
|
+
defaultToolProps = {
|
|
38
|
+
configuration: {
|
|
39
|
+
orientationWidget: {
|
|
40
|
+
enabled: true,
|
|
41
|
+
viewportCorner: vtkOrientationMarkerWidget.Corners.BOTTOM_RIGHT,
|
|
42
|
+
viewportSize: 0.15,
|
|
43
|
+
minPixelSize: 100,
|
|
44
|
+
maxPixelSize: 300,
|
|
45
|
+
},
|
|
46
|
+
overlayMarkerType:
|
|
47
|
+
OrientationMarkerTool.OVERLAY_MARKER_TYPES.ANNOTATED_CUBE,
|
|
48
|
+
overlayConfiguration: {
|
|
49
|
+
[OrientationMarkerTool.OVERLAY_MARKER_TYPES.ANNOTATED_CUBE]: {
|
|
50
|
+
faceProperties: {
|
|
51
|
+
xPlus: { text: 'R', faceColor: '#ffff00', faceRotation: 90 },
|
|
52
|
+
xMinus: { text: 'L', faceColor: '#ffff00', faceRotation: 270 },
|
|
53
|
+
yPlus: {
|
|
54
|
+
text: 'P',
|
|
55
|
+
faceColor: '#00ffff',
|
|
56
|
+
fontColor: 'white',
|
|
57
|
+
faceRotation: 180,
|
|
58
|
+
},
|
|
59
|
+
yMinus: { text: 'A', faceColor: '#00ffff', fontColor: 'white' },
|
|
60
|
+
zPlus: { text: 'S' },
|
|
61
|
+
zMinus: { text: 'I' },
|
|
62
|
+
},
|
|
63
|
+
defaultStyle: {
|
|
64
|
+
fontStyle: 'bold',
|
|
65
|
+
fontFamily: 'Arial',
|
|
66
|
+
fontColor: 'black',
|
|
67
|
+
fontSizeScale: (res) => res / 2,
|
|
68
|
+
faceColor: '#0000ff',
|
|
69
|
+
edgeThickness: 0.1,
|
|
70
|
+
edgeColor: 'black',
|
|
71
|
+
resolution: 400,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
[OrientationMarkerTool.OVERLAY_MARKER_TYPES.AXES]: {},
|
|
75
|
+
[OrientationMarkerTool.OVERLAY_MARKER_TYPES.CUSTOM]: {
|
|
76
|
+
polyDataURL:
|
|
77
|
+
'https://raw.githubusercontent.com/Slicer/Slicer/80ad0a04dacf134754459557bf2638c63f3d1d1b/Base/Logic/Resources/OrientationMarkers/Human.vtp',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
}
|
|
82
|
+
) {
|
|
83
|
+
super(toolProps, defaultToolProps);
|
|
84
|
+
this.orientationMarkers = {};
|
|
85
|
+
this.configuration_invalidated = true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
onSetToolEnabled = (): void => {
|
|
89
|
+
this.initViewports();
|
|
90
|
+
this.configuration_invalidated = true;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
onSetToolActive = (): void => {
|
|
94
|
+
this.initViewports();
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
private initViewports() {
|
|
98
|
+
const renderingEngines = getRenderingEngines();
|
|
99
|
+
const renderingEngine = renderingEngines[0];
|
|
100
|
+
|
|
101
|
+
if (!renderingEngine) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
let viewports = renderingEngine.getViewports();
|
|
106
|
+
viewports = filterViewportsWithToolEnabled(viewports, this.getToolName());
|
|
107
|
+
viewports.forEach((viewport) => this.addAxisActorInViewport(viewport));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async addAxisActorInViewport(viewport) {
|
|
111
|
+
const viewportId = viewport.id;
|
|
112
|
+
const type = this.configuration.overlayMarkerType;
|
|
113
|
+
|
|
114
|
+
const overlayConfiguration = this.configuration.overlayConfiguration[type];
|
|
115
|
+
|
|
116
|
+
if (this.orientationMarkers[viewportId]) {
|
|
117
|
+
const { actor, orientationWidget } = this.orientationMarkers[viewportId];
|
|
118
|
+
// remove the previous one
|
|
119
|
+
viewport.getRenderer().removeActor(actor);
|
|
120
|
+
orientationWidget.setEnabled(false);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
let actor;
|
|
124
|
+
if (type === 1) {
|
|
125
|
+
actor = this.createAnnotationCube(overlayConfiguration);
|
|
126
|
+
} else if (type === 2) {
|
|
127
|
+
actor = vtkAxesActor.newInstance();
|
|
128
|
+
} else if (type === 3) {
|
|
129
|
+
actor = await this.createCustomActor();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const renderer = viewport.getRenderer();
|
|
133
|
+
const renderWindow = viewport
|
|
134
|
+
.getRenderingEngine()
|
|
135
|
+
.offscreenMultiRenderWindow.getRenderWindow();
|
|
136
|
+
|
|
137
|
+
const {
|
|
138
|
+
enabled,
|
|
139
|
+
viewportCorner,
|
|
140
|
+
viewportSize,
|
|
141
|
+
minPixelSize,
|
|
142
|
+
maxPixelSize,
|
|
143
|
+
} = this.configuration.orientationWidget;
|
|
144
|
+
|
|
145
|
+
const orientationWidget = vtkOrientationMarkerWidget.newInstance({
|
|
146
|
+
actor,
|
|
147
|
+
interactor: renderWindow.getInteractor(),
|
|
148
|
+
parentRenderer: renderer,
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
orientationWidget.setEnabled(enabled);
|
|
152
|
+
orientationWidget.setViewportCorner(viewportCorner);
|
|
153
|
+
orientationWidget.setViewportSize(viewportSize);
|
|
154
|
+
orientationWidget.setMinPixelSize(minPixelSize);
|
|
155
|
+
orientationWidget.setMaxPixelSize(maxPixelSize);
|
|
156
|
+
|
|
157
|
+
orientationWidget.updateMarkerOrientation();
|
|
158
|
+
this.orientationMarkers[viewportId] = {
|
|
159
|
+
orientationWidget,
|
|
160
|
+
actor,
|
|
161
|
+
};
|
|
162
|
+
renderer.resetCamera();
|
|
163
|
+
renderWindow.render();
|
|
164
|
+
viewport.getRenderingEngine().render();
|
|
165
|
+
|
|
166
|
+
this.configuration_invalidated = false;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
private async createCustomActor() {
|
|
170
|
+
const url =
|
|
171
|
+
this.configuration.overlayConfiguration[OverlayMarkerType.CUSTOM]
|
|
172
|
+
.polyDataURL;
|
|
173
|
+
|
|
174
|
+
const response = await fetch(url);
|
|
175
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
176
|
+
const vtpReader = vtkXMLPolyDataReader.newInstance();
|
|
177
|
+
vtpReader.parseAsArrayBuffer(arrayBuffer);
|
|
178
|
+
vtpReader.update();
|
|
179
|
+
|
|
180
|
+
const polyData = vtkPolyData.newInstance();
|
|
181
|
+
polyData.shallowCopy(vtpReader.getOutputData());
|
|
182
|
+
polyData.getPointData().setActiveScalars('Color');
|
|
183
|
+
const mapper = vtkMapper.newInstance();
|
|
184
|
+
mapper.setInputData(polyData);
|
|
185
|
+
mapper.setColorModeToDirectScalars();
|
|
186
|
+
|
|
187
|
+
const actor = vtkActor.newInstance();
|
|
188
|
+
actor.setMapper(mapper);
|
|
189
|
+
actor.rotateZ(180);
|
|
190
|
+
return actor;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private createAnnotationCube(overlayConfiguration: any) {
|
|
194
|
+
const actor = vtkAnnotatedCubeActor.newInstance();
|
|
195
|
+
actor.setDefaultStyle({ ...overlayConfiguration.defaultStyle });
|
|
196
|
+
actor.setXPlusFaceProperty({
|
|
197
|
+
...overlayConfiguration.faceProperties.xPlus,
|
|
198
|
+
});
|
|
199
|
+
actor.setXMinusFaceProperty({
|
|
200
|
+
...overlayConfiguration.faceProperties.xMinus,
|
|
201
|
+
});
|
|
202
|
+
actor.setYPlusFaceProperty({
|
|
203
|
+
...overlayConfiguration.faceProperties.yPlus,
|
|
204
|
+
});
|
|
205
|
+
actor.setYMinusFaceProperty({
|
|
206
|
+
...overlayConfiguration.faceProperties.yMinus,
|
|
207
|
+
});
|
|
208
|
+
actor.setZPlusFaceProperty({
|
|
209
|
+
...overlayConfiguration.faceProperties.zPlus,
|
|
210
|
+
});
|
|
211
|
+
actor.setZMinusFaceProperty({
|
|
212
|
+
...overlayConfiguration.faceProperties.zMinus,
|
|
213
|
+
});
|
|
214
|
+
return actor;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async createAnnotatedCubeActor() {
|
|
218
|
+
const axes = vtkAnnotatedCubeActor.newInstance();
|
|
219
|
+
const { faceProperties, defaultStyle } = this.configuration.annotatedCube;
|
|
220
|
+
|
|
221
|
+
axes.setDefaultStyle(defaultStyle);
|
|
222
|
+
|
|
223
|
+
Object.keys(faceProperties).forEach((key) => {
|
|
224
|
+
const methodName = `set${
|
|
225
|
+
key.charAt(0).toUpperCase() + key.slice(1)
|
|
226
|
+
}FaceProperty`;
|
|
227
|
+
axes[methodName](faceProperties[key]);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
return axes;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
OrientationMarkerTool.toolName = 'OrientationMarker';
|
|
235
|
+
export default OrientationMarkerTool;
|