@cornerstonejs/core 1.66.4 → 1.66.6
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/BaseVolumeViewport.js +2 -1
- package/dist/cjs/RenderingEngine/BaseVolumeViewport.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/BaseVolumeViewport.js +2 -1
- package/dist/esm/RenderingEngine/BaseVolumeViewport.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/BaseVolumeViewport.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/BaseVolumeViewport.ts +5 -2
- package/src/utilities/getTargetVolumeAndSpacingInNormalDir.ts +8 -7
- 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.6",
|
|
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": "d60934ef8318bfae38a2e1665171540e41f9e1b4"
|
|
51
51
|
}
|
|
@@ -863,7 +863,9 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
863
863
|
const colormapsVTK = vtkColorMaps.rgbPresetNames.map((presetName) =>
|
|
864
864
|
vtkColorMaps.getPresetByName(presetName)
|
|
865
865
|
);
|
|
866
|
-
const colormapsCS3D = getColormapNames().map((colormapName) =>
|
|
866
|
+
const colormapsCS3D = getColormapNames().map((colormapName) =>
|
|
867
|
+
getColormap(colormapName)
|
|
868
|
+
);
|
|
867
869
|
const colormaps = colormapsVTK.concat(colormapsCS3D);
|
|
868
870
|
const matchedColormap = colormaps.find((colormap) => {
|
|
869
871
|
const { RGBPoints: presetRGBPoints } = colormap;
|
|
@@ -1563,7 +1565,8 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
1563
1565
|
|
|
1564
1566
|
sliceIndex ??= this.getCurrentImageIdIndex();
|
|
1565
1567
|
const { viewPlaneNormal, focalPoint } = this.getCamera();
|
|
1566
|
-
|
|
1568
|
+
const querySeparator = volumeId.indexOf('?') > -1 ? '&' : '?';
|
|
1569
|
+
return `volumeId:${volumeId}${querySeparator}sliceIndex=${sliceIndex}&viewPlaneNormal=${viewPlaneNormal.join(
|
|
1567
1570
|
','
|
|
1568
1571
|
)}&focalPoint=${focalPoint.join(',')}`;
|
|
1569
1572
|
}
|
|
@@ -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 (
|
|
69
|
-
const
|
|
70
|
-
|
|
68
|
+
if (targetId) {
|
|
69
|
+
const targetVolumeId = getVolumeId(targetId);
|
|
70
|
+
const imageVolumeIndex = imageVolumes.findIndex((iv) =>
|
|
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
|
};
|