@ohif/app 3.12.0-beta.67 → 3.12.0-beta.69

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 (40) hide show
  1. package/dist/{1447.bundle.40045129a43f8dd9c901.js → 1447.bundle.0e8117bd9e72c339bd04.js} +2 -2
  2. package/dist/{2518.bundle.57c229a14e22d23db384.js → 2518.bundle.bdbd870da5355fdf502a.js} +8 -3
  3. package/dist/{319.bundle.fc959064ddf2f6978b54.js → 319.bundle.cd9383a345b9da2ba840.js} +1 -1
  4. package/dist/{3409.bundle.ded798747ea65b47c72c.js → 3409.bundle.2d77e2bddb2a19e798ed.js} +14 -1
  5. package/dist/{9819.bundle.29fb49e6d25cf486a204.js → 3613.bundle.14721af2527117f720b0.js} +492 -17
  6. package/dist/{4019.bundle.13e7f662a9e489b74a27.js → 4019.bundle.acd0f85d0467cb10d86a.js} +14 -7
  7. package/dist/{4113.bundle.d57b077bf8b22a2fffe6.js → 4113.bundle.cdb5aabbb16c44b3937d.js} +7 -11
  8. package/dist/{2345.bundle.c17b90bde0073fd7dbb6.js → 5400.bundle.eb0f5866140b5db31518.js} +5 -61
  9. package/dist/{7412.bundle.9ff692981e3c3af1dfaf.js → 7412.bundle.a8aa0b243b2a05031789.js} +660 -417
  10. package/dist/{8558.bundle.81679f1abf949872a8d7.js → 8558.bundle.29e3ea8a442b8a40e89d.js} +1 -1
  11. package/dist/{9856.bundle.4d469a7b62ac0c005da2.js → 9856.bundle.31827ec7e09a8978744c.js} +77 -10
  12. package/dist/{9892.bundle.34f911ad728a17a0ad60.js → 9892.bundle.7a23896727af274e8c43.js} +154 -457
  13. package/dist/{app.bundle.5e500cc3ae1ec8449424.js → app.bundle.fb405f7159a5d06049af.js} +28 -26
  14. package/dist/{compute.bundle.bf2d925bfc81c7f05c06.js → compute.bundle.5d0df54f99d2a555a02a.js} +3 -3
  15. package/dist/index.html +1 -1
  16. package/dist/{polySeg.bundle.1d99496fc36c90c48d48.js → polySeg.bundle.eb47d9d9105dcfbb56fc.js} +3 -3
  17. package/dist/sw.js +1 -1
  18. package/package.json +21 -21
  19. /package/dist/{1459.bundle.a3c4154b8f8a929875f6.js → 1459.bundle.6d1fa1c8fdbb81f0f359.js} +0 -0
  20. /package/dist/{147.bundle.5081555db809adebded5.js → 147.bundle.23cc8fbbd94c0b65d337.js} +0 -0
  21. /package/dist/{1604.bundle.54c4d82c28d03adab00b.js → 1604.bundle.47f2f0635a91795b3c49.js} +0 -0
  22. /package/dist/{1807.bundle.92de522ae4def176aff6.js → 1807.bundle.68fc01f6cad9998763ea.js} +0 -0
  23. /package/dist/{1919.bundle.b709d24082a089fb96f9.js → 1919.bundle.1931c96cc842a6098baa.js} +0 -0
  24. /package/dist/{213.bundle.06da551965e6495eaf22.js → 213.bundle.f9c868b449c1a68b6f35.js} +0 -0
  25. /package/dist/{2243.bundle.49e31757e1b67c1631af.js → 2243.bundle.2e464ef173f36231cf06.js} +0 -0
  26. /package/dist/{2424.bundle.b84347c7c65b70298931.js → 2424.bundle.a9eecc0e2aeb8699f135.js} +0 -0
  27. /package/dist/{414.bundle.62d7f459bd4c3888de2a.js → 414.bundle.46f922eb0a1911124a73.js} +0 -0
  28. /package/dist/{5457.bundle.74835d952cd31adf54df.js → 5457.bundle.ee43997565093fa2caec.js} +0 -0
  29. /package/dist/{5485.bundle.7b59b0105c66003eb8c5.js → 5485.bundle.a15a2f530189848c31ee.js} +0 -0
  30. /package/dist/{6027.bundle.39d04080242ce96ac848.js → 6027.bundle.8971d7d4eec7b0b4cfb7.js} +0 -0
  31. /package/dist/{6201.bundle.568aac152c31949d09a4.js → 6201.bundle.cc73f3d377cacd418cb0.js} +0 -0
  32. /package/dist/{6991.bundle.a0f689bfa5ad3f3ee4a8.js → 6991.bundle.77f5d56a53a04f524bc3.js} +0 -0
  33. /package/dist/{7197.bundle.c0d2f4d7071f1d49223f.js → 7197.bundle.364e03cf01a6b56217f9.js} +0 -0
  34. /package/dist/{7431.bundle.859d7586ac7a86c27fb8.js → 7431.bundle.6dee1ec831da974a7433.js} +0 -0
  35. /package/dist/{7639.bundle.3bae54d7c31bb87eb68e.js → 7639.bundle.e6024d8f644419db89ff.js} +0 -0
  36. /package/dist/{810.bundle.536730c2c4702996ce35.js → 810.bundle.0806263ecf7902133c17.js} +0 -0
  37. /package/dist/{85.bundle.1848a6604cfd55f08b91.js → 85.bundle.de54be0dcfcc960c45a0.js} +0 -0
  38. /package/dist/{8815.bundle.c6b394394ee3e5dda949.js → 8815.bundle.4fe4069d6c0a8d9b95cb.js} +0 -0
  39. /package/dist/{934.bundle.3cbbd88355500a623dcb.js → 934.bundle.5aef917dada6d51ac96b.js} +0 -0
  40. /package/dist/{9862.bundle.30916d7d975475c609a1.js → 9862.bundle.dc627e5f01fc4698a00f.js} +0 -0
