@ohif/app 3.13.0-beta.21 → 3.13.0-beta.23

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 (38) hide show
  1. package/dist/{6409.bundle.24edbaa283b7c521b8f7.js → 2075.bundle.a9783d07b48ca241486e.js} +239 -168
  2. package/dist/{3081.bundle.69c2ed88c1fc66671e82.js → 3081.bundle.4344a3bedb7e70eb5d78.js} +2 -2
  3. package/dist/{3461.bundle.b1c56af281517014477c.js → 3461.bundle.7127d96c33ad3cd68c11.js} +3 -3
  4. package/dist/{4287.bundle.571587a1d29d54203175.js → 4287.bundle.c6bd6cf991e2dae32044.js} +111 -35
  5. package/dist/{5028.bundle.b75c0bb0fa9a490055bd.js → 5028.bundle.5833a530fe9ade4dc787.js} +2 -2
  6. package/dist/{2031.bundle.a17bc2d85cef3a9fea57.js → 581.bundle.2bb402f7316b6e8c735b.js} +326 -231
  7. package/dist/{6280.bundle.6574101421b8a4ab6777.js → 6280.bundle.828ccda61aa5c83408a5.js} +425 -567
  8. package/dist/{2816.bundle.838fa4d72921c026083c.js → 6386.bundle.d1be64fd274877e918d9.js} +30 -58
  9. package/dist/{8665.bundle.056dcd3e86743de2526c.js → 7537.bundle.5a26371cf1368d0e5cf2.js} +321 -75
  10. package/dist/{8305.bundle.e621bc861f8c16092e7c.js → 8305.bundle.61e53a1298804bd4bc46.js} +2 -2
  11. package/dist/{8583.bundle.d0773ead34455cfa28d7.js → 8583.bundle.3bae324bc92e2a4f00e4.js} +2 -2
  12. package/dist/{9195.bundle.902ab556e8909fa878a1.js → 9195.bundle.e4457f0ed6c34993e3c6.js} +3 -4
  13. package/dist/{9205.bundle.dca4f040999d069f1cc5.js → 9205.bundle.a37976b4f3ded2cbb2ab.js} +587 -709
  14. package/dist/{933.bundle.c8f45e1f380ad5a34e07.js → 933.bundle.a6220d057519db0b7651.js} +2 -2
  15. package/dist/{app.bundle.38dca800f336facdb28b.js → app.bundle.f8d7e7242f341be6acab.js} +282 -81
  16. package/dist/{compute.bundle.6bc9d64acadd16a85f59.js → compute.bundle.0fa6bd11224eb79e7474.js} +3 -3
  17. package/dist/index.html +1 -1
  18. package/dist/{polySeg.bundle.41c40b57dd1b265fb425.js → polySeg.bundle.f15c8d2cc2559db627cf.js} +3 -3
  19. package/dist/sw.js +1 -1
  20. package/package.json +21 -21
  21. /package/dist/{1459.bundle.2f3d935de1ef66d49c9b.js → 1459.bundle.fdfad1e671918501e3d2.js} +0 -0
  22. /package/dist/{1933.bundle.1b74cba28c11aaa349c1.js → 1933.bundle.f89ae7ae7baa9a38128e.js} +0 -0
  23. /package/dist/{2018.bundle.330c371c2152bc79a68e.js → 2018.bundle.a517a2a8d4b076b2c684.js} +0 -0
  24. /package/dist/{213.bundle.83766bfd0ad91206ba20.js → 213.bundle.df5bb838062f6a1aa79c.js} +0 -0
  25. /package/dist/{2424.bundle.8d41a94526449b9c27f2.js → 2424.bundle.c2786065ba1937631a79.js} +0 -0
  26. /package/dist/{3138.bundle.536017116b2a48fe8f59.js → 3138.bundle.a33cbe78017b1918c923.js} +0 -0
  27. /package/dist/{4507.bundle.2943a08dea2a96095e86.js → 4507.bundle.895bc803df58395a221f.js} +0 -0
  28. /package/dist/{4819.bundle.b817d46688ec00d46826.js → 4819.bundle.e97fa2fed6fb6e421f1a.js} +0 -0
  29. /package/dist/{5015.bundle.ea7e3b295cd3ef134df2.js → 5015.bundle.eff33bbbbd6ff055c742.js} +0 -0
  30. /package/dist/{5457.bundle.ea0a729d0bb45314d5ca.js → 5457.bundle.4b2e1e0aaf4f54d8cd1e.js} +0 -0
  31. /package/dist/{5485.bundle.8248a4caa4411103e190.js → 5485.bundle.70dbc4d41d1b5f299e6e.js} +0 -0
  32. /package/dist/{6027.bundle.b9a666f05ac57e742979.js → 6027.bundle.77ed34c72d695295cc90.js} +0 -0
  33. /package/dist/{7431.bundle.e6f5f5835a3c49e2309c.js → 7431.bundle.8ddbd21f7b2b8528a14a.js} +0 -0
  34. /package/dist/{7639.bundle.2e179ab85c66a6def98f.js → 7639.bundle.9a1d8c0a3624fff53cb9.js} +0 -0
  35. /package/dist/{8499.bundle.59df69e1919739d6e444.js → 8499.bundle.cca6ef54e2c475fc9f2b.js} +0 -0
  36. /package/dist/{85.bundle.14430d53b13d7ff9f8a8.js → 85.bundle.aa4e9485c037e1bf2cbc.js} +0 -0
  37. /package/dist/{8558.bundle.288aabeb7473ee9d7312.js → 8558.bundle.69bda0c8e9b438294401.js} +0 -0
  38. /package/dist/{9927.bundle.006c8d2dda07109c4749.js → 9927.bundle.006b27903e0450ce2e94.js} +0 -0
