@cornerstonejs/tools 0.61.6 → 0.61.7
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/cjs/tools/displayTools/Labelmap/labelmapDisplay.js +26 -0
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +26 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +41 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "0.61.
|
|
3
|
+
"version": "0.61.7",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "dist/umd/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"type": "individual",
|
|
53
53
|
"url": "https://ohif.org/donate"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "0bb66c6cb814db95508e50cca647e71ae6e7e7b7"
|
|
56
56
|
}
|
|
@@ -134,6 +134,40 @@ function removeSegmentationRepresentation(
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Checks if a segmentation data have the same frameOfReference as the series
|
|
139
|
+
* displayed in a given viewport
|
|
140
|
+
* @param viewport
|
|
141
|
+
* @param referencedVolumeId volume id of the segmentation reference series
|
|
142
|
+
* @returns
|
|
143
|
+
*/
|
|
144
|
+
function isSameFrameOfReference(viewport, referencedVolumeId) {
|
|
145
|
+
// if the referencedVolumeId is not defined, we acted as before to not break
|
|
146
|
+
// applications as referencedVolumeId is inserted in this change
|
|
147
|
+
// Can modify that in the future commits
|
|
148
|
+
if (!referencedVolumeId) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
const defaultActor = viewport.getDefaultActor();
|
|
152
|
+
if (!defaultActor) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
const { uid: defaultActorUID } = defaultActor;
|
|
156
|
+
const volume = cache.getVolume(defaultActorUID);
|
|
157
|
+
|
|
158
|
+
if (volume) {
|
|
159
|
+
const referencedVolume = cache.getVolume(referencedVolumeId);
|
|
160
|
+
if (
|
|
161
|
+
referencedVolume &&
|
|
162
|
+
volume.metadata.FrameOfReferenceUID ===
|
|
163
|
+
referencedVolume.metadata.FrameOfReferenceUID
|
|
164
|
+
) {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
|
|
137
171
|
/**
|
|
138
172
|
* It takes the enabled element, the segmentation Id, and the configuration, and
|
|
139
173
|
* it sets the segmentation for the enabled element as a labelmap
|
|
@@ -166,6 +200,9 @@ async function render(
|
|
|
166
200
|
throw new Error(`No Labelmap found for volumeId: ${labelmapUID}`);
|
|
167
201
|
}
|
|
168
202
|
|
|
203
|
+
if (!isSameFrameOfReference(viewport, labelmapData?.referencedVolumeId)) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
169
206
|
let actorEntry = viewport.getActor(segmentationRepresentationUID);
|
|
170
207
|
|
|
171
208
|
if (!actorEntry) {
|
|
@@ -182,6 +219,10 @@ async function render(
|
|
|
182
219
|
actorEntry = viewport.getActor(segmentationRepresentationUID);
|
|
183
220
|
}
|
|
184
221
|
|
|
222
|
+
if (!actorEntry) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
185
226
|
const { cfun, ofun } = renderingConfig as LabelmapRenderingConfig;
|
|
186
227
|
|
|
187
228
|
const renderInactiveSegmentations =
|