@cornerstonejs/core 0.38.0 → 0.40.0

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.38.0",
3
+ "version": "0.40.0",
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": "9a2711ca032949079e7b96ba332b6e01b3316da8"
54
+ "gitHead": "b21acf448f3b24c4ff109da5208bc313c0289b81"
55
55
  }
@@ -188,6 +188,11 @@ enum Events {
188
188
  */
189
189
  GEOMETRY_CACHE_GEOMETRY_ADDED = 'CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_ADDED',
190
190
 
191
+ /**
192
+ * Triggers when the scroll function is called with a delta that is out of bounds.
193
+ * This is usually for signaling that the user may want a different volume for partially loaded volumes which is meant to optimize memory.
194
+ */
195
+ VOLUME_SCROLL_OUT_OF_BOUNDS = 'CORNERSTONE_VOLUME_SCROLL_OUT_OF_BOUNDS',
191
196
  // IMAGE_CACHE_FULL = 'CORNERSTONE_IMAGE_CACHE_FULL',
192
197
  // PRE_RENDER = 'CORNERSTONE_PRE_RENDER',
193
198
  // ELEMENT_RESIZED = 'CORNERSTONE_ELEMENT_RESIZED',
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
 
@@ -11,10 +11,8 @@ function getVolumeViewportScrollInfo(
11
11
  viewport: IVolumeViewport,
12
12
  volumeId: string
13
13
  ) {
14
- const { sliceRange, spacingInNormalDirection } = getVolumeSliceRangeInfo(
15
- viewport,
16
- volumeId
17
- );
14
+ const { sliceRange, spacingInNormalDirection, camera } =
15
+ getVolumeSliceRangeInfo(viewport, volumeId);
18
16
 
19
17
  const { min, max, current } = sliceRange;
20
18
 
@@ -26,7 +24,15 @@ function getVolumeViewportScrollInfo(
26
24
  const floatingStepNumber = fraction * numScrollSteps;
27
25
  const currentStepIndex = Math.round(floatingStepNumber);
28
26
 
29
- return { numScrollSteps, currentStepIndex };
27
+ return {
28
+ numScrollSteps,
29
+ currentStepIndex,
30
+ sliceRangeInfo: {
31
+ sliceRange,
32
+ spacingInNormalDirection,
33
+ camera,
34
+ },
35
+ };
30
36
  }
31
37
 
32
38
  export default getVolumeViewportScrollInfo;