@cornerstonejs/tools 0.13.0 → 0.15.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.
Files changed (79) hide show
  1. package/dist/cjs/enums/ToolBindings.js.map +1 -1
  2. package/dist/cjs/index.d.ts +2 -2
  3. package/dist/cjs/index.js +3 -1
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/cjs/tools/MagnifyTool.d.ts +24 -0
  6. package/dist/cjs/tools/MagnifyTool.js +169 -0
  7. package/dist/cjs/tools/MagnifyTool.js.map +1 -0
  8. package/dist/cjs/tools/annotation/AngleTool.d.ts +37 -0
  9. package/dist/cjs/tools/annotation/AngleTool.js +442 -0
  10. package/dist/cjs/tools/annotation/AngleTool.js.map +1 -0
  11. package/dist/cjs/tools/index.d.ts +3 -1
  12. package/dist/cjs/tools/index.js +5 -1
  13. package/dist/cjs/tools/index.js.map +1 -1
  14. package/dist/cjs/types/CINETypes.d.ts +19 -0
  15. package/dist/cjs/types/CINETypes.js +3 -0
  16. package/dist/cjs/types/CINETypes.js.map +1 -0
  17. package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +24 -0
  18. package/dist/cjs/types/index.d.ts +2 -1
  19. package/dist/cjs/utilities/cine/events.d.ts +5 -0
  20. package/dist/cjs/utilities/cine/events.js +9 -0
  21. package/dist/cjs/utilities/cine/events.js.map +1 -0
  22. package/dist/cjs/utilities/cine/index.d.ts +4 -0
  23. package/dist/cjs/utilities/cine/index.js +15 -0
  24. package/dist/cjs/utilities/cine/index.js.map +1 -0
  25. package/dist/cjs/utilities/cine/playClip.d.ts +4 -0
  26. package/dist/cjs/utilities/cine/playClip.js +165 -0
  27. package/dist/cjs/utilities/cine/playClip.js.map +1 -0
  28. package/dist/cjs/utilities/cine/state.d.ts +4 -0
  29. package/dist/cjs/utilities/cine/state.js +18 -0
  30. package/dist/cjs/utilities/cine/state.js.map +1 -0
  31. package/dist/cjs/utilities/index.d.ts +2 -1
  32. package/dist/cjs/utilities/index.js +3 -1
  33. package/dist/cjs/utilities/index.js.map +1 -1
  34. package/dist/cjs/utilities/math/angle/angleBetweenLines.d.ts +4 -0
  35. package/dist/cjs/utilities/math/angle/angleBetweenLines.js +17 -0
  36. package/dist/cjs/utilities/math/angle/angleBetweenLines.js.map +1 -0
  37. package/dist/cjs/utilities/viewportFilters/filterViewportsWithToolEnabled.js +3 -0
  38. package/dist/cjs/utilities/viewportFilters/filterViewportsWithToolEnabled.js.map +1 -1
  39. package/dist/esm/enums/ToolBindings.js.map +1 -1
  40. package/dist/esm/index.d.ts +2 -2
  41. package/dist/esm/index.js +2 -2
  42. package/dist/esm/index.js.map +1 -1
  43. package/dist/esm/tools/MagnifyTool.d.ts +24 -0
  44. package/dist/esm/tools/MagnifyTool.js +163 -0
  45. package/dist/esm/tools/MagnifyTool.js.map +1 -0
  46. package/dist/esm/tools/annotation/AngleTool.d.ts +37 -0
  47. package/dist/esm/tools/annotation/AngleTool.js +417 -0
  48. package/dist/esm/tools/annotation/AngleTool.js.map +1 -0
  49. package/dist/esm/tools/index.d.ts +3 -1
  50. package/dist/esm/tools/index.js +3 -1
  51. package/dist/esm/tools/index.js.map +1 -1
  52. package/dist/esm/types/CINETypes.d.ts +19 -0
  53. package/dist/esm/types/CINETypes.js +2 -0
  54. package/dist/esm/types/CINETypes.js.map +1 -0
  55. package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +24 -0
  56. package/dist/esm/types/index.d.ts +2 -1
  57. package/dist/esm/utilities/cine/events.d.ts +5 -0
  58. package/dist/esm/utilities/cine/events.js +7 -0
  59. package/dist/esm/utilities/cine/events.js.map +1 -0
  60. package/dist/esm/utilities/cine/index.d.ts +4 -0
  61. package/dist/esm/utilities/cine/index.js +5 -0
  62. package/dist/esm/utilities/cine/index.js.map +1 -0
  63. package/dist/esm/utilities/cine/playClip.d.ts +4 -0
  64. package/dist/esm/utilities/cine/playClip.js +157 -0
  65. package/dist/esm/utilities/cine/playClip.js.map +1 -0
  66. package/dist/esm/utilities/cine/state.d.ts +4 -0
  67. package/dist/esm/utilities/cine/state.js +14 -0
  68. package/dist/esm/utilities/cine/state.js.map +1 -0
  69. package/dist/esm/utilities/index.d.ts +2 -1
  70. package/dist/esm/utilities/index.js +2 -1
  71. package/dist/esm/utilities/index.js.map +1 -1
  72. package/dist/esm/utilities/math/angle/angleBetweenLines.d.ts +4 -0
  73. package/dist/esm/utilities/math/angle/angleBetweenLines.js +14 -0
  74. package/dist/esm/utilities/math/angle/angleBetweenLines.js.map +1 -0
  75. package/dist/esm/utilities/viewportFilters/filterViewportsWithToolEnabled.js +3 -0
  76. package/dist/esm/utilities/viewportFilters/filterViewportsWithToolEnabled.js.map +1 -1
  77. package/dist/umd/index.js +1 -1
  78. package/dist/umd/index.js.map +1 -1
  79. package/package.json +6 -6
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.addToolState = exports.getToolState = exports.Events = exports.stopClip = exports.playClip = void 0;
7
+ const playClip_1 = require("./playClip");
8
+ Object.defineProperty(exports, "playClip", { enumerable: true, get: function () { return playClip_1.playClip; } });
9
+ Object.defineProperty(exports, "stopClip", { enumerable: true, get: function () { return playClip_1.stopClip; } });
10
+ const events_1 = __importDefault(require("./events"));
11
+ exports.Events = events_1.default;
12
+ const state_1 = require("./state");
13
+ Object.defineProperty(exports, "getToolState", { enumerable: true, get: function () { return state_1.getToolState; } });
14
+ Object.defineProperty(exports, "addToolState", { enumerable: true, get: function () { return state_1.addToolState; } });
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/cine/index.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAgD;AAIvC,yFAJA,mBAAQ,OAIA;AAAE,yFAJA,mBAAQ,OAIA;AAH3B,sDAA8B;AAGD,iBAHtB,gBAAM,CAGsB;AAFnC,mCAAqD;AAEhB,6FAF5B,oBAAY,OAE4B;AAAE,6FAF5B,oBAAY,OAE4B"}
@@ -0,0 +1,4 @@
1
+ import { CINETypes } from '../../types';
2
+ declare function playClip(element: HTMLDivElement, playClipOptions: CINETypes.PlayClipOptions): void;
3
+ declare function stopClip(element: HTMLDivElement): void;
4
+ export { playClip, stopClip };
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.stopClip = exports.playClip = void 0;
7
+ const core_1 = require("@cornerstonejs/core");
8
+ const events_1 = __importDefault(require("./events"));
9
+ const state_1 = require("./state");
10
+ const { triggerEvent } = core_1.utilities;
11
+ function playClip(element, playClipOptions) {
12
+ var _a, _b, _c, _d;
13
+ let playClipTimeouts;
14
+ let playClipIsTimeVarying;
15
+ if (element === undefined) {
16
+ throw new Error('playClip: element must not be undefined');
17
+ }
18
+ const enabledElement = (0, core_1.getEnabledElement)(element);
19
+ if (!enabledElement) {
20
+ throw new Error('playClip: element must be a valid Cornerstone enabled element');
21
+ }
22
+ const { viewport } = enabledElement;
23
+ if (!(viewport instanceof core_1.StackViewport)) {
24
+ throw new Error('playClip: element must be a stack viewport, volume viewport playClip not yet implemented');
25
+ }
26
+ const stackData = {
27
+ currentImageIdIndex: viewport.getCurrentImageIdIndex(),
28
+ imageIds: viewport.getImageIds(),
29
+ };
30
+ let playClipData = (0, state_1.getToolState)(element);
31
+ if (!playClipData) {
32
+ playClipData = {
33
+ intervalId: undefined,
34
+ framesPerSecond: 30,
35
+ lastFrameTimeStamp: undefined,
36
+ ignoreFrameTimeVector: false,
37
+ usingFrameTimeVector: false,
38
+ frameTimeVector: (_a = playClipOptions.frameTimeVector) !== null && _a !== void 0 ? _a : undefined,
39
+ speed: (_b = playClipOptions.frameTimeVectorSpeedMultiplier) !== null && _b !== void 0 ? _b : 1,
40
+ reverse: (_c = playClipOptions.reverse) !== null && _c !== void 0 ? _c : false,
41
+ loop: (_d = playClipOptions.loop) !== null && _d !== void 0 ? _d : true,
42
+ };
43
+ (0, state_1.addToolState)(element, playClipData);
44
+ }
45
+ else {
46
+ _stopClipWithData(playClipData);
47
+ }
48
+ if (playClipOptions.framesPerSecond < 0 ||
49
+ playClipOptions.framesPerSecond > 0) {
50
+ playClipData.framesPerSecond = Number(playClipOptions.framesPerSecond);
51
+ playClipData.reverse = playClipData.framesPerSecond < 0;
52
+ playClipData.ignoreFrameTimeVector = true;
53
+ }
54
+ if (playClipData.ignoreFrameTimeVector !== true &&
55
+ playClipData.frameTimeVector &&
56
+ playClipData.frameTimeVector.length === stackData.imageIds.length) {
57
+ const { timeouts, isTimeVarying } = _getPlayClipTimeouts(playClipData.frameTimeVector, playClipData.speed);
58
+ playClipTimeouts = timeouts;
59
+ playClipIsTimeVarying = isTimeVarying;
60
+ }
61
+ const playClipAction = () => {
62
+ let newImageIdIndex = stackData.currentImageIdIndex;
63
+ const imageCount = stackData.imageIds.length;
64
+ if (playClipData.reverse) {
65
+ newImageIdIndex--;
66
+ }
67
+ else {
68
+ newImageIdIndex++;
69
+ }
70
+ if (!playClipData.loop &&
71
+ (newImageIdIndex < 0 || newImageIdIndex >= imageCount)) {
72
+ _stopClipWithData(playClipData);
73
+ const eventDetail = {
74
+ element,
75
+ };
76
+ triggerEvent(element, events_1.default.CLIP_STOPPED, eventDetail);
77
+ return;
78
+ }
79
+ if (newImageIdIndex >= imageCount) {
80
+ newImageIdIndex = 0;
81
+ }
82
+ if (newImageIdIndex < 0) {
83
+ newImageIdIndex = imageCount - 1;
84
+ }
85
+ if (newImageIdIndex !== stackData.currentImageIdIndex) {
86
+ viewport.setImageIdIndex(newImageIdIndex).then(() => {
87
+ stackData.currentImageIdIndex = newImageIdIndex;
88
+ });
89
+ }
90
+ };
91
+ if (playClipTimeouts &&
92
+ playClipTimeouts.length > 0 &&
93
+ playClipIsTimeVarying) {
94
+ playClipData.usingFrameTimeVector = true;
95
+ playClipData.intervalId = window.setTimeout(function playClipTimeoutHandler() {
96
+ playClipData.intervalId = window.setTimeout(playClipTimeoutHandler, playClipTimeouts[stackData.currentImageIdIndex]);
97
+ playClipAction();
98
+ }, 0);
99
+ }
100
+ else {
101
+ playClipData.usingFrameTimeVector = false;
102
+ playClipData.intervalId = window.setInterval(playClipAction, 1000 / Math.abs(playClipData.framesPerSecond));
103
+ }
104
+ const eventDetail = {
105
+ element,
106
+ };
107
+ triggerEvent(element, events_1.default.CLIP_STARTED, eventDetail);
108
+ }
109
+ exports.playClip = playClip;
110
+ function stopClip(element) {
111
+ const enabledElement = (0, core_1.getEnabledElement)(element);
112
+ const { viewport } = enabledElement;
113
+ const cineToolData = (0, state_1.getToolState)(viewport.element);
114
+ if (!cineToolData) {
115
+ return;
116
+ }
117
+ _stopClipWithData(cineToolData);
118
+ }
119
+ exports.stopClip = stopClip;
120
+ function _getPlayClipTimeouts(vector, speed) {
121
+ let i;
122
+ let sample;
123
+ let delay;
124
+ let sum = 0;
125
+ const limit = vector.length;
126
+ const timeouts = [];
127
+ let isTimeVarying = false;
128
+ if (typeof speed !== 'number' || speed <= 0) {
129
+ speed = 1;
130
+ }
131
+ for (i = 1; i < limit; i++) {
132
+ delay = (Number(vector[i]) / speed) | 0;
133
+ timeouts.push(delay);
134
+ if (i === 1) {
135
+ sample = delay;
136
+ }
137
+ else if (delay !== sample) {
138
+ isTimeVarying = true;
139
+ }
140
+ sum += delay;
141
+ }
142
+ if (timeouts.length > 0) {
143
+ if (isTimeVarying) {
144
+ delay = (sum / timeouts.length) | 0;
145
+ }
146
+ else {
147
+ delay = timeouts[0];
148
+ }
149
+ timeouts.push(delay);
150
+ }
151
+ return { timeouts, isTimeVarying };
152
+ }
153
+ function _stopClipWithData(playClipData) {
154
+ const id = playClipData.intervalId;
155
+ if (typeof id !== 'undefined') {
156
+ playClipData.intervalId = undefined;
157
+ if (playClipData.usingFrameTimeVector) {
158
+ clearTimeout(id);
159
+ }
160
+ else {
161
+ clearInterval(id);
162
+ }
163
+ }
164
+ }
165
+ //# sourceMappingURL=playClip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playClip.js","sourceRoot":"","sources":["../../../../src/utilities/cine/playClip.ts"],"names":[],"mappings":";;;;;;AAAA,8CAI6B;AAC7B,sDAAmC;AACnC,mCAAqD;AAGrD,MAAM,EAAE,YAAY,EAAE,GAAG,gBAAS,CAAC;AASnC,SAAS,QAAQ,CACf,OAAuB,EACvB,eAA0C;;IAE1C,IAAI,gBAAgB,CAAC;IACrB,IAAI,qBAAqB,CAAC;IAE1B,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;KAC5D;IAED,MAAM,cAAc,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;IAElD,IAAI,CAAC,cAAc,EAAE;QACnB,MAAM,IAAI,KAAK,CACb,+DAA+D,CAChE,CAAC;KACH;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;IAEpC,IAAI,CAAC,CAAC,QAAQ,YAAY,oBAAa,CAAC,EAAE;QACxC,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;KACH;IAED,MAAM,SAAS,GAAG;QAChB,mBAAmB,EAAE,QAAQ,CAAC,sBAAsB,EAAE;QACtD,QAAQ,EAAE,QAAQ,CAAC,WAAW,EAAE;KACjC,CAAC;IAEF,IAAI,YAAY,GAAG,IAAA,oBAAY,EAAC,OAAO,CAAC,CAAC;IAEzC,IAAI,CAAC,YAAY,EAAE;QACjB,YAAY,GAAG;YACb,UAAU,EAAE,SAAS;YACrB,eAAe,EAAE,EAAE;YACnB,kBAAkB,EAAE,SAAS;YAC7B,qBAAqB,EAAE,KAAK;YAC5B,oBAAoB,EAAE,KAAK;YAC3B,eAAe,EAAE,MAAA,eA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QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QACvB,IAAI,aAAa,EAAE;YAGjB,KAAK,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACrC;aAAM;YACL,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;SACrB;QAED,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACtB;IAED,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;AACrC,CAAC;AAMD,SAAS,iBAAiB,CAAC,YAAY;IACrC,MAAM,EAAE,GAAG,YAAY,CAAC,UAAU,CAAC;IAEnC,IAAI,OAAO,EAAE,KAAK,WAAW,EAAE;QAC7B,YAAY,CAAC,UAAU,GAAG,SAAS,CAAC;QACpC,IAAI,YAAY,CAAC,oBAAoB,EAAE;YACrC,YAAY,CAAC,EAAE,CAAC,CAAC;SAClB;aAAM;YACL,aAAa,CAAC,EAAE,CAAC,CAAC;SACnB;KACF;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { CINETypes } from '../../types';
2
+ declare function addToolState(element: HTMLDivElement, data: CINETypes.ToolData): void;
3
+ declare function getToolState(element: HTMLDivElement): CINETypes.ToolData | undefined;
4
+ export { addToolState, getToolState };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getToolState = exports.addToolState = void 0;
4
+ const core_1 = require("@cornerstonejs/core");
5
+ const state = {};
6
+ function addToolState(element, data) {
7
+ const enabledElement = (0, core_1.getEnabledElement)(element);
8
+ const { viewportId } = enabledElement;
9
+ state[viewportId] = data;
10
+ }
11
+ exports.addToolState = addToolState;
12
+ function getToolState(element) {
13
+ const enabledElement = (0, core_1.getEnabledElement)(element);
14
+ const { viewportId } = enabledElement;
15
+ return state[viewportId];
16
+ }
17
+ exports.getToolState = getToolState;
18
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../src/utilities/cine/state.ts"],"names":[],"mappings":";;;AAAA,8CAAwD;AAGxD,MAAM,KAAK,GAAuC,EAAE,CAAC;AAErD,SAAS,YAAY,CAAC,OAAuB,EAAE,IAAwB;IACrE,MAAM,cAAc,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;IAClD,MAAM,EAAE,UAAU,EAAE,GAAG,cAAc,CAAC;IACtC,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;AAC3B,CAAC;AAQQ,oCAAY;AANrB,SAAS,YAAY,CAAC,OAAuB;IAC3C,MAAM,cAAc,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;IAClD,MAAM,EAAE,UAAU,EAAE,GAAG,cAAc,CAAC;IACtC,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC;AAC3B,CAAC;AAEsB,oCAAY"}
@@ -15,5 +15,6 @@ import * as planar from './planar';
15
15
  import * as stackScrollTool from './stackScrollTool';