@@ -1,4 +1,4 @@
1
- (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[6280,6409],{
1
+ (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[2075,6280],{
2
2
 
3
3
  /***/ 5057
4
4
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
@@ -7294,7 +7294,7 @@ var COLOR_LUT = __webpack_require__(93952);
7294
7294
 
7295
7295
 
7296
7296
  ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/version.js
7297
- const version = '4.15.29';
7297
+ const version = '4.17.2';
7298
7298
 
7299
7299
  ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/synchronizers/callbacks/cameraSyncCallback.js
7300
7300
  /* unused harmony import specifier */ var cameraSyncCallback_getRenderingEngine;
@@ -7773,8 +7773,8 @@ var contours = __webpack_require__(19111);
7773
7773
  var segmentation = __webpack_require__(93759);
7774
7774
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/drawing/index.js
7775
7775
  var drawing = __webpack_require__(473);
7776
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/index.js + 4 modules
7777
- var math = __webpack_require__(85895);
7776
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/index.js + 3 modules
7777
+ var math = __webpack_require__(18153);
7778
7778
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/planar/index.js
7779
7779
  var planar = __webpack_require__(13165);
7780
7780
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/viewportFilters/index.js
@@ -19289,7 +19289,6 @@ LabelTool.toolName = 'Label';
19289
19289
 
19290
19290
 
19291
19291
 
19292
-
19293
19292
  class LengthTool extends base/* AnnotationTool */.EC {
19294
19293
  static { this.toolName = 'Length'; }
19295
19294
  constructor(toolProps = {}, defaultToolProps = {
@@ -19568,36 +19567,17 @@ class LengthTool extends base/* AnnotationTool */.EC {
19568
19567
  console.warn('Rendering Engine has been destroyed');
19569
19568
  return renderStatus;
19570
19569
  }
19571
- const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
19572
- if (!options.visibility) {
19573
- data.handles.textBox = {
19574
- hasMoved: false,
19575
- worldPosition: [0, 0, 0],
19576
- worldBoundingBox: {
19577
- topLeft: [0, 0, 0],
19578
- topRight: [0, 0, 0],
19579
- bottomLeft: [0, 0, 0],
19580
- bottomRight: [0, 0, 0],
19581
- },
19582
- };
19583
- continue;
19584
- }
19585
19570
  const textLines = this.configuration.getTextLines(data, targetId);
19586
- if (!data.handles.textBox.hasMoved) {
19587
- const canvasTextBoxCoords = (0,drawing.getTextBoxCoordsCanvas)(canvasCoordinates);
19588
- data.handles.textBox.worldPosition =
19589
- viewport.canvasToWorld(canvasTextBoxCoords);
19571
+ if (!this.renderLinkedTextBoxAnnotation({
19572
+ enabledElement,
19573
+ svgDrawingHelper,
19574
+ annotation,
19575
+ styleSpecifier,
19576
+ textLines: textLines ?? [],
19577
+ canvasCoordinates,
19578
+ })) {
19579
+ continue;
19590
19580
  }
19591
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
19592
- const textBoxUID = '1';
19593
- const boundingBox = (0,drawingSvg.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
19594
- const { x: left, y: top, width, height } = boundingBox;
19595
- data.handles.textBox.worldBoundingBox = {
19596
- topLeft: viewport.canvasToWorld([left, top]),
19597
- topRight: viewport.canvasToWorld([left + width, top]),
19598
- bottomLeft: viewport.canvasToWorld([left, top + height]),
19599
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
19600
- };
19601
19581
  }
19602
19582
  return renderStatus;
19603
19583
  };
@@ -19723,7 +19703,6 @@ function defaultGetTextLines(data, targetId) {
19723
19703
 
19724
19704
 
19725
19705
 
19726
-
19727
19706
  const { transformWorldToIndex: HeightTool_transformWorldToIndex } = esm.utilities;
19728
19707
  class HeightTool extends base/* AnnotationTool */.EC {
19729
19708
  static { this.toolName = 'Height'; }
@@ -19829,7 +19808,7 @@ class HeightTool extends base/* AnnotationTool */.EC {
19829
19808
  this.isDrawing = true;
19830
19809
  const eventDetail = evt.detail;
19831
19810
  const { element } = eventDetail;
19832
- const { annotation, viewportIdsToRender, handleIndex, movingTextBox, newAnnotation } = this.editData;
19811
+ const { annotation, viewportIdsToRender, handleIndex, movingTextBox, newAnnotation, } = this.editData;
19833
19812
  const { data } = annotation;
19834
19813
  this.createMemo(element, annotation, { newAnnotation });
19835
19814
  if (movingTextBox) {
@@ -19990,36 +19969,17 @@ class HeightTool extends base/* AnnotationTool */.EC {
19990
19969
  console.warn('Rendering Engine has been destroyed');
19991
19970
  return renderStatus;
19992
19971
  }
19993
- const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
19994
- if (!options.visibility) {
19995
- data.handles.textBox = {
19996
- hasMoved: false,
19997
- worldPosition: [0, 0, 0],
19998
- worldBoundingBox: {
19999
- topLeft: [0, 0, 0],
20000
- topRight: [0, 0, 0],
20001
- bottomLeft: [0, 0, 0],
20002
- bottomRight: [0, 0, 0],
20003
- },
20004
- };
20005
- continue;
20006
- }
20007
19972
  const textLines = this.configuration.getTextLines(data, targetId);
20008
- if (!data.handles.textBox.hasMoved) {
20009
- const canvasTextBoxCoords = (0,drawing.getTextBoxCoordsCanvas)(canvasCoordinates);
20010
- data.handles.textBox.worldPosition =
20011
- viewport.canvasToWorld(canvasTextBoxCoords);
19973
+ if (!this.renderLinkedTextBoxAnnotation({
19974
+ enabledElement,
19975
+ svgDrawingHelper,
19976
+ annotation,
19977
+ styleSpecifier,
19978
+ textLines: textLines ?? [],
19979
+ canvasCoordinates,
19980
+ })) {
19981
+ continue;
20012
19982
  }
20013
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
20014
- const textBoxUID = '1';
20015
- const boundingBox = (0,drawingSvg.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
20016
- const { x: left, y: top, width, height } = boundingBox;
20017
- data.handles.textBox.worldBoundingBox = {
20018
- topLeft: viewport.canvasToWorld([left, top]),
20019
- topRight: viewport.canvasToWorld([left + width, top]),
20020
- bottomLeft: viewport.canvasToWorld([left, top + height]),
20021
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
20022
- };
20023
19983
  }
20024
19984
  return renderStatus;
20025
19985
  };
@@ -20138,6 +20098,7 @@ var isViewportPreScaled = __webpack_require__(18990);
20138
20098
 
20139
20099
 
20140
20100
 
20101
+
20141
20102
  const { transformWorldToIndex: ProbeTool_transformWorldToIndex } = esm.utilities;
20142
20103
  class ProbeTool extends base/* AnnotationTool */.EC {
20143
20104
  static { this.toolName = 'Probe'; }
@@ -20332,12 +20293,9 @@ class ProbeTool extends base/* AnnotationTool */.EC {
20332
20293
  }
20333
20294
  const textLines = this.configuration.getTextLines(data, targetId);
20334
20295
  if (textLines) {
20335
- const textCanvasCoordinates = [
20336
- canvasCoordinates[0] + this.configuration.textCanvasOffset.x,
20337
- canvasCoordinates[1] + this.configuration.textCanvasOffset.y,
20338
- ];
20296
+ const textCanvasCoordinates = (0,drawing.getTextBoxCoordsCanvas)([canvasCoordinates], element, textLines);
20339
20297
  const textUID = '0';
20340
- (0,drawingSvg.drawTextBox)(svgDrawingHelper, annotationUID, textUID, textLines, [textCanvasCoordinates[0], textCanvasCoordinates[1]], options);
20298
+ (0,drawingSvg.drawTextBox)(svgDrawingHelper, annotationUID, textUID, textLines, textCanvasCoordinates, options);
20341
20299
  }
20342
20300
  }
20343
20301
  return renderStatus;
@@ -20656,7 +20614,6 @@ var basic = __webpack_require__(73262);
20656
20614
 
20657
20615
 
20658
20616
 
20659
-
20660
20617
 
20661
20618
 
20662
20619
  const { transformWorldToIndex: EllipticalROITool_transformWorldToIndex } = esm.utilities;
@@ -21110,40 +21067,21 @@ class EllipticalROITool extends base/* AnnotationTool */.EC {
21110
21067
  }
21111
21068
  }
21112
21069
  renderStatus = true;
21113
- const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
21114
- if (!options.visibility) {
21115
- data.handles.textBox = {
21116
- hasMoved: false,
21117
- worldPosition: [0, 0, 0],
21118
- worldBoundingBox: {
21119
- topLeft: [0, 0, 0],
21120
- topRight: [0, 0, 0],
21121
- bottomLeft: [0, 0, 0],
21122
- bottomRight: [0, 0, 0],
21123
- },
21124
- };
21125
- continue;
21126
- }
21127
21070
  const textLines = this.configuration.getTextLines(data, targetId);
21128
21071
  if (!textLines || textLines.length === 0) {
21129
21072
  continue;
21130
21073
  }
21131
- let canvasTextBoxCoords;
21132
- if (!data.handles.textBox.hasMoved) {
21133
- canvasTextBoxCoords = (0,drawing.getTextBoxCoordsCanvas)(canvasCorners);
21134
- data.handles.textBox.worldPosition =
21135
- viewport.canvasToWorld(canvasTextBoxCoords);
21074
+ if (!this.renderLinkedTextBoxAnnotation({
21075
+ enabledElement,
21076
+ svgDrawingHelper,
21077
+ annotation,
21078
+ styleSpecifier,
21079
+ textLines,
21080
+ canvasCoordinates,
21081
+ placementPoints: canvasCorners,
21082
+ })) {
21083
+ continue;
21136
21084
  }
21137
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
21138
- const textBoxUID = '1';
21139
- const boundingBox = (0,drawingSvg.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
21140
- const { x: left, y: top, width, height } = boundingBox;
21141
- data.handles.textBox.worldBoundingBox = {
21142
- topLeft: viewport.canvasToWorld([left, top]),
21143
- topRight: viewport.canvasToWorld([left + width, top]),
21144
- bottomLeft: viewport.canvasToWorld([left, top + height]),
21145
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
21146
- };
21147
21085
  }
21148
21086
  return renderStatus;
21149
21087
  };
@@ -21362,7 +21300,6 @@ function EllipticalROITool_defaultGetTextLines(data, targetId) {
21362
21300
 
21363
21301
 
21364
21302
 
21365
-
21366
21303
 
21367
21304
 
21368
21305
  const { transformWorldToIndex: CircleROITool_transformWorldToIndex } = esm.utilities;
@@ -21779,40 +21716,22 @@ class CircleROITool extends base/* AnnotationTool */.EC {
21779
21716
  }
21780
21717
  renderStatus = true;
21781
21718
  if (this.configuration.calculateStats) {
21782
- const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
21783
- if (!options.visibility) {
21784
- data.handles.textBox = {
21785
- hasMoved: false,
21786
- worldPosition: [0, 0, 0],
21787
- worldBoundingBox: {
21788
- topLeft: [0, 0, 0],
21789
- topRight: [0, 0, 0],
21790
- bottomLeft: [0, 0, 0],
21791
- bottomRight: [0, 0, 0],
21792
- },
21793
- };
21794
- continue;
21795
- }
21796
21719
  const textLines = this.configuration.getTextLines(data, targetId);
21797
21720
  if (!textLines || textLines.length === 0) {
21798
21721
  continue;
21799
21722
  }
21800
- let canvasTextBoxCoords;
21801
- if (!data.handles.textBox.hasMoved) {
21802
- canvasTextBoxCoords = (0,drawing.getTextBoxCoordsCanvas)(canvasCorners);
21803
- data.handles.textBox.worldPosition =
21804
- viewport.canvasToWorld(canvasTextBoxCoords);
21723
+ const linkAnchorPoints = [center, canvasCoordinates[1]];
21724
+ if (!this.renderLinkedTextBoxAnnotation({
21725
+ enabledElement,
21726
+ svgDrawingHelper,
21727
+ annotation,
21728
+ styleSpecifier,
21729
+ textLines,
21730
+ canvasCoordinates: linkAnchorPoints,
21731
+ placementPoints: canvasCorners,
21732
+ })) {
21733
+ continue;
21805
21734
  }
21806
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
21807
- const textBoxUID = '1';
21808
- const boundingBox = (0,drawingSvg.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, [center, canvasCoordinates[1]], {}, options);
21809
- const { x: left, y: top, width, height } = boundingBox;
21810
- data.handles.textBox.worldBoundingBox = {
21811
- topLeft: viewport.canvasToWorld([left, top]),
21812
- topRight: viewport.canvasToWorld([left + width, top]),
21813
- bottomLeft: viewport.canvasToWorld([left, top + height]),
21814
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
21815
- };
21816
21735
  }
21817
21736
  }
21818
21737
  return renderStatus;
@@ -22400,7 +22319,6 @@ var ContourSegmentationBaseTool = __webpack_require__(36320);
22400
22319
 
22401
22320
 
22402
22321
 
22403
-
22404
22322
  const SPLINE_MIN_POINTS = 3;
22405
22323
  const SPLINE_CLICK_CLOSE_CURVE_DIST = 10;
22406
22324
  const DEFAULT_SPLINE_CONFIG = {
@@ -22747,32 +22665,33 @@ class SplineROITool extends ContourSegmentationBaseTool/* default */.A {
22747
22665
  element.removeEventListener(enums.Events.MOUSE_DOUBLE_CLICK, this._mouseDownCallback);
22748
22666
  element.removeEventListener(enums.Events.TOUCH_TAP, this._mouseDownCallback);
22749
22667
  };
22750
- this._renderStats = (annotation, viewport, svgDrawingHelper, textboxStyle) => {
22668
+ this._renderStats = (annotation, enabledElement, svgDrawingHelper) => {
22751
22669
  const data = annotation.data;
22670
+ const { viewport } = enabledElement;
22752
22671
  const targetId = this.getTargetId(viewport);
22753
- if (!data.spline.instance.closed || !textboxStyle.visibility) {
22672
+ if (!data.spline.instance.closed) {
22754
22673
  return;
22755
22674
  }
22675
+ const styleSpecifier = {
22676
+ toolGroupId: this.toolGroupId,
22677
+ toolName: this.getToolName(),
22678
+ viewportId: enabledElement.viewport.id,
22679
+ annotationUID: annotation.annotationUID,
22680
+ };
22756
22681
  const textLines = this.configuration.getTextLines(data, targetId);
22757
22682
  if (!textLines || textLines.length === 0) {
22758
22683
  return;
22759
22684
  }
22760
22685
  const canvasCoordinates = data.handles.points.map((p) => viewport.worldToCanvas(p));
22761
- if (!data.handles.textBox.hasMoved) {
22762
- const canvasTextBoxCoords = (0,drawing.getTextBoxCoordsCanvas)(canvasCoordinates);
22763
- data.handles.textBox.worldPosition =
22764
- viewport.canvasToWorld(canvasTextBoxCoords);
22765
- }
22766
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
22767
- const textBoxUID = 'textBox';
22768
- const boundingBox = (0,drawingSvg.drawLinkedTextBox)(svgDrawingHelper, annotation.annotationUID ?? '', textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, textboxStyle);
22769
- const { x: left, y: top, width, height } = boundingBox;
22770
- data.handles.textBox.worldBoundingBox = {
22771
- topLeft: viewport.canvasToWorld([left, top]),
22772
- topRight: viewport.canvasToWorld([left + width, top]),
22773
- bottomLeft: viewport.canvasToWorld([left, top + height]),
22774
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
22775
- };
22686
+ this.renderLinkedTextBoxAnnotation({
22687
+ enabledElement,
22688
+ svgDrawingHelper,
22689
+ annotation,
22690
+ styleSpecifier,
22691
+ textLines,
22692
+ canvasCoordinates,
22693
+ textBoxUID: 'textBox',
22694
+ });
22776
22695
  };
22777
22696
  this.addControlPointCallback = (evt, annotation) => {
22778
22697
  const { data } = annotation;
@@ -23044,7 +22963,7 @@ class SplineROITool extends ContourSegmentationBaseTool/* default */.A {
23044
22963
  lineWidth: 1,
23045
22964
  });
23046
22965
  }
23047
- this._renderStats(annotation, viewport, svgDrawingHelper, annotationStyle.textbox);
22966
+ this._renderStats(annotation, enabledElement, svgDrawingHelper);
23048
22967
  if (this.fireChangeOnUpdate?.annotationUID === annotationUID) {
23049
22968
  this.triggerChangeEvent(annotation, enabledElement, this.fireChangeOnUpdate.changeType, this.fireChangeOnUpdate.contourHoleProcessingEnabled);
23050
22969
  this.fireChangeOnUpdate = null;
@@ -23291,7 +23210,6 @@ var LiveWirePath = __webpack_require__(38776);
23291
23210
 
23292
23211
 
23293
23212
 
23294
-
23295
23213
  const CLICK_CLOSE_CURVE_SQR_DIST = 10 ** 2;
23296
23214
  class LivewireContourTool extends ContourSegmentationBaseTool/* default */.A {
23297
23215
  static { this.toolName = 'LivewireContour'; }
@@ -23641,32 +23559,33 @@ class LivewireContourTool extends ContourSegmentationBaseTool/* default */.A {
23641
23559
  }
23642
23560
  return cachedStats;
23643
23561
  };
23644
- this._renderStats = (annotation, viewport, svgDrawingHelper, textboxStyle) => {
23562
+ this._renderStats = (annotation, enabledElement, svgDrawingHelper) => {
23645
23563
  const data = annotation.data;
23564
+ const { viewport } = enabledElement;
23646
23565
  const targetId = this.getTargetId(viewport);
23647
- if (!data.contour.closed || !textboxStyle.visibility) {
23566
+ if (!data.contour.closed) {
23648
23567
  return;
23649
23568
  }
23569
+ const styleSpecifier = {
23570
+ toolGroupId: this.toolGroupId,
23571
+ toolName: this.getToolName(),
23572
+ viewportId: enabledElement.viewport.id,
23573
+ annotationUID: annotation.annotationUID,
23574
+ };
23650
23575
  const textLines = this.configuration.getTextLines(data, targetId);
23651
23576
  if (!textLines || textLines.length === 0) {
23652
23577
  return;
23653
23578
  }
23654
23579
  const canvasCoordinates = data.handles.points.map((p) => viewport.worldToCanvas(p));
23655
- if (!data.handles.textBox.hasMoved) {
23656
- const canvasTextBoxCoords = (0,drawing.getTextBoxCoordsCanvas)(canvasCoordinates);
23657
- data.handles.textBox.worldPosition =
23658
- viewport.canvasToWorld(canvasTextBoxCoords);
23659
- }
23660
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
23661
- const textBoxUID = 'textBox';
23662
- const boundingBox = (0,drawingSvg.drawLinkedTextBox)(svgDrawingHelper, annotation.annotationUID ?? '', textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, textboxStyle);
23663
- const { x: left, y: top, width, height } = boundingBox;
23664
- data.handles.textBox.worldBoundingBox = {
23665
- topLeft: viewport.canvasToWorld([left, top]),
23666
- topRight: viewport.canvasToWorld([left + width, top]),
23667
- bottomLeft: viewport.canvasToWorld([left, top + height]),
23668
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
23669
- };
23580
+ this.renderLinkedTextBoxAnnotation({
23581
+ enabledElement,
23582
+ svgDrawingHelper,
23583
+ annotation,
23584
+ styleSpecifier,
23585
+ textLines,
23586
+ canvasCoordinates,
23587
+ textBoxUID: 'textBox',
23588
+ });
23670
23589
  };
23671
23590
  this.triggerAnnotationModified = (annotation, enabledElement, changeType = enums.ChangeTypes.StatsUpdated) => {
23672
23591
  const { viewportId, renderingEngineId } = enabledElement;
@@ -23894,7 +23813,7 @@ class LivewireContourTool extends ContourSegmentationBaseTool/* default */.A {
23894
23813
  else if (annotation.invalidated) {
23895
23814
  this._throttledCalculateCachedStats(annotation, element);
23896
23815
  }
23897
- this._renderStats(annotation, viewport, svgDrawingHelper, annotationStyle.textbox);
23816
+ this._renderStats(annotation, enabledElement, svgDrawingHelper);
23898
23817
  return true;
23899
23818
  }
23900
23819
  updateAnnotation(livewirePath) {
@@ -24360,35 +24279,16 @@ class ArrowAnnotateTool extends base/* AnnotationTool */.EC {
24360
24279
  if (!label) {
24361
24280
  continue;
24362
24281
  }
24363
- const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
24364
- if (!options.visibility) {
24365
- data.handles.textBox = {
24366
- hasMoved: false,
24367
- worldPosition: [0, 0, 0],
24368
- worldBoundingBox: {
24369
- topLeft: [0, 0, 0],
24370
- topRight: [0, 0, 0],
24371
- bottomLeft: [0, 0, 0],
24372
- bottomRight: [0, 0, 0],
24373
- },
24374
- };
24282
+ if (!this.renderLinkedTextBoxAnnotation({
24283
+ enabledElement,
24284
+ svgDrawingHelper,
24285
+ annotation,
24286
+ styleSpecifier,
24287
+ textLines: [label],
24288
+ canvasCoordinates,
24289
+ })) {
24375
24290
  continue;
24376
24291
  }
24377
- if (!data.handles.textBox.hasMoved) {
24378
- const canvasTextBoxCoords = canvasCoordinates[1];
24379
- data.handles.textBox.worldPosition =
24380
- viewport.canvasToWorld(canvasTextBoxCoords);
24381
- }
24382
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
24383
- const textBoxUID = '1';
24384
- const boundingBox = (0,drawingSvg.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, [label], textBoxPosition, canvasCoordinates, {}, options);
24385
- const { x: left, y: top, width, height } = boundingBox;
24386
- data.handles.textBox.worldBoundingBox = {
24387
- topLeft: viewport.canvasToWorld([left, top]),
24388
- topRight: viewport.canvasToWorld([left + width, top]),
24389
- bottomLeft: viewport.canvasToWorld([left, top + height]),
24390
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
24391
- };
24392
24292
  }
24393
24293
  return renderStatus;
24394
24294
  };
@@ -24823,36 +24723,22 @@ class AngleTool extends base/* AnnotationTool */.EC {
24823
24723
  if (!data.cachedStats[targetId]?.angle) {
24824
24724
  continue;
24825
24725
  }
24826
- const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
24827
- if (!options.visibility) {
24828
- data.handles.textBox = {
24829
- hasMoved: false,
24830
- worldPosition: [0, 0, 0],
24831
- worldBoundingBox: {
24832
- topLeft: [0, 0, 0],
24833
- topRight: [0, 0, 0],
24834
- bottomLeft: [0, 0, 0],
24835
- bottomRight: [0, 0, 0],
24836
- },
24837
- };
24838
- continue;
24839
- }
24840
24726
  const textLines = this.configuration.getTextLines(data, targetId);
24841
- if (!data.handles.textBox.hasMoved) {
24842
- const canvasTextBoxCoords = canvasCoordinates[1];
24843
- data.handles.textBox.worldPosition =
24844
- viewport.canvasToWorld(canvasTextBoxCoords);
24727
+ const vertexAnchor = [
24728
+ canvasCoordinates[1],
24729
+ canvasCoordinates[1],
24730
+ ];
24731
+ if (!this.renderLinkedTextBoxAnnotation({
24732
+ enabledElement,
24733
+ svgDrawingHelper,
24734
+ annotation,
24735
+ styleSpecifier,
24736
+ textLines,
24737
+ canvasCoordinates,
24738
+ placementPoints: vertexAnchor,
24739
+ })) {
24740
+ continue;
24845
24741
  }
24846
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
24847
- const textBoxUID = '1';
24848
- const boundingBox = (0,drawingSvg.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
24849
- const { x: left, y: top, width, height } = boundingBox;
24850
- data.handles.textBox.worldBoundingBox = {
24851
- topLeft: viewport.canvasToWorld([left, top]),
24852
- topRight: viewport.canvasToWorld([left + width, top]),
24853
- bottomLeft: viewport.canvasToWorld([left, top + height]),
24854
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
24855
- };
24856
24742
  }
24857
24743
  return renderStatus;
24858
24744
  };
@@ -24982,7 +24868,6 @@ var midPoint = __webpack_require__(82983);
24982
24868
 
24983
24869
 
24984
24870
 
24985
-
24986
24871
  class CobbAngleTool extends base/* AnnotationTool */.EC {
24987
24872
  static { this.toolName = 'CobbAngle'; }
24988
24873
  constructor(toolProps = {}, defaultToolProps = {
@@ -25369,44 +25254,27 @@ class CobbAngleTool extends base/* AnnotationTool */.EC {
25369
25254
  if (!data.cachedStats[targetId]?.angle) {
25370
25255
  continue;
25371
25256
  }
25372
- const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
25373
- if (!options.visibility) {
25374
- data.handles.textBox = {
25375
- hasMoved: false,
25376
- worldPosition: [0, 0, 0],
25377
- worldBoundingBox: {
25378
- topLeft: [0, 0, 0],
25379
- topRight: [0, 0, 0],
25380
- bottomLeft: [0, 0, 0],
25381
- bottomRight: [0, 0, 0],
25382
- },
25383
- };
25257
+ const textLines = this.configuration.getTextLines(data, targetId);
25258
+ if (!this.renderLinkedTextBoxAnnotation({
25259
+ enabledElement,
25260
+ svgDrawingHelper,
25261
+ annotation,
25262
+ styleSpecifier,
25263
+ textLines: textLines ?? [],
25264
+ canvasCoordinates,
25265
+ textBoxUID: 'cobbAngleText',
25266
+ })) {
25384
25267
  continue;
25385
25268
  }
25386
- const textLines = this.configuration.getTextLines(data, targetId);
25387
- if (!data.handles.textBox.hasMoved) {
25388
- const canvasTextBoxCoords = (0,drawing.getTextBoxCoordsCanvas)(canvasCoordinates);
25389
- data.handles.textBox.worldPosition =
25390
- viewport.canvasToWorld(canvasTextBoxCoords);
25391
- }
25392
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
25393
- const textBoxUID = 'cobbAngleText';
25394
- const boundingBox = (0,drawingSvg.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
25395
- const { x: left, y: top, width, height } = boundingBox;
25396
- data.handles.textBox.worldBoundingBox = {
25397
- topLeft: viewport.canvasToWorld([left, top]),
25398
- topRight: viewport.canvasToWorld([left + width, top]),
25399
- bottomLeft: viewport.canvasToWorld([left, top + height]),
25400
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
25401
- };
25402
25269
  if (this.configuration.showArcLines) {
25270
+ const textBoxStyleOptions = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
25403
25271
  const arc1TextBoxUID = 'arcAngle1';
25404
25272
  const arc1TextLine = [
25405
25273
  `${arc1Angle.toFixed(2)} ${String.fromCharCode(176)}`,
25406
25274
  ];
25407
25275
  const arch1TextPosCanvas = (0,midPoint/* midPoint2 */.f)(arc1Start, arc1End);
25408
25276
  (0,drawingSvg.drawTextBox)(svgDrawingHelper, annotationUID, arc1TextBoxUID, arc1TextLine, arch1TextPosCanvas, {
25409
- ...options,
25277
+ ...textBoxStyleOptions,
25410
25278
  padding: 3,
25411
25279
  });
25412
25280
  const arc2TextBoxUID = 'arcAngle2';
@@ -25415,7 +25283,7 @@ class CobbAngleTool extends base/* AnnotationTool */.EC {
25415
25283
  ];
25416
25284
  const arch2TextPosCanvas = (0,midPoint/* midPoint2 */.f)(arc2Start, arc2End);
25417
25285
  (0,drawingSvg.drawTextBox)(svgDrawingHelper, annotationUID, arc2TextBoxUID, arc2TextLine, arch2TextPosCanvas, {
25418
- ...options,
25286
+ ...textBoxStyleOptions,
25419
25287
  padding: 3,
25420
25288
  });
25421
25289
  }
@@ -25956,36 +25824,22 @@ class UltrasoundDirectionalTool extends base/* AnnotationTool */.EC {
25956
25824
  shadow: this.configuration.shadow,
25957
25825
  }, dataId);
25958
25826
  }
25959
- const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
25960
- if (!options.visibility) {
25961
- data.handles.textBox = {
25962
- hasMoved: false,
25963
- worldPosition: [0, 0, 0],
25964
- worldBoundingBox: {
25965
- topLeft: [0, 0, 0],
25966
- topRight: [0, 0, 0],
25967
- bottomLeft: [0, 0, 0],
25968
- bottomRight: [0, 0, 0],
25969
- },
25970
- };
25971
- continue;
25972
- }
25973
25827
  const textLines = this.configuration.getTextLines(data, targetId, this.configuration);
25974
- if (!data.handles.textBox.hasMoved) {
25975
- const canvasTextBoxCoords = canvasCoordinates[1];
25976
- data.handles.textBox.worldPosition =
25977
- viewport.canvasToWorld(canvasTextBoxCoords);
25828
+ const vertexAnchor = [
25829
+ canvasCoordinates[1],
25830
+ canvasCoordinates[1],
25831
+ ];
25832
+ if (!this.renderLinkedTextBoxAnnotation({
25833
+ enabledElement,
25834
+ svgDrawingHelper,
25835
+ annotation,
25836
+ styleSpecifier,
25837
+ textLines,
25838
+ canvasCoordinates,
25839
+ placementPoints: vertexAnchor,
25840
+ })) {
25841
+ continue;
25978
25842
  }
25979
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
25980
- const textBoxUID = '1';
25981
- const boundingBox = (0,drawingSvg.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
25982
- const { x: left, y: top, width, height } = boundingBox;
25983
- data.handles.textBox.worldBoundingBox = {
25984
- topLeft: viewport.canvasToWorld([left, top]),
25985
- topRight: viewport.canvasToWorld([left + width, top]),
25986
- bottomLeft: viewport.canvasToWorld([left, top + height]),
25987
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
25988
- };
25989
25843
  }
25990
25844
  return renderStatus;
25991
25845
  };
@@ -28399,7 +28253,6 @@ var RectangleROIStartEndThresholdTool = __webpack_require__(67847);
28399
28253
 
28400
28254
 
28401
28255
 
28402
-
28403
28256
 
28404
28257
 
28405
28258
  const { transformWorldToIndex: CircleROIStartEndThresholdTool_transformWorldToIndex } = esm.utilities;
@@ -28661,40 +28514,25 @@ class CircleROIStartEndThresholdTool extends annotation_CircleROITool {
28661
28514
  }
28662
28515
  renderStatus = true;
28663
28516
  if (this.configuration.showTextBox) {
28664
- const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
28665
- if (!options.visibility) {
28666
- data.handles.textBox = {
28667
- hasMoved: false,
28668
- worldPosition: [0, 0, 0],
28669
- worldBoundingBox: {
28670
- topLeft: [0, 0, 0],
28671
- topRight: [0, 0, 0],
28672
- bottomLeft: [0, 0, 0],
28673
- bottomRight: [0, 0, 0],
28674
- },
28675
- };
28676
- continue;
28677
- }
28678
28517
  const textLines = this.configuration.getTextLines(data, { metadata });
28679
28518
  if (!textLines || textLines.length === 0) {
28680
28519
  continue;
28681
28520
  }
28682
- let canvasTextBoxCoords;
28683
- if (!data.handles.textBox.hasMoved) {
28684
- canvasTextBoxCoords = (0,drawing.getTextBoxCoordsCanvas)(canvasCorners);
28685
- data.handles.textBox.worldPosition =
28686
- viewport.canvasToWorld(canvasTextBoxCoords);
28521
+ const linkAnchorPoints = [
28522
+ canvasCoordinates[0],
28523
+ canvasCoordinates[1],
28524
+ ];
28525
+ if (!this.renderLinkedTextBoxAnnotation({
28526
+ enabledElement,
28527
+ svgDrawingHelper,
28528
+ annotation,
28529
+ styleSpecifier,
28530
+ textLines,
28531
+ canvasCoordinates: linkAnchorPoints,
28532
+ placementPoints: canvasCorners,
28533
+ })) {
28534
+ continue;
28687
28535
  }
28688
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
28689
- const textBoxUID = '1';
28690
- const boundingBox = (0,drawingSvg.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, [canvasCoordinates[0], canvasCoordinates[1]], {}, options);
28691
- const { x: left, y: top, width, height } = boundingBox;
28692
- data.handles.textBox.worldBoundingBox = {
28693
- topLeft: viewport.canvasToWorld([left, top]),
28694
- topRight: viewport.canvasToWorld([left + width, top]),
28695
- bottomLeft: viewport.canvasToWorld([left, top + height]),
28696
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
28697
- };
28698
28536
  }
28699
28537
  }
28700
28538
  return renderStatus;
@@ -29558,7 +29396,6 @@ var segmentationColor = __webpack_require__(93733);
29558
29396
 
29559
29397
 
29560
29398
 
29561
-
29562
29399
  class SegmentBidirectionalTool extends BidirectionalTool/* default */.A {
29563
29400
  static { this.toolName = 'SegmentBidirectional'; }
29564
29401
  constructor(toolProps = {}) {
@@ -29644,41 +29481,20 @@ class SegmentBidirectionalTool extends BidirectionalTool/* default */.A {
29644
29481
  shadow,
29645
29482
  }, dataId2);
29646
29483
  renderStatus = true;
29647
- const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
29648
- if (!options.visibility) {
29649
- data.handles.textBox = {
29650
- hasMoved: false,
29651
- worldPosition: [0, 0, 0],
29652
- worldBoundingBox: {
29653
- topLeft: [0, 0, 0],
29654
- topRight: [0, 0, 0],
29655
- bottomLeft: [0, 0, 0],
29656
- bottomRight: [0, 0, 0],
29657
- },
29658
- };
29659
- continue;
29660
- }
29661
- options.color = color;
29662
29484
  const textLines = this.configuration.getTextLines(data, targetId);
29663
29485
  if (!textLines || textLines.length === 0) {
29664
29486
  continue;
29665
29487
  }
29666
- let canvasTextBoxCoords;
29667
- if (!data.handles.textBox.hasMoved) {
29668
- canvasTextBoxCoords = (0,drawing.getTextBoxCoordsCanvas)(canvasCoordinates);
29669
- data.handles.textBox.worldPosition =
29670
- viewport.canvasToWorld(canvasTextBoxCoords);
29488
+ if (!this.renderLinkedTextBoxAnnotation({
29489
+ enabledElement,
29490
+ svgDrawingHelper,
29491
+ annotation,
29492
+ styleSpecifier,
29493
+ textLines,
29494
+ canvasCoordinates,
29495
+ })) {
29496
+ continue;
29671
29497
  }
29672
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
29673
- const textBoxUID = '1';
29674
- const boundingBox = (0,drawingSvg.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
29675
- const { x: left, y: top, width, height } = boundingBox;
29676
- data.handles.textBox.worldBoundingBox = {
29677
- topLeft: viewport.canvasToWorld([left, top]),
29678
- topRight: viewport.canvasToWorld([left + width, top]),
29679
- bottomLeft: viewport.canvasToWorld([left, top + height]),
29680
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
29681
- };
29682
29498
  }
29683
29499
  return renderStatus;
29684
29500
  };
@@ -31527,10 +31343,16 @@ function clearUntouched(svgLayerElement, canvasHash) {
31527
31343
  }
31528
31344
  /* harmony default export */ const drawingSvg_getSvgDrawingHelper = (getSvgDrawingHelper);
31529
31345
 
31346
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/drawing/textBoxOverlapRegistry.js
31347
+ var textBoxOverlapRegistry = __webpack_require__(49773);
31530
31348
  ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/draw.js
31531
31349
 
31350
+
31532
31351
  function draw(element, fn) {
31533
31352
  const svgDrawingHelper = drawingSvg_getSvgDrawingHelper(element);
31353
+ if (svgDrawingHelper.svgLayerElement) {
31354
+ (0,textBoxOverlapRegistry/* clearTextBoxRegistry */.F4)(svgDrawingHelper.svgLayerElement);
31355
+ }
31534
31356
  fn(svgDrawingHelper);
31535
31357
  svgDrawingHelper.clearUntouched();
31536
31358
  }
@@ -31672,70 +31494,6 @@ function drawHandles(svgDrawingHelper, annotationUID, handleGroupUID, handlePoin
31672
31494
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (drawHandles);
31673
31495
 
31674
31496
 
31675
- /***/ },
31676
-
31677
- /***/ 1595
31678
- (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31679
-
31680
- "use strict";
31681
-
31682
- // EXPORTS
31683
- __webpack_require__.d(__webpack_exports__, {
31684
- A: () => (/* binding */ drawingSvg_drawLinkedTextBox)
31685
- });
31686
-
31687
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/drawTextBox.js
31688
- var drawTextBox = __webpack_require__(26290);
31689
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/drawLine.js
31690
- var drawLine = __webpack_require__(92118);
31691
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/vec2/findClosestPoint.js
31692
- var findClosestPoint = __webpack_require__(90554);
31693
- ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/drawLink.js
31694
-
31695
-
31696
- function drawLink(svgDrawingHelper, annotationUID, linkUID, annotationAnchorPoints, refPoint, boundingBox, options = {}) {
31697
- const start = annotationAnchorPoints.length > 0
31698
- ? (0,findClosestPoint/* default */.A)(annotationAnchorPoints, refPoint)
31699
- : refPoint;
31700
- const boundingBoxPoints = _boundingBoxPoints(boundingBox);
31701
- const end = (0,findClosestPoint/* default */.A)(boundingBoxPoints, start);
31702
- const mergedOptions = Object.assign({
31703
- color: 'rgb(255, 255, 0)',
31704
- lineWidth: '1',
31705
- lineDash: '2,3',
31706
- }, options);
31707
- (0,drawLine/* default */.A)(svgDrawingHelper, annotationUID, `link-${linkUID}`, start, end, mergedOptions);
31708
- }
31709
- function _boundingBoxPoints(boundingBox) {
31710
- const { x: left, y: top, height, width } = boundingBox;
31711
- const halfWidth = width / 2;
31712
- const halfHeight = height / 2;
31713
- const topMiddle = [left + halfWidth, top];
31714
- const leftMiddle = [left, top + halfHeight];
31715
- const bottomMiddle = [left + halfWidth, top + height];
31716
- const rightMiddle = [left + width, top + halfHeight];
31717
- return [topMiddle, leftMiddle, bottomMiddle, rightMiddle];
31718
- }
31719
- /* harmony default export */ const drawingSvg_drawLink = (drawLink);
31720
-
31721
- ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/drawLinkedTextBox.js
31722
-
31723
-
31724
- function drawLinkedTextBox(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, annotationAnchorPoints, textBox, options = {}) {
31725
- const mergedOptions = Object.assign({
31726
- handleRadius: '6',
31727
- centering: {
31728
- x: false,
31729
- y: true,
31730
- },
31731
- }, options);
31732
- const canvasBoundingBox = (0,drawTextBox/* default */.A)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, mergedOptions);
31733
- drawingSvg_drawLink(svgDrawingHelper, annotationUID, textBoxUID, annotationAnchorPoints, textBoxPosition, canvasBoundingBox, mergedOptions);
31734
- return canvasBoundingBox;
31735
- }
31736
- /* harmony default export */ const drawingSvg_drawLinkedTextBox = (drawLinkedTextBox);
31737
-
31738
-
31739
31497
  /***/ },
31740
31498
 
31741
31499
  /***/ 97530
@@ -35394,11 +35152,9 @@ function resetSvgNodeCache() {
35394
35152
  /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(29857);
35395
35153
  /* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(60810);
35396
35154
  /* harmony import */ var _utilities_math_line__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(93258);
35397
- /* harmony import */ var _utilities_drawing__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(473);
35398
- /* harmony import */ var _cursors_elementCursor__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(7001);
35399
- /* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(58640);
35400
- /* harmony import */ var _stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(76712);
35401
-
35155
+ /* harmony import */ var _cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(7001);
35156
+ /* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(58640);
35157
+ /* harmony import */ var _stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(76712);
35402
35158
 
35403
35159
 
35404
35160
 
@@ -35479,8 +35235,8 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
35479
35235
  this._activateModify(element);
35480
35236
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
35481
35237
  const { renderingEngine } = enabledElement;
35482
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewportIdsToRender);
35483
- (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_15__.hideElementCursor)(element);
35238
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
35239
+ (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.hideElementCursor)(element);
35484
35240
  evt.preventDefault();
35485
35241
  };
35486
35242
  this.handleSelectedCallback = (evt, annotation, handle) => {
@@ -35497,7 +35253,7 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
35497
35253
  handleIndex = data.handles.points.findIndex((p) => p === handle);
35498
35254
  }
35499
35255
  const viewportIdsToRender = (0,_utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_12__.getViewportIdsWithToolToRender)(element, this.getToolName());
35500
- (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_15__.hideElementCursor)(element);
35256
+ (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.hideElementCursor)(element);
35501
35257
  this.editData = {
35502
35258
  annotation,
35503
35259
  viewportIdsToRender,
@@ -35507,7 +35263,7 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
35507
35263
  this._activateModify(element);
35508
35264
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
35509
35265
  const { renderingEngine } = enabledElement;
35510
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewportIdsToRender);
35266
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
35511
35267
  evt.preventDefault();
35512
35268
  };
35513
35269
  this._endCallback = (evt) => {
@@ -35522,7 +35278,7 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
35522
35278
  data.handles.activeHandleIndex = null;
35523
35279
  this._deactivateModify(element);
35524
35280
  this._deactivateDraw(element);
35525
- (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_15__.resetElementCursor)(element);
35281
+ (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.resetElementCursor)(element);
35526
35282
  const { renderingEngine } = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
35527
35283
  if (this.editData.handleIndex !== undefined) {
35528
35284
  const { points } = data.handles;
@@ -35557,7 +35313,7 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
35557
35313
  this.configuration.preventHandleOutsideImage) {
35558
35314
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.removeAnnotation)(annotation.annotationUID);
35559
35315
  }
35560
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewportIdsToRender);
35316
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
35561
35317
  if (newAnnotation) {
35562
35318
  (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_8__.triggerAnnotationCompleted)(annotation);
35563
35319
  }
@@ -35619,7 +35375,7 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
35619
35375
  data.handles.points[2] = viewport.canvasToWorld([startX, startY]);
35620
35376
  data.handles.points[3] = viewport.canvasToWorld([endX, endY]);
35621
35377
  annotation.invalidated = true;
35622
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewportIdsToRender);
35378
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
35623
35379
  (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_8__.triggerAnnotationModified)(annotation, element, _enums__WEBPACK_IMPORTED_MODULE_11__.ChangeTypes.HandlesUpdated);
35624
35380
  this.editData.hasMoved = true;
35625
35381
  };
@@ -35655,7 +35411,7 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
35655
35411
  this._dragModifyHandle(evt);
35656
35412
  annotation.invalidated = true;
35657
35413
  }
35658
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewportIdsToRender);
35414
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
35659
35415
  if (annotation.invalidated) {
35660
35416
  (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_8__.triggerAnnotationModified)(annotation, element, _enums__WEBPACK_IMPORTED_MODULE_11__.ChangeTypes.HandlesUpdated);
35661
35417
  }
@@ -35810,12 +35566,12 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
35810
35566
  this.isDrawing = false;
35811
35567
  this._deactivateDraw(element);
35812
35568
  this._deactivateModify(element);
35813
- (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_15__.resetElementCursor)(element);
35569
+ (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.resetElementCursor)(element);
35814
35570
  const { annotation, viewportIdsToRender, newAnnotation } = this.editData;
35815
35571
  const { data } = annotation;
35816
35572
  annotation.highlighted = false;
35817
35573
  data.handles.activeHandleIndex = null;
35818
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewportIdsToRender);
35574
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
35819
35575
  if (newAnnotation) {
35820
35576
  (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_8__.triggerAnnotationCompleted)(annotation);
35821
35577
  }
@@ -35915,7 +35671,7 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
35915
35671
  activeHandleIndex !== null) {
35916
35672
  activeHandleCanvasCoords = [canvasCoordinates[activeHandleIndex]];
35917
35673
  }
35918
- const showHandlesAlways = Boolean((0,_stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_17__/* .getStyleProperty */ .h)('showHandlesAlways', {}));
35674
+ const showHandlesAlways = Boolean((0,_stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_16__/* .getStyleProperty */ .h)('showHandlesAlways', {}));
35919
35675
  if (activeHandleCanvasCoords || showHandlesAlways) {
35920
35676
  const handleGroupUID = '0';
35921
35677
  (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_9__.drawHandles)(svgDrawingHelper, annotationUID, handleGroupUID, showHandlesAlways ? canvasCoordinates : activeHandleCanvasCoords, {
@@ -35939,40 +35695,20 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
35939
35695
  shadow,
35940
35696
  }, dataId2);
35941
35697
  renderStatus = true;
35942
- const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
35943
- if (!options.visibility) {
35944
- data.handles.textBox = {
35945
- hasMoved: false,
35946
- worldPosition: [0, 0, 0],
35947
- worldBoundingBox: {
35948
- topLeft: [0, 0, 0],
35949
- topRight: [0, 0, 0],
35950
- bottomLeft: [0, 0, 0],
35951
- bottomRight: [0, 0, 0],
35952
- },
35953
- };
35954
- continue;
35955
- }
35956
35698
  const textLines = this.configuration.getTextLines(data, targetId);
35957
35699
  if (!textLines || textLines.length === 0) {
35958
35700
  continue;
35959
35701
  }
35960
- let canvasTextBoxCoords;
35961
- if (!data.handles.textBox.hasMoved) {
35962
- canvasTextBoxCoords = (0,_utilities_drawing__WEBPACK_IMPORTED_MODULE_14__.getTextBoxCoordsCanvas)(canvasCoordinates);
35963
- data.handles.textBox.worldPosition =
35964
- viewport.canvasToWorld(canvasTextBoxCoords);
35702
+ if (!this.renderLinkedTextBoxAnnotation({
35703
+ enabledElement,
35704
+ svgDrawingHelper,
35705
+ annotation,
35706
+ styleSpecifier,
35707
+ textLines,
35708
+ canvasCoordinates,
35709
+ })) {
35710
+ continue;
35965
35711
  }
35966
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
35967
- const textBoxUID = '1';
35968
- const boundingBox = (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_9__.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
35969
- const { x: left, y: top, width, height } = boundingBox;
35970
- data.handles.textBox.worldBoundingBox = {
35971
- topLeft: viewport.canvasToWorld([left, top]),
35972
- topRight: viewport.canvasToWorld([left + width, top]),
35973
- bottomLeft: viewport.canvasToWorld([left, top + height]),
35974
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
35975
- };
35976
35712
  }
35977
35713
  return renderStatus;
35978
35714
  };
@@ -36076,9 +35812,9 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
36076
35812
  hasMoved: false,
36077
35813
  };
36078
35814
  this._activateDraw(element);
36079
- (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_15__.hideElementCursor)(element);
35815
+ (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.hideElementCursor)(element);
36080
35816
  evt.preventDefault();
36081
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewportIdsToRender);
35817
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
36082
35818
  return annotation;
36083
35819
  }
36084
35820
  static { this.hydrate = (viewportId, axis, options) => {
@@ -36125,7 +35861,7 @@ class BidirectionalTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .Annotation
36125
35861
  },
36126
35862
  };
36127
35863
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.addAnnotation)(annotation, viewport.element);
36128
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)([viewport.id]);
35864
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)([viewport.id]);
36129
35865
  return annotation;
36130
35866
  }; }
36131
35867
  }
@@ -36206,7 +35942,7 @@ class PlanarFreehandContourSegmentationTool extends _PlanarFreehandROITool__WEBP
36206
35942
  /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
36207
35943
  /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3823);
36208
35944
  /* harmony import */ var _utilities_getCalibratedUnits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4096);
36209
- /* harmony import */ var _utilities_math__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(85895);
35945
+ /* harmony import */ var _utilities_math__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(18153);
36210
35946
  /* harmony import */ var _utilities_planar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13165);
36211
35947
  /* harmony import */ var _utilities_throttle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(27730);
36212
35948
  /* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(60810);
@@ -36218,16 +35954,12 @@ class PlanarFreehandContourSegmentationTool extends _PlanarFreehandROITool__WEBP
36218
35954
  /* harmony import */ var _planarFreehandROITool_openContourEndEditLoop__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(70734);
36219
35955
  /* harmony import */ var _planarFreehandROITool_renderMethods__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(58161);
36220
35956
  /* harmony import */ var _stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(44049);
36221
- /* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(74347);
36222
- /* harmony import */ var _utilities_drawing__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(473);
36223
- /* harmony import */ var _utilities_math_polyline__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(92984);
36224
- /* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(18990);
36225
- /* harmony import */ var _utilities_math_basic__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(73262);
36226
- /* harmony import */ var _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(36320);
36227
- /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(29857);
36228
- /* harmony import */ var _utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(40634);
36229
-
36230
-
35957
+ /* harmony import */ var _utilities_math_polyline__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(92984);
35958
+ /* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(18990);
35959
+ /* harmony import */ var _utilities_math_basic__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(73262);
35960
+ /* harmony import */ var _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(36320);
35961
+ /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(29857);
35962
+ /* harmony import */ var _utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(40634);
36231
35963
 
36232
35964
 
36233
35965
 
@@ -36253,7 +35985,7 @@ class PlanarFreehandContourSegmentationTool extends _PlanarFreehandROITool__WEBP
36253
35985
  const { pointCanProjectOnLine } = _utilities_math__WEBPACK_IMPORTED_MODULE_3__.polyline;
36254
35986
  const { EPSILON } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.CONSTANTS;
36255
35987
  const PARALLEL_THRESHOLD = 1 - EPSILON;
36256
- class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_20__/* ["default"] */ .A {
35988
+ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .A {
36257
35989
  static { this.toolName = 'PlanarFreehandROI'; }
36258
35990
  constructor(toolProps = {}, defaultToolProps = {
36259
35991
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -36261,7 +35993,7 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
36261
35993
  storePointData: false,
36262
35994
  shadow: true,
36263
35995
  preventHandleOutsideImage: false,
36264
- contourHoleAdditionModifierKey: _enums__WEBPACK_IMPORTED_MODULE_21__.KeyboardBindings.Shift,
35996
+ contourHoleAdditionModifierKey: _enums__WEBPACK_IMPORTED_MODULE_19__.KeyboardBindings.Shift,
36265
35997
  alwaysRenderOpenContourHandles: {
36266
35998
  enabled: false,
36267
35999
  radius: 2,
@@ -36288,7 +36020,7 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
36288
36020
  displayOnePointAsCrosshairs: false,
36289
36021
  calculateStats: true,
36290
36022
  getTextLines: defaultGetTextLines,
36291
- statsCalculator: _utilities_math_basic__WEBPACK_IMPORTED_MODULE_19__.BasicStatsCalculator,
36023
+ statsCalculator: _utilities_math_basic__WEBPACK_IMPORTED_MODULE_17__.BasicStatsCalculator,
36292
36024
  },
36293
36025
  }) {
36294
36026
  super(toolProps, defaultToolProps);
@@ -36373,10 +36105,10 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
36373
36105
  const { imageData, metadata } = image;
36374
36106
  const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
36375
36107
  const modalityUnitOptions = {
36376
- isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_18__/* .isViewportPreScaled */ .u)(viewport, targetId),
36108
+ isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_16__/* .isViewportPreScaled */ .u)(viewport, targetId),
36377
36109
  isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
36378
36110
  };
36379
- const modalityUnit = (0,_utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_22__/* .getPixelValueUnits */ .j)(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
36111
+ const modalityUnit = (0,_utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_20__/* .getPixelValueUnits */ .j)(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
36380
36112
  const polyline = data.contour.polyline;
36381
36113
  const numPoints = polyline.length;
36382
36114
  const projectedPolyline = new Array(numPoints);
@@ -36428,7 +36160,7 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
36428
36160
  const invalidated = annotation.invalidated;
36429
36161
  annotation.invalidated = false;
36430
36162
  if (invalidated) {
36431
- (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_14__.triggerAnnotationModified)(annotation, enabledElement.viewport.element, _enums__WEBPACK_IMPORTED_MODULE_21__.ChangeTypes.StatsUpdated);
36163
+ (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_14__.triggerAnnotationModified)(annotation, enabledElement.viewport.element, _enums__WEBPACK_IMPORTED_MODULE_19__.ChangeTypes.StatsUpdated);
36432
36164
  }
36433
36165
  return cachedStats;
36434
36166
  };
@@ -36441,30 +36173,19 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
36441
36173
  viewportId: enabledElement.viewport.id,
36442
36174
  annotationUID: annotation.annotationUID,
36443
36175
  };
36444
- const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
36445
- if (!options.visibility) {
36446
- return;
36447
- }
36448
36176
  const textLines = this.configuration.getTextLines(data, targetId);
36449
36177
  if (!textLines || textLines.length === 0) {
36450
36178
  return;
36451
36179
  }
36452
36180
  const canvasCoordinates = data.contour.polyline.map((p) => viewport.worldToCanvas(p));
36453
- if (!data.handles.textBox.hasMoved) {
36454
- const canvasTextBoxCoords = (0,_utilities_drawing__WEBPACK_IMPORTED_MODULE_16__.getTextBoxCoordsCanvas)(canvasCoordinates);
36455
- data.handles.textBox.worldPosition =
36456
- viewport.canvasToWorld(canvasTextBoxCoords);
36457
- }
36458
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
36459
- const textBoxUID = '1';
36460
- const boundingBox = (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_15__.drawLinkedTextBox)(svgDrawingHelper, annotation.annotationUID ?? '', textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
36461
- const { x: left, y: top, width, height } = boundingBox;
36462
- data.handles.textBox.worldBoundingBox = {
36463
- topLeft: viewport.canvasToWorld([left, top]),
36464
- topRight: viewport.canvasToWorld([left + width, top]),
36465
- bottomLeft: viewport.canvasToWorld([left, top + height]),
36466
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
36467
- };
36181
+ this.renderLinkedTextBoxAnnotation({
36182
+ enabledElement,
36183
+ svgDrawingHelper,
36184
+ annotation,
36185
+ styleSpecifier,
36186
+ textLines,
36187
+ canvasCoordinates,
36188
+ });
36468
36189
  };
36469
36190
  (0,_planarFreehandROITool_drawLoop__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .A)(this);
36470
36191
  (0,_planarFreehandROITool_editLoopCommon__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A)(this);
@@ -36700,7 +36421,7 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
36700
36421
  if (point[1] != curRow) {
36701
36422
  intersectionCounter = 0;
36702
36423
  curRow = point[1];
36703
- intersections = (0,_utilities_math_polyline__WEBPACK_IMPORTED_MODULE_17__.getLineSegmentIntersectionsCoordinates)(canvasCoordinates, point, [canvasPosEnd[0], point[1]]);
36424
+ intersections = (0,_utilities_math_polyline__WEBPACK_IMPORTED_MODULE_15__.getLineSegmentIntersectionsCoordinates)(canvasCoordinates, point, [canvasPosEnd[0], point[1]]);
36704
36425
  intersections.sort((function (index) {
36705
36426
  return function (a, b) {
36706
36427
  return a[index] === b[index]
@@ -36729,13 +36450,13 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
36729
36450
  name: 'area',
36730
36451
  value: area,
36731
36452
  unit: areaUnit,
36732
- type: _enums__WEBPACK_IMPORTED_MODULE_21__.MeasurementType.Area,
36453
+ type: _enums__WEBPACK_IMPORTED_MODULE_19__.MeasurementType.Area,
36733
36454
  };
36734
36455
  const namedPerimeter = {
36735
36456
  name: 'perimeter',
36736
36457
  value: perimeter,
36737
36458
  unit,
36738
- type: _enums__WEBPACK_IMPORTED_MODULE_21__.MeasurementType.Linear,
36459
+ type: _enums__WEBPACK_IMPORTED_MODULE_19__.MeasurementType.Linear,
36739
36460
  };
36740
36461
  cachedStats[targetId] = {
36741
36462
  Modality: metadata.Modality,
@@ -36760,7 +36481,7 @@ class PlanarFreehandROITool extends _base_ContourSegmentationBaseTool__WEBPACK_I
36760
36481
  name: 'length',
36761
36482
  value: length,
36762
36483
  unit,
36763
- type: _enums__WEBPACK_IMPORTED_MODULE_21__.MeasurementType.Linear,
36484
+ type: _enums__WEBPACK_IMPORTED_MODULE_19__.MeasurementType.Linear,
36764
36485
  };
36765
36486
  cachedStats[targetId] = {
36766
36487
  Modality: metadata.Modality,
@@ -36827,14 +36548,12 @@ function defaultGetTextLines(data, targetId) {
36827
36548
  /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(29857);
36828
36549
  /* harmony import */ var _utilities_viewportFilters__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(60810);
36829
36550
  /* harmony import */ var _utilities_math_rectangle__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(33657);
36830
- /* harmony import */ var _utilities_drawing__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(473);
36831
- /* harmony import */ var _cursors_elementCursor__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(7001);
36832
- /* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(58640);
36833
- /* harmony import */ var _utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(40634);
36834
- /* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(18990);
36835
- /* harmony import */ var _utilities_math_basic__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(73262);
36836
- /* harmony import */ var _stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(76712);
36837
-
36551
+ /* harmony import */ var _cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(7001);
36552
+ /* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(58640);
36553
+ /* harmony import */ var _utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(40634);
36554
+ /* harmony import */ var _utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(18990);
36555
+ /* harmony import */ var _utilities_math_basic__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(73262);
36556
+ /* harmony import */ var _stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(76712);
36838
36557
 
36839
36558
 
36840
36559
 
@@ -36866,7 +36585,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
36866
36585
  preventHandleOutsideImage: false,
36867
36586
  calculateStats: true,
36868
36587
  getTextLines: defaultGetTextLines,
36869
- statsCalculator: _utilities_math_basic__WEBPACK_IMPORTED_MODULE_19__.BasicStatsCalculator,
36588
+ statsCalculator: _utilities_math_basic__WEBPACK_IMPORTED_MODULE_18__.BasicStatsCalculator,
36870
36589
  },
36871
36590
  }) {
36872
36591
  super(toolProps, defaultToolProps);
@@ -36911,9 +36630,9 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
36911
36630
  hasMoved: false,
36912
36631
  };
36913
36632
  this._activateDraw(element);
36914
- (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_15__.hideElementCursor)(element);
36633
+ (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.hideElementCursor)(element);
36915
36634
  evt.preventDefault();
36916
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewportIdsToRender);
36635
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
36917
36636
  return annotation;
36918
36637
  };
36919
36638
  this.isPointNearTool = (element, annotation, canvasCoords, proximity) => {
@@ -36946,10 +36665,10 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
36946
36665
  movingTextBox: false,
36947
36666
  };
36948
36667
  this._activateModify(element);
36949
- (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_15__.hideElementCursor)(element);
36668
+ (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.hideElementCursor)(element);
36950
36669
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
36951
36670
  const { renderingEngine } = enabledElement;
36952
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewportIdsToRender);
36671
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
36953
36672
  evt.preventDefault();
36954
36673
  };
36955
36674
  this.handleSelectedCallback = (evt, annotation, handle) => {
@@ -36973,10 +36692,10 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
36973
36692
  movingTextBox,
36974
36693
  };
36975
36694
  this._activateModify(element);
36976
- (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_15__.hideElementCursor)(element);
36695
+ (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.hideElementCursor)(element);
36977
36696
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
36978
36697
  const { renderingEngine } = enabledElement;
36979
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewportIdsToRender);
36698
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
36980
36699
  evt.preventDefault();
36981
36700
  };
36982
36701
  this._endCallback = (evt) => {
@@ -36990,7 +36709,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
36990
36709
  data.handles.activeHandleIndex = null;
36991
36710
  this._deactivateModify(element);
36992
36711
  this._deactivateDraw(element);
36993
- (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_15__.resetElementCursor)(element);
36712
+ (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.resetElementCursor)(element);
36994
36713
  this.doneEditMemo();
36995
36714
  this.editData = null;
36996
36715
  this.isDrawing = false;
@@ -36998,7 +36717,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
36998
36717
  this.configuration.preventHandleOutsideImage) {
36999
36718
  (0,_stateManagement__WEBPACK_IMPORTED_MODULE_5__/* .removeAnnotation */ .O8)(annotation.annotationUID);
37000
36719
  }
37001
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewportIdsToRender);
36720
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
37002
36721
  if (newAnnotation) {
37003
36722
  (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_8__.triggerAnnotationCompleted)(annotation);
37004
36723
  }
