@cornerstonejs/tools 0.11.0 → 0.12.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/cjs/drawingSvg/drawPolyline.d.ts +8 -0
- package/dist/cjs/drawingSvg/drawPolyline.js +50 -0
- package/dist/cjs/drawingSvg/drawPolyline.js.map +1 -0
- package/dist/cjs/drawingSvg/index.d.ts +2 -1
- package/dist/cjs/drawingSvg/index.js +3 -1
- package/dist/cjs/drawingSvg/index.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/stateManagement/annotation/config/annotationStyle.js +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.d.ts +32 -0
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +192 -0
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.d.ts +2 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +216 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.d.ts +2 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js +182 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/editLoopCommon.d.ts +2 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/editLoopCommon.js +127 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/editLoopCommon.js.map +1 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.d.ts +2 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js +289 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEndEditLoop.d.ts +2 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js +43 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js.map +1 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/renderMethods.d.ts +2 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/renderMethods.js +99 -0
- package/dist/cjs/tools/annotation/planarFreehandROITool/renderMethods.js.map +1 -0
- package/dist/cjs/tools/index.d.ts +2 -1
- package/dist/cjs/tools/index.js +3 -1
- package/dist/cjs/tools/index.js.map +1 -1
- package/dist/cjs/types/AnnotationTypes.d.ts +1 -0
- package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +31 -0
- package/dist/cjs/utilities/math/index.d.ts +2 -1
- package/dist/cjs/utilities/math/index.js +3 -1
- package/dist/cjs/utilities/math/index.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/addCanvasPointsToArray.d.ts +4 -0
- package/dist/cjs/utilities/math/polyline/addCanvasPointsToArray.js +36 -0
- package/dist/cjs/utilities/math/polyline/addCanvasPointsToArray.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/calculateAreaOfPoints.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/calculateAreaOfPoints.js +14 -0
- package/dist/cjs/utilities/math/polyline/calculateAreaOfPoints.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getIntersectionWithPolyline.d.ts +7 -0
- package/dist/cjs/utilities/math/polyline/getIntersectionWithPolyline.js +110 -0
- package/dist/cjs/utilities/math/polyline/getIntersectionWithPolyline.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getSubPixelSpacingAndXYDirections.d.ts +7 -0
- package/dist/cjs/utilities/math/polyline/getSubPixelSpacingAndXYDirections.js +67 -0
- package/dist/cjs/utilities/math/polyline/getSubPixelSpacingAndXYDirections.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/index.d.ts +7 -0
- package/dist/cjs/utilities/math/polyline/index.js +20 -0
- package/dist/cjs/utilities/math/polyline/index.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/planarFreehandROIInternalTypes.d.ts +22 -0
- package/dist/cjs/utilities/math/polyline/planarFreehandROIInternalTypes.js +3 -0
- package/dist/cjs/utilities/math/polyline/planarFreehandROIInternalTypes.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/pointCanProjectOnLine.d.ts +3 -0
- package/dist/cjs/utilities/math/polyline/pointCanProjectOnLine.js +35 -0
- package/dist/cjs/utilities/math/polyline/pointCanProjectOnLine.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/pointsAreWithinCloseContourProximity.d.ts +3 -0
- package/dist/cjs/utilities/math/polyline/pointsAreWithinCloseContourProximity.js +8 -0
- package/dist/cjs/utilities/math/polyline/pointsAreWithinCloseContourProximity.js.map +1 -0
- package/dist/esm/drawingSvg/drawPolyline.d.ts +8 -0
- package/dist/esm/drawingSvg/drawPolyline.js +44 -0
- package/dist/esm/drawingSvg/drawPolyline.js.map +1 -0
- package/dist/esm/drawingSvg/index.d.ts +2 -1
- package/dist/esm/drawingSvg/index.js +2 -1
- package/dist/esm/drawingSvg/index.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stateManagement/annotation/config/annotationStyle.js +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.d.ts +32 -0
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +187 -0
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.d.ts +2 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +211 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.d.ts +2 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js +177 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/editLoopCommon.d.ts +2 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/editLoopCommon.js +125 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/editLoopCommon.js.map +1 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.d.ts +2 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js +284 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEndEditLoop.d.ts +2 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js +41 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js.map +1 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/renderMethods.d.ts +2 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/renderMethods.js +97 -0
- package/dist/esm/tools/annotation/planarFreehandROITool/renderMethods.js.map +1 -0
- package/dist/esm/tools/index.d.ts +2 -1
- package/dist/esm/tools/index.js +2 -1
- package/dist/esm/tools/index.js.map +1 -1
- package/dist/esm/types/AnnotationTypes.d.ts +1 -0
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +31 -0
- package/dist/esm/utilities/math/index.d.ts +2 -1
- package/dist/esm/utilities/math/index.js +2 -1
- package/dist/esm/utilities/math/index.js.map +1 -1
- package/dist/esm/utilities/math/polyline/addCanvasPointsToArray.d.ts +4 -0
- package/dist/esm/utilities/math/polyline/addCanvasPointsToArray.js +34 -0
- package/dist/esm/utilities/math/polyline/addCanvasPointsToArray.js.map +1 -0
- package/dist/esm/utilities/math/polyline/calculateAreaOfPoints.d.ts +2 -0
- package/dist/esm/utilities/math/polyline/calculateAreaOfPoints.js +11 -0
- package/dist/esm/utilities/math/polyline/calculateAreaOfPoints.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getIntersectionWithPolyline.d.ts +7 -0
- package/dist/esm/utilities/math/polyline/getIntersectionWithPolyline.js +106 -0
- package/dist/esm/utilities/math/polyline/getIntersectionWithPolyline.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getSubPixelSpacingAndXYDirections.d.ts +7 -0
- package/dist/esm/utilities/math/polyline/getSubPixelSpacingAndXYDirections.js +65 -0
- package/dist/esm/utilities/math/polyline/getSubPixelSpacingAndXYDirections.js.map +1 -0
- package/dist/esm/utilities/math/polyline/index.d.ts +7 -0
- package/dist/esm/utilities/math/polyline/index.js +8 -0
- package/dist/esm/utilities/math/polyline/index.js.map +1 -0
- package/dist/esm/utilities/math/polyline/planarFreehandROIInternalTypes.d.ts +22 -0
- package/dist/esm/utilities/math/polyline/planarFreehandROIInternalTypes.js +2 -0
- package/dist/esm/utilities/math/polyline/planarFreehandROIInternalTypes.js.map +1 -0
- package/dist/esm/utilities/math/polyline/pointCanProjectOnLine.d.ts +3 -0
- package/dist/esm/utilities/math/polyline/pointCanProjectOnLine.js +33 -0
- package/dist/esm/utilities/math/polyline/pointCanProjectOnLine.js.map +1 -0
- package/dist/esm/utilities/math/polyline/pointsAreWithinCloseContourProximity.d.ts +3 -0
- package/dist/esm/utilities/math/polyline/pointsAreWithinCloseContourProximity.js +6 -0
- package/dist/esm/utilities/math/polyline/pointsAreWithinCloseContourProximity.js.map +1 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default function calculateAreaOfPoints(points) {
|
|
2
|
+
const n = points.length;
|
|
3
|
+
let area = 0.0;
|
|
4
|
+
let j = n - 1;
|
|
5
|
+
for (let i = 0; i < n; i++) {
|
|
6
|
+
area += (points[j][0] + points[i][0]) * (points[j][1] - points[i][1]);
|
|
7
|
+
j = i;
|
|
8
|
+
}
|
|
9
|
+
return Math.abs(area / 2.0);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=calculateAreaOfPoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculateAreaOfPoints.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/calculateAreaOfPoints.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,MAAsB;IAElE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IACxB,IAAI,IAAI,GAAG,GAAG,CAAC;IACf,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1B,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtE,CAAC,GAAG,CAAC,CAAC;KACP;IAGD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
declare function getFirstIntersectionWithPolyline(points: Types.Point2[], p1: Types.Point2, q1: Types.Point2, closed?: boolean): Types.Point2 | undefined;
|
|
3
|
+
declare function getClosestIntersectionWithPolyline(points: Types.Point2[], p1: Types.Point2, q1: Types.Point2, closed?: boolean): {
|
|
4
|
+
segment: Types.Point2;
|
|
5
|
+
distance: number;
|
|
6
|
+
} | undefined;
|
|
7
|
+
export { getFirstIntersectionWithPolyline, getClosestIntersectionWithPolyline };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { vec2 } from 'gl-matrix';
|
|
2
|
+
function getFirstIntersectionWithPolyline(points, p1, q1, closed = true) {
|
|
3
|
+
let initialI;
|
|
4
|
+
let j;
|
|
5
|
+
if (closed) {
|
|
6
|
+
j = points.length - 1;
|
|
7
|
+
initialI = 0;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
j = 0;
|
|
11
|
+
initialI = 1;
|
|
12
|
+
}
|
|
13
|
+
for (let i = initialI; i < points.length; i++) {
|
|
14
|
+
const p2 = points[j];
|
|
15
|
+
const q2 = points[i];
|
|
16
|
+
if (doesIntersect(p1, q1, p2, q2)) {
|
|
17
|
+
return [j, i];
|
|
18
|
+
}
|
|
19
|
+
j = i;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function getClosestIntersectionWithPolyline(points, p1, q1, closed = true) {
|
|
23
|
+
let initialI;
|
|
24
|
+
let j;
|
|
25
|
+
if (closed) {
|
|
26
|
+
j = points.length - 1;
|
|
27
|
+
initialI = 0;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
j = 0;
|
|
31
|
+
initialI = 1;
|
|
32
|
+
}
|
|
33
|
+
const intersections = [];
|
|
34
|
+
for (let i = initialI; i < points.length; i++) {
|
|
35
|
+
const p2 = points[j];
|
|
36
|
+
const q2 = points[i];
|
|
37
|
+
if (doesIntersect(p1, q1, p2, q2)) {
|
|
38
|
+
intersections.push([j, i]);
|
|
39
|
+
}
|
|
40
|
+
j = i;
|
|
41
|
+
}
|
|
42
|
+
if (intersections.length === 0) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const distances = [];
|
|
46
|
+
intersections.forEach((intersection) => {
|
|
47
|
+
const intersectionPoints = [
|
|
48
|
+
points[intersection[0]],
|
|
49
|
+
points[intersection[1]],
|
|
50
|
+
];
|
|
51
|
+
const midpoint = [
|
|
52
|
+
(intersectionPoints[0][0] + intersectionPoints[1][0]) / 2,
|
|
53
|
+
(intersectionPoints[0][1] + intersectionPoints[1][1]) / 2,
|
|
54
|
+
];
|
|
55
|
+
distances.push(vec2.distance(midpoint, p1));
|
|
56
|
+
});
|
|
57
|
+
const minDistance = Math.min(...distances);
|
|
58
|
+
const indexOfMinDistance = distances.indexOf(minDistance);
|
|
59
|
+
return {
|
|
60
|
+
segment: intersections[indexOfMinDistance],
|
|
61
|
+
distance: minDistance,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function doesIntersect(p1, q1, p2, q2) {
|
|
65
|
+
let result = false;
|
|
66
|
+
const orient = [
|
|
67
|
+
orientation(p1, q1, p2),
|
|
68
|
+
orientation(p1, q1, q2),
|
|
69
|
+
orientation(p2, q2, p1),
|
|
70
|
+
orientation(p2, q2, q1),
|
|
71
|
+
];
|
|
72
|
+
if (orient[0] !== orient[1] && orient[2] !== orient[3]) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
if (orient[0] === 0 && onSegment(p1, p2, q1)) {
|
|
76
|
+
result = true;
|
|
77
|
+
}
|
|
78
|
+
else if (orient[1] === 0 && onSegment(p1, q2, q1)) {
|
|
79
|
+
result = true;
|
|
80
|
+
}
|
|
81
|
+
else if (orient[2] === 0 && onSegment(p2, p1, q2)) {
|
|
82
|
+
result = true;
|
|
83
|
+
}
|
|
84
|
+
else if (orient[3] === 0 && onSegment(p2, q1, q2)) {
|
|
85
|
+
result = true;
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
function orientation(p, q, r) {
|
|
90
|
+
const orientationValue = (q[1] - p[1]) * (r[0] - q[0]) - (q[0] - p[0]) * (r[1] - q[1]);
|
|
91
|
+
if (orientationValue === 0) {
|
|
92
|
+
return 0;
|
|
93
|
+
}
|
|
94
|
+
return orientationValue > 0 ? 1 : 2;
|
|
95
|
+
}
|
|
96
|
+
function onSegment(p, q, r) {
|
|
97
|
+
if (q[0] <= Math.max(p[0], r[0]) &&
|
|
98
|
+
q[0] >= Math.min(p[0], r[0]) &&
|
|
99
|
+
q[1] <= Math.max(p[1], r[1]) &&
|
|
100
|
+
q[1] >= Math.min(p[1], r[1])) {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
export { getFirstIntersectionWithPolyline, getClosestIntersectionWithPolyline };
|
|
106
|
+
//# sourceMappingURL=getIntersectionWithPolyline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getIntersectionWithPolyline.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/getIntersectionWithPolyline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAYjC,SAAS,gCAAgC,CACvC,MAAsB,EACtB,EAAgB,EAChB,EAAgB,EAChB,MAAM,GAAG,IAAI;IAEb,IAAI,QAAQ,CAAC;IACb,IAAI,CAAC,CAAC;IAEN,IAAI,MAAM,EAAE;QACV,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACtB,QAAQ,GAAG,CAAC,CAAC;KACd;SAAM;QACL,CAAC,GAAG,CAAC,CAAC;QACN,QAAQ,GAAG,CAAC,CAAC;KACd;IAED,KAAK,IAAI,CAAC,GAAG,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC7C,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACrB,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAErB,IAAI,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE;YACjC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACf;QAED,CAAC,GAAG,CAAC,CAAC;KACP;AACH,CAAC;AAMD,SAAS,kCAAkC,CACzC,MAAsB,EACtB,EAAgB,EAChB,EAAgB,EAChB,MAAM,GAAG,IAAI;IAEb,IAAI,QAAQ,CAAC;IACb,IAAI,CAAC,CAAC;IAEN,IAAI,MAAM,EAAE;QACV,CAAC,G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AAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAC5B;QACA,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,OAAO,EAAE,gCAAgC,EAAE,kCAAkC,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
declare const getSubPixelSpacingAndXYDirections: (viewport: Types.IStackViewport | Types.IVolumeViewport, subPixelResolution: number) => {
|
|
3
|
+
spacing: Types.Point2;
|
|
4
|
+
xDir: Types.Point3;
|
|
5
|
+
yDir: Types.Point3;
|
|
6
|
+
};
|
|
7
|
+
export default getSubPixelSpacingAndXYDirections;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { StackViewport } from '@cornerstonejs/core';
|
|
2
|
+
import { vec3 } from 'gl-matrix';
|
|
3
|
+
const EPSILON = 1e-3;
|
|
4
|
+
const getSubPixelSpacingAndXYDirections = (viewport, subPixelResolution) => {
|
|
5
|
+
let spacing;
|
|
6
|
+
let xDir;
|
|
7
|
+
let yDir;
|
|
8
|
+
if (viewport instanceof StackViewport) {
|
|
9
|
+
const imageData = viewport.getImageData();
|
|
10
|
+
xDir = imageData.direction.slice(0, 3);
|
|
11
|
+
yDir = imageData.direction.slice(3, 6);
|
|
12
|
+
spacing = imageData.spacing;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
const imageData = viewport.getImageData();
|
|
16
|
+
const { direction, spacing: volumeSpacing } = imageData;
|
|
17
|
+
const { viewPlaneNormal, viewUp } = viewport.getCamera();
|
|
18
|
+
const iVector = direction.slice(0, 3);
|
|
19
|
+
const jVector = direction.slice(3, 6);
|
|
20
|
+
const kVector = direction.slice(6, 9);
|
|
21
|
+
let viewRight = vec3.create();
|
|
22
|
+
vec3.cross(viewRight, viewUp, viewPlaneNormal);
|
|
23
|
+
viewRight = [-viewRight[0], -viewRight[1], -viewRight[2]];
|
|
24
|
+
let xSpacing;
|
|
25
|
+
if (Math.abs(1 - vec3.dot(viewRight, iVector)) < EPSILON) {
|
|
26
|
+
xSpacing = volumeSpacing[0];
|
|
27
|
+
xDir = iVector;
|
|
28
|
+
}
|
|
29
|
+
else if (Math.abs(1 - vec3.dot(viewRight, jVector)) < EPSILON) {
|
|
30
|
+
xSpacing = volumeSpacing[1];
|
|
31
|
+
xDir = jVector;
|
|
32
|
+
}
|
|
33
|
+
else if (Math.abs(1 - vec3.dot(viewRight, kVector)) < EPSILON) {
|
|
34
|
+
xSpacing = volumeSpacing[2];
|
|
35
|
+
xDir = kVector;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
throw new Error('No support yet for oblique plane planar contours');
|
|
39
|
+
}
|
|
40
|
+
let ySpacing;
|
|
41
|
+
if (Math.abs(1 - vec3.dot(viewPlaneNormal, iVector)) < EPSILON) {
|
|
42
|
+
ySpacing = volumeSpacing[0];
|
|
43
|
+
yDir = iVector;
|
|
44
|
+
}
|
|
45
|
+
else if (Math.abs(1 - vec3.dot(viewPlaneNormal, jVector)) < EPSILON) {
|
|
46
|
+
ySpacing = volumeSpacing[1];
|
|
47
|
+
yDir = jVector;
|
|
48
|
+
}
|
|
49
|
+
else if (Math.abs(1 - vec3.dot(viewPlaneNormal, kVector)) < EPSILON) {
|
|
50
|
+
ySpacing = volumeSpacing[2];
|
|
51
|
+
yDir = kVector;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
throw new Error('No support yet for oblique plane planar contours');
|
|
55
|
+
}
|
|
56
|
+
spacing = [xSpacing, ySpacing];
|
|
57
|
+
}
|
|
58
|
+
const subPixelSpacing = [
|
|
59
|
+
spacing[0] / subPixelResolution,
|
|
60
|
+
spacing[1] / subPixelResolution,
|
|
61
|
+
];
|
|
62
|
+
return { spacing: subPixelSpacing, xDir, yDir };
|
|
63
|
+
};
|
|
64
|
+
export default getSubPixelSpacingAndXYDirections;
|
|
65
|
+
//# sourceMappingURL=getSubPixelSpacingAndXYDirections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSubPixelSpacingAndXYDirections.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/getSubPixelSpacingAndXYDirections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,OAAO,GAAG,IAAI,CAAC;AAcrB,MAAM,iCAAiC,GAAG,CACxC,QAAsD,EACtD,kBAA0B,EACyC,EAAE;IACrE,IAAI,OAAO,CAAC;IACZ,IAAI,IAAI,CAAC;IACT,IAAI,IAAI,CAAC;IAET,IAAI,QAAQ,YAAY,aAAa,EAAE;QAErC,MAAM,SAAS,GAAG,QAAQ,CAAC,YAAY,EAAE,CAAC;QAE1C,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvC,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEvC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;KAC7B;SAAM;QAEL,MAAM,SAAS,GAAG,QAAQ,CAAC,YAAY,EAAE,CAAC;QAC1C,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;QACxD,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;QAGzD,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACtC,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACtC,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEtC,IAAI,SAAS,GAAG,IAAI,CAAC,MAAM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AAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE;YACrE,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,GAAG,OAAO,CAAC;SAChB;aAAM,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE;YACrE,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,GAAG,OAAO,CAAC;SAChB;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;SACrE;QAED,OAAO,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;KAChC;IAED,MAAM,eAAe,GAAiB;QACpC,OAAO,CAAC,CAAC,CAAC,GAAG,kBAAkB;QAC/B,OAAO,CAAC,CAAC,CAAC,GAAG,kBAAkB;KAChC,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAClD,CAAC,CAAC;AAEF,eAAe,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getFirstIntersectionWithPolyline, getClosestIntersectionWithPolyline } from './getIntersectionWithPolyline';
|
|
2
|
+
import getSubPixelSpacingAndXYDirections from './getSubPixelSpacingAndXYDirections';
|
|
3
|
+
import pointsAreWithinCloseContourProximity from './pointsAreWithinCloseContourProximity';
|
|
4
|
+
import addCanvasPointsToArray from './addCanvasPointsToArray';
|
|
5
|
+
import pointCanProjectOnLine from './pointCanProjectOnLine';
|
|
6
|
+
import calculateAreaOfPoints from './calculateAreaOfPoints';
|
|
7
|
+
export { getFirstIntersectionWithPolyline, getClosestIntersectionWithPolyline, getSubPixelSpacingAndXYDirections, pointsAreWithinCloseContourProximity, addCanvasPointsToArray, pointCanProjectOnLine, calculateAreaOfPoints, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getFirstIntersectionWithPolyline, getClosestIntersectionWithPolyline, } from './getIntersectionWithPolyline';
|
|
2
|
+
import getSubPixelSpacingAndXYDirections from './getSubPixelSpacingAndXYDirections';
|
|
3
|
+
import pointsAreWithinCloseContourProximity from './pointsAreWithinCloseContourProximity';
|
|
4
|
+
import addCanvasPointsToArray from './addCanvasPointsToArray';
|
|
5
|
+
import pointCanProjectOnLine from './pointCanProjectOnLine';
|
|
6
|
+
import calculateAreaOfPoints from './calculateAreaOfPoints';
|
|
7
|
+
export { getFirstIntersectionWithPolyline, getClosestIntersectionWithPolyline, getSubPixelSpacingAndXYDirections, pointsAreWithinCloseContourProximity, addCanvasPointsToArray, pointCanProjectOnLine, calculateAreaOfPoints, };
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,kCAAkC,GACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,iCAAiC,MAAM,qCAAqC,CAAC;AACpF,OAAO,oCAAoC,MAAM,wCAAwC,CAAC;AAC1F,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EACL,gCAAgC,EAChC,kCAAkC,EAClC,iCAAiC,EACjC,oCAAoC,EACpC,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,GACtB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import { PlanarFreehandROIAnnotation } from '../../../types/ToolSpecificAnnotationTypes';
|
|
3
|
+
declare type PlanarFreehandROIDrawData = {
|
|
4
|
+
polylineIndex: number;
|
|
5
|
+
canvasPoints: Types.Point2[];
|
|
6
|
+
};
|
|
7
|
+
declare type PlanarFreehandROIEditData = {
|
|
8
|
+
prevCanvasPoints: Types.Point2[];
|
|
9
|
+
editCanvasPoints: Types.Point2[];
|
|
10
|
+
fusedCanvasPoints: Types.Point2[];
|
|
11
|
+
startCrossingIndex?: Types.Point2;
|
|
12
|
+
editIndex: number;
|
|
13
|
+
snapIndex?: number;
|
|
14
|
+
};
|
|
15
|
+
declare type PlanarFreehandROICommonData = {
|
|
16
|
+
annotation: PlanarFreehandROIAnnotation;
|
|
17
|
+
viewportIdsToRender: string[];
|
|
18
|
+
spacing: Types.Point2;
|
|
19
|
+
xDir: Types.Point3;
|
|
20
|
+
yDir: Types.Point3;
|
|
21
|
+
};
|
|
22
|
+
export { PlanarFreehandROIDrawData, PlanarFreehandROIEditData, PlanarFreehandROICommonData, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planarFreehandROIInternalTypes.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/planarFreehandROIInternalTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { vec2 } from 'gl-matrix';
|
|
2
|
+
const pointCanProjectOnLine = (p, p1, p2, proximity) => {
|
|
3
|
+
const p1p = [p[0] - p1[0], p[1] - p1[1]];
|
|
4
|
+
const p1p2 = [p2[0] - p1[0], p2[1] - p1[1]];
|
|
5
|
+
const dot = p1p[0] * p1p2[0] + p1p[1] * p1p2[1];
|
|
6
|
+
if (dot < 0) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
const p1p2Mag = Math.sqrt(p1p2[0] * p1p2[0] + p1p2[1] * p1p2[1]);
|
|
10
|
+
if (p1p2Mag === 0) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const projectionVectorMag = dot / p1p2Mag;
|
|
14
|
+
const p1p2UnitVector = [p1p2[0] / p1p2Mag, p1p2[1] / p1p2Mag];
|
|
15
|
+
const projectionVector = [
|
|
16
|
+
p1p2UnitVector[0] * projectionVectorMag,
|
|
17
|
+
p1p2UnitVector[1] * projectionVectorMag,
|
|
18
|
+
];
|
|
19
|
+
const projectionPoint = [
|
|
20
|
+
p1[0] + projectionVector[0],
|
|
21
|
+
p1[1] + projectionVector[1],
|
|
22
|
+
];
|
|
23
|
+
const distance = vec2.distance(p, projectionPoint);
|
|
24
|
+
if (distance > proximity) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (vec2.distance(p1, projectionPoint) > vec2.distance(p1, p2)) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
};
|
|
32
|
+
export default pointCanProjectOnLine;
|
|
33
|
+
//# sourceMappingURL=pointCanProjectOnLine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointCanProjectOnLine.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/pointCanProjectOnLine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAMjC,MAAM,qBAAqB,GAAG,CAC5B,CAAe,EACf,EAAgB,EAChB,EAAgB,EAChB,SAAiB,EACR,EAAE;IAEX,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE5C,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAGhD,IAAI,GAAG,GAAG,CAAC,EA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vec2.dist(p1, p2) < closeContourProximity;
|
|
4
|
+
};
|
|
5
|
+
export default pointsAreWithinCloseContourProximity;
|
|
6
|
+
//# sourceMappingURL=pointsAreWithinCloseContourProximity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointsAreWithinCloseContourProximity.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/pointsAreWithinCloseContourProximity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAMjC,MAAM,oCAAoC,GAAG,CAC3C,EAAgB,EAChB,EAAgB,EAChB,qBAA6B,EACpB,EAAE;IACX,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,qBAAqB,CAAC;AACnD,CAAC,CAAC;AAEF,eAAe,oCAAoC,CAAC"}
|