@cornerstonejs/core 0.40.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "0.40.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": "b21acf448f3b24c4ff109da5208bc313c0289b81"
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().getData(),
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
  // ----------------------------------------------------------------------------
@@ -133,7 +133,7 @@ class Cache implements ICache {
133
133
  }
134
134
 
135
135
  if (volume.imageData) {
136
- volume.imageData = null;
136
+ volume.imageData.delete();
137
137
  }
138
138
 
139
139
  if (volumeLoadObject.cancelFn) {
@@ -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?: any;
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
  }