@cornerstonejs/tools 1.27.4 → 1.28.1
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/utilities/dynamicVolume/getDataInTime.js +13 -5
- package/dist/cjs/utilities/dynamicVolume/getDataInTime.js.map +1 -1
- package/dist/esm/utilities/dynamicVolume/getDataInTime.js +13 -5
- package/dist/esm/utilities/dynamicVolume/getDataInTime.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/utilities/dynamicVolume/getDataInTime.ts +18 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.1",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cornerstonejs/core": "^1.
|
|
32
|
+
"@cornerstonejs/core": "^1.28.1",
|
|
33
33
|
"lodash.clonedeep": "4.5.0",
|
|
34
34
|
"lodash.get": "^4.4.2"
|
|
35
35
|
},
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"type": "individual",
|
|
53
53
|
"url": "https://ohif.org/donate"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "5a9e221773f68002c2514a0ed7ae87c5f89c81ad"
|
|
56
56
|
}
|
|
@@ -45,13 +45,13 @@ function getDataInTime(
|
|
|
45
45
|
if (options.maskVolumeId) {
|
|
46
46
|
const segmentationVolume = cache.getVolume(options.maskVolumeId);
|
|
47
47
|
|
|
48
|
-
const dataInTime = _getTimePointDataMask(
|
|
48
|
+
const [dataInTime, ijkCoords] = _getTimePointDataMask(
|
|
49
49
|
frames,
|
|
50
50
|
dynamicVolume,
|
|
51
51
|
segmentationVolume
|
|
52
52
|
);
|
|
53
53
|
|
|
54
|
-
return dataInTime;
|
|
54
|
+
return [dataInTime, ijkCoords];
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
if (options.imageCoordinate) {
|
|
@@ -103,11 +103,19 @@ function _getTimePointDataMask(frames, dynamicVolume, segmentationVolume) {
|
|
|
103
103
|
// Pre-allocate memory for array
|
|
104
104
|
const nonZeroVoxelIndices = [];
|
|
105
105
|
nonZeroVoxelIndices.length = len;
|
|
106
|
+
const ijkCoords = [];
|
|
107
|
+
|
|
108
|
+
const dimensions = segmentationVolume.dimensions;
|
|
106
109
|
|
|
107
110
|
// Get the index of every non-zero voxel in mask
|
|
108
111
|
let actualLen = 0;
|
|
109
112
|
for (let i = 0, len = segScalarData.length; i < len; i++) {
|
|
110
113
|
if (segScalarData[i] !== 0) {
|
|
114
|
+
ijkCoords.push([
|
|
115
|
+
i % dimensions[0],
|
|
116
|
+
Math.floor((i / dimensions[0]) % dimensions[1]),
|
|
117
|
+
Math.floor(i / (dimensions[0] * dimensions[1])),
|
|
118
|
+
]);
|
|
111
119
|
nonZeroVoxelIndices[actualLen++] = i;
|
|
112
120
|
}
|
|
113
121
|
}
|
|
@@ -134,14 +142,18 @@ function _getTimePointDataMask(frames, dynamicVolume, segmentationVolume) {
|
|
|
134
142
|
values.push(indexValues);
|
|
135
143
|
}
|
|
136
144
|
|
|
137
|
-
return values;
|
|
145
|
+
return [values, ijkCoords];
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
// In case that the segmentation mask is not the same size as the dynamic volume (one frame)
|
|
141
149
|
// then we need to consider each voxel in the segmentation mask and check if it
|
|
142
150
|
// overlaps with the other volume, and if so we need to average the values of the
|
|
143
151
|
// overlapping voxels.
|
|
144
|
-
const callback = ({
|
|
152
|
+
const callback = ({
|
|
153
|
+
pointLPS: segPointLPS,
|
|
154
|
+
value: segValue,
|
|
155
|
+
pointIJK: segPointIJK,
|
|
156
|
+
}) => {
|
|
145
157
|
// see if the value is non-zero
|
|
146
158
|
if (segValue === 0) {
|
|
147
159
|
// not interested
|
|
@@ -188,6 +200,7 @@ function _getTimePointDataMask(frames, dynamicVolume, segmentationVolume) {
|
|
|
188
200
|
averageValues.push(sum / count);
|
|
189
201
|
});
|
|
190
202
|
|
|
203
|
+
ijkCoords.push(segPointIJK);
|
|
191
204
|
values.push(averageValues);
|
|
192
205
|
};
|
|
193
206
|
|
|
@@ -197,7 +210,7 @@ function _getTimePointDataMask(frames, dynamicVolume, segmentationVolume) {
|
|
|
197
210
|
// Todo: consider using the nonZeroVoxelIndices to compute the pointLPS
|
|
198
211
|
pointInShapeCallback(maskImageData, () => true, callback);
|
|
199
212
|
|
|
200
|
-
return values;
|
|
213
|
+
return [values, ijkCoords];
|
|
201
214
|
}
|
|
202
215
|
|
|
203
216
|
export default getDataInTime;
|