@cornerstonejs/tools 4.17.5 → 4.18.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/esm/tools/annotation/ProbeTool.js +14 -5
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js +4 -3
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js +4 -4
- package/dist/esm/utilities/getCalibratedUnits.js +24 -5
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -3
|
@@ -298,31 +298,40 @@ class ProbeTool extends AnnotationTool {
|
|
|
298
298
|
continue;
|
|
299
299
|
}
|
|
300
300
|
const { dimensions, imageData, metadata, voxelManager } = image;
|
|
301
|
-
const modality = metadata
|
|
301
|
+
const modality = metadata?.Modality;
|
|
302
302
|
let ijk = transformWorldToIndex(imageData, worldPos);
|
|
303
303
|
ijk = vec3.round(ijk, ijk);
|
|
304
304
|
if (csUtils.indexWithinDimensions(ijk, dimensions)) {
|
|
305
305
|
this.isHandleOutsideImage = false;
|
|
306
|
-
|
|
307
|
-
if (targetId.startsWith('imageId:')) {
|
|
306
|
+
if (targetId.startsWith('imageId:') && modality !== 'ECG') {
|
|
308
307
|
const imageId = targetId.split('imageId:')[1];
|
|
309
308
|
const imageURI = csUtils.imageIdToURI(imageId);
|
|
310
309
|
const viewports = csUtils.getViewportsWithImageURI(imageURI);
|
|
311
310
|
const viewport = viewports[0];
|
|
312
311
|
ijk[2] = viewport.getCurrentImageIdIndex();
|
|
313
312
|
}
|
|
313
|
+
let value;
|
|
314
314
|
let modalityUnit;
|
|
315
|
-
if (modality === '
|
|
315
|
+
if (modality === 'ECG') {
|
|
316
316
|
const calibratedResults = getCalibratedProbeUnitsAndValue(image, [
|
|
317
317
|
ijk,
|
|
318
318
|
]);
|
|
319
|
-
|
|
319
|
+
value = calibratedResults.values;
|
|
320
|
+
modalityUnit = calibratedResults.units;
|
|
321
|
+
}
|
|
322
|
+
else if (modality === 'US') {
|
|
323
|
+
value = voxelManager?.getAtIJKPoint(ijk);
|
|
324
|
+
const calibratedResults = getCalibratedProbeUnitsAndValue(image, [
|
|
325
|
+
ijk,
|
|
326
|
+
]);
|
|
327
|
+
const hasEnhancedRegionValues = calibratedResults.values.every((v) => v !== null);
|
|
320
328
|
value = (hasEnhancedRegionValues ? calibratedResults.values : value);
|
|
321
329
|
modalityUnit = hasEnhancedRegionValues
|
|
322
330
|
? calibratedResults.units
|
|
323
331
|
: 'raw';
|
|
324
332
|
}
|
|
325
333
|
else {
|
|
334
|
+
value = voxelManager?.getAtIJKPoint(ijk);
|
|
326
335
|
modalityUnit = getPixelValueUnits(modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
|
|
327
336
|
}
|
|
328
337
|
cachedStats[targetId] = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChangeTypes, Events } from '../../enums';
|
|
2
|
-
import { getEnabledElement, utilities as csUtils, StackViewport, } from '@cornerstonejs/core';
|
|
2
|
+
import { getEnabledElement, utilities as csUtils, StackViewport, ECGViewport, } from '@cornerstonejs/core';
|
|
3
3
|
import { AnnotationTool } from '../base';
|
|
4
4
|
import throttle from '../../utilities/throttle';
|
|
5
5
|
import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement/annotation/annotationState';
|
|
@@ -35,8 +35,9 @@ class UltrasoundDirectionalTool extends AnnotationTool {
|
|
|
35
35
|
const worldPos = currentPoints.world;
|
|
36
36
|
const enabledElement = getEnabledElement(element);
|
|
37
37
|
const { viewport } = enabledElement;
|
|
38
|
-
if (!(viewport instanceof StackViewport)
|
|
39
|
-
|
|
38
|
+
if (!(viewport instanceof StackViewport) &&
|
|
39
|
+
!(viewport instanceof ECGViewport)) {
|
|
40
|
+
throw new Error('UltrasoundDirectionalTool can only be used on a StackViewport or ECGViewport');
|
|
40
41
|
}
|
|
41
42
|
hideElementCursor(element);
|
|
42
43
|
this.isDrawing = true;
|
|
@@ -131,7 +131,7 @@ function completeDrawClosedContour(element, options) {
|
|
|
131
131
|
if (this.haltDrawing(element, canvasPoints)) {
|
|
132
132
|
return false;
|
|
133
133
|
}
|
|
134
|
-
const { annotation, viewportIdsToRender } = this.commonData;
|
|
134
|
+
const { annotation, viewportIdsToRender, movingTextBox } = this.commonData;
|
|
135
135
|
const enabledElement = getEnabledElement(element);
|
|
136
136
|
const { viewport } = enabledElement;
|
|
137
137
|
addCanvasPointsToArray(element, canvasPoints, canvasPoints[0], this.commonData);
|
|
@@ -145,7 +145,7 @@ function completeDrawClosedContour(element, options) {
|
|
|
145
145
|
targetWindingDirection: ContourWindingDirection.Clockwise,
|
|
146
146
|
}, viewport);
|
|
147
147
|
const { textBox } = annotation.data.handles;
|
|
148
|
-
if (!textBox?.hasMoved) {
|
|
148
|
+
if (!textBox?.hasMoved && !movingTextBox) {
|
|
149
149
|
triggerContourAnnotationCompleted(annotation, contourHoleProcessingEnabled);
|
|
150
150
|
}
|
|
151
151
|
this.isDrawing = false;
|
|
@@ -177,7 +177,7 @@ function completeDrawOpenContour(element, options) {
|
|
|
177
177
|
if (this.haltDrawing(element, canvasPoints)) {
|
|
178
178
|
return false;
|
|
179
179
|
}
|
|
180
|
-
const { annotation, viewportIdsToRender } = this.commonData;
|
|
180
|
+
const { annotation, viewportIdsToRender, movingTextBox } = this.commonData;
|
|
181
181
|
const enabledElement = getEnabledElement(element);
|
|
182
182
|
const { viewport } = enabledElement;
|
|
183
183
|
const updatedPoints = shouldSmooth(this.configuration, annotation)
|
|
@@ -200,7 +200,7 @@ function completeDrawOpenContour(element, options) {
|
|
|
200
200
|
if (annotation.data.isOpenUShapeContour) {
|
|
201
201
|
annotation.data.openUShapeContourVectorToPeak = resolveVectorToPeak(canvasPoints, viewport, annotation.data.isOpenUShapeContour);
|
|
202
202
|
}
|
|
203
|
-
if (!textBox.hasMoved) {
|
|
203
|
+
if (!textBox.hasMoved && !movingTextBox) {
|
|
204
204
|
triggerContourAnnotationCompleted(annotation, contourHoleProcessingEnabled);
|
|
205
205
|
}
|
|
206
206
|
this.isDrawing = false;
|
|
@@ -11,6 +11,7 @@ const SUPPORTED_REGION_DATA_TYPES = [
|
|
|
11
11
|
const SUPPORTED_PROBE_VARIANT = [
|
|
12
12
|
'4,3',
|
|
13
13
|
'4,7',
|
|
14
|
+
'4,-1',
|
|
14
15
|
];
|
|
15
16
|
const UNIT_MAPPING = {
|
|
16
17
|
0: 'px',
|
|
@@ -24,6 +25,7 @@ const UNIT_MAPPING = {
|
|
|
24
25
|
8: 'cm\xb2',
|
|
25
26
|
9: 'cm\xb2/s',
|
|
26
27
|
0xc: 'degrees',
|
|
28
|
+
[-1]: 'mV',
|
|
27
29
|
};
|
|
28
30
|
const EPS = 1e-3;
|
|
29
31
|
const SQUARE = '\xb2';
|
|
@@ -66,7 +68,9 @@ const getCalibratedLengthUnitsAndScale = (image, handles) => {
|
|
|
66
68
|
const region = calibration.sequenceOfUltrasoundRegions.find((region) => handles.every((handle) => handle[0] >= region.regionLocationMinX0 &&
|
|
67
69
|
handle[0] <= region.regionLocationMaxX1 &&
|
|
68
70
|
handle[1] >= region.regionLocationMinY0 &&
|
|
69
|
-
handle[1] <= region.regionLocationMaxY1) &&
|
|
71
|
+
handle[1] <= region.regionLocationMaxY1) &&
|
|
72
|
+
(SUPPORTED_REGION_DATA_TYPES.includes(region.regionDataType) ||
|
|
73
|
+
SUPPORTED_PROBE_VARIANT.includes(`${region.physicalUnitsXDirection},${region.physicalUnitsYDirection}`)));
|
|
70
74
|
if (region &&
|
|
71
75
|
region.physicalUnitsXDirection === region.physicalUnitsYDirection) {
|
|
72
76
|
const physicalDeltaX = Math.abs(region.physicalDeltaX);
|
|
@@ -77,6 +81,19 @@ const getCalibratedLengthUnitsAndScale = (image, handles) => {
|
|
|
77
81
|
unit = UNIT_MAPPING[region.physicalUnitsXDirection] || 'unknown';
|
|
78
82
|
areaUnit = unit + SQUARE;
|
|
79
83
|
}
|
|
84
|
+
else if (region && region.physicalUnitsYDirection === -1) {
|
|
85
|
+
const physicalDeltaX = Math.abs(region.physicalDeltaX);
|
|
86
|
+
const physicalDeltaY = Math.abs(region.physicalDeltaY);
|
|
87
|
+
scale = 1 / physicalDeltaX;
|
|
88
|
+
scaleY = 1 / physicalDeltaY;
|
|
89
|
+
calibrationType = 'ECG Region';
|
|
90
|
+
unit =
|
|
91
|
+
UNIT_MAPPING[region.physicalUnitsXDirection] ||
|
|
92
|
+
UNIT_MAPPING[region.physicalUnitsYDirection] ||
|
|
93
|
+
'unknown';
|
|
94
|
+
areaUnit =
|
|
95
|
+
(UNIT_MAPPING[region.physicalUnitsYDirection] || 'px') + SQUARE;
|
|
96
|
+
}
|
|
80
97
|
}
|
|
81
98
|
else if (calibration.scale) {
|
|
82
99
|
scale = calibration.scale;
|
|
@@ -101,7 +118,8 @@ const getCalibratedProbeUnitsAndValue = (image, handles) => {
|
|
|
101
118
|
return { units, values };
|
|
102
119
|
}
|
|
103
120
|
if (calibration.sequenceOfUltrasoundRegions) {
|
|
104
|
-
const supportedRegionsMetadata = calibration.sequenceOfUltrasoundRegions.filter((region) => SUPPORTED_REGION_DATA_TYPES.includes(region.regionDataType)
|
|
121
|
+
const supportedRegionsMetadata = calibration.sequenceOfUltrasoundRegions.filter((region) => (SUPPORTED_REGION_DATA_TYPES.includes(region.regionDataType) ||
|
|
122
|
+
SUPPORTED_PROBE_VARIANT.includes(`${region.physicalUnitsXDirection},${region.physicalUnitsYDirection}`)) &&
|
|
105
123
|
SUPPORTED_PROBE_VARIANT.includes(`${region.physicalUnitsXDirection},${region.physicalUnitsYDirection}`));
|
|
106
124
|
if (!supportedRegionsMetadata?.length) {
|
|
107
125
|
return { units, values };
|
|
@@ -119,11 +137,12 @@ const getCalibratedProbeUnitsAndValue = (image, handles) => {
|
|
|
119
137
|
physicalDeltaY;
|
|
120
138
|
const xValue = (imageIndex[0] - region.regionLocationMinX0 - referencePixelX0) *
|
|
121
139
|
physicalDeltaX;
|
|
122
|
-
calibrationType =
|
|
140
|
+
calibrationType =
|
|
141
|
+
region.physicalUnitsYDirection === -1 ? 'ECG Region' : 'US Region';
|
|
123
142
|
values = [xValue, yValue];
|
|
124
143
|
units = [
|
|
125
|
-
UNIT_MAPPING[region.physicalUnitsXDirection],
|
|
126
|
-
UNIT_MAPPING[region.physicalUnitsYDirection],
|
|
144
|
+
UNIT_MAPPING[region.physicalUnitsXDirection] ?? 'unknown',
|
|
145
|
+
UNIT_MAPPING[region.physicalUnitsYDirection] ?? 'unknown',
|
|
127
146
|
];
|
|
128
147
|
}
|
|
129
148
|
return {
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.
|
|
1
|
+
export declare const version = "4.18.1";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '4.
|
|
1
|
+
export const version = '4.18.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.18.1",
|
|
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.
|
|
111
|
+
"@cornerstonejs/core": "4.18.1",
|
|
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": "1fc5684032269b1b1e3e3733cd891d48c27303f7"
|
|
131
131
|
}
|