@cornerstonejs/core 1.32.2 → 1.32.3

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 (27) hide show
  1. package/dist/cjs/utilities/getTargetVolumeAndSpacingInNormalDir.d.ts +1 -1
  2. package/dist/cjs/utilities/getTargetVolumeAndSpacingInNormalDir.js +4 -4
  3. package/dist/cjs/utilities/getTargetVolumeAndSpacingInNormalDir.js.map +1 -1
  4. package/dist/cjs/utilities/getVolumeSliceRangeInfo.d.ts +1 -1
  5. package/dist/cjs/utilities/getVolumeSliceRangeInfo.js +2 -2
  6. package/dist/cjs/utilities/getVolumeSliceRangeInfo.js.map +1 -1
  7. package/dist/cjs/utilities/getVolumeViewportScrollInfo.d.ts +1 -1
  8. package/dist/cjs/utilities/getVolumeViewportScrollInfo.js +2 -2
  9. package/dist/cjs/utilities/getVolumeViewportScrollInfo.js.map +1 -1
  10. package/dist/esm/utilities/getTargetVolumeAndSpacingInNormalDir.js +4 -4
  11. package/dist/esm/utilities/getTargetVolumeAndSpacingInNormalDir.js.map +1 -1
  12. package/dist/esm/utilities/getVolumeSliceRangeInfo.js +2 -2
  13. package/dist/esm/utilities/getVolumeSliceRangeInfo.js.map +1 -1
  14. package/dist/esm/utilities/getVolumeViewportScrollInfo.js +2 -2
  15. package/dist/esm/utilities/getVolumeViewportScrollInfo.js.map +1 -1
  16. package/dist/types/utilities/getTargetVolumeAndSpacingInNormalDir.d.ts +1 -1
  17. package/dist/types/utilities/getTargetVolumeAndSpacingInNormalDir.d.ts.map +1 -1
  18. package/dist/types/utilities/getVolumeSliceRangeInfo.d.ts +1 -1
  19. package/dist/types/utilities/getVolumeSliceRangeInfo.d.ts.map +1 -1
  20. package/dist/types/utilities/getVolumeViewportScrollInfo.d.ts +1 -1
  21. package/dist/types/utilities/getVolumeViewportScrollInfo.d.ts.map +1 -1
  22. package/dist/umd/index.js +1 -1
  23. package/dist/umd/index.js.map +1 -1
  24. package/package.json +2 -2
  25. package/src/utilities/getTargetVolumeAndSpacingInNormalDir.ts +9 -5
  26. package/src/utilities/getVolumeSliceRangeInfo.ts +10 -2
  27. package/src/utilities/getVolumeViewportScrollInfo.ts +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "1.32.2",
3
+ "version": "1.32.3",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "types": "dist/types/index.d.ts",
@@ -47,5 +47,5 @@
47
47
  "type": "individual",
48
48
  "url": "https://ohif.org/donate"
49
49
  },
50
- "gitHead": "c6c2dfdee7f3b1137fae77d9154809267076dc87"
50
+ "gitHead": "0a00cbe4159dc323fcce9b374938f3eedf343ed1"
51
51
  }
@@ -30,14 +30,16 @@ const isPrimaryVolume = (volume): boolean =>
30
30
  * @param camera - current camera
31
31
  * @param targetVolumeId - If a target volumeId is given that volume
32
32
  * is forced to be used.
33
- *
33
+ * @param useSlabThickness - If true, the number of steps will be calculated
34
+ * based on the slab thickness instead of the spacing in the normal direction
34
35
  * @returns An object containing the imageVolume and spacingInNormalDirection.
35
36
  *
36
37
  */
37
38
  export default function getTargetVolumeAndSpacingInNormalDir(
38
39
  viewport: IVolumeViewport,
39
40
  camera: ICamera,
40
- targetVolumeId?: string
41
+ targetVolumeId?: string,
42
+ useSlabThickness = false
41
43
  ): {
42
44
  imageVolume: IImageVolume;
43
45
  spacingInNormalDirection: number;
@@ -75,7 +77,8 @@ export default function getTargetVolumeAndSpacingInNormalDir(
75
77
  const spacingInNormalDirection = getSpacingInNormal(
76
78
  imageVolume,
77
79
  viewPlaneNormal,
78
- viewport
80
+ viewport,
81
+ useSlabThickness
79
82
  );
80
83
 
81
84
  return { imageVolume, spacingInNormalDirection, actorUID };
@@ -131,11 +134,12 @@ export default function getTargetVolumeAndSpacingInNormalDir(
131
134
  function getSpacingInNormal(
132
135
  imageVolume: IImageVolume,
133
136
  viewPlaneNormal: Point3,
134
- viewport: IVolumeViewport
137
+ viewport: IVolumeViewport,
138
+ useSlabThickness = false
135
139
  ): number {
136
140
  const { slabThickness } = viewport.getProperties();
137
141
  let spacingInNormalDirection = slabThickness;
138
- if (!slabThickness) {
142
+ if (!slabThickness || useSlabThickness === false) {
139
143
  spacingInNormalDirection = getSpacingInNormalDirection(
140
144
  imageVolume,
141
145
  viewPlaneNormal
@@ -11,11 +11,14 @@ import {
11
11
  * Calculates the slice range for the given volume based on its orientation
12
12
  * @param viewport - Volume viewport
13
13
  * @param volumeId - Id of one of the volumes loaded on the given viewport
14
+ * @param useSlabThickness - If true, the slice range will be calculated
15
+ * based on the slab thickness instead of the spacing in the normal direction
14
16
  * @returns slice range information
15
17
  */
16
18
  function getVolumeSliceRangeInfo(
17
19
  viewport: IVolumeViewport,
18
- volumeId: string
20
+ volumeId: string,
21
+ useSlabThickness = false
19
22
  ): {
20
23
  sliceRange: ActorSliceRange;
21
24
  spacingInNormalDirection: number;
@@ -24,7 +27,12 @@ function getVolumeSliceRangeInfo(
24
27
  const camera = viewport.getCamera();
25
28
  const { focalPoint, viewPlaneNormal } = camera;
26
29
  const { spacingInNormalDirection, actorUID } =
27
- getTargetVolumeAndSpacingInNormalDir(viewport, camera, volumeId);
30
+ getTargetVolumeAndSpacingInNormalDir(
31
+ viewport,
32
+ camera,
33
+ volumeId,
34
+ useSlabThickness
35
+ );
28
36
 
29
37
  if (!actorUID) {
30
38
  throw new Error(
@@ -5,14 +5,17 @@ import getVolumeSliceRangeInfo from './getVolumeSliceRangeInfo';
5
5
  * Calculates the number os steps the volume can scroll based on its orientation
6
6
  * @param viewport - Volume viewport
7
7
  * @param volumeId - Id of one of the volumes loaded on the given viewport
8
+ * @param useSlabThickness - If true, the number of steps will be calculated
9
+ * based on the slab thickness instead of the spacing in the normal direction
8
10
  * @returns number of steps the volume can scroll and its current position
9
11
  */
10
12
  function getVolumeViewportScrollInfo(
11
13
  viewport: IVolumeViewport,
12
- volumeId: string
14
+ volumeId: string,
15
+ useSlabThickness = false
13
16
  ) {
14
17
  const { sliceRange, spacingInNormalDirection, camera } =
15
- getVolumeSliceRangeInfo(viewport, volumeId);
18
+ getVolumeSliceRangeInfo(viewport, volumeId, useSlabThickness);
16
19
 
17
20
  const { min, max, current } = sliceRange;
18
21