@ohif/app 3.7.0-beta.99 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/{202.bundle.96bbb4547a346fe3921f.js → 202.bundle.d3490836f71e001dd30f.js} +746 -19
  2. package/dist/{221.bundle.8d4059312a771ac53a19.js → 221.bundle.a331e2a9a29f9599fd40.js} +70 -14
  3. package/dist/{342.bundle.095cc16d795ac02a7b78.js → 342.bundle.3f9ebc45fdc6d6879adc.js} +40 -22
  4. package/dist/{359.bundle.d32d3e78569b6717a2fb.js → 359.bundle.aa2adce78c3935aa19c1.js} +1 -3
  5. package/dist/{370.bundle.a275a49f7b72669bce3f.js → 370.bundle.31f3d861d96bdd540dc7.js} +4 -4
  6. package/dist/{743.bundle.4bfe6e562ffb2c22708f.js → 743.bundle.489f7df3a089d4d374e1.js} +13 -0
  7. package/dist/{831.bundle.83658f62fcc769043605.js → 757.bundle.ec8301d8e70d2b990f65.js} +368 -1
  8. package/dist/{782.bundle.f6d16bde1ecbb30f1693.js → 788.bundle.b9dabaea41cb029360b1.js} +5 -305
  9. package/dist/{82.bundle.e83d670b0199d1bc717c.js → 82.bundle.ec05d3de5ac5b0c577fe.js} +61 -41
  10. package/dist/{957.bundle.71558794566041f37a92.js → 957.bundle.9ea4506963ef8b2d84ba.js} +44 -41
  11. package/dist/app.bundle.css +1 -1
  12. package/dist/{app.bundle.85c4172c936ff45dd5ae.js → app.bundle.dacb6768b481e9135f71.js} +143 -99
  13. package/dist/index.html +1 -1
  14. package/dist/sw.js +1 -1
  15. package/package.json +19 -18
  16. /package/dist/{12.bundle.c149229c3721197734b9.js → 12.bundle.b965cc54108a0b38a022.js} +0 -0
  17. /package/dist/{181.bundle.169383e9b1a0358b44e8.js → 181.bundle.ceb057236403bcb630ac.js} +0 -0
  18. /package/dist/{19.bundle.d1a02a9b42c17df51f39.js → 19.bundle.d961845411cf4e95d27c.js} +0 -0
  19. /package/dist/{236.bundle.004ffd1d05a9f69d6812.js → 236.bundle.b09ef6a3c16be7ad1d05.js} +0 -0
  20. /package/dist/{281.bundle.2faa52a55643723e80a3.js → 281.bundle.4f7c49673b5861436311.js} +0 -0
  21. /package/dist/{410.bundle.998289ecc010615b6088.js → 410.bundle.12c1bc7cb765ef74d275.js} +0 -0
  22. /package/dist/{506.bundle.f12d11057236d3e4cf05.js → 506.bundle.311783d53e8d64b84280.js} +0 -0
  23. /package/dist/{613.bundle.9d7c11a0ceefc2d954b5.js → 613.bundle.4359bc30c68b8f567140.js} +0 -0
  24. /package/dist/{663.bundle.7c704397c496dd476e11.js → 663.bundle.87300c41b902228496ec.js} +0 -0
  25. /package/dist/{687.bundle.93b66d44a4f83a1921db.js → 687.bundle.a3caefcf2e55897bad75.js} +0 -0
  26. /package/dist/{774.bundle.7528cba56a1407357144.js → 774.bundle.4b2dc46a35012b898e1a.js} +0 -0
  27. /package/dist/{814.bundle.9b3900d3b98f009990f9.js → 814.bundle.a3d1fbc03a4a3ea3f23d.js} +0 -0
  28. /package/dist/{822.bundle.0545d6dbb49515aa04ee.js → 822.bundle.891f2e57b1b7bc2f4cb4.js} +0 -0
  29. /package/dist/{99.bundle.bf2efcee897944d8a14b.js → 99.bundle.d77c8c0a957274c827da.js} +0 -0
