@ohif/app 3.10.1 → 3.10.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 (44) hide show
  1. package/dist/{1919.bundle.6f7de53921f3710a1d54.js → 1919.bundle.6cb4a1f5ea770e504398.js} +2 -2
  2. package/dist/{1927.bundle.83810560c4d3a90eb7cf.js → 1927.bundle.5c25b9084f704a3582d2.js} +1 -1
  3. package/dist/{3396.bundle.858cfdfc5ab560840958.js → 2482.bundle.0947bc67ad4429d5fda3.js} +289 -1353
  4. package/dist/{2701.bundle.f1f15df81406d04851c4.js → 2701.bundle.87301d8d94693b5d5fcc.js} +2 -2
  5. package/dist/{2860.bundle.5d93c30e2df60e382bda.js → 2860.bundle.130f5c83c90c83017101.js} +1368 -28
  6. package/dist/{2914.bundle.a0a5ddfebfc9d429063d.js → 2914.bundle.adefec5b51b4955af1f9.js} +2 -0
  7. package/dist/{2932.bundle.038f79dbbfdd9d1f387b.js → 2932.bundle.2757ab993a28dab49d56.js} +2 -2
  8. package/dist/{3075.bundle.0624f6bf3f676f30d1b5.js → 3075.bundle.5d83563c3791a0d884df.js} +16 -3
  9. package/dist/{3353.bundle.184ebb9668df2cbebd26.js → 3353.bundle.1b2d3da25de70f5f1042.js} +33 -4
  10. package/dist/{3984.bundle.592161af4b618c9dd56f.js → 3984.bundle.1248e382e82ee04eff72.js} +12 -7
  11. package/dist/{4113.bundle.7ec6da0eb1ab98e1b791.js → 4113.bundle.1a3202dd6a1b2e6b9d5d.js} +5 -5
  12. package/dist/{4526.bundle.fbdd617a934353019be3.js → 4526.bundle.54c0b8f753ed5c39f6c5.js} +2 -2
  13. package/dist/{6029.bundle.43e04238ac01880fa66c.js → 6029.bundle.a4206e2a2e75c7b1ad7b.js} +238 -40
  14. package/dist/{6066.bundle.345453ace06e86bc481c.js → 6066.bundle.89df990e4f257e8ac73b.js} +1466 -39
  15. package/dist/{6201.bundle.e0d8d1c967a9daed4662.js → 6201.bundle.b584d7554570344d9170.js} +4 -4
  16. package/dist/{7197.bundle.a9c6429f2859a8feeded.js → 7197.bundle.2032eea26c084877d172.js} +3 -3
  17. package/dist/{810.bundle.86ba4f6f1311ccc28d41.js → 810.bundle.8b29de53f9632f0f1bf9.js} +4 -4
  18. package/dist/{8185.bundle.b2252d9ff14ce760df9c.js → 8185.bundle.c7e0ab58fa8f7070de26.js} +22 -16
  19. package/dist/{8558.bundle.5b67110ba3e66f5525ae.js → 8558.bundle.24bb90c2d5a0857577c5.js} +1 -1
  20. package/dist/{7241.bundle.7097a0cd314605d766f5.js → 8572.bundle.bd98ac784dae1e224a52.js} +135 -47
  21. package/dist/{3166.bundle.40162f1d9f9f5fc16b16.js → 908.bundle.7f901ab4610793bb5ee3.js} +29 -5
  22. package/dist/{934.bundle.c446dfb396152899756f.js → 934.bundle.441c775536d8be5029af.js} +2 -2
  23. package/dist/{963.bundle.88152346007c0f5049a3.js → 963.bundle.4b88a54196fdd1976d6c.js} +2 -2
  24. package/dist/{9890.bundle.37d7ed265c0454337a57.js → 9890.bundle.b4c265e3609512785ae8.js} +2 -2
  25. package/dist/{9977.bundle.071821200c1921021d29.js → 9977.bundle.4f44190c1a5d6a69bc00.js} +3 -1
  26. package/dist/{app.bundle.d09601053966ecdcfe4b.js → app.bundle.223c009cd6f636320f76.js} +2148 -1758
  27. package/dist/app.bundle.css +2 -2
  28. package/dist/{compute.bundle.f0c30502c027d04e94f2.js → compute.bundle.83a75c96620eedca973e.js} +3 -3
  29. package/dist/index.html +1 -1
  30. package/dist/{polySeg.bundle.7445d00e1e9ef623d0f1.js → polySeg.bundle.30f6f13491f48e597605.js} +3 -3
  31. package/dist/sw.js +1 -1
  32. package/package.json +19 -19
  33. /package/dist/{1459.bundle.4b6682c8673e199edf64.js → 1459.bundle.ea2023918c1ef217d23a.js} +0 -0
  34. /package/dist/{1807.bundle.e8c6890ca68e62f46990.js → 1807.bundle.a04f3486b00cdcc6a305.js} +0 -0
  35. /package/dist/{213.bundle.d8495e69f1d1405d0356.js → 213.bundle.e861b773d4779d7d724a.js} +0 -0
  36. /package/dist/{2424.bundle.ef98022039ea6e87cfd9.js → 2424.bundle.425cb2260521f2a23f70.js} +0 -0
  37. /package/dist/{3658.bundle.04fdfe11b9d38cd5f3c6.js → 3658.bundle.a6a9c2e1b32d92e3b621.js} +0 -0
  38. /package/dist/{6027.bundle.155cbff7fa97c7ede627.js → 6027.bundle.8e1b6021f0d570eb85f5.js} +0 -0
  39. /package/dist/{7639.bundle.a659acbf2ab7f3f2e8f4.js → 7639.bundle.b622eafdc74d9bfc1280.js} +0 -0
  40. /package/dist/{8228.bundle.74c8ca5e66a44db80464.js → 8228.bundle.f520ecf3c0a8998e770a.js} +0 -0
  41. /package/dist/{85.bundle.e65ed829e1a136e33576.js → 85.bundle.a27a1466f85e01adf8e8.js} +0 -0
  42. /package/dist/{8815.bundle.c8a97b220635e9b15109.js → 8815.bundle.096958a5ae7253911a2e.js} +0 -0
  43. /package/dist/{9026.bundle.eb2ae9e2311a6a620751.js → 9026.bundle.019d8b4b70096b94302e.js} +0 -0
  44. /package/dist/{9862.bundle.87d8249a9cf1d8cf579d.js → 9862.bundle.b0ea941458506379f666.js} +0 -0
