@ohif/app 3.11.0-beta.4 → 3.11.0-beta.41

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 (59) hide show
  1. package/dist/{3166.bundle.0f97235b970e279a4707.js → 1443.bundle.c2c3a83663dc73b1820e.js} +1384 -120
  2. package/dist/{1459.bundle.70f777c1d4dd80f60f2a.js → 1459.bundle.ce2dea2e729b6990fd5f.js} +4 -5
  3. package/dist/{9026.bundle.37f3be98189966cc21e4.js → 147.bundle.1b8f3523e23ef02f16e5.js} +168 -348
  4. package/dist/147.css +3 -0
  5. package/dist/{9464.bundle.bc0e50f8b60edfdcb9d4.js → 1755.bundle.273a2ccf55fb6b5f24cc.js} +1700 -92
  6. package/dist/{1807.bundle.c3e389c1032546990d0f.js → 1807.bundle.bda0f454ee2a4bb16a8d.js} +140 -14
  7. package/dist/{1919.bundle.36abe9ac129e3feda56c.js → 1919.bundle.5671ece333e8bed1b9a3.js} +12 -9
  8. package/dist/{1927.bundle.83810560c4d3a90eb7cf.js → 1927.bundle.8ff87d0f7b5c9827c0b7.js} +1 -1
  9. package/dist/{7639.bundle.5bb6b94168812afff4e9.js → 20.bundle.5bd1ab88428890c8d245.js} +176 -26
  10. package/dist/{213.bundle.f0e91360bfbb6a7fff1e.js → 213.bundle.39658febe5cf70092109.js} +17 -16
  11. package/dist/{2424.bundle.ed1e829e9f8994d42268.js → 2424.bundle.b168820ca49adb020e2e.js} +16 -18
  12. package/dist/{2701.bundle.f1f15df81406d04851c4.js → 2701.bundle.2efa5ef87231f42523b0.js} +15 -182
  13. package/dist/{2860.bundle.5d93c30e2df60e382bda.js → 2860.bundle.e34569d9a74c449d1540.js} +1382 -34
  14. package/dist/{2914.bundle.a0a5ddfebfc9d429063d.js → 2914.bundle.cd8484abdeeca657a947.js} +17 -1
  15. package/dist/{4991.bundle.f72a01fd158167a94ae8.js → 2974.bundle.b8dce8a8a0ddb1b8f5fe.js} +552 -1
  16. package/dist/{3075.bundle.0624f6bf3f676f30d1b5.js → 3075.bundle.c2db31f3c9af6aef6765.js} +16 -3
  17. package/dist/{3353.bundle.184ebb9668df2cbebd26.js → 3353.bundle.1da534e468bbcdfb3e61.js} +71 -25
  18. package/dist/{3658.bundle.4626913077118884c82a.js → 3658.bundle.751c0df421fad991e21a.js} +6 -6
  19. package/dist/{4113.bundle.9b74254dea58217f44e7.js → 4113.bundle.87f8055d01fa2002e508.js} +24 -60
  20. package/dist/{2932.bundle.eef63513eb91799b699f.js → 414.bundle.f1014fc73cc678367ed7.js} +224 -116
  21. package/dist/{4202.bundle.89ae773b645db3b1c59c.js → 4202.bundle.c6a6fbe72316d634ea50.js} +6 -8
  22. package/dist/{3396.bundle.858cfdfc5ab560840958.js → 4834.bundle.127402fccb2569e19089.js} +494 -1504
  23. package/dist/5349.bundle.0cb8c9401110fad0ad34.js +264 -0
  24. package/dist/{6027.bundle.033d7f5b05753d637829.js → 6027.bundle.200b200d7837fd1130ed.js} +5 -7
  25. package/dist/{6201.bundle.8345a4f28dccdd3964fc.js → 6201.bundle.d44f7dd7e97388901d43.js} +18 -14
  26. package/dist/{6376.bundle.baa1088702940b82e198.js → 6376.bundle.2bc0cb4c1dfb24e7821c.js} +1 -1
  27. package/dist/{7159.bundle.9c21bc29860ed1850c67.js → 7159.bundle.71fc1d465a641a38d55c.js} +19 -6
  28. package/dist/{7190.bundle.2b96b2c6711301b56d54.js → 7190.bundle.5dd1bbf8270acf285eae.js} +30 -12
  29. package/dist/{7197.bundle.3761ac22f6deace64267.js → 7197.bundle.21998be2eae5242b65a2.js} +23 -13
  30. package/dist/{7241.bundle.91a068f7da51bbbc5a36.js → 7366.bundle.de3cd9dddfc218b88cb7.js} +8069 -4538
  31. package/dist/{6029.bundle.c5d0baf943c367e7bcb8.js → 7639.bundle.c3728b03f5b021678adb.js} +1552 -242
  32. package/dist/{810.bundle.a068eefb47145eba3646.js → 810.bundle.097ff444788f11fa6738.js} +21 -23
  33. package/dist/{8185.bundle.0dde37bbed6dbbf102d3.js → 8185.bundle.14055d7349389628491a.js} +22 -16
  34. package/dist/{8228.bundle.74c8ca5e66a44db80464.js → 8228.bundle.d112b3c04805d0f7ec2f.js} +6 -6
  35. package/dist/{3984.bundle.a331ebdcb2b9689957c9.js → 8420.bundle.1f70bb49c2c4937daec7.js} +675 -549
  36. package/dist/{85.bundle.70d771fdb8bff5459819.js → 85.bundle.94f48e759d07ce4996b0.js} +131 -25
  37. package/dist/{8558.bundle.62f318f0173a8c883eac.js → 8558.bundle.9206e74456d71d10163b.js} +29 -22
  38. package/dist/{4526.bundle.fbdd617a934353019be3.js → 8740.bundle.d9921daed3b3b74ca1c0.js} +37 -229
  39. package/dist/{8815.bundle.17cbe358165596abed6c.js → 8815.bundle.09de4ea0b425161a3d40.js} +144 -19
  40. package/dist/{934.bundle.434c958fbf88583ce207.js → 934.bundle.1c682179ae0a3901ccc6.js} +2 -2
  41. package/dist/{963.bundle.0213ae95c48d603deb5e.js → 963.bundle.1e200493de8d3bf5ca2e.js} +141 -12
  42. package/dist/{9862.bundle.ccb787865a82b9696113.js → 9862.bundle.14baacadd68a27e69b96.js} +20 -58
  43. package/dist/{9977.bundle.071821200c1921021d29.js → 9977.bundle.6beae8cf6bcbb3338216.js} +27 -2
  44. package/dist/{app.bundle.dc0cf08c171266b917ae.js → app.bundle.12ac6ede70c2727d6a4e.js} +231217 -276359
  45. package/dist/app.bundle.css +3 -26
  46. package/dist/{compute.bundle.f0c30502c027d04e94f2.js → compute.bundle.fd5e2231c1440e676c20.js} +3 -3
  47. package/dist/index.html +1 -1
  48. package/dist/{interpolation.bundle.26c71e2b635b13e01127.js → interpolation.bundle.9226cca4caf2ef9a59e7.js} +1 -1
  49. package/dist/{polySeg.bundle.707e6d9b0342d06ffa49.js → polySeg.bundle.47987b6b3afe8ef94ad2.js} +3 -3
  50. package/dist/sw.js +1 -1
  51. package/package.json +19 -19
  52. package/dist/9026.css +0 -3
  53. package/dist/9890.bundle.37d7ed265c0454337a57.js +0 -480
  54. /package/dist/{2932.css → 414.css} +0 -0
  55. /package/dist/{4759.bundle.a31dcfd4c3054e2ea980.js → 4759.bundle.d1fdc8e827d54c0f40c9.js} +0 -0
  56. /package/dist/{9890.css → 5349.css} +0 -0
  57. /package/dist/{5674.bundle.b9c6a5039c2113262ae5.js → 5674.bundle.49f5a714f733cf20d560.js} +0 -0
  58. /package/dist/{6939.bundle.45622b7920dac102b5a7.js → 6939.bundle.41fbdef87597b5172ec6.js} +0 -0
  59. /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);
