@ohif/app 3.13.0-beta.88 → 3.13.0-beta.89

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 (53) hide show
  1. package/dist/{5491.bundle.4866d2ecb20dd089e071.js → 1124.bundle.3c1b947a1884362c1241.js} +376 -222
  2. package/dist/1429.bundle.bd1585628440399e6c3f.js +2079 -0
  3. package/dist/{2108.bundle.142ee8d405727d02b16a.js → 1704.bundle.38d95b81b9e1293e04de.js} +1 -643
  4. package/dist/{7537.bundle.3c7d71348190ed4e9565.js → 1741.bundle.abc3a09729ada4c25685.js} +105024 -55129
  5. package/dist/{1927.bundle.be67b3aafe238ca9f191.js → 1927.bundle.1749aa6ae7b1dd3d06b1.js} +1 -1
  6. package/dist/{6354.bundle.929febcf6d326e582e00.js → 2802.bundle.3d6cc53ef3c69901431d.js} +31 -324
  7. package/dist/{3461.bundle.9bc7ca0f93d754014c23.js → 3461.bundle.2f3e998096ef3fca602b.js} +5 -4
  8. package/dist/{3617.bundle.f408991512372e52c6cf.js → 3617.bundle.f7f53b332f72e9fe6374.js} +2 -2
  9. package/dist/{3754.bundle.477cfd7fc3ff13e9dc67.js → 3754.bundle.2a46971b209140d4cb08.js} +12 -6
  10. package/dist/{9039.bundle.49ab126163ca208e52b3.js → 4335.bundle.69a7cc007e85f043488e.js} +4114 -4263
  11. package/dist/{4579.bundle.1c315389368cc476aed3.js → 451.bundle.6634a9dae2b4f0e9ebc9.js} +83 -30
  12. package/dist/{5028.bundle.4960393948811673d99b.js → 5028.bundle.f483671d94ded4c8f6f3.js} +2 -2
  13. package/dist/{5858.bundle.466e58128de344ab53f3.js → 5858.bundle.c25c73ecbc47b1a69cea.js} +0 -4
  14. package/dist/{6125.bundle.2c6f2ba3bd8e1493e54b.js → 6125.bundle.4e46ecd271f647cb977f.js} +2 -2087
  15. package/dist/{6376.bundle.f5ef0f5465d575d0dbb0.js → 6376.bundle.c7c515ba478be810e03d.js} +6 -3
  16. package/dist/{9567.bundle.ff782480a4c66e306027.js → 650.bundle.5decc3ce72a22162b8f4.js} +3080 -216
  17. package/dist/{7166.bundle.0a84efe4f3e6d0ddcbec.js → 7166.bundle.eeeda537770d73736e46.js} +161 -55
  18. package/dist/{6386.bundle.dc7e3b159d6b4733647f.js → 741.bundle.e47adc12429ee838d3fb.js} +3408 -3722
  19. package/dist/{7431.bundle.a9b4dbf97a8c196efe51.js → 7431.bundle.c3bd9a9f1ea743c81335.js} +61 -60
  20. package/dist/{8305.bundle.8088b210631f2b22899d.js → 8305.bundle.71787ad9e3df5d1dd30d.js} +2 -2
  21. package/dist/{8558.bundle.79c567857e04df2694cc.js → 8558.bundle.00d5dbdf73ca0a44831a.js} +1 -1
  22. package/dist/{8583.bundle.e36ff2fc6ee67e4e4232.js → 8583.bundle.40859ef5654559a1c66b.js} +3 -3
  23. package/dist/{9205.bundle.c974537f15d86687f6d2.js → 9205.bundle.d43cd617e38109746e4d.js} +2257 -2133
  24. package/dist/{4287.bundle.4f28e48c1e39a46dfc87.js → 9400.bundle.a56bfccf2bf7a51ed297.js} +1362 -692
  25. package/dist/{2075.bundle.ba9ac60662f1fa739378.js → 9475.bundle.693fe4de0573042a17f3.js} +203 -156
  26. package/dist/{app.bundle.3b116829d23059e8d9d8.js → app.bundle.93ee83d5e283aa1496da.js} +81239 -52123
  27. package/dist/{compute.bundle.2b82d8a0d1f3b41df1d2.js → compute.bundle.2fc1182cc9b2af5f4a40.js} +3 -15
  28. package/dist/{histogram-worker.bundle.a2a50c4674d99c619ca7.js → histogram-worker.bundle.c81373ef983363586dc5.js} +4 -4
  29. package/dist/index.html +1 -1
  30. package/dist/{interpolation.bundle.35be9e5cf473c6ebd3da.js → interpolation.bundle.a31edd1d26d81ef65b9b.js} +6 -6
  31. package/dist/{polySeg.bundle.ad2080f28d2c471bf208.js → polySeg.bundle.294012e3a5458cd3fecc.js} +3 -15
  32. package/dist/sw.js +1 -1
  33. package/package.json +21 -21
  34. /package/dist/{1459.bundle.23ea55eeadd13d26d6b5.js → 1459.bundle.763540bccf93fda17fff.js} +0 -0
  35. /package/dist/{1933.bundle.5713711c4a8f6518803b.js → 1933.bundle.8d54b74d93a7354925c5.js} +0 -0
  36. /package/dist/{2018.bundle.fee6699868f9e280861c.js → 2018.bundle.7ba8f9afeb48defb425b.js} +0 -0
  37. /package/dist/{213.bundle.3c0a19cba715a9a87151.js → 213.bundle.1a54c6878a493c5b61c5.js} +0 -0
  38. /package/dist/{2424.bundle.1d615d02f985abbbc633.js → 2424.bundle.c6d74f7129108d885a1b.js} +0 -0
  39. /package/dist/{2516.bundle.6b52ced19754035768ae.js → 2516.bundle.28427294c53e067811ca.js} +0 -0
  40. /package/dist/{3138.bundle.451e4105dda240465e6d.js → 3138.bundle.3845b7e06b8ab2564951.js} +0 -0
  41. /package/dist/{4507.bundle.51470574cbf11549ff72.js → 4507.bundle.b658ff59d35614916a2b.js} +0 -0
  42. /package/dist/{4819.bundle.c5e695cd51065d2a1a88.js → 4819.bundle.e28f5f1f0d481e190bb1.js} +0 -0
  43. /package/dist/{5015.bundle.647c560efcc9942bb42c.js → 5015.bundle.455552a6df9b442b3c40.js} +0 -0
  44. /package/dist/{5457.bundle.45b43e0e56637108f8f1.js → 5457.bundle.ee1026db729958b36a2e.js} +0 -0
  45. /package/dist/{5485.bundle.3d2d3a7f37f948da2269.js → 5485.bundle.0ecad3940c321ae65b23.js} +0 -0
  46. /package/dist/{5802.bundle.da6055b6bf1a3db7b6d5.js → 5802.bundle.5e1a7df7ad850a5370f8.js} +0 -0
  47. /package/dist/{5830.bundle.d026ec38980fb12f2518.js → 5830.bundle.8327ccd3c8a6334ac315.js} +0 -0
  48. /package/dist/{6027.bundle.ea7a56c1ebde501ce02d.js → 6027.bundle.f276566b6237d9e16333.js} +0 -0
  49. /package/dist/{7639.bundle.2b4ae693bddf15fb9641.js → 7639.bundle.25e1a86f2248148c35d5.js} +0 -0
  50. /package/dist/{8499.bundle.f94b5427bb2889634aeb.js → 8499.bundle.22f25667db4ab2e59e57.js} +0 -0
  51. /package/dist/{85.bundle.f7cb4cf8432ca6a815c0.js → 85.bundle.2aa39c9bf12258c7ca68.js} +0 -0
  52. /package/dist/{9862.bundle.f92516a34b9cef88c56f.js → 9862.bundle.fb87529360fb93010555.js} +0 -0
  53. /package/dist/{9927.bundle.5cf09e95f0253210d431.js → 9927.bundle.f6e7785bceeeb7a1c62e.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[2075],{
2
+ (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[9475],{
3
3
 
4
4
  /***/ 18262
5
5
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
@@ -170,6 +170,70 @@ function drawHandles(svgDrawingHelper, annotationUID, handleGroupUID, handlePoin
170
170
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (drawHandles);
171
171
 
172
172
 
173
+ /***/ },
174
+
175
+ /***/ 17311
176
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
177
+
178
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
179
+ /* harmony export */ A: () => (/* binding */ drawPath)
180
+ /* harmony export */ });
181
+ /* harmony import */ var _getHash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(97181);
182
+ /* harmony import */ var _setNewAttributesIfValid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(56442);
183
+ /* harmony import */ var _setAttributesIfNecessary__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(85899);
184
+
185
+
186
+
187
+ function drawPath(svgDrawingHelper, annotationUID, pathUID, points, options) {
188
+ const hasSubArrays = points.length && points[0].length && Array.isArray(points[0][0]);
189
+ const pointsArrays = hasSubArrays ? points : [points];
190
+ const { color = 'rgb(0, 255, 0)', width = 10, fillColor = 'none', fillOpacity = 0, strokeOpacity = 1, lineWidth, lineDash, lineCap, lineJoin, closePath = false, } = options;
191
+ const strokeWidth = lineWidth || width;
192
+ const svgns = 'http://www.w3.org/2000/svg';
193
+ const svgNodeHash = (0,_getHash__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(annotationUID, 'path', pathUID);
194
+ const existingNode = svgDrawingHelper.getSvgNode(svgNodeHash);
195
+ let pointsAttribute = '';
196
+ for (let i = 0, numArrays = pointsArrays.length; i < numArrays; i++) {
197
+ const points = pointsArrays[i];
198
+ const numPoints = points.length;
199
+ if (numPoints < 2) {
200
+ continue;
201
+ }
202
+ for (let j = 0; j < numPoints; j++) {
203
+ const point = points[j];
204
+ const cmd = j ? 'L' : 'M';
205
+ pointsAttribute += `${cmd} ${point[0].toFixed(1)}, ${point[1].toFixed(1)} `;
206
+ }
207
+ if (closePath) {
208
+ pointsAttribute += 'Z ';
209
+ }
210
+ }
211
+ if (!pointsAttribute) {
212
+ return;
213
+ }
214
+ const attributes = {
215
+ d: pointsAttribute,
216
+ stroke: color,
217
+ fill: fillColor,
218
+ 'fill-opacity': fillOpacity,
219
+ 'stroke-opacity': strokeOpacity,
220
+ 'stroke-width': strokeWidth,
221
+ 'stroke-dasharray': lineDash,
222
+ 'stroke-linecap': lineCap,
223
+ 'stroke-linejoin': lineJoin,
224
+ };
225
+ if (existingNode) {
226
+ (0,_setAttributesIfNecessary__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)(attributes, existingNode);
227
+ svgDrawingHelper.setNodeTouched(svgNodeHash);
228
+ }
229
+ else {
230
+ const newNode = document.createElementNS(svgns, 'path');
231
+ (0,_setNewAttributesIfValid__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(attributes, newNode);
232
+ svgDrawingHelper.appendNode(newNode, svgNodeHash);
233
+ }
234
+ }
235
+
236
+
173
237
  /***/ },
174
238
 
175
239
  /***/ 97530
@@ -426,31 +490,6 @@ const segmentationStyle = new SegmentationStyle();
426
490
 
427
491
 
428
492
 
429
- /***/ },
430
-
431
- /***/ 98798
432
- (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
433
-
434
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
435
- /* harmony export */ Q: () => (/* binding */ triggerSegmentationDataModified)
436
- /* harmony export */ });
437
- /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
438
- /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29857);
439
- /* harmony import */ var _utilities_segmentation_utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(64063);
440
-
441
-
442
-
443
- function triggerSegmentationDataModified(segmentationId, modifiedSlicesToUse, segmentIndex) {
444
- const eventDetail = {
445
- segmentationId,
446
- modifiedSlicesToUse,
447
- segmentIndex,
448
- };
449
- (0,_utilities_segmentation_utilities__WEBPACK_IMPORTED_MODULE_2__/* .setSegmentationDirty */ .HM)(segmentationId);
450
- (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.triggerEvent)(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.eventTarget, _enums__WEBPACK_IMPORTED_MODULE_1__.Events.SEGMENTATION_DATA_MODIFIED, eventDetail);
451
- }
452
-
453
-
454
493
  /***/ },
