Removing targetEX tool references

This commit is contained in:
Bruno Alves de Faria 2017-11-10 07:41:18 -02:00
parent 5bc294f3a9
commit c80b25aeef
5 changed files with 18 additions and 42 deletions

View File

@ -11,7 +11,6 @@ const toolTypes = [
'bidirectional',
'targetCR',
'targetUN',
'targetEX',
'nonTarget',
'length',
'ellipticalRoi',
@ -100,4 +99,6 @@ function keyDownCallback(event, eventData) {
}
// module/private exports
cornerstoneTools.deleteLesionKeyboardTool = cornerstoneTools.keyboardTool(keyDownCallback);
const tool = cornerstoneTools.keyboardTool(keyDownCallback);
tool.toolTypes = toolTypes;
cornerstoneTools.deleteLesionKeyboardTool = tool;

View File

@ -1,18 +1,8 @@
import { OHIF } from 'meteor/ohif:core';
import { Viewerbase } from 'meteor/ohif:viewerbase';
import { cornerstone, cornerstoneMath, cornerstoneTools } from 'meteor/ohif:cornerstone';
var responseByToolType = [{
"toolType": "targetCR",
"toolResponse": "CR"
}, {
"toolType": "targetUN",
"toolResponse": "UN"
}, {
"toolType": "targetEX",
"toolResponse": "EX"
}];
const toolDefaultStates = OHIF.viewerbase.toolManager.getToolDefaultStates();
const toolDefaultStates = Viewerbase.toolManager.getToolDefaultStates();
const textBoxConfig = toolDefaultStates.textBoxConfig;
var configuration = {
@ -40,18 +30,12 @@ function changeMeasurementLocationCallback(measurementData, eventData, doneCallb
}
function createQualitativeTargetTool(toolType) {
function createQualitativeTargetTool(toolType, responseText='') {
var toolInterface = {
toolType: toolType
};
var response;
responseByToolType.forEach(function(tool) {
if (tool.toolType === toolInterface.toolType) {
response = tool.toolResponse;
}
});
var response = responseText;
/// --- Mouse Tool --- ///
///////// BEGIN ACTIVE TOOL ///////
@ -497,17 +481,14 @@ function createQualitativeTargetTool(toolType) {
return toolInterface;
}
var targetCRInterface = createQualitativeTargetTool('targetCR');
var targetCRInterface = createQualitativeTargetTool('targetCR', 'CR');
cornerstoneTools.targetCR = targetCRInterface.mouse;
cornerstoneTools.targetCR.setConfiguration(configuration);
cornerstoneTools.targetCRTouch = targetCRInterface.touch;
var targetUNInterface = createQualitativeTargetTool('targetUN');
var targetUNInterface = createQualitativeTargetTool('targetUN', 'UN');
cornerstoneTools.targetUN = targetUNInterface.mouse;
cornerstoneTools.targetUN.setConfiguration(configuration);
cornerstoneTools.targetUNTouch = targetUNInterface.touch;
var targetEXInterface = createQualitativeTargetTool('targetEX');
cornerstoneTools.targetEX = targetEXInterface.mouse;
cornerstoneTools.targetEX.setConfiguration(configuration);
cornerstoneTools.targetEXTouch = targetEXInterface.touch;
OHIF.lesiontracker.createQualitativeTargetTool = createQualitativeTargetTool;

View File

@ -46,8 +46,7 @@ OHIF.lesiontracker.configureTargetToolsHandles = () => {
// Append the callback configuration to bidirectional tool
appendConfig('bidirectional');
// Append the callback configuration to CR, UN and EX tools
// Append the callback configuration to CR and UN tools
appendConfig('targetCR');
appendConfig('targetUN');
appendConfig('targetEX');
};

View File

@ -23,7 +23,7 @@ OHIF.lesiontracker.toggleLesionTrackerTools = () => {
activate: ['deleteLesionKeyboardTool'],
deactivate: [],
enable: [],
disable: [ 'bidirectional', 'nonTarget', 'length', 'targetCR', 'targetUN', 'targetEX' ]
disable: ['bidirectional', 'nonTarget', 'length', 'targetCR', 'targetUN']
};
toolManager.setToolDefaultStates(toolDefaultStates);
@ -53,8 +53,8 @@ OHIF.lesiontracker.toggleLesionTrackerToolsButtons = (isEnabled) => {
toolStates.disabledToolButtons = [];
OHIF.lesiontracker.toggleLesionTrackerToolsHotKeys(true);
} else {
toolStates.disabledToolButtons = [ 'bidirectional', 'nonTarget', 'targetCR', 'targetUN', 'targetEX',
'toggleHUD', 'toggleTrial', 'toolbarSectionEntry', 'toggleMeasurements' ];
toolStates.disabledToolButtons = ['bidirectional', 'nonTarget', 'targetCR', 'targetUN',
'toggleHUD', 'toggleTrial', 'toolbarSectionEntry', 'toggleMeasurements'];
OHIF.lesiontracker.toggleLesionTrackerToolsHotKeys(false);
}

View File

@ -34,28 +34,23 @@ Meteor.startup(function() {
touch: cornerstoneTools.targetUNTouch
});
toolManager.addTool('targetEX', {
mouse: cornerstoneTools.targetEX,
touch: cornerstoneTools.targetEXTouch
});
// Update default state for tools making sure each tool is only inserted once
let currentDefaultStates = toolManager.getToolDefaultStates();
let newDefaultStates = {
enable: [ 'scaleOverlayTool' ],
deactivate: ['bidirectional', 'nonTarget', 'length', 'targetCR', 'targetUN', 'targetEX'],
deactivate: ['bidirectional', 'nonTarget', 'length', 'targetCR', 'targetUN'],
activate: ['deleteLesionKeyboardTool']
};
for (let state in newDefaultStates) {
newDefaultStates[state].forEach(function(tool) {
Object.keys(newDefaultStates).forEach(state => {
newDefaultStates[state].forEach(tool => {
let tools = currentDefaultStates[state];
// make sure each tool is only inserted once
if (tools && tools.indexOf(tool) < 0) {
tools.push(tool);
}
});
}
});
toolManager.setToolDefaultStates(currentDefaultStates);
});