@ohif/app 3.7.0-beta.4 → 3.7.0-beta.40

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 (41) hide show
  1. package/dist/{192.bundle.a692060cb8ee9076ddee.js → 192.bundle.b2863bbbf41f16203af7.js} +4 -4
  2. package/dist/{199.bundle.69d1b0419e63f5546281.js → 199.bundle.af3f8b331f3b030fe4b1.js} +2 -7
  3. package/dist/{208.bundle.9123fc7f84b459723777.js → 208.bundle.a27d931468daecfff934.js} +4 -4
  4. package/dist/{270.bundle.4564621556b0f963a004.js → 270.bundle.2d215f8720350f03e171.js} +133 -122
  5. package/dist/{283.bundle.326b6ad7c2dc105fd0b8.js → 283.bundle.76f6d48710f450ccd0f3.js} +58 -33
  6. package/dist/{331.bundle.bd0c13931a21d53086c9.js → 389.bundle.38df7e54d2f632cfa7a0.js} +123 -74
  7. package/dist/{404.bundle.0de1e82fef0a0cd2c34e.js → 404.bundle.02cea2f3b08cdbe8ceee.js} +9 -16
  8. package/dist/{351.bundle.da314e071dcf5e888085.js → 468.bundle.84576e0c0e8a7bdcfb90.js} +117 -85
  9. package/dist/{55.bundle.5f5e5ef9087b0beee35c.js → 55.bundle.fe53f3784bfe7db4a5a5.js} +6 -6
  10. package/dist/{569.bundle.0ed8d8178ffd43fe1c34.js → 569.bundle.e77c17d37a65e5dedfed.js} +23 -12
  11. package/dist/{581.bundle.360d26f97b37da8faec3.js → 581.bundle.15078e71fe52b53f48b3.js} +7 -6
  12. package/dist/{616.bundle.3f5157b8b6911d95e8ec.js → 616.bundle.b159e7f111ada286d862.js} +6 -6
  13. package/dist/{707.bundle.fec5dc4210086c7f617d.js → 625.bundle.7e4bece1b4ef5dc300a8.js} +79 -105
  14. package/dist/{642.bundle.478ce6f500f977507924.js → 642.bundle.ac0c06c27fc4366de343.js} +2 -2
  15. package/dist/{728.bundle.d13856835357400fef82.js → 728.bundle.5bef7c8643b42d70a79f.js} +11 -10
  16. package/dist/{744.bundle.bbf06d38d4e6cc5127a1.js → 744.bundle.0be683bc1498cc0d89ef.js} +64 -91
  17. package/dist/{790.bundle.45eaa69aab86f0048f1c.js → 790.bundle.18db48c8d89ce04e57bc.js} +4 -4
  18. package/dist/{799.bundle.ca18bdf4abe4d9abea26.js → 799.bundle.d8e50f1fd6bf4fa3a5e1.js} +56 -8
  19. package/dist/{82.bundle.579b84883e04e040cc03.js → 82.bundle.9affd6d9fbce4d32e826.js} +143 -112
  20. package/dist/{917.bundle.c88ce40fac58f95c68d1.js → 917.bundle.cba9223eb2a6dfea6066.js} +2 -2
  21. package/dist/945.min.worker.js +1 -1
  22. package/dist/945.min.worker.js.map +1 -1
  23. package/dist/{953.bundle.9e3a7225f07336bfcb41.js → 953.bundle.95b0621f1da8dfeaed8a.js} +4 -3
  24. package/dist/{973.bundle.7e3f2870f5ae0400fa85.js → 973.bundle.fa8a13ecc41ff54fb82b.js} +2 -2
  25. package/dist/{976.bundle.45373bcb38773e2c10c9.js → 976.bundle.19dac9a84b453d2c4dbb.js} +7 -7
  26. package/dist/{984.bundle.ed28bde89cb27e6ae9cd.js → 984.bundle.3623bc3bc26748a21d00.js} +9 -9
  27. package/dist/app-config.js +7 -7
  28. package/dist/{app.bundle.976f90a2d39df9f3146e.js → app.bundle.6987d8f46ddf4345d40a.js} +1483 -739
  29. package/dist/app.bundle.css +1 -1
  30. package/dist/cornerstoneDICOMImageLoader.min.js +1 -1
  31. package/dist/cornerstoneDICOMImageLoader.min.js.map +1 -1
  32. package/dist/google.js +6 -5
  33. package/dist/index.html +1 -1
  34. package/dist/{index.worker.1c69152d710fa7b84bce.worker.js → index.worker.17eee78bdafa44cbb47d.worker.js} +2 -2
  35. package/dist/index.worker.17eee78bdafa44cbb47d.worker.js.map +1 -0
  36. package/dist/sw.js +1 -1
  37. package/package.json +19 -19
  38. package/dist/index.worker.1c69152d710fa7b84bce.worker.js.map +0 -1
  39. /package/dist/{351.css → 468.css} +0 -0
  40. /package/dist/{50.bundle.222e93034cacb51bee8b.js → 50.bundle.7def59ad0bc69d63790b.js} +0 -0
  41. /package/dist/{707.css → 625.css} +0 -0
