@cornerstonejs/tools 1.84.0 → 1.84.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.
@@ -1,3 +1,6 @@
1
- import { Types } from '@cornerstonejs/core';
2
1
  import { PlanarFreehandROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
3
- export default function smoothAnnotation(enabledElement: Types.IEnabledElement, annotation: PlanarFreehandROIAnnotation, knotsRatioPercentage: number): boolean;
2
+ export declare type SmoothOptions = {
3
+ knotsRatioPercentage: number;
4
+ loop: number;
5
+ };
6
+ export default function smoothAnnotation(annotation: PlanarFreehandROIAnnotation, options?: SmoothOptions): boolean;
@@ -3,44 +3,61 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const tools_1 = require("../../tools");
7
- const store_1 = require("../../store");
6
+ const gl_matrix_1 = require("gl-matrix");
8
7
  const interpolateSegmentPoints_1 = __importDefault(require("./interpolation/interpolateSegmentPoints"));
9
- function shouldPreventInterpolation(enabledElement, annotation, knotsRatioPercentage) {
10
- var _a;
11
- if (!((_a = annotation === null || annotation === void 0 ? void 0 : annotation.data) === null || _a === void 0 ? void 0 : _a.polyline) || knotsRatioPercentage <= 0) {
8
+ function shouldPreventInterpolation(annotation, options) {
9
+ var _a, _b, _c;
10
+ const knotsRatioPercentage = (options === null || options === void 0 ? void 0 : options.knotsRatioPercentage) || 30;
11
+ if (!((_c = (_b = (_a = annotation === null || annotation === void 0 ? void 0 : annotation.data) === null || _a === void 0 ? void 0 : _a.contour) === null || _b === void 0 ? void 0 : _b.polyline) === null || _c === void 0 ? void 0 : _c.length) ||
12
+ knotsRatioPercentage <= 0) {
12
13
  return true;
13
14
  }
14
- if (!enabledElement.viewport) {
15
- return true;
16
- }
17
- const { renderingEngineId, viewportId, FrameOfReferenceUID } = enabledElement;
18
- const toolGroup = store_1.ToolGroupManager.getToolGroupForViewport(viewportId, renderingEngineId);
19
- if (annotation.metadata.FrameOfReferenceUID !== FrameOfReferenceUID) {
20
- return true;
21
- }
22
- if (!toolGroup) {
23
- return true;
15
+ return false;
16
+ }
17
+ function rotateMatrix(normal, focal) {
18
+ const mat = gl_matrix_1.mat4.create();
19
+ const eye = gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), focal, normal);
20
+ const up = Math.abs(normal[0]) > 0.1
21
+ ? gl_matrix_1.vec3.fromValues(-normal[1], normal[0], 0)
22
+ : gl_matrix_1.vec3.fromValues(0, -normal[2], normal[1]);
23
+ gl_matrix_1.mat4.lookAt(mat, focal, eye, up);
24
+ return mat;
25
+ }
26
+ function rotate(list, count = Math.floor(Math.random() * (list.length - 1))) {
27
+ if (count === 0) {
28
+ return 0;
24
29
  }
25
- const toolInstance = toolGroup.getToolInstance(annotation.metadata.toolName);
26
- if (!(toolInstance instanceof tools_1.PlanarFreehandROITool)) {
27
- return true;
30
+ const srcList = [...list];
31
+ const { length } = list;
32
+ for (let i = 0; i < length; i++) {
33
+ list[i] = srcList[(i + count + length) % length];
28
34
  }
29
- return (toolInstance.isDrawing ||
30
- toolInstance.isEditingOpen ||
31
- toolInstance.isEditingClosed);
35
+ return count;
32
36
  }
33
- function smoothAnnotation(enabledElement, annotation, knotsRatioPercentage) {
34
- if (shouldPreventInterpolation(enabledElement, annotation, knotsRatioPercentage)) {
37
+ function smoothAnnotation(annotation, options) {
38
+ if (shouldPreventInterpolation(annotation, options)) {
35
39
  return false;
36
40
  }
37
- const { viewport } = enabledElement;
38
- const canvasPoints = annotation.data.contour.polyline.map(viewport.worldToCanvas);
39
- const interpolatedCanvasPoints = ((0, interpolateSegmentPoints_1.default)(canvasPoints, 0, canvasPoints.length, knotsRatioPercentage));
41
+ const { viewPlaneNormal } = annotation.metadata;
42
+ const { closed, polyline } = annotation.data.contour;
43
+ const rotateMat = rotateMatrix(viewPlaneNormal, annotation.data.contour.polyline[0]);
44
+ const canvasPoints = annotation.data.contour.polyline.map((p) => {
45
+ const planeP = gl_matrix_1.vec3.transformMat4(gl_matrix_1.vec3.create(), p, rotateMat);
46
+ return [planeP[0], planeP[1]];
47
+ });
48
+ let rotation = closed ? rotate(canvasPoints) : 0;
49
+ let interpolatedCanvasPoints = ((0, interpolateSegmentPoints_1.default)(canvasPoints, 0, canvasPoints.length, (options === null || options === void 0 ? void 0 : options.knotsRatioPercentage) || 30));
40
50
  if (interpolatedCanvasPoints === canvasPoints) {
41
51
  return false;
42
52
  }
43
- annotation.data.contour.polyline = interpolatedCanvasPoints.map(viewport.canvasToWorld);
53
+ rotate(interpolatedCanvasPoints, -rotation);
54
+ for (let i = 1; i < (options === null || options === void 0 ? void 0 : options.loop); i++) {
55
+ rotation = closed ? rotate(interpolatedCanvasPoints) : 0;
56
+ interpolatedCanvasPoints = ((0, interpolateSegmentPoints_1.default)(interpolatedCanvasPoints, 0, canvasPoints.length, (options === null || options === void 0 ? void 0 : options.knotsRatioPercentage) || 30));
57
+ rotate(interpolatedCanvasPoints, -rotation);
58
+ }
59
+ const unRotate = gl_matrix_1.mat4.invert(gl_matrix_1.mat4.create(), rotateMat);
60
+ annotation.data.contour.polyline = (interpolatedCanvasPoints.map((p) => gl_matrix_1.vec3.transformMat4([0, 0, 0], [...p, 0], unRotate)));
44
61
  return true;
45
62
  }
46
63
  exports.default = smoothAnnotation;
@@ -1 +1 @@
1
- {"version":3,"file":"smoothAnnotation.js","sourceRoot":"","sources":["../../../../src/utilities/planarFreehandROITool/smoothAnnotation.ts"],"names":[],"mappings":";;;;;AACA,uCAAoD;AACpD,uCAA+C;AAE/C,wGAAgF;AAEhF,SAAS,0BAA0B,CACjC,cAAqC,EACrC,UAAuC,EACvC,oBAA4B;;IAE5B,IAAI,CAAC,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,0CAAE,QAAQ,CAAA,IAAI,oBAAoB,IAAI,CAAC,EAAE;QAC5D,OAAO,IAAI,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jC,gBAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,CACnD,CACF,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AA7DD,mCA6DC"}
@@ -1,40 +1,57 @@
1
- import { PlanarFreehandROITool } from '../../tools';
2
- import { ToolGroupManager } from '../../store';
1
+ import { mat4, vec3 } from 'gl-matrix';
3
2
  import interpolateSegmentPoints from './interpolation/interpolateSegmentPoints';
4
- function shouldPreventInterpolation(enabledElement, annotation, knotsRatioPercentage) {
5
- if (!annotation?.data?.polyline || knotsRatioPercentage <= 0) {
3
+ function shouldPreventInterpolation(annotation, options) {
4
+ const knotsRatioPercentage = options?.knotsRatioPercentage || 30;
5
+ if (!annotation?.data?.contour?.polyline?.length ||
6
+ knotsRatioPercentage <= 0) {
6
7
  return true;
7
8
  }
8
- if (!enabledElement.viewport) {
9
- return true;
10
- }
11
- const { renderingEngineId, viewportId, FrameOfReferenceUID } = enabledElement;
12
- const toolGroup = ToolGroupManager.getToolGroupForViewport(viewportId, renderingEngineId);
13
- if (annotation.metadata.FrameOfReferenceUID !== FrameOfReferenceUID) {
14
- return true;
15
- }
16
- if (!toolGroup) {
17
- return true;
9
+ return false;
10
+ }
11
+ function rotateMatrix(normal, focal) {
12
+ const mat = mat4.create();
13
+ const eye = vec3.add(vec3.create(), focal, normal);
14
+ const up = Math.abs(normal[0]) > 0.1
15
+ ? vec3.fromValues(-normal[1], normal[0], 0)
16
+ : vec3.fromValues(0, -normal[2], normal[1]);
17
+ mat4.lookAt(mat, focal, eye, up);
18
+ return mat;
19
+ }
20
+ function rotate(list, count = Math.floor(Math.random() * (list.length - 1))) {
21
+ if (count === 0) {
22
+ return 0;
18
23
  }
19
- const toolInstance = toolGroup.getToolInstance(annotation.metadata.toolName);
20
- if (!(toolInstance instanceof PlanarFreehandROITool)) {
21
- return true;
24
+ const srcList = [...list];
25
+ const { length } = list;
26
+ for (let i = 0; i < length; i++) {
27
+ list[i] = srcList[(i + count + length) % length];
22
28
  }
23
- return (toolInstance.isDrawing ||
24
- toolInstance.isEditingOpen ||
25
- toolInstance.isEditingClosed);
29
+ return count;
26
30
  }
27
- export default function smoothAnnotation(enabledElement, annotation, knotsRatioPercentage) {
28
- if (shouldPreventInterpolation(enabledElement, annotation, knotsRatioPercentage)) {
31
+ export default function smoothAnnotation(annotation, options) {
32
+ if (shouldPreventInterpolation(annotation, options)) {
29
33
  return false;
30
34
  }
31
- const { viewport } = enabledElement;
32
- const canvasPoints = annotation.data.contour.polyline.map(viewport.worldToCanvas);
33
- const interpolatedCanvasPoints = (interpolateSegmentPoints(canvasPoints, 0, canvasPoints.length, knotsRatioPercentage));
35
+ const { viewPlaneNormal } = annotation.metadata;
36
+ const { closed, polyline } = annotation.data.contour;
37
+ const rotateMat = rotateMatrix(viewPlaneNormal, annotation.data.contour.polyline[0]);
38
+ const canvasPoints = annotation.data.contour.polyline.map((p) => {
39
+ const planeP = vec3.transformMat4(vec3.create(), p, rotateMat);
40
+ return [planeP[0], planeP[1]];
41
+ });
42
+ let rotation = closed ? rotate(canvasPoints) : 0;
43
+ let interpolatedCanvasPoints = (interpolateSegmentPoints(canvasPoints, 0, canvasPoints.length, options?.knotsRatioPercentage || 30));
34
44
  if (interpolatedCanvasPoints === canvasPoints) {
35
45
  return false;
36
46
  }
37
- annotation.data.contour.polyline = interpolatedCanvasPoints.map(viewport.canvasToWorld);
47
+ rotate(interpolatedCanvasPoints, -rotation);
48
+ for (let i = 1; i < options?.loop; i++) {
49
+ rotation = closed ? rotate(interpolatedCanvasPoints) : 0;
50
+ interpolatedCanvasPoints = (interpolateSegmentPoints(interpolatedCanvasPoints, 0, canvasPoints.length, options?.knotsRatioPercentage || 30));
51
+ rotate(interpolatedCanvasPoints, -rotation);
52
+ }
53
+ const unRotate = mat4.invert(mat4.create(), rotateMat);
54
+ annotation.data.contour.polyline = (interpolatedCanvasPoints.map((p) => vec3.transformMat4([0, 0, 0], [...p, 0], unRotate)));
38
55
  return true;
39
56
  }
40
57
  //# sourceMappingURL=smoothAnnotation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"smoothAnnotation.js","sourceRoot":"","sources":["../../../../src/utilities/planarFreehandROITool/smoothAnnotation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,wBAAwB,MAAM,0CAA0C,CAAC;AAEhF,SAAS,0BAA0B,CACjC,cAAqC,EACrC,UAAuC,EACvC,oBAA4B;IAE5B,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,IAAI,oBAAoB,IAAI,CAAC,EAAE;QAC5D,OAAO,IAAI,CAAC;KACb;IAED,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE;QAC5B,OAAO,IAAI,CAAC;KACb;IAED,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,GAAG,cAAc,CAAC;IAC9E,MAAM,SAAS,GAAG,gBAAgB,CAAC,uBAAuB,CACxD,UAAU,EACV,iBAAiB,CAClB,CAAC;IAEF,IAAI,UAAU,CAAC,QAAQ,CAAC,mBAAmB,KAAK,mBAAmB,EAAE;QACnE,OAAO,IAAI,CAAC;KACb;IAED,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,IAAI,CAAC;KACb;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAG7E,IAAI,CAAC,CAAC,YAAY,YAAY,qBAAqB,CAAC,EAAE;QACpD,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,YAAY,CAAC,SAAS;QACtB,YAAY,CAAC,aAAa;QAC1B,YAAY,CAAC,eAAe,CAC7B,CAAC;AACJ,CAAC;AAOD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,cAAqC,EACrC,UAAuC,EACvC,oBAA4B;IAG5B,IACE,0BAA0B,CAAC,cAAc,EAAE,UAAU,EAAE,oBAAoB,CAAC,EAC5E;QACA,OAAO,KAAK,CAAC;KACd;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;IAGpC,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CACvD,QAAQ,CAAC,aAAa,CACvB,CAAC;IACF,MAAM,wBAAwB,GAAmB,CAC/C,wBAAwB,CACtB,YAAY,EACZ,CAAC,EACD,YAAY,CAAC,MAAM,EACnB,oBAAoB,CACrB,CACF,CAAC;IAEF,IAAI,wBAAwB,KAAK,YAAY,EAAE;QAC7C,OAAO,KAAK,CAAC;KACd;IAED,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,wBAAwB,CAAC,GAAG,CAC7D,QAAQ,CAAC,aAAa,CACvB,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC"}
1
+ {"version":3,"file":"smoothAnnotation.js","sourceRoot":"","sources":["../../../../src/utilities/planarFreehandROITool/smoothAnnotation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIvC,OAAO,wBAAwB,MAAM,0CAA0C,CAAC;AAOhF,SAAS,0BAA0B,CACjC,UAAuC,EACvC,OAAuB;IAEvB,MAAM,oBAAoB,GAAG,OAAO,EAAE,oBAAoB,IAAI,EAAE,CAAC;IACjE,IACE,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM;QAC5C,oBAAoB,IAAI,CAAC,EACzB;QACA,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,MAAM,EAAE,KAAK;IACjC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAA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AAmB,CACzC,wBAAwB,CACtB,wBAAwB,EACxB,CAAC,EACD,YAAY,CAAC,MAAM,EACnB,OAAO,EAAE,oBAAoB,IAAI,EAAE,CACpC,CACF,CAAC;QACF,MAAM,CAAC,wBAAwB,EAAE,CAAC,QAAQ,CAAC,CAAC;KAC7C;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,SAAS,CAAC,CAAC;IACvD,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAmB,CACjD,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACjC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,CACnD,CACF,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,4 +1,7 @@
1
- import { Types } from '@cornerstonejs/core';
2
1
  import { PlanarFreehandROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
3
- export default function smoothAnnotation(enabledElement: Types.IEnabledElement, annotation: PlanarFreehandROIAnnotation, knotsRatioPercentage: number): boolean;
2
+ export declare type SmoothOptions = {
3
+ knotsRatioPercentage: number;
4
+ loop: number;
5
+ };
6
+ export default function smoothAnnotation(annotation: PlanarFreehandROIAnnotation, options?: SmoothOptions): boolean;
4
7
  //# sourceMappingURL=smoothAnnotation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"smoothAnnotation.d.ts","sourceRoot":"","sources":["../../../../src/utilities/planarFreehandROITool/smoothAnnotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAiDtF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,cAAc,EAAE,KAAK,CAAC,eAAe,EACrC,UAAU,EAAE,2BAA2B,EACvC,oBAAoB,EAAE,MAAM,GAC3B,OAAO,CAgCT"}
1
+ {"version":3,"file":"smoothAnnotation.d.ts","sourceRoot":"","sources":["../../../../src/utilities/planarFreehandROITool/smoothAnnotation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAGtF,oBAAY,aAAa,GAAG;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA4DF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,UAAU,EAAE,2BAA2B,EACvC,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CA0DT"}