@@ -3332,6 +3334,8 @@ const CornerstonePMAP = {
3332
3334
 
3333
3335
 
3334
3336
 
3337
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 1 modules
3338
+ var esm = __webpack_require__(15327);
3335
3339
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone3D/cornerstone3DTag.js
3336
3340
  var CORNERSTONE_3D_TAG = "Cornerstone3DTools@^0.1.0";
3337
3341
 
@@ -3358,6 +3362,25 @@ function copyStudyTags(src) {
3358
3362
 
3359
3363
 
3360
3364
 
3365
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/helpers/copySeriesTags.js
3366
+ const seriesTags = ["SeriesInstanceUID", "SeriesNumber", "SeriesDescription", "Modality", "SeriesDate", "SeriesTime"];
3367
+ function copySeriesTags(src) {
3368
+ const study = {
3369
+ _meta: src._meta,
3370
+ _vrMap: src._vrMap
3371
+ };
3372
+ for (const tagKey of seriesTags) {
3373
+ const value = src[tagKey];
3374
+ if (value === undefined) {
3375
+ continue;
3376
+ }
3377
+ study[tagKey] = value;
3378
+ }
3379
+ return study;
3380
+ }
3381
+
3382
+
3383
+
3361
3384
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone3D/CodingScheme.js
3362
3385
  // This is a custom coding scheme defined to store some annotations from Cornerstone.
3363
3386
  // Note: CodeMeaning is VR type LO, which means we only actually support 64 characters
@@ -3375,6 +3398,11 @@ const CodingScheme = {
3375
3398
 
3376
3399
 
3377
3400
 
3401
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone3D/constants/index.js
3402
+ const NO_IMAGE_ID = "none";
3403
+
3404
+
3405
+
3378
3406
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone3D/MeasurementReport.js
3379
3407
 
3380
3408
 
@@ -3384,6 +3412,9 @@ const CodingScheme = {
3384
3412
 
3385
3413
 
3386
3414
 
3415
+
3416
+
3417
+
3387
3418
  var _MeasurementReport;
3388
3419
  const {
3389
3420
  TID1500: MeasurementReport_TID1500,
@@ -3469,15 +3500,13 @@ class MeasurementReport_MeasurementReport {
3469
3500
  };
3470
3501
  return _meta;
3471
3502
  }
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");
3503
+ static processSCOORDGroup(_ref) {
3504
+ let {
3505
+ SCOORDGroup,
3506
+ toolType,
3507
+ sopInstanceUIDToImageIdMap,
3508
+ metadata
3509
+ } = _ref;
3481
3510
  const {
3482
3511
  ReferencedSOPSequence
3483
3512
  } = SCOORDGroup.ContentSequence;
@@ -3487,23 +3516,101 @@ class MeasurementReport_MeasurementReport {
3487
3516
  } = ReferencedSOPSequence;
3488
3517
  const referencedImageId = sopInstanceUIDToImageIdMap[ReferencedSOPInstanceUID];
3489
3518
  const imagePlaneModule = metadata.get("imagePlaneModule", referencedImageId);
3519
+ return {
3520
+ SCOORDGroup,
3521
+ ReferencedSOPSequence,
3522
+ ReferencedSOPInstanceUID,
3523
+ ReferencedFrameNumber,
3524
+ state: {
3525
+ description: undefined,
3526
+ sopInstanceUid: ReferencedSOPInstanceUID,
3527
+ annotation: {
3528
+ annotationUID: MeasurementReport_DicomMetaDictionary.uid(),
3529
+ metadata: {
3530
+ toolName: toolType,
3531
+ referencedImageId,
3532
+ FrameOfReferenceUID: imagePlaneModule.frameOfReferenceUID,
3533
+ label: ""
3534
+ }
3535
+ }
3536
+ }
3537
+ };
3538
+ }
3539
+ static processSCOORD3DGroup(_ref2) {
3540
+ let {
3541
+ SCOORD3DGroup,
3542
+ toolType
3543
+ } = _ref2;
3544
+ return {
3545
+ SCOORD3DGroup,
3546
+ FrameOfReferenceUID: SCOORD3DGroup.ReferencedFrameOfReferenceUID,
3547
+ state: {
3548
+ description: undefined,
3549
+ annotation: {
3550
+ annotationUID: MeasurementReport_DicomMetaDictionary.uid(),
3551
+ metadata: {
3552
+ toolName: toolType,
3553
+ FrameOfReferenceUID: SCOORD3DGroup.ReferencedFrameOfReferenceUID,
3554
+ label: ""
3555
+ }
3556
+ }
3557
+ }
3558
+ };
3559
+ }
3560
+ static getSpatialCoordinatesState(_ref3) {
3561
+ let {
3562
+ NUMGroup,
3563
+ sopInstanceUIDToImageIdMap,
3564
+ metadata,
3565
+ toolType
3566
+ } = _ref3;
3567
+ const SCOORDGroup = toArray(NUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD");
3568
+ const SCOORD3DGroup = toArray(NUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD3D");
3569
+ if (SCOORDGroup) {
3570
+ return this.processSCOORDGroup({
3571
+ SCOORDGroup,
3572
+ toolType,
3573
+ metadata,
3574
+ sopInstanceUIDToImageIdMap
3575
+ });
3576
+ } else if (SCOORD3DGroup) {
3577
+ return this.processSCOORD3DGroup({
3578
+ SCOORD3DGroup,
3579
+ toolType
3580
+ });
3581
+ } else {
3582
+ throw new Error("No spatial coordinates group found.");
3583
+ }
3584
+ }
3585
+ static processSpatialCoordinatesGroup(_ref4) {
3586
+ let {
3587
+ NUMGroup,
3588
+ sopInstanceUIDToImageIdMap,
3589
+ metadata,
3590
+ findingGroup,
3591
+ findingSiteGroups,
3592
+ toolType
3593
+ } = _ref4;
3594
+ const {
3595
+ state,
3596
+ SCOORDGroup,
3597
+ ReferencedSOPSequence,
3598
+ ReferencedSOPInstanceUID,
3599
+ ReferencedFrameNumber,
3600
+ SCOORD3DGroup,
3601
+ FrameOfReferenceUID
3602
+ } = this.getSpatialCoordinatesState({
3603
+ NUMGroup,
3604
+ sopInstanceUIDToImageIdMap,
3605
+ metadata,
3606
+ toolType
3607
+ });
3490
3608
  const finding = findingGroup ? MeasurementReport_addAccessors(findingGroup.ConceptCodeSequence) : undefined;
3491
3609
  const findingSites = findingSiteGroups.map(fsg => {
3492
3610
  return MeasurementReport_addAccessors(fsg.ConceptCodeSequence);
3493
3611
  });
3494
3612
  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
- },
3613
+ ...state,
3507
3614
  finding,
3508
3615
  findingSites
3509
3616
  };
@@ -3517,39 +3624,96 @@ class MeasurementReport_MeasurementReport {
3517
3624
  SCOORDGroup,
3518
3625
  ReferencedSOPSequence,
3519
3626
  ReferencedSOPInstanceUID,
3520
- ReferencedFrameNumber
3627
+ ReferencedFrameNumber,
3628
+ SCOORD3DGroup,
3629
+ FrameOfReferenceUID
3630
+ };
3631
+ }
3632
+ static getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, toolType) {
3633
+ const {
3634
+ ContentSequence
3635
+ } = MeasurementGroup;
3636
+ const contentSequenceArr = toArray(ContentSequence);
3637
+ const findingGroup = contentSequenceArr.find(group => this.codeValueMatch(group, MeasurementReport_FINDING));
3638
+ const findingSiteGroups = contentSequenceArr.filter(group => this.codeValueMatch(group, MeasurementReport_FINDING_SITE, MeasurementReport_FINDING_SITE_OLD)) || [];
3639
+ const NUMGroup = contentSequenceArr.find(group => group.ValueType === "NUM");
3640
+ return this.processSpatialCoordinatesGroup({
3641
+ NUMGroup,
3642
+ sopInstanceUIDToImageIdMap,
3643
+ metadata,
3644
+ findingGroup,
3645
+ findingSiteGroups,
3646
+ toolType
3647
+ });
3648
+ }
3649
+ static generateReferencedSOPSequence(_ref5) {
3650
+ let {
3651
+ toolData,
3652
+ toolTypes,
3653
+ metadataProvider,
3654
+ imageId,
3655
+ sopInstanceUIDsToSeriesInstanceUIDMap,
3656
+ derivationSourceDatasets
3657
+ } = _ref5;
3658
+ const effectiveImageId = imageId === NO_IMAGE_ID ? this.getImageIdFromVolume({
3659
+ toolData,
3660
+ toolTypes
3661
+ }) : imageId;
3662
+ const sopCommonModule = metadataProvider.get("sopCommonModule", effectiveImageId);
3663
+ const instance = metadataProvider.get("instance", effectiveImageId);
3664
+ const {
3665
+ sopInstanceUID,
3666
+ sopClassUID
3667
+ } = sopCommonModule;
3668
+ const {
3669
+ SeriesInstanceUID: seriesInstanceUID
3670
+ } = instance;
3671
+ sopInstanceUIDsToSeriesInstanceUIDMap[sopInstanceUID] = seriesInstanceUID;
3672
+ if (!derivationSourceDatasets.find(dsd => dsd.SeriesInstanceUID === seriesInstanceUID)) {
3673
+ const derivationSourceDataset = MeasurementReport_MeasurementReport.generateDerivationSourceDataset(instance);
3674
+ derivationSourceDatasets.push(derivationSourceDataset);
3675
+ }
3676
+ const frameNumber = metadataProvider.get("frameNumber", effectiveImageId);
3677
+ const ReferencedSOPSequence = {
3678
+ ReferencedSOPClassUID: sopClassUID,
3679
+ ReferencedSOPInstanceUID: sopInstanceUID,
3680
+ ReferencedFrameNumber: undefined
3521
3681
  };
3682
+ if (instance && instance.NumberOfFrames && instance.NumberOfFrames > 1 || MeasurementReport_Normalizer.isMultiframeSOPClassUID(sopClassUID)) {
3683
+ ReferencedSOPSequence.ReferencedFrameNumber = frameNumber;
3684
+ }
3685
+ return ReferencedSOPSequence;
3686
+ }
3687
+ static getImageIdFromVolume(_ref6) {
3688
+ let {
3689
+ toolData,
3690
+ toolTypes
3691
+ } = _ref6;
3692
+ const referenceToolData = toolData?.[toolTypes?.[0]]?.data?.[0];
3693
+ const volumeId = referenceToolData?.metadata?.volumeId;
3694
+ const volume = esm.cache.getVolume(volumeId);
3695
+ const imageId = volume.imageIds[0];
3696
+ return imageId;
3522
3697
  }
3523
3698
  static generateReport(toolState, metadataProvider, worldToImageCoords, options) {
3524
3699
  let allMeasurementGroups = [];
3525
3700
  const sopInstanceUIDsToSeriesInstanceUIDMap = {};
3526
3701
  const derivationSourceDatasets = [];
3527
3702
  const _meta = MeasurementReport_MeasurementReport.generateDatasetMeta();
3703
+ let is3DSR = false;
3528
3704
  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
3705
  const toolData = toolState[imageId];
3545
3706
  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;
3707
+ const ReferencedSOPSequence = this.generateReferencedSOPSequence({
3708
+ toolData,
3709
+ toolTypes,
3710
+ metadataProvider,
3711
+ imageId,
3712
+ sopInstanceUIDsToSeriesInstanceUIDMap,
3713
+ derivationSourceDatasets
3714
+ });
3715
+ if (imageId === NO_IMAGE_ID) {
3716
+ is3DSR = true;
3553
3717
  }
3554
3718
  const measurementGroups = [];
3555
3719
  toolTypes.forEach(toolType => {
@@ -3571,6 +3735,9 @@ class MeasurementReport_MeasurementReport {
3571
3735
  report.dataset = Object.assign(report.dataset, contentItem);
3572
3736
  report.dataset._meta = _meta;
3573
3737
  report.SpecificCharacterSet = "ISO_IR 192";
3738
+ if (is3DSR) {
3739
+ report.dataset.SOPClassUID = MeasurementReport_DicomMetaDictionary.sopClassUIDsByName.Comprehensive3DSR;
3740
+ }
3574
3741
  return report;
3575
3742
  }
3576
3743
  static generateToolState(dataset, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata, hooks) {
@@ -3661,9 +3828,12 @@ _MeasurementReport.codeValueMatch = (group, code, oldCode) => {
3661
3828
  return CodingSchemeDesignator == code.CodingSchemeDesignator && CodeValue == code.CodeValue || oldCode && CodingSchemeDesignator == oldCode.CodingSchemeDesignator && CodeValue == oldCode.CodeValue;
3662
3829
  };
3663
3830
  _MeasurementReport.generateDerivationSourceDataset = instance => {
3664
- _MeasurementReport.generateDatasetMeta();
3665
- const derivationSourceDataset = copyStudyTags(instance);
3666
- return derivationSourceDataset;
3831
+ const studyTags = copyStudyTags(instance);
3832
+ const seriesTags = copySeriesTags(instance);
3833
+ return {
3834
+ ...studyTags,
3835
+ ...seriesTags
3836
+ };
3667
3837
  };
3668
3838
 
3669
3839
 
@@ -3736,7 +3906,7 @@ class BaseAdapter3D {
3736
3906
  referencedImageId
3737
3907
  } = metadata;
3738
3908
  if (!referencedImageId) {
3739
- throw new Error("Probe.getTID300RepresentationArguments: referencedImageId is not defined");
3909
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
3740
3910
  }
3741
3911
  const {
3742
3912
  handles: {
@@ -3758,6 +3928,30 @@ class BaseAdapter3D {
3758
3928
  };
3759
3929
  return tidArguments;
3760
3930
  }
3931
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
3932
+ const {
3933
+ data,
3934
+ finding,
3935
+ findingSites
3936
+ } = tool;
3937
+ const {
3938
+ handles: {
3939
+ points = []
3940
+ }
3941
+ } = data;
3942
+ const point = points[0];
3943
+ const pointXYZ = {
3944
+ x: point[0],
3945
+ y: point[1],
3946
+ z: point[2]
3947
+ };
3948
+ return {
3949
+ points: [pointXYZ],
3950
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
3951
+ findingSites: findingSites || [],
3952
+ finding
3953
+ };
3954
+ }
3761
3955
  }
3762
3956
 
3763
3957
 
@@ -3780,10 +3974,69 @@ class ArrowAnnotate_ArrowAnnotate extends BaseAdapter3D {
3780
3974
  const {
3781
3975
  defaultState,
3782
3976
  SCOORDGroup,
3977
+ SCOORD3DGroup,
3783
3978
  ReferencedFrameNumber
3784
3979
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, ArrowAnnotate_ArrowAnnotate.toolType);
3785
3980
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
3786
3981
  const text = defaultState.annotation.metadata.label;
3982
+ if (SCOORDGroup) {
3983
+ return this.getMeasurementDataFromScoord({
3984
+ SCOORDGroup,
3985
+ referencedImageId,
3986
+ metadata,
3987
+ imageToWorldCoords,
3988
+ defaultState,
3989
+ text,
3990
+ ReferencedFrameNumber
3991
+ });
3992
+ } else if (SCOORD3DGroup) {
3993
+ return this.getMeasurementDataFromScoord3D({
3994
+ SCOORD3DGroup,
3995
+ defaultState,
3996
+ text
3997
+ });
3998
+ } else {
3999
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
4000
+ }
4001
+ }
4002
+ static getMeasurementDataFromScoord3D(_ref) {
4003
+ let {
4004
+ SCOORD3DGroup,
4005
+ defaultState,
4006
+ text
4007
+ } = _ref;
4008
+ const {
4009
+ GraphicData
4010
+ } = SCOORD3DGroup;
4011
+ const worldCoords = [];
4012
+ for (let i = 0; i < GraphicData.length; i += 3) {
4013
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
4014
+ worldCoords.push(point);
4015
+ }
4016
+ const state = defaultState;
4017
+ state.annotation.data = {
4018
+ text,
4019
+ handles: {
4020
+ arrowFirst: true,
4021
+ points: [worldCoords[0], worldCoords[1]],
4022
+ activeHandleIndex: 0,
4023
+ textBox: {
4024
+ hasMoved: false
4025
+ }
4026
+ }
4027
+ };
4028
+ return state;
4029
+ }
4030
+ static getMeasurementDataFromScoord(_ref2) {
4031
+ let {
4032
+ SCOORDGroup,
4033
+ referencedImageId,
4034
+ metadata,
4035
+ imageToWorldCoords,
4036
+ defaultState,
4037
+ text,
4038
+ ReferencedFrameNumber
4039
+ } = _ref2;
3787
4040
  const {
3788
4041
  GraphicData
3789
4042
  } = SCOORDGroup;
@@ -3835,7 +4088,7 @@ class ArrowAnnotate_ArrowAnnotate extends BaseAdapter3D {
3835
4088
  referencedImageId
3836
4089
  } = metadata;
3837
4090
  if (!referencedImageId) {
3838
- throw new Error("ArrowAnnotate.getTID300RepresentationArguments: referencedImageId is not defined");
4091
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
3839
4092
  }
3840
4093
  const {
3841
4094
  points,
@@ -3862,7 +4115,57 @@ class ArrowAnnotate_ArrowAnnotate extends BaseAdapter3D {
3862
4115
  }],
3863
4116
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
3864
4117
  findingSites: findingSites || [],
4118
+ finding,
4119
+ use3DSpatialCoordinates: false
4120
+ };
4121
+ if (!finding || finding.CodeValue !== codeValues.CORNERSTONEFREETEXT) {
4122
+ finding = {
4123
+ CodeValue: codeValues.CORNERSTONEFREETEXT,
4124
+ CodingSchemeDesignator: CodingScheme.CodingSchemeDesignator,
4125
+ CodeMeaning: data.text
4126
+ };
4127
+ }
4128
+ return TID300RepresentationArguments;
4129
+ }
4130
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
4131
+ const {
4132
+ data,
4133
+ findingSites,
4134
+ metadata
4135
+ } = tool;
4136
+ let {
3865
4137
  finding
4138
+ } = tool;
4139
+ const {
4140
+ points,
4141
+ arrowFirst
4142
+ } = data.handles;
4143
+ let point;
4144
+ let point2;
4145
+ if (arrowFirst) {
4146
+ point = points[0];
4147
+ point2 = points[1];
4148
+ } else {
4149
+ point = points[1];
4150
+ point2 = points[0];
4151
+ }
4152
+ const pointImage = point;
4153
+ const pointImage2 = point2;
4154
+ const TID300RepresentationArguments = {
4155
+ points: [{
4156
+ x: pointImage[0],
4157
+ y: pointImage[1],
4158
+ z: pointImage[2]
4159
+ }, {
4160
+ x: pointImage2[0],
4161
+ y: pointImage2[1],
4162
+ z: pointImage2[2]
4163
+ }],
4164
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4165
+ findingSites: findingSites || [],
4166
+ finding,
4167
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
4168
+ use3DSpatialCoordinates: true
3866
4169
  };
3867
4170
  if (!finding || finding.CodeValue !== codeValues.CORNERSTONEFREETEXT) {
3868
4171
  finding = {
@@ -3906,9 +4209,39 @@ class Bidirectional_Bidirectional extends BaseAdapter3D {
3906
4209
  ContentSequence
3907
4210
  } = MeasurementGroup;
3908
4211
  const longAxisNUMGroup = toArray(ContentSequence).find(group => group.ConceptNameCodeSequence.CodeMeaning === Bidirectional_LONG_AXIS);
3909
- const longAxisSCOORDGroup = toArray(longAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD");
3910
4212
  const shortAxisNUMGroup = toArray(ContentSequence).find(group => group.ConceptNameCodeSequence.CodeMeaning === Bidirectional_SHORT_AXIS);
4213
+ const longAxisSCOORDGroup = toArray(longAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD");
3911
4214
  const shortAxisSCOORDGroup = toArray(shortAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD");
4215
+ if (longAxisSCOORDGroup && shortAxisSCOORDGroup) {
4216
+ return this.getMeasurementDataFromScoord({
4217
+ longAxisNUMGroup,
4218
+ shortAxisNUMGroup,
4219
+ longAxisSCOORDGroup,
4220
+ shortAxisSCOORDGroup,
4221
+ referencedImageId,
4222
+ imageToWorldCoords,
4223
+ ReferencedFrameNumber,
4224
+ defaultState
4225
+ });
4226
+ } else {
4227
+ return this.getMeasurementDataFromScoord3d({
4228
+ longAxisNUMGroup,
4229
+ shortAxisNUMGroup,
4230
+ defaultState
4231
+ });
4232
+ }
4233
+ }
4234
+ static getMeasurementDataFromScoord(_ref) {
4235
+ let {
4236
+ longAxisNUMGroup,
4237
+ shortAxisNUMGroup,
4238
+ longAxisSCOORDGroup,
4239
+ shortAxisSCOORDGroup,
4240
+ referencedImageId,
4241
+ imageToWorldCoords,
4242
+ ReferencedFrameNumber,
4243
+ defaultState
4244
+ } = _ref;
3912
4245
  const worldCoords = [];
3913
4246
  [longAxisSCOORDGroup, shortAxisSCOORDGroup].forEach(group => {
3914
4247
  const {
@@ -3938,6 +4271,37 @@ class Bidirectional_Bidirectional extends BaseAdapter3D {
3938
4271
  };
3939
4272
  return state;
3940
4273
  }
4274
+ static getMeasurementDataFromScoord3d(_ref2) {
4275
+ let {
4276
+ longAxisNUMGroup,
4277
+ shortAxisNUMGroup,
4278
+ defaultState
4279
+ } = _ref2;
4280
+ const worldCoords = [];
4281
+ const longAxisSCOORD3DGroup = toArray(longAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD3D");
4282
+ const shortAxisSCOORD3DGroup = toArray(shortAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD3D");
4283
+ [longAxisSCOORD3DGroup, shortAxisSCOORD3DGroup].forEach(group => {
4284
+ const {
4285
+ GraphicData
4286
+ } = group;
4287
+ for (let i = 0; i < GraphicData.length; i += 3) {
4288
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
4289
+ worldCoords.push(point);
4290
+ }
4291
+ });
4292
+ const state = defaultState;
4293
+ state.annotation.data = {
4294
+ handles: {
4295
+ points: [worldCoords[0], worldCoords[1], worldCoords[2], worldCoords[3]],
4296
+ activeHandleIndex: 0,
4297
+ textBox: {
4298
+ hasMoved: false
4299
+ }
4300
+ },
4301
+ cachedStats: {}
4302
+ };
4303
+ return state;
4304
+ }
3941
4305
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
3942
4306
  const {
3943
4307
  data,
@@ -3952,13 +4316,6 @@ class Bidirectional_Bidirectional extends BaseAdapter3D {
3952
4316
  const {
3953
4317
  referencedImageId
3954
4318
  } = 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
4319
  const {
3963
4320
  points
3964
4321
  } = handles;
@@ -3975,10 +4332,21 @@ class Bidirectional_Bidirectional extends BaseAdapter3D {
3975
4332
  shortAxisPoints = secondPointPairs;
3976
4333
  longAxisPoints = firstPointPairs;
3977
4334
  }
4335
+ if (!referencedImageId) {
4336
+ return this.getTID300RepresentationArgumentsSCOORD3D({
4337
+ tool,
4338
+ shortAxisPoints,
4339
+ longAxisPoints
4340
+ });
4341
+ }
3978
4342
  const longAxisStartImage = worldToImageCoords(referencedImageId, shortAxisPoints[0]);
3979
4343
  const longAxisEndImage = worldToImageCoords(referencedImageId, shortAxisPoints[1]);
3980
4344
  const shortAxisStartImage = worldToImageCoords(referencedImageId, longAxisPoints[0]);
3981
4345
  const shortAxisEndImage = worldToImageCoords(referencedImageId, longAxisPoints[1]);
4346
+ const {
4347
+ length,
4348
+ width
4349
+ } = cachedStats[`imageId:${referencedImageId}`] || {};
3982
4350
  return {
3983
4351
  longAxis: {
3984
4352
  point1: {
@@ -4004,18 +4372,77 @@ class Bidirectional_Bidirectional extends BaseAdapter3D {
4004
4372
  shortAxisLength: width,
4005
4373
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4006
4374
  finding: finding,
4007
- findingSites: findingSites || []
4375
+ findingSites: findingSites || [],
4376
+ use3DSpatialCoordinates: false
4008
4377
  };
4009
4378
  }
4010
- }
4011
- _Bidirectional = Bidirectional_Bidirectional;
4012
- (() => {
4013
- _Bidirectional.init("Bidirectional", Bidirectional_TID300Bidirectional);
4014
- _Bidirectional.registerLegacy();
4015
- })();
4016
-
4017
-
4018
-
4379
+ static getTID300RepresentationArgumentsSCOORD3D(_ref3) {
4380
+ let {
4381
+ tool,
4382
+ shortAxisPoints,
4383
+ longAxisPoints
4384
+ } = _ref3;
4385
+ const {
4386
+ data,
4387
+ finding,
4388
+ findingSites,
4389
+ metadata
4390
+ } = tool;
4391
+ const {
4392
+ cachedStats = {}
4393
+ } = data;
4394
+ const longAxisStart = shortAxisPoints[0];
4395
+ const longAxisEnd = shortAxisPoints[1];
4396
+ const shortAxisStart = longAxisPoints[0];
4397
+ const shortAxisEnd = longAxisPoints[1];
4398
+ const cachedStatsKeys = Object.keys(cachedStats)[0];
4399
+ const {
4400
+ length,
4401
+ width
4402
+ } = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
4403
+ return {
4404
+ longAxis: {
4405
+ point1: {
4406
+ x: longAxisStart[0],
4407
+ y: longAxisStart[1],
4408
+ z: longAxisStart[2]
4409
+ },
4410
+ point2: {
4411
+ x: longAxisEnd[0],
4412
+ y: longAxisEnd[1],
4413
+ z: longAxisEnd[2]
4414
+ }
4415
+ },
4416
+ shortAxis: {
4417
+ point1: {
4418
+ x: shortAxisStart[0],
4419
+ y: shortAxisStart[1],
4420
+ z: shortAxisStart[2]
4421
+ },
4422
+ point2: {
4423
+ x: shortAxisEnd[0],
4424
+ y: shortAxisEnd[1],
4425
+ z: shortAxisEnd[2]
4426
+ }
4427
+ },
4428
+ longAxisLength: length,
4429
+ shortAxisLength: width,
4430
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4431
+ finding: finding,
4432
+ findingSites: findingSites || [],
4433
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
4434
+ use3DSpatialCoordinates: true
4435
+ };
4436
+ }
4437
+ }
4438
+ _Bidirectional = Bidirectional_Bidirectional;
4439
+ (() => {
4440
+ _Bidirectional.init("Bidirectional", Bidirectional_TID300Bidirectional);
4441
+ _Bidirectional.registerLegacy();
4442
+ })();
4443
+
4444
+
4445
+
4019
4446
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone3D/Angle.js
4020
4447
 
4021
4448
 
@@ -4031,8 +4458,34 @@ class Angle_Angle extends BaseAdapter3D {
4031
4458
  defaultState,
4032
4459
  NUMGroup,
4033
4460
  SCOORDGroup,
4461
+ SCOORD3DGroup,
4034
4462
  ReferencedFrameNumber
4035
4463
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, Angle_Angle.toolType);
4464
+ if (SCOORDGroup) {
4465
+ return this.getMeasurementDataFromScoord({
4466
+ defaultState,
4467
+ SCOORDGroup,
4468
+ imageToWorldCoords,
4469
+ NUMGroup,
4470
+ ReferencedFrameNumber
4471
+ });
4472
+ } else if (SCOORD3DGroup) {
4473
+ return this.getMeasurementDataFromScoord3D({
4474
+ defaultState,
4475
+ SCOORD3DGroup
4476
+ });
4477
+ } else {
4478
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
4479
+ }
4480
+ }
4481
+ static getMeasurementDataFromScoord(_ref) {
4482
+ let {
4483
+ defaultState,
4484
+ SCOORDGroup,
4485
+ imageToWorldCoords,
4486
+ NUMGroup,
4487
+ ReferencedFrameNumber
4488
+ } = _ref;
4036
4489
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4037
4490
  const {
4038
4491
  GraphicData
@@ -4060,6 +4513,32 @@ class Angle_Angle extends BaseAdapter3D {
4060
4513
  };
4061
4514
  return state;
4062
4515
  }
4516
+ static getMeasurementDataFromScoord3D(_ref2) {
4517
+ let {
4518
+ defaultState,
4519
+ SCOORD3DGroup
4520
+ } = _ref2;
4521
+ const {
4522
+ GraphicData
4523
+ } = SCOORD3DGroup;
4524
+ const worldCoords = [];
4525
+ for (let i = 0; i < GraphicData.length; i += 3) {
4526
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
4527
+ worldCoords.push(point);
4528
+ }
4529
+ const state = defaultState;
4530
+ state.annotation.data = {
4531
+ handles: {
4532
+ points: [worldCoords[0], worldCoords[1], worldCoords[3]],
4533
+ activeHandleIndex: 0,
4534
+ textBox: {
4535
+ hasMoved: false
4536
+ }
4537
+ },
4538
+ cachedStats: {}
4539
+ };
4540
+ return state;
4541
+ }
4063
4542
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
4064
4543
  const {
4065
4544
  data,
@@ -4075,7 +4554,7 @@ class Angle_Angle extends BaseAdapter3D {
4075
4554
  referencedImageId
4076
4555
  } = metadata;
4077
4556
  if (!referencedImageId) {
4078
- throw new Error("Angle.getTID300RepresentationArguments: referencedImageId is not defined");
4557
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4079
4558
  }
4080
4559
  const start1 = worldToImageCoords(referencedImageId, handles.points[0]);
4081
4560
  const middle = worldToImageCoords(referencedImageId, handles.points[1]);
@@ -4104,7 +4583,55 @@ class Angle_Angle extends BaseAdapter3D {
4104
4583
  rAngle: angle,
4105
4584
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4106
4585
  finding,
4107
- findingSites: findingSites || []
4586
+ findingSites: findingSites || [],
4587
+ use3DSpatialCoordinates: false
4588
+ };
4589
+ }
4590
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
4591
+ const {
4592
+ data,
4593
+ finding,
4594
+ findingSites,
4595
+ metadata
4596
+ } = tool;
4597
+ const {
4598
+ cachedStats = {},
4599
+ handles
4600
+ } = data;
4601
+ const start = handles.points[0];
4602
+ const middle = handles.points[1];
4603
+ const end = handles.points[2];
4604
+ const point1 = {
4605
+ x: start[0],
4606
+ y: start[1],
4607
+ z: start[2]
4608
+ };
4609
+ const point2 = {
4610
+ x: middle[0],
4611
+ y: middle[1],
4612
+ z: middle[2]
4613
+ };
4614
+ const point3 = point2;
4615
+ const point4 = {
4616
+ x: end[0],
4617
+ y: end[1],
4618
+ z: end[2]
4619
+ };
4620
+ const cachedStatsKeys = Object.keys(cachedStats)[0];
4621
+ const {
4622
+ angle
4623
+ } = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
4624
+ return {
4625
+ point1,
4626
+ point2,
4627
+ point3,
4628
+ point4,
4629
+ rAngle: angle,
4630
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4631
+ finding,
4632
+ findingSites: findingSites || [],
4633
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
4634
+ use3DSpatialCoordinates: true
4108
4635
  };
4109
4636
  }
4110
4637
  }
@@ -4131,8 +4658,34 @@ class CobbAngle_CobbAngle extends BaseAdapter3D {
4131
4658
  defaultState,
4132
4659
  NUMGroup,
4133
4660
  SCOORDGroup,
4661
+ SCOORD3DGroup,
4134
4662
  ReferencedFrameNumber
4135
4663
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, CobbAngle_CobbAngle.toolType);
4664
+ if (SCOORDGroup) {
4665
+ return this.getMeasurementDataFromScoord({
4666
+ defaultState,
4667
+ SCOORDGroup,
4668
+ imageToWorldCoords,
4669
+ NUMGroup,
4670
+ ReferencedFrameNumber
4671
+ });
4672
+ } else if (SCOORD3DGroup) {
4673
+ return this.getMeasurementDataFromScoord3D({
4674
+ defaultState,
4675
+ SCOORD3DGroup
4676
+ });
4677
+ } else {
4678
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
4679
+ }
4680
+ }
4681
+ static getMeasurementDataFromScoord(_ref) {
4682
+ let {
4683
+ defaultState,
4684
+ SCOORDGroup,
4685
+ imageToWorldCoords,
4686
+ NUMGroup,
4687
+ ReferencedFrameNumber
4688
+ } = _ref;
4136
4689
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4137
4690
  const {
4138
4691
  GraphicData
@@ -4160,6 +4713,32 @@ class CobbAngle_CobbAngle extends BaseAdapter3D {
4160
4713
  };
4161
4714
  return state;
4162
4715
  }
4716
+ static getMeasurementDataFromScoord3D(_ref2) {
4717
+ let {
4718
+ defaultState,
4719
+ SCOORD3DGroup
4720
+ } = _ref2;
4721
+ const {
4722
+ GraphicData
4723
+ } = SCOORD3DGroup;
4724
+ const worldCoords = [];
4725
+ for (let i = 0; i < GraphicData.length; i += 3) {
4726
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
4727
+ worldCoords.push(point);
4728
+ }
4729
+ const state = defaultState;
4730
+ state.annotation.data = {
4731
+ handles: {
4732
+ points: [worldCoords[0], worldCoords[1], worldCoords[2], worldCoords[3]],
4733
+ activeHandleIndex: 0,
4734
+ textBox: {
4735
+ hasMoved: false
4736
+ }
4737
+ },
4738
+ cachedStats: {}
4739
+ };
4740
+ return state;
4741
+ }
4163
4742
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
4164
4743
  const {
4165
4744
  data,
@@ -4175,7 +4754,7 @@ class CobbAngle_CobbAngle extends BaseAdapter3D {
4175
4754
  referencedImageId
4176
4755
  } = metadata;
4177
4756
  if (!referencedImageId) {
4178
- throw new Error("CobbAngle.getTID300RepresentationArguments: referencedImageId is not defined");
4757
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4179
4758
  }
4180
4759
  const start1 = worldToImageCoords(referencedImageId, handles.points[0]);
4181
4760
  const end1 = worldToImageCoords(referencedImageId, handles.points[1]);
@@ -4208,7 +4787,60 @@ class CobbAngle_CobbAngle extends BaseAdapter3D {
4208
4787
  rAngle: angle,
4209
4788
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4210
4789
  finding,
4211
- findingSites: findingSites || []
4790
+ findingSites: findingSites || [],
4791
+ use3DSpatialCoordinates: false
4792
+ };
4793
+ }
4794
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
4795
+ const {
4796
+ data,
4797
+ finding,
4798
+ findingSites,
4799
+ metadata
4800
+ } = tool;
4801
+ const {
4802
+ cachedStats = {},
4803
+ handles
4804
+ } = data;
4805
+ const start1 = handles.points[0];
4806
+ const end1 = handles.points[1];
4807
+ const start2 = handles.points[2];
4808
+ const end2 = handles.points[3];
4809
+ const point1 = {
4810
+ x: start1[0],
4811
+ y: start1[1],
4812
+ z: start1[2]
4813
+ };
4814
+ const point2 = {
4815
+ x: end1[0],
4816
+ y: end1[1],
4817
+ z: end1[2]
4818
+ };
4819
+ const point3 = {
4820
+ x: start2[0],
4821
+ y: start2[1],
4822
+ z: start2[2]
4823
+ };
4824
+ const point4 = {
4825
+ x: end2[0],
4826
+ y: end2[1],
4827
+ z: end2[2]
4828
+ };
4829
+ const cachedStatsKeys = Object.keys(cachedStats)[0];
4830
+ const {
4831
+ angle
4832
+ } = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
4833
+ return {
4834
+ point1,
4835
+ point2,
4836
+ point3,
4837
+ point4,
4838
+ rAngle: angle,
4839
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4840
+ finding,
4841
+ findingSites: findingSites || [],
4842
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
4843
+ use3DSpatialCoordinates: true
4212
4844
  };
4213
4845
  }
4214
4846
  }
@@ -4235,8 +4867,34 @@ class CircleROI extends BaseAdapter3D {
4235
4867
  defaultState,
4236
4868
  NUMGroup,
4237
4869
  SCOORDGroup,
4870
+ SCOORD3DGroup,
4238
4871
  ReferencedFrameNumber
4239
4872
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, CircleROI.toolType);
4873
+ if (SCOORDGroup) {
4874
+ return this.getMeasurementDataFromScoord({
4875
+ defaultState,
4876
+ SCOORDGroup,
4877
+ imageToWorldCoords,
4878
+ NUMGroup,
4879
+ ReferencedFrameNumber
4880
+ });
4881
+ } else if (SCOORD3DGroup) {
4882
+ return this.getMeasurementDataFromScoord3D({
4883
+ defaultState,
4884
+ SCOORD3DGroup
4885
+ });
4886
+ } else {
4887
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
4888
+ }
4889
+ }
4890
+ static getMeasurementDataFromScoord(_ref) {
4891
+ let {
4892
+ defaultState,
4893
+ SCOORDGroup,
4894
+ imageToWorldCoords,
4895
+ NUMGroup,
4896
+ ReferencedFrameNumber
4897
+ } = _ref;
4240
4898
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4241
4899
  const {
4242
4900
  GraphicData
@@ -4266,6 +4924,32 @@ class CircleROI extends BaseAdapter3D {
4266
4924
  };
4267
4925
  return state;
4268
4926
  }
4927
+ static getMeasurementDataFromScoord3D(_ref2) {
4928
+ let {
4929
+ defaultState,
4930
+ SCOORD3DGroup
4931
+ } = _ref2;
4932
+ const {
4933
+ GraphicData
4934
+ } = SCOORD3DGroup;
4935
+ const pointsWorld = [];
4936
+ for (let i = 0; i < GraphicData.length; i += 3) {
4937
+ const worldPos = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
4938
+ pointsWorld.push(worldPos);
4939
+ }
4940
+ const state = defaultState;
4941
+ state.annotation.data = {
4942
+ handles: {
4943
+ points: [...pointsWorld],
4944
+ activeHandleIndex: 0,
4945
+ textBox: {
4946
+ hasMoved: false
4947
+ }
4948
+ },
4949
+ cachedStats: {}
4950
+ };
4951
+ return state;
4952
+ }
4269
4953
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
4270
4954
  const {
4271
4955
  data,
@@ -4281,7 +4965,7 @@ class CircleROI extends BaseAdapter3D {
4281
4965
  referencedImageId
4282
4966
  } = metadata;
4283
4967
  if (!referencedImageId) {
4284
- throw new Error("CircleROI.getTID300RepresentationArguments: referencedImageId is not defined");
4968
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4285
4969
  }
4286
4970
  const center = worldToImageCoords(referencedImageId, handles.points[0]);
4287
4971
  const end = worldToImageCoords(referencedImageId, handles.points[1]);
@@ -4306,7 +4990,50 @@ class CircleROI extends BaseAdapter3D {
4306
4990
  points,
4307
4991
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4308
4992
  finding,
4309
- findingSites: findingSites || []
4993
+ findingSites: findingSites || [],
4994
+ use3DSpatialCoordinates: false
4995
+ };
4996
+ }
4997
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
4998
+ const {
4999
+ data,
5000
+ finding,
5001
+ findingSites,
5002
+ metadata
5003
+ } = tool;
5004
+ const {
5005
+ cachedStats = {},
5006
+ handles
5007
+ } = data;
5008
+ const center = handles.points[0];
5009
+ const end = handles.points[1];
5010
+ const points = [];
5011
+ points.push({
5012
+ x: center[0],
5013
+ y: center[1],
5014
+ z: center[2]
5015
+ });
5016
+ points.push({
5017
+ x: end[0],
5018
+ y: end[1],
5019
+ z: center[2]
5020
+ });
5021
+ const cachedStatsKeys = Object.keys(cachedStats)[0];
5022
+ const {
5023
+ area,
5024
+ radius
5025
+ } = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
5026
+ const perimeter = 2 * Math.PI * radius;
5027
+ return {
5028
+ area,
5029
+ perimeter,
5030
+ radius,
5031
+ points,
5032
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
5033
+ finding,
5034
+ findingSites: findingSites || [],
5035
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
5036
+ use3DSpatialCoordinates: true
4310
5037
  };
4311
5038
  }
4312
5039
  }
@@ -4319,7 +5046,7 @@ _CircleROI = CircleROI;
4319
5046
 
4320
5047
 
4321
5048
  // EXTERNAL MODULE: ../../../node_modules/gl-matrix/esm/index.js + 1 modules
4322
- var esm = __webpack_require__(3823);
5049
+ var gl_matrix_esm = __webpack_require__(3823);
4323
5050
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone3D/EllipticalROI.js
4324
5051
 
4325
5052
 
@@ -4337,8 +5064,36 @@ class EllipticalROI extends BaseAdapter3D {
4337
5064
  defaultState,
4338
5065
  NUMGroup,
4339
5066
  SCOORDGroup,
5067
+ SCOORD3DGroup,
4340
5068
  ReferencedFrameNumber
4341
5069
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, EllipticalROI.toolType);
5070
+ if (SCOORDGroup) {
5071
+ return this.getMeasurementDataFromScoord({
5072
+ defaultState,
5073
+ SCOORDGroup,
5074
+ imageToWorldCoords,
5075
+ metadata,
5076
+ NUMGroup,
5077
+ ReferencedFrameNumber
5078
+ });
5079
+ } else if (SCOORD3DGroup) {
5080
+ return this.getMeasurementDataFromScoord3D({
5081
+ defaultState,
5082
+ SCOORD3DGroup
5083
+ });
5084
+ } else {
5085
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
5086
+ }
5087
+ }
5088
+ static getMeasurementDataFromScoord(_ref) {
5089
+ let {
5090
+ defaultState,
5091
+ SCOORDGroup,
5092
+ imageToWorldCoords,
5093
+ metadata,
5094
+ NUMGroup,
5095
+ ReferencedFrameNumber
5096
+ } = _ref;
4342
5097
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4343
5098
  const {
4344
5099
  GraphicData
@@ -4348,16 +5103,16 @@ class EllipticalROI extends BaseAdapter3D {
4348
5103
  const worldPos = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
4349
5104
  pointsWorld.push(worldPos);
4350
5105
  }
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);
5106
+ const majorAxisStart = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[0]);
5107
+ const majorAxisEnd = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[1]);
5108
+ const minorAxisStart = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[2]);
5109
+ const minorAxisEnd = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[3]);
5110
+ const majorAxisVec = gl_matrix_esm/* vec3.create */.eR.create();
5111
+ gl_matrix_esm/* vec3.sub */.eR.sub(majorAxisVec, majorAxisEnd, majorAxisStart);
5112
+ gl_matrix_esm/* vec3.normalize */.eR.normalize(majorAxisVec, majorAxisVec);
5113
+ const minorAxisVec = gl_matrix_esm/* vec3.create */.eR.create();
5114
+ gl_matrix_esm/* vec3.sub */.eR.sub(minorAxisVec, minorAxisEnd, minorAxisStart);
5115
+ gl_matrix_esm/* vec3.normalize */.eR.normalize(minorAxisVec, minorAxisVec);
4361
5116
  const imagePlaneModule = metadata.get("imagePlaneModule", referencedImageId);
4362
5117
  if (!imagePlaneModule) {
4363
5118
  throw new Error("imageId does not have imagePlaneModule metadata");
@@ -4365,9 +5120,9 @@ class EllipticalROI extends BaseAdapter3D {
4365
5120
  const {
4366
5121
  columnCosines
4367
5122
  } = 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);
5123
+ const columnCosinesVec = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(columnCosines[0], columnCosines[1], columnCosines[2]);
5124
+ const projectedMajorAxisOnColVec = gl_matrix_esm/* vec3.dot */.eR.dot(columnCosinesVec, majorAxisVec);
5125
+ const projectedMinorAxisOnColVec = gl_matrix_esm/* vec3.dot */.eR.dot(columnCosinesVec, minorAxisVec);
4371
5126
  const absoluteOfMajorDotProduct = Math.abs(projectedMajorAxisOnColVec);
4372
5127
  const absoluteOfMinorDotProduct = Math.abs(projectedMinorAxisOnColVec);
4373
5128
  let ellipsePoints = [];
@@ -4396,6 +5151,42 @@ class EllipticalROI extends BaseAdapter3D {
4396
5151
  };
4397
5152
  return state;
4398
5153
  }
5154
+ static getMeasurementDataFromScoord3D(_ref2) {
5155
+ let {
5156
+ defaultState,
5157
+ SCOORD3DGroup
5158
+ } = _ref2;
5159
+ const {
5160
+ GraphicData
5161
+ } = SCOORD3DGroup;
5162
+ const pointsWorld = [];
5163
+ for (let i = 0; i < GraphicData.length; i += 3) {
5164
+ const worldPos = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
5165
+ pointsWorld.push(worldPos);
5166
+ }
5167
+ const majorAxisStart = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[0]);
5168
+ const majorAxisEnd = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[1]);
5169
+ const minorAxisStart = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[2]);
5170
+ const minorAxisEnd = gl_matrix_esm/* vec3.fromValues */.eR.fromValues(...pointsWorld[3]);
5171
+ const majorAxisVec = gl_matrix_esm/* vec3.create */.eR.create();
5172
+ gl_matrix_esm/* vec3.sub */.eR.sub(majorAxisVec, majorAxisEnd, majorAxisStart);
5173
+ gl_matrix_esm/* vec3.normalize */.eR.normalize(majorAxisVec, majorAxisVec);
5174
+ const minorAxisVec = gl_matrix_esm/* vec3.create */.eR.create();
5175
+ gl_matrix_esm/* vec3.sub */.eR.sub(minorAxisVec, minorAxisEnd, minorAxisStart);
5176
+ gl_matrix_esm/* vec3.normalize */.eR.normalize(minorAxisVec, minorAxisVec);
5177
+ const state = defaultState;
5178
+ state.annotation.data = {
5179
+ handles: {
5180
+ points: [majorAxisStart, majorAxisEnd, minorAxisStart, minorAxisEnd],
5181
+ activeHandleIndex: 0,
5182
+ textBox: {
5183
+ hasMoved: false
5184
+ }
5185
+ },
5186
+ cachedStats: {}
5187
+ };
5188
+ return state;
5189
+ }
4399
5190
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
4400
5191
  const {
4401
5192
  data,
@@ -4412,7 +5203,7 @@ class EllipticalROI extends BaseAdapter3D {
4412
5203
  referencedImageId
4413
5204
  } = metadata;
4414
5205
  if (!referencedImageId) {
4415
- throw new Error("EllipticalROI.getTID300RepresentationArguments: referencedImageId is not defined");
5206
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4416
5207
  }
4417
5208
  let top, bottom, left, right;
4418
5209
  if (rotation == 90 || rotation == 270) {
@@ -4472,7 +5263,92 @@ class EllipticalROI extends BaseAdapter3D {
4472
5263
  points,
4473
5264
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4474
5265
  finding,
4475
- findingSites: findingSites || []
5266
+ findingSites: findingSites || [],
5267
+ use3DSpatialCoordinates: false
5268
+ };
5269
+ }
5270
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
5271
+ const {
5272
+ data,
5273
+ finding,
5274
+ findingSites,
5275
+ metadata
5276
+ } = tool;
5277
+ const {
5278
+ cachedStats,
5279
+ handles
5280
+ } = data;
5281
+ const rotation = data.initialRotation || 0;
5282
+ let top, bottom, left, right;
5283
+ if (rotation == 90 || rotation == 270) {
5284
+ bottom = handles.points[2];
5285
+ top = handles.points[3];
5286
+ left = handles.points[0];
5287
+ right = handles.points[1];
5288
+ } else {
5289
+ top = handles.points[0];
5290
+ bottom = handles.points[1];
5291
+ left = handles.points[2];
5292
+ right = handles.points[3];
5293
+ }
5294
+ const topBottomLength = Math.sqrt((top[0] - bottom[0]) ** 2 + (top[1] - bottom[1]) ** 2 + (top[2] - bottom[2]) ** 2);
5295
+ const leftRightLength = Math.sqrt((left[0] - right[0]) ** 2 + (left[1] - right[1]) ** 2 + (left[2] - right[2]) ** 2);
5296
+ const points = [];
5297
+ if (topBottomLength > leftRightLength) {
5298
+ points.push({
5299
+ x: top[0],
5300
+ y: top[1],
5301
+ z: top[2]
5302
+ });
5303
+ points.push({
5304
+ x: bottom[0],
5305
+ y: bottom[1],
5306
+ z: bottom[2]
5307
+ });
5308
+ points.push({
5309
+ x: left[0],
5310
+ y: left[1],
5311
+ z: left[2]
5312
+ });
5313
+ points.push({
5314
+ x: right[0],
5315
+ y: right[1],
5316
+ z: right[2]
5317
+ });
5318
+ } else {
5319
+ points.push({
5320
+ x: left[0],
5321
+ y: left[1],
5322
+ z: left[2]
5323
+ });
5324
+ points.push({
5325
+ x: right[0],
5326
+ y: right[1],
5327
+ z: right[2]
5328
+ });
5329
+ points.push({
5330
+ x: top[0],
5331
+ y: top[1],
5332
+ z: top[2]
5333
+ });
5334
+ points.push({
5335
+ x: bottom[0],
5336
+ y: bottom[1],
5337
+ z: bottom[2]
5338
+ });
5339
+ }
5340
+ const cachedStatsKeys = Object.keys(cachedStats)[0];
5341
+ const {
5342
+ area
5343
+ } = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
5344
+ return {
5345
+ area,
5346
+ points,
5347
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
5348
+ finding,
5349
+ findingSites: findingSites || [],
5350
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
5351
+ use3DSpatialCoordinates: true
4476
5352
  };
4477
5353
  }
4478
5354
  }
@@ -4496,15 +5372,72 @@ class RectangleROI extends BaseAdapter3D {
4496
5372
  defaultState,
4497
5373
  NUMGroup,
4498
5374
  SCOORDGroup,
5375
+ SCOORD3DGroup,
4499
5376
  ReferencedFrameNumber
4500
5377
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, RectangleROI.toolType);
5378
+ if (SCOORDGroup) {
5379
+ return this.getMeasurementDataFromScoord({
5380
+ defaultState,
5381
+ SCOORDGroup,
5382
+ imageToWorldCoords,
5383
+ NUMGroup,
5384
+ ReferencedFrameNumber
5385
+ });
5386
+ } else if (SCOORD3DGroup) {
5387
+ return this.getMeasurementDataFromScoord3D({
5388
+ SCOORD3DGroup,
5389
+ defaultState
5390
+ });
5391
+ } else {
5392
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
5393
+ }
5394
+ }
5395
+ static getMeasurementDataFromScoord(_ref) {
5396
+ let {
5397
+ defaultState,
5398
+ SCOORDGroup,
5399
+ imageToWorldCoords,
5400
+ NUMGroup,
5401
+ ReferencedFrameNumber
5402
+ } = _ref;
4501
5403
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4502
5404
  const {
4503
5405
  GraphicData
4504
5406
  } = SCOORDGroup;
4505
5407
  const worldCoords = [];
4506
- for (let i = 0; i < GraphicData.length; i += 2) {
4507
- const point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
5408
+ for (let i = 0; i < GraphicData.length; i += 2) {
5409
+ const point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
5410
+ worldCoords.push(point);
5411
+ }
5412
+ const state = defaultState;
5413
+ state.annotation.data = {
5414
+ handles: {
5415
+ points: [worldCoords[0], worldCoords[1], worldCoords[3], worldCoords[2]],
5416
+ activeHandleIndex: 0,
5417
+ textBox: {
5418
+ hasMoved: false
5419
+ }
5420
+ },
5421
+ cachedStats: {
5422
+ [`imageId:${referencedImageId}`]: {
5423
+ area: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : null
5424
+ }
5425
+ },
5426
+ frameNumber: ReferencedFrameNumber
5427
+ };
5428
+ return state;
5429
+ }
5430
+ static getMeasurementDataFromScoord3D(_ref2) {
5431
+ let {
5432
+ SCOORD3DGroup,
5433
+ defaultState
5434
+ } = _ref2;
5435
+ const {
5436
+ GraphicData
5437
+ } = SCOORD3DGroup;
5438
+ const worldCoords = [];
5439
+ for (let i = 0; i < GraphicData.length; i += 3) {
5440
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
4508
5441
  worldCoords.push(point);
4509
5442
  }
4510
5443
  const state = defaultState;
@@ -4516,12 +5449,7 @@ class RectangleROI extends BaseAdapter3D {
4516
5449
  hasMoved: false
4517
5450
  }
4518
5451
  },
4519
- cachedStats: {
4520
- [`imageId:${referencedImageId}`]: {
4521
- area: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : null
4522
- }
4523
- },
4524
- frameNumber: ReferencedFrameNumber
5452
+ cachedStats: {}
4525
5453
  };
4526
5454
  return state;
4527
5455
  }
