@ohif/app 3.12.0-beta.66 → 3.12.0-beta.68

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 (41) hide show
  1. package/dist/{1447.bundle.4ce931c66306039c9524.js → 1447.bundle.42a201eb7cfb535dbb27.js} +2 -2
  2. package/dist/{2518.bundle.57c229a14e22d23db384.js → 2518.bundle.80f6f53d5a171288d177.js} +6 -1
  3. package/dist/{319.bundle.fc959064ddf2f6978b54.js → 319.bundle.cd9383a345b9da2ba840.js} +1 -1
  4. package/dist/{3409.bundle.c4ddac8992b11938c3ea.js → 3409.bundle.fc5d04563e48e2d9509c.js} +14 -1
  5. package/dist/{9819.bundle.29fb49e6d25cf486a204.js → 3613.bundle.f54ec42efcfa4f83656c.js} +486 -14
  6. package/dist/{4019.bundle.13e7f662a9e489b74a27.js → 4019.bundle.2f21e5bc490fc3b743a8.js} +6 -0
  7. package/dist/{2345.bundle.c17b90bde0073fd7dbb6.js → 5400.bundle.c287bffc0f21bc857c12.js} +1 -53
  8. package/dist/{7412.bundle.9ff692981e3c3af1dfaf.js → 7412.bundle.930910a9ad29b9d44d34.js} +619 -412
  9. package/dist/{8558.bundle.71585fbe755dc6671a38.js → 8558.bundle.465dd596983d518dc10c.js} +1 -1
  10. package/dist/{9856.bundle.4d469a7b62ac0c005da2.js → 9856.bundle.31827ec7e09a8978744c.js} +77 -10
  11. package/dist/{9892.bundle.34f911ad728a17a0ad60.js → 9892.bundle.36238ff727cb3bba26e4.js} +114 -447
  12. package/dist/app-config.js +1 -0
  13. package/dist/{app.bundle.e92aded4c4ed8eab4829.js → app.bundle.0d5d24cd2914cba3684d.js} +43 -36
  14. package/dist/{compute.bundle.bf2d925bfc81c7f05c06.js → compute.bundle.a63e807a357d03539511.js} +3 -3
  15. package/dist/index.html +1 -1
  16. package/dist/{polySeg.bundle.1d99496fc36c90c48d48.js → polySeg.bundle.75dd3439f4989f634f98.js} +3 -3
  17. package/dist/sw.js +1 -1
  18. package/package.json +21 -21
  19. /package/dist/{1459.bundle.151334804558a830126e.js → 1459.bundle.95bf19211e4a0cc6eb85.js} +0 -0
  20. /package/dist/{147.bundle.5081555db809adebded5.js → 147.bundle.23cc8fbbd94c0b65d337.js} +0 -0
  21. /package/dist/{1604.bundle.28a7f3bd0455a20138e0.js → 1604.bundle.d8d092c4b7f0752f1795.js} +0 -0
  22. /package/dist/{1807.bundle.32d45e525e6ba61c2fed.js → 1807.bundle.4b36d85142830705cc73.js} +0 -0
  23. /package/dist/{1919.bundle.9757dfaa834727c2ffe8.js → 1919.bundle.58198149cd016af5c240.js} +0 -0
  24. /package/dist/{213.bundle.502c54b95cbe29ad6a4d.js → 213.bundle.ed0a3b64ad066e7fe2aa.js} +0 -0
  25. /package/dist/{2243.bundle.6f5c7a659fdbcc52764b.js → 2243.bundle.1b13d9c823fa58c47dd2.js} +0 -0
  26. /package/dist/{2424.bundle.a45ee00e643d99899066.js → 2424.bundle.7a57d8210c8644e83d61.js} +0 -0
  27. /package/dist/{4113.bundle.2f98cfa79a248f4217f1.js → 4113.bundle.4a27d08881e8e8726cdc.js} +0 -0
  28. /package/dist/{414.bundle.6c1bcb8dfb6b6e8b10ab.js → 414.bundle.647df2f6e756c8adf1bc.js} +0 -0
  29. /package/dist/{5457.bundle.bfdda34afb3a37e8168c.js → 5457.bundle.650c3a9b81d8d3fafaee.js} +0 -0
  30. /package/dist/{5485.bundle.ee1ed302fe626aabbdbd.js → 5485.bundle.dff6dd53d1d533b0d00f.js} +0 -0
  31. /package/dist/{6027.bundle.0d355f640c71df4d9462.js → 6027.bundle.9ba3ec82debbfbd24227.js} +0 -0
  32. /package/dist/{6201.bundle.664aed05fc0a692abb0e.js → 6201.bundle.1268f4b25e533d6e5752.js} +0 -0
  33. /package/dist/{6991.bundle.6aa430921a2e1e4a0ba7.js → 6991.bundle.fa5072b6f1712784344f.js} +0 -0
  34. /package/dist/{7197.bundle.75050a366be6f61a4653.js → 7197.bundle.d3f79fce26514955231c.js} +0 -0
  35. /package/dist/{7431.bundle.859d7586ac7a86c27fb8.js → 7431.bundle.6dee1ec831da974a7433.js} +0 -0
  36. /package/dist/{7639.bundle.707e0e08ff5addb18e64.js → 7639.bundle.47232f936255859feba8.js} +0 -0
  37. /package/dist/{810.bundle.6fd7ed5646659037bbb7.js → 810.bundle.41459c511a763f328524.js} +0 -0
  38. /package/dist/{85.bundle.b55d825da24528eae306.js → 85.bundle.284a0d47f14a7969112c.js} +0 -0
  39. /package/dist/{8815.bundle.5c64dc7489f5f2be757f.js → 8815.bundle.eb855e3a55f5bcd0ede4.js} +0 -0
  40. /package/dist/{934.bundle.79029fd2086a238eadfd.js → 934.bundle.90f33b73332a588bafa8.js} +0 -0
  41. /package/dist/{9862.bundle.30916d7d975475c609a1.js → 9862.bundle.dc627e5f01fc4698a00f.js} +0 -0
