@cornerstonejs/core 2.3.3 → 2.4.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/dist/esm/RenderingEngine/helpers/setDefaultVolumeVOI.js +5 -3
- package/dist/esm/enums/VoxelManagerEnum.d.ts +5 -0
- package/dist/esm/enums/VoxelManagerEnum.js +6 -0
- package/dist/esm/enums/index.d.ts +2 -1
- package/dist/esm/enums/index.js +2 -1
- package/dist/esm/loaders/imageLoader.d.ts +3 -0
- package/dist/esm/loaders/imageLoader.js +13 -9
- package/dist/esm/loaders/volumeLoader.d.ts +2 -0
- package/dist/esm/loaders/volumeLoader.js +6 -1
- package/dist/esm/types/PixelDataTypedArray.d.ts +1 -1
- package/dist/esm/utilities/PointsManager.d.ts +1 -0
- package/dist/esm/utilities/PointsManager.js +3 -0
- package/dist/esm/utilities/RLEVoxelMap.d.ts +42 -6
- package/dist/esm/utilities/RLEVoxelMap.js +213 -12
- package/dist/esm/utilities/VoxelManager.d.ts +30 -10
- package/dist/esm/utilities/VoxelManager.js +226 -129
- package/dist/esm/utilities/createPositionCallback.d.ts +2 -0
- package/dist/esm/utilities/createPositionCallback.js +42 -0
- package/dist/esm/utilities/pointInShapeCallback.d.ts +15 -1
- package/dist/esm/utilities/pointInShapeCallback.js +62 -51
- package/package.json +2 -2
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createPositionCallback } from './createPositionCallback';
|
|
2
2
|
export function pointInShapeCallback(imageData, options) {
|
|
3
|
-
const { pointInShapeFn, callback, boundsIJK, returnPoints = false
|
|
4
|
-
let iMin, iMax, jMin, jMax, kMin, kMax;
|
|
3
|
+
const { pointInShapeFn, callback, boundsIJK, returnPoints = false } = options;
|
|
5
4
|
let scalarData;
|
|
6
|
-
const { numComps } = imageData;
|
|
7
5
|
if (imageData.getScalarData) {
|
|
8
6
|
scalarData = imageData.getScalarData();
|
|
9
7
|
}
|
|
@@ -13,47 +11,44 @@ export function pointInShapeCallback(imageData, options) {
|
|
|
13
11
|
.getScalars()
|
|
14
12
|
.getData();
|
|
15
13
|
}
|
|
16
|
-
if (!scalarData) {
|
|
17
|
-
console.warn('No scalar data found for imageData', imageData);
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
14
|
const dimensions = imageData.getDimensions();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const scanAxisStep = vec3.fromValues(scanAxisNormal[0] * scanAxisSpacing, scanAxisNormal[1] * scanAxisSpacing, scanAxisNormal[2] * scanAxisSpacing);
|
|
15
|
+
const defaultBoundsIJK = [
|
|
16
|
+
[0, dimensions[0]],
|
|
17
|
+
[0, dimensions[1]],
|
|
18
|
+
[0, dimensions[2]],
|
|
19
|
+
];
|
|
20
|
+
const bounds = boundsIJK || defaultBoundsIJK;
|
|
21
|
+
const pointsInShape = iterateOverPointsInShape({
|
|
22
|
+
imageData,
|
|
23
|
+
bounds,
|
|
24
|
+
scalarData,
|
|
25
|
+
pointInShapeFn,
|
|
26
|
+
callback,
|
|
27
|
+
});
|
|
28
|
+
return returnPoints ? pointsInShape : undefined;
|
|
29
|
+
}
|
|
30
|
+
export function iterateOverPointsInShape({ imageData, bounds, scalarData, pointInShapeFn, callback, }) {
|
|
31
|
+
const [[iMin, iMax], [jMin, jMax], [kMin, kMax]] = bounds;
|
|
32
|
+
const { numComps } = imageData;
|
|
33
|
+
const dimensions = imageData.getDimensions();
|
|
34
|
+
const indexToWorld = createPositionCallback(imageData);
|
|
35
|
+
const pointIJK = [0, 0, 0];
|
|
43
36
|
const xMultiple = numComps ||
|
|
44
37
|
scalarData.length / dimensions[2] / dimensions[1] / dimensions[0];
|
|
45
38
|
const yMultiple = dimensions[0] * xMultiple;
|
|
46
39
|
const zMultiple = dimensions[1] * yMultiple;
|
|
47
40
|
const pointsInShape = [];
|
|
48
|
-
const currentPos = vec3.clone(worldPosStart);
|
|
49
41
|
for (let k = kMin; k <= kMax; k++) {
|
|
50
|
-
|
|
42
|
+
pointIJK[2] = k;
|
|
43
|
+
const indexK = k * zMultiple;
|
|
51
44
|
for (let j = jMin; j <= jMax; j++) {
|
|
52
|
-
|
|
45
|
+
pointIJK[1] = j;
|
|
46
|
+
const indexJK = indexK + j * yMultiple;
|
|
53
47
|
for (let i = iMin; i <= iMax; i++) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
pointIJK[0] = i;
|
|
49
|
+
const pointLPS = indexToWorld(pointIJK);
|
|
50
|
+
if (pointInShapeFn(pointLPS, pointIJK)) {
|
|
51
|
+
const index = indexJK + i * xMultiple;
|
|
57
52
|
let value;
|
|
58
53
|
if (xMultiple > 2) {
|
|
59
54
|
value = [
|
|
@@ -69,24 +64,40 @@ export function pointInShapeCallback(imageData, options) {
|
|
|
69
64
|
value,
|
|
70
65
|
index,
|
|
71
66
|
pointIJK,
|
|
72
|
-
pointLPS:
|
|
67
|
+
pointLPS: pointLPS.slice(),
|
|
73
68
|
});
|
|
74
|
-
|
|
75
|
-
callback({
|
|
76
|
-
value,
|
|
77
|
-
index,
|
|
78
|
-
pointIJK,
|
|
79
|
-
pointLPS: currentPos,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
69
|
+
callback({ value, index, pointIJK, pointLPS });
|
|
82
70
|
}
|
|
83
|
-
vec3.add(currentPos, currentPos, rowStep);
|
|
84
71
|
}
|
|
85
|
-
vec3.copy(currentPos, startPosI);
|
|
86
|
-
vec3.add(currentPos, currentPos, columnStep);
|
|
87
72
|
}
|
|
88
|
-
vec3.copy(currentPos, startPosJ);
|
|
89
|
-
vec3.add(currentPos, currentPos, scanAxisStep);
|
|
90
73
|
}
|
|
91
|
-
return
|
|
74
|
+
return pointsInShape;
|
|
75
|
+
}
|
|
76
|
+
export function iterateOverPointsInShapeVoxelManager({ voxelManager, bounds, imageData, pointInShapeFn, callback, }) {
|
|
77
|
+
const [[iMin, iMax], [jMin, jMax], [kMin, kMax]] = bounds;
|
|
78
|
+
const indexToWorld = createPositionCallback(imageData);
|
|
79
|
+
const pointIJK = [0, 0, 0];
|
|
80
|
+
const pointsInShape = [];
|
|
81
|
+
for (let k = kMin; k <= kMax; k++) {
|
|
82
|
+
pointIJK[2] = k;
|
|
83
|
+
for (let j = jMin; j <= jMax; j++) {
|
|
84
|
+
pointIJK[1] = j;
|
|
85
|
+
for (let i = iMin; i <= iMax; i++) {
|
|
86
|
+
pointIJK[0] = i;
|
|
87
|
+
const pointLPS = indexToWorld(pointIJK);
|
|
88
|
+
if (pointInShapeFn(pointLPS, pointIJK)) {
|
|
89
|
+
const index = voxelManager.toIndex(pointIJK);
|
|
90
|
+
const value = voxelManager.getAtIndex(index);
|
|
91
|
+
pointsInShape.push({
|
|
92
|
+
value,
|
|
93
|
+
index,
|
|
94
|
+
pointIJK: [...pointIJK],
|
|
95
|
+
pointLPS: pointLPS.slice(),
|
|
96
|
+
});
|
|
97
|
+
callback?.({ value, index, pointIJK, pointLPS });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return pointsInShape;
|
|
92
103
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"type": "individual",
|
|
83
83
|
"url": "https://ohif.org/donate"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "70fc2826230875c1c5f3533953fac9a3025833c0"
|
|
86
86
|
}
|