455
494
 
456
495
  /***/ 67165
@@ -483,50 +522,6 @@ function getSegmentationRepresentationVisibility(viewportId, specifier) {
483
522
  }
484
523
 
485
524
 
486
- /***/ },
487
-
488
- /***/ 44188
489
- (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
490
-
491
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
492
- /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
493
- /* harmony export */ });
494
- /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33283);
495
- /* harmony import */ var _enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(18682);
496
-
497
-
498
- function internalAddRepresentationData({ segmentationId, type, data, }) {
499
- const segmentation = (0,_getSegmentation__WEBPACK_IMPORTED_MODULE_0__/* .getSegmentation */ .T)(segmentationId);
500
- if (!segmentation) {
501
- throw new Error(`Segmentation ${segmentationId} not found`);
502
- }
503
- if (segmentation.representationData[type]) {
504
- console.warn(`Representation data of type ${type} already exists for segmentation ${segmentationId}, overwriting it.`);
505
- }
506
- switch (type) {
507
- case _enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.Labelmap:
508
- if (data) {
509
- segmentation.representationData[type] =
510
- data;
511
- }
512
- break;
513
- case _enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.Contour:
514
- if (data) {
515
- segmentation.representationData[type] = data;
516
- }
517
- break;
518
- case _enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.Surface:
519
- if (data) {
520
- segmentation.representationData[type] = data;
521
- }
522
- break;
523
- default:
524
- throw new Error(`Invalid representation type ${type}`);
525
- }
526
- }
527
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (internalAddRepresentationData);
528
-
529
-
530
525
  /***/ },
