@ohif/app 3.8.0 → 3.8.2

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 (46) hide show
  1. package/dist/{117.bundle.77cc4e62d0de5d843e2e.js → 117.bundle.17ae130d2bb21ef9d31f.js} +75 -80
  2. package/dist/{121.bundle.47f05840a5b3cdf75543.js → 121.bundle.27d181784f24551bc546.js} +2 -1
  3. package/dist/{164.bundle.b101cb64d04a22453984.js → 164.bundle.e30009bee13acb6967da.js} +554 -311
  4. package/dist/{236.bundle.f774cdc955890e6cdac9.js → 236.bundle.79a374f5fdf7fde431f4.js} +753 -140
  5. package/dist/{188.bundle.f2b81ec70ae344f57183.js → 243.bundle.7891b41d969264043783.js} +8 -8
  6. package/dist/{325.bundle.5012b0285b6baadd1884.js → 325.bundle.bfb7de5a397beae16d24.js} +11 -11
  7. package/dist/{342.bundle.36ee082163b01284eeba.js → 342.bundle.17f0c50a27c0ba1f3846.js} +7 -0
  8. package/dist/{203.bundle.3581da3a32a0b720d3a7.js → 370.bundle.e4cd6c20d3496c949374.js} +614 -455
  9. package/dist/{448.bundle.35b8f8e262fa954026df.js → 448.bundle.375bbf6d00a23e35f229.js} +2 -2
  10. package/dist/{483.bundle.581b242d7b90866fdfb9.js → 483.bundle.016de3c3ec209d9fa42a.js} +16 -3
  11. package/dist/{487.bundle.79aff4db7df5f383b423.js → 487.bundle.205821cf073b4d0d2e71.js} +2 -2
  12. package/dist/{416.bundle.9b0d7559344fd02c9e08.js → 501.bundle.de519580f8ba42802378.js} +1206 -305
  13. package/dist/{530.bundle.207b38c15c4c01e4db0e.js → 530.bundle.17b9a34fefff133e5379.js} +3 -3
  14. package/dist/{544.bundle.3542927ec15c3f688c8d.js → 544.bundle.170c67e76a6900a9a644.js} +4 -4
  15. package/dist/{206.bundle.e1ea316389b21006d3df.js → 545.bundle.c9cc3bd30adc9904cf64.js} +28 -24
  16. package/dist/{321.bundle.39a76114e54cd9833c43.js → 550.bundle.53604ec87839bd9b4a49.js} +82 -49
  17. package/dist/{574.bundle.4b059c95cd34efdc9cb3.js → 574.bundle.b369b11b04c3e080f0b3.js} +40 -37
  18. package/dist/{41.bundle.64e0da470e235cfac4bb.js → 682.bundle.fdd752d2920107f695fb.js} +26 -6
  19. package/dist/{699.bundle.b9666b1d4ddf7e8577ee.js → 699.bundle.fee3d1c6609ecc557a9a.js} +32 -3
  20. package/dist/{669.bundle.64309c677c5ca188348c.js → 721.bundle.d01a6829ac9b0abef67d.js} +73 -73
  21. package/dist/{722.bundle.52eb61926d08a08793fe.js → 722.bundle.1242e0348afc63ca4f5e.js} +10 -4
  22. package/dist/{724.bundle.72aef9dfca69ae057d37.js → 776.bundle.bb8a64b917ff1e559734.js} +13 -15
  23. package/dist/{862.bundle.9897a9b748078d53f9ab.js → 862.bundle.59bb164ca7e871a33e44.js} +1 -1
  24. package/dist/{889.bundle.b6231f995fd098f7e3f9.js → 889.bundle.5b10c495e1442d648ffc.js} +8 -8
  25. package/dist/{905.bundle.cd3e2b347340dd47a1b0.js → 905.bundle.1ba21a0406473fc92696.js} +2 -2
  26. package/dist/{907.bundle.723a425dedf8147243d2.js → 907.bundle.b199f25916a94c4ebb97.js} +2 -2
  27. package/dist/{473.bundle.11f707c8170ade2eb56a.js → 914.bundle.2b3a856b7d41ac8298e6.js} +510 -272
  28. package/dist/{94.bundle.33ca3bc10aa42716dbbb.js → 94.bundle.ae3ca435b134c95aea2e.js} +38 -8
  29. package/dist/{961.bundle.2c4663737c970764a41e.js → 961.bundle.d1b25d8f354bde3be17c.js} +2 -2
  30. package/dist/{7.bundle.94692aed50fe4ba2e2f5.js → 981.bundle.808058a6555d322675e1.js} +15 -15
  31. package/dist/{594.bundle.c292423defd9581bfbe3.js → 989.bundle.b929ddc23c16980560de.js} +5 -5
  32. package/dist/{633.bundle.e258ba4843985e67336a.js → 998.bundle.df083f740270855652bd.js} +21 -20
  33. package/dist/app-config.js +5 -1
  34. package/dist/{app.bundle.a05edb830ad2ecd67aac.js → app.bundle.7fa3782f7fa236cc53a8.js} +791 -568
  35. package/dist/app.bundle.css +1 -1
  36. package/dist/cornerstoneDICOMImageLoader.min.js +1 -1
  37. package/dist/cornerstoneDICOMImageLoader.min.js.map +1 -1
  38. package/dist/google.js +1 -0
  39. package/dist/index.html +1 -1
  40. package/dist/{polySeg.bundle.4442dd3318266fddf4d0.js → polySeg.bundle.36ddebc98d8b109edf33.js} +3 -3
  41. package/dist/{suv-peak-worker.bundle.348c016f7f973d05f2d2.js → suv-peak-worker.bundle.f4df597fab47d977d7f3.js} +3 -3
  42. package/dist/sw.js +1 -1
  43. package/package.json +18 -18
  44. /package/dist/{321.css → 550.css} +0 -0
  45. /package/dist/{783.bundle.11d774eb13ffc74cdca5.js → 783.bundle.f4f09b94ebe4d1a466b1.js} +0 -0
  46. /package/dist/{633.css → 998.css} +0 -0
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[164,473],{
2
+ (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[164,914],{
3
3
 
4
4
  /***/ 25271:
5
5
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
@@ -7,7 +7,7 @@
7
7
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8
8
  /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
9
9
  /* harmony export */ });
10
- async function addImageSlicesToViewports(renderingEngine, stackInputs, viewportIds, immediateRender = false, suppressEvents = false) {
10
+ async function addImageSlicesToViewports(renderingEngine, stackInputs, viewportIds) {
11
11
  for (const viewportId of viewportIds) {
12
12
  const viewport = renderingEngine.getViewport(viewportId);
13
13
  if (!viewport) {
@@ -20,7 +20,7 @@ async function addImageSlicesToViewports(renderingEngine, stackInputs, viewportI
20
20
  }
21
21
  const addStackPromises = viewportIds.map(async (viewportId) => {
22
22
  const viewport = renderingEngine.getViewport(viewportId);
23
- return viewport.addImages(stackInputs, immediateRender, suppressEvents);
23
+ return viewport.addImages(stackInputs);
24
24
  });
25
25
  await Promise.all(addStackPromises);
26
26
  }
@@ -347,7 +347,7 @@ var ViewportStatus;
347
347
 
348
348
  /***/ }),
349
349
 
350
- /***/ 50002:
350
+ /***/ 98362:
351
351
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
352
352
 
353
353
 
@@ -355,7 +355,6 @@ var ViewportStatus;
355
355
  __webpack_require__.d(__webpack_exports__, {
356
356
  BlendModes: () => (/* reexport */ enums_BlendModes),
357
357
  CalibrationTypes: () => (/* reexport */ enums_CalibrationTypes),
358
- ContourType: () => (/* reexport */ enums_ContourType),
359
358
  Events: () => (/* reexport */ Events/* default */.A),
360
359
  GeometryType: () => (/* reexport */ enums_GeometryType),
361
360
  ImageQualityStatus: () => (/* reexport */ ImageQualityStatus/* default */.A),
@@ -370,7 +369,7 @@ __webpack_require__.d(__webpack_exports__, {
370
369
  ViewportType: () => (/* reexport */ ViewportType/* default */.A)
371
370
  });
372
371
 
373
- // UNUSED EXPORTS: DynamicOperatorType
372
+ // UNUSED EXPORTS: ContourType, DynamicOperatorType
374
373
 
375
374
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/enums/Events.js
376
375
  var Events = __webpack_require__(11731);
@@ -406,14 +405,8 @@ var GeometryType;
406
405
  })(GeometryType || (GeometryType = {}));
407
406
  /* harmony default export */ const enums_GeometryType = (GeometryType);
408
407
 
409
- ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/enums/ContourType.js
410
- var ContourType;
411
- (function (ContourType) {
412
- ContourType["CLOSED_PLANAR"] = "CLOSED_PLANAR";
413
- ContourType["OPEN_PLANAR"] = "OPEN_PLANAR";
414
- })(ContourType || (ContourType = {}));
415
- /* harmony default export */ const enums_ContourType = (ContourType);
416
-
408
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/enums/ContourType.js
409
+ var ContourType = __webpack_require__(99842);
417
410
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/enums/VOILUTFunctionType.js
418
411
  var VOILUTFunctionType = __webpack_require__(15381);
419
412
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/enums/DynamicOperatorType.js
@@ -654,12 +647,24 @@ function createAndCacheDerivedImage(referencedImageId, options = {}, preventCach
654
647
  const { TypedArrayConstructor } = (0,_utilities__WEBPACK_IMPORTED_MODULE_4__.getBufferConfiguration)(options.targetBufferType, length);
655
648
  const imageScalarData = new TypedArrayConstructor(skipCreateBuffer ? 1 : length);
656
649
  const derivedImageId = imageId;
657
- ['imagePixelModule', 'imagePlaneModule', 'generalSeriesModule'].forEach((type) => {
650
+ ['imagePlaneModule', 'generalSeriesModule'].forEach((type) => {
658
651
  _utilities__WEBPACK_IMPORTED_MODULE_4__.genericMetadataProvider.add(derivedImageId, {
659
652
  type,
660
653
  metadata: ___WEBPACK_IMPORTED_MODULE_6__.metaData.get(type, referencedImageId),
661
654
  });
662
655
  });
656
+ const imagePixelModule = ___WEBPACK_IMPORTED_MODULE_6__.metaData.get('imagePixelModule', referencedImageId);
657
+ _utilities__WEBPACK_IMPORTED_MODULE_4__.genericMetadataProvider.add(derivedImageId, {
658
+ type: 'imagePixelModule',
659
+ metadata: {
660
+ ...imagePixelModule,
661
+ bitsAllocated: 8,
662
+ bitsStored: 8,
663
+ highBit: 7,
664
+ samplesPerPixel: 1,
665
+ pixelRepresentation: 0,
666
+ },
667
+ });
663
668
  const localImage = createAndCacheLocalImage({ scalarData: imageScalarData, onCacheAdd, skipCreateBuffer }, imageId, true);
664
669
  const imageLoadObject = {
665
670
  promise: Promise.resolve(localImage),
@@ -1121,9 +1126,23 @@ function generateVolumeScalarData(targetBuffer, scalarLength) {
1121
1126
  throw new Error(_enums_Events__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.CACHE_SIZE_EXCEEDED);
1122
1127
  }
1123
1128
  let volumeScalarData;
1124
- if (targetBuffer?.sharedArrayBuffer) {
1125
- const buffer = new SharedArrayBuffer(numBytes);
1126
- volumeScalarData = new TypedArrayConstructor(buffer);
1129
+ if (targetBuffer?.sharedArrayBuffer ?? (0,_init__WEBPACK_IMPORTED_MODULE_10__/* .getShouldUseSharedArrayBuffer */ .TB)()) {
1130
+ switch (targetBuffer.type) {
1131
+ case 'Float32Array':
1132
+ volumeScalarData = (0,_utilities__WEBPACK_IMPORTED_MODULE_9__.createFloat32SharedArray)(scalarLength);
1133
+ break;
1134
+ case 'Uint8Array':
1135
+ volumeScalarData = (0,_utilities__WEBPACK_IMPORTED_MODULE_9__.createUint8SharedArray)(scalarLength);
1136
+ break;
1137
+ case 'Uint16Array':
1138
+ volumeScalarData = (0,_utilities__WEBPACK_IMPORTED_MODULE_9__.createUint16SharedArray)(scalarLength);
1139
+ break;
1140
+ case 'Int16Array':
1141
+ volumeScalarData = (0,_utilities__WEBPACK_IMPORTED_MODULE_9__.createUint16SharedArray)(scalarLength);
1142
+ break;
1143
+ default:
1144
+ throw new Error('generateVolumeScalarData: SharedArrayBuffer is not supported for the specified target buffer type');
1145
+ }
1127
1146
  }
1128
1147
  else {
1129
1148
  volumeScalarData = new TypedArrayConstructor(scalarLength);
@@ -1399,7 +1418,7 @@ function triggerEvent(el = _eventTarget__WEBPACK_IMPORTED_MODULE_0__/* ["default
1399
1418
  /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
1400
1419
  /* harmony export */ });
1401
1420
  /* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(99178);
1402
- /* harmony import */ var _enums___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(50002);
1421
+ /* harmony import */ var _enums___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(98362);
1403
1422
  /* harmony import */ var _requestPool_requestPoolManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(79927);
1404
1423
 
1405
1424
 
@@ -1561,7 +1580,7 @@ class CentralizedWorkerManager {
1561
1580
  /* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(61738);
1562
1581
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55965);
1563
1582
  /* harmony import */ var _synchronizers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42375);
1564
- /* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2746);
1583
+ /* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(49574);
1565
1584
  /* harmony import */ var _utilities__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(74119);
1566
1585
  /* harmony import */ var _cursors__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(32916);
1567
1586
  /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(40969);
@@ -1643,7 +1662,7 @@ class CentralizedWorkerManager {
1643
1662
  /* harmony import */ var _stateManagement_annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(48428);
1644
1663
  /* harmony import */ var _stateManagement_annotation_annotationVisibility__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(21009);
1645
1664
  /* harmony import */ var _stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(54177);
1646
- /* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(2746);
1665
+ /* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(49574);
1647
1666
  /* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(61738);
1648
1667
  /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(84901);
1649
1668
  /* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(90252);
@@ -2317,6 +2336,7 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_4__/* .Annotation
2317
2336
  viewUp: [...viewUp],
2318
2337
  FrameOfReferenceUID,
2319
2338
  referencedImageId,
2339
+ ...viewport.getViewReference({ points: [worldPos] }),
2320
2340
  },
2321
2341
  data: {
2322
2342
  handles: {
@@ -2537,7 +2557,7 @@ class AnnotationTool extends _AnnotationDisplayTool__WEBPACK_IMPORTED_MODULE_2__
2537
2557
  if (viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.BaseVolumeViewport) {
2538
2558
  const volumeId = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.getVolumeId(targetId);
2539
2559
  const volume = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getVolume(volumeId);
2540
- return volume.scaling?.PT !== undefined;
2560
+ return volume?.scaling?.PT !== undefined;
2541
2561
  }
2542
2562
  const scalingModule = imageId && _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.metaData.get('scalingModule', imageId);
2543
2563
  return typeof scalingModule?.suvbw === 'number';
@@ -2637,7 +2657,7 @@ __webpack_require__.d(__webpack_exports__, {
2637
2657
  t0: () => (/* reexport */ SegmentationDisplayTool/* default */.A)
2638
2658
  });
2639
2659
 
2640
- // UNUSED EXPORTS: AngleTool, AnnotationDisplayTool, ArrowAnnotateTool, BaseTool, BidirectionalTool, BrushTool, CircleROIStartEndThresholdTool, CircleROITool, CircleScissorsTool, CobbAngleTool, CrosshairsTool, DragProbeTool, EllipticalROITool, EraserTool, KeyImageTool, LengthTool, LivewireContourSegmentationTool, LivewireContourTool, MIPJumpToClickTool, MagnifyTool, OrientationMarkerTool, OverlayGridTool, PaintFillTool, PanTool, PlanarRotateTool, ProbeTool, RectangleROIStartEndThresholdTool, RectangleROIThresholdTool, RectangleROITool, RectangleScissorsTool, ReferenceCursors, ReferenceLines, ReferenceLinesTool, ScaleOverlayTool, SegmentSelectTool, SegmentationIntersectionTool, SphereScissorsTool, SplineContourSegmentationTool, SplineROITool, StackScrollMouseWheelTool, StackScrollTool, TrackballRotateTool, UltrasoundDirectionalTool, VolumeRotateMouseWheelTool, WindowLevelTool, ZoomTool
2660
+ // UNUSED EXPORTS: AngleTool, AnnotationDisplayTool, ArrowAnnotateTool, BaseTool, BidirectionalTool, BrushTool, CircleROIStartEndThresholdTool, CircleROITool, CircleScissorsTool, CobbAngleTool, CrosshairsTool, DragProbeTool, EllipticalROITool, EraserTool, KeyImageTool, LengthTool, LivewireContourSegmentationTool, LivewireContourTool, MIPJumpToClickTool, MagnifyTool, OrientationMarkerTool, OverlayGridTool, PaintFillTool, PanTool, PlanarRotateTool, ProbeTool, RectangleROIStartEndThresholdTool, RectangleROIThresholdTool, RectangleROITool, RectangleScissorsTool, ReferenceCursors, ReferenceLines, ReferenceLinesTool, ScaleOverlayTool, SculptorTool, SegmentSelectTool, SegmentationIntersectionTool, SphereScissorsTool, SplineContourSegmentationTool, SplineROITool, StackScrollMouseWheelTool, StackScrollTool, TrackballRotateTool, UltrasoundDirectionalTool, VolumeRotateMouseWheelTool, WindowLevelRegionTool, WindowLevelTool, ZoomTool
2641
2661
 
2642
2662
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/base/index.js
2643
2663
  var base = __webpack_require__(96214);
@@ -2647,6 +2667,8 @@ var PanTool = __webpack_require__(25294);
2647
2667
  var TrackballRotateTool = __webpack_require__(15924);
2648
2668
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/WindowLevelTool.js
2649
2669
  var WindowLevelTool = __webpack_require__(455);
2670
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/WindowLevelRegionTool.js
2671
+ var WindowLevelRegionTool = __webpack_require__(60747);
2650
2672
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/StackScrollTool.js
2651
2673
  var StackScrollTool = __webpack_require__(20132);
2652
2674
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/PlanarRotateTool.js
@@ -2675,6 +2697,8 @@ var SegmentationIntersectionTool = __webpack_require__(70494);
2675
2697
  var ReferenceCursors = __webpack_require__(1143);
2676
2698
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/ScaleOverlayTool.js
2677
2699
  var ScaleOverlayTool = __webpack_require__(92807);
2700
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/SculptorTool.js
2701
+ var SculptorTool = __webpack_require__(16151);
2678
2702
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/annotation/BidirectionalTool.js
2679
2703
  var BidirectionalTool = __webpack_require__(50720);
2680
2704
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/annotation/LengthTool.js
@@ -2727,8 +2751,8 @@ var esm = __webpack_require__(92136);
2727
2751
  var stateManagement = __webpack_require__(95778);
2728
2752
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/annotation/annotationLocking.js
2729
2753
  var annotationLocking = __webpack_require__(48428);
2730
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/index.js + 17 modules
2731
- var drawingSvg = __webpack_require__(2746);
2754
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/index.js + 18 modules
2755
+ var drawingSvg = __webpack_require__(49574);
2732
2756
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/viewportFilters/index.js + 4 modules
2733
2757
  var viewportFilters = __webpack_require__(90252);
2734
2758
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/cursors/elementCursor.js
@@ -3262,6 +3286,8 @@ var SegmentSelectTool = __webpack_require__(34041);
3262
3286
 
3263
3287
 
3264
3288
 
3289
+
3290
+
3265
3291
 
3266
3292
 
3267
3293
 
@@ -3317,6 +3343,102 @@ class AnnotationFrameRange {
3317
3343
  }
3318
3344
 
3319
3345
 
3346
+ /***/ }),
3347
+
3348
+ /***/ 25781:
3349
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3350
+
3351
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3352
+ /* harmony export */ x: () => (/* binding */ getClosestImageIdForStackViewport)
3353
+ /* harmony export */ });
3354
+ /* unused harmony export annotationHydration */
3355
+ /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92136);
3356
+ /* harmony import */ var _stateManagement__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(95778);
3357
+ /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44753);
3358
+
3359
+
3360
+
3361
+ function annotationHydration(viewport, toolName, worldPoints, options) {
3362
+ const viewReference = viewport.getViewReference();
3363
+ const { viewPlaneNormal, FrameOfReferenceUID } = viewReference;
3364
+ const annotation = {
3365
+ annotationUID: options?.annotationUID || utilities.uuidv4(),
3366
+ data: {
3367
+ handles: {
3368
+ points: worldPoints,
3369
+ },
3370
+ },
3371
+ highlighted: false,
3372
+ autoGenerated: false,
3373
+ invalidated: false,
3374
+ isLocked: false,
3375
+ isVisible: true,
3376
+ metadata: {
3377
+ toolName,
3378
+ viewPlaneNormal,
3379
+ FrameOfReferenceUID,
3380
+ referencedImageId: getReferencedImageId(viewport, worldPoints[0], viewPlaneNormal),
3381
+ ...options,
3382
+ },
3383
+ };
3384
+ addAnnotation(annotation, viewport.element);
3385
+ return annotation;
3386
+ }
3387
+ function getReferencedImageId(viewport, worldPos, viewPlaneNormal) {
3388
+ let referencedImageId;
3389
+ if (viewport instanceof StackViewport) {
3390
+ referencedImageId = getClosestImageIdForStackViewport(viewport, worldPos, viewPlaneNormal);
3391
+ }
3392
+ else if (viewport instanceof BaseVolumeViewport) {
3393
+ const targetId = getTargetId(viewport);
3394
+ const volumeId = utilities.getVolumeId(targetId);
3395
+ const imageVolume = cache.getVolume(volumeId);
3396
+ referencedImageId = utilities.getClosestImageId(imageVolume, worldPos, viewPlaneNormal);
3397
+ }
3398
+ else {
3399
+ throw new Error('getReferencedImageId: viewport must be a StackViewport or BaseVolumeViewport');
3400
+ }
3401
+ return referencedImageId;
3402
+ }
3403
+ function getTargetId(viewport) {
3404
+ const targetId = viewport.getReferenceId?.();
3405
+ if (targetId) {
3406
+ return targetId;
3407
+ }
3408
+ if (viewport instanceof BaseVolumeViewport) {
3409
+ return `volumeId:${getTargetVolumeId(viewport)}`;
3410
+ }
3411
+ throw new Error('getTargetId: viewport must have a getTargetId method');
3412
+ }
3413
+ function getTargetVolumeId(viewport) {
3414
+ const actorEntries = viewport.getActors();
3415
+ if (!actorEntries) {
3416
+ return;
3417
+ }
3418
+ return actorEntries.find((actorEntry) => actorEntry.actor.getClassName() === 'vtkVolume')?.uid;
3419
+ }
3420
+ function getClosestImageIdForStackViewport(viewport, worldPos, viewPlaneNormal) {
3421
+ const imageIds = viewport.getImageIds();
3422
+ if (!imageIds || !imageIds.length) {
3423
+ return;
3424
+ }
3425
+ const distanceImagePairs = imageIds.map((imageId) => {
3426
+ const { imagePositionPatient } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.metaData.get('imagePlaneModule', imageId);
3427
+ const distance = calculateDistanceToImage(worldPos, imagePositionPatient, viewPlaneNormal);
3428
+ return { imageId, distance };
3429
+ });
3430
+ distanceImagePairs.sort((a, b) => a.distance - b.distance);
3431
+ return distanceImagePairs[0].imageId;
3432
+ }
3433
+ function calculateDistanceToImage(worldPos, ImagePositionPatient, viewPlaneNormal) {
3434
+ const dir = gl_matrix__WEBPACK_IMPORTED_MODULE_2__/* .vec3.create */ .eR.create();
3435
+ gl_matrix__WEBPACK_IMPORTED_MODULE_2__/* .vec3.sub */ .eR.sub(dir, worldPos, ImagePositionPatient);
3436
+ const dot = gl_matrix__WEBPACK_IMPORTED_MODULE_2__/* .vec3.dot */ .eR.dot(dir, viewPlaneNormal);
3437
+ return Math.abs(dot);
3438
+ }
3439
+
3440
+
3441
+
3320
3442
  /***/ }),
