@ohif/app 3.11.0-beta.7 → 3.11.0-beta.70

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 (64) hide show
  1. package/dist/{3166.bundle.0f97235b970e279a4707.js → 1443.bundle.1514ced63fdeb24497a5.js} +1452 -110
  2. package/dist/{1459.bundle.49d00b9d93ad086d9b9f.js → 1459.bundle.ac169b2e856370bcda98.js} +4 -5
  3. package/dist/{9026.bundle.37f3be98189966cc21e4.js → 147.bundle.7d490566f0b21be6e8f6.js} +185 -350
  4. package/dist/147.css +3 -0
  5. package/dist/{1807.bundle.d2b74ec4f34bacff0e2f.js → 1807.bundle.0c70ce9e3d873e6a5f8c.js} +144 -14
  6. package/dist/{1919.bundle.8b037093245b6dbe1c72.js → 1919.bundle.e1d6a15210e3023ca78c.js} +13 -9
  7. package/dist/{1927.bundle.83810560c4d3a90eb7cf.js → 1927.bundle.8ff87d0f7b5c9827c0b7.js} +1 -1
  8. package/dist/1943.bundle.29dff94baef3720ad5d5.js +1119 -0
  9. package/dist/{6029.bundle.c5d0baf943c367e7bcb8.js → 2011.bundle.ed6e0ec41068815b40ce.js} +16678 -37810
  10. package/dist/2108.bundle.e84aa8d858d8c4f2413e.js +25374 -0
  11. package/dist/{213.bundle.58db799a4fd1f94aeeb9.js → 213.bundle.883c672493c4b1e6ef29.js} +17 -16
  12. package/dist/{2424.bundle.502d96ba98a65f9bd13a.js → 2424.bundle.f91550a801e0f8ac30c2.js} +16 -18
  13. package/dist/{2701.bundle.f1f15df81406d04851c4.js → 2701.bundle.5aee709c1e018fe8c2c1.js} +15 -182
  14. package/dist/{3396.bundle.858cfdfc5ab560840958.js → 2803.bundle.8363a9ebc8eb3a960428.js} +2051 -1736
  15. package/dist/{4991.bundle.f72a01fd158167a94ae8.js → 2974.bundle.361b332eda0990f6cacc.js} +553 -1
  16. package/dist/{3353.bundle.184ebb9668df2cbebd26.js → 3353.bundle.1da534e468bbcdfb3e61.js} +71 -25
  17. package/dist/{7241.bundle.75e0b3d71dbd342e8435.js → 3547.bundle.79ff367bdb1d61f9cac1.js} +15284 -11330
  18. package/dist/{3658.bundle.fddcf6f37a5b78269d5c.js → 3658.bundle.2260426fccb7b3120e42.js} +6 -6
  19. package/dist/{2860.bundle.5d93c30e2df60e382bda.js → 3791.bundle.911326845611f005e857.js} +1658 -607
  20. package/dist/{4113.bundle.6023132d71c31aebf166.js → 4113.bundle.77d9a7a50f4dabe5319c.js} +24 -60
  21. package/dist/{2932.bundle.d9d52b37a070e8ba7f7d.js → 414.bundle.2652d95e4a790a198100.js} +224 -116
  22. package/dist/{4202.bundle.89ae773b645db3b1c59c.js → 4202.bundle.c1b3daf423902b64d223.js} +6 -8
  23. package/dist/{4759.bundle.a31dcfd4c3054e2ea980.js → 4759.bundle.4da90b9346bb5e377ac6.js} +1 -0
  24. package/dist/5349.bundle.e6acd4609ca1ebeb6f7f.js +264 -0
  25. package/dist/{5674.bundle.b9c6a5039c2113262ae5.js → 5674.bundle.8c737c7addfe5011b8af.js} +1 -0
  26. package/dist/{9464.bundle.bc0e50f8b60edfdcb9d4.js → 5886.bundle.89591925de5c2f496ff1.js} +4189 -805
  27. package/dist/{6027.bundle.62eb5b7a87fd90858481.js → 6027.bundle.bfbdf5beee7796fc4a62.js} +9 -7
  28. package/dist/{6201.bundle.5a5edae10f2a162ea246.js → 6201.bundle.80aa88f7fbeef5c9c698.js} +18 -14
  29. package/dist/{9977.bundle.071821200c1921021d29.js → 6216.bundle.7b9f2a852393f4818f33.js} +277 -204
  30. package/dist/{6376.bundle.baa1088702940b82e198.js → 6376.bundle.2bc0cb4c1dfb24e7821c.js} +1 -1
  31. package/dist/{3075.bundle.0624f6bf3f676f30d1b5.js → 7079.bundle.67d7e6604e105c4bc3b5.js} +300 -189
  32. package/dist/{7159.bundle.9c21bc29860ed1850c67.js → 7159.bundle.71fc1d465a641a38d55c.js} +19 -6
  33. package/dist/{7190.bundle.2b96b2c6711301b56d54.js → 7190.bundle.5dd1bbf8270acf285eae.js} +30 -12
  34. package/dist/{7197.bundle.8d83a7b85d9acf5cea4a.js → 7197.bundle.f873de3a0a42a53a361a.js} +27 -16
  35. package/dist/{8185.bundle.0dde37bbed6dbbf102d3.js → 7431.bundle.0ad249bb005f759ecb23.js} +154 -64
  36. package/dist/{7639.bundle.bab513406f6ebd677cb4.js → 7639.bundle.01ca196904ba572872e3.js} +179 -25
  37. package/dist/{810.bundle.0e5d66a08beead643c4a.js → 810.bundle.3394ec577c515c2a4cad.js} +21 -23
  38. package/dist/{8228.bundle.74c8ca5e66a44db80464.js → 8228.bundle.a233d729eb8b0b7d13d1.js} +6 -6
  39. package/dist/8228.css +1 -1
  40. package/dist/{3984.bundle.7d348bf4296f0e694989.js → 8420.bundle.0c79a41d03185b551f09.js} +711 -557
  41. package/dist/{85.bundle.dfc519b7ad389085b1bc.js → 85.bundle.f89ed68bb47749c78597.js} +147 -25
  42. package/dist/{8558.bundle.07a9426d1509c9330032.js → 8558.bundle.213a120fdf05cc52cd68.js} +32 -23
  43. package/dist/860.bundle.e829a4d86d63381b7ee3.js +1240 -0
  44. package/dist/860.css +3 -0
  45. package/dist/{4526.bundle.fbdd617a934353019be3.js → 8740.bundle.c806cf516808070fd001.js} +37 -229
  46. package/dist/{8815.bundle.97396bcf73fb9d0c931d.js → 8815.bundle.5558b84d6b5262e2af3c.js} +150 -19
  47. package/dist/{934.bundle.89d59988874b5cbbc7c2.js → 934.bundle.535a14ad6079c2e47214.js} +3 -2
  48. package/dist/{2914.bundle.a0a5ddfebfc9d429063d.js → 9594.bundle.a5ec427281e682dd7873.js} +153 -81
  49. package/dist/{963.bundle.b88e6ceb0e69a4f5f2ea.js → 963.bundle.7ee0a33e99d6bdf50133.js} +157 -12
  50. package/dist/{9862.bundle.ccb787865a82b9696113.js → 9862.bundle.a8886d2df68809b695ab.js} +20 -58
  51. package/dist/{app.bundle.d3225bd8c26100781bf7.js → app.bundle.14d8a919943473644806.js} +231498 -276277
  52. package/dist/app.bundle.css +4 -26
  53. package/dist/{compute.bundle.f0c30502c027d04e94f2.js → compute.bundle.782c03fcef507db50532.js} +3 -3
  54. package/dist/index.html +2 -2
  55. package/dist/{interpolation.bundle.26c71e2b635b13e01127.js → interpolation.bundle.9226cca4caf2ef9a59e7.js} +1 -1
  56. package/dist/{polySeg.bundle.707e6d9b0342d06ffa49.js → polySeg.bundle.a17c82e6f03118918698.js} +3 -3
  57. package/dist/sw.js +1 -1
  58. package/package.json +22 -20
  59. package/dist/9026.css +0 -3
  60. package/dist/9890.bundle.37d7ed265c0454337a57.js +0 -480
  61. /package/dist/{2932.css → 414.css} +0 -0
  62. /package/dist/{9890.css → 5349.css} +0 -0
  63. /package/dist/{6939.bundle.45622b7920dac102b5a7.js → 6939.bundle.41fbdef87597b5172ec6.js} +0 -0
  64. /package/dist/{4526.css → 8740.css} +0 -0
