@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.
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/stateManagement/index.d.ts +2 -0
- package/dist/esm/stateManagement/index.js +2 -2
- package/dist/esm/tools/annotation/BidirectionalTool.js +6 -6
- package/dist/esm/tools/annotation/CircleROITool.js +12 -12
- package/dist/esm/tools/annotation/DragProbeTool.js +2 -2
- package/dist/esm/tools/annotation/EllipticalROITool.js +11 -11
- package/dist/esm/tools/annotation/HeightTool.js +4 -4
- package/dist/esm/tools/annotation/LengthTool.js +4 -4
- package/dist/esm/tools/annotation/PlanarFreehandROITool.d.ts +4 -4
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +19 -19
- package/dist/esm/tools/annotation/ProbeTool.js +8 -8
- package/dist/esm/tools/annotation/RectangleROITool.js +11 -11
- package/dist/esm/tools/annotation/SplineROITool.js +6 -6
- package/dist/esm/tools/index.d.ts +1 -3
- package/dist/esm/tools/index.js +1 -3
- package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.js +8 -8
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +8 -8
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +2 -2
- package/dist/esm/utilities/getCalibratedUnits.d.ts +2 -2
- package/dist/esm/utilities/getCalibratedUnits.js +13 -13
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/esm/tools/StackScrollToolMouseWheelTool.d.ts +0 -16
- package/dist/esm/tools/StackScrollToolMouseWheelTool.js +0 -33
|
@@ -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,
|
|
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
|
-
|
|
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].
|
|
563
|
+
data.cachedStats[targetId].areaUnit == null) {
|
|
564
564
|
data.cachedStats[targetId] = {
|
|
565
565
|
Modality: null,
|
|
566
566
|
area: null,
|
|
567
|
-
|
|
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,
|
|
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)} ${
|
|
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,
|
|
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, };
|
package/dist/esm/tools/index.js
CHANGED
|
@@ -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,
|
|
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
|
|
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
|
-
|
|
413
|
-
|
|
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,
|
|
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)} ${
|
|
465
|
-
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${
|
|
466
|
-
textLines.push(`Max: ${csUtils.roundNumber(max)} ${
|
|
467
|
-
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${
|
|
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
|
|
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
|
-
|
|
371
|
-
|
|
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,
|
|
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)} ${
|
|
419
|
-
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${
|
|
420
|
-
textLines.push(`Max: ${csUtils.roundNumber(max)} ${
|
|
421
|
-
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${
|
|
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
|
-
|
|
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
|
-
|
|
133
|
+
areaUnit: string;
|
|
134
134
|
};
|
|
135
135
|
};
|
|
136
136
|
};
|
|
@@ -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
|
|
31
|
-
let
|
|
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 {
|
|
36
|
+
return { unit, areaUnit, scale };
|
|
37
37
|
}
|
|
38
38
|
if (calibration.type === CalibrationTypes.UNCALIBRATED) {
|
|
39
|
-
return {
|
|
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 {
|
|
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
|
-
|
|
67
|
-
|
|
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
|
-
|
|
79
|
-
|
|
78
|
+
unit = UNIT_MAPPING[region.physicalUnitsXDirection] || 'unknown';
|
|
79
|
+
areaUnit = unit + SQUARE;
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
82
|
return {
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
103
|
-
|
|
102
|
+
unit: unit + (calibrationType ? ` ${calibrationType}` : ''),
|
|
103
|
+
areaUnit: areaUnit + (calibrationType ? ` ${calibrationType}` : ''),
|
|
104
104
|
scale,
|
|
105
105
|
};
|
|
106
106
|
};
|