3321
3443
 
3322
3444
  /***/ 42290:
@@ -3799,6 +3921,9 @@ function _createCinePlayContext(viewport, playClipOptions) {
3799
3921
  /***/ 88484:
3800
3922
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3801
3923
 
3924
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3925
+ /* harmony export */ Ay: () => (__WEBPACK_DEFAULT_EXPORT__)
3926
+ /* harmony export */ });
3802
3927
  /* unused harmony exports clip, clipToBox */
3803
3928
  function clip(val, low, high) {
3804
3929
  return Math.min(Math.max(low, val), high);
@@ -3807,7 +3932,7 @@ function clipToBox(point, box) {
3807
3932
  point.x = clip(point.x, 0, box.width);
3808
3933
  point.y = clip(point.y, 0, box.height);
3809
3934
  }
3810
- /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (clip)));
3935
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (clip);
3811
3936
 
3812
3937
 
3813
3938
  /***/ }),
@@ -3916,57 +4041,90 @@ function removeContourSegmentationAnnotation(annotation) {
3916
4041
 
3917
4042
  /***/ }),
3918
4043
 
3919
- /***/ 93712:
3920
- /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
3921
-
3922
- /* harmony import */ var _RectangleROIStartEndThreshold__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69405);
4044
+ /***/ 53891:
4045
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3923
4046
 