@@ -37080,7 +36799,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
37080
36799
  }
37081
36800
  this.editData.hasMoved = true;
37082
36801
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElement)(element);
37083
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewportIdsToRender);
36802
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
37084
36803
  if (annotation.invalidated) {
37085
36804
  (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_8__.triggerAnnotationModified)(annotation, element, _enums__WEBPACK_IMPORTED_MODULE_11__.ChangeTypes.HandlesUpdated);
37086
36805
  }
@@ -37090,12 +36809,12 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
37090
36809
  this.isDrawing = false;
37091
36810
  this._deactivateDraw(element);
37092
36811
  this._deactivateModify(element);
37093
- (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_15__.resetElementCursor)(element);
36812
+ (0,_cursors_elementCursor__WEBPACK_IMPORTED_MODULE_14__.resetElementCursor)(element);
37094
36813
  const { annotation, viewportIdsToRender, newAnnotation } = this.editData;
37095
36814
  const { data } = annotation;
37096
36815
  annotation.highlighted = false;
37097
36816
  data.handles.activeHandleIndex = null;
37098
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)(viewportIdsToRender);
36817
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportIdsToRender);
37099
36818
  if (newAnnotation) {
37100
36819
  (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_8__.triggerAnnotationCompleted)(annotation);
37101
36820
  }