@@ -10394,8 +10394,8 @@ function AboutModalDefault() {
10394
10394
  name
10395
10395
  } = (0,browser_detect_es5/* default */.A)();
10396
10396
  const browser = `${name[0].toUpperCase()}${name.substr(1)} ${version}`;
10397
- const versionNumber = "3.12.0-beta.66";
10398
- const commitHash = "42aa2df62622ab380f97025819bd929fa0579e14";
10397
+ const versionNumber = "3.12.0-beta.68";
10398
+ const commitHash = "170e860aa1b786ab6056cf31076804302a2bc462";
10399
10399
  const [main, beta] = versionNumber.split('-');
10400
10400
  return /*#__PURE__*/react.createElement(ui_next_src/* AboutModal */.VTU, {
10401
10401
  className: "w-[400px]"
@@ -5655,6 +5655,7 @@ function labelmapImagesFromBuffer_insertPixelDataPlanar(_ref4) {
5655
5655
  const imageIdIndex = imageIdMaps.indices[imageId];
5656
5656
  const labelmapImage = labelMapImages[imageIdIndex];
5657
5657
  const labelmap2DView = labelmapImage.getPixelData();
5658
+ const imageVoxelManager = labelmapImage.voxelManager;
5658
5659
  const data = alignedPixelDataI.data;
5659
5660
  const indexCache = [];
5660
5661
  for (let k = 0, len = alignedPixelDataI.data.length; k < len; ++k) {
@@ -5677,7 +5678,11 @@ function labelmapImagesFromBuffer_insertPixelDataPlanar(_ref4) {
5677
5678
  imageIdMaps
5678
5679
  }));
5679
5680
  }
5680
- labelmap2DView[x] = segmentIndex;
5681
+ if (imageVoxelManager) {
5682
+ imageVoxelManager.setAtIndex(x, segmentIndex);
5683
+ } else {
5684
+ labelmap2DView[x] = segmentIndex;
5685
+ }
5681
5686
  indexCache.push(x);
5682
5687
  }
5683
5688
  }
@@ -2214,7 +2214,7 @@ class CircleSculptCursor {
2214
2214
  /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
2215
2215
  /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85817);
2216
2216
  /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(99737);
2217
- /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(83673);
2217
+ /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(55126);
2218
2218
  /* harmony import */ var _stateManagement_segmentation_triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(49906);
2219
2219
  /* harmony import */ var _utilities_segmentation_growCut_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(10564);
2220
2220
  /* harmony import */ var _utilities_segmentation_getSVGStyleForSegment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(86644);
