@ohif/app 3.14.0-beta.55 → 3.14.0-beta.57
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/{9187.bundle.47a04a89.js → 1283.bundle.56abacf4.js} +162 -137
- package/dist/{4262.bundle.0c550b7f.js → 1558.bundle.03d5783b.js} +36 -11
- package/dist/{1566.bundle.8d90bb15.js → 1566.bundle.e9f5d851.js} +5 -1
- package/dist/{1645.bundle.65cff869.js → 1645.bundle.618a2886.js} +700 -389
- package/dist/{1724.bundle.b4757283.js → 1724.bundle.59b20c59.js} +1184 -1139
- package/dist/{1788.bundle.5b78672d.js → 1788.bundle.3f1349d2.js} +101 -43
- package/dist/1975.bundle.53cf5d7c.js +8216 -0
- package/dist/{5922.bundle.46b3e037.js → 2894.bundle.db3f8686.js} +240 -151
- package/dist/{6567.bundle.cc57e572.js → 3044.bundle.039294b9.js} +105 -76
- package/dist/{3386.bundle.7665dd43.js → 3386.bundle.25140fec.js} +92 -23
- package/dist/{4004.bundle.da822fd2.js → 4018.bundle.48c288e5.js} +128 -253
- package/dist/{2894.bundle.d612efb2.js → 513.bundle.9c0548cf.js} +1 -1
- package/dist/{5143.bundle.62bcf4ee.js → 5143.bundle.67167d39.js} +219 -147
- package/dist/{5895.bundle.b4892e1b.js → 5320.bundle.0c7b2cb7.js} +1473 -617
- package/dist/{5383.bundle.d393d2f5.js → 5383.bundle.79243338.js} +26 -4
- package/dist/{4324.bundle.8645d6b4.js → 5888.bundle.cd717f42.js} +1364 -8004
- package/dist/{8128.bundle.2afe5a05.js → 5914.bundle.00f408d2.js} +419 -49
- package/dist/{1284.bundle.a489bd1d.js → 5989.bundle.f8096a4e.js} +1175 -616
- package/dist/{6255.bundle.ee378f1c.js → 6255.bundle.521051c1.js} +42 -18
- package/dist/{829.bundle.e60fee3a.js → 641.bundle.4627a8e1.js} +472 -483
- package/dist/{1568.bundle.474a5a93.js → 9187.bundle.237037e4.js} +1 -1
- package/dist/{6711.bundle.baba2ccd.js → 9232.bundle.3b0caf8e.js} +10 -10
- package/dist/{1895.bundle.923d0bd4.js → 9620.bundle.67375c83.js} +82 -24
- package/dist/{app.bundle.3a861c86.js → app.bundle.b9e31304.js} +44 -44
- package/dist/{compute.bundle.caab94e6.js → compute.bundle.a8f26c49.js} +10 -10
- package/dist/index.html +1 -1
- package/dist/{interpolation.bundle.eed65b60.js → interpolation.bundle.aef2f614.js} +5 -5
- package/dist/{polySeg.bundle.34a58c4f.js → polySeg.bundle.ba052ac3.js} +11 -11
- package/dist/static/wasm/{27ff970b98.module.wasm → 0e14aeab30.module.wasm} +0 -0
- package/dist/static/wasm/58a146bc8c.module.wasm +0 -0
- package/dist/static/wasm/99a2672e64.module.wasm +0 -0
- package/dist/static/wasm/{11f8dc2413.module.wasm → d8b213f3ea.module.wasm} +0 -0
- package/dist/sw.js +1 -1
- package/package.json +6 -6
- package/dist/0.bundle.485115b4.js +0 -4498
- package/dist/static/wasm/58769f1d7d.module.wasm +0 -0
- /package/dist/{1895.bundle.css → 9620.bundle.css} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis["rspackChunk_ohif_app"] ||= []).push([[
|
|
1
|
+
(globalThis["rspackChunk_ohif_app"] ||= []).push([[641], {
|
|
2
2
|
5157(module, __unused_rspack_exports, __webpack_require__) {
|
|
3
3
|
/**
|
|
4
4
|
* lodash (Custom Build) <https://lodash.com/>
|
|
@@ -1004,18 +1004,6 @@ var Events;
|
|
|
1004
1004
|
/* export default */ __webpack_exports__.A = (Events);
|
|
1005
1005
|
|
|
1006
1006
|
|
|
1007
|
-
},
|
|
1008
|
-
52602(__unused_rspack___webpack_module__, __webpack_exports__) {
|
|
1009
|
-
"use strict";
|
|
1010
|
-
var SegmentationRepresentations;
|
|
1011
|
-
(function (SegmentationRepresentations) {
|
|
1012
|
-
SegmentationRepresentations["Labelmap"] = "Labelmap";
|
|
1013
|
-
SegmentationRepresentations["Contour"] = "Contour";
|
|
1014
|
-
SegmentationRepresentations["Surface"] = "Surface";
|
|
1015
|
-
})(SegmentationRepresentations || (SegmentationRepresentations = {}));
|
|
1016
|
-
/* export default */ __webpack_exports__.A = (SegmentationRepresentations);
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
1007
|
},
|
|
1020
1008
|
29652(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1021
1009
|
"use strict";
|
|
@@ -1354,6 +1342,21 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1354
1342
|
});
|
|
1355
1343
|
|
|
1356
1344
|
|
|
1345
|
+
},
|
|
1346
|
+
45114(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1347
|
+
"use strict";
|
|
1348
|
+
/* import */ var _SegmentationStateManager_js__rspack_import_0 = __webpack_require__(91155);
|
|
1349
|
+
|
|
1350
|
+
function getSegmentationRepresentationVisibility(viewportId, specifier) {
|
|
1351
|
+
const segmentationStateManager = _SegmentationStateManager_js__rspack_import_0/* .defaultSegmentationStateManager */._6;
|
|
1352
|
+
return segmentationStateManager.getSegmentationRepresentationVisibility(viewportId, specifier);
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1356
|
+
I: () => (getSegmentationRepresentationVisibility)
|
|
1357
|
+
});
|
|
1358
|
+
|
|
1359
|
+
|
|
1357
1360
|
},
|
|
1358
1361
|
66155(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1359
1362
|
"use strict";
|
|
@@ -1517,14 +1520,16 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1517
1520
|
"use strict";
|
|
1518
1521
|
/* import */ var _cornerstonejs_core__rspack_import_0 = __webpack_require__(62721);
|
|
1519
1522
|
/* import */ var _labelmapLayerStore_js__rspack_import_1 = __webpack_require__(53325);
|
|
1520
|
-
/* import */ var
|
|
1521
|
-
/* import */ var
|
|
1523
|
+
/* import */ var _labelmapImageIdMapping_js__rspack_import_2 = __webpack_require__(27749);
|
|
1524
|
+
/* import */ var _labelmapSegmentBindings_js__rspack_import_3 = __webpack_require__(53344);
|
|
1525
|
+
/* import */ var _privateLabelmap_js__rspack_import_4 = __webpack_require__(55892);
|
|
1526
|
+
|
|
1522
1527
|
|
|
1523
1528
|
|
|
1524
1529
|
|
|
1525
1530
|
|
|
1526
1531
|
function getProtectedSegmentIndicesForLayer(segmentation, labelmapId, segmentIndex, overwriteSegmentIndices = []) {
|
|
1527
|
-
return (0,
|
|
1532
|
+
return (0,_labelmapSegmentBindings_js__rspack_import_3/* .getSegmentsOnLabelmap */.I3)(segmentation, labelmapId).filter((candidateSegmentIndex) => candidateSegmentIndex !== segmentIndex &&
|
|
1528
1533
|
!overwriteSegmentIndices.includes(candidateSegmentIndex));
|
|
1529
1534
|
}
|
|
1530
1535
|
function hasProtectedSegmentOverwrite(segmentation, labelmapId, protectedSegmentIndices, voxelManager, options = {}) {
|
|
@@ -1537,7 +1542,7 @@ function hasProtectedSegmentOverwrite(segmentation, labelmapId, protectedSegment
|
|
|
1537
1542
|
if (!value || hasConflict) {
|
|
1538
1543
|
return;
|
|
1539
1544
|
}
|
|
1540
|
-
const candidateSegmentIndex = (0,
|
|
1545
|
+
const candidateSegmentIndex = (0,_labelmapSegmentBindings_js__rspack_import_3/* .getSegmentIndexForLabelValue */.Mx)(segmentation, labelmapId, Number(value));
|
|
1541
1546
|
if (candidateSegmentIndex && protectedSet.has(candidateSegmentIndex)) {
|
|
1542
1547
|
hasConflict = true;
|
|
1543
1548
|
}
|
|
@@ -1553,7 +1558,7 @@ function collectCrossLayerEraseBindings(segmentation, labelmapId, overwriteSegme
|
|
|
1553
1558
|
return [];
|
|
1554
1559
|
}
|
|
1555
1560
|
return overwriteSegmentIndices
|
|
1556
|
-
.map((overwriteSegmentIndex) => (0,
|
|
1561
|
+
.map((overwriteSegmentIndex) => (0,_labelmapSegmentBindings_js__rspack_import_3/* .getSegmentBinding */.hM)(segmentation, overwriteSegmentIndex))
|
|
1557
1562
|
.filter((binding) => !!binding && binding.labelmapId !== labelmapId);
|
|
1558
1563
|
}
|
|
1559
1564
|
function beginLabelmapEditTransaction(segmentation, options) {
|
|
@@ -1569,7 +1574,7 @@ function beginLabelmapEditTransaction(segmentation, options) {
|
|
|
1569
1574
|
movedSegment: false,
|
|
1570
1575
|
};
|
|
1571
1576
|
}
|
|
1572
|
-
const binding = (0,
|
|
1577
|
+
const binding = (0,_labelmapSegmentBindings_js__rspack_import_3/* .getSegmentBinding */.hM)(segmentation, segmentIndex);
|
|
1573
1578
|
const sourceLayer = binding
|
|
1574
1579
|
? (0,_labelmapLayerStore_js__rspack_import_1/* .getLabelmap */.Hs)(segmentation, binding.labelmapId)
|
|
1575
1580
|
: undefined;
|
|
@@ -1588,7 +1593,8 @@ function beginLabelmapEditTransaction(segmentation, options) {
|
|
|
1588
1593
|
let labelValue = binding.labelValue;
|
|
1589
1594
|
let movedSegment = false;
|
|
1590
1595
|
const protectedSegmentIndices = getProtectedSegmentIndicesForLayer(segmentation, labelmapId, segmentIndex, overwriteSegmentIndices);
|
|
1591
|
-
const
|
|
1596
|
+
const segmentsLocked = options.segmentsLocked ?? [];
|
|
1597
|
+
const shouldMoveSegment = hasProtectedSegmentOverwrite(segmentation, labelmapId, protectedSegmentIndices.filter((protectedSegmentIndex) => !segmentsLocked.includes(protectedSegmentIndex)), options.segmentationVoxelManager, {
|
|
1592
1598
|
segmentationImageData: options.segmentationImageData,
|
|
1593
1599
|
isInObject: options.isInObject,
|
|
1594
1600
|
isInObjectBoundsIJK: options.isInObjectBoundsIJK,
|
|
@@ -1596,9 +1602,9 @@ function beginLabelmapEditTransaction(segmentation, options) {
|
|
|
1596
1602
|
let moveStep;
|
|
1597
1603
|
if (shouldMoveSegment) {
|
|
1598
1604
|
const moveSegmentToPrivateLabelmap = options.moveSegmentToPrivateLabelmap ??
|
|
1599
|
-
|
|
1605
|
+
_privateLabelmap_js__rspack_import_4/* .moveSegmentToPrivateLabelmap */.J;
|
|
1600
1606
|
const privateLayer = moveSegmentToPrivateLabelmap(segmentation, segmentIndex, { moveStepCallback: (step) => (moveStep = step) });
|
|
1601
|
-
const privateBinding = (0,
|
|
1607
|
+
const privateBinding = (0,_labelmapSegmentBindings_js__rspack_import_3/* .getSegmentBinding */.hM)(segmentation, segmentIndex);
|
|
1602
1608
|
if (privateLayer && privateBinding) {
|
|
1603
1609
|
activeLayer = privateLayer;
|
|
1604
1610
|
labelmapId = privateBinding.labelmapId;
|
|
@@ -1625,6 +1631,53 @@ function beginLabelmapEditTransaction(segmentation, options) {
|
|
|
1625
1631
|
moveStep,
|
|
1626
1632
|
};
|
|
1627
1633
|
}
|
|
1634
|
+
function getLockedVoxelsOnOtherLayers(segmentation, labelmapId, segmentsLocked = [], targetOptions = {}) {
|
|
1635
|
+
const labelValuesByLayer = new Map();
|
|
1636
|
+
for (const lockedSegmentIndex of segmentsLocked) {
|
|
1637
|
+
const binding = (0,_labelmapSegmentBindings_js__rspack_import_3/* .getSegmentBinding */.hM)(segmentation, lockedSegmentIndex);
|
|
1638
|
+
if (!binding || binding.labelmapId === labelmapId) {
|
|
1639
|
+
continue;
|
|
1640
|
+
}
|
|
1641
|
+
if (!labelValuesByLayer.has(binding.labelmapId)) {
|
|
1642
|
+
labelValuesByLayer.set(binding.labelmapId, new Set());
|
|
1643
|
+
}
|
|
1644
|
+
labelValuesByLayer.get(binding.labelmapId).add(binding.labelValue);
|
|
1645
|
+
}
|
|
1646
|
+
const { sourceLayer: editedLayer, imageId: editedImageId } = targetOptions;
|
|
1647
|
+
const editedImageIndex = editedLayer?.imageIds?.indexOf(editedImageId) ?? -1;
|
|
1648
|
+
const referencedImageId = editedLayer?.referencedImageIds && editedImageIndex >= 0
|
|
1649
|
+
? (0,_labelmapImageIdMapping_js__rspack_import_2/* .getReferencedImageIdForImageIndex */.cj)(editedLayer, editedImageIndex)
|
|
1650
|
+
: undefined;
|
|
1651
|
+
const isVolumeEdit = targetOptions.preferVolume ||
|
|
1652
|
+
targetOptions.viewport instanceof _cornerstonejs_core__rspack_import_0.BaseVolumeViewport;
|
|
1653
|
+
const lockedVoxels = [];
|
|
1654
|
+
labelValuesByLayer.forEach((labelValues, lockedLabelmapId) => {
|
|
1655
|
+
const layer = (0,_labelmapLayerStore_js__rspack_import_1/* .getLabelmap */.Hs)(segmentation, lockedLabelmapId);
|
|
1656
|
+
if (!layer) {
|
|
1657
|
+
return;
|
|
1658
|
+
}
|
|
1659
|
+
let layerTargetOptions = targetOptions;
|
|
1660
|
+
if (!isVolumeEdit &&
|
|
1661
|
+
!layer.volumeId &&
|
|
1662
|
+
referencedImageId &&
|
|
1663
|
+
layer.referencedImageIds) {
|
|
1664
|
+
const [lockedImageId] = (0,_labelmapImageIdMapping_js__rspack_import_2/* .getLabelmapImageIdsForReferencedImageId */.s_)(layer, referencedImageId);
|
|
1665
|
+
if (!lockedImageId) {
|
|
1666
|
+
return;
|
|
1667
|
+
}
|
|
1668
|
+
layerTargetOptions = {
|
|
1669
|
+
...targetOptions,
|
|
1670
|
+
imageId: lockedImageId,
|
|
1671
|
+
sourceLayer: layer,
|
|
1672
|
+
};
|
|
1673
|
+
}
|
|
1674
|
+
const { voxelManager } = resolveLabelmapLayerEditTarget(layer, layerTargetOptions);
|
|
1675
|
+
if (voxelManager) {
|
|
1676
|
+
lockedVoxels.push({ voxelManager, labelValues });
|
|
1677
|
+
}
|
|
1678
|
+
});
|
|
1679
|
+
return lockedVoxels;
|
|
1680
|
+
}
|
|
1628
1681
|
function getViewportImageIds(viewport) {
|
|
1629
1682
|
const stackViewport = viewport;
|
|
1630
1683
|
return typeof stackViewport?.getImageIds === 'function'
|
|
@@ -1766,6 +1819,7 @@ function eraseLabelmapEditTransactionOverwrites(segmentation, transaction, optio
|
|
|
1766
1819
|
|
|
1767
1820
|
__webpack_require__.d(__webpack_exports__, {
|
|
1768
1821
|
Qk: () => (beginLabelmapEditTransaction),
|
|
1822
|
+
RP: () => (getLockedVoxelsOnOtherLayers),
|
|
1769
1823
|
Ry: () => (eraseLabelmapEditTransactionOverwrites),
|
|
1770
1824
|
VQ: () => (resolveLabelmapLayerEditTarget)
|
|
1771
1825
|
});
|
|
@@ -1816,338 +1870,12 @@ function hasMultipleLabelmapImagesPerReferencedImageId(layer) {
|
|
|
1816
1870
|
|
|
1817
1871
|
__webpack_require__.d(__webpack_exports__, {
|
|
1818
1872
|
Zd: () => (forEachLabelmapImageReference),
|
|
1873
|
+
cj: () => (getReferencedImageIdForImageIndex),
|
|
1819
1874
|
dm: () => (hasMultipleLabelmapImagesPerReferencedImageId),
|
|
1820
1875
|
s_: () => (getLabelmapImageIdsForReferencedImageId)
|
|
1821
1876
|
});
|
|
1822
1877
|
|
|
1823
1878
|
|
|
1824
|
-
},
|
|
1825
|
-
78691(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1826
|
-
"use strict";
|
|
1827
|
-
/* import */ var _cornerstonejs_core__rspack_import_0 = __webpack_require__(62721);
|
|
1828
|
-
/* import */ var _helpers_getViewportLabelmapRenderMode_js__rspack_import_1 = __webpack_require__(15422);
|
|
1829
|
-
/* import */ var _normalizeLabelmapSegmentationData_js__rspack_import_2 = __webpack_require__(18782);
|
|
1830
|
-
/* import */ var _labelmapLayerStore_js__rspack_import_3 = __webpack_require__(53325);
|
|
1831
|
-
/* import */ var _labelmapSegmentBindings_js__rspack_import_4 = __webpack_require__(53344);
|
|
1832
|
-
/* import */ var _labelmapLegacyAdapter_js__rspack_import_5 = __webpack_require__(19637);
|
|
1833
|
-
/* import */ var _labelmapImageIdMapping_js__rspack_import_6 = __webpack_require__(27749);
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
class LabelmapImageReferenceResolver {
|
|
1842
|
-
constructor(getSegmentation) {
|
|
1843
|
-
this.stackLabelmapImageIdReferenceMap = new Map();
|
|
1844
|
-
this.labelmapImageIdReferenceMap = new Map();
|
|
1845
|
-
this.keysBySegmentationId = new Map();
|
|
1846
|
-
this.completedScanResultsBySegmentationId = new Map();
|
|
1847
|
-
this.getSegmentation = getSegmentation;
|
|
1848
|
-
}
|
|
1849
|
-
reset() {
|
|
1850
|
-
this.stackLabelmapImageIdReferenceMap.clear();
|
|
1851
|
-
this.labelmapImageIdReferenceMap.clear();
|
|
1852
|
-
this.keysBySegmentationId.clear();
|
|
1853
|
-
this.completedScanResultsBySegmentationId.clear();
|
|
1854
|
-
}
|
|
1855
|
-
removeSegmentation(segmentationId) {
|
|
1856
|
-
this.stackLabelmapImageIdReferenceMap.delete(segmentationId);
|
|
1857
|
-
this.completedScanResultsBySegmentationId.delete(segmentationId);
|
|
1858
|
-
const keys = this.keysBySegmentationId.get(segmentationId);
|
|
1859
|
-
if (keys) {
|
|
1860
|
-
for (const key of keys) {
|
|
1861
|
-
this.labelmapImageIdReferenceMap.delete(key);
|
|
1862
|
-
}
|
|
1863
|
-
this.keysBySegmentationId.delete(segmentationId);
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
setLabelmapImageIds(segmentationId, key, labelmapImageIds) {
|
|
1867
|
-
this.labelmapImageIdReferenceMap.set(key, labelmapImageIds);
|
|
1868
|
-
let keys = this.keysBySegmentationId.get(segmentationId);
|
|
1869
|
-
if (!keys) {
|
|
1870
|
-
keys = new Set();
|
|
1871
|
-
this.keysBySegmentationId.set(segmentationId, keys);
|
|
1872
|
-
}
|
|
1873
|
-
keys.add(key);
|
|
1874
|
-
}
|
|
1875
|
-
getLabelmapImageIds(representationData) {
|
|
1876
|
-
const labelmapData = representationData.Labelmap;
|
|
1877
|
-
let labelmapImageIds;
|
|
1878
|
-
if (!labelmapData) {
|
|
1879
|
-
return;
|
|
1880
|
-
}
|
|
1881
|
-
if (labelmapData?.labelmaps) {
|
|
1882
|
-
const imageIds = Object.values(labelmapData.labelmaps).flatMap((layer) => {
|
|
1883
|
-
if (layer.imageIds?.length) {
|
|
1884
|
-
return layer.imageIds;
|
|
1885
|
-
}
|
|
1886
|
-
if (layer.volumeId) {
|
|
1887
|
-
return _cornerstonejs_core__rspack_import_0.cache.getVolume(layer.volumeId)
|
|
1888
|
-
?.imageIds;
|
|
1889
|
-
}
|
|
1890
|
-
return [];
|
|
1891
|
-
});
|
|
1892
|
-
return Array.from(new Set(imageIds.filter(Boolean)));
|
|
1893
|
-
}
|
|
1894
|
-
if (labelmapData.imageIds) {
|
|
1895
|
-
labelmapImageIds = labelmapData
|
|
1896
|
-
.imageIds;
|
|
1897
|
-
}
|
|
1898
|
-
else if (labelmapData.volumeId) {
|
|
1899
|
-
const volumeId = labelmapData
|
|
1900
|
-
.volumeId;
|
|
1901
|
-
const volume = _cornerstonejs_core__rspack_import_0.cache.getVolume(volumeId);
|
|
1902
|
-
labelmapImageIds = volume.imageIds;
|
|
1903
|
-
}
|
|
1904
|
-
return labelmapImageIds;
|
|
1905
|
-
}
|
|
1906
|
-
getLabelmapImageIdsForImageId(imageId, segmentationId) {
|
|
1907
|
-
const segmentation = this.getSegmentation(segmentationId);
|
|
1908
|
-
if (!segmentation?.representationData?.Labelmap) {
|
|
1909
|
-
return;
|
|
1910
|
-
}
|
|
1911
|
-
(0,_normalizeLabelmapSegmentationData_js__rspack_import_2/* .ensureLabelmapState */.uk)(segmentation);
|
|
1912
|
-
return (0,_labelmapLegacyAdapter_js__rspack_import_5/* .getReferencedImageIdToCurrentImageIdMap */._)(segmentation).get(imageId);
|
|
1913
|
-
}
|
|
1914
|
-
updateLabelmapSegmentationImageReferences(viewportId, segmentationId) {
|
|
1915
|
-
const segmentation = this.getSegmentation(segmentationId);
|
|
1916
|
-
if (!segmentation) {
|
|
1917
|
-
return;
|
|
1918
|
-
}
|
|
1919
|
-
if (!this.stackLabelmapImageIdReferenceMap.has(segmentationId)) {
|
|
1920
|
-
this.stackLabelmapImageIdReferenceMap.set(segmentationId, new Map());
|
|
1921
|
-
}
|
|
1922
|
-
const { representationData } = segmentation;
|
|
1923
|
-
if (!representationData.Labelmap) {
|
|
1924
|
-
return;
|
|
1925
|
-
}
|
|
1926
|
-
const labelmapImageIds = this.getLabelmapImageIds(representationData);
|
|
1927
|
-
const enabledElement = (0,_cornerstonejs_core__rspack_import_0.getEnabledElementByViewportId)(viewportId);
|
|
1928
|
-
if (!enabledElement || !labelmapImageIds?.length) {
|
|
1929
|
-
return;
|
|
1930
|
-
}
|
|
1931
|
-
const viewport = enabledElement.viewport;
|
|
1932
|
-
const scanKey = this.generateScanKey('current', viewport, labelmapImageIds);
|
|
1933
|
-
if (scanKey && this.hasCompletedScan(segmentationId, scanKey)) {
|
|
1934
|
-
return this.getCompletedScanResult(segmentationId, scanKey);
|
|
1935
|
-
}
|
|
1936
|
-
const result = this.updateLabelmapSegmentationReferences(segmentationId, viewport, labelmapImageIds);
|
|
1937
|
-
if (scanKey) {
|
|
1938
|
-
this.markCompletedScan(segmentationId, scanKey, result);
|
|
1939
|
-
}
|
|
1940
|
-
return result;
|
|
1941
|
-
}
|
|
1942
|
-
generateScanKey(kind, viewport, labelmapImageIds) {
|
|
1943
|
-
const referenceImageId = typeof viewport.getCurrentImageId === 'function'
|
|
1944
|
-
? viewport.getCurrentImageId()
|
|
1945
|
-
: undefined;
|
|
1946
|
-
if (!referenceImageId) {
|
|
1947
|
-
return;
|
|
1948
|
-
}
|
|
1949
|
-
return `${kind}|${viewport.id}|${referenceImageId}|${labelmapImageIds.length}|${labelmapImageIds[0]}|${labelmapImageIds[labelmapImageIds.length - 1]}`;
|
|
1950
|
-
}
|
|
1951
|
-
hasCompletedScan(segmentationId, scanKey) {
|
|
1952
|
-
return !!this.completedScanResultsBySegmentationId
|
|
1953
|
-
.get(segmentationId)
|
|
1954
|
-
?.has(scanKey);
|
|
1955
|
-
}
|
|
1956
|
-
getCompletedScanResult(segmentationId, scanKey) {
|
|
1957
|
-
return this.completedScanResultsBySegmentationId
|
|
1958
|
-
.get(segmentationId)
|
|
1959
|
-
?.get(scanKey);
|
|
1960
|
-
}
|
|
1961
|
-
markCompletedScan(segmentationId, scanKey, result) {
|
|
1962
|
-
let results = this.completedScanResultsBySegmentationId.get(segmentationId);
|
|
1963
|
-
if (!results) {
|
|
1964
|
-
results = new Map();
|
|
1965
|
-
this.completedScanResultsBySegmentationId.set(segmentationId, results);
|
|
1966
|
-
}
|
|
1967
|
-
results.set(scanKey, result);
|
|
1968
|
-
}
|
|
1969
|
-
getCurrentLabelmapImageIdsForViewport(viewportId, segmentationId) {
|
|
1970
|
-
const enabledElement = (0,_cornerstonejs_core__rspack_import_0.getEnabledElementByViewportId)(viewportId);
|
|
1971
|
-
if (!enabledElement) {
|
|
1972
|
-
return;
|
|
1973
|
-
}
|
|
1974
|
-
const { viewport } = enabledElement;
|
|
1975
|
-
const viewportRenderMode = (0,_helpers_getViewportLabelmapRenderMode_js__rspack_import_1/* ["default"] */.A)(viewport);
|
|
1976
|
-
if (viewportRenderMode !== 'image' ||
|
|
1977
|
-
typeof viewport.getCurrentImageId !== 'function') {
|
|
1978
|
-
return;
|
|
1979
|
-
}
|
|
1980
|
-
const referenceImageId = viewport.getCurrentImageId();
|
|
1981
|
-
const segmentation = this.getSegmentation(segmentationId);
|
|
1982
|
-
if (!segmentation) {
|
|
1983
|
-
return;
|
|
1984
|
-
}
|
|
1985
|
-
(0,_normalizeLabelmapSegmentationData_js__rspack_import_2/* .ensureLabelmapState */.uk)(segmentation);
|
|
1986
|
-
const viewportImageIds = viewport.getImageIds();
|
|
1987
|
-
const currentIndex = viewportImageIds.indexOf(referenceImageId);
|
|
1988
|
-
const labelmapImageIds = [];
|
|
1989
|
-
(0,_labelmapLayerStore_js__rspack_import_3/* .getLabelmaps */.m)(segmentation).forEach((layer) => {
|
|
1990
|
-
const referencedLabelmapImageIds = (0,_labelmapImageIdMapping_js__rspack_import_6/* .getLabelmapImageIdsForReferencedImageId */.s_)(layer, referenceImageId);
|
|
1991
|
-
if (referencedLabelmapImageIds.length) {
|
|
1992
|
-
labelmapImageIds.push(...referencedLabelmapImageIds);
|
|
1993
|
-
return;
|
|
1994
|
-
}
|
|
1995
|
-
if (currentIndex !== -1 && layer.imageIds?.[currentIndex]) {
|
|
1996
|
-
labelmapImageIds.push(layer.imageIds[currentIndex]);
|
|
1997
|
-
return;
|
|
1998
|
-
}
|
|
1999
|
-
layer.imageIds?.some((candidateImageId) => {
|
|
2000
|
-
const viewableImageId = viewport.isReferenceViewable({ referencedImageId: candidateImageId }, { asOverlay: true });
|
|
2001
|
-
if (viewableImageId) {
|
|
2002
|
-
labelmapImageIds.push(candidateImageId);
|
|
2003
|
-
}
|
|
2004
|
-
return !!viewableImageId;
|
|
2005
|
-
});
|
|
2006
|
-
});
|
|
2007
|
-
const resolvedImageIds = Array.from(new Set(labelmapImageIds));
|
|
2008
|
-
const key = this.generateMapKey({
|
|
2009
|
-
segmentationId,
|
|
2010
|
-
referenceImageId,
|
|
2011
|
-
});
|
|
2012
|
-
this.setLabelmapImageIds(segmentationId, key, resolvedImageIds);
|
|
2013
|
-
if (!this.stackLabelmapImageIdReferenceMap.has(segmentationId)) {
|
|
2014
|
-
this.stackLabelmapImageIdReferenceMap.set(segmentationId, new Map());
|
|
2015
|
-
}
|
|
2016
|
-
const activeSegmentIndex = Object.keys(segmentation.segments).find((segmentIndex) => segmentation.segments[segmentIndex].active);
|
|
2017
|
-
const activeImageId = activeSegmentIndex
|
|
2018
|
-
? (0,_labelmapSegmentBindings_js__rspack_import_4/* .getLabelmapForSegment */.r)(segmentation, Number(activeSegmentIndex))
|
|
2019
|
-
?.imageIds?.[currentIndex]
|
|
2020
|
-
: undefined;
|
|
2021
|
-
this.stackLabelmapImageIdReferenceMap
|
|
2022
|
-
.get(segmentationId)
|
|
2023
|
-
.set(referenceImageId, activeImageId ?? resolvedImageIds[0]);
|
|
2024
|
-
return resolvedImageIds;
|
|
2025
|
-
}
|
|
2026
|
-
getCurrentLabelmapImageIdForViewport(viewportId, segmentationId) {
|
|
2027
|
-
const enabledElement = (0,_cornerstonejs_core__rspack_import_0.getEnabledElementByViewportId)(viewportId);
|
|
2028
|
-
if (!enabledElement) {
|
|
2029
|
-
return;
|
|
2030
|
-
}
|
|
2031
|
-
const { viewport } = enabledElement;
|
|
2032
|
-
const viewportRenderMode = (0,_helpers_getViewportLabelmapRenderMode_js__rspack_import_1/* ["default"] */.A)(viewport);
|
|
2033
|
-
if (viewportRenderMode !== 'image' ||
|
|
2034
|
-
typeof viewport.getCurrentImageId !== 'function') {
|
|
2035
|
-
return;
|
|
2036
|
-
}
|
|
2037
|
-
const currentImageId = viewport.getCurrentImageId();
|
|
2038
|
-
const currentImageIds = this.getCurrentLabelmapImageIdsForViewport(viewportId, segmentationId);
|
|
2039
|
-
if (!currentImageIds?.length) {
|
|
2040
|
-
return;
|
|
2041
|
-
}
|
|
2042
|
-
const segmentation = this.getSegmentation(segmentationId);
|
|
2043
|
-
const currentIndex = viewport
|
|
2044
|
-
.getImageIds()
|
|
2045
|
-
.indexOf(currentImageId);
|
|
2046
|
-
const activeSegmentIndex = segmentation
|
|
2047
|
-
? Object.keys(segmentation.segments).find((segmentIndex) => segmentation.segments[segmentIndex].active)
|
|
2048
|
-
: undefined;
|
|
2049
|
-
const activeImageId = segmentation && activeSegmentIndex
|
|
2050
|
-
? (0,_labelmapSegmentBindings_js__rspack_import_4/* .getLabelmapForSegment */.r)(segmentation, Number(activeSegmentIndex))
|
|
2051
|
-
?.imageIds?.[currentIndex]
|
|
2052
|
-
: undefined;
|
|
2053
|
-
return activeImageId ?? currentImageIds[0];
|
|
2054
|
-
}
|
|
2055
|
-
getStackSegmentationImageIdsForViewport(viewportId, segmentationId) {
|
|
2056
|
-
const segmentation = this.getSegmentation(segmentationId);
|
|
2057
|
-
if (!segmentation) {
|
|
2058
|
-
return [];
|
|
2059
|
-
}
|
|
2060
|
-
this.updateAllLabelmapSegmentationImageReferences(viewportId, segmentationId);
|
|
2061
|
-
const enabledElement = (0,_cornerstonejs_core__rspack_import_0.getEnabledElementByViewportId)(viewportId);
|
|
2062
|
-
const imageIds = enabledElement?.viewport.getImageIds?.() ?? [];
|
|
2063
|
-
const imageIdMap = (0,_labelmapLegacyAdapter_js__rspack_import_5/* .getReferencedImageIdToCurrentImageIdMap */._)(segmentation);
|
|
2064
|
-
return imageIds.flatMap((imageId) => imageIdMap.get(imageId) ?? []);
|
|
2065
|
-
}
|
|
2066
|
-
updateLabelmapSegmentationReferences(segmentationId, viewport, labelmapImageIds, updateCallback) {
|
|
2067
|
-
const referenceImageId = viewport.getCurrentImageId();
|
|
2068
|
-
let viewableLabelmapImageIdFound = false;
|
|
2069
|
-
for (const labelmapImageId of labelmapImageIds) {
|
|
2070
|
-
const viewableImageId = viewport.isReferenceViewable({ referencedImageId: labelmapImageId }, { asOverlay: true });
|
|
2071
|
-
if (viewableImageId) {
|
|
2072
|
-
viewableLabelmapImageIdFound = true;
|
|
2073
|
-
this.stackLabelmapImageIdReferenceMap
|
|
2074
|
-
.get(segmentationId)
|
|
2075
|
-
.set(referenceImageId, labelmapImageId);
|
|
2076
|
-
this.updateLabelmapImageIdReferenceMap({
|
|
2077
|
-
segmentationId,
|
|
2078
|
-
referenceImageId,
|
|
2079
|
-
labelmapImageId,
|
|
2080
|
-
});
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
updateCallback?.(viewport, segmentationId, labelmapImageIds);
|
|
2084
|
-
return viewableLabelmapImageIdFound
|
|
2085
|
-
? this.stackLabelmapImageIdReferenceMap
|
|
2086
|
-
.get(segmentationId)
|
|
2087
|
-
.get(referenceImageId)
|
|
2088
|
-
: undefined;
|
|
2089
|
-
}
|
|
2090
|
-
updateAllLabelmapSegmentationImageReferences(viewportId, segmentationId) {
|
|
2091
|
-
const segmentation = this.getSegmentation(segmentationId);
|
|
2092
|
-
if (!segmentation) {
|
|
2093
|
-
return;
|
|
2094
|
-
}
|
|
2095
|
-
if (!this.stackLabelmapImageIdReferenceMap.has(segmentationId)) {
|
|
2096
|
-
this.stackLabelmapImageIdReferenceMap.set(segmentationId, new Map());
|
|
2097
|
-
}
|
|
2098
|
-
const { representationData } = segmentation;
|
|
2099
|
-
if (!representationData.Labelmap) {
|
|
2100
|
-
return;
|
|
2101
|
-
}
|
|
2102
|
-
const labelmapImageIds = this.getLabelmapImageIds(representationData);
|
|
2103
|
-
const enabledElement = (0,_cornerstonejs_core__rspack_import_0.getEnabledElementByViewportId)(viewportId);
|
|
2104
|
-
if (!enabledElement || !labelmapImageIds?.length) {
|
|
2105
|
-
return;
|
|
2106
|
-
}
|
|
2107
|
-
const stackViewport = enabledElement.viewport;
|
|
2108
|
-
const scanKey = this.generateScanKey('all', stackViewport, labelmapImageIds);
|
|
2109
|
-
if (scanKey && this.hasCompletedScan(segmentationId, scanKey)) {
|
|
2110
|
-
return;
|
|
2111
|
-
}
|
|
2112
|
-
if (scanKey) {
|
|
2113
|
-
this.markCompletedScan(segmentationId, scanKey);
|
|
2114
|
-
}
|
|
2115
|
-
this.updateLabelmapSegmentationReferences(segmentationId, stackViewport, labelmapImageIds, (stackViewport, segmentationId, labelmapImageIds) => {
|
|
2116
|
-
const imageIds = stackViewport.getImageIds();
|
|
2117
|
-
imageIds.forEach((referenceImageId, index) => {
|
|
2118
|
-
for (const labelmapImageId of labelmapImageIds) {
|
|
2119
|
-
const viewableImageId = stackViewport.isReferenceViewable({ referencedImageId: labelmapImageId, sliceIndex: index }, { asOverlay: true, withNavigation: true });
|
|
2120
|
-
if (viewableImageId) {
|
|
2121
|
-
this.stackLabelmapImageIdReferenceMap
|
|
2122
|
-
.get(segmentationId)
|
|
2123
|
-
.set(referenceImageId, labelmapImageId);
|
|
2124
|
-
this.updateLabelmapImageIdReferenceMap({
|
|
2125
|
-
segmentationId,
|
|
2126
|
-
referenceImageId,
|
|
2127
|
-
labelmapImageId,
|
|
2128
|
-
});
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
});
|
|
2132
|
-
});
|
|
2133
|
-
}
|
|
2134
|
-
updateLabelmapImageIdReferenceMap({ segmentationId, referenceImageId, labelmapImageId, }) {
|
|
2135
|
-
const key = this.generateMapKey({ segmentationId, referenceImageId });
|
|
2136
|
-
if (!this.labelmapImageIdReferenceMap.has(key)) {
|
|
2137
|
-
this.setLabelmapImageIds(segmentationId, key, [labelmapImageId]);
|
|
2138
|
-
return;
|
|
2139
|
-
}
|
|
2140
|
-
const currentValues = this.labelmapImageIdReferenceMap.get(key) ?? [];
|
|
2141
|
-
const newValues = Array.from(new Set([...currentValues, labelmapImageId]));
|
|
2142
|
-
this.setLabelmapImageIds(segmentationId, key, newValues);
|
|
2143
|
-
}
|
|
2144
|
-
generateMapKey({ segmentationId, referenceImageId }) {
|
|
2145
|
-
return `${segmentationId}-${referenceImageId}`;
|
|
2146
|
-
}
|
|
2147
|
-
}
|
|
2148
|
-
/* export default */ __webpack_exports__.A = (LabelmapImageReferenceResolver);
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
1879
|
},
|
|
2152
1880
|
19637(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2153
1881
|
"use strict";
|
|
@@ -4585,6 +4313,7 @@ function prepareOverlapOperationData(operationData) {
|
|
|
4585
4313
|
const transaction = (0,labelmapSegmentationState/* .beginLabelmapEditTransaction */.Qk)(segmentation, {
|
|
4586
4314
|
segmentIndex: operationData.segmentIndex,
|
|
4587
4315
|
overwriteSegmentIndices: operationData.overwriteSegmentIndices,
|
|
4316
|
+
segmentsLocked: operationData.segmentsLocked,
|
|
4588
4317
|
segmentationVoxelManager: operationData.segmentationVoxelManager,
|
|
4589
4318
|
segmentationImageData: operationData.segmentationImageData,
|
|
4590
4319
|
isInObject: operationData.isInObject,
|
|
@@ -4610,6 +4339,11 @@ function prepareOverlapOperationData(operationData) {
|
|
|
4610
4339
|
operationData.segmentationVoxelManager = target.voxelManager;
|
|
4611
4340
|
}
|
|
4612
4341
|
}
|
|
4342
|
+
transaction.lockedVoxelsOnOtherLayers = (0,labelmapSegmentationState/* .getLockedVoxelsOnOtherLayers */.RP)(segmentation, transaction.labelmapId, operationData.segmentsLocked, {
|
|
4343
|
+
viewport: operationData.viewport,
|
|
4344
|
+
imageId: operationData.imageId,
|
|
4345
|
+
sourceLayer: transaction.activeLayer,
|
|
4346
|
+
});
|
|
4613
4347
|
}
|
|
4614
4348
|
|
|
4615
4349
|
|
|
@@ -5090,27 +4824,34 @@ var getViewportIdsWithSegmentation = __webpack_require__(66155);
|
|
|
5090
4824
|
},
|
|
5091
4825
|
});
|
|
5092
4826
|
|
|
4827
|
+
// EXTERNAL MODULE: ../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/strategies/utils/brushVoxelSlab.js
|
|
4828
|
+
var brushVoxelSlab = __webpack_require__(90058);
|
|
5093
4829
|
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/tools/dist/esm/tools/segmentation/strategies/compositions/regionFill.js
|
|
5094
4830
|
|
|
4831
|
+
|
|
5095
4832
|
/* export default */ var regionFill = ({
|
|
5096
4833
|
[StrategyCallbacks/* ["default"].Fill */.A.Fill]: (operationData) => {
|
|
5097
|
-
const {
|
|
4834
|
+
const { segmentationImageData, segmentationVoxelManager, brushStrategy, centerIJK, brushVoxelSlabFill, } = operationData;
|
|
5098
4835
|
const isWithinThreshold = brushStrategy.createIsInThreshold?.(operationData);
|
|
5099
4836
|
const { setValue } = brushStrategy;
|
|
5100
4837
|
const callback = isWithinThreshold
|
|
5101
4838
|
? (data) => {
|
|
5102
|
-
|
|
5103
|
-
if (segmentsLocked.includes(value) || !isWithinThreshold(index)) {
|
|
4839
|
+
if (!isWithinThreshold(data.index)) {
|
|
5104
4840
|
return;
|
|
5105
4841
|
}
|
|
5106
4842
|
setValue(operationData, data);
|
|
5107
4843
|
}
|
|
5108
4844
|
: (data) => setValue(operationData, data);
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
4845
|
+
if (brushVoxelSlabFill) {
|
|
4846
|
+
(0,brushVoxelSlab/* .forEachBrushFillVoxel */.Uk)(brushVoxelSlabFill, segmentationVoxelManager, callback);
|
|
4847
|
+
}
|
|
4848
|
+
else {
|
|
4849
|
+
segmentationVoxelManager.forEach(callback, {
|
|
4850
|
+
imageData: segmentationImageData,
|
|
4851
|
+
isInObject: operationData.isInObject,
|
|
4852
|
+
boundsIJK: operationData.isInObjectBoundsIJK,
|
|
4853
|
+
});
|
|
4854
|
+
}
|
|
5114
4855
|
segmentationVoxelManager.addPoint(centerIJK);
|
|
5115
4856
|
},
|
|
5116
4857
|
});
|
|
@@ -5213,7 +4954,7 @@ var labelmapSegmentationState = __webpack_require__(92996);
|
|
|
5213
4954
|
|
|
5214
4955
|
/* export default */ var compositions_setValue = ({
|
|
5215
4956
|
[StrategyCallbacks/* ["default"].INTERNAL_setValue */.A.INTERNAL_setValue]: (operationData, { value, index }) => {
|
|
5216
|
-
const { segmentsLocked, previewSegmentIndex, memo, segmentationVoxelManager, centerSegmentIndexInfo, segmentIndex, labelValue, labelmapId, segmentationId, } = operationData;
|
|
4957
|
+
const { segmentsLocked, previewSegmentIndex, memo, segmentationVoxelManager, centerSegmentIndexInfo, segmentIndex, labelValue, labelmapId, segmentationId, labelmapEditTransaction, } = operationData;
|
|
5217
4958
|
const existingValue = segmentationVoxelManager.getAtIndex(index);
|
|
5218
4959
|
const segmentation = (0,getSegmentation/* .getSegmentation */.T)(segmentationId);
|
|
5219
4960
|
const existingSegmentIndex = segmentation && labelmapId
|
|
@@ -5223,6 +4964,10 @@ var labelmapSegmentationState = __webpack_require__(92996);
|
|
|
5223
4964
|
if (segmentsLocked.includes(existingSegmentIndex)) {
|
|
5224
4965
|
return;
|
|
5225
4966
|
}
|
|
4967
|
+
if (writeValue &&
|
|
4968
|
+
labelmapEditTransaction?.lockedVoxelsOnOtherLayers?.some(({ voxelManager, labelValues }) => labelValues.has(voxelManager.getAtIndex(index)))) {
|
|
4969
|
+
return;
|
|
4970
|
+
}
|
|
5226
4971
|
if (!centerSegmentIndexInfo &&
|
|
5227
4972
|
existingValue === (labelValue ?? segmentIndex)) {
|
|
5228
4973
|
return;
|
|
@@ -5502,7 +5247,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5502
5247
|
/* import */ var _compositions_index_js__rspack_import_3 = __webpack_require__(68292);
|
|
5503
5248
|
/* import */ var _enums_StrategyCallbacks_js__rspack_import_4 = __webpack_require__(48413);
|
|
5504
5249
|
/* import */ var _fillCircle_js__rspack_import_5 = __webpack_require__(35637);
|
|
5505
|
-
/* import */ var
|
|
5250
|
+
/* import */ var _utils_brushVoxelSlab_js__rspack_import_6 = __webpack_require__(90058);
|
|
5251
|
+
/* import */ var _utilities_getSphereBoundsInfo_js__rspack_import_7 = __webpack_require__(10312);
|
|
5252
|
+
|
|
5506
5253
|
|
|
5507
5254
|
|
|
5508
5255
|
|
|
@@ -5513,7 +5260,7 @@ const { transformWorldToIndex, getNormalizedAspectRatio } = _cornerstonejs_core_
|
|
|
5513
5260
|
|
|
5514
5261
|
const sphereComposition = {
|
|
5515
5262
|
[_enums_StrategyCallbacks_js__rspack_import_4/* ["default"].Initialize */.A.Initialize]: (operationData) => {
|
|
5516
|
-
const { points, viewport, segmentationImageData } = operationData;
|
|
5263
|
+
const { points, viewport, segmentationImageData, viewUp, viewPlaneNormal } = operationData;
|
|
5517
5264
|
if (!points) {
|
|
5518
5265
|
return;
|
|
5519
5266
|
}
|
|
@@ -5527,7 +5274,6 @@ const sphereComposition = {
|
|
|
5527
5274
|
}
|
|
5528
5275
|
operationData.centerWorld = center;
|
|
5529
5276
|
operationData.centerIJK = transformWorldToIndex(segmentationImageData, center);
|
|
5530
|
-
const baseExtent = (0,_utilities_getSphereBoundsInfo_js__rspack_import_6/* .getSphereBoundsInfoFromViewport */.l)(points.slice(0, 2), segmentationImageData, viewport);
|
|
5531
5277
|
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
5532
5278
|
const corners = (0,_fillCircle_js__rspack_import_5/* .getEllipseCornersFromCanvasCoordinates */.C$)(canvasCoordinates);
|
|
5533
5279
|
const cornersInWorld = corners.map((corner) => viewport.canvasToWorld(corner));
|
|
@@ -5538,73 +5284,67 @@ const sphereComposition = {
|
|
|
5538
5284
|
const xRadius = points.length >= 2
|
|
5539
5285
|
? gl_matrix__rspack_import_1/* .vec3.distance */.eR.Io(points[2], points[3]) / 2 / aspectRatio[0]
|
|
5540
5286
|
: 0;
|
|
5541
|
-
const
|
|
5542
|
-
|
|
5287
|
+
const normalizedViewUp = gl_matrix__rspack_import_1/* .vec3.fromValues */.eR.fA(viewUp[0], viewUp[1], viewUp[2]);
|
|
5288
|
+
gl_matrix__rspack_import_1/* .vec3.normalize */.eR.S8(normalizedViewUp, normalizedViewUp);
|
|
5289
|
+
const normalizedPlaneNormal = gl_matrix__rspack_import_1/* .vec3.fromValues */.eR.fA(viewPlaneNormal[0], viewPlaneNormal[1], viewPlaneNormal[2]);
|
|
5290
|
+
gl_matrix__rspack_import_1/* .vec3.normalize */.eR.S8(normalizedPlaneNormal, normalizedPlaneNormal);
|
|
5291
|
+
const viewRight = gl_matrix__rspack_import_1/* .vec3.create */.eR.vt();
|
|
5292
|
+
gl_matrix__rspack_import_1/* .vec3.cross */.eR.$A(viewRight, normalizedViewUp, normalizedPlaneNormal);
|
|
5293
|
+
gl_matrix__rspack_import_1/* .vec3.normalize */.eR.S8(viewRight, viewRight);
|
|
5294
|
+
const baseExtent = (0,_utilities_getSphereBoundsInfo_js__rspack_import_7/* .getSphereBoundsInfoFromViewport */.l)(points.slice(0, 2), segmentationImageData, viewport);
|
|
5295
|
+
const strokeCenters = operationData.strokePointsWorld?.length
|
|
5543
5296
|
? operationData.strokePointsWorld
|
|
5544
5297
|
: [operationData.centerWorld];
|
|
5545
5298
|
const baseBounds = baseExtent.boundsIJK;
|
|
5546
5299
|
const baseCenterIJK = operationData.centerIJK;
|
|
5547
|
-
const boundsForStroke = strokeCenters.reduce((
|
|
5300
|
+
const boundsForStroke = strokeCenters.reduce((accumulated, centerPoint) => {
|
|
5548
5301
|
if (!centerPoint) {
|
|
5549
|
-
return
|
|
5302
|
+
return accumulated;
|
|
5550
5303
|
}
|
|
5551
5304
|
const translatedCenterIJK = transformWorldToIndex(segmentationImageData, centerPoint);
|
|
5552
|
-
const
|
|
5553
|
-
translatedCenterIJK[
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
];
|
|
5562
|
-
if (!acc) {
|
|
5563
|
-
return translatedBounds;
|
|
5305
|
+
const translated = [0, 1, 2].map((axis) => {
|
|
5306
|
+
const delta = translatedCenterIJK[axis] - baseCenterIJK[axis];
|
|
5307
|
+
return [
|
|
5308
|
+
baseBounds[axis][0] + delta,
|
|
5309
|
+
baseBounds[axis][1] + delta,
|
|
5310
|
+
];
|
|
5311
|
+
});
|
|
5312
|
+
if (!accumulated) {
|
|
5313
|
+
return translated;
|
|
5564
5314
|
}
|
|
5565
|
-
return [
|
|
5566
|
-
[
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
],
|
|
5570
|
-
[
|
|
5571
|
-
Math.min(acc[1][0], translatedBounds[1][0]),
|
|
5572
|
-
Math.max(acc[1][1], translatedBounds[1][1]),
|
|
5573
|
-
],
|
|
5574
|
-
[
|
|
5575
|
-
Math.min(acc[2][0], translatedBounds[2][0]),
|
|
5576
|
-
Math.max(acc[2][1], translatedBounds[2][1]),
|
|
5577
|
-
],
|
|
5578
|
-
];
|
|
5315
|
+
return [0, 1, 2].map((axis) => [
|
|
5316
|
+
Math.min(accumulated[axis][0], translated[axis][0]),
|
|
5317
|
+
Math.max(accumulated[axis][1], translated[axis][1]),
|
|
5318
|
+
]);
|
|
5579
5319
|
}, null);
|
|
5580
5320
|
const boundsToUse = boundsForStroke ?? baseExtent.boundsIJK;
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
[
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
[
|
|
5589
|
-
Math.max(0, Math.min(boundsToUse[1][0], dimensions[1] - 1)),
|
|
5590
|
-
Math.max(0, Math.min(boundsToUse[1][1], dimensions[1] - 1)),
|
|
5591
|
-
],
|
|
5592
|
-
[
|
|
5593
|
-
Math.max(0, Math.min(boundsToUse[2][0], dimensions[2] - 1)),
|
|
5594
|
-
Math.max(0, Math.min(boundsToUse[2][1], dimensions[2] - 1)),
|
|
5595
|
-
],
|
|
5596
|
-
];
|
|
5597
|
-
}
|
|
5598
|
-
else {
|
|
5599
|
-
operationData.isInObjectBoundsIJK = boundsToUse;
|
|
5600
|
-
}
|
|
5321
|
+
const dimensions = segmentationImageData?.getDimensions();
|
|
5322
|
+
operationData.isInObjectBoundsIJK = dimensions
|
|
5323
|
+
? [0, 1, 2].map((axis) => [
|
|
5324
|
+
Math.max(0, Math.min(boundsToUse[axis][0], dimensions[axis] - 1)),
|
|
5325
|
+
Math.max(0, Math.min(boundsToUse[axis][1], dimensions[axis] - 1)),
|
|
5326
|
+
])
|
|
5327
|
+
: boundsToUse;
|
|
5601
5328
|
operationData.isInObject = (0,_fillCircle_js__rspack_import_5/* .createEllipseInPoint */.mu)(cornersInWorld, {
|
|
5602
5329
|
strokePointsWorld: operationData.strokePointsWorld,
|
|
5603
5330
|
segmentationImageData,
|
|
5604
5331
|
xRadius,
|
|
5605
5332
|
yRadius,
|
|
5606
5333
|
aspectRatio,
|
|
5334
|
+
viewRight,
|
|
5335
|
+
viewUp: normalizedViewUp,
|
|
5336
|
+
viewNormal: normalizedPlaneNormal,
|
|
5337
|
+
depthRadius: Math.max(xRadius, yRadius),
|
|
5607
5338
|
});
|
|
5339
|
+
(0,_utils_brushVoxelSlab_js__rspack_import_6/* .applyBrushFill */.Ws)(operationData, (0,_utils_brushVoxelSlab_js__rspack_import_6/* .createSphereBrushFill */.Zi)({
|
|
5340
|
+
segmentationImageData,
|
|
5341
|
+
viewUp: normalizedViewUp,
|
|
5342
|
+
viewPlaneNormal: normalizedPlaneNormal,
|
|
5343
|
+
centerWorld: operationData.centerWorld,
|
|
5344
|
+
xRadius,
|
|
5345
|
+
yRadius,
|
|
5346
|
+
strokeCentersWorld: strokeCenters,
|
|
5347
|
+
}));
|
|
5608
5348
|
},
|
|
5609
5349
|
};
|
|
5610
5350
|
const SPHERE_STRATEGY = new _BrushStrategy_js__rspack_import_2/* ["default"] */.A('Sphere', _compositions_index_js__rspack_import_3/* ["default"].regionFill */.A.regionFill, _compositions_index_js__rspack_import_3/* ["default"].setValue */.A.setValue, sphereComposition, _compositions_index_js__rspack_import_3/* ["default"].determineSegmentIndex */.A.determineSegmentIndex, _compositions_index_js__rspack_import_3/* ["default"].preview */.A.preview, _compositions_index_js__rspack_import_3/* ["default"].labelmapStatistics */.A.labelmapStatistics, _compositions_index_js__rspack_import_3/* ["default"].ensureSegmentationVolumeFor3DManipulation */.A.ensureSegmentationVolumeFor3DManipulation);
|
|
@@ -5627,6 +5367,314 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5627
5367
|
});
|
|
5628
5368
|
|
|
5629
5369
|
|
|
5370
|
+
},
|
|
5371
|
+
90058(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
5372
|
+
"use strict";
|
|
5373
|
+
/* import */ var gl_matrix__rspack_import_0 = __webpack_require__(50341);
|
|
5374
|
+
/* import */ var _cornerstonejs_core__rspack_import_1 = __webpack_require__(62721);
|
|
5375
|
+
/* import */ var _utilities_sampleAreaAnnotationVoxels_js__rspack_import_2 = __webpack_require__(72821);
|
|
5376
|
+
|
|
5377
|
+
|
|
5378
|
+
|
|
5379
|
+
const brushFillLog = _cornerstonejs_core__rspack_import_1.utilities.logger.toolsLog.getLogger('segmentation', 'brushVoxelSlab');
|
|
5380
|
+
const { createEllipseShape, createRectangleShape, createUnionShape, getSlabEpsilon, getSlabHalfWidth, getVoxelThicknessAlongNormal, isSlabDepthLowInclusive, iterateVoxelsInShape, resolveReferencePlaneThickness, signedDistanceToPlane, } = _cornerstonejs_core__rspack_import_1.utilities.voxelSlab;
|
|
5381
|
+
function volumeFromImageData(imageData) {
|
|
5382
|
+
return {
|
|
5383
|
+
dimensions: imageData.getDimensions(),
|
|
5384
|
+
direction: imageData.getDirection(),
|
|
5385
|
+
spacing: imageData.getSpacing(),
|
|
5386
|
+
origin: imageData.getOrigin(),
|
|
5387
|
+
};
|
|
5388
|
+
}
|
|
5389
|
+
function getViewRight(viewUp, viewPlaneNormal) {
|
|
5390
|
+
const right = gl_matrix__rspack_import_0/* .vec3.cross */.eR.$A(gl_matrix__rspack_import_0/* .vec3.create */.eR.vt(), viewUp, viewPlaneNormal);
|
|
5391
|
+
return gl_matrix__rspack_import_0/* .vec3.normalize */.eR.S8(right, right);
|
|
5392
|
+
}
|
|
5393
|
+
function densifyStrokeCenters(centers, stepWorld) {
|
|
5394
|
+
if (centers.length <= 1 || !(stepWorld > 0)) {
|
|
5395
|
+
return centers;
|
|
5396
|
+
}
|
|
5397
|
+
const dense = [centers[0]];
|
|
5398
|
+
for (let index = 1; index < centers.length; index++) {
|
|
5399
|
+
const from = centers[index - 1];
|
|
5400
|
+
const to = centers[index];
|
|
5401
|
+
const delta = [to[0] - from[0], to[1] - from[1], to[2] - from[2]];
|
|
5402
|
+
const length = Math.hypot(delta[0], delta[1], delta[2]);
|
|
5403
|
+
const steps = Math.max(1, Math.ceil(length / stepWorld));
|
|
5404
|
+
for (let step = 1; step <= steps; step++) {
|
|
5405
|
+
const t = step / steps;
|
|
5406
|
+
dense.push([
|
|
5407
|
+
from[0] + delta[0] * t,
|
|
5408
|
+
from[1] + delta[1] * t,
|
|
5409
|
+
from[2] + delta[2] * t,
|
|
5410
|
+
]);
|
|
5411
|
+
}
|
|
5412
|
+
}
|
|
5413
|
+
return dense;
|
|
5414
|
+
}
|
|
5415
|
+
function buildBrushFill({ segmentationImageData, planePoint, viewPlaneNormal, centersWorld, boundsMargin, viewThicknessWorld, createShape, }) {
|
|
5416
|
+
if (!centersWorld.length) {
|
|
5417
|
+
return null;
|
|
5418
|
+
}
|
|
5419
|
+
const volume = volumeFromImageData(segmentationImageData);
|
|
5420
|
+
const voxelThickness = getVoxelThicknessAlongNormal(volume, viewPlaneNormal);
|
|
5421
|
+
const shapes = centersWorld
|
|
5422
|
+
.map((centerWorld) => createShape({ volume, planePoint, viewPlaneNormal, centerWorld }))
|
|
5423
|
+
.filter(Boolean);
|
|
5424
|
+
if (!shapes.length) {
|
|
5425
|
+
return null;
|
|
5426
|
+
}
|
|
5427
|
+
const shape = createUnionShape(shapes);
|
|
5428
|
+
const requiredThickness = shape.getRequiredThickness();
|
|
5429
|
+
const carriesOwnDepth = requiredThickness > 0;
|
|
5430
|
+
const depthCoverage = carriesOwnDepth
|
|
5431
|
+
? 'overlapping'
|
|
5432
|
+
: 'centerInside';
|
|
5433
|
+
const thicknessWorld = resolveReferencePlaneThickness(carriesOwnDepth ? requiredThickness : viewThicknessWorld, voxelThickness);
|
|
5434
|
+
return {
|
|
5435
|
+
volume,
|
|
5436
|
+
planePoint,
|
|
5437
|
+
viewPlaneNormal,
|
|
5438
|
+
thicknessWorld,
|
|
5439
|
+
depthCoverage,
|
|
5440
|
+
bounds: (0,_utilities_sampleAreaAnnotationVoxels_js__rspack_import_2/* .getShapeIndexBounds */.V)(centersWorld, volume, segmentationImageData, viewPlaneNormal, getSlabHalfWidth(thicknessWorld, voxelThickness, depthCoverage), boundsMargin),
|
|
5441
|
+
shape,
|
|
5442
|
+
};
|
|
5443
|
+
}
|
|
5444
|
+
function createCircleBrushFill(operationData) {
|
|
5445
|
+
const { segmentationImageData, viewUp, viewPlaneNormal, centerWorld, xRadius, yRadius, viewThicknessWorld, } = operationData;
|
|
5446
|
+
if (!(xRadius > 0) || !(yRadius > 0)) {
|
|
5447
|
+
return null;
|
|
5448
|
+
}
|
|
5449
|
+
const viewRight = getViewRight(viewUp, viewPlaneNormal);
|
|
5450
|
+
const centers = operationData.strokeCentersWorld?.length
|
|
5451
|
+
? operationData.strokeCentersWorld
|
|
5452
|
+
: [centerWorld];
|
|
5453
|
+
return buildBrushFill({
|
|
5454
|
+
segmentationImageData,
|
|
5455
|
+
planePoint: centerWorld,
|
|
5456
|
+
viewPlaneNormal,
|
|
5457
|
+
centersWorld: densifyStrokeCenters(centers, Math.min(xRadius, yRadius) / 2),
|
|
5458
|
+
boundsMargin: Math.max(xRadius, yRadius),
|
|
5459
|
+
viewThicknessWorld,
|
|
5460
|
+
createShape: ({ volume, planePoint, centerWorld: center }) => createEllipseShape({
|
|
5461
|
+
volume,
|
|
5462
|
+
planePoint,
|
|
5463
|
+
viewPlaneNormal,
|
|
5464
|
+
centerWorld: center,
|
|
5465
|
+
majorAxis: viewRight,
|
|
5466
|
+
majorRadius: xRadius,
|
|
5467
|
+
minorRadius: yRadius,
|
|
5468
|
+
}),
|
|
5469
|
+
});
|
|
5470
|
+
}
|
|
5471
|
+
function createSphereBrushFill(operationData) {
|
|
5472
|
+
const { segmentationImageData, viewUp, viewPlaneNormal, centerWorld, xRadius, yRadius, } = operationData;
|
|
5473
|
+
if (!(xRadius > 0) || !(yRadius > 0)) {
|
|
5474
|
+
return null;
|
|
5475
|
+
}
|
|
5476
|
+
const depthRadius = Math.max(xRadius, yRadius);
|
|
5477
|
+
const viewRight = getViewRight(viewUp, viewPlaneNormal);
|
|
5478
|
+
const centers = operationData.strokeCentersWorld?.length
|
|
5479
|
+
? operationData.strokeCentersWorld
|
|
5480
|
+
: [centerWorld];
|
|
5481
|
+
return buildBrushFill({
|
|
5482
|
+
segmentationImageData,
|
|
5483
|
+
planePoint: centerWorld,
|
|
5484
|
+
viewPlaneNormal,
|
|
5485
|
+
centersWorld: densifyStrokeCenters(centers, Math.min(xRadius, yRadius) / 2),
|
|
5486
|
+
boundsMargin: depthRadius,
|
|
5487
|
+
createShape: ({ volume, planePoint, centerWorld: center }) => createEllipseShape({
|
|
5488
|
+
volume,
|
|
5489
|
+
planePoint,
|
|
5490
|
+
viewPlaneNormal,
|
|
5491
|
+
centerWorld: center,
|
|
5492
|
+
majorAxis: viewRight,
|
|
5493
|
+
majorRadius: xRadius,
|
|
5494
|
+
minorRadius: yRadius,
|
|
5495
|
+
depthRadius,
|
|
5496
|
+
}),
|
|
5497
|
+
});
|
|
5498
|
+
}
|
|
5499
|
+
function createRectangleBrushFill(operationData) {
|
|
5500
|
+
const { segmentationImageData, cornersWorld } = operationData;
|
|
5501
|
+
if (cornersWorld.length < 4) {
|
|
5502
|
+
return null;
|
|
5503
|
+
}
|
|
5504
|
+
const [p0, p1, , p3] = cornersWorld;
|
|
5505
|
+
const majorAxis = gl_matrix__rspack_import_0/* .vec3.sub */.eR.jb(gl_matrix__rspack_import_0/* .vec3.create */.eR.vt(), p1, p0);
|
|
5506
|
+
const minorAxis = gl_matrix__rspack_import_0/* .vec3.sub */.eR.jb(gl_matrix__rspack_import_0/* .vec3.create */.eR.vt(), p3, p0);
|
|
5507
|
+
const majorHalfLength = gl_matrix__rspack_import_0/* .vec3.length */.eR.Bw(majorAxis) / 2;
|
|
5508
|
+
const minorHalfLength = gl_matrix__rspack_import_0/* .vec3.length */.eR.Bw(minorAxis) / 2;
|
|
5509
|
+
if (!(majorHalfLength > 0) || !(minorHalfLength > 0)) {
|
|
5510
|
+
return null;
|
|
5511
|
+
}
|
|
5512
|
+
const normal = gl_matrix__rspack_import_0/* .vec3.cross */.eR.$A(gl_matrix__rspack_import_0/* .vec3.create */.eR.vt(), majorAxis, minorAxis);
|
|
5513
|
+
if (!(gl_matrix__rspack_import_0/* .vec3.squaredLength */.eR.m3(normal) > 0)) {
|
|
5514
|
+
if (!operationData.viewPlaneNormal) {
|
|
5515
|
+
return null;
|
|
5516
|
+
}
|
|
5517
|
+
gl_matrix__rspack_import_0/* .vec3.copy */.eR.C(normal, operationData.viewPlaneNormal);
|
|
5518
|
+
}
|
|
5519
|
+
gl_matrix__rspack_import_0/* .vec3.normalize */.eR.S8(normal, normal);
|
|
5520
|
+
const center = gl_matrix__rspack_import_0/* .vec3.lerp */.eR.Cc(gl_matrix__rspack_import_0/* .vec3.create */.eR.vt(), p0, cornersWorld[2], 0.5);
|
|
5521
|
+
return buildBrushFill({
|
|
5522
|
+
segmentationImageData,
|
|
5523
|
+
planePoint: center,
|
|
5524
|
+
viewPlaneNormal: normal,
|
|
5525
|
+
centersWorld: [center],
|
|
5526
|
+
boundsMargin: Math.hypot(majorHalfLength, minorHalfLength),
|
|
5527
|
+
createShape: ({ volume, planePoint, viewPlaneNormal, centerWorld }) => createRectangleShape({
|
|
5528
|
+
volume,
|
|
5529
|
+
planePoint,
|
|
5530
|
+
viewPlaneNormal,
|
|
5531
|
+
centerWorld,
|
|
5532
|
+
majorAxis: majorAxis,
|
|
5533
|
+
majorHalfLength,
|
|
5534
|
+
minorHalfLength,
|
|
5535
|
+
}),
|
|
5536
|
+
});
|
|
5537
|
+
}
|
|
5538
|
+
function createBrushFillPredicate(fill, imageData) {
|
|
5539
|
+
const { planePoint, viewPlaneNormal, shape } = fill;
|
|
5540
|
+
const voxelThickness = getVoxelThicknessAlongNormal(fill.volume, viewPlaneNormal);
|
|
5541
|
+
const halfWidth = getSlabHalfWidth(fill.thicknessWorld, voxelThickness, fill.depthCoverage);
|
|
5542
|
+
const epsilon = getSlabEpsilon(voxelThickness);
|
|
5543
|
+
const halfOpen = isSlabDepthLowInclusive(fill.depthCoverage);
|
|
5544
|
+
const depthLow = halfOpen ? -halfWidth - epsilon : -halfWidth + epsilon;
|
|
5545
|
+
const depthHigh = halfWidth - epsilon;
|
|
5546
|
+
const scratch = [0, 0, 0];
|
|
5547
|
+
return (pointLPS, pointIJK) => {
|
|
5548
|
+
let world = pointLPS;
|
|
5549
|
+
if (!world) {
|
|
5550
|
+
if (!pointIJK || !imageData) {
|
|
5551
|
+
return false;
|
|
5552
|
+
}
|
|
5553
|
+
world = imageData.indexToWorld(pointIJK, scratch);
|
|
5554
|
+
}
|
|
5555
|
+
const depth = signedDistanceToPlane(world, planePoint, viewPlaneNormal);
|
|
5556
|
+
const withinDepth = halfOpen
|
|
5557
|
+
? depth >= depthLow && depth < depthHigh
|
|
5558
|
+
: depth > depthLow && depth < depthHigh;
|
|
5559
|
+
return withinDepth && shape.containsPoint(world);
|
|
5560
|
+
};
|
|
5561
|
+
}
|
|
5562
|
+
function applyBrushFill(operationData, fill) {
|
|
5563
|
+
if (!fill) {
|
|
5564
|
+
return;
|
|
5565
|
+
}
|
|
5566
|
+
operationData.brushVoxelSlabFill = fill;
|
|
5567
|
+
operationData.isInObject = createBrushFillPredicate(fill, operationData.segmentationImageData);
|
|
5568
|
+
operationData.isInObjectBoundsIJK = fill.bounds;
|
|
5569
|
+
}
|
|
5570
|
+
function forEachBrushFillVoxel(fill, voxelManager, callback) {
|
|
5571
|
+
const iteration = iterateVoxelsInShape({
|
|
5572
|
+
volume: fill.volume,
|
|
5573
|
+
planePoint: fill.planePoint,
|
|
5574
|
+
viewPlaneNormal: fill.viewPlaneNormal,
|
|
5575
|
+
referencePlaneThickness: fill.thicknessWorld,
|
|
5576
|
+
depthCoverage: fill.depthCoverage,
|
|
5577
|
+
bounds: fill.bounds,
|
|
5578
|
+
getShapeRuns: fill.shape.getRuns,
|
|
5579
|
+
});
|
|
5580
|
+
const debug = (brushFillLog.getLevel?.() ?? 5) <= 1;
|
|
5581
|
+
const depths = [];
|
|
5582
|
+
let minDepth = Infinity;
|
|
5583
|
+
let maxDepth = -Infinity;
|
|
5584
|
+
let painted = 0;
|
|
5585
|
+
for (const { ijk, center } of iteration) {
|
|
5586
|
+
if (debug) {
|
|
5587
|
+
const depth = (center[0] - fill.planePoint[0]) * fill.viewPlaneNormal[0] +
|
|
5588
|
+
(center[1] - fill.planePoint[1]) * fill.viewPlaneNormal[1] +
|
|
5589
|
+
(center[2] - fill.planePoint[2]) * fill.viewPlaneNormal[2];
|
|
5590
|
+
depths.push(depth);
|
|
5591
|
+
minDepth = Math.min(minDepth, depth);
|
|
5592
|
+
maxDepth = Math.max(maxDepth, depth);
|
|
5593
|
+
}
|
|
5594
|
+
painted++;
|
|
5595
|
+
const pointIJK = [ijk[0], ijk[1], ijk[2]];
|
|
5596
|
+
const index = voxelManager.toIndex(pointIJK);
|
|
5597
|
+
callback({
|
|
5598
|
+
value: voxelManager.getAtIndex(index),
|
|
5599
|
+
index,
|
|
5600
|
+
pointIJK,
|
|
5601
|
+
pointLPS: [center[0], center[1], center[2]],
|
|
5602
|
+
});
|
|
5603
|
+
}
|
|
5604
|
+
if (!debug) {
|
|
5605
|
+
return;
|
|
5606
|
+
}
|
|
5607
|
+
if (!painted) {
|
|
5608
|
+
brushFillLog.debug('brush fill painted=0');
|
|
5609
|
+
return;
|
|
5610
|
+
}
|
|
5611
|
+
const voxelThickness = getVoxelThicknessAlongNormal(fill.volume, fill.viewPlaneNormal);
|
|
5612
|
+
const layers = new Set(depths.map((depth) => Math.round((depth / voxelThickness) * 10) / 10));
|
|
5613
|
+
const sorted = [...layers].sort((a, b) => a - b);
|
|
5614
|
+
const span = (maxDepth - minDepth) / voxelThickness;
|
|
5615
|
+
const halfWidth = getSlabHalfWidth(fill.thicknessWorld, voxelThickness, fill.depthCoverage);
|
|
5616
|
+
brushFillLog.debug(`brush fill painted=${painted} T_v=${voxelThickness.toFixed(4)} ` +
|
|
5617
|
+
`coverage=${fill.depthCoverage} ` +
|
|
5618
|
+
`halfWidth=${halfWidth.toFixed(4)} ` +
|
|
5619
|
+
`halfWidth/T_v=${(halfWidth / voxelThickness).toFixed(4)} ` +
|
|
5620
|
+
`depthSpanInVoxels=${span.toFixed(4)} ` +
|
|
5621
|
+
`distinctLayers=${sorted.length} ` +
|
|
5622
|
+
`${span < 1 ? 'ONE PLANE' : 'MORE THAN ONE PLANE'}`, {
|
|
5623
|
+
minDepth,
|
|
5624
|
+
maxDepth,
|
|
5625
|
+
layersInVoxels: sorted.length <= 24 ? sorted : `${sorted.length} values`,
|
|
5626
|
+
planePoint: fill.planePoint,
|
|
5627
|
+
viewPlaneNormal: fill.viewPlaneNormal,
|
|
5628
|
+
});
|
|
5629
|
+
}
|
|
5630
|
+
|
|
5631
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5632
|
+
LY: () => (createRectangleBrushFill),
|
|
5633
|
+
SH: () => (createCircleBrushFill),
|
|
5634
|
+
Uk: () => (forEachBrushFillVoxel),
|
|
5635
|
+
Ws: () => (applyBrushFill),
|
|
5636
|
+
Zi: () => (createSphereBrushFill)
|
|
5637
|
+
});
|
|
5638
|
+
|
|
5639
|
+
|
|
5640
|
+
},
|
|
5641
|
+
53976(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
5642
|
+
"use strict";
|
|
5643
|
+
/* import */ var _cornerstonejs_core__rspack_import_0 = __webpack_require__(62721);
|
|
5644
|
+
/* import */ var _utilities_sampleAreaAnnotationVoxels_js__rspack_import_1 = __webpack_require__(72821);
|
|
5645
|
+
|
|
5646
|
+
|
|
5647
|
+
const { createPolylineShape, getSlabHalfWidth, getVoxelThicknessAlongNormal, iterateVoxelsInShape, } = _cornerstonejs_core__rspack_import_0.utilities.voxelSlab;
|
|
5648
|
+
const CONTOUR_FILL_COVERAGE = 'centerInside';
|
|
5649
|
+
function* iterateContourFillVoxels({ volume, polyline, viewPlaneNormal, imageData, }) {
|
|
5650
|
+
if (!(polyline?.length >= 3)) {
|
|
5651
|
+
return;
|
|
5652
|
+
}
|
|
5653
|
+
const planePoint = polyline[0];
|
|
5654
|
+
const voxelThickness = getVoxelThicknessAlongNormal(volume, viewPlaneNormal);
|
|
5655
|
+
const shape = createPolylineShape({
|
|
5656
|
+
volume,
|
|
5657
|
+
planePoint,
|
|
5658
|
+
viewPlaneNormal,
|
|
5659
|
+
polyline,
|
|
5660
|
+
});
|
|
5661
|
+
for (const { ijk } of iterateVoxelsInShape({
|
|
5662
|
+
volume,
|
|
5663
|
+
planePoint,
|
|
5664
|
+
viewPlaneNormal,
|
|
5665
|
+
depthCoverage: CONTOUR_FILL_COVERAGE,
|
|
5666
|
+
bounds: (0,_utilities_sampleAreaAnnotationVoxels_js__rspack_import_1/* .getShapeIndexBounds */.V)(polyline, volume, imageData, viewPlaneNormal, getSlabHalfWidth(voxelThickness, voxelThickness, CONTOUR_FILL_COVERAGE)),
|
|
5667
|
+
getShapeRuns: shape.getRuns,
|
|
5668
|
+
})) {
|
|
5669
|
+
yield ijk;
|
|
5670
|
+
}
|
|
5671
|
+
}
|
|
5672
|
+
|
|
5673
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5674
|
+
x: () => (iterateContourFillVoxels)
|
|
5675
|
+
});
|
|
5676
|
+
|
|
5677
|
+
|
|
5630
5678
|
},
|
|
5631
5679
|
8878(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
5632
5680
|
"use strict";
|
|
@@ -5802,6 +5850,19 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5802
5850
|
});
|
|
5803
5851
|
|
|
5804
5852
|
|
|
5853
|
+
},
|
|
5854
|
+
98512(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
5855
|
+
"use strict";
|
|
5856
|
+
const MINIMUM_AREA_ANNOTATION_DIMENSION = 1e-12;
|
|
5857
|
+
function hasValidAreaAnnotationDimensions(dimension, ...additionalDimensions) {
|
|
5858
|
+
return [dimension, ...additionalDimensions].every((value) => value > MINIMUM_AREA_ANNOTATION_DIMENSION);
|
|
5859
|
+
}
|
|
5860
|
+
|
|
5861
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5862
|
+
k: () => (hasValidAreaAnnotationDimensions)
|
|
5863
|
+
});
|
|
5864
|
+
|
|
5865
|
+
|
|
5805
5866
|
},
|
|
5806
5867
|
36988(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
5807
5868
|
"use strict";
|
|
@@ -6948,55 +7009,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
6948
7009
|
});
|
|
6949
7010
|
|
|
6950
7011
|
|
|
6951
|
-
},
|
|
6952
|
-
45393(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
6953
|
-
"use strict";
|
|
6954
|
-
/* import */ var _isClosed_js__rspack_import_0 = __webpack_require__(89102);
|
|
6955
|
-
|
|
6956
|
-
function containsPoint(polyline, point, options = {
|
|
6957
|
-
closed: undefined,
|
|
6958
|
-
}) {
|
|
6959
|
-
if (polyline.length < 3) {
|
|
6960
|
-
return false;
|
|
6961
|
-
}
|
|
6962
|
-
const numPolylinePoints = polyline.length;
|
|
6963
|
-
let numIntersections = 0;
|
|
6964
|
-
const { closed, holes } = options;
|
|
6965
|
-
if (holes?.length) {
|
|
6966
|
-
for (const hole of holes) {
|
|
6967
|
-
if (containsPoint(hole, point)) {
|
|
6968
|
-
return false;
|
|
6969
|
-
}
|
|
6970
|
-
}
|
|
6971
|
-
}
|
|
6972
|
-
const shouldClose = !(closed === undefined ? (0,_isClosed_js__rspack_import_0/* ["default"] */.A)(polyline) : closed);
|
|
6973
|
-
const maxSegmentIndex = polyline.length - (shouldClose ? 1 : 2);
|
|
6974
|
-
for (let i = 0; i <= maxSegmentIndex; i++) {
|
|
6975
|
-
const p1 = polyline[i];
|
|
6976
|
-
const p2Index = i === numPolylinePoints - 1 ? 0 : i + 1;
|
|
6977
|
-
const p2 = polyline[p2Index];
|
|
6978
|
-
const maxX = p1[0] >= p2[0] ? p1[0] : p2[0];
|
|
6979
|
-
const maxY = p1[1] >= p2[1] ? p1[1] : p2[1];
|
|
6980
|
-
const minY = p1[1] <= p2[1] ? p1[1] : p2[1];
|
|
6981
|
-
const mayIntersectLineSegment = point[0] <= maxX && point[1] >= minY && point[1] < maxY;
|
|
6982
|
-
if (mayIntersectLineSegment) {
|
|
6983
|
-
const isVerticalLine = p1[0] === p2[0];
|
|
6984
|
-
let intersects = isVerticalLine;
|
|
6985
|
-
if (!intersects) {
|
|
6986
|
-
const xIntersection = ((point[1] - p1[1]) * (p2[0] - p1[0])) / (p2[1] - p1[1]) + p1[0];
|
|
6987
|
-
intersects = point[0] <= xIntersection;
|
|
6988
|
-
}
|
|
6989
|
-
numIntersections += intersects ? 1 : 0;
|
|
6990
|
-
}
|
|
6991
|
-
}
|
|
6992
|
-
return !!(numIntersections % 2);
|
|
6993
|
-
}
|
|
6994
|
-
|
|
6995
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
6996
|
-
A: () => (containsPoint)
|
|
6997
|
-
});
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
7012
|
},
|
|
7001
7013
|
80713(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
7002
7014
|
"use strict";
|
|
@@ -7025,29 +7037,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
7025
7037
|
});
|
|
7026
7038
|
|
|
7027
7039
|
|
|
7028
|
-
},
|
|
7029
|
-
89102(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
7030
|
-
"use strict";
|
|
7031
|
-
/* import */ var gl_matrix__rspack_import_0 = __webpack_require__(50341);
|
|
7032
|
-
/* import */ var _point_index_js__rspack_import_1 = __webpack_require__(3756);
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
function isClosed(polyline) {
|
|
7036
|
-
if (polyline.length < 3) {
|
|
7037
|
-
return false;
|
|
7038
|
-
}
|
|
7039
|
-
const numPolylinePoints = polyline.length;
|
|
7040
|
-
const firstPoint = polyline[0];
|
|
7041
|
-
const lastPoint = polyline[numPolylinePoints - 1];
|
|
7042
|
-
const distFirstToLastPoints = (0,_point_index_js__rspack_import_1.distanceToPointSquared)(firstPoint, lastPoint);
|
|
7043
|
-
return gl_matrix__rspack_import_0/* .glMatrix.equals */.Fd.aI(0, distFirstToLastPoints);
|
|
7044
|
-
}
|
|
7045
|
-
|
|
7046
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
7047
|
-
A: () => (isClosed)
|
|
7048
|
-
});
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
7040
|
},
|
|
7052
7041
|
29362(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
7053
7042
|
"use strict";
|