@cornerstonejs/core 2.0.0-beta.2 → 2.0.0-beta.4

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.
Files changed (136) hide show
  1. package/dist/cjs/RenderingEngine/StackViewport.js +3 -4
  2. package/dist/cjs/RenderingEngine/StackViewport.js.map +1 -1
  3. package/dist/cjs/RenderingEngine/Viewport.js +8 -9
  4. package/dist/cjs/RenderingEngine/Viewport.js.map +1 -1
  5. package/dist/cjs/RenderingEngine/VolumeViewport.js +13 -0
  6. package/dist/cjs/RenderingEngine/VolumeViewport.js.map +1 -1
  7. package/dist/cjs/RenderingEngine/helpers/cpuFallback/rendering/correctShift.d.ts +1 -1
  8. package/dist/cjs/RenderingEngine/vtkClasses/vtkStreamingOpenGLVolumeMapper.js +1 -0
  9. package/dist/cjs/RenderingEngine/vtkClasses/vtkStreamingOpenGLVolumeMapper.js.map +1 -1
  10. package/dist/cjs/Settings.js +3 -1
  11. package/dist/cjs/Settings.js.map +1 -1
  12. package/dist/cjs/cache/cache.d.ts +3 -1
  13. package/dist/cjs/cache/cache.js +12 -7
  14. package/dist/cjs/cache/cache.js.map +1 -1
  15. package/dist/cjs/cache/classes/Contour.d.ts +1 -1
  16. package/dist/cjs/cache/classes/ContourSet.d.ts +1 -1
  17. package/dist/cjs/index.js +0 -1
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/cjs/loaders/geometryLoader.d.ts +1 -1
  20. package/dist/cjs/loaders/volumeLoader.js +2 -3
  21. package/dist/cjs/loaders/volumeLoader.js.map +1 -1
  22. package/dist/cjs/requestPool/requestPoolManager.d.ts +3 -3
  23. package/dist/cjs/types/ActorSliceRange.d.ts +1 -1
  24. package/dist/cjs/types/AffineMatrix.d.ts +1 -1
  25. package/dist/cjs/types/CPUFallbackColormapData.d.ts +1 -1
  26. package/dist/cjs/types/CPUFallbackColormapsData.d.ts +1 -1
  27. package/dist/cjs/types/CPUFallbackLUT.d.ts +1 -1
  28. package/dist/cjs/types/CPUFallbackRenderingTools.d.ts +1 -1
  29. package/dist/cjs/types/CPUFallbackViewport.d.ts +1 -1
  30. package/dist/cjs/types/CPUFallbackViewportDisplayedArea.d.ts +1 -1
  31. package/dist/cjs/types/CPUIImageData.d.ts +2 -2
  32. package/dist/cjs/types/Colormap.d.ts +3 -3
  33. package/dist/cjs/types/ContourData.d.ts +3 -3
  34. package/dist/cjs/types/Cornerstone3DConfig.d.ts +1 -1
  35. package/dist/cjs/types/EventTypes.d.ts +46 -46
  36. package/dist/cjs/types/FlipDirection.d.ts +1 -1
  37. package/dist/cjs/types/IActor.d.ts +4 -4
  38. package/dist/cjs/types/IImage.d.ts +2 -0
  39. package/dist/cjs/types/IViewport.d.ts +4 -4
  40. package/dist/cjs/types/IVolume.d.ts +1 -1
  41. package/dist/cjs/types/IVolumeInput.d.ts +1 -1
  42. package/dist/cjs/types/ImageLoaderFn.d.ts +1 -1
  43. package/dist/cjs/types/ImageSliceData.d.ts +1 -1
  44. package/dist/cjs/types/Mat3.d.ts +1 -1
  45. package/dist/cjs/types/Metadata.d.ts +1 -1
  46. package/dist/cjs/types/OrientationVectors.d.ts +1 -1
  47. package/dist/cjs/types/PixelDataTypedArray.d.ts +1 -1
  48. package/dist/cjs/types/Plane.d.ts +1 -1
  49. package/dist/cjs/types/Point2.d.ts +1 -1
  50. package/dist/cjs/types/Point3.d.ts +1 -1
  51. package/dist/cjs/types/Point4.d.ts +1 -1
  52. package/dist/cjs/types/RGB.d.ts +1 -1
  53. package/dist/cjs/types/ScalingParameters.d.ts +3 -3
  54. package/dist/cjs/types/StackViewportProperties.d.ts +1 -1
  55. package/dist/cjs/types/TransformMatrix2D.d.ts +1 -1
  56. package/dist/cjs/types/ViewportInputOptions.d.ts +1 -1
  57. package/dist/cjs/types/ViewportProperties.d.ts +1 -1
  58. package/dist/cjs/types/VolumeLoaderFn.d.ts +1 -1
  59. package/dist/cjs/types/VolumeViewportProperties.d.ts +1 -1
  60. package/dist/cjs/types/displayArea.d.ts +1 -1
  61. package/dist/cjs/types/voi.d.ts +2 -2
  62. package/dist/cjs/utilities/actorCheck.d.ts +1 -1
  63. package/dist/cjs/utilities/getViewportsWithImageURI.d.ts +1 -1
  64. package/dist/esm/RenderingEngine/StackViewport.js +3 -4
  65. package/dist/esm/RenderingEngine/StackViewport.js.map +1 -1
  66. package/dist/esm/RenderingEngine/Viewport.js +8 -9
  67. package/dist/esm/RenderingEngine/Viewport.js.map +1 -1
  68. package/dist/esm/RenderingEngine/VolumeViewport.js +15 -2
  69. package/dist/esm/RenderingEngine/VolumeViewport.js.map +1 -1
  70. package/dist/esm/RenderingEngine/helpers/cpuFallback/rendering/correctShift.d.ts +1 -1
  71. package/dist/esm/RenderingEngine/vtkClasses/vtkStreamingOpenGLVolumeMapper.js +1 -0
  72. package/dist/esm/RenderingEngine/vtkClasses/vtkStreamingOpenGLVolumeMapper.js.map +1 -1
  73. package/dist/esm/Settings.js +3 -1
  74. package/dist/esm/Settings.js.map +1 -1
  75. package/dist/esm/cache/cache.d.ts +3 -1
  76. package/dist/esm/cache/cache.js +12 -7
  77. package/dist/esm/cache/cache.js.map +1 -1
  78. package/dist/esm/cache/classes/Contour.d.ts +1 -1
  79. package/dist/esm/cache/classes/ContourSet.d.ts +1 -1
  80. package/dist/esm/index.js +0 -1
  81. package/dist/esm/index.js.map +1 -1
  82. package/dist/esm/loaders/geometryLoader.d.ts +1 -1
  83. package/dist/esm/loaders/volumeLoader.js +2 -3
  84. package/dist/esm/loaders/volumeLoader.js.map +1 -1
  85. package/dist/esm/requestPool/requestPoolManager.d.ts +3 -3
  86. package/dist/esm/types/ActorSliceRange.d.ts +1 -1
  87. package/dist/esm/types/AffineMatrix.d.ts +1 -1
  88. package/dist/esm/types/CPUFallbackColormapData.d.ts +1 -1
  89. package/dist/esm/types/CPUFallbackColormapsData.d.ts +1 -1
  90. package/dist/esm/types/CPUFallbackLUT.d.ts +1 -1
  91. package/dist/esm/types/CPUFallbackRenderingTools.d.ts +1 -1
  92. package/dist/esm/types/CPUFallbackViewport.d.ts +1 -1
  93. package/dist/esm/types/CPUFallbackViewportDisplayedArea.d.ts +1 -1
  94. package/dist/esm/types/CPUIImageData.d.ts +2 -2
  95. package/dist/esm/types/Colormap.d.ts +3 -3
  96. package/dist/esm/types/ContourData.d.ts +3 -3
  97. package/dist/esm/types/Cornerstone3DConfig.d.ts +1 -1
  98. package/dist/esm/types/EventTypes.d.ts +46 -46
  99. package/dist/esm/types/FlipDirection.d.ts +1 -1
  100. package/dist/esm/types/IActor.d.ts +4 -4
  101. package/dist/esm/types/IImage.d.ts +2 -0
  102. package/dist/esm/types/IViewport.d.ts +4 -4
  103. package/dist/esm/types/IVolume.d.ts +1 -1
  104. package/dist/esm/types/IVolumeInput.d.ts +1 -1
  105. package/dist/esm/types/ImageLoaderFn.d.ts +1 -1
  106. package/dist/esm/types/ImageSliceData.d.ts +1 -1
  107. package/dist/esm/types/Mat3.d.ts +1 -1
  108. package/dist/esm/types/Metadata.d.ts +1 -1
  109. package/dist/esm/types/OrientationVectors.d.ts +1 -1
  110. package/dist/esm/types/PixelDataTypedArray.d.ts +1 -1
  111. package/dist/esm/types/Plane.d.ts +1 -1
  112. package/dist/esm/types/Point2.d.ts +1 -1
  113. package/dist/esm/types/Point3.d.ts +1 -1
  114. package/dist/esm/types/Point4.d.ts +1 -1
  115. package/dist/esm/types/RGB.d.ts +1 -1
  116. package/dist/esm/types/ScalingParameters.d.ts +3 -3
  117. package/dist/esm/types/StackViewportProperties.d.ts +1 -1
  118. package/dist/esm/types/TransformMatrix2D.d.ts +1 -1
  119. package/dist/esm/types/ViewportInputOptions.d.ts +1 -1
  120. package/dist/esm/types/ViewportProperties.d.ts +1 -1
  121. package/dist/esm/types/VolumeLoaderFn.d.ts +1 -1
  122. package/dist/esm/types/VolumeViewportProperties.d.ts +1 -1
  123. package/dist/esm/types/displayArea.d.ts +1 -1
  124. package/dist/esm/types/voi.d.ts +2 -2
  125. package/dist/esm/utilities/actorCheck.d.ts +1 -1
  126. package/dist/esm/utilities/getViewportsWithImageURI.d.ts +1 -1
  127. package/dist/umd/index.js +1 -1
  128. package/dist/umd/index.js.map +1 -1
  129. package/package.json +3 -4
  130. package/src/RenderingEngine/StackViewport.ts +3 -4
  131. package/src/RenderingEngine/Viewport.ts +9 -10
  132. package/src/RenderingEngine/VolumeViewport.ts +20 -3
  133. package/src/Settings.ts +3 -1
  134. package/src/cache/cache.ts +33 -18
  135. package/src/loaders/volumeLoader.ts +2 -3
  136. package/src/types/IImage.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.4",
