@cornerstonejs/polymorphic-segmentation 3.8.3 → 3.8.5
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cache } from '@cornerstonejs/core';
|
|
1
|
+
import { cache, getEnabledElementByViewportId } from '@cornerstonejs/core';
|
|
2
2
|
import * as cornerstoneTools from '@cornerstonejs/tools';
|
|
3
3
|
import { computeSurfaceFromLabelmapSegmentation } from './surfaceComputationStrategies';
|
|
4
4
|
import { createAndCacheSurfacesFromRaw } from './createAndCacheSurfacesFromRaw';
|
|
@@ -21,11 +21,35 @@ export async function updateSurfaceData(segmentationId) {
|
|
|
21
21
|
triggerSegmentationModified(segmentationId);
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
+
const viewportIds = getViewportIdsWithSegmentation(segmentationId);
|
|
25
|
+
viewportIds.forEach((viewportId) => {
|
|
26
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
27
|
+
const viewport = enabledElement.viewport;
|
|
28
|
+
if (viewport.type !== 'volume3d') {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const actorEntries = viewport.getActors();
|
|
32
|
+
const segmentIndicesAsSurface = actorEntries
|
|
33
|
+
.map((actor) => actor.representationUID?.split('-').pop())
|
|
34
|
+
.filter((segment) => segment && Number(segment))
|
|
35
|
+
.map(Number);
|
|
36
|
+
segmentIndicesAsSurface.forEach((segmentIndex) => {
|
|
37
|
+
if (!indices.includes(segmentIndex)) {
|
|
38
|
+
const filteredSurfaceActors = actorEntries.filter((actor) => actor.representationUID &&
|
|
39
|
+
actor.representationUID ===
|
|
40
|
+
`${segmentationId}-${SegmentationRepresentations.Surface}-${segmentIndex}`);
|
|
41
|
+
const removingUIDs = filteredSurfaceActors.map((actor) => actor.uid);
|
|
42
|
+
viewport.removeActors(removingUIDs);
|
|
43
|
+
viewport.render();
|
|
44
|
+
const geometryId = `segmentation_${segmentationId}_surface_${segmentIndex}`;
|
|
45
|
+
cache.removeGeometryLoadObject(geometryId);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
24
49
|
const promises = surfacesObj.map(({ data, segmentIndex }) => {
|
|
25
50
|
const geometryId = `segmentation_${segmentationId}_surface_${segmentIndex}`;
|
|
26
51
|
const geometry = cache.getGeometry(geometryId);
|
|
27
52
|
if (!geometry) {
|
|
28
|
-
const viewportIds = getViewportIdsWithSegmentation(segmentationId);
|
|
29
53
|
return viewportIds.map((viewportId) => {
|
|
30
54
|
const surfaceRepresentation = getSegmentationRepresentation(viewportId, {
|
|
31
55
|
segmentationId,
|
|
@@ -33,8 +57,10 @@ export async function updateSurfaceData(segmentationId) {
|
|
|
33
57
|
});
|
|
34
58
|
return [surfaceRepresentation].map((surfaceRepresentation) => {
|
|
35
59
|
segmentation.representationData.Surface.geometryIds.set(segmentIndex, geometryId);
|
|
60
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
36
61
|
return createAndCacheSurfacesFromRaw(segmentationId, [{ segmentIndex, data }], {
|
|
37
62
|
segmentationId: surfaceRepresentation.segmentationId,
|
|
63
|
+
viewport: enabledElement.viewport,
|
|
38
64
|
});
|
|
39
65
|
});
|
|
40
66
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/polymorphic-segmentation",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.5",
|
|
4
4
|
"description": "Polymorphic Segmentation utility for Cornerstone3D",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"@icr/polyseg-wasm": "0.4.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@cornerstonejs/core": "^3.8.
|
|
52
|
-
"@cornerstonejs/tools": "^3.8.
|
|
51
|
+
"@cornerstonejs/core": "^3.8.5",
|
|
52
|
+
"@cornerstonejs/tools": "^3.8.5",
|
|
53
53
|
"@kitware/vtk.js": "32.12.1"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "782551a1523d3619fa002b9b5bb2991519fb5f40"
|
|
56
56
|
}
|