@cornerstonejs/tools 2.0.0-beta.22 → 2.0.0-beta.23

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.
@@ -452,7 +452,7 @@ class SplineROITool extends ContourSegmentationBaseTool {
452
452
  const deltaInX = vec3.distance(originalWorldPoint, deltaXPoint);
453
453
  const deltaInY = vec3.distance(originalWorldPoint, deltaYPoint);
454
454
  const { imageData } = image;
455
- const { scale, areaUnits } = getCalibratedLengthUnitsAndScale(image, () => {
455
+ const { scale, areaUnit } = getCalibratedLengthUnitsAndScale(image, () => {
456
456
  const { maxX: canvasMaxX, maxY: canvasMaxY, minX: canvasMinX, minY: canvasMinY, } = math.polyline.getAABB(canvasCoordinates);
457
457
  const topLeftBBWorld = viewport.canvasToWorld([
458
458
  canvasMinX,
@@ -471,7 +471,7 @@ class SplineROITool extends ContourSegmentationBaseTool {
471
471
  cachedStats[targetId] = {
472
472
  Modality: metadata.Modality,
473
473
  area,
474
- areaUnits,
474
+ areaUnit,
475
475
  };
476
476
  }
477
477
  this.triggerAnnotationModified(annotation, enabledElement, ChangeTypes.StatsUpdated);
@@ -560,11 +560,11 @@ class SplineROITool extends ContourSegmentationBaseTool {
560
560
  });
561
561
  super.renderAnnotationInstance(renderContext);
562
562
  if (!data.cachedStats[targetId] ||
563
- data.cachedStats[targetId].areaUnits == null) {
563
+ data.cachedStats[targetId].areaUnit == null) {
564
564
  data.cachedStats[targetId] = {
565
565
  Modality: null,
566
566
  area: null,
567
- areaUnits: null,
567
+ areaUnit: null,
568
568
  };
569
569
  this._calculateCachedStats(annotation, element);
570
570
  }
@@ -715,12 +715,12 @@ class SplineROITool extends ContourSegmentationBaseTool {
715
715
  }
716
716
  function defaultGetTextLines(data, targetId) {
717
717
  const cachedVolumeStats = data.cachedStats[targetId];
718
- const { area, isEmptyArea, areaUnits } = cachedVolumeStats;
718
+ const { area, isEmptyArea, areaUnit } = cachedVolumeStats;
719
719
  const textLines = [];
720
720
  if (area) {
721
721
  const areaLine = isEmptyArea
722
722
  ? `Area: Oblique not supported`
723
- : `Area: ${utilities.roundNumber(area)} ${areaUnits}`;
723
+ : `Area: ${utilities.roundNumber(area)} ${areaUnit}`;
724
724
  textLines.push(areaLine);
725
725
  }
726
726
  return textLines;
@@ -5,7 +5,6 @@ import WindowLevelTool from './WindowLevelTool';
5
5
  import WindowLevelRegionTool from './WindowLevelRegionTool';
6
6
  import StackScrollTool from './StackScrollTool';
7
7
  import PlanarRotateTool from './PlanarRotateTool';
8
- import StackScrollMouseWheelTool from './StackScrollToolMouseWheelTool';
9
8
  import ZoomTool from './ZoomTool';
10
9
  import VolumeRotateMouseWheelTool from './VolumeRotateMouseWheelTool';
11
10
  import MIPJumpToClickTool from './MIPJumpToClickTool';
@@ -16,7 +15,6 @@ import ReferenceLinesTool from './ReferenceLinesTool';
16
15
  import OverlayGridTool from './OverlayGridTool';
17
16
  import SegmentationIntersectionTool from './SegmentationIntersectionTool';
18
17
  import ReferenceCursors from './ReferenceCursors';
19
- import ReferenceLines from './ReferenceLinesTool';
20
18
  import ScaleOverlayTool from './ScaleOverlayTool';
21
19
  import SculptorTool from './SculptorTool';
22
20
  import BidirectionalTool from './annotation/BidirectionalTool';
@@ -49,4 +47,4 @@ import BrushTool from './segmentation/BrushTool';
49
47
  import PaintFillTool from './segmentation/PaintFillTool';
50
48
  import OrientationMarkerTool from './OrientationMarkerTool';
51
49
  import SegmentSelectTool from './segmentation/SegmentSelectTool';
52
- export { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, StackScrollTool, PlanarRotateTool, StackScrollMouseWheelTool, ZoomTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, ReferenceCursors, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, BidirectionalTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, SplineROITool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, KeyImageTool, AnnotationEraserTool as EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, SplineContourSegmentationTool, BrushTool, MagnifyTool, AdvancedMagnifyTool, ReferenceLines, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, SculptorTool, SegmentSelectTool, };
50
+ export { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, StackScrollTool, PlanarRotateTool, ZoomTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, ReferenceCursors, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, BidirectionalTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, SplineROITool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, KeyImageTool, AnnotationEraserTool as EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, SplineContourSegmentationTool, BrushTool, MagnifyTool, AdvancedMagnifyTool, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, SculptorTool, SegmentSelectTool, };
@@ -5,7 +5,6 @@ import WindowLevelTool from './WindowLevelTool';
5
5
  import WindowLevelRegionTool from './WindowLevelRegionTool';
6
6
  import StackScrollTool from './StackScrollTool';
7
7
  import PlanarRotateTool from './PlanarRotateTool';
8
- import StackScrollMouseWheelTool from './StackScrollToolMouseWheelTool';
9
8
  import ZoomTool from './ZoomTool';
10
9
  import VolumeRotateMouseWheelTool from './VolumeRotateMouseWheelTool';
11
10
  import MIPJumpToClickTool from './MIPJumpToClickTool';
@@ -16,7 +15,6 @@ import ReferenceLinesTool from './ReferenceLinesTool';
16
15
  import OverlayGridTool from './OverlayGridTool';
17
16
  import SegmentationIntersectionTool from './SegmentationIntersectionTool';
18
17
  import ReferenceCursors from './ReferenceCursors';
19
- import ReferenceLines from './ReferenceLinesTool';
20
18
  import ScaleOverlayTool from './ScaleOverlayTool';
21
19
  import SculptorTool from './SculptorTool';
22
20
  import BidirectionalTool from './annotation/BidirectionalTool';
@@ -49,4 +47,4 @@ import BrushTool from './segmentation/BrushTool';
49
47
  import PaintFillTool from './segmentation/PaintFillTool';
50
48
  import OrientationMarkerTool from './OrientationMarkerTool';
51
49
  import SegmentSelectTool from './segmentation/SegmentSelectTool';
52
- export { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, StackScrollTool, PlanarRotateTool, StackScrollMouseWheelTool, ZoomTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, ReferenceCursors, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, BidirectionalTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, SplineROITool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, KeyImageTool, AnnotationEraserTool as EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, SplineContourSegmentationTool, BrushTool, MagnifyTool, AdvancedMagnifyTool, ReferenceLines, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, SculptorTool, SegmentSelectTool, };
50
+ export { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, StackScrollTool, PlanarRotateTool, ZoomTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, ReferenceCursors, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, BidirectionalTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, SplineROITool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, KeyImageTool, AnnotationEraserTool as EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, SplineContourSegmentationTool, BrushTool, MagnifyTool, AdvancedMagnifyTool, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, SculptorTool, SegmentSelectTool, };
@@ -345,7 +345,7 @@ class CircleROIStartEndThresholdTool extends CircleROITool {
345
345
  isPreScaled: isViewportPreScaled(viewport, targetId),
346
346
  isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
347
347
  };
348
- const pixelValueUnits = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
348
+ const modalityUnit = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
349
349
  for (let i = 0; i < projectionPoints.length; i++) {
350
350
  if (!imageVolume) {
351
351
  continue;
@@ -409,8 +409,8 @@ class CircleROIStartEndThresholdTool extends CircleROITool {
409
409
  stdDev: stats.stdDev?.value,
410
410
  max: stats.max?.value,
411
411
  statsArray: stats.array,
412
- areaUnits: measureInfo.areaUnits,
413
- pixelValueUnits,
412
+ areaUnit: measureInfo.areaUnit,
413
+ modalityUnit,
414
414
  };
415
415
  }
416
416
  _calculateCachedStatsTool(annotation, enabledElement) {
@@ -456,15 +456,15 @@ class CircleROIStartEndThresholdTool extends CircleROITool {
456
456
  }
457
457
  function defaultGetTextLines(data) {
458
458
  const cachedVolumeStats = data.cachedStats.statistics;
459
- const { area, mean, max, stdDev, areaUnits, pixelValueUnits } = cachedVolumeStats;
459
+ const { area, mean, max, stdDev, areaUnit, modalityUnit } = cachedVolumeStats;
460
460
  if (mean === undefined) {
461
461
  return;
462
462
  }
463
463
  const textLines = [];
464
- textLines.push(`Area: ${csUtils.roundNumber(area)} ${areaUnits}`);
465
- textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${pixelValueUnits}`);
466
- textLines.push(`Max: ${csUtils.roundNumber(max)} ${pixelValueUnits}`);
467
- textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${pixelValueUnits}`);
464
+ textLines.push(`Area: ${csUtils.roundNumber(area)} ${areaUnit}`);
465
+ textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
466
+ textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
467
+ textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
468
468
  return textLines;
469
469
  }
470
470
  CircleROIStartEndThresholdTool.toolName = 'CircleROIStartEndThreshold';
@@ -316,7 +316,7 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
316
316
  isPreScaled: isViewportPreScaled(viewport, targetId),
317
317
  isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
318
318
  };
319
- const pixelValueUnits = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
319
+ const modalityUnit = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
320
320
  for (let i = 0; i < projectionPoints.length; i++) {
321
321
  if (!imageVolume) {
322
322
  continue;
@@ -367,8 +367,8 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
367
367
  stdDev: stats.stdDev?.value,
368
368
  max: stats.max?.value,
369
369
  statsArray: stats.array,
370
- areaUnits: measureInfo.areaUnits,
371
- pixelValueUnits,
370
+ areaUnit: measureInfo.areaUnit,
371
+ modalityUnit,
372
372
  };
373
373
  }
374
374
  _calculateCachedStatsTool(annotation, enabledElement) {
@@ -410,15 +410,15 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
410
410
  }
411
411
  function defaultGetTextLines(data) {
412
412
  const cachedVolumeStats = data.cachedStats.statistics;
413
- const { area, mean, max, stdDev, areaUnits, pixelValueUnits } = cachedVolumeStats;
413
+ const { area, mean, max, stdDev, areaUnit, modalityUnit } = cachedVolumeStats;
414
414
  if (mean === undefined) {
415
415
  return;
416
416
  }
417
417
  const textLines = [];
418
- textLines.push(`Area: ${csUtils.roundNumber(area)} ${areaUnits}`);
419
- textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${pixelValueUnits}`);
420
- textLines.push(`Max: ${csUtils.roundNumber(max)} ${pixelValueUnits}`);
421
- textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${pixelValueUnits}`);
418
+ textLines.push(`Area: ${csUtils.roundNumber(area)} ${areaUnit}`);
419
+ textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
420
+ textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
421
+ textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
422
422
  return textLines;
423
423
  }
424
424
  RectangleROIStartEndThresholdTool.toolName = 'RectangleROIStartEndThreshold';
@@ -7,7 +7,7 @@ export interface ROICachedStats {
7
7
  [targetId: string]: {
8
8
  Modality: string;
9
9
  area: number;
10
- areaUnits: string;
10
+ areaUnit: string;
11
11
  max: number;
12
12
  mean: number;
13
13
  stdDev: number;
@@ -130,7 +130,7 @@ export type SplineROIAnnotation = ContourAnnotation & {
130
130
  [targetId: string]: {
131
131
  Modality: string;
132
132
  area: number;
133
- areaUnits: string;
133
+ areaUnit: string;
134
134
  };
135
135
  };
136
136
  };
@@ -1,6 +1,6 @@
1
1
  declare const getCalibratedLengthUnitsAndScale: (image: any, handles: any) => {
2
- lengthUnits: string;
3
- areaUnits: string;
2
+ unit: string;
3
+ areaUnit: string;
4
4
  scale: number;
5
5
  };
6
6
  declare const getCalibratedProbeUnitsAndValue: (image: any, handles: any) => {
@@ -27,16 +27,16 @@ const EPS = 1e-3;
27
27
  const SQUARE = '\xb2';
28
28
  const getCalibratedLengthUnitsAndScale = (image, handles) => {
29
29
  const { calibration, hasPixelSpacing } = image;
30
- let lengthUnits = hasPixelSpacing ? 'mm' : PIXEL_UNITS;
31
- let areaUnits = lengthUnits + SQUARE;
30
+ let unit = hasPixelSpacing ? 'mm' : PIXEL_UNITS;
31
+ let areaUnit = unit + SQUARE;
32
32
  let scale = 1;
33
33
  let calibrationType = '';
34
34
  if (!calibration ||
35
35
  (!calibration.type && !calibration.sequenceOfUltrasoundRegions)) {
36
- return { lengthUnits, areaUnits, scale };
36
+ return { unit, areaUnit, scale };
37
37
  }
38
38
  if (calibration.type === CalibrationTypes.UNCALIBRATED) {
39
- return { lengthUnits: PIXEL_UNITS, areaUnits: PIXEL_UNITS + SQUARE, scale };
39
+ return { unit: PIXEL_UNITS, areaUnit: PIXEL_UNITS + SQUARE, scale };
40
40
  }
41
41
  if (calibration.sequenceOfUltrasoundRegions) {
42
42
  let imageIndex1, imageIndex2;
@@ -57,14 +57,14 @@ const getCalibratedLengthUnitsAndScale = (image, handles) => {
57
57
  imageIndex2[1] >= region.regionLocationMinY0 &&
58
58
  imageIndex2[1] <= region.regionLocationMaxY1);
59
59
  if (!regions?.length) {
60
- return { lengthUnits, areaUnits, scale };
60
+ return { unit, areaUnit, scale };
61
61
  }
62
62
  regions = regions.filter((region) => SUPPORTED_REGION_DATA_TYPES.includes(region.regionDataType) &&
63
63
  SUPPORTED_LENGTH_VARIANT.includes(`${region.physicalUnitsXDirection},${region.physicalUnitsYDirection}`));
64
64
  if (!regions.length) {
65
65
  return {
66
- lengthUnits: PIXEL_UNITS,
67
- areaUnits: PIXEL_UNITS + SQUARE,
66
+ unit: PIXEL_UNITS,
67
+ areaUnit: PIXEL_UNITS + SQUARE,
68
68
  scale,
69
69
  };
70
70
  }
@@ -75,13 +75,13 @@ const getCalibratedLengthUnitsAndScale = (image, handles) => {
75
75
  if (isSamePhysicalDelta) {
76
76
  scale = 1 / physicalDeltaX;
77
77
  calibrationType = 'US Region';
78
- lengthUnits = UNIT_MAPPING[region.physicalUnitsXDirection] || 'unknown';
79
- areaUnits = lengthUnits + SQUARE;
78
+ unit = UNIT_MAPPING[region.physicalUnitsXDirection] || 'unknown';
79
+ areaUnit = unit + SQUARE;
80
80
  }
81
81
  else {
82
82
  return {
83
- lengthUnits: PIXEL_UNITS,
84
- areaUnits: PIXEL_UNITS + SQUARE,
83
+ unit: PIXEL_UNITS,
84
+ areaUnit: PIXEL_UNITS + SQUARE,
85
85
  scale,
86
86
  };
87
87
  }
@@ -99,8 +99,8 @@ const getCalibratedLengthUnitsAndScale = (image, handles) => {
99
99
  calibrationType = calibration.type;
100
100
  }
101
101
  return {
102
- lengthUnits: lengthUnits + (calibrationType ? ` ${calibrationType}` : ''),
103
- areaUnits: areaUnits + (calibrationType ? ` ${calibrationType}` : ''),
102
+ unit: unit + (calibrationType ? ` ${calibrationType}` : ''),
103
+ areaUnit: areaUnit + (calibrationType ? ` ${calibrationType}` : ''),
104
104
  scale,
105
105
  };
106
106
  };