@@ -4540,7 +5468,7 @@ class RectangleROI extends BaseAdapter3D {
4540
5468
  referencedImageId
4541
5469
  } = metadata;
4542
5470
  if (!referencedImageId) {
4543
- throw new Error("CobbAngle.getTID300RepresentationArguments: referencedImageId is not defined");
5471
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4544
5472
  }
4545
5473
  const corners = handles.points.map(point => worldToImageCoords(referencedImageId, point));
4546
5474
  const {
@@ -4553,7 +5481,35 @@ class RectangleROI extends BaseAdapter3D {
4553
5481
  perimeter,
4554
5482
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4555
5483
  finding,
4556
- findingSites: findingSites || []
5484
+ findingSites: findingSites || [],
5485
+ use3DSpatialCoordinates: false
5486
+ };
5487
+ }
5488
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
5489
+ const {
5490
+ data,
5491
+ finding,
5492
+ findingSites,
5493
+ metadata
5494
+ } = tool;
5495
+ const {
5496
+ cachedStats = {},
5497
+ handles
5498
+ } = data;
5499
+ const corners = handles.points;
5500
+ const {
5501
+ area,
5502
+ perimeter
5503
+ } = cachedStats;
5504
+ return {
5505
+ points: [corners[0], corners[1], corners[3], corners[2], corners[0]],
5506
+ area,
5507
+ perimeter,
5508
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
5509
+ finding,
5510
+ findingSites: findingSites || [],
5511
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
5512
+ use3DSpatialCoordinates: true
4557
5513
  };
