@cornerstonejs/core 4.12.5 → 4.12.6
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.
|
@@ -13,8 +13,10 @@ declare class WSIViewport extends Viewport {
|
|
|
13
13
|
protected metadataDicomweb: any;
|
|
14
14
|
private microscopyElement;
|
|
15
15
|
protected map: any;
|
|
16
|
+
private imageURISet;
|
|
16
17
|
private internalCamera;
|
|
17
18
|
private viewer;
|
|
19
|
+
private annotationRemovedListener;
|
|
18
20
|
private voiRange;
|
|
19
21
|
private feFilter;
|
|
20
22
|
private averageWhite;
|
|
@@ -9,14 +9,18 @@ import { EPSILON } from '../constants';
|
|
|
9
9
|
import triggerEvent from '../utilities/triggerEvent';
|
|
10
10
|
import { peerImport } from '../init';
|
|
11
11
|
import microscopyViewportCss from '../constants/microscopyViewportCss';
|
|
12
|
+
import eventTarget from '../eventTarget';
|
|
13
|
+
import imageIdToURI from '../utilities/imageIdToURI';
|
|
12
14
|
let WSIUtilFunctions = null;
|
|
13
15
|
const EVENT_POSTRENDER = 'postrender';
|
|
16
|
+
const ANNOTATION_REMOVED = 'CORNERSTONE_TOOLS_ANNOTATION_REMOVED';
|
|
14
17
|
class WSIViewport extends Viewport {
|
|
15
18
|
constructor(props) {
|
|
16
19
|
super({
|
|
17
20
|
...props,
|
|
18
21
|
canvas: props.canvas || getOrCreateCanvas(props.element),
|
|
19
22
|
});
|
|
23
|
+
this.imageURISet = new Set();
|
|
20
24
|
this.internalCamera = {
|
|
21
25
|
rotation: 0,
|
|
22
26
|
centerIndex: [0, 0],
|
|
@@ -26,6 +30,26 @@ class WSIViewport extends Viewport {
|
|
|
26
30
|
resolution: 1,
|
|
27
31
|
zoom: 1,
|
|
28
32
|
};
|
|
33
|
+
this.annotationRemovedListener = (evt) => {
|
|
34
|
+
const { detail } = evt;
|
|
35
|
+
const metadata = detail?.annotation?.metadata;
|
|
36
|
+
if (!metadata) {
|
|
37
|
+
this.postrender();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const referencedImageURI = metadata.referencedImageURI ??
|
|
41
|
+
(metadata.referencedImageId
|
|
42
|
+
? imageIdToURI(metadata.referencedImageId)
|
|
43
|
+
: null);
|
|
44
|
+
if (referencedImageURI && !this.hasImageURI(referencedImageURI)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const annotationFOR = metadata.FrameOfReferenceUID ?? null;
|
|
48
|
+
if (annotationFOR && annotationFOR !== this.frameOfReferenceUID) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.postrender();
|
|
52
|
+
};
|
|
29
53
|
this.voiRange = {
|
|
30
54
|
lower: 0,
|
|
31
55
|
upper: 255,
|
|
@@ -127,9 +151,11 @@ class WSIViewport extends Viewport {
|
|
|
127
151
|
}
|
|
128
152
|
addEventListeners() {
|
|
129
153
|
this.canvas.addEventListener(EVENTS.ELEMENT_DISABLED, this.elementDisabledHandler);
|
|
154
|
+
eventTarget.addEventListener(ANNOTATION_REMOVED, this.annotationRemovedListener);
|
|
130
155
|
}
|
|
131
156
|
removeEventListeners() {
|
|
132
157
|
this.canvas.removeEventListener(EVENTS.ELEMENT_DISABLED, this.elementDisabledHandler);
|
|
158
|
+
eventTarget.removeEventListener(ANNOTATION_REMOVED, this.annotationRemovedListener);
|
|
133
159
|
}
|
|
134
160
|
elementDisabledHandler() {
|
|
135
161
|
this.removeEventListeners();
|
|
@@ -138,6 +164,7 @@ class WSIViewport extends Viewport {
|
|
|
138
164
|
const cs3dElement = this.element.firstElementChild;
|
|
139
165
|
cs3dElement.removeChild(this.microscopyElement);
|
|
140
166
|
this.microscopyElement = null;
|
|
167
|
+
this.imageURISet.clear();
|
|
141
168
|
}
|
|
142
169
|
getImageDataMetadata(imageIndex = 0) {
|
|
143
170
|
const maxImage = this.metadataDicomweb.reduce((maxImage, image) => {
|
|
@@ -269,7 +296,10 @@ class WSIViewport extends Viewport {
|
|
|
269
296
|
return imageDataReturn;
|
|
270
297
|
}
|
|
271
298
|
hasImageURI(imageURI) {
|
|
272
|
-
|
|
299
|
+
if (!imageURI) {
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
return this.imageURISet.has(imageURI);
|
|
273
303
|
}
|
|
274
304
|
setCamera(camera) {
|
|
275
305
|
const previousCamera = this.getCamera();
|
|
@@ -358,7 +388,7 @@ class WSIViewport extends Viewport {
|
|
|
358
388
|
const webClient = options?.webClient ||
|
|
359
389
|
metaData.get(MetadataModules.WADO_WEB_CLIENT, imageIds[0]);
|
|
360
390
|
if (!webClient) {
|
|
361
|
-
throw new Error(`To use setDataIds on WSI data, you must provide metaData.webClient for ${imageIds[0]}
|
|
391
|
+
throw new Error(`To use setDataIds on WSI data, you must provide metaData.webClient for ${imageIds[0]}.`);
|
|
362
392
|
}
|
|
363
393
|
return this.setWSI(imageIds, webClient);
|
|
364
394
|
}
|
|
@@ -366,6 +396,7 @@ class WSIViewport extends Viewport {
|
|
|
366
396
|
this.microscopyElement.style.background = 'black';
|
|
367
397
|
this.microscopyElement.innerText = 'Loading';
|
|
368
398
|
this.imageIds = imageIds;
|
|
399
|
+
this.imageURISet = new Set(imageIds.map((imageId) => imageIdToURI(imageId)));
|
|
369
400
|
const DicomMicroscopyViewer = await WSIViewport.getDicomMicroscopyViewer();
|
|
370
401
|
WSIUtilFunctions ||= DicomMicroscopyViewer.utils;
|
|
371
402
|
this.frameOfReferenceUID = null;
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.12.
|
|
1
|
+
export declare const version = "4.12.6";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '4.12.
|
|
1
|
+
export const version = '4.12.6';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.6",
|
|
4
4
|
"description": "Cornerstone3D Core",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"type": "individual",
|
|
98
98
|
"url": "https://ohif.org/donate"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "67da5ec35cb711e4310f0f1971bd8ed090377338"
|
|
101
101
|
}
|