@cornerstonejs/tools 0.67.2 → 0.67.4

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.
Files changed (43) hide show
  1. package/dist/cjs/drawingSvg/drawCircle.js +3 -1
  2. package/dist/cjs/drawingSvg/drawCircle.js.map +1 -1
  3. package/dist/cjs/tools/CrosshairsTool.js +1 -1
  4. package/dist/cjs/tools/CrosshairsTool.js.map +1 -1
  5. package/dist/cjs/tools/StackScrollToolMouseWheelTool.js +12 -12
  6. package/dist/cjs/tools/StackScrollToolMouseWheelTool.js.map +1 -1
  7. package/dist/cjs/tools/annotation/RectangleROITool.js +1 -1
  8. package/dist/cjs/tools/annotation/RectangleROITool.js.map +1 -1
  9. package/dist/cjs/tools/base/AnnotationDisplayTool.js +1 -1
  10. package/dist/cjs/tools/base/AnnotationDisplayTool.js.map +1 -1
  11. package/dist/cjs/tools/segmentation/RectangleROIStartEndThresholdTool.js +2 -2
  12. package/dist/cjs/tools/segmentation/RectangleROIStartEndThresholdTool.js.map +1 -1
  13. package/dist/cjs/tools/segmentation/RectangleROIThresholdTool.js +1 -1
  14. package/dist/cjs/tools/segmentation/RectangleROIThresholdTool.js.map +1 -1
  15. package/dist/cjs/utilities/scroll.js +8 -0
  16. package/dist/cjs/utilities/scroll.js.map +1 -1
  17. package/dist/esm/drawingSvg/drawCircle.js +3 -1
  18. package/dist/esm/drawingSvg/drawCircle.js.map +1 -1
  19. package/dist/esm/tools/CrosshairsTool.js +1 -1
  20. package/dist/esm/tools/CrosshairsTool.js.map +1 -1
  21. package/dist/esm/tools/StackScrollToolMouseWheelTool.js +10 -13
  22. package/dist/esm/tools/StackScrollToolMouseWheelTool.js.map +1 -1
  23. package/dist/esm/tools/annotation/RectangleROITool.js +1 -1
  24. package/dist/esm/tools/annotation/RectangleROITool.js.map +1 -1
  25. package/dist/esm/tools/base/AnnotationDisplayTool.js +1 -1
  26. package/dist/esm/tools/base/AnnotationDisplayTool.js.map +1 -1
  27. package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +2 -2
  28. package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js.map +1 -1
  29. package/dist/esm/tools/segmentation/RectangleROIThresholdTool.js +1 -1
  30. package/dist/esm/tools/segmentation/RectangleROIThresholdTool.js.map +1 -1
  31. package/dist/esm/utilities/scroll.js +9 -1
  32. package/dist/esm/utilities/scroll.js.map +1 -1
  33. package/dist/umd/index.js +1 -1
  34. package/dist/umd/index.js.map +1 -1
  35. package/package.json +3 -3
  36. package/src/drawingSvg/drawCircle.ts +3 -1
  37. package/src/tools/CrosshairsTool.ts +2 -2
  38. package/src/tools/StackScrollToolMouseWheelTool.ts +11 -20
  39. package/src/tools/annotation/RectangleROITool.ts +1 -1
  40. package/src/tools/base/AnnotationDisplayTool.ts +1 -2
  41. package/src/tools/segmentation/RectangleROIStartEndThresholdTool.ts +2 -4
  42. package/src/tools/segmentation/RectangleROIThresholdTool.ts +1 -2
  43. package/src/utilities/scroll.ts +15 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "0.67.2",
3
+ "version": "0.67.4",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "main": "dist/umd/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
27
27
  },
28
28
  "dependencies": {
29
- "@cornerstonejs/core": "^0.46.2",
29
+ "@cornerstonejs/core": "^0.47.1",
30
30
  "lodash.clonedeep": "4.5.0",
31
31
  "lodash.get": "^4.4.2"
32
32
  },
@@ -49,5 +49,5 @@
49
49
  "type": "individual",
50
50
  "url": "https://ohif.org/donate"
51
51
  },
52
- "gitHead": "1e5e0ec2e760c409d532f14b145f52853a9f50ec"
52
+ "gitHead": "fe634bf0a19f588638aaa21d4bcbbc8df33897b3"
53
53
  }