4558
5514
  }
4559
5515
  }
@@ -4576,13 +5532,14 @@ const {
4576
5532
  } = dcmjs_es/* utilities */.BF.TID300;
4577
5533
  const Length_LENGTH = "Length";
4578
5534
  class Length_Length extends BaseAdapter3D {
4579
- static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
4580
- const {
5535
+ static getMeasurementDataFromScoord(_ref) {
5536
+ let {
4581
5537
  defaultState,
4582
5538
  NUMGroup,
4583
5539
  SCOORDGroup,
4584
- ReferencedFrameNumber
4585
- } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, this.toolType);
5540
+ ReferencedFrameNumber,
5541
+ imageToWorldCoords
5542
+ } = _ref;
4586
5543
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4587
5544
  const {
4588
5545
  GraphicData
@@ -4610,6 +5567,53 @@ class Length_Length extends BaseAdapter3D {
4610
5567
  };
4611
5568
  return state;
4612
5569
  }
5570
+ static getMeasurementDataFromScoord3d(_ref2) {
5571
+ let {
5572
+ defaultState,
5573
+ SCOORD3DGroup
5574
+ } = _ref2;
5575
+ const {
5576
+ GraphicData
5577
+ } = SCOORD3DGroup;
5578
+ const worldCoords = GraphicData;
5579
+ const state = defaultState;
5580
+ state.annotation.data = {
5581
+ handles: {
5582
+ points: [worldCoords.slice(0, 3), worldCoords.slice(3, 6)],
5583
+ activeHandleIndex: 0,
5584
+ textBox: {
5585
+ hasMoved: false
5586
+ }
5587
+ },
5588
+ cachedStats: {}
5589
+ };
5590
+ return state;
5591
+ }
5592
+ static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
5593
+ const {
5594
+ defaultState,
5595
+ NUMGroup,
5596
+ SCOORDGroup,
5597
+ SCOORD3DGroup,
5598
+ ReferencedFrameNumber
5599
+ } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, this.toolType);
5600
+ if (SCOORDGroup) {
5601
+ return this.getMeasurementDataFromScoord({
5602
+ defaultState,
5603
+ NUMGroup,
5604
+ SCOORDGroup,
5605
+ ReferencedFrameNumber,
5606
+ imageToWorldCoords
5607
+ });
5608
+ } else if (SCOORD3DGroup) {
5609
+ return this.getMeasurementDataFromScoord3d({
5610
+ defaultState,
5611
+ SCOORD3DGroup
5612
+ });
5613
+ } else {
5614
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
5615
+ }
5616
+ }
4613
5617
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
4614
5618
  const {
4615
5619
  data,
@@ -4625,7 +5629,7 @@ class Length_Length extends BaseAdapter3D {
4625
5629
  referencedImageId
4626
5630
  } = metadata;
4627
5631
  if (!referencedImageId) {
4628
- throw new Error("Length.getTID300RepresentationArguments: referencedImageId is not defined");
5632
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4629
5633
  }
4630
5634
  const start = worldToImageCoords(referencedImageId, handles.points[0]);
4631
5635
  const end = worldToImageCoords(referencedImageId, handles.points[1]);
@@ -4646,7 +5650,46 @@ class Length_Length extends BaseAdapter3D {
4646
5650
  distance,
4647
5651
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4648
5652
  finding,
4649
- findingSites: findingSites || []
5653
+ findingSites: findingSites || [],
5654
+ use3DSpatialCoordinates: false
5655
+ };
5656
+ }
5657
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
5658
+ const {
5659
+ data,
5660
+ finding,
5661
+ findingSites,
5662
+ metadata
5663
+ } = tool;
5664
+ const {
5665
+ cachedStats = {},
5666
+ handles
5667
+ } = data;
5668
+ const start = handles.points[0];
5669
+ const end = handles.points[1];
5670
+ const point1 = {
5671
+ x: start[0],
5672
+ y: start[1],
5673
+ z: start[2]
5674
+ };
5675
+ const point2 = {
5676
+ x: end[0],
5677
+ y: end[1],
5678
+ z: end[2]
5679
+ };
5680
+ const cachedStatsKeys = Object.keys(cachedStats)[0];
5681
+ const {
5682
+ length: distance
5683
+ } = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
5684
+ return {
5685
+ point1,
5686
+ point2,
5687
+ distance,
5688
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
5689
+ finding,
5690
+ findingSites: findingSites || [],
5691
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
5692
+ use3DSpatialCoordinates: true
4650
5693
  };
