@cornerstonejs/tools 4.15.26 → 4.15.27
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.
|
@@ -13,7 +13,12 @@ export default function mouseDownActivate(evt) {
|
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
if (activeTool.addNewAnnotation) {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
try {
|
|
17
|
+
const annotation = activeTool.addNewAnnotation(evt, 'mouse');
|
|
18
|
+
setAnnotationSelected(annotation.annotationUID);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.warn('Error adding new annotation, viewport not ready:', error);
|
|
22
|
+
}
|
|
18
23
|
}
|
|
19
24
|
}
|
|
@@ -492,12 +492,14 @@ class CircleROITool extends AnnotationTool {
|
|
|
492
492
|
const targetId = targetIds[i];
|
|
493
493
|
const image = this.getTargetImageData(targetId);
|
|
494
494
|
if (!image) {
|
|
495
|
+
console.warn('image not found for stats:', targetId);
|
|
496
|
+
delete cachedStats[targetId];
|
|
495
497
|
continue;
|
|
496
498
|
}
|
|
497
499
|
const { dimensions, imageData, metadata, voxelManager } = image;
|
|
498
500
|
const handles = points.map((point) => imageData.worldToIndex(point));
|
|
499
501
|
const calibrate = getCalibratedLengthUnitsAndScale(image, handles);
|
|
500
|
-
const radius = CircleROITool.calculateLengthInIndex(calibrate, handles);
|
|
502
|
+
const radius = CircleROITool.calculateLengthInIndex(calibrate, handles.slice(0, 2));
|
|
501
503
|
const area = Math.PI * radius * radius;
|
|
502
504
|
const perimeter = 2 * Math.PI * radius;
|
|
503
505
|
const isEmptyArea = radius === 0;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AnnotationTool } from '../base';
|
|
2
2
|
import { getEnabledElement, VolumeViewport, utilities as csUtils, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
3
|
+
import { vec3 } from 'gl-matrix';
|
|
3
4
|
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
4
5
|
import throttle from '../../utilities/throttle';
|
|
5
6
|
import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement';
|
|
@@ -12,7 +13,6 @@ import { ChangeTypes, Events } from '../../enums';
|
|
|
12
13
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
13
14
|
import * as rectangle from '../../utilities/math/rectangle';
|
|
14
15
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
15
|
-
import getWorldWidthAndHeightFromCorners from '../../utilities/planar/getWorldWidthAndHeightFromCorners';
|
|
16
16
|
import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
|
|
17
17
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
18
18
|
import { getPixelValueUnits } from '../../utilities/getPixelValueUnits';
|
|
@@ -448,8 +448,7 @@ class RectangleROITool extends AnnotationTool {
|
|
|
448
448
|
const { data } = annotation;
|
|
449
449
|
const { viewport } = enabledElement;
|
|
450
450
|
const { element } = viewport;
|
|
451
|
-
const
|
|
452
|
-
const worldPos2 = data.handles.points[3];
|
|
451
|
+
const worldHandles = data.handles.points;
|
|
453
452
|
const { cachedStats } = data;
|
|
454
453
|
const targetIds = Object.keys(cachedStats);
|
|
455
454
|
for (let i = 0; i < targetIds.length; i++) {
|
|
@@ -459,14 +458,9 @@ class RectangleROITool extends AnnotationTool {
|
|
|
459
458
|
continue;
|
|
460
459
|
}
|
|
461
460
|
const { dimensions, imageData, metadata, voxelManager } = image;
|
|
462
|
-
const
|
|
463
|
-
pos1Index[0]
|
|
464
|
-
|
|
465
|
-
pos1Index[2] = Math.floor(pos1Index[2]);
|
|
466
|
-
const pos2Index = transformWorldToIndex(imageData, worldPos2);
|
|
467
|
-
pos2Index[0] = Math.floor(pos2Index[0]);
|
|
468
|
-
pos2Index[1] = Math.floor(pos2Index[1]);
|
|
469
|
-
pos2Index[2] = Math.floor(pos2Index[2]);
|
|
461
|
+
const indexHandles = worldHandles.map((worldHandle) => transformWorldToIndex(imageData, worldHandle));
|
|
462
|
+
const pos1Index = indexHandles[0].map(Math.floor);
|
|
463
|
+
const pos2Index = indexHandles[3].map(Math.floor);
|
|
470
464
|
if (this._isInsideVolume(pos1Index, pos2Index, dimensions)) {
|
|
471
465
|
this.isHandleOutsideImage = false;
|
|
472
466
|
const iMin = Math.min(pos1Index[0], pos2Index[0]);
|
|
@@ -480,10 +474,12 @@ class RectangleROITool extends AnnotationTool {
|
|
|
480
474
|
[jMin, jMax],
|
|
481
475
|
[kMin, kMax],
|
|
482
476
|
];
|
|
483
|
-
const { worldWidth, worldHeight } = getWorldWidthAndHeightFromCorners(viewPlaneNormal, viewUp, worldPos1, worldPos2);
|
|
484
477
|
const handles = [pos1Index, pos2Index];
|
|
485
|
-
const
|
|
486
|
-
const
|
|
478
|
+
const calibrate = getCalibratedLengthUnitsAndScale(image, handles);
|
|
479
|
+
const width = RectangleROITool.calculateLengthInIndex(calibrate, indexHandles.slice(0, 2));
|
|
480
|
+
const height = RectangleROITool.calculateLengthInIndex(calibrate, indexHandles.slice(2, 4));
|
|
481
|
+
const area = Math.abs(width * height);
|
|
482
|
+
const { areaUnit } = calibrate;
|
|
487
483
|
const pixelUnitsOptions = {
|
|
488
484
|
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
489
485
|
isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.15.
|
|
1
|
+
export declare const version = "4.15.27";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '4.15.
|
|
1
|
+
export const version = '4.15.27';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.27",
|
|
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.15.
|
|
111
|
+
"@cornerstonejs/core": "4.15.27",
|
|
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": "af3578dd13210050d2f9c309f69483deb1f67168"
|
|
131
131
|
}
|