Skip to content

Commit 204128c

Browse files
committed
fix(dcmjs): Store an optional second point for the arrow annotation
The point TID300 normally takes 1 point, but seems to be ok if an extra one is added for the source of the indicator.
1 parent 7a4eeda commit 204128c

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/adapters/Cornerstone/ArrowAnnotate.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const CORNERSTONEFREETEXT = "CORNERSTONEFREETEXT";
88
class ArrowAnnotate {
99
constructor() {}
1010

11-
// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
1211
static getMeasurementData(MeasurementGroup) {
1312
const {
1413
defaultState,
@@ -31,11 +30,17 @@ class ArrowAnnotate {
3130
highlight: true,
3231
active: false
3332
},
34-
// TODO: How do we choose where the end goes?
35-
// Just put it pointing from the bottom right for now?
33+
// Use a generic offset if the stored data doesn't have the endpoint, otherwise
34+
// use the actual endpoint.
3635
end: {
37-
x: GraphicData[0] + 20,
38-
y: GraphicData[1] + 20,
36+
x:
37+
GraphicData.length == 4
38+
? GraphicData[2]
39+
: GraphicData[0] + 20,
40+
y:
41+
GraphicData.length == 4
42+
? GraphicData[3]
43+
: GraphicData[1] + 20,
3944
highlight: true,
4045
active: false
4146
},
@@ -56,7 +61,7 @@ class ArrowAnnotate {
5661
}
5762

5863
static getTID300RepresentationArguments(tool) {
59-
const points = [tool.handles.start];
64+
const points = [tool.handles.start, tool.handles.end];
6065

6166
let { finding, findingSites } = tool;
6267

src/utilities/TID300/Point.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ export default class Point extends TID300Measurement {
1212
const GraphicData = use3DSpatialCoordinates
1313
? [points[0].x, points[0].y, points[0].z]
1414
: [points[0].x, points[0].y];
15-
15+
// Allow storing another point as part of an indicator showing a single point
16+
if (points.length == 2) {
17+
GraphicData.push(points[1].x);
18+
GraphicData.push(points[1].y);
19+
if (use3DSpatialCoordinates) GraphicData.push(points[1].z);
20+
}
1621
return this.getMeasurement([
1722
{
1823
RelationshipType: "CONTAINS",

0 commit comments

Comments
 (0)