@cornerstonejs/tools 5.0.10 → 5.0.12

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.
@@ -378,7 +378,9 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
378
378
  if (!this.configuration.calculateStats) {
379
379
  return;
380
380
  }
381
- if (annotation.invalidated) {
381
+ const { data, invalidated } = annotation;
382
+ const cachedStats = data?.cachedStats;
383
+ if (invalidated || !cachedStats?.[targetId]) {
382
384
  this._calculateStatsIfActive(annotation, targetId, viewport, renderingEngine, enabledElement);
383
385
  }
384
386
  this._renderStats(annotation, viewport, enabledElement, svgDrawingHelper);
@@ -412,6 +414,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
412
414
  updateClosedCachedStats({ viewport, points, imageData, metadata, voxelManager, cachedStats, targetId, modalityUnit, canvasCoordinates, calibratedScale, deltaInX, deltaInY, }) {
413
415
  const { areaUnit, unit } = calibratedScale;
414
416
  const indexPoints = points.map((point) => imageData.worldToIndex(point));
417
+ const dims = imageData.getDimensions();
415
418
  let iMin = Number.MAX_SAFE_INTEGER;
416
419
  let iMax = Number.MIN_SAFE_INTEGER;
417
420
  let jMin = Number.MAX_SAFE_INTEGER;
@@ -427,6 +430,12 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
427
430
  kMin = Math.min(kMin, worldPosIndex[2]);
428
431
  kMax = Math.max(kMax, worldPosIndex[2]);
429
432
  }
433
+ iMin = Math.max(0, Math.min(dims[0] - 1, iMin));
434
+ iMax = Math.max(0, Math.min(dims[0] - 1, iMax));
435
+ jMin = Math.max(0, Math.min(dims[1] - 1, jMin));
436
+ jMax = Math.max(0, Math.min(dims[1] - 1, jMax));
437
+ kMin = Math.max(0, Math.min(dims[2] - 1, kMin));
438
+ kMax = Math.max(0, Math.min(dims[2] - 1, kMax));
430
439
  [iMin, iMax] = snapIndexBounds(iMin, iMax);
431
440
  [jMin, jMax] = snapIndexBounds(jMin, jMax);
432
441
  [kMin, kMax] = snapIndexBounds(kMin, kMax);
@@ -1 +1 @@
1
- export declare const version = "5.0.10";
1
+ export declare const version = "5.0.12";
@@ -1 +1 @@
1
- export const version = '5.0.10';
1
+ export const version = '5.0.12';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "5.0.10",
3
+ "version": "5.0.12",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -108,11 +108,11 @@
108
108
  "lodash.get": "4.4.2"
109
109
  },
110
110
  "devDependencies": {
111
- "@cornerstonejs/core": "5.0.10",
111
+ "@cornerstonejs/core": "5.0.12",
112
112
  "canvas": "3.2.0"
113
113
  },
114
114
  "peerDependencies": {
115
- "@cornerstonejs/core": "5.0.10",
115
+ "@cornerstonejs/core": "5.0.12",
116
116
  "@kitware/vtk.js": "35.5.3",
117
117
  "@types/d3-array": "3.2.1",
118
118
  "@types/d3-interpolate": "3.0.4",
@@ -131,5 +131,5 @@
131
131
  "type": "individual",
132
132
  "url": "https://ohif.org/donate"
133
133
  },
134
- "gitHead": "7a0e2fd2fb15e2893e93f469d5d83ebb7e6d4f5b"
134
+ "gitHead": "53a356dd06bcc5be6eef19faf3e67d0b5cac57ac"
135
135
  }