3924
- function validateAnnotation(annotation) {
3925
- if (!annotation?.data) {
3926
- throw new Error('Tool data is empty');
4047
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4048
+ /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
4049
+ /* harmony export */ });
4050
+ function calculatePerimeter(polyline, closed) {
4051
+ let perimeter = 0;
4052
+ for (let i = 0; i < polyline.length - 1; i++) {
4053
+ const point1 = polyline[i];
4054
+ const point2 = polyline[i + 1];
4055
+ perimeter += Math.sqrt(Math.pow(point2[0] - point1[0], 2) + Math.pow(point2[1] - point1[1], 2));
3927
4056
  }
3928
- if (!annotation.metadata || annotation.metadata.referenceImageId) {
3929
- throw new Error('Tool data is not associated with any imageId');
4057
+ if (closed) {
4058
+ const firstPoint = polyline[0];
4059
+ const lastPoint = polyline[polyline.length - 1];
4060
+ perimeter += Math.sqrt(Math.pow(lastPoint[0] - firstPoint[0], 2) +
4061
+ Math.pow(lastPoint[1] - firstPoint[1], 2));
3930
4062
  }
4063
+ return perimeter;
3931
4064
  }
3932
- class AnnotationToPointData {
3933
- constructor() {
4065
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (calculatePerimeter);
4066
+
4067
+
4068
+ /***/ }),
4069
+
4070
+ /***/ 84045:
4071
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4072
+
4073
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4074
+ /* harmony export */ A: () => (/* binding */ findHandlePolylineIndex)
4075
+ /* harmony export */ });
4076
+ /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92136);
4077
+ /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(44753);
4078
+
4079
+
4080
+ const { isEqual } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities;
4081
+ function findHandlePolylineIndex(annotation, handleIndex) {
4082
+ const { polyline } = annotation.data.contour;
4083
+ const { points } = annotation.data.handles;
4084
+ const { length } = points;
4085
+ if (handleIndex === length) {
4086
+ return polyline.length;
3934
4087
  }
3935
- static { this.TOOL_NAMES = {}; }
3936
- static convert(annotation, index, metadataProvider) {
3937
- validateAnnotation(annotation);
3938
- const { toolName } = annotation.metadata;
3939
- const toolClass = AnnotationToPointData.TOOL_NAMES[toolName];
3940
- if (!toolClass) {
3941
- throw new Error(`Unknown tool type: ${toolName}, cannot convert to RTSSReport`);
3942
- }
3943
- const ContourSequence = toolClass.getContourSequence(annotation, metadataProvider);
3944
- const color = [
3945
- Math.floor(Math.random() * 255),
3946
- Math.floor(Math.random() * 255),
3947
- Math.floor(Math.random() * 255),
3948
- ];
3949
- return {
3950
- ReferencedROINumber: index + 1,
3951
- ROIDisplayColor: color,
3952
- ContourSequence,
3953
- };
4088
+ if (handleIndex < 0) {
4089
+ handleIndex = (handleIndex + length) % length;
3954
4090
  }
3955
- static register(toolClass) {
3956
- AnnotationToPointData.TOOL_NAMES[toolClass.toolName] = toolClass;
4091
+ if (handleIndex === 0) {
4092
+ return 0;
3957
4093
  }
4094
+ const handle = points[handleIndex];
4095
+ const index = polyline.findIndex((point) => isEqual(handle, point));
4096
+ if (index !== -1) {
4097
+ return index;
4098
+ }
4099
+ let closestDistance = Infinity;
4100
+ return polyline.reduce((closestIndex, point, testIndex) => {
4101
+ const distance = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.squaredDistance */ .eR.squaredDistance(point, handle);
4102
+ if (distance < closestDistance) {
4103
+ closestDistance = distance;
4104
+ return testIndex;
4105
+ }
4106
+ return closestIndex;
4107
+ }, -1);
3958
4108
  }
3959
- AnnotationToPointData.register(_RectangleROIStartEndThreshold__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A);
3960
- /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (AnnotationToPointData)));
3961
4109
 