@@ -652,6 +652,10 @@ function calculateSUVScalingFactors(instances) {
652
652
  /* harmony export */ zj: () => (/* binding */ getConfig)
653
653
  /* harmony export */ });
654
654
  /* unused harmony export getAddOns */
655
+ /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
656
+ /* harmony import */ var _enums_Events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(94021);
657
+
658
+
655
659
  let config = {};
656
660
  function getConfig() {
657
661
  return config;
@@ -4618,6 +4622,7 @@ class ToolStyle {
4618
4622
  textBoxLinkLineDash: '2,3',
4619
4623
  textBoxShadow: true,
4620
4624
  markerSize: '10',
4625
+ angleArcLineDash: '',
4621
4626
  };
4622
4627
  this._initializeConfig(defaultConfig);
4623
4628
  }
@@ -5247,7 +5252,7 @@ const segmentationRenderingEngine = new SegmentationRenderingEngine();
5247
5252
  /* unused harmony export default */
5248
5253
  /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
5249
5254
  /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99737);
5250
- /* harmony import */ var _kitware_vtk_js_Rendering_Core_ColorTransferFunction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33739);
5255
+ /* harmony import */ var _kitware_vtk_js_Rendering_Core_ColorTransferFunction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(642);
5251
5256
  /* harmony import */ var _kitware_vtk_js_Common_DataModel_PiecewiseFunction__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99341);
5252
5257
  /* harmony import */ var _triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(49906);
5253
5258
  /* harmony import */ var _SegmentationStyle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(92686);
@@ -5969,13 +5974,16 @@ function normalizeSegments(segmentsConfig, type, data) {
5969
5974
  const normalizedSegments = {};
5970
5975
  if (segmentsConfig) {
5971
5976
  Object.entries(segmentsConfig).forEach(([segmentIndex, segment]) => {
5972
- normalizedSegments[segmentIndex] = {
5977
+ const { label, locked, cachedStats, active, ...rest } = segment;
5978
+ const normalizedSegment = {
5973
5979
  segmentIndex: Number(segmentIndex),
5974
- label: segment.label ?? `Segment ${segmentIndex}`,
5975
- locked: segment.locked ?? false,
5976
- cachedStats: segment.cachedStats ?? {},
5977
- active: segment.active ?? false,
5980
+ label: label ?? `Segment ${segmentIndex}`,
5981
+ locked: locked ?? false,
5982
+ cachedStats: cachedStats ?? {},
5983
+ active: active ?? false,
5984
+ ...rest,
5978
5985
  };
5986
+ normalizedSegments[segmentIndex] = normalizedSegment;
5979
5987
  });
5980
5988
  }
5981
5989
  else if (type === enums.SegmentationRepresentations.Surface) {
@@ -14764,6 +14772,8 @@ WindowLevelTool.toolName = 'WindowLevel';
14764
14772
  /* harmony import */ var _kitware_vtk_js_Common_Core_Math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84607);
14765
14773
  /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(15327);
14766
14774
  /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(85817);
14775
+ /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(99737);
14776
+
14767
14777
 
14768
14778
 
14769
14779
 
@@ -14880,6 +14890,9 @@ class ZoomTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .BaseTool */ .oS {
14880
14890
  }
14881
14891
  this.mouseDragCallback = this._dragCallback.bind(this);
14882
14892
  }
14893
+ mouseWheelCallback(evt) {
14894
+ this._zoom(evt);
14895
+ }
14883
14896
  _pinchCallback(evt) {
14884
14897
  const pointsList = evt.detail
14885
14898
  .currentPointsList;
@@ -14919,6 +14932,36 @@ class ZoomTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .BaseTool */ .oS {
14919
14932
  }
14920
14933
  viewport.render();
14921
14934
  }
14935
+ _zoom(evt) {
14936
+ const { element, points } = evt.detail;
14937
+ const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_2__.getEnabledElement)(element);
14938
+ const { viewport } = enabledElement;
14939
+ const camera = viewport.getCamera();
14940
+ const wheelData = evt.detail.wheel;
14941
+ const direction = wheelData.direction;
14942
+ const eventDetails = {
14943
+ detail: {
14944
+ element,
14945
+ eventName: _enums__WEBPACK_IMPORTED_MODULE_4__.Events.MOUSE_WHEEL,
14946
+ renderingEngineId: enabledElement.renderingEngineId,
14947
+ viewportId: viewport.id,
14948
+ camera: {},
14949
+ deltaPoints: {
14950
+ page: points.page,
14951
+ client: points.client,
14952
+ world: points.world,
14953
+ canvas: [0, -direction * 5],
14954
+ },
14955
+ startPoints: points,
14956
+ lastPoints: points,
14957
+ currentPoints: points,
14958
+ },
14959
+ };
14960
+ if (viewport.type === _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_2__.Enums.ViewportType.STACK) {
14961
+ this.preMouseDownCallback(eventDetails);
14962
+ }
14963
+ this._dragCallback(eventDetails);
14964
+ }
14922
14965
  _panCallback(evt) {
14923
14966
  const { element, deltaPoints } = evt.detail;
14924
14967
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_2__.getEnabledElement)(element);
@@ -14991,6 +15034,8 @@ class AngleTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
14991
15034
  supportedInteractionTypes: ['Mouse', 'Touch'],