@@ -37217,7 +36936,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
37217
36936
  activeHandleIndex !== undefined) {
37218
36937
  activeHandleCanvasCoords = [canvasCoordinates[activeHandleIndex]];
37219
36938
  }
37220
- const showHandlesAlways = Boolean((0,_stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_20__/* .getStyleProperty */ .h)('showHandlesAlways', {}));
36939
+ const showHandlesAlways = Boolean((0,_stateManagement_annotation_config_helpers__WEBPACK_IMPORTED_MODULE_19__/* .getStyleProperty */ .h)('showHandlesAlways', {}));
37221
36940
  if (activeHandleCanvasCoords || showHandlesAlways) {
37222
36941
  const handleGroupUID = '0';
37223
36942
  (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_9__.drawHandles)(svgDrawingHelper, annotationUID, handleGroupUID, showHandlesAlways ? canvasCoordinates : activeHandleCanvasCoords, {
@@ -37232,39 +36951,20 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
37232
36951
  lineWidth,
37233
36952
  }, dataId);
37234
36953
  renderStatus = true;
37235
- const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
37236
- if (!options.visibility) {
37237
- data.handles.textBox = {
37238
- hasMoved: false,
37239
- worldPosition: [0, 0, 0],
37240
- worldBoundingBox: {
37241
- topLeft: [0, 0, 0],
37242
- topRight: [0, 0, 0],
37243
- bottomLeft: [0, 0, 0],
37244
- bottomRight: [0, 0, 0],
37245
- },
37246
- };
37247
- continue;
37248
- }
37249
36954
  const textLines = this.configuration.getTextLines(data, targetId);
37250
36955
  if (!textLines || textLines.length === 0) {
37251
36956
  continue;
37252
36957
  }
37253
- if (!data.handles.textBox.hasMoved) {
37254
- const canvasTextBoxCoords = (0,_utilities_drawing__WEBPACK_IMPORTED_MODULE_14__.getTextBoxCoordsCanvas)(canvasCoordinates);
37255
- data.handles.textBox.worldPosition =
37256
- viewport.canvasToWorld(canvasTextBoxCoords);
36958
+ if (!this.renderLinkedTextBoxAnnotation({
36959
+ enabledElement,
36960
+ svgDrawingHelper,
36961
+ annotation,
36962
+ styleSpecifier,
36963
+ textLines,
36964
+ canvasCoordinates,
36965
+ })) {
36966
+ continue;
37257
36967
  }
37258
- const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
37259
- const textBoxUID = '1';
37260
- const boundingBox = (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_9__.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, options);
37261
- const { x: left, y: top, width, height } = boundingBox;
37262
- data.handles.textBox.worldBoundingBox = {
37263
- topLeft: viewport.canvasToWorld([left, top]),
37264
- topRight: viewport.canvasToWorld([left + width, top]),
37265
- bottomLeft: viewport.canvasToWorld([left, top + height]),
37266
- bottomRight: viewport.canvasToWorld([left + width, top + height]),
37267
- };
37268
36968
  }
37269
36969
  return renderStatus;
37270
36970
  };