@@ -1,6 +1,6 @@
1
- (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[3166],{
1
+ (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[1443],{
2
2
 
3
- /***/ 59874:
3
+ /***/ 34279:
4
4
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5
5
 
6
6
  "use strict";
@@ -15,6 +15,8 @@ __webpack_require__.d(__webpack_exports__, {
15
15
  _$: () => (/* reexport */ helpers_namespaceObject)
16
16
  });
17
17
 
18
+ // UNUSED EXPORTS: NO_IMAGE_ID
19
+
18
20
  // NAMESPACE OBJECT: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone/Segmentation.js
19
21
  var Segmentation_namespaceObject = {};
20
22
  __webpack_require__.r(Segmentation_namespaceObject);
@@ -2707,6 +2709,18 @@ function Segmentation_4X_unpackPixelData(multiframe, options) {
2707
2709
  // MAX 2GB is the limit right now to allocate a buffer
2708
2710
  return getUnpackedChunks(data, options.maxBytesPerChunk);
2709
2711
  }
2712
+ if (segType === "LABELMAP") {
2713
+ // For LABELMAP, we can return the data as is, since it is already in a
2714
+ // format that Cornerstone can handle. Also here we are returning the
2715
+ // whole data at once, since the storage is more efficent than BINARY mode
2716
+ if (multiframe.BitsStored === 8) {
2717
+ return new Uint8Array(data);
2718
+ } else if (multiframe.BitsStored === 16) {
2719
+ return new Uint16Array(data);
2720
+ } else {
2721
+ return new Uint8Array(data);
2722
+ }
2723
+ }
2710
2724
  const pixelData = new Uint8Array(data);
2711
2725
  const max = multiframe.MaximumFractionalValue;
2712
2726
  const onlyMaxAndZero = pixelData.find(element => element !== 0 && element !== max) === undefined;
@@ -3332,6 +3346,8 @@ const CornerstonePMAP = {
3332
3346
 
3333
3347
 
3334
3348
 
3349
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 1 modules
3350
+ var esm = __webpack_require__(15327);
3335
3351
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone3D/cornerstone3DTag.js
3336
3352
  var CORNERSTONE_3D_TAG = "Cornerstone3DTools@^0.1.0";
3337
3353
 
@@ -3358,6 +3374,25 @@ function copyStudyTags(src) {
3358
3374
 
3359
3375
 
3360
3376
 
3377
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/helpers/copySeriesTags.js
3378
+ const seriesTags = ["SeriesInstanceUID", "SeriesNumber", "SeriesDescription", "Modality", "SeriesDate", "SeriesTime"];
3379
+ function copySeriesTags(src) {
3380
+ const study = {
3381
+ _meta: src._meta,
3382
+ _vrMap: src._vrMap
3383
+ };
3384
+ for (const tagKey of seriesTags) {
3385
+ const value = src[tagKey];
3386
+ if (value === undefined) {
3387
+ continue;
3388
+ }
3389
+ study[tagKey] = value;
3390
+ }
3391
+ return study;
3392
+ }
3393
+
3394
+
3395
+
3361
3396
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone3D/CodingScheme.js
3362
3397
  // This is a custom coding scheme defined to store some annotations from Cornerstone.
3363
3398
  // Note: CodeMeaning is VR type LO, which means we only actually support 64 characters
@@ -3375,6 +3410,11 @@ const CodingScheme = {
3375
3410
 
3376
3411
 
3377
3412
 
3413
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone3D/constants/index.js
3414
+ const NO_IMAGE_ID = "none";
3415
+
3416
+
3417
+
3378
3418
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone3D/MeasurementReport.js
3379
3419
 
3380
3420
 
@@ -3384,6 +3424,9 @@ const CodingScheme = {
3384
3424
 
3385
3425
 
3386
3426
 
3427
+
3428
+
3429
+
3387
3430
  var _MeasurementReport;
3388
3431
  const {
3389
3432
  TID1500: MeasurementReport_TID1500,
@@ -3469,15 +3512,13 @@ class MeasurementReport_MeasurementReport {
3469
3512
  };
3470
3513
  return _meta;
3471
3514
  }
3472
- static getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, toolType) {
3473
- const {
3474
- ContentSequence
3475
- } = MeasurementGroup;
3476
- const contentSequenceArr = toArray(ContentSequence);
3477
- const findingGroup = contentSequenceArr.find(group => this.codeValueMatch(group, MeasurementReport_FINDING));
3478
- const findingSiteGroups = contentSequenceArr.filter(group => this.codeValueMatch(group, MeasurementReport_FINDING_SITE, MeasurementReport_FINDING_SITE_OLD)) || [];
3479
- const NUMGroup = contentSequenceArr.find(group => group.ValueType === "NUM");
3480
- const SCOORDGroup = toArray(NUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD");
3515
+ static processSCOORDGroup(_ref) {
3516
+ let {
3517
+ SCOORDGroup,
3518
+ toolType,
3519
+ sopInstanceUIDToImageIdMap,
3520
+ metadata
3521
+ } = _ref;
3481
3522
  const {
3482
3523
  ReferencedSOPSequence
3483
3524
  } = SCOORDGroup.ContentSequence;
@@ -3487,23 +3528,101 @@ class MeasurementReport_MeasurementReport {
3487
3528
  } = ReferencedSOPSequence;
3488
3529
  const referencedImageId = sopInstanceUIDToImageIdMap[ReferencedSOPInstanceUID];
3489
3530
  const imagePlaneModule = metadata.get("imagePlaneModule", referencedImageId);
3531
+ return {
3532
+ SCOORDGroup,
3533
+ ReferencedSOPSequence,
3534
+ ReferencedSOPInstanceUID,
3535
+ ReferencedFrameNumber,
3536
+ state: {
3537
+ description: undefined,
3538
+ sopInstanceUid: ReferencedSOPInstanceUID,
3539
+ annotation: {
3540
+ annotationUID: MeasurementReport_DicomMetaDictionary.uid(),
3541
+ metadata: {
3542
+ toolName: toolType,
3543
+ referencedImageId,
3544
+ FrameOfReferenceUID: imagePlaneModule.frameOfReferenceUID,
3545
+ label: ""
3546
+ }
3547
+ }
3548
+ }
3549
+ };
3550
+ }
3551
+ static processSCOORD3DGroup(_ref2) {
3552
+ let {
3553
+ SCOORD3DGroup,
3554
+ toolType
3555
+ } = _ref2;
3556
+ return {
3557
+ SCOORD3DGroup,
3558
+ FrameOfReferenceUID: SCOORD3DGroup.ReferencedFrameOfReferenceUID,
3559
+ state: {
3560
+ description: undefined,
3561
+ annotation: {
3562
+ annotationUID: MeasurementReport_DicomMetaDictionary.uid(),
3563
+ metadata: {
3564
+ toolName: toolType,
3565
+ FrameOfReferenceUID: SCOORD3DGroup.ReferencedFrameOfReferenceUID,
3566
+ label: ""
3567
+ }
3568
+ }
3569
+ }
3570
+ };
3571
+ }
3572
+ static getSpatialCoordinatesState(_ref3) {
3573
+ let {
3574
+ NUMGroup,
3575
+ sopInstanceUIDToImageIdMap,
3576
+ metadata,
3577
+ toolType
3578
+ } = _ref3;
3579
+ const SCOORDGroup = toArray(NUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD");
3580
+ const SCOORD3DGroup = toArray(NUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD3D");
3581
+ if (SCOORDGroup) {
3582
+ return this.processSCOORDGroup({
3583
+ SCOORDGroup,
3584
+ toolType,
3585
+ metadata,
3586
+ sopInstanceUIDToImageIdMap
3587
+ });
3588
+ } else if (SCOORD3DGroup) {
3589
+ return this.processSCOORD3DGroup({
3590
+ SCOORD3DGroup,
3591
+ toolType
3592
+ });
3593
+ } else {
3594
+ throw new Error("No spatial coordinates group found.");
3595
+ }
3596
+ }
3597
+ static processSpatialCoordinatesGroup(_ref4) {
3598
+ let {
3599
+ NUMGroup,
3600
+ sopInstanceUIDToImageIdMap,
3601
+ metadata,
3602
+ findingGroup,
3603
+ findingSiteGroups,
3604
+ toolType
3605
+ } = _ref4;
3606
+ const {
3607
+ state,
3608
+ SCOORDGroup,
3609
+ ReferencedSOPSequence,
3610
+ ReferencedSOPInstanceUID,
3611
+ ReferencedFrameNumber,
3612
+ SCOORD3DGroup,
3613
+ FrameOfReferenceUID
3614
+ } = this.getSpatialCoordinatesState({
3615
+ NUMGroup,
3616
+ sopInstanceUIDToImageIdMap,
3617
+ metadata,
3618
+ toolType
3619
+ });
3490
3620
  const finding = findingGroup ? MeasurementReport_addAccessors(findingGroup.ConceptCodeSequence) : undefined;
3491
3621
  const findingSites = findingSiteGroups.map(fsg => {
3492
3622
  return MeasurementReport_addAccessors(fsg.ConceptCodeSequence);
3493
3623
  });
3494
3624
  const defaultState = {
3495
- description: undefined,
3496
- sopInstanceUid: ReferencedSOPInstanceUID,
3497
- annotation: {
3498
- annotationUID: MeasurementReport_DicomMetaDictionary.uid(),
3499
- metadata: {
3500
- toolName: toolType,
3501
- referencedImageId,
3502
- FrameOfReferenceUID: imagePlaneModule.frameOfReferenceUID,
3503
- label: ""
3504
- },
3505
- data: undefined
3506
- },
3625
+ ...state,
3507
3626
  finding,
3508
3627
  findingSites
3509
3628
  };
@@ -3517,39 +3636,96 @@ class MeasurementReport_MeasurementReport {
3517
3636
  SCOORDGroup,
3518
3637
  ReferencedSOPSequence,
3519
3638
  ReferencedSOPInstanceUID,
3520
- ReferencedFrameNumber
3639
+ ReferencedFrameNumber,
3640
+ SCOORD3DGroup,
3641
+ FrameOfReferenceUID
3642
+ };
3643
+ }
3644
+ static getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, toolType) {
3645
+ const {
3646
+ ContentSequence
3647
+ } = MeasurementGroup;
3648
+ const contentSequenceArr = toArray(ContentSequence);
3649
+ const findingGroup = contentSequenceArr.find(group => this.codeValueMatch(group, MeasurementReport_FINDING));
3650
+ const findingSiteGroups = contentSequenceArr.filter(group => this.codeValueMatch(group, MeasurementReport_FINDING_SITE, MeasurementReport_FINDING_SITE_OLD)) || [];
3651
+ const NUMGroup = contentSequenceArr.find(group => group.ValueType === "NUM");
3652
+ return this.processSpatialCoordinatesGroup({
3653
+ NUMGroup,
3654
+ sopInstanceUIDToImageIdMap,
3655
+ metadata,
3656
+ findingGroup,
3657
+ findingSiteGroups,
3658
+ toolType
3659
+ });
3660
+ }
3661
+ static generateReferencedSOPSequence(_ref5) {
3662
+ let {
3663
+ toolData,
3664
+ toolTypes,
3665
+ metadataProvider,
3666
+ imageId,
3667
+ sopInstanceUIDsToSeriesInstanceUIDMap,
3668
+ derivationSourceDatasets
3669
+ } = _ref5;
3670
+ const effectiveImageId = imageId === NO_IMAGE_ID ? this.getImageIdFromVolume({
3671
+ toolData,
3672
+ toolTypes
3673
+ }) : imageId;
3674
+ const sopCommonModule = metadataProvider.get("sopCommonModule", effectiveImageId);
3675
+ const instance = metadataProvider.get("instance", effectiveImageId);
3676
+ const {
3677
+ sopInstanceUID,
3678
+ sopClassUID
3679
+ } = sopCommonModule;
3680
+ const {
3681
+ SeriesInstanceUID: seriesInstanceUID
3682
+ } = instance;
3683
+ sopInstanceUIDsToSeriesInstanceUIDMap[sopInstanceUID] = seriesInstanceUID;
3684
+ if (!derivationSourceDatasets.find(dsd => dsd.SeriesInstanceUID === seriesInstanceUID)) {
3685
+ const derivationSourceDataset = MeasurementReport_MeasurementReport.generateDerivationSourceDataset(instance);
3686
+ derivationSourceDatasets.push(derivationSourceDataset);
3687
+ }
3688
+ const frameNumber = metadataProvider.get("frameNumber", effectiveImageId);
3689
+ const ReferencedSOPSequence = {
3690
+ ReferencedSOPClassUID: sopClassUID,
3691
+ ReferencedSOPInstanceUID: sopInstanceUID,
3692
+ ReferencedFrameNumber: undefined
3521
3693
  };
3694
+ if (instance && instance.NumberOfFrames && instance.NumberOfFrames > 1 || MeasurementReport_Normalizer.isMultiframeSOPClassUID(sopClassUID)) {
3695
+ ReferencedSOPSequence.ReferencedFrameNumber = frameNumber;
3696
+ }
3697
+ return ReferencedSOPSequence;
3698
+ }
3699
+ static getImageIdFromVolume(_ref6) {
3700
+ let {
3701
+ toolData,
3702
+ toolTypes
3703
+ } = _ref6;
3704
+ const referenceToolData = toolData?.[toolTypes?.[0]]?.data?.[0];
3705
+ const volumeId = referenceToolData?.metadata?.volumeId;
3706
+ const volume = esm.cache.getVolume(volumeId);
3707
+ const imageId = volume.imageIds[0];
3708
+ return imageId;
3522
3709
  }
3523
3710
  static generateReport(toolState, metadataProvider, worldToImageCoords, options) {
3524
3711
  let allMeasurementGroups = [];
3525
3712
  const sopInstanceUIDsToSeriesInstanceUIDMap = {};
3526
3713
  const derivationSourceDatasets = [];
3527
3714
  const _meta = MeasurementReport_MeasurementReport.generateDatasetMeta();
3715
+ let is3DSR = false;
3528
3716
  Object.keys(toolState).forEach(imageId => {
3529
- const sopCommonModule = metadataProvider.get("sopCommonModule", imageId);
3530
- const instance = metadataProvider.get("instance", imageId);
3531
- const {
3532
- sopInstanceUID,
3533
- sopClassUID
3534
- } = sopCommonModule;
3535
- const {
3536
- SeriesInstanceUID: seriesInstanceUID
3537
- } = instance;
3538
- sopInstanceUIDsToSeriesInstanceUIDMap[sopInstanceUID] = seriesInstanceUID;
3539
- if (!derivationSourceDatasets.find(dsd => dsd.SeriesInstanceUID === seriesInstanceUID)) {
3540
- const derivationSourceDataset = MeasurementReport_MeasurementReport.generateDerivationSourceDataset(instance);
3541
- derivationSourceDatasets.push(derivationSourceDataset);
3542
- }
3543
- const frameNumber = metadataProvider.get("frameNumber", imageId);
3544
3717
  const toolData = toolState[imageId];
3545
3718
  const toolTypes = Object.keys(toolData);
3546
- const ReferencedSOPSequence = {
3547
- ReferencedSOPClassUID: sopClassUID,
3548
- ReferencedSOPInstanceUID: sopInstanceUID,
3549
- ReferencedFrameNumber: undefined
3550
- };
3551
- if (instance && instance.NumberOfFrames && instance.NumberOfFrames > 1 || MeasurementReport_Normalizer.isMultiframeSOPClassUID(sopClassUID)) {
3552
- ReferencedSOPSequence.ReferencedFrameNumber = frameNumber;
3719
+ const ReferencedSOPSequence = this.generateReferencedSOPSequence({
3720
+ toolData,
3721
+ toolTypes,
3722
+ metadataProvider,
3723
+ imageId,
3724
+ sopInstanceUIDsToSeriesInstanceUIDMap,
3725
+ derivationSourceDatasets
3726
+ });
3727
+ if (imageId === NO_IMAGE_ID) {
3728
+ is3DSR = true;
3553
3729
  }
3554
3730
  const measurementGroups = [];
3555
3731
  toolTypes.forEach(toolType => {
@@ -3571,6 +3747,9 @@ class MeasurementReport_MeasurementReport {
3571
3747
  report.dataset = Object.assign(report.dataset, contentItem);
3572
3748
  report.dataset._meta = _meta;
3573
3749
  report.SpecificCharacterSet = "ISO_IR 192";
3750
+ if (is3DSR) {
3751
+ report.dataset.SOPClassUID = MeasurementReport_DicomMetaDictionary.sopClassUIDsByName.Comprehensive3DSR;
3752
+ }
3574
3753
  return report;
3575
3754
  }
3576
3755
  static generateToolState(dataset, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata, hooks) {
@@ -3661,9 +3840,12 @@ _MeasurementReport.codeValueMatch = (group, code, oldCode) => {
3661
3840
  return CodingSchemeDesignator == code.CodingSchemeDesignator && CodeValue == code.CodeValue || oldCode && CodingSchemeDesignator == oldCode.CodingSchemeDesignator && CodeValue == oldCode.CodeValue;
3662
3841
  };
3663
3842
  _MeasurementReport.generateDerivationSourceDataset = instance => {
3664
- _MeasurementReport.generateDatasetMeta();
3665
- const derivationSourceDataset = copyStudyTags(instance);
3666
- return derivationSourceDataset;
3843
+ const studyTags = copyStudyTags(instance);
3844
+ const seriesTags = copySeriesTags(instance);
3845
+ return {
3846
+ ...studyTags,
3847
+ ...seriesTags
3848
+ };
3667
3849
  };
3668
3850
 
3669
3851
 
@@ -3736,7 +3918,7 @@ class BaseAdapter3D {
3736
3918
  referencedImageId
3737
3919
  } = metadata;
3738
3920
  if (!referencedImageId) {
3739
- throw new Error("Probe.getTID300RepresentationArguments: referencedImageId is not defined");
3921
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
3740
3922
  }
3741
3923
  const {
3742
3924
  handles: {
@@ -3758,6 +3940,30 @@ class BaseAdapter3D {
3758
3940
  };
3759
3941
  return tidArguments;
3760
3942
  }
3943
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
3944
+ const {
3945
+ data,
3946
+ finding,
3947
+ findingSites
3948
+ } = tool;
3949
+ const {
3950
+ handles: {
3951
+ points = []
3952
+ }
3953
+ } = data;
3954
+ const point = points[0];
3955
+ const pointXYZ = {
3956
+ x: point[0],
3957
+ y: point[1],
3958
+ z: point[2]
3959
+ };
3960
+ return {
3961
+ points: [pointXYZ],
3962
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
3963
+ findingSites: findingSites || [],
3964
+ finding
3965
+ };
3966
+ }
3761
3967
  }
3762
3968
 
3763
3969
 
@@ -3780,10 +3986,69 @@ class ArrowAnnotate_ArrowAnnotate extends BaseAdapter3D {
3780
3986
  const {
3781
3987
  defaultState,
3782
3988
  SCOORDGroup,
3989
+ SCOORD3DGroup,
3783
3990
  ReferencedFrameNumber
3784
3991
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, ArrowAnnotate_ArrowAnnotate.toolType);
3785
3992
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
3786
3993
  const text = defaultState.annotation.metadata.label;
3994
+ if (SCOORDGroup) {
3995
+ return this.getMeasurementDataFromScoord({
3996
+ SCOORDGroup,
3997
+ referencedImageId,
3998
+ metadata,
3999
+ imageToWorldCoords,
4000
+ defaultState,
4001
+ text,
4002
+ ReferencedFrameNumber
4003
+ });
4004
+ } else if (SCOORD3DGroup) {
4005
+ return this.getMeasurementDataFromScoord3D({
4006
+ SCOORD3DGroup,
4007
+ defaultState,
4008
+ text
4009
+ });
4010
+ } else {
4011
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
4012
+ }
4013
+ }
4014
+ static getMeasurementDataFromScoord3D(_ref) {
4015
+ let {
4016
+ SCOORD3DGroup,
4017
+ defaultState,
4018
+ text
4019
+ } = _ref;
4020
+ const {
4021
+ GraphicData
4022
+ } = SCOORD3DGroup;
4023
+ const worldCoords = [];
4024
+ for (let i = 0; i < GraphicData.length; i += 3) {
4025
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
4026
+ worldCoords.push(point);
4027
+ }
4028
+ const state = defaultState;
4029
+ state.annotation.data = {
4030
+ text,
4031
+ handles: {
4032
+ arrowFirst: true,
4033
+ points: [worldCoords[0], worldCoords[1]],
4034
+ activeHandleIndex: 0,
4035
+ textBox: {
4036
+ hasMoved: false
4037
+ }
4038
+ }
4039
+ };
4040
+ return state;
4041
+ }
4042
+ static getMeasurementDataFromScoord(_ref2) {
4043
+ let {
4044
+ SCOORDGroup,
4045
+ referencedImageId,
4046
+ metadata,
4047
+ imageToWorldCoords,
4048
+ defaultState,
4049
+ text,
4050
+ ReferencedFrameNumber
4051
+ } = _ref2;
3787
4052
  const {
3788
4053
  GraphicData
3789
4054
  } = SCOORDGroup;
@@ -3835,7 +4100,7 @@ class ArrowAnnotate_ArrowAnnotate extends BaseAdapter3D {
3835
4100
  referencedImageId
3836
4101
  } = metadata;
3837
4102
  if (!referencedImageId) {
3838
- throw new Error("ArrowAnnotate.getTID300RepresentationArguments: referencedImageId is not defined");
4103
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
3839
4104
  }
3840
4105
  const {
3841
4106
  points,
@@ -3862,7 +4127,57 @@ class ArrowAnnotate_ArrowAnnotate extends BaseAdapter3D {
3862
4127
  }],
3863
4128
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
3864
4129
  findingSites: findingSites || [],
4130
+ finding,
4131
+ use3DSpatialCoordinates: false
4132
+ };
4133
+ if (!finding || finding.CodeValue !== codeValues.CORNERSTONEFREETEXT) {
4134
+ finding = {
4135
+ CodeValue: codeValues.CORNERSTONEFREETEXT,
4136
+ CodingSchemeDesignator: CodingScheme.CodingSchemeDesignator,
4137
+ CodeMeaning: data.text
4138
+ };
4139
+ }
4140
+ return TID300RepresentationArguments;
4141
+ }
4142
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
4143
+ const {
4144
+ data,
4145
+ findingSites,
4146
+ metadata
4147
+ } = tool;
4148
+ let {
3865
4149
  finding
4150
+ } = tool;
4151
+ const {
4152
+ points,
4153
+ arrowFirst
4154
+ } = data.handles;
4155
+ let point;
4156
+ let point2;
4157
+ if (arrowFirst) {
4158
+ point = points[0];
4159
+ point2 = points[1];
4160
+ } else {
4161
+ point = points[1];
4162
+ point2 = points[0];
4163
+ }
4164
+ const pointImage = point;
4165
+ const pointImage2 = point2;
4166
+ const TID300RepresentationArguments = {
4167
+ points: [{
4168
+ x: pointImage[0],
4169
+ y: pointImage[1],
4170
+ z: pointImage[2]
4171
+ }, {
4172
+ x: pointImage2[0],
4173
+ y: pointImage2[1],
4174
+ z: pointImage2[2]
4175
+ }],
4176
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4177
+ findingSites: findingSites || [],
4178
+ finding,
4179
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
4180
+ use3DSpatialCoordinates: true
3866
4181
  };
3867
4182
  if (!finding || finding.CodeValue !== codeValues.CORNERSTONEFREETEXT) {
3868
4183
  finding = {
@@ -3906,9 +4221,39 @@ class Bidirectional_Bidirectional extends BaseAdapter3D {
3906
4221
  ContentSequence
3907
4222
  } = MeasurementGroup;
3908
4223
  const longAxisNUMGroup = toArray(ContentSequence).find(group => group.ConceptNameCodeSequence.CodeMeaning === Bidirectional_LONG_AXIS);
3909
- const longAxisSCOORDGroup = toArray(longAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD");
3910
4224
  const shortAxisNUMGroup = toArray(ContentSequence).find(group => group.ConceptNameCodeSequence.CodeMeaning === Bidirectional_SHORT_AXIS);
4225
+ const longAxisSCOORDGroup = toArray(longAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD");
3911
4226
  const shortAxisSCOORDGroup = toArray(shortAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD");
4227
+ if (longAxisSCOORDGroup && shortAxisSCOORDGroup) {
4228
+ return this.getMeasurementDataFromScoord({
4229
+ longAxisNUMGroup,
4230
+ shortAxisNUMGroup,
4231
+ longAxisSCOORDGroup,
4232
+ shortAxisSCOORDGroup,
4233
+ referencedImageId,
4234
+ imageToWorldCoords,
4235
+ ReferencedFrameNumber,
4236
+ defaultState
4237
+ });
4238
+ } else {
4239
+ return this.getMeasurementDataFromScoord3d({
4240
+ longAxisNUMGroup,
4241
+ shortAxisNUMGroup,
4242
+ defaultState
4243
+ });
4244
+ }
4245
+ }
4246
+ static getMeasurementDataFromScoord(_ref) {
4247
+ let {
4248
+ longAxisNUMGroup,
4249
+ shortAxisNUMGroup,
4250
+ longAxisSCOORDGroup,
4251
+ shortAxisSCOORDGroup,
4252
+ referencedImageId,
4253
+ imageToWorldCoords,
4254
+ ReferencedFrameNumber,
4255
+ defaultState
4256
+ } = _ref;
3912
4257
  const worldCoords = [];
3913
4258
  [longAxisSCOORDGroup, shortAxisSCOORDGroup].forEach(group => {
3914
4259
  const {
@@ -3938,6 +4283,37 @@ class Bidirectional_Bidirectional extends BaseAdapter3D {
3938
4283
  };
3939
4284
  return state;
3940
4285
  }
4286
+ static getMeasurementDataFromScoord3d(_ref2) {
4287
+ let {
4288
+ longAxisNUMGroup,
4289
+ shortAxisNUMGroup,
4290
+ defaultState
4291
+ } = _ref2;
4292
+ const worldCoords = [];
4293
+ const longAxisSCOORD3DGroup = toArray(longAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD3D");
4294
+ const shortAxisSCOORD3DGroup = toArray(shortAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD3D");
4295
+ [longAxisSCOORD3DGroup, shortAxisSCOORD3DGroup].forEach(group => {
4296
+ const {
4297
+ GraphicData
4298
+ } = group;
4299
+ for (let i = 0; i < GraphicData.length; i += 3) {
4300
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
4301
+ worldCoords.push(point);
4302
+ }
4303
+ });
4304
+ const state = defaultState;
4305
+ state.annotation.data = {
4306
+ handles: {
4307
+ points: [worldCoords[0], worldCoords[1], worldCoords[2], worldCoords[3]],
4308
+ activeHandleIndex: 0,
4309
+ textBox: {
4310
+ hasMoved: false
4311
+ }
4312
+ },
4313
+ cachedStats: {}
4314
+ };
4315
+ return state;
4316
+ }
3941
4317
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
3942
4318
  const {
3943
4319
  data,
@@ -3952,13 +4328,6 @@ class Bidirectional_Bidirectional extends BaseAdapter3D {
3952
4328
  const {
3953
4329
  referencedImageId
3954
4330
  } = metadata;
3955
- if (!referencedImageId) {
3956
- throw new Error("Bidirectional.getTID300RepresentationArguments: referencedImageId is not defined");
3957
- }
3958
- const {
3959
- length,
3960
- width
3961
- } = cachedStats[`imageId:${referencedImageId}`] || {};
3962
4331
  const {
3963
4332
  points
3964
4333
  } = handles;
@@ -3975,10 +4344,21 @@ class Bidirectional_Bidirectional extends BaseAdapter3D {
3975
4344
  shortAxisPoints = secondPointPairs;
3976
4345
  longAxisPoints = firstPointPairs;
3977
4346
  }
4347
+ if (!referencedImageId) {
4348
+ return this.getTID300RepresentationArgumentsSCOORD3D({
4349
+ tool,
4350
+ shortAxisPoints,
4351
+ longAxisPoints
4352
+ });
4353
+ }
3978
4354
  const longAxisStartImage = worldToImageCoords(referencedImageId, shortAxisPoints[0]);
3979
4355
  const longAxisEndImage = worldToImageCoords(referencedImageId, shortAxisPoints[1]);
3980
4356
  const shortAxisStartImage = worldToImageCoords(referencedImageId, longAxisPoints[0]);
3981
4357
  const shortAxisEndImage = worldToImageCoords(referencedImageId, longAxisPoints[1]);
4358
+ const {
4359
+ length,
4360
+ width
4361
+ } = cachedStats[`imageId:${referencedImageId}`] || {};
3982
4362
  return {
3983
4363
  longAxis: {
3984
4364
  point1: {
@@ -4004,15 +4384,74 @@ class Bidirectional_Bidirectional extends BaseAdapter3D {
4004
4384
  shortAxisLength: width,
4005
4385
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4006
4386
  finding: finding,
4007
- findingSites: findingSites || []
4387
+ findingSites: findingSites || [],
4388
+ use3DSpatialCoordinates: false
4008
4389
  };
4009
4390
  }
4010
- }
4011
- _Bidirectional = Bidirectional_Bidirectional;
4012
- (() => {
4013
- _Bidirectional.init("Bidirectional", Bidirectional_TID300Bidirectional);
4014
- _Bidirectional.registerLegacy();
4015
- })();
4391
+ static getTID300RepresentationArgumentsSCOORD3D(_ref3) {
4392
+ let {
4393
+ tool,
4394
+ shortAxisPoints,
4395
+ longAxisPoints
4396
+ } = _ref3;
4397
+ const {
4398
+ data,
4399
+ finding,
4400
+ findingSites,
4401
+ metadata
4402
+ } = tool;
4403
+ const {
4404
+ cachedStats = {}
4405
+ } = data;
4406
+ const longAxisStart = shortAxisPoints[0];
4407
+ const longAxisEnd = shortAxisPoints[1];
4408
+ const shortAxisStart = longAxisPoints[0];
4409
+ const shortAxisEnd = longAxisPoints[1];
4410
+ const cachedStatsKeys = Object.keys(cachedStats)[0];
4411
+ const {
4412
+ length,
4413
+ width
4414
+ } = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
4415
+ return {
4416
+ longAxis: {
4417
+ point1: {
4418
+ x: longAxisStart[0],
4419
+ y: longAxisStart[1],
4420
+ z: longAxisStart[2]
4421
+ },
4422
+ point2: {
4423
+ x: longAxisEnd[0],
4424
+ y: longAxisEnd[1],
4425
+ z: longAxisEnd[2]
4426
+ }
4427
+ },
4428
+ shortAxis: {
4429
+ point1: {
4430
+ x: shortAxisStart[0],
4431
+ y: shortAxisStart[1],
4432
+ z: shortAxisStart[2]
4433
+ },
4434
+ point2: {
4435
+ x: shortAxisEnd[0],
4436
+ y: shortAxisEnd[1],
4437
+ z: shortAxisEnd[2]
4438
+ }
4439
+ },
4440
+ longAxisLength: length,
4441
+ shortAxisLength: width,
4442
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4443
+ finding: finding,
4444
+ findingSites: findingSites || [],
4445
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
4446
+ use3DSpatialCoordinates: true
4447
+ };
4448
+ }
4449
+ }
4450
+ _Bidirectional = Bidirectional_Bidirectional;
4451
+ (() => {
4452
+ _Bidirectional.init("Bidirectional", Bidirectional_TID300Bidirectional);
4453
+ _Bidirectional.registerLegacy();
4454
+ })();
4016
4455
 
4017
4456
 
4018
4457
 
@@ -4031,8 +4470,34 @@ class Angle_Angle extends BaseAdapter3D {
4031
4470
  defaultState,
4032
4471
  NUMGroup,
4033
4472
  SCOORDGroup,
4473
+ SCOORD3DGroup,
4034
4474
  ReferencedFrameNumber
4035
4475
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, Angle_Angle.toolType);
4476
+ if (SCOORDGroup) {
4477
+ return this.getMeasurementDataFromScoord({
4478
+ defaultState,
4479
+ SCOORDGroup,
4480
+ imageToWorldCoords,
4481
+ NUMGroup,
4482
+ ReferencedFrameNumber
4483
+ });
4484
+ } else if (SCOORD3DGroup) {
4485
+ return this.getMeasurementDataFromScoord3D({
4486
+ defaultState,
4487
+ SCOORD3DGroup
4488
+ });
4489
+ } else {
4490
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
4491
+ }
4492
+ }
4493
+ static getMeasurementDataFromScoord(_ref) {
4494
+ let {
4495
+ defaultState,
4496
+ SCOORDGroup,
4497
+ imageToWorldCoords,
4498
+ NUMGroup,
4499
+ ReferencedFrameNumber
4500
+ } = _ref;
4036
4501
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4037
4502
  const {
4038
4503
  GraphicData
@@ -4060,6 +4525,32 @@ class Angle_Angle extends BaseAdapter3D {
4060
4525
  };
4061
4526
  return state;
4062
4527
  }
4528
+ static getMeasurementDataFromScoord3D(_ref2) {
4529
+ let {
4530
+ defaultState,
4531
+ SCOORD3DGroup
4532
+ } = _ref2;
4533
+ const {
4534
+ GraphicData
4535
+ } = SCOORD3DGroup;
4536
+ const worldCoords = [];
4537
+ for (let i = 0; i < GraphicData.length; i += 3) {
4538
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
4539
+ worldCoords.push(point);
4540
+ }
4541
+ const state = defaultState;
4542
+ state.annotation.data = {
4543
+ handles: {
4544
+ points: [worldCoords[0], worldCoords[1], worldCoords[3]],
4545
+ activeHandleIndex: 0,
4546
+ textBox: {
4547
+ hasMoved: false
4548
+ }
4549
+ },
4550
+ cachedStats: {}
4551
+ };
4552
+ return state;
4553
+ }
4063
4554
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
4064
4555
  const {
4065
4556
  data,
@@ -4075,7 +4566,7 @@ class Angle_Angle extends BaseAdapter3D {
4075
4566
  referencedImageId
4076
4567
  } = metadata;
4077
4568
  if (!referencedImageId) {
4078
- throw new Error("Angle.getTID300RepresentationArguments: referencedImageId is not defined");
4569
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4079
4570
  }
4080
4571
  const start1 = worldToImageCoords(referencedImageId, handles.points[0]);
4081
4572
  const middle = worldToImageCoords(referencedImageId, handles.points[1]);
@@ -4104,7 +4595,55 @@ class Angle_Angle extends BaseAdapter3D {
4104
4595
  rAngle: angle,
4105
4596
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4106
4597
  finding,
4107
- findingSites: findingSites || []
4598
+ findingSites: findingSites || [],
4599
+ use3DSpatialCoordinates: false
4600
+ };
4601
+ }
4602
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
4603
+ const {
4604
+ data,
4605
+ finding,
4606
+ findingSites,
4607
+ metadata
4608
+ } = tool;
4609
+ const {
4610
+ cachedStats = {},
4611
+ handles
4612
+ } = data;
4613
+ const start = handles.points[0];
4614
+ const middle = handles.points[1];
4615
+ const end = handles.points[2];
4616
+ const point1 = {
4617
+ x: start[0],
4618
+ y: start[1],
4619
+ z: start[2]
4620
+ };
4621
+ const point2 = {
4622
+ x: middle[0],
4623
+ y: middle[1],
4624
+ z: middle[2]
4625
+ };
4626
+ const point3 = point2;
4627
+ const point4 = {
4628
+ x: end[0],
4629
+ y: end[1],
4630
+ z: end[2]
4631
+ };
4632
+ const cachedStatsKeys = Object.keys(cachedStats)[0];
4633
+ const {
4634
+ angle
4635
+ } = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
4636
+ return {
4637
+ point1,
4638
+ point2,
4639
+ point3,
4640
+ point4,
4641
+ rAngle: angle,
4642
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4643
+ finding,
4644
+ findingSites: findingSites || [],
4645
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
4646
+ use3DSpatialCoordinates: true
4108
4647
  };
4109
4648
  }
4110
4649
  }
@@ -4131,8 +4670,34 @@ class CobbAngle_CobbAngle extends BaseAdapter3D {
4131
4670
  defaultState,
4132
4671
  NUMGroup,
4133
4672
  SCOORDGroup,
4673
+ SCOORD3DGroup,
4134
4674
  ReferencedFrameNumber
4135
4675
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, CobbAngle_CobbAngle.toolType);
4676
+ if (SCOORDGroup) {
4677
+ return this.getMeasurementDataFromScoord({
4678
+ defaultState,
4679
+ SCOORDGroup,
4680
+ imageToWorldCoords,
4681
+ NUMGroup,
4682
+ ReferencedFrameNumber
4683
+ });
4684
+ } else if (SCOORD3DGroup) {
4685
+ return this.getMeasurementDataFromScoord3D({
4686
+ defaultState,
4687
+ SCOORD3DGroup
4688
+ });
4689
+ } else {
4690
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
4691
+ }
4692
+ }
4693
+ static getMeasurementDataFromScoord(_ref) {
4694
+ let {
4695
+ defaultState,
4696
+ SCOORDGroup,
4697
+ imageToWorldCoords,
4698
+ NUMGroup,
4699
+ ReferencedFrameNumber
4700
+ } = _ref;
4136
4701
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4137
4702
  const {
4138
4703
  GraphicData
@@ -4160,6 +4725,32 @@ class CobbAngle_CobbAngle extends BaseAdapter3D {
4160
4725
  };
4161
4726
  return state;
4162
4727
  }
4728
+ static getMeasurementDataFromScoord3D(_ref2) {
4729
+ let {
4730
+ defaultState,
4731
+ SCOORD3DGroup
4732
+ } = _ref2;
4733
+ const {
4734
+ GraphicData
4735
+ } = SCOORD3DGroup;
4736
+ const worldCoords = [];
4737
+ for (let i = 0; i < GraphicData.length; i += 3) {
4738
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
4739
+ worldCoords.push(point);
4740
+ }
4741
+ const state = defaultState;
4742
+ state.annotation.data = {
4743
+ handles: {
4744
+ points: [worldCoords[0], worldCoords[1], worldCoords[2], worldCoords[3]],
4745
+ activeHandleIndex: 0,
4746
+ textBox: {
4747
+ hasMoved: false
4748
+ }
4749
+ },
4750
+ cachedStats: {}
4751
+ };
4752
+ return state;
4753
+ }
4163
4754
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
4164
4755
  const {
4165
4756
  data,
@@ -4175,7 +4766,7 @@ class CobbAngle_CobbAngle extends BaseAdapter3D {
4175
4766
  referencedImageId
4176
4767
  } = metadata;
4177
4768
  if (!referencedImageId) {
4178
- throw new Error("CobbAngle.getTID300RepresentationArguments: referencedImageId is not defined");
4769
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4179
4770
  }
4180
4771
  const start1 = worldToImageCoords(referencedImageId, handles.points[0]);
4181
4772
  const end1 = worldToImageCoords(referencedImageId, handles.points[1]);
@@ -4208,7 +4799,60 @@ class CobbAngle_CobbAngle extends BaseAdapter3D {
4208
4799
  rAngle: angle,
4209
4800
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4210
4801
  finding,
4211
- findingSites: findingSites || []
4802
+ findingSites: findingSites || [],
4803
+ use3DSpatialCoordinates: false
4804
+ };
4805
+ }
4806
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
4807
+ const {
4808
+ data,
4809
+ finding,
4810
+ findingSites,
4811
+ metadata
4812
+ } = tool;
4813
+ const {
4814
+ cachedStats = {},
4815
+ handles
4816
+ } = data;
4817
+ const start1 = handles.points[0];
4818
+ const end1 = handles.points[1];
4819
+ const start2 = handles.points[2];
4820
+ const end2 = handles.points[3];
4821
+ const point1 = {
4822
+ x: start1[0],
4823
+ y: start1[1],
4824
+ z: start1[2]
4825
+ };
4826
+ const point2 = {
4827
+ x: end1[0],
4828
+ y: end1[1],
4829
+ z: end1[2]
4830
+ };
4831
+ const point3 = {
4832
+ x: start2[0],
4833
+ y: start2[1],
4834
+ z: start2[2]
4835
+ };
4836
+ const point4 = {
4837
+ x: end2[0],
4838
+ y: end2[1],
4839
+ z: end2[2]
4840
+ };
4841
+ const cachedStatsKeys = Object.keys(cachedStats)[0];
4842
+ const {
4843
+ angle
4844
+ } = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
4845
+ return {
4846
+ point1,
4847
+ point2,
4848
+ point3,
4849
+ point4,
4850
+ rAngle: angle,
4851
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4852
+ finding,
4853
+ findingSites: findingSites || [],
4854
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
4855
+ use3DSpatialCoordinates: true
4212
4856
  };
4213
4857
  }
4214
4858
  }
@@ -4235,8 +4879,34 @@ class CircleROI extends BaseAdapter3D {
4235
4879
  defaultState,
4236
4880
  NUMGroup,
4237
4881
  SCOORDGroup,
4882
+ SCOORD3DGroup,
4238
4883
  ReferencedFrameNumber
4239
4884
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, CircleROI.toolType);
4885
+ if (SCOORDGroup) {
4886
+ return this.getMeasurementDataFromScoord({
4887
+ defaultState,
4888
+ SCOORDGroup,
4889
+ imageToWorldCoords,
4890
+ NUMGroup,
4891
+ ReferencedFrameNumber
4892
+ });
4893
+ } else if (SCOORD3DGroup) {
4894
+ return this.getMeasurementDataFromScoord3D({
4895
+ defaultState,
4896
+ SCOORD3DGroup
4897
+ });
4898
+ } else {
4899
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
4900
+ }
4901
+ }
4902
+ static getMeasurementDataFromScoord(_ref) {
4903
+ let {
4904
+ defaultState,
4905
+ SCOORDGroup,
4906
+ imageToWorldCoords,
4907
+ NUMGroup,
4908
+ ReferencedFrameNumber
4909
+ } = _ref;
4240
4910
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4241
4911
  const {
4242
4912
  GraphicData
@@ -4266,6 +4936,32 @@ class CircleROI extends BaseAdapter3D {
4266
4936
  };
4267
4937
  return state;
4268
4938
  }
4939
+ static getMeasurementDataFromScoord3D(_ref2) {
4940
+ let {
4941
+ defaultState,
4942
+ SCOORD3DGroup
4943
+ } = _ref2;
4944
+ const {
4945
+ GraphicData
4946
+ } = SCOORD3DGroup;
4947
+ const pointsWorld = [];
4948
+ for (let i = 0; i < GraphicData.length; i += 3) {
4949
+ const worldPos = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
4950
+ pointsWorld.push(worldPos);
4951
+ }
4952
+ const state = defaultState;
4953
+ state.annotation.data = {
4954
+ handles: {
4955
+ points: [...pointsWorld],
4956
+ activeHandleIndex: 0,
4957
+ textBox: {
4958
+ hasMoved: false
4959
+ }
4960
+ },
4961
+ cachedStats: {}
4962
+ };
4963
+ return state;
4964
+ }
4269
4965
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
4270
4966
  const {
4271
4967
  data,
@@ -4281,7 +4977,7 @@ class CircleROI extends BaseAdapter3D {
4281
4977
  referencedImageId
4282
4978
  } = metadata;
4283
4979
  if (!referencedImageId) {
4284
- throw new Error("CircleROI.getTID300RepresentationArguments: referencedImageId is not defined");
4980
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4285
4981
  }
4286
4982
  const center = worldToImageCoords(referencedImageId, handles.points[0]);
4287
4983
  const end = worldToImageCoords(referencedImageId, handles.points[1]);
@@ -4306,7 +5002,50 @@ class CircleROI extends BaseAdapter3D {
4306
5002
  points,
4307
5003
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4308
5004
  finding,
4309
- findingSites: findingSites || []
5005
+ findingSites: findingSites || [],
5006
+ use3DSpatialCoordinates: false
5007
+ };
5008
+ }
5009
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
5010
+ const {
5011
+ data,
5012
+ finding,
5013
+ findingSites,
5014
+ metadata
5015
+ } = tool;
5016
+ const {
5017
+ cachedStats = {},
5018
+ handles
5019
+ } = data;
5020
+ const center = handles.points[0];
5021
+ const end = handles.points[1];
5022
+ const points = [];
5023
+ points.push({
5024
+ x: center[0],
5025
+ y: center[1],
5026
+ z: center[2]
5027
+ });
5028
+ points.push({
5029
+ x: end[0],
5030
+ y: end[1],
5031
+ z: center[2]
5032
+ });
5033
+ const cachedStatsKeys = Object.keys(cachedStats)[0];
5034
+ const {
5035
+ area,
5036
+ radius
5037
+ } = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
5038
+ const perimeter = 2 * Math.PI * radius;
5039
+ return {
5040
+ area,
5041
+ perimeter,
5042
+ radius,
5043
+ points,
5044
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
5045
+ finding,
5046
+ findingSites: findingSites || [],
5047
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
5048
+ use3DSpatialCoordinates: true
4310
5049
  };
4311
5050
  }
4312
5051
  }
@@ -4319,7 +5058,7 @@ _CircleROI = CircleROI;
4319
5058
 
4320
5059
 
4321
5060
  // EXTERNAL MODULE: ../../../node_modules/gl-matrix/esm/index.js + 1 modules
4322
- var esm = __webpack_require__(3823);
5061
+ var gl_matrix_esm = __webpack_require__(3823);
4323
5062
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone3D/EllipticalROI.js
4324
5063
 
4325
5064
 
@@ -4337,8 +5076,36 @@ class EllipticalROI extends BaseAdapter3D {
4337
5076
  defaultState,
4338
5077
  NUMGroup,
4339
5078
  SCOORDGroup,
5079
+ SCOORD3DGroup,
4340
5080
  ReferencedFrameNumber
4341
5081
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, EllipticalROI.toolType);
5082
+ if (SCOORDGroup) {
5083
+ return this.getMeasurementDataFromScoord({
5084
+ defaultState,
5085
+ SCOORDGroup,
5086
+ imageToWorldCoords,
5087
+ metadata,
5088
+ NUMGroup,
5089
+ ReferencedFrameNumber
5090
+ });
5091
+ } else if (SCOORD3DGroup) {
5092
+ return this.getMeasurementDataFromScoord3D({
5093
+ defaultState,
5094
+ SCOORD3DGroup
5095
+ });
5096
+ } else {
5097
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
5098
+ }
5099
+ }
5100
+ static getMeasurementDataFromScoord(_ref) {
5101
+ let {
5102
+ defaultState,
5103
+ SCOORDGroup,
5104
+ imageToWorldCoords,
5105
+ metadata,
5106
+ NUMGroup,
5107
+ ReferencedFrameNumber
5108
+ } = _ref;
4342
5109
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4343
5110
  const {
4344
5111
  GraphicData
@@ -4348,16 +5115,16 @@ class EllipticalROI extends BaseAdapter3D {
4348
5115
  const worldPos = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
4349
5116
  pointsWorld.push(worldPos);
4350
5117
  }
4351
- const majorAxisStart = esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[0]);
4352
- const majorAxisEnd = esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[1]);
4353
- const minorAxisStart = esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[2]);
4354
- const minorAxisEnd = esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[3]);
4355
- const majorAxisVec = esm/* vec3.create */.eR.create();
4356
- esm/* vec3.sub */.eR.sub(majorAxisVec, majorAxisEnd, majorAxisStart);
4357
- esm/* vec3.normalize */.eR.normalize(majorAxisVec, majorAxisVec);
4358
- const minorAxisVec = esm/* vec3.create */.eR.create();
4359
- esm/* vec3.sub */.eR.sub(minorAxisVec, minorAxisEnd, minorAxisStart);
4360
- esm/* vec3.normalize */.eR.normalize(minorAxisVec, minorAxisVec);
5118
+ const majorAxisStart = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[0]);
5119
+ const majorAxisEnd = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[1]);
5120
+ const minorAxisStart = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[2]);
5121
+ const minorAxisEnd = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[3]);
5122
+ const majorAxisVec = gl_matrix_esm/* vec3.create */.eR.create();
5123
+ gl_matrix_esm/* vec3.sub */.eR.sub(majorAxisVec, majorAxisEnd, majorAxisStart);
5124
+ gl_matrix_esm/* vec3.normalize */.eR.normalize(majorAxisVec, majorAxisVec);
5125
+ const minorAxisVec = gl_matrix_esm/* vec3.create */.eR.create();
5126
+ gl_matrix_esm/* vec3.sub */.eR.sub(minorAxisVec, minorAxisEnd, minorAxisStart);
5127
+ gl_matrix_esm/* vec3.normalize */.eR.normalize(minorAxisVec, minorAxisVec);
4361
5128
  const imagePlaneModule = metadata.get("imagePlaneModule", referencedImageId);
4362
5129
  if (!imagePlaneModule) {
4363
5130
  throw new Error("imageId does not have imagePlaneModule metadata");
@@ -4365,9 +5132,9 @@ class EllipticalROI extends BaseAdapter3D {
4365
5132
  const {
4366
5133
  columnCosines
4367
5134
  } = imagePlaneModule;
4368
- const columnCosinesVec = esm/* vec3.fromValues */.eR.fromValues(columnCosines[0], columnCosines[1], columnCosines[2]);
4369
- const projectedMajorAxisOnColVec = esm/* vec3.dot */.eR.dot(columnCosinesVec, majorAxisVec);
4370
- const projectedMinorAxisOnColVec = esm/* vec3.dot */.eR.dot(columnCosinesVec, minorAxisVec);
5135
+ const columnCosinesVec = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(columnCosines[0], columnCosines[1], columnCosines[2]);
5136
+ const projectedMajorAxisOnColVec = gl_matrix_esm/* vec3.dot */.eR.dot(columnCosinesVec, majorAxisVec);
5137
+ const projectedMinorAxisOnColVec = gl_matrix_esm/* vec3.dot */.eR.dot(columnCosinesVec, minorAxisVec);
4371
5138
  const absoluteOfMajorDotProduct = Math.abs(projectedMajorAxisOnColVec);
4372
5139
  const absoluteOfMinorDotProduct = Math.abs(projectedMinorAxisOnColVec);
4373
5140
  let ellipsePoints = [];
@@ -4396,6 +5163,42 @@ class EllipticalROI extends BaseAdapter3D {
4396
5163
  };
4397
5164
  return state;
4398
5165
  }
5166
+ static getMeasurementDataFromScoord3D(_ref2) {
5167
+ let {
5168
+ defaultState,
5169
+ SCOORD3DGroup
5170
+ } = _ref2;
5171
+ const {
5172
+ GraphicData
5173
+ } = SCOORD3DGroup;
5174
+ const pointsWorld = [];
5175
+ for (let i = 0; i < GraphicData.length; i += 3) {
5176
+ const worldPos = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
5177
+ pointsWorld.push(worldPos);
5178
+ }
5179
+ const majorAxisStart = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[0]);
5180
+ const majorAxisEnd = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[1]);
5181
+ const minorAxisStart = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[2]);
5182
+ const minorAxisEnd = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[3]);
5183
+ const majorAxisVec = gl_matrix_esm/* vec3.create */.eR.create();
5184
+ gl_matrix_esm/* vec3.sub */.eR.sub(majorAxisVec, majorAxisEnd, majorAxisStart);
5185
+ gl_matrix_esm/* vec3.normalize */.eR.normalize(majorAxisVec, majorAxisVec);
5186
+ const minorAxisVec = gl_matrix_esm/* vec3.create */.eR.create();
5187
+ gl_matrix_esm/* vec3.sub */.eR.sub(minorAxisVec, minorAxisEnd, minorAxisStart);
5188
+ gl_matrix_esm/* vec3.normalize */.eR.normalize(minorAxisVec, minorAxisVec);
5189
+ const state = defaultState;
5190
+ state.annotation.data = {
5191
+ handles: {
5192
+ points: [majorAxisStart, majorAxisEnd, minorAxisStart, minorAxisEnd],
5193
+ activeHandleIndex: 0,
5194
+ textBox: {
5195
+ hasMoved: false
5196
+ }
5197
+ },
5198
+ cachedStats: {}
5199
+ };
5200
+ return state;
5201
+ }
4399
5202
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
4400
5203
  const {
4401
5204
  data,
@@ -4412,7 +5215,7 @@ class EllipticalROI extends BaseAdapter3D {
4412
5215
  referencedImageId
4413
5216
  } = metadata;
4414
5217
  if (!referencedImageId) {
4415
- throw new Error("EllipticalROI.getTID300RepresentationArguments: referencedImageId is not defined");
5218
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4416
5219
  }
4417
5220
  let top, bottom, left, right;
4418
5221
  if (rotation == 90 || rotation == 270) {
@@ -4472,7 +5275,92 @@ class EllipticalROI extends BaseAdapter3D {
4472
5275
  points,
4473
5276
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4474
5277
  finding,
4475
- findingSites: findingSites || []
5278
+ findingSites: findingSites || [],
5279
+ use3DSpatialCoordinates: false
5280
+ };
5281
+ }
5282
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
5283
+ const {
5284
+ data,
5285
+ finding,
5286
+ findingSites,
5287
+ metadata
5288
+ } = tool;
5289
+ const {
5290
+ cachedStats,
5291
+ handles
5292
+ } = data;
5293
+ const rotation = data.initialRotation || 0;
5294
+ let top, bottom, left, right;
5295
+ if (rotation == 90 || rotation == 270) {
5296
+ bottom = handles.points[2];
5297
+ top = handles.points[3];
5298
+ left = handles.points[0];
5299
+ right = handles.points[1];
5300
+ } else {
5301
+ top = handles.points[0];
5302
+ bottom = handles.points[1];
5303
+ left = handles.points[2];
5304
+ right = handles.points[3];
5305
+ }
5306
+ const topBottomLength = Math.sqrt((top[0] - bottom[0]) ** 2 + (top[1] - bottom[1]) ** 2 + (top[2] - bottom[2]) ** 2);
5307
+ const leftRightLength = Math.sqrt((left[0] - right[0]) ** 2 + (left[1] - right[1]) ** 2 + (left[2] - right[2]) ** 2);
5308
+ const points = [];
5309
+ if (topBottomLength > leftRightLength) {
5310
+ points.push({
5311
+ x: top[0],
5312
+ y: top[1],
5313
+ z: top[2]
5314
+ });
5315
+ points.push({
5316
+ x: bottom[0],
5317
+ y: bottom[1],
5318
+ z: bottom[2]
5319
+ });
5320
+ points.push({
5321
+ x: left[0],
5322
+ y: left[1],
5323
+ z: left[2]
5324
+ });
5325
+ points.push({
5326
+ x: right[0],
5327
+ y: right[1],
5328
+ z: right[2]
5329
+ });
5330
+ } else {
5331
+ points.push({
5332
+ x: left[0],
5333
+ y: left[1],
5334
+ z: left[2]
5335
+ });
5336
+ points.push({
5337
+ x: right[0],
5338
+ y: right[1],
5339
+ z: right[2]
5340
+ });
5341
+ points.push({
5342
+ x: top[0],
5343
+ y: top[1],
5344
+ z: top[2]
5345
+ });
5346
+ points.push({
5347
+ x: bottom[0],
5348
+ y: bottom[1],
5349
+ z: bottom[2]
5350
+ });
5351
+ }
5352
+ const cachedStatsKeys = Object.keys(cachedStats)[0];
5353
+ const {
5354
+ area
5355
+ } = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
5356
+ return {
5357
+ area,
5358
+ points,
5359
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
5360
+ finding,
5361
+ findingSites: findingSites || [],
5362
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
5363
+ use3DSpatialCoordinates: true
4476
5364
  };
4477
5365
  }
4478
5366
  }
@@ -4496,8 +5384,34 @@ class RectangleROI extends BaseAdapter3D {
4496
5384
  defaultState,
4497
5385
  NUMGroup,
4498
5386
  SCOORDGroup,
5387
+ SCOORD3DGroup,
4499
5388
  ReferencedFrameNumber
4500
5389
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, RectangleROI.toolType);
5390
+ if (SCOORDGroup) {
5391
+ return this.getMeasurementDataFromScoord({
5392
+ defaultState,
5393
+ SCOORDGroup,
5394
+ imageToWorldCoords,
5395
+ NUMGroup,
5396
+ ReferencedFrameNumber
5397
+ });
5398
+ } else if (SCOORD3DGroup) {
5399
+ return this.getMeasurementDataFromScoord3D({
5400
+ SCOORD3DGroup,
5401
+ defaultState
5402
+ });
5403
+ } else {
5404
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
5405
+ }
5406
+ }
5407
+ static getMeasurementDataFromScoord(_ref) {
5408
+ let {
5409
+ defaultState,
5410
+ SCOORDGroup,
5411
+ imageToWorldCoords,
5412
+ NUMGroup,
5413
+ ReferencedFrameNumber
5414
+ } = _ref;
4501
5415
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4502
5416
  const {
4503
5417
  GraphicData
@@ -4525,6 +5439,32 @@ class RectangleROI extends BaseAdapter3D {
4525
5439
  };
4526
5440
  return state;
4527
5441
  }
5442
+ static getMeasurementDataFromScoord3D(_ref2) {
5443
+ let {
5444
+ SCOORD3DGroup,
5445
+ defaultState
5446
+ } = _ref2;
5447
+ const {
5448
+ GraphicData
5449
+ } = SCOORD3DGroup;
5450
+ const worldCoords = [];
5451
+ for (let i = 0; i < GraphicData.length; i += 3) {
5452
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
5453
+ worldCoords.push(point);
5454
+ }
5455
+ const state = defaultState;
5456
+ state.annotation.data = {
5457
+ handles: {
5458
+ points: [worldCoords[0], worldCoords[1], worldCoords[3], worldCoords[2]],
5459
+ activeHandleIndex: 0,
5460
+ textBox: {
5461
+ hasMoved: false
5462
+ }
5463
+ },
5464
+ cachedStats: {}
5465
+ };
5466
+ return state;
5467
+ }
4528
5468
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
4529
5469
  const {
4530
5470
  data,
@@ -4540,7 +5480,7 @@ class RectangleROI extends BaseAdapter3D {
4540
5480
  referencedImageId
4541
5481
  } = metadata;
4542
5482
  if (!referencedImageId) {
4543
- throw new Error("CobbAngle.getTID300RepresentationArguments: referencedImageId is not defined");
5483
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4544
5484
  }
4545
5485
  const corners = handles.points.map(point => worldToImageCoords(referencedImageId, point));
4546
5486
  const {
@@ -4553,7 +5493,35 @@ class RectangleROI extends BaseAdapter3D {
4553
5493
  perimeter,
4554
5494
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4555
5495
  finding,
4556
- findingSites: findingSites || []
5496
+ findingSites: findingSites || [],
5497
+ use3DSpatialCoordinates: false
5498
+ };
5499
+ }
5500
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
5501
+ const {
5502
+ data,
5503
+ finding,
5504
+ findingSites,
5505
+ metadata
5506
+ } = tool;
5507
+ const {
5508
+ cachedStats = {},
5509
+ handles
5510
+ } = data;
5511
+ const corners = handles.points;
5512
+ const {
5513
+ area,
5514
+ perimeter
5515
+ } = cachedStats;
5516
+ return {
5517
+ points: [corners[0], corners[1], corners[3], corners[2], corners[0]],
5518
+ area,
5519
+ perimeter,
5520
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
5521
+ finding,
5522
+ findingSites: findingSites || [],
5523
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
5524
+ use3DSpatialCoordinates: true
4557
5525
  };
4558
5526
  }
4559
5527
  }
@@ -4576,13 +5544,14 @@ const {
4576
5544
  } = dcmjs_es/* utilities */.BF.TID300;
4577
5545
  const Length_LENGTH = "Length";
4578
5546
  class Length_Length extends BaseAdapter3D {
4579
- static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
4580
- const {
5547
+ static getMeasurementDataFromScoord(_ref) {
5548
+ let {
4581
5549
  defaultState,
4582
5550
  NUMGroup,
4583
5551
  SCOORDGroup,
4584
- ReferencedFrameNumber
4585
- } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, this.toolType);
5552
+ ReferencedFrameNumber,
5553
+ imageToWorldCoords
5554
+ } = _ref;
4586
5555
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4587
5556
  const {
4588
5557
  GraphicData
@@ -4610,6 +5579,53 @@ class Length_Length extends BaseAdapter3D {
4610
5579
  };
4611
5580
  return state;
4612
5581
  }
5582
+ static getMeasurementDataFromScoord3d(_ref2) {
5583
+ let {
5584
+ defaultState,
5585
+ SCOORD3DGroup
5586
+ } = _ref2;
5587
+ const {
5588
+ GraphicData
5589
+ } = SCOORD3DGroup;
5590
+ const worldCoords = GraphicData;
5591
+ const state = defaultState;
5592
+ state.annotation.data = {
5593
+ handles: {
5594
+ points: [worldCoords.slice(0, 3), worldCoords.slice(3, 6)],
5595
+ activeHandleIndex: 0,
5596
+ textBox: {
5597
+ hasMoved: false
5598
+ }
5599
+ },
5600
+ cachedStats: {}
5601
+ };
5602
+ return state;
5603
+ }
5604
+ static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
5605
+ const {
5606
+ defaultState,
5607
+ NUMGroup,
5608
+ SCOORDGroup,
5609
+ SCOORD3DGroup,
5610
+ ReferencedFrameNumber
5611
+ } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, this.toolType);
5612
+ if (SCOORDGroup) {
5613
+ return this.getMeasurementDataFromScoord({
5614
+ defaultState,
5615
+ NUMGroup,
5616
+ SCOORDGroup,
5617
+ ReferencedFrameNumber,
5618
+ imageToWorldCoords
5619
+ });
5620
+ } else if (SCOORD3DGroup) {
5621
+ return this.getMeasurementDataFromScoord3d({
5622
+ defaultState,
5623
+ SCOORD3DGroup
5624
+ });
5625
+ } else {
5626
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
5627
+ }
5628
+ }
4613
5629
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
4614
5630
  const {
4615
5631
  data,
@@ -4625,7 +5641,7 @@ class Length_Length extends BaseAdapter3D {
4625
5641
  referencedImageId
4626
5642
  } = metadata;
4627
5643
  if (!referencedImageId) {
4628
- throw new Error("Length.getTID300RepresentationArguments: referencedImageId is not defined");
5644
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4629
5645
  }
4630
5646
  const start = worldToImageCoords(referencedImageId, handles.points[0]);
4631
5647
  const end = worldToImageCoords(referencedImageId, handles.points[1]);
@@ -4646,7 +5662,46 @@ class Length_Length extends BaseAdapter3D {
4646
5662
  distance,
4647
5663
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4648
5664
  finding,
4649
- findingSites: findingSites || []
5665
+ findingSites: findingSites || [],
5666
+ use3DSpatialCoordinates: false
5667
+ };
5668
+ }
5669
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
5670
+ const {
5671
+ data,
5672
+ finding,
5673
+ findingSites,
5674
+ metadata
5675
+ } = tool;
5676
+ const {
5677
+ cachedStats = {},
5678
+ handles
5679
+ } = data;
5680
+ const start = handles.points[0];
5681
+ const end = handles.points[1];
5682
+ const point1 = {
5683
+ x: start[0],
5684
+ y: start[1],
5685
+ z: start[2]
5686
+ };
5687
+ const point2 = {
5688
+ x: end[0],
5689
+ y: end[1],
5690
+ z: end[2]
5691
+ };
5692
+ const cachedStatsKeys = Object.keys(cachedStats)[0];
5693
+ const {
5694
+ length: distance
5695
+ } = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
5696
+ return {
5697
+ point1,
5698
+ point2,
5699
+ distance,
5700
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
5701
+ finding,
5702
+ findingSites: findingSites || [],
5703
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
5704
+ use3DSpatialCoordinates: true
4650
5705
  };
4651
5706
  }
4652
5707
  }
@@ -4674,8 +5729,34 @@ class PlanarFreehandROI extends BaseAdapter3D {
4674
5729
  defaultState,
4675
5730
  NUMGroup,
4676
5731
  SCOORDGroup,
5732
+ SCOORD3DGroup,
4677
5733
  ReferencedFrameNumber
4678
5734
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, PlanarFreehandROI.toolType);
5735
+ if (SCOORDGroup) {
5736
+ return this.getMeasurementDataFromScoord({
5737
+ defaultState,
5738
+ SCOORDGroup,
5739
+ imageToWorldCoords,
5740
+ NUMGroup,
5741
+ ReferencedFrameNumber
5742
+ });
5743
+ } else if (SCOORD3DGroup) {
5744
+ return this.getMeasurementDataFromScoord3D({
5745
+ defaultState,
5746
+ SCOORD3DGroup
5747
+ });
5748
+ } else {
5749
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
5750
+ }
5751
+ }
5752
+ static getMeasurementDataFromScoord(_ref) {
5753
+ let {
5754
+ defaultState,
5755
+ SCOORDGroup,
5756
+ imageToWorldCoords,
5757
+ NUMGroup,
5758
+ ReferencedFrameNumber
5759
+ } = _ref;
4679
5760
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4680
5761
  const {
4681
5762
  GraphicData
@@ -4685,7 +5766,7 @@ class PlanarFreehandROI extends BaseAdapter3D {
4685
5766
  const point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
4686
5767
  worldCoords.push(point);
4687
5768
  }
4688
- const distanceBetweenFirstAndLastPoint = esm/* vec3.distance */.eR.distance(worldCoords[worldCoords.length - 1], worldCoords[0]);
5769
+ const distanceBetweenFirstAndLastPoint = gl_matrix_esm/* vec3.distance */.eR.distance(worldCoords[worldCoords.length - 1], worldCoords[0]);
4689
5770
  let isOpenContour = true;
4690
5771
  if (distanceBetweenFirstAndLastPoint < this.closedContourThreshold) {
4691
5772
  worldCoords.pop();
@@ -4717,6 +5798,46 @@ class PlanarFreehandROI extends BaseAdapter3D {
4717
5798
  };
4718
5799
  return state;
4719
5800
  }
5801
+ static getMeasurementDataFromScoord3D(_ref2) {
5802
+ let {
5803
+ defaultState,
5804
+ SCOORD3DGroup
5805
+ } = _ref2;
5806
+ const {
5807
+ GraphicData
5808
+ } = SCOORD3DGroup;
5809
+ const worldCoords = [];
5810
+ for (let i = 0; i < GraphicData.length; i += 3) {
5811
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
5812
+ worldCoords.push(point);
5813
+ }
5814
+ const distanceBetweenFirstAndLastPoint = gl_matrix_esm/* vec3.distance */.eR.distance(worldCoords[worldCoords.length - 1], worldCoords[0]);
5815
+ let isOpenContour = true;
5816
+ if (distanceBetweenFirstAndLastPoint < this.closedContourThreshold) {
5817
+ worldCoords.pop();
5818
+ isOpenContour = false;
5819
+ }
5820
+ const points = [];
5821
+ if (isOpenContour) {
5822
+ points.push(worldCoords[0], worldCoords[worldCoords.length - 1]);
5823
+ }
5824
+ const state = defaultState;
5825
+ state.annotation.data = {
5826
+ contour: {
5827
+ polyline: worldCoords,
5828
+ closed: !isOpenContour
5829
+ },
5830
+ handles: {
5831
+ points,
5832
+ activeHandleIndex: null,
5833
+ textBox: {
5834
+ hasMoved: false
5835
+ }
5836
+ },
5837
+ cachedStats: {}
5838
+ };
5839
+ return state;
5840
+ }
4720
5841
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
4721
5842
  const {
4722
5843
  data,
@@ -4733,7 +5854,7 @@ class PlanarFreehandROI extends BaseAdapter3D {
4733
5854
  referencedImageId
4734
5855
  } = metadata;
4735
5856
  if (!referencedImageId) {
4736
- throw new Error("PlanarFreehandROI.getTID300RepresentationArguments: referencedImageId is not defined");
5857
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4737
5858
  }
4738
5859
  const points = polyline.map(worldPos => worldToImageCoords(referencedImageId, worldPos));
4739
5860
  if (!isOpenContour) {
@@ -4760,7 +5881,51 @@ class PlanarFreehandROI extends BaseAdapter3D {
4760
5881
  stdDev,
4761
5882
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4762
5883
  finding,
4763
- findingSites: findingSites || []
5884
+ findingSites: findingSites || [],
5885
+ use3DSpatialCoordinates: false
5886
+ };
5887
+ }
5888
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
5889
+ const {
5890
+ data,
5891
+ finding,
5892
+ findingSites,
5893
+ metadata
5894
+ } = tool;
5895
+ const {
5896
+ polyline,
5897
+ closed
5898
+ } = data.contour;
5899
+ const isOpenContour = closed !== true;
5900
+ const points = polyline;
5901
+ if (!isOpenContour) {
5902
+ const firstPoint = points[0];
5903
+ points.push([firstPoint[0], firstPoint[1], firstPoint[2]]);
5904
+ }
5905
+ const cachedStatsKeys = Object.keys(data.cachedStats)[0];
5906
+ const {
5907
+ area,
5908
+ areaUnit,
5909
+ modalityUnit,
5910
+ perimeter,
5911
+ mean,
5912
+ max,
5913
+ stdDev
5914
+ } = cachedStatsKeys ? data.cachedStats[cachedStatsKeys] : {};
5915
+ return {
5916
+ points,
5917
+ area,
5918
+ areaUnit,
5919
+ perimeter,
5920
+ modalityUnit,
5921
+ mean,
5922
+ max,
5923
+ stdDev,
5924
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
5925
+ finding,
5926
+ findingSites: findingSites || [],
5927
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
5928
+ use3DSpatialCoordinates: true
4764
5929
  };
4765
5930
  }
4766
5931
  }
@@ -4784,8 +5949,32 @@ class Probe extends BaseAdapter3D {
4784
5949
  const state = super.getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata, trackingIdentifier);
4785
5950
  const {
4786
5951
  defaultState,
4787
- SCOORDGroup
5952
+ SCOORDGroup,
5953
+ SCOORD3DGroup
4788
5954
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, Probe.toolType);
5955
+ if (SCOORDGroup) {
5956
+ return this.getMeasurementDataFromScoord({
5957
+ state,
5958
+ defaultState,
5959
+ SCOORDGroup,
5960
+ imageToWorldCoords
5961
+ });
5962
+ } else if (SCOORD3DGroup) {
5963
+ return this.getMeasurementDataFromScoord3D({
5964
+ state,
5965
+ SCOORD3DGroup
5966
+ });
5967
+ } else {
5968
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
5969
+ }
5970
+ }
5971
+ static getMeasurementDataFromScoord(_ref) {
5972
+ let {
5973
+ state,
5974
+ defaultState,
5975
+ SCOORDGroup,
5976
+ imageToWorldCoords
5977
+ } = _ref;
4789
5978
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4790
5979
  const {
4791
5980
  GraphicData
@@ -4807,6 +5996,93 @@ class Probe extends BaseAdapter3D {
4807
5996
  };
4808
5997
  return state;
4809
5998
  }
5999
+ static getMeasurementDataFromScoord3D(_ref2) {
6000
+ let {
6001
+ state,
6002
+ SCOORD3DGroup
6003
+ } = _ref2;
6004
+ const {
6005
+ GraphicData
6006
+ } = SCOORD3DGroup;
6007
+ const worldCoords = [];
6008
+ for (let i = 0; i < GraphicData.length; i += 3) {
6009
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
6010
+ worldCoords.push(point);
6011
+ }
6012
+ state.annotation.data = {
6013
+ ...state.annotation.data,
6014
+ handles: {
6015
+ points: worldCoords,
6016
+ activeHandleIndex: null,
6017
+ textBox: {
6018
+ hasMoved: false
6019
+ }
6020
+ }
6021
+ };
6022
+ return state;
6023
+ }
6024
+ static getTID300RepresentationArguments(tool, worldToImageCoords) {
6025
+ const {
6026
+ data,
6027
+ metadata
6028
+ } = tool;
6029
+ const {
6030
+ finding,
6031
+ findingSites
6032
+ } = tool;
6033
+ const {
6034
+ referencedImageId
6035
+ } = metadata;
6036
+ if (!referencedImageId) {
6037
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
6038
+ }
6039
+ const {
6040
+ handles: {
6041
+ points = []
6042
+ }
6043
+ } = data;
6044
+ const pointsImage = points.map(point => {
6045
+ const pointImage = worldToImageCoords(referencedImageId, point);
6046
+ return {
6047
+ x: pointImage[0],
6048
+ y: pointImage[1]
6049
+ };
6050
+ });
6051
+ return {
6052
+ points: pointsImage,
6053
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
6054
+ findingSites: findingSites || [],
6055
+ finding,
6056
+ use3DSpatialCoordinates: false
6057
+ };
6058
+ }
6059
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
6060
+ const {
6061
+ data,
6062
+ finding,
6063
+ findingSites,
6064
+ metadata
6065
+ } = tool;
6066
+ const {
6067
+ handles: {
6068
+ points = []
6069
+ }
6070
+ } = data;
6071
+ const point = points[0];
6072
+ const pointXYZ = {
6073
+ x: point[0],
6074
+ y: point[1],
6075
+ z: point[2]
6076
+ };
6077
+ return {
6078
+ points: [pointXYZ],
6079
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
6080
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
6081
+ findingSites: findingSites || [],
6082
+ finding,
6083
+ use3DSpatialCoordinates: true
6084
+ };
6085
+ }
4810
6086
  }
4811
6087
  _Probe = Probe;
4812
6088
  (() => {
@@ -4972,10 +6248,8 @@ function generateLabelMaps2DFrom3D(labelmap3D) {
4972
6248
 
4973
6249
 
4974
6250
 
4975
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 1 modules
4976
- var dist_esm = __webpack_require__(15327);
4977
6251
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/index.js
4978
- var tools_dist_esm = __webpack_require__(4667);
6252
+ var dist_esm = __webpack_require__(4667);
4979
6253
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone3D/Segmentation/compactMergeSegData.js
4980
6254
  const checkHasOverlapping = _ref => {
4981
6255
  let {
@@ -5166,7 +6440,7 @@ async function createLabelmapsFromBufferInternal(referencedImageIds, arrayBuffer
5166
6440
  const referenceImageId = referencedImageIds[i];
5167
6441
  imageIdMaps.indices[referenceImageId] = i;
5168
6442
  imageIdMaps.metadata[referenceImageId] = metadataProvider.get("instance", referenceImageId);
5169
- const labelMapImage = dist_esm.imageLoader.createAndCacheDerivedLabelmapImage(referenceImageId);
6443
+ const labelMapImage = esm.imageLoader.createAndCacheDerivedLabelmapImage(referenceImageId);
5170
6444
  labelMapImages.push(labelMapImage);
5171
6445
  }
5172
6446
  const segmentsPixelIndices = new Map();
@@ -5200,8 +6474,8 @@ async function createLabelmapsFromBufferInternal(referencedImageIds, arrayBuffer
5200
6474
  overlappingSegments: hasOverlappingSegments
5201
6475
  };
5202
6476
  }
5203
- const throttledTriggerLoadProgressEvent = tools_dist_esm.utilities.throttle(percentComplete => {
5204
- (0,dist_esm.triggerEvent)(dist_esm.eventTarget, Events.SEGMENTATION_LOAD_PROGRESS, {
6477
+ const throttledTriggerLoadProgressEvent = dist_esm.utilities.throttle(percentComplete => {
6478
+ (0,esm.triggerEvent)(esm.eventTarget, Events.SEGMENTATION_LOAD_PROGRESS, {
5205
6479
  percentComplete
5206
6480
  });
5207
6481
  }, 200);
@@ -5309,7 +6583,72 @@ function labelmapImagesFromBuffer_insertPixelDataPlanar(_ref4) {
5309
6583
  });
5310
6584
  }
5311
6585
  };
5312
- processChunk(0);
6586
+ const processLabelmapChunk = firstIndex => {
6587
+ const pfSeq = multiframe.PerFrameFunctionalGroupsSequence;
6588
+ const sharedPlaneOrientation = multiframe.SharedFunctionalGroupsSequence.PlaneOrientationSequence?.ImageOrientationPatient;
6589
+ for (let i = firstIndex; i < firstIndex + imagesPerChunk && i < groupsLen; i++) {
6590
+ const PerFrameFunctionalGroups = pfSeq[i];
6591
+ const ImageOrientationPatientI = sharedPlaneOrientation || PerFrameFunctionalGroups.PlaneOrientationSequence.ImageOrientationPatient;
6592
+ const view = pixelDataChunks.subarray(i * sliceLength, (i + 1) * sliceLength);
6593
+ const pixelDataI2D = ndarray_default()(view, [Rows, Columns]);
6594
+ const alignedPixelDataI = Segmentation_4X_alignPixelDataWithSourceData(pixelDataI2D, ImageOrientationPatientI, validOrientations, tolerance);
6595
+ if (!alignedPixelDataI) {
6596
+ throw new Error("Individual Labelmap SEG frames are out of plane with respect to the first SEG frame. " + "This is not yet supported. Aborting segmentation loading.");
6597
+ }
6598
+ const imageId = findReferenceSourceImageId(multiframe, i, referencedImageIds, metadataProvider, tolerance, sopUIDImageIdIndexMap);
6599
+ if (!imageId) {
6600
+ console.warn(`Image not present in stack, can't import frame : ${i}.`);
6601
+ continue;
6602
+ }
6603
+ const sourceImageMetadata = imageIdMaps.metadata[imageId];
6604
+ if (Rows !== sourceImageMetadata.Rows || Columns !== sourceImageMetadata.Columns) {
6605
+ throw new Error("Individual Labelmap SEG frames have different geometry dimensions (Rows and Columns) " + "respect to the source image reference frame. This is not yet supported. " + "Aborting segmentation loading. ");
6606
+ }
6607
+ const imageIdIndex = imageIdMaps.indices[imageId];
6608
+ const labelmapImage = labelMapImages[imageIdIndex];
6609
+ const labelmap2DView = labelmapImage.getPixelData();
6610
+ const data = alignedPixelDataI.data;
6611
+ let segmentsOnFrameArr = segmentsOnFrame[imageIdIndex];
6612
+ if (!segmentsOnFrameArr) {
6613
+ segmentsOnFrameArr = [];
6614
+ segmentsOnFrame[imageIdIndex] = segmentsOnFrameArr;
6615
+ }
6616
+ const segSet = new Set(segmentsOnFrameArr);
6617
+ for (let k = 0, len = data.length; k < len; ++k) {
6618
+ const segIdx = data[k];
6619
+ if (segIdx !== 0) {
6620
+ labelmap2DView[k] = segIdx;
6621
+ if (!segSet.has(segIdx)) {
6622
+ segmentsOnFrameArr.push(segIdx);
6623
+ segSet.add(segIdx);
6624
+ }
6625
+ if (!segmentsPixelIndices.has(segIdx)) {
6626
+ segmentsPixelIndices.set(segIdx, {});
6627
+ }
6628
+ const segmentPixelInfo = segmentsPixelIndices.get(segIdx);
6629
+ if (!segmentPixelInfo[imageIdIndex]) {
6630
+ segmentPixelInfo[imageIdIndex] = [];
6631
+ }
6632
+ segmentPixelInfo[imageIdIndex].push(k);
6633
+ }
6634
+ }
6635
+ }
6636
+ const percentComplete = Math.round(firstIndex / groupsLen * 100);
6637
+ throttledTriggerLoadProgressEvent(percentComplete);
6638
+ if (firstIndex < groupsLen) {
6639
+ setTimeout(() => processLabelmapChunk(firstIndex + imagesPerChunk), 0);
6640
+ } else {
6641
+ resolve({
6642
+ hasOverlappingSegments: false,
6643
+ arrayOfLabelMapImages: [labelMapImages]
6644
+ });
6645
+ }
6646
+ };
6647
+ if (multiframe.SegmentationType === "LABELMAP") {
6648
+ processLabelmapChunk(0);
6649
+ } else {
6650
+ processChunk(0);
6651
+ }
5313
6652
  });
5314
6653
  }
5315
6654
  const getAlignedPixelData = _ref5 => {
@@ -5360,7 +6699,7 @@ const getArrayOfLabelMapImagesWithSegmentData = _ref7 => {
5360
6699
  return arrayOfSegmentData.map(arr => {
5361
6700
  const labelMapImages = referencedImageIds.map((referencedImageId, i) => {
5362
6701
  const hasEmptySegmentData = !arr[i];
5363
- const labelMapImage = dist_esm.imageLoader.createAndCacheDerivedLabelmapImage(referencedImageId);
6702
+ const labelMapImage = esm.imageLoader.createAndCacheDerivedLabelmapImage(referencedImageId);
5364
6703
  const pixelData = labelMapImage.getPixelData();
5365
6704
  if (!hasEmptySegmentData) {
5366
6705
  for (let j = 0; j < pixelData.length; j++) {
@@ -5739,7 +7078,7 @@ function getStructureSetModule(contour, index) {
5739
7078
  const {
5740
7079
  generateContourSetsFromLabelmap,
5741
7080
  AnnotationToPointData
5742
- } = tools_dist_esm.utilities.contours;
7081
+ } = dist_esm.utilities.contours;
5743
7082
  const {
5744
7083
  DicomMetaDictionary: RTSS_DicomMetaDictionary
5745
7084
  } = dcmjs_es/* default.data */.Ay.data;
@@ -5915,7 +7254,7 @@ function _initializeDataset(rtMetadata, imgMetadata, metadataProvider) {
5915
7254
 
5916
7255
  const {
5917
7256
  generateContourSetsFromLabelmap: RTStruct_generateContourSetsFromLabelmap
5918
- } = tools_dist_esm.utilities.contours;
7257
+ } = dist_esm.utilities.contours;
5919
7258
 
5920
7259
 
5921
7260
 
@@ -6288,6 +7627,7 @@ function downloadDICOMData(bufferOrDataset, filename) {
6288
7627
 
6289
7628
 
6290
7629
 
7630
+
6291
7631
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/index.js
6292
7632
 
6293
7633
 
@@ -6296,6 +7636,7 @@ function downloadDICOMData(bufferOrDataset, filename) {
6296
7636
 
6297
7637
 
6298
7638
 
7639
+
6299
7640
  /***/ }),
6300
7641
 
6301
7642
  /***/ 75183:
@@ -6344,6 +7685,7 @@ var Events;
6344
7685
  Events["ANNOTATION_LOCK_CHANGE"] = "CORNERSTONE_TOOLS_ANNOTATION_LOCK_CHANGE";
6345
7686
  Events["ANNOTATION_VISIBILITY_CHANGE"] = "CORNERSTONE_TOOLS_ANNOTATION_VISIBILITY_CHANGE";
6346
7687
  Events["ANNOTATION_RENDERED"] = "CORNERSTONE_TOOLS_ANNOTATION_RENDERED";
7688
+ Events["ANNOTATION_CUT_MERGE_PROCESS_COMPLETED"] = "CORNERSTONE_TOOLS_ANNOTATION_CUT_MERGE_PROCESS_COMPLETED";
6347
7689
  Events["ANNOTATION_INTERPOLATION_PROCESS_COMPLETED"] = "CORNERSTONE_TOOLS_ANNOTATION_INTERPOLATION_PROCESS_COMPLETED";
6348
7690
  Events["INTERPOLATED_ANNOTATIONS_REMOVED"] = "CORNERSTONE_TOOLS_INTERPOLATED_ANNOTATIONS_REMOVED";
6349
7691
  Events["SEGMENTATION_MODIFIED"] = "CORNERSTONE_TOOLS_SEGMENTATION_MODIFIED";