4
4
  "description": "",
5
5
  "main": "dist/umd/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -32,8 +32,7 @@
32
32
  "dependencies": {
33
33
  "@kitware/vtk.js": "27.3.1",
34
34
  "detect-gpu": "^5.0.22",
35
- "gl-matrix": "^3.4.3",
36
- "lodash.clonedeep": "4.5.0"
35
+ "gl-matrix": "^3.4.3"
37
36
  },
38
37
  "contributors": [
39
38
  {
@@ -46,5 +45,5 @@
46
45
  "type": "individual",
47
46
  "url": "https://ohif.org/donate"
48
47
  },
49
- "gitHead": "c154f7531c166db29a54fe41c76a22ecc7ac47c8"
48
+ "gitHead": "deefd5fb773ca3eb6fc4f2047c15a2b1a3ac82de"
50
49
  }
@@ -1,7 +1,6 @@
1
1
  import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray';
2
2
  import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
3
3
  import type { vtkImageData as vtkImageDataType } from '@kitware/vtk.js/Common/DataModel/ImageData';
4
- import _cloneDeep from 'lodash.clonedeep';
5
4
  import vtkCamera from '@kitware/vtk.js/Rendering/Core/Camera';
6
5
  import { vec2, vec3, mat4 } from 'gl-matrix';
