@ohif/app 3.7.0-beta.10 → 3.7.0-beta.100
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/{917.bundle.5ba88c26be5d6da4a0c2.js → 12.bundle.34050abb042540a90a3a.js} +6 -6
- package/dist/{295.bundle.957b1159fec14b9199a1.js → 125.bundle.253395f320b72180da63.js} +6 -6
- package/dist/{351.bundle.0742237651aef9694a65.js → 181.bundle.169383e9b1a0358b44e8.js} +226 -204
- package/dist/{351.css → 181.css} +1 -1
- package/dist/{744.bundle.c8ae026860dde82c9e1b.js → 19.bundle.eef637102334f1832ba9.js} +240 -375
- package/dist/{606.bundle.5d876f5f3dd8287f0a28.js → 202.bundle.96bbb4547a346fe3921f.js} +1420 -750
- package/dist/{926.bundle.dbc9d0e591cb9217fda2.js → 220.bundle.f7e1c96c94245e70f2be.js} +990 -400
- package/dist/221.bundle.0b9f7401294213262852.js +1723 -0
- package/dist/221.css +2 -0
- package/dist/{664.bundle.09abae984223969d1bde.js → 23.bundle.e008ad788170f2ed5569.js} +5 -6
- package/dist/{976.bundle.2f01873fd8d59fe756e1.js → 236.bundle.7768b3e29b1fd618b9ec.js} +89 -105
- package/dist/{55.bundle.550a823e75eb608e8d5e.js → 250.bundle.8084960e3318cda37317.js} +52 -36
- package/dist/{973.bundle.528e2b42f4a218b2524c.js → 281.bundle.39cb630582cf8114fd5e.js} +18 -14
- package/dist/{82.bundle.3ac52bd40e60cdfee60a.js → 342.bundle.6edc7ac022b4218ec99f.js} +1772 -477
- package/dist/{404.bundle.ef4f5f0697573d138bf1.js → 359.bundle.a8f6cf2f90fe05fc346d.js} +46 -131
- package/dist/{192.bundle.26466954184a0ae830e0.js → 370.bundle.4e1276530ba7757347f5.js} +113 -99
- package/dist/{790.bundle.4ed6048f4998cbdd9149.js → 410.bundle.5a330214c0c31cbf2551.js} +11 -9
- package/dist/{151.bundle.31ea35044218837bf73f.js → 417.bundle.af0a207c29b109f84159.js} +49 -17
- package/dist/{569.bundle.c8e771a8d28e237b32be.js → 451.bundle.9fd36f52ff69594f0669.js} +86 -106
- package/dist/{581.bundle.dc6197189f7c88c27d4c.js → 471.bundle.b3d77b83b1593c09a504.js} +78 -99
- package/dist/{199.bundle.5abeeb99615ff32ed827.js → 506.bundle.ac385e382f79bbf4f306.js} +11 -9
- package/dist/{531.bundle.2a82fb1d69e5b57cc72b.js → 530.bundle.a03b6f942ace3e1baa1e.js} +726 -447
- package/dist/579.css +1 -0
- package/dist/{935.bundle.deeffff0e4f7b528e3c3.js → 604.bundle.a51f83e64004bca5f497.js} +2 -3
- package/dist/613.bundle.f75fd669ddfe4ecf9c1b.js +532 -0
- package/dist/{984.bundle.75811ab1b046b004305c.js → 663.bundle.3863ac49f85320c8ca96.js} +68 -38
- package/dist/{205.bundle.b5a473c200dcf2bbcdb4.js → 686.bundle.dccef1f36e4bc79bcc48.js} +6 -6
- package/dist/{50.bundle.f1439664aa8deca8c0bb.js → 687.bundle.ebd1260565c31ab9ad08.js} +218 -9
- package/dist/{331.bundle.bd0c13931a21d53086c9.js → 743.bundle.4bfe6e562ffb2c22708f.js} +26281 -21326
- package/dist/{728.bundle.d13856835357400fef82.js → 774.bundle.7528cba56a1407357144.js} +95 -64
- package/dist/{381.bundle.0905e683605fcbc0895f.js → 775.bundle.2285e7e0e67878948c0d.js} +16 -16
- package/dist/{283.bundle.f547f85681d875f9e2e3.js → 782.bundle.8c17030f76b75035564c.js} +117 -67
- package/dist/{642.bundle.2d1065b66fd7f8531dd2.js → 814.bundle.cc0ed4fc75cb16e34f02.js} +6 -6
- package/dist/{707.bundle.ed1d145de922570db0d2.js → 82.bundle.7a89cd8b81eb7e1e5c66.js} +1147 -768
- package/dist/{799.bundle.758558e64147e5aad612.js → 822.bundle.0545d6dbb49515aa04ee.js} +81 -34
- package/dist/831.bundle.83658f62fcc769043605.js +16700 -0
- package/dist/{953.bundle.3b0189ebc11cf0946f18.js → 886.bundle.4b3a7f2079d085fdbcb3.js} +34 -29
- package/dist/945.min.worker.js +1 -1
- package/dist/945.min.worker.js.map +1 -1
- package/dist/{270.bundle.4564621556b0f963a004.js → 957.bundle.71558794566041f37a92.js} +7110 -997
- package/dist/{208.bundle.b1d53f6cc253c3cbc5b3.js → 99.bundle.c6876aaaa3ff2f1b08a1.js} +86 -105
- package/dist/_redirects +1 -1
- package/dist/app-config.js +35 -17
- package/dist/app.bundle.css +13 -12
- package/dist/{app.bundle.1a4a0577bf5f2ab8b76d.js → app.bundle.dc0e89948c4f4568fe20.js} +73483 -68064
- package/dist/assets/yandex-browser-manifest.json +1 -1
- package/dist/cornerstoneDICOMImageLoader.min.js +1 -1
- package/dist/cornerstoneDICOMImageLoader.min.js.map +1 -1
- package/dist/{dicom-microscopy-viewer.bundle.aa60bdf008c32c39cfd7.js → dicom-microscopy-viewer.bundle.2c146384eb9466d02ff8.js} +5 -4
- package/dist/es6-shim.min.js +3569 -2
- package/dist/google.js +8 -7
- package/dist/index.html +2 -1
- package/dist/{index.worker.1c69152d710fa7b84bce.worker.js → index.worker.e62ecca63f1a2e124230.worker.js} +2 -2
- package/dist/index.worker.e62ecca63f1a2e124230.worker.js.map +1 -0
- package/dist/init-service-worker.js +3 -5
- package/dist/oidc-client.min.js +10857 -39
- package/dist/polyfill.min.js +184 -1
- package/dist/silent-refresh.html +18 -9
- package/dist/sw.js +1 -1
- package/package.json +20 -22
- package/dist/616.bundle.07fe93ec26097c150193.js +0 -685
- package/dist/780.bundle.fd0f13dc92e9caa0581e.js +0 -4769
- package/dist/index.worker.1c69152d710fa7b84bce.worker.js.map +0 -1
- /package/dist/{806.css → 19.css} +0 -0
- /package/dist/{55.css → 250.css} +0 -0
- /package/dist/{707.css → 82.css} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(
|
|
1
|
+
(self["webpackChunk"] = self["webpackChunk"] || []).push([[82],{
|
|
2
2
|
|
|
3
|
-
/***/
|
|
3
|
+
/***/ 78227:
|
|
4
4
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
@@ -9,44 +9,44 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9
9
|
|
|
10
10
|
// EXPORTS
|
|
11
11
|
__webpack_require__.d(__webpack_exports__, {
|
|
12
|
-
|
|
12
|
+
Types: () => (/* reexport */ types_namespaceObject),
|
|
13
13
|
"default": () => (/* binding */ cornerstone_src),
|
|
14
14
|
getActiveViewportEnabledElement: () => (/* reexport */ getActiveViewportEnabledElement),
|
|
15
15
|
measurementMappingUtils: () => (/* reexport */ utils_namespaceObject),
|
|
16
16
|
toolNames: () => (/* reexport */ toolNames)
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
// NAMESPACE OBJECT: ../../../extensions/cornerstone/src/types/index.ts
|
|
20
|
-
var types_namespaceObject = {};
|
|
21
|
-
__webpack_require__.r(types_namespaceObject);
|
|
22
|
-
|
|
23
19
|
// NAMESPACE OBJECT: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/index.ts
|
|
24
20
|
var utils_namespaceObject = {};
|
|
25
21
|
__webpack_require__.r(utils_namespaceObject);
|
|
26
22
|
__webpack_require__.d(utils_namespaceObject, {
|
|
23
|
+
getDisplayUnit: () => (utils_getDisplayUnit),
|
|
27
24
|
getFirstAnnotationSelected: () => (getFirstAnnotationSelected),
|
|
28
25
|
getHandlesFromPoints: () => (getHandlesFromPoints),
|
|
29
|
-
getModalityUnit: () => (utils_getModalityUnit),
|
|
30
26
|
getSOPInstanceAttributes: () => (getSOPInstanceAttributes/* default */.Z),
|
|
31
27
|
isAnnotationSelected: () => (isAnnotationSelected),
|
|
32
28
|
setAnnotationSelected: () => (setAnnotationSelected)
|
|
33
29
|
});
|
|
34
30
|
|
|
31
|
+
// NAMESPACE OBJECT: ../../../extensions/cornerstone/src/types/index.ts
|
|
32
|
+
var types_namespaceObject = {};
|
|
33
|
+
__webpack_require__.r(types_namespaceObject);
|
|
34
|
+
|
|
35
35
|
// EXTERNAL MODULE: ../../../node_modules/react/index.js
|
|
36
|
-
var react = __webpack_require__(
|
|
37
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js +
|
|
38
|
-
var esm = __webpack_require__(
|
|
39
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/index.js +
|
|
40
|
-
var dist_esm = __webpack_require__(
|
|
41
|
-
// EXTERNAL MODULE: ../../core/src/index.ts +
|
|
42
|
-
var src = __webpack_require__(
|
|
36
|
+
var react = __webpack_require__(43001);
|
|
37
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 331 modules
|
|
38
|
+
var esm = __webpack_require__(3743);
|
|
39
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/index.js + 348 modules
|
|
40
|
+
var dist_esm = __webpack_require__(14957);
|
|
41
|
+
// EXTERNAL MODULE: ../../core/src/index.ts + 65 modules
|
|
42
|
+
var src = __webpack_require__(71771);
|
|
43
43
|
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/streaming-image-volume-loader/dist/esm/index.js + 13 modules
|
|
44
|
-
var streaming_image_volume_loader_dist_esm = __webpack_require__(
|
|
44
|
+
var streaming_image_volume_loader_dist_esm = __webpack_require__(7087);
|
|
45
45
|
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/dynamic-import/cornerstoneDICOMImageLoader.min.js
|
|
46
|
-
var cornerstoneDICOMImageLoader_min = __webpack_require__(
|
|
46
|
+
var cornerstoneDICOMImageLoader_min = __webpack_require__(61539);
|
|
47
47
|
var cornerstoneDICOMImageLoader_min_default = /*#__PURE__*/__webpack_require__.n(cornerstoneDICOMImageLoader_min);
|
|
48
48
|
// EXTERNAL MODULE: ../../../node_modules/dicom-parser/dist/dicomParser.min.js
|
|
49
|
-
var dicomParser_min = __webpack_require__(
|
|
49
|
+
var dicomParser_min = __webpack_require__(56660);
|
|
50
50
|
var dicomParser_min_default = /*#__PURE__*/__webpack_require__.n(dicomParser_min);
|
|
51
51
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/initWADOImageLoader.js
|
|
52
52
|
|
|
@@ -76,7 +76,7 @@ function initWebWorkers(appConfig) {
|
|
|
76
76
|
initialized = true;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
function initWADOImageLoader(userAuthenticationService, appConfig) {
|
|
79
|
+
function initWADOImageLoader(userAuthenticationService, appConfig, extensionManager) {
|
|
80
80
|
(cornerstoneDICOMImageLoader_min_default()).external.cornerstone = esm;
|
|
81
81
|
(cornerstoneDICOMImageLoader_min_default()).external.dicomParser = (dicomParser_min_default());
|
|
82
82
|
registerVolumeLoader('cornerstoneStreamingImageVolume', streaming_image_volume_loader_dist_esm/* cornerstoneStreamingImageVolumeLoader */.IU);
|
|
@@ -87,21 +87,17 @@ function initWADOImageLoader(userAuthenticationService, appConfig) {
|
|
|
87
87
|
// will convert everything to integers (to be able to work with cornerstone-2d).
|
|
88
88
|
// Until the default is set to true (which is the case for cornerstone3D),
|
|
89
89
|
// we should set this flag to false.
|
|
90
|
-
convertFloatPixelDataToInt: false
|
|
90
|
+
convertFloatPixelDataToInt: false,
|
|
91
|
+
use16BitDataType: Boolean(appConfig.use16BitDataType)
|
|
91
92
|
},
|
|
92
93
|
beforeSend: function (xhr) {
|
|
94
|
+
//TODO should be removed in the future and request emitted by DicomWebDataSource
|
|
95
|
+
const sourceConfig = extensionManager.getActiveDataSource()?.[0].getConfig() ?? {};
|
|
93
96
|
const headers = userAuthenticationService.getAuthorizationHeader();
|
|
94
|
-
|
|
95
|
-
// Request:
|
|
96
|
-
// JPEG-LS Lossless (1.2.840.10008.1.2.4.80) if available, otherwise accept
|
|
97
|
-
// whatever transfer-syntax the origin server provides.
|
|
98
|
-
// For now we use image/jls and image/x-jls because some servers still use the old type
|
|
99
|
-
// http://dicom.nema.org/medical/dicom/current/output/html/part18.html
|
|
97
|
+
const acceptHeader = src.utils.generateAcceptHeader(sourceConfig.acceptHeader, sourceConfig.requestTransferSyntaxUID, sourceConfig.omitQuotationForMultipartRequest);
|
|
100
98
|
const xhrRequestHeaders = {
|
|
101
|
-
Accept:
|
|
102
|
-
// 'multipart/related; type="image/x-jls", multipart/related; type="image/jls"; transfer-syntax="1.2.840.10008.1.2.4.80", multipart/related; type="image/x-jls", multipart/related; type="application/octet-stream"; transfer-syntax=*',
|
|
99
|
+
Accept: acceptHeader
|
|
103
100
|
};
|
|
104
|
-
|
|
105
101
|
if (headers) {
|
|
106
102
|
Object.assign(xhrRequestHeaders, headers);
|
|
107
103
|
}
|
|
@@ -116,14 +112,14 @@ function initWADOImageLoader(userAuthenticationService, appConfig) {
|
|
|
116
112
|
function destroy() {
|
|
117
113
|
// Note: we don't want to call .terminate on the webWorkerManager since
|
|
118
114
|
// that resets the config
|
|
119
|
-
const webWorkers =
|
|
115
|
+
const webWorkers = webWorkerManager.webWorkers;
|
|
120
116
|
for (let i = 0; i < webWorkers.length; i++) {
|
|
121
117
|
webWorkers[i].worker.terminate();
|
|
122
118
|
}
|
|
123
119
|
webWorkers.length = 0;
|
|
124
120
|
}
|
|
125
|
-
// EXTERNAL MODULE: ../../ui/src/index.js +
|
|
126
|
-
var ui_src = __webpack_require__(
|
|
121
|
+
// EXTERNAL MODULE: ../../ui/src/index.js + 485 modules
|
|
122
|
+
var ui_src = __webpack_require__(71783);
|
|
127
123
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/callInputDialog.tsx
|
|
128
124
|
|
|
129
125
|
|
|
@@ -157,7 +153,9 @@ function callInputDialog(uiDialogService, data, callback) {
|
|
|
157
153
|
} = _ref;
|
|
158
154
|
switch (action.id) {
|
|
159
155
|
case 'save':
|
|
160
|
-
if (typeof validateFunc === 'function' && !validateFunc(value.label))
|
|
156
|
+
if (typeof validateFunc === 'function' && !validateFunc(value.label)) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
161
159
|
callback(value.label, action.id);
|
|
162
160
|
break;
|
|
163
161
|
case 'cancel':
|
|
@@ -187,11 +185,11 @@ function callInputDialog(uiDialogService, data, callback) {
|
|
|
187
185
|
actions: [{
|
|
188
186
|
id: 'cancel',
|
|
189
187
|
text: 'Cancel',
|
|
190
|
-
type: ui_src/* ButtonEnums.type */.LZ.
|
|
188
|
+
type: ui_src/* ButtonEnums.type */.LZ.dt.secondary
|
|
191
189
|
}, {
|
|
192
190
|
id: 'save',
|
|
193
191
|
text: 'Save',
|
|
194
|
-
type: ui_src/* ButtonEnums.type */.LZ.
|
|
192
|
+
type: ui_src/* ButtonEnums.type */.LZ.dt.primary
|
|
195
193
|
}],
|
|
196
194
|
onSubmit: onSubmitHandler,
|
|
197
195
|
body: _ref2 => {
|
|
@@ -201,7 +199,7 @@ function callInputDialog(uiDialogService, data, callback) {
|
|
|
201
199
|
} = _ref2;
|
|
202
200
|
return /*#__PURE__*/react.createElement(ui_src/* Input */.II, {
|
|
203
201
|
autoFocus: true,
|
|
204
|
-
className: "
|
|
202
|
+
className: "border-primary-main bg-black",
|
|
205
203
|
type: "text",
|
|
206
204
|
id: "annotation",
|
|
207
205
|
label: inputLabel,
|
|
@@ -232,17 +230,17 @@ function callInputDialog(uiDialogService, data, callback) {
|
|
|
232
230
|
}
|
|
233
231
|
/* harmony default export */ const utils_callInputDialog = (callInputDialog);
|
|
234
232
|
// EXTERNAL MODULE: ../../../extensions/cornerstone/src/state.ts
|
|
235
|
-
var state = __webpack_require__(
|
|
233
|
+
var state = __webpack_require__(73704);
|
|
236
234
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/getActiveViewportEnabledElement.ts
|
|
237
235
|
|
|
238
236
|
|
|
239
237
|
function getActiveViewportEnabledElement(viewportGridService) {
|
|
240
238
|
const {
|
|
241
|
-
|
|
239
|
+
activeViewportId
|
|
242
240
|
} = viewportGridService.getState();
|
|
243
241
|
const {
|
|
244
242
|
element
|
|
245
|
-
} = (0,state/* getEnabledElement */.K8)(
|
|
243
|
+
} = (0,state/* getEnabledElement */.K8)(activeViewportId) || {};
|
|
246
244
|
const enabledElement = (0,esm.getEnabledElement)(element);
|
|
247
245
|
return enabledElement;
|
|
248
246
|
}
|
|
@@ -322,11 +320,12 @@ function onCompletedCalibrationLine(servicesManager, csToolsEvent) {
|
|
|
322
320
|
const currentColumnPixelSpacing = calibratedPixelSpacing?.[1] || imagePlaneModule?.columnPixelSpacing || 1;
|
|
323
321
|
const adjustCalibration = newLength => {
|
|
324
322
|
const spacingScale = newLength / length;
|
|
325
|
-
const rowSpacing = spacingScale * currentRowPixelSpacing;
|
|
326
|
-
const colSpacing = spacingScale * currentColumnPixelSpacing;
|
|
327
323
|
|
|
328
324
|
// trigger resize of the viewport to adjust the world/pixel mapping
|
|
329
|
-
calibrateImageSpacing(imageId, viewport.getRenderingEngine(),
|
|
325
|
+
calibrateImageSpacing(imageId, viewport.getRenderingEngine(), {
|
|
326
|
+
type: 'User',
|
|
327
|
+
scale: 1 / spacingScale
|
|
328
|
+
});
|
|
330
329
|
};
|
|
331
330
|
return new Promise((resolve, reject) => {
|
|
332
331
|
if (!uiDialogService) {
|
|
@@ -358,9 +357,223 @@ function onCompletedCalibrationLine(servicesManager, csToolsEvent) {
|
|
|
358
357
|
});
|
|
359
358
|
});
|
|
360
359
|
}
|
|
360
|
+
// EXTERNAL MODULE: ../../core/src/utils/index.js + 25 modules
|
|
361
|
+
var utils = __webpack_require__(77250);
|
|
362
|
+
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/tools/ImageOverlayViewerTool.tsx
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Image Overlay Viewer tool is not a traditional tool that requires user interactin.
|
|
369
|
+
* But it is used to display Pixel Overlays. And it will provide toggling capability.
|
|
370
|
+
*
|
|
371
|
+
* The documentation for Overlay Plane Module of DICOM can be found in [C.9.2 of
|
|
372
|
+
* Part-3 of DICOM standard](https://dicom.nema.org/medical/dicom/2018b/output/chtml/part03/sect_C.9.2.html)
|
|
373
|
+
*
|
|
374
|
+
* Image Overlay rendered by this tool can be toggled on and off using
|
|
375
|
+
* toolGroup.setToolEnabled() and toolGroup.setToolDisabled()
|
|
376
|
+
*/
|
|
377
|
+
class ImageOverlayViewerTool extends dist_esm.AnnotationDisplayTool {
|
|
378
|
+
constructor() {
|
|
379
|
+
let toolProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
380
|
+
let defaultToolProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
381
|
+
supportedInteractionTypes: [],
|
|
382
|
+
configuration: {
|
|
383
|
+
fillColor: [255, 127, 127, 255]
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
super(toolProps, defaultToolProps);
|
|
387
|
+
this._cachedOverlayMetadata = new Map();
|
|
388
|
+
this._cachedStats = {};
|
|
389
|
+
this.onSetToolDisabled = () => {
|
|
390
|
+
this._cachedStats = {};
|
|
391
|
+
this._cachedOverlayMetadata = new Map();
|
|
392
|
+
};
|
|
393
|
+
this.renderAnnotation = (enabledElement, svgDrawingHelper) => {
|
|
394
|
+
const {
|
|
395
|
+
viewport
|
|
396
|
+
} = enabledElement;
|
|
397
|
+
const imageId = this.getReferencedImageId(viewport);
|
|
398
|
+
if (!imageId) {
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
const overlays = this._cachedOverlayMetadata.get(imageId) ?? esm.metaData.get('overlayPlaneModule', imageId)?.overlays;
|
|
402
|
+
|
|
403
|
+
// no overlays
|
|
404
|
+
if (!overlays?.length) {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
this._cachedOverlayMetadata.set(imageId, overlays);
|
|
408
|
+
this._getCachedStat(imageId, overlays, this.configuration.fillColor).then(cachedStat => {
|
|
409
|
+
cachedStat.overlays.forEach(overlay => {
|
|
410
|
+
this._renderOverlay(enabledElement, svgDrawingHelper, overlay);
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
return true;
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
getReferencedImageId(viewport) {
|
|
417
|
+
if (viewport instanceof esm.VolumeViewport) {
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
const targetId = this.getTargetId(viewport);
|
|
421
|
+
return targetId.split('imageId:')[1];
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Render to DOM
|
|
425
|
+
*
|
|
426
|
+
* @param enabledElement
|
|
427
|
+
* @param svgDrawingHelper
|
|
428
|
+
* @param overlayData
|
|
429
|
+
* @returns
|
|
430
|
+
*/
|
|
431
|
+
_renderOverlay(enabledElement, svgDrawingHelper, overlayData) {
|
|
432
|
+
const {
|
|
433
|
+
viewport
|
|
434
|
+
} = enabledElement;
|
|
435
|
+
const imageId = this.getReferencedImageId(viewport);
|
|
436
|
+
if (!imageId) {
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// Decide the rendering position of the overlay image on the current canvas
|
|
441
|
+
const {
|
|
442
|
+
_id,
|
|
443
|
+
columns: width,
|
|
444
|
+
rows: height,
|
|
445
|
+
x,
|
|
446
|
+
y
|
|
447
|
+
} = overlayData;
|
|
448
|
+
const overlayTopLeftWorldPos = esm.utilities.imageToWorldCoords(imageId, [x - 1,
|
|
449
|
+
// Remind that top-left corner's (x, y) is be (1, 1)
|
|
450
|
+
y - 1]);
|
|
451
|
+
const overlayTopLeftOnCanvas = viewport.worldToCanvas(overlayTopLeftWorldPos);
|
|
452
|
+
const overlayBottomRightWorldPos = esm.utilities.imageToWorldCoords(imageId, [width, height]);
|
|
453
|
+
const overlayBottomRightOnCanvas = viewport.worldToCanvas(overlayBottomRightWorldPos);
|
|
454
|
+
|
|
455
|
+
// add image to the annotations svg layer
|
|
456
|
+
const svgns = 'http://www.w3.org/2000/svg';
|
|
457
|
+
const svgNodeHash = `image-overlay-${_id}`;
|
|
458
|
+
const existingImageElement = svgDrawingHelper.getSvgNode(svgNodeHash);
|
|
459
|
+
const attributes = {
|
|
460
|
+
'data-id': svgNodeHash,
|
|
461
|
+
width: overlayBottomRightOnCanvas[0] - overlayTopLeftOnCanvas[0],
|
|
462
|
+
height: overlayBottomRightOnCanvas[1] - overlayTopLeftOnCanvas[1],
|
|
463
|
+
x: overlayTopLeftOnCanvas[0],
|
|
464
|
+
y: overlayTopLeftOnCanvas[1],
|
|
465
|
+
href: overlayData.dataUrl
|
|
466
|
+
};
|
|
467
|
+
if (isNaN(attributes.x) || isNaN(attributes.y) || isNaN(attributes.width) || isNaN(attributes.height)) {
|
|
468
|
+
console.warn('Invalid rendering attribute for image overlay', attributes['data-id']);
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
if (existingImageElement) {
|
|
472
|
+
dist_esm.drawing.setAttributesIfNecessary(attributes, existingImageElement);
|
|
473
|
+
svgDrawingHelper.setNodeTouched(svgNodeHash);
|
|
474
|
+
} else {
|
|
475
|
+
const newImageElement = document.createElementNS(svgns, 'image');
|
|
476
|
+
dist_esm.drawing.setNewAttributesIfValid(attributes, newImageElement);
|
|
477
|
+
svgDrawingHelper.appendNode(newImageElement, svgNodeHash);
|
|
478
|
+
}
|
|
479
|
+
return true;
|
|
480
|
+
}
|
|
481
|
+
async _getCachedStat(imageId, overlayMetadata, color) {
|
|
482
|
+
if (this._cachedStats[imageId] && this._isSameColor(this._cachedStats[imageId].color, color)) {
|
|
483
|
+
return this._cachedStats[imageId];
|
|
484
|
+
}
|
|
485
|
+
const overlays = await Promise.all(overlayMetadata.filter(overlay => overlay.pixelData).map(async (overlay, idx) => {
|
|
486
|
+
let pixelData = null;
|
|
487
|
+
if (overlay.pixelData.Value) {
|
|
488
|
+
pixelData = overlay.pixelData.Value;
|
|
489
|
+
} else if (overlay.pixelData instanceof Array) {
|
|
490
|
+
pixelData = overlay.pixelData[0];
|
|
491
|
+
} else if (overlay.pixelData.retrieveBulkData) {
|
|
492
|
+
pixelData = await overlay.pixelData.retrieveBulkData();
|
|
493
|
+
}
|
|
494
|
+
if (!pixelData) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
const dataUrl = this._renderOverlayToDataUrl({
|
|
498
|
+
width: overlay.columns,
|
|
499
|
+
height: overlay.rows
|
|
500
|
+
}, color, pixelData);
|
|
501
|
+
return {
|
|
502
|
+
...overlay,
|
|
503
|
+
_id: (0,utils/* guid */.M8)(),
|
|
504
|
+
dataUrl,
|
|
505
|
+
// this will be a data url expression of the rendered image
|
|
506
|
+
color
|
|
507
|
+
};
|
|
508
|
+
}));
|
|
509
|
+
this._cachedStats[imageId] = {
|
|
510
|
+
color: color,
|
|
511
|
+
overlays: overlays.filter(overlay => overlay)
|
|
512
|
+
};
|
|
513
|
+
return this._cachedStats[imageId];
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* compare two RGBA expression of colors.
|
|
518
|
+
*
|
|
519
|
+
* @param color1
|
|
520
|
+
* @param color2
|
|
521
|
+
* @returns
|
|
522
|
+
*/
|
|
523
|
+
_isSameColor(color1, color2) {
|
|
524
|
+
return color1 && color2 && color1[0] === color2[0] && color1[1] === color2[1] && color1[2] === color2[2] && color1[3] === color2[3];
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* pixelData of overlayPlane module is an array of bits corresponding
|
|
529
|
+
* to each of the underlying pixels of the image.
|
|
530
|
+
* Let's create pixel data from bit array of overlay data
|
|
531
|
+
*
|
|
532
|
+
* @param pixelDataRaw
|
|
533
|
+
* @param color
|
|
534
|
+
* @returns
|
|
535
|
+
*/
|
|
536
|
+
_renderOverlayToDataUrl(_ref, color, pixelDataRaw) {
|
|
537
|
+
let {
|
|
538
|
+
width,
|
|
539
|
+
height
|
|
540
|
+
} = _ref;
|
|
541
|
+
const pixelDataView = new DataView(pixelDataRaw);
|
|
542
|
+
const totalBits = width * height;
|
|
543
|
+
const canvas = document.createElement('canvas');
|
|
544
|
+
canvas.width = width;
|
|
545
|
+
canvas.height = height;
|
|
546
|
+
const ctx = canvas.getContext('2d');
|
|
547
|
+
ctx.clearRect(0, 0, width, height); // make it transparent
|
|
548
|
+
ctx.globalCompositeOperation = 'copy';
|
|
549
|
+
const imageData = ctx.getImageData(0, 0, width, height);
|
|
550
|
+
const data = imageData.data;
|
|
551
|
+
for (let i = 0, bitIdx = 0, byteIdx = 0; i < totalBits; i++) {
|
|
552
|
+
if (pixelDataView.getUint8(byteIdx) & 1 << bitIdx) {
|
|
553
|
+
data[i * 4] = color[0];
|
|
554
|
+
data[i * 4 + 1] = color[1];
|
|
555
|
+
data[i * 4 + 2] = color[2];
|
|
556
|
+
data[i * 4 + 3] = color[3];
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// next bit, byte
|
|
560
|
+
if (bitIdx >= 7) {
|
|
561
|
+
bitIdx = 0;
|
|
562
|
+
byteIdx++;
|
|
563
|
+
} else {
|
|
564
|
+
bitIdx++;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
ctx.putImageData(imageData, 0, 0);
|
|
568
|
+
return canvas.toDataURL();
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
ImageOverlayViewerTool.toolName = 'ImageOverlayViewer';
|
|
572
|
+
/* harmony default export */ const tools_ImageOverlayViewerTool = (ImageOverlayViewerTool);
|
|
361
573
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/initCornerstoneTools.js
|
|
362
574
|
|
|
363
575
|
|
|
576
|
+
|
|
364
577
|
function initCornerstoneTools() {
|
|
365
578
|
let configuration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
366
579
|
dist_esm.CrosshairsTool.isAnnotation = false;
|
|
@@ -390,6 +603,10 @@ function initCornerstoneTools() {
|
|
|
390
603
|
(0,dist_esm.addTool)(dist_esm.ReferenceLinesTool);
|
|
391
604
|
(0,dist_esm.addTool)(tools_CalibrationLineTool);
|
|
392
605
|
(0,dist_esm.addTool)(dist_esm.TrackballRotateTool);
|
|
606
|
+
(0,dist_esm.addTool)(dist_esm.CircleScissorsTool);
|
|
607
|
+
(0,dist_esm.addTool)(dist_esm.RectangleScissorsTool);
|
|
608
|
+
(0,dist_esm.addTool)(dist_esm.SphereScissorsTool);
|
|
609
|
+
(0,dist_esm.addTool)(tools_ImageOverlayViewerTool);
|
|
393
610
|
|
|
394
611
|
// Modify annotation tools to use dashed lines on SR
|
|
395
612
|
const annotationStyle = {
|
|
@@ -428,13 +645,17 @@ const toolNames = {
|
|
|
428
645
|
SegmentationDisplay: dist_esm.SegmentationDisplayTool.toolName,
|
|
429
646
|
ReferenceLines: dist_esm.ReferenceLinesTool.toolName,
|
|
430
647
|
CalibrationLine: tools_CalibrationLineTool.toolName,
|
|
431
|
-
TrackballRotateTool: dist_esm.TrackballRotateTool.toolName
|
|
648
|
+
TrackballRotateTool: dist_esm.TrackballRotateTool.toolName,
|
|
649
|
+
CircleScissors: dist_esm.CircleScissorsTool.toolName,
|
|
650
|
+
RectangleScissors: dist_esm.RectangleScissorsTool.toolName,
|
|
651
|
+
SphereScissors: dist_esm.SphereScissorsTool.toolName,
|
|
652
|
+
ImageOverlayViewer: tools_ImageOverlayViewerTool.toolName
|
|
432
653
|
};
|
|
433
654
|
|
|
434
655
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/constants/supportedTools.js
|
|
435
656
|
/* harmony default export */ const supportedTools = (['Length', 'EllipticalROI', 'CircleROI', 'Bidirectional', 'ArrowAnnotate', 'Angle', 'CobbAngle', 'Probe', 'RectangleROI', 'PlanarFreehandROI']);
|
|
436
657
|
// EXTERNAL MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/getSOPInstanceAttributes.js
|
|
437
|
-
var getSOPInstanceAttributes = __webpack_require__(
|
|
658
|
+
var getSOPInstanceAttributes = __webpack_require__(87172);
|
|
438
659
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/Length.ts
|
|
439
660
|
|
|
440
661
|
|
|
@@ -537,9 +758,9 @@ function getMappedAnnotations(annotation, displaySetService) {
|
|
|
537
758
|
SeriesNumber
|
|
538
759
|
} = displaySet;
|
|
539
760
|
const {
|
|
540
|
-
length
|
|
761
|
+
length,
|
|
762
|
+
unit = 'mm'
|
|
541
763
|
} = targetStats;
|
|
542
|
-
const unit = 'mm';
|
|
543
764
|
annotations.push({
|
|
544
765
|
SeriesInstanceUID,
|
|
545
766
|
SOPInstanceUID,
|
|
@@ -566,10 +787,13 @@ function _getReport(mappedAnnotations, points, FrameOfReferenceUID) {
|
|
|
566
787
|
values.push('Cornerstone:Length');
|
|
567
788
|
mappedAnnotations.forEach(annotation => {
|
|
568
789
|
const {
|
|
569
|
-
length
|
|
790
|
+
length,
|
|
791
|
+
unit
|
|
570
792
|
} = annotation;
|
|
571
|
-
columns.push(`Length
|
|
793
|
+
columns.push(`Length`);
|
|
572
794
|
values.push(length);
|
|
795
|
+
columns.push('Unit');
|
|
796
|
+
values.push(unit);
|
|
573
797
|
});
|
|
574
798
|
if (FrameOfReferenceUID) {
|
|
575
799
|
columns.push('FrameOfReferenceUID');
|
|
@@ -598,7 +822,8 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
|
|
598
822
|
length,
|
|
599
823
|
SeriesNumber,
|
|
600
824
|
SOPInstanceUID,
|
|
601
|
-
frameNumber
|
|
825
|
+
frameNumber,
|
|
826
|
+
unit
|
|
602
827
|
} = mappedAnnotations[0];
|
|
603
828
|
const instance = displaySet.images.find(image => image.SOPInstanceUID === SOPInstanceUID);
|
|
604
829
|
let InstanceNumber;
|
|
@@ -607,16 +832,77 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
|
|
607
832
|
}
|
|
608
833
|
const instanceText = InstanceNumber ? ` I: ${InstanceNumber}` : '';
|
|
609
834
|
const frameText = displaySet.isMultiFrame ? ` F: ${frameNumber}` : '';
|
|
610
|
-
if (length === null || length === undefined)
|
|
835
|
+
if (length === null || length === undefined) {
|
|
836
|
+
return displayText;
|
|
837
|
+
}
|
|
611
838
|
const roundedLength = src.utils.roundNumber(length, 2);
|
|
612
|
-
displayText.push(`${roundedLength}
|
|
839
|
+
displayText.push(`${roundedLength} ${unit} (S: ${SeriesNumber}${instanceText}${frameText})`);
|
|
613
840
|
return displayText;
|
|
614
841
|
}
|
|
615
842
|
/* harmony default export */ const measurementServiceMappings_Length = (Length);
|
|
843
|
+
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/getHandlesFromPoints.js
|
|
844
|
+
function getHandlesFromPoints(points) {
|
|
845
|
+
if (points.longAxis && points.shortAxis) {
|
|
846
|
+
const handles = {};
|
|
847
|
+
handles.start = points.longAxis[0];
|
|
848
|
+
handles.end = points.longAxis[1];
|
|
849
|
+
handles.perpendicularStart = points.longAxis[0];
|
|
850
|
+
handles.perpendicularEnd = points.longAxis[1];
|
|
851
|
+
return handles;
|
|
852
|
+
}
|
|
853
|
+
return points.map((p, i) => i % 10 === 0 ? {
|
|
854
|
+
start: p
|
|
855
|
+
} : {
|
|
856
|
+
end: p
|
|
857
|
+
}).reduce((obj, item) => Object.assign(obj, {
|
|
858
|
+
...item
|
|
859
|
+
}), {});
|
|
860
|
+
}
|
|
861
|
+
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/selection.ts
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Check whether an annotation from imaging library is selected or not.
|
|
866
|
+
* @param {string} annotationUID uid of imaging library annotation
|
|
867
|
+
* @returns boolean
|
|
868
|
+
*/
|
|
869
|
+
function isAnnotationSelected(annotationUID) {
|
|
870
|
+
return dist_esm.annotation.selection.isAnnotationSelected(annotationUID);
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Change an annotation from imaging library's selected property.
|
|
875
|
+
* @param annotationUID - uid of imaging library annotation
|
|
876
|
+
* @param selected - new value for selected
|
|
877
|
+
*/
|
|
878
|
+
function setAnnotationSelected(annotationUID, selected) {
|
|
879
|
+
const isCurrentSelected = isAnnotationSelected(annotationUID);
|
|
880
|
+
// branch cut, avoid invoking imaging library unnecessarily.
|
|
881
|
+
if (isCurrentSelected !== selected) {
|
|
882
|
+
dist_esm.annotation.selection.setAnnotationSelected(annotationUID, selected);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
function getFirstAnnotationSelected(element) {
|
|
886
|
+
const [selectedAnnotationUID] = dist_esm.annotation.selection.getAnnotationsSelected() || [];
|
|
887
|
+
if (selectedAnnotationUID) {
|
|
888
|
+
return dist_esm.annotation.state.getAnnotation(selectedAnnotationUID);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/getDisplayUnit.js
|
|
893
|
+
const getDisplayUnit = unit => unit == null ? '' : unit;
|
|
894
|
+
/* harmony default export */ const utils_getDisplayUnit = (getDisplayUnit);
|
|
895
|
+
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/index.ts
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
|
|
616
901
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/Bidirectional.ts
|
|
617
902
|
|
|
618
903
|
|
|
619
904
|
|
|
905
|
+
|
|
620
906
|
const Bidirectional = {
|
|
621
907
|
toAnnotation: measurement => {},
|
|
622
908
|
toMeasurement: (csToolsEventDetail, displaySetService, cornerstoneViewportService, getValueTypeFromToolType) => {
|
|
@@ -711,9 +997,9 @@ function Bidirectional_getMappedAnnotations(annotation, displaySetService) {
|
|
|
711
997
|
} = displaySet;
|
|
712
998
|
const {
|
|
713
999
|
length,
|
|
714
|
-
width
|
|
1000
|
+
width,
|
|
1001
|
+
unit
|
|
715
1002
|
} = targetStats;
|
|
716
|
-
const unit = 'mm';
|
|
717
1003
|
annotations.push({
|
|
718
1004
|
SeriesInstanceUID,
|
|
719
1005
|
SOPInstanceUID,
|
|
@@ -742,10 +1028,11 @@ function Bidirectional_getReport(mappedAnnotations, points, FrameOfReferenceUID)
|
|
|
742
1028
|
mappedAnnotations.forEach(annotation => {
|
|
743
1029
|
const {
|
|
744
1030
|
length,
|
|
745
|
-
width
|
|
1031
|
+
width,
|
|
1032
|
+
unit
|
|
746
1033
|
} = annotation;
|
|
747
|
-
columns.push(`Length
|
|
748
|
-
values.push(length, width);
|
|
1034
|
+
columns.push(`Length`, `Width`, 'Unit');
|
|
1035
|
+
values.push(length, width, unit);
|
|
749
1036
|
});
|
|
750
1037
|
if (FrameOfReferenceUID) {
|
|
751
1038
|
columns.push('FrameOfReferenceUID');
|
|
@@ -773,6 +1060,7 @@ function Bidirectional_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
773
1060
|
const {
|
|
774
1061
|
length,
|
|
775
1062
|
width,
|
|
1063
|
+
unit,
|
|
776
1064
|
SeriesNumber,
|
|
777
1065
|
SOPInstanceUID,
|
|
778
1066
|
frameNumber
|
|
@@ -786,22 +1074,11 @@ function Bidirectional_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
786
1074
|
}
|
|
787
1075
|
const instanceText = InstanceNumber ? ` I: ${InstanceNumber}` : '';
|
|
788
1076
|
const frameText = displaySet.isMultiFrame ? ` F: ${frameNumber}` : '';
|
|
789
|
-
displayText.push(`L: ${roundedLength}
|
|
790
|
-
displayText.push(`W: ${roundedWidth}
|
|
1077
|
+
displayText.push(`L: ${roundedLength} ${utils_getDisplayUnit(unit)} (S: ${SeriesNumber}${instanceText}${frameText})`);
|
|
1078
|
+
displayText.push(`W: ${roundedWidth} ${utils_getDisplayUnit(unit)}`);
|
|
791
1079
|
return displayText;
|
|
792
1080
|
}
|
|
793
1081
|
/* harmony default export */ const measurementServiceMappings_Bidirectional = (Bidirectional);
|
|
794
|
-
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/getModalityUnit.js
|
|
795
|
-
function getModalityUnit(modality) {
|
|
796
|
-
if (modality === 'CT') {
|
|
797
|
-
return 'HU';
|
|
798
|
-
} else if (modality === 'PT') {
|
|
799
|
-
return 'SUV';
|
|
800
|
-
} else {
|
|
801
|
-
return '';
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
/* harmony default export */ const utils_getModalityUnit = (getModalityUnit);
|
|
805
1082
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/EllipticalROI.ts
|
|
806
1083
|
|
|
807
1084
|
|
|
@@ -904,16 +1181,18 @@ function EllipticalROI_getMappedAnnotations(annotation, displaySetService) {
|
|
|
904
1181
|
stdDev,
|
|
905
1182
|
max,
|
|
906
1183
|
area,
|
|
907
|
-
Modality
|
|
1184
|
+
Modality,
|
|
1185
|
+
areaUnit,
|
|
1186
|
+
modalityUnit
|
|
908
1187
|
} = targetStats;
|
|
909
|
-
const unit = utils_getModalityUnit(Modality);
|
|
910
1188
|
annotations.push({
|
|
911
1189
|
SeriesInstanceUID,
|
|
912
1190
|
SOPInstanceUID,
|
|
913
1191
|
SeriesNumber,
|
|
914
1192
|
frameNumber,
|
|
915
1193
|
Modality,
|
|
916
|
-
unit,
|
|
1194
|
+
unit: modalityUnit,
|
|
1195
|
+
areaUnit,
|
|
917
1196
|
mean,
|
|
918
1197
|
stdDev,
|
|
919
1198
|
max,
|
|
@@ -941,13 +1220,14 @@ function EllipticalROI_getReport(mappedAnnotations, points, FrameOfReferenceUID)
|
|
|
941
1220
|
stdDev,
|
|
942
1221
|
max,
|
|
943
1222
|
area,
|
|
944
|
-
unit
|
|
1223
|
+
unit,
|
|
1224
|
+
areaUnit
|
|
945
1225
|
} = annotation;
|
|
946
1226
|
if (!mean || !unit || !max || !area) {
|
|
947
1227
|
return;
|
|
948
1228
|
}
|
|
949
|
-
columns.push(`max (${unit})`, `mean (${unit})`, `std (${unit})`,
|
|
950
|
-
values.push(max, mean, stdDev, area);
|
|
1229
|
+
columns.push(`max (${unit})`, `mean (${unit})`, `std (${unit})`, 'Area', 'Unit');
|
|
1230
|
+
values.push(max, mean, stdDev, area, areaUnit);
|
|
951
1231
|
});
|
|
952
1232
|
if (FrameOfReferenceUID) {
|
|
953
1233
|
columns.push('FrameOfReferenceUID');
|
|
@@ -975,7 +1255,8 @@ function EllipticalROI_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
975
1255
|
const {
|
|
976
1256
|
area,
|
|
977
1257
|
SOPInstanceUID,
|
|
978
|
-
frameNumber
|
|
1258
|
+
frameNumber,
|
|
1259
|
+
areaUnit
|
|
979
1260
|
} = mappedAnnotations[0];
|
|
980
1261
|
const instance = displaySet.images.find(image => image.SOPInstanceUID === SOPInstanceUID);
|
|
981
1262
|
let InstanceNumber;
|
|
@@ -984,10 +1265,8 @@ function EllipticalROI_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
984
1265
|
}
|
|
985
1266
|
const instanceText = InstanceNumber ? ` I: ${InstanceNumber}` : '';
|
|
986
1267
|
const frameText = displaySet.isMultiFrame ? ` F: ${frameNumber}` : '';
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
const roundedArea = src.utils.roundNumber(area || 0, 2);
|
|
990
|
-
displayText.push(`${roundedArea} mm<sup>2</sup>`);
|
|
1268
|
+
const roundedArea = src.utils.roundNumber(area, 2);
|
|
1269
|
+
displayText.push(`${roundedArea} ${utils_getDisplayUnit(areaUnit)}`);
|
|
991
1270
|
|
|
992
1271
|
// Todo: we need a better UI for displaying all these information
|
|
993
1272
|
mappedAnnotations.forEach(mappedAnnotation => {
|
|
@@ -999,7 +1278,7 @@ function EllipticalROI_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
999
1278
|
let maxStr = '';
|
|
1000
1279
|
if (max) {
|
|
1001
1280
|
const roundedMax = src.utils.roundNumber(max, 2);
|
|
1002
|
-
maxStr = `Max: ${roundedMax} <small>${unit}</small> `;
|
|
1281
|
+
maxStr = `Max: ${roundedMax} <small>${utils_getDisplayUnit(unit)}</small> `;
|
|
1003
1282
|
}
|
|
1004
1283
|
const str = `${maxStr}(S:${SeriesNumber}${instanceText}${frameText})`;
|
|
1005
1284
|
if (!displayText.includes(str)) {
|
|
@@ -1111,20 +1390,22 @@ function CircleROI_getMappedAnnotations(annotation, DisplaySetService) {
|
|
|
1111
1390
|
stdDev,
|
|
1112
1391
|
max,
|
|
1113
1392
|
area,
|
|
1114
|
-
Modality
|
|
1393
|
+
Modality,
|
|
1394
|
+
areaUnit,
|
|
1395
|
+
modalityUnit
|
|
1115
1396
|
} = targetStats;
|
|
1116
|
-
const unit = utils_getModalityUnit(Modality);
|
|
1117
1397
|
annotations.push({
|
|
1118
1398
|
SeriesInstanceUID,
|
|
1119
1399
|
SOPInstanceUID,
|
|
1120
1400
|
SeriesNumber,
|
|
1121
1401
|
frameNumber,
|
|
1122
1402
|
Modality,
|
|
1123
|
-
unit,
|
|
1403
|
+
unit: modalityUnit,
|
|
1124
1404
|
mean,
|
|
1125
1405
|
stdDev,
|
|
1126
1406
|
max,
|
|
1127
|
-
area
|
|
1407
|
+
area,
|
|
1408
|
+
areaUnit
|
|
1128
1409
|
});
|
|
1129
1410
|
});
|
|
1130
1411
|
return annotations;
|
|
@@ -1148,13 +1429,14 @@ function CircleROI_getReport(mappedAnnotations, points, FrameOfReferenceUID) {
|
|
|
1148
1429
|
stdDev,
|
|
1149
1430
|
max,
|
|
1150
1431
|
area,
|
|
1151
|
-
unit
|
|
1432
|
+
unit,
|
|
1433
|
+
areaUnit
|
|
1152
1434
|
} = annotation;
|
|
1153
1435
|
if (!mean || !unit || !max || !area) {
|
|
1154
1436
|
return;
|
|
1155
1437
|
}
|
|
1156
|
-
columns.push(`max (${unit})`, `mean (${unit})`, `std (${unit})`,
|
|
1157
|
-
values.push(max, mean, stdDev, area);
|
|
1438
|
+
columns.push(`max (${unit})`, `mean (${unit})`, `std (${unit})`, 'Area', 'Unit');
|
|
1439
|
+
values.push(max, mean, stdDev, area, areaUnit);
|
|
1158
1440
|
});
|
|
1159
1441
|
if (FrameOfReferenceUID) {
|
|
1160
1442
|
columns.push('FrameOfReferenceUID');
|
|
@@ -1182,7 +1464,8 @@ function CircleROI_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
1182
1464
|
const {
|
|
1183
1465
|
area,
|
|
1184
1466
|
SOPInstanceUID,
|
|
1185
|
-
frameNumber
|
|
1467
|
+
frameNumber,
|
|
1468
|
+
areaUnit
|
|
1186
1469
|
} = mappedAnnotations[0];
|
|
1187
1470
|
const instance = displaySet.images.find(image => image.SOPInstanceUID === SOPInstanceUID);
|
|
1188
1471
|
let InstanceNumber;
|
|
@@ -1194,7 +1477,7 @@ function CircleROI_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
1194
1477
|
|
|
1195
1478
|
// Area sometimes becomes undefined if `preventHandleOutsideImage` is off.
|
|
1196
1479
|
const roundedArea = src.utils.roundNumber(area || 0, 2);
|
|
1197
|
-
displayText.push(`${roundedArea}
|
|
1480
|
+
displayText.push(`${roundedArea} ${utils_getDisplayUnit(areaUnit)}`);
|
|
1198
1481
|
|
|
1199
1482
|
// Todo: we need a better UI for displaying all these information
|
|
1200
1483
|
mappedAnnotations.forEach(mappedAnnotation => {
|
|
@@ -1206,7 +1489,7 @@ function CircleROI_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
1206
1489
|
let maxStr = '';
|
|
1207
1490
|
if (max) {
|
|
1208
1491
|
const roundedMax = src.utils.roundNumber(max, 2);
|
|
1209
|
-
maxStr = `Max: ${roundedMax} <small>${unit}</small> `;
|
|
1492
|
+
maxStr = `Max: ${roundedMax} <small>${utils_getDisplayUnit(unit)}</small> `;
|
|
1210
1493
|
}
|
|
1211
1494
|
const str = `${maxStr}(S:${SeriesNumber}${instanceText}${frameText})`;
|
|
1212
1495
|
if (!displayText.includes(str)) {
|
|
@@ -1345,6 +1628,7 @@ function ArrowAnnotate_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
1345
1628
|
|
|
1346
1629
|
|
|
1347
1630
|
|
|
1631
|
+
|
|
1348
1632
|
const CobbAngle = {
|
|
1349
1633
|
toAnnotation: measurement => {},
|
|
1350
1634
|
/**
|
|
@@ -1515,9 +1799,11 @@ function CobbAngle_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
1515
1799
|
}
|
|
1516
1800
|
const instanceText = InstanceNumber ? ` I: ${InstanceNumber}` : '';
|
|
1517
1801
|
const frameText = displaySet.isMultiFrame ? ` F: ${frameNumber}` : '';
|
|
1518
|
-
if (angle === undefined)
|
|
1802
|
+
if (angle === undefined) {
|
|
1803
|
+
return displayText;
|
|
1804
|
+
}
|
|
1519
1805
|
const roundedAngle = src.utils.roundNumber(angle, 2);
|
|
1520
|
-
displayText.push(`${roundedAngle} ${unit} (S: ${SeriesNumber}${instanceText}${frameText})`);
|
|
1806
|
+
displayText.push(`${roundedAngle} ${utils_getDisplayUnit(unit)} (S: ${SeriesNumber}${instanceText}${frameText})`);
|
|
1521
1807
|
return displayText;
|
|
1522
1808
|
}
|
|
1523
1809
|
/* harmony default export */ const measurementServiceMappings_CobbAngle = (CobbAngle);
|
|
@@ -1525,6 +1811,7 @@ function CobbAngle_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
1525
1811
|
|
|
1526
1812
|
|
|
1527
1813
|
|
|
1814
|
+
|
|
1528
1815
|
const Angle = {
|
|
1529
1816
|
toAnnotation: measurement => {},
|
|
1530
1817
|
/**
|
|
@@ -1695,9 +1982,11 @@ function Angle_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
1695
1982
|
}
|
|
1696
1983
|
const instanceText = InstanceNumber ? ` I: ${InstanceNumber}` : '';
|
|
1697
1984
|
const frameText = displaySet.isMultiFrame ? ` F: ${frameNumber}` : '';
|
|
1698
|
-
if (angle === undefined)
|
|
1985
|
+
if (angle === undefined) {
|
|
1986
|
+
return displayText;
|
|
1987
|
+
}
|
|
1699
1988
|
const roundedAngle = src.utils.roundNumber(angle, 2);
|
|
1700
|
-
displayText.push(`${roundedAngle} ${unit} (S: ${SeriesNumber}${instanceText}${frameText})`);
|
|
1989
|
+
displayText.push(`${roundedAngle} ${utils_getDisplayUnit(unit)} (S: ${SeriesNumber}${instanceText}${frameText})`);
|
|
1701
1990
|
return displayText;
|
|
1702
1991
|
}
|
|
1703
1992
|
/* harmony default export */ const measurementServiceMappings_Angle = (Angle);
|
|
@@ -1937,20 +2226,22 @@ function RectangleROI_getMappedAnnotations(annotation, DisplaySetService) {
|
|
|
1937
2226
|
stdDev,
|
|
1938
2227
|
max,
|
|
1939
2228
|
area,
|
|
1940
|
-
Modality
|
|
2229
|
+
Modality,
|
|
2230
|
+
modalityUnit,
|
|
2231
|
+
areaUnit
|
|
1941
2232
|
} = targetStats;
|
|
1942
|
-
const unit = utils_getModalityUnit(Modality);
|
|
1943
2233
|
annotations.push({
|
|
1944
2234
|
SeriesInstanceUID,
|
|
1945
2235
|
SOPInstanceUID,
|
|
1946
2236
|
SeriesNumber,
|
|
1947
2237
|
frameNumber,
|
|
1948
2238
|
Modality,
|
|
1949
|
-
unit,
|
|
2239
|
+
unit: modalityUnit,
|
|
1950
2240
|
mean,
|
|
1951
2241
|
stdDev,
|
|
1952
2242
|
max,
|
|
1953
|
-
area
|
|
2243
|
+
area,
|
|
2244
|
+
areaUnit
|
|
1954
2245
|
});
|
|
1955
2246
|
});
|
|
1956
2247
|
return annotations;
|
|
@@ -1974,13 +2265,14 @@ function RectangleROI_getReport(mappedAnnotations, points, FrameOfReferenceUID)
|
|
|
1974
2265
|
stdDev,
|
|
1975
2266
|
max,
|
|
1976
2267
|
area,
|
|
1977
|
-
unit
|
|
2268
|
+
unit,
|
|
2269
|
+
areaUnit
|
|
1978
2270
|
} = annotation;
|
|
1979
2271
|
if (!mean || !unit || !max || !area) {
|
|
1980
2272
|
return;
|
|
1981
2273
|
}
|
|
1982
|
-
columns.push(`
|
|
1983
|
-
values.push(max, mean, stdDev, area);
|
|
2274
|
+
columns.push(`Maximum`, `Mean`, `Std Dev`, 'Pixel Unit', `Area`, 'Unit');
|
|
2275
|
+
values.push(max, mean, stdDev, unit, area, areaUnit);
|
|
1984
2276
|
});
|
|
1985
2277
|
if (FrameOfReferenceUID) {
|
|
1986
2278
|
columns.push('FrameOfReferenceUID');
|
|
@@ -2008,7 +2300,8 @@ function RectangleROI_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
2008
2300
|
const {
|
|
2009
2301
|
area,
|
|
2010
2302
|
SOPInstanceUID,
|
|
2011
|
-
frameNumber
|
|
2303
|
+
frameNumber,
|
|
2304
|
+
areaUnit
|
|
2012
2305
|
} = mappedAnnotations[0];
|
|
2013
2306
|
const instance = displaySet.images.find(image => image.SOPInstanceUID === SOPInstanceUID);
|
|
2014
2307
|
let InstanceNumber;
|
|
@@ -2020,7 +2313,7 @@ function RectangleROI_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
2020
2313
|
|
|
2021
2314
|
// Area sometimes becomes undefined if `preventHandleOutsideImage` is off.
|
|
2022
2315
|
const roundedArea = src.utils.roundNumber(area || 0, 2);
|
|
2023
|
-
displayText.push(`${roundedArea}
|
|
2316
|
+
displayText.push(`${roundedArea} ${utils_getDisplayUnit(areaUnit)}`);
|
|
2024
2317
|
|
|
2025
2318
|
// Todo: we need a better UI for displaying all these information
|
|
2026
2319
|
mappedAnnotations.forEach(mappedAnnotation => {
|
|
@@ -2032,7 +2325,7 @@ function RectangleROI_getDisplayText(mappedAnnotations, displaySet) {
|
|
|
2032
2325
|
let maxStr = '';
|
|
2033
2326
|
if (max) {
|
|
2034
2327
|
const roundedMax = src.utils.roundNumber(max, 2);
|
|
2035
|
-
maxStr = `Max: ${roundedMax} <small>${unit}</small> `;
|
|
2328
|
+
maxStr = `Max: ${roundedMax} <small>${utils_getDisplayUnit(unit)}</small> `;
|
|
2036
2329
|
}
|
|
2037
2330
|
const str = `${maxStr}(S:${SeriesNumber}${instanceText}${frameText})`;
|
|
2038
2331
|
if (!displayText.includes(str)) {
|
|
@@ -2515,7 +2808,7 @@ function getInterleavedFrames(imageIds) {
|
|
|
2515
2808
|
}
|
|
2516
2809
|
while (!prefetchQueuedFilled.currentPositionDownToMinimum || !prefetchQueuedFilled.currentPositionUpToMaximum) {
|
|
2517
2810
|
if (!prefetchQueuedFilled.currentPositionDownToMinimum) {
|
|
2518
|
-
// Add imageId
|
|
2811
|
+
// Add imageId below
|
|
2519
2812
|
lowerImageIdIndex--;
|
|
2520
2813
|
imageIdsToPrefetch.push({
|
|
2521
2814
|
imageId: imageIds[lowerImageIdIndex],
|
|
@@ -2540,7 +2833,7 @@ function getInterleavedFrames(imageIds) {
|
|
|
2540
2833
|
return imageIdsToPrefetch;
|
|
2541
2834
|
}
|
|
2542
2835
|
// EXTERNAL MODULE: ../../../node_modules/lodash/lodash.js
|
|
2543
|
-
var lodash = __webpack_require__(
|
|
2836
|
+
var lodash = __webpack_require__(44379);
|
|
2544
2837
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/interleaveCenterLoader.ts
|
|
2545
2838
|
|
|
2546
2839
|
|
|
@@ -2730,8 +3023,12 @@ function getNthFrames(imageIds) {
|
|
|
2730
3023
|
* @returns [] reordered to be breadth first traversal of lists
|
|
2731
3024
|
*/
|
|
2732
3025
|
function interleave(lists) {
|
|
2733
|
-
if (!lists || !lists.length)
|
|
2734
|
-
|
|
3026
|
+
if (!lists || !lists.length) {
|
|
3027
|
+
return [];
|
|
3028
|
+
}
|
|
3029
|
+
if (lists.length === 1) {
|
|
3030
|
+
return lists[0];
|
|
3031
|
+
}
|
|
2735
3032
|
console.time('interleave');
|
|
2736
3033
|
const useLists = [...lists];
|
|
2737
3034
|
const ret = [];
|
|
@@ -3004,6 +3301,7 @@ const DEFAULT_CONTEXT_MENU_CLICKS = {
|
|
|
3004
3301
|
commands: [{
|
|
3005
3302
|
commandName: 'showCornerstoneContextMenu',
|
|
3006
3303
|
commandOptions: {
|
|
3304
|
+
requireNearbyToolData: true,
|
|
3007
3305
|
menuId: 'measurementsContextMenu'
|
|
3008
3306
|
}
|
|
3009
3307
|
}]
|
|
@@ -3020,9 +3318,15 @@ const DEFAULT_CONTEXT_MENU_CLICKS = {
|
|
|
3020
3318
|
function getEventName(evt) {
|
|
3021
3319
|
const button = evt.detail.event.which;
|
|
3022
3320
|
const nameArr = [];
|
|
3023
|
-
if (evt.detail.event.altKey)
|
|
3024
|
-
|
|
3025
|
-
|
|
3321
|
+
if (evt.detail.event.altKey) {
|
|
3322
|
+
nameArr.push('alt');
|
|
3323
|
+
}
|
|
3324
|
+
if (evt.detail.event.ctrlKey) {
|
|
3325
|
+
nameArr.push('ctrl');
|
|
3326
|
+
}
|
|
3327
|
+
if (evt.detail.event.shiftKey) {
|
|
3328
|
+
nameArr.push('shift');
|
|
3329
|
+
}
|
|
3026
3330
|
nameArr.push('button');
|
|
3027
3331
|
nameArr.push(button);
|
|
3028
3332
|
return nameArr.join('');
|
|
@@ -3040,9 +3344,18 @@ function initContextMenu(_ref) {
|
|
|
3040
3344
|
const cornerstoneViewportHandleEvent = (name, evt) => {
|
|
3041
3345
|
const customizations = customizationService.get('cornerstoneViewportClickCommands') || DEFAULT_CONTEXT_MENU_CLICKS;
|
|
3042
3346
|
const toRun = customizations[name];
|
|
3043
|
-
|
|
3347
|
+
if (!toRun) {
|
|
3348
|
+
return;
|
|
3349
|
+
}
|
|
3350
|
+
|
|
3351
|
+
// only find nearbyToolData if required, for the click (which closes the context menu
|
|
3352
|
+
// we don't need to find nearbyToolData)
|
|
3353
|
+
let nearbyToolData = null;
|
|
3354
|
+
if (toRun.commands.some(command => command.commandOptions?.requireNearbyToolData)) {
|
|
3355
|
+
nearbyToolData = findNearbyToolData(commandsManager, evt);
|
|
3356
|
+
}
|
|
3044
3357
|
const options = {
|
|
3045
|
-
nearbyToolData
|
|
3358
|
+
nearbyToolData,
|
|
3046
3359
|
event: evt
|
|
3047
3360
|
};
|
|
3048
3361
|
commandsManager.run(toRun, options);
|
|
@@ -3057,10 +3370,11 @@ function initContextMenu(_ref) {
|
|
|
3057
3370
|
element
|
|
3058
3371
|
} = evt.detail;
|
|
3059
3372
|
const viewportInfo = cornerstoneViewportService.getViewportInfo(viewportId);
|
|
3060
|
-
if (!viewportInfo)
|
|
3061
|
-
|
|
3373
|
+
if (!viewportInfo) {
|
|
3374
|
+
return;
|
|
3375
|
+
}
|
|
3062
3376
|
// TODO check update upstream
|
|
3063
|
-
(0,state/* setEnabledElement */.Yc)(
|
|
3377
|
+
(0,state/* setEnabledElement */.Yc)(viewportId, element);
|
|
3064
3378
|
element.addEventListener(cs3DToolsEvents.MOUSE_CLICK, cornerstoneViewportHandleClick);
|
|
3065
3379
|
}
|
|
3066
3380
|
function elementDisabledHandler(evt) {
|
|
@@ -3094,9 +3408,15 @@ const DEFAULT_DOUBLE_CLICK = {
|
|
|
3094
3408
|
*/
|
|
3095
3409
|
function getDoubleClickEventName(evt) {
|
|
3096
3410
|
const nameArr = [];
|
|
3097
|
-
if (evt.detail.event.altKey)
|
|
3098
|
-
|
|
3099
|
-
|
|
3411
|
+
if (evt.detail.event.altKey) {
|
|
3412
|
+
nameArr.push('alt');
|
|
3413
|
+
}
|
|
3414
|
+
if (evt.detail.event.ctrlKey) {
|
|
3415
|
+
nameArr.push('ctrl');
|
|
3416
|
+
}
|
|
3417
|
+
if (evt.detail.event.shiftKey) {
|
|
3418
|
+
nameArr.push('shift');
|
|
3419
|
+
}
|
|
3100
3420
|
nameArr.push('doubleClick');
|
|
3101
3421
|
return nameArr.join('');
|
|
3102
3422
|
}
|
|
@@ -3137,6 +3457,49 @@ function initDoubleClick(_ref) {
|
|
|
3137
3457
|
esm.eventTarget.addEventListener(esm.EVENTS.ELEMENT_DISABLED, elementDisabledHandler.bind(null));
|
|
3138
3458
|
}
|
|
3139
3459
|
/* harmony default export */ const src_initDoubleClick = (initDoubleClick);
|
|
3460
|
+
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/initViewTiming.ts
|
|
3461
|
+
|
|
3462
|
+
|
|
3463
|
+
const {
|
|
3464
|
+
TimingEnum
|
|
3465
|
+
} = src.Types;
|
|
3466
|
+
const IMAGE_TIMING_KEYS = [TimingEnum.DISPLAY_SETS_TO_ALL_IMAGES, TimingEnum.DISPLAY_SETS_TO_FIRST_IMAGE, TimingEnum.STUDY_TO_FIRST_IMAGE];
|
|
3467
|
+
const imageTiming = {
|
|
3468
|
+
viewportsWaiting: 0
|
|
3469
|
+
};
|
|
3470
|
+
|
|
3471
|
+
/**
|
|
3472
|
+
* Defines the initial view timing reporting.
|
|
3473
|
+
* This allows knowing how many viewports are waiting for initial views and
|
|
3474
|
+
* when the IMAGE_RENDERED gets sent out.
|
|
3475
|
+
* The first image rendered will fire the FIRST_IMAGE timeEnd logs, while
|
|
3476
|
+
* the last of the enabled viewport will fire the ALL_IMAGES timeEnd logs.
|
|
3477
|
+
*
|
|
3478
|
+
*/
|
|
3479
|
+
|
|
3480
|
+
function initViewTiming(_ref) {
|
|
3481
|
+
let {
|
|
3482
|
+
element
|
|
3483
|
+
} = _ref;
|
|
3484
|
+
if (!IMAGE_TIMING_KEYS.find(key => src/* log */.cM.timingKeys[key])) {
|
|
3485
|
+
return;
|
|
3486
|
+
}
|
|
3487
|
+
imageTiming.viewportsWaiting += 1;
|
|
3488
|
+
element.addEventListener(esm.EVENTS.IMAGE_RENDERED, imageRenderedListener);
|
|
3489
|
+
}
|
|
3490
|
+
function imageRenderedListener(evt) {
|
|
3491
|
+
if (evt.detail.viewportStatus === 'preRender') {
|
|
3492
|
+
return;
|
|
3493
|
+
}
|
|
3494
|
+
src/* log */.cM.timeEnd(TimingEnum.DISPLAY_SETS_TO_FIRST_IMAGE);
|
|
3495
|
+
src/* log */.cM.timeEnd(TimingEnum.STUDY_TO_FIRST_IMAGE);
|
|
3496
|
+
src/* log */.cM.timeEnd(TimingEnum.SCRIPT_TO_VIEW);
|
|
3497
|
+
imageTiming.viewportsWaiting -= 1;
|
|
3498
|
+
evt.detail.element.removeEventListener(esm.EVENTS.IMAGE_RENDERED, imageRenderedListener);
|
|
3499
|
+
if (!imageTiming.viewportsWaiting) {
|
|
3500
|
+
src/* log */.cM.timeEnd(TimingEnum.DISPLAY_SETS_TO_ALL_IMAGES);
|
|
3501
|
+
}
|
|
3502
|
+
}
|
|
3140
3503
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/init.tsx
|
|
3141
3504
|
|
|
3142
3505
|
|
|
@@ -3155,6 +3518,7 @@ function initDoubleClick(_ref) {
|
|
|
3155
3518
|
|
|
3156
3519
|
|
|
3157
3520
|
|
|
3521
|
+
|
|
3158
3522
|
// TODO: Cypress tests are currently grabbing this from the window?
|
|
3159
3523
|
window.cornerstone = esm;
|
|
3160
3524
|
window.cornerstoneTools = dist_esm;
|
|
@@ -3169,7 +3533,24 @@ async function init(_ref) {
|
|
|
3169
3533
|
configuration,
|
|
3170
3534
|
appConfig
|
|
3171
3535
|
} = _ref;
|
|
3172
|
-
|
|
3536
|
+
// Note: this should run first before initializing the cornerstone
|
|
3537
|
+
// DO NOT CHANGE THE ORDER
|
|
3538
|
+
const value = appConfig.useSharedArrayBuffer;
|
|
3539
|
+
let sharedArrayBufferDisabled = false;
|
|
3540
|
+
if (value === 'AUTO') {
|
|
3541
|
+
esm.setUseSharedArrayBuffer(esm.Enums.SharedArrayBufferModes.AUTO);
|
|
3542
|
+
} else if (value === 'FALSE' || value === false) {
|
|
3543
|
+
esm.setUseSharedArrayBuffer(esm.Enums.SharedArrayBufferModes.FALSE);
|
|
3544
|
+
sharedArrayBufferDisabled = true;
|
|
3545
|
+
} else {
|
|
3546
|
+
esm.setUseSharedArrayBuffer(esm.Enums.SharedArrayBufferModes.TRUE);
|
|
3547
|
+
}
|
|
3548
|
+
await (0,esm.init)({
|
|
3549
|
+
rendering: {
|
|
3550
|
+
preferSizeOverAccuracy: Boolean(appConfig.use16BitDataType),
|
|
3551
|
+
useNorm16Texture: Boolean(appConfig.use16BitDataType)
|
|
3552
|
+
}
|
|
3553
|
+
});
|
|
3173
3554
|
|
|
3174
3555
|
// For debugging e2e tests that are failing on CI
|
|
3175
3556
|
esm.setUseCPURendering(Boolean(appConfig.useCPURendering));
|
|
@@ -3181,34 +3562,35 @@ async function init(_ref) {
|
|
|
3181
3562
|
}
|
|
3182
3563
|
});
|
|
3183
3564
|
|
|
3184
|
-
// For debugging large datasets
|
|
3185
|
-
const
|
|
3186
|
-
|
|
3187
|
-
|
|
3565
|
+
// For debugging large datasets, otherwise prefer the defaults
|
|
3566
|
+
const {
|
|
3567
|
+
maxCacheSize
|
|
3568
|
+
} = appConfig;
|
|
3569
|
+
if (maxCacheSize) {
|
|
3570
|
+
esm.cache.setMaxCacheSize(maxCacheSize);
|
|
3571
|
+
}
|
|
3188
3572
|
initCornerstoneTools();
|
|
3189
3573
|
esm.Settings.getRuntimeSettings().set('useCursors', Boolean(appConfig.useCursors));
|
|
3190
3574
|
const {
|
|
3191
3575
|
userAuthenticationService,
|
|
3192
|
-
measurementService,
|
|
3193
3576
|
customizationService,
|
|
3194
|
-
displaySetService,
|
|
3195
|
-
uiDialogService,
|
|
3196
3577
|
uiModalService,
|
|
3197
3578
|
uiNotificationService,
|
|
3198
3579
|
cineService,
|
|
3199
3580
|
cornerstoneViewportService,
|
|
3200
3581
|
hangingProtocolService,
|
|
3201
3582
|
toolGroupService,
|
|
3583
|
+
toolbarService,
|
|
3202
3584
|
viewportGridService,
|
|
3203
3585
|
stateSyncService
|
|
3204
3586
|
} = servicesManager.services;
|
|
3205
3587
|
window.services = servicesManager.services;
|
|
3206
3588
|
window.extensionManager = extensionManager;
|
|
3207
3589
|
window.commandsManager = commandsManager;
|
|
3208
|
-
if (appConfig.showWarningMessageForCrossOrigin && !window.crossOriginIsolated) {
|
|
3590
|
+
if (appConfig.showWarningMessageForCrossOrigin && !window.crossOriginIsolated && !sharedArrayBufferDisabled) {
|
|
3209
3591
|
uiNotificationService.show({
|
|
3210
3592
|
title: 'Cross Origin Isolation',
|
|
3211
|
-
message: 'Cross Origin Isolation is not enabled,
|
|
3593
|
+
message: 'Cross Origin Isolation is not enabled, read more about it here: https://docs.ohif.org/faq/',
|
|
3212
3594
|
type: 'warning'
|
|
3213
3595
|
});
|
|
3214
3596
|
}
|
|
@@ -3254,7 +3636,7 @@ async function init(_ref) {
|
|
|
3254
3636
|
thumbnail: appConfig?.maxNumRequests?.thumbnail || 75,
|
|
3255
3637
|
prefetch: appConfig?.maxNumRequests?.prefetch || 10
|
|
3256
3638
|
};
|
|
3257
|
-
initWADOImageLoader(userAuthenticationService, appConfig);
|
|
3639
|
+
initWADOImageLoader(userAuthenticationService, appConfig, extensionManager);
|
|
3258
3640
|
|
|
3259
3641
|
/* Measurement Service */
|
|
3260
3642
|
this.measurementServiceSource = connectToolsToMeasurementService(servicesManager);
|
|
@@ -3289,11 +3671,51 @@ async function init(_ref) {
|
|
|
3289
3671
|
customizationService,
|
|
3290
3672
|
commandsManager
|
|
3291
3673
|
});
|
|
3292
|
-
|
|
3674
|
+
|
|
3675
|
+
/**
|
|
3676
|
+
* When a viewport gets a new display set, this call will go through all the
|
|
3677
|
+
* active tools in the toolbar, and call any commands registered in the
|
|
3678
|
+
* toolbar service with a callback to re-enable on displaying the viewport.
|
|
3679
|
+
*/
|
|
3680
|
+
const toolbarEventListener = evt => {
|
|
3293
3681
|
const {
|
|
3294
3682
|
element
|
|
3295
3683
|
} = evt.detail;
|
|
3296
|
-
|
|
3684
|
+
const activeTools = toolbarService.getActiveTools();
|
|
3685
|
+
activeTools.forEach(tool => {
|
|
3686
|
+
const toolData = toolbarService.getNestedButton(tool);
|
|
3687
|
+
const commands = toolData?.listeners?.[evt.type];
|
|
3688
|
+
commandsManager.run(commands, {
|
|
3689
|
+
element,
|
|
3690
|
+
evt
|
|
3691
|
+
});
|
|
3692
|
+
});
|
|
3693
|
+
};
|
|
3694
|
+
|
|
3695
|
+
/** Listens for active viewport events and fires the toolbar listeners */
|
|
3696
|
+
const activeViewportEventListener = evt => {
|
|
3697
|
+
const {
|
|
3698
|
+
viewportId
|
|
3699
|
+
} = evt;
|
|
3700
|
+
const toolGroup = toolGroupService.getToolGroupForViewport(viewportId);
|
|
3701
|
+
const activeTools = toolbarService.getActiveTools();
|
|
3702
|
+
activeTools.forEach(tool => {
|
|
3703
|
+
if (!toolGroup?._toolInstances?.[tool]) {
|
|
3704
|
+
return;
|
|
3705
|
+
}
|
|
3706
|
+
|
|
3707
|
+
// check if tool is active on the new viewport
|
|
3708
|
+
const toolEnabled = toolGroup._toolInstances[tool].mode === dist_esm.Enums.ToolModes.Enabled;
|
|
3709
|
+
if (!toolEnabled) {
|
|
3710
|
+
return;
|
|
3711
|
+
}
|
|
3712
|
+
const button = toolbarService.getNestedButton(tool);
|
|
3713
|
+
const commands = button?.listeners?.[evt.type];
|
|
3714
|
+
commandsManager.run(commands, {
|
|
3715
|
+
viewportId,
|
|
3716
|
+
evt
|
|
3717
|
+
});
|
|
3718
|
+
});
|
|
3297
3719
|
};
|
|
3298
3720
|
const resetCrosshairs = evt => {
|
|
3299
3721
|
const {
|
|
@@ -3316,12 +3738,22 @@ async function init(_ref) {
|
|
|
3316
3738
|
toolGroup.setToolEnabled('Crosshairs');
|
|
3317
3739
|
}
|
|
3318
3740
|
};
|
|
3741
|
+
esm.eventTarget.addEventListener(esm.EVENTS.STACK_VIEWPORT_NEW_STACK, evt => {
|
|
3742
|
+
const {
|
|
3743
|
+
element
|
|
3744
|
+
} = evt.detail;
|
|
3745
|
+
dist_esm.utilities.stackContextPrefetch.enable(element);
|
|
3746
|
+
});
|
|
3319
3747
|
function elementEnabledHandler(evt) {
|
|
3320
3748
|
const {
|
|
3321
3749
|
element
|
|
3322
3750
|
} = evt.detail;
|
|
3323
3751
|
element.addEventListener(esm.EVENTS.CAMERA_RESET, resetCrosshairs);
|
|
3324
|
-
esm.eventTarget.addEventListener(esm.EVENTS.STACK_VIEWPORT_NEW_STACK,
|
|
3752
|
+
esm.eventTarget.addEventListener(esm.EVENTS.STACK_VIEWPORT_NEW_STACK, toolbarEventListener);
|
|
3753
|
+
initViewTiming({
|
|
3754
|
+
element,
|
|
3755
|
+
eventTarget: esm.eventTarget
|
|
3756
|
+
});
|
|
3325
3757
|
}
|
|
3326
3758
|
function elementDisabledHandler(evt) {
|
|
3327
3759
|
const {
|
|
@@ -3338,31 +3770,7 @@ async function init(_ref) {
|
|
|
3338
3770
|
|
|
3339
3771
|
esm.eventTarget.addEventListener(esm.EVENTS.ELEMENT_ENABLED, elementEnabledHandler.bind(null));
|
|
3340
3772
|
esm.eventTarget.addEventListener(esm.EVENTS.ELEMENT_DISABLED, elementDisabledHandler.bind(null));
|
|
3341
|
-
viewportGridService.subscribe(viewportGridService.EVENTS.
|
|
3342
|
-
let {
|
|
3343
|
-
viewportIndex,
|
|
3344
|
-
viewportId
|
|
3345
|
-
} = _ref2;
|
|
3346
|
-
viewportId = viewportId || `viewport-${viewportIndex}`;
|
|
3347
|
-
const toolGroup = toolGroupService.getToolGroupForViewport(viewportId);
|
|
3348
|
-
if (!toolGroup || !toolGroup._toolInstances?.['ReferenceLines']) {
|
|
3349
|
-
return;
|
|
3350
|
-
}
|
|
3351
|
-
|
|
3352
|
-
// check if reference lines are active
|
|
3353
|
-
const referenceLinesEnabled = toolGroup._toolInstances['ReferenceLines'].mode === dist_esm.Enums.ToolModes.Enabled;
|
|
3354
|
-
if (!referenceLinesEnabled) {
|
|
3355
|
-
return;
|
|
3356
|
-
}
|
|
3357
|
-
toolGroup.setToolConfiguration(dist_esm.ReferenceLinesTool.toolName, {
|
|
3358
|
-
sourceViewportId: viewportId
|
|
3359
|
-
}, true // overwrite
|
|
3360
|
-
);
|
|
3361
|
-
|
|
3362
|
-
// make sure to set it to enabled again since we want to recalculate
|
|
3363
|
-
// the source-target lines
|
|
3364
|
-
toolGroup.setToolEnabled(dist_esm.ReferenceLinesTool.toolName);
|
|
3365
|
-
});
|
|
3773
|
+
viewportGridService.subscribe(viewportGridService.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED, activeViewportEventListener);
|
|
3366
3774
|
}
|
|
3367
3775
|
function CPUModal() {
|
|
3368
3776
|
return /*#__PURE__*/react.createElement("div", null, /*#__PURE__*/react.createElement("p", null, "Your computer does not have enough GPU power to support the default GPU rendering mode. OHIF has switched to CPU rendering mode. Please note that CPU rendering does not support all features such as Volume Rendering, Multiplanar Reconstruction, and Segmentation Overlays."));
|
|
@@ -3387,12 +3795,12 @@ function _showCPURenderingModal(uiModalService, hangingProtocolService) {
|
|
|
3387
3795
|
});
|
|
3388
3796
|
}
|
|
3389
3797
|
// EXTERNAL MODULE: ../../../node_modules/react-dropzone/dist/es/index.js + 5 modules
|
|
3390
|
-
var es = __webpack_require__(
|
|
3798
|
+
var es = __webpack_require__(74834);
|
|
3391
3799
|
// EXTERNAL MODULE: ../../../node_modules/prop-types/index.js
|
|
3392
|
-
var prop_types = __webpack_require__(
|
|
3800
|
+
var prop_types = __webpack_require__(3827);
|
|
3393
3801
|
var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);
|
|
3394
3802
|
// EXTERNAL MODULE: ../../../node_modules/classnames/index.js
|
|
3395
|
-
var classnames = __webpack_require__(
|
|
3803
|
+
var classnames = __webpack_require__(44921);
|
|
3396
3804
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
3397
3805
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/DicomFileUploader.ts
|
|
3398
3806
|
|
|
@@ -3541,7 +3949,9 @@ class DicomFileUploader extends src/* PubSubService */.hC {
|
|
|
3541
3949
|
request.addEventListener('loadend', cleanUpCallback);
|
|
3542
3950
|
}
|
|
3543
3951
|
_checkDicomFile(arrayBuffer) {
|
|
3544
|
-
if (arrayBuffer.length <= 132)
|
|
3952
|
+
if (arrayBuffer.length <= 132) {
|
|
3953
|
+
return false;
|
|
3954
|
+
}
|
|
3545
3955
|
const arr = new Uint8Array(arrayBuffer.slice(128, 132));
|
|
3546
3956
|
// bytes from 128 to 132 must be "DICM"
|
|
3547
3957
|
return Array.from('DICM').every((char, i) => char.charCodeAt(0) === arr[i]);
|
|
@@ -3560,7 +3970,6 @@ const DicomUploadProgressItem = /*#__PURE__*/(0,react.memo)(_ref => {
|
|
|
3560
3970
|
const [percentComplete, setPercentComplete] = (0,react.useState)(dicomFileUploader.getPercentComplete());
|
|
3561
3971
|
const [failedReason, setFailedReason] = (0,react.useState)('');
|
|
3562
3972
|
const [status, setStatus] = (0,react.useState)(dicomFileUploader.getStatus());
|
|
3563
|
-
console.info(`${dicomFileUploader.getFileId()}`);
|
|
3564
3973
|
const isComplete = (0,react.useCallback)(() => {
|
|
3565
3974
|
return status === UploadStatus.Failed || status === UploadStatus.Cancelled || status === UploadStatus.Success;
|
|
3566
3975
|
}, [status]);
|
|
@@ -3601,25 +4010,25 @@ const DicomUploadProgressItem = /*#__PURE__*/(0,react.memo)(_ref => {
|
|
|
3601
4010
|
}
|
|
3602
4011
|
};
|
|
3603
4012
|
return /*#__PURE__*/react.createElement("div", {
|
|
3604
|
-
className: "
|
|
4013
|
+
className: "min-h-14 border-secondary-light flex w-full items-center overflow-hidden border-b p-2.5 text-lg"
|
|
3605
4014
|
}, /*#__PURE__*/react.createElement("div", {
|
|
3606
|
-
className: "
|
|
4015
|
+
className: "self-top flex w-0 shrink grow flex-col gap-1"
|
|
3607
4016
|
}, /*#__PURE__*/react.createElement("div", {
|
|
3608
4017
|
className: "flex gap-4"
|
|
3609
4018
|
}, /*#__PURE__*/react.createElement("div", {
|
|
3610
|
-
className: "flex w-6
|
|
4019
|
+
className: "flex w-6 shrink-0 items-center justify-center"
|
|
3611
4020
|
}, getStatusIcon()), /*#__PURE__*/react.createElement("div", {
|
|
3612
|
-
className: "text-ellipsis whitespace-nowrap
|
|
4021
|
+
className: "overflow-hidden text-ellipsis whitespace-nowrap"
|
|
3613
4022
|
}, dicomFileUploader.getFileName())), failedReason && /*#__PURE__*/react.createElement("div", {
|
|
3614
4023
|
className: "pl-10"
|
|
3615
4024
|
}, failedReason)), /*#__PURE__*/react.createElement("div", {
|
|
3616
|
-
className: "w-24
|
|
4025
|
+
className: "flex w-24 items-center"
|
|
3617
4026
|
}, !isComplete() && /*#__PURE__*/react.createElement(react.Fragment, null, dicomFileUploader.getStatus() === UploadStatus.InProgress && /*#__PURE__*/react.createElement("div", {
|
|
3618
4027
|
className: "w-10 text-right"
|
|
3619
4028
|
}, percentComplete, "%"), /*#__PURE__*/react.createElement("div", {
|
|
3620
|
-
className: "flex cursor-pointer
|
|
4029
|
+
className: "ml-auto flex cursor-pointer"
|
|
3621
4030
|
}, /*#__PURE__*/react.createElement(ui_src/* Icon */.JO, {
|
|
3622
|
-
className: "
|
|
4031
|
+
className: "text-primary-active self-center",
|
|
3623
4032
|
name: "close",
|
|
3624
4033
|
onClick: cancelUpload
|
|
3625
4034
|
})))));
|
|
@@ -3846,7 +4255,7 @@ function DicomUploadProgress(_ref) {
|
|
|
3846
4255
|
}, []);
|
|
3847
4256
|
const getNumCompletedAndTimeRemainingComponent = () => {
|
|
3848
4257
|
return /*#__PURE__*/react.createElement("div", {
|
|
3849
|
-
className: "
|
|
4258
|
+
className: "bg-primary-dark flex h-14 items-center px-1 pb-4 text-lg"
|
|
3850
4259
|
}, numFilesCompleted === dicomFileUploaderArr.length ? /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("span", {
|
|
3851
4260
|
className: NO_WRAP_ELLIPSIS_CLASS_NAMES
|
|
3852
4261
|
}, `${dicomFileUploaderArr.length} ${dicomFileUploaderArr.length > 1 ? 'files' : 'file'} completed.`), /*#__PURE__*/react.createElement(ui_src/* Button */.zx, {
|
|
@@ -3861,13 +4270,13 @@ function DicomUploadProgress(_ref) {
|
|
|
3861
4270
|
}, ' files completed.', "\xA0"), /*#__PURE__*/react.createElement("span", {
|
|
3862
4271
|
className: NO_WRAP_ELLIPSIS_CLASS_NAMES
|
|
3863
4272
|
}, timeRemaining ? `Less than ${getFormattedTimeRemaining()} remaining. ` : ''), /*#__PURE__*/react.createElement("span", {
|
|
3864
|
-
className: classnames_default()(NO_WRAP_ELLIPSIS_CLASS_NAMES, '
|
|
4273
|
+
className: classnames_default()(NO_WRAP_ELLIPSIS_CLASS_NAMES, 'text-primary-active hover:text-primary-light active:text-aqua-pale ml-auto cursor-pointer'),
|
|
3865
4274
|
onClick: cancelAllUploads
|
|
3866
4275
|
}, "Cancel All Uploads")));
|
|
3867
4276
|
};
|
|
3868
4277
|
const getShowFailedOnlyIconComponent = () => {
|
|
3869
4278
|
return /*#__PURE__*/react.createElement("div", {
|
|
3870
|
-
className: "ml-auto flex justify-center
|
|
4279
|
+
className: "ml-auto flex w-6 justify-center"
|
|
3871
4280
|
}, numFails > 0 && /*#__PURE__*/react.createElement("div", {
|
|
3872
4281
|
onClick: () => setShowFailedOnly(currentShowFailedOnly => !currentShowFailedOnly)
|
|
3873
4282
|
}, /*#__PURE__*/react.createElement(ui_src/* Icon */.JO, {
|
|
@@ -3877,28 +4286,28 @@ function DicomUploadProgress(_ref) {
|
|
|
3877
4286
|
};
|
|
3878
4287
|
const getPercentCompleteComponent = () => {
|
|
3879
4288
|
return /*#__PURE__*/react.createElement("div", {
|
|
3880
|
-
className: "overflow-y-scroll
|
|
4289
|
+
className: "ohif-scrollbar border-secondary-light overflow-y-scroll border-b px-2"
|
|
3881
4290
|
}, /*#__PURE__*/react.createElement("div", {
|
|
3882
|
-
className: "flex w-full p-2.5
|
|
4291
|
+
className: "min-h-14 flex w-full items-center p-2.5"
|
|
3883
4292
|
}, numFilesCompleted === dicomFileUploaderArr.length ? /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("div", {
|
|
3884
|
-
className: "text-
|
|
4293
|
+
className: "text-primary-light text-xl"
|
|
3885
4294
|
}, numFails > 0 ? `Completed with ${numFails} ${numFails > 1 ? 'errors' : 'error'}!` : 'Completed!'), getShowFailedOnlyIconComponent()) : /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("div", {
|
|
3886
4295
|
ref: progressBarContainerRef,
|
|
3887
4296
|
className: "flex-grow"
|
|
3888
4297
|
}, /*#__PURE__*/react.createElement(ui_src/* ProgressLoadingBar */.YE, {
|
|
3889
4298
|
progress: showInfiniteProgressBar() ? undefined : Math.min(100, percentComplete)
|
|
3890
4299
|
})), /*#__PURE__*/react.createElement("div", {
|
|
3891
|
-
className: "
|
|
4300
|
+
className: "ml-1 flex w-24 items-center"
|
|
3892
4301
|
}, /*#__PURE__*/react.createElement("div", {
|
|
3893
4302
|
className: "w-10 text-right"
|
|
3894
4303
|
}, `${getPercentCompleteRounded()}%`), getShowFailedOnlyIconComponent()))));
|
|
3895
4304
|
};
|
|
3896
4305
|
return /*#__PURE__*/react.createElement("div", {
|
|
3897
|
-
className: "flex flex-col
|
|
4306
|
+
className: "flex grow flex-col"
|
|
3898
4307
|
}, getNumCompletedAndTimeRemainingComponent(), /*#__PURE__*/react.createElement("div", {
|
|
3899
|
-
className: "flex flex-col bg-black text-lg
|
|
4308
|
+
className: "flex grow flex-col overflow-hidden bg-black text-lg"
|
|
3900
4309
|
}, getPercentCompleteComponent(), /*#__PURE__*/react.createElement("div", {
|
|
3901
|
-
className: "overflow-y-scroll
|
|
4310
|
+
className: "ohif-scrollbar h-1 grow overflow-y-scroll px-2"
|
|
3902
4311
|
}, dicomFileUploaderArr.filter(dicomFileUploader => !showFailedOnly || dicomFileUploader.getStatus() === UploadStatus.Failed).map(dicomFileUploader => /*#__PURE__*/react.createElement(DicomUpload_DicomUploadProgressItem, {
|
|
3903
4312
|
key: dicomFileUploader.getFileId(),
|
|
3904
4313
|
dicomFileUploader: dicomFileUploader
|
|
@@ -3945,7 +4354,7 @@ function DicomUpload(_ref) {
|
|
|
3945
4354
|
getRootProps
|
|
3946
4355
|
} = _ref2;
|
|
3947
4356
|
return /*#__PURE__*/react.createElement("div", _extends({}, getRootProps(), {
|
|
3948
|
-
className: "
|
|
4357
|
+
className: "dicom-upload-drop-area-border-dash m-5 flex h-full flex-col items-center justify-center"
|
|
3949
4358
|
}), /*#__PURE__*/react.createElement("div", {
|
|
3950
4359
|
className: "flex gap-3"
|
|
3951
4360
|
}, /*#__PURE__*/react.createElement(es/* default */.Z, {
|
|
@@ -3969,7 +4378,7 @@ function DicomUpload(_ref) {
|
|
|
3969
4378
|
getInputProps
|
|
3970
4379
|
} = _ref4;
|
|
3971
4380
|
return /*#__PURE__*/react.createElement("div", getRootProps(), /*#__PURE__*/react.createElement(ui_src/* Button */.zx, {
|
|
3972
|
-
type: ui_src/* ButtonEnums.type */.LZ.
|
|
4381
|
+
type: ui_src/* ButtonEnums.type */.LZ.dt.secondary,
|
|
3973
4382
|
disabled: false,
|
|
3974
4383
|
onClick: () => {}
|
|
3975
4384
|
}, 'Add folder', /*#__PURE__*/react.createElement("input", _extends({}, getInputProps(), {
|
|
@@ -3979,7 +4388,7 @@ function DicomUpload(_ref) {
|
|
|
3979
4388
|
})), /*#__PURE__*/react.createElement("div", {
|
|
3980
4389
|
className: "pt-5"
|
|
3981
4390
|
}, "or drag images or folders here"), /*#__PURE__*/react.createElement("div", {
|
|
3982
|
-
className: "
|
|
4391
|
+
className: "text-aqua-pale pt-3 text-lg"
|
|
3983
4392
|
}, "(DICOM files supported)"));
|
|
3984
4393
|
});
|
|
3985
4394
|
};
|
|
@@ -4043,7 +4452,7 @@ function getCustomizationModule() {
|
|
|
4043
4452
|
}
|
|
4044
4453
|
/* harmony default export */ const src_getCustomizationModule = (getCustomizationModule);
|
|
4045
4454
|
// EXTERNAL MODULE: ../../../node_modules/html2canvas/dist/html2canvas.esm.js
|
|
4046
|
-
var html2canvas_esm = __webpack_require__(
|
|
4455
|
+
var html2canvas_esm = __webpack_require__(76010);
|
|
4047
4456
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/CornerstoneViewportDownloadForm.tsx
|
|
4048
4457
|
|
|
4049
4458
|
|
|
@@ -4059,10 +4468,10 @@ const VIEWPORT_ID = 'cornerstone-viewport-download-form';
|
|
|
4059
4468
|
const CornerstoneViewportDownloadForm = _ref => {
|
|
4060
4469
|
let {
|
|
4061
4470
|
onClose,
|
|
4062
|
-
|
|
4471
|
+
activeViewportId: activeViewportIdProp,
|
|
4063
4472
|
cornerstoneViewportService
|
|
4064
4473
|
} = _ref;
|
|
4065
|
-
const enabledElement = (0,state/* getEnabledElement */.K8)(
|
|
4474
|
+
const enabledElement = (0,state/* getEnabledElement */.K8)(activeViewportIdProp);
|
|
4066
4475
|
const activeViewportElement = enabledElement?.element;
|
|
4067
4476
|
const activeViewportEnabledElement = (0,esm.getEnabledElement)(activeViewportElement);
|
|
4068
4477
|
const {
|
|
@@ -4181,13 +4590,18 @@ const CornerstoneViewportDownloadForm = _ref => {
|
|
|
4181
4590
|
const imageId = viewport.getCurrentImageId();
|
|
4182
4591
|
const properties = viewport.getProperties();
|
|
4183
4592
|
downloadViewport.setStack([imageId]).then(() => {
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4593
|
+
try {
|
|
4594
|
+
downloadViewport.setProperties(properties);
|
|
4595
|
+
const newWidth = Math.min(width || image.width, MAX_TEXTURE_SIZE);
|
|
4596
|
+
const newHeight = Math.min(height || image.height, MAX_TEXTURE_SIZE);
|
|
4597
|
+
resolve({
|
|
4598
|
+
width: newWidth,
|
|
4599
|
+
height: newHeight
|
|
4600
|
+
});
|
|
4601
|
+
} catch (e) {
|
|
4602
|
+
// Happens on clicking the cancel button
|
|
4603
|
+
console.warn('Unable to set properties', e);
|
|
4604
|
+
}
|
|
4191
4605
|
});
|
|
4192
4606
|
} else if (downloadViewport instanceof esm.VolumeViewport) {
|
|
4193
4607
|
const actors = viewport.getActors();
|
|
@@ -4264,74 +4678,75 @@ const CornerstoneViewportDownloadForm = _ref => {
|
|
|
4264
4678
|
};
|
|
4265
4679
|
CornerstoneViewportDownloadForm.propTypes = {
|
|
4266
4680
|
onClose: (prop_types_default()).func,
|
|
4267
|
-
|
|
4681
|
+
activeViewportId: (prop_types_default()).string.isRequired
|
|
4268
4682
|
};
|
|
4269
4683
|
/* harmony default export */ const utils_CornerstoneViewportDownloadForm = (CornerstoneViewportDownloadForm);
|
|
4270
|
-
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/stackSync/calculateViewportRegistrations.ts
|
|
4271
|
-
|
|
4272
|
-
function calculateViewportRegistrations(viewports) {
|
|
4273
|
-
const viewportPairs = _getViewportPairs(viewports);
|
|
4274
|
-
for (const [viewport, nextViewport] of viewportPairs) {
|
|
4275
|
-
// check if they are in the same Frame of Reference
|
|
4276
|
-
const renderingEngine1 = (0,esm.getRenderingEngine)(viewport.renderingEngineId);
|
|
4277
|
-
const renderingEngine2 = (0,esm.getRenderingEngine)(nextViewport.renderingEngineId);
|
|
4278
|
-
const csViewport1 = renderingEngine1.getViewport(viewport.viewportId);
|
|
4279
|
-
const csViewport2 = renderingEngine2.getViewport(nextViewport.viewportId);
|
|
4280
|
-
esm.utilities.calculateViewportsSpatialRegistration(csViewport1, csViewport2);
|
|
4281
|
-
}
|
|
4282
|
-
}
|
|
4283
|
-
const _getViewportPairs = viewports => {
|
|
4284
|
-
const viewportPairs = [];
|
|
4285
|
-
for (let i = 0; i < viewports.length; i++) {
|
|
4286
|
-
for (let j = i + 1; j < viewports.length; j++) {
|
|
4287
|
-
viewportPairs.push([viewports[i], viewports[j]]);
|
|
4288
|
-
}
|
|
4289
|
-
}
|
|
4290
|
-
return viewportPairs;
|
|
4291
|
-
};
|
|
4292
4684
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/stackSync/toggleStackImageSync.ts
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
// [ {
|
|
4296
|
-
// synchronizerId: string,
|
|
4297
|
-
// viewports: [ { viewportId: number, renderingEngineId: string, index: number } , ...]
|
|
4298
|
-
// ]}
|
|
4299
|
-
let STACK_IMAGE_SYNC_GROUPS_INFO = [];
|
|
4685
|
+
const STACK_SYNC_NAME = 'stackImageSync';
|
|
4300
4686
|
function toggleStackImageSync(_ref) {
|
|
4301
4687
|
let {
|
|
4302
4688
|
toggledState,
|
|
4303
4689
|
servicesManager,
|
|
4304
|
-
|
|
4690
|
+
viewports: providedViewports
|
|
4305
4691
|
} = _ref;
|
|
4692
|
+
if (!toggledState) {
|
|
4693
|
+
return disableSync(STACK_SYNC_NAME, servicesManager);
|
|
4694
|
+
}
|
|
4306
4695
|
const {
|
|
4307
4696
|
syncGroupService,
|
|
4308
4697
|
viewportGridService,
|
|
4309
4698
|
displaySetService,
|
|
4310
4699
|
cornerstoneViewportService
|
|
4311
4700
|
} = servicesManager.services;
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4701
|
+
const viewports = providedViewports || getReconstructableStackViewports(viewportGridService, displaySetService);
|
|
4702
|
+
|
|
4703
|
+
// create synchronization group and add the viewports to it.
|
|
4704
|
+
viewports.forEach(gridViewport => {
|
|
4705
|
+
const {
|
|
4706
|
+
viewportId
|
|
4707
|
+
} = gridViewport.viewportOptions;
|
|
4708
|
+
const viewport = cornerstoneViewportService.getCornerstoneViewport(viewportId);
|
|
4709
|
+
if (!viewport) {
|
|
4710
|
+
return;
|
|
4711
|
+
}
|
|
4712
|
+
syncGroupService.addViewportToSyncGroup(viewportId, viewport.getRenderingEngine().id, {
|
|
4713
|
+
type: 'stackimage',
|
|
4714
|
+
id: STACK_SYNC_NAME,
|
|
4715
|
+
source: true,
|
|
4716
|
+
target: true
|
|
4325
4717
|
});
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4718
|
+
});
|
|
4719
|
+
}
|
|
4720
|
+
function disableSync(syncName, servicesManager) {
|
|
4721
|
+
const {
|
|
4722
|
+
syncGroupService,
|
|
4723
|
+
viewportGridService,
|
|
4724
|
+
displaySetService,
|
|
4725
|
+
cornerstoneViewportService
|
|
4726
|
+
} = servicesManager.services;
|
|
4727
|
+
const viewports = getReconstructableStackViewports(viewportGridService, displaySetService);
|
|
4728
|
+
viewports.forEach(gridViewport => {
|
|
4729
|
+
const {
|
|
4730
|
+
viewportId
|
|
4731
|
+
} = gridViewport.viewportOptions;
|
|
4732
|
+
const viewport = cornerstoneViewportService.getCornerstoneViewport(viewportId);
|
|
4733
|
+
if (!viewport) {
|
|
4734
|
+
return;
|
|
4735
|
+
}
|
|
4736
|
+
syncGroupService.removeViewportFromSyncGroup(viewport.id, viewport.getRenderingEngine().id, syncName);
|
|
4737
|
+
});
|
|
4738
|
+
}
|
|
4739
|
+
;
|
|
4329
4740
|
|
|
4330
|
-
|
|
4741
|
+
/**
|
|
4742
|
+
* Gets the consistent spacing stack viewport types, which are the ones which
|
|
4743
|
+
* can be navigated using the stack image sync right now.
|
|
4744
|
+
*/
|
|
4745
|
+
function getReconstructableStackViewports(viewportGridService, displaySetService) {
|
|
4331
4746
|
let {
|
|
4332
4747
|
viewports
|
|
4333
4748
|
} = viewportGridService.getState();
|
|
4334
|
-
|
|
4749
|
+
viewports = [...viewports.values()];
|
|
4335
4750
|
// filter empty viewports
|
|
4336
4751
|
viewports = viewports.filter(viewport => viewport.displaySetInstanceUIDs && viewport.displaySetInstanceUIDs.length);
|
|
4337
4752
|
|
|
@@ -4342,103 +4757,17 @@ function toggleStackImageSync(_ref) {
|
|
|
4342
4757
|
} = viewport;
|
|
4343
4758
|
for (const displaySetInstanceUID of displaySetInstanceUIDs) {
|
|
4344
4759
|
const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
|
|
4760
|
+
|
|
4761
|
+
// TODO - add a better test than isReconstructable
|
|
4345
4762
|
if (displaySet && displaySet.isReconstructable) {
|
|
4346
4763
|
return true;
|
|
4347
4764
|
}
|
|
4348
4765
|
return false;
|
|
4349
4766
|
}
|
|
4350
4767
|
});
|
|
4351
|
-
|
|
4352
|
-
const {
|
|
4353
|
-
viewportId,
|
|
4354
|
-
viewportType
|
|
4355
|
-
} = viewport.viewportOptions;
|
|
4356
|
-
if (viewportType !== 'stack') {
|
|
4357
|
-
console.warn('Viewport is not a stack, cannot sync images yet');
|
|
4358
|
-
return acc;
|
|
4359
|
-
}
|
|
4360
|
-
const {
|
|
4361
|
-
element
|
|
4362
|
-
} = cornerstoneViewportService.getViewportInfo(viewportId);
|
|
4363
|
-
const {
|
|
4364
|
-
viewport: csViewport,
|
|
4365
|
-
renderingEngineId
|
|
4366
|
-
} = getEnabledElement(element);
|
|
4367
|
-
const {
|
|
4368
|
-
viewPlaneNormal
|
|
4369
|
-
} = csViewport.getCamera();
|
|
4370
|
-
|
|
4371
|
-
// Should we round here? I guess so, but not sure how much precision we need
|
|
4372
|
-
const orientation = viewPlaneNormal.map(v => Math.round(v)).join(',');
|
|
4373
|
-
if (!acc[orientation]) {
|
|
4374
|
-
acc[orientation] = [];
|
|
4375
|
-
}
|
|
4376
|
-
acc[orientation].push({
|
|
4377
|
-
viewportId,
|
|
4378
|
-
renderingEngineId
|
|
4379
|
-
});
|
|
4380
|
-
return acc;
|
|
4381
|
-
}, {});
|
|
4382
|
-
|
|
4383
|
-
// create synchronizer for each group
|
|
4384
|
-
Object.values(viewportsByOrientation).map(viewports => {
|
|
4385
|
-
let synchronizerId = viewports.map(_ref3 => {
|
|
4386
|
-
let {
|
|
4387
|
-
viewportId
|
|
4388
|
-
} = _ref3;
|
|
4389
|
-
return viewportId;
|
|
4390
|
-
}).join(',');
|
|
4391
|
-
synchronizerId = `imageSync_${synchronizerId}`;
|
|
4392
|
-
calculateViewportRegistrations(viewports);
|
|
4393
|
-
viewports.forEach(_ref4 => {
|
|
4394
|
-
let {
|
|
4395
|
-
viewportId,
|
|
4396
|
-
renderingEngineId
|
|
4397
|
-
} = _ref4;
|
|
4398
|
-
syncGroupService.addViewportToSyncGroup(viewportId, renderingEngineId, {
|
|
4399
|
-
type: 'stackimage',
|
|
4400
|
-
id: synchronizerId,
|
|
4401
|
-
source: true,
|
|
4402
|
-
target: true
|
|
4403
|
-
});
|
|
4404
|
-
});
|
|
4405
|
-
STACK_IMAGE_SYNC_GROUPS_INFO.push({
|
|
4406
|
-
synchronizerId,
|
|
4407
|
-
viewports
|
|
4408
|
-
});
|
|
4409
|
-
});
|
|
4768
|
+
return viewports;
|
|
4410
4769
|
}
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
/**
|
|
4415
|
-
* Check whether an annotation from imaging library is selected or not.
|
|
4416
|
-
* @param {string} annotationUID uid of imaging library annotation
|
|
4417
|
-
* @returns boolean
|
|
4418
|
-
*/
|
|
4419
|
-
function isAnnotationSelected(annotationUID) {
|
|
4420
|
-
return dist_esm.annotation.selection.isAnnotationSelected(annotationUID);
|
|
4421
|
-
}
|
|
4422
|
-
|
|
4423
|
-
/**
|
|
4424
|
-
* Change an annotation from imaging library's selected property.
|
|
4425
|
-
* @param annotationUID - uid of imaging library annotation
|
|
4426
|
-
* @param selected - new value for selected
|
|
4427
|
-
*/
|
|
4428
|
-
function setAnnotationSelected(annotationUID, selected) {
|
|
4429
|
-
const isCurrentSelected = isAnnotationSelected(annotationUID);
|
|
4430
|
-
// branch cut, avoid invoking imaging library unnecessarily.
|
|
4431
|
-
if (isCurrentSelected !== selected) {
|
|
4432
|
-
dist_esm.annotation.selection.setAnnotationSelected(annotationUID, selected);
|
|
4433
|
-
}
|
|
4434
|
-
}
|
|
4435
|
-
function getFirstAnnotationSelected(element) {
|
|
4436
|
-
const [selectedAnnotationUID] = dist_esm.annotation.selection.getAnnotationsSelected() || [];
|
|
4437
|
-
if (selectedAnnotationUID) {
|
|
4438
|
-
return dist_esm.annotation.state.getAnnotation(selectedAnnotationUID);
|
|
4439
|
-
}
|
|
4440
|
-
}
|
|
4441
|
-
|
|
4770
|
+
;
|
|
4442
4771
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/commandsModule.ts
|
|
4443
4772
|
|
|
4444
4773
|
|
|
@@ -4457,6 +4786,7 @@ function commandsModule(_ref) {
|
|
|
4457
4786
|
toolGroupService,
|
|
4458
4787
|
cineService,
|
|
4459
4788
|
toolbarService,
|
|
4789
|
+
stateSyncService,
|
|
4460
4790
|
uiDialogService,
|
|
4461
4791
|
cornerstoneViewportService,
|
|
4462
4792
|
uiNotificationService,
|
|
@@ -4650,8 +4980,7 @@ function commandsModule(_ref) {
|
|
|
4650
4980
|
console.warn('No viewport found for viewportId:', viewportId);
|
|
4651
4981
|
return;
|
|
4652
4982
|
}
|
|
4653
|
-
|
|
4654
|
-
viewportGridService.setActiveViewportIndex(viewportIndex);
|
|
4983
|
+
viewportGridService.setActiveViewportId(viewportId);
|
|
4655
4984
|
},
|
|
4656
4985
|
arrowTextCallback: _ref7 => {
|
|
4657
4986
|
let {
|
|
@@ -4716,10 +5045,16 @@ function commandsModule(_ref) {
|
|
|
4716
5045
|
toolbarServiceRecordInteraction: props => {
|
|
4717
5046
|
toolbarService.recordInteraction(props);
|
|
4718
5047
|
},
|
|
5048
|
+
// Enable or disable a toggleable command, without calling the activation
|
|
5049
|
+
// Used to setup already active tools from hanging protocols
|
|
5050
|
+
setToolbarToggled: props => {
|
|
5051
|
+
toolbarService.setToggled(props.toolId, props.isActive ?? true);
|
|
5052
|
+
},
|
|
4719
5053
|
setToolActive: _ref9 => {
|
|
4720
5054
|
let {
|
|
4721
5055
|
toolName,
|
|
4722
|
-
toolGroupId = null
|
|
5056
|
+
toolGroupId = null,
|
|
5057
|
+
toggledState
|
|
4723
5058
|
} = _ref9;
|
|
4724
5059
|
if (toolName === 'Crosshairs') {
|
|
4725
5060
|
const activeViewportToolGroup = toolGroupService.getToolGroup(null);
|
|
@@ -4735,9 +5070,10 @@ function commandsModule(_ref) {
|
|
|
4735
5070
|
}
|
|
4736
5071
|
const {
|
|
4737
5072
|
viewports
|
|
4738
|
-
} = viewportGridService.getState()
|
|
4739
|
-
|
|
4740
|
-
|
|
5073
|
+
} = viewportGridService.getState();
|
|
5074
|
+
if (!viewports.size) {
|
|
5075
|
+
return;
|
|
5076
|
+
}
|
|
4741
5077
|
const toolGroup = toolGroupService.getToolGroup(toolGroupId);
|
|
4742
5078
|
const toolGroupViewportIds = toolGroup?.getViewportIds?.();
|
|
4743
5079
|
|
|
@@ -4745,11 +5081,8 @@ function commandsModule(_ref) {
|
|
|
4745
5081
|
if (!toolGroupViewportIds || !toolGroupViewportIds.length) {
|
|
4746
5082
|
return;
|
|
4747
5083
|
}
|
|
4748
|
-
const filteredViewports = viewports.filter(viewport => {
|
|
4749
|
-
|
|
4750
|
-
return false;
|
|
4751
|
-
}
|
|
4752
|
-
return toolGroupViewportIds.includes(viewport.viewportOptions.viewportId);
|
|
5084
|
+
const filteredViewports = Array.from(viewports.values()).filter(viewport => {
|
|
5085
|
+
return toolGroupViewportIds.includes(viewport.viewportId);
|
|
4753
5086
|
});
|
|
4754
5087
|
if (!filteredViewports.length) {
|
|
4755
5088
|
return;
|
|
@@ -4773,6 +5106,14 @@ function commandsModule(_ref) {
|
|
|
4773
5106
|
toolGroup.setToolPassive(activeToolName);
|
|
4774
5107
|
}
|
|
4775
5108
|
}
|
|
5109
|
+
|
|
5110
|
+
// If there is a toggle state, then simply set the enabled/disabled state without
|
|
5111
|
+
// setting the tool active.
|
|
5112
|
+
if (toggledState != null) {
|
|
5113
|
+
toggledState ? toolGroup.setToolEnabled(toolName) : toolGroup.setToolDisabled(toolName);
|
|
5114
|
+
return;
|
|
5115
|
+
}
|
|
5116
|
+
|
|
4776
5117
|
// Set the new toolName to be active
|
|
4777
5118
|
toolGroup.setToolActive(toolName, {
|
|
4778
5119
|
bindings: [{
|
|
@@ -4782,9 +5123,9 @@ function commandsModule(_ref) {
|
|
|
4782
5123
|
},
|
|
4783
5124
|
showDownloadViewportModal: () => {
|
|
4784
5125
|
const {
|
|
4785
|
-
|
|
5126
|
+
activeViewportId
|
|
4786
5127
|
} = viewportGridService.getState();
|
|
4787
|
-
if (!cornerstoneViewportService.
|
|
5128
|
+
if (!cornerstoneViewportService.getCornerstoneViewport(activeViewportId)) {
|
|
4788
5129
|
// Cannot download a non-cornerstone viewport (image).
|
|
4789
5130
|
uiNotificationService.show({
|
|
4790
5131
|
title: 'Download Image',
|
|
@@ -4801,7 +5142,7 @@ function commandsModule(_ref) {
|
|
|
4801
5142
|
content: utils_CornerstoneViewportDownloadForm,
|
|
4802
5143
|
title: 'Download High Quality Image',
|
|
4803
5144
|
contentProps: {
|
|
4804
|
-
|
|
5145
|
+
activeViewportId,
|
|
4805
5146
|
onClose: uiModalService.hide,
|
|
4806
5147
|
cornerstoneViewportService
|
|
4807
5148
|
}
|
|
@@ -4882,15 +5223,13 @@ function commandsModule(_ref) {
|
|
|
4882
5223
|
const {
|
|
4883
5224
|
viewport
|
|
4884
5225
|
} = enabledElement;
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
viewport.render();
|
|
4893
|
-
}
|
|
5226
|
+
const {
|
|
5227
|
+
invert
|
|
5228
|
+
} = viewport.getProperties();
|
|
5229
|
+
viewport.setProperties({
|
|
5230
|
+
invert: !invert
|
|
5231
|
+
});
|
|
5232
|
+
viewport.render();
|
|
4894
5233
|
},
|
|
4895
5234
|
resetViewport: () => {
|
|
4896
5235
|
const enabledElement = _getActiveViewportEnabledElement();
|
|
@@ -4993,12 +5332,12 @@ function commandsModule(_ref) {
|
|
|
4993
5332
|
},
|
|
4994
5333
|
setViewportColormap: _ref15 => {
|
|
4995
5334
|
let {
|
|
4996
|
-
|
|
5335
|
+
viewportId,
|
|
4997
5336
|
displaySetInstanceUID,
|
|
4998
5337
|
colormap,
|
|
4999
5338
|
immediate = false
|
|
5000
5339
|
} = _ref15;
|
|
5001
|
-
const viewport = cornerstoneViewportService.
|
|
5340
|
+
const viewport = cornerstoneViewportService.getCornerstoneViewport(viewportId);
|
|
5002
5341
|
const actorEntries = viewport.getActors();
|
|
5003
5342
|
const actorEntry = actorEntries.find(actorEntry => {
|
|
5004
5343
|
return actorEntry.uid.includes(displaySetInstanceUID);
|
|
@@ -5015,51 +5354,53 @@ function commandsModule(_ref) {
|
|
|
5015
5354
|
viewport.render();
|
|
5016
5355
|
}
|
|
5017
5356
|
},
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
} = viewportGridService.getState();
|
|
5023
|
-
const nextViewportIndex = (activeViewportIndex + 1) % viewports.length;
|
|
5024
|
-
viewportGridService.setActiveViewportIndex(nextViewportIndex);
|
|
5025
|
-
},
|
|
5026
|
-
decrementActiveViewport: () => {
|
|
5357
|
+
changeActiveViewport: _ref16 => {
|
|
5358
|
+
let {
|
|
5359
|
+
direction = 1
|
|
5360
|
+
} = _ref16;
|
|
5027
5361
|
const {
|
|
5028
|
-
|
|
5362
|
+
activeViewportId,
|
|
5029
5363
|
viewports
|
|
5030
5364
|
} = viewportGridService.getState();
|
|
5031
|
-
const
|
|
5032
|
-
|
|
5365
|
+
const viewportIds = Array.from(viewports.keys());
|
|
5366
|
+
const currentIndex = viewportIds.indexOf(activeViewportId);
|
|
5367
|
+
const nextViewportIndex = (currentIndex + direction + viewportIds.length) % viewportIds.length;
|
|
5368
|
+
viewportGridService.setActiveViewportId(viewportIds[nextViewportIndex]);
|
|
5033
5369
|
},
|
|
5034
|
-
toggleStackImageSync:
|
|
5370
|
+
toggleStackImageSync: _ref17 => {
|
|
5035
5371
|
let {
|
|
5036
5372
|
toggledState
|
|
5037
|
-
} =
|
|
5373
|
+
} = _ref17;
|
|
5038
5374
|
toggleStackImageSync({
|
|
5039
|
-
getEnabledElement: esm.getEnabledElement,
|
|
5040
5375
|
servicesManager,
|
|
5041
5376
|
toggledState
|
|
5042
5377
|
});
|
|
5043
5378
|
},
|
|
5044
|
-
|
|
5379
|
+
setSourceViewportForReferenceLinesTool: _ref18 => {
|
|
5045
5380
|
let {
|
|
5046
|
-
toggledState
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
if (!toggledState) {
|
|
5055
|
-
toolGroup.setToolDisabled(dist_esm.ReferenceLinesTool.toolName);
|
|
5381
|
+
toggledState,
|
|
5382
|
+
viewportId
|
|
5383
|
+
} = _ref18;
|
|
5384
|
+
if (!viewportId) {
|
|
5385
|
+
const {
|
|
5386
|
+
activeViewportId
|
|
5387
|
+
} = viewportGridService.getState();
|
|
5388
|
+
viewportId = activeViewportId;
|
|
5056
5389
|
}
|
|
5390
|
+
const toolGroup = toolGroupService.getToolGroupForViewport(viewportId);
|
|
5057
5391
|
toolGroup.setToolConfiguration(dist_esm.ReferenceLinesTool.toolName, {
|
|
5058
5392
|
sourceViewportId: viewportId
|
|
5059
5393
|
}, true // overwrite
|
|
5060
5394
|
);
|
|
5395
|
+
},
|
|
5061
5396
|
|
|
5062
|
-
|
|
5397
|
+
storePresentation: _ref19 => {
|
|
5398
|
+
let {
|
|
5399
|
+
viewportId
|
|
5400
|
+
} = _ref19;
|
|
5401
|
+
cornerstoneViewportService.storePresentation({
|
|
5402
|
+
viewportId
|
|
5403
|
+
});
|
|
5063
5404
|
}
|
|
5064
5405
|
};
|
|
5065
5406
|
const definitions = {
|
|
@@ -5114,10 +5455,13 @@ function commandsModule(_ref) {
|
|
|
5114
5455
|
}
|
|
5115
5456
|
},
|
|
5116
5457
|
incrementActiveViewport: {
|
|
5117
|
-
commandFn: actions.
|
|
5458
|
+
commandFn: actions.changeActiveViewport
|
|
5118
5459
|
},
|
|
5119
5460
|
decrementActiveViewport: {
|
|
5120
|
-
commandFn: actions.
|
|
5461
|
+
commandFn: actions.changeActiveViewport,
|
|
5462
|
+
options: {
|
|
5463
|
+
direction: -1
|
|
5464
|
+
}
|
|
5121
5465
|
},
|
|
5122
5466
|
flipViewportHorizontal: {
|
|
5123
5467
|
commandFn: actions.flipViewportHorizontal
|
|
@@ -5194,8 +5538,14 @@ function commandsModule(_ref) {
|
|
|
5194
5538
|
toggleStackImageSync: {
|
|
5195
5539
|
commandFn: actions.toggleStackImageSync
|
|
5196
5540
|
},
|
|
5197
|
-
|
|
5198
|
-
commandFn: actions.
|
|
5541
|
+
setSourceViewportForReferenceLinesTool: {
|
|
5542
|
+
commandFn: actions.setSourceViewportForReferenceLinesTool
|
|
5543
|
+
},
|
|
5544
|
+
storePresentation: {
|
|
5545
|
+
commandFn: actions.storePresentation
|
|
5546
|
+
},
|
|
5547
|
+
setToolbarToggled: {
|
|
5548
|
+
commandFn: actions.setToolbarToggled
|
|
5199
5549
|
}
|
|
5200
5550
|
};
|
|
5201
5551
|
return {
|
|
@@ -5210,9 +5560,8 @@ const mpr = {
|
|
|
5210
5560
|
id: 'mpr',
|
|
5211
5561
|
name: 'Multi-Planar Reconstruction',
|
|
5212
5562
|
locked: true,
|
|
5213
|
-
hasUpdatedPriorsInformation: false,
|
|
5214
5563
|
createdDate: '2021-02-23',
|
|
5215
|
-
modifiedDate: '2023-
|
|
5564
|
+
modifiedDate: '2023-08-15',
|
|
5216
5565
|
availableTo: {},
|
|
5217
5566
|
editableBy: {},
|
|
5218
5567
|
// Unknown number of priors referenced - so just match any study
|
|
@@ -5283,6 +5632,7 @@ const mpr = {
|
|
|
5283
5632
|
},
|
|
5284
5633
|
viewports: [{
|
|
5285
5634
|
viewportOptions: {
|
|
5635
|
+
viewportId: 'mpr-axial',
|
|
5286
5636
|
toolGroupId: 'mpr',
|
|
5287
5637
|
viewportType: 'volume',
|
|
5288
5638
|
orientation: 'axial',
|
|
@@ -5301,6 +5651,7 @@ const mpr = {
|
|
|
5301
5651
|
}]
|
|
5302
5652
|
}, {
|
|
5303
5653
|
viewportOptions: {
|
|
5654
|
+
viewportId: 'mpr-sagittal',
|
|
5304
5655
|
toolGroupId: 'mpr',
|
|
5305
5656
|
viewportType: 'volume',
|
|
5306
5657
|
orientation: 'sagittal',
|
|
@@ -5319,6 +5670,7 @@ const mpr = {
|
|
|
5319
5670
|
}]
|
|
5320
5671
|
}, {
|
|
5321
5672
|
viewportOptions: {
|
|
5673
|
+
viewportId: 'mpr-coronal',
|
|
5322
5674
|
toolGroupId: 'mpr',
|
|
5323
5675
|
viewportType: 'volume',
|
|
5324
5676
|
orientation: 'coronal',
|
|
@@ -5341,7 +5693,6 @@ const mpr = {
|
|
|
5341
5693
|
const mprAnd3DVolumeViewport = {
|
|
5342
5694
|
id: 'mprAnd3DVolumeViewport',
|
|
5343
5695
|
locked: true,
|
|
5344
|
-
hasUpdatedPriorsInformation: false,
|
|
5345
5696
|
name: 'mpr',
|
|
5346
5697
|
createdDate: '2023-03-15T10:29:44.894Z',
|
|
5347
5698
|
modifiedDate: '2023-03-15T10:29:44.894Z',
|
|
@@ -5530,9 +5881,9 @@ class ToolGroupService {
|
|
|
5530
5881
|
return dist_esm.ToolGroupManager.getToolGroupForViewport(viewportId, renderingEngine.id);
|
|
5531
5882
|
}
|
|
5532
5883
|
getActiveToolForViewport(viewportId) {
|
|
5533
|
-
const toolGroup =
|
|
5884
|
+
const toolGroup = this.getToolGroupForViewport(viewportId);
|
|
5534
5885
|
if (!toolGroup) {
|
|
5535
|
-
return
|
|
5886
|
+
return;
|
|
5536
5887
|
}
|
|
5537
5888
|
return toolGroup.getActivePrimaryMouseButtonTool();
|
|
5538
5889
|
}
|
|
@@ -5595,9 +5946,8 @@ class ToolGroupService {
|
|
|
5595
5946
|
this._setToolsMode(toolGroup, tools);
|
|
5596
5947
|
}
|
|
5597
5948
|
createToolGroupAndAddTools(toolGroupId, tools) {
|
|
5598
|
-
let configs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
5599
5949
|
const toolGroup = this.createToolGroup(toolGroupId);
|
|
5600
|
-
this.addToolsToToolGroup(toolGroupId, tools
|
|
5950
|
+
this.addToolsToToolGroup(toolGroupId, tools);
|
|
5601
5951
|
return toolGroup;
|
|
5602
5952
|
}
|
|
5603
5953
|
|
|
@@ -5643,30 +5993,6 @@ class ToolGroupService {
|
|
|
5643
5993
|
const toolInstance = toolGroup.getToolInstance(toolName);
|
|
5644
5994
|
toolInstance.configuration = config;
|
|
5645
5995
|
}
|
|
5646
|
-
_getToolNames(toolGroupTools) {
|
|
5647
|
-
const toolNames = [];
|
|
5648
|
-
if (toolGroupTools.active) {
|
|
5649
|
-
toolGroupTools.active.forEach(tool => {
|
|
5650
|
-
toolNames.push(tool.toolName);
|
|
5651
|
-
});
|
|
5652
|
-
}
|
|
5653
|
-
if (toolGroupTools.passive) {
|
|
5654
|
-
toolGroupTools.passive.forEach(tool => {
|
|
5655
|
-
toolNames.push(tool.toolName);
|
|
5656
|
-
});
|
|
5657
|
-
}
|
|
5658
|
-
if (toolGroupTools.enabled) {
|
|
5659
|
-
toolGroupTools.enabled.forEach(tool => {
|
|
5660
|
-
toolNames.push(tool.toolName);
|
|
5661
|
-
});
|
|
5662
|
-
}
|
|
5663
|
-
if (toolGroupTools.disabled) {
|
|
5664
|
-
toolGroupTools.disabled.forEach(tool => {
|
|
5665
|
-
toolNames.push(tool.toolName);
|
|
5666
|
-
});
|
|
5667
|
-
}
|
|
5668
|
-
return toolNames;
|
|
5669
|
-
}
|
|
5670
5996
|
_setToolsMode(toolGroup, tools) {
|
|
5671
5997
|
const {
|
|
5672
5998
|
active,
|
|
@@ -5710,29 +6036,46 @@ class ToolGroupService {
|
|
|
5710
6036
|
});
|
|
5711
6037
|
}
|
|
5712
6038
|
}
|
|
5713
|
-
_addTools(toolGroup, tools
|
|
5714
|
-
const
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
6039
|
+
_addTools(toolGroup, tools) {
|
|
6040
|
+
const addTools = tools => {
|
|
6041
|
+
tools.forEach(_ref5 => {
|
|
6042
|
+
let {
|
|
6043
|
+
toolName,
|
|
6044
|
+
parentTool,
|
|
6045
|
+
configuration
|
|
6046
|
+
} = _ref5;
|
|
6047
|
+
if (parentTool) {
|
|
6048
|
+
toolGroup.addToolInstance(toolName, parentTool, {
|
|
6049
|
+
...configuration
|
|
6050
|
+
});
|
|
6051
|
+
} else {
|
|
6052
|
+
toolGroup.addTool(toolName, {
|
|
6053
|
+
...configuration
|
|
6054
|
+
});
|
|
6055
|
+
}
|
|
5725
6056
|
});
|
|
5726
|
-
}
|
|
6057
|
+
};
|
|
6058
|
+
if (tools.active) {
|
|
6059
|
+
addTools(tools.active);
|
|
6060
|
+
}
|
|
6061
|
+
if (tools.passive) {
|
|
6062
|
+
addTools(tools.passive);
|
|
6063
|
+
}
|
|
6064
|
+
if (tools.enabled) {
|
|
6065
|
+
addTools(tools.enabled);
|
|
6066
|
+
}
|
|
6067
|
+
if (tools.disabled) {
|
|
6068
|
+
addTools(tools.disabled);
|
|
6069
|
+
}
|
|
5727
6070
|
}
|
|
5728
6071
|
}
|
|
5729
6072
|
ToolGroupService.REGISTRATION = {
|
|
5730
6073
|
name: 'toolGroupService',
|
|
5731
6074
|
altName: 'ToolGroupService',
|
|
5732
|
-
create:
|
|
6075
|
+
create: _ref6 => {
|
|
5733
6076
|
let {
|
|
5734
6077
|
servicesManager
|
|
5735
|
-
} =
|
|
6078
|
+
} = _ref6;
|
|
5736
6079
|
return new ToolGroupService(servicesManager);
|
|
5737
6080
|
}
|
|
5738
6081
|
};
|
|
@@ -5789,7 +6132,7 @@ class SyncGroupService {
|
|
|
5789
6132
|
* @param type is the type of the synchronizer to create
|
|
5790
6133
|
* @param creator
|
|
5791
6134
|
*/
|
|
5792
|
-
|
|
6135
|
+
addSynchronizerType(type, creator) {
|
|
5793
6136
|
this.synchronizerCreators[type.toLowerCase()] = creator;
|
|
5794
6137
|
}
|
|
5795
6138
|
_getOrCreateSynchronizer(type, id, options) {
|
|
@@ -5867,10 +6210,10 @@ SyncGroupService.REGISTRATION = {
|
|
|
5867
6210
|
|
|
5868
6211
|
/* harmony default export */ const services_SyncGroupService = (SyncGroupService);
|
|
5869
6212
|
// EXTERNAL MODULE: ../../../node_modules/lodash.clonedeep/index.js
|
|
5870
|
-
var lodash_clonedeep = __webpack_require__(
|
|
6213
|
+
var lodash_clonedeep = __webpack_require__(11677);
|
|
5871
6214
|
var lodash_clonedeep_default = /*#__PURE__*/__webpack_require__.n(lodash_clonedeep);
|
|
5872
6215
|
// EXTERNAL MODULE: ../../../node_modules/lodash.isequal/index.js
|
|
5873
|
-
var lodash_isequal = __webpack_require__(
|
|
6216
|
+
var lodash_isequal = __webpack_require__(10311);
|
|
5874
6217
|
var lodash_isequal_default = /*#__PURE__*/__webpack_require__.n(lodash_isequal);
|
|
5875
6218
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/transitions.ts
|
|
5876
6219
|
/**
|
|
@@ -6026,6 +6369,82 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6026
6369
|
segmentation
|
|
6027
6370
|
});
|
|
6028
6371
|
};
|
|
6372
|
+
// Todo: this should not run on the main thread
|
|
6373
|
+
this.calculateCentroids = (segmentationId, segmentIndex) => {
|
|
6374
|
+
const segmentation = this.getSegmentation(segmentationId);
|
|
6375
|
+
const volume = this.getLabelmapVolume(segmentationId);
|
|
6376
|
+
const {
|
|
6377
|
+
dimensions,
|
|
6378
|
+
imageData
|
|
6379
|
+
} = volume;
|
|
6380
|
+
const scalarData = volume.getScalarData();
|
|
6381
|
+
const [dimX, dimY, numFrames] = dimensions;
|
|
6382
|
+
const frameLength = dimX * dimY;
|
|
6383
|
+
const segmentIndices = segmentIndex ? [segmentIndex] : segmentation.segments.filter(segment => segment?.segmentIndex).map(segment => segment.segmentIndex);
|
|
6384
|
+
const segmentIndicesSet = new Set(segmentIndices);
|
|
6385
|
+
const centroids = new Map();
|
|
6386
|
+
for (const index of segmentIndicesSet) {
|
|
6387
|
+
centroids.set(index, {
|
|
6388
|
+
x: 0,
|
|
6389
|
+
y: 0,
|
|
6390
|
+
z: 0,
|
|
6391
|
+
count: 0
|
|
6392
|
+
});
|
|
6393
|
+
}
|
|
6394
|
+
let voxelIndex = 0;
|
|
6395
|
+
for (let frame = 0; frame < numFrames; frame++) {
|
|
6396
|
+
for (let p = 0; p < frameLength; p++) {
|
|
6397
|
+
const segmentIndex = scalarData[voxelIndex++];
|
|
6398
|
+
if (segmentIndicesSet.has(segmentIndex)) {
|
|
6399
|
+
const centroid = centroids.get(segmentIndex);
|
|
6400
|
+
centroid.x += p % dimX;
|
|
6401
|
+
centroid.y += p / dimX | 0;
|
|
6402
|
+
centroid.z += frame;
|
|
6403
|
+
centroid.count++;
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6406
|
+
}
|
|
6407
|
+
const result = new Map();
|
|
6408
|
+
for (const [index, centroid] of centroids) {
|
|
6409
|
+
const count = centroid.count;
|
|
6410
|
+
const normalizedCentroid = {
|
|
6411
|
+
x: centroid.x / count,
|
|
6412
|
+
y: centroid.y / count,
|
|
6413
|
+
z: centroid.z / count
|
|
6414
|
+
};
|
|
6415
|
+
normalizedCentroid.world = imageData.indexToWorld([normalizedCentroid.x, normalizedCentroid.y, normalizedCentroid.z]);
|
|
6416
|
+
result.set(index, normalizedCentroid);
|
|
6417
|
+
}
|
|
6418
|
+
this.setCentroids(segmentationId, result);
|
|
6419
|
+
return result;
|
|
6420
|
+
};
|
|
6421
|
+
this.setCentroids = (segmentationId, centroids) => {
|
|
6422
|
+
const segmentation = this.getSegmentation(segmentationId);
|
|
6423
|
+
const imageData = this.getLabelmapVolume(segmentationId).imageData; // Assuming this method returns imageData
|
|
6424
|
+
|
|
6425
|
+
if (!segmentation.cachedStats) {
|
|
6426
|
+
segmentation.cachedStats = {
|
|
6427
|
+
segmentCenter: {}
|
|
6428
|
+
};
|
|
6429
|
+
} else if (!segmentation.cachedStats.segmentCenter) {
|
|
6430
|
+
segmentation.cachedStats.segmentCenter = {};
|
|
6431
|
+
}
|
|
6432
|
+
for (const [segmentIndex, centroid] of centroids) {
|
|
6433
|
+
let world = centroid.world;
|
|
6434
|
+
|
|
6435
|
+
// If world coordinates are not provided, calculate them
|
|
6436
|
+
if (!world || world.length === 0) {
|
|
6437
|
+
world = imageData.indexToWorld(centroid.image);
|
|
6438
|
+
}
|
|
6439
|
+
segmentation.cachedStats.segmentCenter[segmentIndex] = {
|
|
6440
|
+
center: {
|
|
6441
|
+
image: centroid.image,
|
|
6442
|
+
world: world
|
|
6443
|
+
}
|
|
6444
|
+
};
|
|
6445
|
+
}
|
|
6446
|
+
this.addOrUpdateSegmentation(segmentation, true, true);
|
|
6447
|
+
};
|
|
6029
6448
|
this.createSegmentationForDisplaySet = async (displaySetInstanceUID, options) => {
|
|
6030
6449
|
const {
|
|
6031
6450
|
displaySetService
|
|
@@ -6055,6 +6474,7 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6055
6474
|
// We should set it as active by default, as it created for display
|
|
6056
6475
|
isActive: true,
|
|
6057
6476
|
type: representationType,
|
|
6477
|
+
FrameOfReferenceUID: options?.FrameOfReferenceUID || displaySet.instances?.[0]?.FrameOfReferenceUID,
|
|
6058
6478
|
representationData: {
|
|
6059
6479
|
LABELMAP: {
|
|
6060
6480
|
volumeId: segmentationId,
|
|
@@ -6078,6 +6498,7 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6078
6498
|
this.addSegmentationRepresentationToToolGroup = async function (toolGroupId, segmentationId) {
|
|
6079
6499
|
let hydrateSegmentation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
6080
6500
|
let representationType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : dist_esm.Enums.SegmentationRepresentations.Labelmap;
|
|
6501
|
+
let suppressEvents = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
6081
6502
|
const segmentation = _this.getSegmentation(segmentationId);
|
|
6082
6503
|
if (!segmentation) {
|
|
6083
6504
|
throw new Error(`Segmentation with segmentationId ${segmentationId} not found.`);
|
|
@@ -6122,12 +6543,17 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6122
6543
|
if (visibility !== undefined) {
|
|
6123
6544
|
_this._setSegmentVisibility(segmentationId, segmentIndex, visibility, toolGroupId, suppressEvents);
|
|
6124
6545
|
}
|
|
6125
|
-
if (isLocked
|
|
6546
|
+
if (isLocked) {
|
|
6126
6547
|
_this._setSegmentLocked(segmentationId, segmentIndex, isLocked, suppressEvents);
|
|
6127
6548
|
}
|
|
6128
6549
|
}
|
|
6550
|
+
if (!suppressEvents) {
|
|
6551
|
+
_this._broadcastEvent(_this.EVENTS.SEGMENTATION_UPDATED, {
|
|
6552
|
+
segmentation
|
|
6553
|
+
});
|
|
6554
|
+
}
|
|
6129
6555
|
};
|
|
6130
|
-
this.
|
|
6556
|
+
this.setSegmentRGBAColor = (segmentationId, segmentIndex, rgbaColor, toolGroupId) => {
|
|
6131
6557
|
const segmentation = this.getSegmentation(segmentationId);
|
|
6132
6558
|
if (segmentation === undefined) {
|
|
6133
6559
|
throw new Error(`no segmentation for segmentationId: ${segmentationId}`);
|
|
@@ -6153,6 +6579,9 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6153
6579
|
throw new Error(`Segmentation with segmentationId ${segmentationId} not found.`);
|
|
6154
6580
|
}
|
|
6155
6581
|
segmentation.hydrated = true;
|
|
6582
|
+
|
|
6583
|
+
// Not all segmentations have dipslaysets, some of them are derived in the client
|
|
6584
|
+
_this._setDisplaySetIsHydrated(segmentationId, true);
|
|
6156
6585
|
if (!suppressEvents) {
|
|
6157
6586
|
_this._broadcastEvent(_this.EVENTS.SEGMENTATION_UPDATED, {
|
|
6158
6587
|
segmentation
|
|
@@ -6467,34 +6896,40 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6467
6896
|
this._initSegmentationService();
|
|
6468
6897
|
}
|
|
6469
6898
|
/**
|
|
6470
|
-
*
|
|
6471
|
-
* the segment.
|
|
6472
|
-
* @param
|
|
6473
|
-
* segment to.
|
|
6474
|
-
*
|
|
6475
|
-
*
|
|
6476
|
-
*
|
|
6477
|
-
*
|
|
6478
|
-
*
|
|
6479
|
-
*
|
|
6480
|
-
*
|
|
6481
|
-
*
|
|
6899
|
+
* Adds a new segment to the specified segmentation.
|
|
6900
|
+
* @param segmentationId - The ID of the segmentation to add the segment to.
|
|
6901
|
+
* @param config - An object containing the configuration options for the new segment.
|
|
6902
|
+
* - segmentIndex: (optional) The index of the segment to add. If not provided, the next available index will be used.
|
|
6903
|
+
* - toolGroupId: (optional) The ID of the tool group to associate the new segment with. If not provided, the first available tool group will be used.
|
|
6904
|
+
* - properties: (optional) An object containing the properties of the new segment.
|
|
6905
|
+
* - label: (optional) The label of the new segment. If not provided, a default label will be used.
|
|
6906
|
+
* - color: (optional) The color of the new segment in RGB format. If not provided, a default color will be used.
|
|
6907
|
+
* - opacity: (optional) The opacity of the new segment. If not provided, a default opacity will be used.
|
|
6908
|
+
* - visibility: (optional) Whether the new segment should be visible. If not provided, the segment will be visible by default.
|
|
6909
|
+
* - isLocked: (optional) Whether the new segment should be locked for editing. If not provided, the segment will not be locked by default.
|
|
6910
|
+
* - active: (optional) Whether the new segment should be the active segment to be edited. If not provided, the segment will not be active by default.
|
|
6482
6911
|
*/
|
|
6483
|
-
addSegment(segmentationId
|
|
6484
|
-
|
|
6912
|
+
addSegment(segmentationId) {
|
|
6913
|
+
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6914
|
+
if (config?.segmentIndex === 0) {
|
|
6485
6915
|
throw new Error('Segment index 0 is reserved for "no label"');
|
|
6486
6916
|
}
|
|
6487
|
-
toolGroupId = toolGroupId ?? this._getFirstToolGroupId();
|
|
6917
|
+
const toolGroupId = config.toolGroupId ?? this._getFirstToolGroupId();
|
|
6488
6918
|
const {
|
|
6489
6919
|
segmentationRepresentationUID,
|
|
6490
6920
|
segmentation
|
|
6491
6921
|
} = this._getSegmentationInfo(segmentationId, toolGroupId);
|
|
6922
|
+
let segmentIndex = config.segmentIndex;
|
|
6923
|
+
if (!segmentIndex) {
|
|
6924
|
+
// grab the next available segment index
|
|
6925
|
+
segmentIndex = segmentation.segments.length === 0 ? 1 : segmentation.segments.length;
|
|
6926
|
+
}
|
|
6492
6927
|
if (this._getSegmentInfo(segmentation, segmentIndex)) {
|
|
6493
6928
|
throw new Error(`Segment ${segmentIndex} already exists`);
|
|
6494
6929
|
}
|
|
6495
6930
|
const rgbaColor = dist_esm.segmentation.config.color.getColorForSegmentIndex(toolGroupId, segmentationRepresentationUID, segmentIndex);
|
|
6496
6931
|
segmentation.segments[segmentIndex] = {
|
|
6497
|
-
label: properties
|
|
6932
|
+
label: config.properties?.label ?? `Segment ${segmentIndex}`,
|
|
6498
6933
|
segmentIndex: segmentIndex,
|
|
6499
6934
|
color: [rgbaColor[0], rgbaColor[1], rgbaColor[2]],
|
|
6500
6935
|
opacity: rgbaColor[3],
|
|
@@ -6502,15 +6937,18 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6502
6937
|
isLocked: false
|
|
6503
6938
|
};
|
|
6504
6939
|
segmentation.segmentCount++;
|
|
6940
|
+
|
|
6941
|
+
// make the newly added segment the active segment
|
|
6942
|
+
this._setActiveSegment(segmentationId, segmentIndex);
|
|
6505
6943
|
const suppressEvents = true;
|
|
6506
|
-
if (properties !== undefined) {
|
|
6944
|
+
if (config.properties !== undefined) {
|
|
6507
6945
|
const {
|
|
6508
6946
|
color: newColor,
|
|
6509
6947
|
opacity,
|
|
6510
6948
|
isLocked,
|
|
6511
6949
|
visibility,
|
|
6512
6950
|
active
|
|
6513
|
-
} = properties;
|
|
6951
|
+
} = config.properties;
|
|
6514
6952
|
if (newColor !== undefined) {
|
|
6515
6953
|
this._setSegmentColor(segmentationId, segmentIndex, newColor, toolGroupId, suppressEvents);
|
|
6516
6954
|
}
|
|
@@ -6590,12 +7028,21 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6590
7028
|
let suppressEvents = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
6591
7029
|
this._setSegmentVisibility(segmentationId, segmentIndex, isVisible, toolGroupId, suppressEvents);
|
|
6592
7030
|
}
|
|
6593
|
-
|
|
7031
|
+
setSegmentLocked(segmentationId, segmentIndex, isLocked) {
|
|
6594
7032
|
const suppressEvents = false;
|
|
6595
7033
|
this._setSegmentLocked(segmentationId, segmentIndex, isLocked, suppressEvents);
|
|
6596
7034
|
}
|
|
6597
|
-
|
|
6598
|
-
|
|
7035
|
+
|
|
7036
|
+
/**
|
|
7037
|
+
* Toggles the locked state of a segment in a segmentation.
|
|
7038
|
+
* @param segmentationId - The ID of the segmentation.
|
|
7039
|
+
* @param segmentIndex - The index of the segment to toggle.
|
|
7040
|
+
*/
|
|
7041
|
+
toggleSegmentLocked(segmentationId, segmentIndex) {
|
|
7042
|
+
const segmentation = this.getSegmentation(segmentationId);
|
|
7043
|
+
const segment = this._getSegmentInfo(segmentation, segmentIndex);
|
|
7044
|
+
const isLocked = !segment.isLocked;
|
|
7045
|
+
this._setSegmentLocked(segmentationId, segmentIndex, isLocked);
|
|
6599
7046
|
}
|
|
6600
7047
|
setSegmentColor(segmentationId, segmentIndex, color, toolGroupId) {
|
|
6601
7048
|
this._setSegmentColor(segmentationId, segmentIndex, color, toolGroupId);
|
|
@@ -6608,7 +7055,7 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6608
7055
|
const suppressEvents = false;
|
|
6609
7056
|
this._setActiveSegmentationForToolGroup(segmentationId, toolGroupId, suppressEvents);
|
|
6610
7057
|
}
|
|
6611
|
-
|
|
7058
|
+
setActiveSegment(segmentationId, segmentIndex) {
|
|
6612
7059
|
this._setActiveSegment(segmentationId, segmentIndex, false);
|
|
6613
7060
|
}
|
|
6614
7061
|
|
|
@@ -6677,11 +7124,14 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6677
7124
|
}
|
|
6678
7125
|
}]);
|
|
6679
7126
|
|
|
6680
|
-
//
|
|
6681
|
-
//
|
|
6682
|
-
const
|
|
6683
|
-
|
|
6684
|
-
|
|
7127
|
+
// if first segmentation, we can use the default colorLUT, otherwise
|
|
7128
|
+
// we need to generate a new one and use a new colorLUT
|
|
7129
|
+
const colorLUTIndex = 0;
|
|
7130
|
+
if (Object.keys(this.segmentations).length !== 0) {
|
|
7131
|
+
const newColorLUT = this.generateNewColorLUT();
|
|
7132
|
+
const colorLUTIndex = this.getNextColorLUTIndex();
|
|
7133
|
+
dist_esm.segmentation.config.color.addColorLUT(newColorLUT, colorLUTIndex);
|
|
7134
|
+
}
|
|
6685
7135
|
this.segmentations[segmentationId] = {
|
|
6686
7136
|
...segmentation,
|
|
6687
7137
|
label: segmentation.label || '',
|
|
@@ -6689,8 +7139,8 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6689
7139
|
activeSegmentIndex: segmentation.activeSegmentIndex ?? null,
|
|
6690
7140
|
segmentCount: segmentation.segmentCount ?? 0,
|
|
6691
7141
|
isActive: false,
|
|
6692
|
-
|
|
6693
|
-
|
|
7142
|
+
isVisible: true,
|
|
7143
|
+
colorLUTIndex
|
|
6694
7144
|
};
|
|
6695
7145
|
cachedSegmentation = this.segmentations[segmentationId];
|
|
6696
7146
|
this._updateCornerstoneSegmentations({
|
|
@@ -6715,6 +7165,7 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6715
7165
|
id: segmentationId,
|
|
6716
7166
|
displaySetInstanceUID: segDisplaySet.displaySetInstanceUID,
|
|
6717
7167
|
type: representationType,
|
|
7168
|
+
label: segDisplaySet.SeriesDescription,
|
|
6718
7169
|
representationData: {
|
|
6719
7170
|
[LABELMAP]: {
|
|
6720
7171
|
volumeId: segmentationId,
|
|
@@ -6731,11 +7182,11 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6731
7182
|
return this.addOrUpdateSegmentation(Object.assign(segmentation, cachedSegmentation), suppressEvents);
|
|
6732
7183
|
}
|
|
6733
7184
|
const {
|
|
6734
|
-
|
|
7185
|
+
labelmapBufferArray,
|
|
6735
7186
|
referencedVolumeId
|
|
6736
7187
|
} = segDisplaySet;
|
|
6737
|
-
if (!
|
|
6738
|
-
throw new Error('
|
|
7188
|
+
if (!labelmapBufferArray || !referencedVolumeId) {
|
|
7189
|
+
throw new Error('No labelmapBufferArray or referencedVolumeId found for the SEG displaySet');
|
|
6739
7190
|
}
|
|
6740
7191
|
|
|
6741
7192
|
// if the labelmap doesn't exist, we need to create it first from the
|
|
@@ -6754,72 +7205,27 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6754
7205
|
sharedArrayBuffer: true
|
|
6755
7206
|
}
|
|
6756
7207
|
});
|
|
6757
|
-
const [rows, columns] = derivedVolume.dimensions;
|
|
6758
7208
|
const derivedVolumeScalarData = derivedVolume.getScalarData();
|
|
6759
|
-
const
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
} = esm.metaData.get('generalImageModule', imageId);
|
|
6766
|
-
acc[sopInstanceUid] = index;
|
|
6767
|
-
return acc;
|
|
6768
|
-
}, {});
|
|
6769
|
-
const numSegments = Object.keys(segments).length;
|
|
6770
|
-
// Note: ideally we could use the TypedArray set method, but since each
|
|
6771
|
-
// slice can have multiple segments, we need to loop over each slice and
|
|
6772
|
-
// set the segment value for each segment.
|
|
6773
|
-
let overlappingSegments = false;
|
|
6774
|
-
const _segmentInfoUpdate = (segmentInfo, segmentIndex) => {
|
|
7209
|
+
const segmentsInfo = segDisplaySet.segMetadata.data;
|
|
7210
|
+
derivedVolumeScalarData.set(new Uint8Array(labelmapBufferArray[0]));
|
|
7211
|
+
segmentation.segments = segmentsInfo.map((segmentInfo, segmentIndex) => {
|
|
7212
|
+
if (segmentIndex === 0) {
|
|
7213
|
+
return;
|
|
7214
|
+
}
|
|
6775
7215
|
const {
|
|
6776
|
-
|
|
7216
|
+
SegmentedPropertyCategoryCodeSequence,
|
|
7217
|
+
SegmentNumber,
|
|
7218
|
+
SegmentLabel,
|
|
7219
|
+
SegmentAlgorithmType,
|
|
7220
|
+
SegmentAlgorithmName,
|
|
7221
|
+
SegmentedPropertyTypeCodeSequence,
|
|
7222
|
+
rgba
|
|
6777
7223
|
} = segmentInfo;
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
const {
|
|
6784
|
-
ReferencedSOPInstanceUID
|
|
6785
|
-
} = functionalGroup.DerivationImageSequence.SourceImageSequence;
|
|
6786
|
-
const imageIdIndex = sopUIDImageIdIndexMap[ReferencedSOPInstanceUID];
|
|
6787
|
-
if (imageIdIndex === -1) {
|
|
6788
|
-
return;
|
|
6789
|
-
}
|
|
6790
|
-
const step = rows * columns;
|
|
6791
|
-
|
|
6792
|
-
// we need a faster way to get the pixel data for the current
|
|
6793
|
-
// functional group, which we use typed array view
|
|
6794
|
-
|
|
6795
|
-
const functionGroupPixelData = new Uint8Array(segPixelData.buffer, functionalGroupIndex * step, step);
|
|
6796
|
-
const functionalGroupStartIndex = imageIdIndex * step;
|
|
6797
|
-
const functionalGroupEndIndex = (imageIdIndex + 1) * step;
|
|
6798
|
-
|
|
6799
|
-
// Note: this for loop is not optimized, since DICOM SEG stores
|
|
6800
|
-
// each segment as a separate labelmap so if there is a slice
|
|
6801
|
-
// that has multiple segments, we will have to loop over each
|
|
6802
|
-
// segment and we cannot use the TypedArray set method.
|
|
6803
|
-
for (let i = functionalGroupStartIndex, j = 0; i < functionalGroupEndIndex; i++, j++) {
|
|
6804
|
-
if (functionGroupPixelData[j] !== 0) {
|
|
6805
|
-
if (derivedVolumeScalarData[i] !== 0) {
|
|
6806
|
-
overlappingSegments = true;
|
|
6807
|
-
}
|
|
6808
|
-
derivedVolumeScalarData[i] = segmentIndex;
|
|
6809
|
-
|
|
6810
|
-
// centroid calculations
|
|
6811
|
-
segmentX += i % columns;
|
|
6812
|
-
segmentY += Math.floor(i / columns) % rows;
|
|
6813
|
-
segmentZ += Math.floor(i / (columns * rows));
|
|
6814
|
-
count++;
|
|
6815
|
-
}
|
|
6816
|
-
}
|
|
6817
|
-
}
|
|
6818
|
-
|
|
6819
|
-
// centroid calculations
|
|
6820
|
-
const x = Math.floor(segmentX / count);
|
|
6821
|
-
const y = Math.floor(segmentY / count);
|
|
6822
|
-
const z = Math.floor(segmentZ / count);
|
|
7224
|
+
const {
|
|
7225
|
+
x,
|
|
7226
|
+
y,
|
|
7227
|
+
z
|
|
7228
|
+
} = segDisplaySet.centroids.get(segmentIndex);
|
|
6823
7229
|
const centerWorld = derivedVolume.imageData.indexToWorld([x, y, z]);
|
|
6824
7230
|
segmentation.cachedStats = {
|
|
6825
7231
|
...segmentation.cachedStats,
|
|
@@ -6834,51 +7240,24 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6834
7240
|
}
|
|
6835
7241
|
}
|
|
6836
7242
|
};
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
const promiseArray = [];
|
|
6847
|
-
for (const segmentIndex in segments) {
|
|
6848
|
-
const segmentInfo = segments[segmentIndex];
|
|
6849
|
-
|
|
6850
|
-
// Important: we need a non-blocking way to update the segmentation
|
|
6851
|
-
// state, otherwise the UI will freeze and the user will not be able
|
|
6852
|
-
// to interact with the app or progress bars will not be updated.
|
|
6853
|
-
const promise = new Promise((resolve, reject) => {
|
|
6854
|
-
setTimeout(() => {
|
|
6855
|
-
_segmentInfoUpdate(segmentInfo, segmentIndex);
|
|
6856
|
-
resolve();
|
|
6857
|
-
}, 0);
|
|
6858
|
-
});
|
|
6859
|
-
promiseArray.push(promise);
|
|
6860
|
-
}
|
|
6861
|
-
await Promise.all(promiseArray);
|
|
6862
|
-
segmentation.segmentCount = Object.keys(segments).length;
|
|
6863
|
-
segmentation.segments = [null]; // segment 0
|
|
6864
|
-
|
|
6865
|
-
Object.keys(segments).forEach(segmentIndex => {
|
|
6866
|
-
const segmentInfo = segments[segmentIndex];
|
|
6867
|
-
const segIndex = Number(segmentIndex);
|
|
6868
|
-
segmentation.segments[segIndex] = {
|
|
6869
|
-
label: segmentInfo.label || `Segment ${segIndex}`,
|
|
6870
|
-
segmentIndex: Number(segmentIndex),
|
|
6871
|
-
color: [segmentInfo.color[0], segmentInfo.color[1], segmentInfo.color[2]],
|
|
6872
|
-
opacity: segmentInfo.color[3],
|
|
7243
|
+
return {
|
|
7244
|
+
label: SegmentLabel || `Segment ${SegmentNumber}`,
|
|
7245
|
+
segmentIndex: Number(SegmentNumber),
|
|
7246
|
+
category: SegmentedPropertyCategoryCodeSequence ? SegmentedPropertyCategoryCodeSequence.CodeMeaning : '',
|
|
7247
|
+
type: SegmentedPropertyTypeCodeSequence ? SegmentedPropertyTypeCodeSequence.CodeMeaning : '',
|
|
7248
|
+
algorithmType: SegmentAlgorithmType,
|
|
7249
|
+
algorithmName: SegmentAlgorithmName,
|
|
7250
|
+
color: rgba,
|
|
7251
|
+
opacity: 255,
|
|
6873
7252
|
isVisible: true,
|
|
6874
7253
|
isLocked: false
|
|
6875
7254
|
};
|
|
6876
7255
|
});
|
|
7256
|
+
segmentation.segmentCount = segmentsInfo.length - 1;
|
|
6877
7257
|
segDisplaySet.isLoaded = true;
|
|
6878
7258
|
this._broadcastEvent(SegmentationService_EVENTS.SEGMENTATION_LOADING_COMPLETE, {
|
|
6879
7259
|
segmentationId,
|
|
6880
|
-
segDisplaySet
|
|
6881
|
-
overlappingSegments
|
|
7260
|
+
segDisplaySet
|
|
6882
7261
|
});
|
|
6883
7262
|
return this.addOrUpdateSegmentation(segmentation, suppressEvents);
|
|
6884
7263
|
}
|
|
@@ -6911,6 +7290,7 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
6911
7290
|
id: segmentationId,
|
|
6912
7291
|
displaySetInstanceUID: rtDisplaySetUID,
|
|
6913
7292
|
type: representationType,
|
|
7293
|
+
label: rtDisplaySet.SeriesDescription,
|
|
6914
7294
|
representationData: {
|
|
6915
7295
|
[CONTOUR]: {
|
|
6916
7296
|
geometryIds
|
|
@@ -7015,6 +7395,9 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
7015
7395
|
toolGroupService
|
|
7016
7396
|
} = this.servicesManager.services;
|
|
7017
7397
|
const center = this._getSegmentCenter(segmentationId, segmentIndex);
|
|
7398
|
+
if (!center?.world) {
|
|
7399
|
+
return;
|
|
7400
|
+
}
|
|
7018
7401
|
const {
|
|
7019
7402
|
world
|
|
7020
7403
|
} = center;
|
|
@@ -7068,6 +7451,17 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
7068
7451
|
const adjustedAlpha = type === LABELMAP ? alpha : 1 - alpha;
|
|
7069
7452
|
highlightFn(segmentIndex, adjustedAlpha, hideOthers, segments, toolGroupId, animationLength, segmentationRepresentation);
|
|
7070
7453
|
}
|
|
7454
|
+
_setDisplaySetIsHydrated(displaySetUID, isHydrated) {
|
|
7455
|
+
const {
|
|
7456
|
+
displaySetService
|
|
7457
|
+
} = this.servicesManager.services;
|
|
7458
|
+
const displaySet = displaySetService.getDisplaySetByUID(displaySetUID);
|
|
7459
|
+
if (!displaySet) {
|
|
7460
|
+
return;
|
|
7461
|
+
}
|
|
7462
|
+
displaySet.isHydrated = isHydrated;
|
|
7463
|
+
displaySetService.setDisplaySetMetadataInvalidated(displaySetUID, false);
|
|
7464
|
+
}
|
|
7071
7465
|
_highlightLabelmap(segmentIndex, alpha, hideOthers, segments, toolGroupId, animationLength, segmentationRepresentation) {
|
|
7072
7466
|
const newSegmentSpecificConfig = {
|
|
7073
7467
|
[segmentIndex]: {
|
|
@@ -7170,21 +7564,23 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
7170
7564
|
|
|
7171
7565
|
if (wasActive) {
|
|
7172
7566
|
const remainingSegmentations = this._getSegmentations();
|
|
7173
|
-
|
|
7567
|
+
const remainingHydratedSegmentations = remainingSegmentations.filter(segmentation => segmentation.hydrated);
|
|
7568
|
+
if (remainingHydratedSegmentations.length) {
|
|
7174
7569
|
const {
|
|
7175
7570
|
id
|
|
7176
|
-
} =
|
|
7571
|
+
} = remainingHydratedSegmentations[0];
|
|
7177
7572
|
this._setActiveSegmentationForToolGroup(id, this._getFirstToolGroupId(), false);
|
|
7178
7573
|
}
|
|
7179
7574
|
}
|
|
7575
|
+
this._setDisplaySetIsHydrated(segmentationId, false);
|
|
7180
7576
|
this._broadcastEvent(this.EVENTS.SEGMENTATION_REMOVED, {
|
|
7181
7577
|
segmentationId
|
|
7182
7578
|
});
|
|
7183
7579
|
}
|
|
7184
|
-
|
|
7185
|
-
this.
|
|
7580
|
+
setSegmentLabel(segmentationId, segmentIndex, label) {
|
|
7581
|
+
this._setSegmentLabel(segmentationId, segmentIndex, label);
|
|
7186
7582
|
}
|
|
7187
|
-
|
|
7583
|
+
_setSegmentLabel(segmentationId, segmentIndex, label) {
|
|
7188
7584
|
let suppressEvents = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
7189
7585
|
const segmentation = this.getSegmentation(segmentationId);
|
|
7190
7586
|
if (segmentation === undefined) {
|
|
@@ -7202,16 +7598,14 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
7202
7598
|
});
|
|
7203
7599
|
}
|
|
7204
7600
|
}
|
|
7205
|
-
shouldRenderSegmentation(viewportDisplaySetInstanceUIDs,
|
|
7206
|
-
if (!viewportDisplaySetInstanceUIDs
|
|
7601
|
+
shouldRenderSegmentation(viewportDisplaySetInstanceUIDs, segmentationFrameOfReferenceUID) {
|
|
7602
|
+
if (!viewportDisplaySetInstanceUIDs?.length) {
|
|
7207
7603
|
return false;
|
|
7208
7604
|
}
|
|
7209
7605
|
const {
|
|
7210
7606
|
displaySetService
|
|
7211
7607
|
} = this.servicesManager.services;
|
|
7212
7608
|
let shouldDisplaySeg = false;
|
|
7213
|
-
const segDisplaySet = displaySetService.getDisplaySetByUID(segDisplaySetInstanceUID);
|
|
7214
|
-
const segFrameOfReferenceUID = this._getFrameOfReferenceUIDForSeg(segDisplaySet);
|
|
7215
7609
|
|
|
7216
7610
|
// check if the displaySet is sharing the same frameOfReferenceUID
|
|
7217
7611
|
// with the new segmentation
|
|
@@ -7220,7 +7614,7 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
7220
7614
|
|
|
7221
7615
|
// Todo: this might not be ideal for use cases such as 4D, since we
|
|
7222
7616
|
// don't want to show the segmentation for all the frames
|
|
7223
|
-
if (displaySet.isReconstructable && displaySet?.images?.[0]?.FrameOfReferenceUID ===
|
|
7617
|
+
if (displaySet.isReconstructable && displaySet?.images?.[0]?.FrameOfReferenceUID === segmentationFrameOfReferenceUID) {
|
|
7224
7618
|
shouldDisplaySeg = true;
|
|
7225
7619
|
break;
|
|
7226
7620
|
}
|
|
@@ -7374,7 +7768,7 @@ class SegmentationService extends src/* PubSubService */.hC {
|
|
|
7374
7768
|
}
|
|
7375
7769
|
_getSegmentationRepresentation(segmentationId, toolGroupId) {
|
|
7376
7770
|
const segmentationRepresentations = this.getSegmentationRepresentationsForToolGroup(toolGroupId);
|
|
7377
|
-
if (segmentationRepresentations
|
|
7771
|
+
if (!segmentationRepresentations?.length) {
|
|
7378
7772
|
return;
|
|
7379
7773
|
}
|
|
7380
7774
|
|
|
@@ -7659,7 +8053,8 @@ class CornerstoneCacheService {
|
|
|
7659
8053
|
}
|
|
7660
8054
|
_shouldRenderSegmentation(displaySets) {
|
|
7661
8055
|
const {
|
|
7662
|
-
segmentationService
|
|
8056
|
+
segmentationService,
|
|
8057
|
+
displaySetService
|
|
7663
8058
|
} = this.servicesManager.services;
|
|
7664
8059
|
const viewportDisplaySetInstanceUIDs = displaySets.map(_ref2 => {
|
|
7665
8060
|
let {
|
|
@@ -7673,7 +8068,8 @@ class CornerstoneCacheService {
|
|
|
7673
8068
|
const segmentations = segmentationService.getSegmentations();
|
|
7674
8069
|
for (const segmentation of segmentations) {
|
|
7675
8070
|
const segDisplaySetInstanceUID = segmentation.displaySetInstanceUID;
|
|
7676
|
-
const
|
|
8071
|
+
const segDisplaySet = displaySetService.getDisplaySetByUID(segDisplaySetInstanceUID);
|
|
8072
|
+
const shouldDisplaySeg = segmentationService.shouldRenderSegmentation(viewportDisplaySetInstanceUIDs, segDisplaySet.instances[0].FrameOfReferenceUID);
|
|
7677
8073
|
if (shouldDisplaySeg) {
|
|
7678
8074
|
return true;
|
|
7679
8075
|
}
|
|
@@ -7747,16 +8143,17 @@ const DEFAULT_TOOLGROUP_ID = 'default';
|
|
|
7747
8143
|
// Return true if the data contains the given display set UID OR the imageId
|
|
7748
8144
|
// if it is a composite object.
|
|
7749
8145
|
const dataContains = (data, displaySetUID, imageId) => {
|
|
7750
|
-
if (data.displaySetInstanceUID === displaySetUID)
|
|
8146
|
+
if (data.displaySetInstanceUID === displaySetUID) {
|
|
8147
|
+
return true;
|
|
8148
|
+
}
|
|
7751
8149
|
if (imageId && data.isCompositeStack && data.imageIds) {
|
|
7752
8150
|
return !!data.imageIds.find(dataId => dataId === imageId);
|
|
7753
8151
|
}
|
|
7754
8152
|
return false;
|
|
7755
8153
|
};
|
|
7756
8154
|
class ViewportInfo {
|
|
7757
|
-
constructor(
|
|
8155
|
+
constructor(viewportId) {
|
|
7758
8156
|
this.viewportId = '';
|
|
7759
|
-
this.viewportIndex = void 0;
|
|
7760
8157
|
this.element = void 0;
|
|
7761
8158
|
this.viewportOptions = void 0;
|
|
7762
8159
|
this.displaySetOptions = void 0;
|
|
@@ -7768,7 +8165,6 @@ class ViewportInfo {
|
|
|
7768
8165
|
this.viewportOptions = null;
|
|
7769
8166
|
this.displaySetOptions = null;
|
|
7770
8167
|
};
|
|
7771
|
-
this.viewportIndex = viewportIndex;
|
|
7772
8168
|
this.viewportId = viewportId;
|
|
7773
8169
|
this.setPublicViewportOptions({});
|
|
7774
8170
|
this.setPublicDisplaySetOptions([{}]);
|
|
@@ -7779,7 +8175,9 @@ class ViewportInfo {
|
|
|
7779
8175
|
* OR if it is a composite stack and contains the given imageId
|
|
7780
8176
|
*/
|
|
7781
8177
|
contains(displaySetUID, imageId) {
|
|
7782
|
-
if (!this.viewportData?.data)
|
|
8178
|
+
if (!this.viewportData?.data) {
|
|
8179
|
+
return false;
|
|
8180
|
+
}
|
|
7783
8181
|
if (this.viewportData.data.length) {
|
|
7784
8182
|
return !!this.viewportData.data.find(data => dataContains(data, displaySetUID, imageId));
|
|
7785
8183
|
}
|
|
@@ -7794,9 +8192,6 @@ class ViewportInfo {
|
|
|
7794
8192
|
setViewportId(viewportId) {
|
|
7795
8193
|
this.viewportId = viewportId;
|
|
7796
8194
|
}
|
|
7797
|
-
setViewportIndex(viewportIndex) {
|
|
7798
|
-
this.viewportIndex = viewportIndex;
|
|
7799
|
-
}
|
|
7800
8195
|
setElement(element) {
|
|
7801
8196
|
this.element = element;
|
|
7802
8197
|
}
|
|
@@ -7806,9 +8201,6 @@ class ViewportInfo {
|
|
|
7806
8201
|
getViewportData() {
|
|
7807
8202
|
return this.viewportData;
|
|
7808
8203
|
}
|
|
7809
|
-
getViewportIndex() {
|
|
7810
|
-
return this.viewportIndex;
|
|
7811
|
-
}
|
|
7812
8204
|
getElement() {
|
|
7813
8205
|
return this.element;
|
|
7814
8206
|
}
|
|
@@ -7819,13 +8211,14 @@ class ViewportInfo {
|
|
|
7819
8211
|
// map the displaySetOptions and check if they are undefined then set them to default values
|
|
7820
8212
|
const displaySetOptions = this.mapDisplaySetOptions(publicDisplaySetOptions);
|
|
7821
8213
|
this.setDisplaySetOptions(displaySetOptions);
|
|
8214
|
+
return this.displaySetOptions;
|
|
7822
8215
|
}
|
|
7823
8216
|
hasDisplaySet(displaySetInstanceUID) {
|
|
7824
8217
|
// Todo: currently this does not work for non image & referenceImage displaySets.
|
|
7825
8218
|
// Since SEG and other derived displaySets are loaded in a different way, and not
|
|
7826
8219
|
// via cornerstoneViewportService
|
|
7827
8220
|
let viewportData = this.getViewportData();
|
|
7828
|
-
if (viewportData.viewportType === esm.Enums.ViewportType.ORTHOGRAPHIC) {
|
|
8221
|
+
if (viewportData.viewportType === esm.Enums.ViewportType.ORTHOGRAPHIC || viewportData.viewportType === esm.Enums.ViewportType.VOLUME_3D) {
|
|
7829
8222
|
viewportData = viewportData;
|
|
7830
8223
|
return viewportData.data.some(_ref => {
|
|
7831
8224
|
let {
|
|
@@ -7865,6 +8258,7 @@ class ViewportInfo {
|
|
|
7865
8258
|
toolGroupId,
|
|
7866
8259
|
presentationIds
|
|
7867
8260
|
});
|
|
8261
|
+
return this.viewportOptions;
|
|
7868
8262
|
}
|
|
7869
8263
|
setViewportOptions(viewportOptions) {
|
|
7870
8264
|
this.viewportOptions = viewportOptions;
|
|
@@ -7894,6 +8288,9 @@ class ViewportInfo {
|
|
|
7894
8288
|
getOrientation() {
|
|
7895
8289
|
return this.viewportOptions.orientation;
|
|
7896
8290
|
}
|
|
8291
|
+
getDisplayArea() {
|
|
8292
|
+
return this.viewportOptions.displayArea;
|
|
8293
|
+
}
|
|
7897
8294
|
getInitialImageOptions() {
|
|
7898
8295
|
return this.viewportOptions.initialImageOptions;
|
|
7899
8296
|
}
|
|
@@ -7959,7 +8356,6 @@ class CornerstoneViewportService extends src/* PubSubService */.hC {
|
|
|
7959
8356
|
constructor(servicesManager) {
|
|
7960
8357
|
super(CornerstoneViewportService_EVENTS);
|
|
7961
8358
|
this.renderingEngine = void 0;
|
|
7962
|
-
this.viewportsInfo = new Map();
|
|
7963
8359
|
this.viewportsById = new Map();
|
|
7964
8360
|
this.viewportGridResizeObserver = void 0;
|
|
7965
8361
|
this.viewportsDisplaySets = new Map();
|
|
@@ -7975,37 +8371,16 @@ class CornerstoneViewportService extends src/* PubSubService */.hC {
|
|
|
7975
8371
|
|
|
7976
8372
|
/**
|
|
7977
8373
|
* Adds the HTML element to the viewportService
|
|
7978
|
-
* @param {*}
|
|
8374
|
+
* @param {*} viewportId
|
|
7979
8375
|
* @param {*} elementRef
|
|
7980
8376
|
*/
|
|
7981
|
-
enableViewport(
|
|
7982
|
-
|
|
7983
|
-
// Not providing a viewportId is frowned upon because it does weird things
|
|
7984
|
-
// on moving them around, but it does mostly work.
|
|
7985
|
-
if (!viewportOptions.viewportId) {
|
|
7986
|
-
console.warn('Should provide viewport id externally', viewportOptions);
|
|
7987
|
-
viewportOptions.viewportId = this.getViewportId(viewportIndex) || `viewport-${viewportIndex}`;
|
|
7988
|
-
}
|
|
7989
|
-
const {
|
|
7990
|
-
viewportId
|
|
7991
|
-
} = viewportOptions;
|
|
7992
|
-
const viewportInfo = new Viewport(viewportIndex, viewportId);
|
|
7993
|
-
if (!viewportInfo.viewportId) {
|
|
7994
|
-
throw new Error('Should have viewport ID afterwards');
|
|
7995
|
-
}
|
|
8377
|
+
enableViewport(viewportId, elementRef) {
|
|
8378
|
+
const viewportInfo = new Viewport(viewportId);
|
|
7996
8379
|
viewportInfo.setElement(elementRef);
|
|
7997
|
-
this.viewportsInfo.set(viewportIndex, viewportInfo);
|
|
7998
8380
|
this.viewportsById.set(viewportId, viewportInfo);
|
|
7999
8381
|
}
|
|
8000
8382
|
getViewportIds() {
|
|
8001
|
-
|
|
8002
|
-
this.viewportsInfo.forEach(viewportInfo => {
|
|
8003
|
-
viewportIds.push(viewportInfo.getViewportId());
|
|
8004
|
-
});
|
|
8005
|
-
return viewportIds;
|
|
8006
|
-
}
|
|
8007
|
-
getViewportId(viewportIndex) {
|
|
8008
|
-
return this.viewportsInfo[viewportIndex]?.viewportId;
|
|
8383
|
+
return Array.from(this.viewportsById.keys());
|
|
8009
8384
|
}
|
|
8010
8385
|
|
|
8011
8386
|
/**
|
|
@@ -8059,34 +8434,38 @@ class CornerstoneViewportService extends src/* PubSubService */.hC {
|
|
|
8059
8434
|
* created for every new viewport, this will be called whenever the set of
|
|
8060
8435
|
* viewports is changed, but NOT when the viewport position changes only.
|
|
8061
8436
|
*
|
|
8062
|
-
* @param
|
|
8437
|
+
* @param viewportId - The viewportId to disable
|
|
8063
8438
|
*/
|
|
8064
|
-
disableElement(
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
}
|
|
8069
|
-
const viewportId = viewportInfo.getViewportId();
|
|
8070
|
-
this.renderingEngine && this.renderingEngine.disableElement(viewportId);
|
|
8071
|
-
this.viewportsInfo.get(viewportIndex).destroy();
|
|
8072
|
-
this.viewportsInfo.delete(viewportIndex);
|
|
8439
|
+
disableElement(viewportId) {
|
|
8440
|
+
this.renderingEngine?.disableElement(viewportId);
|
|
8441
|
+
|
|
8442
|
+
// clean up
|
|
8073
8443
|
this.viewportsById.delete(viewportId);
|
|
8444
|
+
this.viewportsDisplaySets.delete(viewportId);
|
|
8074
8445
|
}
|
|
8075
8446
|
setPresentations(viewport, presentations) {
|
|
8076
8447
|
const properties = presentations?.lutPresentation?.properties;
|
|
8077
|
-
if (properties)
|
|
8448
|
+
if (properties) {
|
|
8449
|
+
viewport.setProperties(properties);
|
|
8450
|
+
}
|
|
8078
8451
|
const camera = presentations?.positionPresentation?.camera;
|
|
8079
|
-
if (camera)
|
|
8452
|
+
if (camera) {
|
|
8453
|
+
viewport.setCamera(camera);
|
|
8454
|
+
}
|
|
8080
8455
|
}
|
|
8081
|
-
getPresentation(
|
|
8082
|
-
const viewportInfo = this.
|
|
8083
|
-
if (!viewportInfo)
|
|
8456
|
+
getPresentation(viewportId) {
|
|
8457
|
+
const viewportInfo = this.viewportsById.get(viewportId);
|
|
8458
|
+
if (!viewportInfo) {
|
|
8459
|
+
return;
|
|
8460
|
+
}
|
|
8084
8461
|
const {
|
|
8085
8462
|
viewportType,
|
|
8086
8463
|
presentationIds
|
|
8087
8464
|
} = viewportInfo.getViewportOptions();
|
|
8088
|
-
const csViewport = this.
|
|
8089
|
-
if (!csViewport)
|
|
8465
|
+
const csViewport = this.getCornerstoneViewport(viewportId);
|
|
8466
|
+
if (!csViewport) {
|
|
8467
|
+
return;
|
|
8468
|
+
}
|
|
8090
8469
|
const properties = csViewport.getProperties();
|
|
8091
8470
|
if (properties.isComputedVOI) {
|
|
8092
8471
|
delete properties.voiRange;
|
|
@@ -8102,59 +8481,111 @@ class CornerstoneViewportService extends src/* PubSubService */.hC {
|
|
|
8102
8481
|
camera
|
|
8103
8482
|
};
|
|
8104
8483
|
}
|
|
8484
|
+
storePresentation(_ref) {
|
|
8485
|
+
let {
|
|
8486
|
+
viewportId
|
|
8487
|
+
} = _ref;
|
|
8488
|
+
const stateSyncService = this.servicesManager.services.stateSyncService;
|
|
8489
|
+
let presentation;
|
|
8490
|
+
try {
|
|
8491
|
+
presentation = this.getPresentation(viewportId);
|
|
8492
|
+
} catch (error) {
|
|
8493
|
+
console.warn(error);
|
|
8494
|
+
}
|
|
8495
|
+
if (!presentation || !presentation.presentationIds) {
|
|
8496
|
+
return;
|
|
8497
|
+
}
|
|
8498
|
+
const {
|
|
8499
|
+
lutPresentationStore,
|
|
8500
|
+
positionPresentationStore
|
|
8501
|
+
} = stateSyncService.getState();
|
|
8502
|
+
const {
|
|
8503
|
+
presentationIds
|
|
8504
|
+
} = presentation;
|
|
8505
|
+
const {
|
|
8506
|
+
lutPresentationId,
|
|
8507
|
+
positionPresentationId
|
|
8508
|
+
} = presentationIds || {};
|
|
8509
|
+
const storeState = {};
|
|
8510
|
+
if (lutPresentationId) {
|
|
8511
|
+
storeState.lutPresentationStore = {
|
|
8512
|
+
...lutPresentationStore,
|
|
8513
|
+
[lutPresentationId]: presentation
|
|
8514
|
+
};
|
|
8515
|
+
}
|
|
8516
|
+
if (positionPresentationId) {
|
|
8517
|
+
storeState.positionPresentationStore = {
|
|
8518
|
+
...positionPresentationStore,
|
|
8519
|
+
[positionPresentationId]: presentation
|
|
8520
|
+
};
|
|
8521
|
+
}
|
|
8522
|
+
stateSyncService.store(storeState);
|
|
8523
|
+
}
|
|
8105
8524
|
|
|
8106
8525
|
/**
|
|
8107
|
-
*
|
|
8108
|
-
*
|
|
8109
|
-
* @param
|
|
8110
|
-
* @param
|
|
8111
|
-
* @param
|
|
8112
|
-
* @
|
|
8526
|
+
* Sets the viewport data for a viewport.
|
|
8527
|
+
* @param viewportId - The ID of the viewport to set the data for.
|
|
8528
|
+
* @param viewportData - The viewport data to set.
|
|
8529
|
+
* @param publicViewportOptions - The public viewport options.
|
|
8530
|
+
* @param publicDisplaySetOptions - The public display set options.
|
|
8531
|
+
* @param presentations - The presentations to set.
|
|
8113
8532
|
*/
|
|
8114
|
-
setViewportData(
|
|
8533
|
+
setViewportData(viewportId, viewportData, publicViewportOptions, publicDisplaySetOptions, presentations) {
|
|
8115
8534
|
const renderingEngine = this.getRenderingEngine();
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
}
|
|
8535
|
+
|
|
8536
|
+
// This is the old viewportInfo, which may have old options but we might be
|
|
8537
|
+
// using its viewport (same viewportId as the new viewportInfo)
|
|
8120
8538
|
const viewportInfo = this.viewportsById.get(viewportId);
|
|
8539
|
+
|
|
8540
|
+
// We should store the presentation for the current viewport since we can't only
|
|
8541
|
+
// rely to store it WHEN the viewport is disabled since we might keep around the
|
|
8542
|
+
// same viewport/element and just change the viewportData for it (drag and drop etc.)
|
|
8543
|
+
// the disableElement storePresentation handle would not be called in this case
|
|
8544
|
+
// and we would lose the presentation.
|
|
8545
|
+
this.storePresentation({
|
|
8546
|
+
viewportId: viewportInfo.getViewportId()
|
|
8547
|
+
});
|
|
8121
8548
|
if (!viewportInfo) {
|
|
8122
|
-
throw new Error('
|
|
8549
|
+
throw new Error('element is not enabled for the given viewportId');
|
|
8123
8550
|
}
|
|
8124
8551
|
|
|
8125
|
-
//
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
viewportInfo.viewportIndex = viewportIndex;
|
|
8130
|
-
}
|
|
8131
|
-
viewportInfo.setRenderingEngineId(renderingEngine.id);
|
|
8132
|
-
const {
|
|
8133
|
-
viewportOptions,
|
|
8134
|
-
displaySetOptions
|
|
8135
|
-
} = this._getViewportAndDisplaySetOptions(publicViewportOptions, publicDisplaySetOptions, viewportInfo);
|
|
8136
|
-
viewportInfo.setViewportOptions(viewportOptions);
|
|
8137
|
-
viewportInfo.setDisplaySetOptions(displaySetOptions);
|
|
8138
|
-
viewportInfo.setViewportData(viewportData);
|
|
8552
|
+
// override the viewportOptions and displaySetOptions with the public ones
|
|
8553
|
+
// since those are the newly set ones, we set them here so that it handles defaults
|
|
8554
|
+
const displaySetOptions = viewportInfo.setPublicDisplaySetOptions(publicDisplaySetOptions);
|
|
8555
|
+
const viewportOptions = viewportInfo.setPublicViewportOptions(publicViewportOptions);
|
|
8139
8556
|
const element = viewportInfo.getElement();
|
|
8140
8557
|
const type = viewportInfo.getViewportType();
|
|
8141
8558
|
const background = viewportInfo.getBackground();
|
|
8142
8559
|
const orientation = viewportInfo.getOrientation();
|
|
8560
|
+
const displayArea = viewportInfo.getDisplayArea();
|
|
8143
8561
|
const viewportInput = {
|
|
8144
8562
|
viewportId,
|
|
8145
8563
|
element,
|
|
8146
8564
|
type,
|
|
8147
8565
|
defaultOptions: {
|
|
8148
8566
|
background,
|
|
8149
|
-
orientation
|
|
8567
|
+
orientation,
|
|
8568
|
+
displayArea
|
|
8150
8569
|
}
|
|
8151
8570
|
};
|
|
8152
8571
|
|
|
8572
|
+
// Rendering Engine Id set should happen before enabling the element
|
|
8573
|
+
// since there are callbacks that depend on the renderingEngine id
|
|
8574
|
+
// Todo: however, this is a limitation which means that we can't change
|
|
8575
|
+
// the rendering engine id for a given viewport which might be a super edge
|
|
8576
|
+
// case
|
|
8577
|
+
viewportInfo.setRenderingEngineId(renderingEngine.id);
|
|
8578
|
+
|
|
8153
8579
|
// Todo: this is not optimal at all, we are re-enabling the already enabled
|
|
8154
8580
|
// element which is not what we want. But enabledElement as part of the
|
|
8155
8581
|
// renderingEngine is designed to be used like this. This will trigger
|
|
8156
8582
|
// ENABLED_ELEMENT again and again, which will run onEnableElement callbacks
|
|
8157
8583
|
renderingEngine.enableElement(viewportInput);
|
|
8584
|
+
viewportInfo.setViewportOptions(viewportOptions);
|
|
8585
|
+
viewportInfo.setDisplaySetOptions(displaySetOptions);
|
|
8586
|
+
viewportInfo.setViewportData(viewportData);
|
|
8587
|
+
viewportInfo.setViewportId(viewportId);
|
|
8588
|
+
this.viewportsById.set(viewportId, viewportInfo);
|
|
8158
8589
|
const viewport = renderingEngine.getViewport(viewportId);
|
|
8159
8590
|
this._setDisplaySets(viewport, viewportData, viewportInfo, presentations);
|
|
8160
8591
|
|
|
@@ -8163,7 +8594,6 @@ class CornerstoneViewportService extends src/* PubSubService */.hC {
|
|
|
8163
8594
|
// invalid data.
|
|
8164
8595
|
this._broadcastEvent(this.EVENTS.VIEWPORT_DATA_CHANGED, {
|
|
8165
8596
|
viewportData,
|
|
8166
|
-
viewportIndex,
|
|
8167
8597
|
viewportId
|
|
8168
8598
|
});
|
|
8169
8599
|
}
|
|
@@ -8175,31 +8605,8 @@ class CornerstoneViewportService extends src/* PubSubService */.hC {
|
|
|
8175
8605
|
const viewport = this.renderingEngine.getViewport(viewportId);
|
|
8176
8606
|
return viewport;
|
|
8177
8607
|
}
|
|
8178
|
-
getCornerstoneViewportByIndex(viewportIndex) {
|
|
8179
|
-
const viewportInfo = this.getViewportInfoByIndex(viewportIndex);
|
|
8180
|
-
if (!viewportInfo || !this.renderingEngine || this.renderingEngine.hasBeenDestroyed) {
|
|
8181
|
-
return null;
|
|
8182
|
-
}
|
|
8183
|
-
const viewport = this.renderingEngine.getViewport(viewportInfo.getViewportId());
|
|
8184
|
-
return viewport;
|
|
8185
|
-
}
|
|
8186
|
-
|
|
8187
|
-
/**
|
|
8188
|
-
* Returns the viewportIndex for the provided viewportId
|
|
8189
|
-
* @param {string} viewportId - the viewportId
|
|
8190
|
-
* @returns {number} - the viewportIndex
|
|
8191
|
-
*/
|
|
8192
|
-
getViewportInfoByIndex(viewportIndex) {
|
|
8193
|
-
return this.viewportsInfo.get(viewportIndex);
|
|
8194
|
-
}
|
|
8195
8608
|
getViewportInfo(viewportId) {
|
|
8196
|
-
|
|
8197
|
-
for (const [index, viewport] of this.viewportsInfo.entries()) {
|
|
8198
|
-
if (viewport.getViewportId() === viewportId) {
|
|
8199
|
-
return viewport;
|
|
8200
|
-
}
|
|
8201
|
-
}
|
|
8202
|
-
return null;
|
|
8609
|
+
return this.viewportsById.get(viewportId);
|
|
8203
8610
|
}
|
|
8204
8611
|
_setStackViewport(viewport, viewportData, viewportInfo, presentations) {
|
|
8205
8612
|
const displaySetOptions = viewportInfo.getDisplaySetOptions();
|
|
@@ -8236,9 +8643,13 @@ class CornerstoneViewportService extends src/* PubSubService */.hC {
|
|
|
8236
8643
|
}
|
|
8237
8644
|
}
|
|
8238
8645
|
viewport.setStack(imageIds, initialImageIndexToUse).then(() => {
|
|
8239
|
-
viewport.setProperties(
|
|
8646
|
+
viewport.setProperties({
|
|
8647
|
+
...properties
|
|
8648
|
+
});
|
|
8240
8649
|
const camera = presentations.positionPresentation?.camera;
|
|
8241
|
-
if (camera)
|
|
8650
|
+
if (camera) {
|
|
8651
|
+
viewport.setCamera(camera);
|
|
8652
|
+
}
|
|
8242
8653
|
});
|
|
8243
8654
|
}
|
|
8244
8655
|
_getInitialImageIndexForViewport(viewportInfo, imageIds) {
|
|
@@ -8333,7 +8744,7 @@ class CornerstoneViewportService extends src/* PubSubService */.hC {
|
|
|
8333
8744
|
});
|
|
8334
8745
|
}
|
|
8335
8746
|
this.viewportsDisplaySets.set(viewport.id, displaySetInstanceUIDs);
|
|
8336
|
-
if (hangingProtocolService.
|
|
8747
|
+
if (hangingProtocolService.getShouldPerformCustomImageLoad()) {
|
|
8337
8748
|
// delegate the volume loading to the hanging protocol service if it has a custom image load strategy
|
|
8338
8749
|
return hangingProtocolService.runImageLoadStrategy({
|
|
8339
8750
|
viewportId: viewport.id,
|
|
@@ -8395,11 +8806,11 @@ class CornerstoneViewportService extends src/* PubSubService */.hC {
|
|
|
8395
8806
|
};
|
|
8396
8807
|
});
|
|
8397
8808
|
await viewport.setVolumes(volumeInputArray);
|
|
8398
|
-
volumesProperties.forEach(
|
|
8809
|
+
volumesProperties.forEach(_ref2 => {
|
|
8399
8810
|
let {
|
|
8400
8811
|
properties,
|
|
8401
8812
|
volumeId
|
|
8402
|
-
} =
|
|
8813
|
+
} = _ref2;
|
|
8403
8814
|
viewport.setProperties(properties, volumeId);
|
|
8404
8815
|
});
|
|
8405
8816
|
this.setPresentations(viewport, presentations);
|
|
@@ -8448,13 +8859,25 @@ class CornerstoneViewportService extends src/* PubSubService */.hC {
|
|
|
8448
8859
|
continue;
|
|
8449
8860
|
}
|
|
8450
8861
|
|
|
8451
|
-
// otherwise, check if the hydrated segmentations are in the same
|
|
8862
|
+
// otherwise, check if the hydrated segmentations are in the same FrameOfReferenceUID
|
|
8452
8863
|
// as the primary displaySet, if so add the representation (since it was not there)
|
|
8453
8864
|
const {
|
|
8454
|
-
id: segDisplaySetInstanceUID
|
|
8455
|
-
type
|
|
8865
|
+
id: segDisplaySetInstanceUID
|
|
8456
8866
|
} = segmentation;
|
|
8457
|
-
|
|
8867
|
+
let segFrameOfReferenceUID = this._getFrameOfReferenceUID(segDisplaySetInstanceUID);
|
|
8868
|
+
if (!segFrameOfReferenceUID) {
|
|
8869
|
+
// if the segmentation displaySet does not have a FrameOfReferenceUID, we might check the
|
|
8870
|
+
// segmentation itself maybe it has a FrameOfReferenceUID
|
|
8871
|
+
const {
|
|
8872
|
+
FrameOfReferenceUID
|
|
8873
|
+
} = segmentation;
|
|
8874
|
+
if (FrameOfReferenceUID) {
|
|
8875
|
+
segFrameOfReferenceUID = FrameOfReferenceUID;
|
|
8876
|
+
}
|
|
8877
|
+
}
|
|
8878
|
+
if (!segFrameOfReferenceUID) {
|
|
8879
|
+
return;
|
|
8880
|
+
}
|
|
8458
8881
|
let shouldDisplaySeg = false;
|
|
8459
8882
|
for (const displaySetInstanceUID of displaySetInstanceUIDs) {
|
|
8460
8883
|
const primaryFrameOfReferenceUID = this._getFrameOfReferenceUID(displaySetInstanceUID);
|
|
@@ -8487,13 +8910,12 @@ class CornerstoneViewportService extends src/* PubSubService */.hC {
|
|
|
8487
8910
|
|
|
8488
8911
|
// Todo: keepCamera is an interim solution until we have a better solution for
|
|
8489
8912
|
// keeping the camera position when the viewport data is changed
|
|
8490
|
-
updateViewport(
|
|
8913
|
+
updateViewport(viewportId, viewportData) {
|
|
8491
8914
|
let keepCamera = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8492
|
-
const viewportInfo = this.
|
|
8493
|
-
const viewportId = viewportInfo.getViewportId();
|
|
8915
|
+
const viewportInfo = this.getViewportInfo(viewportId);
|
|
8494
8916
|
const viewport = this.getCornerstoneViewport(viewportId);
|
|
8495
8917
|
const viewportCamera = viewport.getCamera();
|
|
8496
|
-
if (viewport instanceof esm.VolumeViewport) {
|
|
8918
|
+
if (viewport instanceof esm.VolumeViewport || viewport instanceof esm.VolumeViewport3D) {
|
|
8497
8919
|
this._setVolumeViewport(viewport, viewportData, viewportInfo).then(() => {
|
|
8498
8920
|
if (keepCamera) {
|
|
8499
8921
|
viewport.setCamera(viewportCamera);
|
|
@@ -8548,23 +8970,6 @@ class CornerstoneViewportService extends src/* PubSubService */.hC {
|
|
|
8548
8970
|
return slabThickness;
|
|
8549
8971
|
}
|
|
8550
8972
|
}
|
|
8551
|
-
_getViewportAndDisplaySetOptions(publicViewportOptions, publicDisplaySetOptions, viewportInfo) {
|
|
8552
|
-
const viewportIndex = viewportInfo.getViewportIndex();
|
|
8553
|
-
|
|
8554
|
-
// Creating a temporary viewportInfo to handle defaults
|
|
8555
|
-
const newViewportInfo = new Viewport(viewportIndex, viewportInfo.getViewportId());
|
|
8556
|
-
|
|
8557
|
-
// To handle setting the default values if missing for the viewportOptions and
|
|
8558
|
-
// displaySetOptions
|
|
8559
|
-
newViewportInfo.setPublicViewportOptions(publicViewportOptions);
|
|
8560
|
-
newViewportInfo.setPublicDisplaySetOptions(publicDisplaySetOptions);
|
|
8561
|
-
const newViewportOptions = newViewportInfo.getViewportOptions();
|
|
8562
|
-
const newDisplaySetOptions = newViewportInfo.getDisplaySetOptions();
|
|
8563
|
-
return {
|
|
8564
|
-
viewportOptions: newViewportOptions,
|
|
8565
|
-
displaySetOptions: newDisplaySetOptions
|
|
8566
|
-
};
|
|
8567
|
-
}
|
|
8568
8973
|
_getFrameOfReferenceUID(displaySetInstanceUID) {
|
|
8569
8974
|
const {
|
|
8570
8975
|
displaySetService
|
|
@@ -8602,28 +9007,28 @@ class CornerstoneViewportService extends src/* PubSubService */.hC {
|
|
|
8602
9007
|
*
|
|
8603
9008
|
* @param measurement
|
|
8604
9009
|
* The measurement that is desired to view.
|
|
8605
|
-
* @param
|
|
9010
|
+
* @param activeViewportId - the index that was active at the time the jump
|
|
8606
9011
|
* was initiated.
|
|
8607
|
-
* @return the
|
|
9012
|
+
* @return the viewportId that the measurement should be displayed in.
|
|
8608
9013
|
*/
|
|
8609
|
-
|
|
8610
|
-
const viewportInfo = this.
|
|
9014
|
+
getViewportIdToJump(activeViewportId, displaySetInstanceUID, cameraProps) {
|
|
9015
|
+
const viewportInfo = this.getViewportInfo(activeViewportId);
|
|
8611
9016
|
const {
|
|
8612
9017
|
referencedImageId
|
|
8613
9018
|
} = cameraProps;
|
|
8614
9019
|
if (viewportInfo?.contains(displaySetInstanceUID, referencedImageId)) {
|
|
8615
|
-
return
|
|
9020
|
+
return activeViewportId;
|
|
8616
9021
|
}
|
|
8617
|
-
return [...this.viewportsById.values()].find(viewportInfo => viewportInfo.contains(displaySetInstanceUID, referencedImageId))?.
|
|
9022
|
+
return [...this.viewportsById.values()].find(viewportInfo => viewportInfo.contains(displaySetInstanceUID, referencedImageId))?.viewportId ?? null;
|
|
8618
9023
|
}
|
|
8619
9024
|
}
|
|
8620
9025
|
CornerstoneViewportService.REGISTRATION = {
|
|
8621
9026
|
name: 'cornerstoneViewportService',
|
|
8622
9027
|
altName: 'CornerstoneViewportService',
|
|
8623
|
-
create:
|
|
9028
|
+
create: _ref3 => {
|
|
8624
9029
|
let {
|
|
8625
9030
|
servicesManager
|
|
8626
|
-
} =
|
|
9031
|
+
} = _ref3;
|
|
8627
9032
|
return new CornerstoneViewportService(servicesManager);
|
|
8628
9033
|
}
|
|
8629
9034
|
};
|
|
@@ -8632,7 +9037,7 @@ CornerstoneViewportService.REGISTRATION = {
|
|
|
8632
9037
|
|
|
8633
9038
|
|
|
8634
9039
|
// EXTERNAL MODULE: ../../../node_modules/dicomweb-client/build/dicomweb-client.es.js
|
|
8635
|
-
var dicomweb_client_es = __webpack_require__(
|
|
9040
|
+
var dicomweb_client_es = __webpack_require__(97604);
|
|
8636
9041
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/dicomLoaderService.js
|
|
8637
9042
|
|
|
8638
9043
|
|
|
@@ -8707,7 +9112,7 @@ class DicomLoaderService {
|
|
|
8707
9112
|
// Use referenced imageInstance
|
|
8708
9113
|
const imageInstance = getImageInstance(dataset);
|
|
8709
9114
|
const nonImageInstance = getNonImageInstance(dataset);
|
|
8710
|
-
if (!imageInstance && !nonImageInstance || !nonImageInstance.imageId
|
|
9115
|
+
if (!imageInstance && !nonImageInstance || !nonImageInstance.imageId?.startsWith('dicomfile')) {
|
|
8711
9116
|
return;
|
|
8712
9117
|
}
|
|
8713
9118
|
const instance = imageInstance || nonImageInstance;
|
|
@@ -8801,30 +9206,6 @@ const package_namespaceObject = JSON.parse('{"u2":"@ohif/extension-cornerstone"}
|
|
|
8801
9206
|
|
|
8802
9207
|
const id = package_namespaceObject.u2;
|
|
8803
9208
|
|
|
8804
|
-
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/getHandlesFromPoints.js
|
|
8805
|
-
function getHandlesFromPoints(points) {
|
|
8806
|
-
if (points.longAxis && points.shortAxis) {
|
|
8807
|
-
const handles = {};
|
|
8808
|
-
handles.start = points.longAxis[0];
|
|
8809
|
-
handles.end = points.longAxis[1];
|
|
8810
|
-
handles.perpendicularStart = points.longAxis[0];
|
|
8811
|
-
handles.perpendicularEnd = points.longAxis[1];
|
|
8812
|
-
return handles;
|
|
8813
|
-
}
|
|
8814
|
-
return points.map((p, i) => i % 10 === 0 ? {
|
|
8815
|
-
start: p
|
|
8816
|
-
} : {
|
|
8817
|
-
end: p
|
|
8818
|
-
}).reduce((obj, item) => Object.assign(obj, {
|
|
8819
|
-
...item
|
|
8820
|
-
}), {});
|
|
8821
|
-
}
|
|
8822
|
-
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/index.ts
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
9209
|
;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/index.ts
|
|
8829
9210
|
|
|
8830
9211
|
|
|
@@ -8849,11 +9230,10 @@ function src_extends() { src_extends = Object.assign ? Object.assign.bind() : fu
|
|
|
8849
9230
|
|
|
8850
9231
|
|
|
8851
9232
|
|
|
8852
|
-
|
|
8853
9233
|
|
|
8854
9234
|
|
|
8855
9235
|
const Component = /*#__PURE__*/react.lazy(() => {
|
|
8856
|
-
return Promise.all(/* import() */[__webpack_require__.e(
|
|
9236
|
+
return Promise.all(/* import() */[__webpack_require__.e(23), __webpack_require__.e(181)]).then(__webpack_require__.bind(__webpack_require__, 86181));
|
|
8857
9237
|
});
|
|
8858
9238
|
const OHIFCornerstoneViewport = props => {
|
|
8859
9239
|
return /*#__PURE__*/react.createElement(react.Suspense, {
|
|
@@ -8876,7 +9256,6 @@ const cornerstoneExtension = {
|
|
|
8876
9256
|
esm.imageLoadPoolManager.clearRequestStack(type);
|
|
8877
9257
|
esm.imageRetrievalPoolManager.clearRequestStack(type);
|
|
8878
9258
|
});
|
|
8879
|
-
destroy();
|
|
8880
9259
|
(0,state/* reset */.mc)();
|
|
8881
9260
|
},
|
|
8882
9261
|
/**
|
|
@@ -8956,7 +9335,7 @@ const cornerstoneExtension = {
|
|
|
8956
9335
|
|
|
8957
9336
|
/***/ }),
|
|
8958
9337
|
|
|
8959
|
-
/***/
|
|
9338
|
+
/***/ 73704:
|
|
8960
9339
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8961
9340
|
|
|
8962
9341
|
"use strict";
|
|
@@ -8976,21 +9355,21 @@ const state = {
|
|
|
8976
9355
|
* @param {HTMLElement} dom Active viewport element.
|
|
8977
9356
|
* @return void
|
|
8978
9357
|
*/
|
|
8979
|
-
const setEnabledElement = (
|
|
9358
|
+
const setEnabledElement = (viewportId, element, context) => {
|
|
8980
9359
|
const targetContext = context || state.DEFAULT_CONTEXT;
|
|
8981
|
-
state.enabledElements[
|
|
9360
|
+
state.enabledElements[viewportId] = {
|
|
8982
9361
|
element,
|
|
8983
9362
|
context: targetContext
|
|
8984
9363
|
};
|
|
8985
9364
|
};
|
|
8986
9365
|
|
|
8987
9366
|
/**
|
|
8988
|
-
* Grabs the enabled element `dom` reference of an
|
|
9367
|
+
* Grabs the enabled element `dom` reference of an active viewport.
|
|
8989
9368
|
*
|
|
8990
9369
|
* @return {HTMLElement} Active viewport element.
|
|
8991
9370
|
*/
|
|
8992
|
-
const getEnabledElement =
|
|
8993
|
-
return state.enabledElements[
|
|
9371
|
+
const getEnabledElement = viewportId => {
|
|
9372
|
+
return state.enabledElements[viewportId];
|
|
8994
9373
|
};
|
|
8995
9374
|
const reset = () => {
|
|
8996
9375
|
state.enabledElements = {};
|
|
@@ -8999,14 +9378,14 @@ const reset = () => {
|
|
|
8999
9378
|
|
|
9000
9379
|
/***/ }),
|
|
9001
9380
|
|
|
9002
|
-
/***/
|
|
9381
|
+
/***/ 87172:
|
|
9003
9382
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
9004
9383
|
|
|
9005
9384
|
"use strict";
|
|
9006
9385
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9007
9386
|
/* harmony export */ Z: () => (/* binding */ getSOPInstanceAttributes)
|
|
9008
9387
|
/* harmony export */ });
|
|
9009
|
-
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
9388
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3743);
|
|
9010
9389
|
|
|
9011
9390
|
|
|
9012
9391
|
/**
|