531
526
 
532
527
  /***/ 65136
@@ -570,12 +565,12 @@ function getToolGroupForViewport(viewportId, renderingEngineId) {
570
565
  /* harmony import */ var _stateManagement_segmentation_triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(49906);
571
566
  /* harmony import */ var _PlanarFreehandROITool__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28220);
572
567
  /* harmony import */ var _utilities_contours_AnnotationToPointData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29632);
568
+ var _a;
573
569
 
574
570
 
575
571
 
576
572
 
577
573
  class PlanarFreehandContourSegmentationTool extends _PlanarFreehandROITool__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A {
578
- static { this.toolName = 'PlanarFreehandContourSegmentationTool'; }
579
574
  constructor(toolProps) {
580
575
  const initialProps = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.deepMerge({
581
576
  configuration: {
@@ -585,9 +580,6 @@ class PlanarFreehandContourSegmentationTool extends _PlanarFreehandROITool__WEBP
585
580
  }, toolProps);
586
581
  super(initialProps);
587
582
  }
588
- static {
589
- _utilities_contours_AnnotationToPointData__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A.register(this);
590
- }
591
583
  isContourSegmentationTool() {
592
584
  return true;
593
585
  }
@@ -602,6 +594,11 @@ class PlanarFreehandContourSegmentationTool extends _PlanarFreehandROITool__WEBP
602
594
  return renderResult;
603
595
  }
604
596
  }