@@ -10346,10 +10346,23 @@ function commandsModule({
10346
10346
  if (displaySet.Modality === 'SEG' || displaySet.Modality === 'RTSTRUCT') {
10347
10347
  const referencedDisplaySet = displaySetService.getDisplaySetByUID(referencedDisplaySetInstanceUID);
10348
10348
  storePositionPresentation(referencedDisplaySet);
10349
- return commandsManager.runCommand('loadSegmentationDisplaySetsForViewport', {
10349
+ const results = commandsManager.runCommand('loadSegmentationDisplaySetsForViewport', {
10350
10350
  viewportId,
10351
10351
  displaySetInstanceUIDs: [referencedDisplaySet.displaySetInstanceUID]
10352
10352
  });
10353
+ const disableEditing = customizationService.getCustomization('panelSegmentation.disableEditing');
10354
+ if (disableEditing) {
10355
+ const segmentationRepresentations = segmentationService.getSegmentationRepresentations(viewportId, {
10356
+ segmentationId: displaySet.displaySetInstanceUID
10357
+ });
10358
+ segmentationRepresentations.forEach(representation => {
10359
+ const segmentIndices = Object.keys(representation.segments);
10360
+ segmentIndices.forEach(segmentIndex => {
10361
+ segmentationService.setSegmentLocked(representation.segmentationId, parseInt(segmentIndex), true);
10362
+ });
10363
+ });
10364
+ }
10365
+ return results;
10353
10366
  } else if (displaySet.Modality === 'SR') {
10354
10367
  const results = commandsManager.runCommand('hydrateStructuredReport', {
10355
10368
  displaySetInstanceUID: displaySet.displaySetInstanceUID
@@ -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__) => {
@@ -34390,7 +34390,7 @@ function uuidv4() {
34390
34390
 
34391
34391
  "use strict";
34392
34392
  /* unused harmony export version */
34393
- const version = '4.5.5';
34393
+ const version = '4.5.13';
34394
34394
 
34395
34395
 
34396
34396
  /***/ }),
@@ -36291,9 +36291,10 @@ const defaultFrameOfReferenceSpecificAnnotationManager = new FrameOfReferenceSpe
36291
36291
  "use strict";
36292
36292
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
36293
36293
  /* harmony export */ checkAndSetAnnotationLocked: () => (/* binding */ checkAndSetAnnotationLocked),
36294
- /* harmony export */ isAnnotationLocked: () => (/* binding */ isAnnotationLocked)
36294
+ /* harmony export */ isAnnotationLocked: () => (/* binding */ isAnnotationLocked),
36295
+ /* harmony export */ setAnnotationLocked: () => (/* binding */ setAnnotationLocked)
36295
36296
  /* harmony export */ });
36296
- /* unused harmony exports setAnnotationLocked, getAnnotationsLocked, getAnnotationsLockedCount, unlockAllAnnotations */
36297
+ /* unused harmony exports getAnnotationsLocked, getAnnotationsLockedCount, unlockAllAnnotations */
36297
36298
  /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
36298
36299
  /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99737);
36299
36300
  /* harmony import */ var _annotationState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(82056);
@@ -37376,28 +37377,278 @@ function getSurfaceRepresentationUID(segmentationId, segmentIndex) {
37376
37377
 
37377
37378
  /***/ }),
37378
37379
 
37379
- /***/ 98484:
37380
+ /***/ 64540:
37380
37381
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37381
37382
 
37382
37383
  "use strict";
37383
- /* unused harmony export getAnnotationsUIDMapFromSegmentation */
37384
- /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33283);
37384
+ /* unused harmony export default */
37385
+ /* harmony import */ var _utilities_contours__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6936);
37386
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(82056);
37387
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33283);
37388
+ /* harmony import */ var _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(96629);
37389
+
37390
+
37385
37391
 