4651
5694
  }
4652
5695
  }
@@ -4674,8 +5717,34 @@ class PlanarFreehandROI extends BaseAdapter3D {
4674
5717
  defaultState,
4675
5718
  NUMGroup,
4676
5719
  SCOORDGroup,
5720
+ SCOORD3DGroup,
4677
5721
  ReferencedFrameNumber
4678
5722
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, PlanarFreehandROI.toolType);
5723
+ if (SCOORDGroup) {
5724
+ return this.getMeasurementDataFromScoord({
5725
+ defaultState,
5726
+ SCOORDGroup,
5727
+ imageToWorldCoords,
5728
+ NUMGroup,
5729
+ ReferencedFrameNumber
5730
+ });
5731
+ } else if (SCOORD3DGroup) {
5732
+ return this.getMeasurementDataFromScoord3D({
5733
+ defaultState,
5734
+ SCOORD3DGroup
5735
+ });
5736
+ } else {
5737
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
5738
+ }
5739
+ }
5740
+ static getMeasurementDataFromScoord(_ref) {
5741
+ let {
5742
+ defaultState,
5743
+ SCOORDGroup,
5744
+ imageToWorldCoords,
5745
+ NUMGroup,
5746
+ ReferencedFrameNumber
5747
+ } = _ref;
4679
5748
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4680
5749
  const {
4681
5750
  GraphicData
@@ -4685,7 +5754,7 @@ class PlanarFreehandROI extends BaseAdapter3D {
4685
5754
  const point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
4686
5755
  worldCoords.push(point);
4687
5756
  }
4688
- const distanceBetweenFirstAndLastPoint = esm/* vec3.distance */.eR.distance(worldCoords[worldCoords.length - 1], worldCoords[0]);
5757
+ const distanceBetweenFirstAndLastPoint = gl_matrix_esm/* vec3.distance */.eR.distance(worldCoords[worldCoords.length - 1], worldCoords[0]);
4689
5758
  let isOpenContour = true;
4690
5759
  if (distanceBetweenFirstAndLastPoint < this.closedContourThreshold) {
4691
5760
  worldCoords.pop();
@@ -4717,6 +5786,46 @@ class PlanarFreehandROI extends BaseAdapter3D {
4717
5786
  };
4718
5787
  return state;
4719
5788
  }
5789
+ static getMeasurementDataFromScoord3D(_ref2) {
5790
+ let {
5791
+ defaultState,
5792
+ SCOORD3DGroup
5793
+ } = _ref2;
5794
+ const {
5795
+ GraphicData
5796
+ } = SCOORD3DGroup;
5797
+ const worldCoords = [];
5798
+ for (let i = 0; i < GraphicData.length; i += 3) {
5799
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
5800
+ worldCoords.push(point);
5801
+ }
5802
+ const distanceBetweenFirstAndLastPoint = gl_matrix_esm/* vec3.distance */.eR.distance(worldCoords[worldCoords.length - 1], worldCoords[0]);
5803
+ let isOpenContour = true;
5804
+ if (distanceBetweenFirstAndLastPoint < this.closedContourThreshold) {
5805
+ worldCoords.pop();
5806
+ isOpenContour = false;
5807
+ }
5808
+ const points = [];
5809
+ if (isOpenContour) {
5810
+ points.push(worldCoords[0], worldCoords[worldCoords.length - 1]);
5811
+ }
5812
+ const state = defaultState;
5813
+ state.annotation.data = {
5814
+ contour: {
5815
+ polyline: worldCoords,
5816
+ closed: !isOpenContour
5817
+ },
5818
+ handles: {
5819
+ points,
5820
+ activeHandleIndex: null,
5821
+ textBox: {
5822
+ hasMoved: false
5823
+ }
5824
+ },
5825
+ cachedStats: {}
5826
+ };
5827
+ return state;
5828
+ }
4720
5829
  static getTID300RepresentationArguments(tool, worldToImageCoords) {
4721
5830
  const {
4722
5831
  data,
@@ -4733,7 +5842,7 @@ class PlanarFreehandROI extends BaseAdapter3D {
4733
5842
  referencedImageId
4734
5843
  } = metadata;
4735
5844
  if (!referencedImageId) {
4736
- throw new Error("PlanarFreehandROI.getTID300RepresentationArguments: referencedImageId is not defined");
5845
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
4737
5846
  }
4738
5847
  const points = polyline.map(worldPos => worldToImageCoords(referencedImageId, worldPos));
4739
5848
  if (!isOpenContour) {
@@ -4760,7 +5869,51 @@ class PlanarFreehandROI extends BaseAdapter3D {
4760
5869
  stdDev,
4761
5870
  trackingIdentifierTextValue: this.trackingIdentifierTextValue,
4762
5871
  finding,
4763
- findingSites: findingSites || []
5872
+ findingSites: findingSites || [],
5873
+ use3DSpatialCoordinates: false
5874
+ };
5875
+ }
5876
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
5877
+ const {
5878
+ data,
5879
+ finding,
5880
+ findingSites,
5881
+ metadata
5882
+ } = tool;
5883
+ const {
5884
+ polyline,
5885
+ closed
5886
+ } = data.contour;
5887
+ const isOpenContour = closed !== true;
5888
+ const points = polyline;
5889
+ if (!isOpenContour) {
5890
+ const firstPoint = points[0];
5891
+ points.push([firstPoint[0], firstPoint[1], firstPoint[2]]);
5892
+ }
5893
+ const cachedStatsKeys = Object.keys(data.cachedStats)[0];
5894
+ const {
5895
+ area,
5896
+ areaUnit,
5897
+ modalityUnit,
5898
+ perimeter,
5899
+ mean,
5900
+ max,
5901
+ stdDev
5902
+ } = cachedStatsKeys ? data.cachedStats[cachedStatsKeys] : {};
5903
+ return {
5904
+ points,
5905
+ area,
5906
+ areaUnit,
5907
+ perimeter,
5908
+ modalityUnit,
5909
+ mean,
5910
+ max,
5911
+ stdDev,
5912
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
5913
+ finding,
5914
+ findingSites: findingSites || [],
5915
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
5916
+ use3DSpatialCoordinates: true
4764
5917
  };
4765
5918
  }
4766
5919
  }
@@ -4784,8 +5937,32 @@ class Probe extends BaseAdapter3D {
4784
5937
  const state = super.getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata, trackingIdentifier);
4785
5938
  const {
4786
5939
  defaultState,
4787
- SCOORDGroup
5940
+ SCOORDGroup,
5941
+ SCOORD3DGroup
4788
5942
  } = MeasurementReport_MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, Probe.toolType);
5943
+ if (SCOORDGroup) {
5944
+ return this.getMeasurementDataFromScoord({
5945
+ state,
5946
+ defaultState,
5947
+ SCOORDGroup,
5948
+ imageToWorldCoords
5949
+ });
5950
+ } else if (SCOORD3DGroup) {
5951
+ return this.getMeasurementDataFromScoord3D({
5952
+ state,
5953
+ SCOORD3DGroup
5954
+ });
5955
+ } else {
5956
+ throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
5957
+ }
5958
+ }
5959
+ static getMeasurementDataFromScoord(_ref) {
5960
+ let {
5961
+ state,
5962
+ defaultState,
5963
+ SCOORDGroup,
5964
+ imageToWorldCoords
5965
+ } = _ref;
4789
5966
  const referencedImageId = defaultState.annotation.metadata.referencedImageId;
4790
5967
  const {
4791
5968
  GraphicData
@@ -4807,6 +5984,93 @@ class Probe extends BaseAdapter3D {
4807
5984
  };
4808
5985
  return state;
4809
5986
  }
5987
+ static getMeasurementDataFromScoord3D(_ref2) {
5988
+ let {
5989
+ state,
5990
+ SCOORD3DGroup
5991
+ } = _ref2;
5992
+ const {
5993
+ GraphicData
5994
+ } = SCOORD3DGroup;
5995
+ const worldCoords = [];
5996
+ for (let i = 0; i < GraphicData.length; i += 3) {
5997
+ const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
5998
+ worldCoords.push(point);
5999
+ }
6000
+ state.annotation.data = {
6001
+ ...state.annotation.data,
6002
+ handles: {
6003
+ points: worldCoords,
6004
+ activeHandleIndex: null,
6005
+ textBox: {
6006
+ hasMoved: false
6007
+ }
6008
+ }
6009
+ };
6010
+ return state;
6011
+ }
6012
+ static getTID300RepresentationArguments(tool, worldToImageCoords) {
6013
+ const {
6014
+ data,
6015
+ metadata
6016
+ } = tool;
6017
+ const {
6018
+ finding,
6019
+ findingSites
6020
+ } = tool;
6021
+ const {
6022
+ referencedImageId
6023
+ } = metadata;
6024
+ if (!referencedImageId) {
6025
+ return this.getTID300RepresentationArgumentsSCOORD3D(tool);
6026
+ }
6027
+ const {
6028
+ handles: {
6029
+ points = []
6030
+ }
6031
+ } = data;
6032
+ const pointsImage = points.map(point => {
6033
+ const pointImage = worldToImageCoords(referencedImageId, point);
6034
+ return {
6035
+ x: pointImage[0],
6036
+ y: pointImage[1]
6037
+ };
6038
+ });
6039
+ return {
6040
+ points: pointsImage,
6041
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
6042
+ findingSites: findingSites || [],
6043
+ finding,
6044
+ use3DSpatialCoordinates: false
6045
+ };
6046
+ }
6047
+ static getTID300RepresentationArgumentsSCOORD3D(tool) {
6048
+ const {
6049
+ data,
6050
+ finding,
6051
+ findingSites,
6052
+ metadata
6053
+ } = tool;
6054
+ const {
6055
+ handles: {
6056
+ points = []
6057
+ }
6058
+ } = data;
6059
+ const point = points[0];
6060
+ const pointXYZ = {
6061
+ x: point[0],
6062
+ y: point[1],
6063
+ z: point[2]
6064
+ };
6065
+ return {
6066
+ points: [pointXYZ],
6067
+ trackingIdentifierTextValue: this.trackingIdentifierTextValue,
6068
+ ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
6069
+ findingSites: findingSites || [],
6070
+ finding,
6071
+ use3DSpatialCoordinates: true
6072
+ };
6073
+ }
4810
6074
  }