16
16
  import * as viewportFilters from './viewportFilters';
17
17
  import * as orientation from './orientation';
18
+ import * as cine from './cine';
18
19
  import { triggerEvent } from '@cornerstonejs/core';
19
- export { math, planar, viewportFilters, stackScrollTool, drawing, debounce, deepMerge, throttle, orientation, isObject, triggerEvent, calibrateImageSpacing, segmentation, triggerAnnotationRenderForViewportIds, pointInShapeCallback, pointInSurroundingSphereCallback, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, jumpToSlice, };
20
+ export { math, planar, viewportFilters, stackScrollTool, drawing, debounce, deepMerge, throttle, orientation, isObject, triggerEvent, calibrateImageSpacing, segmentation, triggerAnnotationRenderForViewportIds, pointInShapeCallback, pointInSurroundingSphereCallback, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, jumpToSlice, cine, };
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.jumpToSlice = exports.getAnnotationNearPointOnEnabledElement = exports.getAnnotationNearPoint = exports.pointInSurroundingSphereCallback = exports.pointInShapeCallback = exports.triggerAnnotationRenderForViewportIds = exports.segmentation = exports.calibrateImageSpacing = exports.triggerEvent = exports.isObject = exports.orientation = exports.throttle = exports.deepMerge = exports.debounce = exports.drawing = exports.stackScrollTool = exports.viewportFilters = exports.planar = exports.math = void 0;
25
+ exports.cine = exports.jumpToSlice = exports.getAnnotationNearPointOnEnabledElement = exports.getAnnotationNearPoint = exports.pointInSurroundingSphereCallback = exports.pointInShapeCallback = exports.triggerAnnotationRenderForViewportIds = exports.segmentation = exports.calibrateImageSpacing = exports.triggerEvent = exports.isObject = exports.orientation = exports.throttle = exports.deepMerge = exports.debounce = exports.drawing = exports.stackScrollTool = exports.viewportFilters = exports.planar = exports.math = void 0;
26
26
  const getAnnotationNearPoint_1 = require("./getAnnotationNearPoint");