7
6
  import vtkImageMapper from '@kitware/vtk.js/Rendering/Core/ImageMapper';
@@ -1017,7 +1016,7 @@ class StackViewport extends Viewport implements IStackViewport {
1017
1016
  ? vec3.negate(vec3.create(), this.initialViewUp)
1018
1017
  : this.initialViewUp;
1019
1018
 
1020
- this.setCamera({
1019
+ this.setCameraNoEvent({
1021
1020
  viewUp: initialViewUp as Point3,
1022
1021
  });
1023
1022
 
@@ -1957,7 +1956,7 @@ class StackViewport extends Viewport implements IStackViewport {
1957
1956
 
1958
1957
  // Cache camera props so we can trigger one camera changed event after
1959
1958
  // The full transition.
1960
- const previousCameraProps = _cloneDeep(this.getCamera());
1959
+ const previousCameraProps = structuredClone(this.getCamera());
1961
1960
  if (sameImageData && !this.stackInvalidated) {
1962
1961
  // 3a. If we can reuse it, replace the scalar data under the hood
1963
1962
  this._updateVTKImageDataFromCornerstoneImage(image);
@@ -2239,7 +2238,7 @@ class StackViewport extends Viewport implements IStackViewport {
2239
2238
 
2240
2239
  const targetImageId = imageIds[newTargetImageIdIndex];
2241
2240
 
2242
- const imageAlreadyLoaded = cache.isImageIdCached(targetImageId);
2241
+ const imageAlreadyLoaded = cache.isLoaded(targetImageId);
2243
2242
 
2244
2243
  // If image is already cached we want to scroll right away; however, if it is
2245
2244
  // not cached, we can debounce the scroll event to avoid firing multiple scroll
@@ -4,7 +4,6 @@ import vtkMath from '@kitware/vtk.js/Common/Core/Math';
4
4
  import vtkPlane from '@kitware/vtk.js/Common/DataModel/Plane';
5
5
 
6
6
  import { vec2, vec3 } from 'gl-matrix';
7
- import _cloneDeep from 'lodash.clonedeep';
8
7
 
9
8
  import Events from '../enums/Events';
10
9
  import ViewportStatus from '../enums/ViewportStatus';
@@ -103,11 +102,11 @@ class Viewport implements IViewport {
103
102
  this.renderingEngineId
104
103
  );
105
104
 
106
- this.defaultOptions = _cloneDeep(props.defaultOptions);
105
+ this.defaultOptions = structuredClone(props.defaultOptions);
107
106
  this.suppressEvents = props.defaultOptions.suppressEvents
108
107
  ? props.defaultOptions.suppressEvents
109
108
  : false;
110
- this.options = _cloneDeep(props.defaultOptions);
109
+ this.options = structuredClone(props.defaultOptions);
111
110
  this.isDisabled = false;
112
111
  }
113
112
 
@@ -126,7 +125,7 @@ class Viewport implements IViewport {
126
125
 
127
126
  /**
128
127
  * Indicate that the image has been rendered.
129
- * This will set hte viewportStatus to RENDERED if there is image data
128
+ * This will set the viewportStatus to RENDERED if there is image data
130
129
  * available to actually be rendered - otherwise, the rendering simply showed
131
130
  * the background image.
132
131
  */
@@ -180,7 +179,7 @@ class Viewport implements IViewport {
180
179
  * @param immediate - If `true`, renders the viewport after the options are set.
181
180
  */
182
181
  public setOptions(options: ViewportInputOptions, immediate = false): void {
183
- this.options = <ViewportInputOptions>_cloneDeep(options);
182
+ this.options = <ViewportInputOptions>structuredClone(options);
184
183
 
185
184
  // TODO When this is needed we need to move the camera position.
186
185
  // We can steal some logic from the tools we build to do this.
@@ -198,7 +197,7 @@ class Viewport implements IViewport {
198
197
  * @param immediate - If `true`, renders the viewport after the options are reset.
199
198
  */
200
199
  public reset(immediate = false) {
201
- this.options = _cloneDeep(this.defaultOptions);
200
+ this.options = structuredClone(this.defaultOptions);
202
201
 
203
202
  // TODO When this is needed we need to move the camera position.
204
203
  // We can steal some logic from the tools we build to do this.
@@ -660,7 +659,7 @@ class Viewport implements IViewport {
660
659
  flipVertical: false,
661
660
  });
662
661
 
663
- const previousCamera = _cloneDeep(this.getCamera());
662
+ const previousCamera = structuredClone(this.getCamera());
664
663
  const bounds = renderer.computeVisiblePropBounds();
665
664
  const focalPoint = <Point3>[0, 0, 0];
666
665
  const imageData = this.getDefaultImageData();
@@ -775,9 +774,9 @@ class Viewport implements IViewport {
775
774
  clippingRange: clippingRangeToUse,
776
775
  });
777
776
 
778
- const modifiedCamera = _cloneDeep(this.getCamera());
777
+ const modifiedCamera = structuredClone(this.getCamera());
779
778
 
780
- this.setFitToCanvasCamera(_cloneDeep(this.getCamera()));
779
+ this.setFitToCanvasCamera(structuredClone(this.getCamera()));
781
780
 
782
781
  if (storeAsInitialCamera) {
783
782
  this.setInitialCamera(modifiedCamera);
@@ -1007,7 +1006,7 @@ class Viewport implements IViewport {
1007
1006
  storeAsInitialCamera = false
1008
1007
  ): void {
1009
1008
  const vtkCamera = this.getVtkActiveCamera();
1010
- const previousCamera = _cloneDeep(this.getCamera());
1009
+ const previousCamera = structuredClone(this.getCamera());
1011
1010
  const updatedCamera = Object.assign({}, previousCamera, cameraInterface);
1012
1011
  const {
1013
1012
  viewUp,
@@ -1,9 +1,11 @@
1
1
  import vtkPlane from '@kitware/vtk.js/Common/DataModel/Plane';
2
+ import vtkVolume from '@kitware/vtk.js/Rendering/Core/Volume';
3
+
2
4
  import { vec3 } from 'gl-matrix';
3
5
 
4
6
  import cache from '../cache';
5
7
  import { MPR_CAMERA_VALUES, RENDERING_DEFAULTS } from '../constants';
6
- import { BlendModes, OrientationAxis } from '../enums';
8
+ import { BlendModes, OrientationAxis, Events } from '../enums';
7
9
  import type {
8
10
  ActorEntry,
9
11
  IImageVolume,
@@ -12,10 +14,9 @@ import type {
12
14
  Point3,
13
15
  } from '../types';
14
16
  import type { ViewportInput } from '../types/IViewport';
15
- import { actorIsA, getClosestImageId } from '../utilities';
17
+ import { actorIsA, getClosestImageId, triggerEvent } from '../utilities';
16
18
  import BaseVolumeViewport from './BaseVolumeViewport';
17
19
  import setDefaultVolumeVOI from './helpers/setDefaultVolumeVOI';
18
- import vtkVolume from '@kitware/vtk.js/Rendering/Core/Volume';
19
20
 
20
21
  /**
21
22
  * An object representing a VolumeViewport. VolumeViewports are used to render
@@ -383,6 +384,22 @@ class VolumeViewport extends BaseVolumeViewport {
383
384
  );
384
385
  }
385
386
  setDefaultVolumeVOI(volumeActor.actor as vtkVolume, imageVolume, false);
387
+
388
+ const range = (volumeActor.actor as vtkVolume)
389
+ .getProperty()
390
+ .getRGBTransferFunction(0)
391
+ .getMappingRange();
392
+
393
+ const eventDetails = {
394
+ viewportId: volumeActor.uid,
395
+ range: {
396
+ lower: range[0],
397
+ upper: range[1],
398
+ },
399
+ volumeId: volumeActor.uid,
400
+ };
401
+
402
+ triggerEvent(this.element, Events.VOI_MODIFIED, eventDetails);
386
403
  }
387
404
  }
388
405
 
package/src/Settings.ts CHANGED
@@ -13,7 +13,9 @@ const DICTIONARY = Symbol('Dictionary');
13
13
  export default class Settings {
14
14
  constructor(base?: Settings) {
15
15
  const dictionary = Object.create(
16
- base instanceof Settings && DICTIONARY in base ? base[DICTIONARY] : null
16
+ base instanceof Settings && DICTIONARY in base
17
+ ? (base[DICTIONARY] as object)
18
+ : null
17
19
  );
18
20
  Object.seal(
19
21
  Object.defineProperty(this, DICTIONARY, {
@@ -15,34 +15,40 @@ import { triggerEvent, imageIdToURI } from '../utilities';
15
15
  import eventTarget from '../eventTarget';
16
16
  import Events from '../enums/Events';
17
17
 
18
- const MAX_CACHE_SIZE_1GB = 1073741824;
18
+ const ONE_GB = 1073741824;
19
19
 
20
+ /**
21
+ * Stores images, volumes and geometry.
22
+ * There are two sizes - the max cache size, that controls the overal maximum
23
+ * size, and the instance size, which controls how big any single object can
24
+ * be. Defaults are 3 GB and 2 GB - 8 bytes (just enough to allow allocating it
25
+ * without crashing).
26
+ * The 3 gb is tuned to the chromium garbage collection cycle to allow image volumes
27
+ * to be used/discarded.
28
+ */
20
29
  class Cache implements ICache {
21
- private readonly _imageCache: Map<string, ICachedImage>; // volatile space
22
- private readonly _volumeCache: Map<string, ICachedVolume>; // non-volatile space
30
+ // used to store image data (2d)
31
+ private readonly _imageCache = new Map<string, ICachedImage>(); // volatile space
32
+ // used to store volume data (3d)
33
+ private readonly _volumeCache = new Map<string, ICachedVolume>(); // non-volatile space
23
34
  // Todo: contour for now, but will be used for surface, etc.
24
35
  private readonly _geometryCache: Map<string, ICachedGeometry>;
25
- private _imageCacheSize: number;
26
- private _volumeCacheSize: number;
27
- private _maxCacheSize: number;
36
+
37
+ private _imageCacheSize = 0;
38
+ private _volumeCacheSize = 0;
39
+ private _maxCacheSize = 3 * ONE_GB;
40
+ private _maxInstanceSize = 2 * ONE_GB - 8;
28
41
 
29
42
  constructor() {
30
- // used to store image data (2d)
31
- this._imageCache = new Map();
32
- // used to store volume data (3d)
33
- this._volumeCache = new Map();
34
43
  // used to store object data (contour, surface, etc.)
35
44
  this._geometryCache = new Map();
36
- this._imageCacheSize = 0;
37
- this._volumeCacheSize = 0;
38
- this._maxCacheSize = MAX_CACHE_SIZE_1GB; // Default 1GB
39
45
  }
40
46
 
41
47
  /**
42
48
  * Set the maximum cache Size
43
49
  *
44
- * Maximum cache size should be set before adding the data; otherwise, it
45
- * will throw an error.
50
+ * Maximum cache size should be set before adding the data. If set after,
51
+ * and it is smaller than the current size, will cause issues.
46
52
  *
47
53
  * @param newMaxCacheSize - new maximum cache size
48
54
  *
@@ -59,7 +65,7 @@ class Cache implements ICache {
59
65
  /**
60
66
  * Checks if there is enough space in the cache for requested byte size
61
67
  *
62
- * It throws error, if the sum of volatile (image) cache and unallocated cache
68
+ * It returns false, if the sum of volatile (image) cache and unallocated cache
63
69
  * is less than the requested byteLength
64
70
  *
65
71
  * @param byteLength - byte length of requested byte size
@@ -67,6 +73,9 @@ class Cache implements ICache {
67
73
  * @returns - boolean indicating if there is enough space in the cache
68
74
  */
69
75
  public isCacheable = (byteLength: number): boolean => {
76
+ if (byteLength > this._maxInstanceSize) {
77
+ return false;
78
+ }
70
79
  const unallocatedSpace = this.getBytesAvailable();
71
80
  const imageCacheSize = this._imageCacheSize;
72
81
  const availableSpace = unallocatedSpace + imageCacheSize;
@@ -81,6 +90,13 @@ class Cache implements ICache {
81
90
  */
82
91
  public getMaxCacheSize = (): number => this._maxCacheSize;
83
92
 
93
+ /**
94
+ * Returns maximum size of a single instance (volume or single image)
95
+ *
96
+ * @returns maximum instance size
97
+ */
98
+ public getMaxInstanceSize = (): number => this._maxInstanceSize;
99
+
84
100
  /**
85
101
  * Returns current size of the cache
86
102
  *
@@ -384,7 +400,6 @@ class Cache implements ICache {
384
400
  cachedImage.image = image;
385
401
  cachedImage.sizeInBytes = image.sizeInBytes;
386
402
  this._incrementImageCacheSize(cachedImage.sizeInBytes);
387
-
388
403
  const eventDetails: EventTypes.ImageCacheImageAddedEventDetail = {
389
404
  image: cachedImage,
390
405
  };
@@ -429,7 +444,7 @@ class Cache implements ICache {
429
444
  * @param imageId - image Id to check
430
445
  * @returns boolean
431
446
  */
432
- public isImageIdCached(imageId: string): boolean {
447
+ public isLoaded(imageId: string): boolean {
433
448
  const cachedImage = this._imageCache.get(imageId);
434
449
 
435
450
  if (!cachedImage) {
@@ -3,7 +3,6 @@ import '@kitware/vtk.js/Rendering/Profiles/Volume';
3
3
  import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
4
4
  import type { vtkImageData as vtkImageDataType } from '@kitware/vtk.js/Common/DataModel/ImageData';
5
5
  import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray';
6
- import cloneDeep from 'lodash.clonedeep';
7
6
 
8
7
  import { ImageVolume } from '../cache/classes/ImageVolume';
9
8
  import type * as Types from '../types';
@@ -330,7 +329,7 @@ export async function createAndCacheDerivedVolume(
330
329
 
331
330
  const derivedVolume = new ImageVolume({
332
331
  volumeId,
333
- metadata: cloneDeep(metadata),
332
+ metadata: structuredClone(metadata),
334
333
  dimensions: [dimensions[0], dimensions[1], dimensions[2]],
335
334
  spacing,
336
335
  origin,
@@ -419,7 +418,7 @@ export function createLocalVolume(
419
418
 
420
419
  const derivedVolume = new ImageVolume({
421
420
  volumeId,
422
- metadata: cloneDeep(metadata),
421
+ metadata: structuredClone(metadata),
423
422
  dimensions: [dimensions[0], dimensions[1], dimensions[2]],
424
423
  spacing,
425
424
  origin,
@@ -93,6 +93,8 @@ interface IImage {
93
93
  suvbwToSuvbsa?: number;
94
94
  };
95
95
  };
96
+ loadTimeInMS?: number;
97
+ decodeTimeInMS?: number;
96
98
  /** CPU: image statistics for rendering */
97
99
  stats?: {
98
100
  lastStoredPixelDataToCanvasImageDataTime?: number;