@ohif/app 3.13.0-beta.88 → 3.13.0-beta.89
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.
- package/dist/{5491.bundle.4866d2ecb20dd089e071.js → 1124.bundle.3c1b947a1884362c1241.js} +376 -222
- package/dist/1429.bundle.bd1585628440399e6c3f.js +2079 -0
- package/dist/{2108.bundle.142ee8d405727d02b16a.js → 1704.bundle.38d95b81b9e1293e04de.js} +1 -643
- package/dist/{7537.bundle.3c7d71348190ed4e9565.js → 1741.bundle.abc3a09729ada4c25685.js} +105024 -55129
- package/dist/{1927.bundle.be67b3aafe238ca9f191.js → 1927.bundle.1749aa6ae7b1dd3d06b1.js} +1 -1
- package/dist/{6354.bundle.929febcf6d326e582e00.js → 2802.bundle.3d6cc53ef3c69901431d.js} +31 -324
- package/dist/{3461.bundle.9bc7ca0f93d754014c23.js → 3461.bundle.2f3e998096ef3fca602b.js} +5 -4
- package/dist/{3617.bundle.f408991512372e52c6cf.js → 3617.bundle.f7f53b332f72e9fe6374.js} +2 -2
- package/dist/{3754.bundle.477cfd7fc3ff13e9dc67.js → 3754.bundle.2a46971b209140d4cb08.js} +12 -6
- package/dist/{9039.bundle.49ab126163ca208e52b3.js → 4335.bundle.69a7cc007e85f043488e.js} +4114 -4263
- package/dist/{4579.bundle.1c315389368cc476aed3.js → 451.bundle.6634a9dae2b4f0e9ebc9.js} +83 -30
- package/dist/{5028.bundle.4960393948811673d99b.js → 5028.bundle.f483671d94ded4c8f6f3.js} +2 -2
- package/dist/{5858.bundle.466e58128de344ab53f3.js → 5858.bundle.c25c73ecbc47b1a69cea.js} +0 -4
- package/dist/{6125.bundle.2c6f2ba3bd8e1493e54b.js → 6125.bundle.4e46ecd271f647cb977f.js} +2 -2087
- package/dist/{6376.bundle.f5ef0f5465d575d0dbb0.js → 6376.bundle.c7c515ba478be810e03d.js} +6 -3
- package/dist/{9567.bundle.ff782480a4c66e306027.js → 650.bundle.5decc3ce72a22162b8f4.js} +3080 -216
- package/dist/{7166.bundle.0a84efe4f3e6d0ddcbec.js → 7166.bundle.eeeda537770d73736e46.js} +161 -55
- package/dist/{6386.bundle.dc7e3b159d6b4733647f.js → 741.bundle.e47adc12429ee838d3fb.js} +3408 -3722
- package/dist/{7431.bundle.a9b4dbf97a8c196efe51.js → 7431.bundle.c3bd9a9f1ea743c81335.js} +61 -60
- package/dist/{8305.bundle.8088b210631f2b22899d.js → 8305.bundle.71787ad9e3df5d1dd30d.js} +2 -2
- package/dist/{8558.bundle.79c567857e04df2694cc.js → 8558.bundle.00d5dbdf73ca0a44831a.js} +1 -1
- package/dist/{8583.bundle.e36ff2fc6ee67e4e4232.js → 8583.bundle.40859ef5654559a1c66b.js} +3 -3
- package/dist/{9205.bundle.c974537f15d86687f6d2.js → 9205.bundle.d43cd617e38109746e4d.js} +2257 -2133
- package/dist/{4287.bundle.4f28e48c1e39a46dfc87.js → 9400.bundle.a56bfccf2bf7a51ed297.js} +1362 -692
- package/dist/{2075.bundle.ba9ac60662f1fa739378.js → 9475.bundle.693fe4de0573042a17f3.js} +203 -156
- package/dist/{app.bundle.3b116829d23059e8d9d8.js → app.bundle.93ee83d5e283aa1496da.js} +81239 -52123
- package/dist/{compute.bundle.2b82d8a0d1f3b41df1d2.js → compute.bundle.2fc1182cc9b2af5f4a40.js} +3 -15
- package/dist/{histogram-worker.bundle.a2a50c4674d99c619ca7.js → histogram-worker.bundle.c81373ef983363586dc5.js} +4 -4
- package/dist/index.html +1 -1
- package/dist/{interpolation.bundle.35be9e5cf473c6ebd3da.js → interpolation.bundle.a31edd1d26d81ef65b9b.js} +6 -6
- package/dist/{polySeg.bundle.ad2080f28d2c471bf208.js → polySeg.bundle.294012e3a5458cd3fecc.js} +3 -15
- package/dist/sw.js +1 -1
- package/package.json +21 -21
- /package/dist/{1459.bundle.23ea55eeadd13d26d6b5.js → 1459.bundle.763540bccf93fda17fff.js} +0 -0
- /package/dist/{1933.bundle.5713711c4a8f6518803b.js → 1933.bundle.8d54b74d93a7354925c5.js} +0 -0
- /package/dist/{2018.bundle.fee6699868f9e280861c.js → 2018.bundle.7ba8f9afeb48defb425b.js} +0 -0
- /package/dist/{213.bundle.3c0a19cba715a9a87151.js → 213.bundle.1a54c6878a493c5b61c5.js} +0 -0
- /package/dist/{2424.bundle.1d615d02f985abbbc633.js → 2424.bundle.c6d74f7129108d885a1b.js} +0 -0
- /package/dist/{2516.bundle.6b52ced19754035768ae.js → 2516.bundle.28427294c53e067811ca.js} +0 -0
- /package/dist/{3138.bundle.451e4105dda240465e6d.js → 3138.bundle.3845b7e06b8ab2564951.js} +0 -0
- /package/dist/{4507.bundle.51470574cbf11549ff72.js → 4507.bundle.b658ff59d35614916a2b.js} +0 -0
- /package/dist/{4819.bundle.c5e695cd51065d2a1a88.js → 4819.bundle.e28f5f1f0d481e190bb1.js} +0 -0
- /package/dist/{5015.bundle.647c560efcc9942bb42c.js → 5015.bundle.455552a6df9b442b3c40.js} +0 -0
- /package/dist/{5457.bundle.45b43e0e56637108f8f1.js → 5457.bundle.ee1026db729958b36a2e.js} +0 -0
- /package/dist/{5485.bundle.3d2d3a7f37f948da2269.js → 5485.bundle.0ecad3940c321ae65b23.js} +0 -0
- /package/dist/{5802.bundle.da6055b6bf1a3db7b6d5.js → 5802.bundle.5e1a7df7ad850a5370f8.js} +0 -0
- /package/dist/{5830.bundle.d026ec38980fb12f2518.js → 5830.bundle.8327ccd3c8a6334ac315.js} +0 -0
- /package/dist/{6027.bundle.ea7a56c1ebde501ce02d.js → 6027.bundle.f276566b6237d9e16333.js} +0 -0
- /package/dist/{7639.bundle.2b4ae693bddf15fb9641.js → 7639.bundle.25e1a86f2248148c35d5.js} +0 -0
- /package/dist/{8499.bundle.f94b5427bb2889634aeb.js → 8499.bundle.22f25667db4ab2e59e57.js} +0 -0
- /package/dist/{85.bundle.f7cb4cf8432ca6a815c0.js → 85.bundle.2aa39c9bf12258c7ca68.js} +0 -0
- /package/dist/{9862.bundle.f92516a34b9cef88c56f.js → 9862.bundle.fb87529360fb93010555.js} +0 -0
- /package/dist/{9927.bundle.5cf09e95f0253210d431.js → 9927.bundle.f6e7785bceeeb7a1c62e.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
(globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[
|
|
2
|
+
(globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[9400],{
|
|
3
3
|
|
|
4
4
|
/***/ 97181
|
|
5
5
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -73,6 +73,23 @@ var Events;
|
|
|
73
73
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Events);
|
|
74
74
|
|
|
75
75
|
|
|
76
|
+
/***/ },
|
|
77
|
+
|
|
78
|
+
/***/ 18682
|
|
79
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
80
|
+
|
|
81
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
82
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
83
|
+
/* harmony export */ });
|
|
84
|
+
var SegmentationRepresentations;
|
|
85
|
+
(function (SegmentationRepresentations) {
|
|
86
|
+
SegmentationRepresentations["Labelmap"] = "Labelmap";
|
|
87
|
+
SegmentationRepresentations["Contour"] = "Contour";
|
|
88
|
+
SegmentationRepresentations["Surface"] = "Surface";
|
|
89
|
+
})(SegmentationRepresentations || (SegmentationRepresentations = {}));
|
|
90
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SegmentationRepresentations);
|
|
91
|
+
|
|
92
|
+
|
|
76
93
|
/***/ },
|
|
77
94
|
|
|
78
95
|
/***/ 76910
|
|
@@ -359,6 +376,849 @@ function validateSegmentationInput(segmentationInputArray) {
|
|
|
359
376
|
/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (validateSegmentationInput)));
|
|
360
377
|
|
|
361
378
|
|
|
379
|
+
/***/ },
|
|
380
|
+
|
|
381
|
+
/***/ 72759
|
|
382
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
383
|
+
|
|
384
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
385
|
+
/* harmony export */ Qk: () => (/* binding */ beginLabelmapEditTransaction),
|
|
386
|
+
/* harmony export */ Ry: () => (/* binding */ eraseLabelmapEditTransactionOverwrites),
|
|
387
|
+
/* harmony export */ VQ: () => (/* binding */ resolveLabelmapLayerEditTarget)
|
|
388
|
+
/* harmony export */ });
|
|
389
|
+
/* unused harmony exports collectCrossLayerEraseBindings, getLabelmapLayerImageId, getProtectedSegmentIndicesForLayer, hasProtectedSegmentOverwrite */
|
|
390
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
|
|
391
|
+
/* harmony import */ var _labelmapLayerStore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(80973);
|
|
392
|
+
/* harmony import */ var _labelmapSegmentBindings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7296);
|
|
393
|
+
/* harmony import */ var _privateLabelmap__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99380);
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
function getProtectedSegmentIndicesForLayer(segmentation, labelmapId, segmentIndex, overwriteSegmentIndices = []) {
|
|
399
|
+
return (0,_labelmapSegmentBindings__WEBPACK_IMPORTED_MODULE_2__/* .getSegmentsOnLabelmap */ .I3)(segmentation, labelmapId).filter((candidateSegmentIndex) => candidateSegmentIndex !== segmentIndex &&
|
|
400
|
+
!overwriteSegmentIndices.includes(candidateSegmentIndex));
|
|
401
|
+
}
|
|
402
|
+
function hasProtectedSegmentOverwrite(segmentation, labelmapId, protectedSegmentIndices, voxelManager, options = {}) {
|
|
403
|
+
if (!voxelManager || !protectedSegmentIndices.length) {
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
const protectedSet = new Set(protectedSegmentIndices);
|
|
407
|
+
let hasConflict = false;
|
|
408
|
+
voxelManager.forEach(({ value }) => {
|
|
409
|
+
if (!value || hasConflict) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
const candidateSegmentIndex = (0,_labelmapSegmentBindings__WEBPACK_IMPORTED_MODULE_2__/* .getSegmentIndexForLabelValue */ .Mx)(segmentation, labelmapId, Number(value));
|
|
413
|
+
if (candidateSegmentIndex && protectedSet.has(candidateSegmentIndex)) {
|
|
414
|
+
hasConflict = true;
|
|
415
|
+
}
|
|
416
|
+
}, {
|
|
417
|
+
imageData: options.segmentationImageData,
|
|
418
|
+
isInObject: options.isInObject,
|
|
419
|
+
boundsIJK: options.isInObjectBoundsIJK,
|
|
420
|
+
});
|
|
421
|
+
return hasConflict;
|
|
422
|
+
}
|
|
423
|
+
function collectCrossLayerEraseBindings(segmentation, labelmapId, overwriteSegmentIndices = []) {
|
|
424
|
+
if (!labelmapId || !overwriteSegmentIndices.length) {
|
|
425
|
+
return [];
|
|
426
|
+
}
|
|
427
|
+
return overwriteSegmentIndices
|
|
428
|
+
.map((overwriteSegmentIndex) => (0,_labelmapSegmentBindings__WEBPACK_IMPORTED_MODULE_2__/* .getSegmentBinding */ .hM)(segmentation, overwriteSegmentIndex))
|
|
429
|
+
.filter((binding) => !!binding && binding.labelmapId !== labelmapId);
|
|
430
|
+
}
|
|
431
|
+
function beginLabelmapEditTransaction(segmentation, options) {
|
|
432
|
+
const { segmentIndex } = options;
|
|
433
|
+
const overwriteSegmentIndices = options.overwriteSegmentIndices ?? [];
|
|
434
|
+
if (!segmentIndex) {
|
|
435
|
+
return {
|
|
436
|
+
segmentIndex,
|
|
437
|
+
labelValue: 0,
|
|
438
|
+
overwriteSegmentIndices,
|
|
439
|
+
protectedSegmentIndices: [],
|
|
440
|
+
crossLayerEraseBindings: [],
|
|
441
|
+
movedSegment: false,
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
const binding = (0,_labelmapSegmentBindings__WEBPACK_IMPORTED_MODULE_2__/* .getSegmentBinding */ .hM)(segmentation, segmentIndex);
|
|
445
|
+
const sourceLayer = binding
|
|
446
|
+
? (0,_labelmapLayerStore__WEBPACK_IMPORTED_MODULE_1__/* .getLabelmap */ .Hs)(segmentation, binding.labelmapId)
|
|
447
|
+
: undefined;
|
|
448
|
+
if (!binding || !sourceLayer) {
|
|
449
|
+
return {
|
|
450
|
+
segmentIndex,
|
|
451
|
+
labelValue: segmentIndex,
|
|
452
|
+
overwriteSegmentIndices,
|
|
453
|
+
protectedSegmentIndices: [],
|
|
454
|
+
crossLayerEraseBindings: [],
|
|
455
|
+
movedSegment: false,
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
let activeLayer = sourceLayer;
|
|
459
|
+
let labelmapId = binding.labelmapId;
|
|
460
|
+
let labelValue = binding.labelValue;
|
|
461
|
+
let movedSegment = false;
|
|
462
|
+
const protectedSegmentIndices = getProtectedSegmentIndicesForLayer(segmentation, labelmapId, segmentIndex, overwriteSegmentIndices);
|
|
463
|
+
const shouldMoveSegment = hasProtectedSegmentOverwrite(segmentation, labelmapId, protectedSegmentIndices, options.segmentationVoxelManager, {
|
|
464
|
+
segmentationImageData: options.segmentationImageData,
|
|
465
|
+
isInObject: options.isInObject,
|
|
466
|
+
isInObjectBoundsIJK: options.isInObjectBoundsIJK,
|
|
467
|
+
});
|
|
468
|
+
if (shouldMoveSegment) {
|
|
469
|
+
const moveSegmentToPrivateLabelmap = options.moveSegmentToPrivateLabelmap ??
|
|
470
|
+
_privateLabelmap__WEBPACK_IMPORTED_MODULE_3__/* .moveSegmentToPrivateLabelmap */ .J;
|
|
471
|
+
const privateLayer = moveSegmentToPrivateLabelmap(segmentation, segmentIndex);
|
|
472
|
+
const privateBinding = (0,_labelmapSegmentBindings__WEBPACK_IMPORTED_MODULE_2__/* .getSegmentBinding */ .hM)(segmentation, segmentIndex);
|
|
473
|
+
if (privateLayer && privateBinding) {
|
|
474
|
+
activeLayer = privateLayer;
|
|
475
|
+
labelmapId = privateBinding.labelmapId;
|
|
476
|
+
labelValue = privateBinding.labelValue;
|
|
477
|
+
movedSegment = privateLayer.labelmapId !== sourceLayer.labelmapId;
|
|
478
|
+
}
|
|
479
|
+
else if (privateLayer) {
|
|
480
|
+
activeLayer = privateLayer;
|
|
481
|
+
labelmapId = privateLayer.labelmapId;
|
|
482
|
+
labelValue = 1;
|
|
483
|
+
movedSegment = privateLayer.labelmapId !== sourceLayer.labelmapId;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return {
|
|
487
|
+
segmentIndex,
|
|
488
|
+
labelmapId,
|
|
489
|
+
labelValue,
|
|
490
|
+
sourceLayer,
|
|
491
|
+
activeLayer,
|
|
492
|
+
overwriteSegmentIndices,
|
|
493
|
+
protectedSegmentIndices,
|
|
494
|
+
crossLayerEraseBindings: collectCrossLayerEraseBindings(segmentation, labelmapId, overwriteSegmentIndices),
|
|
495
|
+
movedSegment,
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
function getViewportImageIds(viewport) {
|
|
499
|
+
const stackViewport = viewport;
|
|
500
|
+
return typeof stackViewport?.getImageIds === 'function'
|
|
501
|
+
? stackViewport.getImageIds()
|
|
502
|
+
: [];
|
|
503
|
+
}
|
|
504
|
+
function getCurrentViewportImageId(viewport) {
|
|
505
|
+
const stackViewport = viewport;
|
|
506
|
+
return typeof stackViewport?.getCurrentImageId === 'function'
|
|
507
|
+
? stackViewport.getCurrentImageId()
|
|
508
|
+
: undefined;
|
|
509
|
+
}
|
|
510
|
+
function getLayerImageIndex(layer, options) {
|
|
511
|
+
const currentImageId = options.imageId ?? getCurrentViewportImageId(options.viewport);
|
|
512
|
+
if (!currentImageId) {
|
|
513
|
+
return -1;
|
|
514
|
+
}
|
|
515
|
+
const sourceImageIndex = options.sourceLayer?.imageIds?.indexOf(currentImageId) ?? -1;
|
|
516
|
+
if (sourceImageIndex >= 0) {
|
|
517
|
+
return sourceImageIndex;
|
|
518
|
+
}
|
|
519
|
+
const layerImageIndex = layer.imageIds?.indexOf(currentImageId) ?? -1;
|
|
520
|
+
if (layerImageIndex >= 0) {
|
|
521
|
+
return layerImageIndex;
|
|
522
|
+
}
|
|
523
|
+
return getViewportImageIds(options.viewport).indexOf(currentImageId);
|
|
524
|
+
}
|
|
525
|
+
function getLabelmapLayerImageId(layer, options = {}) {
|
|
526
|
+
const targetIndex = getLayerImageIndex(layer, options);
|
|
527
|
+
return targetIndex >= 0 ? layer.imageIds?.[targetIndex] : layer.imageIds?.[0];
|
|
528
|
+
}
|
|
529
|
+
function resolveLabelmapLayerEditTarget(layer, options = {}) {
|
|
530
|
+
const imageId = getLabelmapLayerImageId(layer, options);
|
|
531
|
+
if (options.preferVolume ||
|
|
532
|
+
layer.volumeId ||
|
|
533
|
+
options.viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.BaseVolumeViewport) {
|
|
534
|
+
const volume = (0,_labelmapLayerStore__WEBPACK_IMPORTED_MODULE_1__/* .getOrCreateLabelmapVolume */ .kL)(layer);
|
|
535
|
+
return {
|
|
536
|
+
imageId,
|
|
537
|
+
imageData: volume?.imageData,
|
|
538
|
+
voxelManager: volume?.voxelManager,
|
|
539
|
+
volume,
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
const image = imageId ? _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getImage(imageId) : undefined;
|
|
543
|
+
return {
|
|
544
|
+
imageId,
|
|
545
|
+
voxelManager: image?.voxelManager,
|
|
546
|
+
image,
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
function eraseVolumeLayer(layer, binding, options, modifiedSlices) {
|
|
550
|
+
const volume = (0,_labelmapLayerStore__WEBPACK_IMPORTED_MODULE_1__/* .getOrCreateLabelmapVolume */ .kL)(layer);
|
|
551
|
+
if (!volume) {
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
volume.voxelManager.forEach(({ value, index, pointIJK }) => {
|
|
555
|
+
if (value !== binding.labelValue) {
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
const worldPoint = volume.imageData.indexToWorld(pointIJK);
|
|
559
|
+
if (!options.isInObject(worldPoint)) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
volume.voxelManager.setAtIndex(index, 0);
|
|
563
|
+
}, {
|
|
564
|
+
imageData: volume.imageData,
|
|
565
|
+
boundsIJK: options.isInObjectBoundsIJK,
|
|
566
|
+
});
|
|
567
|
+
volume.voxelManager
|
|
568
|
+
?.getArrayOfModifiedSlices?.()
|
|
569
|
+
?.forEach((sliceIndex) => modifiedSlices.add(sliceIndex));
|
|
570
|
+
}
|
|
571
|
+
function eraseStackLayer(layer, binding, options, modifiedSlices) {
|
|
572
|
+
const stackViewport = options.viewport;
|
|
573
|
+
const currentImageId = getCurrentViewportImageId(options.viewport) ?? options.imageId;
|
|
574
|
+
const { image, voxelManager } = resolveLabelmapLayerEditTarget(layer, {
|
|
575
|
+
viewport: options.viewport,
|
|
576
|
+
imageId: currentImageId,
|
|
577
|
+
});
|
|
578
|
+
if (!image || !voxelManager) {
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
voxelManager.forEach(({ value, index, pointIJK }) => {
|
|
582
|
+
if (value !== binding.labelValue) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
const worldPoint = options.referenceImageData.indexToWorld(pointIJK);
|
|
586
|
+
if (!options.isInObject(worldPoint)) {
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
voxelManager.setAtIndex(index, 0);
|
|
590
|
+
}, {
|
|
591
|
+
imageData: options.referenceImageData,
|
|
592
|
+
boundsIJK: options.isInObjectBoundsIJK,
|
|
593
|
+
});
|
|
594
|
+
const currentSlice = stackViewport.getCurrentImageIdIndex?.();
|
|
595
|
+
if (typeof currentSlice === 'number') {
|
|
596
|
+
modifiedSlices.add(currentSlice);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
function eraseLabelmapEditTransactionOverwrites(segmentation, transaction, options) {
|
|
600
|
+
if (!transaction?.crossLayerEraseBindings?.length) {
|
|
601
|
+
return [];
|
|
602
|
+
}
|
|
603
|
+
const modifiedSlices = new Set();
|
|
604
|
+
transaction.crossLayerEraseBindings.forEach((binding) => {
|
|
605
|
+
const layer = (0,_labelmapLayerStore__WEBPACK_IMPORTED_MODULE_1__/* .getLabelmap */ .Hs)(segmentation, binding.labelmapId);
|
|
606
|
+
if (!layer) {
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
if (options.viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.BaseVolumeViewport || layer.volumeId) {
|
|
610
|
+
eraseVolumeLayer(layer, binding, options, modifiedSlices);
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
eraseStackLayer(layer, binding, options, modifiedSlices);
|
|
614
|
+
});
|
|
615
|
+
return Array.from(modifiedSlices);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
/***/ },
|
|
621
|
+
|
|
622
|
+
/***/ 52133
|
|
623
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
624
|
+
|
|
625
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
626
|
+
/* harmony export */ Zd: () => (/* binding */ forEachLabelmapImageReference),
|
|
627
|
+
/* harmony export */ dm: () => (/* binding */ hasMultipleLabelmapImagesPerReferencedImageId),
|
|
628
|
+
/* harmony export */ s_: () => (/* binding */ getLabelmapImageIdsForReferencedImageId)
|
|
629
|
+
/* harmony export */ });
|
|
630
|
+
/* unused harmony export getReferencedImageIdForImageIndex */
|
|
631
|
+
function getReferencedImageIdForImageIndex(layer, imageIndex) {
|
|
632
|
+
const imageIds = layer.imageIds ?? [];
|
|
633
|
+
const referencedImageIds = layer.referencedImageIds ?? imageIds;
|
|
634
|
+
if (!referencedImageIds.length) {
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
if (layer.referencedImageIds?.length &&
|
|
638
|
+
imageIds.length > referencedImageIds.length &&
|
|
639
|
+
imageIds.length % referencedImageIds.length === 0) {
|
|
640
|
+
return referencedImageIds[imageIndex % referencedImageIds.length];
|
|
641
|
+
}
|
|
642
|
+
return referencedImageIds[imageIndex];
|
|
643
|
+
}
|
|
644
|
+
function forEachLabelmapImageReference(layer, callback) {
|
|
645
|
+
layer.imageIds?.forEach((labelmapImageId, imageIndex) => {
|
|
646
|
+
const referencedImageId = getReferencedImageIdForImageIndex(layer, imageIndex);
|
|
647
|
+
if (!referencedImageId || !labelmapImageId) {
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
callback(referencedImageId, labelmapImageId, imageIndex);
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
function getLabelmapImageIdsForReferencedImageId(layer, referencedImageId) {
|
|
654
|
+
const imageIds = [];
|
|
655
|
+
forEachLabelmapImageReference(layer, (candidateReference, imageId) => {
|
|
656
|
+
if (candidateReference === referencedImageId) {
|
|
657
|
+
imageIds.push(imageId);
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
return imageIds;
|
|
661
|
+
}
|
|
662
|
+
function hasMultipleLabelmapImagesPerReferencedImageId(layer) {
|
|
663
|
+
const imageIdsByReference = new Map();
|
|
664
|
+
forEachLabelmapImageReference(layer, (referencedImageId) => {
|
|
665
|
+
imageIdsByReference.set(referencedImageId, (imageIdsByReference.get(referencedImageId) ?? 0) + 1);
|
|
666
|
+
});
|
|
667
|
+
return Array.from(imageIdsByReference.values()).some((count) => count > 1);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
/***/ },
|
|
673
|
+
|
|
674
|
+
/***/ 62851
|
|
675
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
676
|
+
|
|
677
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
678
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
679
|
+
/* harmony export */ });
|
|
680
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
|
|
681
|
+
/* harmony import */ var _helpers_getViewportLabelmapRenderMode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33214);
|
|
682
|
+
/* harmony import */ var _normalizeLabelmapSegmentationData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(830);
|
|
683
|
+
/* harmony import */ var _labelmapLayerStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(80973);
|
|
684
|
+
/* harmony import */ var _labelmapSegmentBindings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7296);
|
|
685
|
+
/* harmony import */ var _labelmapLegacyAdapter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(91573);
|
|
686
|
+
/* harmony import */ var _labelmapImageIdMapping__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(52133);
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
class LabelmapImageReferenceResolver {
|
|
695
|
+
constructor(getSegmentation) {
|
|
696
|
+
this.stackLabelmapImageIdReferenceMap = new Map();
|
|
697
|
+
this.labelmapImageIdReferenceMap = new Map();
|
|
698
|
+
this.keysBySegmentationId = new Map();
|
|
699
|
+
this.getSegmentation = getSegmentation;
|
|
700
|
+
}
|
|
701
|
+
reset() {
|
|
702
|
+
this.stackLabelmapImageIdReferenceMap.clear();
|
|
703
|
+
this.labelmapImageIdReferenceMap.clear();
|
|
704
|
+
this.keysBySegmentationId.clear();
|
|
705
|
+
}
|
|
706
|
+
removeSegmentation(segmentationId) {
|
|
707
|
+
this.stackLabelmapImageIdReferenceMap.delete(segmentationId);
|
|
708
|
+
const keys = this.keysBySegmentationId.get(segmentationId);
|
|
709
|
+
if (keys) {
|
|
710
|
+
for (const key of keys) {
|
|
711
|
+
this.labelmapImageIdReferenceMap.delete(key);
|
|
712
|
+
}
|
|
713
|
+
this.keysBySegmentationId.delete(segmentationId);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
setLabelmapImageIds(segmentationId, key, labelmapImageIds) {
|
|
717
|
+
this.labelmapImageIdReferenceMap.set(key, labelmapImageIds);
|
|
718
|
+
let keys = this.keysBySegmentationId.get(segmentationId);
|
|
719
|
+
if (!keys) {
|
|
720
|
+
keys = new Set();
|
|
721
|
+
this.keysBySegmentationId.set(segmentationId, keys);
|
|
722
|
+
}
|
|
723
|
+
keys.add(key);
|
|
724
|
+
}
|
|
725
|
+
getLabelmapImageIds(representationData) {
|
|
726
|
+
const labelmapData = representationData.Labelmap;
|
|
727
|
+
let labelmapImageIds;
|
|
728
|
+
if (!labelmapData) {
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
if (labelmapData?.labelmaps) {
|
|
732
|
+
const imageIds = Object.values(labelmapData.labelmaps).flatMap((layer) => {
|
|
733
|
+
if (layer.imageIds?.length) {
|
|
734
|
+
return layer.imageIds;
|
|
735
|
+
}
|
|
736
|
+
if (layer.volumeId) {
|
|
737
|
+
return _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getVolume(layer.volumeId)
|
|
738
|
+
?.imageIds;
|
|
739
|
+
}
|
|
740
|
+
return [];
|
|
741
|
+
});
|
|
742
|
+
return Array.from(new Set(imageIds.filter(Boolean)));
|
|
743
|
+
}
|
|
744
|
+
if (labelmapData.imageIds) {
|
|
745
|
+
labelmapImageIds = labelmapData
|
|
746
|
+
.imageIds;
|
|
747
|
+
}
|
|
748
|
+
else if (labelmapData.volumeId) {
|
|
749
|
+
const volumeId = labelmapData
|
|
750
|
+
.volumeId;
|
|
751
|
+
const volume = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getVolume(volumeId);
|
|
752
|
+
labelmapImageIds = volume.imageIds;
|
|
753
|
+
}
|
|
754
|
+
return labelmapImageIds;
|
|
755
|
+
}
|
|
756
|
+
getLabelmapImageIdsForImageId(imageId, segmentationId) {
|
|
757
|
+
const segmentation = this.getSegmentation(segmentationId);
|
|
758
|
+
if (!segmentation?.representationData?.Labelmap) {
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
(0,_normalizeLabelmapSegmentationData__WEBPACK_IMPORTED_MODULE_2__/* .ensureLabelmapState */ .uk)(segmentation);
|
|
762
|
+
return (0,_labelmapLegacyAdapter__WEBPACK_IMPORTED_MODULE_5__/* .getReferencedImageIdToCurrentImageIdMap */ ._)(segmentation).get(imageId);
|
|
763
|
+
}
|
|
764
|
+
updateLabelmapSegmentationImageReferences(viewportId, segmentationId) {
|
|
765
|
+
const segmentation = this.getSegmentation(segmentationId);
|
|
766
|
+
if (!segmentation) {
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
if (!this.stackLabelmapImageIdReferenceMap.has(segmentationId)) {
|
|
770
|
+
this.stackLabelmapImageIdReferenceMap.set(segmentationId, new Map());
|
|
771
|
+
}
|
|
772
|
+
const { representationData } = segmentation;
|
|
773
|
+
if (!representationData.Labelmap) {
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
const labelmapImageIds = this.getLabelmapImageIds(representationData);
|
|
777
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElementByViewportId)(viewportId);
|
|
778
|
+
if (!enabledElement || !labelmapImageIds?.length) {
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
return this.updateLabelmapSegmentationReferences(segmentationId, enabledElement.viewport, labelmapImageIds);
|
|
782
|
+
}
|
|
783
|
+
getCurrentLabelmapImageIdsForViewport(viewportId, segmentationId) {
|
|
784
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElementByViewportId)(viewportId);
|
|
785
|
+
if (!enabledElement) {
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
const { viewport } = enabledElement;
|
|
789
|
+
const viewportRenderMode = (0,_helpers_getViewportLabelmapRenderMode__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(viewport);
|
|
790
|
+
if (viewportRenderMode !== 'image' ||
|
|
791
|
+
typeof viewport.getCurrentImageId !== 'function') {
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
const referenceImageId = viewport.getCurrentImageId();
|
|
795
|
+
const segmentation = this.getSegmentation(segmentationId);
|
|
796
|
+
if (!segmentation) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
(0,_normalizeLabelmapSegmentationData__WEBPACK_IMPORTED_MODULE_2__/* .ensureLabelmapState */ .uk)(segmentation);
|
|
800
|
+
const viewportImageIds = viewport.getImageIds();
|
|
801
|
+
const currentIndex = viewportImageIds.indexOf(referenceImageId);
|
|
802
|
+
const labelmapImageIds = [];
|
|
803
|
+
(0,_labelmapLayerStore__WEBPACK_IMPORTED_MODULE_3__/* .getLabelmaps */ .m)(segmentation).forEach((layer) => {
|
|
804
|
+
const referencedLabelmapImageIds = (0,_labelmapImageIdMapping__WEBPACK_IMPORTED_MODULE_6__/* .getLabelmapImageIdsForReferencedImageId */ .s_)(layer, referenceImageId);
|
|
805
|
+
if (referencedLabelmapImageIds.length) {
|
|
806
|
+
labelmapImageIds.push(...referencedLabelmapImageIds);
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
if (currentIndex !== -1 && layer.imageIds?.[currentIndex]) {
|
|
810
|
+
labelmapImageIds.push(layer.imageIds[currentIndex]);
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
layer.imageIds?.some((candidateImageId) => {
|
|
814
|
+
const viewableImageId = viewport.isReferenceViewable({ referencedImageId: candidateImageId }, { asOverlay: true });
|
|
815
|
+
if (viewableImageId) {
|
|
816
|
+
labelmapImageIds.push(candidateImageId);
|
|
817
|
+
}
|
|
818
|
+
return !!viewableImageId;
|
|
819
|
+
});
|
|
820
|
+
});
|
|
821
|
+
const resolvedImageIds = Array.from(new Set(labelmapImageIds));
|
|
822
|
+
const key = this.generateMapKey({
|
|
823
|
+
segmentationId,
|
|
824
|
+
referenceImageId,
|
|
825
|
+
});
|
|
826
|
+
this.setLabelmapImageIds(segmentationId, key, resolvedImageIds);
|
|
827
|
+
if (!this.stackLabelmapImageIdReferenceMap.has(segmentationId)) {
|
|
828
|
+
this.stackLabelmapImageIdReferenceMap.set(segmentationId, new Map());
|
|
829
|
+
}
|
|
830
|
+
const activeSegmentIndex = Object.keys(segmentation.segments).find((segmentIndex) => segmentation.segments[segmentIndex].active);
|
|
831
|
+
const activeImageId = activeSegmentIndex
|
|
832
|
+
? (0,_labelmapSegmentBindings__WEBPACK_IMPORTED_MODULE_4__/* .getLabelmapForSegment */ .r)(segmentation, Number(activeSegmentIndex))
|
|
833
|
+
?.imageIds?.[currentIndex]
|
|
834
|
+
: undefined;
|
|
835
|
+
this.stackLabelmapImageIdReferenceMap
|
|
836
|
+
.get(segmentationId)
|
|
837
|
+
.set(referenceImageId, activeImageId ?? resolvedImageIds[0]);
|
|
838
|
+
return resolvedImageIds;
|
|
839
|
+
}
|
|
840
|
+
getCurrentLabelmapImageIdForViewport(viewportId, segmentationId) {
|
|
841
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElementByViewportId)(viewportId);
|
|
842
|
+
if (!enabledElement) {
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
const { viewport } = enabledElement;
|
|
846
|
+
const viewportRenderMode = (0,_helpers_getViewportLabelmapRenderMode__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(viewport);
|
|
847
|
+
if (viewportRenderMode !== 'image' ||
|
|
848
|
+
typeof viewport.getCurrentImageId !== 'function') {
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
const currentImageId = viewport.getCurrentImageId();
|
|
852
|
+
const currentImageIds = this.getCurrentLabelmapImageIdsForViewport(viewportId, segmentationId);
|
|
853
|
+
if (!currentImageIds?.length) {
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
const segmentation = this.getSegmentation(segmentationId);
|
|
857
|
+
const currentIndex = viewport
|
|
858
|
+
.getImageIds()
|
|
859
|
+
.indexOf(currentImageId);
|
|
860
|
+
const activeSegmentIndex = segmentation
|
|
861
|
+
? Object.keys(segmentation.segments).find((segmentIndex) => segmentation.segments[segmentIndex].active)
|
|
862
|
+
: undefined;
|
|
863
|
+
const activeImageId = segmentation && activeSegmentIndex
|
|
864
|
+
? (0,_labelmapSegmentBindings__WEBPACK_IMPORTED_MODULE_4__/* .getLabelmapForSegment */ .r)(segmentation, Number(activeSegmentIndex))
|
|
865
|
+
?.imageIds?.[currentIndex]
|
|
866
|
+
: undefined;
|
|
867
|
+
return activeImageId ?? currentImageIds[0];
|
|
868
|
+
}
|
|
869
|
+
getStackSegmentationImageIdsForViewport(viewportId, segmentationId) {
|
|
870
|
+
const segmentation = this.getSegmentation(segmentationId);
|
|
871
|
+
if (!segmentation) {
|
|
872
|
+
return [];
|
|
873
|
+
}
|
|
874
|
+
this.updateAllLabelmapSegmentationImageReferences(viewportId, segmentationId);
|
|
875
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElementByViewportId)(viewportId);
|
|
876
|
+
const imageIds = enabledElement?.viewport.getImageIds?.() ?? [];
|
|
877
|
+
const imageIdMap = (0,_labelmapLegacyAdapter__WEBPACK_IMPORTED_MODULE_5__/* .getReferencedImageIdToCurrentImageIdMap */ ._)(segmentation);
|
|
878
|
+
return imageIds.flatMap((imageId) => imageIdMap.get(imageId) ?? []);
|
|
879
|
+
}
|
|
880
|
+
updateLabelmapSegmentationReferences(segmentationId, viewport, labelmapImageIds, updateCallback) {
|
|
881
|
+
const referenceImageId = viewport.getCurrentImageId();
|
|
882
|
+
let viewableLabelmapImageIdFound = false;
|
|
883
|
+
for (const labelmapImageId of labelmapImageIds) {
|
|
884
|
+
const viewableImageId = viewport.isReferenceViewable({ referencedImageId: labelmapImageId }, { asOverlay: true });
|
|
885
|
+
if (viewableImageId) {
|
|
886
|
+
viewableLabelmapImageIdFound = true;
|
|
887
|
+
this.stackLabelmapImageIdReferenceMap
|
|
888
|
+
.get(segmentationId)
|
|
889
|
+
.set(referenceImageId, labelmapImageId);
|
|
890
|
+
this.updateLabelmapImageIdReferenceMap({
|
|
891
|
+
segmentationId,
|
|
892
|
+
referenceImageId,
|
|
893
|
+
labelmapImageId,
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
updateCallback?.(viewport, segmentationId, labelmapImageIds);
|
|
898
|
+
return viewableLabelmapImageIdFound
|
|
899
|
+
? this.stackLabelmapImageIdReferenceMap
|
|
900
|
+
.get(segmentationId)
|
|
901
|
+
.get(referenceImageId)
|
|
902
|
+
: undefined;
|
|
903
|
+
}
|
|
904
|
+
updateAllLabelmapSegmentationImageReferences(viewportId, segmentationId) {
|
|
905
|
+
const segmentation = this.getSegmentation(segmentationId);
|
|
906
|
+
if (!segmentation) {
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
if (!this.stackLabelmapImageIdReferenceMap.has(segmentationId)) {
|
|
910
|
+
this.stackLabelmapImageIdReferenceMap.set(segmentationId, new Map());
|
|
911
|
+
}
|
|
912
|
+
const { representationData } = segmentation;
|
|
913
|
+
if (!representationData.Labelmap) {
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
const labelmapImageIds = this.getLabelmapImageIds(representationData);
|
|
917
|
+
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElementByViewportId)(viewportId);
|
|
918
|
+
if (!enabledElement || !labelmapImageIds?.length) {
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
const stackViewport = enabledElement.viewport;
|
|
922
|
+
this.updateLabelmapSegmentationReferences(segmentationId, stackViewport, labelmapImageIds, (stackViewport, segmentationId, labelmapImageIds) => {
|
|
923
|
+
const imageIds = stackViewport.getImageIds();
|
|
924
|
+
imageIds.forEach((referenceImageId, index) => {
|
|
925
|
+
for (const labelmapImageId of labelmapImageIds) {
|
|
926
|
+
const viewableImageId = stackViewport.isReferenceViewable({ referencedImageId: labelmapImageId, sliceIndex: index }, { asOverlay: true, withNavigation: true });
|
|
927
|
+
if (viewableImageId) {
|
|
928
|
+
this.stackLabelmapImageIdReferenceMap
|
|
929
|
+
.get(segmentationId)
|
|
930
|
+
.set(referenceImageId, labelmapImageId);
|
|
931
|
+
this.updateLabelmapImageIdReferenceMap({
|
|
932
|
+
segmentationId,
|
|
933
|
+
referenceImageId,
|
|
934
|
+
labelmapImageId,
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
});
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
updateLabelmapImageIdReferenceMap({ segmentationId, referenceImageId, labelmapImageId, }) {
|
|
942
|
+
const key = this.generateMapKey({ segmentationId, referenceImageId });
|
|
943
|
+
if (!this.labelmapImageIdReferenceMap.has(key)) {
|
|
944
|
+
this.setLabelmapImageIds(segmentationId, key, [labelmapImageId]);
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
const currentValues = this.labelmapImageIdReferenceMap.get(key) ?? [];
|
|
948
|
+
const newValues = Array.from(new Set([...currentValues, labelmapImageId]));
|
|
949
|
+
this.setLabelmapImageIds(segmentationId, key, newValues);
|
|
950
|
+
}
|
|
951
|
+
generateMapKey({ segmentationId, referenceImageId }) {
|
|
952
|
+
return `${segmentationId}-${referenceImageId}`;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LabelmapImageReferenceResolver);
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
/***/ },
|
|
959
|
+
|
|
960
|
+
/***/ 91573
|
|
961
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
962
|
+
|
|
963
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
964
|
+
/* harmony export */ _: () => (/* binding */ getReferencedImageIdToCurrentImageIdMap),
|
|
965
|
+
/* harmony export */ x: () => (/* binding */ syncLegacyLabelmapData)
|
|
966
|
+
/* harmony export */ });
|
|
967
|
+
/* harmony import */ var _normalizeLabelmapSegmentationData__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(830);
|
|
968
|
+
/* harmony import */ var _labelmapLayerStore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(80973);
|
|
969
|
+
/* harmony import */ var _labelmapImageIdMapping__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(52133);
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
function syncOptionalLegacyProperty(target, key, value) {
|
|
974
|
+
if (value == null) {
|
|
975
|
+
delete target[key];
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
target[key] = value;
|
|
979
|
+
}
|
|
980
|
+
function syncLegacyLabelmapData(segmentation) {
|
|
981
|
+
const labelmapState = (0,_normalizeLabelmapSegmentationData__WEBPACK_IMPORTED_MODULE_0__/* .ensureLabelmapState */ .uk)(segmentation);
|
|
982
|
+
if (!labelmapState) {
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
const firstSegmentIndex = (0,_normalizeLabelmapSegmentationData__WEBPACK_IMPORTED_MODULE_0__/* .getSegmentOrder */ .gV)(segmentation)[0] ?? 1;
|
|
986
|
+
const primaryLabelmapId = labelmapState.primaryLabelmapId ??
|
|
987
|
+
labelmapState.segmentBindings[firstSegmentIndex]?.labelmapId ??
|
|
988
|
+
Object.keys(labelmapState.labelmaps)[0];
|
|
989
|
+
const primaryLayer = labelmapState.labelmaps[primaryLabelmapId];
|
|
990
|
+
if (!primaryLayer) {
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
syncOptionalLegacyProperty(labelmapState, 'volumeId', primaryLayer.volumeId);
|
|
994
|
+
syncOptionalLegacyProperty(labelmapState, 'referencedVolumeId', primaryLayer.referencedVolumeId);
|
|
995
|
+
syncOptionalLegacyProperty(labelmapState, 'imageIds', primaryLayer.imageIds);
|
|
996
|
+
syncOptionalLegacyProperty(labelmapState, 'referencedImageIds', primaryLayer.referencedImageIds);
|
|
997
|
+
}
|
|
998
|
+
function getReferencedImageIdToCurrentImageIdMap(segmentation) {
|
|
999
|
+
const map = new Map();
|
|
1000
|
+
(0,_labelmapLayerStore__WEBPACK_IMPORTED_MODULE_1__/* .getLabelmaps */ .m)(segmentation).forEach((layer) => {
|
|
1001
|
+
(0,_labelmapImageIdMapping__WEBPACK_IMPORTED_MODULE_2__/* .forEachLabelmapImageReference */ .Zd)(layer, (referenceImageId, labelmapImageId) => {
|
|
1002
|
+
const values = map.get(referenceImageId) ?? [];
|
|
1003
|
+
if (!values.includes(labelmapImageId)) {
|
|
1004
|
+
values.push(labelmapImageId);
|
|
1005
|
+
}
|
|
1006
|
+
map.set(referenceImageId, values);
|
|
1007
|
+
});
|
|
1008
|
+
});
|
|
1009
|
+
return map;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
/***/ },
|
|
1015
|
+
|
|
1016
|
+
/***/ 830
|
|
1017
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1018
|
+
|
|
1019
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1020
|
+
/* harmony export */ gV: () => (/* binding */ getSegmentOrder),
|
|
1021
|
+
/* harmony export */ uk: () => (/* binding */ ensureLabelmapState)
|
|
1022
|
+
/* harmony export */ });
|
|
1023
|
+
/* unused harmony exports SOURCE_REPRESENTATION_NAME, getPrimaryLabelmapId */
|
|
1024
|
+
const SOURCE_REPRESENTATION_NAME = 'binaryLabelmap';
|
|
1025
|
+
function getSegmentOrder(segmentation) {
|
|
1026
|
+
if (segmentation.segmentOrder?.length) {
|
|
1027
|
+
return [...segmentation.segmentOrder];
|
|
1028
|
+
}
|
|
1029
|
+
return Object.keys(segmentation.segments)
|
|
1030
|
+
.map(Number)
|
|
1031
|
+
.sort((a, b) => a - b);
|
|
1032
|
+
}
|
|
1033
|
+
function getPrimaryLabelmapId(segmentationId) {
|
|
1034
|
+
return `${segmentationId}-storage-0`;
|
|
1035
|
+
}
|
|
1036
|
+
function getPrimaryLabelmapType(labelmapData) {
|
|
1037
|
+
return labelmapData.volumeId ? 'volume' : 'stack';
|
|
1038
|
+
}
|
|
1039
|
+
function createPrimaryLabelmapLayer(segmentation, labelmapData, labelmapId = getPrimaryLabelmapId(segmentation.segmentationId)) {
|
|
1040
|
+
const layer = {
|
|
1041
|
+
labelmapId,
|
|
1042
|
+
type: getPrimaryLabelmapType(labelmapData),
|
|
1043
|
+
labelToSegmentIndex: {},
|
|
1044
|
+
};
|
|
1045
|
+
if (labelmapData.volumeId != null) {
|
|
1046
|
+
layer.volumeId = labelmapData.volumeId;
|
|
1047
|
+
}
|
|
1048
|
+
if (labelmapData.referencedVolumeId != null) {
|
|
1049
|
+
layer.referencedVolumeId = labelmapData.referencedVolumeId;
|
|
1050
|
+
}
|
|
1051
|
+
if (labelmapData.referencedImageIds != null) {
|
|
1052
|
+
layer.referencedImageIds = labelmapData.referencedImageIds;
|
|
1053
|
+
}
|
|
1054
|
+
if (labelmapData.imageIds != null) {
|
|
1055
|
+
layer.imageIds = labelmapData.imageIds;
|
|
1056
|
+
}
|
|
1057
|
+
return layer;
|
|
1058
|
+
}
|
|
1059
|
+
function resolvePrimaryLabelmapId(segmentation, labelmapData) {
|
|
1060
|
+
const storedLabelmapId = labelmapData.primaryLabelmapId;
|
|
1061
|
+
if (storedLabelmapId && labelmapData.labelmaps?.[storedLabelmapId]) {
|
|
1062
|
+
return storedLabelmapId;
|
|
1063
|
+
}
|
|
1064
|
+
const fallbackLabelmapId = Object.keys(labelmapData.labelmaps ?? {})[0] ??
|
|
1065
|
+
getPrimaryLabelmapId(segmentation.segmentationId);
|
|
1066
|
+
labelmapData.primaryLabelmapId = fallbackLabelmapId;
|
|
1067
|
+
return fallbackLabelmapId;
|
|
1068
|
+
}
|
|
1069
|
+
function ensureLabelmapState(segmentation) {
|
|
1070
|
+
const labelmapData = segmentation.representationData.Labelmap;
|
|
1071
|
+
if (!labelmapData) {
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
labelmapData.labelmaps ||= {};
|
|
1075
|
+
const primaryLabelmapId = resolvePrimaryLabelmapId(segmentation, labelmapData);
|
|
1076
|
+
labelmapData.labelmaps[primaryLabelmapId] ||= createPrimaryLabelmapLayer(segmentation, labelmapData, primaryLabelmapId);
|
|
1077
|
+
labelmapData.segmentBindings ||= {};
|
|
1078
|
+
labelmapData.sourceRepresentationName ||= SOURCE_REPRESENTATION_NAME;
|
|
1079
|
+
getSegmentOrder(segmentation).forEach((segmentIndex) => {
|
|
1080
|
+
labelmapData.segmentBindings[segmentIndex] ||= {
|
|
1081
|
+
labelmapId: primaryLabelmapId,
|
|
1082
|
+
labelValue: segmentIndex,
|
|
1083
|
+
};
|
|
1084
|
+
});
|
|
1085
|
+
Object.values(labelmapData.labelmaps).forEach((layer) => {
|
|
1086
|
+
layer.labelToSegmentIndex = {};
|
|
1087
|
+
});
|
|
1088
|
+
Object.entries(labelmapData.segmentBindings).forEach(([segmentIndex, binding]) => {
|
|
1089
|
+
const layer = labelmapData.labelmaps[binding.labelmapId];
|
|
1090
|
+
if (!layer) {
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
layer.labelToSegmentIndex ||= {};
|
|
1094
|
+
layer.labelToSegmentIndex[binding.labelValue] = Number(segmentIndex);
|
|
1095
|
+
});
|
|
1096
|
+
return labelmapData;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
/***/ },
|
|
1102
|
+
|
|
1103
|
+
/***/ 99380
|
|
1104
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1105
|
+
|
|
1106
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1107
|
+
/* harmony export */ J: () => (/* binding */ moveSegmentToPrivateLabelmap)
|
|
1108
|
+
/* harmony export */ });
|
|
1109
|
+
/* unused harmony export createPrivateLabelmap */
|
|
1110
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
|
|
1111
|
+
/* harmony import */ var _labelmapLayerStore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(80973);
|
|
1112
|
+
/* harmony import */ var _labelmapSegmentBindings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7296);
|
|
1113
|
+
/* harmony import */ var _labelmapLegacyAdapter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(91573);
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
function createPrivateVolumeLabelmap(segmentation, sourceLabelmap) {
|
|
1119
|
+
const sourceVolume = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getVolume(sourceLabelmap.volumeId);
|
|
1120
|
+
const volumeId = `${segmentation.segmentationId}-storage-${_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.uuidv4()}`;
|
|
1121
|
+
const referencedVolumeId = sourceLabelmap.referencedVolumeId ??
|
|
1122
|
+
sourceVolume?.referencedVolumeId ??
|
|
1123
|
+
sourceLabelmap.volumeId;
|
|
1124
|
+
const volume = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.volumeLoader.createAndCacheDerivedLabelmapVolume(referencedVolumeId, {
|
|
1125
|
+
volumeId,
|
|
1126
|
+
});
|
|
1127
|
+
return {
|
|
1128
|
+
labelmapId: volumeId,
|
|
1129
|
+
type: 'volume',
|
|
1130
|
+
volumeId,
|
|
1131
|
+
imageIds: volume.imageIds,
|
|
1132
|
+
referencedVolumeId,
|
|
1133
|
+
referencedImageIds: sourceLabelmap.referencedImageIds ?? sourceVolume?.referencedImageIds,
|
|
1134
|
+
labelToSegmentIndex: {},
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
function createPrivateStackLabelmap(segmentation, sourceLabelmap) {
|
|
1138
|
+
const referencedImageIds = sourceLabelmap.referencedImageIds ?? sourceLabelmap.imageIds ?? [];
|
|
1139
|
+
const sourceImageIds = sourceLabelmap.imageIds ?? [];
|
|
1140
|
+
const sourceImage = sourceImageIds[0]
|
|
1141
|
+
? _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getImage(sourceImageIds[0])
|
|
1142
|
+
: null;
|
|
1143
|
+
const targetType = sourceImage?.voxelManager?.getConstructor?.().name ?? 'Uint8Array';
|
|
1144
|
+
const images = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.imageLoader.createAndCacheDerivedImages(referencedImageIds, {
|
|
1145
|
+
getDerivedImageId: (referencedImageId) => `${segmentation.segmentationId}-storage-${_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.uuidv4()}-${referencedImageId.slice(-12)}`,
|
|
1146
|
+
targetBuffer: {
|
|
1147
|
+
type: targetType,
|
|
1148
|
+
},
|
|
1149
|
+
});
|
|
1150
|
+
return {
|
|
1151
|
+
labelmapId: `${segmentation.segmentationId}-storage-${_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.uuidv4()}`,
|
|
1152
|
+
type: 'stack',
|
|
1153
|
+
imageIds: images.map((image) => image.imageId),
|
|
1154
|
+
referencedVolumeId: sourceLabelmap.referencedVolumeId,
|
|
1155
|
+
referencedImageIds,
|
|
1156
|
+
labelToSegmentIndex: {},
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
function createPrivateLabelmap(segmentation, sourceLabelmap) {
|
|
1160
|
+
if (sourceLabelmap.imageIds?.length ||
|
|
1161
|
+
sourceLabelmap.referencedImageIds?.length) {
|
|
1162
|
+
return createPrivateStackLabelmap(segmentation, sourceLabelmap);
|
|
1163
|
+
}
|
|
1164
|
+
if (sourceLabelmap.volumeId) {
|
|
1165
|
+
return createPrivateVolumeLabelmap(segmentation, sourceLabelmap);
|
|
1166
|
+
}
|
|
1167
|
+
return createPrivateStackLabelmap(segmentation, sourceLabelmap);
|
|
1168
|
+
}
|
|
1169
|
+
function moveSegmentToPrivateLabelmap(segmentation, segmentIndex) {
|
|
1170
|
+
const binding = (0,_labelmapSegmentBindings__WEBPACK_IMPORTED_MODULE_2__/* .getSegmentBinding */ .hM)(segmentation, segmentIndex);
|
|
1171
|
+
if (!binding) {
|
|
1172
|
+
return;
|
|
1173
|
+
}
|
|
1174
|
+
const sourceLabelmap = (0,_labelmapLayerStore__WEBPACK_IMPORTED_MODULE_1__/* .getLabelmap */ .Hs)(segmentation, binding.labelmapId);
|
|
1175
|
+
if (!sourceLabelmap) {
|
|
1176
|
+
return;
|
|
1177
|
+
}
|
|
1178
|
+
if ((0,_labelmapSegmentBindings__WEBPACK_IMPORTED_MODULE_2__/* .getSegmentsOnLabelmap */ .I3)(segmentation, sourceLabelmap.labelmapId).length <= 1) {
|
|
1179
|
+
return sourceLabelmap;
|
|
1180
|
+
}
|
|
1181
|
+
const privateLabelmap = createPrivateLabelmap(segmentation, sourceLabelmap);
|
|
1182
|
+
(0,_labelmapLayerStore__WEBPACK_IMPORTED_MODULE_1__/* .registerLabelmap */ .AD)(segmentation, privateLabelmap);
|
|
1183
|
+
if (sourceLabelmap.volumeId && privateLabelmap.volumeId) {
|
|
1184
|
+
const sourceVolume = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getVolume(sourceLabelmap.volumeId);
|
|
1185
|
+
const targetVolume = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getVolume(privateLabelmap.volumeId);
|
|
1186
|
+
sourceVolume.voxelManager.forEach(({ value, index }) => {
|
|
1187
|
+
if (value !== binding.labelValue) {
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
targetVolume.voxelManager.setAtIndex(index, 1);
|
|
1191
|
+
sourceVolume.voxelManager.setAtIndex(index, 0);
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
else {
|
|
1195
|
+
const sourceImageIds = sourceLabelmap.imageIds ?? [];
|
|
1196
|
+
const targetImageIds = privateLabelmap.imageIds ?? [];
|
|
1197
|
+
sourceImageIds.forEach((imageId, imageIndex) => {
|
|
1198
|
+
const sourceImage = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getImage(imageId);
|
|
1199
|
+
const targetImage = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getImage(targetImageIds[imageIndex]);
|
|
1200
|
+
if (!sourceImage || !targetImage) {
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
sourceImage.voxelManager.forEach(({ value, index }) => {
|
|
1204
|
+
if (value !== binding.labelValue) {
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
targetImage.voxelManager.setAtIndex(index, 1);
|
|
1208
|
+
sourceImage.voxelManager.setAtIndex(index, 0);
|
|
1209
|
+
});
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
(0,_labelmapSegmentBindings__WEBPACK_IMPORTED_MODULE_2__/* .setSegmentBinding */ .Zs)(segmentation, segmentIndex, {
|
|
1213
|
+
labelmapId: privateLabelmap.labelmapId,
|
|
1214
|
+
labelValue: 1,
|
|
1215
|
+
});
|
|
1216
|
+
(0,_labelmapLegacyAdapter__WEBPACK_IMPORTED_MODULE_3__/* .syncLegacyLabelmapData */ .x)(segmentation);
|
|
1217
|
+
return privateLabelmap;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
|
|
362
1222
|
/***/ },
|
|
363
1223
|
|
|
364
1224
|
/***/ 57999
|
|
@@ -2090,7 +2950,6 @@ var SegmentationStateManager = __webpack_require__(59475);
|
|
|
2090
2950
|
|
|
2091
2951
|
|
|
2092
2952
|
class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
2093
|
-
static { this.PreviewSegmentIndex = 255; }
|
|
2094
2953
|
constructor(toolProps, defaultToolProps) {
|
|
2095
2954
|
super(toolProps, defaultToolProps);
|
|
2096
2955
|
if (this.configuration.interpolation?.enabled) {
|
|
@@ -2234,482 +3093,43 @@ class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
|
2234
3093
|
textbox: {
|
|
2235
3094
|
color,
|
|
2236
3095
|
},
|
|
2237
|
-
visibility,
|
|
2238
|
-
locked: annotationLocked,
|
|
2239
|
-
};
|
|
2240
|
-
}
|
|
2241
|
-
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
/***/ },
|
|
2246
|
-
|
|
2247
|
-
/***/ 67772
|
|
2248
|
-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2249
|
-
|
|
2250
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2251
|
-
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
2252
|
-
/* harmony export */ });
|
|
2253
|
-
const defaultContourConfig = {
|
|
2254
|
-
renderOutline: true,
|
|
2255
|
-
outlineWidthAutoGenerated: 3,
|
|
2256
|
-
outlineWidth: 1,
|
|
2257
|
-
outlineWidthInactive: 1,
|
|
2258
|
-
outlineOpacity: 1,
|
|
2259
|
-
outlineOpacityInactive: 0.85,
|
|
2260
|
-
outlineDash: undefined,
|
|
2261
|
-
outlineDashInactive: undefined,
|
|
2262
|
-
outlineDashAutoGenerated: '5,3',
|
|
2263
|
-
activeSegmentOutlineWidthDelta: 0,
|
|
2264
|
-
renderFill: true,
|
|
2265
|
-
fillAlpha: 0.5,
|
|
2266
|
-
fillAlphaInactive: 0.3,
|
|
2267
|
-
fillAlphaAutoGenerated: 0.3,
|
|
2268
|
-
};
|
|
2269
|
-
function getDefaultContourStyle() {
|
|
2270
|
-
return defaultContourConfig;
|
|
2271
|
-
}
|
|
2272
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getDefaultContourStyle);
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
/***/ },
|
|
2276
|
-
|
|
2277
|
-
/***/ 22384
|
|
2278
|
-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
// EXPORTS
|
|
2282
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
2283
|
-
d: () => (/* binding */ handleContourSegmentation)
|
|
2284
|
-
});
|
|
2285
|
-
|
|
2286
|
-
// UNUSED EXPORTS: addContourSetsToElement
|
|
2287
|
-
|
|
2288
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/annotation/annotationState.js
|
|
2289
|
-
var annotationState = __webpack_require__(82056);
|
|
2290
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 1 modules
|
|
2291
|
-
var esm = __webpack_require__(15327);
|
|
2292
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/annotationHydration.js
|
|
2293
|
-
var annotationHydration = __webpack_require__(64485);
|
|
2294
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contourSegmentation/index.js + 1 modules
|
|
2295
|
-
var contourSegmentation = __webpack_require__(56534);
|
|
2296
|
-
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/CellArray.js
|
|
2297
|
-
var CellArray = __webpack_require__(32461);
|
|
2298
|
-
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/Points.js
|
|
2299
|
-
var Points = __webpack_require__(74973);
|
|
2300
|
-
// EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/PolyData.js + 7 modules
|
|
2301
|
-
var PolyData = __webpack_require__(27480);
|
|
2302
|
-
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Contour/contourHandler/utils.js
|
|
2303
|
-
/* unused harmony import specifier */ var Enums;
|
|
2304
|
-
/* unused harmony import specifier */ var vtkCellArray;
|
|
2305
|
-
/* unused harmony import specifier */ var vtkPoints;
|
|
2306
|
-
/* unused harmony import specifier */ var vtkPolyData;
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
function validateGeometry(geometry) {
|
|
2312
|
-
if (!geometry) {
|
|
2313
|
-
throw new Error(`No contours found for geometryId ${geometry.id}`);
|
|
2314
|
-
}
|
|
2315
|
-
const geometryId = geometry.id;
|
|
2316
|
-
if (geometry.type !== esm.Enums.GeometryType.CONTOUR) {
|
|
2317
|
-
throw new Error(`Geometry type ${geometry.type} not supported for rendering.`);
|
|
2318
|
-
}
|
|
2319
|
-
if (!geometry.data) {
|
|
2320
|
-
console.warn(`No contours found for geometryId ${geometryId}. Skipping render.`);
|
|
2321
|
-
return;
|
|
2322
|
-
}
|
|
2323
|
-
}
|
|
2324
|
-
function getPolyData(contourSet) {
|
|
2325
|
-
const pointArray = [];
|
|
2326
|
-
const points = vtkPoints.newInstance();
|
|
2327
|
-
const lines = vtkCellArray.newInstance();
|
|
2328
|
-
let pointIndex = 0;
|
|
2329
|
-
contourSet.contours.forEach((contour) => {
|
|
2330
|
-
const pointList = contour.points;
|
|
2331
|
-
const flatPoints = contour.flatPointsArray;
|
|
2332
|
-
const type = contour.type;
|
|
2333
|
-
const pointIndexes = pointList.map((_, pointListIndex) => pointListIndex + pointIndex);
|
|
2334
|
-
if (type === Enums.ContourType.CLOSED_PLANAR) {
|
|
2335
|
-
pointIndexes.push(pointIndexes[0]);
|
|
2336
|
-
}
|
|
2337
|
-
const linePoints = Float32Array.from(flatPoints);
|
|
2338
|
-
pointArray.push(...linePoints);
|
|
2339
|
-
lines.insertNextCell([...pointIndexes]);
|
|
2340
|
-
pointIndex = pointIndex + pointList.length;
|
|
2341
|
-
});
|
|
2342
|
-
points.setData(pointArray, 3);
|
|
2343
|
-
const polygon = vtkPolyData.newInstance();
|
|
2344
|
-
polygon.setPoints(points);
|
|
2345
|
-
polygon.setLines(lines);
|
|
2346
|
-
return polygon;
|
|
2347
|
-
}
|
|
2348
|
-
|
|
2349
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/enums/index.js + 3 modules
|
|
2350
|
-
var enums = __webpack_require__(29857);
|
|
2351
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/SegmentationStyle.js
|
|
2352
|
-
var SegmentationStyle = __webpack_require__(92686);
|
|
2353
|
-
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
function handleContourSegmentation(viewport, geometryIds, annotationUIDsMap, contourRepresentation) {
|
|
2362
|
-
if (annotationUIDsMap.size) {
|
|
2363
|
-
viewport.render();
|
|
2364
|
-
}
|
|
2365
|
-
else {
|
|
2366
|
-
addContourSetsToElement(viewport, geometryIds, contourRepresentation);
|
|
2367
|
-
}
|
|
2368
|
-
}
|
|
2369
|
-
function addContourSetsToElement(viewport, geometryIds, contourRepresentation) {
|
|
2370
|
-
const { segmentationId } = contourRepresentation;
|
|
2371
|
-
const segmentSpecificMap = new Map();
|
|
2372
|
-
geometryIds.forEach((geometryId) => {
|
|
2373
|
-
const geometry = esm.cache.getGeometry(geometryId);
|
|
2374
|
-
if (!geometry) {
|
|
2375
|
-
console.warn(`No geometry found for geometryId ${geometryId}. Skipping render.`);
|
|
2376
|
-
return;
|
|
2377
|
-
}
|
|
2378
|
-
const segmentIndex = geometry.data.segmentIndex;
|
|
2379
|
-
validateGeometry(geometry);
|
|
2380
|
-
const segmentSpecificConfig = SegmentationStyle/* segmentationStyle */.Y.getStyle({
|
|
2381
|
-
viewportId: viewport.id,
|
|
2382
|
-
segmentationId,
|
|
2383
|
-
type: enums.SegmentationRepresentations.Contour,
|
|
2384
|
-
segmentIndex,
|
|
2385
|
-
});
|
|
2386
|
-
const contourSet = geometry.data;
|
|
2387
|
-
const viewPlaneNormal = viewport.getCamera().viewPlaneNormal;
|
|
2388
|
-
contourSet.contours.forEach((contour) => {
|
|
2389
|
-
const { points, color, id } = contour;
|
|
2390
|
-
const referencedImageId = (0,annotationHydration/* getClosestImageIdForStackViewport */.x)(viewport, points[0], viewPlaneNormal);
|
|
2391
|
-
const contourSegmentationAnnotation = {
|
|
2392
|
-
annotationUID: esm.utilities.uuidv4(),
|
|
2393
|
-
data: {
|
|
2394
|
-
contour: {
|
|
2395
|
-
closed: true,
|
|
2396
|
-
polyline: points,
|
|
2397
|
-
},
|
|
2398
|
-
segmentation: {
|
|
2399
|
-
segmentationId,
|
|
2400
|
-
segmentIndex,
|
|
2401
|
-
color,
|
|
2402
|
-
id,
|
|
2403
|
-
},
|
|
2404
|
-
handles: {},
|
|
2405
|
-
},
|
|
2406
|
-
handles: {},
|
|
2407
|
-
highlighted: false,
|
|
2408
|
-
autoGenerated: false,
|
|
2409
|
-
invalidated: false,
|
|
2410
|
-
isLocked: true,
|
|
2411
|
-
isVisible: true,
|
|
2412
|
-
metadata: {
|
|
2413
|
-
referencedImageId,
|
|
2414
|
-
toolName: 'PlanarFreehandContourSegmentationTool',
|
|
2415
|
-
FrameOfReferenceUID: viewport.getFrameOfReferenceUID(),
|
|
2416
|
-
viewPlaneNormal: viewport.getCamera().viewPlaneNormal,
|
|
2417
|
-
},
|
|
2418
|
-
};
|
|
2419
|
-
const annotationGroupSelector = viewport.element;
|
|
2420
|
-
(0,annotationState.addAnnotation)(contourSegmentationAnnotation, annotationGroupSelector);
|
|
2421
|
-
(0,contourSegmentation.addContourSegmentationAnnotation)(contourSegmentationAnnotation);
|
|
2422
|
-
});
|
|
2423
|
-
if (segmentSpecificConfig) {
|
|
2424
|
-
segmentSpecificMap.set(segmentIndex, segmentSpecificConfig);
|
|
2425
|
-
}
|
|
2426
|
-
});
|
|
2427
|
-
viewport.render();
|
|
2428
|
-
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
/***/ },
|
|
2433
|
-
|
|
2434
|
-
/***/ 87420
|
|
2435
|
-
(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
|
|
2436
|
-
|
|
2437
|
-
/* unused harmony import specifier */ var getSegmentation;
|
|
2438
|
-
/* unused harmony import specifier */ var removeAnnotation;
|
|
2439
|
-
/* harmony import */ var _stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33283);
|
|
2440
|
-
/* harmony import */ var _stateManagement__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6802);
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
function removeContourFromElement(viewportId, segmentationId, removeFromCache = false) {
|
|
2444
|
-
const segmentation = getSegmentation(segmentationId);
|
|
2445
|
-
const { annotationUIDsMap } = segmentation.representationData.Contour;
|
|
2446
|
-
annotationUIDsMap.forEach((annotationSet) => {
|
|
2447
|
-
annotationSet.forEach((annotationUID) => {
|
|
2448
|
-
removeAnnotation(annotationUID);
|
|
2449
|
-
});
|
|
2450
|
-
});
|
|
2451
|
-
}
|
|
2452
|
-
/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (removeContourFromElement)));
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
/***/ },
|
|
2456
|
-
|
|
2457
|
-
/***/ 63597
|
|
2458
|
-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
// EXPORTS
|
|
2462
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
2463
|
-
A: () => (/* binding */ Labelmap_addLabelmapToElement)
|
|
2464
|
-
});
|
|
2465
|
-
|
|
2466
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 1 modules
|
|
2467
|
-
var esm = __webpack_require__(15327);
|
|
2468
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getCurrentLabelmapImageIdForViewport.js
|
|
2469
|
-
var getCurrentLabelmapImageIdForViewport = __webpack_require__(97577);
|
|
2470
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getSegmentation.js
|
|
2471
|
-
var getSegmentation = __webpack_require__(33283);
|
|
2472
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.js
|
|
2473
|
-
var triggerSegmentationEvents = __webpack_require__(49906);
|
|
2474
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/enums/index.js + 3 modules
|
|
2475
|
-
var enums = __webpack_require__(29857);
|
|
2476
|
-
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Labelmap/addVolumesAsIndependentComponents.js
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
const internalCache = new Map();
|
|
2481
|
-
const load = ({ cfun, ofun, actor }) => {
|
|
2482
|
-
actor.getProperty().setRGBTransferFunction(1, cfun);
|
|
2483
|
-
actor.getProperty().setScalarOpacity(1, ofun);
|
|
2484
|
-
};
|
|
2485
|
-
async function addVolumesAsIndependentComponents({ viewport, volumeInputs, segmentationId, }) {
|
|
2486
|
-
const defaultActor = viewport.getDefaultActor();
|
|
2487
|
-
const { actor } = defaultActor;
|
|
2488
|
-
const { uid } = defaultActor;
|
|
2489
|
-
const referenceVolumeId = viewport.getVolumeId();
|
|
2490
|
-
if (internalCache.get(uid)?.added) {
|
|
2491
|
-
return {
|
|
2492
|
-
uid,
|
|
2493
|
-
actor,
|
|
2494
|
-
};
|
|
2495
|
-
}
|
|
2496
|
-
const volumeInputArray = volumeInputs;
|
|
2497
|
-
const firstImageVolume = esm.cache.getVolume(volumeInputArray[0].volumeId);
|
|
2498
|
-
if (!firstImageVolume) {
|
|
2499
|
-
throw new Error(`imageVolume with id: ${firstImageVolume.volumeId} does not exist`);
|
|
2500
|
-
}
|
|
2501
|
-
const { volumeId } = volumeInputArray[0];
|
|
2502
|
-
const segImageVolume = await esm.volumeLoader.loadVolume(volumeId);
|
|
2503
|
-
if (!segImageVolume) {
|
|
2504
|
-
throw new Error(`segImageVolume with id: ${segImageVolume.volumeId} does not exist`);
|
|
2505
|
-
}
|
|
2506
|
-
const segVoxelManager = segImageVolume.voxelManager;
|
|
2507
|
-
const segData = segVoxelManager.getCompleteScalarDataArray();
|
|
2508
|
-
const { imageData: segImageData } = segImageVolume;
|
|
2509
|
-
const baseVolume = esm.cache.getVolume(referenceVolumeId);
|
|
2510
|
-
const volumeTexture = baseVolume.vtkOpenGLTexture;
|
|
2511
|
-
const hasPendingFrames = volumeTexture.hasUpdatedFrames();
|
|
2512
|
-
if (hasPendingFrames) {
|
|
2513
|
-
return;
|
|
2514
|
-
}
|
|
2515
|
-
const baseVoxelManager = baseVolume.voxelManager;
|
|
2516
|
-
const baseData = baseVoxelManager.getCompleteScalarDataArray();
|
|
2517
|
-
const newComp = 2;
|
|
2518
|
-
const cubeData = new Float32Array(newComp * baseVolume.voxelManager.getScalarDataLength());
|
|
2519
|
-
const dims = segImageData.getDimensions();
|
|
2520
|
-
for (let z = 0; z < dims[2]; ++z) {
|
|
2521
|
-
for (let y = 0; y < dims[1]; ++y) {
|
|
2522
|
-
for (let x = 0; x < dims[0]; ++x) {
|
|
2523
|
-
const iTuple = x + dims[0] * (y + dims[1] * z);
|
|
2524
|
-
cubeData[iTuple * newComp + 0] = baseData[iTuple];
|
|
2525
|
-
cubeData[iTuple * newComp + 1] = segData[iTuple];
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
}
|
|
2529
|
-
viewport.removeActors([uid]);
|
|
2530
|
-
const oldMapper = actor.getMapper();
|
|
2531
|
-
const mapper = (0,esm.convertMapperToNotSharedMapper)(oldMapper);
|
|
2532
|
-
actor.setMapper(mapper);
|
|
2533
|
-
mapper.setBlendMode(esm.Enums.BlendModes.LABELMAP_EDGE_PROJECTION_BLEND);
|
|
2534
|
-
const arrayAgain = mapper.getInputData().getPointData().getArray(0);
|
|
2535
|
-
arrayAgain.setData(cubeData);
|
|
2536
|
-
arrayAgain.setNumberOfComponents(2);
|
|
2537
|
-
const oldColorMixPreset = actor.getProperty().getColorMixPreset();
|
|
2538
|
-
actor.getProperty().setColorMixPreset(1);
|
|
2539
|
-
const oldForceNearestInterpolation = actor
|
|
2540
|
-
.getProperty()
|
|
2541
|
-
.getForceNearestInterpolation(1);
|
|
2542
|
-
actor.getProperty().setForceNearestInterpolation(1, true);
|
|
2543
|
-
const oldIndependentComponents = actor
|
|
2544
|
-
.getProperty()
|
|
2545
|
-
.getIndependentComponents();
|
|
2546
|
-
actor.getProperty().setIndependentComponents(true);
|
|
2547
|
-
viewport.addActor({
|
|
2548
|
-
...defaultActor,
|
|
2549
|
-
representationUID: `${segmentationId}-${enums.SegmentationRepresentations.Labelmap}`,
|
|
2550
|
-
});
|
|
2551
|
-
internalCache.set(uid, {
|
|
2552
|
-
added: true,
|
|
2553
|
-
segmentationRepresentationUID: `${segmentationId}`,
|
|
2554
|
-
originalBlendMode: viewport.getBlendMode(),
|
|
2555
|
-
});
|
|
2556
|
-
const oldPreLoad = actor.get('preLoad');
|
|
2557
|
-
actor.set({
|
|
2558
|
-
preLoad: load,
|
|
2559
|
-
});
|
|
2560
|
-
function onSegmentationDataModified(evt) {
|
|
2561
|
-
const { segmentationId } = evt.detail;
|
|
2562
|
-
const { representationData } = (0,getSegmentation/* getSegmentation */.T)(segmentationId);
|
|
2563
|
-
const { volumeId: segVolumeId } = representationData.Labelmap;
|
|
2564
|
-
if (segVolumeId !== segImageVolume.volumeId) {
|
|
2565
|
-
return;
|
|
2566
|
-
}
|
|
2567
|
-
const segmentationVolume = esm.cache.getVolume(segVolumeId);
|
|
2568
|
-
const segVoxelManager = segmentationVolume.voxelManager;
|
|
2569
|
-
const imageData = mapper.getInputData();
|
|
2570
|
-
const array = imageData.getPointData().getArray(0);
|
|
2571
|
-
const baseData = array.getData();
|
|
2572
|
-
const newComp = 2;
|
|
2573
|
-
const dims = segImageData.getDimensions();
|
|
2574
|
-
const slices = Array.from({ length: dims[2] }, (_, i) => i);
|
|
2575
|
-
for (const z of slices) {
|
|
2576
|
-
for (let y = 0; y < dims[1]; ++y) {
|
|
2577
|
-
for (let x = 0; x < dims[0]; ++x) {
|
|
2578
|
-
const iTuple = x + dims[0] * (y + dims[1] * z);
|
|
2579
|
-
baseData[iTuple * newComp + 1] = segVoxelManager.getAtIndex(iTuple);
|
|
2580
|
-
}
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2583
|
-
array.setData(baseData);
|
|
2584
|
-
imageData.modified();
|
|
2585
|
-
viewport.render();
|
|
2586
|
-
}
|
|
2587
|
-
esm.eventTarget.addEventListenerDebounced(enums.Events.SEGMENTATION_DATA_MODIFIED, onSegmentationDataModified, 200);
|
|
2588
|
-
function onSegmentationRepresentationRemoved(evt) {
|
|
2589
|
-
if (evt.detail.viewportId !== viewport.id) {
|
|
2590
|
-
return;
|
|
2591
|
-
}
|
|
2592
|
-
esm.eventTarget.removeEventListener(enums.Events.SEGMENTATION_DATA_MODIFIED, onSegmentationDataModified);
|
|
2593
|
-
esm.eventTarget.removeEventListener(enums.Events.SEGMENTATION_REPRESENTATION_REMOVED, onSegmentationRepresentationRemoved);
|
|
2594
|
-
const actorEntry = viewport.getActor(uid);
|
|
2595
|
-
if (actorEntry) {
|
|
2596
|
-
viewport.removeActors([uid]);
|
|
2597
|
-
}
|
|
2598
|
-
internalCache.delete(uid);
|
|
2599
|
-
if (viewport.isDisabled) {
|
|
2600
|
-
return;
|
|
2601
|
-
}
|
|
2602
|
-
actor.setMapper(oldMapper);
|
|
2603
|
-
actor.getProperty().setColorMixPreset(oldColorMixPreset);
|
|
2604
|
-
actor
|
|
2605
|
-
.getProperty()
|
|
2606
|
-
.setForceNearestInterpolation(1, oldForceNearestInterpolation);
|
|
2607
|
-
actor.getProperty().setIndependentComponents(oldIndependentComponents);
|
|
2608
|
-
viewport.addActor({
|
|
2609
|
-
...defaultActor,
|
|
2610
|
-
});
|
|
2611
|
-
actor.set(oldPreLoad);
|
|
2612
|
-
viewport.render();
|
|
3096
|
+
visibility,
|
|
3097
|
+
locked: annotationLocked,
|
|
3098
|
+
};
|
|
2613
3099
|
}
|
|
2614
|
-
esm.eventTarget.addEventListener(enums.Events.SEGMENTATION_REPRESENTATION_REMOVED, onSegmentationRepresentationRemoved);
|
|
2615
|
-
return {
|
|
2616
|
-
uid,
|
|
2617
|
-
actor,
|
|
2618
|
-
};
|
|
2619
3100
|
}
|
|
2620
|
-
|
|
2621
|
-
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js
|
|
2622
|
-
|
|
3101
|
+
ContourSegmentationBaseTool.PreviewSegmentIndex = 255;
|
|
2623
3102
|
|
|
2624
3103
|
|
|
2625
3104
|
|
|
3105
|
+
/***/ },
|
|
2626
3106
|
|
|
3107
|
+
/***/ 67772
|
|
3108
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2627
3109
|
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
const refDims = baseVolume.dimensions;
|
|
2650
|
-
if (segDims[0] !== refDims[0] ||
|
|
2651
|
-
segDims[1] !== refDims[1] ||
|
|
2652
|
-
segDims[2] !== refDims[2]) {
|
|
2653
|
-
useIndependentComponents = false;
|
|
2654
|
-
blendMode = esm.Enums.BlendModes.MAXIMUM_INTENSITY_BLEND;
|
|
2655
|
-
console.debug('Dimensions mismatch - falling back to regular volume addition');
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
const volumeInputs = [
|
|
2659
|
-
{
|
|
2660
|
-
volumeId,
|
|
2661
|
-
visibility,
|
|
2662
|
-
representationUID: `${segmentationId}-${enums.SegmentationRepresentations.Labelmap}`,
|
|
2663
|
-
useIndependentComponents,
|
|
2664
|
-
blendMode,
|
|
2665
|
-
},
|
|
2666
|
-
];
|
|
2667
|
-
if (!volumeInputs[0].useIndependentComponents) {
|
|
2668
|
-
await (0,esm.addVolumesToViewports)(renderingEngine, volumeInputs, [viewportId], immediateRender, suppressEvents);
|
|
2669
|
-
}
|
|
2670
|
-
else {
|
|
2671
|
-
const result = await addVolumesAsIndependentComponents({
|
|
2672
|
-
viewport,
|
|
2673
|
-
volumeInputs,
|
|
2674
|
-
segmentationId,
|
|
2675
|
-
});
|
|
2676
|
-
return result;
|
|
2677
|
-
}
|
|
2678
|
-
}
|
|
2679
|
-
else {
|
|
2680
|
-
const segmentationImageIds = (0,getCurrentLabelmapImageIdForViewport/* getCurrentLabelmapImageIdsForViewport */.aF)(viewport.id, segmentationId);
|
|
2681
|
-
const stackInputs = segmentationImageIds.map((imageId) => ({
|
|
2682
|
-
imageId,
|
|
2683
|
-
representationUID: `${segmentationId}-${enums.SegmentationRepresentations.Labelmap}-${imageId}`,
|
|
2684
|
-
}));
|
|
2685
|
-
(0,esm.addImageSlicesToViewports)(renderingEngine, stackInputs, [viewportId]);
|
|
2686
|
-
}
|
|
2687
|
-
(0,triggerSegmentationEvents.triggerSegmentationDataModified)(segmentationId);
|
|
2688
|
-
}
|
|
2689
|
-
function _ensureVolumeHasVolumeId(labelMapData, segmentationId) {
|
|
2690
|
-
let { volumeId } = labelMapData;
|
|
2691
|
-
if (!volumeId) {
|
|
2692
|
-
volumeId = uuidv4();
|
|
2693
|
-
const segmentation = (0,getSegmentation/* getSegmentation */.T)(segmentationId);
|
|
2694
|
-
segmentation.representationData.Labelmap = {
|
|
2695
|
-
...segmentation.representationData.Labelmap,
|
|
2696
|
-
volumeId,
|
|
2697
|
-
};
|
|
2698
|
-
labelMapData.volumeId = volumeId;
|
|
2699
|
-
(0,triggerSegmentationEvents.triggerSegmentationModified)(segmentationId);
|
|
2700
|
-
}
|
|
2701
|
-
return volumeId;
|
|
2702
|
-
}
|
|
2703
|
-
async function _handleMissingVolume(labelMapData) {
|
|
2704
|
-
const stackData = labelMapData;
|
|
2705
|
-
const hasImageIds = stackData.imageIds.length > 0;
|
|
2706
|
-
if (!hasImageIds) {
|
|
2707
|
-
throw new Error('cannot create labelmap, no imageIds found for the volume labelmap');
|
|
2708
|
-
}
|
|
2709
|
-
const volume = await esm.volumeLoader.createAndCacheVolumeFromImages(labelMapData.volumeId || uuidv4(), stackData.imageIds);
|
|
2710
|
-
return volume;
|
|
3110
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3111
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
3112
|
+
/* harmony export */ });
|
|
3113
|
+
const defaultContourConfig = {
|
|
3114
|
+
renderOutline: true,
|
|
3115
|
+
outlineWidthAutoGenerated: 3,
|
|
3116
|
+
outlineWidth: 1,
|
|
3117
|
+
outlineWidthInactive: 1,
|
|
3118
|
+
outlineOpacity: 1,
|
|
3119
|
+
outlineOpacityInactive: 0.85,
|
|
3120
|
+
outlineDash: undefined,
|
|
3121
|
+
outlineDashInactive: undefined,
|
|
3122
|
+
outlineDashAutoGenerated: '5,3',
|
|
3123
|
+
activeSegmentOutlineWidthDelta: 0,
|
|
3124
|
+
renderFill: true,
|
|
3125
|
+
fillAlpha: 0.5,
|
|
3126
|
+
fillAlphaInactive: 0.3,
|
|
3127
|
+
fillAlphaAutoGenerated: 0.3,
|
|
3128
|
+
};
|
|
3129
|
+
function getDefaultContourStyle() {
|
|
3130
|
+
return defaultContourConfig;
|
|
2711
3131
|
}
|
|
2712
|
-
/* harmony default export */ const
|
|
3132
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getDefaultContourStyle);
|
|
2713
3133
|
|
|
2714
3134
|
|
|
2715
3135
|
/***/ },
|
|
@@ -2741,181 +3161,177 @@ function getDefaultLabelmapStyle() {
|
|
|
2741
3161
|
|
|
2742
3162
|
/***/ },
|
|
2743
3163
|
|
|
2744
|
-
/***/
|
|
3164
|
+
/***/ 18543
|
|
2745
3165
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2746
3166
|
|
|
2747
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2748
|
-
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
2749
|
-
/* harmony export */ });
|
|
2750
|
-
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
|
|
2751
|
-
/* harmony import */ var _stateManagement_segmentation_helpers_getSegmentationActor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(59452);
|
|
2752
3167
|
|
|
3168
|
+
// EXPORTS
|
|
3169
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
3170
|
+
A: () => (/* binding */ strategies_BrushStrategy)
|
|
3171
|
+
});
|
|
2753
3172
|
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
3173
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.js
|
|
3174
|
+
var triggerSegmentationEvents = __webpack_require__(49906);
|
|
3175
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/strategies/compositions/index.js + 11 modules
|
|
3176
|
+
var compositions = __webpack_require__(64664);
|
|
3177
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js
|
|
3178
|
+
var getStrategyData = __webpack_require__(40905);
|
|
3179
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/enums/index.js + 3 modules
|
|
3180
|
+
var enums = __webpack_require__(29857);
|
|
3181
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getSegmentation.js
|
|
3182
|
+
var getSegmentation = __webpack_require__(33283);
|
|
3183
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/helpers/labelmapSegmentationState.js
|
|
3184
|
+
var labelmapSegmentationState = __webpack_require__(90660);
|
|
3185
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/strategies/utils/crossLayerErase.js
|
|
3186
|
+
/* unused harmony import specifier */ var crossLayerErase_getSegmentation;
|
|
3187
|
+
/* unused harmony import specifier */ var collectCrossLayerEraseBindings;
|
|
3188
|
+
|
|
3189
|
+
|
|
3190
|
+
function collectCrossLayerEraseBindingsForOperation(operationData) {
|
|
3191
|
+
const { segmentationId, labelmapId, overwriteSegmentIndices } = operationData;
|
|
3192
|
+
const segmentation = crossLayerErase_getSegmentation(segmentationId);
|
|
3193
|
+
operationData.crossLayerEraseBindings = segmentation
|
|
3194
|
+
? collectCrossLayerEraseBindings(segmentation, labelmapId, overwriteSegmentIndices)
|
|
3195
|
+
: [];
|
|
3196
|
+
}
|
|
3197
|
+
function eraseCrossLayerOverwrites(operationData) {
|
|
3198
|
+
const segmentation = (0,getSegmentation/* getSegmentation */.T)(operationData.segmentationId);
|
|
3199
|
+
if (!segmentation) {
|
|
3200
|
+
return [];
|
|
2760
3201
|
}
|
|
3202
|
+
return (0,labelmapSegmentationState/* eraseLabelmapEditTransactionOverwrites */.Ry)(segmentation, operationData.labelmapEditTransaction, {
|
|
3203
|
+
viewport: operationData.viewport,
|
|
3204
|
+
referenceImageData: operationData.segmentationImageData,
|
|
3205
|
+
isInObject: operationData.isInObject,
|
|
3206
|
+
isInObjectBoundsIJK: operationData.isInObjectBoundsIJK,
|
|
3207
|
+
imageId: operationData.imageId,
|
|
3208
|
+
});
|
|
2761
3209
|
}
|
|
2762
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (removeLabelmapFromElement);
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
/***/ },
|
|
2766
|
-
|
|
2767
|
-
/***/ 18796
|
|
2768
|
-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2769
|
-
|
|
2770
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2771
|
-
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
2772
|
-
/* harmony export */ });
|
|
2773
|
-
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
|
|
2774
|
-
/* harmony import */ var _kitware_vtk_js_Rendering_Core_Mapper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81418);
|
|
2775
|
-
/* harmony import */ var _kitware_vtk_js_Rendering_Core_Actor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44404);
|
|
2776
|
-
/* harmony import */ var _kitware_vtk_js_Common_DataModel_PolyData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(27480);
|
|
2777
|
-
/* harmony import */ var _kitware_vtk_js_Common_Core_CellArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(32461);
|
|
2778
|
-
/* harmony import */ var _stateManagement_segmentation_helpers_getSegmentationActor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(59452);
|
|
2779
3210
|
|
|
2780
3211
|
|
|
3212
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/config.js
|
|
3213
|
+
var config = __webpack_require__(36625);
|
|
3214
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getSegmentationRepresentation.js
|
|
3215
|
+
var getSegmentationRepresentation = __webpack_require__(93210);
|
|
3216
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/strategies/utils/overwritePolicy.js
|
|
2781
3217
|
|
|
2782
3218
|
|
|
2783
3219
|
|
|
2784
3220
|
|
|
2785
|
-
function
|
|
2786
|
-
const
|
|
2787
|
-
const
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
surfaceActor.setVisibility(isVisible);
|
|
2791
|
-
if (!isVisible) {
|
|
2792
|
-
return;
|
|
2793
|
-
}
|
|
2794
|
-
const surfaceMapper = surfaceActor.getMapper();
|
|
2795
|
-
const currentPolyData = surfaceMapper.getInputData();
|
|
2796
|
-
const newPoints = surface.points;
|
|
2797
|
-
const newPolys = surface.polys;
|
|
2798
|
-
const currentPoints = currentPolyData.getPoints().getData();
|
|
2799
|
-
const currentPolys = currentPolyData.getPolys().getData();
|
|
2800
|
-
if (newPoints.length === currentPoints.length &&
|
|
2801
|
-
newPolys.length === currentPolys.length) {
|
|
2802
|
-
return;
|
|
2803
|
-
}
|
|
2804
|
-
const polyData = _kitware_vtk_js_Common_DataModel_PolyData__WEBPACK_IMPORTED_MODULE_3__/* ["default"].newInstance */ .Ay.newInstance();
|
|
2805
|
-
polyData.getPoints().setData(newPoints, 3);
|
|
2806
|
-
const triangles = _kitware_vtk_js_Common_Core_CellArray__WEBPACK_IMPORTED_MODULE_4__/* ["default"].newInstance */ .Ay.newInstance({
|
|
2807
|
-
values: Float32Array.from(newPolys),
|
|
2808
|
-
});
|
|
2809
|
-
polyData.setPolys(triangles);
|
|
2810
|
-
surfaceMapper.setInputData(polyData);
|
|
2811
|
-
surfaceMapper.modified();
|
|
2812
|
-
viewport.getRenderer().resetCameraClippingRange();
|
|
2813
|
-
return;
|
|
3221
|
+
function resolveOverwriteSegmentIndices(operationData) {
|
|
3222
|
+
const { segmentationId, segmentIndex, segmentsLocked, viewport } = operationData;
|
|
3223
|
+
const segmentation = (0,getSegmentation/* getSegmentation */.T)(segmentationId);
|
|
3224
|
+
if (!segmentation || segmentIndex === 0) {
|
|
3225
|
+
return [];
|
|
2814
3226
|
}
|
|
2815
|
-
const
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
actor.getProperty().setColor(color[0] / 255, color[1] / 255, color[2] / 255);
|
|
2830
|
-
actor.getProperty().setLineWidth(2);
|
|
2831
|
-
const representationUID = (0,_stateManagement_segmentation_helpers_getSegmentationActor__WEBPACK_IMPORTED_MODULE_5__/* .getSurfaceRepresentationUID */ .DU)(segmentationId, surface.segmentIndex);
|
|
2832
|
-
viewport.addActor({
|
|
2833
|
-
uid: _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.uuidv4(),
|
|
2834
|
-
actor: actor,
|
|
2835
|
-
clippingFilter,
|
|
2836
|
-
representationUID,
|
|
3227
|
+
const overwriteMode = (0,config/* getConfig */.zj)().segmentation?.overwriteMode ?? 'all';
|
|
3228
|
+
if (overwriteMode === 'none') {
|
|
3229
|
+
return [];
|
|
3230
|
+
}
|
|
3231
|
+
const allSegmentIndices = Object.keys(segmentation.segments)
|
|
3232
|
+
.map(Number)
|
|
3233
|
+
.filter((candidateSegmentIndex) => candidateSegmentIndex !== segmentIndex &&
|
|
3234
|
+
!segmentsLocked.includes(candidateSegmentIndex));
|
|
3235
|
+
if (overwriteMode === 'all') {
|
|
3236
|
+
return allSegmentIndices;
|
|
3237
|
+
}
|
|
3238
|
+
const representation = (0,getSegmentationRepresentation/* getSegmentationRepresentation */.Ut)(viewport.id, {
|
|
3239
|
+
segmentationId,
|
|
3240
|
+
type: enums.SegmentationRepresentations.Labelmap,
|
|
2837
3241
|
});
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
3242
|
+
if (!representation?.visible) {
|
|
3243
|
+
return [];
|
|
3244
|
+
}
|
|
3245
|
+
return allSegmentIndices.filter((candidateSegmentIndex) => representation.segments[candidateSegmentIndex]?.visible !== false);
|
|
2841
3246
|
}
|
|
2842
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (addOrUpdateSurfaceToElement);
|
|
2843
3247
|
|
|
2844
3248
|
|
|
2845
|
-
|
|
3249
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/strategies/utils/labelmapOverlap.js
|
|
2846
3250
|
|
|
2847
|
-
/***/ 20552
|
|
2848
|
-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2849
3251
|
|
|
2850
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2851
|
-
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
2852
|
-
/* harmony export */ });
|
|
2853
|
-
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
|
|
2854
3252
|
|
|
2855
|
-
function removeSurfaceFromElement(element, segmentationId) {
|
|
2856
|
-
const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
|
|
2857
|
-
const { viewport } = enabledElement;
|
|
2858
|
-
const actorEntries = viewport.getActors();
|
|
2859
|
-
const filteredSurfaceActors = actorEntries.filter((actor) => actor.representationUID &&
|
|
2860
|
-
typeof actor.representationUID === 'string' &&
|
|
2861
|
-
actor.representationUID.startsWith(segmentationId));
|
|
2862
|
-
viewport.removeActors(filteredSurfaceActors.map((actor) => actor.uid));
|
|
2863
|
-
}
|
|
2864
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (removeSurfaceFromElement);
|
|
2865
3253
|
|
|
3254
|
+
function prepareOverlapOperationData(operationData) {
|
|
3255
|
+
const segmentation = (0,getSegmentation/* getSegmentation */.T)(operationData.segmentationId);
|
|
3256
|
+
if (!segmentation) {
|
|
3257
|
+
return;
|
|
3258
|
+
}
|
|
3259
|
+
operationData.overwriteSegmentIndices =
|
|
3260
|
+
resolveOverwriteSegmentIndices(operationData);
|
|
3261
|
+
const transaction = (0,labelmapSegmentationState/* beginLabelmapEditTransaction */.Qk)(segmentation, {
|
|
3262
|
+
segmentIndex: operationData.segmentIndex,
|
|
3263
|
+
overwriteSegmentIndices: operationData.overwriteSegmentIndices,
|
|
3264
|
+
segmentationVoxelManager: operationData.segmentationVoxelManager,
|
|
3265
|
+
segmentationImageData: operationData.segmentationImageData,
|
|
3266
|
+
isInObject: operationData.isInObject,
|
|
3267
|
+
isInObjectBoundsIJK: operationData.isInObjectBoundsIJK,
|
|
3268
|
+
});
|
|
3269
|
+
operationData.labelmapEditTransaction = transaction;
|
|
3270
|
+
operationData.labelValue = transaction.labelValue;
|
|
3271
|
+
operationData.labelmapId = transaction.labelmapId;
|
|
3272
|
+
operationData.crossLayerEraseBindings = transaction.crossLayerEraseBindings;
|
|
3273
|
+
if (transaction.movedSegment && transaction.activeLayer) {
|
|
3274
|
+
const target = (0,labelmapSegmentationState/* resolveLabelmapLayerEditTarget */.VQ)(transaction.activeLayer, {
|
|
3275
|
+
viewport: operationData.viewport,
|
|
3276
|
+
imageId: operationData.imageId,
|
|
3277
|
+
sourceLayer: transaction.sourceLayer,
|
|
3278
|
+
});
|
|
3279
|
+
if (target.imageId) {
|
|
3280
|
+
operationData.imageId = target.imageId;
|
|
3281
|
+
}
|
|
3282
|
+
if (target.imageData) {
|
|
3283
|
+
operationData.segmentationImageData = target.imageData;
|
|
3284
|
+
}
|
|
3285
|
+
if (target.voxelManager) {
|
|
3286
|
+
operationData.segmentationVoxelManager = target.voxelManager;
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
}
|
|
2866
3290
|
|
|
2867
|
-
/***/ },
|
|
2868
3291
|
|
|
2869
|
-
|
|
2870
|
-
|
|
3292
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/utils/shouldUseLazyLabelmapEditing.js
|
|
3293
|
+
var shouldUseLazyLabelmapEditing = __webpack_require__(86986);
|
|
3294
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/strategies/BrushStrategy.js
|
|
2871
3295
|
|
|
2872
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2873
|
-
/* harmony export */ A: () => (/* binding */ BrushStrategy)
|
|
2874
|
-
/* harmony export */ });
|
|
2875
|
-
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
|
|
2876
|
-
/* harmony import */ var _stateManagement_segmentation_triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(49906);
|
|
2877
|
-
/* harmony import */ var _compositions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(64664);
|
|
2878
|
-
/* harmony import */ var _utils_getStrategyData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(40905);
|
|
2879
|
-
/* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29857);
|
|
2880
3296
|
|
|
2881
3297
|
|
|
2882
3298
|
|
|
2883
3299
|
|
|
2884
3300
|
|
|
2885
3301
|
class BrushStrategy {
|
|
2886
|
-
static { this.COMPOSITIONS = _compositions__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A; }
|
|
2887
|
-
static { this.childFunctions = {
|
|
2888
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.OnInteractionStart]: addListMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.OnInteractionStart, _enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Initialize),
|
|
2889
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.OnInteractionEnd]: addListMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.OnInteractionEnd, _enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Initialize),
|
|
2890
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Fill]: addListMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Fill),
|
|
2891
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Initialize]: addListMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Initialize),
|
|
2892
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.CreateIsInThreshold]: addSingletonMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.CreateIsInThreshold),
|
|
2893
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Interpolate]: addListMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Interpolate, _enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Initialize),
|
|
2894
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.AcceptPreview]: addListMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.AcceptPreview, _enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Initialize),
|
|
2895
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.RejectPreview]: addListMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.RejectPreview, _enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Initialize),
|
|
2896
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.INTERNAL_setValue]: addSingletonMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.INTERNAL_setValue),
|
|
2897
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Preview]: addSingletonMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.Preview, false),
|
|
2898
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.ComputeInnerCircleRadius]: addListMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.ComputeInnerCircleRadius),
|
|
2899
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.EnsureSegmentationVolumeFor3DManipulation]: addListMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.EnsureSegmentationVolumeFor3DManipulation),
|
|
2900
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.EnsureImageVolumeFor3DManipulation]: addListMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.EnsureImageVolumeFor3DManipulation),
|
|
2901
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.AddPreview]: addListMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.AddPreview),
|
|
2902
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.GetStatistics]: addSingletonMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.GetStatistics),
|
|
2903
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.CalculateCursorGeometry]: addSingletonMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.CalculateCursorGeometry, true),
|
|
2904
|
-
[_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.RenderCursor]: addSingletonMethod(_enums__WEBPACK_IMPORTED_MODULE_4__.StrategyCallbacks.RenderCursor, true),
|
|
2905
|
-
compositions: null,
|
|
2906
|
-
}; }
|
|
2907
3302
|
constructor(name, ...initializers) {
|
|
2908
3303
|
this._initialize = [];
|
|
2909
3304
|
this._fill = [];
|
|
2910
3305
|
this._onInteractionStart = [];
|
|
2911
3306
|
this.fill = (enabledElement, operationData) => {
|
|
2912
|
-
const initializedData = this.initialize(enabledElement, operationData,
|
|
3307
|
+
const initializedData = this.initialize(enabledElement, operationData, enums.StrategyCallbacks.Fill);
|
|
2913
3308
|
if (!initializedData) {
|
|
2914
3309
|
return;
|
|
2915
3310
|
}
|
|
3311
|
+
const isLazyLabelmapEditing = (0,shouldUseLazyLabelmapEditing/* shouldUseLazyLabelmapEditing */.v)(initializedData.viewport);
|
|
3312
|
+
const shouldPrepareOverlap = !isLazyLabelmapEditing || !initializedData.previewOnHover;
|
|
3313
|
+
const originalSegmentationVoxelManager = initializedData.segmentationVoxelManager;
|
|
3314
|
+
const originalSegmentationImageData = initializedData.segmentationImageData;
|
|
3315
|
+
if (shouldPrepareOverlap) {
|
|
3316
|
+
prepareOverlapOperationData(initializedData);
|
|
3317
|
+
}
|
|
3318
|
+
if (initializedData.memo?.segmentationVoxelManager !==
|
|
3319
|
+
initializedData.segmentationVoxelManager) {
|
|
3320
|
+
initializedData.memo = initializedData.createMemo(initializedData.segmentationId, initializedData.segmentationVoxelManager);
|
|
3321
|
+
}
|
|
3322
|
+
if (initializedData.segmentationVoxelManager !==
|
|
3323
|
+
originalSegmentationVoxelManager ||
|
|
3324
|
+
initializedData.segmentationImageData !== originalSegmentationImageData) {
|
|
3325
|
+
this._initialize.forEach((func) => func(initializedData));
|
|
3326
|
+
}
|
|
2916
3327
|
this._fill.forEach((func) => func(initializedData));
|
|
2917
3328
|
const { segmentationVoxelManager, segmentIndex } = initializedData;
|
|
2918
|
-
(
|
|
3329
|
+
const crossLayerModifiedSlices = eraseCrossLayerOverwrites(initializedData);
|
|
3330
|
+
const modifiedSlices = new Set([
|
|
3331
|
+
...(segmentationVoxelManager.getArrayOfModifiedSlices() ?? []),
|
|
3332
|
+
...crossLayerModifiedSlices,
|
|
3333
|
+
]);
|
|
3334
|
+
(0,triggerSegmentationEvents.triggerSegmentationDataModified)(initializedData.segmentationId, Array.from(modifiedSlices), segmentIndex);
|
|
2919
3335
|
return initializedData;
|
|
2920
3336
|
};
|
|
2921
3337
|
this.onInteractionStart = (enabledElement, operationData) => {
|
|
@@ -2926,23 +3342,23 @@ class BrushStrategy {
|
|
|
2926
3342
|
this._onInteractionStart.forEach((func) => func.call(this, initializedData));
|
|
2927
3343
|
};
|
|
2928
3344
|
this.addPreview = (enabledElement, operationData) => {
|
|
2929
|
-
const initializedData = this.initialize(enabledElement, operationData,
|
|
3345
|
+
const initializedData = this.initialize(enabledElement, operationData, enums.StrategyCallbacks.AddPreview);
|
|
2930
3346
|
if (!initializedData) {
|
|
2931
3347
|
return;
|
|
2932
3348
|
}
|
|
2933
3349
|
return initializedData;
|
|
2934
3350
|
};
|
|
2935
3351
|
this.configurationName = name;
|
|
2936
|
-
const cursorGeometryInitializer = initializers.find((init) => init.hasOwnProperty(
|
|
2937
|
-
const renderCursorInitializer = initializers.find((init) => init.hasOwnProperty(
|
|
3352
|
+
const cursorGeometryInitializer = initializers.find((init) => init.hasOwnProperty(enums.StrategyCallbacks.CalculateCursorGeometry));
|
|
3353
|
+
const renderCursorInitializer = initializers.find((init) => init.hasOwnProperty(enums.StrategyCallbacks.RenderCursor));
|
|
2938
3354
|
if (!cursorGeometryInitializer) {
|
|
2939
3355
|
initializers.push({
|
|
2940
|
-
[
|
|
3356
|
+
[enums.StrategyCallbacks.CalculateCursorGeometry]: compositions/* default */.A.circularCursor.calculateCursorGeometry,
|
|
2941
3357
|
});
|
|
2942
3358
|
}
|
|
2943
3359
|
if (!renderCursorInitializer) {
|
|
2944
3360
|
initializers.push({
|
|
2945
|
-
[
|
|
3361
|
+
[enums.StrategyCallbacks.RenderCursor]: compositions/* default */.A.circularCursor.renderCursor,
|
|
2946
3362
|
});
|
|
2947
3363
|
}
|
|
2948
3364
|
this.compositions = initializers;
|
|
@@ -2967,7 +3383,7 @@ class BrushStrategy {
|
|
|
2967
3383
|
}
|
|
2968
3384
|
initialize(enabledElement, operationData, operationName) {
|
|
2969
3385
|
const { viewport } = enabledElement;
|
|
2970
|
-
const data = (0,
|
|
3386
|
+
const data = (0,getStrategyData/* getStrategyData */.S)({ operationData, viewport, strategy: this });
|
|
2971
3387
|
if (!data ||
|
|
2972
3388
|
!data.imageVoxelManager ||
|
|
2973
3389
|
!data.segmentationVoxelManager ||
|
|
@@ -2995,6 +3411,28 @@ class BrushStrategy {
|
|
|
2995
3411
|
return initializedData;
|
|
2996
3412
|
}
|
|
2997
3413
|
}
|
|
3414
|
+
BrushStrategy.COMPOSITIONS = compositions/* default */.A;
|
|
3415
|
+
BrushStrategy.childFunctions = {
|
|
3416
|
+
[enums.StrategyCallbacks.OnInteractionStart]: addListMethod(enums.StrategyCallbacks.OnInteractionStart, enums.StrategyCallbacks.Initialize),
|
|
3417
|
+
[enums.StrategyCallbacks.OnInteractionEnd]: addListMethod(enums.StrategyCallbacks.OnInteractionEnd, enums.StrategyCallbacks.Initialize),
|
|
3418
|
+
[enums.StrategyCallbacks.Fill]: addListMethod(enums.StrategyCallbacks.Fill),
|
|
3419
|
+
[enums.StrategyCallbacks.Initialize]: addListMethod(enums.StrategyCallbacks.Initialize),
|
|
3420
|
+
[enums.StrategyCallbacks.CreateIsInThreshold]: addSingletonMethod(enums.StrategyCallbacks.CreateIsInThreshold),
|
|
3421
|
+
[enums.StrategyCallbacks.Interpolate]: addListMethod(enums.StrategyCallbacks.Interpolate, enums.StrategyCallbacks.Initialize),
|
|
3422
|
+
[enums.StrategyCallbacks.AcceptPreview]: addListMethod(enums.StrategyCallbacks.AcceptPreview, enums.StrategyCallbacks.Initialize),
|
|
3423
|
+
[enums.StrategyCallbacks.RejectPreview]: addListMethod(enums.StrategyCallbacks.RejectPreview, enums.StrategyCallbacks.Initialize),
|
|
3424
|
+
[enums.StrategyCallbacks.INTERNAL_setValue]: addSingletonMethod(enums.StrategyCallbacks.INTERNAL_setValue),
|
|
3425
|
+
[enums.StrategyCallbacks.Preview]: addSingletonMethod(enums.StrategyCallbacks.Preview, false),
|
|
3426
|
+
[enums.StrategyCallbacks.ComputeInnerCircleRadius]: addListMethod(enums.StrategyCallbacks.ComputeInnerCircleRadius),
|
|
3427
|
+
[enums.StrategyCallbacks.EnsureSegmentationVolumeFor3DManipulation]: addListMethod(enums.StrategyCallbacks.EnsureSegmentationVolumeFor3DManipulation),
|
|
3428
|
+
[enums.StrategyCallbacks.EnsureImageVolumeFor3DManipulation]: addListMethod(enums.StrategyCallbacks.EnsureImageVolumeFor3DManipulation),
|
|
3429
|
+
[enums.StrategyCallbacks.AddPreview]: addListMethod(enums.StrategyCallbacks.AddPreview),
|
|
3430
|
+
[enums.StrategyCallbacks.GetStatistics]: addSingletonMethod(enums.StrategyCallbacks.GetStatistics),
|
|
3431
|
+
[enums.StrategyCallbacks.CalculateCursorGeometry]: addSingletonMethod(enums.StrategyCallbacks.CalculateCursorGeometry, true),
|
|
3432
|
+
[enums.StrategyCallbacks.RenderCursor]: addSingletonMethod(enums.StrategyCallbacks.RenderCursor, true),
|
|
3433
|
+
compositions: null,
|
|
3434
|
+
};
|
|
3435
|
+
/* harmony default export */ const strategies_BrushStrategy = (BrushStrategy);
|
|
2998
3436
|
function addListMethod(name, createInitialized) {
|
|
2999
3437
|
const listName = `_${name}`;
|
|
3000
3438
|
return (brushStrategy, func) => {
|
|
@@ -3047,7 +3485,7 @@ var StrategyCallbacks = __webpack_require__(84093);
|
|
|
3047
3485
|
|
|
3048
3486
|
/* harmony default export */ const determineSegmentIndex = ({
|
|
3049
3487
|
[StrategyCallbacks/* default */.A.OnInteractionStart]: (operationData) => {
|
|
3050
|
-
const { segmentIndex, previewSegmentIndex, segmentationVoxelManager, centerIJK, viewPlaneNormal, segmentationImageData, configuration, } = operationData;
|
|
3488
|
+
const { segmentIndex, labelValue, previewSegmentIndex, segmentationVoxelManager, centerIJK, viewPlaneNormal, segmentationImageData, configuration, } = operationData;
|
|
3051
3489
|
if (!configuration?.useCenterSegmentIndex) {
|
|
3052
3490
|
operationData.centerSegmentIndexInfo.segmentIndex = null;
|
|
3053
3491
|
operationData.centerSegmentIndexInfo.hasSegmentIndex = false;
|
|
@@ -3069,7 +3507,7 @@ var StrategyCallbacks = __webpack_require__(84093);
|
|
|
3069
3507
|
nestedBounds[2] = [centerIJK[2], centerIJK[2]];
|
|
3070
3508
|
}
|
|
3071
3509
|
const callback = ({ value }) => {
|
|
3072
|
-
hasSegmentIndex ||= value === segmentIndex;
|
|
3510
|
+
hasSegmentIndex ||= value === (labelValue ?? segmentIndex);
|
|
3073
3511
|
hasPreviewIndex ||= value === previewSegmentIndex;
|
|
3074
3512
|
};
|
|
3075
3513
|
segmentationVoxelManager.forEach(callback, {
|
|
@@ -3090,9 +3528,12 @@ var StrategyCallbacks = __webpack_require__(84093);
|
|
|
3090
3528
|
|
|
3091
3529
|
// EXTERNAL MODULE: ../../../node_modules/gl-matrix/esm/index.js + 1 modules
|
|
3092
3530
|
var esm = __webpack_require__(3823);
|
|
3531
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/getViewportICamera.js
|
|
3532
|
+
var getViewportICamera = __webpack_require__(29604);
|
|
3093
3533
|
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/strategies/compositions/dynamicThreshold.js
|
|
3094
3534
|
|
|
3095
3535
|
|
|
3536
|
+
|
|
3096
3537
|
/* harmony default export */ const dynamicThreshold = ({
|
|
3097
3538
|
[StrategyCallbacks/* default */.A.Initialize]: (operationData) => {
|
|
3098
3539
|
const { operationName, centerIJK, segmentationVoxelManager, imageVoxelManager, configuration, segmentIndex, viewport, } = operationData;
|
|
@@ -3106,7 +3547,10 @@ var esm = __webpack_require__(3823);
|
|
|
3106
3547
|
const boundsIJK = segmentationVoxelManager.getBoundsIJK();
|
|
3107
3548
|
const { range: oldThreshold, dynamicRadius = 0 } = configuration.threshold;
|
|
3108
3549
|
const useDelta = oldThreshold ? 0 : dynamicRadius;
|
|
3109
|
-
const { viewPlaneNormal } =
|
|
3550
|
+
const { viewPlaneNormal } = (0,getViewportICamera/* default */.A)(viewport);
|
|
3551
|
+
if (!viewPlaneNormal) {
|
|
3552
|
+
return;
|
|
3553
|
+
}
|
|
3110
3554
|
const nestedBounds = boundsIJK.map((ijk, idx) => {
|
|
3111
3555
|
const [min, max] = ijk;
|
|
3112
3556
|
return [
|
|
@@ -3197,7 +3641,7 @@ var segmentation_islandRemoval = __webpack_require__(67912);
|
|
|
3197
3641
|
|
|
3198
3642
|
/* harmony default export */ const islandRemovalComposition = ({
|
|
3199
3643
|
[StrategyCallbacks/* default */.A.OnInteractionEnd]: (operationData) => {
|
|
3200
|
-
const { previewSegmentIndex, segmentIndex, viewport, segmentationVoxelManager, activeStrategy, memo, } = operationData;
|
|
3644
|
+
const { previewSegmentIndex, segmentIndex, labelValue, viewport, segmentationVoxelManager, activeStrategy, memo, } = operationData;
|
|
3201
3645
|
if (activeStrategy !== 'THRESHOLD_INSIDE_SPHERE_WITH_ISLAND_REMOVAL' ||
|
|
3202
3646
|
segmentIndex === null) {
|
|
3203
3647
|
return;
|
|
@@ -3206,7 +3650,7 @@ var segmentation_islandRemoval = __webpack_require__(67912);
|
|
|
3206
3650
|
const voxelManager = memo?.voxelManager || segmentationVoxelManager;
|
|
3207
3651
|
if (!islandRemoval.initialize(viewport, voxelManager, {
|
|
3208
3652
|
previewSegmentIndex,
|
|
3209
|
-
segmentIndex,
|
|
3653
|
+
segmentIndex: labelValue ?? segmentIndex,
|
|
3210
3654
|
})) {
|
|
3211
3655
|
return;
|
|
3212
3656
|
}
|
|
@@ -3261,7 +3705,7 @@ var getViewportIdsWithSegmentation = __webpack_require__(58859);
|
|
|
3261
3705
|
operationData.modified = true;
|
|
3262
3706
|
},
|
|
3263
3707
|
[StrategyCallbacks/* default */.A.AcceptPreview]: (operationData) => {
|
|
3264
|
-
const { previewSegmentIndex, segmentationVoxelManager, memo, segmentIndex, centerSegmentIndexInfo, } = operationData || {};
|
|
3708
|
+
const { previewSegmentIndex, segmentationVoxelManager, memo, segmentIndex, labelValue, centerSegmentIndexInfo, } = operationData || {};
|
|
3265
3709
|
const { changedIndices } = centerSegmentIndexInfo || {};
|
|
3266
3710
|
const labelmapMemo = memo;
|
|
3267
3711
|
const callback = ({ index }) => {
|
|
@@ -3273,7 +3717,7 @@ var getViewportIdsWithSegmentation = __webpack_require__(58859);
|
|
|
3273
3717
|
}
|
|
3274
3718
|
else {
|
|
3275
3719
|
if (oldValue === previewSegmentIndex) {
|
|
3276
|
-
labelmapMemo.voxelManager.setAtIndex(index, segmentIndex);
|
|
3720
|
+
labelmapMemo.voxelManager.setAtIndex(index, labelValue ?? segmentIndex);
|
|
3277
3721
|
}
|
|
3278
3722
|
}
|
|
3279
3723
|
};
|
|
@@ -3330,10 +3774,11 @@ var getViewportIdsWithSegmentation = __webpack_require__(58859);
|
|
|
3330
3774
|
|
|
3331
3775
|
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/strategies/utils/handleUseSegmentCenterIndex.js
|
|
3332
3776
|
function handleUseSegmentCenterIndex({ operationData, existingValue, index, }) {
|
|
3333
|
-
const { previewSegmentIndex, memo, centerSegmentIndexInfo, previewOnHover, segmentIndex, } = operationData;
|
|
3777
|
+
const { previewSegmentIndex, memo, centerSegmentIndexInfo, previewOnHover, segmentIndex, labelValue, } = operationData;
|
|
3778
|
+
const activeLabelValue = labelValue ?? segmentIndex;
|
|
3334
3779
|
const { hasPreviewIndex, hasSegmentIndex, segmentIndex: centerSegmentIndex, } = centerSegmentIndexInfo;
|
|
3335
3780
|
if (centerSegmentIndex === 0 && hasSegmentIndex && hasPreviewIndex) {
|
|
3336
|
-
if (existingValue ===
|
|
3781
|
+
if (existingValue === activeLabelValue) {
|
|
3337
3782
|
return;
|
|
3338
3783
|
}
|
|
3339
3784
|
if (previewOnHover) {
|
|
@@ -3346,7 +3791,7 @@ function handleUseSegmentCenterIndex({ operationData, existingValue, index, }) {
|
|
|
3346
3791
|
return;
|
|
3347
3792
|
}
|
|
3348
3793
|
if (centerSegmentIndex === 0 && hasSegmentIndex && !hasPreviewIndex) {
|
|
3349
|
-
if (existingValue === 0 || existingValue !==
|
|
3794
|
+
if (existingValue === 0 || existingValue !== activeLabelValue) {
|
|
3350
3795
|
return;
|
|
3351
3796
|
}
|
|
3352
3797
|
memo.voxelManager.setAtIndex(index, previewSegmentIndex);
|
|
@@ -3354,7 +3799,7 @@ function handleUseSegmentCenterIndex({ operationData, existingValue, index, }) {
|
|
|
3354
3799
|
return;
|
|
3355
3800
|
}
|
|
3356
3801
|
if (centerSegmentIndex === 0 && !hasSegmentIndex && hasPreviewIndex) {
|
|
3357
|
-
if (existingValue ===
|
|
3802
|
+
if (existingValue === activeLabelValue) {
|
|
3358
3803
|
return;
|
|
3359
3804
|
}
|
|
3360
3805
|
if (previewOnHover) {
|
|
@@ -3367,7 +3812,7 @@ function handleUseSegmentCenterIndex({ operationData, existingValue, index, }) {
|
|
|
3367
3812
|
return;
|
|
3368
3813
|
}
|
|
3369
3814
|
if (centerSegmentIndex === 0 && !hasSegmentIndex && !hasPreviewIndex) {
|
|
3370
|
-
if (existingValue ===
|
|
3815
|
+
if (existingValue === activeLabelValue) {
|
|
3371
3816
|
return;
|
|
3372
3817
|
}
|
|
3373
3818
|
if (existingValue === previewSegmentIndex) {
|
|
@@ -3379,7 +3824,7 @@ function handleUseSegmentCenterIndex({ operationData, existingValue, index, }) {
|
|
|
3379
3824
|
if (centerSegmentIndex === previewSegmentIndex &&
|
|
3380
3825
|
hasSegmentIndex &&
|
|
3381
3826
|
hasPreviewIndex) {
|
|
3382
|
-
if (existingValue ===
|
|
3827
|
+
if (existingValue === activeLabelValue) {
|
|
3383
3828
|
return;
|
|
3384
3829
|
}
|
|
3385
3830
|
memo.voxelManager.setAtIndex(index, previewSegmentIndex);
|
|
@@ -3388,25 +3833,25 @@ function handleUseSegmentCenterIndex({ operationData, existingValue, index, }) {
|
|
|
3388
3833
|
if (centerSegmentIndex === previewSegmentIndex &&
|
|
3389
3834
|
!hasSegmentIndex &&
|
|
3390
3835
|
hasPreviewIndex) {
|
|
3391
|
-
if (existingValue ===
|
|
3836
|
+
if (existingValue === activeLabelValue) {
|
|
3392
3837
|
return;
|
|
3393
3838
|
}
|
|
3394
3839
|
memo.voxelManager.setAtIndex(index, previewSegmentIndex);
|
|
3395
3840
|
return;
|
|
3396
3841
|
}
|
|
3397
|
-
if (centerSegmentIndex ===
|
|
3842
|
+
if (centerSegmentIndex === activeLabelValue &&
|
|
3398
3843
|
hasSegmentIndex &&
|
|
3399
3844
|
hasPreviewIndex) {
|
|
3400
|
-
if (existingValue ===
|
|
3845
|
+
if (existingValue === activeLabelValue) {
|
|
3401
3846
|
return;
|
|
3402
3847
|
}
|
|
3403
3848
|
memo.voxelManager.setAtIndex(index, previewSegmentIndex);
|
|
3404
3849
|
return;
|
|
3405
3850
|
}
|
|
3406
|
-
if (centerSegmentIndex ===
|
|
3851
|
+
if (centerSegmentIndex === activeLabelValue &&
|
|
3407
3852
|
hasSegmentIndex &&
|
|
3408
3853
|
!hasPreviewIndex) {
|
|
3409
|
-
if (existingValue ===
|
|
3854
|
+
if (existingValue === activeLabelValue) {
|
|
3410
3855
|
return;
|
|
3411
3856
|
}
|
|
3412
3857
|
memo.voxelManager.setAtIndex(index, previewSegmentIndex);
|
|
@@ -3414,29 +3859,41 @@ function handleUseSegmentCenterIndex({ operationData, existingValue, index, }) {
|
|
|
3414
3859
|
}
|
|
3415
3860
|
}
|
|
3416
3861
|
|
|
3862
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getSegmentation.js
|
|
3863
|
+
var getSegmentation = __webpack_require__(33283);
|
|
3864
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/helpers/labelmapSegmentationState.js
|
|
3865
|
+
var labelmapSegmentationState = __webpack_require__(90660);
|
|
3417
3866
|
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/strategies/compositions/setValue.js
|
|
3418
3867
|
|
|
3419
3868
|
|
|
3869
|
+
|
|
3870
|
+
|
|
3420
3871
|
/* harmony default export */ const setValue = ({
|
|
3421
3872
|
[StrategyCallbacks/* default */.A.INTERNAL_setValue]: (operationData, { value, index }) => {
|
|
3422
|
-
const { segmentsLocked, previewSegmentIndex, memo, segmentationVoxelManager, centerSegmentIndexInfo, segmentIndex, } = operationData;
|
|
3873
|
+
const { segmentsLocked, previewSegmentIndex, memo, segmentationVoxelManager, centerSegmentIndexInfo, segmentIndex, labelValue, labelmapId, segmentationId, } = operationData;
|
|
3423
3874
|
const existingValue = segmentationVoxelManager.getAtIndex(index);
|
|
3424
|
-
|
|
3875
|
+
const segmentation = (0,getSegmentation/* getSegmentation */.T)(segmentationId);
|
|
3876
|
+
const existingSegmentIndex = segmentation && labelmapId
|
|
3877
|
+
? (0,labelmapSegmentationState/* getSegmentIndexForLabelValue */.Mx)(segmentation, labelmapId, existingValue)
|
|
3878
|
+
: existingValue;
|
|
3879
|
+
const writeValue = previewSegmentIndex ?? labelValue ?? segmentIndex;
|
|
3880
|
+
if (segmentsLocked.includes(existingSegmentIndex)) {
|
|
3425
3881
|
return;
|
|
3426
3882
|
}
|
|
3427
|
-
if (!centerSegmentIndexInfo &&
|
|
3883
|
+
if (!centerSegmentIndexInfo &&
|
|
3884
|
+
existingValue === (labelValue ?? segmentIndex)) {
|
|
3428
3885
|
return;
|
|
3429
3886
|
}
|
|
3430
3887
|
if (centerSegmentIndexInfo?.segmentIndex !== 0 &&
|
|
3431
|
-
existingValue === segmentIndex) {
|
|
3888
|
+
existingValue === (labelValue ?? segmentIndex)) {
|
|
3432
3889
|
return;
|
|
3433
3890
|
}
|
|
3434
3891
|
if (centerSegmentIndexInfo?.segmentIndex === null) {
|
|
3435
|
-
memo.voxelManager.setAtIndex(index,
|
|
3892
|
+
memo.voxelManager.setAtIndex(index, writeValue);
|
|
3436
3893
|
return;
|
|
3437
3894
|
}
|
|
3438
3895
|
if (!previewSegmentIndex) {
|
|
3439
|
-
let useSegmentIndex = segmentIndex;
|
|
3896
|
+
let useSegmentIndex = labelValue ?? segmentIndex;
|
|
3440
3897
|
if (centerSegmentIndexInfo) {
|
|
3441
3898
|
useSegmentIndex = centerSegmentIndexInfo.segmentIndex;
|
|
3442
3899
|
}
|
|
@@ -3500,6 +3957,7 @@ var drawingSvg = __webpack_require__(74347);
|
|
|
3500
3957
|
|
|
3501
3958
|
|
|
3502
3959
|
|
|
3960
|
+
|
|
3503
3961
|
/* harmony default export */ const circularCursor = ({
|
|
3504
3962
|
[StrategyCallbacks/* default */.A.CalculateCursorGeometry]: function (enabledElement, operationData) {
|
|
3505
3963
|
if (!operationData) {
|
|
@@ -3507,8 +3965,11 @@ var drawingSvg = __webpack_require__(74347);
|
|
|
3507
3965
|
}
|
|
3508
3966
|
const { configuration, activeStrategy, hoverData } = operationData;
|
|
3509
3967
|
const { viewport } = enabledElement;
|
|
3510
|
-
const camera =
|
|
3968
|
+
const camera = (0,getViewportICamera/* default */.A)(viewport);
|
|
3511
3969
|
const { brushSize } = configuration;
|
|
3970
|
+
if (!camera.viewUp || !camera.viewPlaneNormal) {
|
|
3971
|
+
return;
|
|
3972
|
+
}
|
|
3512
3973
|
const viewUp = esm/* vec3.fromValues */.eR.fromValues(camera.viewUp[0], camera.viewUp[1], camera.viewUp[2]);
|
|
3513
3974
|
const viewPlaneNormal = esm/* vec3.fromValues */.eR.fromValues(camera.viewPlaneNormal[0], camera.viewPlaneNormal[1], camera.viewPlaneNormal[2]);
|
|
3514
3975
|
const viewRight = esm/* vec3.create */.eR.create();
|
|
@@ -3543,6 +4004,7 @@ var drawingSvg = __webpack_require__(74347);
|
|
|
3543
4004
|
leftCursorInWorld,
|
|
3544
4005
|
rightCursorInWorld,
|
|
3545
4006
|
];
|
|
4007
|
+
data.editPoints = [...data.handles.points];
|
|
3546
4008
|
const strategy = configuration.strategies[activeStrategy];
|
|
3547
4009
|
if (typeof strategy?.computeInnerCircleRadius === 'function') {
|
|
3548
4010
|
strategy.computeInnerCircleRadius({
|
|
@@ -3563,35 +4025,58 @@ var drawingSvg = __webpack_require__(74347);
|
|
|
3563
4025
|
if (!toolMetadata) {
|
|
3564
4026
|
return;
|
|
3565
4027
|
}
|
|
3566
|
-
const annotationUID = toolMetadata.brushCursorUID;
|
|
4028
|
+
const annotationUID = toolMetadata.brushCursorUID || 'brushCursor';
|
|
3567
4029
|
const data = brushCursor.data;
|
|
3568
|
-
const { points } = data.handles;
|
|
3569
|
-
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
3570
|
-
const bottom = canvasCoordinates[0];
|
|
3571
|
-
const top = canvasCoordinates[1];
|
|
3572
|
-
const center = [
|
|
3573
|
-
Math.floor((bottom[0] + top[0]) / 2),
|
|
3574
|
-
Math.floor((bottom[1] + top[1]) / 2),
|
|
3575
|
-
];
|
|
3576
|
-
const radius = Math.abs(bottom[1] - Math.floor((bottom[1] + top[1]) / 2));
|
|
3577
4030
|
const color = `rgb(${toolMetadata.segmentColor?.slice(0, 3) || [0, 0, 0]})`;
|
|
3578
4031
|
if (!viewport.getRenderingEngine()) {
|
|
3579
4032
|
console.warn('Rendering Engine has been destroyed');
|
|
3580
4033
|
return;
|
|
3581
4034
|
}
|
|
3582
|
-
const
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
4035
|
+
const points = data.handles?.points || [];
|
|
4036
|
+
const totalCircles = Math.floor((points?.length || 0) / 4);
|
|
4037
|
+
const circleGeometries = [];
|
|
4038
|
+
for (let i = 0; i < points.length; i += 4) {
|
|
4039
|
+
const circlePoints = points.slice(i, i + 4);
|
|
4040
|
+
if (circlePoints.length < 2) {
|
|
4041
|
+
continue;
|
|
4042
|
+
}
|
|
4043
|
+
const canvasCoordinates = circlePoints.map((p) => viewport.worldToCanvas(p));
|
|
4044
|
+
const bottom = canvasCoordinates[0];
|
|
4045
|
+
const top = canvasCoordinates[1];
|
|
4046
|
+
const center = [
|
|
4047
|
+
Math.floor((bottom[0] + top[0]) / 2),
|
|
4048
|
+
Math.floor((bottom[1] + top[1]) / 2),
|
|
4049
|
+
];
|
|
4050
|
+
const radius = Math.round(Math.abs(bottom[1] - center[1]));
|
|
4051
|
+
circleGeometries.push({ center, radius });
|
|
4052
|
+
}
|
|
4053
|
+
const currentCircle = circleGeometries[circleGeometries.length - 1];
|
|
4054
|
+
if (circleGeometries.length > 1) {
|
|
4055
|
+
(0,drawingSvg.drawPath)(svgDrawingHelper, annotationUID, 'stroke-preview', circleGeometries.map((circle) => circle.center), {
|
|
4056
|
+
color,
|
|
4057
|
+
lineWidth: currentCircle.radius * 2,
|
|
4058
|
+
strokeOpacity: 0.35,
|
|
4059
|
+
lineCap: 'round',
|
|
4060
|
+
lineJoin: 'round',
|
|
4061
|
+
lineDash: this.centerSegmentIndexInfo.segmentIndex === 0 ? '6,4' : undefined,
|
|
4062
|
+
});
|
|
4063
|
+
}
|
|
4064
|
+
if (currentCircle) {
|
|
4065
|
+
(0,drawingSvg.drawCircle)(svgDrawingHelper, annotationUID, 'current-circle', currentCircle.center, currentCircle.radius, {
|
|
4066
|
+
color,
|
|
4067
|
+
lineWidth: 2,
|
|
4068
|
+
strokeOpacity: 1,
|
|
4069
|
+
lineDash: this.centerSegmentIndexInfo.segmentIndex === 0 ? [1, 2] : null,
|
|
4070
|
+
}, 'brush-cursor');
|
|
4071
|
+
}
|
|
3587
4072
|
const { dynamicRadiusInCanvas } = configuration?.threshold || {
|
|
3588
4073
|
dynamicRadiusInCanvas: 0,
|
|
3589
4074
|
};
|
|
3590
|
-
if (dynamicRadiusInCanvas) {
|
|
3591
|
-
const circleUID1 = '
|
|
3592
|
-
(0,drawingSvg.drawCircle)(svgDrawingHelper, annotationUID, circleUID1, center, dynamicRadiusInCanvas, {
|
|
4075
|
+
if (dynamicRadiusInCanvas && currentCircle) {
|
|
4076
|
+
const circleUID1 = 'dynamic-radius';
|
|
4077
|
+
(0,drawingSvg.drawCircle)(svgDrawingHelper, annotationUID, circleUID1, currentCircle.center, dynamicRadiusInCanvas, {
|
|
3593
4078
|
color,
|
|
3594
|
-
});
|
|
4079
|
+
}, 'brush-cursor');
|
|
3595
4080
|
}
|
|
3596
4081
|
},
|
|
3597
4082
|
});
|
|
@@ -3633,7 +4118,7 @@ var drawingSvg = __webpack_require__(74347);
|
|
|
3633
4118
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3634
4119
|
/* harmony export */ r: () => (/* binding */ eraseInsideCircle)
|
|
3635
4120
|
/* harmony export */ });
|
|
3636
|
-
/* harmony import */ var _BrushStrategy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
4121
|
+
/* harmony import */ var _BrushStrategy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18543);
|
|
3637
4122
|
/* harmony import */ var _fillCircle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(56789);
|
|
3638
4123
|
/* harmony import */ var _compositions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(64664);
|
|
3639
4124
|
|
|
@@ -3652,7 +4137,7 @@ const eraseInsideCircle = ERASE_CIRCLE_STRATEGY.strategyFunction;
|
|
|
3652
4137
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3653
4138
|
/* harmony export */ _: () => (/* binding */ eraseInsideSphere)
|
|
3654
4139
|
/* harmony export */ });
|
|
3655
|
-
/* harmony import */ var _BrushStrategy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
4140
|
+
/* harmony import */ var _BrushStrategy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18543);
|
|
3656
4141
|
/* harmony import */ var _fillSphere__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17492);
|
|
3657
4142
|
/* harmony import */ var _compositions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(64664);
|
|
3658
4143
|
|
|
@@ -3677,7 +4162,7 @@ const eraseInsideSphere = ERASE_SPHERE_STRATEGY.strategyFunction;
|
|
|
3677
4162
|
/* unused harmony export fillOutsideSphere */
|
|
3678
4163
|
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
|
|
3679
4164
|
/* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3823);
|
|
3680
|
-
/* harmony import */ var _BrushStrategy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
4165
|
+
/* harmony import */ var _BrushStrategy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(18543);
|
|
3681
4166
|
/* harmony import */ var _compositions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(64664);
|
|
3682
4167
|
/* harmony import */ var _enums_StrategyCallbacks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84093);
|
|
3683
4168
|
/* harmony import */ var _fillCircle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(56789);
|
|
@@ -3688,7 +4173,7 @@ const eraseInsideSphere = ERASE_SPHERE_STRATEGY.strategyFunction;
|
|
|
3688
4173
|
|
|
3689
4174
|
|
|
3690
4175
|
|
|
3691
|
-
const { transformWorldToIndex } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities;
|
|
4176
|
+
const { transformWorldToIndex, getNormalizedAspectRatio } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities;
|
|
3692
4177
|
|
|
3693
4178
|
const sphereComposition = {
|
|
3694
4179
|
[_enums_StrategyCallbacks__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A.Initialize]: (operationData) => {
|
|
@@ -3710,7 +4195,13 @@ const sphereComposition = {
|
|
|
3710
4195
|
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
3711
4196
|
const corners = (0,_fillCircle__WEBPACK_IMPORTED_MODULE_5__/* .getEllipseCornersFromCanvasCoordinates */ .C$)(canvasCoordinates);
|
|
3712
4197
|
const cornersInWorld = corners.map((corner) => viewport.canvasToWorld(corner));
|
|
3713
|
-
const
|
|
4198
|
+
const aspectRatio = getNormalizedAspectRatio(viewport.getAspectRatio());
|
|
4199
|
+
const yRadius = points.length >= 2
|
|
4200
|
+
? gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.distance */ .eR.distance(points[0], points[1]) / 2 / aspectRatio[1]
|
|
4201
|
+
: 0;
|
|
4202
|
+
const xRadius = points.length >= 2
|
|
4203
|
+
? gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.distance */ .eR.distance(points[2], points[3]) / 2 / aspectRatio[0]
|
|
4204
|
+
: 0;
|
|
3714
4205
|
const strokeCenters = operationData.strokePointsWorld &&
|
|
3715
4206
|
operationData.strokePointsWorld.length > 0
|
|
3716
4207
|
? operationData.strokePointsWorld
|
|
@@ -3774,7 +4265,9 @@ const sphereComposition = {
|
|
|
3774
4265
|
operationData.isInObject = (0,_fillCircle__WEBPACK_IMPORTED_MODULE_5__/* .createEllipseInPoint */ .mu)(cornersInWorld, {
|
|
3775
4266
|
strokePointsWorld: operationData.strokePointsWorld,
|
|
3776
4267
|
segmentationImageData,
|
|
3777
|
-
|
|
4268
|
+
xRadius,
|
|
4269
|
+
yRadius,
|
|
4270
|
+
aspectRatio,
|
|
3778
4271
|
});
|
|
3779
4272
|
},
|
|
3780
4273
|
};
|
|
@@ -3790,6 +4283,170 @@ function fillOutsideSphere() {
|
|
|
3790
4283
|
|
|
3791
4284
|
|
|
3792
4285
|
|
|
4286
|
+
/***/ },
|
|
4287
|
+
|
|
4288
|
+
/***/ 81668
|
|
4289
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4290
|
+
|
|
4291
|
+
|
|
4292
|
+
// EXPORTS
|
|
4293
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
4294
|
+
A: () => (/* binding */ utils_LazyBrushEditController)
|
|
4295
|
+
});
|
|
4296
|
+
|
|
4297
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 1 modules
|
|
4298
|
+
var esm = __webpack_require__(15327);
|
|
4299
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/enums/index.js + 3 modules
|
|
4300
|
+
var enums = __webpack_require__(29857);
|
|
4301
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/utils/lazyBrushPreview.js
|
|
4302
|
+
const EPSILON = 1e-3;
|
|
4303
|
+
function clonePoint(point) {
|
|
4304
|
+
return [point[0], point[1], point[2]];
|
|
4305
|
+
}
|
|
4306
|
+
function isSamePoint(a, b) {
|
|
4307
|
+
return (Math.abs(a[0] - b[0]) < EPSILON &&
|
|
4308
|
+
Math.abs(a[1] - b[1]) < EPSILON &&
|
|
4309
|
+
Math.abs(a[2] - b[2]) < EPSILON);
|
|
4310
|
+
}
|
|
4311
|
+
function appendLazyBrushStrokePoint(points = [], point) {
|
|
4312
|
+
if (!point) {
|
|
4313
|
+
return points;
|
|
4314
|
+
}
|
|
4315
|
+
if (points.length && isSamePoint(points[points.length - 1], point)) {
|
|
4316
|
+
return points;
|
|
4317
|
+
}
|
|
4318
|
+
return [...points, clonePoint(point)];
|
|
4319
|
+
}
|
|
4320
|
+
function appendLazyBrushPreviewCircle(existingPoints = [], circlePoints = []) {
|
|
4321
|
+
if (!circlePoints.length) {
|
|
4322
|
+
return existingPoints;
|
|
4323
|
+
}
|
|
4324
|
+
const nextCircle = circlePoints.map((point) => clonePoint(point));
|
|
4325
|
+
if (!existingPoints.length) {
|
|
4326
|
+
return nextCircle;
|
|
4327
|
+
}
|
|
4328
|
+
const previousCircle = existingPoints.slice(-nextCircle.length);
|
|
4329
|
+
const isDuplicateCircle = previousCircle.length === nextCircle.length &&
|
|
4330
|
+
previousCircle.every((point, index) => isSamePoint(point, nextCircle[index]));
|
|
4331
|
+
if (isDuplicateCircle) {
|
|
4332
|
+
return existingPoints;
|
|
4333
|
+
}
|
|
4334
|
+
return [...existingPoints, ...nextCircle];
|
|
4335
|
+
}
|
|
4336
|
+
|
|
4337
|
+
;// ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/utils/LazyBrushEditController.js
|
|
4338
|
+
|
|
4339
|
+
|
|
4340
|
+
|
|
4341
|
+
class LazyBrushEditController {
|
|
4342
|
+
constructor() {
|
|
4343
|
+
this.strokePointsWorld = [];
|
|
4344
|
+
this.previewPoints = [];
|
|
4345
|
+
this.pendingPreviewCleanup = null;
|
|
4346
|
+
}
|
|
4347
|
+
reset() {
|
|
4348
|
+
this.strokePointsWorld = [];
|
|
4349
|
+
this.previewPoints = [];
|
|
4350
|
+
}
|
|
4351
|
+
clearPendingCleanup() {
|
|
4352
|
+
if (!this.pendingPreviewCleanup) {
|
|
4353
|
+
return;
|
|
4354
|
+
}
|
|
4355
|
+
esm.eventTarget.removeEventListener(enums.Events.SEGMENTATION_RENDERED, this.pendingPreviewCleanup.listener);
|
|
4356
|
+
this.pendingPreviewCleanup = null;
|
|
4357
|
+
}
|
|
4358
|
+
appendStrokePoint(worldPoint) {
|
|
4359
|
+
this.strokePointsWorld = appendLazyBrushStrokePoint(this.strokePointsWorld, worldPoint);
|
|
4360
|
+
}
|
|
4361
|
+
getStrokePointsWorld() {
|
|
4362
|
+
return this.strokePointsWorld;
|
|
4363
|
+
}
|
|
4364
|
+
capturePreviewCircle(hoverData) {
|
|
4365
|
+
if (!hoverData) {
|
|
4366
|
+
return;
|
|
4367
|
+
}
|
|
4368
|
+
const circlePoints = hoverData.brushCursor?.data?.editPoints;
|
|
4369
|
+
this.previewPoints = appendLazyBrushPreviewCircle(this.previewPoints, circlePoints);
|
|
4370
|
+
hoverData.brushCursor.data.handles.points = this.previewPoints;
|
|
4371
|
+
}
|
|
4372
|
+
scheduleCleanup({ element, centerCanvas, viewportId, segmentationId, refreshCursor, }) {
|
|
4373
|
+
this.clearPendingCleanup();
|
|
4374
|
+
const listener = ((evt) => {
|
|
4375
|
+
const detail = evt.detail;
|
|
4376
|
+
if (detail.viewportId !== viewportId ||
|
|
4377
|
+
detail.segmentationId !== segmentationId) {
|
|
4378
|
+
return;
|
|
4379
|
+
}
|
|
4380
|
+
this.clearPendingCleanup();
|
|
4381
|
+
this.reset();
|
|
4382
|
+
refreshCursor(element, centerCanvas);
|
|
4383
|
+
});
|
|
4384
|
+
this.pendingPreviewCleanup = {
|
|
4385
|
+
viewportId,
|
|
4386
|
+
segmentationId,
|
|
4387
|
+
listener,
|
|
4388
|
+
};
|
|
4389
|
+
esm.eventTarget.addEventListener(enums.Events.SEGMENTATION_RENDERED, listener);
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4392
|
+
/* harmony default export */ const utils_LazyBrushEditController = (LazyBrushEditController);
|
|
4393
|
+
|
|
4394
|
+
|
|
4395
|
+
/***/ },
|
|
4396
|
+
|
|
4397
|
+
/***/ 86986
|
|
4398
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4399
|
+
|
|
4400
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4401
|
+
/* harmony export */ v: () => (/* binding */ shouldUseLazyLabelmapEditing)
|
|
4402
|
+
/* harmony export */ });
|
|
4403
|
+
/* unused harmony export isCPUViewport */
|
|
4404
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
|
|
4405
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(36625);
|
|
4406
|
+
|
|
4407
|
+
|
|
4408
|
+
const CPU_RENDER_MODES = new Set([
|
|
4409
|
+
_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.ActorRenderMode.CPU_IMAGE,
|
|
4410
|
+
_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.ActorRenderMode.CPU_VOLUME,
|
|
4411
|
+
]);
|
|
4412
|
+
function getDefaultActor(viewport) {
|
|
4413
|
+
try {
|
|
4414
|
+
return viewport.getDefaultActor?.();
|
|
4415
|
+
}
|
|
4416
|
+
catch {
|
|
4417
|
+
return;
|
|
4418
|
+
}
|
|
4419
|
+
}
|
|
4420
|
+
function isCPUViewport(viewport) {
|
|
4421
|
+
if (!viewport) {
|
|
4422
|
+
return (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getShouldUseCPURendering)();
|
|
4423
|
+
}
|
|
4424
|
+
const cpuViewport = viewport;
|
|
4425
|
+
if (cpuViewport.useCPURendering === true) {
|
|
4426
|
+
return true;
|
|
4427
|
+
}
|
|
4428
|
+
if (cpuViewport._cpuFallbackEnabledElement) {
|
|
4429
|
+
return true;
|
|
4430
|
+
}
|
|
4431
|
+
const defaultActor = getDefaultActor(viewport);
|
|
4432
|
+
const renderMode = defaultActor?.actorMapper?.renderMode;
|
|
4433
|
+
if (renderMode && CPU_RENDER_MODES.has(renderMode)) {
|
|
4434
|
+
return true;
|
|
4435
|
+
}
|
|
4436
|
+
const actorClassName = typeof defaultActor?.actor?.getClassName === 'function'
|
|
4437
|
+
? defaultActor.actor.getClassName()
|
|
4438
|
+
: undefined;
|
|
4439
|
+
if (actorClassName === 'CanvasActor') {
|
|
4440
|
+
return true;
|
|
4441
|
+
}
|
|
4442
|
+
return (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getShouldUseCPURendering)();
|
|
4443
|
+
}
|
|
4444
|
+
function shouldUseLazyLabelmapEditing(viewport) {
|
|
4445
|
+
return ((0,_config__WEBPACK_IMPORTED_MODULE_1__/* .getConfig */ .zj)().segmentation?.overwriteMode !== undefined ||
|
|
4446
|
+
isCPUViewport(viewport));
|
|
4447
|
+
}
|
|
4448
|
+
|
|
4449
|
+
|
|
3793
4450
|
/***/ },
|
|
3794
4451
|
|
|
3795
4452
|
/***/ 109
|
|
@@ -4616,6 +5273,40 @@ function _generateClosedContour(points) {
|
|
|
4616
5273
|
/* harmony default export */ const interpolation_interpolate = (interpolate);
|
|
4617
5274
|
|
|
4618
5275
|
|
|
5276
|
+
/***/ },
|
|
5277
|
+
|
|
5278
|
+
/***/ 29604
|
|
5279
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
5280
|
+
|
|
5281
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5282
|
+
/* harmony export */ A: () => (/* binding */ getViewportICamera)
|
|
5283
|
+
/* harmony export */ });
|
|
5284
|
+
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
|
|
5285
|
+
|
|
5286
|
+
function getViewportICamera(viewport, viewReference = viewport.getViewReference()) {
|
|
5287
|
+
const genericViewport = viewport;
|
|
5288
|
+
const camera = (genericViewport.getResolvedView?.()?.toICamera?.() ||
|
|
5289
|
+
viewport.getCamera?.() ||
|
|
5290
|
+
{});
|
|
5291
|
+
const focalPoint = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.clonePoint3(viewReference?.cameraFocalPoint || camera.focalPoint);
|
|
5292
|
+
const viewPlaneNormal = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.clonePoint3(viewReference?.viewPlaneNormal || camera.viewPlaneNormal);
|
|
5293
|
+
const viewUp = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.clonePoint3(viewReference?.viewUp || camera.viewUp);
|
|
5294
|
+
const position = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.clonePoint3(camera.position ||
|
|
5295
|
+
(focalPoint &&
|
|
5296
|
+
viewPlaneNormal && [
|
|
5297
|
+
focalPoint[0] - viewPlaneNormal[0],
|
|
5298
|
+
focalPoint[1] - viewPlaneNormal[1],
|
|
5299
|
+
focalPoint[2] - viewPlaneNormal[2],
|
|
5300
|
+
]));
|
|
5301
|
+
return {
|
|
5302
|
+
focalPoint,
|
|
5303
|
+
position,
|
|
5304
|
+
viewPlaneNormal,
|
|
5305
|
+
viewUp,
|
|
5306
|
+
};
|
|
5307
|
+
}
|
|
5308
|
+
|
|
5309
|
+
|
|
4619
5310
|
/***/ },
|
|
4620
5311
|
|
|
4621
5312
|
/***/ 69013
|
|
@@ -4627,6 +5318,7 @@ function _generateClosedContour(points) {
|
|
|
4627
5318
|
/* harmony export */ });
|
|
4628
5319
|
/* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
|
|
4629
5320
|
/* harmony import */ var _Calculator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28364);
|
|
5321
|
+
var _a;
|
|
4630
5322
|
|
|
4631
5323
|
|
|
4632
5324
|
const { PointsManager } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities;
|
|
@@ -4833,20 +5525,21 @@ function basicGetStatistics(state, unit) {
|
|
|
4833
5525
|
return named;
|
|
4834
5526
|
}
|
|
4835
5527
|
class BasicStatsCalculator extends _Calculator__WEBPACK_IMPORTED_MODULE_1__/* .Calculator */ .t {
|
|
4836
|
-
static { this.state = createBasicStatsState(true); }
|
|
4837
5528
|
static statsInit(options) {
|
|
4838
5529
|
if (!options.storePointData) {
|
|
4839
5530
|
this.state.pointsInShape = null;
|
|
4840
5531
|
}
|
|
4841
5532
|
this.state = createBasicStatsState(options.storePointData);
|
|
4842
5533
|
}
|
|
4843
|
-
static { this.statsCallback = ({ value: newValue, pointLPS = null, pointIJK = null, }) => {
|
|
4844
|
-
basicStatsCallback(this.state, newValue, pointLPS, pointIJK);
|
|
4845
|
-
}; }
|
|
4846
|
-
static { this.getStatistics = (options) => {
|
|
4847
|
-
return basicGetStatistics(this.state, options?.unit);
|
|
4848
|
-
}; }
|
|
4849
5534
|
}
|
|
5535
|
+
_a = BasicStatsCalculator;
|
|
5536
|
+
BasicStatsCalculator.state = createBasicStatsState(true);
|
|
5537
|
+
BasicStatsCalculator.statsCallback = ({ value: newValue, pointLPS = null, pointIJK = null, }) => {
|
|
5538
|
+
basicStatsCallback(_a.state, newValue, pointLPS, pointIJK);
|
|
5539
|
+
};
|
|
5540
|
+
BasicStatsCalculator.getStatistics = (options) => {
|
|
5541
|
+
return basicGetStatistics(_a.state, options?.unit);
|
|
5542
|
+
};
|
|
4850
5543
|
class InstanceBasicStatsCalculator extends _Calculator__WEBPACK_IMPORTED_MODULE_1__/* .InstanceCalculator */ .I {
|
|
4851
5544
|
constructor(options) {
|
|
4852
5545
|
super(options);
|
|
@@ -5526,29 +6219,6 @@ function deleteRelatedAnnotations(viewportData) {
|
|
|
5526
6219
|
}
|
|
5527
6220
|
|
|
5528
6221
|
|
|
5529
|
-
/***/ },
|
|
5530
|
-
|
|
5531
|
-
/***/ 27479
|
|
5532
|
-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
5533
|
-
|
|
5534
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5535
|
-
/* harmony export */ d: () => (/* binding */ computeAndAddRepresentation)
|
|
5536
|
-
/* harmony export */ });
|
|
5537
|
-
/* harmony import */ var _stateManagement_segmentation_internalAddRepresentationData__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(44188);
|
|
5538
|
-
|
|
5539
|
-
async function computeAndAddRepresentation(segmentationId, type, computeFunction, onComputationComplete) {
|
|
5540
|
-
const data = await computeFunction();
|
|
5541
|
-
(0,_stateManagement_segmentation_internalAddRepresentationData__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({
|
|
5542
|
-
segmentationId,
|
|
5543
|
-
type,
|
|
5544
|
-
data,
|
|
5545
|
-
});
|
|
5546
|
-
onComputationComplete?.();
|
|
5547
|
-
return data;
|
|
5548
|
-
}
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
6222
|
/***/ },
|
|
5553
6223
|
|
|
5554
6224
|
/***/ 86644
|
|
@@ -5665,7 +6335,7 @@ function getViewportIdsWithToolToRender(element, toolName, requireParallelNormal
|
|
|
5665
6335
|
viewports = (0,_filterViewportsWithToolEnabled__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)(viewports, toolName);
|
|
5666
6336
|
const viewport = renderingEngine.getViewport(enabledElement.viewportId);
|
|
5667
6337
|
if (requireParallelNormals) {
|
|
5668
|
-
viewports = (0,_filterViewportsWithParallelNormals__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A)(viewports, viewport
|
|
6338
|
+
viewports = (0,_filterViewportsWithParallelNormals__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A)(viewports, viewport);
|
|
5669
6339
|
}
|
|
5670
6340
|
const viewportIds = viewports.map((vp) => vp.id);
|
|
5671
6341
|
return viewportIds;
|