@@ -578,8 +578,8 @@ __webpack_require__.d(synchronizers_namespaceObject, {
578
578
  var types_namespaceObject = {};
579
579
  __webpack_require__.r(types_namespaceObject);
580
580
 
581
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 335 modules
582
- var esm = __webpack_require__(77331);
581
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 336 modules
582
+ var esm = __webpack_require__(58389);
583
583
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/enums/ToolBindings.js
584
584
  var MouseBindings;
585
585
  (function (MouseBindings) {
@@ -5561,7 +5561,7 @@ class AnnotationTool extends base_AnnotationDisplayTool {
5561
5561
  if (viewport instanceof esm.BaseVolumeViewport) {
5562
5562
  const volumeId = targetId.split('volumeId:')[1];
5563
5563
  const volume = esm.cache.getVolume(volumeId);
5564
- return volume.scaling?.PET !== undefined;
5564
+ return volume.scaling?.PT !== undefined;
5565
5565
  }
5566
5566
  else if (viewport instanceof esm.StackViewport) {
5567
5567
  const scalingModule = imageId && esm.metaData.get('scalingModule', imageId);
@@ -8483,6 +8483,7 @@ function _applyShift(viewport, delta) {
8483
8483
 
8484
8484
 
8485
8485
 
8486
+
8486
8487
  class MIPJumpToClickTool extends base_BaseTool {
8487
8488
  constructor(toolProps = {}, defaultToolProps = {
8488
8489
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -8512,9 +8513,16 @@ class MIPJumpToClickTool extends base_BaseTool {
8512
8513
  if (!brightestPoint || !brightestPoint.length) {
8513
8514
  return;
8514
8515
  }
8515
- const { targetViewportIds } = this.configuration;
8516
- targetViewportIds.forEach((viewportId) => {
8517
- const viewport = renderingEngine.getViewport(viewportId);
8516
+ const { targetViewportIds, toolGroupId } = this.configuration;
8517
+ const viewports = renderingEngine.getViewports().filter((vp) => {
8518
+ if (targetViewportIds?.indexOf(vp.id) >= 0)
8519
+ return true;
8520
+ const foundToolGroup = ToolGroupManager_getToolGroupForViewport(vp.id, renderingEngine.id);
8521
+ if (toolGroupId && toolGroupId === foundToolGroup?.id)
8522
+ return true;
8523
+ return false;
8524
+ });
8525
+ viewports.forEach((viewport) => {
8518
8526
  if (viewport instanceof esm.VolumeViewport) {
8519
8527
  jumpToWorld(viewport, brightestPoint);
8520
8528
  }
@@ -11664,19 +11672,28 @@ LengthTool.toolName = 'Length';
11664
11672
  /* harmony default export */ const annotation_LengthTool = (LengthTool);
11665
11673
  //# sourceMappingURL=LengthTool.js.map
11666
11674
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/getModalityUnit.js
11667
- function getModalityUnit(modality, isPreScaled, isSuvScaled) {
11675
+
11676
+ function getModalityUnit(modality, imageId, options) {
11668
11677
  if (modality === 'CT') {
11669
11678
  return 'HU';
11670
11679
  }
11671
- else if (modality === 'PT' &&
11672
- isPreScaled === true &&
11673
- isSuvScaled === true) {
11674
- return 'SUV';
11680
+ else if (modality === 'PT') {
11681
+ return _handlePTModality(imageId, options);
11675
11682
  }
11676
11683
  else {
11677
11684
  return '';
11678
11685
  }
11679
11686
  }
11687
+ function _handlePTModality(imageId, options) {
11688
+ if (!options.isPreScaled) {
11689
+ return 'raw';
11690
+ }
11691
+ if (options.isSuvScaled) {
11692
+ return 'SUV';
11693
+ }
11694
+ const petSeriesModule = esm.metaData.get('petSeriesModule', imageId);
11695
+ return petSeriesModule?.units || 'unitless';
11696
+ }
11680
11697
 
11681
11698
  //# sourceMappingURL=getModalityUnit.js.map
11682
11699
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/viewport/isViewportPreScaled.js
@@ -11869,16 +11886,20 @@ class ProbeTool extends base_AnnotationTool {
11869
11886
  const canvasCoordinates = viewport.worldToCanvas(point);
11870
11887
  styleSpecifier.annotationUID = annotationUID;
11871
11888
  const color = this.getStyle('color', styleSpecifier, annotation);
11889
+ const modalityUnitOptions = {
11890
+ isPreScaled: isViewportPreScaled(viewport, targetId),
11891
+ isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
11892
+ };
11872
11893
  if (!data.cachedStats[targetId]) {
11873
11894
  data.cachedStats[targetId] = {
11874
11895
  Modality: null,
11875
11896
  index: null,
11876
11897
  value: null,
11877
11898
  };
11878
- this._calculateCachedStats(annotation, renderingEngine, enabledElement);
11899
+ this._calculateCachedStats(annotation, renderingEngine, enabledElement, modalityUnitOptions);
11879
11900
  }
11880
11901
  else if (annotation.invalidated) {
11881
- this._calculateCachedStats(annotation, renderingEngine, enabledElement);
11902
+ this._calculateCachedStats(annotation, renderingEngine, enabledElement, modalityUnitOptions);
11882
11903
  if (viewport instanceof esm.VolumeViewport) {
11883
11904
  const { referencedImageId } = annotation.metadata;
11884
11905
  for (const targetId in data.cachedStats) {
@@ -11904,9 +11925,7 @@ class ProbeTool extends base_AnnotationTool {
11904
11925
  const handleGroupUID = '0';
11905
11926
  drawingSvg_drawHandles(svgDrawingHelper, annotationUID, handleGroupUID, [canvasCoordinates], { color });
11906
11927
  renderStatus = true;
11907
- const isPreScaled = isViewportPreScaled(viewport, targetId);
11908
- const isSuvScaled = this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId);
11909
- const textLines = this._getTextLines(data, targetId, isPreScaled, isSuvScaled);
11928
+ const textLines = this._getTextLines(data, targetId);
11910
11929
  if (textLines) {
11911
11930
  const textCanvasCoordinates = [
11912
11931
  canvasCoordinates[0] + 6,
@@ -11950,50 +11969,18 @@ class ProbeTool extends base_AnnotationTool {
11950
11969
  utilities_triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
11951
11970
  evt.preventDefault();
11952
11971
  }
11953
- _getTextLines(data, targetId, isPreScaled, isSuvScaled) {
11972
+ _getTextLines(data, targetId) {
11954
11973
  const cachedVolumeStats = data.cachedStats[targetId];
11955
- const { index, Modality, value, SUVBw, SUVLbm, SUVBsa } = cachedVolumeStats;
11956
- if (value === undefined && SUVBw === undefined) {
11974
+ const { index, value, modalityUnit } = cachedVolumeStats;
11975
+ if (value === undefined) {
11957
11976
  return;
11958
11977
  }
11959
11978
  const textLines = [];
11960
- const unit = getModalityUnit(Modality, isPreScaled, isSuvScaled);
11961
11979
  textLines.push(`(${index[0]}, ${index[1]}, ${index[2]})`);
11962
- if (Modality === 'PT' && isPreScaled === true && SUVBw !== undefined) {
11963
- textLines.push(`${SUVBw.toFixed(2)} SUV bw`);
11964
- if (SUVLbm) {
11965
- textLines.push(`${SUVLbm.toFixed(2)} SUV lbm`);
11966
- }
11967
- if (SUVBsa) {
11968
- textLines.push(`${SUVBsa.toFixed(2)} SUV bsa`);
11969
- }
11970
- }
11971
- else {
11972
- textLines.push(`${value.toFixed(2)} ${unit}`);
11973
- }
11980
+ textLines.push(`${value.toFixed(2)} ${modalityUnit}`);
11974
11981
  return textLines;
11975
11982
  }
11976
- _getValueForModality(value, imageVolume, modality) {
11977
- const values = {};
11978
- values['value'] = value;
11979
- if (modality === 'PT' &&
11980
- imageVolume.scaling?.PET &&
11981
- (imageVolume.scaling.PET.suvbwToSuvbsa ||
11982
- imageVolume.scaling.PET.suvbwToSuvlbm)) {
11983
- const { suvbwToSuvlbm, suvbwToSuvbsa } = imageVolume.scaling.PET;
11984
- values['SUVBw'] = value;
11985
- if (suvbwToSuvlbm) {
11986
- const SUVLbm = value * suvbwToSuvlbm;
11987
- values['SUVLbm'] = SUVLbm;
11988
- }
11989
- if (suvbwToSuvbsa) {
11990
- const SUVBsa = value * suvbwToSuvbsa;
11991
- values['SUVBsa'] = SUVBsa;
11992
- }
11993
- }
11994
- return values;
11995
- }
11996
- _calculateCachedStats(annotation, renderingEngine, enabledElement) {
11983
+ _calculateCachedStats(annotation, renderingEngine, enabledElement, modalityUnitOptions) {
11997
11984
  const data = annotation.data;
11998
11985
  const { viewportId, renderingEngineId } = enabledElement;
11999
11986
  const worldPos = data.handles.points[0];
@@ -12024,11 +12011,12 @@ class ProbeTool extends base_AnnotationTool {
12024
12011
  const viewport = viewports[0];
12025
12012
  index[2] = viewport.getCurrentImageIdIndex();
12026
12013
  }
12027
- const values = this._getValueForModality(value, image, modality);
12014
+ const modalityUnit = getModalityUnit(modality, annotation.metadata.referencedImageId, modalityUnitOptions);
12028
12015
  cachedStats[targetId] = {
12029
12016
  index,
12030
- ...values,
12017
+ value,
12031
12018
  Modality: modality,
12019
+ modalityUnit,
12032
12020
  };
12033
12021
  }
12034
12022
  else {
@@ -12136,16 +12124,20 @@ class DragProbeTool extends annotation_ProbeTool {
12136
12124
  const canvasCoordinates = viewport.worldToCanvas(point);
12137
12125
  styleSpecifier.annotationUID = annotationUID;
12138
12126
  const color = this.getStyle('color', styleSpecifier, annotation);
12127
+ const modalityUnitOptions = {
12128
+ isPreScaled: isViewportPreScaled(viewport, targetId),
12129
+ isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
12130
+ };
12139
12131
  if (!data.cachedStats[targetId]) {
12140
12132
  data.cachedStats[targetId] = {
12141
12133
  Modality: null,
12142
12134
  index: null,
12143
12135
  value: null,
12144
12136
  };
12145
- this._calculateCachedStats(annotation, renderingEngine, enabledElement);
12137
+ this._calculateCachedStats(annotation, renderingEngine, enabledElement, modalityUnitOptions);
12146
12138
  }
12147
12139
  else if (annotation.invalidated) {
12148
- this._calculateCachedStats(annotation, renderingEngine, enabledElement);
12140
+ this._calculateCachedStats(annotation, renderingEngine, enabledElement, modalityUnitOptions);
12149
12141
  }
12150
12142
  if (!viewport.getRenderingEngine()) {
12151
12143
  console.warn('Rendering Engine has been destroyed');
@@ -12154,9 +12146,7 @@ class DragProbeTool extends annotation_ProbeTool {
12154
12146
  const handleGroupUID = '0';
12155
12147
  drawingSvg_drawHandles(svgDrawingHelper, annotationUID, handleGroupUID, [canvasCoordinates], { color });
12156
12148
  renderStatus = true;
12157
- const isPreScaled = isViewportPreScaled(viewport, targetId);
12158
- const isSuvScaled = this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId);
12159
- const textLines = this._getTextLines(data, targetId, isPreScaled, isSuvScaled);
12149
+ const textLines = this._getTextLines(data, targetId);
12160
12150
  if (textLines) {
12161
12151
  const textCanvasCoordinates = [
12162
12152
  canvasCoordinates[0] + 6,
@@ -12571,6 +12561,10 @@ class RectangleROITool extends base_AnnotationTool {
12571
12561
  const lineDash = this.getStyle('lineDash', styleSpecifier, annotation);
12572
12562
  const color = this.getStyle('color', styleSpecifier, annotation);
12573
12563
  const { viewPlaneNormal, viewUp } = viewport.getCamera();
12564
+ const modalityUnitOptions = {
12565
+ isPreScaled: isViewportPreScaled(viewport, targetId),
12566
+ isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
12567
+ };
12574
12568
  if (!data.cachedStats[targetId] ||
12575
12569
  data.cachedStats[targetId].areaUnit === undefined) {
12576
12570
  data.cachedStats[targetId] = {
@@ -12581,10 +12575,10 @@ class RectangleROITool extends base_AnnotationTool {
12581
12575
  stdDev: null,
12582
12576
  areaUnit: null,
12583
12577
  };
12584
- this._calculateCachedStats(annotation, viewPlaneNormal, viewUp, renderingEngine, enabledElement);
12578
+ this._calculateCachedStats(annotation, viewPlaneNormal, viewUp, renderingEngine, enabledElement, modalityUnitOptions);
12585
12579
  }
12586
12580
  else if (annotation.invalidated) {
12587
- this._throttledCalculateCachedStats(annotation, viewPlaneNormal, viewUp, renderingEngine, enabledElement);
12581
+ this._throttledCalculateCachedStats(annotation, viewPlaneNormal, viewUp, renderingEngine, enabledElement, modalityUnitOptions);
12588
12582
  if (viewport instanceof esm.VolumeViewport) {
12589
12583
  const { referencedImageId } = annotation.metadata;
12590
12584
  for (const targetId in data.cachedStats) {
@@ -12630,9 +12624,7 @@ class RectangleROITool extends base_AnnotationTool {
12630
12624
  lineWidth,
12631
12625
  }, dataId);
12632
12626
  renderStatus = true;
12633
- const isPreScaled = isViewportPreScaled(viewport, targetId);
12634
- const isSuvScaled = this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId);
12635
- const textLines = this._getTextLines(data, targetId, isPreScaled, isSuvScaled);
12627
+ const textLines = this._getTextLines(data, targetId);
12636
12628
  if (!textLines || textLines.length === 0) {
12637
12629
  continue;
12638
12630
  }
@@ -12663,21 +12655,20 @@ class RectangleROITool extends base_AnnotationTool {
12663
12655
  height: Math.abs(point0[1] - point1[1]),
12664
12656
  };
12665
12657
  };
12666
- this._getTextLines = (data, targetId, isPreScaled, isSuvScaled) => {
12658
+ this._getTextLines = (data, targetId) => {
12667
12659
  const cachedVolumeStats = data.cachedStats[targetId];
12668
- const { area, mean, max, stdDev, Modality, areaUnit } = cachedVolumeStats;
12660
+ const { area, mean, max, stdDev, areaUnit, modalityUnit } = cachedVolumeStats;
12669
12661
  if (mean === undefined) {
12670
12662
  return;
12671
12663
  }
12672
12664
  const textLines = [];
12673
- const unit = getModalityUnit(Modality, isPreScaled, isSuvScaled);
12674
12665
  textLines.push(`Area: ${area.toFixed(2)} ${areaUnit}\xb2`);
12675
- textLines.push(`Mean: ${mean.toFixed(2)} ${unit}`);
12676
- textLines.push(`Max: ${max.toFixed(2)} ${unit}`);
12677
- textLines.push(`Std Dev: ${stdDev.toFixed(2)} ${unit}`);
12666
+ textLines.push(`Mean: ${mean.toFixed(2)} ${modalityUnit}`);
12667
+ textLines.push(`Max: ${max.toFixed(2)} ${modalityUnit}`);
12668
+ textLines.push(`Std Dev: ${stdDev.toFixed(2)} ${modalityUnit}`);
12678
12669
  return textLines;
12679
12670
  };
12680
- this._calculateCachedStats = (annotation, viewPlaneNormal, viewUp, renderingEngine, enabledElement) => {
12671
+ this._calculateCachedStats = (annotation, viewPlaneNormal, viewUp, renderingEngine, enabledElement, modalityUnitOptions) => {
12681
12672
  const { data } = annotation;
12682
12673
  const { viewportId, renderingEngineId } = enabledElement;
12683
12674
  const worldPos1 = data.handles.points[0];
@@ -12740,6 +12731,7 @@ class RectangleROITool extends base_AnnotationTool {
12740
12731
  }
12741
12732
  stdDev /= count;
12742
12733
  stdDev = Math.sqrt(stdDev);
12734
+ const modalityUnit = getModalityUnit(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
12743
12735
  cachedStats[targetId] = {
12744
12736
  Modality: metadata.Modality,
12745
12737
  area,
@@ -12747,6 +12739,7 @@ class RectangleROITool extends base_AnnotationTool {
12747
12739
  stdDev,
12748
12740
  max,
12749
12741
  areaUnit: hasPixelSpacing ? 'mm' : 'px',
12742
+ modalityUnit,
12750
12743
  };
12751
12744
  }
12752
12745
  else {
@@ -13237,6 +13230,10 @@ class EllipticalROITool extends base_AnnotationTool {
13237
13230
  canvasCorners = (getCanvasEllipseCorners(canvasCoordinates));
13238
13231
  }
13239
13232
  const { centerPointRadius } = this.configuration;
13233
+ const modalityUnitOptions = {
13234
+ isPreScaled: isViewportPreScaled(viewport, targetId),
13235
+ isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
13236
+ };
13240
13237
  if (!data.cachedStats[targetId] ||
13241
13238
  data.cachedStats[targetId].areaUnit === undefined) {
13242
13239
  data.cachedStats[targetId] = {
@@ -13247,10 +13244,10 @@ class EllipticalROITool extends base_AnnotationTool {
13247
13244
  stdDev: null,
13248
13245
  areaUnit: null,
13249
13246
  };
13250
- this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
13247
+ this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions);
13251
13248
  }
13252
13249
  else if (annotation.invalidated) {
13253
- this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
13250
+ this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions);
13254
13251
  if (viewport instanceof esm.VolumeViewport) {
13255
13252
  const { referencedImageId } = annotation.metadata;
13256
13253
  for (const targetId in data.cachedStats) {
@@ -13307,9 +13304,7 @@ class EllipticalROITool extends base_AnnotationTool {
13307
13304
  }
13308
13305
  }
13309
13306
  renderStatus = true;
13310
- const isPreScaled = isViewportPreScaled(viewport, targetId);
13311
- const isSuvScaled = this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId);
13312
- const textLines = this._getTextLines(data, targetId, isPreScaled, isSuvScaled);
13307
+ const textLines = this._getTextLines(data, targetId);
13313
13308
  if (!textLines || textLines.length === 0) {
13314
13309
  continue;
13315
13310
  }
@@ -13332,11 +13327,10 @@ class EllipticalROITool extends base_AnnotationTool {
13332
13327
  }
13333
13328
  return renderStatus;
13334
13329
  };
13335
- this._getTextLines = (data, targetId, isPreScaled, isSuvScaled) => {
13330
+ this._getTextLines = (data, targetId) => {
13336
13331
  const cachedVolumeStats = data.cachedStats[targetId];
13337
- const { area, mean, stdDev, max, isEmptyArea, Modality, areaUnit } = cachedVolumeStats;
13332
+ const { area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit } = cachedVolumeStats;
13338
13333
  const textLines = [];
13339
- const unit = getModalityUnit(Modality, isPreScaled, isSuvScaled);
13340
13334
  if (area) {
13341
13335
  const areaLine = isEmptyArea
13342
13336
  ? `Area: Oblique not supported`
@@ -13344,17 +13338,17 @@ class EllipticalROITool extends base_AnnotationTool {
13344
13338
  textLines.push(areaLine);
13345
13339
  }
13346
13340
  if (mean) {
13347
- textLines.push(`Mean: ${mean.toFixed(2)} ${unit}`);
13341
+ textLines.push(`Mean: ${mean.toFixed(2)} ${modalityUnit}`);
13348
13342
  }
13349
13343
  if (max) {
13350
- textLines.push(`Max: ${max.toFixed(2)} ${unit}`);
13344
+ textLines.push(`Max: ${max.toFixed(2)} ${modalityUnit}`);
13351
13345
  }
13352
13346
  if (stdDev) {
13353
- textLines.push(`Std Dev: ${stdDev.toFixed(2)} ${unit}`);
13347
+ textLines.push(`Std Dev: ${stdDev.toFixed(2)} ${modalityUnit}`);
13354
13348
  }
13355
13349
  return textLines;
13356
13350
  };
13357
- this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement) => {
13351
+ this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions) => {
13358
13352
  const data = annotation.data;
13359
13353
  const { viewportId, renderingEngineId } = enabledElement;
13360
13354
  const { points } = data.handles;
@@ -13428,6 +13422,7 @@ class EllipticalROITool extends base_AnnotationTool {
13428
13422
  pointInShapeCallback(imageData, (pointLPS, pointIJK) => pointInEllipse(ellipseObj, pointLPS), stdCalculator, boundsIJK);
13429
13423
  stdDev /= count;
13430
13424
  stdDev = Math.sqrt(stdDev);
13425
+ const modalityUnit = getModalityUnit(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
13431
13426
  cachedStats[targetId] = {
13432
13427
  Modality: metadata.Modality,
13433
13428
  area,
@@ -13436,6 +13431,7 @@ class EllipticalROITool extends base_AnnotationTool {
13436
13431
  stdDev,
13437
13432
  isEmptyArea,
13438
13433
  areaUnit: hasPixelSpacing ? 'mm' : 'px',
13434
+ modalityUnit,
13439
13435
  };
13440
13436
  }
13441
13437
  else {
@@ -13875,6 +13871,10 @@ class CircleROITool extends base_AnnotationTool {
13875
13871
  const radius = getCanvasCircleRadius(canvasCoordinates);
13876
13872
  const canvasCorners = getCanvasCircleCorners(canvasCoordinates);
13877
13873
  const { centerPointRadius } = this.configuration;
13874
+ const modalityUnitOptions = {
13875
+ isPreScaled: isViewportPreScaled(viewport, targetId),
13876
+ isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
13877
+ };
13878
13878
  if (!data.cachedStats[targetId] ||
13879
13879
  data.cachedStats[targetId].areaUnit === undefined) {
13880
13880
  data.cachedStats[targetId] = {
@@ -13888,10 +13888,10 @@ class CircleROITool extends base_AnnotationTool {
13888
13888
  radiusUnit: null,
13889
13889
  perimeter: null,
13890
13890
  };
13891
- this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
13891
+ this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions);
13892
13892
  }
13893
13893
  else if (annotation.invalidated) {
13894
- this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
13894
+ this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions);
13895
13895
  if (viewport instanceof esm.VolumeViewport) {
13896
13896
  const { referencedImageId } = annotation.metadata;
13897
13897
  for (const targetId in data.cachedStats) {
@@ -13946,9 +13946,7 @@ class CircleROITool extends base_AnnotationTool {
13946
13946
  }
13947
13947
  }
13948
13948
  renderStatus = true;
13949
- const isPreScaled = isViewportPreScaled(viewport, targetId);
13950
- const isSuvScaled = this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId);
13951
- const textLines = this._getTextLines(data, targetId, isPreScaled, isSuvScaled);
13949
+ const textLines = this._getTextLines(data, targetId);
13952
13950
  if (!textLines || textLines.length === 0) {
13953
13951
  continue;
13954
13952
  }
@@ -13971,11 +13969,10 @@ class CircleROITool extends base_AnnotationTool {
13971
13969
  }
13972
13970
  return renderStatus;
13973
13971
  };
13974
- this._getTextLines = (data, targetId, isPreScaled, isSuvScaled) => {
13972
+ this._getTextLines = (data, targetId) => {
13975
13973
  const cachedVolumeStats = data.cachedStats[targetId];
13976
- const { radius, radiusUnit, area, mean, stdDev, max, isEmptyArea, Modality, areaUnit, } = cachedVolumeStats;
13974
+ const { radius, radiusUnit, area, mean, stdDev, max, isEmptyArea, Modality, areaUnit, modalityUnit, } = cachedVolumeStats;
13977
13975
  const textLines = [];
13978
- const unit = getModalityUnit(Modality, isPreScaled, isSuvScaled);
13979
13976
  if (radius) {
13980
13977
  const radiusLine = isEmptyArea
13981
13978
  ? `Radius: Oblique not supported`
@@ -13989,17 +13986,17 @@ class CircleROITool extends base_AnnotationTool {
13989
13986
  textLines.push(areaLine);
13990
13987
  }
13991
13988
  if (mean) {
13992
- textLines.push(`Mean: ${mean.toFixed(2)} ${unit}`);
13989
+ textLines.push(`Mean: ${mean.toFixed(2)} ${modalityUnit}`);
13993
13990
  }
13994
13991
  if (max) {
13995
- textLines.push(`Max: ${max.toFixed(2)} ${unit}`);
13992
+ textLines.push(`Max: ${max.toFixed(2)} ${modalityUnit}`);
13996
13993
  }
13997
13994
  if (stdDev) {
13998
- textLines.push(`Std Dev: ${stdDev.toFixed(2)} ${unit}`);
13995
+ textLines.push(`Std Dev: ${stdDev.toFixed(2)} ${modalityUnit}`);
13999
13996
  }
14000
13997
  return textLines;
14001
13998
  };
14002
- this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement) => {
13999
+ this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions) => {
14003
14000
  const data = annotation.data;
14004
14001
  const { viewportId, renderingEngineId } = enabledElement;
14005
14002
  const { points } = data.handles;
@@ -14073,6 +14070,7 @@ class CircleROITool extends base_AnnotationTool {
14073
14070
  pointInShapeCallback(imageData, (pointLPS, pointIJK) => pointInEllipse(ellipseObj, pointLPS), stdCalculator, boundsIJK);
14074
14071
  stdDev /= count;
14075
14072
  stdDev = Math.sqrt(stdDev);
14073
+ const modalityUnit = getModalityUnit(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
14076
14074
  cachedStats[targetId] = {
14077
14075
  Modality: metadata.Modality,
14078
14076
  area,
@@ -14084,6 +14082,7 @@ class CircleROITool extends base_AnnotationTool {
14084
14082
  radius: worldWidth / 2,
14085
14083
  radiusUnit: hasPixelSpacing ? 'mm' : 'px',
14086
14084
  perimeter: 2 * Math.PI * (worldWidth / 2),
14085
+ modalityUnit,
14087
14086
  };
14088
14087
  }
14089
14088
  else {
@@ -14775,7 +14774,10 @@ function completeDrawClosedContour(element) {
14775
14774
  const worldPoints = updatedPoints.map((canvasPoint) => viewport.canvasToWorld(canvasPoint));
14776
14775
  annotation.data.polyline = worldPoints;
14777
14776
  annotation.data.isOpenContour = false;
14778
- this.triggerAnnotationCompleted(annotation);
14777
+ const { textBox } = annotation.data.handles;
14778
+ if (!textBox.hasMoved) {
14779
+ this.triggerAnnotationCompleted(annotation);
14780
+ }
14779
14781
  this.isDrawing = false;
14780
14782
  this.drawData = undefined;
14781
14783
  this.commonData = undefined;
@@ -14808,6 +14810,7 @@ function completeDrawOpenContour(element) {
14808
14810
  const worldPoints = updatedPoints.map((canvasPoint) => viewport.canvasToWorld(canvasPoint));
14809
14811
  annotation.data.polyline = worldPoints;
14810
14812
  annotation.data.isOpenContour = true;
14813
+ const { textBox } = annotation.data.handles;
14811
14814
  annotation.data.handles.points = [
14812
14815
  worldPoints[0],
14813
14816
  worldPoints[worldPoints.length - 1],
@@ -14816,7 +14819,9 @@ function completeDrawOpenContour(element) {
14816
14819
  annotation.data.openUShapeContourVectorToPeak =
14817
14820
  findOpenUShapedContourVectorToPeak(canvasPoints, viewport);
14818
14821
  }
14819
- this.triggerAnnotationCompleted(annotation);
14822
+ if (!textBox.hasMoved) {
14823
+ this.triggerAnnotationCompleted(annotation);
14824
+ }
14820
14825
  this.isDrawing = false;
14821
14826
  this.drawData = undefined;
14822
14827
  this.commonData = undefined;
@@ -15257,6 +15262,7 @@ function completeClosedContourEdit(element) {
15257
15262
  const worldPoints = updatedPoints.map((canvasPoint) => viewport.canvasToWorld(canvasPoint));
15258
15263
  annotation.data.polyline = worldPoints;
15259
15264
  annotation.data.isOpenContour = false;
15265
+ annotation.invalidated = true;
15260
15266
  this.triggerAnnotationModified(annotation, enabledElement);
15261
15267
  }
15262
15268
  this.isEditingClosed = false;
@@ -15565,6 +15571,7 @@ function completeOpenContourEdit(element) {
15565
15571
  annotation.data.openUShapeContourVectorToPeak =
15566
15572
  findOpenUShapedContourVectorToPeak(fusedCanvasPoints, viewport);
15567
15573
  }
15574
+ annotation.invalidated = true;
15568
15575
  this.triggerAnnotationModified(annotation, enabledElement);
15569
15576
  }
15570
15577
  this.isEditingOpen = false;
@@ -16045,6 +16052,10 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16045
16052
  if (annotation.annotationUID === activeAnnotationUID &&
16046
16053
  !this.commonData?.movingTextBox)
16047
16054
  return;
16055
+ const modalityUnitOptions = {
16056
+ isPreScaled: isViewportPreScaled(viewport, targetId),
16057
+ isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
16058
+ };
16048
16059
  if (!this.commonData?.movingTextBox) {
16049
16060
  const { data } = annotation;
16050
16061
  if (!data.cachedStats[targetId] ||
@@ -16057,17 +16068,17 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16057
16068
  stdDev: null,
16058
16069
  areaUnit: null,
16059
16070
  };
16060
- this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
16071
+ this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions);
16061
16072
  }
16062
16073
  else if (annotation.invalidated) {
16063
- this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
16074
+ this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions);
16064
16075
  }
16065
16076
  }
16066
16077
  this._renderStats(annotation, viewport, enabledElement, svgDrawingHelper);
16067
16078
  });
16068
16079
  return renderStatus;
16069
16080
  };
16070
- this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement) => {
16081
+ this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions) => {
16071
16082
  const data = annotation.data;
16072
16083
  const { cachedStats, polyline: points } = data;
16073
16084
  const targetIds = Object.keys(cachedStats);
@@ -16162,6 +16173,7 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16162
16173
  const mean = sum / count;
16163
16174
  let stdDev = sumSquares / count - mean ** 2;
16164
16175
  stdDev = Math.sqrt(stdDev);
16176
+ const modalityUnit = getModalityUnit(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
16165
16177
  cachedStats[targetId] = {
16166
16178
  Modality: metadata.Modality,
16167
16179
  area,
@@ -16169,17 +16181,17 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16169
16181
  max,
16170
16182
  stdDev,
16171
16183
  areaUnit: hasPixelSpacing ? 'mm' : 'px',
16184
+ modalityUnit,
16172
16185
  };
16173
16186
  }
16187
+ this.triggerAnnotationModified(annotation, enabledElement);
16174
16188
  annotation.invalidated = false;
16175
16189
  return cachedStats;
16176
16190
  };
16177
16191
  this._renderStats = (annotation, viewport, enabledElement, svgDrawingHelper) => {
16178
16192
  const data = annotation.data;
16179
16193
  const targetId = this.getTargetId(viewport);
16180
- const isPreScaled = isViewportPreScaled(viewport, targetId);
16181
- const isSuvScaled = this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId);
16182
- const textLines = this._getTextLines(data, targetId, isPreScaled, isSuvScaled);
16194
+ const textLines = this._getTextLines(data, targetId);
16183
16195
  if (!textLines || textLines.length === 0)
16184
16196
  return;
16185
16197
  const canvasCoordinates = data.polyline.map((p) => viewport.worldToCanvas(p));
@@ -16204,11 +16216,10 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16204
16216
  bottomRight: viewport.canvasToWorld([left + width, top + height]),
16205
16217
  };
16206
16218
  };
16207
- this._getTextLines = (data, targetId, isPreScaled, isSuvScaled) => {
16219
+ this._getTextLines = (data, targetId) => {
16208
16220
  const cachedVolumeStats = data.cachedStats[targetId];
16209
- const { area, mean, stdDev, max, isEmptyArea, Modality, areaUnit } = cachedVolumeStats;
16221
+ const { area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit } = cachedVolumeStats;
16210
16222
  const textLines = [];
16211
- const unit = getModalityUnit(Modality, isPreScaled, isSuvScaled);
16212
16223
  if (area) {
16213
16224
  const areaLine = isEmptyArea
16214
16225
  ? `Area: Oblique not supported`
@@ -16216,13 +16227,13 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16216
16227
  textLines.push(areaLine);
16217
16228
  }
16218
16229
  if (mean) {
16219
- textLines.push(`Mean: ${mean.toFixed(2)} ${unit}`);
16230
+ textLines.push(`Mean: ${mean.toFixed(2)} ${modalityUnit}`);
16220
16231
  }
16221
16232
  if (max) {
16222
- textLines.push(`Max: ${max.toFixed(2)} ${unit}`);
16233
+ textLines.push(`Max: ${max.toFixed(2)} ${modalityUnit}`);
16223
16234
  }
16224
16235
  if (stdDev) {
16225
- textLines.push(`Std Dev: ${stdDev.toFixed(2)} ${unit}`);
16236
+ textLines.push(`Std Dev: ${stdDev.toFixed(2)} ${modalityUnit}`);
16226
16237
  }
16227
16238
  return textLines;
16228
16239
  };
@@ -16299,7 +16310,6 @@ PlanarFreehandROITool.toolName = 'PlanarFreehandROI';
16299
16310
 
16300
16311
 
16301
16312
 
16302
-
16303
16313
  class ArrowAnnotateTool extends base_AnnotationTool {
16304
16314
  constructor(toolProps = {}, defaultToolProps = {
16305
16315
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -16646,7 +16656,7 @@ class ArrowAnnotateTool extends base_AnnotationTool {
16646
16656
  continue;
16647
16657
  }
16648
16658
  if (!data.handles.textBox.hasMoved) {
16649
- const canvasTextBoxCoords = getTextBoxCoordsCanvas(canvasCoordinates);
16659
+ const canvasTextBoxCoords = canvasCoordinates[1];
16650
16660
  data.handles.textBox.worldPosition =
16651
16661
  viewport.canvasToWorld(canvasTextBoxCoords);
16652
16662
  }
@@ -16731,7 +16741,6 @@ ArrowAnnotateTool.toolName = 'ArrowAnnotate';
16731
16741
 
16732
16742
 
16733
16743
 
16734
-
16735
16744
  class AngleTool extends base_AnnotationTool {
16736
16745
  constructor(toolProps = {}, defaultToolProps = {
16737
16746
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -17064,7 +17073,7 @@ class AngleTool extends base_AnnotationTool {
17064
17073
  }
17065
17074
  const textLines = this._getTextLines(data, targetId);
17066
17075
  if (!data.handles.textBox.hasMoved) {
17067
- const canvasTextBoxCoords = getTextBoxCoordsCanvas(canvasCoordinates);
17076
+ const canvasTextBoxCoords = canvasCoordinates[1];
17068
17077
  data.handles.textBox.worldPosition =
17069
17078
  viewport.canvasToWorld(canvasTextBoxCoords);
17070
17079
  }
@@ -22848,21 +22857,23 @@ function createCameraPositionSynchronizer(synchronizerName) {
22848
22857
 
22849
22858
  function voiSyncCallback(synchronizerInstance, sourceViewport, targetViewport, voiModifiedEvent) {
22850
22859
  const eventDetail = voiModifiedEvent.detail;
22851
- const { volumeId, range } = eventDetail;
22860
+ const { volumeId, range, invertStateChanged, invert } = eventDetail;
22852
22861
  const renderingEngine = (0,esm.getRenderingEngine)(targetViewport.renderingEngineId);
22853
22862
  if (!renderingEngine) {
22854
22863
  throw new Error(`Rendering Engine does not exist: ${targetViewport.renderingEngineId}`);
22855
22864
  }
22856
22865
  const tViewport = renderingEngine.getViewport(targetViewport.viewportId);
22857
- if (tViewport instanceof esm.VolumeViewport) {
22858
- tViewport.setProperties({
22859
- voiRange: range,
22860
- }, volumeId);
22866
+ const tProperties = {
22867
+ voiRange: range,
22868
+ };
22869
+ if (invertStateChanged) {
22870
+ tProperties.invert = invert;
22871
+ }
22872
+ if (tViewport instanceof esm.BaseVolumeViewport) {
22873
+ tViewport.setProperties(tProperties, volumeId);
22861
22874
  }
22862
22875
  else if (tViewport instanceof esm.StackViewport) {
22863
- tViewport.setProperties({
22864
- voiRange: range,
22865
- });
22876
+ tViewport.setProperties(tProperties);
22866
22877
  }
22867
22878
  else {
22868
22879
  throw new Error('Viewport type not supported.');