@@ -1,4 +1,4 @@
1
- (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[9819],{
1
+ (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[3613],{
2
2
 
3
3
  /***/ 86871:
4
4
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
@@ -19456,6 +19456,7 @@ class ImageVolume {
19456
19456
  dimensions,
19457
19457
  imageIds,
19458
19458
  numberOfComponents,
19459
+ id: volumeId,
19459
19460
  });
19460
19461
  this.numVoxels =
19461
19462
  this.dimensions[0] * this.dimensions[1] * this.dimensions[2];
@@ -34390,7 +34391,7 @@ function uuidv4() {
34390
34391
 
34391
34392
  "use strict";
34392
34393
  /* unused harmony export version */
34393
- const version = '4.5.5';
34394
+ const version = '4.5.19';
34394
34395
 
34395
34396
 
34396
34397
  /***/ }),
@@ -36291,9 +36292,10 @@ const defaultFrameOfReferenceSpecificAnnotationManager = new FrameOfReferenceSpe
36291
36292
  "use strict";
36292
36293
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
36293
36294
  /* harmony export */ checkAndSetAnnotationLocked: () => (/* binding */ checkAndSetAnnotationLocked),
36294
- /* harmony export */ isAnnotationLocked: () => (/* binding */ isAnnotationLocked)
36295
+ /* harmony export */ isAnnotationLocked: () => (/* binding */ isAnnotationLocked),
36296
+ /* harmony export */ setAnnotationLocked: () => (/* binding */ setAnnotationLocked)
36295
36297
  /* harmony export */ });
36296
- /* unused harmony exports setAnnotationLocked, getAnnotationsLocked, getAnnotationsLockedCount, unlockAllAnnotations */
36298
+ /* unused harmony exports getAnnotationsLocked, getAnnotationsLockedCount, unlockAllAnnotations */
36297
36299
  /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
36298
36300
  /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99737);
36299
36301
  /* harmony import */ var _annotationState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(82056);
@@ -37376,28 +37378,278 @@ function getSurfaceRepresentationUID(segmentationId, segmentIndex) {
37376
37378
 
37377
37379
  /***/ }),
37378
37380
 
37379
- /***/ 98484:
37381
+ /***/ 64540:
37380
37382
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37381
37383
 
37382
37384
  "use strict";
37383
- /* unused harmony export getAnnotationsUIDMapFromSegmentation */
37384
- /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33283);
37385
+ /* unused harmony export default */
37386
+ /* harmony import */ var _utilities_contours__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6936);
37387
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(82056);
37388
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33283);
37389
+ /* harmony import */ var _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(96629);
37390
+
37391
+
37385
37392
 
