@cornerstonejs/tools 2.3.1 → 2.3.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.
|
@@ -14,14 +14,15 @@ function generateContourSetsFromLabelmap({ segmentations }) {
|
|
|
14
14
|
console.warn(`No volume found for ${segVolumeId}`);
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
const numSlices = vol.dimensions[2];
|
|
18
17
|
const voxelManager = vol.voxelManager;
|
|
18
|
+
const segData = voxelManager.getCompleteScalarDataArray();
|
|
19
|
+
const numSlices = vol.dimensions[2];
|
|
19
20
|
const pixelsPerSlice = vol.dimensions[0] * vol.dimensions[1];
|
|
20
21
|
for (let z = 0; z < numSlices; z++) {
|
|
21
22
|
for (let y = 0; y < vol.dimensions[1]; y++) {
|
|
22
23
|
const index = y * vol.dimensions[0] + z * pixelsPerSlice;
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
segData[index] = 0;
|
|
25
|
+
segData[index + vol.dimensions[0] - 1] = 0;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
const ContourSets = [];
|
|
@@ -41,13 +42,13 @@ function generateContourSetsFromLabelmap({ segmentations }) {
|
|
|
41
42
|
});
|
|
42
43
|
const { containedSegmentIndices } = segment;
|
|
43
44
|
for (let sliceIndex = 0; sliceIndex < numSlices; sliceIndex++) {
|
|
44
|
-
if (isSliceEmptyForSegment(sliceIndex,
|
|
45
|
+
if (isSliceEmptyForSegment(sliceIndex, segData, pixelsPerSlice, segIndex)) {
|
|
45
46
|
continue;
|
|
46
47
|
}
|
|
47
48
|
const frameStart = sliceIndex * pixelsPerSlice;
|
|
48
49
|
try {
|
|
49
50
|
for (let i = 0; i < pixelsPerSlice; i++) {
|
|
50
|
-
const value =
|
|
51
|
+
const value = segData[i + frameStart];
|
|
51
52
|
if (value === segIndex || containedSegmentIndices?.has(value)) {
|
|
52
53
|
scalars.setValue(i + frameStart, 1);
|
|
53
54
|
}
|
|
@@ -96,11 +97,11 @@ function generateContourSetsFromLabelmap({ segmentations }) {
|
|
|
96
97
|
}
|
|
97
98
|
return ContourSets;
|
|
98
99
|
}
|
|
99
|
-
function isSliceEmptyForSegment(sliceIndex,
|
|
100
|
+
function isSliceEmptyForSegment(sliceIndex, segData, pixelsPerSlice, segIndex) {
|
|
100
101
|
const startIdx = sliceIndex * pixelsPerSlice;
|
|
101
102
|
const endIdx = startIdx + pixelsPerSlice;
|
|
102
103
|
for (let i = startIdx; i < endIdx; i++) {
|
|
103
|
-
if (
|
|
104
|
+
if (segData[i] === segIndex) {
|
|
104
105
|
return false;
|
|
105
106
|
}
|
|
106
107
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"canvas": "^2.11.2"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
|
-
"@cornerstonejs/core": "^2.3.
|
|
107
|
+
"@cornerstonejs/core": "^2.3.2",
|
|
108
108
|
"@kitware/vtk.js": "32.1.1",
|
|
109
109
|
"@types/d3-array": "^3.0.4",
|
|
110
110
|
"@types/d3-interpolate": "^3.0.1",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"type": "individual",
|
|
124
124
|
"url": "https://ohif.org/donate"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "3bbd9ea2a093e186c2bc2485d57ad8e52bef89ae"
|
|
127
127
|
}
|