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 // Get the Measurement ID and relevant tool so we can remove
// tool data for this Measurement // tool data for this Measurement
var measurementId = data._id; 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 // Remove the measurement from all the imageIds on which it exists
// as toolData // as toolData

View File

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

View File

@ -1,13 +1,25 @@
(function($, cornerstone, cornerstoneMath, cornerstoneTools) { (function($, cornerstone, cornerstoneMath, cornerstoneTools) {
'use strict'; '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 = { var toolInterface = {
toolType: toolType, toolType: toolType
toolName: toolName
}; };
var response;
responseByToolType.forEach(function(tool) {
if (tool.toolType === toolInterface.toolType) {
response = tool.toolResponse;
}
});
var configuration = { var configuration = {
setLesionNumberCallback: setLesionNumberCallback, setLesionNumberCallback: setLesionNumberCallback,
getLesionLocationCallback: getLesionLocationCallback, getLesionLocationCallback: getLesionLocationCallback,
@ -158,11 +170,10 @@
seriesInstanceUid: seriesInstanceUid, seriesInstanceUid: seriesInstanceUid,
studyInstanceUid: studyInstanceUid, studyInstanceUid: studyInstanceUid,
patientId: patientId, patientId: patientId,
response: toolName, response: response,
isTarget: true, isTarget: true,
measurementType: 'nonTarget', measurementType: 'nonTarget',
toolType: toolType, toolType: toolType
toolName: 'Target'
}; };
return measurementData; return measurementData;
@ -288,7 +299,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,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; data.handles.textBox.boundingBox = boundingBox;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ clearMeasurementTimepointData = function(measurementId, timepointId) {
// Clear the Measurement data for this timepoint // Clear the Measurement data for this timepoint
var imageId = data.timepoints[timepointId].imageId; var imageId = data.timepoints[timepointId].imageId;
var toolType = data.isTarget ? 'lesion' : 'nonTarget'; var toolType = data.toolType;
removeToolDataWithMeasurementId(imageId, toolType, measurementId); removeToolDataWithMeasurementId(imageId, toolType, measurementId);
// Update any viewports that are currently displaying this imageId // 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 // Check what toolType we should be adding this to, based on the isTarget value
// of the stored Measurement // of the stored Measurement
var toolType = measurement.isTarget ? 'lesion' : 'nonTarget'; var toolType = measurement.toolType;
// Loop through the timepoint data for this measurement // Loop through the timepoint data for this measurement
Object.keys(measurement.timepoints).forEach(function(key) { Object.keys(measurement.timepoints).forEach(function(key) {