@@ -37317,10 +37017,10 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
37317
37017
  const area = Math.abs(width * height);
37318
37018
  const { areaUnit } = calibrate;
37319
37019
  const pixelUnitsOptions = {
37320
- isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_18__/* .isViewportPreScaled */ .u)(viewport, targetId),
37020
+ isPreScaled: (0,_utilities_viewport_isViewportPreScaled__WEBPACK_IMPORTED_MODULE_17__/* .isViewportPreScaled */ .u)(viewport, targetId),
37321
37021
  isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
37322
37022
  };
37323
- const modalityUnit = (0,_utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_17__/* .getPixelValueUnits */ .j)(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
37023
+ const modalityUnit = (0,_utilities_getPixelValueUnits__WEBPACK_IMPORTED_MODULE_16__/* .getPixelValueUnits */ .j)(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
37324
37024
  let pointsInShape;
37325
37025
  if (voxelManager) {
37326
37026
  pointsInShape = voxelManager.forEach(this.configuration.statsCalculator.statsCallback, {
@@ -37394,7 +37094,7 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
37394
37094
  },
37395
37095
  };
37396
37096
  (0,_stateManagement__WEBPACK_IMPORTED_MODULE_5__/* .addAnnotation */ .lC)(annotation, viewport.element);
37397
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)([viewport.id]);
37097
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)([viewport.id]);
37398
37098
  }; }
