@ohif/app 3.12.0-beta.85 → 3.12.0-beta.87

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 (42) hide show
  1. package/dist/{1037.bundle.c5b7e110bee6ca994e4a.js → 1037.bundle.87a5adb8c92bd5bf53f5.js} +165 -51
  2. package/dist/{1214.bundle.f969e8b51fad410eeca4.js → 1214.bundle.82dc18225ebf452da664.js} +171 -21
  3. package/dist/{1927.bundle.da6db325e08bacb0bca0.js → 1927.bundle.019331c266d306772371.js} +1 -1
  4. package/dist/{2018.bundle.af575721c20ef6294415.js → 2018.bundle.7df9cb6c57005b9db237.js} +1 -1
  5. package/dist/{2518.bundle.4fd28150fb5a21d423e6.js → 2518.bundle.644302643ac0790e7374.js} +9 -1
  6. package/dist/{306.bundle.c671a09e1eacf6bcfc84.js → 306.bundle.f9faa2b3cdd7e86b5869.js} +114 -5
  7. package/dist/{3613.bundle.0231451edf6a513eb34a.js → 3613.bundle.6157004e0592003c0800.js} +41 -12
  8. package/dist/{4019.bundle.210bc6108a0656fc35ec.js → 4019.bundle.1be1cdd0805ad2c59d65.js} +16 -43
  9. package/dist/{5400.bundle.3ebba479fc068cd8c700.js → 5400.bundle.c3a3fe8867efa2edfa94.js} +7 -9
  10. package/dist/{5858.bundle.99a6b9de04c621694ffd.js → 5858.bundle.d5f4bf849aaeebf5025c.js} +1 -1
  11. package/dist/{7412.bundle.9c3066742e534aaabb61.js → 7412.bundle.34fe5e72833e857edc0a.js} +202 -52
  12. package/dist/{9548.bundle.6832b2af05dbb7c7b6f3.js → 9548.bundle.591b8e5a1953f3c40500.js} +2 -2
  13. package/dist/{app.bundle.3ec0c39d87740bea6a21.js → app.bundle.d57cd60de54593fc0edc.js} +45 -23
  14. package/dist/{compute.bundle.ce909c29a2b66706341f.js → compute.bundle.f3ca9fb0e7ce9e885b9c.js} +1 -1
  15. package/dist/index.html +1 -1
  16. package/dist/{polySeg.bundle.ed1926b3f492983b8ced.js → polySeg.bundle.7b8d1bb21d442a48da1d.js} +1 -1
  17. package/dist/sw.js +1 -1
  18. package/package.json +21 -21
  19. /package/dist/{1459.bundle.b126b1da11a8b6d6fe2f.js → 1459.bundle.462daea3a2c1f0dca759.js} +0 -0
  20. /package/dist/{147.bundle.b1edd4ebd4f25f286183.js → 147.bundle.6fc65a239d1ae1c6a918.js} +0 -0
  21. /package/dist/{1604.bundle.9d62fcb3f7d30f4ee26d.js → 1604.bundle.bce0af2ccee3ab380bb1.js} +0 -0
  22. /package/dist/{1919.bundle.a442471a34039d823946.js → 1919.bundle.31349210489b93bcc35c.js} +0 -0
  23. /package/dist/{213.bundle.e4cc8af1fd2b65353c55.js → 213.bundle.51bea1cb336c73934e96.js} +0 -0
  24. /package/dist/{2243.bundle.d023076216ee5053ed9a.js → 2243.bundle.bf7662965efeb8b44a66.js} +0 -0
  25. /package/dist/{2424.bundle.861ad07422aa8b64e3b5.js → 2424.bundle.a694e15598f198c603ef.js} +0 -0
  26. /package/dist/{319.bundle.f5adcbbef5767dedc45d.js → 319.bundle.4ea0dbcfeb553c900206.js} +0 -0
  27. /package/dist/{4092.bundle.4c8277f4eeef8289a181.js → 4092.bundle.3ed6e7b6a1d9e4bb268d.js} +0 -0
  28. /package/dist/{4113.bundle.242b0997ac86bd1fc9f8.js → 4113.bundle.d8327081e2f6f9b04923.js} +0 -0
  29. /package/dist/{414.bundle.284a7af4c78e2ba5fff8.js → 414.bundle.2cc1b68e9f2c67c98c7b.js} +0 -0
  30. /package/dist/{5457.bundle.14e7db17f61eded3e99b.js → 5457.bundle.b16413f24116d2e46209.js} +0 -0
  31. /package/dist/{5485.bundle.4e6361b9d925e5d15d8f.js → 5485.bundle.53d1c9a66dabf2a7706e.js} +0 -0
  32. /package/dist/{6027.bundle.157a7abbbb3e3f2c736e.js → 6027.bundle.06f9e5bcee12740d39b3.js} +0 -0
  33. /package/dist/{6201.bundle.75c9f595ff3a04fb2614.js → 6201.bundle.81b7ff3af7126daedcdf.js} +0 -0
  34. /package/dist/{6991.bundle.fd69fac510f618217e12.js → 6991.bundle.5a781db0023a394ad0e6.js} +0 -0
  35. /package/dist/{7431.bundle.cb629cddc7beedb366c8.js → 7431.bundle.55dd86000e66bee467e2.js} +0 -0
  36. /package/dist/{7639.bundle.fd9b8372ca9864bb203b.js → 7639.bundle.628b74ec869bf3883217.js} +0 -0
  37. /package/dist/{810.bundle.71f4a47f74c9a75b689d.js → 810.bundle.c0403ba10f598d873382.js} +0 -0
  38. /package/dist/{85.bundle.cf598802682ce35d7ca5.js → 85.bundle.6cb9ea0c464f37f8d3f8.js} +0 -0
  39. /package/dist/{8558.bundle.156a140415383c14413f.js → 8558.bundle.fa6050d1ec65ec5f03d4.js} +0 -0
  40. /package/dist/{934.bundle.f706defba7c22a0f9f7c.js → 934.bundle.fdb3bbaca7f62002f22f.js} +0 -0
  41. /package/dist/{9862.bundle.9f27703ec23c9c8f4cea.js → 9862.bundle.fa2e1ca195f94ef376de.js} +0 -0
  42. /package/dist/{9927.bundle.f35434a037c0f7898f13.js → 9927.bundle.cd69182c3b0b1a1c3a12.js} +0 -0