@@ -1,4 +1,4 @@
1
- (self["webpackChunk"] = self["webpackChunk"] || []).push([[831],{
1
+ (self["webpackChunk"] = self["webpackChunk"] || []).push([[757],{
2
2
 
3
3
  /***/ 82803:
4
4
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@@ -90,6 +90,373 @@ exports.Z = function (_ref) {
90
90
  );
91
91
  };
92
92
 
93
+ /***/ }),
94
+
95
+ /***/ 49399:
96
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
97
+
98
+ "use strict";
99
+
100
+ // EXPORTS
101
+ __webpack_require__.d(__webpack_exports__, {
102
+ ZP: () => (/* binding */ vtkImageMarchingSquares$1)
103
+ });
104
+
105
+ // UNUSED EXPORTS: extend, newInstance
106
+
107
+ // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/macros.js + 6 modules
108
+ var macros = __webpack_require__(41168);
109
+ // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/PolyData.js + 9 modules
110
+ var PolyData = __webpack_require__(1299);
111
+ // EXTERNAL MODULE: ../../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js
112
+ var classCallCheck = __webpack_require__(72688);
113
+ // EXTERNAL MODULE: ../../../node_modules/@babel/runtime/helpers/esm/createClass.js
114
+ var createClass = __webpack_require__(75755);
115
+ ;// CONCATENATED MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/EdgeLocator.js
116
+
117
+
118
+
119
+ var EdgeLocator = /*#__PURE__*/function () {
120
+ function EdgeLocator() {
121
+ var oriented = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
122
+
123
+ (0,classCallCheck/* default */.Z)(this, EdgeLocator);
124
+
125
+ this.oriented = oriented;
126
+ this.edgeMap = new Map();
127
+ }
128
+
129
+ (0,createClass/* default */.Z)(EdgeLocator, [{
130
+ key: "initialize",
131
+ value: function initialize() {
132
+ this.edgeMap.clear();
133
+ }
134
+ }, {
135
+ key: "computeEdgeKey",
136
+ value: function computeEdgeKey(pointId0, pointId1) {
137
+ return this.oriented || pointId0 < pointId1 ? // Cantor pairing function:
138
+ 0.5 * (pointId0 * pointId1) * (pointId0 * pointId1 + 1) + pointId1 : 0.5 * (pointId1 * pointId0) * (pointId1 * pointId0 + 1) + pointId0;
139
+ }
140
+ }, {
141
+ key: "insertUniqueEdge",
142
+ value: function insertUniqueEdge(pointId0, pointId1, newEdgeValue) {
143
+ // Generate a unique key
144
+ var key = this.computeEdgeKey(pointId0, pointId1);
145
+ var node = this.edgeMap.get(key);
146
+
147
+ if (!node) {
148
+ // Didn't find key, so add a new edge entry
149
+ node = {
150
+ key: key,
151
+ edgeId: this.edgeMap.size,
152
+ value: newEdgeValue
153
+ };
154
+ this.edgeMap.set(key, node);
155
+ }
156
+
157
+ return node;
158
+ }
159
+ }, {
160
+ key: "insertEdge",
161
+ value: function insertEdge(pointId0, pointId1, newEdgeValue) {
162
+ // Generate a unique key
163
+ var key = this.computeEdgeKey(pointId0, pointId1);
164
+ var node = {
165
+ key: key,
166
+ edgeId: this.edgeMap.size,
167
+ value: newEdgeValue
168
+ };
169
+ this.edgeMap.set(key, node);
170
+ return node;
171
+ }
172
+ }, {
173
+ key: "isInsertedEdge",
174
+ value: function isInsertedEdge(pointId0, pointId1) {
175
+ var key = this.computeEdgeKey(pointId0, pointId1);
176
+ return this.edgeMap.get(key);
177
+ }
178
+ }], [{
179
+ key: "getEdgePointIds",
180
+ value: function getEdgePointIds(node) {
181
+ var n = 0.5 * (-1 + Math.sqrt(8 * node.key + 1));
182
+ var pointId0 = node.key - 0.5 * (n + 1) * n;
183
+ var pointId1 = n - pointId0;
184
+ return [pointId0, pointId1];
185
+ }
186
+ }]);
187
+
188
+ return EdgeLocator;
189
+ }();
190
+
191
+ function newInstance() {
192
+ var initialValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
193
+ return new EdgeLocator(initialValues.oriented);
194
+ }
195
+
196
+ var vtkEdgeLocator = {
197
+ newInstance: newInstance
198
+ };
199
+
200
+
201
+
202
+ ;// CONCATENATED MODULE: ../../../node_modules/@kitware/vtk.js/Filters/General/ImageMarchingSquares/caseTable.js
203
+ // ----------------------------------------------------------------------------
204
+ // Marching squares case functions (using lines to generate the 2D tessellation).
205
+ // For each case, a list of edge ids that form the triangles. A -1 marks the
206
+ // end of the list of edges. Edges are taken three at a time to generate
207
+ // triangle points.
208
+ // ----------------------------------------------------------------------------
209
+ var MARCHING_SQUARES_CASES = [[-1, -1, -1, -1, -1]
210
+ /* 0 */
211
+ , [0, 3, -1, -1, -1]
212
+ /* 1 */
213
+ , [1, 0, -1, -1, -1]
214
+ /* 2 */
215
+ , [1, 3, -1, -1, -1]
216
+ /* 3 */
217
+ , [2, 1, -1, -1, -1]
218
+ /* 4 */
219
+ , [0, 3, 2, 1, -1]
220
+ /* 5 */
221
+ , [2, 0, -1, -1, -1]
222
+ /* 6 */
223
+ , [2, 3, -1, -1, -1]
224
+ /* 7 */
225
+ , [3, 2, -1, -1, -1]
226
+ /* 8 */
227
+ , [0, 2, -1, -1, -1]
228
+ /* 9 */
229
+ , [1, 0, 3, 2, -1]
230
+ /* 10 */
231
+ , [1, 2, -1, -1, -1]
232
+ /* 11 */
233
+ , [3, 1, -1, -1, -1]
234
+ /* 12 */
235
+ , [0, 1, -1, -1, -1]
236
+ /* 13 */
237
+ , [3, 0, -1, -1, -1]
238
+ /* 14 */
239
+ , [-1, -1, -1, -1, -1]
240
+ /* 15 */
241
+ ];
242
+ var EDGES = [[0, 1], [1, 3], [2, 3], [0, 2]];
243
+
244
+ function getCase(index) {
245
+ return MARCHING_SQUARES_CASES[index];
246
+ } // Define the four edges of the pixel by the following pairs of vertices
247
+
248
+
249
+ function getEdge(eid) {
250
+ return EDGES[eid];
251
+ } // ----------------------------------------------------------------------------
252
+ // Static API
253
+ // ----------------------------------------------------------------------------
254
+
255
+
256
+ var vtkCaseTable = {
257
+ getCase: getCase,
258
+ getEdge: getEdge
259
+ };
260
+
261
+
262
+
263
+ ;// CONCATENATED MODULE: ../../../node_modules/@kitware/vtk.js/Filters/General/ImageMarchingSquares.js
264
+
265
+
266
+
267
+
268
+
269
+ var vtkErrorMacro = macros["default"].vtkErrorMacro,
270
+ vtkDebugMacro = macros["default"].vtkDebugMacro; // ----------------------------------------------------------------------------
271
+ // vtkImageMarchingSquares methods
272
+ // ----------------------------------------------------------------------------
273
+
274
+ function vtkImageMarchingSquares(publicAPI, model) {
275
+ // Set our className
276
+ model.classHierarchy.push('vtkImageMarchingSquares');
277
+
278
+ publicAPI.getContourValues = function () {
279
+ return model.contourValues;
280
+ };
281
+
282
+ publicAPI.setContourValues = function (cValues) {
283
+ model.contourValues = cValues;
284
+ publicAPI.modified();
285
+ };
286
+
287
+ var ids = [];
288
+ var pixelScalars = [];
289
+ var pixelPts = [];
290
+ var edgeLocator = vtkEdgeLocator.newInstance(); // Retrieve scalars and pixel coordinates. i-j-k is origin of pixel.
291
+
292
+ publicAPI.getPixelScalars = function (i, j, k, slice, dims, origin, spacing, s) {
293
+ // First get the indices for the pixel
294
+ ids[0] = k * slice + j * dims[0] + i; // i, j, k
295
+
296
+ ids[1] = ids[0] + 1; // i+1, j, k
297
+
298
+ ids[2] = ids[0] + dims[0]; // i, j+1, k
299
+
300
+ ids[3] = ids[2] + 1; // i+1, j+1, k
301
+ // Now retrieve the scalars
302
+
303
+ for (var ii = 0; ii < 4; ++ii) {
304
+ pixelScalars[ii] = s[ids[ii]];
305
+ }
306
+ }; // Retrieve pixel coordinates. i-j-k is origin of pixel.
307
+
308
+
309
+ publicAPI.getPixelPoints = function (i, j, k, dims, origin, spacing) {
310
+ // (i,i+1),(j,j+1),(k,k+1) - i varies fastest; then j; then k
311
+ pixelPts[0] = origin[0] + i * spacing[0]; // 0
312
+
313
+ pixelPts[1] = origin[1] + j * spacing[1];
314
+ pixelPts[2] = pixelPts[0] + spacing[0]; // 1
315
+
316
+ pixelPts[3] = pixelPts[1];
317
+ pixelPts[4] = pixelPts[0]; // 2
318
+
319
+ pixelPts[5] = pixelPts[1] + spacing[1];
320
+ pixelPts[6] = pixelPts[2]; // 3
321
+
322
+ pixelPts[7] = pixelPts[5];
323
+ };
324
+
325
+ publicAPI.produceLines = function (cVal, i, j, k, slice, dims, origin, spacing, scalars, points, lines) {
326
+ var CASE_MASK = [1, 2, 8, 4]; // case table is actually for quad
327
+
328
+ var xyz = [];
329
+ var pId;
330
+ publicAPI.getPixelScalars(i, j, k, slice, dims, origin, spacing, scalars);
331
+ var index = 0;
332
+
333
+ for (var idx = 0; idx < 4; idx++) {
334
+ if (pixelScalars[idx] >= cVal) {
335
+ index |= CASE_MASK[idx]; // eslint-disable-line no-bitwise
336
+ }
337
+ }
338
+
339
+ var pixelLines = vtkCaseTable.getCase(index);
340
+
341
+ if (pixelLines[0] < 0) {
342
+ return; // don't get the pixel coordinates, nothing to do
343
+ }
344
+
345
+ publicAPI.getPixelPoints(i, j, k, dims, origin, spacing);
346
+ var z = origin[2] + k * spacing[2];
347
+
348
+ for (var _idx = 0; pixelLines[_idx] >= 0; _idx += 3) {
349
+ lines.push(2);
350
+
351
+ for (var eid = 0; eid < 2; eid++) {
352
+ var edgeVerts = vtkCaseTable.getEdge(pixelLines[_idx + eid]);
353
+ pId = undefined;
354
+
355
+ if (model.mergePoints) {
356
+ var _edgeLocator$isInsert;
357
+
358
+ pId = (_edgeLocator$isInsert = edgeLocator.isInsertedEdge(ids[edgeVerts[0]], ids[edgeVerts[1]])) === null || _edgeLocator$isInsert === void 0 ? void 0 : _edgeLocator$isInsert.value;
359
+ }
360
+
361
+ if (pId === undefined) {
362
+ var t = (cVal - pixelScalars[edgeVerts[0]]) / (pixelScalars[edgeVerts[1]] - pixelScalars[edgeVerts[0]]);
363
+ var x0 = pixelPts.slice(edgeVerts[0] * 2, (edgeVerts[0] + 1) * 2);
364
+ var x1 = pixelPts.slice(edgeVerts[1] * 2, (edgeVerts[1] + 1) * 2);
365
+ xyz[0] = x0[0] + t * (x1[0] - x0[0]);
366
+ xyz[1] = x0[1] + t * (x1[1] - x0[1]);
367
+ pId = points.length / 3;
368
+ points.push(xyz[0], xyz[1], z);
369
+
370
+ if (model.mergePoints) {
371
+ edgeLocator.insertEdge(ids[edgeVerts[0]], ids[edgeVerts[1]], pId);
372
+ }
373
+ }
374
+
375
+ lines.push(pId);
376
+ }
377
+ }
378
+ };
379
+
380
+ publicAPI.requestData = function (inData, outData) {
381
+ // implement requestData
382
+ var input = inData[0];
383
+
384
+ if (!input) {
385
+ vtkErrorMacro('Invalid or missing input');
386
+ return;
387
+ }
388
+
389
+ console.time('msquares'); // Retrieve output and volume data
390
+
391
+ var origin = input.getOrigin();
392
+ var spacing = input.getSpacing();
393
+ var dims = input.getDimensions();
394
+ var s = input.getPointData().getScalars().getData(); // Points - dynamic array
395
+
396
+ var pBuffer = []; // Cells - dynamic array
397
+
398
+ var lBuffer = []; // Ensure slice is valid
399
+
400
+ var slice = dims[0] * dims[1];
401
+ var k = Math.round(model.slice);
402
+
403
+ if (k >= dims[2]) {
404
+ k = 0;
405
+ } // Loop over all contour values, and then pixels, determine case and process
406
+
407
+
408
+ for (var cv = 0; cv < model.contourValues.length; ++cv) {
409
+ for (var j = 0; j < dims[1] - 1; ++j) {
410
+ for (var i = 0; i < dims[0] - 1; ++i) {
411
+ publicAPI.produceLines(model.contourValues[cv], i, j, k, slice, dims, origin, spacing, s, pBuffer, lBuffer);
412
+ }
413
+ }
414
+
415
+ edgeLocator.initialize();
416
+ } // Update output
417
+
418
+
419
+ var polydata = PolyData/* default.newInstance */.ZP.newInstance();
420
+ polydata.getPoints().setData(new Float32Array(pBuffer), 3);
421
+ polydata.getLines().setData(new Uint32Array(lBuffer));
422
+ outData[0] = polydata;
423
+ vtkDebugMacro('Produced output');
424
+ console.timeEnd('msquares');
425
+ };
426
+ } // ----------------------------------------------------------------------------
427
+ // Object factory
428
+ // ----------------------------------------------------------------------------
429
+
430
+
431
+ var DEFAULT_VALUES = {
432
+ contourValues: [],
433
+ slice: 0,
434
+ mergePoints: false
435
+ }; // ----------------------------------------------------------------------------
436
+
437
+ function extend(publicAPI, model) {
438
+ var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
439
+ Object.assign(model, DEFAULT_VALUES, initialValues); // Make this a VTK object
440
+
441
+ macros["default"].obj(publicAPI, model); // Also make it an algorithm with one input and one output
442
+
443
+ macros["default"].algo(publicAPI, model, 1, 1);
444
+ macros["default"].setGet(publicAPI, model, ['slice', 'mergePoints']); // Object specific methods
445
+
446
+ macros["default"].algo(publicAPI, model, 1, 1);
447
+ vtkImageMarchingSquares(publicAPI, model);
448
+ } // ----------------------------------------------------------------------------
449
+
450
+ var ImageMarchingSquares_newInstance = macros["default"].newInstance(extend, 'vtkImageMarchingSquares'); // ----------------------------------------------------------------------------
451
+
452
+ var vtkImageMarchingSquares$1 = {
453
+ newInstance: ImageMarchingSquares_newInstance,
454
+ extend: extend
455
+ };
456
+
457
+
458
+
459
+
93
460
  /***/ }),
94
461
 
95
462
  /***/ 55187:
@@ -1,6 +1,6 @@
1
- (self["webpackChunk"] = self["webpackChunk"] || []).push([[782],{
1
+ (self["webpackChunk"] = self["webpackChunk"] || []).push([[788],{
2
2
 
3
- /***/ 43851:
3
+ /***/ 4483:
4
4
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5
5
 
6
6
  "use strict";
@@ -1964,310 +1964,10 @@ function createAndDownloadTMTVReport(segReport, additionalReportRows) {
1964
1964
  a.download = `${firstReport.PatientID}_tmtv.csv`;
1965
1965
  a.click();
1966
1966
  }
1967
- ;// CONCATENATED MODULE: ../../../extensions/tmtv/src/utils/dicomRTAnnotationExport/RTStructureSet/measurements/RectangleROIStartEndThreshold.js
1968
- // comment
1969
- class RectangleROIStartEndThreshold_RectangleROIStartEndThreshold {
1970
- constructor() {}
1971
- static getContourSequence(toolData, metadataProvider) {
1972
- const {
1973
- data
1974
- } = toolData;
1975
- const {
1976
- projectionPoints,
1977
- projectionPointsImageIds
1978
- } = data.cachedStats;
1979
- return projectionPoints.map((point, index) => {
1980
- const ContourData = getPointData(point);
1981
- const ContourImageSequence = getContourImageSequence(projectionPointsImageIds[index], metadataProvider);
1982
- return {
1983
- NumberOfContourPoints: ContourData.length / 3,
1984
- ContourImageSequence,
1985
- ContourGeometricType: 'CLOSED_PLANAR',
1986
- ContourData
1987
- };
1988
- });
1989
- }
1990
- }
1991
- RectangleROIStartEndThreshold_RectangleROIStartEndThreshold.toolName = 'RectangleROIStartEndThreshold';
1992
- function getPointData(points) {
1993
- // Since this is a closed contour, the order of the points is important.
1994
- // re-order the points to be in the correct order clockwise
1995
- // Spread to make sure Float32Arrays are converted to arrays
1996
- const orderedPoints = [...points[0], ...points[1], ...points[3], ...points[2]];
1997
- const pointsArray = orderedPoints.flat();
1998
-
1999
- // reduce the precision of the points to 2 decimal places
2000
- const pointsArrayWithPrecision = pointsArray.map(point => {
2001
- return point.toFixed(2);
2002
- });
2003
- return pointsArrayWithPrecision;
2004
- }
2005
- function getContourImageSequence(imageId, metadataProvider) {
2006
- const sopCommon = metadataProvider.get('sopCommonModule', imageId);
2007
- return {
2008
- ReferencedSOPClassUID: sopCommon.sopClassUID,
2009
- ReferencedSOPInstanceUID: sopCommon.sopInstanceUID
2010
- };
2011
- }
2012
- /* harmony default export */ const measurements_RectangleROIStartEndThreshold = (RectangleROIStartEndThreshold_RectangleROIStartEndThreshold);
2013
- ;// CONCATENATED MODULE: ../../../extensions/tmtv/src/utils/dicomRTAnnotationExport/RTStructureSet/measurements/AnnotationToPointData.js
2014
-
2015
- function validateAnnotation(annotation) {
2016
- if (!annotation?.data) {
2017
- throw new Error('Tool data is empty');
2018
- }
2019
- if (!annotation.metadata || annotation.metadata.referenceImageId) {
2020
- throw new Error('Tool data is not associated with any imageId');
2021
- }
2022
- }
2023
- class AnnotationToPointData {
2024
- constructor() {}
2025
- static convert(annotation, index, metadataProvider) {
2026
- validateAnnotation(annotation);
2027
- const {
2028
- toolName
2029
- } = annotation.metadata;
2030
- const toolClass = AnnotationToPointData.TOOL_NAMES[toolName];
2031
- if (!toolClass) {
2032
- throw new Error(`Unknown tool type: ${toolName}, cannot convert to RTSSReport`);
2033
- }
2034
-
2035
- // Each toolData should become a list of contours, ContourSequence
2036
- // contains a list of contours with their pointData, their geometry
2037
- // type and their length.
2038
- const ContourSequence = toolClass.getContourSequence(annotation, metadataProvider);
2039
-
2040
- // Todo: random rgb color for now, options should be passed in
2041
- const color = [Math.floor(Math.random() * 255), Math.floor(Math.random() * 255), Math.floor(Math.random() * 255)];
2042
- return {
2043
- ReferencedROINumber: index + 1,
2044
- ROIDisplayColor: color,
2045
- ContourSequence
2046
- };
2047
- }
2048
- static register(toolClass) {
2049
- AnnotationToPointData.TOOL_NAMES[toolClass.toolName] = toolClass;
2050
- }
2051
- }
2052
- AnnotationToPointData.TOOL_NAMES = {};
2053
- AnnotationToPointData.register(measurements_RectangleROIStartEndThreshold);
2054
- /* harmony default export */ const measurements_AnnotationToPointData = (AnnotationToPointData);
2055
1967
  // EXTERNAL MODULE: ../../../node_modules/dcmjs/build/dcmjs.es.js
2056
1968
  var dcmjs_es = __webpack_require__(67540);
2057
- ;// CONCATENATED MODULE: ../../../extensions/tmtv/src/utils/dicomRTAnnotationExport/RTStructureSet/RTSSReport.js
2058
-
2059
-
2060
-
2061
- const {
2062
- DicomMetaDictionary
2063
- } = dcmjs_es["default"].data;
2064
- class RTSSReport {
2065
- constructor() {}
2066
-
2067
- /**
2068
- * Convert handles to RTSSReport report object containing the dcmjs dicom dataset.
2069
- *
2070
- * Note: The tool data needs to be formatted in a specific way, and currently
2071
- * it is limited to the RectangleROIStartEndTool in the Cornerstone.
2072
- *
2073
- * @param annotations Array of Cornerstone tool annotation data
2074
- * @param metadataProvider Metadata provider
2075
- * @param options report generation options
2076
- * @returns Report object containing the dataset
2077
- */
2078
- static generateReport(annotations, metadataProvider, options) {
2079
- let dataset = initializeDataset(annotations, metadataProvider);
2080
- annotations.forEach((annotation, index) => {
2081
- const ContourSequence = measurements_AnnotationToPointData.convert(annotation, index, metadataProvider, options);
2082
- dataset.StructureSetROISequence.push(getStructureSetModule(annotation, index, metadataProvider));
2083
- dataset.ROIContourSequence.push(ContourSequence);
2084
- dataset.RTROIObservationsSequence.push(getRTROIObservationsSequence(annotation, index, metadataProvider));
2085
-
2086
- // ReferencedSeriesSequence
2087
- // Todo: handle more than one series
2088
- dataset.ReferencedSeriesSequence = getReferencedSeriesSequence(annotation, index, metadataProvider);
2089
-
2090
- // ReferencedFrameOfReferenceSequence
2091
- dataset.ReferencedFrameOfReferenceSequence = getReferencedFrameOfReferenceSequence(annotation, metadataProvider, dataset);
2092
- });
2093
- const fileMetaInformationVersionArray = new Uint8Array(2);
2094
- fileMetaInformationVersionArray[1] = 1;
2095
- const _meta = {
2096
- FileMetaInformationVersion: {
2097
- Value: [fileMetaInformationVersionArray.buffer],
2098
- vr: 'OB'
2099
- },
2100
- TransferSyntaxUID: {
2101
- Value: ['1.2.840.10008.1.2.1'],
2102
- vr: 'UI'
2103
- },
2104
- ImplementationClassUID: {
2105
- Value: [DicomMetaDictionary.uid()],
2106
- // TODO: could be git hash or other valid id
2107
- vr: 'UI'
2108
- },
2109
- ImplementationVersionName: {
2110
- Value: ['dcmjs'],
2111
- vr: 'SH'
2112
- }
2113
- };
2114
- dataset._meta = _meta;
2115
- return dataset;
2116
- }
2117
-
2118
- /**
2119
- * Generate Cornerstone tool state from dataset
2120
- * @param {object} dataset dataset
2121
- * @param {object} hooks
2122
- * @param {function} hooks.getToolClass Function to map dataset to a tool class
2123
- * @returns
2124
- */
2125
- static generateToolState(dataset) {
2126
- let hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2127
- // Todo
2128
- console.warn('RTSSReport.generateToolState not implemented');
2129
- }
2130
- }
2131
- function initializeDataset(annotations, metadataProvider) {
2132
- const rtSOPInstanceUID = DicomMetaDictionary.uid();
2133
-
2134
- // get the first annotation data
2135
- const {
2136
- referencedImageId: imageId,
2137
- FrameOfReferenceUID
2138
- } = annotations[0].metadata;
2139
- const {
2140
- studyInstanceUID
2141
- } = metadataProvider.get('generalSeriesModule', imageId);
2142
- const patientModule = getPatientModule(imageId, metadataProvider);
2143
- const rtSeriesModule = getRTSeriesModule(imageId, metadataProvider);
2144
- return {
2145
- StructureSetROISequence: [],
2146
- ROIContourSequence: [],
2147
- RTROIObservationsSequence: [],
2148
- ReferencedSeriesSequence: [],
2149
- ReferencedFrameOfReferenceSequence: [],
2150
- ...patientModule,
2151
- ...rtSeriesModule,
2152
- StudyInstanceUID: studyInstanceUID,
2153
- SOPClassUID: '1.2.840.10008.5.1.4.1.1.481.3',
2154
- // RT Structure Set Storage
2155
- SOPInstanceUID: rtSOPInstanceUID,
2156
- Manufacturer: 'dcmjs',
2157
- Modality: 'RTSTRUCT',
2158
- FrameOfReferenceUID,
2159
- PositionReferenceIndicator: '',
2160
- StructureSetLabel: '',
2161
- StructureSetName: '',
2162
- ReferringPhysicianName: '',
2163
- OperatorsName: '',
2164
- StructureSetDate: DicomMetaDictionary.date(),
2165
- StructureSetTime: DicomMetaDictionary.time()
2166
- };
2167
- }
2168
- function getPatientModule(imageId, metadataProvider) {
2169
- const generalSeriesModule = metadataProvider.get('generalSeriesModule', imageId);
2170
- const generalStudyModule = metadataProvider.get('generalStudyModule', imageId);
2171
- const patientStudyModule = metadataProvider.get('patientStudyModule', imageId);
2172
- const patientModule = metadataProvider.get('patientModule', imageId);
2173
- const patientDemographicModule = metadataProvider.get('patientDemographicModule', imageId);
2174
- return {
2175
- Modality: generalSeriesModule.modality,
2176
- PatientID: patientModule.patientId,
2177
- PatientName: patientModule.patientName,
2178
- PatientBirthDate: '',
2179
- PatientAge: patientStudyModule.patientAge,
2180
- PatientSex: patientDemographicModule.patientSex,
2181
- PatientWeight: patientStudyModule.patientWeight,
2182
- StudyDate: generalStudyModule.studyDate,
2183
- StudyTime: generalStudyModule.studyTime,
2184
- StudyID: 'ToDo',
2185
- AccessionNumber: generalStudyModule.accessionNumber
2186
- };
2187
- }
2188
- function getReferencedFrameOfReferenceSequence(toolData, metadataProvider, dataset) {
2189
- const {
2190
- referencedImageId: imageId,
2191
- FrameOfReferenceUID
2192
- } = toolData.metadata;
2193
- const instance = metadataProvider.get('instance', imageId);
2194
- const {
2195
- SeriesInstanceUID
2196
- } = instance;
2197
- const {
2198
- ReferencedSeriesSequence
2199
- } = dataset;
2200
- return [{
2201
- FrameOfReferenceUID,
2202
- RTReferencedStudySequence: [{
2203
- ReferencedSOPClassUID: dataset.SOPClassUID,
2204
- ReferencedSOPInstanceUID: dataset.SOPInstanceUID,
2205
- RTReferencedSeriesSequence: [{
2206
- SeriesInstanceUID,
2207
- ContourImageSequence: [...ReferencedSeriesSequence[0].ReferencedInstanceSequence]
2208
- }]
2209
- }]
2210
- }];
2211
- }
2212
- function getReferencedSeriesSequence(toolData, index, metadataProvider) {
2213
- // grab imageId from toolData
2214
- const {
2215
- referencedImageId: imageId
2216
- } = toolData.metadata;
2217
- const instance = metadataProvider.get('instance', imageId);
2218
- const {
2219
- SeriesInstanceUID,
2220
- StudyInstanceUID
2221
- } = instance;
2222
- const ReferencedSeriesSequence = [];
2223
- if (SeriesInstanceUID) {
2224
- const series = core_src.DicomMetadataStore.getSeries(StudyInstanceUID, SeriesInstanceUID);
2225
- const ReferencedSeries = {
2226
- SeriesInstanceUID,
2227
- ReferencedInstanceSequence: []
2228
- };
2229
- series.instances.forEach(instance => {
2230
- const {
2231
- SOPInstanceUID,
2232
- SOPClassUID
2233
- } = instance;
2234
- ReferencedSeries.ReferencedInstanceSequence.push({
2235
- ReferencedSOPClassUID: SOPClassUID,
2236
- ReferencedSOPInstanceUID: SOPInstanceUID
2237
- });
2238
- });
2239
- ReferencedSeriesSequence.push(ReferencedSeries);
2240
- }
2241
- return ReferencedSeriesSequence;
2242
- }
2243
- function getRTSeriesModule(imageId, metadataProvider) {
2244
- return {
2245
- SeriesInstanceUID: DicomMetaDictionary.uid(),
2246
- // generate a new series instance uid
2247
- SeriesNumber: '99' // Todo:: what should be the series number?
2248
- };
2249
- }
2250
-
2251
- function getStructureSetModule(toolData, index, metadataProvider) {
2252
- const {
2253
- FrameOfReferenceUID
2254
- } = toolData.metadata;
2255
- return {
2256
- ROINumber: index + 1,
2257
- ROIName: `Todo: name ${index + 1}`,
2258
- ROIDescription: `Todo: description ${index + 1}`,
2259
- ROIGenerationAlgorithm: 'Todo: algorithm',
2260
- ReferencedFrameOfReferenceUID: FrameOfReferenceUID
2261
- };
2262
- }
2263
- function getRTROIObservationsSequence(toolData, index, metadataProvider) {
2264
- return {
2265
- ObservationNumber: index + 1,
2266
- ReferencedROINumber: index + 1,
2267
- RTROIInterpretedType: 'Todo: type',
2268
- ROIInterpreter: 'Todo: interpreter'
2269
- };
2270
- }
1969
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/adapters.es.js
1970
+ var adapters_es = __webpack_require__(91202);
2271
1971
  ;// CONCATENATED MODULE: ../../../extensions/tmtv/src/utils/dicomRTAnnotationExport/RTStructureSet/dicomRTAnnotationExport.js
2272
1972
 
2273
1973
 
@@ -2277,7 +1977,7 @@ const {
2277
1977
  } = dcmjs_es["default"].data;
2278
1978
  const metadataProvider = core_src.classes.MetadataProvider;
2279
1979
  function dicomRTAnnotationExport(annotations) {
2280
- const dataset = RTSSReport.generateReport(annotations, metadataProvider);
1980
+ const dataset = adapters_es.adaptersRT.Cornerstone3D.RTSS.generateRTSSFromAnnotations(annotations, metadataProvider, core_src.DicomMetadataStore);
2281
1981
  const reportBlob = datasetToBlob(dataset);
2282
1982
 
2283
1983
  //Create a URL for the binary.