@ohif/app 3.7.0-beta.99 → 3.7.0

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 (29) hide show
  1. package/dist/{202.bundle.96bbb4547a346fe3921f.js → 202.bundle.d3490836f71e001dd30f.js} +746 -19
  2. package/dist/{221.bundle.8d4059312a771ac53a19.js → 221.bundle.a331e2a9a29f9599fd40.js} +70 -14
  3. package/dist/{342.bundle.095cc16d795ac02a7b78.js → 342.bundle.3f9ebc45fdc6d6879adc.js} +40 -22
  4. package/dist/{359.bundle.d32d3e78569b6717a2fb.js → 359.bundle.aa2adce78c3935aa19c1.js} +1 -3
  5. package/dist/{370.bundle.a275a49f7b72669bce3f.js → 370.bundle.31f3d861d96bdd540dc7.js} +4 -4
  6. package/dist/{743.bundle.4bfe6e562ffb2c22708f.js → 743.bundle.489f7df3a089d4d374e1.js} +13 -0
  7. package/dist/{831.bundle.83658f62fcc769043605.js → 757.bundle.ec8301d8e70d2b990f65.js} +368 -1
  8. package/dist/{782.bundle.f6d16bde1ecbb30f1693.js → 788.bundle.b9dabaea41cb029360b1.js} +5 -305
  9. package/dist/{82.bundle.e83d670b0199d1bc717c.js → 82.bundle.ec05d3de5ac5b0c577fe.js} +61 -41
  10. package/dist/{957.bundle.71558794566041f37a92.js → 957.bundle.9ea4506963ef8b2d84ba.js} +44 -41
  11. package/dist/app.bundle.css +1 -1
  12. package/dist/{app.bundle.85c4172c936ff45dd5ae.js → app.bundle.dacb6768b481e9135f71.js} +143 -99
  13. package/dist/index.html +1 -1
  14. package/dist/sw.js +1 -1
  15. package/package.json +19 -18
  16. /package/dist/{12.bundle.c149229c3721197734b9.js → 12.bundle.b965cc54108a0b38a022.js} +0 -0
  17. /package/dist/{181.bundle.169383e9b1a0358b44e8.js → 181.bundle.ceb057236403bcb630ac.js} +0 -0
  18. /package/dist/{19.bundle.d1a02a9b42c17df51f39.js → 19.bundle.d961845411cf4e95d27c.js} +0 -0
  19. /package/dist/{236.bundle.004ffd1d05a9f69d6812.js → 236.bundle.b09ef6a3c16be7ad1d05.js} +0 -0
  20. /package/dist/{281.bundle.2faa52a55643723e80a3.js → 281.bundle.4f7c49673b5861436311.js} +0 -0
  21. /package/dist/{410.bundle.998289ecc010615b6088.js → 410.bundle.12c1bc7cb765ef74d275.js} +0 -0
  22. /package/dist/{506.bundle.f12d11057236d3e4cf05.js → 506.bundle.311783d53e8d64b84280.js} +0 -0
  23. /package/dist/{613.bundle.9d7c11a0ceefc2d954b5.js → 613.bundle.4359bc30c68b8f567140.js} +0 -0
  24. /package/dist/{663.bundle.7c704397c496dd476e11.js → 663.bundle.87300c41b902228496ec.js} +0 -0
  25. /package/dist/{687.bundle.93b66d44a4f83a1921db.js → 687.bundle.a3caefcf2e55897bad75.js} +0 -0
  26. /package/dist/{774.bundle.7528cba56a1407357144.js → 774.bundle.4b2dc46a35012b898e1a.js} +0 -0
  27. /package/dist/{814.bundle.9b3900d3b98f009990f9.js → 814.bundle.a3d1fbc03a4a3ea3f23d.js} +0 -0
  28. /package/dist/{822.bundle.0545d6dbb49515aa04ee.js → 822.bundle.891f2e57b1b7bc2f4cb4.js} +0 -0
  29. /package/dist/{99.bundle.bf2efcee897944d8a14b.js → 99.bundle.d77c8c0a957274c827da.js} +0 -0