37386
- function getAnnotationsUIDMapFromSegmentation(segmentationId) {
37393
+
37394
+ function convertContourHoles(segmentationId, segmentIndex, targetSegmentationId, targetSegmentationIndex) {
37387
37395
  const segmentation = getSegmentation(segmentationId);
37388
37396
  if (!segmentation) {
37397
+ console.warn(`Invalid segmentation given ${segmentationId}`);
37389
37398
  return;
37390
37399
  }
37391
- const contourRepresentationData = segmentation.representationData
37392
- ?.Contour;
37393
- if (!contourRepresentationData) {
37400
+ if (!segmentation.representationData.Contour) {
37401
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
37402
+ return;
37403
+ }
37404
+ const { annotationUIDsMap } = segmentation?.representationData.Contour || {};
37405
+ if (!annotationUIDsMap) {
37406
+ console.warn(`No annotation map found for segmentation ${segmentationId}`);
37407
+ return;
37408
+ }
37409
+ const annotationsUIDsSet = annotationUIDsMap?.get(segmentIndex);
37410
+ if (!annotationsUIDsSet) {
37411
+ console.warn(`Segmentation index ${segmentIndex} has no annotations in segmentation ${segmentationId}`);
37412
+ return;
37413
+ }
37414
+ let targetUIDsSet;
37415
+ if (targetSegmentationId && typeof targetSegmentationIndex === 'number') {
37416
+ const targetSegmentation = getSegmentation(targetSegmentationId);
37417
+ if (!targetSegmentation) {
37418
+ console.warn(`Target segmentation ${targetSegmentationId} does not exist.`);
37419
+ return;
37420
+ }
37421
+ if (!targetSegmentation.representationData.Contour) {
37422
+ console.warn(`No contour representation found for target segmentation ${targetSegmentationId}`);
37423
+ return;
37424
+ }
37425
+ targetUIDsSet =
37426
+ targetSegmentation.representationData.Contour.annotationUIDsMap.get(targetSegmentationIndex);
37427
+ if (!targetUIDsSet) {
37428
+ targetUIDsSet = new Set();
37429
+ targetSegmentation.representationData.Contour.annotationUIDsMap.set(targetSegmentationIndex, targetUIDsSet);
37430
+ }
37431
+ }
37432
+ const polylinesCanvasMap = extractSegmentPolylines(segmentationId, segmentIndex);
37433
+ if (!polylinesCanvasMap) {
37434
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
37435
+ return;
37436
+ }
37437
+ const keys = Array.from(polylinesCanvasMap?.keys());
37438
+ const polylines = keys.map((key) => polylinesCanvasMap.get(key));
37439
+ const holeDetectionResults = findContourHoles(polylines);
37440
+ if (holeDetectionResults?.length > 0) {
37441
+ holeDetectionResults.forEach((hole) => {
37442
+ hole.holeIndexes.forEach((index) => {
37443
+ const annotation = getAnnotation(keys[index]);
37444
+ clearParentAnnotation(annotation);
37445
+ if (targetSegmentationId &&
37446
+ typeof targetSegmentationIndex === 'number') {
37447
+ targetUIDsSet.add(annotation.annotationUID);
37448
+ }
37449
+ else {
37450
+ annotationsUIDsSet.add(annotation.annotationUID);
37451
+ }
37452
+ });
37453
+ });
37454
+ }
37455
+ }
37456
+
37457
+
37458
+ /***/ }),
37459
+
37460
+ /***/ 53097:
37461
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37462
+
37463
+ "use strict";
37464
+ /* unused harmony export default */
37465
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82056);
37466
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33283);
37467
+ /* harmony import */ var _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(96629);
37468
+ /* harmony import */ var _utilities_math_polyline_decimate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99944);
37469
+ /* harmony import */ var _getViewportAssociatedToSegmentation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16493);
37470
+
37471
+
37472
+
37473
+
37474
+
37475
+ function decimateContours(segmentationId, segmentIndex, options = { epsilon: 0.1 }) {
37476
+ const segmentation = getSegmentation(segmentationId);
37477
+ if (!segmentation) {
37478
+ console.warn(`Invalid segmentation given ${segmentationId}`);
37479
+ return;
37480
+ }
37481
+ if (!segmentation.representationData.Contour) {
37482
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
37483
+ return;
37484
+ }
37485
+ const viewports = getViewportsAssociatedToSegmentation(segmentationId);
37486
+ if (!viewports) {
37487
+ console.warn('No viewport associated to the segmentation found');
37488
+ return;
37489
+ }
37490
+ const polylinesCanvasMap = extractSegmentPolylines(segmentationId, segmentIndex);
37491
+ if (!polylinesCanvasMap) {
37492
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
37493
+ return;
37494
+ }
37495
+ const keys = Array.from(polylinesCanvasMap?.keys());
37496
+ for (const annotationUID of keys) {
37497
+ const annotation = getAnnotation(annotationUID);
37498
+ if (!annotation) {
37499
+ continue;
37500
+ }
37501
+ const polylineCanvas = polylinesCanvasMap.get(annotationUID);
37502
+ const decimatedPolyline2D = decimate(polylineCanvas, options.epsilon);
37503
+ const viewport = getViewportWithMatchingViewPlaneNormal(viewports, annotation);
37504
+ if (viewport) {
37505
+ annotation.data.contour.polyline = decimatedPolyline2D.map((point2D) => viewport.canvasToWorld(point2D));
37506
+ invalidateAnnotation(annotation);
37507
+ }
37508
+ }
37509
+ }
37510
+
37511
+
37512
+ /***/ }),
37513
+
37514
+ /***/ 96629:
37515
+ /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
37516
+
37517
+ "use strict";
37518
+
37519
+ // UNUSED EXPORTS: extractSegmentPolylines
37520
+
37521
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getSegmentation.js
37522
+ var segmentation_getSegmentation = __webpack_require__(33283);
37523
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contourSegmentation/index.js + 1 modules
37524
+ var contourSegmentation = __webpack_require__(56534);
37525
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/getViewportAssociatedToSegmentation.js
37526
+ var getViewportAssociatedToSegmentation = __webpack_require__(16493);
37527
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/getAnnotationMapFromSegmentation.js
37528
+ var utilities_getAnnotationMapFromSegmentation = __webpack_require__(10407);
37529
+ ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/getPolylineMap.js
37530
+
37531
+ function closePolyline(polyline, closed) {
37532
+ if (!polyline || polyline.length === 0) {
37533
+ return [];
37534
+ }
37535
+ if (!closed) {
37536
+ return [...polyline];
37537
+ }
37538
+ const firstPoint = polyline[0];
37539
+ const lastPoint = polyline[polyline.length - 1];
37540
+ const isAlreadyClosed = firstPoint[0] === lastPoint[0] &&
37541
+ firstPoint[1] === lastPoint[1] &&
37542
+ firstPoint[2] === lastPoint[2];
37543
+ if (isAlreadyClosed) {
37544
+ return [...polyline];
37545
+ }
37546
+ return [...polyline, firstPoint];
37547
+ }
37548
+ function getPolylineMap_getPolylinesMap(contourRepresentationData, segmentIndex) {
37549
+ const { annotationUIDsInSegmentMap } = getAnnotationMapFromSegmentation(contourRepresentationData);
37550
+ if (!annotationUIDsInSegmentMap.has(segmentIndex)) {
37551
+ console.warn(`No contour information found for segmentIndex ${segmentIndex}`);
37552
+ return;
37553
+ }
37554
+ const polylines = new Map();
37555
+ const annotationsInfo = annotationUIDsInSegmentMap.get(segmentIndex);
37556
+ for (const annotationInfo of annotationsInfo) {
37557
+ polylines.set(annotationInfo.annotationUID, closePolyline(annotationInfo.polyline, annotationInfo.isClosed));
37558
+ for (let i = 0; i < annotationInfo.holesUIDs?.length; i++) {
37559
+ polylines.set(annotationInfo.holesUIDs[i], closePolyline(annotationInfo.holesPolyline[i], annotationInfo.holesClosed[i]));
37560
+ }
37561
+ }
37562
+ return polylines;
37563
+ }
37564
+
37565
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/annotation/annotationState.js
37566
+ var annotationState = __webpack_require__(82056);
37567
+ ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/extractSegmentPolylines.js
37568
+
37569
+
37570
+
37571
+
37572
+
37573
+ function extractSegmentPolylines(segmentationId, segmentIndex) {
37574
+ const viewports = getViewportsAssociatedToSegmentation(segmentationId);
37575
+ const segmentation = getSegmentation(segmentationId);
37576
+ if (!segmentation) {
37394
37577
  return;
37395
37578
  }
37579
+ if (!segmentation.representationData.Contour) {
37580
+ return;
37581
+ }
37582
+ const contourRepresentationData = segmentation.representationData
37583
+ .Contour;
37396
37584
  const { annotationUIDsMap } = contourRepresentationData;
37397
37585
  if (!annotationUIDsMap) {
37398
37586
  return;
37399
37587
  }
37400
- return annotationUIDsMap;
37588
+ if (!annotationUIDsMap.get(segmentIndex)) {
37589
+ return;
37590
+ }
37591
+ const polyLinesMap = getPolylinesMap(contourRepresentationData, segmentIndex);
37592
+ if (!polyLinesMap) {
37593
+ return;
37594
+ }
37595
+ const keys = Array.from(polyLinesMap?.keys());
37596
+ const polylinesCanvasMap = new Map();
37597
+ for (const key of keys) {
37598
+ const annotation = getAnnotation(key);
37599
+ const viewport = getViewportWithMatchingViewPlaneNormal(viewports, annotation);
37600
+ polylinesCanvasMap.set(key, convertContourPolylineToCanvasSpace(polyLinesMap.get(key), viewport));
37601
+ }
37602
+ return polylinesCanvasMap;
37603
+ }
37604
+
37605
+
37606
+ /***/ }),
37607
+
37608
+ /***/ 10407:
37609
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37610
+
37611
+ "use strict";
37612
+ /* unused harmony export getAnnotationMapFromSegmentation */
37613
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82056);
37614
+
37615
+ function getAnnotationMapFromSegmentation(contourRepresentationData, options = {}) {
37616
+ const annotationMap = contourRepresentationData.annotationUIDsMap;
37617
+ const segmentIndices = options.segmentIndices?.length
37618
+ ? options.segmentIndices
37619
+ : Array.from(annotationMap.keys());
37620
+ const annotationUIDsInSegmentMap = new Map();
37621
+ segmentIndices.forEach((index) => {
37622
+ const annotationUIDsInSegment = annotationMap.get(index);
37623
+ let uids = Array.from(annotationUIDsInSegment);
37624
+ uids = uids.filter((uid) => !getAnnotation(uid).parentAnnotationUID);
37625
+ const annotations = uids.map((uid) => {
37626
+ const annotation = getAnnotation(uid);
37627
+ const hasChildAnnotations = annotation.childAnnotationUIDs?.length;
37628
+ const childPolylinesInformation = hasChildAnnotations &&
37629
+ annotation.childAnnotationUIDs.map((childUID) => {
37630
+ const childAnnotation = getAnnotation(childUID);
37631
+ return {
37632
+ polyline: childAnnotation.data.contour.polyline,
37633
+ isClosed: childAnnotation.data.contour.closed,
37634
+ };
37635
+ });
37636
+ const holesClosed = hasChildAnnotations &&
37637
+ childPolylinesInformation.map((childInfo) => childInfo.isClosed);
37638
+ const childPolylines = hasChildAnnotations &&
37639
+ childPolylinesInformation.map((childInfo) => childInfo.polyline);
37640
+ return {
37641
+ polyline: annotation.data.contour.polyline,
37642
+ isClosed: annotation.data.contour.closed,
37643
+ annotationUID: annotation.annotationUID,
37644
+ referencedImageId: annotation.metadata.referencedImageId,
37645
+ holesPolyline: childPolylines,
37646
+ holesUIDs: annotation.childAnnotationUIDs,
37647
+ holesClosed,
37648
+ };
37649
+ });
37650
+ annotationUIDsInSegmentMap.set(index, annotations);
37651
+ });
37652
+ return { segmentIndices, annotationUIDsInSegmentMap };
37401
37653
  }
