Don't reposition textboxes for now.

This commit is contained in:
James A. Petts 2020-07-01 14:32:54 +01:00
parent e3f2e26e3b
commit 7092fc858e
2 changed files with 53 additions and 5 deletions

View File

@ -523,7 +523,12 @@ function _getLabelFromMeasuredValueSequence(
const { NumericValue, MeasurementUnitsCodeSequence } = MeasuredValueSequence; const { NumericValue, MeasurementUnitsCodeSequence } = MeasuredValueSequence;
const { CodeValue } = MeasurementUnitsCodeSequence; const { CodeValue } = MeasurementUnitsCodeSequence;
return { label: CodeMeaning, value: `${NumericValue} ${CodeValue}` }; // E.g. Long Axis: 31.0 mm const formatedNumericValue = NumericValue ? NumericValue.toFixed(2) : '';
return {
label: CodeMeaning,
value: `${formatedNumericValue} ${CodeValue}`,
}; // E.g. Long Axis: 31.0 mm
} }
function _getReferencedImagesList(ImagingMeasurementReportContentSequence) { function _getReferencedImagesList(ImagingMeasurementReportContentSequence) {

View File

@ -62,10 +62,6 @@ export default class DICOMSRDisplayTool extends BaseTool {
trackingUniqueIdentifiers.includes(td.TrackingUniqueIdentifier) trackingUniqueIdentifiers.includes(td.TrackingUniqueIdentifier)
); );
// First: Render annotations with textboxes moved to closest side
// TODO: Render all annotations and get their locations.
// TODO: Find suitable places for textboxes that aren't covered.
let shouldRepositionTextBoxes = false; let shouldRepositionTextBoxes = false;
for (let i = 0; i < filteredToolData.length; i++) { for (let i = 0; i < filteredToolData.length; i++) {
@ -171,6 +167,30 @@ export default class DICOMSRDisplayTool extends BaseTool {
); );
}); });
} }
// TOOD -> text boxes may overlap with other annotations at the moment.
// To be fixed after we get requirements.
// if (shouldRepositionTextBoxes) {
// this.repositionTextBox(filteredToolData, eventData);
// }
}
repositionTextBox(toolData, eventData) {
debugger;
const toolBoundingBoxes = [];
for (let i = 0; i < toolData.length; i++) {
const toolDataI = toolData[i];
const { textBox } = toolDataI.handles;
const { anchorPoints } = textBox;
const boundingBox = _getBoundingBoxFromAnchorPoints(anchorPoints);
// Get the textbox bounding locations.
// Get the tool extents.
debugger;
}
} }
renderPolyLine(renderableData, eventData, options) { renderPolyLine(renderableData, eventData, options) {
@ -363,3 +383,26 @@ function _getTextBoxAnchorPointsForRenderableData(renderableData, eventData) {
return anchorPoints; return anchorPoints;
} }
function _getBoundingBoxFromAnchorPoints(anchorPoints) {
let minX = Infinity;
let maxX = -Infinity;
let minY = Infinity;
let maxY = -Infinity;
anchorPoints.forEach(point => {
const { x, y } = point;
if (x > maxX) {
maxX = x;
} else if (x < minX) {
minX = x;
}
if (y > maxX) {
maxY = y;
} else if (y < minY) {
minY = y;
}
});
}