4811
6075
  _Probe = Probe;
4812
6076
  (() => {
@@ -4972,10 +6236,8 @@ function generateLabelMaps2DFrom3D(labelmap3D) {
4972
6236
 
4973
6237
 
4974
6238
 
4975
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 1 modules
4976
- var dist_esm = __webpack_require__(15327);
4977
6239
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/index.js
4978
- var tools_dist_esm = __webpack_require__(4667);
6240
+ var dist_esm = __webpack_require__(4667);
4979
6241
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/adapters/Cornerstone3D/Segmentation/compactMergeSegData.js
4980
6242
  const checkHasOverlapping = _ref => {
4981
6243
  let {
@@ -5166,7 +6428,7 @@ async function createLabelmapsFromBufferInternal(referencedImageIds, arrayBuffer
5166
6428
  const referenceImageId = referencedImageIds[i];
5167
6429
  imageIdMaps.indices[referenceImageId] = i;
5168
6430
  imageIdMaps.metadata[referenceImageId] = metadataProvider.get("instance", referenceImageId);
5169
- const labelMapImage = dist_esm.imageLoader.createAndCacheDerivedLabelmapImage(referenceImageId);
6431
+ const labelMapImage = esm.imageLoader.createAndCacheDerivedLabelmapImage(referenceImageId);
5170
6432
  labelMapImages.push(labelMapImage);
5171
6433
  }
5172
6434
  const segmentsPixelIndices = new Map();
@@ -5200,8 +6462,8 @@ async function createLabelmapsFromBufferInternal(referencedImageIds, arrayBuffer
5200
6462
  overlappingSegments: hasOverlappingSegments
5201
6463
  };
5202
6464
  }
5203
- const throttledTriggerLoadProgressEvent = tools_dist_esm.utilities.throttle(percentComplete => {
5204
- (0,dist_esm.triggerEvent)(dist_esm.eventTarget, Events.SEGMENTATION_LOAD_PROGRESS, {
6465
+ const throttledTriggerLoadProgressEvent = dist_esm.utilities.throttle(percentComplete => {
6466
+ (0,esm.triggerEvent)(esm.eventTarget, Events.SEGMENTATION_LOAD_PROGRESS, {
5205
6467
  percentComplete
5206
6468
  });
5207
6469
  }, 200);
@@ -5360,7 +6622,7 @@ const getArrayOfLabelMapImagesWithSegmentData = _ref7 => {
5360
6622
  return arrayOfSegmentData.map(arr => {
5361
6623
  const labelMapImages = referencedImageIds.map((referencedImageId, i) => {
5362
6624
  const hasEmptySegmentData = !arr[i];
5363
- const labelMapImage = dist_esm.imageLoader.createAndCacheDerivedLabelmapImage(referencedImageId);
6625
+ const labelMapImage = esm.imageLoader.createAndCacheDerivedLabelmapImage(referencedImageId);
5364
6626
  const pixelData = labelMapImage.getPixelData();
5365
6627
  if (!hasEmptySegmentData) {
5366
6628
  for (let j = 0; j < pixelData.length; j++) {
@@ -5739,7 +7001,7 @@ function getStructureSetModule(contour, index) {
5739
7001
  const {
5740
7002
  generateContourSetsFromLabelmap,
5741
7003
  AnnotationToPointData
5742
- } = tools_dist_esm.utilities.contours;
7004
+ } = dist_esm.utilities.contours;
5743
7005
  const {
5744
7006
  DicomMetaDictionary: RTSS_DicomMetaDictionary
5745
7007
  } = dcmjs_es/* default.data */.Ay.data;
@@ -5915,7 +7177,7 @@ function _initializeDataset(rtMetadata, imgMetadata, metadataProvider) {
5915
7177
 
5916
7178
  const {
5917
7179
  generateContourSetsFromLabelmap: RTStruct_generateContourSetsFromLabelmap
5918
- } = tools_dist_esm.utilities.contours;
7180
+ } = dist_esm.utilities.contours;
5919
7181
 
5920
7182
 
5921
7183
 
@@ -6288,6 +7550,7 @@ function downloadDICOMData(bufferOrDataset, filename) {
6288
7550
 
6289
7551
 
6290
7552
 
7553
+
6291
7554
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/adapters/dist/esm/index.js
6292
7555
 
6293
7556
 
@@ -6296,6 +7559,7 @@ function downloadDICOMData(bufferOrDataset, filename) {
6296
7559
 
6297
7560
 
6298
7561
 
7562
+
6299
7563
  /***/ }),
6300
7564
 
6301
7565
  /***/ 75183: