@cornerstonejs/polymorphic-segmentation 3.20.2 → 3.21.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.
|
@@ -2,7 +2,7 @@ import { vec3 } from 'gl-matrix';
|
|
|
2
2
|
import { cache, utilities, getWebWorkerManager, volumeLoader, imageLoader, metaData, Enums, triggerEvent, eventTarget, } from '@cornerstonejs/core';
|
|
3
3
|
import * as cornerstoneTools from '@cornerstonejs/tools';
|
|
4
4
|
const { WorkerTypes } = cornerstoneTools.Enums;
|
|
5
|
-
const {
|
|
5
|
+
const { segmentation } = cornerstoneTools;
|
|
6
6
|
const workerManager = getWebWorkerManager();
|
|
7
7
|
const triggerWorkerProgress = (eventTarget, progress) => {
|
|
8
8
|
triggerEvent(eventTarget, Enums.Events.WEB_WORKER_PROGRESS, {
|
|
@@ -22,7 +22,7 @@ export async function convertContourToVolumeLabelmap(contourRepresentationData,
|
|
|
22
22
|
volumeId: segmentationVolumeId,
|
|
23
23
|
});
|
|
24
24
|
const { dimensions, origin, direction, spacing, voxelManager } = segmentationVolume;
|
|
25
|
-
const { segmentIndices, annotationUIDsInSegmentMap } =
|
|
25
|
+
const { segmentIndices, annotationUIDsInSegmentMap } = segmentation.utilities.getAnnotationMapFromSegmentation(contourRepresentationData, options);
|
|
26
26
|
triggerWorkerProgress(eventTarget, 0);
|
|
27
27
|
const newScalarData = await workerManager.executeTask('polySeg', 'convertContourToVolumeLabelmap', {
|
|
28
28
|
segmentIndices,
|
|
@@ -62,7 +62,7 @@ export async function convertContourToStackLabelmap(contourRepresentationData, o
|
|
|
62
62
|
});
|
|
63
63
|
const segImages = await imageLoader.createAndCacheDerivedLabelmapImages(imageIds);
|
|
64
64
|
const segmentationImageIds = segImages.map((it) => it.imageId);
|
|
65
|
-
const { segmentIndices, annotationUIDsInSegmentMap } =
|
|
65
|
+
const { segmentIndices, annotationUIDsInSegmentMap } = segmentation.utilities.getAnnotationMapFromSegmentation(contourRepresentationData, options);
|
|
66
66
|
const segmentationsInfo = new Map();
|
|
67
67
|
segmentationImageIds.forEach((segImageId, index) => {
|
|
68
68
|
const segImage = cache.getImage(segImageId);
|
|
@@ -115,30 +115,3 @@ export async function convertContourToStackLabelmap(contourRepresentationData, o
|
|
|
115
115
|
imageIds: segImageIds,
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
|
-
function _getAnnotationMapFromSegmentation(contourRepresentationData, options = {}) {
|
|
119
|
-
const annotationMap = contourRepresentationData.annotationUIDsMap;
|
|
120
|
-
const segmentIndices = options.segmentIndices?.length
|
|
121
|
-
? options.segmentIndices
|
|
122
|
-
: Array.from(annotationMap.keys());
|
|
123
|
-
const annotationUIDsInSegmentMap = new Map();
|
|
124
|
-
segmentIndices.forEach((index) => {
|
|
125
|
-
const annotationUIDsInSegment = annotationMap.get(index);
|
|
126
|
-
let uids = Array.from(annotationUIDsInSegment);
|
|
127
|
-
uids = uids.filter((uid) => !getAnnotation(uid).parentAnnotationUID);
|
|
128
|
-
const annotations = uids.map((uid) => {
|
|
129
|
-
const annotation = getAnnotation(uid);
|
|
130
|
-
const hasChildAnnotations = annotation.childAnnotationUIDs?.length;
|
|
131
|
-
return {
|
|
132
|
-
polyline: annotation.data.contour.polyline,
|
|
133
|
-
referencedImageId: annotation.metadata.referencedImageId,
|
|
134
|
-
holesPolyline: hasChildAnnotations &&
|
|
135
|
-
annotation.childAnnotationUIDs.map((childUID) => {
|
|
136
|
-
const childAnnotation = getAnnotation(childUID);
|
|
137
|
-
return childAnnotation.data.contour.polyline;
|
|
138
|
-
}),
|
|
139
|
-
};
|
|
140
|
-
});
|
|
141
|
-
annotationUIDsInSegmentMap.set(index, annotations);
|
|
142
|
-
});
|
|
143
|
-
return { segmentIndices, annotationUIDsInSegmentMap };
|
|
144
|
-
}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "3.
|
|
1
|
+
export declare const version = "3.21.0";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.
|
|
1
|
+
export const version = '3.21.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/polymorphic-segmentation",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.0",
|
|
4
4
|
"description": "Polymorphic Segmentation utility for Cornerstone3D",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"@icr/polyseg-wasm": "0.4.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@cornerstonejs/core": "^3.
|
|
58
|
-
"@cornerstonejs/tools": "^3.
|
|
57
|
+
"@cornerstonejs/core": "^3.21.0",
|
|
58
|
+
"@cornerstonejs/tools": "^3.21.0",
|
|
59
59
|
"@kitware/vtk.js": "32.12.1"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "ce026714032fd5e8eba66ff0d881ef88a11bb08c"
|
|
62
62
|
}
|