LT-404: Fixing Target undefined label when start creating a measurement

This commit is contained in:
Bruno Alves de Faria 2017-01-26 15:25:11 -02:00
parent 20bd3f443c
commit 5c316bf334
3 changed files with 57 additions and 55 deletions

View File

@ -997,12 +997,6 @@ import { OHIF } from 'meteor/ohif:core';
width = 0; width = 0;
} }
// Draw the textbox
var suffix = ' mm';
if (!eventData.image.rowPixelSpacing || !eventData.image.columnPixelSpacing) {
suffix = ' pixels';
}
// Length is always longer than width // Length is always longer than width
if (width > length) { if (width > length) {
var tempW = width; var tempW = width;
@ -1011,9 +1005,16 @@ import { OHIF } from 'meteor/ohif:core';
width = tempL; width = tempL;
} }
if (data.measurementNumber) {
// Draw the textbox
var suffix = ' mm';
if (!eventData.image.rowPixelSpacing || !eventData.image.columnPixelSpacing) {
suffix = ' pixels';
}
var lengthText = ' L ' + length.toFixed(1) + suffix; var lengthText = ' L ' + length.toFixed(1) + suffix;
var widthText = ' W ' + width.toFixed(1) + suffix; var widthText = ' W ' + width.toFixed(1) + suffix;
var textLines = [ 'Target ' + data.measurementNumber, lengthText, widthText ]; var textLines = [`Target ${data.measurementNumber}`, lengthText, widthText];
var boundingBox = cornerstoneTools.drawTextBox(context, var boundingBox = cornerstoneTools.drawTextBox(context,
textLines, textLines,
@ -1069,6 +1070,7 @@ import { OHIF } from 'meteor/ohif:core';
context.moveTo(link.start.x, link.start.y); context.moveTo(link.start.x, link.start.y);
context.lineTo(link.end.x, link.end.y); context.lineTo(link.end.x, link.end.y);
context.stroke(); context.stroke();
}
// Set measurement text to show lesion table // Set measurement text to show lesion table
data.longestDiameter = length.toFixed(1); data.longestDiameter = length.toFixed(1);

View File

@ -253,7 +253,7 @@ import { toolManager } from 'meteor/ohif:viewerbase';
// Draw the text // Draw the text
if (data.measurementNumber) { if (data.measurementNumber) {
var boundingBox = cornerstoneTools.drawTextBox(context, 'Non-Target ' + data.measurementNumber, canvasTextLocation.x, canvasTextLocation.y, color); var boundingBox = cornerstoneTools.drawTextBox(context, `Non-Target ${data.measurementNumber}`, canvasTextLocation.x, canvasTextLocation.y, color);
data.handles.textBox.boundingBox = boundingBox; data.handles.textBox.boundingBox = boundingBox;
OHIF.cornerstone.repositionTextBox(eventData, data); OHIF.cornerstone.repositionTextBox(eventData, data);

View File

@ -290,7 +290,7 @@
context.lineTo(canvasTextLocation.x + 20, canvasTextLocation.y + 20); context.lineTo(canvasTextLocation.x + 20, canvasTextLocation.y + 20);
context.stroke(); context.stroke();
var boundingBox = cornerstoneTools.drawTextBox(context, "Target " + +data.measurementNumber, canvasTextLocation.x, canvasTextLocation.y, color); var boundingBox = cornerstoneTools.drawTextBox(context, `Target ${data.measurementNumber}`, canvasTextLocation.x, canvasTextLocation.y, color);
data.handles.textBox.boundingBox = boundingBox; data.handles.textBox.boundingBox = boundingBox;
} }