14992
15035
  configuration: {
14993
15036
  shadow: true,
15037
+ showAngleArc: false,
15038
+ arcOffset: 5,
14994
15039
  preventHandleOutsideImage: false,
14995
15040
  getTextLines: defaultGetTextLines,
14996
15041
  },
@@ -15139,6 +15184,7 @@ class AngleTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
15139
15184
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_4__.removeAnnotation)(annotation.annotationUID);
15140
15185
  }
15141
15186
  (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A)(viewportIdsToRender);
15187
+ this.doneEditMemo();
15142
15188
  if (newAnnotation) {
15143
15189
  (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_12__.triggerAnnotationCompleted)(annotation);
15144
15190
  }
@@ -15149,8 +15195,9 @@ class AngleTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
15149
15195
  this.isDrawing = true;
15150
15196
  const eventDetail = evt.detail;
15151
15197
  const { element } = eventDetail;
15152
- const { annotation, viewportIdsToRender, handleIndex, movingTextBox } = this.editData;
15198
+ const { annotation, viewportIdsToRender, handleIndex, movingTextBox, newAnnotation, } = this.editData;
15153
15199
  const { data } = annotation;
15200
+ this.createMemo(element, annotation, { newAnnotation });
15154
15201
  if (movingTextBox) {
15155
15202
  const { deltaPoints } = eventDetail;
15156
15203
  const worldPosDelta = deltaPoints.world;
@@ -15267,7 +15314,7 @@ class AngleTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
15267
15314
  const { annotationUID, data } = annotation;
15268
15315
  const { points, activeHandleIndex } = data.handles;
15269
15316
  styleSpecifier.annotationUID = annotationUID;
15270
- const { color, lineWidth, lineDash } = this.getAnnotationStyle({
15317
+ const { color, lineWidth, lineDash, angleArcLineDash } = this.getAnnotationStyle({
15271
15318
  annotation,
15272
15319
  styleSpecifier,
15273
15320
  });
@@ -15319,6 +15366,36 @@ class AngleTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
15319
15366
  width: lineWidth,
15320
15367
  lineDash,
15321
15368
  });
15369
+ if (this.configuration.showAngleArc) {
15370
+ const center = canvasCoordinates[1];
15371
+ const offset = this.configuration.arcOffset;
15372
+ const radius = Math.min(_utilities_math_line__WEBPACK_IMPORTED_MODULE_6__.distanceToPoint([center[0], center[1]], [canvasCoordinates[0][0], canvasCoordinates[0][1]], [canvasCoordinates[2][0], canvasCoordinates[2][1]]), _utilities_math_line__WEBPACK_IMPORTED_MODULE_6__.distanceToPoint([center[0], center[1]], [canvasCoordinates[2][0], canvasCoordinates[2][1]], [canvasCoordinates[0][0], canvasCoordinates[0][1]])) / offset;
15373
+ const anglePoints = [];
15374
+ let startAngle = Math.atan2(canvasCoordinates[0][1] - center[1], canvasCoordinates[0][0] - center[0]);
15375
+ let endAngle = Math.atan2(canvasCoordinates[2][1] - center[1], canvasCoordinates[2][0] - center[0]);
15376
+ if (endAngle < startAngle) {
15377
+ endAngle += 2 * Math.PI;
15378
+ }
15379
+ const angleDifference = endAngle - startAngle;
15380
+ if (angleDifference > Math.PI) {
15381
+ const temp = startAngle;
15382
+ startAngle = endAngle;
15383
+ endAngle = temp + 2 * Math.PI;
15384
+ }
15385
+ const segments = 32;
15386
+ for (let i = 0; i <= segments; i++) {
15387
+ const angle = startAngle + (i / segments) * (endAngle - startAngle);
15388
+ anglePoints.push([
15389
+ center[0] + radius * Math.cos(angle),
15390
+ center[1] + radius * Math.sin(angle),
15391
+ ]);
15392
+ }
15393
+ (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_8__.drawPath)(svgDrawingHelper, annotationUID, '3', anglePoints, {
15394
+ color: color,
15395
+ width: lineWidth,
15396
+ lineDash: angleArcLineDash,
15397
+ });
15398
+ }
15322
15399
  if (!data.cachedStats[targetId]?.angle) {
15323
15400
  continue;
15324
15401
  }
@@ -15363,6 +15440,7 @@ class AngleTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
15363
15440
  return;
15364
15441
  }