37402
37654
 
37403
37655
 
@@ -37455,6 +37707,169 @@ function getViewportWithMatchingViewPlaneNormal(viewports, annotation, dotThresh
37455
37707
  }
37456
37708
 
37457
37709
 
37710
+ /***/ }),
37711
+
37712
+ /***/ 38928:
37713
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37714
+
37715
+ "use strict";
37716
+ /* unused harmony export removeCompleteContourAnnotation */
37717
+ /* harmony import */ var _utilities_contourSegmentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(56534);
37718
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(82056);
37719
+
37720
+
37721
+ function removeCompleteContourAnnotation(annotation) {
37722
+ if (!annotation) {
37723
+ return;
37724
+ }
37725
+ if (annotation.parentAnnotationUID) {
37726
+ clearParentAnnotation(annotation);
37727
+ }
37728
+ removeAnnotation(annotation.annotationUID);
37729
+ removeContourSegmentationAnnotation(annotation);
37730
+ }
37731
+
37732
+
37733
+ /***/ }),
37734
+
37735
+ /***/ 19741:
37736
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37737
+
37738
+ "use strict";
37739
+ /* unused harmony export default */
37740
+ /* harmony import */ var _utilities_contours__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6936);
37741
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(82056);
37742
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33283);
37743
+ /* harmony import */ var _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(96629);
37744
+ /* harmony import */ var _removeCompleteContourAnnotation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(38928);
37745
+
37746
+
37747
+
37748
+
37749
+
37750
+ function removeContourHoles(segmentationId, segmentIndex) {
37751
+ const segmentation = getSegmentation(segmentationId);
37752
+ if (!segmentation) {
37753
+ console.warn(`Invalid segmentation given ${segmentationId}`);
37754
+ return;
37755
+ }
37756
+ if (!segmentation.representationData.Contour) {
37757
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
37758
+ return;
37759
+ }
37760
+ const polylinesCanvasMap = extractSegmentPolylines(segmentationId, segmentIndex);
37761
+ if (!polylinesCanvasMap) {
37762
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
37763
+ return;
37764
+ }
37765
+ const keys = Array.from(polylinesCanvasMap?.keys());
37766
+ const polylines = keys.map((key) => polylinesCanvasMap.get(key));
37767
+ const holeDetectionResults = findContourHoles(polylines);
37768
+ if (holeDetectionResults?.length > 0) {
37769
+ holeDetectionResults.forEach((hole) => {
37770
+ hole.holeIndexes.forEach((index) => {
37771
+ const annotation = getAnnotation(keys[index]);
37772
+ removeCompleteContourAnnotation(annotation);
37773
+ });
37774
+ });
37775
+ }
37776
+ }
37777
+
37778
+
37779
+ /***/ }),
37780
+
37781
+ /***/ 85512:
37782
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37783
+
37784
+ "use strict";
37785
+ /* unused harmony export default */
37786
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82056);
37787
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33283);
37788
+ /* harmony import */ var _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(96629);
37789
+ /* harmony import */ var _utilities_contours_findIslands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(76617);
37790
+ /* harmony import */ var _removeCompleteContourAnnotation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(38928);
37791
+
37792
+
37793
+
37794
+
37795
+
37796
+ function removeContourIslands(segmentationId, segmentIndex, options = { threshold: 3 }) {
37797
+ const segmentation = getSegmentation(segmentationId);
37798
+ if (!segmentation) {
37799
+ console.warn(`Invalid segmentation given ${segmentationId}`);
37800
+ return;
37801
+ }
37802
+ if (!segmentation.representationData.Contour) {
37803
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
37804
+ return;
37805
+ }
37806
+ const polylinesCanvasMap = extractSegmentPolylines(segmentationId, segmentIndex);
37807
+ if (!polylinesCanvasMap) {
37808
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
37809
+ return;
37810
+ }
37811
+ const keys = Array.from(polylinesCanvasMap?.keys());
37812
+ const polylines = keys.map((key) => polylinesCanvasMap.get(key));
37813
+ const islands = findIslands(polylines, options.threshold);
37814
+ if (islands?.length > 0) {
37815
+ islands.forEach((index) => {
37816
+ const annotation = getAnnotation(keys[index]);
37817
+ removeCompleteContourAnnotation(annotation);
37818
+ });
37819
+ }
37820
+ }
37821
+
37822
+
37823
+ /***/ }),
37824
+
37825
+ /***/ 68362:
37826
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37827
+
37828
+ "use strict";
37829
+ /* unused harmony export default */
37830
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82056);
37831
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33283);
37832
+ /* harmony import */ var _utilities_planarFreehandROITool_interpolation_interpolateSegmentPoints__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(61768);
37833
+
37834
+
37835
+
37836
+ function smoothContours(segmentationId, segmentIndex, options = { knotsRatioPercentage: 30 }) {
37837
+ const segmentation = getSegmentation(segmentationId);
37838
+ if (!segmentation) {
37839
+ console.warn(`Invalid segmentation given ${segmentationId}`);
37840
+ return;
37841
+ }
37842
+ if (!segmentation.representationData.Contour) {
37843
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
37844
+ return;
37845
+ }
37846
+ const contourRepresentationData = segmentation.representationData
37847
+ .Contour;
37848
+ const { annotationUIDsMap } = contourRepresentationData;
37849
+ if (!annotationUIDsMap) {
37850
+ console.warn(`No contours found for segmentation ${segmentationId}`);
37851
+ return;
37852
+ }
37853
+ if (!annotationUIDsMap.has(segmentIndex)) {
37854
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
37855
+ return;
37856
+ }
37857
+ const annotationList = annotationUIDsMap.get(segmentIndex);
37858
+ annotationList.forEach((annotationUID) => {
37859
+ const annotation = getAnnotation(annotationUID);
37860
+ if (!annotation) {
37861
+ return;
37862
+ }
37863
+ const polyline = annotation.data.contour.polyline;
37864
+ if (!polyline || polyline.length < 3) {
37865
+ return;
37866
+ }
37867
+ const smoothedPolyline = interpolateSegmentPoints(polyline, 0, polyline.length - 1, options.knotsRatioPercentage);
37868
+ annotation.data.contour.polyline = smoothedPolyline;
37869
+ });
37870
+ }
37871
+
37872
+
37458
37873
  /***/ }),