3962
4110
 
3963
4111
  /***/ }),
3964
4112
 
3965
- /***/ 14633:
4113
+ /***/ 75908:
3966
4114
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3967
4115
 
3968
- /* unused harmony export default */
3969
- /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(44753);
4116
+
4117
+ // EXPORTS
4118
+ __webpack_require__.d(__webpack_exports__, {
4119
+ getContourHolesDataCanvas: () => (/* reexport */ getContourHolesDataCanvas),
4120
+ updateContourPolyline: () => (/* reexport */ updateContourPolyline/* default */.A)
4121
+ });
4122
+
4123
+ // UNUSED EXPORTS: AnnotationToPointData, acceptAutogeneratedInterpolations, areCoplanarContours, calculatePerimeter, contourFinder, detectContourHoles, findHandlePolylineIndex, generateContourSetsFromLabelmap, getContourHolesDataWorld, getDeduplicatedVTKPolyDataPoints, interpolation
4124
+
4125
+ // EXTERNAL MODULE: ../../../node_modules/gl-matrix/esm/index.js + 1 modules
4126
+ var esm = __webpack_require__(44753);
4127
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/areCoplanarContours.js
3970
4128
 
3971
4129
  function areCoplanarContours(firstAnnotation, secondAnnotation) {
3972
4130
  const { viewPlaneNormal: firstViewPlaneNormal } = firstAnnotation.metadata;
@@ -3983,39 +4141,7 @@ function areCoplanarContours(firstAnnotation, secondAnnotation) {
3983
4141
  return glMatrix.equals(firstDistance, secondDistance);
3984
4142
  }
3985
4143
 
3986
-
3987
- /***/ }),
3988
-
3989
- /***/ 53891:
3990
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3991
-
3992
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3993
- /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
3994
- /* harmony export */ });
3995
- function calculatePerimeter(polyline, closed) {
3996
- let perimeter = 0;
3997
- for (let i = 0; i < polyline.length - 1; i++) {
3998
- const point1 = polyline[i];
3999
- const point2 = polyline[i + 1];
4000
- perimeter += Math.sqrt(Math.pow(point2[0] - point1[0], 2) + Math.pow(point2[1] - point1[1], 2));
4001
- }
4002
- if (closed) {
4003
- const firstPoint = polyline[0];
4004
- const lastPoint = polyline[polyline.length - 1];
4005
- perimeter += Math.sqrt(Math.pow(lastPoint[0] - firstPoint[0], 2) +
4006
- Math.pow(lastPoint[1] - firstPoint[1], 2));
4007
- }
4008
- return perimeter;
4009
- }
4010
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (calculatePerimeter);
4011
-
4012
-
4013
- /***/ }),
4014
-
4015
- /***/ 11716:
4016
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4017
-
4018
- /* unused harmony exports findContours, findContoursFromReducedSet */
4144
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/contourFinder.js
4019
4145
  function findNextLink(line, lines, contourPoints) {
4020
4146
  let index = -1;
4021
4147
  lines.forEach((cell, i) => {
@@ -4071,21 +4197,62 @@ function findContours(lines) {
4071
4197
  return extraContours;
4072
4198
  }
4073
4199
  }
4074
- function findContoursFromReducedSet(lines) {
4200
+ function contourFinder_findContoursFromReducedSet(lines) {
4075
4201
  return findContours(lines);
4076
4202
  }
4077
- /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ({
4203
+ /* harmony default export */ const contourFinder = ({
4078
4204
  findContours,
4079
- findContoursFromReducedSet,
4205
+ findContoursFromReducedSet: contourFinder_findContoursFromReducedSet,
4080
4206
  });
4081
4207
 
4208
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/getDeduplicatedVTKPolyDataPoints.js
4209
+ function getDeduplicatedVTKPolyDataPoints_getDeduplicatedVTKPolyDataPoints(polyData, bypass = false) {
4210
+ const points = polyData.getPoints();
4211
+ const lines = polyData.getLines();
4212
+ const pointsArray = new Array(points.getNumberOfPoints())
4213
+ .fill(0)
4214
+ .map((_, i) => points.getPoint(i).slice());
4215
+ const linesArray = new Array(lines.getNumberOfCells()).fill(0).map((_, i) => {
4216
+ const cell = lines.getCell(i * 3).slice();
4217
+ return { a: cell[0], b: cell[1] };
4218
+ });
4219
+ if (bypass) {
4220
+ return { points: pointsArray, lines: linesArray };
4221
+ }
4222
+ const newPoints = [];
4223
+ for (const [i, pt] of pointsArray.entries()) {
4224
+ const index = newPoints.findIndex((point) => point[0] === pt[0] && point[1] === pt[1] && point[2] === pt[2]);
4225
+ if (index >= 0) {
4226
+ linesArray.map((line) => {
4227
+ if (line.a === i) {
4228
+ line.a = index;
4229
+ }
4230
+ if (line.b === i) {
4231
+ line.b = index;
4232
+ }
4233
+ return line;
4234
+ });
4235
+ }
4236
+ else {
4237
+ const newIndex = newPoints.length;
4238
+ newPoints.push(pt);
4239
+ linesArray.map((line) => {
4240
+ if (line.a === i) {
4241
+ line.a = newIndex;
4242
+ }
4243
+ if (line.b === i) {
4244
+ line.b = newIndex;
4245
+ }
4246
+ return line;
4247
+ });
4248
+ }
4249
+ }
4250
+ const newLines = linesArray.filter((line) => line.a !== line.b);
4251
+ return { points: newPoints, lines: newLines };
4252
+ }
4253
+ /* harmony default export */ const contours_getDeduplicatedVTKPolyDataPoints = ({ getDeduplicatedVTKPolyDataPoints: getDeduplicatedVTKPolyDataPoints_getDeduplicatedVTKPolyDataPoints });
4082
4254
 
4083
- /***/ }),
4084
-
4085
- /***/ 92806:
4086
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4087
-
4088
- /* unused harmony export processContourHoles */
4255
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/detectContourHoles.js
4089
4256
  const getIsPointInsidePolygon = (point, vertices) => {
4090
4257
  const x = point[0];
4091
4258
  const y = point[1];
@@ -4158,65 +4325,19 @@ function processContourHoles(contours, points, useXOR = true) {
4158
4325
  }
4159
4326
  return retContours;
4160
4327
  }
4161
- /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ({ processContourHoles });
4162
-
4163
-
4164
- /***/ }),
4165
-
4166
- /***/ 84045:
4167
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4168
-
4169
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4170
- /* harmony export */ A: () => (/* binding */ findHandlePolylineIndex)
4171
- /* harmony export */ });
4172
- /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92136);
4173
- /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(44753);
4174
-
4175
-
4176
- const { isEqual } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities;
4177
- function findHandlePolylineIndex(annotation, handleIndex) {
4178
- const { polyline } = annotation.data.contour;
4179
- const { points } = annotation.data.handles;
4180
- const { length } = points;
4181
- if (handleIndex === length) {
4182
- return polyline.length;
4183
- }
4184
- if (handleIndex < 0) {
4185
- handleIndex = (handleIndex + length) % length;
4186
- }
4187
- if (handleIndex === 0) {
4188
- return 0;
4189
- }
4190
- const handle = points[handleIndex];
4191
- const index = polyline.findIndex((point) => isEqual(handle, point));
4192
- if (index !== -1) {
4193
- return index;
4194
- }
4195
- let closestDistance = Infinity;
4196
- return polyline.reduce((closestIndex, point, testIndex) => {
4197
- const distance = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.squaredDistance */ .eR.squaredDistance(point, handle);
4198
- if (distance < closestDistance) {
4199
- closestDistance = distance;
4200
- return testIndex;
4201
- }
4202
- return closestIndex;
4203
- }, -1);
4204
- }
4205
-
4206
-
4207
- /***/ }),
4208
-
4209
- /***/ 36392:
4210
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4328
+ /* harmony default export */ const detectContourHoles = ({ processContourHoles });
4211
4329
 
