@cornerstonejs/tools 5.1.2 → 5.1.4
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/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +11 -44
- package/dist/esm/tools/annotation/LivewireContourTool.js +3 -2
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js +6 -2
- package/dist/esm/utilities/contourSegmentation/addPolylinesToSegmentation.js +54 -27
- package/dist/esm/utilities/contourSegmentation/applyContourStroke.d.ts +4 -0
- package/dist/esm/utilities/contourSegmentation/applyContourStroke.js +102 -0
- package/dist/esm/utilities/contourSegmentation/bridgeWeaklyConnected.d.ts +4 -0
- package/dist/esm/utilities/contourSegmentation/bridgeWeaklyConnected.js +126 -0
- package/dist/esm/utilities/contourSegmentation/clipperBooleanOps.d.ts +13 -0
- package/dist/esm/utilities/contourSegmentation/clipperBooleanOps.js +126 -0
- package/dist/esm/utilities/contourSegmentation/logicalOperators.js +27 -9
- package/dist/esm/utilities/contourSegmentation/mergeMultipleAnnotations.js +37 -46
- package/dist/esm/utilities/contourSegmentation/polylineInfoTypes.d.ts +2 -0
- package/dist/esm/utilities/contourSegmentation/polylineIntersect.js +3 -32
- package/dist/esm/utilities/contourSegmentation/polylineSetOps.d.ts +3 -0
- package/dist/esm/utilities/contourSegmentation/polylineSetOps.js +62 -0
- package/dist/esm/utilities/contourSegmentation/polylineSubtract.js +17 -55
- package/dist/esm/utilities/contourSegmentation/polylineUnify.js +15 -62
- package/dist/esm/utilities/contourSegmentation/polylineXor.js +3 -39
- package/dist/esm/utilities/contourSegmentation/sharedOperations.d.ts +3 -1
- package/dist/esm/utilities/contourSegmentation/sharedOperations.js +50 -58
- package/dist/esm/utilities/segmentation/getSegmentIndexAtWorldPoint.js +14 -18
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +5 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseVolumeViewport, cache, utilities } from '@cornerstonejs/core';
|
|
2
|
-
import getViewportICamera from '../getViewportICamera';
|
|
3
2
|
import { SegmentationRepresentations } from '../../enums';
|
|
4
3
|
import { getSegmentation, getCurrentLabelmapImageIdsForViewport, } from '../../stateManagement/segmentation/segmentationState';
|
|
5
4
|
import { getAnnotation } from '../../stateManagement';
|
|
6
5
|
import { isPointInsidePolyline3D } from '../math/polyline';
|
|
6
|
+
import filterAnnotationsForDisplay from '../planar/filterAnnotationsForDisplay';
|
|
7
7
|
import { getLabelmapActorEntry } from '../../stateManagement/segmentation/helpers/getSegmentationActor';
|
|
8
8
|
import getViewportLabelmapRenderMode from '../../stateManagement/segmentation/helpers/getViewportLabelmapRenderMode';
|
|
9
9
|
import { getLabelmaps, getOrCreateLabelmapVolume, getSegmentIndexForLabelValue, } from '../../stateManagement/segmentation/helpers/labelmapSegmentationState';
|
|
@@ -75,25 +75,21 @@ export function getSegmentIndexAtWorldForLabelmap(segmentation, worldPoint, { vi
|
|
|
75
75
|
}
|
|
76
76
|
export function getSegmentIndexAtWorldForContour(segmentation, worldPoint, { viewport }) {
|
|
77
77
|
const contourData = segmentation.representationData.Contour;
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
const annotationsSet = contourData.annotationUIDsMap.get(segmentIndex);
|
|
82
|
-
if (!annotationsSet) {
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
for (const annotationUID of annotationsSet) {
|
|
78
|
+
const segmentIndexByAnnotation = new Map();
|
|
79
|
+
for (const [segmentIndex, annotationUIDs] of contourData.annotationUIDsMap) {
|
|
80
|
+
for (const annotationUID of annotationUIDs) {
|
|
86
81
|
const annotation = getAnnotation(annotationUID);
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
const { polyline } = annotation.data.contour;
|
|
91
|
-
if (!utilities.isEqual(viewPlaneNormal, annotation.metadata.viewPlaneNormal)) {
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
if (isPointInsidePolyline3D(worldPoint, polyline)) {
|
|
95
|
-
return Number(segmentIndex);
|
|
82
|
+
if (annotation) {
|
|
83
|
+
segmentIndexByAnnotation.set(annotation, Number(segmentIndex));
|
|
96
84
|
}
|
|
97
85
|
}
|
|
98
86
|
}
|
|
87
|
+
const displayableAnnotations = filterAnnotationsForDisplay(viewport, Array.from(segmentIndexByAnnotation.keys()));
|
|
88
|
+
for (const annotation of displayableAnnotations) {
|
|
89
|
+
const { polyline } = annotation.data
|
|
90
|
+
.contour;
|
|
91
|
+
if (isPointInsidePolyline3D(worldPoint, polyline)) {
|
|
92
|
+
return segmentIndexByAnnotation.get(annotation);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
99
95
|
}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.1.
|
|
1
|
+
export declare const version = "5.1.4";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.1.
|
|
1
|
+
export const version = '5.1.4';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.4",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -104,15 +104,16 @@
|
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"@types/offscreencanvas": "2019.7.3",
|
|
107
|
+
"clipper2-ts": "2.0.1",
|
|
107
108
|
"comlink": "4.4.2",
|
|
108
109
|
"lodash.get": "4.4.2"
|
|
109
110
|
},
|
|
110
111
|
"devDependencies": {
|
|
111
|
-
"@cornerstonejs/core": "5.1.
|
|
112
|
+
"@cornerstonejs/core": "5.1.4",
|
|
112
113
|
"canvas": "3.2.0"
|
|
113
114
|
},
|
|
114
115
|
"peerDependencies": {
|
|
115
|
-
"@cornerstonejs/core": "5.1.
|
|
116
|
+
"@cornerstonejs/core": "5.1.4",
|
|
116
117
|
"@kitware/vtk.js": "35.5.3",
|
|
117
118
|
"@types/d3-array": "3.2.1",
|
|
118
119
|
"@types/d3-interpolate": "3.0.4",
|
|
@@ -131,5 +132,5 @@
|
|
|
131
132
|
"type": "individual",
|
|
132
133
|
"url": "https://ohif.org/donate"
|
|
133
134
|
},
|
|
134
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "357796f885445b74f801c5ab727d708345b4e729"
|
|
135
136
|
}
|