LT-115: Reloading and showing CR/UN/EX measurements properly

This commit is contained in:
Aysel Afsar 2016-03-04 15:47:30 -05:00
parent a41e50d79f
commit 0b6776f777
10 changed files with 29 additions and 16 deletions

View File

@ -226,7 +226,7 @@ Template.viewer.onCreated(function() {
// Get the Measurement ID and relevant tool so we can remove
// tool data for this Measurement
var measurementId = data._id;
var toolType = data.isTarget ? 'lesion' : 'nonTarget';
var toolType = data.toolType;
// Remove the measurement from all the imageIds on which it exists
// as toolData

View File

@ -1,7 +1,7 @@
(function($, cornerstone, cornerstoneMath, cornerstoneTools) {
'use strict';
var crToolInterface = cornerstoneTools.crunexTool('crTool', 'CR');
var crToolInterface = cornerstoneTools.crunexTool('crTool');
cornerstoneTools.crTool = crToolInterface.crunex;
cornerstoneTools.crTool.setConfiguration(crToolInterface.defaultConfiguration);
cornerstoneTools.crToolTouch = crToolInterface.crunexTouch;

View File

@ -1,13 +1,25 @@
(function($, cornerstone, cornerstoneMath, cornerstoneTools) {
'use strict';
var responseByToolType = [
{"toolType": "crTool", "toolResponse": "CR"},
{"toolType": "unTool", "toolResponse": "UN"},
{"toolType": "exTool", "toolResponse": "EX"}
];
function crunexTool(toolType, toolName) {
function crunexTool(toolType) {
var toolInterface = {
toolType: toolType,
toolName: toolName
toolType: toolType
};
var response;
responseByToolType.forEach(function(tool) {
if (tool.toolType === toolInterface.toolType) {
response = tool.toolResponse;
}
});
var configuration = {
setLesionNumberCallback: setLesionNumberCallback,
getLesionLocationCallback: getLesionLocationCallback,
@ -158,11 +170,10 @@
seriesInstanceUid: seriesInstanceUid,
studyInstanceUid: studyInstanceUid,
patientId: patientId,
response: toolName,
response: response,
isTarget: true,
measurementType: 'nonTarget',
toolType: toolType,
toolName: 'Target'
toolType: toolType
};
return measurementData;
@ -288,7 +299,7 @@
context.lineTo(canvasTextLocation.x + 20, canvasTextLocation.y + 20);
context.stroke();
var boundingBox = cornerstoneTools.drawTextBox(context,data.toolName + " " + + data.lesionNumber, canvasTextLocation.x, canvasTextLocation.y, color);
var boundingBox = cornerstoneTools.drawTextBox(context, "Target " + + data.lesionNumber, canvasTextLocation.x, canvasTextLocation.y, color);
data.handles.textBox.boundingBox = boundingBox;
}

View File

@ -1,7 +1,7 @@
(function($, cornerstone, cornerstoneMath, cornerstoneTools) {
'use strict';
var exToolInterface = cornerstoneTools.crunexTool('exTool', 'EX');
var exToolInterface = cornerstoneTools.crunexTool('exTool');
cornerstoneTools.exTool = exToolInterface.crunex;
cornerstoneTools.exTool.setConfiguration(exToolInterface.defaultConfiguration);
cornerstoneTools.exToolTouch = exToolInterface.crunexTouch;

View File

@ -100,7 +100,8 @@
shortestDiameter: 0,
isDeleted: false,
isTarget: true,
measurementType: 'bidirectional'
measurementType: 'bidirectional',
toolType: 'lesion'
};
return measurementData;
}

View File

@ -154,7 +154,8 @@
patientId: patientId,
response: '',
isTarget: false,
measurementType: 'nonTarget'
measurementType: 'nonTarget',
toolType: 'nonTarget'
};
return measurementData;

View File

@ -1,7 +1,7 @@
(function($, cornerstone, cornerstoneMath, cornerstoneTools) {
'use strict';
var unToolInterface = cornerstoneTools.crunexTool('unTool', 'UN');
var unToolInterface = cornerstoneTools.crunexTool('unTool');
cornerstoneTools.unTool = unToolInterface.crunex;
cornerstoneTools.unTool.setConfiguration(unToolInterface.defaultConfiguration);
cornerstoneTools.unToolTouch = unToolInterface.crunexTouch;

View File

@ -65,7 +65,7 @@ function activateTool(element, measurementData, timepointId) {
deactivateAllToolData(element, 'unTool');
deactivateAllToolData(element, 'exTool');
var toolType = measurementData.toolType ? measurementData.toolType:(measurementData.isTarget ? 'lesion' : 'nonTarget');
var toolType = measurementData.toolType;
var toolData = cornerstoneTools.getToolState(element, toolType);
if (!toolData) {
return;

View File

@ -8,7 +8,7 @@ clearMeasurementTimepointData = function(measurementId, timepointId) {
// Clear the Measurement data for this timepoint
var imageId = data.timepoints[timepointId].imageId;
var toolType = data.isTarget ? 'lesion' : 'nonTarget';
var toolType = data.toolType;
removeToolDataWithMeasurementId(imageId, toolType, measurementId);
// Update any viewports that are currently displaying this imageId

View File

@ -3,7 +3,7 @@ syncMeasurementAndToolData = function(measurement) {
// Check what toolType we should be adding this to, based on the isTarget value
// of the stored Measurement
var toolType = measurement.isTarget ? 'lesion' : 'nonTarget';
var toolType = measurement.toolType;
// Loop through the timepoint data for this measurement
Object.keys(measurement.timepoints).forEach(function(key) {