@@ -4736,7 +4736,6 @@ function disableSync(syncName, servicesManager) {
4736
4736
  syncGroupService.removeViewportFromSyncGroup(viewport.id, viewport.getRenderingEngine().id, syncName);
4737
4737
  });
4738
4738
  }
4739
- ;
4740
4739
 
4741
4740
  /**
4742
4741
  * Gets the consistent spacing stack viewport types, which are the ones which
@@ -4767,7 +4766,6 @@ function getReconstructableStackViewports(viewportGridService, displaySetService
4767
4766
  });
4768
4767
  return viewports;
4769
4768
  }
4770
- ;
4771
4769
  ;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/commandsModule.ts
4772
4770
 
4773
4771
 
@@ -4786,7 +4784,6 @@ function commandsModule(_ref) {
4786
4784
  toolGroupService,
4787
4785
  cineService,
4788
4786
  toolbarService,
4789
- stateSyncService,
4790
4787
  uiDialogService,
4791
4788
  cornerstoneViewportService,
4792
4789
  uiNotificationService,
@@ -4913,7 +4910,7 @@ function commandsModule(_ref) {
4913
4910
  * @param props - containing the updates to apply
4914
4911
  * @param props.measurementKey - chooses the measurement key to apply the
4915
4912
  * code to. This will typically be finding or site to apply a
4916
- * finind code or a findingSites code.
4913
+ * finding code or a findingSites code.
4917
4914
  * @param props.code - A coding scheme value from DICOM, including:
4918
4915
  * * CodeValue - the language independent code, for example '1234'
4919
4916
  * * CodingSchemeDesignator - the issue of the code value
@@ -4989,6 +4986,22 @@ function commandsModule(_ref) {
4989
4986
  } = _ref7;
4990
4987
  utils_callInputDialog(uiDialogService, data, callback);
4991
4988
  },
4989
+ cleanUpCrosshairs: () => {
4990
+ // if the crosshairs tool is active, deactivate it and set window level active
4991
+ // since we are going back to main non-mpr HP
4992
+ const activeViewportToolGroup = toolGroupService.getToolGroup(null);
4993
+ if (activeViewportToolGroup._toolInstances?.Crosshairs?.mode === dist_esm.Enums.ToolModes.Active) {
4994
+ actions.toolbarServiceRecordInteraction({
4995
+ interactionType: 'tool',
4996
+ commands: [{
4997
+ commandOptions: {
4998
+ toolName: 'WindowLevel'
4999
+ },
5000
+ context: 'CORNERSTONE'
5001
+ }]
5002
+ });
5003
+ }
5004
+ },
4992
5005
  toggleCine: () => {
4993
5006
  const {
4994
5007
  viewports
@@ -5075,16 +5088,7 @@ function commandsModule(_ref) {
5075
5088
  return;
5076
5089
  }
5077
5090
  const toolGroup = toolGroupService.getToolGroup(toolGroupId);
5078
- const toolGroupViewportIds = toolGroup?.getViewportIds?.();
5079
-
5080
- // if toolGroup has been destroyed, or its viewports have been removed
5081
- if (!toolGroupViewportIds || !toolGroupViewportIds.length) {
5082
- return;
5083
- }
5084
- const filteredViewports = Array.from(viewports.values()).filter(viewport => {
5085
- return toolGroupViewportIds.includes(viewport.viewportId);
5086
- });
5087
- if (!filteredViewports.length) {
5091
+ if (!toolGroup) {
5088
5092
  return;
5089
5093
  }
5090
5094
  if (!toolGroup.getToolInstance(toolName)) {
@@ -5243,7 +5247,7 @@ function commandsModule(_ref) {
5243
5247
  viewport.resetProperties();
5244
5248
  viewport.resetCamera();
5245
5249
  } else {
5246
- // Todo: add reset properties for volume viewport
5250
+ viewport.resetProperties();
5247
5251
  viewport.resetCamera();
5248
5252
  }
5249
5253
  viewport.render();
@@ -5546,6 +5550,9 @@ function commandsModule(_ref) {
5546
5550
  },
5547
5551
  setToolbarToggled: {
5548
5552
  commandFn: actions.setToolbarToggled
5553
+ },
5554
+ cleanUpCrosshairs: {
5555
+ commandFn: actions.cleanUpCrosshairs
5549
5556
  }
5550
5557
  };
5551
5558
  return {
@@ -5579,16 +5586,7 @@ const mpr = {
5579
5586
  }],
5580
5587
  // Turns off crosshairs when switching out of MPR mode
5581
5588
  onProtocolExit: [{
5582
- commandName: 'toolbarServiceRecordInteraction',
5583
- commandOptions: {
5584
- interactionType: 'tool',
5585
- commands: [{
5586
- commandOptions: {
5587
- toolName: 'WindowLevel'
5588
- },
5589
- context: 'CORNERSTONE'
5590
- }]
5591
- }
5589
+ commandName: 'cleanUpCrosshairs'
5592
5590
  }]
5593
5591
  },
5594
5592
  displaySetSelectors: {
@@ -6462,7 +6460,7 @@ class SegmentationService extends src/* PubSubService */.hC {
6462
6460
  volumeId: segmentationId,
6463
6461
  targetBuffer: {
6464
6462
  type: 'Uint8Array',
6465
- sharedArrayBuffer: true
6463
+ sharedArrayBuffer: window.SharedArrayBuffer
6466
6464
  }
6467
6465
  });
