@cornerstonejs/tools 4.5.16 → 4.5.17

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.
@@ -48,15 +48,13 @@ declare class PlanarFreehandROITool extends ContourSegmentationBaseTool {
48
48
  deltaInX: any;
49
49
  deltaInY: any;
50
50
  }): void;
51
- protected updateOpenCachedStats({ targetId, metadata, canvasCoordinates, cachedStats, modalityUnit, calibratedScale, deltaInX, deltaInY, }: {
51
+ protected updateOpenCachedStats({ targetId, metadata, cachedStats, modalityUnit, calibratedScale, points, }: {
52
52
  targetId: any;
53
53
  metadata: any;
54
- canvasCoordinates: any;
55
54
  cachedStats: any;
56
55
  modalityUnit: any;
57
56
  calibratedScale: any;
58
- deltaInX: any;
59
- deltaInY: any;
57
+ points: any;
60
58
  }): void;
61
59
  private _renderStats;
62
60
  }
@@ -198,13 +198,11 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
198
198
  else {
199
199
  this.updateOpenCachedStats({
200
200
  metadata,
201
- canvasCoordinates,
202
201
  targetId,
203
202
  cachedStats,
204
203
  modalityUnit,
205
204
  calibratedScale,
206
- deltaInX,
207
- deltaInY,
205
+ points,
208
206
  });
209
207
  }
210
208
  }
@@ -457,8 +455,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
457
455
  worldPosIndex2[2] = Math.floor(worldPosIndex2[2]);
458
456
  let area = polyline.getArea(canvasCoordinates) / scale / scale;
459
457
  area *= deltaInX * deltaInY;
460
- let perimeter = calculatePerimeter(canvasCoordinates, closed) / scale;
461
- perimeter *= Math.sqrt(Math.pow(deltaInX, 2) + Math.pow(deltaInY, 2));
458
+ const perimeter = calculatePerimeter(points, closed) / scale;
462
459
  const iDelta = 0.01 * (iMax - iMin);
463
460
  const jDelta = 0.01 * (jMax - jMin);
464
461
  const kDelta = 0.01 * (kMax - kMin);
@@ -528,10 +525,9 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
528
525
  unit,
529
526
  };
530
527
  }
531
- updateOpenCachedStats({ targetId, metadata, canvasCoordinates, cachedStats, modalityUnit, calibratedScale, deltaInX, deltaInY, }) {
528
+ updateOpenCachedStats({ targetId, metadata, cachedStats, modalityUnit, calibratedScale, points, }) {
532
529
  const { scale, unit } = calibratedScale;
533
- let length = calculatePerimeter(canvasCoordinates, closed) / scale;
534
- length *= Math.sqrt(Math.pow(deltaInX, 2) + Math.pow(deltaInY, 2));
530
+ const length = calculatePerimeter(points, closed) / scale;
535
531
  cachedStats[targetId] = {
536
532
  Modality: metadata.Modality,
537
533
  length,
@@ -1,2 +1,2 @@
1
- declare function calculatePerimeter(polyline: number[][], closed: boolean): number;
1
+ export declare function calculatePerimeter(polyline: number[][], closed: boolean): number;
2
2
  export default calculatePerimeter;
@@ -1,15 +1,15 @@
1
- function calculatePerimeter(polyline, closed) {
1
+ import { vec3 } from 'gl-matrix';
2
+ export function calculatePerimeter(polyline, closed) {
2
3
  let perimeter = 0;
3
4
  for (let i = 0; i < polyline.length - 1; i++) {
4
5
  const point1 = polyline[i];
5
6
  const point2 = polyline[i + 1];
6
- perimeter += Math.sqrt(Math.pow(point2[0] - point1[0], 2) + Math.pow(point2[1] - point1[1], 2));
7
+ perimeter += vec3.dist(point1, point2);
7
8
  }
8
9
  if (closed) {
9
10
  const firstPoint = polyline[0];
10
11
  const lastPoint = polyline[polyline.length - 1];
11
- perimeter += Math.sqrt(Math.pow(lastPoint[0] - firstPoint[0], 2) +
12
- Math.pow(lastPoint[1] - firstPoint[1], 2));
12
+ perimeter += vec3.dist(firstPoint, lastPoint);
13
13
  }
14
14
  return perimeter;
15
15
  }
@@ -1 +1 @@
1
- export declare const version = "4.5.16";
1
+ export declare const version = "4.5.17";
@@ -1 +1 @@
1
- export const version = '4.5.16';
1
+ export const version = '4.5.17';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "4.5.16",
3
+ "version": "4.5.17",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -108,7 +108,7 @@
108
108
  "canvas": "3.1.0"
109
109
  },
110
110
  "peerDependencies": {
111
- "@cornerstonejs/core": "4.5.16",
111
+ "@cornerstonejs/core": "4.5.17",
112
112
  "@kitware/vtk.js": "32.12.1",
113
113
  "@types/d3-array": "3.2.1",
114
114
  "@types/d3-interpolate": "3.0.4",
@@ -127,5 +127,5 @@
127
127
  "type": "individual",
128
128
  "url": "https://ohif.org/donate"
129
129
  },
130
- "gitHead": "77c3c6596746762086a9de26bf28fdde305b84b2"
130
+ "gitHead": "a00e6edba2b5e7e9105708d7e5f7bc91b2dc497c"
131
131
  }