37399
37099
  }
37400
37100
  function defaultGetTextLines(data, targetId) {
@@ -37440,10 +37140,14 @@ function defaultGetTextLines(data, targetId) {
37440
37140
  /* harmony import */ var _stateManagement_annotation_annotationVisibility__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29601);
37441
37141
  /* harmony import */ var _stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(82056);
37442
37142
  /* harmony import */ var _stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(44049);
37443
- /* harmony import */ var _enums_ChangeTypes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(75183);
37444
- /* harmony import */ var _stateManagement_annotation_annotationSelection__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(17343);
37445
- /* harmony import */ var _utilities_contourSegmentation__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(56534);
37446
- /* harmony import */ var _utilities_safeStructuredClone__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(33459);
37143
+ /* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(74347);
37144
+ /* harmony import */ var _utilities_drawing__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(473);
37145
+ /* harmony import */ var _enums_ChangeTypes__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(75183);
37146
+ /* harmony import */ var _stateManagement_annotation_annotationSelection__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(17343);
37147
+ /* harmony import */ var _utilities_contourSegmentation__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(56534);
37148
+ /* harmony import */ var _utilities_safeStructuredClone__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(33459);
37149
+
37150
+
37447
37151
 
37448
37152
 
37449
37153
 
@@ -37558,6 +37262,54 @@ class AnnotationTool extends _AnnotationDisplayTool__WEBPACK_IMPORTED_MODULE_2__
37558
37262
  textBoxLinkLineColor: this.getStyle('textBoxLinkLineColor', specifications, annotation),
37559
37263
  };