37459
37874
 
37460
37875
  /***/ 77609:
@@ -39847,7 +40262,9 @@ var ContourWindingDirection;
39847
40262
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
39848
40263
  /* harmony export */ V: () => (/* binding */ addContourSegmentationAnnotation)
39849
40264
  /* harmony export */ });
39850
- /* harmony import */ var _stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33283);
40265
+ /* harmony import */ var _stateManagement_annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2076);
40266
+ /* harmony import */ var _stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33283);
40267
+
39851
40268
 
39852
40269
  function addContourSegmentationAnnotation(annotation) {
39853
40270
  if (annotation.parentAnnotationUID) {
@@ -39857,7 +40274,7 @@ function addContourSegmentationAnnotation(annotation) {
39857
40274
  throw new Error('addContourSegmentationAnnotation: annotation does not have a segmentation data');
39858
40275
  }
39859
40276
  const { segmentationId, segmentIndex } = annotation.data.segmentation;
39860
- const segmentation = (0,_stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_0__/* .getSegmentation */ .T)(segmentationId);
40277
+ const segmentation = (0,_stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_1__/* .getSegmentation */ .T)(segmentationId);
39861
40278
  if (!segmentation.representationData.Contour) {
39862
40279
  segmentation.representationData.Contour = { annotationUIDsMap: new Map() };
39863
40280
  }
@@ -39870,6 +40287,9 @@ function addContourSegmentationAnnotation(annotation) {
39870
40287
  annotationsUIDsSet = new Set();
39871
40288
  annotationUIDsMap.set(segmentIndex, annotationsUIDsSet);
39872
40289
  }
40290
+ if (segmentation.segments[segmentIndex].locked) {
40291
+ (0,_stateManagement_annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_0__.setAnnotationLocked)(annotation.annotationUID, true);
40292
+ }
39873
40293
  annotationUIDsMap.set(segmentIndex, annotationsUIDsSet.add(annotation.annotationUID));
39874
40294
  }
39875
40295
 
@@ -41181,18 +41601,20 @@ function cleanupPolylines(polylines) {
41181
41601
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
41182
41602
  /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
41183
41603
  /* harmony export */ });
