@cornerstonejs/tools 3.22.0 → 3.22.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.
@@ -306,30 +306,35 @@ class CircleROIStartEndThresholdTool extends CircleROITool {
306
306
  imageData.indexToWorldVec3(startIJK, startWorld);
307
307
  const endWorld = vec3.create();
308
308
  imageData.indexToWorldVec3(endIJK, endWorld);
309
- if (this._getIndexOfCoordinatesForViewplaneNormal(viewPlaneNormal) == 2) {
309
+ const projectionAxisIndex = this._getIndexOfCoordinatesForViewplaneNormal(viewPlaneNormal);
310
+ if (projectionAxisIndex == 2) {
310
311
  startWorld[2] = startCoordinate;
311
312
  endWorld[2] = endCoordinate;
312
313
  handlesToStart[0][2] = startCoordinate;
313
314
  handlesToStart[1][2] = startCoordinate;
314
315
  }
315
- else if (this._getIndexOfCoordinatesForViewplaneNormal(viewPlaneNormal) == 0) {
316
+ else if (projectionAxisIndex == 0) {
316
317
  startWorld[0] = startCoordinate;
317
318
  endWorld[0] = endCoordinate;
318
319
  handlesToStart[0][0] = startCoordinate;
319
320
  handlesToStart[1][0] = startCoordinate;
320
321
  }
321
- else if (this._getIndexOfCoordinatesForViewplaneNormal(viewPlaneNormal) == 1) {
322
+ else if (projectionAxisIndex == 1) {
322
323
  startWorld[1] = startCoordinate;
323
324
  endWorld[1] = endCoordinate;
324
325
  handlesToStart[0][1] = startCoordinate;
325
326
  handlesToStart[1][1] = startCoordinate;
326
327
  }
327
- const distance = vec3.distance(startWorld, endWorld);
328
+ const direction = vec3.create();
329
+ vec3.subtract(direction, endWorld, startWorld);
330
+ const distance = vec3.length(direction);
331
+ vec3.normalize(direction, direction);
328
332
  const newProjectionPoints = [];
333
+ const basePoints = points;
329
334
  for (let dist = 0; dist < distance; dist += spacingInNormal) {
330
- newProjectionPoints.push(handlesToStart.map((point) => {
335
+ newProjectionPoints.push(basePoints.map((point) => {
331
336
  const newPoint = vec3.create();
332
- vec3.scaleAndAdd(newPoint, point, viewPlaneNormal, dist);
337
+ vec3.scaleAndAdd(newPoint, point, direction, dist);
333
338
  return Array.from(newPoint);
334
339
  }));
335
340
  }
@@ -290,24 +290,28 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
290
290
  imageData.indexToWorldVec3(startIJK, startWorld);
291
291
  const endWorld = vec3.create();
292
292
  imageData.indexToWorldVec3(endIJK, endWorld);
293
- if (this._getIndexOfCoordinatesForViewplaneNormal(viewPlaneNormal) == 2) {
293
+ const projectionAxisIndex = this._getIndexOfCoordinatesForViewplaneNormal(viewPlaneNormal);
294
+ if (projectionAxisIndex == 2) {
294
295
  startWorld[2] = startCoordinate;
295
296
  endWorld[2] = endCoordinate;
296
297
  }
297
- else if (this._getIndexOfCoordinatesForViewplaneNormal(viewPlaneNormal) == 0) {
298
+ else if (projectionAxisIndex == 0) {
298
299
  startWorld[0] = startCoordinate;
299
300
  endWorld[0] = endCoordinate;
300
301
  }
301
- else if (this._getIndexOfCoordinatesForViewplaneNormal(viewPlaneNormal) == 1) {
302
+ else if (projectionAxisIndex == 1) {
302
303
  startWorld[1] = startCoordinate;
303
304
  endWorld[1] = endCoordinate;
304
305
  }
305
- const distance = vec3.distance(startWorld, endWorld);
306
+ const direction = vec3.create();
307
+ vec3.subtract(direction, endWorld, startWorld);
308
+ const distance = vec3.length(direction);
309
+ vec3.normalize(direction, direction);
306
310
  const newProjectionPoints = [];
307
311
  for (let dist = 0; dist < distance; dist += spacingInNormal) {
308
312
  newProjectionPoints.push(points.map((point) => {
309
313
  const newPoint = vec3.create();
310
- vec3.scaleAndAdd(newPoint, point, viewPlaneNormal, dist);
314
+ vec3.scaleAndAdd(newPoint, point, direction, dist);
311
315
  return Array.from(newPoint);
312
316
  }));
313
317
  }
@@ -1 +1 @@
1
- export declare const version = "3.22.0";
1
+ export declare const version = "3.22.2";
@@ -1 +1 @@
1
- export const version = '3.22.0';
1
+ export const version = '3.22.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "3.22.0",
3
+ "version": "3.22.2",
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": "^3.22.0",
111
+ "@cornerstonejs/core": "^3.22.2",
112
112
  "@kitware/vtk.js": "32.12.1",
113
113
  "@types/d3-array": "^3.0.4",
114
114
  "@types/d3-interpolate": "^3.0.1",
@@ -127,5 +127,5 @@
127
127
  "type": "individual",
128
128
  "url": "https://ohif.org/donate"
129
129
  },
130
- "gitHead": "eae87d19be6d8bcdb00fa14fc747ab61ede54e1e"
130
+ "gitHead": "3d92fc6b7bb0483ba2a648a3207e3d29697690f0"
131
131
  }