@cornerstonejs/tools 3.7.11 → 3.7.13

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.
@@ -463,8 +463,11 @@ class AngleTool extends AnnotationTool {
463
463
  angle: isNaN(angle) ? 'Incomplete Angle' : angle,
464
464
  };
465
465
  }
466
+ const invalidated = annotation.invalidated;
466
467
  annotation.invalidated = false;
467
- triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
468
+ if (invalidated) {
469
+ triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
470
+ }
468
471
  return cachedStats;
469
472
  }
470
473
  }
@@ -632,8 +632,11 @@ class BidirectionalTool extends AnnotationTool {
632
632
  widthUnit,
633
633
  };
634
634
  }
635
+ const invalidated = annotation.invalidated;
635
636
  annotation.invalidated = false;
636
- triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
637
+ if (invalidated) {
638
+ triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
639
+ }
637
640
  return cachedStats;
638
641
  };
639
642
  this._isInsideVolume = (index1, index2, index3, index4, dimensions) => {
@@ -464,6 +464,7 @@ class CircleROITool extends AnnotationTool {
464
464
  this._calculateCachedStats = (annotation, viewport, renderingEngine, enabledElement) => {
465
465
  const data = annotation.data;
466
466
  const { element } = viewport;
467
+ const wasInvalidated = annotation.invalidated;
467
468
  const { points } = data.handles;
468
469
  const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
469
470
  const { viewPlaneNormal, viewUp } = viewport.getCamera();
@@ -556,7 +557,9 @@ class CircleROITool extends AnnotationTool {
556
557
  }
557
558
  }
558
559
  annotation.invalidated = false;
559
- triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
560
+ if (wasInvalidated) {
561
+ triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
562
+ }
560
563
  return cachedStats;
561
564
  };
562
565
  this._isInsideVolume = (index1, index2, dimensions) => {
@@ -674,8 +674,11 @@ class CobbAngleTool extends AnnotationTool {
674
674
  },
675
675
  };
676
676
  }
677
+ const invalidated = annotation.invalidated;
677
678
  annotation.invalidated = false;
678
- triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
679
+ if (invalidated) {
680
+ triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
681
+ }
679
682
  return cachedStats;
680
683
  }
681
684
  }
@@ -621,8 +621,11 @@ class EllipticalROITool extends AnnotationTool {
621
621
  modalityUnit,
622
622
  };
623
623
  }
624
+ const invalidated = annotation.invalidated;
624
625
  annotation.invalidated = false;
625
- triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
626
+ if (invalidated) {
627
+ triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
628
+ }
626
629
  return cachedStats;
627
630
  };
628
631
  this._isInsideVolume = (index1, index2, dimensions) => {
@@ -1,4 +1,4 @@
1
- import { Events } from '../../enums';
1
+ import { ChangeTypes, Events } from '../../enums';
2
2
  import { getEnabledElement, utilities as csUtils } from '@cornerstonejs/core';
3
3
  import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
4
4
  import { AnnotationTool } from '../base';
@@ -413,8 +413,11 @@ class HeightTool extends AnnotationTool {
413
413
  unit,
414
414
  };
415
415
  }
416
+ const invalidated = annotation.invalidated;
416
417
  annotation.invalidated = false;
417
- triggerAnnotationModified(annotation, element);
418
+ if (invalidated) {
419
+ triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
420
+ }
418
421
  return cachedStats;
419
422
  }
420
423
  _isInsideVolume(index1, index2, dimensions) {
@@ -446,8 +446,11 @@ class LengthTool extends AnnotationTool {
446
446
  unit,
447
447
  };
448
448
  }
449
+ const invalidated = annotation.invalidated;
449
450
  annotation.invalidated = false;
450
- triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
451
+ if (invalidated) {
452
+ triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
453
+ }
451
454
  return cachedStats;
452
455
  }
453
456
  _isInsideVolume(index1, index2, dimensions) {
@@ -365,7 +365,11 @@ class LivewireContourTool extends ContourSegmentationBaseTool {
365
365
  areaUnit: areaUnit,
366
366
  };
367
367
  }
368
- this.triggerAnnotationModified(annotation, enabledElement, ChangeTypes.StatsUpdated);
368
+ const invalidated = annotation.invalidated;
369
+ annotation.invalidated = false;
370
+ if (invalidated) {
371
+ this.triggerAnnotationModified(annotation, enabledElement, ChangeTypes.StatsUpdated);
372
+ }
369
373
  return cachedStats;
370
374
  };
371
375
  this._renderStats = (annotation, viewport, svgDrawingHelper, textboxStyle) => {
@@ -191,8 +191,11 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
191
191
  });
192
192
  }
193
193
  }
194
- triggerAnnotationModified(annotation, enabledElement.viewport.element, ChangeTypes.StatsUpdated);
194
+ const invalidated = annotation.invalidated;
195
195
  annotation.invalidated = false;
196
+ if (invalidated) {
197
+ triggerAnnotationModified(annotation, enabledElement.viewport.element, ChangeTypes.StatsUpdated);
198
+ }
196
199
  return cachedStats;