4212
- /* unused harmony export generateContourSetsFromLabelmap */
4213
- /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92136);
4214
- /* harmony import */ var _kitware_vtk_js_Filters_General_ImageMarchingSquares__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(52754);
4215
- /* harmony import */ var _kitware_vtk_js_Common_Core_DataArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(45128);
4216
- /* harmony import */ var _kitware_vtk_js_Common_DataModel_ImageData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(51250);
4217
- /* harmony import */ var _contours__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(75534);
4218
- /* harmony import */ var _contourFinder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(11716);
4219
- /* harmony import */ var _enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(83946);
4330
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 28 modules
4331
+ var dist_esm = __webpack_require__(92136);
4332
+ // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Filters/General/ImageMarchingSquares.js
4333
+ var ImageMarchingSquares = __webpack_require__(52754);
4334
+ // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/DataArray.js
4335
+ var DataArray = __webpack_require__(45128);
4336
+ // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/ImageData.js
4337
+ var ImageData = __webpack_require__(51250);
4338
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/enums/SegmentationRepresentations.js
4339
+ var SegmentationRepresentations = __webpack_require__(83946);
4340
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js
4220
4341
 
4221
4342
 
4222
4343
 
@@ -4224,7 +4345,7 @@ function findHandlePolylineIndex(annotation, handleIndex) {
4224
4345
 
4225
4346
 
4226
4347
 
4227
- const { Labelmap } = _enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .A;
4348
+ const { Labelmap } = SegmentationRepresentations/* default */.A;
4228
4349
  function generateContourSetsFromLabelmap({ segmentations }) {
4229
4350
  const { representationData, segments = [0, 1] } = segmentations;
4230
4351
  const { volumeId: segVolumeId } = representationData[Labelmap];
@@ -4327,19 +4448,61 @@ function isSliceEmptyForSegment(sliceIndex, segData, pixelsPerSlice, segIndex) {
4327
4448
  }
4328
4449
 
4329
4450
 
4451
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/RectangleROIStartEndThreshold.js
4452
+ var RectangleROIStartEndThreshold = __webpack_require__(69405);
4453
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/AnnotationToPointData.js
4330
4454
 
4331
- /***/ }),
4455
+ function validateAnnotation(annotation) {
4456
+ if (!annotation?.data) {
4457
+ throw new Error('Tool data is empty');
4458
+ }
4459
+ if (!annotation.metadata || annotation.metadata.referenceImageId) {
4460
+ throw new Error('Tool data is not associated with any imageId');
4461
+ }
4462
+ }
4463
+ class AnnotationToPointData {
4464
+ constructor() {
4465
+ }
4466
+ static { this.TOOL_NAMES = {}; }
4467
+ static convert(annotation, index, metadataProvider) {
4468
+ validateAnnotation(annotation);
4469
+ const { toolName } = annotation.metadata;
4470
+ const toolClass = AnnotationToPointData.TOOL_NAMES[toolName];
4471
+ if (!toolClass) {
4472
+ throw new Error(`Unknown tool type: ${toolName}, cannot convert to RTSSReport`);
4473
+ }
4474
+ const ContourSequence = toolClass.getContourSequence(annotation, metadataProvider);
4475
+ const color = [
4476
+ Math.floor(Math.random() * 255),
4477
+ Math.floor(Math.random() * 255),
4478
+ Math.floor(Math.random() * 255),
4479
+ ];
4480
+ return {
4481
+ ReferencedROINumber: index + 1,
4482
+ ROIDisplayColor: color,
4483
+ ContourSequence,
4484
+ };
4485
+ }
4486
+ static register(toolClass) {
4487
+ AnnotationToPointData.TOOL_NAMES[toolClass.toolName] = toolClass;
4488
+ }
4489
+ }
4490
+ AnnotationToPointData.register(RectangleROIStartEndThreshold/* default */.A);
4491
+ /* harmony default export */ const contours_AnnotationToPointData = ((/* unused pure expression or super */ null && (AnnotationToPointData)));
4332
4492
 
4333
- /***/ 88267:
4334
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4493
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/index.js
4494
+ var stateManagement = __webpack_require__(95778);
4495
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/getContourHolesDataWorld.js
4335
4496
 
4336
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4337
- /* harmony export */ A: () => (/* binding */ getContourHolesDataCanvas)
4338
- /* harmony export */ });
4339
- /* harmony import */ var _getContourHolesDataWorld__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(98043);
4497
+ function getContourHolesDataWorld(annotation) {
4498
+ const childAnnotationUIDs = annotation.childAnnotationUIDs ?? [];
4499
+ return childAnnotationUIDs.map((uid) => (0,stateManagement/* getAnnotation */.gw)(uid).data.contour.polyline);
4500
+ }
4501
+
4502
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/getContourHolesDataCanvas.js
4340
4503
 
