@cornerstonejs/tools 4.12.3 → 4.12.5
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/enums/MeasurementType.d.ts +6 -0
- package/dist/esm/enums/MeasurementType.js +7 -0
- package/dist/esm/enums/index.d.ts +1 -0
- package/dist/esm/enums/index.js +1 -0
- package/dist/esm/tools/SculptorTool/CircleSculptCursor.d.ts +8 -10
- package/dist/esm/tools/SculptorTool/CircleSculptCursor.js +33 -133
- package/dist/esm/tools/SculptorTool.d.ts +20 -5
- package/dist/esm/tools/SculptorTool.js +243 -52
- package/dist/esm/tools/annotation/BidirectionalTool.d.ts +0 -2
- package/dist/esm/tools/annotation/BidirectionalTool.js +24 -28
- package/dist/esm/tools/annotation/CircleROITool.d.ts +1 -2
- package/dist/esm/tools/annotation/CircleROITool.js +51 -44
- package/dist/esm/tools/annotation/EllipticalROITool.js +1 -1
- package/dist/esm/tools/annotation/LengthTool.d.ts +0 -2
- package/dist/esm/tools/annotation/LengthTool.js +13 -25
- package/dist/esm/tools/annotation/PlanarFreehandROITool.d.ts +2 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +70 -68
- package/dist/esm/tools/base/BaseTool.d.ts +4 -2
- package/dist/esm/tools/base/BaseTool.js +38 -11
- package/dist/esm/tools/segmentation/BrushTool.js +9 -0
- package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.js +4 -1
- package/dist/esm/types/CalculatorTypes.d.ts +4 -3
- package/dist/esm/types/ISculptToolShape.d.ts +6 -4
- package/dist/esm/utilities/contours/index.d.ts +1 -2
- package/dist/esm/utilities/contours/index.js +1 -2
- package/dist/esm/utilities/getCalibratedUnits.d.ts +2 -0
- package/dist/esm/utilities/getCalibratedUnits.js +32 -63
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -3
- package/dist/esm/utilities/contours/calculatePerimeter.d.ts +0 -2
- package/dist/esm/utilities/contours/calculatePerimeter.js +0 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Enums
|
|
1
|
+
import { Enums } from '@cornerstonejs/core';
|
|
2
2
|
const { CalibrationTypes } = Enums;
|
|
3
3
|
const PIXEL_UNITS = 'px';
|
|
4
4
|
const VOXEL_UNITS = 'voxels';
|
|
@@ -8,10 +8,6 @@ const SUPPORTED_REGION_DATA_TYPES = [
|
|
|
8
8
|
3,
|
|
9
9
|
4,
|
|
10
10
|
];
|
|
11
|
-
const SUPPORTED_LENGTH_VARIANT = [
|
|
12
|
-
'3,3',
|
|
13
|
-
'4,7',
|
|
14
|
-
];
|
|
15
11
|
const SUPPORTED_PROBE_VARIANT = [
|
|
16
12
|
'4,3',
|
|
17
13
|
'4,7',
|
|
@@ -31,94 +27,67 @@ const UNIT_MAPPING = {
|
|
|
31
27
|
};
|
|
32
28
|
const EPS = 1e-3;
|
|
33
29
|
const SQUARE = '\xb2';
|
|
30
|
+
const types = [
|
|
31
|
+
CalibrationTypes.ERMF,
|
|
32
|
+
CalibrationTypes.USER,
|
|
33
|
+
CalibrationTypes.ERROR,
|
|
34
|
+
CalibrationTypes.PROJECTION,
|
|
35
|
+
CalibrationTypes.CALIBRATED,
|
|
36
|
+
CalibrationTypes.UNKNOWN,
|
|
37
|
+
];
|
|
34
38
|
const getCalibratedLengthUnitsAndScale = (image, handles) => {
|
|
35
|
-
const { calibration, hasPixelSpacing } = image;
|
|
39
|
+
const { calibration, hasPixelSpacing, spacing = [1, 1, 1] } = image;
|
|
36
40
|
let unit = hasPixelSpacing ? 'mm' : PIXEL_UNITS;
|
|
37
41
|
const volumeUnit = hasPixelSpacing ? 'mm\xb3' : VOXEL_UNITS;
|
|
38
42
|
let areaUnit = unit + SQUARE;
|
|
39
|
-
|
|
43
|
+
const baseScale = calibration?.scale || 1;
|
|
44
|
+
let scale = baseScale / (calibration?.columnPixelSpacing || spacing[0]);
|
|
45
|
+
let scaleY = baseScale / (calibration?.rowPixelSpacing || spacing[1]);
|
|
46
|
+
let scaleZ = baseScale / spacing[2];
|
|
40
47
|
let calibrationType = '';
|
|
41
48
|
if (!calibration ||
|
|
42
49
|
(!calibration.type && !calibration.sequenceOfUltrasoundRegions)) {
|
|
43
|
-
return { unit, areaUnit, scale, volumeUnit };
|
|
50
|
+
return { unit, areaUnit, scale, scaleY, scaleZ, volumeUnit };
|
|
51
|
+
}
|
|
52
|
+
if (types.includes(calibration?.type)) {
|
|
53
|
+
calibrationType = calibration.type;
|
|
44
54
|
}
|
|
45
55
|
if (calibration.type === CalibrationTypes.UNCALIBRATED) {
|
|
46
56
|
return {
|
|
47
57
|
unit: PIXEL_UNITS,
|
|
48
58
|
areaUnit: PIXEL_UNITS + SQUARE,
|
|
49
59
|
scale,
|
|
60
|
+
scaleY,
|
|
61
|
+
scaleZ,
|
|
50
62
|
volumeUnit: VOXEL_UNITS,
|
|
51
63
|
};
|
|
52
64
|
}
|
|
53
65
|
if (calibration.sequenceOfUltrasoundRegions) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
[
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
let regions = calibration.sequenceOfUltrasoundRegions.filter((region) => imageIndex1[0] >= region.regionLocationMinX0 &&
|
|
64
|
-
imageIndex1[0] <= region.regionLocationMaxX1 &&
|
|
65
|
-
imageIndex1[1] >= region.regionLocationMinY0 &&
|
|
66
|
-
imageIndex1[1] <= region.regionLocationMaxY1 &&
|
|
67
|
-
imageIndex2[0] >= region.regionLocationMinX0 &&
|
|
68
|
-
imageIndex2[0] <= region.regionLocationMaxX1 &&
|
|
69
|
-
imageIndex2[1] >= region.regionLocationMinY0 &&
|
|
70
|
-
imageIndex2[1] <= region.regionLocationMaxY1);
|
|
71
|
-
if (!regions?.length) {
|
|
72
|
-
return { unit, areaUnit, scale, volumeUnit };
|
|
73
|
-
}
|
|
74
|
-
regions = regions.filter((region) => SUPPORTED_REGION_DATA_TYPES.includes(region.regionDataType) &&
|
|
75
|
-
SUPPORTED_LENGTH_VARIANT.includes(`${region.physicalUnitsXDirection},${region.physicalUnitsYDirection}`));
|
|
76
|
-
if (!regions.length) {
|
|
77
|
-
return {
|
|
78
|
-
unit: PIXEL_UNITS,
|
|
79
|
-
areaUnit: PIXEL_UNITS + SQUARE,
|
|
80
|
-
scale,
|
|
81
|
-
volumeUnit: VOXEL_UNITS,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
const region = regions[0];
|
|
85
|
-
const physicalDeltaX = Math.abs(region.physicalDeltaX);
|
|
86
|
-
const physicalDeltaY = Math.abs(region.physicalDeltaY);
|
|
87
|
-
const isSamePhysicalDelta = utilities.isEqual(physicalDeltaX, physicalDeltaY, EPS);
|
|
88
|
-
if (isSamePhysicalDelta) {
|
|
66
|
+
const region = calibration.sequenceOfUltrasoundRegions.find((region) => handles.every((handle) => handle[0] >= region.regionLocationMinX0 &&
|
|
67
|
+
handle[0] <= region.regionLocationMaxX1 &&
|
|
68
|
+
handle[1] >= region.regionLocationMinY0 &&
|
|
69
|
+
handle[1] <= region.regionLocationMaxY1) && SUPPORTED_REGION_DATA_TYPES.includes(region.regionDataType));
|
|
70
|
+
if (region &&
|
|
71
|
+
region.physicalUnitsXDirection === region.physicalUnitsYDirection) {
|
|
72
|
+
const physicalDeltaX = Math.abs(region.physicalDeltaX);
|
|
73
|
+
const physicalDeltaY = Math.abs(region.physicalDeltaY);
|
|
89
74
|
scale = 1 / physicalDeltaX;
|
|
75
|
+
scaleY = 1 / physicalDeltaY;
|
|
90
76
|
calibrationType = 'US Region';
|
|
91
77
|
unit = UNIT_MAPPING[region.physicalUnitsXDirection] || 'unknown';
|
|
92
78
|
areaUnit = unit + SQUARE;
|
|
93
79
|
}
|
|
94
|
-
else {
|
|
95
|
-
return {
|
|
96
|
-
unit: PIXEL_UNITS,
|
|
97
|
-
areaUnit: PIXEL_UNITS + SQUARE,
|
|
98
|
-
scale,
|
|
99
|
-
volumeUnit: VOXEL_UNITS,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
80
|
}
|
|
103
81
|
else if (calibration.scale) {
|
|
104
82
|
scale = calibration.scale;
|
|
105
83
|
}
|
|
106
|
-
const types = [
|
|
107
|
-
CalibrationTypes.ERMF,
|
|
108
|
-
CalibrationTypes.USER,
|
|
109
|
-
CalibrationTypes.ERROR,
|
|
110
|
-
CalibrationTypes.PROJECTION,
|
|
111
|
-
CalibrationTypes.CALIBRATED,
|
|
112
|
-
CalibrationTypes.UNKNOWN,
|
|
113
|
-
];
|
|
114
|
-
if (types.includes(calibration?.type)) {
|
|
115
|
-
calibrationType = calibration.type;
|
|
116
|
-
}
|
|
117
84
|
return {
|
|
118
85
|
unit: unit + (calibrationType ? ` ${calibrationType}` : ''),
|
|
119
86
|
areaUnit: areaUnit + (calibrationType ? ` ${calibrationType}` : ''),
|
|
120
|
-
scale,
|
|
121
87
|
volumeUnit: volumeUnit + (calibrationType ? ` ${calibrationType}` : ''),
|
|
88
|
+
scale,
|
|
89
|
+
scaleY,
|
|
90
|
+
scaleZ,
|
|
122
91
|
};
|
|
123
92
|
};
|
|
124
93
|
const getCalibratedProbeUnitsAndValue = (image, handles) => {
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.12.
|
|
1
|
+
export declare const version = "4.12.5";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '4.12.
|
|
1
|
+
export const version = '4.12.5';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.5",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"canvas": "3.2.0"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
|
-
"@cornerstonejs/core": "4.12.
|
|
111
|
+
"@cornerstonejs/core": "4.12.5",
|
|
112
112
|
"@kitware/vtk.js": "34.15.1",
|
|
113
113
|
"@types/d3-array": "3.2.1",
|
|
114
114
|
"@types/d3-interpolate": "3.0.4",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"type": "individual",
|
|
128
128
|
"url": "https://ohif.org/donate"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "97cc5eed916981c859c091556e6c4e36a139b281"
|
|
131
131
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { vec3 } from 'gl-matrix';
|
|
2
|
-
export function calculatePerimeter(polyline, closed) {
|
|
3
|
-
let perimeter = 0;
|
|
4
|
-
for (let i = 0; i < polyline.length - 1; i++) {
|
|
5
|
-
const point1 = polyline[i];
|
|
6
|
-
const point2 = polyline[i + 1];
|
|
7
|
-
perimeter += vec3.dist(point1, point2);
|
|
8
|
-
}
|
|
9
|
-
if (closed) {
|
|
10
|
-
const firstPoint = polyline[0];
|
|
11
|
-
const lastPoint = polyline[polyline.length - 1];
|
|
12
|
-
perimeter += vec3.dist(firstPoint, lastPoint);
|
|
13
|
-
}
|
|
14
|
-
return perimeter;
|
|
15
|
-
}
|
|
16
|
-
export default calculatePerimeter;
|