37386
- function getAnnotationsUIDMapFromSegmentation(segmentationId) {
37392
+
37393
+ function convertContourHoles(segmentationId, segmentIndex, targetSegmentationId, targetSegmentationIndex) {
37387
37394
  const segmentation = getSegmentation(segmentationId);
37388
37395
  if (!segmentation) {
37396
+ console.warn(`Invalid segmentation given ${segmentationId}`);
37389
37397
  return;
37390
37398
  }
37391
- const contourRepresentationData = segmentation.representationData
37392
- ?.Contour;
37393
- if (!contourRepresentationData) {
37399
+ if (!segmentation.representationData.Contour) {
37400
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
37401
+ return;
37402
+ }
37403
+ const { annotationUIDsMap } = segmentation?.representationData.Contour || {};
37404
+ if (!annotationUIDsMap) {
37405
+ console.warn(`No annotation map found for segmentation ${segmentationId}`);
37406
+ return;
37407
+ }
37408
+ const annotationsUIDsSet = annotationUIDsMap?.get(segmentIndex);
37409
+ if (!annotationsUIDsSet) {
37410
+ console.warn(`Segmentation index ${segmentIndex} has no annotations in segmentation ${segmentationId}`);
37411
+ return;
37412
+ }
37413
+ let targetUIDsSet;
37414
+ if (targetSegmentationId && typeof targetSegmentationIndex === 'number') {
37415
+ const targetSegmentation = getSegmentation(targetSegmentationId);
37416
+ if (!targetSegmentation) {
37417
+ console.warn(`Target segmentation ${targetSegmentationId} does not exist.`);
37418
+ return;
37419
+ }
37420
+ if (!targetSegmentation.representationData.Contour) {
37421
+ console.warn(`No contour representation found for target segmentation ${targetSegmentationId}`);
37422
+ return;
37423
+ }
37424
+ targetUIDsSet =
37425
+ targetSegmentation.representationData.Contour.annotationUIDsMap.get(targetSegmentationIndex);
37426
+ if (!targetUIDsSet) {
37427
+ targetUIDsSet = new Set();
37428
+ targetSegmentation.representationData.Contour.annotationUIDsMap.set(targetSegmentationIndex, targetUIDsSet);
37429
+ }
37430
+ }
37431
+ const polylinesCanvasMap = extractSegmentPolylines(segmentationId, segmentIndex);
37432
+ if (!polylinesCanvasMap) {
37433
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
37434
+ return;
37435
+ }
37436
+ const keys = Array.from(polylinesCanvasMap?.keys());
37437
+ const polylines = keys.map((key) => polylinesCanvasMap.get(key));
37438
+ const holeDetectionResults = findContourHoles(polylines);
37439
+ if (holeDetectionResults?.length > 0) {
37440
+ holeDetectionResults.forEach((hole) => {
37441
+ hole.holeIndexes.forEach((index) => {
37442
+ const annotation = getAnnotation(keys[index]);
37443
+ clearParentAnnotation(annotation);
37444
+ if (targetSegmentationId &&
37445
+ typeof targetSegmentationIndex === 'number') {
37446
+ targetUIDsSet.add(annotation.annotationUID);
37447
+ }
37448
+ else {
37449
+ annotationsUIDsSet.add(annotation.annotationUID);
37450
+ }
37451
+ });
37452
+ });
37453
+ }
37454
+ }
37455
+
37456
+
37457
+ /***/ }),
37458
+
37459
+ /***/ 53097:
37460
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37461
+
37462
+ "use strict";
37463
+ /* unused harmony export default */
37464
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82056);
37465
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33283);
37466
+ /* harmony import */ var _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(96629);
37467
+ /* harmony import */ var _utilities_math_polyline_decimate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99944);
37468
+ /* harmony import */ var _getViewportAssociatedToSegmentation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16493);
37469
+
37470
+
37471
+
37472
+
37473
+
37474
+ function decimateContours(segmentationId, segmentIndex, options = { epsilon: 0.1 }) {
37475
+ const segmentation = getSegmentation(segmentationId);
37476
+ if (!segmentation) {
37477
+ console.warn(`Invalid segmentation given ${segmentationId}`);
37394
37478
  return;
37395
37479
  }
37480
+ if (!segmentation.representationData.Contour) {
37481
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
37482
+ return;
37483
+ }
37484
+ const viewports = getViewportsAssociatedToSegmentation(segmentationId);
37485
+ if (!viewports) {
37486
+ console.warn('No viewport associated to the segmentation found');
37487
+ return;
37488
+ }
37489
+ const polylinesCanvasMap = extractSegmentPolylines(segmentationId, segmentIndex);
37490
+ if (!polylinesCanvasMap) {
37491
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
37492
+ return;
37493
+ }
37494
+ const keys = Array.from(polylinesCanvasMap?.keys());
37495
+ for (const annotationUID of keys) {
37496
+ const annotation = getAnnotation(annotationUID);
37497
+ if (!annotation) {
37498
+ continue;
37499
+ }
37500
+ const polylineCanvas = polylinesCanvasMap.get(annotationUID);
37501
+ const decimatedPolyline2D = decimate(polylineCanvas, options.epsilon);
37502
+ const viewport = getViewportWithMatchingViewPlaneNormal(viewports, annotation);
37503
+ if (viewport) {
37504
+ annotation.data.contour.polyline = decimatedPolyline2D.map((point2D) => viewport.canvasToWorld(point2D));
37505
+ invalidateAnnotation(annotation);
37506
+ }
37507
+ }
37508
+ }
37509
+
37510
+
37511
+ /***/ }),
37512
+
37513
+ /***/ 96629:
37514
+ /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
37515
+
37516
+ "use strict";
37517
+
37518
+ // UNUSED EXPORTS: extractSegmentPolylines
37519
+
37520
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getSegmentation.js
37521
+ var segmentation_getSegmentation = __webpack_require__(33283);
37522
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contourSegmentation/index.js + 1 modules
37523
+ var contourSegmentation = __webpack_require__(56534);
37524
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/getViewportAssociatedToSegmentation.js
37525
+ var getViewportAssociatedToSegmentation = __webpack_require__(16493);
37526
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/getAnnotationMapFromSegmentation.js
37527
+ var utilities_getAnnotationMapFromSegmentation = __webpack_require__(10407);
37528
+ ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/getPolylineMap.js
37529
+
37530
+ function closePolyline(polyline, closed) {
37531
+ if (!polyline || polyline.length === 0) {
37532
+ return [];
37533
+ }
37534
+ if (!closed) {
37535
+ return [...polyline];
37536
+ }
37537
+ const firstPoint = polyline[0];
37538
+ const lastPoint = polyline[polyline.length - 1];
37539
+ const isAlreadyClosed = firstPoint[0] === lastPoint[0] &&
37540
+ firstPoint[1] === lastPoint[1] &&
37541
+ firstPoint[2] === lastPoint[2];
37542
+ if (isAlreadyClosed) {
37543
+ return [...polyline];
37544
+ }
37545
+ return [...polyline, firstPoint];
37546
+ }
37547
+ function getPolylineMap_getPolylinesMap(contourRepresentationData, segmentIndex) {
37548
+ const { annotationUIDsInSegmentMap } = getAnnotationMapFromSegmentation(contourRepresentationData);
37549
+ if (!annotationUIDsInSegmentMap.has(segmentIndex)) {
37550
+ console.warn(`No contour information found for segmentIndex ${segmentIndex}`);
37551
+ return;
37552
+ }
37553
+ const polylines = new Map();
37554
+ const annotationsInfo = annotationUIDsInSegmentMap.get(segmentIndex);
37555
+ for (const annotationInfo of annotationsInfo) {
37556
+ polylines.set(annotationInfo.annotationUID, closePolyline(annotationInfo.polyline, annotationInfo.isClosed));
37557
+ for (let i = 0; i < annotationInfo.holesUIDs?.length; i++) {
37558
+ polylines.set(annotationInfo.holesUIDs[i], closePolyline(annotationInfo.holesPolyline[i], annotationInfo.holesClosed[i]));
37559
+ }
37560
+ }
37561
+ return polylines;
37562
+ }
37563
+
37564
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/annotation/annotationState.js
37565
+ var annotationState = __webpack_require__(82056);
37566
+ ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/extractSegmentPolylines.js
37567
+
37568
+
37569
+
37570
+
37571
+
37572
+ function extractSegmentPolylines(segmentationId, segmentIndex) {
37573
+ const viewports = getViewportsAssociatedToSegmentation(segmentationId);
37574
+ const segmentation = getSegmentation(segmentationId);
37575
+ if (!segmentation) {
37576
+ return;
37577
+ }
37578
+ if (!segmentation.representationData.Contour) {
37579
+ return;
37580
+ }
37581
+ const contourRepresentationData = segmentation.representationData
37582
+ .Contour;
37396
37583
  const { annotationUIDsMap } = contourRepresentationData;
37397
37584
  if (!annotationUIDsMap) {
37398
37585
  return;
37399
37586
  }
37400
- return annotationUIDsMap;
37587
+ if (!annotationUIDsMap.get(segmentIndex)) {
37588
+ return;
37589
+ }
37590
+ const polyLinesMap = getPolylinesMap(contourRepresentationData, segmentIndex);
37591
+ if (!polyLinesMap) {
37592
+ return;
37593
+ }
37594
+ const keys = Array.from(polyLinesMap?.keys());
37595
+ const polylinesCanvasMap = new Map();
37596
+ for (const key of keys) {
37597
+ const annotation = getAnnotation(key);
37598
+ const viewport = getViewportWithMatchingViewPlaneNormal(viewports, annotation);
37599
+ polylinesCanvasMap.set(key, convertContourPolylineToCanvasSpace(polyLinesMap.get(key), viewport));
37600
+ }
37601
+ return polylinesCanvasMap;
37602
+ }
37603
+
37604
+
37605
+ /***/ }),
37606
+
37607
+ /***/ 10407:
37608
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37609
+
37610
+ "use strict";
37611
+ /* unused harmony export getAnnotationMapFromSegmentation */
37612
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82056);
37613
+
37614
+ function getAnnotationMapFromSegmentation(contourRepresentationData, options = {}) {
37615
+ const annotationMap = contourRepresentationData.annotationUIDsMap;
37616
+ const segmentIndices = options.segmentIndices?.length
37617
+ ? options.segmentIndices
37618
+ : Array.from(annotationMap.keys());
37619
+ const annotationUIDsInSegmentMap = new Map();
37620
+ segmentIndices.forEach((index) => {
37621
+ const annotationUIDsInSegment = annotationMap.get(index);
37622
+ let uids = Array.from(annotationUIDsInSegment);
37623
+ uids = uids.filter((uid) => !getAnnotation(uid).parentAnnotationUID);
37624
+ const annotations = uids.map((uid) => {
37625
+ const annotation = getAnnotation(uid);
37626
+ const hasChildAnnotations = annotation.childAnnotationUIDs?.length;
37627
+ const childPolylinesInformation = hasChildAnnotations &&
37628
+ annotation.childAnnotationUIDs.map((childUID) => {
37629
+ const childAnnotation = getAnnotation(childUID);
37630
+ return {
37631
+ polyline: childAnnotation.data.contour.polyline,
37632
+ isClosed: childAnnotation.data.contour.closed,
37633
+ };
37634
+ });
37635
+ const holesClosed = hasChildAnnotations &&
37636
+ childPolylinesInformation.map((childInfo) => childInfo.isClosed);
37637
+ const childPolylines = hasChildAnnotations &&
37638
+ childPolylinesInformation.map((childInfo) => childInfo.polyline);
37639
+ return {
37640
+ polyline: annotation.data.contour.polyline,
37641
+ isClosed: annotation.data.contour.closed,
37642
+ annotationUID: annotation.annotationUID,
37643
+ referencedImageId: annotation.metadata.referencedImageId,
37644
+ holesPolyline: childPolylines,
37645
+ holesUIDs: annotation.childAnnotationUIDs,
37646
+ holesClosed,
37647
+ };
37648
+ });
37649
+ annotationUIDsInSegmentMap.set(index, annotations);
37650
+ });
37651
+ return { segmentIndices, annotationUIDsInSegmentMap };
37401
37652
  }