41604
+ /* unused harmony export calculatePerimeter */
41605
+ /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3823);
41606
+
41184
41607
  function calculatePerimeter(polyline, closed) {
41185
41608
  let perimeter = 0;
41186
41609
  for (let i = 0; i < polyline.length - 1; i++) {
41187
41610
  const point1 = polyline[i];
41188
41611
  const point2 = polyline[i + 1];
41189
- perimeter += Math.sqrt(Math.pow(point2[0] - point1[0], 2) + Math.pow(point2[1] - point1[1], 2));
41612
+ perimeter += gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dist */ .eR.dist(point1, point2);
41190
41613
  }
41191
41614
  if (closed) {
41192
41615
  const firstPoint = polyline[0];
41193
41616
  const lastPoint = polyline[polyline.length - 1];
41194
- perimeter += Math.sqrt(Math.pow(lastPoint[0] - firstPoint[0], 2) +
41195
- Math.pow(lastPoint[1] - firstPoint[1], 2));
41617
+ perimeter += gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dist */ .eR.dist(firstPoint, lastPoint);
41196
41618
  }
41197
41619
  return perimeter;
41198
41620
  }
@@ -42119,6 +42541,59 @@ function normalizeViewportPlane(viewport, boundsIJK) {
42119
42541
  }
42120
42542
 