4341
4504
  function getContourHolesDataCanvas(annotation, viewport) {
4342
- const worldHoleContours = (0,_getContourHolesDataWorld__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(annotation);
4505
+ const worldHoleContours = getContourHolesDataWorld(annotation);
4343
4506
  const canvasHoleContours = [];
4344
4507
  worldHoleContours.forEach((worldHoleContour) => {
4345
4508
  const numPoints = worldHoleContour.length;
@@ -4352,103 +4515,23 @@ function getContourHolesDataCanvas(annotation, viewport) {
4352
4515
  return canvasHoleContours;
4353
4516
  }
4354
4517
 
4518
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/updateContourPolyline.js
4519
+ var updateContourPolyline = __webpack_require__(89111);
4520
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js
4521
+ var InterpolationManager_InterpolationManager = __webpack_require__(33836);
4522
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/interpolation/acceptAutogeneratedInterpolations.js
4355
4523
 
4356
- /***/ }),
4357
-
4358
- /***/ 98043:
4359
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4360
-
4361
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4362
- /* harmony export */ A: () => (/* binding */ getContourHolesDataWorld)
4363
- /* harmony export */ });
4364
- /* harmony import */ var _stateManagement__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(95778);
4365
-
4366
- function getContourHolesDataWorld(annotation) {
4367
- const childAnnotationUIDs = annotation.childAnnotationUIDs ?? [];
4368
- return childAnnotationUIDs.map((uid) => (0,_stateManagement__WEBPACK_IMPORTED_MODULE_0__/* .getAnnotation */ .gw)(uid).data.contour.polyline);
4369
- }
4370
-
4371
-
4372
- /***/ }),
4373
-
4374
- /***/ 19866:
4375
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4376
-
4377
- /* unused harmony export getDeduplicatedVTKPolyDataPoints */
4378
- function getDeduplicatedVTKPolyDataPoints(polyData, bypass = false) {
4379
- const points = polyData.getPoints();
4380
- const lines = polyData.getLines();
4381
- const pointsArray = new Array(points.getNumberOfPoints())
4382
- .fill(0)
4383
- .map((_, i) => points.getPoint(i).slice());
4384
- const linesArray = new Array(lines.getNumberOfCells()).fill(0).map((_, i) => {
4385
- const cell = lines.getCell(i * 3).slice();
4386
- return { a: cell[0], b: cell[1] };
4387
- });
4388
- if (bypass) {
4389
- return { points: pointsArray, lines: linesArray };
4390
- }
4391
- const newPoints = [];
4392
- for (const [i, pt] of pointsArray.entries()) {
4393
- const index = newPoints.findIndex((point) => point[0] === pt[0] && point[1] === pt[1] && point[2] === pt[2]);
4394
- if (index >= 0) {
4395
- linesArray.map((line) => {
4396
- if (line.a === i) {
4397
- line.a = index;
4398
- }
4399
- if (line.b === i) {
4400
- line.b = index;
4401
- }
4402
- return line;
4403
- });
4404
- }
4405
- else {
4406
- const newIndex = newPoints.length;
4407
- newPoints.push(pt);
4408
- linesArray.map((line) => {
4409
- if (line.a === i) {
4410
- line.a = newIndex;
4411
- }
4412
- if (line.b === i) {
4413
- line.b = newIndex;
4414
- }
4415
- return line;
4416
- });
4417
- }
4418
- }
4419
- const newLines = linesArray.filter((line) => line.a !== line.b);
4420
- return { points: newPoints, lines: newLines };
4524
+ function acceptAutogeneratedInterpolations(annotationGroupSelector, selector) {
4525
+ InterpolationManager.acceptAutoGenerated(annotationGroupSelector, selector);
4421
4526
  }
4422
- /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ({ getDeduplicatedVTKPolyDataPoints });
4423
-
4424
-
4425
- /***/ }),
4426
-
4427
- /***/ 75534:
4428
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4429
-
4430
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4431
- /* harmony export */ getContourHolesDataCanvas: () => (/* reexport safe */ _getContourHolesDataCanvas__WEBPACK_IMPORTED_MODULE_7__.A),
4432
- /* harmony export */ updateContourPolyline: () => (/* reexport safe */ _updateContourPolyline__WEBPACK_IMPORTED_MODULE_8__.A)
4433
- /* harmony export */ });
4434
- /* harmony import */ var _areCoplanarContours__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14633);
4435
- /* harmony import */ var _contourFinder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11716);
4436
- /* harmony import */ var _getDeduplicatedVTKPolyDataPoints__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(19866);
4437
- /* harmony import */ var _detectContourHoles__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(92806);
4438
- /* harmony import */ var _generateContourSetsFromLabelmap__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(36392);
4439
- /* harmony import */ var _AnnotationToPointData__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(93712);
4440
- /* harmony import */ var _getContourHolesDataWorld__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(98043);
4441
- /* harmony import */ var _getContourHolesDataCanvas__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(88267);
4442
- /* harmony import */ var _updateContourPolyline__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(89111);
4443
- /* harmony import */ var _interpolation_acceptAutogeneratedInterpolations__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(65864);
4444
- /* harmony import */ var _interpolation__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(69115);
4445
- /* harmony import */ var _findHandlePolylineIndex__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(84045);
4446
- /* harmony import */ var _calculatePerimeter__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(53891);
4447
-
4448
-
4449
-
4450
-
4451
4527
 
4528
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/interpolation/index.js
4529
+ var interpolation = __webpack_require__(69115);
4530
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/findHandlePolylineIndex.js
4531
+ var findHandlePolylineIndex = __webpack_require__(84045);
4532
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/calculatePerimeter.js
4533
+ var calculatePerimeter = __webpack_require__(53891);
4534
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/index.js
4452
4535
 
4453
4536
 
4454
4537
 
@@ -4460,17 +4543,9 @@ function getDeduplicatedVTKPolyDataPoints(polyData, bypass = false) {
4460
4543
 
4461
4544
 
4462
4545
 
4463
- /***/ }),
4464
4546
 
4465
- /***/ 65864:
4466
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4467
4547
 
4468
- /* unused harmony export default */
4469
- /* harmony import */ var _segmentation_InterpolationManager_InterpolationManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33836);
4470
4548
 
4471
- function acceptAutogeneratedInterpolations(annotationGroupSelector, selector) {
4472
- InterpolationManager.acceptAutoGenerated(annotationGroupSelector, selector);
4473
- }
4474
4549
 
4475
4550
 
4476
4551
  /***/ }),