37402
37653
 
37403
37654
 
@@ -37455,6 +37706,169 @@ function getViewportWithMatchingViewPlaneNormal(viewports, annotation, dotThresh
37455
37706
  }
37456
37707
 
37457
37708
 
37709
+ /***/ }),
37710
+
37711
+ /***/ 38928:
37712
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37713
+
37714
+ "use strict";
37715
+ /* unused harmony export removeCompleteContourAnnotation */
37716
+ /* harmony import */ var _utilities_contourSegmentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(56534);
37717
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(82056);
37718
+
37719
+
37720
+ function removeCompleteContourAnnotation(annotation) {
37721
+ if (!annotation) {
37722
+ return;
37723
+ }
37724
+ if (annotation.parentAnnotationUID) {
37725
+ clearParentAnnotation(annotation);
37726
+ }
37727
+ removeAnnotation(annotation.annotationUID);
37728
+ removeContourSegmentationAnnotation(annotation);
37729
+ }
37730
+
37731
+
37732
+ /***/ }),
37733
+
37734
+ /***/ 19741:
37735
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37736
+
37737
+ "use strict";
37738
+ /* unused harmony export default */
37739
+ /* harmony import */ var _utilities_contours__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6936);
37740
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(82056);
37741
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33283);
37742
+ /* harmony import */ var _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(96629);
37743
+ /* harmony import */ var _removeCompleteContourAnnotation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(38928);
37744
+
37745
+
37746
+
37747
+
37748
+
37749
+ function removeContourHoles(segmentationId, segmentIndex) {
37750
+ const segmentation = getSegmentation(segmentationId);
37751
+ if (!segmentation) {
37752
+ console.warn(`Invalid segmentation given ${segmentationId}`);
37753
+ return;
37754
+ }
37755
+ if (!segmentation.representationData.Contour) {
37756
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
37757
+ return;
37758
+ }
37759
+ const polylinesCanvasMap = extractSegmentPolylines(segmentationId, segmentIndex);
37760
+ if (!polylinesCanvasMap) {
37761
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
37762
+ return;
37763
+ }
37764
+ const keys = Array.from(polylinesCanvasMap?.keys());
37765
+ const polylines = keys.map((key) => polylinesCanvasMap.get(key));
37766
+ const holeDetectionResults = findContourHoles(polylines);
37767
+ if (holeDetectionResults?.length > 0) {
37768
+ holeDetectionResults.forEach((hole) => {
37769
+ hole.holeIndexes.forEach((index) => {
37770
+ const annotation = getAnnotation(keys[index]);
37771
+ removeCompleteContourAnnotation(annotation);
37772
+ });
37773
+ });
37774
+ }
37775
+ }
37776
+
37777
+
37778
+ /***/ }),
37779
+
37780
+ /***/ 85512:
37781
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37782
+
37783
+ "use strict";
37784
+ /* unused harmony export default */
37785
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82056);
37786
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33283);
37787
+ /* harmony import */ var _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(96629);
37788
+ /* harmony import */ var _utilities_contours_findIslands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(76617);
37789
+ /* harmony import */ var _removeCompleteContourAnnotation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(38928);
37790
+
37791
+
37792
+
37793
+
37794
+
37795
+ function removeContourIslands(segmentationId, segmentIndex, options = { threshold: 3 }) {
37796
+ const segmentation = getSegmentation(segmentationId);
37797
+ if (!segmentation) {
37798
+ console.warn(`Invalid segmentation given ${segmentationId}`);
37799
+ return;
37800
+ }
37801
+ if (!segmentation.representationData.Contour) {
37802
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
37803
+ return;
37804
+ }
37805
+ const polylinesCanvasMap = extractSegmentPolylines(segmentationId, segmentIndex);
37806
+ if (!polylinesCanvasMap) {
37807
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
37808
+ return;
37809
+ }
37810
+ const keys = Array.from(polylinesCanvasMap?.keys());
37811
+ const polylines = keys.map((key) => polylinesCanvasMap.get(key));
37812
+ const islands = findIslands(polylines, options.threshold);
37813
+ if (islands?.length > 0) {
37814
+ islands.forEach((index) => {
37815
+ const annotation = getAnnotation(keys[index]);
37816
+ removeCompleteContourAnnotation(annotation);
37817
+ });
37818
+ }
37819
+ }
37820
+
37821
+
37822
+ /***/ }),
37823
+
37824
+ /***/ 68362:
37825
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37826
+
37827
+ "use strict";
37828
+ /* unused harmony export default */
37829
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82056);
37830
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33283);
37831
+ /* harmony import */ var _utilities_planarFreehandROITool_interpolation_interpolateSegmentPoints__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(61768);
37832
+
37833
+
37834
+
37835
+ function smoothContours(segmentationId, segmentIndex, options = { knotsRatioPercentage: 30 }) {
37836
+ const segmentation = getSegmentation(segmentationId);
37837
+ if (!segmentation) {
37838
+ console.warn(`Invalid segmentation given ${segmentationId}`);
37839
+ return;
37840
+ }
37841
+ if (!segmentation.representationData.Contour) {
37842
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
37843
+ return;
37844
+ }
37845
+ const contourRepresentationData = segmentation.representationData
37846
+ .Contour;
37847
+ const { annotationUIDsMap } = contourRepresentationData;
37848
+ if (!annotationUIDsMap) {
37849
+ console.warn(`No contours found for segmentation ${segmentationId}`);
37850
+ return;
37851
+ }
37852
+ if (!annotationUIDsMap.has(segmentIndex)) {
37853
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
37854
+ return;
37855
+ }
37856
+ const annotationList = annotationUIDsMap.get(segmentIndex);
37857
+ annotationList.forEach((annotationUID) => {
37858
+ const annotation = getAnnotation(annotationUID);
37859
+ if (!annotation) {
37860
+ return;
37861
+ }
37862
+ const polyline = annotation.data.contour.polyline;
37863
+ if (!polyline || polyline.length < 3) {
37864
+ return;
37865
+ }
37866
+ const smoothedPolyline = interpolateSegmentPoints(polyline, 0, polyline.length - 1, options.knotsRatioPercentage);
37867
+ annotation.data.contour.polyline = smoothedPolyline;
37868
+ });
37869
+ }
37870
+
37871
+
37458
37872
  /***/ }),