@@ -15,11 +15,12 @@ function drawCircle(
15
15
  options = {},
16
16
  dataId = ''
17
17
  ): void {
18
- const { color, fill, width, lineWidth } = Object.assign(
18
+ const { color, fill, width, lineWidth, lineDash } = Object.assign(
19
19
  {
20
20
  color: 'dodgerblue',
21
21
  fill: 'transparent',
22
22
  width: '2',
23
+ lineDash: undefined,
23
24
  lineWidth: undefined,
24
25
  },
25
26
  options
@@ -40,6 +41,7 @@ function drawCircle(
40
41
  stroke: color,
41
42
  fill,
42
43
  'stroke-width': strokeWidth,
44
+ 'stroke-dasharray': lineDash,
43
45
  };
44
46
 
45
47
  if (existingCircleElement) {
@@ -1793,9 +1793,9 @@ class CrosshairsTool extends AnnotationTool {
1793
1793
  for (let i = 0; i < otherViewportAnnotations.length; ++i) {
1794
1794
  const annotation = otherViewportAnnotations[i];
1795
1795
  if (
1796
- otherViewportsAnnotationsWithUniqueCameras.find(
1796
+ otherViewportsAnnotationsWithUniqueCameras.some(
1797
1797
  (element) => element === annotation
1798
- ) === true
1798
+ )
1799
1799
  ) {
1800
1800
  continue;
1801
1801
  }
@@ -1,11 +1,7 @@
1
- import {
2
- getEnabledElement,
3
- VolumeViewport,
4
- StackViewport,
5
- } from '@cornerstonejs/core';
1
+ import { getEnabledElement } from '@cornerstonejs/core';
6
2
  import { BaseTool } from './base';
7
3
  import { MouseWheelEventType } from '../types/EventTypes';
8
- import { scrollVolume } from '../utilities/scroll';
4
+ import scroll from '../utilities/scroll';
9
5
 
10
6
  /**
11
7
  * The StackScrollMouseWheelTool is a tool that allows the user to scroll through a
@@ -37,20 +33,15 @@ class StackScrollMouseWheelTool extends BaseTool {
37
33
  const { viewport } = getEnabledElement(element);
38
34
  const delta = direction * (invert ? -1 : 1);
39
35
 
40
- if (viewport instanceof StackViewport) {
41
- viewport.scroll(
42
- delta,
43
- this.configuration.debounceIfNotLoaded,
44
- this.configuration.loop
45
- );
46
- } else if (viewport instanceof VolumeViewport) {
47
- const targetId = this.getTargetId(viewport);
48
- const volumeId = targetId.split('volumeId:')[1];
49
- // TODO: add loop implemention for scroll volume.
50
- scrollVolume(viewport, volumeId, delta);
51
- } else {
52
- throw new Error('StackScrollMouseWheelTool: Unsupported viewport type');
53
- }
36
+ const targetId = this.getTargetId(viewport);
37
+ const volumeId = targetId.split('volumeId:')[1];
38
+
39
+ scroll(viewport, {
40
+ delta,
41
+ debounceLoading: this.configuration.debounceIfNotLoaded,
42
+ loop: this.configuration.loop,
43
+ volumeId,
44
+ });
54
45
  }
55
46
  }
56
47
 
@@ -653,7 +653,7 @@ class RectangleROITool extends AnnotationTool {
653
653
  // force to recalculate the stats from the points
654
654
  if (
655
655
  !data.cachedStats[targetId] ||
656
- data.cachedStats[targetId].unit === undefined
656
+ data.cachedStats[targetId].areaUnit === undefined
657
657
  ) {
658
658
  data.cachedStats[targetId] = {
659
659
  Modality: null,
@@ -189,8 +189,7 @@ abstract class AnnotationDisplayTool extends BaseTool {
189
189
  referencedImageId = utilities.getClosestImageId(
190
190
  imageVolume,
191
191
  worldPos,
192
- viewPlaneNormal,
193
- viewUp
192
+ viewPlaneNormal
194
193
  );
195
194
  }
196
195
 
@@ -109,8 +109,7 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
109
109
  referencedImageId = csUtils.getClosestImageId(
110
110
  imageVolume,
111
111
  worldPos,
112
- viewPlaneNormal,
113
- viewUp
112
+ viewPlaneNormal
114
113
  );
115
114
  }
116
115
 
@@ -257,8 +256,7 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
257
256
  const imageId = csUtils.getClosestImageId(
258
257
  imageVolume,
259
258
  RectanglePoints[0],
260
- viewPlaneNormal,
261
- metadata.viewUp
259
+ viewPlaneNormal
262
260
  );
263
261
  projectionPointsImageIds.push(imageId);
264
262
  }
@@ -95,8 +95,7 @@ class RectangleROIThresholdTool extends RectangleROITool {
95
95
  referencedImageId = csUtils.getClosestImageId(
96
96
  imageVolume,
97
97
  worldPos,
98
- viewPlaneNormal,
99
- viewUp
98
+ viewPlaneNormal
100
99
  );
101
100
  }
102
101
 
@@ -5,6 +5,7 @@ import {
5
5
  eventTarget,
6
6
  EVENTS,
7
7
  utilities as csUtils,
8
+ getEnabledElement,
8
9
  } from '@cornerstonejs/core';
9
10
  import { ScrollOptions, EventTypes } from '../types';
10
11
 
@@ -21,6 +22,20 @@ export default function scroll(
21
22
  viewport: Types.IStackViewport | Types.IVolumeViewport,
22
23
  options: ScrollOptions
23
24
  ): void {
25
+ // check if viewport is disabled then throw error
26
+ const enabledElement = getEnabledElement(viewport.element);
27
+
28
+ if (!enabledElement) {
29
+ throw new Error('Scroll::Viewport is not enabled (it might be disabled)');
30
+ }
31
+
32
+ if (
33
+ viewport instanceof StackViewport &&
34
+ viewport.getImageIds().length === 0
35
+ ) {
36
+ throw new Error('Scroll::Stack Viewport has no images');
37
+ }
38
+
24
39
  const { type: viewportType } = viewport;
25
40
  const { volumeId, delta } = options;
26
41