6468
6466
  const defaultScheme = this._getDefaultSegmentationScheme();
@@ -6589,7 +6587,7 @@ class SegmentationService extends src/* PubSubService */.hC {
6589
6587
  }
6590
6588
  };
6591
6589
  this.getConfiguration = toolGroupId => {
6592
- toolGroupId = toolGroupId ?? this._getFirstToolGroupId();
6590
+ toolGroupId = toolGroupId ?? this._getApplicableToolGroupId();
6593
6591
  const brushSize = 1;
6594
6592
  // const brushSize = cstUtils.segmentation.getBrushSizeForToolGroup(
6595
6593
  // toolGroupId
@@ -6716,7 +6714,7 @@ class SegmentationService extends src/* PubSubService */.hC {
6716
6714
  if (segmentInfo === undefined) {
6717
6715
  throw new Error(`Segment ${segmentIndex} not yet added to segmentation: ${segmentationId}`);
6718
6716
  }
6719
- toolGroupId = toolGroupId ?? _this._getFirstToolGroupId();
6717
+ toolGroupId = toolGroupId ?? _this._getApplicableToolGroupId();
6720
6718
  const segmentationRepresentation = _this._getSegmentationRepresentation(segmentationId, toolGroupId);
6721
6719
  if (!segmentationRepresentation) {
6722
6720
  throw new Error('Must add representation to toolgroup before setting segments');
@@ -6743,7 +6741,7 @@ class SegmentationService extends src/* PubSubService */.hC {
6743
6741
  if (segmentInfo === undefined) {
6744
6742
  throw new Error(`Segment ${segmentIndex} not yet added to segmentation: ${segmentationId}`);
6745
6743
  }
6746
- toolGroupId = toolGroupId ?? _this._getFirstToolGroupId();
6744
+ toolGroupId = toolGroupId ?? _this._getApplicableToolGroupId();
6747
6745
  const segmentationRepresentation = _this._getSegmentationRepresentation(segmentationId, toolGroupId);
6748
6746
  if (!segmentationRepresentation) {
6749
6747
  throw new Error('Must add representation to toolgroup before setting segments');
@@ -6865,12 +6863,18 @@ class SegmentationService extends src/* PubSubService */.hC {
6865
6863
  });
6866
6864
  });
6867
6865
  };
6868
- this._getFirstToolGroupId = () => {
6866
+ this._getApplicableToolGroupId = () => {
6869
6867
  const {
6870
- toolGroupService
6868
+ toolGroupService,
6869
+ viewportGridService,
6870
+ cornerstoneViewportService
6871
6871
  } = this.servicesManager.services;
6872
- const toolGroupIds = toolGroupService.getToolGroupIds();
6873
- return toolGroupIds[0];
6872
+ const viewportInfo = cornerstoneViewportService.getViewportInfo(viewportGridService.getActiveViewportId());
6873
+ if (!viewportInfo) {
6874
+ const toolGroupIds = toolGroupService.getToolGroupIds();
6875
+ return toolGroupIds[0];
6876
+ }
6877
+ return viewportInfo.getToolGroupId();
6874
6878
  };
6875
6879
  this.getNextColorLUTIndex = () => {
6876
6880
  let i = 0;
@@ -6914,7 +6918,7 @@ class SegmentationService extends src/* PubSubService */.hC {
6914
6918
  if (config?.segmentIndex === 0) {
6915
6919
  throw new Error('Segment index 0 is reserved for "no label"');
6916
6920
  }
6917
- const toolGroupId = config.toolGroupId ?? this._getFirstToolGroupId();
6921
+ const toolGroupId = config.toolGroupId ?? this._getApplicableToolGroupId();
6918
6922
  const {
6919
6923
  segmentationRepresentationUID,
6920
6924
  segmentation
@@ -6958,7 +6962,7 @@ class SegmentationService extends src/* PubSubService */.hC {
6958
6962
  if (visibility !== undefined) {
6959
6963
  this._setSegmentVisibility(segmentationId, segmentIndex, visibility, toolGroupId, suppressEvents);
6960
6964
  }
6961
- if (active !== undefined) {
6965
+ if (active === true) {
6962
6966
  this._setActiveSegment(segmentationId, segmentIndex, suppressEvents);
6963
6967
  }
6964
6968
  if (isLocked !== undefined) {
@@ -7051,7 +7055,7 @@ class SegmentationService extends src/* PubSubService */.hC {
7051
7055
  this._setSegmentOpacity(segmentationId, segmentIndex, opacity, toolGroupId);
7052
7056
  }
7053
7057
  setActiveSegmentationForToolGroup(segmentationId, toolGroupId) {
7054
- toolGroupId = toolGroupId ?? this._getFirstToolGroupId();
7058
+ toolGroupId = toolGroupId ?? this._getApplicableToolGroupId();
7055
7059
  const suppressEvents = false;
7056
7060
  this._setActiveSegmentationForToolGroup(segmentationId, toolGroupId, suppressEvents);
7057
7061
  }
@@ -7081,6 +7085,21 @@ class SegmentationService extends src/* PubSubService */.hC {
7081
7085
  const segmentations = this.arrayOfObjects(this.segmentations);
7082
7086
  return segmentations && segmentations.map(m => this.segmentations[Object.keys(m)[0]]);
7083
7087
  }
7088
+ getActiveSegmentation() {
7089
+ const segmentations = this.getSegmentations();
7090
+ return segmentations.find(segmentation => segmentation.isActive);
7091
+ }
7092
+ getActiveSegment() {
7093
+ const activeSegmentation = this.getActiveSegmentation();
7094
+ const {
7095
+ activeSegmentIndex,
7096
+ segments
7097
+ } = activeSegmentation;
7098
+ if (activeSegmentIndex === null) {
7099
+ return;
7100
+ }
7101
+ return segments[activeSegmentIndex];
7102
+ }
7084
7103
 
7085
7104
  /**
7086
7105
  * Get specific segmentation by its id.
@@ -7202,7 +7221,7 @@ class SegmentationService extends src/* PubSubService */.hC {
7202
7221
  volumeId: segmentationId,
7203
7222
  targetBuffer: {
7204
7223
  type: 'Uint8Array',
7205
- sharedArrayBuffer: true
7224
+ sharedArrayBuffer: window.SharedArrayBuffer
7206
7225
  }
7207
7226
  });
7208
7227
  const derivedVolumeScalarData = derivedVolume.getScalarData();
@@ -7439,7 +7458,7 @@ class SegmentationService extends src/* PubSubService */.hC {
7439
7458
  clearInterval(this.highlightIntervalId);
7440
7459
  }
7441
7460
  const segmentation = this.getSegmentation(segmentationId);
7442
- toolGroupId = toolGroupId ?? this._getFirstToolGroupId();
7461
+ toolGroupId = toolGroupId ?? this._getApplicableToolGroupId();
7443
7462
  const segmentationRepresentation = this._getSegmentationRepresentation(segmentationId, toolGroupId);
7444
7463
  const {
7445
7464
  type
@@ -7569,7 +7588,7 @@ class SegmentationService extends src/* PubSubService */.hC {
7569
7588
  const {
7570
7589
  id
7571
7590
  } = remainingHydratedSegmentations[0];
7572
- this._setActiveSegmentationForToolGroup(id, this._getFirstToolGroupId(), false);
7591
+ this._setActiveSegmentationForToolGroup(id, this._getApplicableToolGroupId(), false);
7573
7592
  }
7574
7593
  }
7575
7594
  this._setDisplaySetIsHydrated(segmentationId, false);
@@ -7724,7 +7743,7 @@ class SegmentationService extends src/* PubSubService */.hC {
7724
7743
  }
7725
7744
  _setSegmentVisibility(segmentationId, segmentIndex, isVisible, toolGroupId) {
7726
7745
  let suppressEvents = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
7727
- toolGroupId = toolGroupId ?? this._getFirstToolGroupId();
7746
+ toolGroupId = toolGroupId ?? this._getApplicableToolGroupId();
7728
7747
  const {
7729
7748
  segmentationRepresentationUID,
7730
7749
  segmentation
@@ -8069,7 +8088,8 @@ class CornerstoneCacheService {
8069
8088
  for (const segmentation of segmentations) {
8070
8089
  const segDisplaySetInstanceUID = segmentation.displaySetInstanceUID;
8071
8090
  const segDisplaySet = displaySetService.getDisplaySetByUID(segDisplaySetInstanceUID);
8072
- const shouldDisplaySeg = segmentationService.shouldRenderSegmentation(viewportDisplaySetInstanceUIDs, segDisplaySet.instances[0].FrameOfReferenceUID);
8091
+ const instance = segDisplaySet.instances?.[0] || segDisplaySet.instance;
8092
+ const shouldDisplaySeg = segmentationService.shouldRenderSegmentation(viewportDisplaySetInstanceUIDs, instance.FrameOfReferenceUID);
8073
8093
  if (shouldDisplaySeg) {
8074
8094
  return true;
8075
8095
  }
@@ -12119,8 +12119,11 @@ function _handlePTModality(imageId, options) {
12119
12119
  if (options.isSuvScaled) {
12120
12120
  return 'SUV';
12121
12121
  }
12122
- const petSeriesModule = esm.metaData.get('petSeriesModule', imageId);
12123
- return petSeriesModule?.units || 'unitless';
12122
+ const generalSeriesModule = esm.metaData.get('generalSeriesModule', imageId);
12123
+ if (generalSeriesModule?.modality === 'PT') {
12124
+ const petSeriesModule = esm.metaData.get('petSeriesModule', imageId);
12125
+ return petSeriesModule?.units || 'unitless';
12126
+ }
12124
12127
  }
12125
12128
 
12126
12129
 
@@ -12315,10 +12318,6 @@ class ProbeTool extends base_AnnotationTool {
12315
12318
  const canvasCoordinates = viewport.worldToCanvas(point);
12316
12319
  styleSpecifier.annotationUID = annotationUID;
12317
12320
  const color = this.getStyle('color', styleSpecifier, annotation);
12318
- const modalityUnitOptions = {
12319
- isPreScaled: isViewportPreScaled(viewport, targetId),
12320
- isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
12321
- };
12322
12321
  if (!data.cachedStats[targetId] ||
12323
12322
  data.cachedStats[targetId].value == null) {
12324
12323
  data.cachedStats[targetId] = {
@@ -12326,10 +12325,10 @@ class ProbeTool extends base_AnnotationTool {
12326
12325
  index: null,
12327
12326
  value: null,
12328
12327
  };
12329
- this._calculateCachedStats(annotation, renderingEngine, enabledElement, modalityUnitOptions);
12328
+ this._calculateCachedStats(annotation, renderingEngine, enabledElement);
12330
12329
  }
12331
12330
  else if (annotation.invalidated) {
12332
- this._calculateCachedStats(annotation, renderingEngine, enabledElement, modalityUnitOptions);
12331
+ this._calculateCachedStats(annotation, renderingEngine, enabledElement);
12333
12332
  if (viewport instanceof esm.VolumeViewport) {
12334
12333
  const { referencedImageId } = annotation.metadata;
12335
12334
  for (const targetId in data.cachedStats) {
@@ -12403,14 +12402,18 @@ class ProbeTool extends base_AnnotationTool {
12403
12402
  utilities_triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
12404
12403
  evt.preventDefault();
12405
12404
  }
12406
- _calculateCachedStats(annotation, renderingEngine, enabledElement, modalityUnitOptions) {
12405
+ _calculateCachedStats(annotation, renderingEngine, enabledElement) {
12407
12406
  const data = annotation.data;
12408
- const { viewportId, renderingEngineId } = enabledElement;
12407
+ const { viewportId, renderingEngineId, viewport } = enabledElement;
12409
12408
  const worldPos = data.handles.points[0];
12410
12409
  const { cachedStats } = data;
12411
12410
  const targetIds = Object.keys(cachedStats);
12412
12411
  for (let i = 0; i < targetIds.length; i++) {
12413
12412
  const targetId = targetIds[i];
12413
+ const modalityUnitOptions = {
12414
+ isPreScaled: isViewportPreScaled(viewport, targetId),
12415
+ isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
12416
+ };
12414
12417
  const image = this.getTargetIdImage(targetId, renderingEngine);
12415
12418
  if (!image) {
12416
12419
  continue;
@@ -12570,10 +12573,10 @@ class DragProbeTool extends annotation_ProbeTool {
12570
12573
  index: null,
12571
12574
  value: null,
12572
12575
  };
12573
- this._calculateCachedStats(annotation, renderingEngine, enabledElement, modalityUnitOptions);
12576
+ this._calculateCachedStats(annotation, renderingEngine, enabledElement);
12574
12577
  }
12575
12578
  else if (annotation.invalidated) {
12576
- this._calculateCachedStats(annotation, renderingEngine, enabledElement, modalityUnitOptions);
12579
+ this._calculateCachedStats(annotation, renderingEngine, enabledElement);
12577
12580
  }
12578
12581
  if (!viewport.getRenderingEngine()) {
12579
12582
  console.warn('Rendering Engine has been destroyed');
@@ -13061,10 +13064,6 @@ class RectangleROITool extends base_AnnotationTool {
13061
13064
  const lineDash = this.getStyle('lineDash', styleSpecifier, annotation);
13062
13065
  const color = this.getStyle('color', styleSpecifier, annotation);
13063
13066
  const { viewPlaneNormal, viewUp } = viewport.getCamera();
13064
- const modalityUnitOptions = {
13065
- isPreScaled: isViewportPreScaled(viewport, targetId),
13066
- isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
13067
- };
13068
13067
  if (!data.cachedStats[targetId] ||
13069
13068
  data.cachedStats[targetId].areaUnit == null) {
13070
13069
  data.cachedStats[targetId] = {
@@ -13075,10 +13074,10 @@ class RectangleROITool extends base_AnnotationTool {
13075
13074
  stdDev: null,
13076
13075
  areaUnit: null,
13077
13076
  };
13078
- this._calculateCachedStats(annotation, viewPlaneNormal, viewUp, renderingEngine, enabledElement, modalityUnitOptions);
13077
+ this._calculateCachedStats(annotation, viewPlaneNormal, viewUp, renderingEngine, enabledElement);
13079
13078
  }
13080
13079
  else if (annotation.invalidated) {
13081
- this._throttledCalculateCachedStats(annotation, viewPlaneNormal, viewUp, renderingEngine, enabledElement, modalityUnitOptions);
13080
+ this._throttledCalculateCachedStats(annotation, viewPlaneNormal, viewUp, renderingEngine, enabledElement);
13082
13081
  if (viewport instanceof esm.VolumeViewport) {
13083
13082
  const { referencedImageId } = annotation.metadata;
13084
13083
  for (const targetId in data.cachedStats) {
@@ -13169,9 +13168,9 @@ class RectangleROITool extends base_AnnotationTool {
13169
13168
  height: Math.abs(point0[1] - point1[1]),
13170
13169
  };
13171
13170
  };
13172
- this._calculateCachedStats = (annotation, viewPlaneNormal, viewUp, renderingEngine, enabledElement, modalityUnitOptions) => {
13171
+ this._calculateCachedStats = (annotation, viewPlaneNormal, viewUp, renderingEngine, enabledElement) => {
13173
13172
  const { data } = annotation;
13174
- const { viewportId, renderingEngineId } = enabledElement;
13173
+ const { viewportId, renderingEngineId, viewport } = enabledElement;
13175
13174
  const worldPos1 = data.handles.points[0];
13176
13175
  const worldPos2 = data.handles.points[3];
13177
13176
  const { cachedStats } = data;
@@ -13208,6 +13207,10 @@ class RectangleROITool extends base_AnnotationTool {
13208
13207
  const { worldWidth, worldHeight } = getWorldWidthAndHeightFromCorners(viewPlaneNormal, viewUp, worldPos1, worldPos2);
13209
13208
  const scale = getCalibratedScale(image);
13210
13209
  const area = Math.abs(worldWidth * worldHeight) / (scale * scale);
13210
+ const modalityUnitOptions = {
13211
+ isPreScaled: isViewportPreScaled(viewport, targetId),
13212
+ isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
13213
+ };
13211
13214
  const modalityUnit = getModalityUnit(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
13212
13215
  const pointsInShape = pointInShapeCallback(imageData, () => true, this.configuration.statsCalculator.statsCallback, boundsIJK);
13213
13216
  const stats = this.configuration.statsCalculator.getStatistics();
@@ -13729,10 +13732,6 @@ class EllipticalROITool extends base_AnnotationTool {
13729
13732
  canvasCorners = (getCanvasEllipseCorners(canvasCoordinates));
13730
13733
  }
13731
13734
  const { centerPointRadius } = this.configuration;
13732
- const modalityUnitOptions = {
13733
- isPreScaled: isViewportPreScaled(viewport, targetId),
13734
- isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
13735
- };
13736
13735
  if (!data.cachedStats[targetId] ||
13737
13736
  data.cachedStats[targetId].areaUnit == null) {
13738
13737
  data.cachedStats[targetId] = {
@@ -13743,10 +13742,10 @@ class EllipticalROITool extends base_AnnotationTool {
13743
13742
  stdDev: null,
13744
13743
  areaUnit: null,
13745
13744
  };
13746
- this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions);
13745
+ this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
13747
13746
  }
13748
13747
  else if (annotation.invalidated) {
13749
- this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions);
13748
+ this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
13750
13749
  if (viewport instanceof esm.VolumeViewport) {
13751
13750
  const { referencedImageId } = annotation.metadata;
13752
13751
  for (const targetId in data.cachedStats) {
@@ -13840,7 +13839,7 @@ class EllipticalROITool extends base_AnnotationTool {
13840
13839
  }
13841
13840
  return renderStatus;
13842
13841
  };
13843
- this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions) => {
13842
+ this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement) => {
13844
13843
  const data = annotation.data;
13845
13844
  const { viewportId, renderingEngineId } = enabledElement;
13846
13845
  const { points } = data.handles;
@@ -13897,6 +13896,10 @@ class EllipticalROITool extends base_AnnotationTool {
13897
13896
  const area = Math.abs(Math.PI * (worldWidth / 2) * (worldHeight / 2)) /
13898
13897
  scale /
13899
13898
  scale;
13899
+ const modalityUnitOptions = {
13900
+ isPreScaled: isViewportPreScaled(viewport, targetId),
13901
+ isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
13902
+ };
13900
13903
  const modalityUnit = getModalityUnit(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
13901
13904
  const pointsInShape = pointInShapeCallback(imageData, (pointLPS, pointIJK) => pointInEllipse(ellipseObj, pointLPS), this.configuration.statsCalculator.statsCallback, boundsIJK);
13902
13905
  const stats = this.configuration.statsCalculator.getStatistics();
@@ -14377,10 +14380,6 @@ class CircleROITool extends base_AnnotationTool {
14377
14380
  const radius = getCanvasCircleRadius(canvasCoordinates);
14378
14381
  const canvasCorners = getCanvasCircleCorners(canvasCoordinates);
14379
14382
  const { centerPointRadius } = this.configuration;
14380
- const modalityUnitOptions = {
14381
- isPreScaled: isViewportPreScaled(viewport, targetId),
14382
- isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
14383
- };
14384
14383
  if (!data.cachedStats[targetId] ||
14385
14384
  data.cachedStats[targetId].areaUnit == null) {
14386
14385
  data.cachedStats[targetId] = {
@@ -14394,10 +14393,10 @@ class CircleROITool extends base_AnnotationTool {
14394
14393
  radiusUnit: null,
14395
14394
  perimeter: null,
14396
14395
  };
14397
- this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions);
14396
+ this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
14398
14397
  }
14399
14398
  else if (annotation.invalidated) {
14400
- this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions);
14399
+ this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
14401
14400
  if (viewport instanceof esm.VolumeViewport) {
14402
14401
  const { referencedImageId } = annotation.metadata;
14403
14402
  for (const targetId in data.cachedStats) {
@@ -14489,7 +14488,7 @@ class CircleROITool extends base_AnnotationTool {
14489
14488
  }
14490
14489
  return renderStatus;
14491
14490
  };
14492
- this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions) => {
14491
+ this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement) => {
14493
14492
  const data = annotation.data;
14494
14493
  const { viewportId, renderingEngineId } = enabledElement;
14495
14494
  const { points } = data.handles;
@@ -14547,6 +14546,10 @@ class CircleROITool extends base_AnnotationTool {
14547
14546
  const area = Math.abs(Math.PI *
14548
14547
  (worldWidth / scale / 2) *
14549
14548
  (worldHeight / aspect / scale / 2));
14549
+ const modalityUnitOptions = {
14550
+ isPreScaled: isViewportPreScaled(viewport, targetId),
14551
+ isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
14552
+ };
14550
14553
  const modalityUnit = getModalityUnit(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
14551
14554
  const pointsInShape = pointInShapeCallback(imageData, (pointLPS, pointIJK) => pointInEllipse(ellipseObj, pointLPS), this.configuration.statsCalculator.statsCallback, boundsIJK);
14552
14555
  const stats = this.configuration.statsCalculator.getStatistics();
@@ -16568,10 +16571,6 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16568
16571
  !this.commonData?.movingTextBox) {
16569
16572
  return;
16570
16573
  }
16571
- const modalityUnitOptions = {
16572
- isPreScaled: isViewportPreScaled(viewport, targetId),
16573
- isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
16574
- };
16575
16574
  if (!this.commonData?.movingTextBox) {
16576
16575
  const { data } = annotation;
16577
16576
  if (!data.cachedStats[targetId] ||
@@ -16584,17 +16583,17 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16584
16583
  stdDev: null,
16585
16584
  areaUnit: null,
16586
16585
  };
16587
- this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions);
16586
+ this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
16588
16587
  }
16589
16588
  else if (annotation.invalidated) {
16590
- this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions);
16589
+ this._throttledCalculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
16591
16590
  }
16592
16591
  }
16593
16592
  this._renderStats(annotation, viewport, enabledElement, svgDrawingHelper);
16594
16593
  });
16595
16594
  return renderStatus;
16596
16595
  };
16597
- this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement, modalityUnitOptions) => {
16596
+ this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement) => {
16598
16597
  const data = annotation.data;
16599
16598
  const { cachedStats, polyline: points } = data;
16600
16599
  const targetIds = Object.keys(cachedStats);
@@ -16688,6 +16687,10 @@ class PlanarFreehandROITool extends base_AnnotationTool {
16688
16687
  }
16689
16688
  return result;
16690
16689
  }, this.configuration.statsCalculator.statsCallback, boundsIJK);
16690
+ const modalityUnitOptions = {
16691
+ isPreScaled: isViewportPreScaled(viewport, targetId),
16692
+ isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
16693
+ };
16691
16694
  const modalityUnit = getModalityUnit(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
16692
16695
  const stats = this.configuration.statsCalculator.getStatistics();
16693
16696
  cachedStats[targetId] = {