37459
37873
 
37460
37874
  /***/ 77609:
@@ -39847,7 +40261,9 @@ var ContourWindingDirection;
39847
40261
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
39848
40262
  /* harmony export */ V: () => (/* binding */ addContourSegmentationAnnotation)
39849
40263
  /* harmony export */ });
39850
- /* harmony import */ var _stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33283);
40264
+ /* harmony import */ var _stateManagement_annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2076);
40265
+ /* harmony import */ var _stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33283);
40266
+
39851
40267
 
39852
40268
  function addContourSegmentationAnnotation(annotation) {
39853
40269
  if (annotation.parentAnnotationUID) {
@@ -39857,7 +40273,7 @@ function addContourSegmentationAnnotation(annotation) {
39857
40273
  throw new Error('addContourSegmentationAnnotation: annotation does not have a segmentation data');
39858
40274
  }
39859
40275
  const { segmentationId, segmentIndex } = annotation.data.segmentation;
39860
- const segmentation = (0,_stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_0__/* .getSegmentation */ .T)(segmentationId);
40276
+ const segmentation = (0,_stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_1__/* .getSegmentation */ .T)(segmentationId);
39861
40277
  if (!segmentation.representationData.Contour) {
39862
40278
  segmentation.representationData.Contour = { annotationUIDsMap: new Map() };
39863
40279
  }
@@ -39870,6 +40286,9 @@ function addContourSegmentationAnnotation(annotation) {
39870
40286
  annotationsUIDsSet = new Set();
39871
40287
  annotationUIDsMap.set(segmentIndex, annotationsUIDsSet);
39872
40288
  }
40289
+ if (segmentation.segments[segmentIndex].locked) {
40290
+ (0,_stateManagement_annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_0__.setAnnotationLocked)(annotation.annotationUID, true);
40291
+ }
39873
40292
  annotationUIDsMap.set(segmentIndex, annotationsUIDsSet.add(annotation.annotationUID));
39874
40293
  }
39875
40294
 
@@ -42119,6 +42538,59 @@ function normalizeViewportPlane(viewport, boundsIJK) {
42119
42538
  }
42120
42539
 
42121
42540
 
42541
+ /***/ }),
42542
+
42543
+ /***/ 61768:
42544
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
42545
+
42546
+ "use strict";
42547
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
42548
+ /* harmony export */ A: () => (/* binding */ interpolateSegmentPoints)
42549
+ /* harmony export */ });
42550
+ /* harmony import */ var _algorithms_bspline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(30269);
42551
+
42552
+ function getContinuousUniformDistributionValues(minDistributionDistance, closedInterval) {
42553
+ const result = [];
42554
+ const [intervalIni, intervalEnd] = closedInterval;
42555
+ const intervalSize = intervalEnd - intervalIni + 1;
42556
+ const intensity = Math.floor(intervalSize / minDistributionDistance);
42557
+ let x = 0;
42558
+ let continuosDistributionValue = Math.round(((intervalSize - 1) / (intensity - 1)) * x) + intervalIni;
42559
+ while (continuosDistributionValue <= intervalEnd) {
42560
+ result.push(continuosDistributionValue);
42561
+ x++;
42562
+ continuosDistributionValue =
42563
+ Math.round(((intervalSize - 1) / (intensity - 1)) * x) + intervalIni;
42564
+ }
42565
+ return result;
42566
+ }
42567
+ function interpolateSegmentPoints(points, iniIndex, endIndex, knotsRatioPercentage) {
42568
+ const segmentSize = endIndex - iniIndex + 1;
42569
+ const amountOfKnots = Math.floor((knotsRatioPercentage / 100) * segmentSize) ?? 1;
42570
+ const minKnotDistance = Math.floor(segmentSize / amountOfKnots) ?? 1;
42571
+ if (isNaN(segmentSize) || !segmentSize || !minKnotDistance) {
42572
+ return points;
42573
+ }
42574
+ if (segmentSize / minKnotDistance < 2) {
42575
+ return points;
42576
+ }
42577
+ const interpolationIniIndex = Math.max(0, iniIndex);
42578
+ const interpolationEndIndex = Math.min(points.length - 1, endIndex);
42579
+ const segmentPointsUnchangedBeg = points.slice(0, interpolationIniIndex);
42580
+ const segmentPointsUnchangedEnd = points.slice(interpolationEndIndex + 1, points.length);
42581
+ const knotsIndexes = getContinuousUniformDistributionValues(minKnotDistance, [
42582
+ interpolationIniIndex,
42583
+ interpolationEndIndex,
42584
+ ]);
42585
+ const interpolatedPoints = (0,_algorithms_bspline__WEBPACK_IMPORTED_MODULE_0__/* .interpolatePoints */ .H)(points, knotsIndexes);
42586
+ return [
42587
+ ...segmentPointsUnchangedBeg,
42588
+ ...interpolatedPoints,
42589
+ ...segmentPointsUnchangedEnd,
42590
+ ];
42591
+ }
42592
+
42593
+
42122
42594
  /***/ }),
42123
42595
 
42124
42596
  /***/ 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;