@cornerstonejs/adapters 3.14.4 → 3.15.0
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/adapters/Cornerstone3D/Angle.d.ts +66 -14
- package/dist/esm/adapters/Cornerstone3D/Angle.js +102 -2
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.d.ts +27 -15
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.js +110 -1
- package/dist/esm/adapters/Cornerstone3D/BaseAdapter3D.d.ts +18 -9
- package/dist/esm/adapters/Cornerstone3D/BaseAdapter3D.js +25 -1
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.d.ts +84 -14
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.js +133 -9
- package/dist/esm/adapters/Cornerstone3D/CircleROI.d.ts +33 -15
- package/dist/esm/adapters/Cornerstone3D/CircleROI.js +97 -2
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.d.ts +66 -14
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.js +107 -2
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.d.ts +30 -15
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.js +151 -2
- package/dist/esm/adapters/Cornerstone3D/KeyImage.d.ts +17 -15
- package/dist/esm/adapters/Cornerstone3D/Length.d.ts +46 -14
- package/dist/esm/adapters/Cornerstone3D/Length.js +93 -6
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.d.ts +82 -12
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.js +181 -44
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.d.ts +41 -15
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.js +112 -2
- package/dist/esm/adapters/Cornerstone3D/Probe.d.ts +39 -14
- package/dist/esm/adapters/Cornerstone3D/Probe.js +112 -1
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.d.ts +31 -15
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.js +82 -2
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.d.ts +8 -9
- package/dist/esm/version.d.ts +1 -1
- package/package.json +5 -5
|
@@ -21,9 +21,39 @@ class Bidirectional extends BaseAdapter3D {
|
|
|
21
21
|
ContentSequence
|
|
22
22
|
} = MeasurementGroup;
|
|
23
23
|
const longAxisNUMGroup = toArray(ContentSequence).find(group => group.ConceptNameCodeSequence.CodeMeaning === LONG_AXIS);
|
|
24
|
-
const longAxisSCOORDGroup = toArray(longAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD");
|
|
25
24
|
const shortAxisNUMGroup = toArray(ContentSequence).find(group => group.ConceptNameCodeSequence.CodeMeaning === SHORT_AXIS);
|
|
25
|
+
const longAxisSCOORDGroup = toArray(longAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD");
|
|
26
26
|
const shortAxisSCOORDGroup = toArray(shortAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD");
|
|
27
|
+
if (longAxisSCOORDGroup && shortAxisSCOORDGroup) {
|
|
28
|
+
return this.getMeasurementDataFromScoord({
|
|
29
|
+
longAxisNUMGroup,
|
|
30
|
+
shortAxisNUMGroup,
|
|
31
|
+
longAxisSCOORDGroup,
|
|
32
|
+
shortAxisSCOORDGroup,
|
|
33
|
+
referencedImageId,
|
|
34
|
+
imageToWorldCoords,
|
|
35
|
+
ReferencedFrameNumber,
|
|
36
|
+
defaultState
|
|
37
|
+
});
|
|
38
|
+
} else {
|
|
39
|
+
return this.getMeasurementDataFromScoord3d({
|
|
40
|
+
longAxisNUMGroup,
|
|
41
|
+
shortAxisNUMGroup,
|
|
42
|
+
defaultState
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
static getMeasurementDataFromScoord(_ref) {
|
|
47
|
+
let {
|
|
48
|
+
longAxisNUMGroup,
|
|
49
|
+
shortAxisNUMGroup,
|
|
50
|
+
longAxisSCOORDGroup,
|
|
51
|
+
shortAxisSCOORDGroup,
|
|
52
|
+
referencedImageId,
|
|
53
|
+
imageToWorldCoords,
|
|
54
|
+
ReferencedFrameNumber,
|
|
55
|
+
defaultState
|
|
56
|
+
} = _ref;
|
|
27
57
|
const worldCoords = [];
|
|
28
58
|
[longAxisSCOORDGroup, shortAxisSCOORDGroup].forEach(group => {
|
|
29
59
|
const {
|
|
@@ -53,6 +83,37 @@ class Bidirectional extends BaseAdapter3D {
|
|
|
53
83
|
};
|
|
54
84
|
return state;
|
|
55
85
|
}
|
|
86
|
+
static getMeasurementDataFromScoord3d(_ref2) {
|
|
87
|
+
let {
|
|
88
|
+
longAxisNUMGroup,
|
|
89
|
+
shortAxisNUMGroup,
|
|
90
|
+
defaultState
|
|
91
|
+
} = _ref2;
|
|
92
|
+
const worldCoords = [];
|
|
93
|
+
const longAxisSCOORD3DGroup = toArray(longAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD3D");
|
|
94
|
+
const shortAxisSCOORD3DGroup = toArray(shortAxisNUMGroup.ContentSequence).find(group => group.ValueType === "SCOORD3D");
|
|
95
|
+
[longAxisSCOORD3DGroup, shortAxisSCOORD3DGroup].forEach(group => {
|
|
96
|
+
const {
|
|
97
|
+
GraphicData
|
|
98
|
+
} = group;
|
|
99
|
+
for (let i = 0; i < GraphicData.length; i += 3) {
|
|
100
|
+
const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
|
|
101
|
+
worldCoords.push(point);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const state = defaultState;
|
|
105
|
+
state.annotation.data = {
|
|
106
|
+
handles: {
|
|
107
|
+
points: [worldCoords[0], worldCoords[1], worldCoords[2], worldCoords[3]],
|
|
108
|
+
activeHandleIndex: 0,
|
|
109
|
+
textBox: {
|
|
110
|
+
hasMoved: false
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
cachedStats: {}
|
|
114
|
+
};
|
|
115
|
+
return state;
|
|
116
|
+
}
|
|
56
117
|
static getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
57
118
|
const {
|
|
58
119
|
data,
|
|
@@ -67,13 +128,6 @@ class Bidirectional extends BaseAdapter3D {
|
|
|
67
128
|
const {
|
|
68
129
|
referencedImageId
|
|
69
130
|
} = metadata;
|
|
70
|
-
if (!referencedImageId) {
|
|
71
|
-
throw new Error("Bidirectional.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
72
|
-
}
|
|
73
|
-
const {
|
|
74
|
-
length,
|
|
75
|
-
width
|
|
76
|
-
} = cachedStats[`imageId:${referencedImageId}`] || {};
|
|
77
131
|
const {
|
|
78
132
|
points
|
|
79
133
|
} = handles;
|
|
@@ -90,10 +144,21 @@ class Bidirectional extends BaseAdapter3D {
|
|
|
90
144
|
shortAxisPoints = secondPointPairs;
|
|
91
145
|
longAxisPoints = firstPointPairs;
|
|
92
146
|
}
|
|
147
|
+
if (!referencedImageId) {
|
|
148
|
+
return this.getTID300RepresentationArgumentsSCOORD3D({
|
|
149
|
+
tool,
|
|
150
|
+
shortAxisPoints,
|
|
151
|
+
longAxisPoints
|
|
152
|
+
});
|
|
153
|
+
}
|
|
93
154
|
const longAxisStartImage = worldToImageCoords(referencedImageId, shortAxisPoints[0]);
|
|
94
155
|
const longAxisEndImage = worldToImageCoords(referencedImageId, shortAxisPoints[1]);
|
|
95
156
|
const shortAxisStartImage = worldToImageCoords(referencedImageId, longAxisPoints[0]);
|
|
96
157
|
const shortAxisEndImage = worldToImageCoords(referencedImageId, longAxisPoints[1]);
|
|
158
|
+
const {
|
|
159
|
+
length,
|
|
160
|
+
width
|
|
161
|
+
} = cachedStats[`imageId:${referencedImageId}`] || {};
|
|
97
162
|
return {
|
|
98
163
|
longAxis: {
|
|
99
164
|
point1: {
|
|
@@ -119,7 +184,66 @@ class Bidirectional extends BaseAdapter3D {
|
|
|
119
184
|
shortAxisLength: width,
|
|
120
185
|
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
121
186
|
finding: finding,
|
|
122
|
-
findingSites: findingSites || []
|
|
187
|
+
findingSites: findingSites || [],
|
|
188
|
+
use3DSpatialCoordinates: false
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
static getTID300RepresentationArgumentsSCOORD3D(_ref3) {
|
|
192
|
+
let {
|
|
193
|
+
tool,
|
|
194
|
+
shortAxisPoints,
|
|
195
|
+
longAxisPoints
|
|
196
|
+
} = _ref3;
|
|
197
|
+
const {
|
|
198
|
+
data,
|
|
199
|
+
finding,
|
|
200
|
+
findingSites,
|
|
201
|
+
metadata
|
|
202
|
+
} = tool;
|
|
203
|
+
const {
|
|
204
|
+
cachedStats = {}
|
|
205
|
+
} = data;
|
|
206
|
+
const longAxisStart = shortAxisPoints[0];
|
|
207
|
+
const longAxisEnd = shortAxisPoints[1];
|
|
208
|
+
const shortAxisStart = longAxisPoints[0];
|
|
209
|
+
const shortAxisEnd = longAxisPoints[1];
|
|
210
|
+
const cachedStatsKeys = Object.keys(cachedStats)[0];
|
|
211
|
+
const {
|
|
212
|
+
length,
|
|
213
|
+
width
|
|
214
|
+
} = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
|
|
215
|
+
return {
|
|
216
|
+
longAxis: {
|
|
217
|
+
point1: {
|
|
218
|
+
x: longAxisStart[0],
|
|
219
|
+
y: longAxisStart[1],
|
|
220
|
+
z: longAxisStart[2]
|
|
221
|
+
},
|
|
222
|
+
point2: {
|
|
223
|
+
x: longAxisEnd[0],
|
|
224
|
+
y: longAxisEnd[1],
|
|
225
|
+
z: longAxisEnd[2]
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
shortAxis: {
|
|
229
|
+
point1: {
|
|
230
|
+
x: shortAxisStart[0],
|
|
231
|
+
y: shortAxisStart[1],
|
|
232
|
+
z: shortAxisStart[2]
|
|
233
|
+
},
|
|
234
|
+
point2: {
|
|
235
|
+
x: shortAxisEnd[0],
|
|
236
|
+
y: shortAxisEnd[1],
|
|
237
|
+
z: shortAxisEnd[2]
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
longAxisLength: length,
|
|
241
|
+
shortAxisLength: width,
|
|
242
|
+
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
243
|
+
finding: finding,
|
|
244
|
+
findingSites: findingSites || [],
|
|
245
|
+
ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
|
|
246
|
+
use3DSpatialCoordinates: true
|
|
123
247
|
};
|
|
124
248
|
}
|
|
125
249
|
}
|
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
import BaseAdapter3D from "./BaseAdapter3D";
|
|
2
2
|
declare class CircleROI extends BaseAdapter3D {
|
|
3
|
-
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any):
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any): any;
|
|
4
|
+
static getMeasurementDataFromScoord({ defaultState, SCOORDGroup, imageToWorldCoords, NUMGroup, ReferencedFrameNumber }: {
|
|
5
|
+
defaultState: any;
|
|
6
|
+
SCOORDGroup: any;
|
|
7
|
+
imageToWorldCoords: any;
|
|
8
|
+
NUMGroup: any;
|
|
9
|
+
ReferencedFrameNumber: any;
|
|
10
|
+
}): any;
|
|
11
|
+
static getMeasurementDataFromScoord3D({ defaultState, SCOORD3DGroup }: {
|
|
12
|
+
defaultState: any;
|
|
13
|
+
SCOORD3DGroup: any;
|
|
14
|
+
}): any;
|
|
15
|
+
static getTID300RepresentationArguments(tool: any, worldToImageCoords: any): {
|
|
16
|
+
area: any;
|
|
17
|
+
perimeter: number;
|
|
18
|
+
radius: any;
|
|
19
|
+
points: any[];
|
|
20
|
+
trackingIdentifierTextValue: string;
|
|
16
21
|
finding: any;
|
|
17
|
-
findingSites: any
|
|
22
|
+
findingSites: any;
|
|
23
|
+
ReferencedFrameOfReferenceUID: any;
|
|
24
|
+
use3DSpatialCoordinates: boolean;
|
|
25
|
+
} | {
|
|
26
|
+
area: any;
|
|
27
|
+
perimeter: number;
|
|
28
|
+
radius: any;
|
|
29
|
+
points: any[];
|
|
30
|
+
trackingIdentifierTextValue: string;
|
|
31
|
+
finding: any;
|
|
32
|
+
findingSites: any;
|
|
33
|
+
use3DSpatialCoordinates: boolean;
|
|
18
34
|
};
|
|
19
|
-
static
|
|
35
|
+
static getTID300RepresentationArgumentsSCOORD3D(tool: any): {
|
|
20
36
|
area: any;
|
|
21
37
|
perimeter: number;
|
|
22
38
|
radius: any;
|
|
@@ -24,6 +40,8 @@ declare class CircleROI extends BaseAdapter3D {
|
|
|
24
40
|
trackingIdentifierTextValue: string;
|
|
25
41
|
finding: any;
|
|
26
42
|
findingSites: any;
|
|
43
|
+
ReferencedFrameOfReferenceUID: any;
|
|
44
|
+
use3DSpatialCoordinates: boolean;
|
|
27
45
|
};
|
|
28
46
|
}
|
|
29
47
|
export default CircleROI;
|
|
@@ -12,8 +12,34 @@ class CircleROI extends BaseAdapter3D {
|
|
|
12
12
|
defaultState,
|
|
13
13
|
NUMGroup,
|
|
14
14
|
SCOORDGroup,
|
|
15
|
+
SCOORD3DGroup,
|
|
15
16
|
ReferencedFrameNumber
|
|
16
17
|
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, CircleROI.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;
|
|
17
43
|
const referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
18
44
|
const {
|
|
19
45
|
GraphicData
|
|
@@ -43,6 +69,32 @@ class CircleROI extends BaseAdapter3D {
|
|
|
43
69
|
};
|
|
44
70
|
return state;
|
|
45
71
|
}
|
|
72
|
+
static getMeasurementDataFromScoord3D(_ref2) {
|
|
73
|
+
let {
|
|
74
|
+
defaultState,
|
|
75
|
+
SCOORD3DGroup
|
|
76
|
+
} = _ref2;
|
|
77
|
+
const {
|
|
78
|
+
GraphicData
|
|
79
|
+
} = SCOORD3DGroup;
|
|
80
|
+
const pointsWorld = [];
|
|
81
|
+
for (let i = 0; i < GraphicData.length; i += 3) {
|
|
82
|
+
const worldPos = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
|
|
83
|
+
pointsWorld.push(worldPos);
|
|
84
|
+
}
|
|
85
|
+
const state = defaultState;
|
|
86
|
+
state.annotation.data = {
|
|
87
|
+
handles: {
|
|
88
|
+
points: [...pointsWorld],
|
|
89
|
+
activeHandleIndex: 0,
|
|
90
|
+
textBox: {
|
|
91
|
+
hasMoved: false
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
cachedStats: {}
|
|
95
|
+
};
|
|
96
|
+
return state;
|
|
97
|
+
}
|
|
46
98
|
static getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
47
99
|
const {
|
|
48
100
|
data,
|
|
@@ -58,7 +110,7 @@ class CircleROI extends BaseAdapter3D {
|
|
|
58
110
|
referencedImageId
|
|
59
111
|
} = metadata;
|
|
60
112
|
if (!referencedImageId) {
|
|
61
|
-
|
|
113
|
+
return this.getTID300RepresentationArgumentsSCOORD3D(tool);
|
|
62
114
|
}
|
|
63
115
|
const center = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
64
116
|
const end = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
@@ -83,7 +135,50 @@ class CircleROI extends BaseAdapter3D {
|
|
|
83
135
|
points,
|
|
84
136
|
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
85
137
|
finding,
|
|
86
|
-
findingSites: findingSites || []
|
|
138
|
+
findingSites: findingSites || [],
|
|
139
|
+
use3DSpatialCoordinates: false
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
static getTID300RepresentationArgumentsSCOORD3D(tool) {
|
|
143
|
+
const {
|
|
144
|
+
data,
|
|
145
|
+
finding,
|
|
146
|
+
findingSites,
|
|
147
|
+
metadata
|
|
148
|
+
} = tool;
|
|
149
|
+
const {
|
|
150
|
+
cachedStats = {},
|
|
151
|
+
handles
|
|
152
|
+
} = data;
|
|
153
|
+
const center = handles.points[0];
|
|
154
|
+
const end = handles.points[1];
|
|
155
|
+
const points = [];
|
|
156
|
+
points.push({
|
|
157
|
+
x: center[0],
|
|
158
|
+
y: center[1],
|
|
159
|
+
z: center[2]
|
|
160
|
+
});
|
|
161
|
+
points.push({
|
|
162
|
+
x: end[0],
|
|
163
|
+
y: end[1],
|
|
164
|
+
z: center[2]
|
|
165
|
+
});
|
|
166
|
+
const cachedStatsKeys = Object.keys(cachedStats)[0];
|
|
167
|
+
const {
|
|
168
|
+
area,
|
|
169
|
+
radius
|
|
170
|
+
} = cachedStatsKeys ? cachedStats[cachedStatsKeys] : {};
|
|
171
|
+
const perimeter = 2 * Math.PI * radius;
|
|
172
|
+
return {
|
|
173
|
+
area,
|
|
174
|
+
perimeter,
|
|
175
|
+
radius,
|
|
176
|
+
points,
|
|
177
|
+
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
178
|
+
finding,
|
|
179
|
+
findingSites: findingSites || [],
|
|
180
|
+
ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
|
|
181
|
+
use3DSpatialCoordinates: true
|
|
87
182
|
};
|
|
88
183
|
}
|
|
89
184
|
}
|
|
@@ -1,42 +1,94 @@
|
|
|
1
1
|
import BaseAdapter3D from "./BaseAdapter3D";
|
|
2
2
|
declare class CobbAngle extends BaseAdapter3D {
|
|
3
|
-
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any):
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any): any;
|
|
4
|
+
static getMeasurementDataFromScoord({ defaultState, SCOORDGroup, imageToWorldCoords, NUMGroup, ReferencedFrameNumber }: {
|
|
5
|
+
defaultState: any;
|
|
6
|
+
SCOORDGroup: any;
|
|
7
|
+
imageToWorldCoords: any;
|
|
8
|
+
NUMGroup: any;
|
|
9
|
+
ReferencedFrameNumber: any;
|
|
10
|
+
}): any;
|
|
11
|
+
static getMeasurementDataFromScoord3D({ defaultState, SCOORD3DGroup }: {
|
|
12
|
+
defaultState: any;
|
|
13
|
+
SCOORD3DGroup: any;
|
|
14
|
+
}): any;
|
|
15
|
+
static getTID300RepresentationArguments(tool: any, worldToImageCoords: any): {
|
|
16
|
+
point1: {
|
|
17
|
+
x: any;
|
|
18
|
+
y: any;
|
|
19
|
+
z: any;
|
|
20
|
+
};
|
|
21
|
+
point2: {
|
|
22
|
+
x: any;
|
|
23
|
+
y: any;
|
|
24
|
+
z: any;
|
|
25
|
+
};
|
|
26
|
+
point3: {
|
|
27
|
+
x: any;
|
|
28
|
+
y: any;
|
|
29
|
+
z: any;
|
|
30
|
+
};
|
|
31
|
+
point4: {
|
|
32
|
+
x: any;
|
|
33
|
+
y: any;
|
|
34
|
+
z: any;
|
|
35
|
+
};
|
|
36
|
+
rAngle: any;
|
|
37
|
+
trackingIdentifierTextValue: string;
|
|
38
|
+
finding: any;
|
|
39
|
+
findingSites: any;
|
|
40
|
+
ReferencedFrameOfReferenceUID: any;
|
|
41
|
+
use3DSpatialCoordinates: boolean;
|
|
42
|
+
} | {
|
|
43
|
+
point1: {
|
|
44
|
+
x: any;
|
|
45
|
+
y: any;
|
|
46
|
+
};
|
|
47
|
+
point2: {
|
|
48
|
+
x: any;
|
|
49
|
+
y: any;
|
|
50
|
+
};
|
|
51
|
+
point3: {
|
|
52
|
+
x: any;
|
|
53
|
+
y: any;
|
|
54
|
+
};
|
|
55
|
+
point4: {
|
|
56
|
+
x: any;
|
|
57
|
+
y: any;
|
|
15
58
|
};
|
|
59
|
+
rAngle: any;
|
|
60
|
+
trackingIdentifierTextValue: string;
|
|
16
61
|
finding: any;
|
|
17
|
-
findingSites: any
|
|
62
|
+
findingSites: any;
|
|
63
|
+
use3DSpatialCoordinates: boolean;
|
|
18
64
|
};
|
|
19
|
-
static
|
|
65
|
+
static getTID300RepresentationArgumentsSCOORD3D(tool: any): {
|
|
20
66
|
point1: {
|
|
21
67
|
x: any;
|
|
22
68
|
y: any;
|
|
69
|
+
z: any;
|
|
23
70
|
};
|
|
24
71
|
point2: {
|
|
25
72
|
x: any;
|
|
26
73
|
y: any;
|
|
74
|
+
z: any;
|
|
27
75
|
};
|
|
28
76
|
point3: {
|
|
29
77
|
x: any;
|
|
30
78
|
y: any;
|
|
79
|
+
z: any;
|
|
31
80
|
};
|
|
32
81
|
point4: {
|
|
33
82
|
x: any;
|
|
34
83
|
y: any;
|
|
84
|
+
z: any;
|
|
35
85
|
};
|
|
36
86
|
rAngle: any;
|
|
37
87
|
trackingIdentifierTextValue: string;
|
|
38
88
|
finding: any;
|
|
39
89
|
findingSites: any;
|
|
90
|
+
ReferencedFrameOfReferenceUID: any;
|
|
91
|
+
use3DSpatialCoordinates: boolean;
|
|
40
92
|
};
|
|
41
93
|
}
|
|
42
94
|
export default CobbAngle;
|
|
@@ -12,8 +12,34 @@ class CobbAngle extends BaseAdapter3D {
|
|
|
12
12
|
defaultState,
|
|
13
13
|
NUMGroup,
|
|
14
14
|
SCOORDGroup,
|
|
15
|
+
SCOORD3DGroup,
|
|
15
16
|
ReferencedFrameNumber
|
|
16
17
|
} = 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;
|
|
17
43
|
const referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
18
44
|
const {
|
|
19
45
|
GraphicData
|
|
@@ -41,6 +67,32 @@ class CobbAngle extends BaseAdapter3D {
|
|
|
41
67
|
};
|
|
42
68
|
return state;
|
|
43
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);
|
|
82
|
+
}
|
|
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
|
+
return state;
|
|
95
|
+
}
|
|
44
96
|
static getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
45
97
|
const {
|
|
46
98
|
data,
|
|
@@ -56,7 +108,7 @@ class CobbAngle extends BaseAdapter3D {
|
|
|
56
108
|
referencedImageId
|
|
57
109
|
} = metadata;
|
|
58
110
|
if (!referencedImageId) {
|
|
59
|
-
|
|
111
|
+
return this.getTID300RepresentationArgumentsSCOORD3D(tool);
|
|
60
112
|
}
|
|
61
113
|
const start1 = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
62
114
|
const end1 = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
@@ -89,7 +141,60 @@ class CobbAngle extends BaseAdapter3D {
|
|
|
89
141
|
rAngle: angle,
|
|
90
142
|
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
91
143
|
finding,
|
|
92
|
-
findingSites: findingSites || []
|
|
144
|
+
findingSites: findingSites || [],
|
|
145
|
+
use3DSpatialCoordinates: false
|
|
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
|
|
93
198
|
};
|
|
94
199
|
}
|
|
95
200
|
}
|
|
@@ -1,27 +1,42 @@
|
|
|
1
1
|
import BaseAdapter3D from "./BaseAdapter3D";
|
|
2
2
|
declare class EllipticalROI extends BaseAdapter3D {
|
|
3
|
-
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any):
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any): any;
|
|
4
|
+
static getMeasurementDataFromScoord({ defaultState, SCOORDGroup, imageToWorldCoords, metadata, NUMGroup, ReferencedFrameNumber }: {
|
|
5
|
+
defaultState: any;
|
|
6
|
+
SCOORDGroup: any;
|
|
7
|
+
imageToWorldCoords: any;
|
|
8
|
+
metadata: any;
|
|
9
|
+
NUMGroup: any;
|
|
10
|
+
ReferencedFrameNumber: any;
|
|
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;
|
|
16
20
|
finding: any;
|
|
17
|
-
findingSites: 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;
|
|
18
31
|
};
|
|
19
|
-
static
|
|
32
|
+
static getTID300RepresentationArgumentsSCOORD3D(tool: any): {
|
|
20
33
|
area: any;
|
|
21
34
|
points: any[];
|
|
22
35
|
trackingIdentifierTextValue: string;
|
|
23
36
|
finding: any;
|
|
24
37
|
findingSites: any;
|
|
38
|
+
ReferencedFrameOfReferenceUID: any;
|
|
39
|
+
use3DSpatialCoordinates: boolean;
|
|
25
40
|
};
|
|
26
41
|
}
|
|
27
42
|
export default EllipticalROI;
|