42121
42543
 
42544
+ /***/ }),
42545
+
42546
+ /***/ 61768:
42547
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
42548
+
42549
+ "use strict";
42550
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
42551
+ /* harmony export */ A: () => (/* binding */ interpolateSegmentPoints)
42552
+ /* harmony export */ });
42553
+ /* harmony import */ var _algorithms_bspline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(30269);
42554
+
42555
+ function getContinuousUniformDistributionValues(minDistributionDistance, closedInterval) {
42556
+ const result = [];
42557
+ const [intervalIni, intervalEnd] = closedInterval;
42558
+ const intervalSize = intervalEnd - intervalIni + 1;
42559
+ const intensity = Math.floor(intervalSize / minDistributionDistance);
42560
+ let x = 0;
42561
+ let continuosDistributionValue = Math.round(((intervalSize - 1) / (intensity - 1)) * x) + intervalIni;
42562
+ while (continuosDistributionValue <= intervalEnd) {
42563
+ result.push(continuosDistributionValue);
42564
+ x++;
42565
+ continuosDistributionValue =
42566
+ Math.round(((intervalSize - 1) / (intensity - 1)) * x) + intervalIni;
42567
+ }
42568
+ return result;
42569
+ }
42570
+ function interpolateSegmentPoints(points, iniIndex, endIndex, knotsRatioPercentage) {
42571
+ const segmentSize = endIndex - iniIndex + 1;
42572
+ const amountOfKnots = Math.floor((knotsRatioPercentage / 100) * segmentSize) ?? 1;
42573
+ const minKnotDistance = Math.floor(segmentSize / amountOfKnots) ?? 1;
42574
+ if (isNaN(segmentSize) || !segmentSize || !minKnotDistance) {
42575
+ return points;
42576
+ }
42577
+ if (segmentSize / minKnotDistance < 2) {
42578
+ return points;
42579
+ }
42580
+ const interpolationIniIndex = Math.max(0, iniIndex);
42581
+ const interpolationEndIndex = Math.min(points.length - 1, endIndex);
42582
+ const segmentPointsUnchangedBeg = points.slice(0, interpolationIniIndex);
42583
+ const segmentPointsUnchangedEnd = points.slice(interpolationEndIndex + 1, points.length);
42584
+ const knotsIndexes = getContinuousUniformDistributionValues(minKnotDistance, [
42585
+ interpolationIniIndex,
42586
+ interpolationEndIndex,
42587
+ ]);
42588
+ const interpolatedPoints = (0,_algorithms_bspline__WEBPACK_IMPORTED_MODULE_0__/* .interpolatePoints */ .H)(points, knotsIndexes);
42589
+ return [
42590
+ ...segmentPointsUnchangedBeg,
42591
+ ...interpolatedPoints,
42592
+ ...segmentPointsUnchangedEnd,
42593
+ ];
42594
+ }
42595
+
42596
+
42122
42597
  /***/ }),