15365
15442
  const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(AngleTool, enabledElement, points, options);
15443
+ const { toolInstance, ...serializableOptions } = options || {};
15366
15444
  const annotation = {
15367
15445
  annotationUID: options?.annotationUID || _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.uuidv4(),
15368
15446
  data: {
@@ -15380,7 +15458,7 @@ class AngleTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
15380
15458
  viewPlaneNormal,
15381
15459
  FrameOfReferenceUID,
15382
15460
  referencedImageId,
15383
- ...options,
15461
+ ...serializableOptions,
15384
15462
  },
15385
15463
  };
15386
15464
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_4__.addAnnotation)(annotation, viewport.element);
@@ -15880,6 +15958,7 @@ class ArrowAnnotateTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .Annotation
15880
15958
  return;
15881
15959
  }
15882
15960
  const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(ArrowAnnotateTool, enabledElement, points, options);
15961
+ const { toolInstance, ...serializableOptions } = options || {};
15883
15962
  const annotation = {
15884
15963
  annotationUID: options?.annotationUID || _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.uuidv4(),
15885
15964
  data: {
@@ -15898,7 +15977,7 @@ class ArrowAnnotateTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .Annotation
15898
15977
  viewPlaneNormal,
15899
15978
  FrameOfReferenceUID,
15900
15979
  referencedImageId,
15901
- ...options,
15980
+ ...serializableOptions,
15902
15981
  },
15903
15982
  };
15904
15983
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_3__.addAnnotation)(annotation, viewport.element);
@@ -16702,6 +16781,7 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
16702
16781
  const [major0, major1] = majorAxis;
16703
16782
  const [minor0, minor1] = minorAxis;
16704
16783
  const points = [major0, major1, minor0, minor1];
16784
+ const { toolInstance, ...serializableOptions } = options || {};
16705
16785
  const annotation = {
16706
16786
  annotationUID: options?.annotationUID || _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.uuidv4(),
16707
16787
  data: {
@@ -16731,7 +16811,7 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
16731
16811
  viewPlaneNormal,
16732
16812
  FrameOfReferenceUID,
16733
16813
  referencedImageId,
16734
- ...options,
16814
+ ...serializableOptions,
16735
16815
  },
16736
16816
  };
16737
16817
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.addAnnotation)(annotation, viewport.element);
@@ -17374,6 +17454,7 @@ class CircleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationTool
17374
17454
  return;
17375
17455
  }
17376
17456
  const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(CircleROITool, enabledElement, points, options);
17457
+ const { toolInstance, ...serializableOptions } = options || {};
17377
17458
  const annotation = {
17378
17459
  annotationUID: options?.annotationUID || _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.uuidv4(),
17379
17460
  data: {
@@ -17404,7 +17485,7 @@ class CircleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationTool
17404
17485
  viewPlaneNormal,
17405
17486
  FrameOfReferenceUID,
17406
17487
  referencedImageId,
17407
- ...options,
17488
+ ...serializableOptions,
17408
17489
  },
17409
17490
  };
17410
17491
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_4__.addAnnotation)(annotation, viewport.element);
@@ -19380,6 +19461,7 @@ class EllipticalROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .Annotation
19380
19461
  return;
19381
19462
  }
19382
19463
  const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(EllipticalROITool, enabledElement, points, options);
19464
+ const { toolInstance, ...serializableOptions } = options || {};
19383
19465
  const annotation = {
19384
19466
  annotationUID: options?.annotationUID || _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.uuidv4(),
19385
19467
  data: {
@@ -19400,7 +19482,7 @@ class EllipticalROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .Annotation
19400
19482
  viewPlaneNormal,
19401
19483
  FrameOfReferenceUID,
19402
19484
  referencedImageId,
19403
- ...options,
19485
+ ...serializableOptions,
19404
19486
  },
19405
19487
  };
19406
19488
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_4__.addAnnotation)(annotation, viewport.element);
@@ -20954,6 +21036,7 @@ class LengthTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .AnnotationTool */
20954
21036
  return;
20955
21037
  }
20956
21038
  const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(LengthTool, enabledElement, points, options);
21039
+ const { toolInstance, ...serializableOptions } = options || {};
20957
21040
  const annotation = {
20958
21041
  annotationUID: options?.annotationUID || _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.uuidv4(),
20959
21042
  data: {
@@ -20971,7 +21054,7 @@ class LengthTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .AnnotationTool */
20971
21054
  viewPlaneNormal,
20972
21055
  FrameOfReferenceUID,
20973
21056
  referencedImageId,
20974
- ...options,
21057
+ ...serializableOptions,
20975
21058
  },
20976
21059
  };
