@cornerstonejs/core 4.13.6 → 4.14.2
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/esm/utilities/VoxelManager.d.ts +1 -1
- package/dist/esm/utilities/VoxelManager.js +1 -1
- package/dist/esm/utilities/calculateSpacingBetweenImageIds.js +45 -5
- package/dist/esm/utilities/getClosestImageId.js +1 -1
- package/dist/esm/utilities/isValidVolume.js +1 -1
- package/dist/esm/utilities/scroll.js +2 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ export default class VoxelManager<T> {
|
|
|
7
7
|
sourceVoxelManager: IVoxelManager<T>;
|
|
8
8
|
isInObject: (pointLPS: any, pointIJK: any) => boolean;
|
|
9
9
|
readonly dimensions: Point3;
|
|
10
|
-
readonly numberOfComponents:
|
|
10
|
+
readonly numberOfComponents: number;
|
|
11
11
|
getCompleteScalarDataArray?: () => ArrayLike<number>;
|
|
12
12
|
setCompleteScalarDataArray?: (scalarData: ArrayLike<number>) => void;
|
|
13
13
|
getRange: () => [number, number];
|
|
@@ -178,7 +178,7 @@ export default class VoxelManager {
|
|
|
178
178
|
this._set = options._set;
|
|
179
179
|
this._id = options._id || '';
|
|
180
180
|
this._getConstructor = options._getConstructor;
|
|
181
|
-
this.numberOfComponents =
|
|
181
|
+
this.numberOfComponents = options.numberOfComponents || 1;
|
|
182
182
|
this.scalarData = options.scalarData;
|
|
183
183
|
this._getScalarData = options._getScalarData;
|
|
184
184
|
this._updateScalarData = options._updateScalarData;
|
|
@@ -1,8 +1,40 @@
|
|
|
1
1
|
import { vec3 } from 'gl-matrix';
|
|
2
2
|
import * as metaData from '../metaData';
|
|
3
3
|
import { getConfiguration } from '../init';
|
|
4
|
+
const DEFAULT_THICKNESS_SINGLE_SLICE = 1;
|
|
5
|
+
function getPixelSpacingForCubicVoxel(metadata) {
|
|
6
|
+
if (metadata.columnPixelSpacing !== undefined) {
|
|
7
|
+
return metadata.columnPixelSpacing;
|
|
8
|
+
}
|
|
9
|
+
if (metadata.rowPixelSpacing !== undefined) {
|
|
10
|
+
return metadata.rowPixelSpacing;
|
|
11
|
+
}
|
|
12
|
+
if (metadata.pixelSpacing?.[1] !== undefined) {
|
|
13
|
+
return metadata.pixelSpacing[1];
|
|
14
|
+
}
|
|
15
|
+
if (metadata.pixelSpacing?.[0] !== undefined) {
|
|
16
|
+
return metadata.pixelSpacing[0];
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
4
20
|
export default function calculateSpacingBetweenImageIds(imageIds) {
|
|
5
21
|
const { imagePositionPatient: referenceImagePositionPatient, imageOrientationPatient, } = metaData.get('imagePlaneModule', imageIds[0]);
|
|
22
|
+
if (imageIds.length === 1) {
|
|
23
|
+
const { sliceThickness, spacingBetweenSlices, columnPixelSpacing, rowPixelSpacing, pixelSpacing, } = metaData.get('imagePlaneModule', imageIds[0]);
|
|
24
|
+
if (sliceThickness)
|
|
25
|
+
return sliceThickness;
|
|
26
|
+
if (spacingBetweenSlices)
|
|
27
|
+
return spacingBetweenSlices;
|
|
28
|
+
const pixelSpacingValue = getPixelSpacingForCubicVoxel({
|
|
29
|
+
columnPixelSpacing,
|
|
30
|
+
rowPixelSpacing,
|
|
31
|
+
pixelSpacing,
|
|
32
|
+
});
|
|
33
|
+
if (pixelSpacingValue !== undefined) {
|
|
34
|
+
return pixelSpacingValue;
|
|
35
|
+
}
|
|
36
|
+
return DEFAULT_THICKNESS_SINGLE_SLICE;
|
|
37
|
+
}
|
|
6
38
|
const rowCosineVec = vec3.fromValues(imageOrientationPatient[0], imageOrientationPatient[1], imageOrientationPatient[2]);
|
|
7
39
|
const colCosineVec = vec3.fromValues(imageOrientationPatient[3], imageOrientationPatient[4], imageOrientationPatient[5]);
|
|
8
40
|
const scanAxisNormal = vec3.create();
|
|
@@ -37,8 +69,6 @@ export default function calculateSpacingBetweenImageIds(imageIds) {
|
|
|
37
69
|
imageIds[0],
|
|
38
70
|
imageIds[Math.floor(imageIds.length / 2)],
|
|
39
71
|
];
|
|
40
|
-
const firstImageDistance = getDistance(prefetchedImageIds[0]);
|
|
41
|
-
const middleImageDistance = getDistance(prefetchedImageIds[1]);
|
|
42
72
|
const metadataForMiddleImage = metaData.get('imagePlaneModule', prefetchedImageIds[1]);
|
|
43
73
|
if (!metadataForMiddleImage) {
|
|
44
74
|
throw new Error('Incomplete metadata required for volume construction.');
|
|
@@ -51,7 +81,7 @@ export default function calculateSpacingBetweenImageIds(imageIds) {
|
|
|
51
81
|
Math.abs(distanceBetweenFirstAndMiddleImages) /
|
|
52
82
|
Math.floor(imageIds.length / 2);
|
|
53
83
|
}
|
|
54
|
-
const { sliceThickness, spacingBetweenSlices } = metaData.get('imagePlaneModule', imageIds[0]);
|
|
84
|
+
const { sliceThickness, spacingBetweenSlices, columnPixelSpacing, rowPixelSpacing, pixelSpacing, } = metaData.get('imagePlaneModule', imageIds[0]);
|
|
55
85
|
const { strictZSpacingForVolumeViewport } = getConfiguration().rendering;
|
|
56
86
|
if ((spacing === 0 || isNaN(spacing)) && !strictZSpacingForVolumeViewport) {
|
|
57
87
|
if (spacingBetweenSlices) {
|
|
@@ -63,8 +93,18 @@ export default function calculateSpacingBetweenImageIds(imageIds) {
|
|
|
63
93
|
spacing = sliceThickness;
|
|
64
94
|
}
|
|
65
95
|
else {
|
|
66
|
-
|
|
67
|
-
|
|
96
|
+
const pixelSpacingValue = getPixelSpacingForCubicVoxel({
|
|
97
|
+
columnPixelSpacing,
|
|
98
|
+
rowPixelSpacing,
|
|
99
|
+
pixelSpacing,
|
|
100
|
+
});
|
|
101
|
+
if (pixelSpacingValue) {
|
|
102
|
+
spacing = pixelSpacingValue;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
console.debug(`Could not calculate spacing and no pixel spacing found. Using default thickness (${DEFAULT_THICKNESS_SINGLE_SLICE} mm)`);
|
|
106
|
+
spacing = DEFAULT_THICKNESS_SINGLE_SLICE;
|
|
107
|
+
}
|
|
68
108
|
}
|
|
69
109
|
}
|
|
70
110
|
return spacing;
|
|
@@ -7,7 +7,7 @@ const log = coreLog.getLogger('utilities', 'getClosestImageId');
|
|
|
7
7
|
export default function getClosestImageId(imageVolume, worldPos, viewPlaneNormal, options) {
|
|
8
8
|
const { direction, spacing, imageIds } = imageVolume;
|
|
9
9
|
const { ignoreSpacing = false } = options || {};
|
|
10
|
-
if (
|
|
10
|
+
if (imageIds?.length) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
const kVector = direction.slice(6, 9);
|
|
@@ -35,6 +35,8 @@ export default function scroll(viewport, options) {
|
|
|
35
35
|
export function scrollVolume(viewport, volumeId, delta, scrollSlabs = false) {
|
|
36
36
|
const useSlabThickness = scrollSlabs;
|
|
37
37
|
const { numScrollSteps, currentStepIndex, sliceRangeInfo } = getVolumeViewportScrollInfo(viewport, volumeId, useSlabThickness);
|
|
38
|
+
if (numScrollSteps === 0)
|
|
39
|
+
return;
|
|
38
40
|
if (!sliceRangeInfo) {
|
|
39
41
|
return;
|
|
40
42
|
}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.
|
|
1
|
+
export declare const version = "4.14.2";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '4.
|
|
1
|
+
export const version = '4.14.2';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.14.2",
|
|
4
4
|
"description": "Cornerstone3D Core",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"type": "individual",
|
|
98
98
|
"url": "https://ohif.org/donate"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "3f4519a6cd7f13a7e0564263cae4c7f821b6f35b"
|
|
101
101
|
}
|