@ohif/app 3.7.0-beta.63 → 3.7.0-beta.65

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 (30) hide show
  1. package/dist/{925.bundle.5e929605d3235ebcdebf.js → 116.bundle.422d1a76d8daccfed61d.js} +301 -253
  2. package/dist/{12.bundle.c80ff2e8651297d7aec8.js → 12.bundle.ba5637aa5f6fda7c4d3e.js} +2 -2
  3. package/dist/{128.bundle.8d7db97e0d90ba8be751.js → 128.bundle.a0a5a0b19a9c55f38d8d.js} +2 -2
  4. package/dist/{150.bundle.0ed8ccb7f15a603151b6.js → 150.bundle.bd84a9929e2ed5468c78.js} +2 -2
  5. package/dist/{181.bundle.1accc89eac7f1b4bc752.js → 181.bundle.e00758d544ff182a20bf.js} +4 -4
  6. package/dist/{202.bundle.8007de18c96daaceca7f.js → 202.bundle.591726b6144882ba0ee0.js} +1 -1
  7. package/dist/{236.bundle.308648f0e447eaaeda67.js → 236.bundle.c32a85934c4217350202.js} +2 -2
  8. package/dist/{250.bundle.1543b1b8466d43f3465d.js → 250.bundle.2162b61af7bd4df7e8d3.js} +2 -2
  9. package/dist/{281.bundle.015cf8cb9625c7fb3dd5.js → 281.bundle.49bd06f629554a37b64e.js} +2 -2
  10. package/dist/{30.bundle.4d8b67d4ed86238948ca.js → 30.bundle.16dcc9077968c7ec5716.js} +4 -4
  11. package/dist/{348.bundle.81366dddd24e78113662.js → 348.bundle.96d3b3a0a76435060ac7.js} +27 -7
  12. package/dist/{359.bundle.1c14405c9d974bb5a30f.js → 359.bundle.2a4ab07118f244889c72.js} +2 -2
  13. package/dist/{362.bundle.11a6a0792b8042b5c81b.js → 362.bundle.5df3f9a2db79bfcea304.js} +4 -4
  14. package/dist/{410.bundle.c0ed86f4d3cbc0939903.js → 410.bundle.097100af9b0146b16d37.js} +6 -3
  15. package/dist/{451.bundle.b3d9a67d4b2a962be96b.js → 451.bundle.229116c974c809ba2428.js} +2 -2
  16. package/dist/{471.bundle.87b1c57d4c04ae35cb88.js → 471.bundle.af42b813c05cd24e7096.js} +2 -2
  17. package/dist/{506.bundle.a9e9ceb9fc71cdf45d91.js → 506.bundle.acb7ec23b403134433c4.js} +2 -2
  18. package/dist/{663.bundle.05e8cc381eadc38f9755.js → 663.bundle.b8457dcc59105db59531.js} +8 -8
  19. package/dist/{754.bundle.7ae67c55a90a6a2d8494.js → 754.bundle.a5c9246c77659eab2739.js} +12 -0
  20. package/dist/{782.bundle.082672a46147b8402d4a.js → 782.bundle.be867cc8b8a53a856ef2.js} +4 -4
  21. package/dist/{814.bundle.35355762730e3b4ee89f.js → 814.bundle.04433a4a08147ddc3e02.js} +2 -2
  22. package/dist/{822.bundle.00dacc09a7d028fca29b.js → 822.bundle.cd9baa3940f7e0ec3ca9.js} +2 -2
  23. package/dist/{886.bundle.d0915318107cf24e8beb.js → 886.bundle.5ea262edc77722f9e3e9.js} +1 -1
  24. package/dist/{678.bundle.784d7fb157d76611068d.js → 967.bundle.daa1686a643339939e75.js} +228 -16
  25. package/dist/{app.bundle.eeda76c463f838f592c1.js → app.bundle.722d93e1898a91823336.js} +5820 -5701
  26. package/dist/index.html +1 -1
  27. package/dist/sw.js +1 -1
  28. package/package.json +19 -19
  29. /package/dist/{687.bundle.3de11e7a373ee3588813.js → 687.bundle.f6f19b17c9a8ade331e9.js} +0 -0
  30. /package/dist/{678.css → 967.css} +0 -0