@@ -7205,10 +7205,17 @@ async function init({
7205
7205
  viewportGridService.addPresentationIdProvider('positionPresentationId', getPositionPresentationId);
7206
7206
  viewportGridService.addPresentationIdProvider('lutPresentationId', getLutPresentationId);
7207
7207
  viewportGridService.addPresentationIdProvider('segmentationPresentationId', getSegmentationPresentationId);
7208
- dist_esm.segmentation.config.style.setStyle({
7208
+ segmentationService.setStyle({
7209
7209
  type: esm_enums.SegmentationRepresentations.Contour
7210
7210
  }, {
7211
- renderFill: false
7211
+ // Declare these alpha values at the Contour type level so that they can be set/changed/inherited for all contour segmentations.
7212
+ fillAlpha: 0.5,
7213
+ fillAlphaInactive: 0.4,
7214
+ // In general do not fill contours so that hydrated RTSTRUCTs are not filled in when active or inactive by default.
7215
+ // However, hydrated RTSTRUCTs are filled in when active or inactive if the user chooses to fill ALL contours.
7216
+ // Those Contours created in OHIF (i.e. using the Segmentation Panel) will override both fill properties upon creation.
7217
+ renderFill: false,
7218
+ renderFillInactive: false
7212
7219
  });
7213
7220
  const metadataProvider = src/* default.classes */.Ay.classes.MetadataProvider;
7214
7221
  esm.volumeLoader.registerVolumeLoader('cornerstoneStreamingImageVolume', loaders/* cornerstoneStreamingImageVolumeLoader */.FC);
@@ -7834,11 +7841,27 @@ function SegmentationToolConfig() {
7834
7841
 
7835
7842
 
7836
7843
 
7837
-
7838
7844
  function getSegmentationPanelCustomization({
7839
7845
  commandsManager,
7840
7846
  servicesManager
7841
7847
  }) {
7848
+ const {
7849
+ segmentationService
7850
+ } = servicesManager.services;
7851
+ let contourRenderFillChangedGlobally = false;
7852
+
7853
+ // Listen to when the global CONTOUR type renderFill style property is changed.
7854
+ const {
7855
+ unsubscribe
7856
+ } = segmentationService.subscribe(segmentationService.EVENTS.SEGMENTATION_STYLE_MODIFIED, ({
7857
+ specifier,
7858
+ style
7859
+ }) => {
7860
+ if (specifier.type === esm_enums.SegmentationRepresentations.Contour && specifier.segmentationId == null && specifier.viewportId == null && style.renderFill != null) {
7861
+ unsubscribe();
7862
+ contourRenderFillChangedGlobally = true;
7863
+ }
7864
+ });
7842
7865
  return {
7843
7866
  'panelSegmentation.customDropdownMenuContent': CustomDropdownMenuContent,
7844
7867
  'panelSegmentation.customSegmentStatisticsHeader': CustomSegmentStatisticsHeader,
@@ -7859,12 +7882,48 @@ function getSegmentationPanelCustomization({
7859
7882
  const segmentationId = await commandsManager.run('createContourForViewport', {
7860
7883
  viewportId
7861
7884
  });
7862
- dist_esm.segmentation.config.style.setStyle({
7863
- segmentationId,
7864
- type: esm_enums.SegmentationRepresentations.Contour
7865
- }, {
7866
- fillAlpha: 0.5,
7867
- renderFill: true
7885
+ // Override the default (i.e. hydrated RTSTRUCT) style for contours if the global CONTOUR type
7886
+ // renderFill style property has not been changed.
7887
+ if (!contourRenderFillChangedGlobally) {
7888
+ segmentationService.setStyle({
7889
+ segmentationId,
7890
+ type: esm_enums.SegmentationRepresentations.Contour
7891
+ }, {
7892
+ renderFill: true,
7893
+ renderFillInactive: true
7894
+ },
7895
+ // Do not merge so that these created contours inherit other type-specific style properties like the fill alpha.
7896
+ // Merging would otherwise permanently inherit the fill alpha and any inheritance from the type level would be lost.
7897
+ false);
7898
+ }
7899
+
7900
+ // If the global CONTOUR type renderFill style property is already set, do not subscribe to the SEGMENTATION_STYLE_MODIFIED event.
7901
+ if (contourRenderFillChangedGlobally) {
7902
+ return;
7903
+ }
7904
+
7905
+ // Subscribe to the SEGMENTATION_STYLE_MODIFIED event to listen for changes to the CONTOUR type renderFill style property.
7906
+ const {
7907
+ unsubscribe
7908
+ } = segmentationService.subscribe(segmentationService.EVENTS.SEGMENTATION_STYLE_MODIFIED, ({
7909
+ specifier,
7910
+ style
7911
+ }) => {
7912
+ if (specifier.type === esm_enums.SegmentationRepresentations.Contour && specifier.segmentationId == null && specifier.viewportId == null && style.renderFill != null) {
7913
+ // We are here because the renderFill style property is globally being changed for ALL contours.
7914
+ // When this occurs, the desire is for ALL contours to inherit the property. To make this happen,
7915
+ // we have to clear the style property that was set for this specific segmentation
7916
+ // when it was created above.
7917
+ // We can now also unsubscribe because this change only needs to be made when the global CONTOUR type
7918
+ // renderFill style property is first changed.
7919
+
7920
+ contourRenderFillChangedGlobally = true;
7921
+ unsubscribe();
7922
+ segmentationService.setStyle({
7923
+ segmentationId,
7924
+ type: esm_enums.SegmentationRepresentations.Contour
7925
+ }, {}, false);
7926
+ }
7868
7927
  });
7869
7928
  }
7870
7929
  },
@@ -12120,6 +12179,24 @@ function commandsModule({
12120
12179
  renderFill: value
12121
12180
  });
12122
12181
  },
12182
+ /**
12183
+ * Sets whether to render fill for inactive segmentations of a segmentation type
12184
+ * @param props.type - The type of segmentation
12185
+ * @param props.value - Whether to render fill for inactive segmentations
12186
+ */
12187
+ setRenderFillInactiveCommand: ({
12188
+ type,
12189
+ value
12190
+ }) => {
12191
+ const {
12192
+ segmentationService
12193
+ } = servicesManager.services;
12194
+ segmentationService.setStyle({
12195
+ type
12196
+ }, {
12197
+ renderFillInactive: value
12198
+ });
12199
+ },
12123
12200
  /**
12124
12201
  * Sets whether to render outline for a segmentation type
12125
12202
  * @param props.type - The type of segmentation
@@ -12139,11 +12216,11 @@ function commandsModule({
12139
12216
  });
12140
12217
  },
12141
12218
  /**
12142
- * Sets the fill alpha for inactive segmentations
12219
+ * Sets whether to render outline for inactive segmentations of a segmentation type
12143
12220
  * @param props.type - The type of segmentation
12144
- * @param props.value - The alpha value to set
12221
+ * @param props.value - Whether to render outline for inactive segmentations
12145
12222
  */
12146
- setFillAlphaInactiveCommand: ({
12223
+ setRenderOutlineInactiveCommand: ({
12147
12224
  type,
12148
12225
  value
12149
12226
  }) => {
@@ -12153,9 +12230,41 @@ function commandsModule({
12153
12230
  segmentationService.setStyle({
12154
12231
  type
12155
12232
  }, {
12156
- fillAlphaInactive: value
12233
+ renderOutlineInactive: value
12157
12234
  });
12158
12235
  },
12236
+ /**
12237
+ * Sets the fill alpha for inactive segmentations.
12238
+ * If no type is provided, the fill alpha for all types will be set.
12239
+ * @param props.type - The type of segmentation
12240
+ * @param props.value - The alpha value to set
12241
+ */
12242
+ setFillAlphaInactiveCommand: ({
12243
+ type,
12244
+ value
12245
+ }) => {
12246
+ const {
12247
+ segmentationService
12248
+ } = servicesManager.services;
12249
+ if (type) {
12250
+ segmentationService.setStyle({
12251
+ type
12252
+ }, {
12253
+ fillAlphaInactive: value
12254
+ });
12255
+ } else {
12256
+ segmentationService.setStyle({
12257
+ type: esm_enums.SegmentationRepresentations.Labelmap
12258
+ }, {
12259
+ fillAlphaInactive: value
12260
+ });
12261
+ segmentationService.setStyle({
12262
+ type: esm_enums.SegmentationRepresentations.Contour
12263
+ }, {
12264
+ fillAlphaInactive: value
12265
+ });
12266
+ }
12267
+ },
12159
12268
  editSegmentLabel: async ({
12160
12269
  segmentationId,
12161
12270
  segmentIndex
@@ -13115,9 +13224,15 @@ function commandsModule({
13115
13224
  setRenderFill: {
13116
13225
  commandFn: actions.setRenderFillCommand
13117
13226
  },
13227
+ setRenderFillInactive: {
13228
+ commandFn: actions.setRenderFillInactiveCommand
13229
+ },
13118
13230
  setRenderOutline: {
13119
13231
  commandFn: actions.setRenderOutlineCommand
13120
13232
  },
13233
+ setRenderOutlineInactive: {
13234
+ commandFn: actions.setRenderOutlineInactiveCommand
13235
+ },
13121
13236
  setFillAlphaInactive: {
13122
13237
  commandFn: actions.setFillAlphaInactiveCommand
13123
13238
  },
@@ -19047,7 +19162,8 @@ const SegmentationService_EVENTS = {
19047
19162
  // loading completed for all segments
19048
19163
  SEGMENTATION_LOADING_COMPLETE: 'event::segmentation_loading_complete',
19049
19164
  // fired when a contour annotation cut merge process is completed
19050
- SEGMENTATION_ANNOTATION_CUT_MERGE_PROCESS_COMPLETED: 'event::annotation_cut_merge_process_completed'
19165
+ SEGMENTATION_ANNOTATION_CUT_MERGE_PROCESS_COMPLETED: 'event::annotation_cut_merge_process_completed',
19166
+ SEGMENTATION_STYLE_MODIFIED: 'event::segmentation_style_modified'
19051
19167
  };
19052
19168
  const VALUE_TYPES = {};
19053
19169
  class SegmentationService extends src/* PubSubService */.Rc {
@@ -19074,8 +19190,13 @@ class SegmentationService extends src/* PubSubService */.Rc {
19074
19190
  const style = dist_esm.segmentation.config.style.getStyle(specifier);
19075
19191
  return style;
19076
19192
  };
19077
- this.setStyle = (specifier, style) => {
19078
- dist_esm.segmentation.config.style.setStyle(specifier, style);
19193
+ this.setStyle = (specifier, style, merge = true) => {
19194
+ dist_esm.segmentation.config.style.setStyle(specifier, style, merge);
19195
+ this._broadcastEvent(SegmentationService_EVENTS.SEGMENTATION_STYLE_MODIFIED, {
19196
+ specifier,
19197
+ style,
19198
+ merge
19199
+ });
19079
19200
  };
19080
19201
  this.resetToGlobalStyle = () => {
19081
19202
  dist_esm.segmentation.config.style.resetToGlobalStyle();
@@ -20306,7 +20427,7 @@ class SegmentationService extends src/* PubSubService */.Rc {
20306
20427
  segmentationId,
20307
20428
  segmentIndex,
20308
20429
  type: LABELMAP
20309
- }, {});
20430
+ }, {}, false);
20310
20431
  }
20311
20432
  };
20312
20433
  requestAnimationFrame(animation);
@@ -20617,7 +20738,7 @@ class CornerstoneCacheService {
20617
20738
  Modality
20618
20739
  } = displaySet;
20619
20740
  const isParametricMap = Modality === 'PMAP';
20620
- const isSeg = Modality === 'SEG';
20741
+ const isSegOrRtstruct = Modality === 'SEG' || Modality === 'RTSTRUCT';
20621
20742
 
20622
20743
  // Don't create volumes for the displaySets that have custom load
20623
20744
  // function (e.g., SEG, RT, since they rely on the reference volumes
@@ -20664,7 +20785,7 @@ class CornerstoneCacheService {
20664
20785
 
20665
20786
  // Parametric maps do not have image ids but they already have volume data
20666
20787
  // therefore a new volume should not be created.
20667
- if (!isParametricMap && !isSeg && (!volumeImageIds || !volume)) {
20788
+ if (!isParametricMap && !isSegOrRtstruct && (!volumeImageIds || !volume)) {
20668
20789
  volumeImageIds = this._getCornerstoneVolumeImageIds(displaySet, dataSource);
20669
20790
  volume = await esm.volumeLoader.createAndCacheVolume(volumeId, {
20670
20791
  imageIds: volumeImageIds
@@ -23239,6 +23360,9 @@ function PanelSegmentation({
23239
23360
  setFillAlpha: ({
23240
23361
  type
23241
23362
  }, value) => {
23363
+ commandsManager.run('activateSelectedSegmentationOfType', {
23364
+ segmentationRepresentationType: type
23365
+ });
23242
23366
  commandsManager.run('setFillAlpha', {
23243
23367
  type,
23244
23368
  value
@@ -23247,6 +23371,9 @@ function PanelSegmentation({
23247
23371
  setOutlineWidth: ({
23248
23372
  type
23249
23373
  }, value) => {
23374
+ commandsManager.run('activateSelectedSegmentationOfType', {
23375
+ segmentationRepresentationType: type
23376
+ });
23250
23377
  commandsManager.run('setOutlineWidth', {
23251
23378
  type,
23252
23379
  value
@@ -23255,19 +23382,41 @@ function PanelSegmentation({
23255
23382
  setRenderFill: ({
23256
23383
  type
23257
23384
  }, value) => {
23385
+ commandsManager.run('activateSelectedSegmentationOfType', {
23386
+ segmentationRepresentationType: type
23387
+ });
23258
23388
  commandsManager.run('setRenderFill', {
23259
23389
  type,
23260
23390
  value
23261
23391
  });
23262
23392
  },
23393
+ setRenderFillInactive: ({
23394
+ type
23395
+ }, value) => {
23396
+ commandsManager.run('setRenderFillInactive', {
23397
+ type,
23398
+ value
23399
+ });
23400
+ },
23263
23401
  setRenderOutline: ({
23264
23402
  type
23265
23403
  }, value) => {
23404
+ commandsManager.run('activateSelectedSegmentationOfType', {
23405
+ segmentationRepresentationType: type
23406
+ });
23266
23407
  commandsManager.run('setRenderOutline', {
23267
23408
  type,
23268
23409
  value
23269
23410
  });
23270
23411
  },
23412
+ setRenderOutlineInactive: ({
23413
+ type
23414
+ }, value) => {
23415
+ commandsManager.run('setRenderOutlineInactive', {
23416
+ type,
23417
+ value
23418
+ });
23419
+ },
23271
23420
  setFillAlphaInactive: ({
23272
23421
  type
23273
23422
  }, value) => {
@@ -24867,6 +25016,7 @@ const utils_utils = {
24867
25016
  /* harmony default export */ const src_utils = (utils_utils);
24868
25017
  ;// ../../../extensions/cornerstone/src/utils/setUpSegmentationEventHandlers.ts
24869
25018
 
25019
+
24870
25020
  const setUpSegmentationEventHandlers = ({
24871
25021
  servicesManager,
24872
25022
  commandsManager
@@ -24899,7 +25049,7 @@ const setUpSegmentationEventHandlers = ({
24899
25049
  return;
24900
25050
  }
24901
25051
  const segmentation = segmentationService.getSegmentation(segmentationId);
24902
- const label = segmentation.cachedStats.info;
25052
+ const label = segmentation.label;
24903
25053
  const imageIds = segmentation.representationData?.Labelmap?.imageIds ?? segmentation.representationData?.Contour?.imageIds;
24904
25054
 
24905
25055
  // Create a display set for the segmentation
@@ -24908,7 +25058,7 @@ const setUpSegmentationEventHandlers = ({
24908
25058
  SOPClassUID: '1.2.840.10008.5.1.4.1.1.66.4',
24909
25059
  SOPClassHandlerId: '@ohif/extension-cornerstone-dicom-seg.sopClassHandlerModule.dicom-seg',
24910
25060
  SeriesDescription: label,
24911
- Modality: 'SEG',
25061
+ Modality: segmentation.representationData[dist_esm.Enums.SegmentationRepresentations.Contour] ? 'RTSTRUCT' : 'SEG',
24912
25062
  numImageFrames: imageIds.length,
24913
25063
  imageIds,
24914
25064
  isOverlayDisplaySet: true,
@@ -170,7 +170,7 @@
170
170
  /******/ // This function allow to reference async chunks and sibling chunks for the entrypoint
171
171
  /******/ __webpack_require__.u = (chunkId) => {
172
172
  /******/ // return url for filenames based on template
173
- /******/ return "" + chunkId + ".bundle." + {"732":"6978ac30a1e36abf06db","5858":"99a6b9de04c621694ffd","8094":"5c44190a325ac23e3e5c"}[chunkId] + ".js";
173
+ /******/ return "" + chunkId + ".bundle." + {"732":"6978ac30a1e36abf06db","5858":"d5f4bf849aaeebf5025c","8094":"5c44190a325ac23e3e5c"}[chunkId] + ".js";
174
174
  /******/ };
175
175
  /******/ })();
176
176
  /******/
@@ -1519,7 +1519,7 @@ function modeFactory({
1519
1519
  props: {
1520
1520
  leftPanels: [ohif.leftPanel],
1521
1521
  leftPanelResizable: true,
1522
- rightPanels: [cornerstone.contourSegmentationPanel, cornerstone.labelMapSegmentationPanel],
1522
+ rightPanels: [cornerstone.labelMapSegmentationPanel, cornerstone.contourSegmentationPanel],
1523
1523
  rightPanelResizable: true,
1524
1524
  // leftPanelClosed: true,
1525
1525
  viewports: [{
@@ -4878,6 +4878,11 @@ const {
4878
4878
  Polyline: RectangleROI_TID300Polyline
4879
4879
  } = dcmjs_es/* utilities */.BF.TID300;
4880
4880
  class RectangleROI extends BaseAdapter3D {
4881
+ static isValidMeasurement(measurement) {
4882
+ const graphicItem = this.getGraphicItem(measurement);
4883
+ const pointsCount = this.getPointsCount(graphicItem);
4884
+ return this.getGraphicType(graphicItem) === "POLYLINE" && (pointsCount === 4 || pointsCount === 5);
4885
+ }
4881
4886
  static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata) {
4882
4887
  const {
4883
4888
  state,
@@ -4885,6 +4890,7 @@ class RectangleROI extends BaseAdapter3D {
4885
4890
  referencedImageId,
4886
4891
  ReferencedFrameNumber
4887
4892
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, this.toolType);
4893
+ const points = worldCoords.length === 5 ? worldCoords.slice(0, 4) : worldCoords;
4888
4894
  const areaGroup = MeasurementGroup.ContentSequence.find(g => g.ValueType === "NUM" && g.ConceptNameCodeSequence[0].CodeMeaning === "Area");
4889
4895
  const cachedStats = referencedImageId ? {
4890
4896
  [`imageId:${referencedImageId}`]: {
@@ -4896,7 +4902,7 @@ class RectangleROI extends BaseAdapter3D {
4896
4902
  ...state.annotation.data,
4897
4903
  handles: {
4898
4904
  ...state.annotation.data.handles,
4899
- points: [worldCoords[0], worldCoords[1], worldCoords[3], worldCoords[2]]
4905
+ points: [points[0], points[1], points[3], points[2]]
4900
4906
  },
4901
4907
  cachedStats,
4902
4908
  frameNumber: ReferencedFrameNumber
@@ -4938,6 +4944,8 @@ _RectangleROI = RectangleROI;
4938
4944
  (() => {
4939
4945
  _RectangleROI.init("RectangleROI", RectangleROI_TID300Polyline);
4940
4946
  _RectangleROI.registerLegacy();
4947
+ _RectangleROI.registerType("DCM:111030", "POLYLINE", 4);
4948
+ _RectangleROI.registerType("DCM:111030", "POLYLINE", 5);
4941
4949
  })();
4942
4950
 
4943
4951
 
@@ -7618,6 +7618,8 @@ var Surface_surfaceDisplay = __webpack_require__(67014);
7618
7618
 
7619
7619
 
7620
7620
 
7621
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/segmentationEventManager.js
7622
+ var segmentationEventManager = __webpack_require__(10692);
7621
7623
  ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/removeSegmentationRepresentations.js
7622
7624
 
7623
7625
 
@@ -7626,6 +7628,7 @@ var Surface_surfaceDisplay = __webpack_require__(67014);
7626
7628
 
7627
7629
 
7628
7630
 
7631
+
7629
7632
  function removeSegmentationRepresentation(viewportId, specifier, immediate) {
7630
7633
  return _removeSegmentationRepresentations(viewportId, specifier, immediate);
7631
7634
  }
@@ -7685,6 +7688,7 @@ function _removeRepresentationObject(viewportId, segmentationId, type, immediate
7685
7688
  else if (representation.type === SegmentationRepresentations.Surface) {
7686
7689
  surfaceDisplay.removeRepresentation(viewportId, representation.segmentationId, immediate);
7687
7690
  }
7691
+ removeSegmentationListener(representation.segmentationId, representation.type);
7688
7692
  });
7689
7693
  const { viewport } = getEnabledElementByViewportId(viewportId) || {};
7690
7694
  if (viewport) {
@@ -7756,6 +7760,94 @@ function getLockedSegmentIndices(segmentationId) {
7756
7760
 
7757
7761
 
7758
7762
 
7763
+ /***/ }),
7764
+
7765
+ /***/ 10692:
7766
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7767
+
7768
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7769
+ /* harmony export */ Np: () => (/* binding */ addDefaultSegmentationListener)
7770
+ /* harmony export */ });
7771
+ /* unused harmony exports addSegmentationListener, removeSegmentationListener, removeAllSegmentationListeners */
7772
+ /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
7773
+ /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99737);
7774
+ /* harmony import */ var _triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(49906);
7775
+ /* harmony import */ var _utilities_debounce__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(52905);
7776
+ /* harmony import */ var _tools_displayTools_Surface_surfaceDisplay__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(67014);
7777
+ /* harmony import */ var _tools_displayTools_Contour_contourDisplay__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(25894);
7778
+ /* harmony import */ var _tools_displayTools_Labelmap_labelmapDisplay__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(684);
7779
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(33283);
7780
+
7781
+
7782
+
7783
+
7784
+
7785
+
7786
+
7787
+
7788
+ const renderers = {
7789
+ [_enums__WEBPACK_IMPORTED_MODULE_1__.SegmentationRepresentations.Labelmap]: _tools_displayTools_Labelmap_labelmapDisplay__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Ay,
7790
+ [_enums__WEBPACK_IMPORTED_MODULE_1__.SegmentationRepresentations.Contour]: _tools_displayTools_Contour_contourDisplay__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A,
7791
+ [_enums__WEBPACK_IMPORTED_MODULE_1__.SegmentationRepresentations.Surface]: _tools_displayTools_Surface_surfaceDisplay__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Ay,
7792
+ };
7793
+ const segmentationListeners = new Map();
7794
+ function addDefaultSegmentationListener(viewport, segmentationId, representationType) {
7795
+ const updateFunction = renderers[representationType].getUpdateFunction(viewport);
7796
+ if (updateFunction) {
7797
+ addSegmentationListener(segmentationId, representationType, updateFunction);
7798
+ }
7799
+ }
7800
+ function addSegmentationListener(segmentationId, representationType, updateFunction) {
7801
+ if (!segmentationListeners.has(segmentationId)) {
7802
+ segmentationListeners.set(segmentationId, new Map());
7803
+ }
7804
+ const listenerMap = segmentationListeners.get(segmentationId);
7805
+ if (listenerMap.has(representationType)) {
7806
+ removeSegmentationListener(segmentationId, representationType);
7807
+ }
7808
+ const listener = createDebouncedSegmentationListener(segmentationId, representationType, updateFunction);
7809
+ _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.eventTarget.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_1__.Events.SEGMENTATION_DATA_MODIFIED, listener);
7810
+ listenerMap.set(representationType, listener);
7811
+ }
7812
+ function removeSegmentationListener(segmentationId, representationType) {
7813
+ const listenerMap = segmentationListeners.get(segmentationId);
7814
+ if (!listenerMap) {
7815
+ return;
7816
+ }
7817
+ const listener = listenerMap.get(representationType);
7818
+ if (!listener) {
7819
+ return;
7820
+ }
7821
+ _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.eventTarget.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_1__.Events.SEGMENTATION_DATA_MODIFIED, listener);
7822
+ listenerMap.delete(representationType);
7823
+ }
7824
+ function removeAllSegmentationListeners(segmentationId) {
7825
+ const listenerMap = segmentationListeners.get(segmentationId);
7826
+ if (!listenerMap) {
7827
+ return;
7828
+ }
7829
+ for (const listener of listenerMap.values()) {
7830
+ eventTarget.removeEventListener(Events.SEGMENTATION_DATA_MODIFIED, listener);
7831
+ }
7832
+ segmentationListeners.delete(segmentationId);
7833
+ }
7834
+ function createDebouncedSegmentationListener(segmentationId, representationType, updateFunction) {
7835
+ const debouncedHandler = (0,_utilities_debounce__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A)((event) => {
7836
+ const eventSegmentationId = event.detail?.segmentationId;
7837
+ const segmentation = (0,_getSegmentation__WEBPACK_IMPORTED_MODULE_7__/* .getSegmentation */ .T)(eventSegmentationId);
7838
+ if (eventSegmentationId === segmentationId &&
7839
+ !!segmentation?.representationData?.[representationType]) {
7840
+ updateFunction(segmentationId);
7841
+ (0,_triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_2__.triggerSegmentationModified)(segmentationId);
7842
+ }
7843
+ }, 300);
7844
+ return ((event) => {
7845
+ debouncedHandler(event);
7846
+ });
7847
+ }
7848
+
7849
+
7850
+
7759
7851
  /***/ }),
7760
7852
 
7761
7853
  /***/ 98870:
@@ -12773,6 +12865,8 @@ var createLabelmapVolumeForViewport = __webpack_require__(97492);
12773
12865
  var enums = __webpack_require__(99737);
12774
12866
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/enums/SegmentationRepresentations.js
12775
12867
  var enums_SegmentationRepresentations = __webpack_require__(18682);
12868
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getSegmentation.js
12869
+ var segmentation_getSegmentation = __webpack_require__(33283);
12776
12870
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getSegmentationRepresentation.js
12777
12871
  var getSegmentationRepresentation = __webpack_require__(93210);
12778
12872
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Surface/surfaceDisplay.js
@@ -12789,6 +12883,8 @@ var state = __webpack_require__(85204);
12789
12883
  var PlanarFreehandContourSegmentationTool = __webpack_require__(37590);
12790
12884
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/store/ToolGroupManager/index.js + 6 modules
12791
12885
  var ToolGroupManager = __webpack_require__(77609);
12886
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/segmentationEventManager.js
12887
+ var segmentationEventManager = __webpack_require__(10692);
12792
12888
  ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/SegmentationRenderingEngine.js
12793
12889
 
12794
12890
 
@@ -12801,6 +12897,8 @@ var ToolGroupManager = __webpack_require__(77609);
12801
12897
 
12802
12898
 
12803
12899
 
12900
+
12901
+
12804
12902
  const renderers = {
12805
12903
  [enums_SegmentationRepresentations/* default */.A.Labelmap]: labelmapDisplay/* default */.Ay,
12806
12904
  [enums_SegmentationRepresentations/* default */.A.Contour]: contourDisplay/* default */.A,
@@ -12894,15 +12992,19 @@ class SegmentationRenderingEngine {
12894
12992
  if (!viewport) {
12895
12993
  return;
12896
12994
  }
12897
- const viewportRenderList = [];
12898
12995
  const segmentationRenderList = segmentationRepresentations.map((representation) => {
12899
12996
  if (representation.type === enums.SegmentationRepresentations.Contour) {
12900
12997
  this._addPlanarFreeHandToolIfAbsent(viewport);
12901
12998
  }
12902
12999
  const display = renderers[representation.type];
13000
+ const segmentation = (0,segmentation_getSegmentation/* getSegmentation */.T)(representation.segmentationId);
13001
+ const existingRepresentation = segmentation.representationData[representation.type] !== undefined;
12903
13002
  try {
12904
- const viewportId = display.render(viewport, representation);
12905
- viewportRenderList.push(viewportId);
13003
+ display.render(viewport, representation).then(() => {
13004
+ if (!existingRepresentation) {
13005
+ (0,segmentationEventManager/* addDefaultSegmentationListener */.Np)(viewport, representation.segmentationId, representation.type);
13006
+ }
13007
+ });
12906
13008
  }
12907
13009
  catch (error) {
12908
13010
  console.error(error);
@@ -14281,8 +14383,6 @@ var getOrCreateImageVolume = __webpack_require__(83075);
14281
14383
  var getStatistics = __webpack_require__(38440);
14282
14384
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/segmentation/validateLabelmap.js
14283
14385
  var validateLabelmap = __webpack_require__(21345);
14284
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getSegmentation.js
14285
- var segmentation_getSegmentation = __webpack_require__(33283);
14286
14386
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.js
14287
14387
  var triggerSegmentationEvents = __webpack_require__(49906);
14288
14388
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/constants/COLOR_LUT.js
@@ -14353,6 +14453,8 @@ function segmentIndex_setActiveSegmentIndex(segmentationId, segmentIndex) {
14353
14453
 
14354
14454
 
14355
14455
 
14456
+
14457
+
14356
14458
  function internalAddSegmentationRepresentation_internalAddSegmentationRepresentation(viewportId, representationInput) {
14357
14459
  const { segmentationId, config } = representationInput;
14358
14460
  const renderingConfig = {
@@ -14360,6 +14462,10 @@ function internalAddSegmentationRepresentation_internalAddSegmentationRepresenta
14360
14462
  ...config,
14361
14463
  };
14362
14464
  defaultSegmentationStateManager.addSegmentationRepresentation(viewportId, segmentationId, representationInput.type, renderingConfig);
14465
+ const { viewport } = getEnabledElementByViewportId(viewportId) || {};
14466
+ if (viewport) {
14467
+ addDefaultSegmentationListener(viewport, segmentationId, representationInput.type);
14468
+ }
14363
14469
  if (!getActiveSegmentIndex(segmentationId)) {
14364
14470
  let firstSegmentIndex = 1;
14365
14471
  const segmentation = defaultSegmentationStateManager.getSegmentation(segmentationId);
@@ -14374,6 +14480,9 @@ function internalAddSegmentationRepresentation_internalAddSegmentationRepresenta
14374
14480
  if (representationInput.type === SegmentationRepresentations.Contour) {
14375
14481
  triggerAnnotationRenderForViewportIds([viewportId]);
14376
14482
  }
14483
+ if (representationInput.type === SegmentationRepresentations.Surface) {
14484
+ triggerSegmentationDataModified(segmentationId);
14485
+ }
14377
14486
  triggerSegmentationModified(segmentationId);
14378
14487
  }
14379
14488
  function getColorLUTIndex(config) {