@cornerstonejs/tools 4.15.15 → 4.15.16
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.
|
@@ -9,7 +9,7 @@ const load = ({ cfun, ofun, actor }) => {
|
|
|
9
9
|
export async function addVolumesAsIndependentComponents({ viewport, volumeInputs, segmentationId, }) {
|
|
10
10
|
const defaultActor = viewport.getDefaultActor();
|
|
11
11
|
const { actor } = defaultActor;
|
|
12
|
-
const { uid
|
|
12
|
+
const { uid } = defaultActor;
|
|
13
13
|
const referenceVolumeId = viewport.getVolumeId();
|
|
14
14
|
if (internalCache.get(uid)?.added) {
|
|
15
15
|
return {
|
|
@@ -31,6 +31,11 @@ export async function addVolumesAsIndependentComponents({ viewport, volumeInputs
|
|
|
31
31
|
const segData = segVoxelManager.getCompleteScalarDataArray();
|
|
32
32
|
const { imageData: segImageData } = segImageVolume;
|
|
33
33
|
const baseVolume = cache.getVolume(referenceVolumeId);
|
|
34
|
+
const volumeTexture = baseVolume.vtkOpenGLTexture;
|
|
35
|
+
const hasPendingFrames = volumeTexture.hasUpdatedFrames();
|
|
36
|
+
if (hasPendingFrames) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
34
39
|
const baseVoxelManager = baseVolume.voxelManager;
|
|
35
40
|
const baseData = baseVoxelManager.getCompleteScalarDataArray();
|
|
36
41
|
const newComp = 2;
|
|
@@ -53,14 +58,18 @@ export async function addVolumesAsIndependentComponents({ viewport, volumeInputs
|
|
|
53
58
|
const arrayAgain = mapper.getInputData().getPointData().getArray(0);
|
|
54
59
|
arrayAgain.setData(cubeData);
|
|
55
60
|
arrayAgain.setNumberOfComponents(2);
|
|
61
|
+
const oldColorMixPreset = actor.getProperty().getColorMixPreset();
|
|
56
62
|
actor.getProperty().setColorMixPreset(1);
|
|
63
|
+
const oldForceNearestInterpolation = actor
|
|
64
|
+
.getProperty()
|
|
65
|
+
.getForceNearestInterpolation(1);
|
|
57
66
|
actor.getProperty().setForceNearestInterpolation(1, true);
|
|
67
|
+
const oldIndependentComponents = actor
|
|
68
|
+
.getProperty()
|
|
69
|
+
.getIndependentComponents();
|
|
58
70
|
actor.getProperty().setIndependentComponents(true);
|
|
59
71
|
viewport.addActor({
|
|
60
|
-
|
|
61
|
-
uid,
|
|
62
|
-
callback,
|
|
63
|
-
referencedId: referenceVolumeId,
|
|
72
|
+
...defaultActor,
|
|
64
73
|
representationUID: `${segmentationId}-${SegmentationRepresentations.Labelmap}`,
|
|
65
74
|
});
|
|
66
75
|
internalCache.set(uid, {
|
|
@@ -68,6 +77,7 @@ export async function addVolumesAsIndependentComponents({ viewport, volumeInputs
|
|
|
68
77
|
segmentationRepresentationUID: `${segmentationId}`,
|
|
69
78
|
originalBlendMode: viewport.getBlendMode(),
|
|
70
79
|
});
|
|
80
|
+
const oldPreLoad = actor.get('preLoad');
|
|
71
81
|
actor.set({
|
|
72
82
|
preLoad: load,
|
|
73
83
|
});
|
|
@@ -99,26 +109,33 @@ export async function addVolumesAsIndependentComponents({ viewport, volumeInputs
|
|
|
99
109
|
viewport.render();
|
|
100
110
|
}
|
|
101
111
|
eventTarget.addEventListenerDebounced(Events.SEGMENTATION_DATA_MODIFIED, onSegmentationDataModified, 200);
|
|
102
|
-
|
|
112
|
+
function onSegmentationRepresentationRemoved(evt) {
|
|
113
|
+
if (evt.detail.viewportId !== viewport.id) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
103
116
|
eventTarget.removeEventListener(Events.SEGMENTATION_DATA_MODIFIED, onSegmentationDataModified);
|
|
117
|
+
eventTarget.removeEventListener(Events.SEGMENTATION_REPRESENTATION_REMOVED, onSegmentationRepresentationRemoved);
|
|
104
118
|
const actorEntry = viewport.getActor(uid);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
if (actorEntry) {
|
|
120
|
+
viewport.removeActors([uid]);
|
|
121
|
+
}
|
|
122
|
+
internalCache.delete(uid);
|
|
123
|
+
if (viewport.isDisabled) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
actor.setMapper(oldMapper);
|
|
127
|
+
actor.getProperty().setColorMixPreset(oldColorMixPreset);
|
|
128
|
+
actor
|
|
129
|
+
.getProperty()
|
|
130
|
+
.setForceNearestInterpolation(1, oldForceNearestInterpolation);
|
|
131
|
+
actor.getProperty().setIndependentComponents(oldIndependentComponents);
|
|
132
|
+
viewport.addActor({
|
|
133
|
+
...defaultActor,
|
|
134
|
+
});
|
|
135
|
+
actor.set(oldPreLoad);
|
|
120
136
|
viewport.render();
|
|
121
|
-
}
|
|
137
|
+
}
|
|
138
|
+
eventTarget.addEventListener(Events.SEGMENTATION_REPRESENTATION_REMOVED, onSegmentationRepresentationRemoved);
|
|
122
139
|
return {
|
|
123
140
|
uid,
|
|
124
141
|
actor,
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.15.
|
|
1
|
+
export declare const version = "4.15.16";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '4.15.
|
|
1
|
+
export const version = '4.15.16';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.16",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"canvas": "3.2.0"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
|
-
"@cornerstonejs/core": "4.15.
|
|
111
|
+
"@cornerstonejs/core": "4.15.16",
|
|
112
112
|
"@kitware/vtk.js": "34.15.1",
|
|
113
113
|
"@types/d3-array": "3.2.1",
|
|
114
114
|
"@types/d3-interpolate": "3.0.4",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"type": "individual",
|
|
128
128
|
"url": "https://ohif.org/donate"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "734dd7f5fd416c386d08d6ab2d17f44226add8e2"
|
|
131
131
|
}
|