@cornerstonejs/adapters 3.30.3 → 3.31.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/adapters/Cornerstone/Bidirectional.js +1 -0
- package/dist/esm/adapters/Cornerstone/MeasurementReport.js +1 -0
- package/dist/esm/adapters/Cornerstone3D/Angle.d.ts +23 -62
- package/dist/esm/adapters/Cornerstone3D/Angle.js +29 -141
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.d.ts +13 -27
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.js +26 -144
- package/dist/esm/adapters/Cornerstone3D/BaseAdapter3D.d.ts +2 -12
- package/dist/esm/adapters/Cornerstone3D/BaseAdapter3D.js +13 -42
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.d.ts +23 -80
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.js +33 -167
- package/dist/esm/adapters/Cornerstone3D/CircleROI.d.ts +16 -33
- package/dist/esm/adapters/Cornerstone3D/CircleROI.js +28 -129
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.d.ts +23 -62
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.js +22 -144
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.d.ts +7 -29
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.js +25 -176
- package/dist/esm/adapters/Cornerstone3D/KeyImage.d.ts +8 -10
- package/dist/esm/adapters/Cornerstone3D/KeyImage.js +2 -2
- package/dist/esm/adapters/Cornerstone3D/Length.d.ts +15 -44
- package/dist/esm/adapters/Cornerstone3D/Length.js +28 -121
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.d.ts +57 -38
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.js +66 -30
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.d.ts +16 -41
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.js +25 -132
- package/dist/esm/adapters/Cornerstone3D/Probe.d.ts +7 -21
- package/dist/esm/adapters/Cornerstone3D/Probe.js +12 -39
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.d.ts +1 -1
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.js +7 -2
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.d.ts +6 -15
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.js +6 -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/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.js +1 -0
- package/dist/esm/version.d.ts +1 -1
- package/package.json +5 -5
|
@@ -1,87 +1,48 @@
|
|
|
1
1
|
import BaseAdapter3D from "./BaseAdapter3D";
|
|
2
2
|
declare class Angle extends BaseAdapter3D {
|
|
3
|
-
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any):
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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;
|
|
58
|
-
};
|
|
59
|
-
rAngle: any;
|
|
60
|
-
trackingIdentifierTextValue: string;
|
|
61
|
-
finding: any;
|
|
62
|
-
findingSites: any;
|
|
63
|
-
use3DSpatialCoordinates: boolean;
|
|
3
|
+
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any): {
|
|
4
|
+
description?: string;
|
|
5
|
+
sopInstanceUid?: string;
|
|
6
|
+
annotation: import("packages/tools/dist/esm/types").Annotation;
|
|
7
|
+
finding?: unknown;
|
|
8
|
+
findingSites?: unknown;
|
|
64
9
|
};
|
|
65
|
-
static
|
|
10
|
+
static getTID300RepresentationArguments(tool: any, is3DMeasurement?: boolean): {
|
|
66
11
|
point1: {
|
|
67
12
|
x: any;
|
|
68
13
|
y: any;
|
|
69
14
|
z: any;
|
|
15
|
+
} | {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
z?: undefined;
|
|
70
19
|
};
|
|
71
20
|
point2: {
|
|
72
21
|
x: any;
|
|
73
22
|
y: any;
|
|
74
23
|
z: any;
|
|
24
|
+
} | {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
z?: undefined;
|
|
75
28
|
};
|
|
76
29
|
point3: {
|
|
77
30
|
x: any;
|
|
78
31
|
y: any;
|
|
79
32
|
z: any;
|
|
33
|
+
} | {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
z?: undefined;
|
|
80
37
|
};
|
|
81
38
|
point4: {
|
|
82
39
|
x: any;
|
|
83
40
|
y: any;
|
|
84
41
|
z: any;
|
|
42
|
+
} | {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
z?: undefined;
|
|
85
46
|
};
|
|
86
47
|
rAngle: any;
|
|
87
48
|
trackingIdentifierTextValue: string;
|
|
@@ -1,6 +1,9 @@
|
|
|
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 { toScoord } from '../helpers/toScoordType.js';
|
|
6
|
+
import '@cornerstonejs/core';
|
|
4
7
|
|
|
5
8
|
var _Angle;
|
|
6
9
|
const {
|
|
@@ -9,91 +12,35 @@ const {
|
|
|
9
12
|
class Angle extends BaseAdapter3D {
|
|
10
13
|
static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
11
14
|
const {
|
|
12
|
-
|
|
15
|
+
state,
|
|
13
16
|
NUMGroup,
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
scoord,
|
|
18
|
+
scoordArgs,
|
|
19
|
+
worldCoords,
|
|
20
|
+
referencedImageId,
|
|
16
21
|
ReferencedFrameNumber
|
|
17
|
-
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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;
|
|
22
|
+
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, this.toolType);
|
|
23
|
+
const cachedStats = referencedImageId ? {
|
|
24
|
+
[`imageId:${referencedImageId}`]: {
|
|
25
|
+
angle: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : null
|
|
26
|
+
}
|
|
27
|
+
} : {};
|
|
53
28
|
state.annotation.data = {
|
|
29
|
+
...state.annotation.data,
|
|
54
30
|
handles: {
|
|
55
|
-
points:
|
|
31
|
+
points: worldCoords,
|
|
56
32
|
activeHandleIndex: 0,
|
|
57
33
|
textBox: {
|
|
58
34
|
hasMoved: false
|
|
59
35
|
}
|
|
60
36
|
},
|
|
61
|
-
cachedStats
|
|
62
|
-
[`imageId:${referencedImageId}`]: {
|
|
63
|
-
angle: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : null
|
|
64
|
-
}
|
|
65
|
-
},
|
|
37
|
+
cachedStats,
|
|
66
38
|
frameNumber: ReferencedFrameNumber
|
|
67
39
|
};
|
|
68
40
|
return state;
|
|
69
41
|
}
|
|
70
|
-
static
|
|
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[3]],
|
|
87
|
-
activeHandleIndex: 0,
|
|
88
|
-
textBox: {
|
|
89
|
-
hasMoved: false
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
cachedStats: {}
|
|
93
|
-
};
|
|
94
|
-
return state;
|
|
95
|
-
}
|
|
96
|
-
static getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
42
|
+
static getTID300RepresentationArguments(tool) {
|
|
43
|
+
let is3DMeasurement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
97
44
|
const {
|
|
98
45
|
data,
|
|
99
46
|
finding,
|
|
@@ -107,74 +54,15 @@ class Angle extends BaseAdapter3D {
|
|
|
107
54
|
const {
|
|
108
55
|
referencedImageId
|
|
109
56
|
} = metadata;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const start1 = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
114
|
-
const middle = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
115
|
-
const end = worldToImageCoords(referencedImageId, handles.points[2]);
|
|
116
|
-
const point1 = {
|
|
117
|
-
x: start1[0],
|
|
118
|
-
y: start1[1]
|
|
119
|
-
};
|
|
120
|
-
const point2 = {
|
|
121
|
-
x: middle[0],
|
|
122
|
-
y: middle[1]
|
|
123
|
-
};
|
|
124
|
-
const point3 = point2;
|
|
125
|
-
const point4 = {
|
|
126
|
-
x: end[0],
|
|
127
|
-
y: end[1]
|
|
128
|
-
};
|
|
129
|
-
const {
|
|
130
|
-
angle
|
|
131
|
-
} = cachedStats[`imageId:${referencedImageId}`] || {};
|
|
132
|
-
return {
|
|
133
|
-
point1,
|
|
134
|
-
point2,
|
|
135
|
-
point3,
|
|
136
|
-
point4,
|
|
137
|
-
rAngle: angle,
|
|
138
|
-
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
139
|
-
finding,
|
|
140
|
-
findingSites: findingSites || [],
|
|
141
|
-
use3DSpatialCoordinates: false
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
static getTID300RepresentationArgumentsSCOORD3D(tool) {
|
|
145
|
-
const {
|
|
146
|
-
data,
|
|
147
|
-
finding,
|
|
148
|
-
findingSites,
|
|
149
|
-
metadata
|
|
150
|
-
} = tool;
|
|
151
|
-
const {
|
|
152
|
-
cachedStats = {},
|
|
153
|
-
handles
|
|
154
|
-
} = data;
|
|
155
|
-
const start = handles.points[0];
|
|
156
|
-
const middle = handles.points[1];
|
|
157
|
-
const end = handles.points[2];
|
|
158
|
-
const point1 = {
|
|
159
|
-
x: start[0],
|
|
160
|
-
y: start[1],
|
|
161
|
-
z: start[2]
|
|
162
|
-
};
|
|
163
|
-
const point2 = {
|
|
164
|
-
x: middle[0],
|
|
165
|
-
y: middle[1],
|
|
166
|
-
z: middle[2]
|
|
167
|
-
};
|
|
168
|
-
const point3 = point2;
|
|
169
|
-
const point4 = {
|
|
170
|
-
x: end[0],
|
|
171
|
-
y: end[1],
|
|
172
|
-
z: end[2]
|
|
57
|
+
const scoordProps = {
|
|
58
|
+
is3DMeasurement,
|
|
59
|
+
referencedImageId
|
|
173
60
|
};
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
61
|
+
const point1 = toScoord(scoordProps, handles.points[0]);
|
|
62
|
+
const point2 = toScoord(scoordProps, handles.points[1]);
|
|
63
|
+
const point3 = toScoord(scoordProps, handles.points[1]);
|
|
64
|
+
const point4 = toScoord(scoordProps, handles.points[2]);
|
|
65
|
+
const angle = cachedStats[`imageId:${referencedImageId}`]?.angle;
|
|
178
66
|
return {
|
|
179
67
|
point1,
|
|
180
68
|
point2,
|
|
@@ -184,8 +72,8 @@ class Angle extends BaseAdapter3D {
|
|
|
184
72
|
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
185
73
|
finding,
|
|
186
74
|
findingSites: findingSites || [],
|
|
187
|
-
ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
|
|
188
|
-
use3DSpatialCoordinates:
|
|
75
|
+
ReferencedFrameOfReferenceUID: is3DMeasurement ? metadata.FrameOfReferenceUID : null,
|
|
76
|
+
use3DSpatialCoordinates: is3DMeasurement
|
|
189
77
|
};
|
|
190
78
|
}
|
|
191
79
|
}
|
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
import BaseAdapter3D from "./BaseAdapter3D";
|
|
2
2
|
declare class ArrowAnnotate extends BaseAdapter3D {
|
|
3
|
-
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any, _trackingIdentifier: any):
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
static getMeasurementDataFromScoord({ SCOORDGroup, referencedImageId, metadata, imageToWorldCoords, defaultState, text, ReferencedFrameNumber }: {
|
|
10
|
-
SCOORDGroup: any;
|
|
11
|
-
referencedImageId: any;
|
|
12
|
-
metadata: any;
|
|
13
|
-
imageToWorldCoords: any;
|
|
14
|
-
defaultState: any;
|
|
15
|
-
text: any;
|
|
16
|
-
ReferencedFrameNumber: any;
|
|
17
|
-
}): any;
|
|
18
|
-
static getTID300RepresentationArguments(tool: any, worldToImageCoords: any): {
|
|
19
|
-
points: {
|
|
20
|
-
x: any;
|
|
21
|
-
y: any;
|
|
22
|
-
}[];
|
|
23
|
-
trackingIdentifierTextValue: string;
|
|
24
|
-
findingSites: any;
|
|
25
|
-
finding: any;
|
|
26
|
-
use3DSpatialCoordinates: boolean;
|
|
3
|
+
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any, _trackingIdentifier: any): {
|
|
4
|
+
description?: string;
|
|
5
|
+
sopInstanceUid?: string;
|
|
6
|
+
annotation: import("packages/tools/dist/esm/types").Annotation;
|
|
7
|
+
finding?: unknown;
|
|
8
|
+
findingSites?: unknown;
|
|
27
9
|
};
|
|
28
|
-
static
|
|
29
|
-
points: {
|
|
10
|
+
static getTID300RepresentationArguments(tool: any, is3DMeasurement?: boolean): {
|
|
11
|
+
points: ({
|
|
30
12
|
x: any;
|
|
31
13
|
y: any;
|
|
32
14
|
z: any;
|
|
33
|
-
}
|
|
15
|
+
} | {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
z?: undefined;
|
|
19
|
+
})[];
|
|
34
20
|
trackingIdentifierTextValue: string;
|
|
35
21
|
findingSites: any;
|
|
36
22
|
finding: any;
|
|
@@ -2,6 +2,9 @@ import MeasurementReport from './MeasurementReport.js';
|
|
|
2
2
|
import { utilities } from 'dcmjs';
|
|
3
3
|
import BaseAdapter3D from './BaseAdapter3D.js';
|
|
4
4
|
import CodingScheme from './CodingScheme.js';
|
|
5
|
+
import 'buffer';
|
|
6
|
+
import { toScoord } from '../helpers/toScoordType.js';
|
|
7
|
+
import '@cornerstonejs/core';
|
|
5
8
|
|
|
6
9
|
var _ArrowAnnotate;
|
|
7
10
|
const {
|
|
@@ -13,80 +16,15 @@ const {
|
|
|
13
16
|
class ArrowAnnotate extends BaseAdapter3D {
|
|
14
17
|
static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata, _trackingIdentifier) {
|
|
15
18
|
const {
|
|
16
|
-
|
|
17
|
-
SCOORDGroup,
|
|
18
|
-
SCOORD3DGroup,
|
|
19
|
-
ReferencedFrameNumber
|
|
20
|
-
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, ArrowAnnotate.toolType);
|
|
21
|
-
const referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
22
|
-
const text = defaultState.annotation.metadata.label;
|
|
23
|
-
if (SCOORDGroup) {
|
|
24
|
-
return this.getMeasurementDataFromScoord({
|
|
25
|
-
SCOORDGroup,
|
|
26
|
-
referencedImageId,
|
|
27
|
-
metadata,
|
|
28
|
-
imageToWorldCoords,
|
|
29
|
-
defaultState,
|
|
30
|
-
text,
|
|
31
|
-
ReferencedFrameNumber
|
|
32
|
-
});
|
|
33
|
-
} else if (SCOORD3DGroup) {
|
|
34
|
-
return this.getMeasurementDataFromScoord3D({
|
|
35
|
-
SCOORD3DGroup,
|
|
36
|
-
defaultState,
|
|
37
|
-
text
|
|
38
|
-
});
|
|
39
|
-
} else {
|
|
40
|
-
throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
static getMeasurementDataFromScoord3D(_ref) {
|
|
44
|
-
let {
|
|
45
|
-
SCOORD3DGroup,
|
|
46
|
-
defaultState,
|
|
47
|
-
text
|
|
48
|
-
} = _ref;
|
|
49
|
-
const {
|
|
50
|
-
GraphicData
|
|
51
|
-
} = SCOORD3DGroup;
|
|
52
|
-
const worldCoords = [];
|
|
53
|
-
for (let i = 0; i < GraphicData.length; i += 3) {
|
|
54
|
-
const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
|
|
55
|
-
worldCoords.push(point);
|
|
56
|
-
}
|
|
57
|
-
const state = defaultState;
|
|
58
|
-
state.annotation.data = {
|
|
59
|
-
text,
|
|
60
|
-
handles: {
|
|
61
|
-
arrowFirst: true,
|
|
62
|
-
points: [worldCoords[0], worldCoords[1]],
|
|
63
|
-
activeHandleIndex: 0,
|
|
64
|
-
textBox: {
|
|
65
|
-
hasMoved: false
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
return state;
|
|
70
|
-
}
|
|
71
|
-
static getMeasurementDataFromScoord(_ref2) {
|
|
72
|
-
let {
|
|
19
|
+
state,
|
|
73
20
|
SCOORDGroup,
|
|
21
|
+
scoordArgs,
|
|
22
|
+
worldCoords,
|
|
74
23
|
referencedImageId,
|
|
75
|
-
metadata,
|
|
76
|
-
imageToWorldCoords,
|
|
77
|
-
defaultState,
|
|
78
|
-
text,
|
|
79
24
|
ReferencedFrameNumber
|
|
80
|
-
} =
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
} = SCOORDGroup;
|
|
84
|
-
const worldCoords = [];
|
|
85
|
-
for (let i = 0; i < GraphicData.length; i += 2) {
|
|
86
|
-
const point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
87
|
-
worldCoords.push(point);
|
|
88
|
-
}
|
|
89
|
-
if (worldCoords.length === 1) {
|
|
25
|
+
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, this.toolType);
|
|
26
|
+
const text = state.annotation.data.label;
|
|
27
|
+
if (worldCoords.length === 1 && SCOORDGroup) {
|
|
90
28
|
const imagePixelModule = metadata.get("imagePixelModule", referencedImageId);
|
|
91
29
|
let xOffset = 10;
|
|
92
30
|
let yOffset = 10;
|
|
@@ -98,15 +36,18 @@ class ArrowAnnotate extends BaseAdapter3D {
|
|
|
98
36
|
xOffset = columns / 10;
|
|
99
37
|
yOffset = rows / 10;
|
|
100
38
|
}
|
|
39
|
+
const {
|
|
40
|
+
GraphicData
|
|
41
|
+
} = SCOORDGroup;
|
|
101
42
|
const secondPoint = imageToWorldCoords(referencedImageId, [GraphicData[0] + xOffset, GraphicData[1] + yOffset]);
|
|
102
43
|
worldCoords.push(secondPoint);
|
|
103
44
|
}
|
|
104
|
-
const state = defaultState;
|
|
105
45
|
state.annotation.data = {
|
|
46
|
+
...state.annotation.data,
|
|
106
47
|
text,
|
|
107
48
|
handles: {
|
|
108
49
|
arrowFirst: true,
|
|
109
|
-
points:
|
|
50
|
+
points: worldCoords,
|
|
110
51
|
activeHandleIndex: 0,
|
|
111
52
|
textBox: {
|
|
112
53
|
hasMoved: false
|
|
@@ -116,7 +57,8 @@ class ArrowAnnotate extends BaseAdapter3D {
|
|
|
116
57
|
};
|
|
117
58
|
return state;
|
|
118
59
|
}
|
|
119
|
-
static getTID300RepresentationArguments(tool
|
|
60
|
+
static getTID300RepresentationArguments(tool) {
|
|
61
|
+
let is3DMeasurement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
120
62
|
const {
|
|
121
63
|
data,
|
|
122
64
|
metadata,
|
|
@@ -128,85 +70,25 @@ class ArrowAnnotate extends BaseAdapter3D {
|
|
|
128
70
|
const {
|
|
129
71
|
referencedImageId
|
|
130
72
|
} = metadata;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const {
|
|
135
|
-
points,
|
|
136
|
-
arrowFirst
|
|
137
|
-
} = data.handles;
|
|
138
|
-
let point;
|
|
139
|
-
let point2;
|
|
140
|
-
if (arrowFirst) {
|
|
141
|
-
point = points[0];
|
|
142
|
-
point2 = points[1];
|
|
143
|
-
} else {
|
|
144
|
-
point = points[1];
|
|
145
|
-
point2 = points[0];
|
|
146
|
-
}
|
|
147
|
-
const pointImage = worldToImageCoords(referencedImageId, point);
|
|
148
|
-
const pointImage2 = worldToImageCoords(referencedImageId, point2);
|
|
149
|
-
const TID300RepresentationArguments = {
|
|
150
|
-
points: [{
|
|
151
|
-
x: pointImage[0],
|
|
152
|
-
y: pointImage[1]
|
|
153
|
-
}, {
|
|
154
|
-
x: pointImage2[0],
|
|
155
|
-
y: pointImage2[1]
|
|
156
|
-
}],
|
|
157
|
-
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
158
|
-
findingSites: findingSites || [],
|
|
159
|
-
finding,
|
|
160
|
-
use3DSpatialCoordinates: false
|
|
73
|
+
const scoordProps = {
|
|
74
|
+
is3DMeasurement,
|
|
75
|
+
referencedImageId
|
|
161
76
|
};
|
|
162
|
-
if (!finding || finding.CodeValue !== codeValues.CORNERSTONEFREETEXT) {
|
|
163
|
-
finding = {
|
|
164
|
-
CodeValue: codeValues.CORNERSTONEFREETEXT,
|
|
165
|
-
CodingSchemeDesignator: CodingScheme.CodingSchemeDesignator,
|
|
166
|
-
CodeMeaning: data.text
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
return TID300RepresentationArguments;
|
|
170
|
-
}
|
|
171
|
-
static getTID300RepresentationArgumentsSCOORD3D(tool) {
|
|
172
|
-
const {
|
|
173
|
-
data,
|
|
174
|
-
findingSites,
|
|
175
|
-
metadata
|
|
176
|
-
} = tool;
|
|
177
|
-
let {
|
|
178
|
-
finding
|
|
179
|
-
} = tool;
|
|
180
77
|
const {
|
|
181
78
|
points,
|
|
182
79
|
arrowFirst
|
|
183
80
|
} = data.handles;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
point2 = points[1];
|
|
189
|
-
} else {
|
|
190
|
-
point = points[1];
|
|
191
|
-
point2 = points[0];
|
|
192
|
-
}
|
|
193
|
-
const pointImage = point;
|
|
194
|
-
const pointImage2 = point2;
|
|
81
|
+
const point = arrowFirst ? points[0] : points[1];
|
|
82
|
+
const point2 = arrowFirst ? points[1] : points[0];
|
|
83
|
+
const pointImage = toScoord(scoordProps, point);
|
|
84
|
+
const pointImage2 = toScoord(scoordProps, point2);
|
|
195
85
|
const TID300RepresentationArguments = {
|
|
196
|
-
points: [
|
|
197
|
-
x: pointImage[0],
|
|
198
|
-
y: pointImage[1],
|
|
199
|
-
z: pointImage[2]
|
|
200
|
-
}, {
|
|
201
|
-
x: pointImage2[0],
|
|
202
|
-
y: pointImage2[1],
|
|
203
|
-
z: pointImage2[2]
|
|
204
|
-
}],
|
|
86
|
+
points: [pointImage, pointImage2],
|
|
205
87
|
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
206
88
|
findingSites: findingSites || [],
|
|
207
89
|
finding,
|
|
208
|
-
ReferencedFrameOfReferenceUID: metadata.FrameOfReferenceUID,
|
|
209
|
-
use3DSpatialCoordinates:
|
|
90
|
+
ReferencedFrameOfReferenceUID: is3DMeasurement ? metadata.FrameOfReferenceUID : null,
|
|
91
|
+
use3DSpatialCoordinates: is3DMeasurement
|
|
210
92
|
};
|
|
211
93
|
if (!finding || finding.CodeValue !== codeValues.CORNERSTONEFREETEXT) {
|
|
212
94
|
finding = {
|
|
@@ -26,19 +26,9 @@ export default class BaseAdapter3D {
|
|
|
26
26
|
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, _imageToWorldCoords: any, metadata: any, trackingIdentifier?: string): {
|
|
27
27
|
description?: string;
|
|
28
28
|
sopInstanceUid?: string;
|
|
29
|
-
annotation:
|
|
30
|
-
annotationUID: string;
|
|
31
|
-
metadata: {
|
|
32
|
-
toolName: string;
|
|
33
|
-
referencedImageId?: string;
|
|
34
|
-
FrameOfReferenceUID: string;
|
|
35
|
-
label: string;
|
|
36
|
-
};
|
|
37
|
-
data?: unknown;
|
|
38
|
-
};
|
|
29
|
+
annotation: import("packages/tools/dist/esm/types").Annotation;
|
|
39
30
|
finding?: unknown;
|
|
40
31
|
findingSites?: unknown;
|
|
41
32
|
};
|
|
42
|
-
static getTID300RepresentationArguments(tool: any,
|
|
43
|
-
static getTID300RepresentationArgumentsSCOORD3D(tool: any): TID300Arguments;
|
|
33
|
+
static getTID300RepresentationArguments(tool: any, is3DMeasurement?: boolean): TID300Arguments;
|
|
44
34
|
}
|