Skip to content

Commit

Permalink
fix(dcmjs): Store an optional second point for the arrow annotation
Browse files Browse the repository at this point in the history
The point TID300 normally takes 1 point, but seems to be ok if an extra
one is added for the source of the indicator.
  • Loading branch information
wayfarer3130 committed Oct 22, 2021
1 parent 7a4eeda commit 204128c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
17 changes: 11 additions & 6 deletions src/adapters/Cornerstone/ArrowAnnotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const CORNERSTONEFREETEXT = "CORNERSTONEFREETEXT";
class ArrowAnnotate {
constructor() {}

// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
static getMeasurementData(MeasurementGroup) {
const {
defaultState,
Expand All @@ -31,11 +30,17 @@ class ArrowAnnotate {
highlight: true,
active: false
},
// TODO: How do we choose where the end goes?
// Just put it pointing from the bottom right for now?
// Use a generic offset if the stored data doesn't have the endpoint, otherwise
// use the actual endpoint.
end: {
x: GraphicData[0] + 20,
y: GraphicData[1] + 20,
x:
GraphicData.length == 4
? GraphicData[2]
: GraphicData[0] + 20,
y:
GraphicData.length == 4
? GraphicData[3]
: GraphicData[1] + 20,
highlight: true,
active: false
},
Expand All @@ -56,7 +61,7 @@ class ArrowAnnotate {
}

static getTID300RepresentationArguments(tool) {
const points = [tool.handles.start];
const points = [tool.handles.start, tool.handles.end];

let { finding, findingSites } = tool;

Expand Down
7 changes: 6 additions & 1 deletion src/utilities/TID300/Point.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export default class Point extends TID300Measurement {
const GraphicData = use3DSpatialCoordinates
? [points[0].x, points[0].y, points[0].z]
: [points[0].x, points[0].y];

// Allow storing another point as part of an indicator showing a single point
if (points.length == 2) {
GraphicData.push(points[1].x);
GraphicData.push(points[1].y);
if (use3DSpatialCoordinates) GraphicData.push(points[1].z);
}
return this.getMeasurement([
{
RelationshipType: "CONTAINS",
Expand Down

0 comments on commit 204128c

Please sign in to comment.