20977
21060
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.addAnnotation)(annotation, viewport.element);
@@ -21879,9 +21962,11 @@ function defaultGetTextLines(data, targetId) {
21879
21962
  /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(99737);
21880
21963
  /* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(60810);
21881
21964
  /* harmony import */ var _cursors_elementCursor__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(7001);
21882
- /* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(58640);
21883
- /* harmony import */ var _utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(40634);
21884
- /* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(18990);
21965
+ /* harmony import */ var _stateManagement_annotation_annotationVisibility__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(29601);
21966
+ /* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(58640);
21967
+ /* harmony import */ var _utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(40634);
21968
+ /* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(18990);
21969
+
21885
21970
 
21886
21971
 
21887
21972
 
@@ -21906,6 +21991,10 @@ class ProbeTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
21906
21991
  preventHandleOutsideImage: false,
21907
21992
  getTextLines: defaultGetTextLines,
21908
21993
  handleRadius: '6',
21994
+ textCanvasOffset: {
21995
+ x: 6,
21996
+ y: -6,
21997
+ },
21909
21998
  },
21910
21999
  }; }
21911
22000
  constructor(toolProps = {}, defaultToolProps) {
@@ -21932,7 +22021,7 @@ class ProbeTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
21932
22021
  this._activateModify(element);
21933
22022
  (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_10__.hideElementCursor)(element);
21934
22023
  evt.preventDefault();
21935
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A)(viewportIdsToRender);
22024
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .A)(viewportIdsToRender);
21936
22025
  return annotation;
21937
22026
  };
21938
22027
  this._endCallback = (evt) => {
@@ -21956,7 +22045,7 @@ class ProbeTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
21956
22045
  this.configuration.preventHandleOutsideImage) {
21957
22046
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_3__.removeAnnotation)(annotation.annotationUID);
21958
22047
  }
21959
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A)(viewportIdsToRender);
22048
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .A)(viewportIdsToRender);
21960
22049
  if (newAnnotation) {
21961
22050
  (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_4__.triggerAnnotationCompleted)(annotation);
21962
22051
  }
@@ -21971,7 +22060,7 @@ class ProbeTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
21971
22060
  this.createMemo(element, annotation, { newAnnotation });
21972
22061
  data.handles.points[0] = [...worldPos];
21973
22062
  annotation.invalidated = true;
21974
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A)(viewportIdsToRender);
22063
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .A)(viewportIdsToRender);
21975
22064
  };
21976
22065
  this.cancel = (element) => {
21977
22066
  if (this.isDrawing) {
@@ -21982,7 +22071,7 @@ class ProbeTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
21982
22071
  const { data } = annotation;
21983
22072
  annotation.highlighted = false;
21984
22073
  data.handles.activeHandleIndex = null;
21985
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A)(viewportIdsToRender);
22074
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .A)(viewportIdsToRender);
21986
22075
  if (newAnnotation) {
21987
22076
  (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_4__.triggerAnnotationCompleted)(annotation);
21988
22077
  }
@@ -22074,6 +22163,9 @@ class ProbeTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
22074
22163
  console.warn('Rendering Engine has been destroyed');
22075
22164
  return renderStatus;
22076
22165
  }
22166
+ if (!(0,_stateManagement_annotation_annotationVisibility__WEBPACK_IMPORTED_MODULE_11__.isAnnotationVisible)(annotationUID)) {
22167
+ continue;
22168
+ }
22077
22169
  const handleGroupUID = '0';
22078
22170
  (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_6__.drawHandles)(svgDrawingHelper, annotationUID, handleGroupUID, [canvasCoordinates], { color, lineWidth, handleRadius: this.configuration.handleRadius });
22079
22171
  renderStatus = true;
@@ -22084,8 +22176,8 @@ class ProbeTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
22084
22176
  const textLines = this.configuration.getTextLines(data, targetId);
22085
22177
  if (textLines) {
22086
22178
  const textCanvasCoordinates = [
22087
- canvasCoordinates[0] + 6,
22088
- canvasCoordinates[1] - 6,
22179
+ canvasCoordinates[0] + this.configuration.textCanvasOffset.x,
22180
+ canvasCoordinates[1] + this.configuration.textCanvasOffset.y,
22089
22181
  ];
22090
22182
  const textUID = '0';
22091
22183
  (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_6__.drawTextBox)(svgDrawingHelper, annotationUID, textUID, textLines, [textCanvasCoordinates[0], textCanvasCoordinates[1]], options);
@@ -22109,6 +22201,7 @@ class ProbeTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
22109
22201
  return;
22110
22202
  }
22111
22203
  const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, viewUp, instance, viewport, } = this.hydrateBase(ProbeTool, enabledElement, points, options);
22204
+ const { toolInstance, ...serializableOptions } = options || {};
22112
22205
  const annotation = {
22113
22206
  annotationUID: options?.annotationUID || _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.uuidv4(),
22114
22207
  data: {
@@ -22126,11 +22219,11 @@ class ProbeTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
22126
22219
  viewPlaneNormal,
22127
22220
  FrameOfReferenceUID,
22128
22221
  referencedImageId,
22129
- ...options,
22222
+ ...serializableOptions,
22130
22223
  },
22131
22224
  };
22132
22225
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_3__.addAnnotation)(annotation, viewport.element);
22133
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A)([viewport.id]);
22226
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .A)([viewport.id]);
22134
22227
  }; }
22135
22228
  getHandleNearImagePoint(element, annotation, canvasCoords, proximity) {
22136
22229
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
@@ -22154,7 +22247,7 @@ class ProbeTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
22154
22247
  };
22155
22248
  this._activateModify(element);
22156
22249
  (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_10__.hideElementCursor)(element);
22157
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .A)(viewportIdsToRender);
22250
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .A)(viewportIdsToRender);
22158
22251
  evt.preventDefault();
22159
22252
  }
22160
22253
  _calculateCachedStats(annotation, renderingEngine, enabledElement, changeType = _enums__WEBPACK_IMPORTED_MODULE_8__.ChangeTypes.StatsUpdated) {
@@ -22167,7 +22260,7 @@ class ProbeTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
22167
22260
  for (let i = 0; i < targetIds.length; i++) {
22168
22261
  const targetId = targetIds[i];
22169
22262
  const pixelUnitsOptions = {
22170
- isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_13__/* .isViewportPreScaled */ .u)(viewport, targetId),
22263
+ isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_14__/* .isViewportPreScaled */ .u)(viewport, targetId),
22171
22264
  isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