197
200
  };
198
201
  this._renderStats = (annotation, viewport, enabledElement, svgDrawingHelper) => {
@@ -332,7 +332,10 @@ class ProbeTool extends AnnotationTool {
332
332
  Modality: modality,
333
333
  };
334
334
  }
335
- annotation.invalidated = false;
335
+ }
336
+ const invalidated = annotation.invalidated;
337
+ annotation.invalidated = false;
338
+ if (invalidated) {
336
339
  triggerAnnotationModified(annotation, element, changeType);
337
340
  }
338
341
  return cachedStats;
@@ -506,8 +506,11 @@ class RectangleROITool extends AnnotationTool {
506
506
  };
507
507
  }
508
508
  }
509
+ const invalidated = annotation.invalidated;
509
510
  annotation.invalidated = false;
510
- triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
511
+ if (invalidated) {
512
+ triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
513
+ }
511
514
  return cachedStats;
512
515
  };
513
516
  this._isInsideVolume = (index1, index2, dimensions) => {
@@ -479,7 +479,11 @@ class SplineROITool extends ContourSegmentationBaseTool {
479
479
  areaUnit,
480
480
  };
481
481
  }
482
- this.triggerAnnotationModified(annotation, enabledElement, ChangeTypes.StatsUpdated);
482
+ const invalidated = annotation.invalidated;
483
+ annotation.invalidated = false;
484
+ if (invalidated) {
485
+ this.triggerAnnotationModified(annotation, enabledElement, ChangeTypes.StatsUpdated);
486
+ }
483
487
  return cachedStats;
484
488
  };
485
489
  this._throttledCalculateCachedStats = throttle(this._calculateCachedStats, 100, { trailing: true });
@@ -1,4 +1,4 @@
1
- import { Events } from '../../enums';
1
+ import { ChangeTypes, Events } from '../../enums';
2
2
  import { getEnabledElement, utilities as csUtils, StackViewport, } from '@cornerstonejs/core';
3
3
  import { AnnotationTool } from '../base';
4
4
  import throttle from '../../utilities/throttle';
@@ -451,8 +451,11 @@ class UltrasoundDirectionalTool extends AnnotationTool {
451
451
  isUnitless,
452
452
  };
453
453
  }
454
+ const invalidated = annotation.invalidated;
454
455
  annotation.invalidated = false;
455
- triggerAnnotationModified(annotation, element);
456
+ if (invalidated) {
457
+ triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
458
+ }
456
459
  return cachedStats;
457
460
  }
458
461
  }
@@ -5,7 +5,7 @@ import throttle from '../../utilities/throttle';
5
5
  import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement';
6
6
  import { drawHandles as drawHandlesSvg, drawRedactionRect as drawRedactionRectSvg, } from '../../drawingSvg';
7
7
  import { state } from '../../store/state';
8
- import { Events } from '../../enums';
8
+ import { ChangeTypes, Events } from '../../enums';
9
9
  import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
10
10
  import * as rectangle from '../../utilities/math/rectangle';
11
11
  import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
@@ -379,15 +379,19 @@ class VideoRedactionTool extends AnnotationTool {
379
379
  };
380
380
  }
381
381
  }
382
- data.invalidated = false;
383
- const eventType = Events.ANNOTATION_MODIFIED;
384
- const eventDetail = {
385
- annotation,
386
- viewportUID,
387
- renderingEngineUID,
388
- sceneUID: sceneUID,
389
- };
390
- triggerEvent(eventTarget, eventType, eventDetail);
382
+ const invalidated = annotation.invalidated;
383
+ annotation.invalidated = false;
384
+ if (invalidated) {
385
+ const eventType = Events.ANNOTATION_MODIFIED;
386
+ const eventDetail = {
387
+ annotation,
388
+ viewportUID,
389
+ renderingEngineUID,
390
+ sceneUID: sceneUID,
391
+ changeType: ChangeTypes.StatsUpdated,
392
+ };
393
+ triggerEvent(eventTarget, eventType, eventDetail);
394
+ }
391
395
  return cachedStats;
392
396
  };
393
397
  this._isInsideVolume = (index1, index2, dimensions) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "3.7.11",
3
+ "version": "3.7.13",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -103,7 +103,7 @@
103
103
  "canvas": "^3.1.0"
104
104
  },
105
105
  "peerDependencies": {
106
- "@cornerstonejs/core": "^3.7.11",
106
+ "@cornerstonejs/core": "^3.7.13",
107
107
  "@kitware/vtk.js": "32.12.1",
108
108
  "@types/d3-array": "^3.0.4",
109
109
  "@types/d3-interpolate": "^3.0.1",
@@ -122,5 +122,5 @@
122
122
  "type": "individual",
123
123
  "url": "https://ohif.org/donate"
124
124
  },
125
- "gitHead": "37a11940f128fdd21a108ee80e39174f771e57fa"
125
+ "gitHead": "b6d47b75d0e92a8e258c2614c5a39a588caea1d3"
126
126
  }