@@ -1,6 +1,6 @@
1
- (self["webpackChunk"] = self["webpackChunk"] || []).push([[925],{
1
+ (self["webpackChunk"] = self["webpackChunk"] || []).push([[116],{
2
2
 
3
- /***/ 26925:
3
+ /***/ 99116:
4
4
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5
5
 
6
6
  "use strict";
@@ -10,6 +10,7 @@ __webpack_require__.r(__webpack_exports__);
10
10
  // EXPORTS
11
11
  __webpack_require__.d(__webpack_exports__, {
12
12
  AngleTool: () => (/* reexport */ annotation_AngleTool),
13
+ AnnotationDisplayTool: () => (/* reexport */ base_AnnotationDisplayTool),
13
14
  AnnotationTool: () => (/* reexport */ base_AnnotationTool),
14
15
  ArrowAnnotateTool: () => (/* reexport */ annotation_ArrowAnnotateTool),
15
16
  BaseTool: () => (/* reexport */ base_BaseTool),
@@ -256,7 +257,9 @@ __webpack_require__.d(drawingSvg_namespaceObject, {
256
257
  drawLinkedTextBox: () => (drawingSvg_drawLinkedTextBox),
257
258
  drawPolyline: () => (drawPolyline),
258
259
  drawRect: () => (drawRect),
259
- drawTextBox: () => (drawingSvg_drawTextBox)
260
+ drawTextBox: () => (drawingSvg_drawTextBox),
261
+ setAttributesIfNecessary: () => (drawingSvg_setAttributesIfNecessary),
262
+ setNewAttributesIfValid: () => (drawingSvg_setNewAttributesIfValid)
260
263
  });
261
264
 
262
265
  // NAMESPACE OBJECT: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/annotation/config/index.js
@@ -364,6 +367,14 @@ __webpack_require__.d(rectangle_namespaceObject, {
364
367
  distanceToPoint: () => (rectangle_distanceToPoint_distanceToPoint)
365
368
  });
366
369
 
370
+ // NAMESPACE OBJECT: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/basic/index.js
371
+ var basic_namespaceObject = {};
372
+ __webpack_require__.r(basic_namespaceObject);
373
+ __webpack_require__.d(basic_namespaceObject, {
374
+ BasicStatsCalculator: () => (BasicStatsCalculator),
375
+ Calculator: () => (basic_Calculator)
376
+ });
377
+
367
378
  // NAMESPACE OBJECT: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/point/index.js
368
379
  var point_namespaceObject = {};
369
380
  __webpack_require__.r(point_namespaceObject);
@@ -396,6 +407,7 @@ __webpack_require__.d(polyline_namespaceObject, {
396
407
  var math_namespaceObject = {};
397
408
  __webpack_require__.r(math_namespaceObject);
398
409
  __webpack_require__.d(math_namespaceObject, {
410
+ BasicStatsCalculator: () => (basic_namespaceObject),
399
411
  ellipse: () => (ellipse_namespaceObject),
400
412
  lineSegment: () => (line_namespaceObject),
401
413
  point: () => (point_namespaceObject),
@@ -2250,8 +2262,15 @@ function keyListener(evt) {
2250
2262
  };
2251
2263
  (0,esm.triggerEvent)(eventDetail.element, enums_Events.KEY_DOWN, eventDetail);
2252
2264
  document.addEventListener('keyup', _onKeyUp);
2265
+ document.addEventListener('visibilitychange', _onVisibilityChange);
2253
2266
  keyDownListener_state.element.removeEventListener('keydown', keyListener);
2254
2267
  }
2268
+ function _onVisibilityChange() {
2269
+ document.removeEventListener('visibilitychange', _onVisibilityChange);
2270
+ if (document.visibilityState === 'hidden') {
2271
+ resetModifierKey();
2272
+ }
2273
+ }
2255
2274
  function _onKeyUp(evt) {
2256
2275
  const eventDetail = {
2257
2276
  renderingEngineId: keyDownListener_state.renderingEngineId,
@@ -2261,6 +2280,7 @@ function _onKeyUp(evt) {
2261
2280
  keyCode: keyDownListener_state.keyCode,
2262
2281
  };
2263
2282
  document.removeEventListener('keyup', _onKeyUp);
2283
+ document.removeEventListener('visibilitychange', _onVisibilityChange);
2264
2284
  keyDownListener_state.element.addEventListener('keydown', keyListener);
2265
2285
  keyDownListener_state = lodash_clonedeep_default()(keyDownListener_defaultState);
2266
2286
  (0,esm.triggerEvent)(eventDetail.element, enums_Events.KEY_UP, eventDetail);
@@ -4460,8 +4480,8 @@ function _getHash(annotationUID, drawingElementType, nodeUID) {
4460
4480
  }
4461
4481
  /* harmony default export */ const drawingSvg_getHash = (_getHash);
4462
4482
 
4463
- ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/_setAttributesIfNecessary.js
4464
- function _setAttributesIfNecessary(attributes, svgNode) {
4483
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/setAttributesIfNecessary.js
4484
+ function setAttributesIfNecessary(attributes, svgNode) {
4465
4485
  Object.keys(attributes).forEach((key) => {
4466
4486
  const currentValue = svgNode.getAttribute(key);
4467
4487
  const newValue = attributes[key];
@@ -4473,10 +4493,10 @@ function _setAttributesIfNecessary(attributes, svgNode) {
4473
4493
  }
4474
4494
  });
4475
4495
  }
4476
- /* harmony default export */ const drawingSvg_setAttributesIfNecessary = (_setAttributesIfNecessary);
4496
+ /* harmony default export */ const drawingSvg_setAttributesIfNecessary = (setAttributesIfNecessary);
4477
4497
 
4478
- ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/_setNewAttributesIfValid.js
4479
- function _setNewAttributesIfValid(attributes, svgNode) {
4498
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/setNewAttributesIfValid.js
4499
+ function setNewAttributesIfValid(attributes, svgNode) {
4480
4500
  Object.keys(attributes).forEach((key) => {
4481
4501
  const newValue = attributes[key];
4482
4502
  if (newValue !== undefined && newValue !== '') {
@@ -4484,7 +4504,7 @@ function _setNewAttributesIfValid(attributes, svgNode) {
4484
4504
  }
4485
4505
  });
4486
4506
  }
4487
- /* harmony default export */ const drawingSvg_setNewAttributesIfValid = (_setNewAttributesIfValid);
4507
+ /* harmony default export */ const drawingSvg_setNewAttributesIfValid = (setNewAttributesIfValid);
4488
4508
 
4489
4509
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/drawingSvg/drawCircle.js
4490
4510
 
@@ -5016,6 +5036,8 @@ function drawArrow(svgDrawingHelper, annotationUID, arrowUID, start, end, option
5016
5036
 
5017
5037
 
5018
5038
 
5039
+
5040
+
5019
5041
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/getToolsWithModesForElement.js
5020
5042
 
5021
5043
 
@@ -5491,8 +5513,8 @@ AnnotationDisplayTool.toolName = 'AnnotationDisplayTool';
5491
5513
 
5492
5514
 
5493
5515
  class AnnotationTool extends base_AnnotationDisplayTool {
5494
- constructor() {
5495
- super(...arguments);
5516
+ constructor(toolProps, defaultToolProps) {
5517
+ super(toolProps, defaultToolProps);
5496
5518
  this.mouseMoveCallback = (evt, filteredAnnotations) => {
5497
5519
  if (!filteredAnnotations) {
5498
5520
  return false;
@@ -5523,6 +5545,13 @@ class AnnotationTool extends base_AnnotationDisplayTool {
5523
5545
  }
5524
5546
  return annotationsNeedToBeRedrawn;
5525
5547
  };
5548
+ if (toolProps.configuration?.getTextLines) {
5549
+ this.configuration.getTextLines = toolProps.configuration.getTextLines;
5550
+ }
5551
+ if (toolProps.configuration?.statsCalculator) {
5552
+ this.configuration.statsCalculator =
5553
+ toolProps.configuration.statsCalculator;
5554
+ }
5526
5555
  }
5527
5556
  getHandleNearImagePoint(element, annotation, canvasCoords, proximity) {
5528
5557
  const enabledElement = (0,esm.getEnabledElement)(element);
@@ -5600,6 +5629,7 @@ AnnotationTool.toolName = 'AnnotationTool';
5600
5629
 
5601
5630
 
5602
5631
 
5632
+
5603
5633
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/SegmentationDisplayTool.js
5604
5634
 
5605
5635
 
@@ -6232,6 +6262,7 @@ function pointInShapeCallback(imageData, pointInShapeFn, callback, boundsIJK) {
6232
6262
  const scanAxisStep = gl_matrix_esm/* vec3.fromValues */.R3.fromValues(scanAxisNormal[0] * scanAxisSpacing, scanAxisNormal[1] * scanAxisSpacing, scanAxisNormal[2] * scanAxisSpacing);
6233
6263
  const yMultiple = dimensions[0];
6234
6264
  const zMultiple = dimensions[0] * dimensions[1];
6265
+ const pointsInShape = [];
6235
6266
  for (let k = kMin; k <= kMax; k++) {
6236
6267
  for (let j = jMin; j <= jMax; j++) {
6237
6268
  for (let i = iMin; i <= iMax; i++) {
@@ -6257,11 +6288,15 @@ function pointInShapeCallback(imageData, pointInShapeFn, callback, boundsIJK) {
6257
6288
  if (pointInShapeFn(pointLPS, pointIJK)) {
6258
6289
  const index = k * zMultiple + j * yMultiple + i;
6259
6290
  const value = scalarData[index];
6260
- callback({ value, index, pointIJK, pointLPS });
6291
+ pointsInShape.push({ value, index, pointIJK, pointLPS });
6292
+ if (callback !== null) {
6293
+ callback({ value, index, pointIJK, pointLPS });
6294
+ }
6261
6295
  }
6262
6296
  }
6263
6297
  }
6264
6298
  }
6299
+ return pointsInShape;
6265
6300
  }
6266
6301
 
6267
6302
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/sphere/pointInSphere.js
@@ -10625,6 +10660,7 @@ class BidirectionalTool extends base_AnnotationTool {
10625
10660
  supportedInteractionTypes: ['Mouse', 'Touch'],
10626
10661
  configuration: {
10627
10662
  preventHandleOutsideImage: false,
10663
+ getTextLines: defaultGetTextLines,
10628
10664
  },
10629
10665
  }) {
10630
10666
  super(toolProps, defaultToolProps);
@@ -11145,7 +11181,7 @@ class BidirectionalTool extends base_AnnotationTool {
11145
11181
  shadow,
11146
11182
  }, dataId2);
11147
11183
  renderStatus = true;
11148
- const textLines = this._getTextLines(data, targetId);
11184
+ const textLines = this.configuration.getTextLines(data, targetId);
11149
11185
  if (!textLines || textLines.length === 0) {
11150
11186
  continue;
11151
11187
  }
@@ -11186,18 +11222,6 @@ class BidirectionalTool extends base_AnnotationTool {
11186
11222
  const wouldPutThroughShortAxis = !proposedIntersectionPoint;
11187
11223
  return wouldPutThroughShortAxis;
11188
11224
  };
11189
- this._getTextLines = (data, targetId) => {
11190
- const { cachedStats } = data;
11191
- const { length, width, unit } = cachedStats[targetId];
11192
- if (length === undefined) {
11193
- return;
11194
- }
11195
- const textLines = [
11196
- `L: ${utilities_roundNumber(length)} ${unit}`,
11197
- `W: ${utilities_roundNumber(width)} ${unit}`,
11198
- ];
11199
- return textLines;
11200
- };
11201
11225
  this._calculateCachedStats = (annotation, renderingEngine, enabledElement) => {
11202
11226
  const { data } = annotation;
11203
11227
  const { viewportId, renderingEngineId } = enabledElement;
@@ -11321,6 +11345,18 @@ class BidirectionalTool extends base_AnnotationTool {
11321
11345
  return Math.sqrt(dx * dx + dy * dy + dz * dz);
11322
11346
  }
11323
11347
  }
11348
+ function defaultGetTextLines(data, targetId) {
11349
+ const { cachedStats } = data;
11350
+ const { length, width, unit } = cachedStats[targetId];
11351
+ if (length === undefined) {
11352
+ return;
11353
+ }
11354
+ const textLines = [
11355
+ `L: ${utilities_roundNumber(length)} ${unit}`,
11356
+ `W: ${utilities_roundNumber(width)} ${unit}`,
11357
+ ];
11358
+ return textLines;
11359
+ }
11324
11360
  BidirectionalTool.toolName = 'Bidirectional';
11325
11361
  /* harmony default export */ const annotation_BidirectionalTool = (BidirectionalTool);
11326
11362
 
@@ -11347,6 +11383,7 @@ class LengthTool extends base_AnnotationTool {
11347
11383
  supportedInteractionTypes: ['Mouse', 'Touch'],
11348
11384
  configuration: {
11349
11385
  preventHandleOutsideImage: false,
11386
+ getTextLines: LengthTool_defaultGetTextLines,
11350
11387
  },
11351
11388
  }) {
11352
11389
  super(toolProps, defaultToolProps);
@@ -11645,7 +11682,7 @@ class LengthTool extends base_AnnotationTool {
11645
11682
  console.warn('Rendering Engine has been destroyed');
11646
11683
  return renderStatus;
11647
11684
  }
11648
- const textLines = this._getTextLines(data, targetId);
11685
+ const textLines = this.configuration.getTextLines(data, targetId);
11649
11686
  if (!data.handles.textBox.hasMoved) {
11650
11687
  const canvasTextBoxCoords = getTextBoxCoordsCanvas(canvasCoordinates);
11651
11688
  data.handles.textBox.worldPosition =
@@ -11693,15 +11730,6 @@ class LengthTool extends base_AnnotationTool {
11693
11730
  utilities_triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
11694
11731
  evt.preventDefault();
11695
11732
  }
11696
- _getTextLines(data, targetId) {
11697
- const cachedVolumeStats = data.cachedStats[targetId];
11698
- const { length, unit } = cachedVolumeStats;
11699
- if (length === undefined || length === null || isNaN(length)) {
11700
- return;
11701
- }
11702
- const textLines = [`${utilities_roundNumber(length)} ${unit}`];
11703
- return textLines;
11704
- }
11705
11733
  _calculateLength(pos1, pos2) {
11706
11734
  const dx = pos1[0] - pos2[0];
11707
11735
  const dy = pos1[1] - pos2[1];
@@ -11749,6 +11777,15 @@ class LengthTool extends base_AnnotationTool {
11749
11777
  esm.utilities.indexWithinDimensions(index2, dimensions));
11750
11778
  }
11751
11779
  }
11780
+ function LengthTool_defaultGetTextLines(data, targetId) {
11781
+ const cachedVolumeStats = data.cachedStats[targetId];
11782
+ const { length, unit } = cachedVolumeStats;
11783
+ if (length === undefined || length === null || isNaN(length)) {
11784
+ return;
11785
+ }
11786
+ const textLines = [`${utilities_roundNumber(length)} ${unit}`];
11787
+ return textLines;
11788
+ }
11752
11789
  LengthTool.toolName = 'Length';
11753
11790
  /* harmony default export */ const annotation_LengthTool = (LengthTool);
11754
11791
 
@@ -11815,6 +11852,7 @@ class ProbeTool extends base_AnnotationTool {
11815
11852
  configuration: {
11816
11853
  shadow: true,
11817
11854
  preventHandleOutsideImage: false,
11855
+ getTextLines: ProbeTool_defaultGetTextLines,
11818
11856
  },
11819
11857
  }) {
11820
11858
  super(toolProps, defaultToolProps);
@@ -12006,7 +12044,7 @@ class ProbeTool extends base_AnnotationTool {
12006
12044
  const handleGroupUID = '0';
12007
12045
  drawingSvg_drawHandles(svgDrawingHelper, annotationUID, handleGroupUID, [canvasCoordinates], { color });
12008
12046
  renderStatus = true;
12009
- const textLines = this._getTextLines(data, targetId);
12047
+ const textLines = this.configuration.getTextLines(data, targetId);
12010
12048
  if (textLines) {
12011
12049
  const textCanvasCoordinates = [
12012
12050
  canvasCoordinates[0] + 6,
@@ -12050,17 +12088,6 @@ class ProbeTool extends base_AnnotationTool {
12050
12088
  utilities_triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
12051
12089
  evt.preventDefault();
12052
12090
  }
12053
- _getTextLines(data, targetId) {
12054
- const cachedVolumeStats = data.cachedStats[targetId];
12055
- const { index, value, modalityUnit } = cachedVolumeStats;
12056
- if (value === undefined) {
12057
- return;
12058
- }
12059
- const textLines = [];
12060
- textLines.push(`(${index[0]}, ${index[1]}, ${index[2]})`);
12061
- textLines.push(`${value.toFixed(2)} ${modalityUnit}`);
12062
- return textLines;
12063
- }
12064
12091
  _calculateCachedStats(annotation, renderingEngine, enabledElement, modalityUnitOptions) {
12065
12092
  const data = annotation.data;
12066
12093
  const { viewportId, renderingEngineId } = enabledElement;
@@ -12119,6 +12146,17 @@ class ProbeTool extends base_AnnotationTool {
12119
12146
  return cachedStats;
12120
12147
  }
12121
12148
  }
12149
+ function ProbeTool_defaultGetTextLines(data, targetId) {
12150
+ const cachedVolumeStats = data.cachedStats[targetId];
12151
+ const { index, value, modalityUnit } = cachedVolumeStats;
12152
+ if (value === undefined) {
12153
+ return;
12154
+ }
12155
+ const textLines = [];
12156
+ textLines.push(`(${index[0]}, ${index[1]}, ${index[2]})`);
12157
+ textLines.push(`${value.toFixed(2)} ${modalityUnit}`);
12158
+ return textLines;
12159
+ }
12122
12160
  ProbeTool.toolName = 'Probe';
12123
12161
  /* harmony default export */ const annotation_ProbeTool = (ProbeTool);
12124
12162
 
@@ -12136,6 +12174,7 @@ class DragProbeTool extends annotation_ProbeTool {
12136
12174
  configuration: {
12137
12175
  shadow: true,
12138
12176
  preventHandleOutsideImage: false,
12177
+ getTextLines: DragProbeTool_defaultGetTextLines,
12139
12178
  },
12140
12179
  }) {
12141
12180
  super(toolProps, defaultToolProps);
@@ -12227,7 +12266,7 @@ class DragProbeTool extends annotation_ProbeTool {
12227
12266
  const handleGroupUID = '0';
12228
12267
  drawingSvg_drawHandles(svgDrawingHelper, annotationUID, handleGroupUID, [canvasCoordinates], { color });
12229
12268
  renderStatus = true;
12230
- const textLines = this._getTextLines(data, targetId);
12269
+ const textLines = this.configuration.getTextLines(data, targetId);
12231
12270
  if (textLines) {
12232
12271
  const textCanvasCoordinates = [
12233
12272
  canvasCoordinates[0] + 6,
@@ -12240,6 +12279,17 @@ class DragProbeTool extends annotation_ProbeTool {
12240
12279
  };
12241
12280
  }
12242
12281
  }
12282
+ function DragProbeTool_defaultGetTextLines(data, targetId) {
12283
+ const cachedVolumeStats = data.cachedStats[targetId];
12284
+ const { index, value, modalityUnit } = cachedVolumeStats;
12285
+ if (value === undefined) {
12286
+ return;
12287
+ }
12288
+ const textLines = [];
12289
+ textLines.push(`(${index[0]}, ${index[1]}, ${index[2]})`);
12290
+ textLines.push(`${value.toFixed(2)} ${modalityUnit}`);
12291
+ return textLines;
12292
+ }
12243
12293
  DragProbeTool.toolName = 'DragProbe';
12244
12294
  /* harmony default export */ const annotation_DragProbeTool = (DragProbeTool);
12245
12295
 
@@ -12291,6 +12341,53 @@ function rectangle_distanceToPoint_distanceToPoint(rect, point) {
12291
12341
 
12292
12342
 
12293
12343
 
12344
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/basic/Calculator.js
12345
+ class Calculator {
12346
+ }
12347
+ /* harmony default export */ const basic_Calculator = (Calculator);
12348
+
12349
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/basic/BasicStatsCalculator.js
12350
+
12351
+ class BasicStatsCalculator extends basic_Calculator {
12352
+ static { this.max = -Infinity; }
12353
+ static { this.currentMax = 0; }
12354
+ static { this.sum = 0; }
12355
+ static { this.sumSquares = 0; }
12356
+ static { this.squaredDiffSum = 0; }
12357
+ static { this.count = 0; }
12358
+ static { this.statsCallback = ({ value: newValue }) => {
12359
+ if (newValue > this.max) {
12360
+ this.max = newValue;
12361
+ this.currentMax = newValue;
12362
+ }
12363
+ this.count += 1;
12364
+ this.sum += newValue;
12365
+ this.sumSquares += newValue ** 2;
12366
+ this.squaredDiffSum += Math.pow(newValue - this.sum / this.count, 2);
12367
+ }; }
12368
+ static { this.getStatistics = () => {
12369
+ const mean = this.sum / this.count;
12370
+ const stdDev = Math.sqrt(this.squaredDiffSum / this.count);
12371
+ const stdDevWithSumSquare = Math.sqrt(this.sumSquares / this.count - mean ** 2);
12372
+ this.max = -Infinity;
12373
+ this.sum = 0;
12374
+ this.sumSquares = 0;
12375
+ this.squaredDiffSum = 0;
12376
+ this.count = 0;
12377
+ return [
12378
+ { name: 'max', value: this.currentMax, unit: null },
12379
+ { name: 'mean', value: mean, unit: null },
12380
+ { name: 'stdDev', value: stdDev, unit: null },
12381
+ { name: 'stdDevWithSumSquare', value: stdDevWithSumSquare, unit: null },
12382
+ ];
12383
+ }; }
12384
+ }
12385
+
12386
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/basic/index.js
12387
+
12388
+
12389
+
12390
+
12294
12391
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/annotation/RectangleROITool.js
12295
12392
 
12296
12393
 
@@ -12310,6 +12407,8 @@ function rectangle_distanceToPoint_distanceToPoint(rect, point) {
12310
12407
 
12311
12408
 
12312
12409
 
12410
+
12411
+
12313
12412
 
12314
12413
  const { transformWorldToIndex: RectangleROITool_transformWorldToIndex } = esm.utilities;
12315
12414
  class RectangleROITool extends base_AnnotationTool {
@@ -12318,6 +12417,8 @@ class RectangleROITool extends base_AnnotationTool {
12318
12417
  configuration: {
12319
12418
  shadow: true,
12320
12419
  preventHandleOutsideImage: false,
12420
+ getTextLines: RectangleROITool_defaultGetTextLines,
12421
+ statsCalculator: BasicStatsCalculator,
12321
12422
  },
12322
12423
  }) {
12323
12424
  super(toolProps, defaultToolProps);
@@ -12707,7 +12808,7 @@ class RectangleROITool extends base_AnnotationTool {
12707
12808
  lineWidth,
12708
12809
  }, dataId);
12709
12810
  renderStatus = true;
12710
- const textLines = this._getTextLines(data, targetId);
12811
+ const textLines = this.configuration.getTextLines(data, targetId);
12711
12812
  if (!textLines || textLines.length === 0) {
12712
12813
  continue;
12713
12814
  }
@@ -12738,19 +12839,6 @@ class RectangleROITool extends base_AnnotationTool {
12738
12839
  height: Math.abs(point0[1] - point1[1]),
12739
12840
  };
12740
12841
  };
12741
- this._getTextLines = (data, targetId) => {
12742
- const cachedVolumeStats = data.cachedStats[targetId];
12743
- const { area, mean, max, stdDev, areaUnit, modalityUnit } = cachedVolumeStats;
12744
- if (mean === undefined) {
12745
- return;
12746
- }
12747
- const textLines = [];
12748
- textLines.push(`Area: ${utilities_roundNumber(area)} ${areaUnit}`);
12749
- textLines.push(`Mean: ${utilities_roundNumber(mean)} ${modalityUnit}`);
12750
- textLines.push(`Max: ${utilities_roundNumber(max)} ${modalityUnit}`);
12751
- textLines.push(`Std Dev: ${utilities_roundNumber(stdDev)} ${modalityUnit}`);
12752
- return textLines;
12753
- };
12754
12842
  this._calculateCachedStats = (annotation, viewPlaneNormal, viewUp, renderingEngine, enabledElement, modalityUnitOptions) => {
12755
12843
  const { data } = annotation;
12756
12844
  const { viewportId, renderingEngineId } = enabledElement;
@@ -12782,46 +12870,25 @@ class RectangleROITool extends base_AnnotationTool {
12782
12870
  const jMax = Math.max(worldPos1Index[1], worldPos2Index[1]);
12783
12871
  const kMin = Math.min(worldPos1Index[2], worldPos2Index[2]);
12784
12872
  const kMax = Math.max(worldPos1Index[2], worldPos2Index[2]);
12873
+ const boundsIJK = [
12874
+ [iMin, iMax],
12875
+ [jMin, jMax],
12876
+ [kMin, kMax],
12877
+ ];
12785
12878
  const { worldWidth, worldHeight } = getWorldWidthAndHeightFromCorners(viewPlaneNormal, viewUp, worldPos1, worldPos2);
12786
12879
  const scale = getCalibratedScale(image);
12787
12880
  const area = Math.abs(worldWidth * worldHeight) / (scale * scale);
12788
- let count = 0;
12789
- let mean = 0;
12790
- let stdDev = 0;
12791
- let max = -Infinity;
12792
- const yMultiple = dimensions[0];
12793
- const zMultiple = dimensions[0] * dimensions[1];
12794
- for (let k = kMin; k <= kMax; k++) {
12795
- for (let j = jMin; j <= jMax; j++) {
12796
- for (let i = iMin; i <= iMax; i++) {
12797
- const value = scalarData[k * zMultiple + j * yMultiple + i];
12798
- if (value > max) {
12799
- max = value;
12800
- }
12801
- count++;
12802
- mean += value;
12803
- }
12804
- }
12805
- }
12806
- mean /= count;
12807
- for (let k = kMin; k <= kMax; k++) {
12808
- for (let j = jMin; j <= jMax; j++) {
12809
- for (let i = iMin; i <= iMax; i++) {
12810
- const value = scalarData[k * zMultiple + j * yMultiple + i];
12811
- const valueMinusMean = value - mean;
12812
- stdDev += valueMinusMean * valueMinusMean;
12813
- }
12814
- }
12815
- }
12816
- stdDev /= count;
12817
- stdDev = Math.sqrt(stdDev);
12818
12881
  const modalityUnit = getModalityUnit(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
12882
+ const pointsInShape = pointInShapeCallback(imageData, () => true, this.configuration.statsCalculator.statsCallback, boundsIJK);
12883
+ const stats = this.configuration.statsCalculator.getStatistics();
12819
12884
  cachedStats[targetId] = {
12820
12885
  Modality: metadata.Modality,
12821
12886
  area,
12822
- mean,
12823
- stdDev,
12824
- max,
12887
+ mean: stats[1]?.value,
12888
+ stdDev: stats[2]?.value,
12889
+ max: stats[0]?.value,
12890
+ statsArray: stats,
12891
+ pointsInShape: pointsInShape,
12825
12892
  areaUnit: getCalibratedAreaUnits(null, image),
12826
12893
  modalityUnit,
12827
12894
  };
@@ -12850,6 +12917,19 @@ class RectangleROITool extends base_AnnotationTool {
12850
12917
  this._throttledCalculateCachedStats = utilities_throttle(this._calculateCachedStats, 100, { trailing: true });
12851
12918
  }
12852
12919
  }
12920
+ function RectangleROITool_defaultGetTextLines(data, targetId) {
12921
+ const cachedVolumeStats = data.cachedStats[targetId];
12922
+ const { area, mean, max, stdDev, areaUnit, modalityUnit } = cachedVolumeStats;
12923
+ if (mean === undefined) {
12924
+ return;
12925
+ }
12926
+ const textLines = [];
12927
+ textLines.push(`Area: ${utilities_roundNumber(area)} ${areaUnit}`);
12928
+ textLines.push(`Mean: ${utilities_roundNumber(mean)} ${modalityUnit}`);
12929
+ textLines.push(`Max: ${utilities_roundNumber(max)} ${modalityUnit}`);
12930
+ textLines.push(`Std Dev: ${utilities_roundNumber(stdDev)} ${modalityUnit}`);
12931
+ return textLines;
12932
+ }
12853
12933
  RectangleROITool.toolName = 'RectangleROI';
12854
12934
  /* harmony default export */ const annotation_RectangleROITool = (RectangleROITool);
12855
12935
 
@@ -12893,6 +12973,7 @@ function getWorldWidthAndHeightFromTwoPoints(viewPlaneNormal, viewUp, worldPos1,
12893
12973
 
12894
12974
 
12895
12975
 
12976
+
12896
12977
 
12897
12978
  const { transformWorldToIndex: EllipticalROITool_transformWorldToIndex } = esm.utilities;
12898
12979
  class EllipticalROITool extends base_AnnotationTool {
@@ -12902,6 +12983,8 @@ class EllipticalROITool extends base_AnnotationTool {
12902
12983
  shadow: true,
12903
12984
  preventHandleOutsideImage: false,
12904
12985
  centerPointRadius: 0,
12986
+ getTextLines: EllipticalROITool_defaultGetTextLines,
12987
+ statsCalculator: BasicStatsCalculator,
12905
12988
  },
12906
12989
  }) {
12907
12990
  super(toolProps, defaultToolProps);
@@ -13390,7 +13473,7 @@ class EllipticalROITool extends base_AnnotationTool {
13390
13473
  }
13391
13474
  }
13392
13475
  renderStatus = true;
13393
- const textLines = this._getTextLines(data, targetId);
13476
+ const textLines = this.configuration.getTextLines(data, targetId);
13394
13477
  if (!textLines || textLines.length === 0) {
13395
13478
  continue;
13396
13479
  }
@@ -13413,27 +13496,6 @@ class EllipticalROITool extends base_AnnotationTool {
13413
13496
  }
13414
13497
  return renderStatus;
13415
13498
  };
13416
- this._getTextLines = (data, targetId) => {
13417
- const cachedVolumeStats = data.cachedStats[targetId];
13418
- const { area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit } = cachedVolumeStats;
13419
- const textLines = [];
13420
- if (area) {
13421
- const areaLine = isEmptyArea
13422
- ? `Area: Oblique not supported`
13423
- : `Area: ${utilities_roundNumber(area)} ${areaUnit}`;
13424
- textLines.push(areaLine);
13425
- }
13426
- if (mean) {
13427
- textLines.push(`Mean: ${utilities_roundNumber(mean)} ${modalityUnit}`);
13428
- }
13429
- if (max) {
13430
- textLines.push(`Max: ${utilities_roundNumber(max)} ${modalityUnit}`);
13431
- }
13432
- if (stdDev) {
13433
- textLines.push(`Std Dev: ${utilities_roundNumber(stdDev)} ${modalityUnit}`);
13434
- }
13435
- return textLines;
13436
- };
13437
13499
  this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions) => {
13438
13500
  const data = annotation.data;
13439
13501
  const { viewportId, renderingEngineId } = enabledElement;
@@ -13491,33 +13553,17 @@ class EllipticalROITool extends base_AnnotationTool {
13491
13553
  const area = Math.abs(Math.PI * (worldWidth / 2) * (worldHeight / 2)) /
13492
13554
  scale /
13493
13555
  scale;
13494
- let count = 0;
13495
- let mean = 0;
13496
- let stdDev = 0;
13497
- let max = -Infinity;
13498
- const meanMaxCalculator = ({ value: newValue }) => {
13499
- if (newValue > max) {
13500
- max = newValue;
13501
- }
13502
- mean += newValue;
13503
- count += 1;
13504
- };
13505
- pointInShapeCallback(imageData, (pointLPS, pointIJK) => pointInEllipse(ellipseObj, pointLPS), meanMaxCalculator, boundsIJK);
13506
- mean /= count;
13507
- const stdCalculator = ({ value }) => {
13508
- const valueMinusMean = value - mean;
13509
- stdDev += valueMinusMean * valueMinusMean;
13510
- };
13511
- pointInShapeCallback(imageData, (pointLPS, pointIJK) => pointInEllipse(ellipseObj, pointLPS), stdCalculator, boundsIJK);
13512
- stdDev /= count;
13513
- stdDev = Math.sqrt(stdDev);
13514
13556
  const modalityUnit = getModalityUnit(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
13557
+ const pointsInShape = pointInShapeCallback(imageData, (pointLPS, pointIJK) => pointInEllipse(ellipseObj, pointLPS), this.configuration.statsCalculator.statsCallback, boundsIJK);
13558
+ const stats = this.configuration.statsCalculator.getStatistics();
13515
13559
  cachedStats[targetId] = {
13516
13560
  Modality: metadata.Modality,
13517
13561
  area,
13518
- mean,
13519
- max,
13520
- stdDev,
13562
+ mean: stats[1]?.value,
13563
+ max: stats[0]?.value,
13564
+ stdDev: stats[2]?.value,
13565
+ statsArray: stats,
13566
+ pointsInShape: pointsInShape,
13521
13567
  isEmptyArea,
13522
13568
  areaUnit: getCalibratedAreaUnits(null, image),
13523
13569
  modalityUnit,
@@ -13569,6 +13615,27 @@ class EllipticalROITool extends base_AnnotationTool {
13569
13615
  ];
13570
13616
  }
13571
13617
  }
13618
+ function EllipticalROITool_defaultGetTextLines(data, targetId) {
13619
+ const cachedVolumeStats = data.cachedStats[targetId];
13620
+ const { area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit } = cachedVolumeStats;
13621
+ const textLines = [];
13622
+ if (area) {
13623
+ const areaLine = isEmptyArea
13624
+ ? `Area: Oblique not supported`
13625
+ : `Area: ${utilities_roundNumber(area)} ${areaUnit}`;
13626
+ textLines.push(areaLine);
13627
+ }
13628
+ if (mean) {
13629
+ textLines.push(`Mean: ${utilities_roundNumber(mean)} ${modalityUnit}`);
13630
+ }
13631
+ if (max) {
13632
+ textLines.push(`Max: ${utilities_roundNumber(max)} ${modalityUnit}`);
13633
+ }
13634
+ if (stdDev) {
13635
+ textLines.push(`Std Dev: ${utilities_roundNumber(stdDev)} ${modalityUnit}`);
13636
+ }
13637
+ return textLines;
13638
+ }
13572
13639
  EllipticalROITool.toolName = 'EllipticalROI';
13573
13640
  /* harmony default export */ const annotation_EllipticalROITool = (EllipticalROITool);
13574
13641
 
@@ -13628,6 +13695,7 @@ function getCanvasCircleCorners(circleCanvasPoints) {
13628
13695
 
13629
13696
 
13630
13697
 
13698
+
13631
13699
 
13632
13700
 
13633
13701
  const { transformWorldToIndex: CircleROITool_transformWorldToIndex } = esm.utilities;
@@ -13638,6 +13706,8 @@ class CircleROITool extends base_AnnotationTool {
13638
13706
  shadow: true,
13639
13707
  preventHandleOutsideImage: false,
13640
13708
  centerPointRadius: 0,
13709
+ getTextLines: CircleROITool_defaultGetTextLines,
13710
+ statsCalculator: BasicStatsCalculator,
13641
13711
  },
13642
13712
  }) {
13643
13713
  super(toolProps, defaultToolProps);
@@ -14038,7 +14108,7 @@ class CircleROITool extends base_AnnotationTool {
14038
14108
  }
14039
14109
  }
14040
14110
  renderStatus = true;
14041
- const textLines = this._getTextLines(data, targetId);
14111
+ const textLines = this.configuration.getTextLines(data, targetId);
14042
14112
  if (!textLines || textLines.length === 0) {
14043
14113
  continue;
14044
14114
  }
@@ -14061,33 +14131,6 @@ class CircleROITool extends base_AnnotationTool {
14061
14131
  }
14062
14132
  return renderStatus;
14063
14133
  };
14064
- this._getTextLines = (data, targetId) => {
14065
- const cachedVolumeStats = data.cachedStats[targetId];
14066
- const { radius, radiusUnit, area, mean, stdDev, max, isEmptyArea, Modality, areaUnit, modalityUnit, } = cachedVolumeStats;
14067
- const textLines = [];
14068
- if (radius) {
14069
- const radiusLine = isEmptyArea
14070
- ? `Radius: Oblique not supported`
14071
- : `Radius: ${utilities_roundNumber(radius)} ${radiusUnit}`;
14072
- textLines.push(radiusLine);
14073
- }
14074
- if (area) {
14075
- const areaLine = isEmptyArea
14076
- ? `Area: Oblique not supported`
14077
- : `Area: ${utilities_roundNumber(area)} ${areaUnit}`;
14078
- textLines.push(areaLine);
14079
- }
14080
- if (mean) {
14081
- textLines.push(`Mean: ${utilities_roundNumber(mean)} ${modalityUnit}`);
14082
- }
14083
- if (max) {
14084
- textLines.push(`Max: ${utilities_roundNumber(max)} ${modalityUnit}`);
14085
- }
14086
- if (stdDev) {
14087
- textLines.push(`Std Dev: ${utilities_roundNumber(stdDev)} ${modalityUnit}`);
14088
- }
14089
- return textLines;
14090
- };
14091
14134
  this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions) => {
14092
14135
  const data = annotation.data;
14093
14136
  const { viewportId, renderingEngineId } = enabledElement;
@@ -14146,33 +14189,17 @@ class CircleROITool extends base_AnnotationTool {
14146
14189
  const area = Math.abs(Math.PI *
14147
14190
  (worldWidth / scale / 2) *
14148
14191
  (worldHeight / aspect / scale / 2));
14149
- let count = 0;
14150
- let mean = 0;
14151
- let stdDev = 0;
14152
- let max = -Infinity;
14153
- const meanMaxCalculator = ({ value: newValue }) => {
14154
- if (newValue > max) {
14155
- max = newValue;
14156
- }
14157
- mean += newValue;
14158
- count += 1;
14159
- };
14160
- pointInShapeCallback(imageData, (pointLPS, pointIJK) => pointInEllipse(ellipseObj, pointLPS), meanMaxCalculator, boundsIJK);
14161
- mean /= count;
14162
- const stdCalculator = ({ value }) => {
14163
- const valueMinusMean = value - mean;
14164
- stdDev += valueMinusMean * valueMinusMean;
14165
- };
14166
- pointInShapeCallback(imageData, (pointLPS, pointIJK) => pointInEllipse(ellipseObj, pointLPS), stdCalculator, boundsIJK);
14167
- stdDev /= count;
14168
- stdDev = Math.sqrt(stdDev);
14169
14192
  const modalityUnit = getModalityUnit(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
14193
+ const pointsInShape = pointInShapeCallback(imageData, (pointLPS, pointIJK) => pointInEllipse(ellipseObj, pointLPS), this.configuration.statsCalculator.statsCallback, boundsIJK);
14194
+ const stats = this.configuration.statsCalculator.getStatistics();
14170
14195
  cachedStats[targetId] = {
14171
14196
  Modality: metadata.Modality,
14172
14197
  area,
14173
- mean,
14174
- max,
14175
- stdDev,
14198
+ mean: stats[1]?.value,
14199
+ max: stats[0]?.value,
14200
+ stdDev: stats[2]?.value,
14201
+ statsArray: stats,
14202
+ pointsInShape: pointsInShape,
14176
14203
  isEmptyArea,
14177
14204
  areaUnit: getCalibratedAreaUnits(null, image),
14178
14205
  radius: worldWidth / 2 / scale,
@@ -14205,6 +14232,33 @@ class CircleROITool extends base_AnnotationTool {
14205
14232
  this._throttledCalculateCachedStats = utilities_throttle(this._calculateCachedStats, 100, { trailing: true });
14206
14233
  }
14207
14234
  }
14235
+ function CircleROITool_defaultGetTextLines(data, targetId) {
14236
+ const cachedVolumeStats = data.cachedStats[targetId];
14237
+ const { radius, radiusUnit, area, mean, stdDev, max, isEmptyArea, Modality, areaUnit, modalityUnit, } = cachedVolumeStats;
14238
+ const textLines = [];
14239
+ if (radius) {
14240
+ const radiusLine = isEmptyArea
14241
+ ? `Radius: Oblique not supported`
14242
+ : `Radius: ${utilities_roundNumber(radius)} ${radiusUnit}`;
14243
+ textLines.push(radiusLine);
14244
+ }
14245
+ if (area) {
14246
+ const areaLine = isEmptyArea
14247
+ ? `Area: Oblique not supported`
14248
+ : `Area: ${utilities_roundNumber(area)} ${areaUnit}`;
14249
+ textLines.push(areaLine);
14250
+ }
14251
+ if (mean) {
14252
+ textLines.push(`Mean: ${utilities_roundNumber(mean)} ${modalityUnit}`);
14253
+ }
14254
+ if (max) {
14255
+ textLines.push(`Max: ${utilities_roundNumber(max)} ${modalityUnit}`);
14256
+ }
14257
+ if (stdDev) {
14258
+ textLines.push(`Std Dev: ${utilities_roundNumber(stdDev)} ${modalityUnit}`);
14259
+ }
14260
+ return textLines;
14261
+ }
14208
14262
  CircleROITool.toolName = 'CircleROI';
14209
14263
  /* harmony default export */ const annotation_CircleROITool = (CircleROITool);
14210
14264
 
@@ -14545,6 +14599,7 @@ function calculateAreaOfPoints(points) {
14545
14599
 
14546
14600
 
14547
14601
 
14602
+
14548
14603
  // EXTERNAL MODULE: ../../../node_modules/d3-interpolate/src/index.js + 31 modules
14549
14604
  var src = __webpack_require__(22791);
14550
14605
  // EXTERNAL MODULE: ../../../node_modules/d3-array/src/index.js + 61 modules
@@ -15947,6 +16002,7 @@ function registerRenderMethods(toolInstance) {
15947
16002
 
15948
16003
 
15949
16004
 
16005
+
15950
16006
 
15951
16007
 
15952
16008
  const { pointCanProjectOnLine: PlanarFreehandROITool_pointCanProjectOnLine } = polyline_namespaceObject;
@@ -15973,6 +16029,8 @@ class PlanarFreehandROITool extends base_AnnotationTool {
15973
16029
  knotsRatioPercentageOnEdit: 40,
15974
16030
  },
15975
16031
  calculateStats: false,
16032
+ getTextLines: PlanarFreehandROITool_defaultGetTextLines,
16033
+ statsCalculator: BasicStatsCalculator,
15976
16034
  },
15977
16035
  }) {
15978
16036
  super(toolProps, defaultToolProps);
@@ -16230,22 +16288,10 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16230
16288
  ];
16231
16289
  const worldPosEnd = imageData.indexToWorld([iMax, jMax, kMax]);
16232
16290
  const canvasPosEnd = viewport.worldToCanvas(worldPosEnd);
16233
- let count = 0;
16234
- let sum = 0;
16235
- let sumSquares = 0;
16236
- let max = -Infinity;
16237
- const statCalculator = ({ value: newValue }) => {
16238
- if (newValue > max) {
16239
- max = newValue;
16240
- }
16241
- sum += newValue;
16242
- sumSquares += newValue ** 2;
16243
- count += 1;
16244
- };
16245
16291
  let curRow = 0;
16246
16292
  let intersections = [];
16247
16293
  let intersectionCounter = 0;
16248
- pointInShapeCallback(imageData, (pointLPS, pointIJK) => {
16294
+ const pointsInShape = pointInShapeCallback(imageData, (pointLPS, pointIJK) => {
16249
16295
  let result = true;
16250
16296
  const point = viewport.worldToCanvas(pointLPS);
16251
16297
  if (point[1] != curRow) {
@@ -16270,17 +16316,17 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16270
16316
  result = false;
16271
16317
  }
16272
16318
  return result;
16273
- }, statCalculator, boundsIJK);
16274
- const mean = sum / count;
16275
- let stdDev = sumSquares / count - mean ** 2;
16276
- stdDev = Math.sqrt(stdDev);
16319
+ }, this.configuration.statsCalculator.statsCallback, boundsIJK);
16277
16320
  const modalityUnit = getModalityUnit(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
16321
+ const stats = this.configuration.statsCalculator.getStatistics();
16278
16322
  cachedStats[targetId] = {
16279
16323
  Modality: metadata.Modality,
16280
16324
  area,
16281
- mean,
16282
- max,
16283
- stdDev,
16325
+ mean: stats[1]?.value,
16326
+ max: stats[0]?.value,
16327
+ stdDev: stats[3]?.value,
16328
+ statsArray: stats,
16329
+ pointsInShape: pointsInShape,
16284
16330
  areaUnit: getCalibratedAreaUnits(null, image),
16285
16331
  modalityUnit,
16286
16332
  };
@@ -16292,7 +16338,7 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16292
16338
  this._renderStats = (annotation, viewport, enabledElement, svgDrawingHelper) => {
16293
16339
  const data = annotation.data;
16294
16340
  const targetId = this.getTargetId(viewport);
16295
- const textLines = this._getTextLines(data, targetId);
16341
+ const textLines = this.configuration.getTextLines(data, targetId);
16296
16342
  if (!textLines || textLines.length === 0) {
16297
16343
  return;
16298
16344
  }
@@ -16318,27 +16364,6 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16318
16364
  bottomRight: viewport.canvasToWorld([left + width, top + height]),
16319
16365
  };
16320
16366
  };
16321
- this._getTextLines = (data, targetId) => {
16322
- const cachedVolumeStats = data.cachedStats[targetId];
16323
- const { area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit } = cachedVolumeStats;
16324
- const textLines = [];
16325
- if (area) {
16326
- const areaLine = isEmptyArea
16327
- ? `Area: Oblique not supported`
16328
- : `Area: ${utilities_roundNumber(area)} ${areaUnit}`;
16329
- textLines.push(areaLine);
16330
- }
16331
- if (mean) {
16332
- textLines.push(`Mean: ${utilities_roundNumber(mean)} ${modalityUnit}`);
16333
- }
16334
- if (max) {
16335
- textLines.push(`Max: ${utilities_roundNumber(max)} ${modalityUnit}`);
16336
- }
16337
- if (stdDev) {
16338
- textLines.push(`Std Dev: ${utilities_roundNumber(stdDev)} ${modalityUnit}`);
16339
- }
16340
- return textLines;
16341
- };
16342
16367
  drawLoop(this);
16343
16368
  editLoopCommon(this);
16344
16369
  closedContourEditLoop(this);
@@ -16397,6 +16422,27 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16397
16422
  return annotationsWithinSlice;
16398
16423
  }
16399
16424
  }
16425
+ function PlanarFreehandROITool_defaultGetTextLines(data, targetId) {
16426
+ const cachedVolumeStats = data.cachedStats[targetId];
16427
+ const { area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit } = cachedVolumeStats;
16428
+ const textLines = [];
16429
+ if (area) {
16430
+ const areaLine = isEmptyArea
16431
+ ? `Area: Oblique not supported`
16432
+ : `Area: ${utilities_roundNumber(area)} ${areaUnit}`;
16433
+ textLines.push(areaLine);
16434
+ }
16435
+ if (mean) {
16436
+ textLines.push(`Mean: ${utilities_roundNumber(mean)} ${modalityUnit}`);
16437
+ }
16438
+ if (max) {
16439
+ textLines.push(`Max: ${utilities_roundNumber(max)} ${modalityUnit}`);
16440
+ }
16441
+ if (stdDev) {
16442
+ textLines.push(`Std Dev: ${utilities_roundNumber(stdDev)} ${modalityUnit}`);
16443
+ }
16444
+ return textLines;
16445
+ }
16400
16446
  PlanarFreehandROITool.toolName = 'PlanarFreehandROI';
16401
16447
  /* harmony default export */ const annotation_PlanarFreehandROITool = (PlanarFreehandROITool);
16402
16448
 
@@ -16850,6 +16896,7 @@ class AngleTool extends base_AnnotationTool {
16850
16896
  configuration: {
16851
16897
  shadow: true,
16852
16898
  preventHandleOutsideImage: false,
16899
+ getTextLines: AngleTool_defaultGetTextLines,
16853
16900
  },
16854
16901
  }) {
16855
16902
  super(toolProps, defaultToolProps);
@@ -17180,7 +17227,7 @@ class AngleTool extends base_AnnotationTool {
17180
17227
  if (!data.cachedStats[targetId]?.angle) {
17181
17228
  continue;
17182
17229
  }
17183
- const textLines = this._getTextLines(data, targetId);
17230
+ const textLines = this.configuration.getTextLines(data, targetId);
17184
17231
  if (!data.handles.textBox.hasMoved) {
17185
17232
  const canvasTextBoxCoords = canvasCoordinates[1];
17186
17233
  data.handles.textBox.worldPosition =
@@ -17228,15 +17275,6 @@ class AngleTool extends base_AnnotationTool {
17228
17275
  utilities_triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
17229
17276
  evt.preventDefault();
17230
17277
  }
17231
- _getTextLines(data, targetId) {
17232
- const cachedVolumeStats = data.cachedStats[targetId];
17233
- const { angle } = cachedVolumeStats;
17234
- if (angle === undefined) {
17235
- return;
17236
- }
17237
- const textLines = [`${utilities_roundNumber(angle)} ${String.fromCharCode(176)}`];
17238
- return textLines;
17239
- }
17240
17278
  _calculateCachedStats(annotation, renderingEngine, enabledElement) {
17241
17279
  const data = annotation.data;
17242
17280
  const { viewportId, renderingEngineId } = enabledElement;
@@ -17266,6 +17304,15 @@ class AngleTool extends base_AnnotationTool {
17266
17304
  return cachedStats;
17267
17305
  }
17268
17306
  }
17307
+ function AngleTool_defaultGetTextLines(data, targetId) {
17308
+ const cachedVolumeStats = data.cachedStats[targetId];
17309
+ const { angle } = cachedVolumeStats;
17310
+ if (angle === undefined) {
17311
+ return;
17312
+ }
17313
+ const textLines = [`${utilities_roundNumber(angle)} ${String.fromCharCode(176)}`];
17314
+ return textLines;
17315
+ }
17269
17316
  AngleTool.toolName = 'Angle';
17270
17317
  /* harmony default export */ const annotation_AngleTool = (AngleTool);
17271
17318
 
@@ -17309,6 +17356,7 @@ class CobbAngleTool extends base_AnnotationTool {
17309
17356
  configuration: {
17310
17357
  shadow: true,
17311
17358
  preventHandleOutsideImage: false,
17359
+ getTextLines: CobbAngleTool_defaultGetTextLines,
17312
17360
  },
17313
17361
  }) {
17314
17362
  super(toolProps, defaultToolProps);
@@ -17659,7 +17707,7 @@ class CobbAngleTool extends base_AnnotationTool {
17659
17707
  if (!data.cachedStats[targetId]?.angle) {
17660
17708
  continue;
17661
17709
  }
17662
- const textLines = this._getTextLines(data, targetId);
17710
+ const textLines = this.configuration.getTextLines(data, targetId);
17663
17711
  if (!data.handles.textBox.hasMoved) {
17664
17712
  const canvasTextBoxCoords = getTextBoxCoordsCanvas(canvasCoordinates);
17665
17713
  data.handles.textBox.worldPosition =
@@ -17707,15 +17755,6 @@ class CobbAngleTool extends base_AnnotationTool {
17707
17755
  utilities_triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
17708
17756
  evt.preventDefault();
17709
17757
  }
17710
- _getTextLines(data, targetId) {
17711
- const cachedVolumeStats = data.cachedStats[targetId];
17712
- const { angle } = cachedVolumeStats;
17713
- if (angle === undefined) {
17714
- return;
17715
- }
17716
- const textLines = [`${angle.toFixed(2)} ${String.fromCharCode(176)}`];
17717
- return textLines;
17718
- }
17719
17758
  _calculateCachedStats(annotation, renderingEngine, enabledElement) {
17720
17759
  const data = annotation.data;
17721
17760
  const { viewportId, renderingEngineId } = enabledElement;
@@ -17757,6 +17796,15 @@ class CobbAngleTool extends base_AnnotationTool {
17757
17796
  return cachedStats;
17758
17797
  }
17759
17798
  }
17799
+ function CobbAngleTool_defaultGetTextLines(data, targetId) {
17800
+ const cachedVolumeStats = data.cachedStats[targetId];
17801
+ const { angle } = cachedVolumeStats;
17802
+ if (angle === undefined) {
17803
+ return;
17804
+ }
17805
+ const textLines = [`${angle.toFixed(2)} ${String.fromCharCode(176)}`];
17806
+ return textLines;
17807
+ }
17760
17808
  CobbAngleTool.toolName = 'CobbAngle';
17761
17809
  /* harmony default export */ const annotation_CobbAngleTool = (CobbAngleTool);
17762
17810