@cornerstonejs/core 0.39.0 → 0.40.1
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/RenderingEngine/BaseVolumeViewport.js +3 -1
- package/dist/cjs/RenderingEngine/BaseVolumeViewport.js.map +1 -1
- package/dist/cjs/RenderingEngine/vtkClasses/vtkStreamingOpenGLVolumeMapper.js.map +1 -1
- package/dist/cjs/cache/cache.js +1 -1
- package/dist/cjs/cache/cache.js.map +1 -1
- package/dist/cjs/cache/classes/ImageVolume.d.ts +2 -1
- package/dist/cjs/cache/classes/ImageVolume.js +4 -0
- package/dist/cjs/cache/classes/ImageVolume.js.map +1 -1
- package/dist/cjs/init.js +2 -0
- package/dist/cjs/init.js.map +1 -1
- package/dist/cjs/types/Cornerstone3DConfig.d.ts +1 -0
- package/dist/esm/RenderingEngine/BaseVolumeViewport.js +3 -1
- package/dist/esm/RenderingEngine/BaseVolumeViewport.js.map +1 -1
- package/dist/esm/RenderingEngine/vtkClasses/vtkStreamingOpenGLVolumeMapper.js.map +1 -1
- package/dist/esm/cache/cache.js +1 -1
- package/dist/esm/cache/cache.js.map +1 -1
- package/dist/esm/cache/classes/ImageVolume.d.ts +2 -1
- package/dist/esm/cache/classes/ImageVolume.js +4 -0
- package/dist/esm/cache/classes/ImageVolume.js.map +1 -1
- package/dist/esm/init.js +2 -0
- package/dist/esm/init.js.map +1 -1
- package/dist/esm/types/Cornerstone3DConfig.d.ts +1 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
- package/src/RenderingEngine/BaseVolumeViewport.ts +3 -1
- package/src/RenderingEngine/vtkClasses/vtkStreamingOpenGLVolumeMapper.js +12 -0
- package/src/cache/cache.ts +1 -1
- package/src/cache/classes/ImageVolume.ts +7 -1
- package/src/init.ts +2 -0
- package/src/types/Cornerstone3DConfig.ts +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/umd/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"type": "individual",
|
|
52
52
|
"url": "https://ohif.org/donate"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "ebbb555ff9032600b1f7d6fecde9303e5c79571f"
|
|
55
55
|
}
|
|
@@ -599,7 +599,9 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
599
599
|
spacing: vtkImageData.getSpacing(),
|
|
600
600
|
origin: vtkImageData.getOrigin(),
|
|
601
601
|
direction: vtkImageData.getDirection(),
|
|
602
|
-
scalarData: vtkImageData.getPointData().getScalars().
|
|
602
|
+
scalarData: vtkImageData.getPointData().getScalars().isDeleted()
|
|
603
|
+
? null
|
|
604
|
+
: vtkImageData.getPointData().getScalars().getData(),
|
|
603
605
|
imageData: actor.getMapper().getInputData(),
|
|
604
606
|
metadata: {
|
|
605
607
|
Modality: volume?.metadata?.Modality,
|
|
@@ -285,6 +285,18 @@ function vtkStreamingOpenGLVolumeMapper(publicAPI, model) {
|
|
|
285
285
|
|
|
286
286
|
return [lowerLeftU, lowerLeftV];
|
|
287
287
|
};
|
|
288
|
+
|
|
289
|
+
// TODO: it seems like this may be needed to reset the GPU memory associated
|
|
290
|
+
// with a volume
|
|
291
|
+
// publicAPI.hardReset = () => {
|
|
292
|
+
// model.opacityTexture.releaseGraphicsResources(model._openGLRenderWindow);
|
|
293
|
+
// model.colorTexture.releaseGraphicsResources(model._openGLRenderWindow);
|
|
294
|
+
// model.scalarTexture.setOglNorm16Ext(
|
|
295
|
+
// model.context.getExtension('EXT_texture_norm16')
|
|
296
|
+
// );
|
|
297
|
+
// model.scalarTexture.releaseGraphicsResources(model._openGLRenderWindow);
|
|
298
|
+
// model.scalarTexture.resetFormatAndType();
|
|
299
|
+
// };
|
|
288
300
|
}
|
|
289
301
|
|
|
290
302
|
// ----------------------------------------------------------------------------
|
package/src/cache/cache.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import isTypedArray from '../../utilities/isTypedArray';
|
|
2
2
|
import { imageIdToURI } from '../../utilities';
|
|
3
3
|
import { vtkStreamingOpenGLTexture } from '../../RenderingEngine/vtkClasses';
|
|
4
|
+
import type { vtkImageData } from '@kitware/vtk.js/Common/DataModel/ImageData';
|
|
4
5
|
import {
|
|
5
6
|
IVolume,
|
|
6
7
|
VolumeScalarData,
|
|
@@ -50,7 +51,7 @@ export class ImageVolume implements IImageVolume {
|
|
|
50
51
|
/** volume number of voxels */
|
|
51
52
|
numVoxels: number;
|
|
52
53
|
/** volume image data */
|
|
53
|
-
imageData?:
|
|
54
|
+
imageData?: vtkImageData;
|
|
54
55
|
/** open gl texture for the volume */
|
|
55
56
|
vtkOpenGLTexture: any; // No good way of referencing vtk classes as they aren't classes.
|
|
56
57
|
/** load status object for the volume */
|
|
@@ -147,7 +148,12 @@ export class ImageVolume implements IImageVolume {
|
|
|
147
148
|
* destroy the volume and make it unusable
|
|
148
149
|
*/
|
|
149
150
|
destroy(): void {
|
|
151
|
+
// TODO: GPU memory associated with volume is not cleared.
|
|
152
|
+
this.vtkOpenGLTexture.releaseGraphicsResources();
|
|
153
|
+
this.vtkOpenGLTexture.destroyTexture();
|
|
150
154
|
this.vtkOpenGLTexture.delete();
|
|
155
|
+
this.imageData.delete();
|
|
156
|
+
this.imageData = null;
|
|
151
157
|
this.scalarData = null;
|
|
152
158
|
}
|
|
153
159
|
}
|
package/src/init.ts
CHANGED
|
@@ -13,6 +13,7 @@ const defaultConfig = {
|
|
|
13
13
|
preferSizeOverAccuracy: false,
|
|
14
14
|
useCPURendering: false,
|
|
15
15
|
useNorm16Texture: false, // _hasNorm16TextureSupport(),
|
|
16
|
+
strictZSpacingForVolumeViewport: true,
|
|
16
17
|
},
|
|
17
18
|
// cache
|
|
18
19
|
// ...
|
|
@@ -24,6 +25,7 @@ let config = {
|
|
|
24
25
|
preferSizeOverAccuracy: false,
|
|
25
26
|
useCPURendering: false,
|
|
26
27
|
useNorm16Texture: false, // _hasNorm16TextureSupport(),
|
|
28
|
+
strictZSpacingForVolumeViewport: true,
|
|
27
29
|
},
|
|
28
30
|
// cache
|
|
29
31
|
// ...
|
|
@@ -25,6 +25,16 @@ type Cornerstone3DConfig = {
|
|
|
25
25
|
// https://bugs.webkit.org/show_bug.cgi?id=252039
|
|
26
26
|
useNorm16Texture: boolean;
|
|
27
27
|
useCPURendering: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* flag to control whether to use fallback behavior for z-spacing calculation in
|
|
30
|
+
* volume viewports when the necessary metadata is missing. If enabled,
|
|
31
|
+
* we will fall back to using slice thickness or a default value of 1 to render
|
|
32
|
+
* the volume viewport when z-spacing cannot be calculated from images
|
|
33
|
+
* This can help improve the usability and robustness of the visualization
|
|
34
|
+
* in scenarios where the metadata is incomplete or missing, but
|
|
35
|
+
* it might be wrong assumption in certain scenarios.
|
|
36
|
+
*/
|
|
37
|
+
strictZSpacingForVolumeViewport: boolean;
|
|
28
38
|
};
|
|
29
39
|
};
|
|
30
40
|
|