@cornerstonejs/core 1.66.5 → 1.66.7
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/Viewport.js +2 -1
- package/dist/cjs/RenderingEngine/Viewport.js.map +1 -1
- package/dist/cjs/utilities/getTargetVolumeAndSpacingInNormalDir.d.ts +1 -1
- package/dist/cjs/utilities/getTargetVolumeAndSpacingInNormalDir.js +5 -3
- package/dist/cjs/utilities/getTargetVolumeAndSpacingInNormalDir.js.map +1 -1
- package/dist/cjs/utilities/getVolumeId.d.ts +1 -0
- package/dist/cjs/utilities/getVolumeId.js +13 -0
- package/dist/cjs/utilities/getVolumeId.js.map +1 -0
- package/dist/cjs/utilities/index.d.ts +2 -1
- package/dist/cjs/utilities/index.js +3 -1
- package/dist/cjs/utilities/index.js.map +1 -1
- package/dist/esm/RenderingEngine/Viewport.js +2 -1
- package/dist/esm/RenderingEngine/Viewport.js.map +1 -1
- package/dist/esm/utilities/getTargetVolumeAndSpacingInNormalDir.js +5 -3
- package/dist/esm/utilities/getTargetVolumeAndSpacingInNormalDir.js.map +1 -1
- package/dist/esm/utilities/getVolumeId.js +9 -0
- package/dist/esm/utilities/getVolumeId.js.map +1 -0
- package/dist/esm/utilities/index.js +2 -1
- package/dist/esm/utilities/index.js.map +1 -1
- package/dist/types/RenderingEngine/Viewport.d.ts.map +1 -1
- package/dist/types/utilities/getTargetVolumeAndSpacingInNormalDir.d.ts +1 -1
- package/dist/types/utilities/getTargetVolumeAndSpacingInNormalDir.d.ts.map +1 -1
- package/dist/types/utilities/getVolumeId.d.ts +2 -0
- package/dist/types/utilities/getVolumeId.d.ts.map +1 -0
- package/dist/types/utilities/index.d.ts +2 -1
- package/dist/types/utilities/index.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
- package/src/RenderingEngine/Viewport.ts +1 -0
- package/src/utilities/getTargetVolumeAndSpacingInNormalDir.ts +7 -6
- package/src/utilities/getVolumeId.ts +16 -0
- package/src/utilities/index.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "1.66.
|
|
3
|
+
"version": "1.66.7",
|
|
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": "
|
|
50
|
+
"gitHead": "7e318e04ab84565f2365252b6dc5a78ca1f0bb52"
|
|
51
51
|
}
|
|
@@ -1424,6 +1424,7 @@ class Viewport implements IViewport {
|
|
|
1424
1424
|
const { viewPlaneNormal } = viewRef;
|
|
1425
1425
|
const camera = this.getCamera();
|
|
1426
1426
|
if (
|
|
1427
|
+
viewPlaneNormal &&
|
|
1427
1428
|
!isEqual(viewPlaneNormal, camera.viewPlaneNormal) &&
|
|
1428
1429
|
!isEqual(
|
|
1429
1430
|
vec3.negate(camera.viewPlaneNormal, camera.viewPlaneNormal),
|
|
@@ -3,6 +3,7 @@ import { EPSILON } from '../constants';
|
|
|
3
3
|
import { ICamera, IImageVolume, IVolumeViewport, Point3 } from '../types';
|
|
4
4
|
import getSpacingInNormalDirection from './getSpacingInNormalDirection';
|
|
5
5
|
import { getVolumeLoaderSchemes } from '../loaders/volumeLoader';
|
|
6
|
+
import { getVolumeId } from './getVolumeId';
|
|
6
7
|
|
|
7
8
|
// One EPSILON part larger multiplier
|
|
8
9
|
const EPSILON_PART = 1 + EPSILON;
|
|
@@ -20,15 +21,14 @@ const isPrimaryVolume = (volume): boolean =>
|
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Given a volume viewport and camera, find the target volume.
|
|
23
|
-
* The imageVolume is retrieved from cache for the specified
|
|
24
|
+
* The imageVolume is retrieved from cache for the specified targetId or
|
|
24
25
|
* in case it is not provided, it chooses the volumeId on the viewport (there
|
|
25
26
|
* might be more than one in case of fusion) that has the finest resolution in the
|
|
26
27
|
* direction of view (normal).
|
|
27
28
|
*
|
|
28
29
|
* @param viewport - volume viewport
|
|
29
30
|
* @param camera - current camera
|
|
30
|
-
* @param
|
|
31
|
-
* is forced to be used.
|
|
31
|
+
* @param targetId - If a targetId is forced to be used.
|
|
32
32
|
* @param useSlabThickness - If true, the number of steps will be calculated
|
|
33
33
|
* based on the slab thickness instead of the spacing in the normal direction
|
|
34
34
|
* @returns An object containing the imageVolume and spacingInNormalDirection.
|
|
@@ -37,7 +37,7 @@ const isPrimaryVolume = (volume): boolean =>
|
|
|
37
37
|
export default function getTargetVolumeAndSpacingInNormalDir(
|
|
38
38
|
viewport: IVolumeViewport,
|
|
39
39
|
camera: ICamera,
|
|
40
|
-
|
|
40
|
+
targetId?: string,
|
|
41
41
|
useSlabThickness = false
|
|
42
42
|
): {
|
|
43
43
|
imageVolume: IImageVolume;
|
|
@@ -65,9 +65,10 @@ export default function getTargetVolumeAndSpacingInNormalDir(
|
|
|
65
65
|
.filter((iv) => !!iv);
|
|
66
66
|
|
|
67
67
|
// If a volumeId is defined, set that volume as the target
|
|
68
|
-
if (
|
|
68
|
+
if (targetId) {
|
|
69
|
+
const targetVolumeId = getVolumeId(targetId);
|
|
69
70
|
const imageVolumeIndex = imageVolumes.findIndex((iv) =>
|
|
70
|
-
iv.volumeId
|
|
71
|
+
targetVolumeId.includes(iv.volumeId)
|
|
71
72
|
);
|
|
72
73
|
|
|
73
74
|
const imageVolume = imageVolumes[imageVolumeIndex];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the volume ID from a target ID. Target Id is not only
|
|
3
|
+
* volumeId but might include other information, but it starts with volumeId.
|
|
4
|
+
*
|
|
5
|
+
* @param targetId - The target ID from which to extract the volume ID.
|
|
6
|
+
* @returns The volume ID extracted from the target ID.
|
|
7
|
+
*/
|
|
8
|
+
export const getVolumeId = (targetId: string) => {
|
|
9
|
+
const prefix = 'volumeId:';
|
|
10
|
+
const str = targetId.includes(prefix)
|
|
11
|
+
? targetId.substring(prefix.length)
|
|
12
|
+
: targetId;
|
|
13
|
+
|
|
14
|
+
const index = str.indexOf('?');
|
|
15
|
+
return index === -1 ? str : str.substring(0, index);
|
|
16
|
+
};
|
package/src/utilities/index.ts
CHANGED
|
@@ -70,6 +70,7 @@ import roundNumber, { roundToPrecision } from './roundNumber';
|
|
|
70
70
|
import convertToGrayscale from './convertToGrayscale';
|
|
71
71
|
import getViewportImageIds from './getViewportImageIds';
|
|
72
72
|
import { getRandomSampleFromArray } from './getRandomSampleFromArray';
|
|
73
|
+
import { getVolumeId } from './getVolumeId';
|
|
73
74
|
|
|
74
75
|
// name spaces
|
|
75
76
|
import * as planar from './planar';
|
|
@@ -158,4 +159,5 @@ export {
|
|
|
158
159
|
roundToPrecision,
|
|
159
160
|
getViewportImageIds,
|
|
160
161
|
getRandomSampleFromArray,
|
|
162
|
+
getVolumeId,
|
|
161
163
|
};
|