27
27
  Object.defineProperty(exports, "getAnnotationNearPoint", { enumerable: true, get: function () { return getAnnotationNearPoint_1.getAnnotationNearPoint; } });
28
28
  Object.defineProperty(exports, "getAnnotationNearPointOnEnabledElement", { enumerable: true, get: function () { return getAnnotationNearPoint_1.getAnnotationNearPointOnEnabledElement; } });
@@ -58,6 +58,8 @@ const viewportFilters = __importStar(require("./viewportFilters"));
58
58
  exports.viewportFilters = viewportFilters;
59
59
  const orientation = __importStar(require("./orientation"));
60
60
  exports.orientation = orientation;
61
+ const cine = __importStar(require("./cine"));
62
+ exports.cine = cine;
61
63
  const core_1 = require("@cornerstonejs/core");
62
64
  Object.defineProperty(exports, "triggerEvent", { enumerable: true, get: function () { return core_1.triggerEvent; } });
63
65
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAGkC;AA2ChC,uGA7CA,+CAAsB,OA6CA;AACtB,uHA7C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D,+BA/BK,8BAAoB,CA+BL;AA9BtB,0GAAkF;AA+BhF,2CA/BK,0CAAgC,CA+BL;AA5BlC,6DAA+C;AAyB7C,oCAAY;AAxBd,mDAAqC;AAgBnC,0BAAO;AAfT,6CAA+B;AAW7B,oBAAI;AAVN,iDAAmC;AAWjC,wBAAM;AAVR,mEAAqD;AAYnD,0CAAe;AAXjB,mEAAqD;AAUnD,0CAAe;AATjB,2DAA6C;AAe3C,kCAAW;AAdb,6CAA+B;AAyB7B,oBAAI;AAtBN,8CAAmD;AAajD,6FAbO,mBAAY,OAaP"}
@@ -0,0 +1,4 @@
1
+ import type { Types } from '@cornerstonejs/core';
2
+ declare type Line = [Types.Point3, Types.Point3];
3
+ export default function angleBetweenLines(line1: Line, line2: Line): number;
4
+ export {};
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const gl_matrix_1 = require("gl-matrix");
4
+ function angleBetweenLines(line1, line2) {
5
+ const [p1, p2] = line1;
6
+ const [p3, p4] = line2;
7
+ const v1 = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), p2, p1);
8
+ const v2 = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), p3, p4);
9
+ const dot = gl_matrix_1.vec3.dot(v1, v2);
10
+ const v1Length = gl_matrix_1.vec3.length(v1);
11
+ const v2Length = gl_matrix_1.vec3.length(v2);
12
+ const cos = dot / (v1Length * v2Length);
13
+ const radian = Math.acos(cos);
14
+ return (radian * 180) / Math.PI;
15
+ }
16
+ exports.default = angleBetweenLines;
17
+ //# sourceMappingURL=angleBetweenLines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"angleBetweenLines.js","sourceRoot":"","sources":["../../../../../src/utilities/math/angle/angleBetweenLines.ts"],"names":[],"mappings":";;AACA,yCAAiC;AAUjC,SAAwB,iBAAiB,CAAC,KAAW,EAAE,KAAW;IAChE,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC;IACvB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC;IAEvB,MAAM,EAAE,GAAG,gBAAI,CAAC,GAAG,CAAC,gBAAI,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC3C,MAAM,EAAE,GAAG,gBAAI,CAAC,GAAG,CAAC,gBAAI,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAE3C,MAAM,GAAG,GAAG,gBAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAE7B,MAAM,QAAQ,GAAG,gBAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,gBAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAEjC,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC;IAExC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE9B,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAClC,CAAC;AAjBD,oCAiBC"}
@@ -9,6 +9,9 @@ function filterViewportsWithToolEnabled(viewports, toolName) {
9
9
  for (let vp = 0; vp < numViewports; vp++) {
10
10
  const viewport = viewports[vp];
11
11
  const toolGroup = store_1.ToolGroupManager.getToolGroupForViewport(viewport.id, viewport.renderingEngineId);
12
+ if (!toolGroup) {
13
+ continue;
14
+ }
12
15
  const hasTool = _toolGroupHasActiveEnabledOrPassiveTool(toolGroup, toolName);
13
16
  if (hasTool) {
14
17
  viewportsWithToolEnabled.push(viewport);
@@ -1 +1 @@
1
- {"version":3,"file":"filterViewportsWithToolEnabled.js","sourceRoot":"","sources":["../../../../src/utilities/viewportFilters/filterViewportsWithToolEnabled.ts"],"names":[],"mappings":";;AAEA,uCAA+C;AAC/C,uCAAwC;AAExC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,iBAAS,CAAC;AAU/C,SAAwB,8BAA8B,CACpD,SAA8D,EAC9D,QAAgB;IAEhB,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC;IAEtC,MAAM,wBAAwB,GAAG,EAAE,CAAC;IAEpC,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,YAAY,EAAE,EAAE,EAAE,EAAE;QACxC,MAAM,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;QAE/B,MAAM,SAAS,GAAG,wBAAgB,CAAC,uBAAuB,CACxD,QAAQ,CAAC,EAAE,EACX,QAAQ,CAAC,iBAAiB,CAC3B,CAAC;QAEF,MAAM,OAAO,GAAG,uCAAuC,CACrD,SAAS,EACT,QAAQ,CACT,CAAC;QAEF,IAAI,OAAO,EAAE;YACX,wBAAwB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACzC;KACF;IAED,OAAO,wBAAwB,CAAC;AAClC,CAAC;AA3BD,iDA2BC;AAWD,SAAS,uCAAuC,CAC9C,SAAqB,EACrB,QAAgB;IAEhB,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;IAClC,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IAEnC,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,KAAK,CAAC;KACd;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;IAE3B,OAAO,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,OAAO,CAAC;AAC7E,CAAC"}
1
+ {"version":3,"file":"filterViewportsWithToolEnabled.js","sourceRoot":"","sources":["../../../../src/utilities/viewportFilters/filterViewportsWithToolEnabled.ts"],"names":[],"mappings":";;AAEA,uCAA+C;AAC/C,uCAAwC;AAExC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,iBAAS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B,CAAA;IACzB,uFAA2B,CAAA;IAC3B,+GAAuC,CAAA;IACvC,mEAAiB,CAAA;IACjB,kEAAiB,CAAA;AACnB,CAAC,EAVI,aAAa,KAAb,aAAa,QAUjB;AAED,IAAK,gBAIJ;AAJD,WAAK,gBAAgB;IACnB,0DAAU,CAAA;IACV,wDAAS,CAAA;IACT,sDAAQ,CAAA;AACV,CAAC,EAJI,gBAAgB,KAAhB,gBAAgB,QAIpB;AAED,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"ToolBindings.js","sourceRoot":"","sources":["../../../src/enums/ToolBindings.ts"],"names":[],"mappings":"AAMA,IAAK,aAeJ;AAfD,WAAK,aAAa;IAEhB,uDAAW,CAAA;IAEX,2DAAa,CAAA;IACb,mFAAyB,CAAA;IAEzB,2DAAa,CAAA;IACb,mFAAyB,CAAA;IACzB,uFAA2B,CAAA;IAC3B,+GAAuC,CAAA;IAEvC,mEAAiB,CAAA;IAEjB,kEAAiB,CAAA;AACnB,CAAC,EAfI,aAAa,KAAb,aAAa,QAejB;AAED,IAAK,gBAIJ;AAJD,WAAK,gBAAgB;IACnB,0DAAU,CAAA;IACV,wDAAS,CAAA;IACT,sDAAQ,CAAA;AACV,CAAC,EAJI,gBAAgB,KAAhB,gBAAgB,QAIpB;AAED,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC"}
@@ -8,6 +8,6 @@ import * as cursors from './cursors';
8
8
  import * as Types from './types';
9
9
  import * as annotation from './stateManagement/annotation';
10
10
  import * as segmentation from './stateManagement/segmentation';
11
- import { BaseTool, AnnotationTool, PanTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, ProbeTool, RectangleROITool, EllipticalROITool, BidirectionalTool, PlanarFreehandROITool, ArrowAnnotateTool, CrosshairsTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, SegmentationDisplayTool, BrushTool } from './tools';
11
+ import { BaseTool, AnnotationTool, PanTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, ProbeTool, RectangleROITool, EllipticalROITool, BidirectionalTool, PlanarFreehandROITool, ArrowAnnotateTool, CrosshairsTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, SegmentationDisplayTool, BrushTool, AngleTool, MagnifyTool } from './tools';
12
12
  import * as Enums from './enums';
13
- export { init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, PanTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, CrosshairsTool, ProbeTool, RectangleROITool, EllipticalROITool, BidirectionalTool, PlanarFreehandROITool, ArrowAnnotateTool, SegmentationDisplayTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, BrushTool, synchronizers, Synchronizer, SynchronizerManager, Types, ToolGroupManager, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, };
13
+ export { init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, PanTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, CrosshairsTool, ProbeTool, RectangleROITool, EllipticalROITool, BidirectionalTool, PlanarFreehandROITool, ArrowAnnotateTool, AngleTool, MagnifyTool, SegmentationDisplayTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, BrushTool, synchronizers, Synchronizer, SynchronizerManager, Types, ToolGroupManager, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, };
package/dist/esm/index.js CHANGED
@@ -8,7 +8,7 @@ import * as cursors from './cursors';
8
8
  import * as Types from './types';
9
9
  import * as annotation from './stateManagement/annotation';
10
10
  import * as segmentation from './stateManagement/segmentation';
11
- import { BaseTool, AnnotationTool, PanTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, ProbeTool, RectangleROITool, EllipticalROITool, BidirectionalTool, PlanarFreehandROITool, ArrowAnnotateTool, CrosshairsTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, SegmentationDisplayTool, BrushTool, } from './tools';
11
+ import { BaseTool, AnnotationTool, PanTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, ProbeTool, RectangleROITool, EllipticalROITool, BidirectionalTool, PlanarFreehandROITool, ArrowAnnotateTool, CrosshairsTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, SegmentationDisplayTool, BrushTool, AngleTool, MagnifyTool, } from './tools';
12
12
  import * as Enums from './enums';
13
- export { init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, PanTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, CrosshairsTool, ProbeTool, RectangleROITool, EllipticalROITool, BidirectionalTool, PlanarFreehandROITool, ArrowAnnotateTool, SegmentationDisplayTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, BrushTool, synchronizers, Synchronizer, SynchronizerManager, Types, ToolGroupManager, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, };
13
+ export { init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, PanTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, CrosshairsTool, ProbeTool, RectangleROITool, EllipticalROITool, BidirectionalTool, PlanarFreehandROITool, ArrowAnnotateTool, AngleTool, MagnifyTool, SegmentationDisplayTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, BrushTool, synchronizers, Synchronizer, SynchronizerManager, Types, ToolGroupManager, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, };
14
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EACL,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,GAC1B,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EACL,QAAQ,EACR,cAAc,EACd,OAAO,EACP,aAAa,EACb,eAAe,EACf,QAAQ,EACR,eAAe,EACf,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACj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ACrC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EACL,QAAQ,EACR,cAAc,EACd,OAAO,EACP,aAAa,EACb,eAAe,EACf,QAAQ,EACR,eAAe,EACf,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,iCAAiC,EACjC,uBAAuB,EACvB,SAAS,EACT,SAAS,EACT,WAAW,GACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EAEL,IAAI,EACJ,OAAO,EACP,OAAO,EACP,UAAU,EACV,yBAAyB,EAEzB,QAAQ,EACR,cAAc,EAEd,OAAO,EACP,aAAa,EACb,eAAe,EACf,QAAQ,EACR,eAAe,EACf,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAElB,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,SAAS,EACT,WAAW,EAEX,uBAAuB,EAEvB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,iCAAiC,EACjC,SAAS,EAET,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,KAAK,EAEL,gBAAgB,EAEhB,KAAK,EAEL,SAAS,EAET,OAAO,EAEP,UAAU,EAEV,YAAY,EAEZ,SAAS,EACT,OAAO,GACR,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { BaseTool } from './base';
2
+ import type { Types } from '@cornerstonejs/core';
3
+ import { EventTypes, PublicToolProps, ToolProps } from '../types';
4
+ import { IPoints } from '../types';
5
+ export default class MagnifyTool extends BaseTool {
6
+ static toolName: string;
7
+ mouseDragCallback: () => void;
8
+ _bounds: any;
9
+ editData: {
10
+ referencedImageId: string;
11
+ viewportIdsToRender: string[];
12
+ enabledElement: Types.IEnabledElement;
13
+ renderingEngine: Types.IRenderingEngine;
14
+ currentPoints: IPoints;
15
+ } | null;
16
+ constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps);
17
+ _getReferencedImageId(viewport: Types.IStackViewport | Types.IVolumeViewport): string;
18
+ preMouseDownCallback: (evt: EventTypes.MouseDownActivateEventType) => boolean;
19
+ _createMagnificationViewport: () => void;
20
+ _mouseDragCallback: (evt: EventTypes.MouseDragEventType) => void;
21
+ _mouseUpCallback: (evt: EventTypes.MouseUpEventType) => void;
22
+ _activateDraw: (element: HTMLDivElement) => void;
23
+ _deactivateDraw: (element: HTMLDivElement) => void;
24
+ }
@@ -0,0 +1,163 @@
1
+ import { BaseTool } from './base';
2
+ import { Events } from '../enums';
3
+ import { getEnabledElement, StackViewport } from '@cornerstonejs/core';
4
+ import { getViewportIdsWithToolToRender } from '../utilities/viewportFilters';
5
+ import triggerAnnotationRenderForViewportIds from '../utilities/triggerAnnotationRenderForViewportIds';
6
+ import { state } from '../store';
7
+ import { Enums } from '@cornerstonejs/core';
8
+ import { hideElementCursor, resetElementCursor, } from '../cursors/elementCursor';
9
+ const MAGNIFY_VIEWPORT_ID = 'maginify-viewport';
10
+ export default class MagnifyTool extends BaseTool {
11
+ constructor(toolProps = {}, defaultToolProps = {
12
+ supportedInteractionTypes: ['Mouse', 'Touch'],
13
+ configuration: {
14
+ magnifySize: 10,
15
+ magnifyWidth: 250,
16
+ magnifyHeight: 250,
17
+ },
18
+ }) {
19
+ super(toolProps, defaultToolProps);
20
+ this.preMouseDownCallback = (evt) => {
21
+ const eventDetail = evt.detail;
22
+ const { currentPoints, element } = eventDetail;
23
+ const enabledElement = getEnabledElement(element);
24
+ const { viewport, renderingEngine } = enabledElement;
25
+ if (!(viewport instanceof StackViewport)) {
26
+ throw new Error('MagnifyTool only works on StackViewports');
27
+ }
28
+ const referencedImageId = this._getReferencedImageId(viewport);
29
+ if (!referencedImageId) {
30
+ throw new Error('MagnifyTool: No referenced image id found, reconstructed planes not supported yet');
31
+ }
32
+ const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
33
+ this.editData = {
34
+ referencedImageId,
35
+ viewportIdsToRender,
36
+ enabledElement,
37
+ renderingEngine,
38
+ currentPoints,
39
+ };
40
+ this._createMagnificationViewport();
41
+ this._activateDraw(element);
42
+ hideElementCursor(element);
43
+ evt.preventDefault();
44
+ triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
45
+ return true;
46
+ };
47
+ this._createMagnificationViewport = () => {
48
+ const { enabledElement, referencedImageId, viewportIdsToRender, renderingEngine, currentPoints, } = this.editData;
49
+ const { viewport } = enabledElement;
50
+ const { element } = viewport;
51
+ const { voiRange } = viewport.getProperties();
52
+ const { canvas: canvasPos, world: worldPos } = currentPoints;
53
+ let magnifyToolElement;
54
+ magnifyToolElement = element.querySelector('.magnifyTool');
55
+ if (magnifyToolElement === null) {
56
+ const magnifyElement = document.createElement('div');
57
+ magnifyElement.classList.add('magnifyTool');
58
+ magnifyElement.style.display = 'block';
59
+ magnifyElement.style.width = `${this.configuration.magnifyWidth}px`;
60
+ magnifyElement.style.height = `${this.configuration.magnifyHeight}px`;
61
+ magnifyElement.style.position = 'absolute';
62
+ magnifyToolElement = magnifyElement;
63
+ const viewportElement = element.querySelector('.viewport-element');
64
+ viewportElement.appendChild(magnifyElement);
65
+ const viewportInput = {
66
+ viewportId: MAGNIFY_VIEWPORT_ID,
67
+ type: Enums.ViewportType.STACK,
68
+ element: magnifyToolElement,
69
+ };
70
+ renderingEngine.enableElement(viewportInput);
71
+ }
72
+ magnifyToolElement.style.top = `${canvasPos[1] - this.configuration.magnifyHeight / 2}px`;
73
+ magnifyToolElement.style.left = `${canvasPos[0] - this.configuration.magnifyWidth / 2}px`;
74
+ const magnifyViewport = renderingEngine.getViewport(MAGNIFY_VIEWPORT_ID);
75
+ magnifyViewport.setStack([referencedImageId]).then(() => {
76
+ magnifyViewport.setProperties({ voiRange });
77
+ const { parallelScale } = viewport.getCamera();
78
+ const { focalPoint, position, viewPlaneNormal } = magnifyViewport.getCamera();
79
+ const distance = Math.sqrt(Math.pow(focalPoint[0] - position[0], 2) +
80
+ Math.pow(focalPoint[1] - position[1], 2) +
81
+ Math.pow(focalPoint[2] - position[2], 2));
82
+ const updatedFocalPoint = [
83
+ worldPos[0],
84
+ worldPos[1],
85
+ worldPos[2],
86
+ ];
87
+ const updatedPosition = [
88
+ updatedFocalPoint[0] + distance * viewPlaneNormal[0],
89
+ updatedFocalPoint[1] + distance * viewPlaneNormal[1],
90
+ updatedFocalPoint[2] + distance * viewPlaneNormal[2],
91
+ ];
92
+ magnifyViewport.setCamera({
93
+ parallelScale: parallelScale * (1 / this.configuration.magnifySize),
94
+ focalPoint: updatedFocalPoint,
95
+ position: updatedPosition,
96
+ });
97
+ magnifyViewport.render();
98
+ });
99
+ magnifyToolElement.style.display = 'block';
100
+ triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
101
+ };
102
+ this._mouseDragCallback = (evt) => {
103
+ const eventDetail = evt.detail;
104
+ const { currentPoints, deltaPoints, element } = eventDetail;
105
+ const deltaPointsWorld = deltaPoints.world;
106
+ const canvasPos = currentPoints.canvas;
107
+ const enabledElement = getEnabledElement(element);
108
+ const { renderingEngine } = enabledElement;
109
+ const magnifyViewport = renderingEngine.getViewport(MAGNIFY_VIEWPORT_ID);
110
+ const magnifyElement = element.querySelector('.magnifyTool');
111
+ if (!magnifyElement) {
112
+ return;
113
+ }
114
+ magnifyElement.style.top = `${canvasPos[1] - this.configuration.magnifyHeight / 2}px`;
115
+ magnifyElement.style.left = `${canvasPos[0] - this.configuration.magnifyWidth / 2}px`;
116
+ const { focalPoint, position } = magnifyViewport.getCamera();
117
+ const updatedPosition = [
118
+ position[0] + deltaPointsWorld[0],
119
+ position[1] + deltaPointsWorld[1],
120
+ position[2] + deltaPointsWorld[2],
121
+ ];
122
+ const updatedFocalPoint = [
123
+ focalPoint[0] + deltaPointsWorld[0],
124
+ focalPoint[1] + deltaPointsWorld[1],
125
+ focalPoint[2] + deltaPointsWorld[2],
126
+ ];
127
+ magnifyViewport.setCamera({
128
+ focalPoint: updatedFocalPoint,
129
+ position: updatedPosition,
130
+ });
131
+ magnifyViewport.render();
132
+ };
133
+ this._mouseUpCallback = (evt) => {
134
+ const { element } = evt.detail;
135
+ const magnifyToolElement = element.querySelector('.magnifyTool');
136
+ magnifyToolElement.style.display = 'none';
137
+ this._deactivateDraw(element);
138
+ resetElementCursor(element);
139
+ };
140
+ this._activateDraw = (element) => {
141
+ state.isInteractingWithTool = true;
142
+ element.addEventListener(Events.MOUSE_UP, this._mouseUpCallback);
143
+ element.addEventListener(Events.MOUSE_DRAG, this._mouseDragCallback);
144
+ element.addEventListener(Events.MOUSE_CLICK, this._mouseUpCallback);
145
+ };
146
+ this._deactivateDraw = (element) => {
147
+ state.isInteractingWithTool = false;
148
+ element.removeEventListener(Events.MOUSE_UP, this._mouseUpCallback);
149
+ element.removeEventListener(Events.MOUSE_DRAG, this._mouseDragCallback);
150
+ element.removeEventListener(Events.MOUSE_CLICK, this._mouseUpCallback);
151
+ };
152
+ }
153
+ _getReferencedImageId(viewport) {
154
+ const targetId = this.getTargetId(viewport);
155
+ let referencedImageId;
156
+ if (viewport instanceof StackViewport) {
157
+ referencedImageId = targetId.split('imageId:')[1];
158
+ }
159
+ return referencedImageId;
160
+ }
161
+ }
162
+ MagnifyTool.toolName = 'Magnify';
163
+ //# sourceMappingURL=MagnifyTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MagnifyTool.js","sourceRoot":"","sources":["../../../src/tools/MagnifyTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM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OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzE,CAAC,CAAC;IArOF,CAAC;IAED,qBAAqB,CACnB,QAAsD;QAEtD,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAE5C,IAAI,iBAAiB,CAAC;QAEtB,IAAI,QAAQ,YAAY,aAAa,EAAE;YACrC,iBAAiB,GAAG,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;SACnD;QAED,OAAO,iBAAiB,CAAC;IAC3B,CAAC;;AArCM,oBAAQ,GAAG,SAAS,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { Types } from '@cornerstonejs/core';
2
+ import { AnnotationTool } from '../base';
3
+ import { EventTypes, ToolHandle, PublicToolProps, ToolProps, InteractionTypes } from '../../types';
4
+ import { AngleAnnotation } from '../../types/ToolSpecificAnnotationTypes';
5
+ declare class AngleTool extends AnnotationTool {
6
+ static toolName: string;
7
+ touchDragCallback: any;
8
+ mouseDragCallback: any;
9
+ angleStartedNotYetCompleted: boolean;
10
+ _throttledCalculateCachedStats: any;
11
+ editData: {
12
+ annotation: any;
13
+ viewportIdsToRender: string[];
14
+ handleIndex?: number;
15
+ movingTextBox?: boolean;
16
+ newAnnotation?: boolean;
17
+ hasMoved?: boolean;
18
+ } | null;
19
+ isDrawing: boolean;
20
+ isHandleOutsideImage: boolean;
21
+ constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps);
22
+ addNewAnnotation: (evt: EventTypes.MouseDownActivateEventType) => AngleAnnotation;
23
+ isPointNearTool: (element: HTMLDivElement, annotation: AngleAnnotation, canvasCoords: Types.Point2, proximity: number) => boolean;
24
+ toolSelectedCallback: (evt: EventTypes.MouseDownEventType, annotation: AngleAnnotation, interactionType: InteractionTypes) => void;
25
+ handleSelectedCallback(evt: EventTypes.MouseDownEventType, annotation: AngleAnnotation, handle: ToolHandle, interactionType?: string): void;
26
+ _mouseUpCallback: (evt: EventTypes.MouseUpEventType | EventTypes.MouseClickEventType) => void;
27
+ _mouseDragCallback: (evt: EventTypes.MouseDragEventType | EventTypes.MouseMoveEventType) => void;
28
+ cancel: (element: HTMLDivElement) => any;
29
+ _activateModify: (element: HTMLDivElement) => void;
30
+ _deactivateModify: (element: HTMLDivElement) => void;
31
+ _activateDraw: (element: HTMLDivElement) => void;
32
+ _deactivateDraw: (element: HTMLDivElement) => void;
33
+ renderAnnotation: (enabledElement: Types.IEnabledElement, svgDrawingHelper: any) => void;
34
+ _getTextLines(data: any, targetId: any): string[];
35
+ _calculateCachedStats(annotation: any, renderingEngine: any, enabledElement: any): any;
36
+ }
37
+ export default AngleTool;