22172
22265
  };
22173
22266
  const image = this.getTargetImageData(targetId);
@@ -22200,7 +22293,7 @@ class ProbeTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .AnnotationTool */
22200
22293
  : 'raw';
22201
22294
  }
22202
22295
  else {
22203
- modalityUnit = (0,_utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_12__/* .getPixelValueUnits */ .j)(modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
22296
+ modalityUnit = (0,_utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_13__/* .getPixelValueUnits */ .j)(modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
22204
22297
  }
22205
22298
  cachedStats[targetId] = {
22206
22299
  index: ijk,
@@ -23308,6 +23401,7 @@ class SplineROITool extends _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_
23308
23401
  const splineConfig = instance._getSplineConfig(splineType);
23309
23402
  const SplineClass = splineConfig.Class;
23310
23403
  const splineInstance = new SplineClass();
23404
+ const { toolInstance, ...serializableOptions } = options || {};
23311
23405
  const annotation = {
23312
23406
  annotationUID: options?.annotationUID || _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.uuidv4(),
23313
23407
  data: {
@@ -23334,7 +23428,7 @@ class SplineROITool extends _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_
23334
23428
  viewPlaneNormal,
23335
23429
  FrameOfReferenceUID,
23336
23430
  referencedImageId,
23337
- ...options,
23431
+ ...serializableOptions,
23338
23432
  },
23339
23433
  };
23340
23434
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_2__.addAnnotation)(annotation, viewport.element);
@@ -25657,6 +25751,9 @@ BaseTool.toolName = 'BaseTool';
25657
25751
  /* harmony import */ var _removeContourFromElement__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(87420);
25658
25752
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(36625);
25659
25753
  /* harmony import */ var _utilities_segmentation_computeAndAddRepresentation__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(27479);
25754
+ /* harmony import */ var _utilities_segmentation_getUniqueSegmentIndices__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(25758);
25755
+ /* harmony import */ var _stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(82056);
25756
+ /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(3823);
25660
25757
 
25661
25758
 
25662
25759
 
@@ -25664,7 +25761,10 @@ BaseTool.toolName = 'BaseTool';
25664
25761
 
25665
25762
 
25666
25763
 
25667
- let polySegConversionInProgress = false;
25764
+
25765
+
25766
+
25767
+ const polySegConversionInProgressForViewportId = new Map();
25668
25768
  const processedViewportSegmentations = new Map();
25669
25769
  function removeRepresentation(viewportId, segmentationId, renderImmediate = false) {
25670
25770
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElementByViewportId)(viewportId);
@@ -25672,10 +25772,10 @@ function removeRepresentation(viewportId, segmentationId, renderImmediate = fals
25672
25772
  return;
25673
25773
  }
25674
25774
  const { viewport } = enabledElement;
25775
+ (0,_removeContourFromElement__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)(viewportId, segmentationId);
25675
25776
  if (!renderImmediate) {
25676
25777
  return;
25677
25778
  }
25678
- (0,_removeContourFromElement__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)(viewportId, segmentationId);
25679
25779
  viewport.render();
25680
25780
  }
25681
25781
  async function render(viewport, contourRepresentation) {
@@ -25685,13 +25785,13 @@ async function render(viewport, contourRepresentation) {
25685
25785
  return;
25686
25786
  }
25687
25787
  let contourData = segmentation.representationData[_enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.Contour];
25788
+ const polySeg = (0,_config__WEBPACK_IMPORTED_MODULE_5__/* .getPolySeg */ .Qy)();
25688
25789
  if (!contourData &&
25689
25790
  (0,_config__WEBPACK_IMPORTED_MODULE_5__/* .getPolySeg */ .Qy)()?.canComputeRequestedRepresentation(segmentationId, _enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.Contour) &&
25690
- !polySegConversionInProgress) {
25691
- polySegConversionInProgress = true;
25692
- const polySeg = (0,_config__WEBPACK_IMPORTED_MODULE_5__/* .getPolySeg */ .Qy)();
25791
+ !polySegConversionInProgressForViewportId.get(viewport.id)) {
25792
+ polySegConversionInProgressForViewportId.set(viewport.id, true);
25693
25793
  contourData = await (0,_utilities_segmentation_computeAndAddRepresentation__WEBPACK_IMPORTED_MODULE_6__/* .computeAndAddRepresentation */ .d)(segmentationId, _enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.Contour, () => polySeg.computeContourData(segmentationId, { viewport }), () => undefined);
25694
- polySegConversionInProgress = false;
25794
+ polySegConversionInProgressForViewportId.set(viewport.id, false);
25695
25795
  }
25696
25796
  else if (!contourData && !(0,_config__WEBPACK_IMPORTED_MODULE_5__/* .getPolySeg */ .Qy)()) {
25697
25797
  console.debug(`No contour data found for segmentationId ${segmentationId} and PolySeg add-on is not configured. Unable to convert from other representations to contour. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.`);
@@ -25702,8 +25802,101 @@ async function render(viewport, contourRepresentation) {
25702
25802
  if (!contourData.geometryIds?.length) {
25703
25803
  return;
25704
25804
  }
25805
+ let hasContourDataButNotMatchingViewport = false;
25806
+ const viewportNormal = viewport.getCamera().viewPlaneNormal;
25807
+ if (contourData.annotationUIDsMap) {
25808
+ hasContourDataButNotMatchingViewport = !_checkContourNormalsMatchViewport(contourData.annotationUIDsMap, viewportNormal);
25809
+ }
25810
+ if (contourData.geometryIds.length > 0) {
25811
+ hasContourDataButNotMatchingViewport = !_checkContourGeometryMatchViewport(contourData.geometryIds, viewportNormal);
25812
+ }
25813
+ const viewportProcessed = processedViewportSegmentations.get(viewport.id) || new Set();
25814
+ if (hasContourDataButNotMatchingViewport &&
25815
+ !polySegConversionInProgressForViewportId.get(viewport.id) &&
25816
+ !viewportProcessed.has(segmentationId) &&
25817
+ viewport.viewportStatus === _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.Enums.ViewportStatus.RENDERED) {
25818
+ polySegConversionInProgressForViewportId.set(viewport.id, true);
25819
+ const segmentIndices = (0,_utilities_segmentation_getUniqueSegmentIndices__WEBPACK_IMPORTED_MODULE_7__/* .getUniqueSegmentIndices */ .O)(segmentationId);
25820
+ const surfacesInfo = await polySeg.computeSurfaceData(segmentationId, {
25821
+ segmentIndices,
25822
+ viewport,
25823
+ });
25824
+ const geometryIds = surfacesInfo.geometryIds;
25825
+ const pointsAndPolys = [];
25826
+ for (const geometryId of geometryIds.values()) {
25827
+ const geometry = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getGeometry(geometryId);
25828
+ const data = geometry.data;
25829
+ pointsAndPolys.push({
25830
+ points: data.points,
25831
+ polys: data.polys,
25832
+ segmentIndex: data.segmentIndex,
25833
+ id: data.segmentIndex,
25834
+ });
25835
+ }
25836
+ const polyDataCache = await polySeg.clipAndCacheSurfacesForViewport(pointsAndPolys, viewport);
25837
+ const rawResults = polySeg.extractContourData(polyDataCache);
25838
+ const annotationUIDsMap = polySeg.createAndAddContourSegmentationsFromClippedSurfaces(rawResults, viewport, segmentationId);
25839
+ contourData.annotationUIDsMap = new Map([
25840
+ ...contourData.annotationUIDsMap,
25841
+ ...annotationUIDsMap,
25842
+ ]);
25843
+ viewportProcessed.add(segmentationId);
25844
+ processedViewportSegmentations.set(viewport.id, viewportProcessed);
25845
+ polySegConversionInProgressForViewportId.set(viewport.id, false);
25846
+ }
25705
25847
  (0,_contourHandler_handleContourSegmentation__WEBPACK_IMPORTED_MODULE_2__/* .handleContourSegmentation */ .d)(viewport, contourData.geometryIds, contourData.annotationUIDsMap, contourRepresentation);
25706
25848
  }
25849
+ function _checkContourGeometryMatchViewport(geometryIds, viewportNormal) {
25850
+ let validGeometry = null;
25851
+ let geometryData = null;
25852
+ for (const geometryId of geometryIds) {
25853
+ const geometry = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getGeometry(geometryId);
25854
+ if (!geometry) {
25855
+ continue;
25856
+ }
25857
+ const data = geometry.data;
25858
+ if (data.contours?.[0]?.points?.length >= 3) {
25859
+ validGeometry = geometry;
25860
+ geometryData = data;
25861
+ break;
25862
+ }
25863
+ }
25864
+ if (!validGeometry || !geometryData) {
25865
+ return false;
25866
+ }
25867
+ const contours = geometryData.contours;
25868
+ const points = contours[0].points;
25869
+ const point1 = points[0];
25870
+ const point2 = points[1];
25871
+ const point3 = points[2];
25872
+ let normal = gl_matrix__WEBPACK_IMPORTED_MODULE_9__/* .vec3.cross */ .eR.cross(gl_matrix__WEBPACK_IMPORTED_MODULE_9__/* .vec3.create */ .eR.create(), gl_matrix__WEBPACK_IMPORTED_MODULE_9__/* .vec3.sub */ .eR.sub(gl_matrix__WEBPACK_IMPORTED_MODULE_9__/* .vec3.create */ .eR.create(), point2, point1), gl_matrix__WEBPACK_IMPORTED_MODULE_9__/* .vec3.sub */ .eR.sub(gl_matrix__WEBPACK_IMPORTED_MODULE_9__/* .vec3.create */ .eR.create(), point3, point1));
25873
+ normal = gl_matrix__WEBPACK_IMPORTED_MODULE_9__/* .vec3.normalize */ .eR.normalize(gl_matrix__WEBPACK_IMPORTED_MODULE_9__/* .vec3.create */ .eR.create(), normal);
25874
+ const dotProduct = gl_matrix__WEBPACK_IMPORTED_MODULE_9__/* .vec3.dot */ .eR.dot(normal, viewportNormal);
25875
+ return Math.abs(dotProduct) > 0.9;
25876
+ }
25877
+ function _checkContourNormalsMatchViewport(annotationUIDsMap, viewportNormal) {
25878
+ const annotationUIDs = Array.from(annotationUIDsMap.values())
25879
+ .flat()
25880
+ .map((uidSet) => Array.from(uidSet))
25881
+ .flat();
25882
+ const randomAnnotationUIDs = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.getRandomSampleFromArray(annotationUIDs, 3);
25883
+ for (const annotationUID of randomAnnotationUIDs) {
25884
+ const annotation = (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_8__.getAnnotation)(annotationUID);
25885
+ if (annotation?.metadata) {
25886
+ if (!annotation.metadata.viewPlaneNormal) {
25887
+ continue;
25888
+ }
25889
+ const annotationNormal = annotation.metadata.viewPlaneNormal;
25890
+ const dotProduct = Math.abs(viewportNormal[0] * annotationNormal[0] +
25891
+ viewportNormal[1] * annotationNormal[1] +
25892
+ viewportNormal[2] * annotationNormal[2]);
25893
+ if (Math.abs(dotProduct - 1) > 0.01) {
25894
+ return false;
25895
+ }
25896
+ }
25897
+ }
25898
+ return true;
25899
+ }
25707
25900
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
25708
25901
  render,
25709
25902
  removeRepresentation,
@@ -26616,6 +26809,9 @@ class BrushTool extends _LabelmapBaseTool__WEBPACK_IMPORTED_MODULE_10__/* ["defa
26616
26809
  }
26617
26810
  this.doneEditMemo();
26618
26811
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
26812
+ if (!enabledElement) {
26813
+ return;
26814
+ }
26619
26815
  this.applyActiveStrategyCallback(enabledElement, this.getOperationData(element), _enums__WEBPACK_IMPORTED_MODULE_2__.StrategyCallbacks.RejectPreview);
26620
26816
  this._previewData.preview = null;
26621
26817
  this._previewData.isDrag = false;
@@ -28131,9 +28327,6 @@ class RectangleROIStartEndThresholdTool extends _annotation_RectangleROITool__WE
28131
28327
  if (this.configuration.calculatePointsInsideVolume) {
28132
28328
  this._computePointsInsideVolume(annotation, targetId, imageVolume, enabledElement);
28133
28329
  }
28134
- if (this.configuration.calculatePointsInsideVolume) {
28135
- this._computePointsInsideVolume(annotation, targetId, imageVolume, enabledElement);
28136
- }
28137
28330
  annotation.invalidated = false;
28138
28331
  (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_13__.triggerAnnotationModified)(annotation, viewport.element);
28139
28332
  return cachedStats;
@@ -28838,6 +29031,7 @@ class SegmentBidirectionalTool extends _annotation_BidirectionalTool__WEBPACK_IM
28838
29031
  const [major0, major1] = majorAxis;
28839
29032
  const [minor0, minor1] = minorAxis;
28840
29033
  const points = [major0, major1, minor0, minor1];
29034
+ const { toolInstance, ...serializableOptions } = options || {};
28841
29035
  const annotation = {
28842
29036
  annotationUID: options?.annotationUID || _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.uuidv4(),
28843
29037
  data: {
@@ -28869,7 +29063,7 @@ class SegmentBidirectionalTool extends _annotation_BidirectionalTool__WEBPACK_IM
28869
29063
  viewPlaneNormal,
28870
29064
  FrameOfReferenceUID,
28871
29065
  referencedImageId,
28872
- ...options,
29066
+ ...serializableOptions,
28873
29067
  },
28874
29068
  };
28875
29069
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__.addAnnotation)(annotation, viewport.element);
@@ -34198,10 +34392,14 @@ async function calculateVolumeStatistics({ operationData, indices, unit, mode, }
34198
34392
  origin: imageData.getOrigin(),
34199
34393
  direction: imageData.getDirection(),
34200
34394
  };
34395
+ if (!imageInfo.scalarData?.length) {
34396
+ return;
34397
+ }
34201
34398
  const stats = await (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getWebWorkerManager)().executeTask('compute', 'calculateSegmentsStatisticsVolume', {
34202
34399
  segmentationInfo,
34203
34400
  imageInfo,
34204
34401
  indices,
34402
+ unit,
34205
34403
  mode,
34206
34404
  });
34207
34405
  (0,_utilsForWorker__WEBPACK_IMPORTED_MODULE_1__/* .triggerWorkerProgress */ .sg)(_enums__WEBPACK_IMPORTED_MODULE_4__.WorkerTypes.COMPUTE_STATISTICS, 100);
@@ -36476,7 +36674,7 @@ const getImageReferenceInfo = (segVolumeId, segImageIds) => {
36476
36674
  const refImage = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getImage(refImageId);
36477
36675
  const scalingModule = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.metaData.get('scalingModule', refImageId);
36478
36676
  const modalityUnitOptions = {
36479
- isPreScaled: Boolean(refImage.preScale?.scaled),
36677
+ isPreScaled: Boolean(refImage?.preScale?.scaled),
36480
36678
  isSuvScaled: typeof scalingModule?.suvbw === 'number',
36481
36679
  };
36482
36680
  return { refImageId, modalityUnitOptions };