- Rename lesion tool as bidirectional tool
- Remove measurementType property and use toolType property in the parts that uses measurementType - Add toolType in syncMeasurementAndToolData method - Hide Convert to Non-Target option in lesionLocationDialog for CRUNEX tools
This commit is contained in:
parent
0b6776f777
commit
b51628cc9f
@ -1,7 +1,7 @@
|
||||
Meteor.startup(function() {
|
||||
toolManager.addTool('lesion', {
|
||||
mouse: cornerstoneTools.lesion,
|
||||
touch: cornerstoneTools.lesionTouch
|
||||
toolManager.addTool('bidirectional', {
|
||||
mouse: cornerstoneTools.bidirectional,
|
||||
touch: cornerstoneTools.bidirectionalTouch
|
||||
});
|
||||
|
||||
toolManager.addTool('nonTarget', {
|
||||
@ -36,7 +36,7 @@ Meteor.startup(function() {
|
||||
|
||||
|
||||
var states = toolManager.getToolDefaultStates();
|
||||
states.deactivate.push('lesion');
|
||||
states.deactivate.push('bidirectional');
|
||||
states.deactivate.push('nonTarget');
|
||||
states.deactivate.push('length');
|
||||
states.deactivate.push('crTool');
|
||||
|
||||
@ -41,9 +41,9 @@ Template.viewer.onCreated(function() {
|
||||
},
|
||||
toggleLesionTrackerTools: toggleLesionTrackerTools,
|
||||
clearTools: clearTools,
|
||||
lesion: function() {
|
||||
bidirectional: function() {
|
||||
// Used for hotkeys
|
||||
toolManager.setActiveTool('lesion');
|
||||
toolManager.setActiveTool('bidirectional');
|
||||
},
|
||||
nonTarget: function() {
|
||||
// Used for hotkeys
|
||||
@ -54,7 +54,7 @@ Template.viewer.onCreated(function() {
|
||||
// The hotkey can also be an array (e.g. ["NUMPAD0", "0"])
|
||||
OHIF.viewer.defaultHotkeys = OHIF.viewer.defaultHotkeys || {};
|
||||
OHIF.viewer.defaultHotkeys.toggleLesionTrackerTools = 'O';
|
||||
OHIF.viewer.defaultHotkeys.lesion = 'T'; // Target
|
||||
OHIF.viewer.defaultHotkeys.bidirectional = 'T'; // Target
|
||||
OHIF.viewer.defaultHotkeys.nonTarget = 'N'; // Non-target
|
||||
|
||||
if (isTouchDevice()) {
|
||||
|
||||
@ -56,7 +56,7 @@ Template.viewerMain.helpers({
|
||||
});
|
||||
|
||||
buttonData.push({
|
||||
id: 'lesion',
|
||||
id: 'bidirectional',
|
||||
title: 'Target Tool',
|
||||
classes: 'imageViewerTool',
|
||||
iconClasses: 'fa fa-arrows-alt'
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
var toolType = 'lesion';
|
||||
var toolType = 'bidirectional';
|
||||
|
||||
var configuration = {
|
||||
setLesionNumberCallback: setLesionNumberCallback,
|
||||
@ -100,8 +100,7 @@
|
||||
shortestDiameter: 0,
|
||||
isDeleted: false,
|
||||
isTarget: true,
|
||||
measurementType: 'bidirectional',
|
||||
toolType: 'lesion'
|
||||
toolType: 'bidirectional'
|
||||
};
|
||||
return measurementData;
|
||||
}
|
||||
@ -127,7 +126,7 @@
|
||||
};
|
||||
|
||||
// Set lesion number and lesion name
|
||||
var config = cornerstoneTools.lesion.getConfiguration();
|
||||
var config = cornerstoneTools.bidirectional.getConfiguration();
|
||||
if (measurementData.lesionNumber === undefined) {
|
||||
config.setLesionNumberCallback(measurementData, mouseEventData, doneCallback);
|
||||
}
|
||||
@ -139,7 +138,7 @@
|
||||
// the end point and let the moveHandle move it for us.
|
||||
$(element).off('CornerstoneToolsMouseMove', mouseMoveCallback);
|
||||
$(element).off('CornerstoneToolsMouseDown', mouseDownCallback);
|
||||
$(element).off('CornerstoneToolsMouseDownActivate', cornerstoneTools.lesion.mouseDownActivateCallback);
|
||||
$(element).off('CornerstoneToolsMouseDownActivate', cornerstoneTools.bidirectional.mouseDownActivateCallback);
|
||||
$(element).off('CornerstoneToolsMouseDoubleClick', doubleClickCallback);
|
||||
|
||||
// Add a flag for using Esc to cancel tool placement
|
||||
@ -178,7 +177,7 @@
|
||||
|
||||
$(element).on('CornerstoneToolsMouseMove', eventData, mouseMoveCallback);
|
||||
$(element).on('CornerstoneToolsMouseDown', eventData, mouseDownCallback);
|
||||
$(element).on('CornerstoneToolsMouseDownActivate', eventData, cornerstoneTools.lesion.mouseDownActivateCallback);
|
||||
$(element).on('CornerstoneToolsMouseDownActivate', eventData, cornerstoneTools.bidirectional.mouseDownActivateCallback);
|
||||
$(element).on('CornerstoneToolsMouseDoubleClick', eventData, doubleClickCallback);
|
||||
cornerstone.updateImage(element);
|
||||
});
|
||||
@ -201,7 +200,7 @@
|
||||
var measurementData = createNewMeasurement(touchEventData);
|
||||
|
||||
// Set lesion number and lesion name
|
||||
var config = cornerstoneTools.lesion.getConfiguration();
|
||||
var config = cornerstoneTools.bidirectional.getConfiguration();
|
||||
if (measurementData.lesionNumber === undefined) {
|
||||
config.setLesionNumberCallback(measurementData, mouseEventData, doneCallback);
|
||||
}
|
||||
@ -211,9 +210,9 @@
|
||||
|
||||
// since we are dragging to another place to drop the end point, we can just activate
|
||||
// the end point and let the moveHandle move it for us.
|
||||
$(element).off('CornerstoneToolsTouchDrag', cornerstoneTools.lesion.touchMoveHandle);
|
||||
$(element).off('CornerstoneToolsTap', cornerstoneTools.lesion.tapCallback);
|
||||
$(element).off('CornerstoneToolsDragStartActive', cornerstoneTools.lesion.touchDownActivateCallback);
|
||||
$(element).off('CornerstoneToolsTouchDrag', cornerstoneTools.bidirectional.touchMoveHandle);
|
||||
$(element).off('CornerstoneToolsTap', cornerstoneTools.bidirectional.tapCallback);
|
||||
$(element).off('CornerstoneToolsDragStartActive', cornerstoneTools.bidirectional.touchDownActivateCallback);
|
||||
|
||||
cornerstone.updateImage(element);
|
||||
cornerstoneTools.moveNewHandleTouch(touchEventData, toolType, measurementData, measurementData.handles.end, function() {
|
||||
@ -228,9 +227,9 @@
|
||||
// perpendicular line is not connected to long-line
|
||||
measurementData.handles.perpendicularStart.locked = false;
|
||||
|
||||
$(element).on('CornerstoneToolsTouchDrag', cornerstoneTools.lesion.touchMoveHandle);
|
||||
$(element).on('CornerstoneToolsTap', cornerstoneTools.lesion.tapCallback);
|
||||
$(element).on('CornerstoneToolsDragStartActive', cornerstoneTools.lesion.touchDownActivateCallback);
|
||||
$(element).on('CornerstoneToolsTouchDrag', cornerstoneTools.bidirectional.touchMoveHandle);
|
||||
$(element).on('CornerstoneToolsTap', cornerstoneTools.bidirectional.tapCallback);
|
||||
$(element).on('CornerstoneToolsDragStartActive', cornerstoneTools.bidirectional.touchDownActivateCallback);
|
||||
cornerstone.updateImage(element);
|
||||
});
|
||||
}
|
||||
@ -963,7 +962,7 @@
|
||||
var color;
|
||||
var element = eventData.element;
|
||||
var lineWidth = cornerstoneTools.toolStyle.getToolWidth();
|
||||
var config = cornerstoneTools.lesion.getConfiguration();
|
||||
var config = cornerstoneTools.bidirectional.getConfiguration();
|
||||
|
||||
for (var i = 0; i < toolData.data.length; i++) {
|
||||
var data = toolData.data[i];
|
||||
@ -1076,7 +1075,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
var config = cornerstoneTools.lesion.getConfiguration();
|
||||
var config = cornerstoneTools.bidirectional.getConfiguration();
|
||||
|
||||
var coords = eventData.currentPoints.canvas;
|
||||
var toolData = cornerstoneTools.getToolState(element, toolType);
|
||||
@ -1103,7 +1102,7 @@
|
||||
}
|
||||
|
||||
// module exports
|
||||
cornerstoneTools.lesion = cornerstoneTools.mouseButtonTool({
|
||||
cornerstoneTools.bidirectional = cornerstoneTools.mouseButtonTool({
|
||||
createNewMeasurement: createNewMeasurement,
|
||||
addNewMeasurement: addNewMeasurement,
|
||||
onImageRendered: onImageRendered,
|
||||
@ -1114,7 +1113,7 @@
|
||||
toolType: toolType
|
||||
});
|
||||
|
||||
cornerstoneTools.lesionTouch = cornerstoneTools.touchTool({
|
||||
cornerstoneTools.bidirectionalTouch = cornerstoneTools.touchTool({
|
||||
createNewMeasurement: createNewMeasurement,
|
||||
addNewMeasurement: addNewMeasurementTouch,
|
||||
onImageRendered: onImageRendered,
|
||||
@ -1122,6 +1121,6 @@
|
||||
toolType: toolType
|
||||
});
|
||||
|
||||
cornerstoneTools.lesion.setConfiguration(configuration);
|
||||
cornerstoneTools.bidirectional.setConfiguration(configuration);
|
||||
|
||||
})($, cornerstone, cornerstoneMath, cornerstoneTools);
|
||||
@ -172,7 +172,6 @@
|
||||
patientId: patientId,
|
||||
response: response,
|
||||
isTarget: true,
|
||||
measurementType: 'nonTarget',
|
||||
toolType: toolType
|
||||
};
|
||||
|
||||
|
||||
@ -154,7 +154,6 @@
|
||||
patientId: patientId,
|
||||
response: '',
|
||||
isTarget: false,
|
||||
measurementType: 'nonTarget',
|
||||
toolType: 'nonTarget'
|
||||
};
|
||||
|
||||
|
||||
@ -115,6 +115,14 @@ changeLesionLocationCallback = function(measurementData, eventData, doneCallback
|
||||
|
||||
// Get the lesion location dialog
|
||||
var dialog = $('#lesionLocationRelabelDialog');
|
||||
|
||||
// Show/Hide Convert To NonTarget option in lesionLocationRelabelDialog
|
||||
if (measurementData.toolType === 'bidirectional') {
|
||||
dialog.find("#convertToNonTarget").css("visibility", "visible");
|
||||
} else {
|
||||
dialog.find("#convertToNonTarget").css("visibility", "hidden");
|
||||
}
|
||||
|
||||
Template.lesionLocationDialog.dialog = dialog;
|
||||
|
||||
// Show the backdrop
|
||||
@ -183,7 +191,7 @@ var config = {
|
||||
changeLesionLocationCallback: changeLesionLocationCallback
|
||||
};
|
||||
|
||||
cornerstoneTools.lesion.setConfiguration(config);
|
||||
cornerstoneTools.bidirectional.setConfiguration(config);
|
||||
|
||||
// Set CR-Tool, UN-Tool, EX-Tool configurations
|
||||
// Config for CR Tool
|
||||
|
||||
@ -18,7 +18,7 @@ Template.lesionTableTimepointCell.helpers({
|
||||
|
||||
var data = lesionData.timepoints[this.timepointId];
|
||||
|
||||
if (lesionData.measurementType === 'bidirectional') {
|
||||
if (lesionData.toolType === 'bidirectional') {
|
||||
if (data.shortestDiameter) {
|
||||
return data.longestDiameter + ' x ' + data.shortestDiameter;
|
||||
}
|
||||
@ -35,7 +35,7 @@ Template.lesionTableTimepointCell.helpers({
|
||||
|
||||
isBidirectional: function() {
|
||||
var lesionData = Template.parentData(1);
|
||||
if (lesionData.measurementType === 'bidirectional') {
|
||||
if (lesionData.toolType === 'bidirectional') {
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
|
||||
@ -4,12 +4,16 @@ measurementValuesByType = {
|
||||
'longestDiameter'
|
||||
],
|
||||
nonTarget: ['response'],
|
||||
crTool: ['response'],
|
||||
exTool: ['response'],
|
||||
unTool: ['response'],
|
||||
length: ['length'],
|
||||
ellipticalRoi: [
|
||||
'area',
|
||||
'mean',
|
||||
'stdev'
|
||||
]
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@ -60,14 +64,14 @@ function updateLesionData(lesionData) {
|
||||
imageId: lesionData.imageId
|
||||
};
|
||||
|
||||
if (!lesionData.measurementType) {
|
||||
if (!lesionData.toolType) {
|
||||
// For debugging, might want to switch to measurement types later
|
||||
lesionData.measurementType = lesionData.isTarget ? 'bidirectional' : 'nonTarget';
|
||||
lesionData.toolType = lesionData.isTarget ? 'bidirectional' : 'nonTarget';
|
||||
}
|
||||
|
||||
// Populate this timepoint's data with whichever values
|
||||
// are stored for this Measurement type
|
||||
var values = measurementValuesByType[lesionData.measurementType];
|
||||
var values = measurementValuesByType[lesionData.toolType];
|
||||
values.forEach(function(valueName) {
|
||||
timepointData[valueName] = lesionData[valueName];
|
||||
});
|
||||
@ -81,7 +85,7 @@ function updateLesionData(lesionData) {
|
||||
isTarget: lesionData.isTarget,
|
||||
patientId: lesionData.patientId,
|
||||
id: lesionData.id,
|
||||
measurementType: lesionData.measurementType
|
||||
toolType: lesionData.toolType
|
||||
};
|
||||
if (lesionData.toolType) {
|
||||
measurement.toolType = lesionData.toolType;
|
||||
|
||||
@ -21,7 +21,7 @@ convertToNonTarget = function(measurementData) {
|
||||
studyInstanceUid: measurementData.studyInstanceUid,
|
||||
patientId: measurementData.patientId,
|
||||
isTarget: false,
|
||||
measurementType: toolType
|
||||
toolType: toolType
|
||||
};
|
||||
|
||||
if (timepoint && timepoint.timepointType === 'baseline') {
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
handleMeasurementAdded = function(e, eventData) {
|
||||
var measurementData = eventData.measurementData;
|
||||
|
||||
switch (measurementData.measurementType) {
|
||||
switch (measurementData.toolType) {
|
||||
case 'nonTarget':
|
||||
case 'bidirectional':
|
||||
case 'lesion':
|
||||
case 'crTool':
|
||||
case 'unTool':
|
||||
case 'exTool':
|
||||
log.info('CornerstoneToolsMeasurementAdded');
|
||||
LesionManager.updateLesionData(measurementData);
|
||||
TrialResponseCriteria.validateDelayed(measurementData);
|
||||
@ -21,7 +23,7 @@ handleMeasurementAdded = function(e, eventData) {
|
||||
// Add the relevant metaData to this ImageMeasurement's toolData
|
||||
measurementData.clientId = ClientId;
|
||||
measurementData.imageId = imageId;
|
||||
measurementData.measurementType = eventData.toolType;
|
||||
measurementData.toolType = eventData.toolType;
|
||||
measurementData.patientId = study.patientId;
|
||||
measurementData.studyInstanceUid = study.studyInstanceUid;
|
||||
measurementData.seriesInstanceUid = series.seriesInstanceUid;
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
handleMeasurementModified = function(e, eventData) {
|
||||
var measurementData = eventData.measurementData;
|
||||
switch (measurementData.measurementType) {
|
||||
switch (measurementData.toolType) {
|
||||
case 'nonTarget':
|
||||
case 'lesion':
|
||||
case 'bidirectional':
|
||||
case 'crTool':
|
||||
case 'unTool':
|
||||
case 'exTool':
|
||||
log.info('CornerstoneToolsMeasurementModified');
|
||||
LesionManager.updateLesionData(measurementData);
|
||||
TrialResponseCriteria.validateDelayed(measurementData);
|
||||
@ -20,7 +22,7 @@ handleMeasurementModified = function(e, eventData) {
|
||||
// Add the relevant metaData to this ImageMeasurement's toolData
|
||||
measurementData.clientId = ClientId;
|
||||
measurementData.imageId = imageId;
|
||||
measurementData.measurementType = eventData.toolType;
|
||||
measurementData.toolType = eventData.toolType;
|
||||
measurementData.patientId = study.patientId;
|
||||
measurementData.studyInstanceUid = study.studyInstanceUid;
|
||||
measurementData.seriesInstanceUid = series.seriesInstanceUid;
|
||||
|
||||
@ -5,7 +5,7 @@ syncImageMeasurementAndToolData = function(measurement) {
|
||||
var toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.toolState;
|
||||
|
||||
var imageId = measurement.imageId;
|
||||
var toolType = measurement.measurementType;
|
||||
var toolType = measurement.toolType;
|
||||
|
||||
// If no tool state exists for this imageId, create an empty object to store it
|
||||
if (!toolState[imageId]) {
|
||||
|
||||
@ -56,6 +56,7 @@ function syncTimepointDataWithToolData(measurement, timepointData, imageId, tool
|
||||
tool.visible = timepointData.visible;
|
||||
tool.isDeleted = timepointData.isDeleted;
|
||||
tool.handles = timepointData.handles;
|
||||
tool.toolType = measurement.toolType;
|
||||
return false;
|
||||
});
|
||||
|
||||
@ -82,6 +83,7 @@ function syncTimepointDataWithToolData(measurement, timepointData, imageId, tool
|
||||
tool.locationUID = measurement.locationUID;
|
||||
tool.patientId = measurement.patientId;
|
||||
tool.id = measurement._id;
|
||||
tool.toolType = measurement.toolType;
|
||||
|
||||
// Add the measurementData into the toolData for this imageId
|
||||
toolState[imageId][toolType].data.push(tool);
|
||||
|
||||
@ -5,7 +5,7 @@ setTimepointTools = function(timepoint) {
|
||||
var fuTools = ["button#crunexTools"];
|
||||
if ((timepoint.timepointType).toLowerCase() === "baseline") {
|
||||
// Set active tool as lesion tool
|
||||
toolManager.setActiveTool('lesion');
|
||||
toolManager.setActiveTool('bidirectional');
|
||||
toolManager.addDisabledTool({tools: fuTools, status: true});
|
||||
} else {
|
||||
toolManager.setActiveTool(toolManager.getDefaultTool());
|
||||
|
||||
@ -31,7 +31,7 @@ Package.onUse(function(api) {
|
||||
api.addFiles('client/collections/LocationResponses.js', 'client');
|
||||
|
||||
// Additional Custom Cornerstone Tools for Lesion Tracker
|
||||
api.addFiles('client/compatibility/lesionTool.js', 'client', {
|
||||
api.addFiles('client/compatibility/bidirectionalTool.js', 'client', {
|
||||
bare: true
|
||||
});
|
||||
api.addFiles('client/compatibility/nonTargetTool.js', 'client', {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user