597
+ _a = PlanarFreehandContourSegmentationTool;
598
+ PlanarFreehandContourSegmentationTool.toolName = 'PlanarFreehandContourSegmentationTool';
599
+ (() => {
600
+ _utilities_contours_AnnotationToPointData__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A.register(_a);
601
+ })();
605
602
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PlanarFreehandContourSegmentationTool);
606
603
 
607
604
 
@@ -660,7 +657,6 @@ const { pointCanProjectOnLine } = _utilities_math__WEBPACK_IMPORTED_MODULE_3__.p
660
657
  const { EPSILON } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.CONSTANTS;
661
658
  const PARALLEL_THRESHOLD = 1 - EPSILON;
662
659
  class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .A {
663
- static { this.toolName = 'PlanarFreehandROI'; }
664
660
  constructor(toolProps = {}, defaultToolProps = {
665
661
  supportedInteractionTypes: ['Mouse', 'Touch'],
666
662
  configuration: {
@@ -1165,6 +1161,7 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
1165
1161
  };
1166
1162
  }
1167
1163
  }
1164
+ PlanarFreehandROITool.toolName = 'PlanarFreehandROI';
1168
1165
  function defaultGetTextLines(data, targetId) {
1169
1166
  const cachedVolumeStats = data.cachedStats[targetId];
1170
1167
  const { area, mean, stdDev, length, perimeter, max, min, isEmptyArea, unit, areaUnit, modalityUnit, } = cachedVolumeStats || {};
@@ -1223,9 +1220,12 @@ function defaultGetTextLines(data, targetId) {
1223
1220
  /* harmony import */ var _cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(7001);
1224
1221
  /* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(58640);
1225
1222
  /* harmony import */ var _utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(40634);
1226
- /* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(18990);
1227
- /* harmony import */ var _utilities_math_basic__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(73262);
1228
- /* harmony import */ var _stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(76712);
1223
+ /* harmony import */ var _utilities_viewportCapabilities__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(90398);
1224
+ /* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(18990);
1225
+ /* harmony import */ var _utilities_math_basic__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(73262);
1226
+ /* harmony import */ var _stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(76712);
1227
+ var _a;
1228
+
1229
1229
 
1230
1230
 
1231
1231
 
@@ -1248,7 +1248,6 @@ function defaultGetTextLines(data, targetId) {
1248
1248
 
1249
1249
  const { transformWorldToIndex } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities;
1250
1250
  class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationTool */ .EC {
1251
- static { this.toolName = 'RectangleROI'; }
1252
1251
  constructor(toolProps = {}, defaultToolProps = {
1253
1252
  supportedInteractionTypes: ['Mouse', 'Touch'],
1254
1253
  configuration: {
@@ -1257,7 +1256,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
1257
1256
  preventHandleOutsideImage: false,
1258
1257
  calculateStats: true,
1259
1258
  getTextLines: defaultGetTextLines,
1260
- statsCalculator: _utilities_math_basic__WEBPACK_IMPORTED_MODULE_18__.BasicStatsCalculator,
1259
+ statsCalculator: _utilities_math_basic__WEBPACK_IMPORTED_MODULE_19__.BasicStatsCalculator,
1261
1260
  },
1262
1261
  }) {
1263
1262
  super(toolProps, defaultToolProps);
@@ -1580,7 +1579,9 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
1580
1579
  const { referencedImageId } = annotation.metadata;
1581
1580
  for (const targetId in data.cachedStats) {
1582
1581
  if (targetId.startsWith('imageId')) {
1583
- const viewports = renderingEngine.getStackViewports();
1582
+ const viewports = renderingEngine
1583
+ .getViewports()
1584
+ .filter(_utilities_viewportCapabilities__WEBPACK_IMPORTED_MODULE_17__/* .viewportSupportsImageSlices */ .hz);
1584
1585
  const invalidatedStack = viewports.find((vp) => {
1585
1586
  const referencedImageURI = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.imageIdToURI(referencedImageId);
1586
1587
  const hasImageURI = vp.hasImageURI(referencedImageURI);
@@ -1608,7 +1609,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
1608
1609
  activeHandleIndex !== undefined) {
1609
1610
  activeHandleCanvasCoords = [canvasCoordinates[activeHandleIndex]];
1610
1611
  }
1611
- const showHandlesAlways = Boolean((0,_stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_19__/* .getStyleProperty */ .h)('showHandlesAlways', {}));
1612
+ const showHandlesAlways = Boolean((0,_stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_20__/* .getStyleProperty */ .h)('showHandlesAlways', {}));
1612
1613
  if (activeHandleCanvasCoords || showHandlesAlways) {
1613
1614
  const handleGroupUID = '0';
1614
1615
  (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_9__.drawHandles)(svgDrawingHelper, annotationUID, handleGroupUID, showHandlesAlways ? canvasCoordinates : activeHandleCanvasCoords, {
@@ -1684,18 +1685,18 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
1684
1685
  ];
1685
1686
  const handles = [pos1Index, pos2Index];
1686
1687
  const calibrate = (0,_utilities_getCalibratedUnits__WEBPACK_IMPORTED_MODULE_3__/* .getCalibratedLengthUnitsAndScale */ .Op)(image, handles);
1687
- const width = RectangleROITool.calculateLengthInIndex(calibrate, [
1688
+ const width = _a.calculateLengthInIndex(calibrate, [
1688
1689
  indexHandles[0],
1689
1690
  indexHandles[1],
1690
1691
  ]);
1691
- const height = RectangleROITool.calculateLengthInIndex(calibrate, [
1692
+ const height = _a.calculateLengthInIndex(calibrate, [
1692
1693
  indexHandles[0],
1693
1694
  indexHandles[2],
1694
1695
  ]);
1695
1696
  const area = Math.abs(width * height);
1696
1697
  const { areaUnit } = calibrate;
1697
1698
  const pixelUnitsOptions = {
1698
- isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_17__/* .isViewportPreScaled */ .u)(viewport, targetId),
1699
+ isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_18__/* .isViewportPreScaled */ .u)(viewport, targetId),
1699
1700
  isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
1700
1701
  };
1701
1702
  const modalityUnit = (0,_utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_16__/* .getPixelValueUnits */ .j)(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
@@ -1741,40 +1742,42 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
1741
1742
  };
1742
1743
  this._throttledCalculateCachedStats = (0,_utilities_throttle__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)(this._calculateCachedStats, 100, { trailing: true });
1743
1744
  }
1744
- static { this.hydrate = (viewportId, points, options) => {
1745
- const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElementByViewportId)(viewportId);
1746
- if (!enabledElement) {
1747
- return;
1748
- }
1749
- const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(RectangleROITool, enabledElement, points, options);
1750
- const { toolInstance, ...serializableOptions } = options || {};
1751
- const annotation = {
1752
- annotationUID: options?.annotationUID || _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.uuidv4(),
1753
- data: {
1754
- handles: {
1755
- points,
1756
- activeHandleIndex: null,
1757
- },
1758
- label: '',
1759
- cachedStats: {},
1760
- },
1761
- highlighted: false,
1762
- autoGenerated: false,
1763
- invalidated: false,
1764
- isLocked: false,
1765
- isVisible: true,
1766
- metadata: {
1767
- toolName: instance.getToolName(),
1768
- viewPlaneNormal,
1769
- FrameOfReferenceUID,
1770
- referencedImageId,
1771
- ...serializableOptions,
1772
- },
1773
- };
1774
- (0,_stateManagement__WEBPACK_IMPORTED_MODULE_5__/* .addAnnotation */ .lC)(annotation, viewport.element);
1775
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)([viewport.id]);
1776
- }; }
1777
1745
  }
1746
+ _a = RectangleROITool;
1747
+ RectangleROITool.toolName = 'RectangleROI';
1748
+ RectangleROITool.hydrate = (viewportId, points, options) => {
1749
+ const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElementByViewportId)(viewportId);
1750
+ if (!enabledElement) {
1751
+ return;
1752
+ }
1753
+ const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
1754
+ const { toolInstance, ...serializableOptions } = options || {};
1755
+ const annotation = {
1756
+ annotationUID: options?.annotationUID || _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.uuidv4(),
1757
+ data: {
1758
+ handles: {
1759
+ points,
1760
+ activeHandleIndex: null,
1761
+ },
1762
+ label: '',
1763
+ cachedStats: {},
1764
+ },
1765
+ highlighted: false,
1766
+ autoGenerated: false,
1767
+ invalidated: false,
1768
+ isLocked: false,
1769
+ isVisible: true,
1770
+ metadata: {
1771
+ toolName: instance.getToolName(),
1772
+ viewPlaneNormal,
1773
+ FrameOfReferenceUID,
1774
+ referencedImageId,
1775
+ ...serializableOptions,
1776
+ },
1777
+ };
1778
+ (0,_stateManagement__WEBPACK_IMPORTED_MODULE_5__/* .addAnnotation */ .lC)(annotation, viewport.element);
1779
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)([viewport.id]);
1780
+ };
1778
1781
  function defaultGetTextLines(data, targetId) {
1779
1782
  const cachedVolumeStats = data.cachedStats[targetId];
1780
1783
  const { area, mean, max, stdDev, areaUnit, modalityUnit, min } = cachedVolumeStats;
@@ -1823,6 +1826,8 @@ function defaultGetTextLines(data, targetId) {
1823
1826
  /* harmony import */ var _stateManagement_annotation_annotationSelection__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(17343);
1824
1827
  /* harmony import */ var _utilities_contourSegmentation__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(56534);
1825
1828
  /* harmony import */ var _utilities_safeStructuredClone__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(33459);
1829
+ /* harmony import */ var _utilities_getViewportICamera__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(29604);
1830
+
1826
1831
 
1827
1832
 
1828
1833
 
@@ -2116,7 +2121,7 @@ class AnnotationTool extends _AnnotationDisplayTool__WEBPACK_IMPORTED_MODULE_2__
2116
2121
  }
2117
2122
  const { viewport } = enabledElement;
2118
2123
  const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
2119
- const camera = viewport.getCamera();
2124
+ const camera = (0,_utilities_getViewportICamera__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .A)(viewport);
2120
2125
  const viewPlaneNormal = options.viewplaneNormal ?? camera.viewPlaneNormal;
2121
2126
  const viewUp = options.viewUp ?? camera.viewUp;
2122
2127
  const instance = options.toolInstance || new ToolClass();
@@ -2162,7 +2167,7 @@ AnnotationTool.toolName = 'AnnotationTool';
2162
2167
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2163
2168
 
2164
2169
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2165
- /* harmony export */ A: () => (/* binding */ LabelmapBaseTool)
2170
+ /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
2166
2171
  /* harmony export */ });
2167
2172
  /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
2168
2173
  /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85817);
@@ -2180,6 +2185,12 @@ AnnotationTool.toolName = 'AnnotationTool';
2180
2185
  /* harmony import */ var _utilities_math_polyline__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(92984);
2181
2186
  /* harmony import */ var _stateManagement_segmentation_triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(49906);
2182
2187
  /* harmony import */ var _strategies__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(99522);
2188
+ /* harmony import */ var _stateManagement_segmentation_helpers_getViewportLabelmapRenderMode__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(33214);
2189
+ /* harmony import */ var _stateManagement_segmentation_helpers_labelmapSegmentationState__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(90660);
2190
+ /* harmony import */ var _utilities_getViewportICamera__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(29604);
2191
+
2192
+
2193
+
2183
2194
 
2184
2195
 
2185
2196
 
@@ -2197,14 +2208,6 @@ AnnotationTool.toolName = 'AnnotationTool';
2197
2208
 
2198
2209
 
2199
2210
  class LabelmapBaseTool extends _base__WEBPACK_IMPORTED_MODULE_1__/* .BaseTool */ .oS {
2200
- static { this.previewData = {
2201
- preview: null,
2202
- element: null,
2203
- timerStart: 0,
2204
- timer: null,
2205
- startPoint: [NaN, NaN],
2206
- isDrag: false,
2207
- }; }
2208
2211
  constructor(toolProps, defaultToolProps) {
2209
2212
  super(toolProps, defaultToolProps);
2210
2213
  this.memoMap = new Map();
@@ -2226,6 +2229,9 @@ class LabelmapBaseTool extends _base__WEBPACK_IMPORTED_MODULE_1__/* .BaseTool */
2226
2229
  const memoData = this.acceptedMemoIds.get(id);
2227
2230
  const element = memoData?.element;
2228
2231
  const operationData = this.getOperationData(element);
2232
+ if (!operationData) {
2233
+ return;
2234
+ }
2229
2235
  operationData.segmentIndex = memoData?.segmentIndex;
2230
2236
  if (element) {
2231
2237
  this.applyActiveStrategyCallback((0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element), operationData, _enums__WEBPACK_IMPORTED_MODULE_9__.StrategyCallbacks.AcceptPreview);
@@ -2282,40 +2288,37 @@ class LabelmapBaseTool extends _base__WEBPACK_IMPORTED_MODULE_1__/* .BaseTool */
2282
2288
  return editData;
2283
2289
  }
2284
2290
  getEditData({ viewport, representationData, segmentsLocked, segmentationId, }) {
2285
- if (viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.BaseVolumeViewport) {
2286
- if (!representationData[_enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A.Labelmap]) {
2287
- return;
2288
- }
2289
- const { volumeId } = representationData[_enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A.Labelmap];
2290
- if (!volumeId) {
2291
+ const viewportRenderMode = (0,_stateManagement_segmentation_helpers_getViewportLabelmapRenderMode__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewport);
2292
+ const activeSegmentIndex = (0,_stateManagement_segmentation_getActiveSegmentIndex__WEBPACK_IMPORTED_MODULE_8__/* .getActiveSegmentIndex */ .Q)(segmentationId);
2293
+ const segmentation = (0,_stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_5__/* .getSegmentation */ .T)(segmentationId);
2294
+ const layerForEdit = activeSegmentIndex
2295
+ ? (0,_stateManagement_segmentation_helpers_labelmapSegmentationState__WEBPACK_IMPORTED_MODULE_17__/* .resolveLabelmapForSegment */ .Nf)(segmentation, activeSegmentIndex)
2296
+ : undefined;
2297
+ if (viewportRenderMode === 'volume' ||
2298
+ viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.BaseVolumeViewport) {
2299
+ const segmentationVolume = layerForEdit
2300
+ ? (0,_stateManagement_segmentation_helpers_labelmapSegmentationState__WEBPACK_IMPORTED_MODULE_17__/* .getOrCreateLabelmapVolume */ .kL)(layerForEdit)
2301
+ : undefined;
2302
+ const volumeId = layerForEdit?.volumeId ?? segmentationVolume?.volumeId;
2303
+ if (!segmentationVolume || !volumeId) {
2291
2304
  return;
2292
2305
  }
2293
2306
  const actors = viewport.getActors();
2294
- const isStackViewport = viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.StackViewport;
2295
- if (isStackViewport) {
2296
- const event = new CustomEvent(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.Enums.Events.ERROR_EVENT, {
2297
- detail: {
2298
- type: 'Segmentation',
2299
- message: 'Cannot perform brush operation on the selected viewport',
2300
- },
2301
- cancelable: true,
2302
- });
2303
- _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.eventTarget.dispatchEvent(event);
2304
- return null;
2305
- }
2306
2307
  const volumes = actors
2307
2308
  .filter((actorEntry) => actorEntry.referencedId)
2308
- .map((actorEntry) => _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getVolume(actorEntry.referencedId));
2309
- const segmentationVolume = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getVolume(volumeId);
2309
+ .map((actorEntry) => _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getVolume(actorEntry.referencedId))
2310
+ .filter((volume) => !!volume);
2310
2311
  const referencedVolumeIdToThreshold = volumes.find((volume) => _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.isEqual(volume.dimensions, segmentationVolume.dimensions))?.volumeId || volumes[0]?.volumeId;
2311
2312
  return {
2312
2313
  volumeId,
2313
2314
  referencedVolumeId: this.configuration.threshold?.volumeId ??
2315
+ layerForEdit?.referencedVolumeId ??
2316
+ segmentationVolume.referencedVolumeId ??
2314
2317
  referencedVolumeIdToThreshold,
2315
2318
  segmentsLocked,
2316
2319
  };
2317
2320
  }
2318
- else {
2321
+ if (viewportRenderMode === 'image') {
2319
2322
  const segmentationImageId = (0,_stateManagement_segmentation_getCurrentLabelmapImageIdForViewport__WEBPACK_IMPORTED_MODULE_6__/* .getCurrentLabelmapImageIdForViewport */ .vl)(viewport.id, segmentationId);
2320
2323
  if (!segmentationImageId) {
2321
2324
  return;
@@ -2325,14 +2328,30 @@ class LabelmapBaseTool extends _base__WEBPACK_IMPORTED_MODULE_1__/* .BaseTool */
2325
2328
  segmentsLocked,
2326
2329
  };
2327
2330
  }
2331
+ const event = new CustomEvent(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.Enums.Events.ERROR_EVENT, {
2332
+ detail: {
2333
+ type: 'Segmentation',
2334
+ message: 'Cannot perform brush operation on the selected viewport',
2335
+ },
2336
+ cancelable: true,
2337
+ });
2338
+ _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.eventTarget.dispatchEvent(event);
2339
+ return null;
2328
2340
  }
2329
2341
  createHoverData(element, centerCanvas) {
2330
2342
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
2331
2343
  const { viewport } = enabledElement;
2332
- const camera = viewport.getCamera();
2344
+ const camera = (0,_utilities_getViewportICamera__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .A)(viewport);
2333
2345
  const { viewPlaneNormal, viewUp } = camera;
2346
+ if (!viewPlaneNormal || !viewUp) {
2347
+ return;
2348
+ }
2334
2349
  const viewportIdsToRender = [viewport.id];
2335
- const { segmentIndex, segmentationId, segmentColor } = this.getActiveSegmentationData(viewport) || {};
2350
+ const activeSegmentationData = this.getActiveSegmentationData(viewport);
2351
+ if (!activeSegmentationData) {
2352
+ return;
2353
+ }
2354
+ const { segmentIndex, segmentationId, segmentColor } = activeSegmentationData;
2336
2355
  const brushCursor = {
2337
2356
  metadata: {
2338
2357
  viewPlaneNormal: [...viewPlaneNormal],
@@ -2374,11 +2393,19 @@ class LabelmapBaseTool extends _base__WEBPACK_IMPORTED_MODULE_1__/* .BaseTool */
2374
2393
  }
2375
2394
  getOperationData(element) {
2376
2395
  const editData = this._editData || this.createEditData(element);
2377
- const { segmentIndex, segmentationId, brushCursor } = this._hoverData || this.createHoverData(element);
2396
+ const hoverData = this._hoverData || this.createHoverData(element);
2397
+ if (!editData || !hoverData) {
2398
+ return;
2399
+ }
2400
+ const { segmentIndex, segmentationId, brushCursor } = hoverData;
2378
2401
  const { data, metadata = {} } = brushCursor || {};
2379
2402
  const { viewPlaneNormal, viewUp } = metadata;
2403
+ const points = data?.editPoints || data?.handles?.points;
2380
2404
  const configColor = this.configuration.preview?.previewColors?.[segmentIndex];
2381
- const { viewport } = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
2405
+ const { viewport } = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element) || {};
2406
+ if (!viewport || !segmentIndex || !segmentationId) {
2407
+ return;
2408
+ }
2382
2409
  const segmentColor = (0,_stateManagement_segmentation_config_segmentationColor__WEBPACK_IMPORTED_MODULE_7__.getSegmentIndexColor)(viewport.id, segmentationId, segmentIndex);
2383
2410
  if (!configColor && !segmentColor) {
2384
2411
  return;
@@ -2390,7 +2417,7 @@ class LabelmapBaseTool extends _base__WEBPACK_IMPORTED_MODULE_1__/* .BaseTool */
2390
2417
  }
2391
2418
  const operationData = {
2392
2419
  ...editData,
2393
- points: data?.handles?.points,
2420
+ points,
2394
2421
  segmentIndex,
2395
2422
  viewPlaneNormal,
2396
2423
  previewOnHover: !this._previewData.isDrag,
@@ -2417,7 +2444,11 @@ class LabelmapBaseTool extends _base__WEBPACK_IMPORTED_MODULE_1__/* .BaseTool */
2417
2444
  this.rejectPreview(element);
2418
2445
  }
2419
2446
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
2420
- const results = this.applyActiveStrategyCallback(enabledElement, this.getOperationData(element), _enums__WEBPACK_IMPORTED_MODULE_9__.StrategyCallbacks.AddPreview);
2447
+ const operationData = this.getOperationData(element);
2448
+ if (!enabledElement || !operationData) {
2449
+ return;
2450
+ }
2451
+ const results = this.applyActiveStrategyCallback(enabledElement, operationData, _enums__WEBPACK_IMPORTED_MODULE_9__.StrategyCallbacks.AddPreview);
2421
2452
  _previewData.isDrag = true;
2422
2453
  if (results?.modified) {
2423
2454
  _previewData.preview = results;
@@ -2431,7 +2462,11 @@ class LabelmapBaseTool extends _base__WEBPACK_IMPORTED_MODULE_1__/* .BaseTool */
2431
2462
  }
2432
2463
  this.doneEditMemo();
2433
2464
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
2434
- this.applyActiveStrategyCallback(enabledElement, this.getOperationData(element), _enums__WEBPACK_IMPORTED_MODULE_9__.StrategyCallbacks.RejectPreview);
2465
+ const operationData = this.getOperationData(element);
2466
+ if (!enabledElement || !operationData) {
2467
+ return;
2468
+ }
2469
+ this.applyActiveStrategyCallback(enabledElement, operationData, _enums__WEBPACK_IMPORTED_MODULE_9__.StrategyCallbacks.RejectPreview);
2435
2470
  this._previewData.preview = null;
2436
2471
  this._previewData.isDrag = false;
2437
2472
  }
@@ -2440,6 +2475,9 @@ class LabelmapBaseTool extends _base__WEBPACK_IMPORTED_MODULE_1__/* .BaseTool */
2440
2475
  return;
2441
2476
  }
2442
2477
  const operationData = this.getOperationData(element);
2478
+ if (!operationData) {
2479
+ return;
2480
+ }
2443
2481
  if (this.memo && this.memo.id) {
2444
2482
  this.acceptedMemoIds.set(this.memo.id, {
2445
2483
  element,
@@ -2539,6 +2577,15 @@ class LabelmapBaseTool extends _base__WEBPACK_IMPORTED_MODULE_1__/* .BaseTool */
2539
2577
  (0,_stateManagement_segmentation_triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_14__.triggerSegmentationDataModified)(segmentationId, slices);
2540
2578
  }
2541
2579
  }
2580
+ LabelmapBaseTool.previewData = {
2581
+ preview: null,
2582
+ element: null,
2583
+ timerStart: 0,
2584
+ timer: null,
2585
+ startPoint: [NaN, NaN],
2586
+ isDrag: false,
2587
+ };
2588
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LabelmapBaseTool);
2542
2589
  function lightenColor(r, g, b, a, factor = 0.4) {
2543
2590
  return [
2544
2591
  Math.round(r + (255 - r) * factor),