37560
37264
  }
37265
+ renderLinkedTextBoxAnnotation(options) {
37266
+ const { enabledElement, svgDrawingHelper, annotation, styleSpecifier, textLines, canvasCoordinates, textBoxUID = '1', placementPoints, } = options;
37267
+ const { viewport } = enabledElement;
37268
+ const { element } = viewport;
37269
+ const { annotationUID, data } = annotation;
37270
+ const styleOptions = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
37271
+ if (!styleOptions.visibility) {
37272
+ data.handles.textBox = {
37273
+ hasMoved: false,
37274
+ worldPosition: [0, 0, 0],
37275
+ worldBoundingBox: {
37276
+ topLeft: [0, 0, 0],
37277
+ topRight: [0, 0, 0],
37278
+ bottomLeft: [0, 0, 0],
37279
+ bottomRight: [0, 0, 0],
37280
+ },
37281
+ };
37282
+ return false;
37283
+ }
37284
+ if (!data.handles.textBox) {
37285
+ data.handles.textBox = {
37286
+ hasMoved: false,
37287
+ worldPosition: [0, 0, 0],
37288
+ worldBoundingBox: {
37289
+ topLeft: [0, 0, 0],
37290
+ topRight: [0, 0, 0],
37291
+ bottomLeft: [0, 0, 0],
37292
+ bottomRight: [0, 0, 0],
37293
+ },
37294
+ };
37295
+ }
37296
+ const pointsForPlacement = placementPoints ?? canvasCoordinates;
37297
+ if (!data.handles.textBox.hasMoved) {
37298
+ const canvasTextBoxCoords = (0,_utilities_drawing__WEBPACK_IMPORTED_MODULE_8__.getTextBoxCoordsCanvas)(pointsForPlacement, element, textLines);
37299
+ data.handles.textBox.worldPosition =
37300
+ viewport.canvasToWorld(canvasTextBoxCoords);
37301
+ }
37302
+ const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
37303
+ const boundingBox = (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_7__.drawLinkedTextBox)(svgDrawingHelper, annotationUID, textBoxUID, textLines, textBoxPosition, canvasCoordinates, {}, styleOptions);
37304
+ const { x: left, y: top, width, height } = boundingBox;
37305
+ data.handles.textBox.worldBoundingBox = {
37306
+ topLeft: viewport.canvasToWorld([left, top]),
37307
+ topRight: viewport.canvasToWorld([left + width, top]),
37308
+ bottomLeft: viewport.canvasToWorld([left, top + height]),
37309
+ bottomRight: viewport.canvasToWorld([left + width, top + height]),
37310
+ };
37311
+ return true;
37312
+ }
37561
37313
  static isSuvScaled(viewport, targetId, imageId) {
37562
37314
  if (viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.BaseVolumeViewport) {
37563
37315
  const volumeId = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.getVolumeId(targetId);
@@ -37609,7 +37361,7 @@ class AnnotationTool extends _AnnotationDisplayTool__WEBPACK_IMPORTED_MODULE_2__
37609
37361
  const { data, annotationUID } = annotation;
37610
37362
  return {
37611
37363
  annotationUID,
37612
- data: (0,_utilities_safeStructuredClone__WEBPACK_IMPORTED_MODULE_10__/* .safeStructuredClone */ .W)(data),
37364
+ data: (0,_utilities_safeStructuredClone__WEBPACK_IMPORTED_MODULE_12__/* .safeStructuredClone */ .W)(data),
37613
37365
  deleting,
37614
37366
  };
37615
37367
  }
@@ -37633,19 +37385,19 @@ class AnnotationTool extends _AnnotationDisplayTool__WEBPACK_IMPORTED_MODULE_2__
37633
37385
  annotationData.contour.polyline = state.data.contour.pointsManager.points;
37634
37386
  delete state.data.contour.pointsManager;
37635
37387
  if (annotationData.segmentation) {
37636
- (0,_utilities_contourSegmentation__WEBPACK_IMPORTED_MODULE_9__.addContourSegmentationAnnotation)(annotation);
37388
+ (0,_utilities_contourSegmentation__WEBPACK_IMPORTED_MODULE_11__.addContourSegmentationAnnotation)(annotation);
37637
37389
  }
37638
37390
  }
