@ohif/app 3.8.0-beta.85 → 3.8.0-beta.87
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/117.bundle.a5e6959bf225da5cf4ed.js +6552 -0
- package/dist/164.bundle.96c0518b435ea19ef8c4.js +11816 -0
- package/dist/{433.bundle.c92d3f716a797127c1be.js → 203.bundle.846a90d1ede185c941b0.js} +4765 -6951
- package/dist/{206.bundle.f944f8146169a6867103.js → 206.bundle.096c1d86defe1cf7e9ae.js} +26 -16
- package/dist/{183.bundle.fd870b9c566be6b8de8d.js → 236.bundle.fb6c65ae3a5aa0c58727.js} +17552 -23647
- package/dist/{321.bundle.eee08c35b8ae9177aef8.js → 321.bundle.7d6d0ead9384fcb67a5c.js} +21 -33
- package/dist/{325.bundle.3a548f7563cf7f4fa0c3.js → 325.bundle.357db826733b5379bd1d.js} +3 -2
- package/dist/{342.bundle.8c74ac4c7871bd4a6f60.js → 342.bundle.36ee082163b01284eeba.js} +1 -1
- package/dist/{41.bundle.0bbfc8b185335a6af3d2.js → 41.bundle.2f52dafa60516e97cd03.js} +6 -6
- package/dist/{217.bundle.c8c6e6cc3a615ceb5db3.js → 416.bundle.837e0b84baddd2193d67.js} +61666 -70479
- package/dist/{448.bundle.1c84f0bdf33114ffaa23.js → 448.bundle.7c47e50e0db23eeace58.js} +6 -6
- package/dist/473.bundle.f6804e7ac014a561eff8.js +7256 -0
- package/dist/483.bundle.9263b25c34b349aae80e.js +2287 -0
- package/dist/{487.bundle.1e939666fcf482a3f483.js → 487.bundle.adf730aff4ec37332b88.js} +7 -7
- package/dist/{544.bundle.80c013bb477a263bcf10.js → 544.bundle.1b6998bb61d6f8f88da9.js} +2 -2
- package/dist/{574.bundle.9919f94ea252d4a45aaf.js → 574.bundle.d6f15a036af7ecaf82f9.js} +4 -4
- package/dist/{633.bundle.7df396e5ce55038d73f8.js → 633.bundle.ad22fd57eb95ee5f056a.js} +7 -6
- package/dist/{669.bundle.7a2e02cf4a5ddd9f93d0.js → 669.bundle.796543c57c658097fe75.js} +9 -9
- package/dist/{699.bundle.c61a6ee18edaa82bbcb8.js → 699.bundle.4d75ac5add81a2e4ef3b.js} +4 -4
- package/dist/{335.bundle.40079fc4db9cd9e1ea25.js → 7.bundle.ea90a6f6f1d4ab030dfb.js} +185 -228
- package/dist/{722.bundle.2ee939850f552481d21f.js → 722.bundle.05e8759e64d484f4554d.js} +5 -3
- package/dist/{724.bundle.4b4c12fd4021b8e731c8.js → 724.bundle.275035c2002c8fd78471.js} +234 -7
- package/dist/{726.bundle.0b3d9277d22fe7e15b89.js → 726.bundle.c8de818cf1a3ff0cf7d2.js} +2 -2
- package/dist/{164.bundle.1b5c53db66679bcafad8.js → 783.bundle.b28ae6b134602470e2f1.js} +1 -1
- package/dist/{835.bundle.15aff0b7433bb0dd6d6d.js → 835.bundle.4c0eaa2c1a427ee41817.js} +2 -2
- package/dist/{862.bundle.217ce894d955626c78c5.js → 862.bundle.4be5d148c2b1adf4dbf3.js} +2 -2
- package/dist/{889.bundle.3f2ce46ff0852cd05e2d.js → 889.bundle.1a646aa901e073328cad.js} +1 -1
- package/dist/{94.bundle.258d632602d599e426a9.js → 94.bundle.d6749c52eb6327bd45de.js} +4 -4
- package/dist/{app.bundle.6173c1de2db725433585.js → app.bundle.177823343bc7e2b039a2.js} +44214 -42080
- package/dist/cornerstoneDICOMImageLoader.min.js +1 -1
- package/dist/cornerstoneDICOMImageLoader.min.js.map +1 -1
- package/dist/index.html +1 -1
- package/dist/{polySeg.bundle.f75afca9b957abed095e.js → polySeg.bundle.43bf3490e07982491e2b.js} +3 -3
- package/dist/suv-peak-worker.bundle.1f9b9e6887eebc07c50a.js +404 -0
- package/dist/sw.js +1 -1
- package/package.json +18 -18
- /package/dist/{188.bundle.382a4f6122f36663fe1b.js → 188.bundle.bef5c8babdde7064bdbe.js} +0 -0
- /package/dist/{594.bundle.a92b4affca5dd5a19008.js → 594.bundle.9a7fd38c5fc9823216e5.js} +0 -0
- /package/dist/{905.bundle.353dbb336dd069f813fc.js → 905.bundle.36ce5f219e58ff9ddf9b.js} +0 -0
- /package/dist/{907.bundle.b18e66ce363df0b55c58.js → 907.bundle.64fa9f550bd239e92346.js} +0 -0
- /package/dist/{961.bundle.c2fd81693f7f1a075bbd.js → 961.bundle.6a18125a324bca120651.js} +0 -0
|
@@ -0,0 +1,2287 @@
|
|
|
1
|
+
(globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[483],{
|
|
2
|
+
|
|
3
|
+
/***/ 79697:
|
|
4
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
// EXPORTS
|
|
9
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
10
|
+
A: () => (/* binding */ drawingSvg_draw)
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/store/index.js + 4 modules
|
|
14
|
+
var store = __webpack_require__(61738);
|
|
15
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 28 modules
|
|
16
|
+
var esm = __webpack_require__(92136);
|
|
17
|
+
;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/getSvgDrawingHelper.js
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const VIEWPORT_ELEMENT = 'viewport-element';
|
|
21
|
+
function getSvgDrawingHelper(element) {
|
|
22
|
+
const enabledElement = (0,esm.getEnabledElement)(element);
|
|
23
|
+
const { viewportId, renderingEngineId } = enabledElement;
|
|
24
|
+
const canvasHash = `${viewportId}:${renderingEngineId}`;
|
|
25
|
+
const svgLayerElement = _getSvgLayer(element);
|
|
26
|
+
Object.keys(store/* state */.wk.svgNodeCache[canvasHash]).forEach((cacheKey) => {
|
|
27
|
+
store/* state */.wk.svgNodeCache[canvasHash][cacheKey].touched = false;
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
svgLayerElement: svgLayerElement,
|
|
31
|
+
svgNodeCacheForCanvas: store/* state */.wk.svgNodeCache,
|
|
32
|
+
getSvgNode: getSvgNode.bind(this, canvasHash),
|
|
33
|
+
appendNode: appendNode.bind(this, svgLayerElement, canvasHash),
|
|
34
|
+
setNodeTouched: setNodeTouched.bind(this, canvasHash),
|
|
35
|
+
clearUntouched: clearUntouched.bind(this, svgLayerElement, canvasHash),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function _getSvgLayer(element) {
|
|
39
|
+
const viewportElement = `.${VIEWPORT_ELEMENT}`;
|
|
40
|
+
const internalDivElement = element.querySelector(viewportElement);
|
|
41
|
+
const svgLayer = internalDivElement.querySelector(':scope > .svg-layer');
|
|
42
|
+
return svgLayer;
|
|
43
|
+
}
|
|
44
|
+
function getSvgNode(canvasHash, cacheKey) {
|
|
45
|
+
if (!store/* state */.wk.svgNodeCache[canvasHash]) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (store/* state */.wk.svgNodeCache[canvasHash][cacheKey]) {
|
|
49
|
+
return store/* state */.wk.svgNodeCache[canvasHash][cacheKey].domRef;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function appendNode(svgLayerElement, canvasHash, svgNode, cacheKey) {
|
|
53
|
+
if (!store/* state */.wk.svgNodeCache[canvasHash]) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
store/* state */.wk.svgNodeCache[canvasHash][cacheKey] = {
|
|
57
|
+
touched: true,
|
|
58
|
+
domRef: svgNode,
|
|
59
|
+
};
|
|
60
|
+
svgLayerElement.appendChild(svgNode);
|
|
61
|
+
}
|
|
62
|
+
function setNodeTouched(canvasHash, cacheKey) {
|
|
63
|
+
if (!store/* state */.wk.svgNodeCache[canvasHash]) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (store/* state */.wk.svgNodeCache[canvasHash][cacheKey]) {
|
|
67
|
+
store/* state */.wk.svgNodeCache[canvasHash][cacheKey].touched = true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function clearUntouched(svgLayerElement, canvasHash) {
|
|
71
|
+
if (!store/* state */.wk.svgNodeCache[canvasHash]) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
Object.keys(store/* state */.wk.svgNodeCache[canvasHash]).forEach((cacheKey) => {
|
|
75
|
+
const cacheEntry = store/* state */.wk.svgNodeCache[canvasHash][cacheKey];
|
|
76
|
+
if (!cacheEntry.touched && cacheEntry.domRef) {
|
|
77
|
+
svgLayerElement.removeChild(cacheEntry.domRef);
|
|
78
|
+
delete store/* state */.wk.svgNodeCache[canvasHash][cacheKey];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/* harmony default export */ const drawingSvg_getSvgDrawingHelper = (getSvgDrawingHelper);
|
|
83
|
+
|
|
84
|
+
;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/draw.js
|
|
85
|
+
|
|
86
|
+
function draw(element, fn) {
|
|
87
|
+
const svgDrawingHelper = drawingSvg_getSvgDrawingHelper(element);
|
|
88
|
+
fn(svgDrawingHelper);
|
|
89
|
+
svgDrawingHelper.clearUntouched();
|
|
90
|
+
}
|
|
91
|
+
/* harmony default export */ const drawingSvg_draw = (draw);
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
/***/ }),
|
|
95
|
+
|
|
96
|
+
/***/ 12468:
|
|
97
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
98
|
+
|
|
99
|
+
"use strict";
|
|
100
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
101
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
102
|
+
/* harmony export */ });
|
|
103
|
+
var ToolModes;
|
|
104
|
+
(function (ToolModes) {
|
|
105
|
+
ToolModes["Active"] = "Active";
|
|
106
|
+
ToolModes["Passive"] = "Passive";
|
|
107
|
+
ToolModes["Enabled"] = "Enabled";
|
|
108
|
+
ToolModes["Disabled"] = "Disabled";
|
|
109
|
+
})(ToolModes || (ToolModes = {}));
|
|
110
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ToolModes);
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
/***/ }),
|
|
114
|
+
|
|
115
|
+
/***/ 27630:
|
|
116
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
117
|
+
|
|
118
|
+
"use strict";
|
|
119
|
+
|
|
120
|
+
// EXPORTS
|
|
121
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
122
|
+
A: () => (/* binding */ ToolGroupManager_createToolGroup)
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/store/index.js + 4 modules
|
|
126
|
+
var store = __webpack_require__(61738);
|
|
127
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/enums/index.js + 3 modules
|
|
128
|
+
var enums = __webpack_require__(84901);
|
|
129
|
+
// EXTERNAL MODULE: ../../../node_modules/lodash.get/index.js
|
|
130
|
+
var lodash_get = __webpack_require__(51008);
|
|
131
|
+
var lodash_get_default = /*#__PURE__*/__webpack_require__.n(lodash_get);
|
|
132
|
+
// EXTERNAL MODULE: ../../../node_modules/lodash.clonedeep/index.js
|
|
133
|
+
var lodash_clonedeep = __webpack_require__(48463);
|
|
134
|
+
var lodash_clonedeep_default = /*#__PURE__*/__webpack_require__.n(lodash_clonedeep);
|
|
135
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 28 modules
|
|
136
|
+
var esm = __webpack_require__(92136);
|
|
137
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/cursors/index.js + 5 modules
|
|
138
|
+
var cursors = __webpack_require__(32916);
|
|
139
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/cursors/elementCursor.js
|
|
140
|
+
var elementCursor = __webpack_require__(40233);
|
|
141
|
+
;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/store/ToolGroupManager/ToolGroup.js
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
const { Active, Passive, Enabled, Disabled } = enums.ToolModes;
|
|
151
|
+
const PRIMARY_BINDINGS = [{ mouseButton: enums.MouseBindings.Primary }];
|
|
152
|
+
class ToolGroup {
|
|
153
|
+
constructor(id) {
|
|
154
|
+
this.viewportsInfo = [];
|
|
155
|
+
this.toolOptions = {};
|
|
156
|
+
this.currentActivePrimaryToolName = null;
|
|
157
|
+
this.prevActivePrimaryToolName = null;
|
|
158
|
+
this.restoreToolOptions = {};
|
|
159
|
+
this._toolInstances = {};
|
|
160
|
+
this.id = id;
|
|
161
|
+
}
|
|
162
|
+
getViewportIds() {
|
|
163
|
+
return this.viewportsInfo.map(({ viewportId }) => viewportId);
|
|
164
|
+
}
|
|
165
|
+
getViewportsInfo() {
|
|
166
|
+
return this.viewportsInfo.slice();
|
|
167
|
+
}
|
|
168
|
+
getToolInstance(toolInstanceName) {
|
|
169
|
+
const toolInstance = this._toolInstances[toolInstanceName];
|
|
170
|
+
if (!toolInstance) {
|
|
171
|
+
console.warn(`'${toolInstanceName}' is not registered with this toolGroup (${this.id}).`);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
return toolInstance;
|
|
175
|
+
}
|
|
176
|
+
getToolInstances() {
|
|
177
|
+
return this._toolInstances;
|
|
178
|
+
}
|
|
179
|
+
hasTool(toolName) {
|
|
180
|
+
return !!this._toolInstances[toolName];
|
|
181
|
+
}
|
|
182
|
+
addTool(toolName, configuration = {}) {
|
|
183
|
+
const toolDefinition = store/* state */.wk.tools[toolName];
|
|
184
|
+
const hasToolName = typeof toolName !== 'undefined' && toolName !== '';
|
|
185
|
+
const localToolInstance = this.toolOptions[toolName];
|
|
186
|
+
if (!hasToolName) {
|
|
187
|
+
console.warn('Tool with configuration did not produce a toolName: ', configuration);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (!toolDefinition) {
|
|
191
|
+
console.warn(`'${toolName}' is not registered with the library. You need to use cornerstoneTools.addTool to register it.`);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if (localToolInstance) {
|
|
195
|
+
console.warn(`'${toolName}' is already registered for ToolGroup ${this.id}.`);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const { toolClass: ToolClass } = toolDefinition;
|
|
199
|
+
const toolProps = {
|
|
200
|
+
name: toolName,
|
|
201
|
+
toolGroupId: this.id,
|
|
202
|
+
configuration,
|
|
203
|
+
};
|
|
204
|
+
const instantiatedTool = new ToolClass(toolProps);
|
|
205
|
+
this._toolInstances[toolName] = instantiatedTool;
|
|
206
|
+
}
|
|
207
|
+
addToolInstance(toolName, parentClassName, configuration = {}) {
|
|
208
|
+
let ToolClassToUse = store/* state */.wk.tools[toolName]
|
|
209
|
+
?.toolClass;
|
|
210
|
+
if (!ToolClassToUse) {
|
|
211
|
+
const ParentClass = store/* state */.wk.tools[parentClassName]
|
|
212
|
+
.toolClass;
|
|
213
|
+
class ToolInstance extends ParentClass {
|
|
214
|
+
}
|
|
215
|
+
ToolInstance.toolName = toolName;
|
|
216
|
+
ToolClassToUse = ToolInstance;
|
|
217
|
+
store/* state */.wk.tools[toolName] = {
|
|
218
|
+
toolClass: ToolInstance,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
this.addTool(ToolClassToUse.toolName, configuration);
|
|
222
|
+
}
|
|
223
|
+
addViewport(viewportId, renderingEngineId) {
|
|
224
|
+
if (typeof viewportId !== 'string') {
|
|
225
|
+
throw new Error('viewportId must be defined and be a string');
|
|
226
|
+
}
|
|
227
|
+
const renderingEngines = (0,esm.getRenderingEngines)();
|
|
228
|
+
if (!renderingEngineId && renderingEngines.length > 1) {
|
|
229
|
+
throw new Error('You must specify a renderingEngineId when there are multiple rendering engines.');
|
|
230
|
+
}
|
|
231
|
+
const renderingEngineUIDToUse = renderingEngineId || renderingEngines[0].id;
|
|
232
|
+
if (!this.viewportsInfo.some(({ viewportId: vpId }) => vpId === viewportId)) {
|
|
233
|
+
this.viewportsInfo.push({
|
|
234
|
+
viewportId,
|
|
235
|
+
renderingEngineId: renderingEngineUIDToUse,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
const toolName = this.getActivePrimaryMouseButtonTool();
|
|
239
|
+
const runtimeSettings = esm.Settings.getRuntimeSettings();
|
|
240
|
+
if (runtimeSettings.get('useCursors')) {
|
|
241
|
+
this.setViewportsCursorByToolName(toolName);
|
|
242
|
+
}
|
|
243
|
+
const eventDetail = {
|
|
244
|
+
toolGroupId: this.id,
|
|
245
|
+
viewportId,
|
|
246
|
+
renderingEngineId: renderingEngineUIDToUse,
|
|
247
|
+
};
|
|
248
|
+
(0,esm.triggerEvent)(esm.eventTarget, enums.Events.TOOLGROUP_VIEWPORT_ADDED, eventDetail);
|
|
249
|
+
}
|
|
250
|
+
removeViewports(renderingEngineId, viewportId) {
|
|
251
|
+
const indices = [];
|
|
252
|
+
this.viewportsInfo.forEach((vpInfo, index) => {
|
|
253
|
+
let match = false;
|
|
254
|
+
if (vpInfo.renderingEngineId === renderingEngineId) {
|
|
255
|
+
match = true;
|
|
256
|
+
if (viewportId && vpInfo.viewportId !== viewportId) {
|
|
257
|
+
match = false;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (match) {
|
|
261
|
+
indices.push(index);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
if (indices.length) {
|
|
265
|
+
for (let i = indices.length - 1; i >= 0; i--) {
|
|
266
|
+
this.viewportsInfo.splice(indices[i], 1);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const eventDetail = {
|
|
270
|
+
toolGroupId: this.id,
|
|
271
|
+
viewportId,
|
|
272
|
+
renderingEngineId,
|
|
273
|
+
};
|
|
274
|
+
(0,esm.triggerEvent)(esm.eventTarget, enums.Events.TOOLGROUP_VIEWPORT_REMOVED, eventDetail);
|
|
275
|
+
}
|
|
276
|
+
setActiveStrategy(toolName, strategyName) {
|
|
277
|
+
const toolInstance = this._toolInstances[toolName];
|
|
278
|
+
if (toolInstance === undefined) {
|
|
279
|
+
console.warn(`Tool ${toolName} not added to toolGroup, can't set tool configuration.`);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
toolInstance.setActiveStrategy(strategyName);
|
|
283
|
+
}
|
|
284
|
+
setToolMode(toolName, mode, options = {}) {
|
|
285
|
+
if (!toolName) {
|
|
286
|
+
console.warn('setToolMode: toolName must be defined');
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
if (mode === enums.ToolModes.Active) {
|
|
290
|
+
this.setToolActive(toolName, options || this.restoreToolOptions[toolName]);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (mode === enums.ToolModes.Passive) {
|
|
294
|
+
this.setToolPassive(toolName);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if (mode === enums.ToolModes.Enabled) {
|
|
298
|
+
this.setToolEnabled(toolName);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (mode === enums.ToolModes.Disabled) {
|
|
302
|
+
this.setToolDisabled(toolName);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
console.warn('setToolMode: mode must be defined');
|
|
306
|
+
}
|
|
307
|
+
setToolActive(toolName, toolBindingsOptions = {}) {
|
|
308
|
+
const toolInstance = this._toolInstances[toolName];
|
|
309
|
+
if (toolInstance === undefined) {
|
|
310
|
+
console.warn(`Tool ${toolName} not added to toolGroup, can't set tool mode.`);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
if (!toolInstance) {
|
|
314
|
+
console.warn(`'${toolName}' instance ${toolInstance} is not registered with this toolGroup, can't set tool mode.`);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
const prevBindings = this.toolOptions[toolName]
|
|
318
|
+
? this.toolOptions[toolName].bindings
|
|
319
|
+
: [];
|
|
320
|
+
const newBindings = toolBindingsOptions.bindings
|
|
321
|
+
? toolBindingsOptions.bindings
|
|
322
|
+
: [];
|
|
323
|
+
const bindingsToUse = [...prevBindings, ...newBindings].reduce((unique, binding) => {
|
|
324
|
+
const TouchBinding = binding.numTouchPoints !== undefined;
|
|
325
|
+
const MouseBinding = binding.mouseButton !== undefined;
|
|
326
|
+
if (!unique.some((obj) => hasSameBinding(obj, binding)) &&
|
|
327
|
+
(TouchBinding || MouseBinding)) {
|
|
328
|
+
unique.push(binding);
|
|
329
|
+
}
|
|
330
|
+
return unique;
|
|
331
|
+
}, []);
|
|
332
|
+
const toolOptions = {
|
|
333
|
+
bindings: bindingsToUse,
|
|
334
|
+
mode: Active,
|
|
335
|
+
};
|
|
336
|
+
this.toolOptions[toolName] = toolOptions;
|
|
337
|
+
this._toolInstances[toolName].mode = Active;
|
|
338
|
+
const runtimeSettings = esm.Settings.getRuntimeSettings();
|
|
339
|
+
const useCursor = runtimeSettings.get('useCursors');
|
|
340
|
+
if (this._hasMousePrimaryButtonBinding(toolBindingsOptions) && useCursor) {
|
|
341
|
+
this.setViewportsCursorByToolName(toolName);
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
const activeToolIdentifier = this.getActivePrimaryMouseButtonTool();
|
|
345
|
+
if (!activeToolIdentifier && useCursor) {
|
|
346
|
+
const cursor = cursors.MouseCursor.getDefinedCursor('default');
|
|
347
|
+
this._setCursorForViewports(cursor);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (this._hasMousePrimaryButtonBinding(toolBindingsOptions)) {
|
|
351
|
+
if (this.prevActivePrimaryToolName === null) {
|
|
352
|
+
this.prevActivePrimaryToolName = toolName;
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
this.prevActivePrimaryToolName = this.currentActivePrimaryToolName;
|
|
356
|
+
}
|
|
357
|
+
this.currentActivePrimaryToolName = toolName;
|
|
358
|
+
}
|
|
359
|
+
if (typeof toolInstance.onSetToolActive === 'function') {
|
|
360
|
+
toolInstance.onSetToolActive();
|
|
361
|
+
}
|
|
362
|
+
this._renderViewports();
|
|
363
|
+
const eventDetail = {
|
|
364
|
+
toolGroupId: this.id,
|
|
365
|
+
toolName,
|
|
366
|
+
toolBindingsOptions,
|
|
367
|
+
};
|
|
368
|
+
(0,esm.triggerEvent)(esm.eventTarget, enums.Events.TOOL_ACTIVATED, eventDetail);
|
|
369
|
+
this._triggerToolModeChangedEvent(toolName, Active, toolBindingsOptions);
|
|
370
|
+
}
|
|
371
|
+
setToolPassive(toolName, options) {
|
|
372
|
+
const toolInstance = this._toolInstances[toolName];
|
|
373
|
+
if (toolInstance === undefined) {
|
|
374
|
+
console.warn(`Tool ${toolName} not added to toolGroup, can't set tool mode.`);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
const prevToolOptions = this.getToolOptions(toolName);
|
|
378
|
+
const toolOptions = Object.assign({
|
|
379
|
+
bindings: prevToolOptions ? prevToolOptions.bindings : [],
|
|
380
|
+
}, prevToolOptions, {
|
|
381
|
+
mode: Passive,
|
|
382
|
+
});
|
|
383
|
+
const matchBindings = Array.isArray(options?.removeAllBindings)
|
|
384
|
+
? options.removeAllBindings
|
|
385
|
+
: this.getDefaultPrimaryBindings();
|
|
386
|
+
toolOptions.bindings = toolOptions.bindings.filter((binding) => options?.removeAllBindings !== true &&
|
|
387
|
+
!matchBindings.some((matchBinding) => hasSameBinding(binding, matchBinding)));
|
|
388
|
+
let mode = Passive;
|
|
389
|
+
if (toolOptions.bindings.length !== 0) {
|
|
390
|
+
mode = Active;
|
|
391
|
+
toolOptions.mode = mode;
|
|
392
|
+
}
|
|
393
|
+
this.toolOptions[toolName] = toolOptions;
|
|
394
|
+
toolInstance.mode = mode;
|
|
395
|
+
if (typeof toolInstance.onSetToolPassive === 'function') {
|
|
396
|
+
toolInstance.onSetToolPassive();
|
|
397
|
+
}
|
|
398
|
+
this._renderViewports();
|
|
399
|
+
this._triggerToolModeChangedEvent(toolName, Passive);
|
|
400
|
+
}
|
|
401
|
+
setToolEnabled(toolName) {
|
|
402
|
+
const toolInstance = this._toolInstances[toolName];
|
|
403
|
+
if (toolInstance === undefined) {
|
|
404
|
+
console.warn(`Tool ${toolName} not added to toolGroup, can't set tool mode.`);
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
const toolOptions = {
|
|
408
|
+
bindings: [],
|
|
409
|
+
mode: Enabled,
|
|
410
|
+
};
|
|
411
|
+
this.toolOptions[toolName] = toolOptions;
|
|
412
|
+
toolInstance.mode = Enabled;
|
|
413
|
+
if (typeof toolInstance.onSetToolEnabled === 'function') {
|
|
414
|
+
toolInstance.onSetToolEnabled();
|
|
415
|
+
}
|
|
416
|
+
this._renderViewports();
|
|
417
|
+
this._triggerToolModeChangedEvent(toolName, Enabled);
|
|
418
|
+
}
|
|
419
|
+
setToolDisabled(toolName) {
|
|
420
|
+
const toolInstance = this._toolInstances[toolName];
|
|
421
|
+
if (toolInstance === undefined) {
|
|
422
|
+
console.warn(`Tool ${toolName} not added to toolGroup, can't set tool mode.`);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
const toolOptions = {
|
|
426
|
+
bindings: [],
|
|
427
|
+
mode: Disabled,
|
|
428
|
+
};
|
|
429
|
+
this.restoreToolOptions[toolName] = this.toolOptions[toolName];
|
|
430
|
+
this.toolOptions[toolName] = toolOptions;
|
|
431
|
+
toolInstance.mode = Disabled;
|
|
432
|
+
if (typeof toolInstance.onSetToolDisabled === 'function') {
|
|
433
|
+
toolInstance.onSetToolDisabled();
|
|
434
|
+
}
|
|
435
|
+
this._renderViewports();
|
|
436
|
+
this._triggerToolModeChangedEvent(toolName, Disabled);
|
|
437
|
+
}
|
|
438
|
+
getToolOptions(toolName) {
|
|
439
|
+
const toolOptionsForTool = this.toolOptions[toolName];
|
|
440
|
+
if (toolOptionsForTool === undefined) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
return toolOptionsForTool;
|
|
444
|
+
}
|
|
445
|
+
getActivePrimaryMouseButtonTool() {
|
|
446
|
+
return Object.keys(this.toolOptions).find((toolName) => {
|
|
447
|
+
const toolOptions = this.toolOptions[toolName];
|
|
448
|
+
return (toolOptions.mode === Active &&
|
|
449
|
+
this._hasMousePrimaryButtonBinding(toolOptions));
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
setViewportsCursorByToolName(toolName, strategyName) {
|
|
453
|
+
const cursor = this._getCursor(toolName, strategyName);
|
|
454
|
+
this._setCursorForViewports(cursor);
|
|
455
|
+
}
|
|
456
|
+
_getCursor(toolName, strategyName) {
|
|
457
|
+
let cursorName;
|
|
458
|
+
let cursor;
|
|
459
|
+
if (strategyName) {
|
|
460
|
+
cursorName = `${toolName}.${strategyName}`;
|
|
461
|
+
cursor = cursors.SVGMouseCursor.getDefinedCursor(cursorName, true);
|
|
462
|
+
if (cursor) {
|
|
463
|
+
return cursor;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
cursorName = `${toolName}`;
|
|
467
|
+
cursor = cursors.SVGMouseCursor.getDefinedCursor(cursorName, true);
|
|
468
|
+
if (cursor) {
|
|
469
|
+
return cursor;
|
|
470
|
+
}
|
|
471
|
+
cursorName = toolName;
|
|
472
|
+
cursor = cursors.SVGMouseCursor.getDefinedCursor(cursorName, true);
|
|
473
|
+
if (cursor) {
|
|
474
|
+
return cursor;
|
|
475
|
+
}
|
|
476
|
+
return cursors.MouseCursor.getDefinedCursor('default');
|
|
477
|
+
}
|
|
478
|
+
_setCursorForViewports(cursor) {
|
|
479
|
+
this.viewportsInfo.forEach(({ renderingEngineId, viewportId }) => {
|
|
480
|
+
const enabledElement = (0,esm.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
481
|
+
if (!enabledElement) {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
const { viewport } = enabledElement;
|
|
485
|
+
(0,elementCursor.initElementCursor)(viewport.element, cursor);
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
setToolConfiguration(toolName, configuration, overwrite) {
|
|
489
|
+
const toolInstance = this._toolInstances[toolName];
|
|
490
|
+
if (toolInstance === undefined) {
|
|
491
|
+
console.warn(`Tool ${toolName} not present, can't set tool configuration.`);
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
let _configuration;
|
|
495
|
+
if (overwrite) {
|
|
496
|
+
_configuration = configuration;
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
_configuration = Object.assign(toolInstance.configuration, configuration);
|
|
500
|
+
}
|
|
501
|
+
toolInstance.configuration = _configuration;
|
|
502
|
+
if (typeof toolInstance.onSetToolConfiguration === 'function') {
|
|
503
|
+
toolInstance.onSetToolConfiguration();
|
|
504
|
+
}
|
|
505
|
+
this._renderViewports();
|
|
506
|
+
return true;
|
|
507
|
+
}
|
|
508
|
+
getDefaultMousePrimary() {
|
|
509
|
+
return enums.MouseBindings.Primary;
|
|
510
|
+
}
|
|
511
|
+
getDefaultPrimaryBindings() {
|
|
512
|
+
return PRIMARY_BINDINGS;
|
|
513
|
+
}
|
|
514
|
+
getToolConfiguration(toolName, configurationPath) {
|
|
515
|
+
if (this._toolInstances[toolName] === undefined) {
|
|
516
|
+
console.warn(`Tool ${toolName} not present, can't set tool configuration.`);
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
const _configuration = lodash_get_default()(this._toolInstances[toolName].configuration, configurationPath) ||
|
|
520
|
+
this._toolInstances[toolName].configuration;
|
|
521
|
+
return lodash_clonedeep_default()(_configuration);
|
|
522
|
+
}
|
|
523
|
+
getPrevActivePrimaryToolName() {
|
|
524
|
+
return this.prevActivePrimaryToolName;
|
|
525
|
+
}
|
|
526
|
+
clone(newToolGroupId, fnToolFilter = null) {
|
|
527
|
+
let toolGroup = store/* ToolGroupManager.getToolGroup */.dU.getToolGroup(newToolGroupId);
|
|
528
|
+
if (toolGroup) {
|
|
529
|
+
console.warn(`ToolGroup ${newToolGroupId} already exists`);
|
|
530
|
+
return toolGroup;
|
|
531
|
+
}
|
|
532
|
+
toolGroup = store/* ToolGroupManager.createToolGroup */.dU.createToolGroup(newToolGroupId);
|
|
533
|
+
fnToolFilter = fnToolFilter ?? (() => true);
|
|
534
|
+
Object.keys(this._toolInstances)
|
|
535
|
+
.filter(fnToolFilter)
|
|
536
|
+
.forEach((toolName) => {
|
|
537
|
+
const sourceToolInstance = this._toolInstances[toolName];
|
|
538
|
+
const sourceToolOptions = this.toolOptions[toolName];
|
|
539
|
+
const sourceToolMode = sourceToolInstance.mode;
|
|
540
|
+
toolGroup.addTool(toolName);
|
|
541
|
+
toolGroup.setToolMode(toolName, sourceToolMode, {
|
|
542
|
+
bindings: sourceToolOptions.bindings ?? [],
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
return toolGroup;
|
|
546
|
+
}
|
|
547
|
+
_hasMousePrimaryButtonBinding(toolOptions) {
|
|
548
|
+
const primaryBindings = this.getDefaultPrimaryBindings();
|
|
549
|
+
return toolOptions?.bindings?.some((binding) => primaryBindings.some((primary) => hasSameBinding(binding, primary)));
|
|
550
|
+
}
|
|
551
|
+
_renderViewports() {
|
|
552
|
+
this.viewportsInfo.forEach(({ renderingEngineId, viewportId }) => {
|
|
553
|
+
(0,esm.getRenderingEngine)(renderingEngineId).renderViewport(viewportId);
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
_triggerToolModeChangedEvent(toolName, mode, toolBindingsOptions) {
|
|
557
|
+
const eventDetail = {
|
|
558
|
+
toolGroupId: this.id,
|
|
559
|
+
toolName,
|
|
560
|
+
mode,
|
|
561
|
+
toolBindingsOptions,
|
|
562
|
+
};
|
|
563
|
+
(0,esm.triggerEvent)(esm.eventTarget, enums.Events.TOOL_MODE_CHANGED, eventDetail);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
function hasSameBinding(binding1, binding2) {
|
|
567
|
+
if (binding1.mouseButton !== binding2.mouseButton) {
|
|
568
|
+
return false;
|
|
569
|
+
}
|
|
570
|
+
if (binding1.numTouchPoints !== binding2.numTouchPoints) {
|
|
571
|
+
return false;
|
|
572
|
+
}
|
|
573
|
+
return binding1.modifierKey === binding2.modifierKey;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/store/ToolGroupManager/createToolGroup.js
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
function createToolGroup(toolGroupId) {
|
|
580
|
+
const toolGroupWithIdExists = store/* state */.wk.toolGroups.some((tg) => tg.id === toolGroupId);
|
|
581
|
+
if (toolGroupWithIdExists) {
|
|
582
|
+
console.warn(`'${toolGroupId}' already exists.`);
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
const toolGroup = new ToolGroup(toolGroupId);
|
|
586
|
+
store/* state */.wk.toolGroups.push(toolGroup);
|
|
587
|
+
return toolGroup;
|
|
588
|
+
}
|
|
589
|
+
/* harmony default export */ const ToolGroupManager_createToolGroup = (createToolGroup);
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
/***/ }),
|
|
593
|
+
|
|
594
|
+
/***/ 648:
|
|
595
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
596
|
+
|
|
597
|
+
"use strict";
|
|
598
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
599
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
600
|
+
/* harmony export */ });
|
|
601
|
+
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61738);
|
|
602
|
+
/* harmony import */ var _destroyToolGroup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(59755);
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
function destroy() {
|
|
606
|
+
const toolGroups = [..._index__WEBPACK_IMPORTED_MODULE_0__/* .state */ .wk.toolGroups];
|
|
607
|
+
for (const toolGroup of toolGroups) {
|
|
608
|
+
(0,_destroyToolGroup__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(toolGroup.id);
|
|
609
|
+
}
|
|
610
|
+
_index__WEBPACK_IMPORTED_MODULE_0__/* .state */ .wk.toolGroups = [];
|
|
611
|
+
}
|
|
612
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (destroy);
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
/***/ }),
|
|
616
|
+
|
|
617
|
+
/***/ 59755:
|
|
618
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
619
|
+
|
|
620
|
+
"use strict";
|
|
621
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
622
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
623
|
+
/* harmony export */ });
|
|
624
|
+
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61738);
|
|
625
|
+
/* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(63421);
|
|
626
|
+
/* harmony import */ var _utilities_segmentation_triggerSegmentationRender__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(49521);
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
function destroyToolGroup(toolGroupId) {
|
|
631
|
+
const toolGroupIndex = _index__WEBPACK_IMPORTED_MODULE_0__/* .state */ .wk.toolGroups.findIndex((tg) => tg.id === toolGroupId);
|
|
632
|
+
if (toolGroupIndex > -1) {
|
|
633
|
+
_utilities_segmentation_triggerSegmentationRender__WEBPACK_IMPORTED_MODULE_2__/* .segmentationRenderingEngine */ .px.removeToolGroup(toolGroupId);
|
|
634
|
+
(0,_stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_1__.removeSegmentationsFromToolGroup)(toolGroupId);
|
|
635
|
+
_index__WEBPACK_IMPORTED_MODULE_0__/* .state */ .wk.toolGroups.splice(toolGroupIndex, 1);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (destroyToolGroup);
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
/***/ }),
|
|
642
|
+
|
|
643
|
+
/***/ 3193:
|
|
644
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
645
|
+
|
|
646
|
+
"use strict";
|
|
647
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
648
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
649
|
+
/* harmony export */ });
|
|
650
|
+
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61738);
|
|
651
|
+
|
|
652
|
+
function getAllToolGroups() {
|
|
653
|
+
return _index__WEBPACK_IMPORTED_MODULE_0__/* .state */ .wk.toolGroups;
|
|
654
|
+
}
|
|
655
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getAllToolGroups);
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
/***/ }),
|
|
659
|
+
|
|
660
|
+
/***/ 29697:
|
|
661
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
662
|
+
|
|
663
|
+
"use strict";
|
|
664
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
665
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
666
|
+
/* harmony export */ });
|
|
667
|
+
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61738);
|
|
668
|
+
|
|
669
|
+
function getToolGroup(toolGroupId) {
|
|
670
|
+
return _index__WEBPACK_IMPORTED_MODULE_0__/* .state */ .wk.toolGroups.find((s) => s.id === toolGroupId);
|
|
671
|
+
}
|
|
672
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getToolGroup);
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
/***/ }),
|
|
676
|
+
|
|
677
|
+
/***/ 64109:
|
|
678
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
679
|
+
|
|
680
|
+
"use strict";
|
|
681
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
682
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
683
|
+
/* harmony export */ });
|
|
684
|
+
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61738);
|
|
685
|
+
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84901);
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
const MODES = [_enums__WEBPACK_IMPORTED_MODULE_1__.ToolModes.Active, _enums__WEBPACK_IMPORTED_MODULE_1__.ToolModes.Passive, _enums__WEBPACK_IMPORTED_MODULE_1__.ToolModes.Enabled];
|
|
689
|
+
function getToolGroupsWithToolName(toolName) {
|
|
690
|
+
return _index__WEBPACK_IMPORTED_MODULE_0__/* .state */ .wk.toolGroups.filter(({ toolOptions }) => {
|
|
691
|
+
const toolGroupToolNames = Object.keys(toolOptions);
|
|
692
|
+
for (let i = 0; i < toolGroupToolNames.length; i++) {
|
|
693
|
+
if (toolName !== toolGroupToolNames[i]) {
|
|
694
|
+
continue;
|
|
695
|
+
}
|
|
696
|
+
if (!toolOptions[toolName]) {
|
|
697
|
+
continue;
|
|
698
|
+
}
|
|
699
|
+
if (MODES.includes(toolOptions[toolName].mode)) {
|
|
700
|
+
return true;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return false;
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getToolGroupsWithToolName);
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
/***/ }),
|
|
710
|
+
|
|
711
|
+
/***/ 39244:
|
|
712
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
713
|
+
|
|
714
|
+
"use strict";
|
|
715
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
716
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
717
|
+
/* harmony export */ });
|
|
718
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92136);
|
|
719
|
+
/* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(44753);
|
|
720
|
+
/* harmony import */ var _utilities_getCalibratedUnits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(24592);
|
|
721
|
+
/* harmony import */ var _utilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(74119);
|
|
722
|
+
/* harmony import */ var _utilities_math__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(73047);
|
|
723
|
+
/* harmony import */ var _utilities_planar__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(84797);
|
|
724
|
+
/* harmony import */ var _utilities_throttle__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(21090);
|
|
725
|
+
/* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(90252);
|
|
726
|
+
/* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(23072);
|
|
727
|
+
/* harmony import */ var _planarFreehandROITool_drawLoop__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(14695);
|
|
728
|
+
/* harmony import */ var _planarFreehandROITool_editLoopCommon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(1344);
|
|
729
|
+
/* harmony import */ var _planarFreehandROITool_closedContourEditLoop__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(30911);
|
|
730
|
+
/* harmony import */ var _planarFreehandROITool_openContourEditLoop__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(90511);
|
|
731
|
+
/* harmony import */ var _planarFreehandROITool_openContourEndEditLoop__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(72702);
|
|
732
|
+
/* harmony import */ var _planarFreehandROITool_renderMethods__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(11585);
|
|
733
|
+
/* harmony import */ var _stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(54177);
|
|
734
|
+
/* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(2746);
|
|
735
|
+
/* harmony import */ var _utilities_drawing__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(10910);
|
|
736
|
+
/* harmony import */ var _utilities_math_polyline__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(56634);
|
|
737
|
+
/* harmony import */ var _utilities_pointInShapeCallback__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(75403);
|
|
738
|
+
/* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(97022);
|
|
739
|
+
/* harmony import */ var _utilities_getModalityUnit__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(73801);
|
|
740
|
+
/* harmony import */ var _utilities_math_basic__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(83112);
|
|
741
|
+
/* harmony import */ var _utilities_contours_calculatePerimeter__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(53891);
|
|
742
|
+
/* harmony import */ var _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(76840);
|
|
743
|
+
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(84901);
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
const { pointCanProjectOnLine } = _utilities_math__WEBPACK_IMPORTED_MODULE_4__.polyline;
|
|
771
|
+
const { EPSILON } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.CONSTANTS;
|
|
772
|
+
const PARALLEL_THRESHOLD = 1 - EPSILON;
|
|
773
|
+
class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_24__/* ["default"] */ .A {
|
|
774
|
+
constructor(toolProps = {}, defaultToolProps = {
|
|
775
|
+
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
776
|
+
configuration: {
|
|
777
|
+
shadow: true,
|
|
778
|
+
preventHandleOutsideImage: false,
|
|
779
|
+
contourHoleAdditionModifierKey: _enums__WEBPACK_IMPORTED_MODULE_25__.KeyboardBindings.Shift,
|
|
780
|
+
alwaysRenderOpenContourHandles: {
|
|
781
|
+
enabled: false,
|
|
782
|
+
radius: 2,
|
|
783
|
+
},
|
|
784
|
+
allowOpenContours: true,
|
|
785
|
+
closeContourProximity: 10,
|
|
786
|
+
checkCanvasEditFallbackProximity: 6,
|
|
787
|
+
makeClockWise: true,
|
|
788
|
+
subPixelResolution: 4,
|
|
789
|
+
smoothing: {
|
|
790
|
+
smoothOnAdd: false,
|
|
791
|
+
smoothOnEdit: false,
|
|
792
|
+
knotsRatioPercentageOnAdd: 40,
|
|
793
|
+
knotsRatioPercentageOnEdit: 40,
|
|
794
|
+
},
|
|
795
|
+
interpolation: {
|
|
796
|
+
enabled: false,
|
|
797
|
+
onInterpolationComplete: null,
|
|
798
|
+
},
|
|
799
|
+
decimate: {
|
|
800
|
+
enabled: false,
|
|
801
|
+
epsilon: 0.1,
|
|
802
|
+
},
|
|
803
|
+
calculateStats: true,
|
|
804
|
+
getTextLines: defaultGetTextLines,
|
|
805
|
+
statsCalculator: _utilities_math_basic__WEBPACK_IMPORTED_MODULE_22__.BasicStatsCalculator,
|
|
806
|
+
},
|
|
807
|
+
}) {
|
|
808
|
+
super(toolProps, defaultToolProps);
|
|
809
|
+
this.isDrawing = false;
|
|
810
|
+
this.isEditingClosed = false;
|
|
811
|
+
this.isEditingOpen = false;
|
|
812
|
+
this.addNewAnnotation = (evt) => {
|
|
813
|
+
const eventDetail = evt.detail;
|
|
814
|
+
const { element } = eventDetail;
|
|
815
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
|
|
816
|
+
const { renderingEngine } = enabledElement;
|
|
817
|
+
const annotation = this.createAnnotation(evt);
|
|
818
|
+
this.addAnnotation(annotation, element);
|
|
819
|
+
const viewportIdsToRender = (0,_utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_7__.getViewportIdsWithToolToRender)(element, this.getToolName());
|
|
820
|
+
this.activateDraw(evt, annotation, viewportIdsToRender);
|
|
821
|
+
evt.preventDefault();
|
|
822
|
+
(0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .A)(renderingEngine, viewportIdsToRender);
|
|
823
|
+
return annotation;
|
|
824
|
+
};
|
|
825
|
+
this.handleSelectedCallback = (evt, annotation, handle) => {
|
|
826
|
+
const eventDetail = evt.detail;
|
|
827
|
+
const { element } = eventDetail;
|
|
828
|
+
const viewportIdsToRender = (0,_utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_7__.getViewportIdsWithToolToRender)(element, this.getToolName());
|
|
829
|
+
this.activateOpenContourEndEdit(evt, annotation, viewportIdsToRender, handle);
|
|
830
|
+
};
|
|
831
|
+
this.toolSelectedCallback = (evt, annotation) => {
|
|
832
|
+
const eventDetail = evt.detail;
|
|
833
|
+
const { element } = eventDetail;
|
|
834
|
+
const viewportIdsToRender = (0,_utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_7__.getViewportIdsWithToolToRender)(element, this.getToolName());
|
|
835
|
+
if (annotation.data.contour.closed) {
|
|
836
|
+
this.activateClosedContourEdit(evt, annotation, viewportIdsToRender);
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
this.activateOpenContourEdit(evt, annotation, viewportIdsToRender);
|
|
840
|
+
}
|
|
841
|
+
evt.preventDefault();
|
|
842
|
+
};
|
|
843
|
+
this.isPointNearTool = (element, annotation, canvasCoords, proximity) => {
|
|
844
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
|
|
845
|
+
const { viewport } = enabledElement;
|
|
846
|
+
const { polyline: points } = annotation.data.contour;
|
|
847
|
+
let previousPoint = viewport.worldToCanvas(points[0]);
|
|
848
|
+
for (let i = 1; i < points.length; i++) {
|
|
849
|
+
const p1 = previousPoint;
|
|
850
|
+
const p2 = viewport.worldToCanvas(points[i]);
|
|
851
|
+
const canProject = pointCanProjectOnLine(canvasCoords, p1, p2, proximity);
|
|
852
|
+
if (canProject) {
|
|
853
|
+
return true;
|
|
854
|
+
}
|
|
855
|
+
previousPoint = p2;
|
|
856
|
+
}
|
|
857
|
+
if (!annotation.data.contour.closed) {
|
|
858
|
+
return false;
|
|
859
|
+
}
|
|
860
|
+
const pStart = viewport.worldToCanvas(points[0]);
|
|
861
|
+
const pEnd = viewport.worldToCanvas(points[points.length - 1]);
|
|
862
|
+
return pointCanProjectOnLine(canvasCoords, pStart, pEnd, proximity);
|
|
863
|
+
};
|
|
864
|
+
this.cancel = (element) => {
|
|
865
|
+
const isDrawing = this.isDrawing;
|
|
866
|
+
const isEditingOpen = this.isEditingOpen;
|
|
867
|
+
const isEditingClosed = this.isEditingClosed;
|
|
868
|
+
if (isDrawing) {
|
|
869
|
+
this.cancelDrawing(element);
|
|
870
|
+
}
|
|
871
|
+
else if (isEditingOpen) {
|
|
872
|
+
this.cancelOpenContourEdit(element);
|
|
873
|
+
}
|
|
874
|
+
else if (isEditingClosed) {
|
|
875
|
+
this.cancelClosedContourEdit(element);
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement) => {
|
|
879
|
+
const { data } = annotation;
|
|
880
|
+
const { cachedStats } = data;
|
|
881
|
+
const { polyline: points, closed } = data.contour;
|
|
882
|
+
const targetIds = Object.keys(cachedStats);
|
|
883
|
+
for (let i = 0; i < targetIds.length; i++) {
|
|
884
|
+
const targetId = targetIds[i];
|
|
885
|
+
const image = this.getTargetIdImage(targetId, renderingEngine);
|
|
886
|
+
if (!image) {
|
|
887
|
+
continue;
|
|
888
|
+
}
|
|
889
|
+
const { imageData, metadata } = image;
|
|
890
|
+
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
891
|
+
const canvasPoint = canvasCoordinates[0];
|
|
892
|
+
const originalWorldPoint = viewport.canvasToWorld(canvasPoint);
|
|
893
|
+
const deltaXPoint = viewport.canvasToWorld([
|
|
894
|
+
canvasPoint[0] + 1,
|
|
895
|
+
canvasPoint[1],
|
|
896
|
+
]);
|
|
897
|
+
const deltaYPoint = viewport.canvasToWorld([
|
|
898
|
+
canvasPoint[0],
|
|
899
|
+
canvasPoint[1] + 1,
|
|
900
|
+
]);
|
|
901
|
+
const deltaInX = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.distance */ .eR.distance(originalWorldPoint, deltaXPoint);
|
|
902
|
+
const deltaInY = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.distance */ .eR.distance(originalWorldPoint, deltaYPoint);
|
|
903
|
+
const worldPosIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, points[0]);
|
|
904
|
+
worldPosIndex[0] = Math.floor(worldPosIndex[0]);
|
|
905
|
+
worldPosIndex[1] = Math.floor(worldPosIndex[1]);
|
|
906
|
+
worldPosIndex[2] = Math.floor(worldPosIndex[2]);
|
|
907
|
+
let iMin = worldPosIndex[0];
|
|
908
|
+
let iMax = worldPosIndex[0];
|
|
909
|
+
let jMin = worldPosIndex[1];
|
|
910
|
+
let jMax = worldPosIndex[1];
|
|
911
|
+
let kMin = worldPosIndex[2];
|
|
912
|
+
let kMax = worldPosIndex[2];
|
|
913
|
+
for (let j = 1; j < points.length; j++) {
|
|
914
|
+
const worldPosIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, points[j]);
|
|
915
|
+
worldPosIndex[0] = Math.floor(worldPosIndex[0]);
|
|
916
|
+
worldPosIndex[1] = Math.floor(worldPosIndex[1]);
|
|
917
|
+
worldPosIndex[2] = Math.floor(worldPosIndex[2]);
|
|
918
|
+
iMin = Math.min(iMin, worldPosIndex[0]);
|
|
919
|
+
iMax = Math.max(iMax, worldPosIndex[0]);
|
|
920
|
+
jMin = Math.min(jMin, worldPosIndex[1]);
|
|
921
|
+
jMax = Math.max(jMax, worldPosIndex[1]);
|
|
922
|
+
kMin = Math.min(kMin, worldPosIndex[2]);
|
|
923
|
+
kMax = Math.max(kMax, worldPosIndex[2]);
|
|
924
|
+
}
|
|
925
|
+
const worldPosIndex2 = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, points[1]);
|
|
926
|
+
worldPosIndex2[0] = Math.floor(worldPosIndex2[0]);
|
|
927
|
+
worldPosIndex2[1] = Math.floor(worldPosIndex2[1]);
|
|
928
|
+
worldPosIndex2[2] = Math.floor(worldPosIndex2[2]);
|
|
929
|
+
const { scale, areaUnits } = (0,_utilities_getCalibratedUnits__WEBPACK_IMPORTED_MODULE_2__/* .getCalibratedLengthUnitsAndScale */ .Op)(image, () => {
|
|
930
|
+
const polyline = data.contour.polyline;
|
|
931
|
+
const numPoints = polyline.length;
|
|
932
|
+
const projectedPolyline = new Array(numPoints);
|
|
933
|
+
for (let i = 0; i < numPoints; i++) {
|
|
934
|
+
projectedPolyline[i] = viewport.worldToCanvas(polyline[i]);
|
|
935
|
+
}
|
|
936
|
+
const { maxX: canvasMaxX, maxY: canvasMaxY, minX: canvasMinX, minY: canvasMinY, } = _utilities__WEBPACK_IMPORTED_MODULE_3__.math.polyline.getAABB(projectedPolyline);
|
|
937
|
+
const topLeftBBWorld = viewport.canvasToWorld([
|
|
938
|
+
canvasMinX,
|
|
939
|
+
canvasMinY,
|
|
940
|
+
]);
|
|
941
|
+
const topLeftBBIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, topLeftBBWorld);
|
|
942
|
+
const bottomRightBBWorld = viewport.canvasToWorld([
|
|
943
|
+
canvasMaxX,
|
|
944
|
+
canvasMaxY,
|
|
945
|
+
]);
|
|
946
|
+
const bottomRightBBIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.transformWorldToIndex(imageData, bottomRightBBWorld);
|
|
947
|
+
return [topLeftBBIndex, bottomRightBBIndex];
|
|
948
|
+
});
|
|
949
|
+
let area = _utilities_math__WEBPACK_IMPORTED_MODULE_4__.polyline.getArea(canvasCoordinates) / scale / scale;
|
|
950
|
+
area *= deltaInX * deltaInY;
|
|
951
|
+
const iDelta = 0.01 * (iMax - iMin);
|
|
952
|
+
const jDelta = 0.01 * (jMax - jMin);
|
|
953
|
+
const kDelta = 0.01 * (kMax - kMin);
|
|
954
|
+
iMin = Math.floor(iMin - iDelta);
|
|
955
|
+
iMax = Math.ceil(iMax + iDelta);
|
|
956
|
+
jMin = Math.floor(jMin - jDelta);
|
|
957
|
+
jMax = Math.ceil(jMax + jDelta);
|
|
958
|
+
kMin = Math.floor(kMin - kDelta);
|
|
959
|
+
kMax = Math.ceil(kMax + kDelta);
|
|
960
|
+
const boundsIJK = [
|
|
961
|
+
[iMin, iMax],
|
|
962
|
+
[jMin, jMax],
|
|
963
|
+
[kMin, kMax],
|
|
964
|
+
];
|
|
965
|
+
const worldPosEnd = imageData.indexToWorld([iMax, jMax, kMax]);
|
|
966
|
+
const canvasPosEnd = viewport.worldToCanvas(worldPosEnd);
|
|
967
|
+
let curRow = 0;
|
|
968
|
+
let intersections = [];
|
|
969
|
+
let intersectionCounter = 0;
|
|
970
|
+
const pointsInShape = (0,_utilities_pointInShapeCallback__WEBPACK_IMPORTED_MODULE_19__/* ["default"] */ .A)(imageData, (pointLPS, pointIJK) => {
|
|
971
|
+
let result = true;
|
|
972
|
+
const point = viewport.worldToCanvas(pointLPS);
|
|
973
|
+
if (point[1] != curRow) {
|
|
974
|
+
intersectionCounter = 0;
|
|
975
|
+
curRow = point[1];
|
|
976
|
+
intersections = (0,_utilities_math_polyline__WEBPACK_IMPORTED_MODULE_18__.getLineSegmentIntersectionsCoordinates)(canvasCoordinates, point, [canvasPosEnd[0], point[1]]);
|
|
977
|
+
intersections.sort((function (index) {
|
|
978
|
+
return function (a, b) {
|
|
979
|
+
return a[index] === b[index]
|
|
980
|
+
? 0
|
|
981
|
+
: a[index] < b[index]
|
|
982
|
+
? -1
|
|
983
|
+
: 1;
|
|
984
|
+
};
|
|
985
|
+
})(0));
|
|
986
|
+
}
|
|
987
|
+
if (intersections.length && point[0] > intersections[0][0]) {
|
|
988
|
+
intersections.shift();
|
|
989
|
+
intersectionCounter++;
|
|
990
|
+
}
|
|
991
|
+
if (intersectionCounter % 2 === 0) {
|
|
992
|
+
result = false;
|
|
993
|
+
}
|
|
994
|
+
return result;
|
|
995
|
+
}, this.configuration.statsCalculator.statsCallback, boundsIJK);
|
|
996
|
+
const modalityUnitOptions = {
|
|
997
|
+
isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_20__/* .isViewportPreScaled */ .u)(viewport, targetId),
|
|
998
|
+
isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
|
|
999
|
+
};
|
|
1000
|
+
const modalityUnit = (0,_utilities_getModalityUnit__WEBPACK_IMPORTED_MODULE_21__/* .getModalityUnit */ .c)(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
|
|
1001
|
+
const stats = this.configuration.statsCalculator.getStatistics();
|
|
1002
|
+
cachedStats[targetId] = {
|
|
1003
|
+
Modality: metadata.Modality,
|
|
1004
|
+
area,
|
|
1005
|
+
perimeter: (0,_utilities_contours_calculatePerimeter__WEBPACK_IMPORTED_MODULE_23__/* ["default"] */ .A)(canvasCoordinates, closed),
|
|
1006
|
+
mean: stats.mean?.value,
|
|
1007
|
+
max: stats.max?.value,
|
|
1008
|
+
stdDev: stats.stdDev?.value,
|
|
1009
|
+
statsArray: stats.array,
|
|
1010
|
+
pointsInShape: pointsInShape,
|
|
1011
|
+
areaUnit: areaUnits,
|
|
1012
|
+
modalityUnit,
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
(0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_15__/* .triggerAnnotationModified */ .XF)(annotation, enabledElement.viewport.element, _enums__WEBPACK_IMPORTED_MODULE_25__.ChangeTypes.StatsUpdated);
|
|
1016
|
+
annotation.invalidated = false;
|
|
1017
|
+
return cachedStats;
|
|
1018
|
+
};
|
|
1019
|
+
this._renderStats = (annotation, viewport, enabledElement, svgDrawingHelper) => {
|
|
1020
|
+
const { data } = annotation;
|
|
1021
|
+
const targetId = this.getTargetId(viewport);
|
|
1022
|
+
const styleSpecifier = {
|
|
1023
|
+
toolGroupId: this.toolGroupId,
|
|
1024
|
+
toolName: this.getToolName(),
|
|
1025
|
+
viewportId: enabledElement.viewport.id,
|
|
1026
|
+
};
|
|
1027
|
+
const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
|
|
1028
|
+
if (!options.visibility) {
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
const textLines = this.configuration.getTextLines(data, targetId);
|
|
1032
|
+
if (!textLines || textLines.length === 0) {
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
const canvasCoordinates = data.contour.polyline.map((p) => viewport.worldToCanvas(p));
|
|
1036
|
+
if (!data.handles.textBox.hasMoved) {
|
|
1037
|
+
const canvasTextBoxCoords = (0,_utilities_drawing__WEBPACK_IMPORTED_MODULE_17__.getTextBoxCoordsCanvas)(canvasCoordinates);
|
|
1038
|
+
data.handles.textBox.worldPosition =
|
|
1039
|
+
viewport.canvasToWorld(canvasTextBoxCoords);
|
|
1040
|
+
}
|
|
1041
|
+
const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
|
|
1042
|
+
const textBoxUID = '1';
|
|
1043
|
+
const boundingBox = (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_16__.drawLinkedTextBox)(svgDrawingHelper, annotation.annotationUID ?? '', textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
|
|
1044
|
+
const { x: left, y: top, width, height } = boundingBox;
|
|
1045
|
+
data.handles.textBox.worldBoundingBox = {
|
|
1046
|
+
topLeft: viewport.canvasToWorld([left, top]),
|
|
1047
|
+
topRight: viewport.canvasToWorld([left + width, top]),
|
|
1048
|
+
bottomLeft: viewport.canvasToWorld([left, top + height]),
|
|
1049
|
+
bottomRight: viewport.canvasToWorld([left + width, top + height]),
|
|
1050
|
+
};
|
|
1051
|
+
};
|
|
1052
|
+
(0,_planarFreehandROITool_drawLoop__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A)(this);
|
|
1053
|
+
(0,_planarFreehandROITool_editLoopCommon__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .A)(this);
|
|
1054
|
+
(0,_planarFreehandROITool_closedContourEditLoop__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A)(this);
|
|
1055
|
+
(0,_planarFreehandROITool_openContourEditLoop__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .A)(this);
|
|
1056
|
+
(0,_planarFreehandROITool_openContourEndEditLoop__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .A)(this);
|
|
1057
|
+
(0,_planarFreehandROITool_renderMethods__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .A)(this);
|
|
1058
|
+
this._throttledCalculateCachedStats = (0,_utilities_throttle__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .A)(this._calculateCachedStats, 100, { trailing: true });
|
|
1059
|
+
}
|
|
1060
|
+
filterInteractableAnnotationsForElement(element, annotations) {
|
|
1061
|
+
if (!annotations || !annotations.length) {
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1064
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
|
|
1065
|
+
const { viewport } = enabledElement;
|
|
1066
|
+
let annotationsToDisplay;
|
|
1067
|
+
if (viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.VolumeViewport) {
|
|
1068
|
+
const camera = viewport.getCamera();
|
|
1069
|
+
const { spacingInNormalDirection } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.getTargetVolumeAndSpacingInNormalDir(viewport, camera);
|
|
1070
|
+
annotationsToDisplay = this.filterAnnotationsWithinSlice(annotations, camera, spacingInNormalDirection);
|
|
1071
|
+
}
|
|
1072
|
+
else {
|
|
1073
|
+
annotationsToDisplay = (0,_utilities_planar__WEBPACK_IMPORTED_MODULE_5__.filterAnnotationsForDisplay)(viewport, annotations);
|
|
1074
|
+
}
|
|
1075
|
+
return annotationsToDisplay;
|
|
1076
|
+
}
|
|
1077
|
+
filterAnnotationsWithinSlice(annotations, camera, spacingInNormalDirection) {
|
|
1078
|
+
const { viewPlaneNormal } = camera;
|
|
1079
|
+
const annotationsWithParallelNormals = annotations.filter((td) => {
|
|
1080
|
+
const annotationViewPlaneNormal = td.metadata.viewPlaneNormal;
|
|
1081
|
+
const isParallel = Math.abs(gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.dot */ .eR.dot(viewPlaneNormal, annotationViewPlaneNormal)) >
|
|
1082
|
+
PARALLEL_THRESHOLD;
|
|
1083
|
+
return annotationViewPlaneNormal && isParallel;
|
|
1084
|
+
});
|
|
1085
|
+
if (!annotationsWithParallelNormals.length) {
|
|
1086
|
+
return [];
|
|
1087
|
+
}
|
|
1088
|
+
const halfSpacingInNormalDirection = spacingInNormalDirection / 2;
|
|
1089
|
+
const { focalPoint } = camera;
|
|
1090
|
+
const annotationsWithinSlice = [];
|
|
1091
|
+
for (const annotation of annotationsWithParallelNormals) {
|
|
1092
|
+
const data = annotation.data;
|
|
1093
|
+
const point = data.contour.polyline[0];
|
|
1094
|
+
if (!annotation.isVisible) {
|
|
1095
|
+
continue;
|
|
1096
|
+
}
|
|
1097
|
+
const dir = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.create */ .eR.create();
|
|
1098
|
+
gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.sub */ .eR.sub(dir, focalPoint, point);
|
|
1099
|
+
const dot = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.dot */ .eR.dot(dir, viewPlaneNormal);
|
|
1100
|
+
if (Math.abs(dot) < halfSpacingInNormalDirection) {
|
|
1101
|
+
annotationsWithinSlice.push(annotation);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
return annotationsWithinSlice;
|
|
1105
|
+
}
|
|
1106
|
+
isContourSegmentationTool() {
|
|
1107
|
+
return false;
|
|
1108
|
+
}
|
|
1109
|
+
createAnnotation(evt) {
|
|
1110
|
+
const worldPos = evt.detail.currentPoints.world;
|
|
1111
|
+
const contourAnnotation = super.createAnnotation(evt);
|
|
1112
|
+
const onInterpolationComplete = (annotation) => {
|
|
1113
|
+
annotation.data.handles.points.length = 0;
|
|
1114
|
+
};
|
|
1115
|
+
const annotation = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.deepMerge(contourAnnotation, {
|
|
1116
|
+
data: {
|
|
1117
|
+
contour: {
|
|
1118
|
+
polyline: [[...worldPos]],
|
|
1119
|
+
},
|
|
1120
|
+
label: '',
|
|
1121
|
+
cachedStats: {},
|
|
1122
|
+
},
|
|
1123
|
+
onInterpolationComplete,
|
|
1124
|
+
});
|
|
1125
|
+
return annotation;
|
|
1126
|
+
}
|
|
1127
|
+
getAnnotationStyle(context) {
|
|
1128
|
+
return super.getAnnotationStyle(context);
|
|
1129
|
+
}
|
|
1130
|
+
renderAnnotationInstance(renderContext) {
|
|
1131
|
+
const { enabledElement, targetId, svgDrawingHelper } = renderContext;
|
|
1132
|
+
const annotation = renderContext.annotation;
|
|
1133
|
+
let renderStatus = false;
|
|
1134
|
+
const { viewport, renderingEngine } = enabledElement;
|
|
1135
|
+
const isDrawing = this.isDrawing;
|
|
1136
|
+
const isEditingOpen = this.isEditingOpen;
|
|
1137
|
+
const isEditingClosed = this.isEditingClosed;
|
|
1138
|
+
if (!(isDrawing || isEditingOpen || isEditingClosed)) {
|
|
1139
|
+
this.renderContour(enabledElement, svgDrawingHelper, annotation);
|
|
1140
|
+
}
|
|
1141
|
+
else {
|
|
1142
|
+
const activeAnnotationUID = this.commonData.annotation.annotationUID;
|
|
1143
|
+
if (annotation.annotationUID === activeAnnotationUID) {
|
|
1144
|
+
if (isDrawing) {
|
|
1145
|
+
this.renderContourBeingDrawn(enabledElement, svgDrawingHelper, annotation);
|
|
1146
|
+
}
|
|
1147
|
+
else if (isEditingClosed) {
|
|
1148
|
+
this.renderClosedContourBeingEdited(enabledElement, svgDrawingHelper, annotation);
|
|
1149
|
+
}
|
|
1150
|
+
else if (isEditingOpen) {
|
|
1151
|
+
this.renderOpenContourBeingEdited(enabledElement, svgDrawingHelper, annotation);
|
|
1152
|
+
}
|
|
1153
|
+
else {
|
|
1154
|
+
throw new Error(`Unknown ${this.getToolName()} annotation rendering state`);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
this.renderContour(enabledElement, svgDrawingHelper, annotation);
|
|
1159
|
+
}
|
|
1160
|
+
renderStatus = true;
|
|
1161
|
+
}
|
|
1162
|
+
if (!this.configuration.calculateStats) {
|
|
1163
|
+
return;
|
|
1164
|
+
}
|
|
1165
|
+
this._calculateStatsIfActive(annotation, targetId, viewport, renderingEngine, enabledElement);
|
|
1166
|
+
this._renderStats(annotation, viewport, enabledElement, svgDrawingHelper);
|
|
1167
|
+
return renderStatus;
|
|
1168
|
+
}
|
|
1169
|
+
_calculateStatsIfActive(annotation, targetId, viewport, renderingEngine, enabledElement) {
|
|
1170
|
+
const activeAnnotationUID = this.commonData?.annotation.annotationUID;
|
|
1171
|
+
if (annotation.annotationUID === activeAnnotationUID &&
|
|
1172
|
+
!this.commonData?.movingTextBox) {
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
if (!this.commonData?.movingTextBox) {
|
|
1176
|
+
const { data } = annotation;
|
|
1177
|
+
if (!data.cachedStats[targetId] ||
|
|
1178
|
+
data.cachedStats[targetId].areaUnit == null) {
|
|
1179
|
+
data.cachedStats[targetId] = {
|
|
1180
|
+
Modality: null,
|
|
1181
|
+
area: null,
|
|
1182
|
+
max: null,
|
|
1183
|
+
mean: null,
|
|
1184
|
+
stdDev: null,
|
|
1185
|
+
areaUnit: null,
|
|
1186
|
+
};
|
|
1187
|
+
this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
|
|
1188
|
+
}
|
|
1189
|
+
else if (annotation.invalidated) {
|
|
1190
|
+
this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
function defaultGetTextLines(data, targetId) {
|
|
1196
|
+
const cachedVolumeStats = data.cachedStats[targetId];
|
|
1197
|
+
const { area, mean, stdDev, perimeter, max, isEmptyArea, areaUnit, modalityUnit, } = cachedVolumeStats || {};
|
|
1198
|
+
const textLines = [];
|
|
1199
|
+
if (area) {
|
|
1200
|
+
const areaLine = isEmptyArea
|
|
1201
|
+
? `Area: Oblique not supported`
|
|
1202
|
+
: `Area: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(area)} ${areaUnit}`;
|
|
1203
|
+
textLines.push(areaLine);
|
|
1204
|
+
}
|
|
1205
|
+
if (mean) {
|
|
1206
|
+
textLines.push(`Mean: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(mean)} ${modalityUnit}`);
|
|
1207
|
+
}
|
|
1208
|
+
if (max) {
|
|
1209
|
+
textLines.push(`Max: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(max)} ${modalityUnit}`);
|
|
1210
|
+
}
|
|
1211
|
+
if (stdDev) {
|
|
1212
|
+
textLines.push(`Std Dev: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(stdDev)} ${modalityUnit}`);
|
|
1213
|
+
}
|
|
1214
|
+
if (perimeter) {
|
|
1215
|
+
textLines.push(`Perimeter: ${(0,_utilities__WEBPACK_IMPORTED_MODULE_3__.roundNumber)(perimeter)} ${modalityUnit}`);
|
|
1216
|
+
}
|
|
1217
|
+
return textLines;
|
|
1218
|
+
}
|
|
1219
|
+
PlanarFreehandROITool.toolName = 'PlanarFreehandROI';
|
|
1220
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PlanarFreehandROITool);
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
/***/ }),
|
|
1224
|
+
|
|
1225
|
+
/***/ 31163:
|
|
1226
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1227
|
+
|
|
1228
|
+
"use strict";
|
|
1229
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1230
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1231
|
+
/* harmony export */ });
|
|
1232
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92136);
|
|
1233
|
+
/* harmony import */ var _enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(83946);
|
|
1234
|
+
/* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(63421);
|
|
1235
|
+
/* harmony import */ var _stateManagement_segmentation_config_segmentationVisibility__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23308);
|
|
1236
|
+
/* harmony import */ var _stateManagement_segmentation_segmentationState__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(30322);
|
|
1237
|
+
/* harmony import */ var _store_ToolGroupManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(52610);
|
|
1238
|
+
/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(96214);
|
|
1239
|
+
/* harmony import */ var _Surface__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(57313);
|
|
1240
|
+
/* harmony import */ var _Contour__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2884);
|
|
1241
|
+
/* harmony import */ var _Labelmap__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(94318);
|
|
1242
|
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(61738);
|
|
1243
|
+
/* harmony import */ var _annotation_PlanarFreehandContourSegmentationTool__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(20070);
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
const planarContourToolName = _annotation_PlanarFreehandContourSegmentationTool__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A.toolName;
|
|
1258
|
+
class SegmentationDisplayTool extends _base__WEBPACK_IMPORTED_MODULE_6__/* .BaseTool */ .oS {
|
|
1259
|
+
constructor(toolProps = {}, defaultToolProps = {
|
|
1260
|
+
configuration: {},
|
|
1261
|
+
}) {
|
|
1262
|
+
super(toolProps, defaultToolProps);
|
|
1263
|
+
this.renderSegmentation = (toolGroupId) => {
|
|
1264
|
+
const toolGroup = (0,_store_ToolGroupManager__WEBPACK_IMPORTED_MODULE_5__.getToolGroup)(toolGroupId);
|
|
1265
|
+
if (!toolGroup) {
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1268
|
+
const toolGroupSegmentationRepresentations = (0,_stateManagement_segmentation_segmentationState__WEBPACK_IMPORTED_MODULE_4__.getSegmentationRepresentations)(toolGroupId);
|
|
1269
|
+
if (!toolGroupSegmentationRepresentations ||
|
|
1270
|
+
toolGroupSegmentationRepresentations.length === 0) {
|
|
1271
|
+
return;
|
|
1272
|
+
}
|
|
1273
|
+
const toolGroupViewports = toolGroup.viewportsInfo.map(({ renderingEngineId, viewportId }) => {
|
|
1274
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
1275
|
+
if (enabledElement) {
|
|
1276
|
+
return enabledElement.viewport;
|
|
1277
|
+
}
|
|
1278
|
+
});
|
|
1279
|
+
const segmentationRenderList = toolGroupSegmentationRepresentations.map((representation) => {
|
|
1280
|
+
const config = this._getMergedRepresentationsConfig(toolGroupId);
|
|
1281
|
+
const viewportsRenderList = [];
|
|
1282
|
+
const renderers = {
|
|
1283
|
+
[_enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.Labelmap]: _Labelmap__WEBPACK_IMPORTED_MODULE_9__/* .labelmapDisplay */ .Zy,
|
|
1284
|
+
[_enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.Contour]: _Contour__WEBPACK_IMPORTED_MODULE_8__/* .contourDisplay */ .T,
|
|
1285
|
+
[_enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.Surface]: _Surface__WEBPACK_IMPORTED_MODULE_7__/* .surfaceDisplay */ .u,
|
|
1286
|
+
};
|
|
1287
|
+
if (representation.type === _enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.Contour) {
|
|
1288
|
+
this.addPlanarFreeHandToolIfAbsent(toolGroupId);
|
|
1289
|
+
}
|
|
1290
|
+
const display = renderers[representation.type];
|
|
1291
|
+
for (const viewport of toolGroupViewports) {
|
|
1292
|
+
const renderedViewport = display.render(viewport, representation, config);
|
|
1293
|
+
viewportsRenderList.push(renderedViewport);
|
|
1294
|
+
}
|
|
1295
|
+
return viewportsRenderList;
|
|
1296
|
+
});
|
|
1297
|
+
Promise.allSettled(segmentationRenderList).then(() => {
|
|
1298
|
+
toolGroupViewports.forEach((viewport) => {
|
|
1299
|
+
viewport.render();
|
|
1300
|
+
});
|
|
1301
|
+
});
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
onSetToolEnabled() {
|
|
1305
|
+
const toolGroupId = this.toolGroupId;
|
|
1306
|
+
const toolGroupSegmentationRepresentations = (0,_stateManagement_segmentation_segmentationState__WEBPACK_IMPORTED_MODULE_4__.getSegmentationRepresentations)(toolGroupId);
|
|
1307
|
+
if (!toolGroupSegmentationRepresentations ||
|
|
1308
|
+
toolGroupSegmentationRepresentations.length === 0) {
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
toolGroupSegmentationRepresentations.forEach((segmentationRepresentation) => {
|
|
1312
|
+
(0,_stateManagement_segmentation_config_segmentationVisibility__WEBPACK_IMPORTED_MODULE_3__.setSegmentationVisibility)(toolGroupId, segmentationRepresentation.segmentationRepresentationUID, true);
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
onSetToolDisabled() {
|
|
1316
|
+
const toolGroupId = this.toolGroupId;
|
|
1317
|
+
const toolGroupSegmentationRepresentations = (0,_stateManagement_segmentation_segmentationState__WEBPACK_IMPORTED_MODULE_4__.getSegmentationRepresentations)(toolGroupId);
|
|
1318
|
+
if (!toolGroupSegmentationRepresentations ||
|
|
1319
|
+
toolGroupSegmentationRepresentations.length === 0) {
|
|
1320
|
+
return;
|
|
1321
|
+
}
|
|
1322
|
+
toolGroupSegmentationRepresentations.forEach((segmentationRepresentation) => {
|
|
1323
|
+
(0,_stateManagement_segmentation_config_segmentationVisibility__WEBPACK_IMPORTED_MODULE_3__.setSegmentationVisibility)(toolGroupId, segmentationRepresentation.segmentationRepresentationUID, false);
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
addPlanarFreeHandToolIfAbsent(toolGroupId) {
|
|
1327
|
+
if (!(planarContourToolName in _store__WEBPACK_IMPORTED_MODULE_10__/* .state */ .wk.tools)) {
|
|
1328
|
+
(0,_store__WEBPACK_IMPORTED_MODULE_10__/* .addTool */ .Gx)(_annotation_PlanarFreehandContourSegmentationTool__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A);
|
|
1329
|
+
}
|
|
1330
|
+
const toolGroup = (0,_store_ToolGroupManager__WEBPACK_IMPORTED_MODULE_5__.getToolGroup)(toolGroupId);
|
|
1331
|
+
if (!toolGroup.hasTool(planarContourToolName)) {
|
|
1332
|
+
toolGroup.addTool(planarContourToolName);
|
|
1333
|
+
toolGroup.setToolPassive(planarContourToolName);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
_getMergedRepresentationsConfig(toolGroupId) {
|
|
1337
|
+
const toolGroupConfig = _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_2__.config.getToolGroupSpecificConfig(toolGroupId);
|
|
1338
|
+
const globalConfig = _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_2__.config.getGlobalConfig();
|
|
1339
|
+
const mergedConfig = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.deepMerge(globalConfig, toolGroupConfig);
|
|
1340
|
+
return mergedConfig;
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
SegmentationDisplayTool.toolName = 'SegmentationDisplay';
|
|
1344
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SegmentationDisplayTool);
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
/***/ }),
|
|
1348
|
+
|
|
1349
|
+
/***/ 51008:
|
|
1350
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1351
|
+
|
|
1352
|
+
/**
|
|
1353
|
+
* lodash (Custom Build) <https://lodash.com/>
|
|
1354
|
+
* Build: `lodash modularize exports="npm" -o ./`
|
|
1355
|
+
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
1356
|
+
* Released under MIT license <https://lodash.com/license>
|
|
1357
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
1358
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
1359
|
+
*/
|
|
1360
|
+
|
|
1361
|
+
/** Used as the `TypeError` message for "Functions" methods. */
|
|
1362
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
1363
|
+
|
|
1364
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1365
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
1366
|
+
|
|
1367
|
+
/** Used as references for various `Number` constants. */
|
|
1368
|
+
var INFINITY = 1 / 0;
|
|
1369
|
+
|
|
1370
|
+
/** `Object#toString` result references. */
|
|
1371
|
+
var funcTag = '[object Function]',
|
|
1372
|
+
genTag = '[object GeneratorFunction]',
|
|
1373
|
+
symbolTag = '[object Symbol]';
|
|
1374
|
+
|
|
1375
|
+
/** Used to match property names within property paths. */
|
|
1376
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
1377
|
+
reIsPlainProp = /^\w*$/,
|
|
1378
|
+
reLeadingDot = /^\./,
|
|
1379
|
+
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
1380
|
+
|
|
1381
|
+
/**
|
|
1382
|
+
* Used to match `RegExp`
|
|
1383
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
1384
|
+
*/
|
|
1385
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
1386
|
+
|
|
1387
|
+
/** Used to match backslashes in property paths. */
|
|
1388
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
1389
|
+
|
|
1390
|
+
/** Used to detect host constructors (Safari). */
|
|
1391
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
1392
|
+
|
|
1393
|
+
/** Detect free variable `global` from Node.js. */
|
|
1394
|
+
var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
|
|
1395
|
+
|
|
1396
|
+
/** Detect free variable `self`. */
|
|
1397
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
1398
|
+
|
|
1399
|
+
/** Used as a reference to the global object. */
|
|
1400
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
1401
|
+
|
|
1402
|
+
/**
|
|
1403
|
+
* Gets the value at `key` of `object`.
|
|
1404
|
+
*
|
|
1405
|
+
* @private
|
|
1406
|
+
* @param {Object} [object] The object to query.
|
|
1407
|
+
* @param {string} key The key of the property to get.
|
|
1408
|
+
* @returns {*} Returns the property value.
|
|
1409
|
+
*/
|
|
1410
|
+
function getValue(object, key) {
|
|
1411
|
+
return object == null ? undefined : object[key];
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
/**
|
|
1415
|
+
* Checks if `value` is a host object in IE < 9.
|
|
1416
|
+
*
|
|
1417
|
+
* @private
|
|
1418
|
+
* @param {*} value The value to check.
|
|
1419
|
+
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
|
1420
|
+
*/
|
|
1421
|
+
function isHostObject(value) {
|
|
1422
|
+
// Many host objects are `Object` objects that can coerce to strings
|
|
1423
|
+
// despite having improperly defined `toString` methods.
|
|
1424
|
+
var result = false;
|
|
1425
|
+
if (value != null && typeof value.toString != 'function') {
|
|
1426
|
+
try {
|
|
1427
|
+
result = !!(value + '');
|
|
1428
|
+
} catch (e) {}
|
|
1429
|
+
}
|
|
1430
|
+
return result;
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
/** Used for built-in method references. */
|
|
1434
|
+
var arrayProto = Array.prototype,
|
|
1435
|
+
funcProto = Function.prototype,
|
|
1436
|
+
objectProto = Object.prototype;
|
|
1437
|
+
|
|
1438
|
+
/** Used to detect overreaching core-js shims. */
|
|
1439
|
+
var coreJsData = root['__core-js_shared__'];
|
|
1440
|
+
|
|
1441
|
+
/** Used to detect methods masquerading as native. */
|
|
1442
|
+
var maskSrcKey = (function() {
|
|
1443
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
1444
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
1445
|
+
}());
|
|
1446
|
+
|
|
1447
|
+
/** Used to resolve the decompiled source of functions. */
|
|
1448
|
+
var funcToString = funcProto.toString;
|
|
1449
|
+
|
|
1450
|
+
/** Used to check objects for own properties. */
|
|
1451
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* Used to resolve the
|
|
1455
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
1456
|
+
* of values.
|
|
1457
|
+
*/
|
|
1458
|
+
var objectToString = objectProto.toString;
|
|
1459
|
+
|
|
1460
|
+
/** Used to detect if a method is native. */
|
|
1461
|
+
var reIsNative = RegExp('^' +
|
|
1462
|
+
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
|
1463
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
1464
|
+
);
|
|
1465
|
+
|
|
1466
|
+
/** Built-in value references. */
|
|
1467
|
+
var Symbol = root.Symbol,
|
|
1468
|
+
splice = arrayProto.splice;
|
|
1469
|
+
|
|
1470
|
+
/* Built-in method references that are verified to be native. */
|
|
1471
|
+
var Map = getNative(root, 'Map'),
|
|
1472
|
+
nativeCreate = getNative(Object, 'create');
|
|
1473
|
+
|
|
1474
|
+
/** Used to convert symbols to primitives and strings. */
|
|
1475
|
+
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
1476
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
1477
|
+
|
|
1478
|
+
/**
|
|
1479
|
+
* Creates a hash object.
|
|
1480
|
+
*
|
|
1481
|
+
* @private
|
|
1482
|
+
* @constructor
|
|
1483
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1484
|
+
*/
|
|
1485
|
+
function Hash(entries) {
|
|
1486
|
+
var index = -1,
|
|
1487
|
+
length = entries ? entries.length : 0;
|
|
1488
|
+
|
|
1489
|
+
this.clear();
|
|
1490
|
+
while (++index < length) {
|
|
1491
|
+
var entry = entries[index];
|
|
1492
|
+
this.set(entry[0], entry[1]);
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
/**
|
|
1497
|
+
* Removes all key-value entries from the hash.
|
|
1498
|
+
*
|
|
1499
|
+
* @private
|
|
1500
|
+
* @name clear
|
|
1501
|
+
* @memberOf Hash
|
|
1502
|
+
*/
|
|
1503
|
+
function hashClear() {
|
|
1504
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
/**
|
|
1508
|
+
* Removes `key` and its value from the hash.
|
|
1509
|
+
*
|
|
1510
|
+
* @private
|
|
1511
|
+
* @name delete
|
|
1512
|
+
* @memberOf Hash
|
|
1513
|
+
* @param {Object} hash The hash to modify.
|
|
1514
|
+
* @param {string} key The key of the value to remove.
|
|
1515
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1516
|
+
*/
|
|
1517
|
+
function hashDelete(key) {
|
|
1518
|
+
return this.has(key) && delete this.__data__[key];
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
/**
|
|
1522
|
+
* Gets the hash value for `key`.
|
|
1523
|
+
*
|
|
1524
|
+
* @private
|
|
1525
|
+
* @name get
|
|
1526
|
+
* @memberOf Hash
|
|
1527
|
+
* @param {string} key The key of the value to get.
|
|
1528
|
+
* @returns {*} Returns the entry value.
|
|
1529
|
+
*/
|
|
1530
|
+
function hashGet(key) {
|
|
1531
|
+
var data = this.__data__;
|
|
1532
|
+
if (nativeCreate) {
|
|
1533
|
+
var result = data[key];
|
|
1534
|
+
return result === HASH_UNDEFINED ? undefined : result;
|
|
1535
|
+
}
|
|
1536
|
+
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* Checks if a hash value for `key` exists.
|
|
1541
|
+
*
|
|
1542
|
+
* @private
|
|
1543
|
+
* @name has
|
|
1544
|
+
* @memberOf Hash
|
|
1545
|
+
* @param {string} key The key of the entry to check.
|
|
1546
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1547
|
+
*/
|
|
1548
|
+
function hashHas(key) {
|
|
1549
|
+
var data = this.__data__;
|
|
1550
|
+
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
/**
|
|
1554
|
+
* Sets the hash `key` to `value`.
|
|
1555
|
+
*
|
|
1556
|
+
* @private
|
|
1557
|
+
* @name set
|
|
1558
|
+
* @memberOf Hash
|
|
1559
|
+
* @param {string} key The key of the value to set.
|
|
1560
|
+
* @param {*} value The value to set.
|
|
1561
|
+
* @returns {Object} Returns the hash instance.
|
|
1562
|
+
*/
|
|
1563
|
+
function hashSet(key, value) {
|
|
1564
|
+
var data = this.__data__;
|
|
1565
|
+
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
1566
|
+
return this;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
// Add methods to `Hash`.
|
|
1570
|
+
Hash.prototype.clear = hashClear;
|
|
1571
|
+
Hash.prototype['delete'] = hashDelete;
|
|
1572
|
+
Hash.prototype.get = hashGet;
|
|
1573
|
+
Hash.prototype.has = hashHas;
|
|
1574
|
+
Hash.prototype.set = hashSet;
|
|
1575
|
+
|
|
1576
|
+
/**
|
|
1577
|
+
* Creates an list cache object.
|
|
1578
|
+
*
|
|
1579
|
+
* @private
|
|
1580
|
+
* @constructor
|
|
1581
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1582
|
+
*/
|
|
1583
|
+
function ListCache(entries) {
|
|
1584
|
+
var index = -1,
|
|
1585
|
+
length = entries ? entries.length : 0;
|
|
1586
|
+
|
|
1587
|
+
this.clear();
|
|
1588
|
+
while (++index < length) {
|
|
1589
|
+
var entry = entries[index];
|
|
1590
|
+
this.set(entry[0], entry[1]);
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
/**
|
|
1595
|
+
* Removes all key-value entries from the list cache.
|
|
1596
|
+
*
|
|
1597
|
+
* @private
|
|
1598
|
+
* @name clear
|
|
1599
|
+
* @memberOf ListCache
|
|
1600
|
+
*/
|
|
1601
|
+
function listCacheClear() {
|
|
1602
|
+
this.__data__ = [];
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
/**
|
|
1606
|
+
* Removes `key` and its value from the list cache.
|
|
1607
|
+
*
|
|
1608
|
+
* @private
|
|
1609
|
+
* @name delete
|
|
1610
|
+
* @memberOf ListCache
|
|
1611
|
+
* @param {string} key The key of the value to remove.
|
|
1612
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1613
|
+
*/
|
|
1614
|
+
function listCacheDelete(key) {
|
|
1615
|
+
var data = this.__data__,
|
|
1616
|
+
index = assocIndexOf(data, key);
|
|
1617
|
+
|
|
1618
|
+
if (index < 0) {
|
|
1619
|
+
return false;
|
|
1620
|
+
}
|
|
1621
|
+
var lastIndex = data.length - 1;
|
|
1622
|
+
if (index == lastIndex) {
|
|
1623
|
+
data.pop();
|
|
1624
|
+
} else {
|
|
1625
|
+
splice.call(data, index, 1);
|
|
1626
|
+
}
|
|
1627
|
+
return true;
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
/**
|
|
1631
|
+
* Gets the list cache value for `key`.
|
|
1632
|
+
*
|
|
1633
|
+
* @private
|
|
1634
|
+
* @name get
|
|
1635
|
+
* @memberOf ListCache
|
|
1636
|
+
* @param {string} key The key of the value to get.
|
|
1637
|
+
* @returns {*} Returns the entry value.
|
|
1638
|
+
*/
|
|
1639
|
+
function listCacheGet(key) {
|
|
1640
|
+
var data = this.__data__,
|
|
1641
|
+
index = assocIndexOf(data, key);
|
|
1642
|
+
|
|
1643
|
+
return index < 0 ? undefined : data[index][1];
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
/**
|
|
1647
|
+
* Checks if a list cache value for `key` exists.
|
|
1648
|
+
*
|
|
1649
|
+
* @private
|
|
1650
|
+
* @name has
|
|
1651
|
+
* @memberOf ListCache
|
|
1652
|
+
* @param {string} key The key of the entry to check.
|
|
1653
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1654
|
+
*/
|
|
1655
|
+
function listCacheHas(key) {
|
|
1656
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
/**
|
|
1660
|
+
* Sets the list cache `key` to `value`.
|
|
1661
|
+
*
|
|
1662
|
+
* @private
|
|
1663
|
+
* @name set
|
|
1664
|
+
* @memberOf ListCache
|
|
1665
|
+
* @param {string} key The key of the value to set.
|
|
1666
|
+
* @param {*} value The value to set.
|
|
1667
|
+
* @returns {Object} Returns the list cache instance.
|
|
1668
|
+
*/
|
|
1669
|
+
function listCacheSet(key, value) {
|
|
1670
|
+
var data = this.__data__,
|
|
1671
|
+
index = assocIndexOf(data, key);
|
|
1672
|
+
|
|
1673
|
+
if (index < 0) {
|
|
1674
|
+
data.push([key, value]);
|
|
1675
|
+
} else {
|
|
1676
|
+
data[index][1] = value;
|
|
1677
|
+
}
|
|
1678
|
+
return this;
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
// Add methods to `ListCache`.
|
|
1682
|
+
ListCache.prototype.clear = listCacheClear;
|
|
1683
|
+
ListCache.prototype['delete'] = listCacheDelete;
|
|
1684
|
+
ListCache.prototype.get = listCacheGet;
|
|
1685
|
+
ListCache.prototype.has = listCacheHas;
|
|
1686
|
+
ListCache.prototype.set = listCacheSet;
|
|
1687
|
+
|
|
1688
|
+
/**
|
|
1689
|
+
* Creates a map cache object to store key-value pairs.
|
|
1690
|
+
*
|
|
1691
|
+
* @private
|
|
1692
|
+
* @constructor
|
|
1693
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1694
|
+
*/
|
|
1695
|
+
function MapCache(entries) {
|
|
1696
|
+
var index = -1,
|
|
1697
|
+
length = entries ? entries.length : 0;
|
|
1698
|
+
|
|
1699
|
+
this.clear();
|
|
1700
|
+
while (++index < length) {
|
|
1701
|
+
var entry = entries[index];
|
|
1702
|
+
this.set(entry[0], entry[1]);
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
/**
|
|
1707
|
+
* Removes all key-value entries from the map.
|
|
1708
|
+
*
|
|
1709
|
+
* @private
|
|
1710
|
+
* @name clear
|
|
1711
|
+
* @memberOf MapCache
|
|
1712
|
+
*/
|
|
1713
|
+
function mapCacheClear() {
|
|
1714
|
+
this.__data__ = {
|
|
1715
|
+
'hash': new Hash,
|
|
1716
|
+
'map': new (Map || ListCache),
|
|
1717
|
+
'string': new Hash
|
|
1718
|
+
};
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
/**
|
|
1722
|
+
* Removes `key` and its value from the map.
|
|
1723
|
+
*
|
|
1724
|
+
* @private
|
|
1725
|
+
* @name delete
|
|
1726
|
+
* @memberOf MapCache
|
|
1727
|
+
* @param {string} key The key of the value to remove.
|
|
1728
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1729
|
+
*/
|
|
1730
|
+
function mapCacheDelete(key) {
|
|
1731
|
+
return getMapData(this, key)['delete'](key);
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
/**
|
|
1735
|
+
* Gets the map value for `key`.
|
|
1736
|
+
*
|
|
1737
|
+
* @private
|
|
1738
|
+
* @name get
|
|
1739
|
+
* @memberOf MapCache
|
|
1740
|
+
* @param {string} key The key of the value to get.
|
|
1741
|
+
* @returns {*} Returns the entry value.
|
|
1742
|
+
*/
|
|
1743
|
+
function mapCacheGet(key) {
|
|
1744
|
+
return getMapData(this, key).get(key);
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
/**
|
|
1748
|
+
* Checks if a map value for `key` exists.
|
|
1749
|
+
*
|
|
1750
|
+
* @private
|
|
1751
|
+
* @name has
|
|
1752
|
+
* @memberOf MapCache
|
|
1753
|
+
* @param {string} key The key of the entry to check.
|
|
1754
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1755
|
+
*/
|
|
1756
|
+
function mapCacheHas(key) {
|
|
1757
|
+
return getMapData(this, key).has(key);
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
/**
|
|
1761
|
+
* Sets the map `key` to `value`.
|
|
1762
|
+
*
|
|
1763
|
+
* @private
|
|
1764
|
+
* @name set
|
|
1765
|
+
* @memberOf MapCache
|
|
1766
|
+
* @param {string} key The key of the value to set.
|
|
1767
|
+
* @param {*} value The value to set.
|
|
1768
|
+
* @returns {Object} Returns the map cache instance.
|
|
1769
|
+
*/
|
|
1770
|
+
function mapCacheSet(key, value) {
|
|
1771
|
+
getMapData(this, key).set(key, value);
|
|
1772
|
+
return this;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
// Add methods to `MapCache`.
|
|
1776
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
1777
|
+
MapCache.prototype['delete'] = mapCacheDelete;
|
|
1778
|
+
MapCache.prototype.get = mapCacheGet;
|
|
1779
|
+
MapCache.prototype.has = mapCacheHas;
|
|
1780
|
+
MapCache.prototype.set = mapCacheSet;
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
1784
|
+
*
|
|
1785
|
+
* @private
|
|
1786
|
+
* @param {Array} array The array to inspect.
|
|
1787
|
+
* @param {*} key The key to search for.
|
|
1788
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1789
|
+
*/
|
|
1790
|
+
function assocIndexOf(array, key) {
|
|
1791
|
+
var length = array.length;
|
|
1792
|
+
while (length--) {
|
|
1793
|
+
if (eq(array[length][0], key)) {
|
|
1794
|
+
return length;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
return -1;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
/**
|
|
1801
|
+
* The base implementation of `_.get` without support for default values.
|
|
1802
|
+
*
|
|
1803
|
+
* @private
|
|
1804
|
+
* @param {Object} object The object to query.
|
|
1805
|
+
* @param {Array|string} path The path of the property to get.
|
|
1806
|
+
* @returns {*} Returns the resolved value.
|
|
1807
|
+
*/
|
|
1808
|
+
function baseGet(object, path) {
|
|
1809
|
+
path = isKey(path, object) ? [path] : castPath(path);
|
|
1810
|
+
|
|
1811
|
+
var index = 0,
|
|
1812
|
+
length = path.length;
|
|
1813
|
+
|
|
1814
|
+
while (object != null && index < length) {
|
|
1815
|
+
object = object[toKey(path[index++])];
|
|
1816
|
+
}
|
|
1817
|
+
return (index && index == length) ? object : undefined;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
/**
|
|
1821
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
1822
|
+
*
|
|
1823
|
+
* @private
|
|
1824
|
+
* @param {*} value The value to check.
|
|
1825
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
1826
|
+
* else `false`.
|
|
1827
|
+
*/
|
|
1828
|
+
function baseIsNative(value) {
|
|
1829
|
+
if (!isObject(value) || isMasked(value)) {
|
|
1830
|
+
return false;
|
|
1831
|
+
}
|
|
1832
|
+
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
|
1833
|
+
return pattern.test(toSource(value));
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
/**
|
|
1837
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
1838
|
+
* values to empty strings.
|
|
1839
|
+
*
|
|
1840
|
+
* @private
|
|
1841
|
+
* @param {*} value The value to process.
|
|
1842
|
+
* @returns {string} Returns the string.
|
|
1843
|
+
*/
|
|
1844
|
+
function baseToString(value) {
|
|
1845
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
1846
|
+
if (typeof value == 'string') {
|
|
1847
|
+
return value;
|
|
1848
|
+
}
|
|
1849
|
+
if (isSymbol(value)) {
|
|
1850
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
1851
|
+
}
|
|
1852
|
+
var result = (value + '');
|
|
1853
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
/**
|
|
1857
|
+
* Casts `value` to a path array if it's not one.
|
|
1858
|
+
*
|
|
1859
|
+
* @private
|
|
1860
|
+
* @param {*} value The value to inspect.
|
|
1861
|
+
* @returns {Array} Returns the cast property path array.
|
|
1862
|
+
*/
|
|
1863
|
+
function castPath(value) {
|
|
1864
|
+
return isArray(value) ? value : stringToPath(value);
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
/**
|
|
1868
|
+
* Gets the data for `map`.
|
|
1869
|
+
*
|
|
1870
|
+
* @private
|
|
1871
|
+
* @param {Object} map The map to query.
|
|
1872
|
+
* @param {string} key The reference key.
|
|
1873
|
+
* @returns {*} Returns the map data.
|
|
1874
|
+
*/
|
|
1875
|
+
function getMapData(map, key) {
|
|
1876
|
+
var data = map.__data__;
|
|
1877
|
+
return isKeyable(key)
|
|
1878
|
+
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1879
|
+
: data.map;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
/**
|
|
1883
|
+
* Gets the native function at `key` of `object`.
|
|
1884
|
+
*
|
|
1885
|
+
* @private
|
|
1886
|
+
* @param {Object} object The object to query.
|
|
1887
|
+
* @param {string} key The key of the method to get.
|
|
1888
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
1889
|
+
*/
|
|
1890
|
+
function getNative(object, key) {
|
|
1891
|
+
var value = getValue(object, key);
|
|
1892
|
+
return baseIsNative(value) ? value : undefined;
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
/**
|
|
1896
|
+
* Checks if `value` is a property name and not a property path.
|
|
1897
|
+
*
|
|
1898
|
+
* @private
|
|
1899
|
+
* @param {*} value The value to check.
|
|
1900
|
+
* @param {Object} [object] The object to query keys on.
|
|
1901
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
1902
|
+
*/
|
|
1903
|
+
function isKey(value, object) {
|
|
1904
|
+
if (isArray(value)) {
|
|
1905
|
+
return false;
|
|
1906
|
+
}
|
|
1907
|
+
var type = typeof value;
|
|
1908
|
+
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
1909
|
+
value == null || isSymbol(value)) {
|
|
1910
|
+
return true;
|
|
1911
|
+
}
|
|
1912
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
1913
|
+
(object != null && value in Object(object));
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
/**
|
|
1917
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
1918
|
+
*
|
|
1919
|
+
* @private
|
|
1920
|
+
* @param {*} value The value to check.
|
|
1921
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1922
|
+
*/
|
|
1923
|
+
function isKeyable(value) {
|
|
1924
|
+
var type = typeof value;
|
|
1925
|
+
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
1926
|
+
? (value !== '__proto__')
|
|
1927
|
+
: (value === null);
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
/**
|
|
1931
|
+
* Checks if `func` has its source masked.
|
|
1932
|
+
*
|
|
1933
|
+
* @private
|
|
1934
|
+
* @param {Function} func The function to check.
|
|
1935
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
1936
|
+
*/
|
|
1937
|
+
function isMasked(func) {
|
|
1938
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
/**
|
|
1942
|
+
* Converts `string` to a property path array.
|
|
1943
|
+
*
|
|
1944
|
+
* @private
|
|
1945
|
+
* @param {string} string The string to convert.
|
|
1946
|
+
* @returns {Array} Returns the property path array.
|
|
1947
|
+
*/
|
|
1948
|
+
var stringToPath = memoize(function(string) {
|
|
1949
|
+
string = toString(string);
|
|
1950
|
+
|
|
1951
|
+
var result = [];
|
|
1952
|
+
if (reLeadingDot.test(string)) {
|
|
1953
|
+
result.push('');
|
|
1954
|
+
}
|
|
1955
|
+
string.replace(rePropName, function(match, number, quote, string) {
|
|
1956
|
+
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
|
1957
|
+
});
|
|
1958
|
+
return result;
|
|
1959
|
+
});
|
|
1960
|
+
|
|
1961
|
+
/**
|
|
1962
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
1963
|
+
*
|
|
1964
|
+
* @private
|
|
1965
|
+
* @param {*} value The value to inspect.
|
|
1966
|
+
* @returns {string|symbol} Returns the key.
|
|
1967
|
+
*/
|
|
1968
|
+
function toKey(value) {
|
|
1969
|
+
if (typeof value == 'string' || isSymbol(value)) {
|
|
1970
|
+
return value;
|
|
1971
|
+
}
|
|
1972
|
+
var result = (value + '');
|
|
1973
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
/**
|
|
1977
|
+
* Converts `func` to its source code.
|
|
1978
|
+
*
|
|
1979
|
+
* @private
|
|
1980
|
+
* @param {Function} func The function to process.
|
|
1981
|
+
* @returns {string} Returns the source code.
|
|
1982
|
+
*/
|
|
1983
|
+
function toSource(func) {
|
|
1984
|
+
if (func != null) {
|
|
1985
|
+
try {
|
|
1986
|
+
return funcToString.call(func);
|
|
1987
|
+
} catch (e) {}
|
|
1988
|
+
try {
|
|
1989
|
+
return (func + '');
|
|
1990
|
+
} catch (e) {}
|
|
1991
|
+
}
|
|
1992
|
+
return '';
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
/**
|
|
1996
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
1997
|
+
* provided, it determines the cache key for storing the result based on the
|
|
1998
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
1999
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
2000
|
+
* is invoked with the `this` binding of the memoized function.
|
|
2001
|
+
*
|
|
2002
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
2003
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
2004
|
+
* constructor with one whose instances implement the
|
|
2005
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
2006
|
+
* method interface of `delete`, `get`, `has`, and `set`.
|
|
2007
|
+
*
|
|
2008
|
+
* @static
|
|
2009
|
+
* @memberOf _
|
|
2010
|
+
* @since 0.1.0
|
|
2011
|
+
* @category Function
|
|
2012
|
+
* @param {Function} func The function to have its output memoized.
|
|
2013
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
2014
|
+
* @returns {Function} Returns the new memoized function.
|
|
2015
|
+
* @example
|
|
2016
|
+
*
|
|
2017
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
2018
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
2019
|
+
*
|
|
2020
|
+
* var values = _.memoize(_.values);
|
|
2021
|
+
* values(object);
|
|
2022
|
+
* // => [1, 2]
|
|
2023
|
+
*
|
|
2024
|
+
* values(other);
|
|
2025
|
+
* // => [3, 4]
|
|
2026
|
+
*
|
|
2027
|
+
* object.a = 2;
|
|
2028
|
+
* values(object);
|
|
2029
|
+
* // => [1, 2]
|
|
2030
|
+
*
|
|
2031
|
+
* // Modify the result cache.
|
|
2032
|
+
* values.cache.set(object, ['a', 'b']);
|
|
2033
|
+
* values(object);
|
|
2034
|
+
* // => ['a', 'b']
|
|
2035
|
+
*
|
|
2036
|
+
* // Replace `_.memoize.Cache`.
|
|
2037
|
+
* _.memoize.Cache = WeakMap;
|
|
2038
|
+
*/
|
|
2039
|
+
function memoize(func, resolver) {
|
|
2040
|
+
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
|
|
2041
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
2042
|
+
}
|
|
2043
|
+
var memoized = function() {
|
|
2044
|
+
var args = arguments,
|
|
2045
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
2046
|
+
cache = memoized.cache;
|
|
2047
|
+
|
|
2048
|
+
if (cache.has(key)) {
|
|
2049
|
+
return cache.get(key);
|
|
2050
|
+
}
|
|
2051
|
+
var result = func.apply(this, args);
|
|
2052
|
+
memoized.cache = cache.set(key, result);
|
|
2053
|
+
return result;
|
|
2054
|
+
};
|
|
2055
|
+
memoized.cache = new (memoize.Cache || MapCache);
|
|
2056
|
+
return memoized;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
// Assign cache to `_.memoize`.
|
|
2060
|
+
memoize.Cache = MapCache;
|
|
2061
|
+
|
|
2062
|
+
/**
|
|
2063
|
+
* Performs a
|
|
2064
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
2065
|
+
* comparison between two values to determine if they are equivalent.
|
|
2066
|
+
*
|
|
2067
|
+
* @static
|
|
2068
|
+
* @memberOf _
|
|
2069
|
+
* @since 4.0.0
|
|
2070
|
+
* @category Lang
|
|
2071
|
+
* @param {*} value The value to compare.
|
|
2072
|
+
* @param {*} other The other value to compare.
|
|
2073
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
2074
|
+
* @example
|
|
2075
|
+
*
|
|
2076
|
+
* var object = { 'a': 1 };
|
|
2077
|
+
* var other = { 'a': 1 };
|
|
2078
|
+
*
|
|
2079
|
+
* _.eq(object, object);
|
|
2080
|
+
* // => true
|
|
2081
|
+
*
|
|
2082
|
+
* _.eq(object, other);
|
|
2083
|
+
* // => false
|
|
2084
|
+
*
|
|
2085
|
+
* _.eq('a', 'a');
|
|
2086
|
+
* // => true
|
|
2087
|
+
*
|
|
2088
|
+
* _.eq('a', Object('a'));
|
|
2089
|
+
* // => false
|
|
2090
|
+
*
|
|
2091
|
+
* _.eq(NaN, NaN);
|
|
2092
|
+
* // => true
|
|
2093
|
+
*/
|
|
2094
|
+
function eq(value, other) {
|
|
2095
|
+
return value === other || (value !== value && other !== other);
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
/**
|
|
2099
|
+
* Checks if `value` is classified as an `Array` object.
|
|
2100
|
+
*
|
|
2101
|
+
* @static
|
|
2102
|
+
* @memberOf _
|
|
2103
|
+
* @since 0.1.0
|
|
2104
|
+
* @category Lang
|
|
2105
|
+
* @param {*} value The value to check.
|
|
2106
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
2107
|
+
* @example
|
|
2108
|
+
*
|
|
2109
|
+
* _.isArray([1, 2, 3]);
|
|
2110
|
+
* // => true
|
|
2111
|
+
*
|
|
2112
|
+
* _.isArray(document.body.children);
|
|
2113
|
+
* // => false
|
|
2114
|
+
*
|
|
2115
|
+
* _.isArray('abc');
|
|
2116
|
+
* // => false
|
|
2117
|
+
*
|
|
2118
|
+
* _.isArray(_.noop);
|
|
2119
|
+
* // => false
|
|
2120
|
+
*/
|
|
2121
|
+
var isArray = Array.isArray;
|
|
2122
|
+
|
|
2123
|
+
/**
|
|
2124
|
+
* Checks if `value` is classified as a `Function` object.
|
|
2125
|
+
*
|
|
2126
|
+
* @static
|
|
2127
|
+
* @memberOf _
|
|
2128
|
+
* @since 0.1.0
|
|
2129
|
+
* @category Lang
|
|
2130
|
+
* @param {*} value The value to check.
|
|
2131
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
2132
|
+
* @example
|
|
2133
|
+
*
|
|
2134
|
+
* _.isFunction(_);
|
|
2135
|
+
* // => true
|
|
2136
|
+
*
|
|
2137
|
+
* _.isFunction(/abc/);
|
|
2138
|
+
* // => false
|
|
2139
|
+
*/
|
|
2140
|
+
function isFunction(value) {
|
|
2141
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
2142
|
+
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
|
2143
|
+
var tag = isObject(value) ? objectToString.call(value) : '';
|
|
2144
|
+
return tag == funcTag || tag == genTag;
|
|
2145
|
+
}
|
|
2146
|
+
|
|
2147
|
+
/**
|
|
2148
|
+
* Checks if `value` is the
|
|
2149
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
2150
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
2151
|
+
*
|
|
2152
|
+
* @static
|
|
2153
|
+
* @memberOf _
|
|
2154
|
+
* @since 0.1.0
|
|
2155
|
+
* @category Lang
|
|
2156
|
+
* @param {*} value The value to check.
|
|
2157
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
2158
|
+
* @example
|
|
2159
|
+
*
|
|
2160
|
+
* _.isObject({});
|
|
2161
|
+
* // => true
|
|
2162
|
+
*
|
|
2163
|
+
* _.isObject([1, 2, 3]);
|
|
2164
|
+
* // => true
|
|
2165
|
+
*
|
|
2166
|
+
* _.isObject(_.noop);
|
|
2167
|
+
* // => true
|
|
2168
|
+
*
|
|
2169
|
+
* _.isObject(null);
|
|
2170
|
+
* // => false
|
|
2171
|
+
*/
|
|
2172
|
+
function isObject(value) {
|
|
2173
|
+
var type = typeof value;
|
|
2174
|
+
return !!value && (type == 'object' || type == 'function');
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
/**
|
|
2178
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
2179
|
+
* and has a `typeof` result of "object".
|
|
2180
|
+
*
|
|
2181
|
+
* @static
|
|
2182
|
+
* @memberOf _
|
|
2183
|
+
* @since 4.0.0
|
|
2184
|
+
* @category Lang
|
|
2185
|
+
* @param {*} value The value to check.
|
|
2186
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
2187
|
+
* @example
|
|
2188
|
+
*
|
|
2189
|
+
* _.isObjectLike({});
|
|
2190
|
+
* // => true
|
|
2191
|
+
*
|
|
2192
|
+
* _.isObjectLike([1, 2, 3]);
|
|
2193
|
+
* // => true
|
|
2194
|
+
*
|
|
2195
|
+
* _.isObjectLike(_.noop);
|
|
2196
|
+
* // => false
|
|
2197
|
+
*
|
|
2198
|
+
* _.isObjectLike(null);
|
|
2199
|
+
* // => false
|
|
2200
|
+
*/
|
|
2201
|
+
function isObjectLike(value) {
|
|
2202
|
+
return !!value && typeof value == 'object';
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
/**
|
|
2206
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
2207
|
+
*
|
|
2208
|
+
* @static
|
|
2209
|
+
* @memberOf _
|
|
2210
|
+
* @since 4.0.0
|
|
2211
|
+
* @category Lang
|
|
2212
|
+
* @param {*} value The value to check.
|
|
2213
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
2214
|
+
* @example
|
|
2215
|
+
*
|
|
2216
|
+
* _.isSymbol(Symbol.iterator);
|
|
2217
|
+
* // => true
|
|
2218
|
+
*
|
|
2219
|
+
* _.isSymbol('abc');
|
|
2220
|
+
* // => false
|
|
2221
|
+
*/
|
|
2222
|
+
function isSymbol(value) {
|
|
2223
|
+
return typeof value == 'symbol' ||
|
|
2224
|
+
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
/**
|
|
2228
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
2229
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
2230
|
+
*
|
|
2231
|
+
* @static
|
|
2232
|
+
* @memberOf _
|
|
2233
|
+
* @since 4.0.0
|
|
2234
|
+
* @category Lang
|
|
2235
|
+
* @param {*} value The value to process.
|
|
2236
|
+
* @returns {string} Returns the string.
|
|
2237
|
+
* @example
|
|
2238
|
+
*
|
|
2239
|
+
* _.toString(null);
|
|
2240
|
+
* // => ''
|
|
2241
|
+
*
|
|
2242
|
+
* _.toString(-0);
|
|
2243
|
+
* // => '-0'
|
|
2244
|
+
*
|
|
2245
|
+
* _.toString([1, 2, 3]);
|
|
2246
|
+
* // => '1,2,3'
|
|
2247
|
+
*/
|
|
2248
|
+
function toString(value) {
|
|
2249
|
+
return value == null ? '' : baseToString(value);
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
/**
|
|
2253
|
+
* Gets the value at `path` of `object`. If the resolved value is
|
|
2254
|
+
* `undefined`, the `defaultValue` is returned in its place.
|
|
2255
|
+
*
|
|
2256
|
+
* @static
|
|
2257
|
+
* @memberOf _
|
|
2258
|
+
* @since 3.7.0
|
|
2259
|
+
* @category Object
|
|
2260
|
+
* @param {Object} object The object to query.
|
|
2261
|
+
* @param {Array|string} path The path of the property to get.
|
|
2262
|
+
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
2263
|
+
* @returns {*} Returns the resolved value.
|
|
2264
|
+
* @example
|
|
2265
|
+
*
|
|
2266
|
+
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
2267
|
+
*
|
|
2268
|
+
* _.get(object, 'a[0].b.c');
|
|
2269
|
+
* // => 3
|
|
2270
|
+
*
|
|
2271
|
+
* _.get(object, ['a', '0', 'b', 'c']);
|
|
2272
|
+
* // => 3
|
|
2273
|
+
*
|
|
2274
|
+
* _.get(object, 'a.b.c', 'default');
|
|
2275
|
+
* // => 'default'
|
|
2276
|
+
*/
|
|
2277
|
+
function get(object, path, defaultValue) {
|
|
2278
|
+
var result = object == null ? undefined : baseGet(object, path);
|
|
2279
|
+
return result === undefined ? defaultValue : result;
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
module.exports = get;
|
|
2283
|
+
|
|
2284
|
+
|
|
2285
|
+
/***/ })
|
|
2286
|
+
|
|
2287
|
+
}]);
|