@cornerstonejs/tools 1.21.1 → 1.22.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/eventDispatchers/mouseEventHandlers/mouseDown.js +1 -1
- package/dist/cjs/eventDispatchers/mouseEventHandlers/mouseDown.js.map +1 -1
- package/dist/cjs/tools/MagnifyTool.js +2 -2
- package/dist/cjs/tools/MagnifyTool.js.map +1 -1
- package/dist/cjs/tools/annotation/CobbAngleTool.d.ts +31 -5
- package/dist/cjs/tools/annotation/CobbAngleTool.js +266 -70
- package/dist/cjs/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/cjs/tools/base/AnnotationTool.d.ts +1 -1
- package/dist/cjs/tools/base/AnnotationTool.js.map +1 -1
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +44 -0
- package/dist/cjs/utilities/math/angle/angleBetweenLines.d.ts +3 -1
- package/dist/cjs/utilities/math/angle/angleBetweenLines.js +18 -1
- package/dist/cjs/utilities/math/angle/angleBetweenLines.js.map +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDown.js +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDown.js.map +1 -1
- package/dist/esm/tools/MagnifyTool.js +2 -2
- package/dist/esm/tools/MagnifyTool.js.map +1 -1
- package/dist/esm/tools/annotation/CobbAngleTool.d.ts +31 -5
- package/dist/esm/tools/annotation/CobbAngleTool.js +273 -71
- package/dist/esm/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/esm/tools/base/AnnotationTool.d.ts +1 -1
- package/dist/esm/tools/base/AnnotationTool.js.map +1 -1
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +44 -0
- package/dist/esm/utilities/math/angle/angleBetweenLines.d.ts +3 -1
- package/dist/esm/utilities/math/angle/angleBetweenLines.js +19 -2
- package/dist/esm/utilities/math/angle/angleBetweenLines.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/eventDispatchers/mouseEventHandlers/mouseDown.ts +1 -1
- package/src/tools/MagnifyTool.ts +2 -2
- package/src/tools/annotation/CobbAngleTool.ts +418 -98
- package/src/tools/base/AnnotationTool.ts +2 -1
- package/src/tools/displayTools/Contour/contourDisplay.ts +0 -1
- package/src/types/ToolSpecificAnnotationTypes.ts +46 -0
- package/src/utilities/math/angle/angleBetweenLines.ts +39 -9
|
@@ -284,6 +284,50 @@ export interface AngleAnnotation extends Annotation {
|
|
|
284
284
|
};
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
|
+
export interface CobbAngleAnnotation extends Annotation {
|
|
288
|
+
data: {
|
|
289
|
+
handles: {
|
|
290
|
+
points: Types.Point3[];
|
|
291
|
+
activeHandleIndex: number | null;
|
|
292
|
+
textBox: {
|
|
293
|
+
hasMoved: boolean;
|
|
294
|
+
worldPosition: Types.Point3;
|
|
295
|
+
worldBoundingBox: {
|
|
296
|
+
topLeft: Types.Point3;
|
|
297
|
+
topRight: Types.Point3;
|
|
298
|
+
bottomLeft: Types.Point3;
|
|
299
|
+
bottomRight: Types.Point3;
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
label: string;
|
|
304
|
+
cachedStats: {
|
|
305
|
+
[targetId: string]: {
|
|
306
|
+
angle: number;
|
|
307
|
+
arc1Angle: number;
|
|
308
|
+
arc2Angle: number;
|
|
309
|
+
points: {
|
|
310
|
+
world: {
|
|
311
|
+
arc1Start: Types.Point3;
|
|
312
|
+
arc1End: Types.Point3;
|
|
313
|
+
arc2Start: Types.Point3;
|
|
314
|
+
arc2End: Types.Point3;
|
|
315
|
+
arc1Angle: number;
|
|
316
|
+
arc2Angle: number;
|
|
317
|
+
};
|
|
318
|
+
canvas: {
|
|
319
|
+
arc1Start: Types.Point2;
|
|
320
|
+
arc1End: Types.Point2;
|
|
321
|
+
arc2Start: Types.Point2;
|
|
322
|
+
arc2End: Types.Point2;
|
|
323
|
+
arc1Angle: number;
|
|
324
|
+
arc2Angle: number;
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
}
|
|
287
331
|
export interface ReferenceCursor extends Annotation {
|
|
288
332
|
data: {
|
|
289
333
|
handles: {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
|
-
declare type
|
|
2
|
+
declare type Line2D = [Types.Point2, Types.Point2];
|
|
3
|
+
declare type Line3D = [Types.Point3, Types.Point3];
|
|
4
|
+
declare type Line = Line2D | Line3D;
|
|
3
5
|
export default function angleBetweenLines(line1: Line, line2: Line): number;
|
|
4
6
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { vec3 } from 'gl-matrix';
|
|
2
|
-
|
|
1
|
+
import { vec2, vec3 } from 'gl-matrix';
|
|
2
|
+
function angleBetween3DLines(line1, line2) {
|
|
3
3
|
const [p1, p2] = line1;
|
|
4
4
|
const [p3, p4] = line2;
|
|
5
5
|
const v1 = vec3.sub(vec3.create(), p2, p1);
|
|
@@ -11,4 +11,21 @@ export default function angleBetweenLines(line1, line2) {
|
|
|
11
11
|
const radian = Math.acos(cos);
|
|
12
12
|
return (radian * 180) / Math.PI;
|
|
13
13
|
}
|
|
14
|
+
function angleBetween2DLines(line1, line2) {
|
|
15
|
+
const [p1, p2] = line1;
|
|
16
|
+
const [p3, p4] = line2;
|
|
17
|
+
const v1 = vec2.sub(vec2.create(), p2, p1);
|
|
18
|
+
const v2 = vec2.sub(vec2.create(), p3, p4);
|
|
19
|
+
const dot = vec2.dot(v1, v2);
|
|
20
|
+
const v1Length = vec2.length(v1);
|
|
21
|
+
const v2Length = vec2.length(v2);
|
|
22
|
+
const cos = dot / (v1Length * v2Length);
|
|
23
|
+
return Math.acos(cos) * (180 / Math.PI);
|
|
24
|
+
}
|
|
25
|
+
export default function angleBetweenLines(line1, line2) {
|
|
26
|
+
const is3D = line1[0].length === 3;
|
|
27
|
+
return is3D
|
|
28
|
+
? angleBetween3DLines(line1, line2)
|
|
29
|
+
: angleBetween2DLines(line1, line2);
|
|
30
|
+
}
|
|
14
31
|
//# sourceMappingURL=angleBetweenLines.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angleBetweenLines.js","sourceRoot":"","sources":["../../../../../src/utilities/math/angle/angleBetweenLines.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"angleBetweenLines.js","sourceRoot":"","sources":["../../../../../src/utilities/math/angle/angleBetweenLines.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AASvC,SAAS,mBAAmB,CAAC,KAAa,EAAE,KAAa;IACvD,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC;IACvB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC;IAEvB,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC3C,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAE3C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAE7B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAEjC,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,QAAQ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