WIP callout in SR viewport.
This commit is contained in:
parent
2704bd7cbc
commit
56358ad95f
@ -12,6 +12,7 @@ const drawEllipse = importInternal('drawing/drawEllipse');
|
|||||||
const drawHandles = importInternal('drawing/drawHandles');
|
const drawHandles = importInternal('drawing/drawHandles');
|
||||||
const getNewContext = importInternal('drawing/getNewContext');
|
const getNewContext = importInternal('drawing/getNewContext');
|
||||||
const BaseTool = importInternal('base/BaseTool');
|
const BaseTool = importInternal('base/BaseTool');
|
||||||
|
const drawLinkedTextBox = importInternal('drawing/drawLinkedTextBox');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class DICOMSRDisplayTool - Renders DICOMSR data in a read only manner (i.e. as an overlay).
|
* @class DICOMSRDisplayTool - Renders DICOMSR data in a read only manner (i.e. as an overlay).
|
||||||
@ -61,16 +62,16 @@ export default class DICOMSRDisplayTool extends BaseTool {
|
|||||||
|
|
||||||
for (let i = 0; i < filteredToolData.length; i++) {
|
for (let i = 0; i < filteredToolData.length; i++) {
|
||||||
const data = filteredToolData[i];
|
const data = filteredToolData[i];
|
||||||
const { renderableData } = data;
|
const { renderableData, labels } = data;
|
||||||
|
|
||||||
const color =
|
const color =
|
||||||
data.TrackingUniqueIdentifier === activeTrackingUniqueIdentifier
|
data.TrackingUniqueIdentifier === activeTrackingUniqueIdentifier
|
||||||
? toolColors.getActiveColor()
|
? toolColors.getActiveColor()
|
||||||
: toolColors.getToolColor();
|
: toolColors.getToolColor();
|
||||||
|
const lineWidth = 2;
|
||||||
const options = {
|
const options = {
|
||||||
color,
|
color,
|
||||||
lineWidth: 2,
|
lineWidth,
|
||||||
handleRadius: 6,
|
handleRadius: 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -105,6 +106,43 @@ export default class DICOMSRDisplayTool extends BaseTool {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { element } = eventData;
|
||||||
|
const context = getNewContext(eventData.canvasContext.canvas);
|
||||||
|
|
||||||
|
debugger;
|
||||||
|
|
||||||
|
const text = _getTextBoxLinesFromLabels(labels);
|
||||||
|
|
||||||
|
debugger;
|
||||||
|
|
||||||
|
function textBoxAnchorPoints() {
|
||||||
|
return [{ x: 1000, y: 1000 }];
|
||||||
|
}
|
||||||
|
|
||||||
|
draw(context, context => {
|
||||||
|
drawLinkedTextBox(
|
||||||
|
context,
|
||||||
|
element,
|
||||||
|
{
|
||||||
|
active: false,
|
||||||
|
hasMoved: false,
|
||||||
|
movesIndependently: false,
|
||||||
|
drawnIndependently: true,
|
||||||
|
allowedOutsideImage: true,
|
||||||
|
hasBoundingBox: true,
|
||||||
|
x: 256,
|
||||||
|
y: 256,
|
||||||
|
},
|
||||||
|
text,
|
||||||
|
null,
|
||||||
|
textBoxAnchorPoints,
|
||||||
|
color,
|
||||||
|
lineWidth,
|
||||||
|
10,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,3 +199,35 @@ export default class DICOMSRDisplayTool extends BaseTool {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _getTextBoxLinesFromLabels(labels) {
|
||||||
|
// TODO -> max 2 for now, need a generic solution for this!
|
||||||
|
|
||||||
|
const labelLength = Math.min(labels.length, 2);
|
||||||
|
|
||||||
|
const lines = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < labelLength; i++) {
|
||||||
|
const labelEntry = labels[i];
|
||||||
|
lines.push(`${_labelToShorthand(labelEntry.label)}${labelEntry.value}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SHORT_HAND_MAP = {
|
||||||
|
'Short Axis': 'S ',
|
||||||
|
'Long Axis': 'L ',
|
||||||
|
AREA: 'Area ',
|
||||||
|
Length: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
function _labelToShorthand(label) {
|
||||||
|
const shortHand = SHORT_HAND_MAP[label];
|
||||||
|
|
||||||
|
if (shortHand !== undefined) {
|
||||||
|
return shortHand;
|
||||||
|
}
|
||||||
|
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@ export default function addMeasurement(
|
|||||||
const measurementData = {
|
const measurementData = {
|
||||||
TrackingUniqueIdentifier: measurement.TrackingUniqueIdentifier,
|
TrackingUniqueIdentifier: measurement.TrackingUniqueIdentifier,
|
||||||
renderableData: {},
|
renderableData: {},
|
||||||
|
labels: measurement.labels,
|
||||||
};
|
};
|
||||||
|
|
||||||
measurement.coords.forEach(coord => {
|
measurement.coords.forEach(coord => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user