@ohif/app 3.14.0-beta.90 → 3.14.0-beta.92
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/{1153.bundle.3b9c4b75.js → 1153.bundle.51d39e80.js} +52 -85
- package/dist/{1645.bundle.c61d372a.js → 1645.bundle.a98b9ca6.js} +3 -3
- package/dist/{3366.bundle.b225ae72.js → 3366.bundle.62baeeec.js} +1 -1
- package/dist/{4606.bundle.9a3f474f.js → 4606.bundle.a3485206.js} +1 -1
- package/dist/{5143.bundle.95aeb8c5.js → 5143.bundle.04f54c00.js} +108 -106
- package/dist/{5320.bundle.a4e386da.js → 5320.bundle.9b05cebb.js} +242 -237
- package/dist/{5989.bundle.2d80cbd0.js → 5989.bundle.f484884a.js} +262 -250
- package/dist/{6253.bundle.8a7c1171.js → 6253.bundle.fdfa1289.js} +174 -84
- package/dist/{6507.bundle.c8ac9bee.js → 6507.bundle.d52f5e81.js} +2 -2
- package/dist/{8037.bundle.d8f1add3.js → 8037.bundle.30a187f7.js} +292 -322
- package/dist/{8029.bundle.40857fb6.js → 8312.bundle.2cb75b58.js} +412 -7
- package/dist/{5383.bundle.79243338.js → 8868.bundle.4c357767.js} +240 -55
- package/dist/{5914.bundle.f6e9fc4a.js → 8923.bundle.9aca06c4.js} +246 -18
- package/dist/{9620.bundle.c3d1589b.js → 9620.bundle.d1dc0be1.js} +2 -2
- package/dist/{app.bundle.46f8d9cb.js → app.bundle.897484ee.js} +290 -196
- package/dist/{compute.bundle.deb7ad1f.js → compute.bundle.0ed1fe87.js} +6 -6
- package/dist/index.html +1 -1
- package/dist/{interpolation.bundle.16504135.js → interpolation.bundle.5a53d112.js} +5 -5
- package/dist/{polySeg.bundle.7088c2eb.js → polySeg.bundle.b4089601.js} +7 -7
- package/dist/sw.js +1 -1
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis["rspackChunk_ohif_app"] ||= []).push([[
|
|
1
|
+
(globalThis["rspackChunk_ohif_app"] ||= []).push([[8868], {
|
|
2
2
|
44709(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
3
3
|
"use strict";
|
|
4
4
|
/**
|
|
@@ -36518,7 +36518,7 @@ async function interpolateLabelmap({ segmentationId, segmentIndex, configuration
|
|
|
36518
36518
|
|
|
36519
36519
|
|
|
36520
36520
|
},
|
|
36521
|
-
|
|
36521
|
+
21363(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
36522
36522
|
"use strict";
|
|
36523
36523
|
// ESM COMPAT FLAG
|
|
36524
36524
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -36642,51 +36642,212 @@ async function createAndCacheSurfacesFromRaw(segmentationId, rawSurfacesData, op
|
|
|
36642
36642
|
};
|
|
36643
36643
|
}
|
|
36644
36644
|
|
|
36645
|
+
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/polymorphic-segmentation/dist/esm/Surface/cropLabelmapToSegment.js
|
|
36646
|
+
function yieldToMain() {
|
|
36647
|
+
if (typeof MessageChannel === 'undefined') {
|
|
36648
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
36649
|
+
}
|
|
36650
|
+
return new Promise((resolve) => {
|
|
36651
|
+
const { port1, port2 } = new MessageChannel();
|
|
36652
|
+
port1.onmessage = () => {
|
|
36653
|
+
port1.close();
|
|
36654
|
+
resolve();
|
|
36655
|
+
};
|
|
36656
|
+
port2.postMessage(null);
|
|
36657
|
+
});
|
|
36658
|
+
}
|
|
36659
|
+
async function findSegmentBounds(dimensions, getFrame, segmentIndices) {
|
|
36660
|
+
const [width, height, depth] = dimensions;
|
|
36661
|
+
const found = new Map();
|
|
36662
|
+
const wanted = new Set(segmentIndices);
|
|
36663
|
+
const extend = (value, iMin, iMax, j, k) => {
|
|
36664
|
+
if (!wanted.has(value)) {
|
|
36665
|
+
return;
|
|
36666
|
+
}
|
|
36667
|
+
const bounds = found.get(value);
|
|
36668
|
+
if (!bounds) {
|
|
36669
|
+
found.set(value, { min: [iMin, j, k], max: [iMax, j, k] });
|
|
36670
|
+
return;
|
|
36671
|
+
}
|
|
36672
|
+
const { min, max } = bounds;
|
|
36673
|
+
if (iMin < min[0])
|
|
36674
|
+
min[0] = iMin;
|
|
36675
|
+
if (iMax > max[0])
|
|
36676
|
+
max[0] = iMax;
|
|
36677
|
+
if (j < min[1])
|
|
36678
|
+
min[1] = j;
|
|
36679
|
+
if (j > max[1])
|
|
36680
|
+
max[1] = j;
|
|
36681
|
+
max[2] = k;
|
|
36682
|
+
};
|
|
36683
|
+
for (let k = 0; k < depth; k++) {
|
|
36684
|
+
const frame = getFrame(k);
|
|
36685
|
+
for (let j = 0; j < height; j++) {
|
|
36686
|
+
if ('map' in frame) {
|
|
36687
|
+
for (const { start, end, value } of frame.map.getRun(j, 0) ?? []) {
|
|
36688
|
+
extend(value, start, end - 1, j, k);
|
|
36689
|
+
}
|
|
36690
|
+
continue;
|
|
36691
|
+
}
|
|
36692
|
+
const rowOffset = j * width;
|
|
36693
|
+
for (let i = 0; i < width; i++) {
|
|
36694
|
+
const value = frame.data[rowOffset + i];
|
|
36695
|
+
if (value) {
|
|
36696
|
+
extend(value, i, i, j, k);
|
|
36697
|
+
}
|
|
36698
|
+
}
|
|
36699
|
+
}
|
|
36700
|
+
await yieldToMain();
|
|
36701
|
+
}
|
|
36702
|
+
return found;
|
|
36703
|
+
}
|
|
36704
|
+
function getSegmentBlock({ min, max }, dimensions) {
|
|
36705
|
+
const start = min.map((value) => Math.max(0, value - 1));
|
|
36706
|
+
const end = max.map((value, axis) => Math.min(dimensions[axis] - 1, value + 1));
|
|
36707
|
+
return {
|
|
36708
|
+
start,
|
|
36709
|
+
dimensions: start.map((value, axis) => end[axis] - value + 1),
|
|
36710
|
+
};
|
|
36711
|
+
}
|
|
36712
|
+
async function cropLabelmapToBlock(dimensions, getFrame, ArrayType, { start, dimensions: blockDimensions }) {
|
|
36713
|
+
const width = dimensions[0];
|
|
36714
|
+
const [blockWidth, blockHeight, blockDepth] = blockDimensions;
|
|
36715
|
+
const end = start.map((value, axis) => value + blockDimensions[axis] - 1);
|
|
36716
|
+
const blockData = new ArrayType(blockWidth * blockHeight * blockDepth);
|
|
36717
|
+
for (let k = start[2]; k <= end[2]; k++) {
|
|
36718
|
+
const frame = getFrame(k);
|
|
36719
|
+
for (let j = start[1]; j <= end[1]; j++) {
|
|
36720
|
+
const target = ((k - start[2]) * blockHeight + (j - start[1])) * blockWidth - start[0];
|
|
36721
|
+
if ('map' in frame) {
|
|
36722
|
+
for (const { start: runStart, end: runEnd, value } of frame.map.getRun(j, 0) ?? []) {
|
|
36723
|
+
const iEnd = Math.min(runEnd - 1, end[0]);
|
|
36724
|
+
for (let i = Math.max(runStart, start[0]); i <= iEnd; i++) {
|
|
36725
|
+
blockData[target + i] = value;
|
|
36726
|
+
}
|
|
36727
|
+
}
|
|
36728
|
+
continue;
|
|
36729
|
+
}
|
|
36730
|
+
const rowOffset = j * width;
|
|
36731
|
+
for (let i = start[0]; i <= end[0]; i++) {
|
|
36732
|
+
blockData[target + i] = frame.data[rowOffset + i];
|
|
36733
|
+
}
|
|
36734
|
+
}
|
|
36735
|
+
await yieldToMain();
|
|
36736
|
+
}
|
|
36737
|
+
return blockData;
|
|
36738
|
+
}
|
|
36739
|
+
|
|
36645
36740
|
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/polymorphic-segmentation/dist/esm/Surface/convertLabelmapToSurface.js
|
|
36646
36741
|
|
|
36647
36742
|
|
|
36743
|
+
|
|
36648
36744
|
const { WorkerTypes: convertLabelmapToSurface_WorkerTypes } = dist_esm.Enums;
|
|
36649
36745
|
const { computeVolumeLabelmapFromStack } = dist_esm.utilities.segmentation;
|
|
36746
|
+
const cs3dLogger = esm.utilities.logger.polySegLog.getLogger('Surface.convertLabelmapToSurface');
|
|
36650
36747
|
const convertLabelmapToSurface_workerManager = (0,esm.getWebWorkerManager)();
|
|
36651
|
-
const
|
|
36652
|
-
|
|
36748
|
+
const MIB = 1024 * 1024;
|
|
36749
|
+
const WORKER_BYTES_PER_VOXEL = 4;
|
|
36750
|
+
let maxBlockMiB = 2048;
|
|
36751
|
+
const MIN_LIMIT_MIB = 256;
|
|
36752
|
+
const convertLabelmapToSurface_triggerWorkerProgress = (progress, id, error) => {
|
|
36753
|
+
(0,esm.triggerEvent)(esm.eventTarget, esm.Enums.Events.WEB_WORKER_PROGRESS, {
|
|
36653
36754
|
progress,
|
|
36654
36755
|
type: convertLabelmapToSurface_WorkerTypes.POLYSEG_LABELMAP_TO_SURFACE,
|
|
36655
36756
|
id,
|
|
36757
|
+
error,
|
|
36656
36758
|
});
|
|
36657
36759
|
};
|
|
36658
|
-
|
|
36659
|
-
|
|
36660
|
-
|
|
36661
|
-
|
|
36662
|
-
|
|
36663
|
-
}
|
|
36664
|
-
|
|
36760
|
+
const reportFailure = (segmentIndex, error) => {
|
|
36761
|
+
cs3dLogger.warn(error);
|
|
36762
|
+
convertLabelmapToSurface_triggerWorkerProgress(100, segmentIndex, error);
|
|
36763
|
+
};
|
|
36764
|
+
async function getLabelmapVolume(labelmapRepresentationData) {
|
|
36765
|
+
let { volumeId } = labelmapRepresentationData;
|
|
36766
|
+
if (!volumeId) {
|
|
36665
36767
|
const { imageIds } = labelmapRepresentationData;
|
|
36666
|
-
({ volumeId } = await computeVolumeLabelmapFromStack({
|
|
36667
|
-
|
|
36668
|
-
|
|
36669
|
-
|
|
36670
|
-
|
|
36671
|
-
const
|
|
36672
|
-
const
|
|
36673
|
-
|
|
36674
|
-
const
|
|
36675
|
-
|
|
36676
|
-
|
|
36677
|
-
|
|
36678
|
-
|
|
36679
|
-
|
|
36680
|
-
|
|
36681
|
-
|
|
36682
|
-
|
|
36683
|
-
|
|
36684
|
-
|
|
36685
|
-
}
|
|
36686
|
-
|
|
36687
|
-
|
|
36688
|
-
|
|
36689
|
-
|
|
36768
|
+
({ volumeId } = await computeVolumeLabelmapFromStack({ imageIds }));
|
|
36769
|
+
}
|
|
36770
|
+
return esm.cache.getVolume(volumeId);
|
|
36771
|
+
}
|
|
36772
|
+
function getLabelmapFrames(volume) {
|
|
36773
|
+
const { dimensions, imageIds, voxelManager } = volume;
|
|
36774
|
+
const [width, height, depth] = dimensions;
|
|
36775
|
+
const frameSize = width * height;
|
|
36776
|
+
const scalarData = voxelManager.getWritableScalarData?.();
|
|
36777
|
+
const frameImageIds = imageIds?.length === depth ? imageIds : undefined;
|
|
36778
|
+
return (k) => {
|
|
36779
|
+
if (scalarData) {
|
|
36780
|
+
return { data: scalarData.subarray(k * frameSize, (k + 1) * frameSize) };
|
|
36781
|
+
}
|
|
36782
|
+
const map = frameImageIds && esm.cache.getImage(frameImageIds[k])?.voxelManager?.map;
|
|
36783
|
+
if (map instanceof esm.utilities.RLEVoxelMap &&
|
|
36784
|
+
map.width === width &&
|
|
36785
|
+
map.height === height &&
|
|
36786
|
+
!map.defaultValue) {
|
|
36787
|
+
return { map: map };
|
|
36788
|
+
}
|
|
36789
|
+
return {
|
|
36790
|
+
data: voxelManager.getSliceData({ sliceIndex: k, slicePlane: 2 }),
|
|
36791
|
+
};
|
|
36792
|
+
};
|
|
36793
|
+
}
|
|
36794
|
+
async function convertLabelmapToSurfaces(labelmapRepresentationData, segmentIndices) {
|
|
36795
|
+
const volume = await getLabelmapVolume(labelmapRepresentationData);
|
|
36796
|
+
const { dimensions, spacing, direction, voxelManager } = volume;
|
|
36797
|
+
const getFrame = getLabelmapFrames(volume);
|
|
36798
|
+
const boundsBySegment = await findSegmentBounds(dimensions, getFrame, segmentIndices);
|
|
36799
|
+
const surfaces = [];
|
|
36800
|
+
for (const segmentIndex of segmentIndices) {
|
|
36801
|
+
if (!volume.imageData) {
|
|
36802
|
+
surfaces.push(undefined);
|
|
36803
|
+
continue;
|
|
36804
|
+
}
|
|
36805
|
+
const bounds = boundsBySegment.get(segmentIndex);
|
|
36806
|
+
if (!bounds) {
|
|
36807
|
+
surfaces.push({ points: [], polys: [] });
|
|
36808
|
+
continue;
|
|
36809
|
+
}
|
|
36810
|
+
const block = getSegmentBlock(bounds, dimensions);
|
|
36811
|
+
const [blockWidth, blockHeight, blockDepth] = block.dimensions;
|
|
36812
|
+
const blockMiB = (blockWidth * blockHeight * blockDepth * WORKER_BYTES_PER_VOXEL) / MIB;
|
|
36813
|
+
if (blockMiB >= maxBlockMiB) {
|
|
36814
|
+
reportFailure(segmentIndex, `Segment ${segmentIndex} is too large for a 3D surface (${Math.ceil(blockMiB)} MiB, limit ${Math.ceil(maxBlockMiB)} MiB).`);
|
|
36815
|
+
surfaces.push(undefined);
|
|
36816
|
+
continue;
|
|
36817
|
+
}
|
|
36818
|
+
const scalarData = await cropLabelmapToBlock(dimensions, getFrame, voxelManager.getConstructor(), block);
|
|
36819
|
+
if (!volume.imageData) {
|
|
36820
|
+
surfaces.push(undefined);
|
|
36821
|
+
continue;
|
|
36822
|
+
}
|
|
36823
|
+
convertLabelmapToSurface_triggerWorkerProgress(0, segmentIndex);
|
|
36824
|
+
try {
|
|
36825
|
+
surfaces.push(await convertLabelmapToSurface_workerManager.executeTask('polySeg', 'convertLabelmapToSurface', {
|
|
36826
|
+
scalarData,
|
|
36827
|
+
dimensions: block.dimensions,
|
|
36828
|
+
spacing,
|
|
36829
|
+
origin: volume.imageData.indexToWorld(block.start),
|
|
36830
|
+
direction,
|
|
36831
|
+
segmentIndex,
|
|
36832
|
+
}, {
|
|
36833
|
+
callbacks: [
|
|
36834
|
+
(progress) => convertLabelmapToSurface_triggerWorkerProgress(progress, segmentIndex),
|
|
36835
|
+
],
|
|
36836
|
+
}));
|
|
36837
|
+
convertLabelmapToSurface_triggerWorkerProgress(100, segmentIndex);
|
|
36838
|
+
}
|
|
36839
|
+
catch (error) {
|
|
36840
|
+
cs3dLogger.warn(error);
|
|
36841
|
+
let message = `The 3D surface of segment ${segmentIndex} failed (${Math.ceil(blockMiB)} MiB).`;
|
|
36842
|
+
if (blockMiB >= MIN_LIMIT_MIB) {
|
|
36843
|
+
maxBlockMiB = Math.min(maxBlockMiB, blockMiB);
|
|
36844
|
+
message += ' Segments of this size or more are not converted now.';
|
|
36845
|
+
}
|
|
36846
|
+
reportFailure(segmentIndex, message);
|
|
36847
|
+
surfaces.push(undefined);
|
|
36848
|
+
}
|
|
36849
|
+
}
|
|
36850
|
+
return surfaces;
|
|
36690
36851
|
}
|
|
36691
36852
|
|
|
36692
36853
|
;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/polymorphic-segmentation/dist/esm/Surface/surfaceComputationStrategies.js
|
|
@@ -36695,7 +36856,7 @@ async function convertLabelmapToSurface(labelmapRepresentationData, segmentIndex
|
|
|
36695
36856
|
|
|
36696
36857
|
|
|
36697
36858
|
|
|
36698
|
-
const
|
|
36859
|
+
const surfaceComputationStrategies_cs3dLogger = esm.utilities.logger.polySegLog.getLogger('Surface.surfaceComputationStrategies');
|
|
36699
36860
|
const { getUniqueSegmentIndices } = dist_esm.utilities.segmentation;
|
|
36700
36861
|
const { getSegmentation: surfaceComputationStrategies_getSegmentation } = dist_esm.segmentation.state;
|
|
36701
36862
|
async function computeSurfaceData(segmentationId, options = {}) {
|
|
@@ -36720,7 +36881,7 @@ async function computeSurfaceData(segmentationId, options = {}) {
|
|
|
36720
36881
|
}
|
|
36721
36882
|
}
|
|
36722
36883
|
catch (error) {
|
|
36723
|
-
|
|
36884
|
+
surfaceComputationStrategies_cs3dLogger.error(error);
|
|
36724
36885
|
throw error;
|
|
36725
36886
|
}
|
|
36726
36887
|
if (!rawSurfacesData) {
|
|
@@ -36732,29 +36893,22 @@ async function computeSurfaceData(segmentationId, options = {}) {
|
|
|
36732
36893
|
async function computeSurfaceFromLabelmapSegmentation(segmentationId, options = {}) {
|
|
36733
36894
|
const segmentation = surfaceComputationStrategies_getSegmentation(segmentationId);
|
|
36734
36895
|
if (!segmentation?.representationData?.Labelmap) {
|
|
36735
|
-
|
|
36896
|
+
surfaceComputationStrategies_cs3dLogger.warn('Only support surface update from labelmaps');
|
|
36736
36897
|
return;
|
|
36737
36898
|
}
|
|
36738
36899
|
const labelmapRepresentationData = segmentation.representationData.Labelmap;
|
|
36739
36900
|
const segmentIndices = options.segmentIndices || getUniqueSegmentIndices(segmentationId);
|
|
36740
|
-
|
|
36741
|
-
|
|
36742
|
-
|
|
36743
|
-
}
|
|
36744
|
-
|
|
36745
|
-
|
|
36746
|
-
if (errors.length > 0) {
|
|
36747
|
-
cs3dLogger.error(errors);
|
|
36901
|
+
let surfaces;
|
|
36902
|
+
try {
|
|
36903
|
+
surfaces = await convertLabelmapToSurfaces(labelmapRepresentationData, segmentIndices);
|
|
36904
|
+
}
|
|
36905
|
+
catch (error) {
|
|
36906
|
+
surfaceComputationStrategies_cs3dLogger.error(error);
|
|
36748
36907
|
throw new Error('Failed to convert labelmap to surface');
|
|
36749
36908
|
}
|
|
36750
|
-
|
|
36751
|
-
.map((
|
|
36752
|
-
|
|
36753
|
-
return { segmentIndex: segmentIndices[index], data: surface.value };
|
|
36754
|
-
}
|
|
36755
|
-
})
|
|
36756
|
-
.filter(Boolean);
|
|
36757
|
-
return rawSurfacesData;
|
|
36909
|
+
return surfaces
|
|
36910
|
+
.map((data, index) => ({ segmentIndex: segmentIndices[index], data }))
|
|
36911
|
+
.filter(({ data }) => data);
|
|
36758
36912
|
}
|
|
36759
36913
|
async function computeSurfaceFromContourSegmentation(segmentationId, options = {}) {
|
|
36760
36914
|
const segmentation = surfaceComputationStrategies_getSegmentation(segmentationId);
|
|
@@ -37506,7 +37660,38 @@ async function canConvertFromTo(fromRepresentationType, toRepresentationType) {
|
|
|
37506
37660
|
|
|
37507
37661
|
|
|
37508
37662
|
const { utilities: { segmentation: { getUniqueSegmentIndices: updateSurfaceData_getUniqueSegmentIndices }, }, segmentation: { state: { getViewportIdsWithSegmentation, getSegmentation: updateSurfaceData_getSegmentation, getSegmentationRepresentation, }, triggerSegmentationEvents: { triggerSegmentationModified }, }, Enums: { SegmentationRepresentations: updateSurfaceData_SegmentationRepresentations }, } = dist_esm;
|
|
37509
|
-
|
|
37663
|
+
const updateSurfaceData_cs3dLogger = esm.utilities.logger.polySegLog.getLogger('Surface.updateSurfaceData');
|
|
37664
|
+
const updates = new Map();
|
|
37665
|
+
function updateSurfaceData(segmentationId) {
|
|
37666
|
+
const running = updates.get(segmentationId);
|
|
37667
|
+
if (running) {
|
|
37668
|
+
running.rerun = true;
|
|
37669
|
+
return running.promise;
|
|
37670
|
+
}
|
|
37671
|
+
const update = { promise: undefined, rerun: false };
|
|
37672
|
+
update.promise = (async () => {
|
|
37673
|
+
try {
|
|
37674
|
+
do {
|
|
37675
|
+
update.rerun = false;
|
|
37676
|
+
try {
|
|
37677
|
+
await updateSurfaceDataOnce(segmentationId);
|
|
37678
|
+
}
|
|
37679
|
+
catch (error) {
|
|
37680
|
+
if (!update.rerun) {
|
|
37681
|
+
throw error;
|
|
37682
|
+
}
|
|
37683
|
+
updateSurfaceData_cs3dLogger.warn(error);
|
|
37684
|
+
}
|
|
37685
|
+
} while (update.rerun);
|
|
37686
|
+
}
|
|
37687
|
+
finally {
|
|
37688
|
+
updates.delete(segmentationId);
|
|
37689
|
+
}
|
|
37690
|
+
})();
|
|
37691
|
+
updates.set(segmentationId, update);
|
|
37692
|
+
return update.promise;
|
|
37693
|
+
}
|
|
37694
|
+
async function updateSurfaceDataOnce(segmentationId) {
|
|
37510
37695
|
const surfacesObj = await computeSurfaceFromLabelmapSegmentation(segmentationId);
|
|
37511
37696
|
if (!surfacesObj) {
|
|
37512
37697
|
return;
|