42123
42598
 
42124
42599
  /***/ 37162:
@@ -2022,6 +2022,12 @@ class AnnotationTool extends _AnnotationDisplayTool__WEBPACK_IMPORTED_MODULE_2__
2022
2022
  createMemo(element, annotation, options) {
2023
2023
  this.memo ||= AnnotationTool.createAnnotationMemo(element, annotation, options);
2024
2024
  }
2025
+ startGroupRecording() {
2026
+ DefaultHistoryMemo.startGroupRecording();
2027
+ }
2028
+ endGroupRecording() {
2029
+ DefaultHistoryMemo.endGroupRecording();
2030
+ }
2025
2031
  static hydrateBase(ToolClass, enabledElement, points, options = {}) {
2026
2032
  if (!enabledElement) {
2027
2033
  return null;
@@ -5124,19 +5130,20 @@ function filterAnnotationsWithinSlice(annotations, camera, spacingInNormalDirect
5124
5130
  const { focalPoint } = camera;
5125
5131
  const annotationsWithinSlice = [];
5126
5132
  for (const annotation of annotationsWithParallelNormals) {
5127
- const data = annotation.data;
5128
- const point = data.handles.points[0] || data.contour?.polyline[0];
5129
- if (!annotation.isVisible) {
5133
+ const { data, metadata, isVisible } = annotation;
5134
+ if (!isVisible) {
5130
5135
  continue;
5131
5136
  }
5132
- const dir = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create();
5137
+ const point = metadata.planeRestriction?.point ||
5138
+ data.handles.points[0] ||
5139
+ data.contour?.polyline[0];
5133
5140
  if (!point) {
5134
5141
  annotationsWithinSlice.push(annotation);
5135
5142
  continue;
5136
5143
  }
5137
- gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.sub */ .eR.sub(dir, focalPoint, point);
5138
- const dot = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dot */ .eR.dot(dir, viewPlaneNormal);
5139
- if (Math.abs(dot) < halfSpacingInNormalDirection) {
5144
+ const dir = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.sub */ .eR.sub(gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.create */ .eR.create(), focalPoint, point);
5145
+ const dot = Math.abs(gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dot */ .eR.dot(dir, viewPlaneNormal));
5146
+ if (dot < halfSpacingInNormalDirection) {
5140
5147
  annotationsWithinSlice.push(annotation);
5141
5148
  }
5142
5149
  }