@cornerstonejs/tools 1.19.0 → 1.19.1
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/cjs/tools/annotation/PlanarFreehandROITool.js +14 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +14 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/tools/annotation/PlanarFreehandROITool.ts +22 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "dist/umd/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cornerstonejs/core": "^1.19.
|
|
32
|
+
"@cornerstonejs/core": "^1.19.1",
|
|
33
33
|
"lodash.clonedeep": "4.5.0",
|
|
34
34
|
"lodash.get": "^4.4.2"
|
|
35
35
|
},
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"type": "individual",
|
|
53
53
|
"url": "https://ohif.org/donate"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "5b0292ff4c77ab9472898ad24e266c01068387b7"
|
|
56
56
|
}
|
|
@@ -44,14 +44,13 @@ import {
|
|
|
44
44
|
AnnotationStyle,
|
|
45
45
|
PublicToolProps,
|
|
46
46
|
ToolProps,
|
|
47
|
-
InteractionTypes,
|
|
48
47
|
SVGDrawingHelper,
|
|
49
48
|
} from '../../types';
|
|
50
|
-
import {
|
|
49
|
+
import { drawLinkedTextBox } from '../../drawingSvg';
|
|
51
50
|
import { PlanarFreehandROIAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
52
51
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
53
52
|
import { PlanarFreehandROICommonData } from '../../utilities/math/polyline/planarFreehandROIInternalTypes';
|
|
54
|
-
|
|
53
|
+
|
|
55
54
|
import { getIntersectionCoordinatesWithPolyline } from '../../utilities/math/polyline/getIntersectionWithPolyline';
|
|
56
55
|
import pointInShapeCallback from '../../utilities/pointInShapeCallback';
|
|
57
56
|
import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScaled';
|
|
@@ -752,9 +751,28 @@ class PlanarFreehandROITool extends AnnotationTool {
|
|
|
752
751
|
|
|
753
752
|
const { imageData, metadata } = image;
|
|
754
753
|
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
754
|
+
|
|
755
|
+
// Using an arbitrary start point (canvasPoint), calculate the
|
|
756
|
+
// mm spacing for the canvas in the X and Y directions.
|
|
757
|
+
const canvasPoint = canvasCoordinates[0];
|
|
758
|
+
const originalWorldPoint = viewport.canvasToWorld(canvasPoint);
|
|
759
|
+
const deltaXPoint = viewport.canvasToWorld([
|
|
760
|
+
canvasPoint[0] + 1,
|
|
761
|
+
canvasPoint[1],
|
|
762
|
+
]);
|
|
763
|
+
const deltaYPoint = viewport.canvasToWorld([
|
|
764
|
+
canvasPoint[0],
|
|
765
|
+
canvasPoint[1] + 1,
|
|
766
|
+
]);
|
|
767
|
+
|
|
768
|
+
const deltaInX = vec3.distance(originalWorldPoint, deltaXPoint);
|
|
769
|
+
const deltaInY = vec3.distance(originalWorldPoint, deltaYPoint);
|
|
770
|
+
|
|
755
771
|
const scale = getCalibratedScale(image);
|
|
756
|
-
|
|
772
|
+
let area =
|
|
757
773
|
polyline.calculateAreaOfPoints(canvasCoordinates) / scale / scale;
|
|
774
|
+
// Convert from canvas_pixels ^2 to mm^2
|
|
775
|
+
area *= deltaInX * deltaInY;
|
|
758
776
|
|
|
759
777
|
const worldPosIndex = csUtils.transformWorldToIndex(imageData, points[0]);
|
|
760
778
|
worldPosIndex[0] = Math.floor(worldPosIndex[0]);
|