@cornerstonejs/adapters 4.0.0-beta.2 → 4.0.0-beta.4
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/README.md +7 -7
- package/dist/esm/adapters/Cornerstone/Bidirectional.js +1 -0
- package/dist/esm/adapters/Cornerstone/MeasurementReport.js +8 -6
- package/dist/esm/adapters/Cornerstone/ParametricMap.js +2 -2
- package/dist/esm/adapters/Cornerstone/Segmentation_4X.js +14 -11
- package/dist/esm/adapters/Cornerstone3D/Angle.d.ts +25 -62
- package/dist/esm/adapters/Cornerstone3D/Angle.js +29 -146
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.d.ts +15 -27
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.js +31 -161
- package/dist/esm/adapters/Cornerstone3D/BaseAdapter3D.d.ts +12 -21
- package/dist/esm/adapters/Cornerstone3D/BaseAdapter3D.js +58 -43
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.d.ts +25 -80
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.js +36 -173
- package/dist/esm/adapters/Cornerstone3D/CircleROI.d.ts +18 -33
- package/dist/esm/adapters/Cornerstone3D/CircleROI.js +27 -133
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.d.ts +25 -62
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.js +24 -149
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.d.ts +18 -30
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.js +27 -241
- package/dist/esm/adapters/Cornerstone3D/KeyImage.d.ts +17 -11
- package/dist/esm/adapters/Cornerstone3D/KeyImage.js +4 -4
- package/dist/esm/adapters/Cornerstone3D/LabelData.d.ts +11 -0
- package/dist/esm/adapters/Cornerstone3D/LabelData.js +102 -0
- package/dist/esm/adapters/Cornerstone3D/Length.d.ts +17 -45
- package/dist/esm/adapters/Cornerstone3D/Length.js +27 -125
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.d.ts +77 -37
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.js +176 -51
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.d.ts +18 -41
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.js +26 -138
- package/dist/esm/adapters/Cornerstone3D/Probe.d.ts +17 -32
- package/dist/esm/adapters/Cornerstone3D/Probe.js +34 -106
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.d.ts +19 -33
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.js +28 -115
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.d.ts +9 -15
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.js +12 -21
- package/dist/esm/adapters/Cornerstone3D/constants/index.d.ts +11 -0
- package/dist/esm/adapters/Cornerstone3D/constants/index.js +12 -1
- package/dist/esm/adapters/Cornerstone3D/index.d.ts +11 -0
- package/dist/esm/adapters/Cornerstone3D/index.js +6 -2
- package/dist/esm/adapters/helpers/checkOrientation.js +2 -2
- package/dist/esm/adapters/helpers/index.d.ts +3 -0
- package/dist/esm/adapters/helpers/index.js +3 -0
- package/dist/esm/adapters/helpers/scoordToWorld.d.ts +5 -0
- package/dist/esm/adapters/helpers/scoordToWorld.js +32 -0
- package/dist/esm/adapters/helpers/toArray.js +1 -1
- package/dist/esm/adapters/helpers/toPoint3.d.ts +3 -0
- package/dist/esm/adapters/helpers/toPoint3.js +18 -0
- package/dist/esm/adapters/helpers/toScoordType.d.ts +23 -0
- package/dist/esm/adapters/helpers/toScoordType.js +33 -0
- package/dist/esm/adapters/index.d.ts +12 -1
- package/dist/esm/adapters/index.js +1 -0
- package/dist/esm/version.d.ts +1 -1
- package/package.json +7 -7
- package/dist/esm/adapters/helpers/compareArrays.d.ts +0 -1
- package/dist/esm/adapters/helpers/compareArrays.js +0 -18
|
@@ -1,99 +1,42 @@
|
|
|
1
1
|
import { utilities } from 'dcmjs';
|
|
2
2
|
import MeasurementReport from './MeasurementReport.js';
|
|
3
3
|
import BaseAdapter3D from './BaseAdapter3D.js';
|
|
4
|
+
import 'buffer';
|
|
5
|
+
import { toScoords } from '../helpers/toScoordType.js';
|
|
6
|
+
import '@cornerstonejs/core';
|
|
4
7
|
|
|
5
8
|
var _CobbAngle;
|
|
6
9
|
const {
|
|
7
10
|
CobbAngle: TID300CobbAngle
|
|
8
11
|
} = utilities.TID300;
|
|
9
12
|
class CobbAngle extends BaseAdapter3D {
|
|
10
|
-
static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap,
|
|
13
|
+
static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata) {
|
|
11
14
|
const {
|
|
12
|
-
|
|
15
|
+
state,
|
|
13
16
|
NUMGroup,
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
referencedImageId,
|
|
18
|
+
worldCoords,
|
|
16
19
|
ReferencedFrameNumber
|
|
17
20
|
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, CobbAngle.toolType);
|
|
18
|
-
if (SCOORDGroup) {
|
|
19
|
-
return this.getMeasurementDataFromScoord({
|
|
20
|
-
defaultState,
|
|
21
|
-
SCOORDGroup,
|
|
22
|
-
imageToWorldCoords,
|
|
23
|
-
NUMGroup,
|
|
24
|
-
ReferencedFrameNumber
|
|
25
|
-
});
|
|
26
|
-
} else if (SCOORD3DGroup) {
|
|
27
|
-
return this.getMeasurementDataFromScoord3D({
|
|
28
|
-
defaultState,
|
|
29
|
-
SCOORD3DGroup
|
|
30
|
-
});
|
|
31
|
-
} else {
|
|
32
|
-
throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
static getMeasurementDataFromScoord(_ref) {
|
|
36
|
-
let {
|
|
37
|
-
defaultState,
|
|
38
|
-
SCOORDGroup,
|
|
39
|
-
imageToWorldCoords,
|
|
40
|
-
NUMGroup,
|
|
41
|
-
ReferencedFrameNumber
|
|
42
|
-
} = _ref;
|
|
43
|
-
const referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
44
|
-
const {
|
|
45
|
-
GraphicData
|
|
46
|
-
} = SCOORDGroup;
|
|
47
|
-
const worldCoords = [];
|
|
48
|
-
for (let i = 0; i < GraphicData.length; i += 2) {
|
|
49
|
-
const point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
50
|
-
worldCoords.push(point);
|
|
51
|
-
}
|
|
52
|
-
const state = defaultState;
|
|
53
21
|
state.annotation.data = {
|
|
22
|
+
...state.annotation.data,
|
|
54
23
|
handles: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
textBox: {
|
|
58
|
-
hasMoved: false
|
|
59
|
-
}
|
|
24
|
+
...state.annotation.data.handles,
|
|
25
|
+
points: [worldCoords[0], worldCoords[1], worldCoords[2], worldCoords[3]]
|
|
60
26
|
},
|
|
61
|
-
|
|
27
|
+
frameNumber: ReferencedFrameNumber
|
|
28
|
+
};
|
|
29
|
+
if (referencedImageId) {
|
|
30
|
+
state.annotation.data.cachedStats = {
|
|
62
31
|
[`imageId:${referencedImageId}`]: {
|
|
63
32
|
angle: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : null
|
|
64
33
|
}
|
|
65
|
-
}
|
|
66
|
-
frameNumber: ReferencedFrameNumber
|
|
67
|
-
};
|
|
68
|
-
return state;
|
|
69
|
-
}
|
|
70
|
-
static getMeasurementDataFromScoord3D(_ref2) {
|
|
71
|
-
let {
|
|
72
|
-
defaultState,
|
|
73
|
-
SCOORD3DGroup
|
|
74
|
-
} = _ref2;
|
|
75
|
-
const {
|
|
76
|
-
GraphicData
|
|
77
|
-
} = SCOORD3DGroup;
|
|
78
|
-
const worldCoords = [];
|
|
79
|
-
for (let i = 0; i < GraphicData.length; i += 3) {
|
|
80
|
-
const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
|
|
81
|
-
worldCoords.push(point);
|
|
34
|
+
};
|
|
82
35
|
}
|
|
83
|
-
const state = defaultState;
|
|
84
|
-
state.annotation.data = {
|
|
85
|
-
handles: {
|
|
86
|
-
points: [worldCoords[0], worldCoords[1], worldCoords[2], worldCoords[3]],
|
|
87
|
-
activeHandleIndex: 0,
|
|
88
|
-
textBox: {
|
|
89
|
-
hasMoved: false
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
cachedStats: {}
|
|
93
|
-
};
|
|
94
36
|
return state;
|
|
95
37
|
}
|
|
96
|
-
static getTID300RepresentationArguments(tool
|
|
38
|
+
static getTID300RepresentationArguments(tool) {
|
|
39
|
+
let is3DMeasurement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
97
40
|
const {
|
|
98
41
|
data,
|
|
99
42
|
finding,
|
|
@@ -107,29 +50,12 @@ class CobbAngle extends BaseAdapter3D {
|
|
|
107
50
|
const {
|
|
108
51
|
referencedImageId
|
|
109
52
|
} = metadata;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const start1 = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
114
|
-
const end1 = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
115
|
-
const start2 = worldToImageCoords(referencedImageId, handles.points[2]);
|
|
116
|
-
const end2 = worldToImageCoords(referencedImageId, handles.points[3]);
|
|
117
|
-
const point1 = {
|
|
118
|
-
x: start1[0],
|
|
119
|
-
y: start1[1]
|
|
120
|
-
};
|
|
121
|
-
const point2 = {
|
|
122
|
-
x: end1[0],
|
|
123
|
-
y: end1[1]
|
|
124
|
-
};
|
|
125
|
-
const point3 = {
|
|
126
|
-
x: start2[0],
|
|
127
|
-
y: start2[1]
|
|
128
|
-
};
|
|
129
|
-
const point4 = {
|
|
130
|
-
x: end2[0],
|
|
131
|
-
y: end2[1]
|
|
53
|
+
const scoordProps = {
|
|
54
|
+
is3DMeasurement,
|
|
55
|
+
referencedImageId
|
|
132
56
|
};
|
|
57
|
+
const points = toScoords(scoordProps, handles.points);
|
|
58
|
+
const [point1, point2, point3, point4] = points;
|
|
133
59
|
const {
|
|
134
60
|
angle
|
|
135
61
|
} = cachedStats[`imageId:${referencedImageId}`] || {};
|
|
@@ -142,59 +68,8 @@ class CobbAngle extends BaseAdapter3D {
|
|
|
142
68
|
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
143
69
|
finding,
|
|
144
70
|
findingSites: findingSites || [],
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
static getTID300RepresentationArgumentsSCOORD3D(tool) {
|
|
149
|
-
const {
|
|
150
|
-
data,
|
|
151
|
-
finding,
|
|
152
|
-
findingSites,
|
|
153
|
-
metadata
|
|
154
|
-
} = tool;
|
|
155
|
-
const {
|
|
156
|
-
cachedStats = {},
|
|
157
|
-
handles
|
|
158
|
-
} = data;
|
|
159
|
-
const start1 = handles.points[0];
|
|
160
|
-
const end1 = handles.points[1];
|
|
161
|
-
const start2 = handles.points[2];
|
|
162
|
-
const end2 = handles.points[3];
|
|
163
|
-
const point1 = {
|
|
164
|
-
x: start1[0],
|
|
165
|
-
y: start1[1],
|
|
166
|
-
z: start1[2]
|
|
167
|
-
};
|
|
168
|
-
const point2 = {
|
|
169
|
-
x: end1[0],
|
|
170
|
-
y: end1[1],
|
|
171
|
-
z: end1[2]
|
|
172
|
-
};
|
|
173
|
-
const point3 = {
|
|
174
|
-
x: start2[0],
|
|
175
|
-
y: start2[1],
|
|
176
|
-
z: start2[2]
|
|
177
|
-
};
|
|
178
|
-
const point4 = {
|
|
179
|
-
x: end2[0],
|
|
180
|
-
y: end2[1],
|
|
181
|
-
z: end2[2]
|
|
182
|
-
};
|
|
183
|
-
const cachedStatsKeys = Object.keys(cachedStats)[0];
|
|
184
|
-
const {
|
|
185
|
-
angle
|
|
186
|
-
} = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
|
|
187
|
-
return {
|
|
188
|
-
point1,
|
|
189
|
-
point2,
|
|
190
|
-
point3,
|
|
191
|
-
point4,
|
|
192
|
-
rAngle: angle,
|
|
193
|
-
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
194
|
-
finding,
|
|
195
|
-
findingSites: findingSites || [],
|
|
196
|
-
ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
|
|
197
|
-
use3DSpatialCoordinates: true
|
|
71
|
+
ReferencedFrameOfReferenceUID: is3DMeasurement ? metadata.FrameOfReferenceUID : null,
|
|
72
|
+
use3DSpatialCoordinates: is3DMeasurement
|
|
198
73
|
};
|
|
199
74
|
}
|
|
200
75
|
}
|
|
@@ -1,37 +1,25 @@
|
|
|
1
1
|
import BaseAdapter3D from "./BaseAdapter3D";
|
|
2
2
|
declare class EllipticalROI extends BaseAdapter3D {
|
|
3
|
-
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}): any;
|
|
12
|
-
static getMeasurementDataFromScoord3D({ defaultState, SCOORD3DGroup }: {
|
|
13
|
-
defaultState: any;
|
|
14
|
-
SCOORD3DGroup: any;
|
|
15
|
-
}): any;
|
|
16
|
-
static getTID300RepresentationArguments(tool: any, worldToImageCoords: any): {
|
|
17
|
-
area: any;
|
|
18
|
-
points: any[];
|
|
19
|
-
trackingIdentifierTextValue: string;
|
|
20
|
-
finding: any;
|
|
21
|
-
findingSites: any;
|
|
22
|
-
ReferencedFrameOfReferenceUID: any;
|
|
23
|
-
use3DSpatialCoordinates: boolean;
|
|
24
|
-
} | {
|
|
25
|
-
area: any;
|
|
26
|
-
points: any[];
|
|
27
|
-
trackingIdentifierTextValue: string;
|
|
28
|
-
finding: any;
|
|
29
|
-
findingSites: any;
|
|
30
|
-
use3DSpatialCoordinates: boolean;
|
|
3
|
+
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, metadata: any): {
|
|
4
|
+
description?: string;
|
|
5
|
+
sopInstanceUid?: string;
|
|
6
|
+
annotation: import("packages/tools/dist/esm/types").Annotation;
|
|
7
|
+
finding?: unknown;
|
|
8
|
+
findingSites?: unknown;
|
|
9
|
+
commentGroup?: any;
|
|
10
|
+
commentPositionGroup?: any;
|
|
31
11
|
};
|
|
32
|
-
static
|
|
12
|
+
static getTID300RepresentationArguments(tool: any, is3DMeasurement?: boolean): {
|
|
33
13
|
area: any;
|
|
34
|
-
points:
|
|
14
|
+
points: ({
|
|
15
|
+
x: any;
|
|
16
|
+
y: any;
|
|
17
|
+
z: any;
|
|
18
|
+
} | {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
z?: undefined;
|
|
22
|
+
})[];
|
|
35
23
|
trackingIdentifierTextValue: string;
|
|
36
24
|
finding: any;
|
|
37
25
|
findingSites: any;
|
|
@@ -1,143 +1,40 @@
|
|
|
1
|
-
import { vec3 } from 'gl-matrix';
|
|
2
1
|
import { utilities } from 'dcmjs';
|
|
3
2
|
import MeasurementReport from './MeasurementReport.js';
|
|
4
3
|
import BaseAdapter3D from './BaseAdapter3D.js';
|
|
4
|
+
import 'buffer';
|
|
5
|
+
import { toScoord } from '../helpers/toScoordType.js';
|
|
6
|
+
import '@cornerstonejs/core';
|
|
5
7
|
|
|
6
8
|
var _EllipticalROI;
|
|
7
9
|
const {
|
|
8
10
|
Ellipse: TID300Ellipse
|
|
9
11
|
} = utilities.TID300;
|
|
10
|
-
const EPSILON = 1e-4;
|
|
11
12
|
class EllipticalROI extends BaseAdapter3D {
|
|
12
|
-
static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap,
|
|
13
|
+
static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata) {
|
|
13
14
|
const {
|
|
14
|
-
|
|
15
|
+
state,
|
|
15
16
|
NUMGroup,
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
worldCoords,
|
|
18
|
+
referencedImageId,
|
|
18
19
|
ReferencedFrameNumber
|
|
19
20
|
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, EllipticalROI.toolType);
|
|
20
|
-
if (SCOORDGroup) {
|
|
21
|
-
return this.getMeasurementDataFromScoord({
|
|
22
|
-
defaultState,
|
|
23
|
-
SCOORDGroup,
|
|
24
|
-
imageToWorldCoords,
|
|
25
|
-
metadata,
|
|
26
|
-
NUMGroup,
|
|
27
|
-
ReferencedFrameNumber
|
|
28
|
-
});
|
|
29
|
-
} else if (SCOORD3DGroup) {
|
|
30
|
-
return this.getMeasurementDataFromScoord3D({
|
|
31
|
-
defaultState,
|
|
32
|
-
SCOORD3DGroup
|
|
33
|
-
});
|
|
34
|
-
} else {
|
|
35
|
-
throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
static getMeasurementDataFromScoord(_ref) {
|
|
39
|
-
let {
|
|
40
|
-
defaultState,
|
|
41
|
-
SCOORDGroup,
|
|
42
|
-
imageToWorldCoords,
|
|
43
|
-
metadata,
|
|
44
|
-
NUMGroup,
|
|
45
|
-
ReferencedFrameNumber
|
|
46
|
-
} = _ref;
|
|
47
|
-
const referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
48
|
-
const {
|
|
49
|
-
GraphicData
|
|
50
|
-
} = SCOORDGroup;
|
|
51
|
-
const pointsWorld = [];
|
|
52
|
-
for (let i = 0; i < GraphicData.length; i += 2) {
|
|
53
|
-
const worldPos = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
54
|
-
pointsWorld.push(worldPos);
|
|
55
|
-
}
|
|
56
|
-
const majorAxisStart = vec3.fromValues(...pointsWorld[0]);
|
|
57
|
-
const majorAxisEnd = vec3.fromValues(...pointsWorld[1]);
|
|
58
|
-
const minorAxisStart = vec3.fromValues(...pointsWorld[2]);
|
|
59
|
-
const minorAxisEnd = vec3.fromValues(...pointsWorld[3]);
|
|
60
|
-
const majorAxisVec = vec3.create();
|
|
61
|
-
vec3.sub(majorAxisVec, majorAxisEnd, majorAxisStart);
|
|
62
|
-
vec3.normalize(majorAxisVec, majorAxisVec);
|
|
63
|
-
const minorAxisVec = vec3.create();
|
|
64
|
-
vec3.sub(minorAxisVec, minorAxisEnd, minorAxisStart);
|
|
65
|
-
vec3.normalize(minorAxisVec, minorAxisVec);
|
|
66
|
-
const imagePlaneModule = metadata.get("imagePlaneModule", referencedImageId);
|
|
67
|
-
if (!imagePlaneModule) {
|
|
68
|
-
throw new Error("imageId does not have imagePlaneModule metadata");
|
|
69
|
-
}
|
|
70
|
-
const {
|
|
71
|
-
columnCosines
|
|
72
|
-
} = imagePlaneModule;
|
|
73
|
-
const columnCosinesVec = vec3.fromValues(columnCosines[0], columnCosines[1], columnCosines[2]);
|
|
74
|
-
const projectedMajorAxisOnColVec = vec3.dot(columnCosinesVec, majorAxisVec);
|
|
75
|
-
const projectedMinorAxisOnColVec = vec3.dot(columnCosinesVec, minorAxisVec);
|
|
76
|
-
const absoluteOfMajorDotProduct = Math.abs(projectedMajorAxisOnColVec);
|
|
77
|
-
const absoluteOfMinorDotProduct = Math.abs(projectedMinorAxisOnColVec);
|
|
78
|
-
let ellipsePoints = [];
|
|
79
|
-
if (Math.abs(absoluteOfMajorDotProduct - 1) < EPSILON) {
|
|
80
|
-
ellipsePoints = [pointsWorld[0], pointsWorld[1], pointsWorld[2], pointsWorld[3]];
|
|
81
|
-
} else if (Math.abs(absoluteOfMinorDotProduct - 1) < EPSILON) {
|
|
82
|
-
ellipsePoints = [pointsWorld[2], pointsWorld[3], pointsWorld[0], pointsWorld[1]];
|
|
83
|
-
} else {
|
|
84
|
-
console.warn("OBLIQUE ELLIPSE NOT YET SUPPORTED");
|
|
85
|
-
}
|
|
86
|
-
const state = defaultState;
|
|
87
21
|
state.annotation.data = {
|
|
22
|
+
...state.annotation.data,
|
|
88
23
|
handles: {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
textBox: {
|
|
92
|
-
hasMoved: false
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
cachedStats: {
|
|
96
|
-
[`imageId:${referencedImageId}`]: {
|
|
97
|
-
area: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : 0
|
|
98
|
-
}
|
|
24
|
+
...state.annotation.data.handles,
|
|
25
|
+
points: worldCoords
|
|
99
26
|
},
|
|
100
27
|
frameNumber: ReferencedFrameNumber
|
|
101
28
|
};
|
|
29
|
+
state.annotation.data.cachedStats = referencedImageId ? {
|
|
30
|
+
[`imageId:${referencedImageId}`]: {
|
|
31
|
+
area: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : 0
|
|
32
|
+
}
|
|
33
|
+
} : {};
|
|
102
34
|
return state;
|
|
103
35
|
}
|
|
104
|
-
static
|
|
105
|
-
let
|
|
106
|
-
defaultState,
|
|
107
|
-
SCOORD3DGroup
|
|
108
|
-
} = _ref2;
|
|
109
|
-
const {
|
|
110
|
-
GraphicData
|
|
111
|
-
} = SCOORD3DGroup;
|
|
112
|
-
const pointsWorld = [];
|
|
113
|
-
for (let i = 0; i < GraphicData.length; i += 3) {
|
|
114
|
-
const worldPos = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
|
|
115
|
-
pointsWorld.push(worldPos);
|
|
116
|
-
}
|
|
117
|
-
const majorAxisStart = vec3.fromValues(...pointsWorld[0]);
|
|
118
|
-
const majorAxisEnd = vec3.fromValues(...pointsWorld[1]);
|
|
119
|
-
const minorAxisStart = vec3.fromValues(...pointsWorld[2]);
|
|
120
|
-
const minorAxisEnd = vec3.fromValues(...pointsWorld[3]);
|
|
121
|
-
const majorAxisVec = vec3.create();
|
|
122
|
-
vec3.sub(majorAxisVec, majorAxisEnd, majorAxisStart);
|
|
123
|
-
vec3.normalize(majorAxisVec, majorAxisVec);
|
|
124
|
-
const minorAxisVec = vec3.create();
|
|
125
|
-
vec3.sub(minorAxisVec, minorAxisEnd, minorAxisStart);
|
|
126
|
-
vec3.normalize(minorAxisVec, minorAxisVec);
|
|
127
|
-
const state = defaultState;
|
|
128
|
-
state.annotation.data = {
|
|
129
|
-
handles: {
|
|
130
|
-
points: [majorAxisStart, majorAxisEnd, minorAxisStart, minorAxisEnd],
|
|
131
|
-
activeHandleIndex: 0,
|
|
132
|
-
textBox: {
|
|
133
|
-
hasMoved: false
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
cachedStats: {}
|
|
137
|
-
};
|
|
138
|
-
return state;
|
|
139
|
-
}
|
|
140
|
-
static getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
36
|
+
static getTID300RepresentationArguments(tool) {
|
|
37
|
+
let is3DMeasurement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
141
38
|
const {
|
|
142
39
|
data,
|
|
143
40
|
finding,
|
|
@@ -152,83 +49,10 @@ class EllipticalROI extends BaseAdapter3D {
|
|
|
152
49
|
const {
|
|
153
50
|
referencedImageId
|
|
154
51
|
} = metadata;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
let top, bottom, left, right;
|
|
159
|
-
if (rotation == 90 || rotation == 270) {
|
|
160
|
-
bottom = worldToImageCoords(referencedImageId, handles.points[2]);
|
|
161
|
-
top = worldToImageCoords(referencedImageId, handles.points[3]);
|
|
162
|
-
left = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
163
|
-
right = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
164
|
-
} else {
|
|
165
|
-
top = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
166
|
-
bottom = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
167
|
-
left = worldToImageCoords(referencedImageId, handles.points[2]);
|
|
168
|
-
right = worldToImageCoords(referencedImageId, handles.points[3]);
|
|
169
|
-
}
|
|
170
|
-
const topBottomLength = Math.abs(top[1] - bottom[1]);
|
|
171
|
-
const leftRightLength = Math.abs(left[0] - right[0]);
|
|
172
|
-
const points = [];
|
|
173
|
-
if (topBottomLength > leftRightLength) {
|
|
174
|
-
points.push({
|
|
175
|
-
x: top[0],
|
|
176
|
-
y: top[1]
|
|
177
|
-
});
|
|
178
|
-
points.push({
|
|
179
|
-
x: bottom[0],
|
|
180
|
-
y: bottom[1]
|
|
181
|
-
});
|
|
182
|
-
points.push({
|
|
183
|
-
x: left[0],
|
|
184
|
-
y: left[1]
|
|
185
|
-
});
|
|
186
|
-
points.push({
|
|
187
|
-
x: right[0],
|
|
188
|
-
y: right[1]
|
|
189
|
-
});
|
|
190
|
-
} else {
|
|
191
|
-
points.push({
|
|
192
|
-
x: left[0],
|
|
193
|
-
y: left[1]
|
|
194
|
-
});
|
|
195
|
-
points.push({
|
|
196
|
-
x: right[0],
|
|
197
|
-
y: right[1]
|
|
198
|
-
});
|
|
199
|
-
points.push({
|
|
200
|
-
x: top[0],
|
|
201
|
-
y: top[1]
|
|
202
|
-
});
|
|
203
|
-
points.push({
|
|
204
|
-
x: bottom[0],
|
|
205
|
-
y: bottom[1]
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
const {
|
|
209
|
-
area
|
|
210
|
-
} = cachedStats[`imageId:${referencedImageId}`] || {};
|
|
211
|
-
return {
|
|
212
|
-
area,
|
|
213
|
-
points,
|
|
214
|
-
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
215
|
-
finding,
|
|
216
|
-
findingSites: findingSites || [],
|
|
217
|
-
use3DSpatialCoordinates: false
|
|
52
|
+
const scoordProps = {
|
|
53
|
+
is3DMeasurement,
|
|
54
|
+
referencedImageId
|
|
218
55
|
};
|
|
219
|
-
}
|
|
220
|
-
static getTID300RepresentationArgumentsSCOORD3D(tool) {
|
|
221
|
-
const {
|
|
222
|
-
data,
|
|
223
|
-
finding,
|
|
224
|
-
findingSites,
|
|
225
|
-
metadata
|
|
226
|
-
} = tool;
|
|
227
|
-
const {
|
|
228
|
-
cachedStats,
|
|
229
|
-
handles
|
|
230
|
-
} = data;
|
|
231
|
-
const rotation = data.initialRotation || 0;
|
|
232
56
|
let top, bottom, left, right;
|
|
233
57
|
if (rotation == 90 || rotation == 270) {
|
|
234
58
|
bottom = handles.points[2];
|
|
@@ -245,60 +69,22 @@ class EllipticalROI extends BaseAdapter3D {
|
|
|
245
69
|
const leftRightLength = Math.sqrt((left[0] - right[0]) ** 2 + (left[1] - right[1]) ** 2 + (left[2] - right[2]) ** 2);
|
|
246
70
|
const points = [];
|
|
247
71
|
if (topBottomLength > leftRightLength) {
|
|
248
|
-
points.push(
|
|
249
|
-
x: top[0],
|
|
250
|
-
y: top[1],
|
|
251
|
-
z: top[2]
|
|
252
|
-
});
|
|
253
|
-
points.push({
|
|
254
|
-
x: bottom[0],
|
|
255
|
-
y: bottom[1],
|
|
256
|
-
z: bottom[2]
|
|
257
|
-
});
|
|
258
|
-
points.push({
|
|
259
|
-
x: left[0],
|
|
260
|
-
y: left[1],
|
|
261
|
-
z: left[2]
|
|
262
|
-
});
|
|
263
|
-
points.push({
|
|
264
|
-
x: right[0],
|
|
265
|
-
y: right[1],
|
|
266
|
-
z: right[2]
|
|
267
|
-
});
|
|
72
|
+
points.push(top, bottom, left, right);
|
|
268
73
|
} else {
|
|
269
|
-
points.push(
|
|
270
|
-
x: left[0],
|
|
271
|
-
y: left[1],
|
|
272
|
-
z: left[2]
|
|
273
|
-
});
|
|
274
|
-
points.push({
|
|
275
|
-
x: right[0],
|
|
276
|
-
y: right[1],
|
|
277
|
-
z: right[2]
|
|
278
|
-
});
|
|
279
|
-
points.push({
|
|
280
|
-
x: top[0],
|
|
281
|
-
y: top[1],
|
|
282
|
-
z: top[2]
|
|
283
|
-
});
|
|
284
|
-
points.push({
|
|
285
|
-
x: bottom[0],
|
|
286
|
-
y: bottom[1],
|
|
287
|
-
z: bottom[2]
|
|
288
|
-
});
|
|
74
|
+
points.push(left, right, top, bottom);
|
|
289
75
|
}
|
|
290
|
-
const cachedStatsKeys = Object.keys(cachedStats)[0];
|
|
291
76
|
const {
|
|
292
77
|
area
|
|
293
|
-
} =
|
|
78
|
+
} = cachedStats[`imageId:${referencedImageId}`] || {};
|
|
79
|
+
const convertedPoints = points.map(point => toScoord(scoordProps, point));
|
|
294
80
|
return {
|
|
295
81
|
area,
|
|
296
|
-
points,
|
|
82
|
+
points: convertedPoints,
|
|
297
83
|
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
298
84
|
finding,
|
|
299
85
|
findingSites: findingSites || [],
|
|
300
|
-
ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
|
|
301
|
-
use3DSpatialCoordinates:
|
|
86
|
+
ReferencedFrameOfReferenceUID: is3DMeasurement ? metadata.FrameOfReferenceUID : null,
|
|
87
|
+
use3DSpatialCoordinates: is3DMeasurement
|
|
302
88
|
};
|
|
303
89
|
}
|
|
304
90
|
}
|
|
@@ -3,23 +3,29 @@ export default class KeyImage extends Probe {
|
|
|
3
3
|
static trackingSeriesIdentifier: string;
|
|
4
4
|
static trackingPointIdentifier: string;
|
|
5
5
|
static trackingSeriesPointIdentifier: string;
|
|
6
|
-
static getMeasurementData(measurementGroup: any, sopInstanceUIDToImageIdMap: any,
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
static getMeasurementData(measurementGroup: any, sopInstanceUIDToImageIdMap: any, metadata: any, trackingIdentifier: any): {
|
|
7
|
+
description?: string;
|
|
8
|
+
sopInstanceUid?: string;
|
|
9
|
+
annotation: import("packages/tools/dist/esm/types").Annotation;
|
|
10
|
+
finding?: unknown;
|
|
11
|
+
findingSites?: unknown;
|
|
12
|
+
commentGroup?: any;
|
|
13
|
+
commentPositionGroup?: any;
|
|
14
|
+
};
|
|
15
|
+
static getTID300RepresentationArguments(tool: any): {
|
|
16
|
+
points: ({
|
|
9
17
|
x: any;
|
|
10
18
|
y: any;
|
|
11
19
|
z: any;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
use3DSpatialCoordinates: boolean;
|
|
18
|
-
} | {
|
|
19
|
-
points: any;
|
|
20
|
+
} | {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
z?: undefined;
|
|
24
|
+
})[];
|
|
20
25
|
trackingIdentifierTextValue: string;
|
|
21
26
|
findingSites: any;
|
|
22
27
|
finding: any;
|
|
28
|
+
ReferencedFrameOfReferenceUID: any;
|
|
23
29
|
use3DSpatialCoordinates: boolean;
|
|
24
30
|
};
|
|
25
31
|
}
|
|
@@ -6,16 +6,16 @@ const {
|
|
|
6
6
|
Point: TID300Point
|
|
7
7
|
} = utilities.TID300;
|
|
8
8
|
class KeyImage extends Probe {
|
|
9
|
-
static getMeasurementData(measurementGroup, sopInstanceUIDToImageIdMap,
|
|
10
|
-
const baseData = super.getMeasurementData(measurementGroup, sopInstanceUIDToImageIdMap,
|
|
9
|
+
static getMeasurementData(measurementGroup, sopInstanceUIDToImageIdMap, metadata, trackingIdentifier) {
|
|
10
|
+
const baseData = super.getMeasurementData(measurementGroup, sopInstanceUIDToImageIdMap, metadata, trackingIdentifier);
|
|
11
11
|
const {
|
|
12
12
|
data
|
|
13
13
|
} = baseData.annotation;
|
|
14
14
|
data.isPoint = trackingIdentifier.indexOf("Point") !== -1;
|
|
15
15
|
return baseData;
|
|
16
16
|
}
|
|
17
|
-
static getTID300RepresentationArguments(tool
|
|
18
|
-
const tid300Arguments = super.getTID300RepresentationArguments(tool
|
|
17
|
+
static getTID300RepresentationArguments(tool) {
|
|
18
|
+
const tid300Arguments = super.getTID300RepresentationArguments(tool);
|
|
19
19
|
const {
|
|
20
20
|
data
|
|
21
21
|
} = tool;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Types } from "@cornerstonejs/tools";
|
|
2
|
+
export default class LabelData {
|
|
3
|
+
protected tid300Item: any;
|
|
4
|
+
protected annotation: Types.Annotation;
|
|
5
|
+
ReferencedSOPSequence: any;
|
|
6
|
+
constructor(tid300Item: any, annotation: Types.Annotation);
|
|
7
|
+
contentItem(): any;
|
|
8
|
+
filterCornerstoneFreeText(contentEntries: any): void;
|
|
9
|
+
createQualitativeLabel(label: string): any;
|
|
10
|
+
createQualitativeLabelPosition(annotation: Types.Annotation): any;
|
|
11
|
+
}
|