37639
37391
  state.data = newState.data;
37640
37392
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.addAnnotation)(annotation, element);
37641
- (0,_stateManagement_annotation_annotationSelection__WEBPACK_IMPORTED_MODULE_8__.setAnnotationSelected)(annotation.annotationUID, true);
37393
+ (0,_stateManagement_annotation_annotationSelection__WEBPACK_IMPORTED_MODULE_10__.setAnnotationSelected)(annotation.annotationUID, true);
37642
37394
  viewport?.render();
37643
37395
  return;
37644
37396
  }
37645
37397
  if (state.deleting === false) {
37646
37398
  state.deleting = true;
37647
37399
  state.data = newState.data;
37648
- (0,_stateManagement_annotation_annotationSelection__WEBPACK_IMPORTED_MODULE_8__.setAnnotationSelected)(annotation.annotationUID);
37400
+ (0,_stateManagement_annotation_annotationSelection__WEBPACK_IMPORTED_MODULE_10__.setAnnotationSelected)(annotation.annotationUID);
37649
37401
  (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.removeAnnotation)(annotation.annotationUID);
37650
37402
  viewport?.render();
37651
37403
  return;
@@ -37663,7 +37415,7 @@ class AnnotationTool extends _AnnotationDisplayTool__WEBPACK_IMPORTED_MODULE_2__
37663
37415
  state.data = newState.data;
37664
37416
  currentAnnotation.invalidated = true;
37665
37417
  if (element) {
37666
- (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_6__.triggerAnnotationModified)(currentAnnotation, element, _enums_ChangeTypes__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A.History);
37418
+ (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_6__.triggerAnnotationModified)(currentAnnotation, element, _enums_ChangeTypes__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A.History);
37667
37419
  }
37668
37420
  },
37669
37421
  id: annotationUID,
@@ -39490,19 +39242,121 @@ function debounce(func, wait, options) {
39490
39242
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
39491
39243
  /* harmony export */ A: () => (/* binding */ getTextBoxCoordsCanvas)
39492
39244
  /* harmony export */ });
39493
- function getTextBoxCoordsCanvas(annotationCanvasPoints) {
39245
+ /* harmony import */ var _textBoxOverlapRegistry__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49773);
39246
+ /* harmony import */ var _math_aabb_intersectAABB__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33277);
39247
+
39248
+
39249
+ const VIEWPORT_ELEMENT = 'viewport-element';
39250
+ const TEXT_BOX_GAP = 6;
39251
+ function getTextBoxCoordsCanvas(annotationCanvasPoints, element, textLines = []) {
39252
+ if (!annotationCanvasPoints?.length || !annotationCanvasPoints[0]) {
39253
+ return [0, 0];
39254
+ }
39494
39255
  const corners = _determineCorners(annotationCanvasPoints);
39495
39256
  const centerY = (corners.top[1] + corners.bottom[1]) / 2;
39496
- const textBoxCanvas = [corners.right[0], centerY];
39497
- return textBoxCanvas;
39257
+ const defaultTextBoxCanvas = [corners.right[0], centerY];
39258
+ if (!element) {
39259
+ return defaultTextBoxCanvas;
39260
+ }
39261
+ const { width: textBoxWidth, height: textBoxHeight } = _estimateTextBoxSize(textLines);
39262
+ const margin = 4;
39263
+ const maxX = element.clientWidth - margin;
39264
+ const maxY = element.clientHeight - margin;
39265
+ let x = corners.right[0];
39266
+ let y = centerY - textBoxHeight / 2;
39267
+ if (x + textBoxWidth > maxX) {
39268
+ x = corners.left[0] - textBoxWidth;
39269
+ }
39270
+ x = Math.max(margin, Math.min(x, maxX - textBoxWidth));
39271
+ y = Math.max(margin, Math.min(y, maxY - textBoxHeight));
39272
+ const svgLayer = _findSvgLayer(element);
39273
+ if (svgLayer) {
39274
+ const existingBoxes = (0,_textBoxOverlapRegistry__WEBPACK_IMPORTED_MODULE_0__/* .getRegisteredTextBoxes */ .Pd)(svgLayer);
39275
+ if (existingBoxes.length > 0) {
39276
+ const resolved = _resolveOverlap(x, y, textBoxWidth, textBoxHeight, existingBoxes, margin, maxX, maxY);
39277
+ x = resolved[0];
39278
+ y = resolved[1];
39279
+ }
39280
+ }
39281
+ return [x, y];
39282
+ }
39283
+ function _resolveOverlap(x, y, width, height, existingBoxes, margin, maxX, maxY) {
39284
+ if (!_overlapsAny(x, y, width, height, existingBoxes)) {
39285
+ return [x, y];
39286
+ }
39287
+ let candidateY = y;
39288
+ for (let i = 0; i < 30; i++) {
39289
+ const blocker = _findFirstOverlap(x, candidateY, width, height, existingBoxes);
39290
+ if (!blocker) {
39291
+ break;
39292
+ }
39293
+ candidateY = blocker.y + blocker.height + TEXT_BOX_GAP;
39294
+ if (candidateY + height > maxY) {
39295
+ candidateY = Infinity;
39296
+ break;
39297
+ }
39298
+ }
39299
+ if (candidateY !== Infinity &&
39300
+ !_overlapsAny(x, candidateY, width, height, existingBoxes)) {
39301
+ return [
39302
+ x,
39303
+ Math.max(margin, Math.min(candidateY, maxY - height)),
39304
+ ];
39305
+ }
39306
+ candidateY = y;
39307
+ for (let i = 0; i < 30; i++) {
39308
+ const blocker = _findFirstOverlap(x, candidateY, width, height, existingBoxes);
39309
+ if (!blocker) {
39310
+ break;
39311
+ }
39312
+ candidateY = blocker.y - height - TEXT_BOX_GAP;
39313
+ if (candidateY < margin) {
39314
+ candidateY = -Infinity;
39315
+ break;
39316
+ }
39317
+ }
39318
+ if (candidateY !== -Infinity &&
39319
+ !_overlapsAny(x, candidateY, width, height, existingBoxes)) {
39320
+ return [
39321
+ x,
39322
+ Math.max(margin, Math.min(candidateY, maxY - height)),
39323
+ ];
39324
+ }
39325
+ return [x, y];
39326
+ }
39327
+ function _overlapsAny(x, y, w, h, boxes) {
39328
+ const candidate = _toTextBoxAABB({ x, y, width: w, height: h });
39329
+ return boxes.some((box) => (0,_math_aabb_intersectAABB__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(candidate, _toTextBoxAABB(box, TEXT_BOX_GAP / 2)));
39330
+ }
39331
+ function _findFirstOverlap(x, y, w, h, boxes) {
39332
+ const candidate = _toTextBoxAABB({ x, y, width: w, height: h });
39333
+ return boxes.find((box) => (0,_math_aabb_intersectAABB__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(candidate, _toTextBoxAABB(box, TEXT_BOX_GAP / 2)));
39334
+ }
39335
+ function _toTextBoxAABB(rect, inflate = 0) {
39336
+ return {
39337
+ minX: rect.x - inflate,
39338
+ minY: rect.y - inflate,
39339
+ maxX: rect.x + rect.width + inflate,
39340
+ maxY: rect.y + rect.height + inflate,
39341
+ };
39342
+ }
39343
+ function _findSvgLayer(element) {
39344
+ const internalDiv = element.querySelector(`.${VIEWPORT_ELEMENT}`);
39345
+ return internalDiv?.querySelector(':scope > .svg-layer') || null;
39498
39346
  }
39499
39347
  function _determineCorners(canvasPoints) {
39348
+ const p0 = canvasPoints[0];
39349
+ if (!p0 || canvasPoints.length < 2) {
39350
+ return { left: p0, right: p0, top: p0, bottom: p0 };
39351
+ }
39500
39352
  const handlesLeftToRight = [canvasPoints[0], canvasPoints[1]].sort(_compareX);
39501
39353
  const handlesTopToBottom = [canvasPoints[0], canvasPoints[1]].sort(_compareY);
39354
+ const left = handlesLeftToRight[0];
39502
39355
  const right = handlesLeftToRight[handlesLeftToRight.length - 1];
39503
39356
  const top = handlesTopToBottom[0];
39504
39357
  const bottom = handlesTopToBottom[handlesTopToBottom.length - 1];
39505
39358
  return {
39359
+ left,
39506
39360
  top,
39507
39361
  bottom,
39508
39362
  right,
@@ -39514,6 +39368,16 @@ function _determineCorners(canvasPoints) {
39514
39368
  return a[1] < b[1] ? -1 : 1;
39515
39369
  }
39516
39370
  }
39371
+ function _estimateTextBoxSize(textLines) {
39372
+ const estimatedPadding = 25;
39373
+ const estimatedCharWidth = 8;
39374
+ const estimatedLineHeight = 17;
39375
+ const longestLineLength = textLines.reduce((max, line) => Math.max(max, line?.length ?? 0), 0);
39376
+ const lineCount = Math.max(textLines.length, 1);
39377
+ const width = longestLineLength * estimatedCharWidth + estimatedPadding * 2;
39378
+ const height = lineCount * estimatedLineHeight + estimatedPadding * 2;
39379
+ return { width, height };
39380
+ }
39517
39381
 
39518
39382
 
39519
39383
  /***/ },
@@ -39920,7 +39784,7 @@ var getCanvasEllipseCorners = __webpack_require__(2222);
39920
39784
 
39921
39785
  /***/ },
39922
39786
 
39923
- /***/ 85895
39787
+ /***/ 18153
39924
39788
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
39925
39789
 
39926
39790
  "use strict";
@@ -39941,17 +39805,11 @@ __webpack_require__.r(aabb_namespaceObject);
39941
39805
  __webpack_require__.d(aabb_namespaceObject, {
39942
39806
  distanceToPoint: () => (distanceToPoint),
39943
39807
  distanceToPointSquared: () => (distanceToPointSquared),
39944
- intersectAABB: () => (intersectAABB)
39808
+ intersectAABB: () => (intersectAABB/* default */.A)
39945
39809
  });
39946
39810
 
39947
- ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/aabb/intersectAABB.js
39948
- function intersectAABB(aabb1, aabb2) {
39949
- return (aabb1.minX <= aabb2.maxX &&
39950
- aabb1.maxX >= aabb2.minX &&
39951
- aabb1.minY <= aabb2.maxY &&
39952
- aabb1.maxY >= aabb2.minY);
39953
- }
39954
-
39811
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/aabb/intersectAABB.js
39812
+ var intersectAABB = __webpack_require__(33277);
39955
39813
  ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/aabb/distanceToPointSquared.js
39956
39814
  function distanceToPointSquared(aabb, point) {
39957
39815
  const aabbWidth = aabb.maxX - aabb.minX;