@@ -4501,7 +4576,7 @@ function acceptAutogeneratedInterpolations(annotationGroupSelector, selector) {
4501
4576
 
4502
4577
 
4503
4578
  function updateContourPolyline(annotation, polylineData, transforms, options) {
4504
- const { canvasToWorld } = transforms;
4579
+ const { canvasToWorld, worldToCanvas } = transforms;
4505
4580
  const { data } = annotation;
4506
4581
  const { targetWindingDirection } = polylineData;
4507
4582
  let { points: polyline } = polylineData;
@@ -4511,7 +4586,7 @@ function updateContourPolyline(annotation, polylineData, transforms, options) {
4511
4586
  let { closed } = polylineData;
4512
4587
  const numPoints = polyline.length;
4513
4588
  const polylineWorldPoints = new Array(numPoints);
4514
- const currentWindingDirection = _math__WEBPACK_IMPORTED_MODULE_1__.polyline.getWindingDirection(polyline);
4589
+ const currentPolylineWindingDirection = _math__WEBPACK_IMPORTED_MODULE_1__.polyline.getWindingDirection(polyline);
4515
4590
  const parentAnnotation = (0,_stateManagement__WEBPACK_IMPORTED_MODULE_2__/* .getParentAnnotation */ .Ay)(annotation);
4516
4591
  if (closed === undefined) {
4517
4592
  let currentClosedState = false;
@@ -4525,11 +4600,18 @@ function updateContourPolyline(annotation, polylineData, transforms, options) {
4525
4600
  ? parentAnnotation.data.contour.windingDirection * -1
4526
4601
  : targetWindingDirection;
4527
4602
  if (windingDirection === undefined) {
4528
- windingDirection = currentWindingDirection;
4603
+ windingDirection = currentPolylineWindingDirection;
4529
4604
  }
4530
- else if (windingDirection !== currentWindingDirection) {
4605
+ if (windingDirection !== currentPolylineWindingDirection) {
4531
4606
  polyline.reverse();
4532
4607
  }
4608
+ const handlePoints = data.handles.points.map((p) => worldToCanvas(p));
4609
+ if (handlePoints.length > 2) {
4610
+ const currentHandlesWindingDirection = _math__WEBPACK_IMPORTED_MODULE_1__.polyline.getWindingDirection(handlePoints);
4611
+ if (currentHandlesWindingDirection !== windingDirection) {
4612
+ data.handles.points.reverse();
4613
+ }
4614
+ }
4533
4615
  for (let i = 0; i < numPoints; i++) {
4534
4616
  polylineWorldPoints[i] = canvasToWorld(polyline[i]);
4535
4617
  }
@@ -5163,6 +5245,7 @@ function getViewportForAnnotation(annotation) {
5163
5245
 
5164
5246
  // EXPORTS
5165
5247
  __webpack_require__.d(__webpack_exports__, {
5248
+ clip: () => (/* reexport */ clip/* default */.Ay),
5166
5249
  debounce: () => (/* reexport */ debounce/* default */.A),
5167
5250
  getCalibratedLengthUnitsAndScale: () => (/* reexport */ getCalibratedUnits/* getCalibratedLengthUnitsAndScale */.Op),
5168
5251
  math: () => (/* reexport */ math),
@@ -5176,7 +5259,7 @@ __webpack_require__.d(__webpack_exports__, {
5176
5259
  triggerAnnotationRenderForViewportIds: () => (/* reexport */ triggerAnnotationRenderForViewportIds/* default */.A)
5177
5260
  });
5178
5261
 
5179
- // UNUSED EXPORTS: annotationFrameRange, boundingBox, calibrateImageSpacing, cine, clip, contourSegmentation, contours, drawing, dynamicVolume, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, getCalibratedAspect, getCalibratedProbeUnitsAndValue, getSphereBoundsInfo, getViewportForAnnotation, isObject, jumpToSlice, orientation, planar, planarFreehandROITool, pointInSurroundingSphereCallback, rectangleROITool, segmentation, stackContextPrefetch, stackPrefetch, touch, triggerAnnotationRender, triggerEvent, viewport, viewportFilters, voi
5262
+ // UNUSED EXPORTS: annotationFrameRange, annotationHydration, boundingBox, calibrateImageSpacing, cine, contourSegmentation, contours, drawing, dynamicVolume, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, getCalibratedAspect, getCalibratedProbeUnitsAndValue, getClosestImageIdForStackViewport, getSphereBoundsInfo, getViewportForAnnotation, isObject, jumpToSlice, orientation, planar, planarFreehandROITool, pointInSurroundingSphereCallback, rectangleROITool, segmentation, stackContextPrefetch, stackPrefetch, touch, triggerAnnotationRender, triggerEvent, viewport, viewportFilters, voi
5180
5263
 
5181
5264
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 28 modules
5182
5265
  var esm = __webpack_require__(92136);
@@ -5216,8 +5299,10 @@ var annotationFrameRange = __webpack_require__(41209);
5216
5299
  var pointInSurroundingSphereCallback = __webpack_require__(5093);
5217
5300
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/getViewportForAnnotation.js
5218
5301
  var getViewportForAnnotation = __webpack_require__(39490);
5219
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/index.js
5220
- var contours = __webpack_require__(75534);
5302
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/annotationHydration.js
5303
+ var annotationHydration = __webpack_require__(25781);
5304
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/index.js + 9 modules
5305
+ var contours = __webpack_require__(75908);
5221
5306
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/segmentation/index.js
5222
5307
  var segmentation = __webpack_require__(10351);
5223
5308
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/drawing/index.js + 1 modules
@@ -5255,8 +5340,8 @@ var touch = __webpack_require__(54868);
5255
5340
  var dynamicVolume = __webpack_require__(16390);
5256
5341
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/polyData/utils.js
5257
5342
  var utils = __webpack_require__(46514);
5258
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/voi/index.js
5259
- var voi = __webpack_require__(10413);
5343
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/voi/index.js + 4 modules
5344
+ var voi = __webpack_require__(14149);
5260
5345
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contourSegmentation/index.js
5261
5346
  var contourSegmentation = __webpack_require__(7259);
5262
5347
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/index.js
@@ -5295,6 +5380,7 @@ var contourSegmentation = __webpack_require__(7259);
5295
5380
 
5296
5381
 
5297
5382
 
5383
+
5298
5384
 
5299
5385
 
5300
5386
  const roundNumber = esm.utilities.roundNumber;
@@ -5387,6 +5473,8 @@ __webpack_require__.d(__webpack_exports__, {
5387
5473
 
5388
5474
  // UNUSED EXPORTS: Calculator
5389
5475
 
5476
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 28 modules
5477
+ var esm = __webpack_require__(92136);
5390
5478
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/basic/Calculator.js
5391
5479
  class Calculator {
5392
5480
  }
@@ -5394,55 +5482,73 @@ class Calculator {
5394
5482
 
5395
5483
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/basic/BasicStatsCalculator.js
5396
5484
 
5485
+
5486
+ const { PointsManager } = esm.utilities;
5397
5487
  class BasicStatsCalculator extends basic_Calculator {
5398
5488
  static { this.max = [-Infinity]; }
5489
+ static { this.min = [Infinity]; }
5399
5490
  static { this.sum = [0]; }
5400
- static { this.sumSquares = [0]; }
5401
- static { this.squaredDiffSum = [0]; }
5402
5491
  static { this.count = 0; }
5403
- static { this.statsCallback = ({ value: newValue }) => {
5492
+ static { this.runMean = [0]; }
5493
+ static { this.m2 = [0]; }
5494
+ static { this.pointsInShape = PointsManager.create3(1024); }
5495
+ static statsInit(options) {
5496
+ if (options.noPointsCollection) {
5497
+ BasicStatsCalculator.pointsInShape = null;
5498
+ }
5499
+ }
5500
+ static { this.statsCallback = ({ value: newValue, pointLPS = null }) => {
5404
5501
  if (Array.isArray(newValue) &&
5405
5502
  newValue.length > 1 &&
5406
5503
  this.max.length === 1) {
5407
5504
  this.max.push(this.max[0], this.max[0]);
5505
+ this.min.push(this.min[0], this.min[0]);
5408
5506
  this.sum.push(this.sum[0], this.sum[0]);
5409
- this.sumSquares.push(this.sumSquares[0], this.sumSquares[0]);
5410
- this.squaredDiffSum.push(this.squaredDiffSum[0], this.squaredDiffSum[0]);
5507
+ this.runMean.push(0, 0);
5508
+ this.m2.push(this.m2[0], this.m2[0]);
5411
5509
  }
5510
+ this.pointsInShape?.push(pointLPS);
5412
5511
  const newArray = Array.isArray(newValue) ? newValue : [newValue];
5413
5512
  this.count += 1;
5414
- this.max.forEach((it, idx) => (this.max[idx] = Math.max(it, newArray[idx])));
5415
- this.sum.map((it, idx) => (this.sum[idx] += newArray[idx]));
5416
- this.sumSquares.map((it, idx) => (this.sumSquares[idx] += newArray[idx] ** 2));
5417
- this.squaredDiffSum.map((it, idx) => (this.squaredDiffSum[idx] += Math.pow(newArray[idx] - this.sum[idx] / this.count, 2)));
5513
+ this.max.map((it, idx) => {
5514
+ const value = newArray[idx];
5515
+ const delta = value - this.runMean[idx];
5516
+ this.sum[idx] += value;
5517
+ this.runMean[idx] += delta / this.count;
5518
+ const delta2 = value - this.runMean[idx];
5519
+ this.m2[idx] += delta * delta2;
5520
+ this.min[idx] = Math.min(this.min[idx], value);
5521
+ this.max[idx] = Math.max(it, value);
5522
+ });
5418
5523
  }; }
5419
- static { this.getStatistics = () => {
5524
+ static { this.getStatistics = (options) => {
5420
5525
  const mean = this.sum.map((sum) => sum / this.count);
5421
- const stdDev = this.squaredDiffSum.map((squaredDiffSum) => Math.sqrt(squaredDiffSum / this.count));
5422
- const stdDevWithSumSquare = this.sumSquares.map((it, idx) => Math.sqrt(this.sumSquares[idx] / this.count - mean[idx] ** 2));
5526
+ const stdDev = this.m2.map((squaredDiffSum) => Math.sqrt(squaredDiffSum / this.count));
5527
+ const unit = options?.unit || null;
5423
5528
  const named = {
5424
5529
  max: {
5425
5530
  name: 'max',
5426
5531
  label: 'Max Pixel',
5427
5532
  value: singleArrayAsNumber(this.max),
5428
- unit: null,
5533
+ unit,
5534
+ },
5535
+ min: {
5536
+ name: 'min',
5537
+ label: 'Min Pixel',
5538
+ value: singleArrayAsNumber(this.min),
5539
+ unit,
5429
5540
  },
5430
5541
  mean: {
5431
5542
  name: 'mean',
5432
5543
  label: 'Mean Pixel',
5433
5544
  value: singleArrayAsNumber(mean),
5434
- unit: null,
5545
+ unit,
5435
5546
  },
5436
5547
  stdDev: {
5437
5548
  name: 'stdDev',
5438
5549
  label: 'Standard Deviation',
5439
5550
  value: singleArrayAsNumber(stdDev),
5440
- unit: null,
5441
- },
5442
- stdDevWithSumSquare: {
5443
- name: 'stdDevWithSumSquare',
5444
- value: singleArrayAsNumber(stdDevWithSumSquare),
5445
- unit: null,
5551
+ unit,
5446
5552
  },
5447
5553
  count: {
5448
5554
  name: 'count',
@@ -5450,14 +5556,17 @@ class BasicStatsCalculator extends basic_Calculator {
5450
5556
  value: this.count,
5451
5557
  unit: null,
5452
5558
  },
5559
+ pointsInShape: this.pointsInShape,
5453
5560
  array: [],
5454
5561
  };
5455
- named.array.push(named.max, named.mean, named.stdDev, named.stdDevWithSumSquare, named.count);
5562
+ named.array.push(named.max, named.mean, named.stdDev, named.stdDev, named.count);
5456
5563
  this.max = [-Infinity];
5564
+ this.min = [Infinity];
5457
5565
  this.sum = [0];
5458
- this.sumSquares = [0];
5459
- this.squaredDiffSum = [0];
5566
+ this.m2 = [0];
5567
+ this.runMean = [0];
5460
5568
  this.count = 0;
5569
+ this.pointsInShape = PointsManager.create3(1024);
5461
5570
  return named;
5462
5571
  }; }
5463
5572
  }
@@ -7653,8 +7762,8 @@ function getBrushThresholdForToolGroup(toolGroupId) {
7653
7762
 
7654
7763
  // UNUSED EXPORTS: default
7655
7764
 
7656
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/index.js
7657
- var contours = __webpack_require__(75534);
7765
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/index.js + 9 modules
7766
+ var contours = __webpack_require__(75908);
7658
7767
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/enums/SegmentationRepresentations.js
7659
7768
  var SegmentationRepresentations = __webpack_require__(83946);
7660
7769
  // EXTERNAL MODULE: ../../../node_modules/gl-matrix/esm/index.js + 1 modules
@@ -10161,10 +10270,144 @@ var ColorbarRangeTextPosition;
10161
10270
 
10162
10271
  /***/ }),
10163
10272
 
10164
- /***/ 10413:
10165
- /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
10273
+ /***/ 14149:
10274
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10275
+
10276
+
10277
+ // EXPORTS
10278
+ __webpack_require__.d(__webpack_exports__, {
10279
+ windowLevel: () => (/* reexport */ windowlevel_namespaceObject)
10280
+ });
10281
+
10282
+ // UNUSED EXPORTS: colorbar
10283
+
10284
+ // NAMESPACE OBJECT: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/voi/windowlevel/index.js
10285
+ var windowlevel_namespaceObject = {};
10286
+ __webpack_require__.r(windowlevel_namespaceObject);
10287
+ __webpack_require__.d(windowlevel_namespaceObject, {
10288
+ calculateMinMaxMean: () => (calculateMinMaxMean),
10289
+ extractWindowLevelRegionToolData: () => (extractWindowLevelRegionToolData),
10290
+ getLuminanceFromRegion: () => (getLuminanceFromRegion)
10291
+ });
10292
+
10293
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/voi/colorbar/index.js
10294
+ var colorbar = __webpack_require__(64690);
10295
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/voi/windowlevel/getLuminanceFromRegion.js
10296
+ function getLuminanceFromRegion(imageData, x, y, width, height) {
10297
+ const luminance = [];
10298
+ let index = 0;
10299
+ const pixelData = imageData.scalarData;
10300
+ let spIndex, row, column;
10301
+ if (imageData.color) {
10302
+ for (row = 0; row < height; row++) {
10303
+ for (column = 0; column < width; column++) {
10304
+ spIndex = ((row + y) * imageData.columns + (column + x)) * 4;
10305
+ const red = pixelData[spIndex];
10306
+ const green = pixelData[spIndex + 1];
10307
+ const blue = pixelData[spIndex + 2];
10308
+ luminance[index++] = 0.2126 * red + 0.7152 * green + 0.0722 * blue;
10309
+ }
10310
+ }
10311
+ }
10312
+ else {
10313
+ for (row = 0; row < height; row++) {
10314
+ for (column = 0; column < width; column++) {
10315
+ spIndex = (row + y) * imageData.columns + (column + x);
10316
+ luminance[index++] = pixelData[spIndex];
10317
+ }
10318
+ }
10319
+ }
10320
+ return luminance;
10321
+ }
10322
+
10323
+
10324
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/voi/windowlevel/calculateMinMaxMean.js
10325
+ function calculateMinMaxMean(pixelLuminance, globalMin, globalMax) {
10326
+ const numPixels = pixelLuminance.length;
10327
+ let min = globalMax;
10328
+ let max = globalMin;
10329
+ let sum = 0;
10330
+ if (numPixels < 2) {
10331
+ return {
10332
+ min,
10333
+ max,
10334
+ mean: (globalMin + globalMax) / 2,
10335
+ };
10336
+ }
10337
+ for (let index = 0; index < numPixels; index++) {
10338
+ const spv = pixelLuminance[index];
10339
+ min = Math.min(min, spv);
10340
+ max = Math.max(max, spv);
10341
+ sum += spv;
10342
+ }
10343
+ return {
10344
+ min,
10345
+ max,
10346
+ mean: sum / numPixels,
10347
+ };
10348
+ }
10349
+
10350
+
10351
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 28 modules
10352
+ var esm = __webpack_require__(92136);
10353
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/voi/windowlevel/extractWindowLevelRegionToolData.js
10354
+
10355
+ function extractWindowLevelRegionToolData(viewport) {
10356
+ if (viewport instanceof esm.VolumeViewport) {
10357
+ return extractImageDataVolume(viewport);
10358
+ }
10359
+ if (viewport instanceof esm.StackViewport) {
10360
+ return extractImageDataStack(viewport);
10361
+ }
10362
+ throw new Error('Viewport not supported');
10363
+ }
10364
+ function extractImageDataVolume(viewport) {
10365
+ const { scalarData, width, height } = esm.utilities.getCurrentVolumeViewportSlice(viewport);
10366
+ const { min: minPixelValue, max: maxPixelValue } = esm.utilities.getMinMax(scalarData);
10367
+ const volumeId = viewport.getVolumeId();
10368
+ const volume = esm.cache.getVolume(volumeId);
10369
+ const { metadata, cornerstoneImageMetaData } = volume;
10370
+ const { Rows: rows, Columns: columns } = metadata;
10371
+ const { color } = cornerstoneImageMetaData;
10372
+ return {
10373
+ scalarData,
10374
+ width,
10375
+ height,
10376
+ minPixelValue,
10377
+ maxPixelValue,
10378
+ rows,
10379
+ columns,
10380
+ color,
10381
+ };
10382
+ }
10383
+ function extractImageDataStack(viewport) {
10384
+ const imageData = viewport.getImageData();
10385
+ const { scalarData } = imageData;
10386
+ const { min: minPixelValue, max: maxPixelValue } = esm.utilities.getMinMax(scalarData);
10387
+ const width = imageData.dimensions[0];
10388
+ const height = imageData.dimensions[1];
10389
+ const { rows, columns, color } = viewport.getCornerstoneImage();
10390
+ return {
10391
+ scalarData,
10392
+ width,
10393
+ height,
10394
+ minPixelValue,
10395
+ maxPixelValue,
10396
+ rows,
10397
+ columns,
10398
+ color,
10399
+ };
10400
+ }
10401
+
10402
+
10403
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/voi/windowlevel/index.js
10404
+
10405
+
10406
+
10407
+
10408
+
10409
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/voi/index.js
10166
10410
 
10167
- /* harmony import */ var _colorbar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64690);
10168
10411
 
10169
10412
 
10170
10413