Merge branch 'crunexTools'

This commit is contained in:
Aysel Afsar committed 2016-03-07 09:21:11 -05:00
commit 52286136ab
39 files changed
+740 -85

No files matched your search

+12 -4
View File
@@ -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];
});
@@ -80,8 +84,12 @@ function updateLesionData(lesionData) {
lesionNumber: lesionData.lesionNumber,
isTarget: lesionData.isTarget,
patientId: lesionData.patientId,
id: lesionData.id
id: lesionData.id,
toolType: lesionData.toolType
};
if (lesionData.toolType) {
measurement.toolType = lesionData.toolType;
}
// Retrieve the location name given the locationUID
if (lesionData.locationUID !== undefined) {
+9 -4
View File
@@ -25,7 +25,7 @@ activateLesion = function(measurementId, templateData) {
sort: {
latestDate: 1
}
})
});
// Loop through each timepoint and populate the orderTimepointEntries array with
// The measurement data at each timepoint. The most recent measurements will be first in
@@ -58,9 +58,11 @@ activateLesion = function(measurementId, templateData) {
// Stop if we run out of timepoints before viewports
if (viewportIndex >= orderedTimepointEntries.length) {
// Update the element anyway, to remove any other highlights that are present
deactivateAllToolData(element, 'lesion');
deactivateAllToolData(element, 'bidirectional');
deactivateAllToolData(element, 'nonTarget');
cornerstone.updateImage(element);
deactivateAllToolData(element, 'crTool');
deactivateAllToolData(element, 'unTool');
deactivateAllToolData(element, 'exTool');
return false;
}
@@ -79,8 +81,11 @@ activateLesion = function(measurementId, templateData) {
// If there is no measurement data to display, stop here
if (!measurementAtTimepoint) {
// Update the element anyway, to remove any other highlights that are present
deactivateAllToolData(element, 'lesion');
deactivateAllToolData(element, 'bidirectional');
deactivateAllToolData(element, 'nonTarget');
deactivateAllToolData(element, 'crTool');
deactivateAllToolData(element, 'unTool');
deactivateAllToolData(element, 'exTool');
cornerstone.updateImage(element);
return;
}
@@ -57,10 +57,15 @@ activateMeasurements = function(element, measurementId, templateData, viewportIn
* @param timepointId
*/
function activateTool(element, measurementData, timepointId) {
deactivateAllToolData(element, 'lesion');
deactivateAllToolData(element, 'bidirectional');
deactivateAllToolData(element, 'nonTarget');
var toolType = measurementData.isTarget ? 'lesion' : 'nonTarget';
// Deactivate CRUNEX Tools
deactivateAllToolData(element, 'crTool');
deactivateAllToolData(element, 'unTool');
deactivateAllToolData(element, 'exTool');
var toolType = measurementData.toolType;
var toolData = cornerstoneTools.getToolState(element, toolType);
if (!toolData) {
return;
@@ -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
+1 -1
View File
@@ -1,6 +1,6 @@
clearTools = function() {
var patientId = Session.get('patientId');
var toolTypes = [ 'lesion', 'nonTarget', 'length', 'ellipticalRoi'];
var toolTypes = [ 'bidirectional', 'nonTarget', 'length', 'ellipticalRoi', 'crTool', 'unTool', 'exTool' ];
var toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.toolState;
var toolStateKeys = Object.keys(toolState).slice(0);
@@ -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,9 +1,12 @@
handleMeasurementAdded = function(e, eventData) {
var measurementData = eventData.measurementData;
switch (eventData.toolType) {
switch (measurementData.toolType) {
case 'nonTarget':
case 'lesion':
case 'bidirectional':
case 'crTool':
case 'unTool':
case 'exTool':
log.info('CornerstoneToolsMeasurementAdded');
LesionManager.updateLesionData(measurementData);
TrialResponseCriteria.validateDelayed(measurementData);
@@ -20,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 (eventData.toolType) {
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;
@@ -3,7 +3,10 @@ handleMeasurementRemoved = function(e, eventData) {
switch (eventData.toolType) {
case 'nonTarget':
case 'lesion':
case 'bidirectional':
case 'crTool':
case 'unTool':
case 'exTool':
log.info('CornerstoneToolsMeasurementRemoved');
var measurement = Measurements.findOne(measurementData.id, {
@@ -32,4 +32,16 @@ pixelSpacingAutorunCheck = function() {
// Enable Lesion Buttons
oncologyTools.prop('disabled', false);
}
// Set disabled/enabled timepoint buttons
var imageId = enabledElement.image.imageId;
var study = cornerstoneTools.metaData.get('study', imageId);
// Find the relevant timepoint given the current study
var timepoint = Timepoints.findOne({
studyInstanceUids: {
$in: [study.studyInstanceUid]
}
});
setTimepointTools(timepoint);
};
@@ -1,10 +0,0 @@
// If timepoint is baseline, sets lesion tool as active tool
// Else sets default tool
setTimepointActiveTool = function(timepoint) {
if ((timepoint.timepointType).toLowerCase() === "baseline") {
// Set active tool as lesion tool
toolManager.setActiveTool('lesion');
} else {
toolManager.setActiveTool(toolManager.getDefaultTool());
}
};
@@ -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]) {
@@ -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) {
@@ -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);
@@ -0,0 +1,28 @@
// If timepoint is baseline, sets lesion tool as active tool
setTimepointTools = function(timepoint) {
// Enabled tools for only follow-up tools
var fuTools = ["button#crunexTools"];
var fuToolsJQ = $("button#crunexTools");
var isDisabled = false;
if ((timepoint.timepointType).toLowerCase() === "baseline") {
// Set active tool as lesion tool
toolManager.setActiveTool('bidirectional');
isDisabled = true;
} else {
toolManager.setActiveTool(toolManager.getDefaultTool());
isDisabled = false;
}
toolManager.addDisabledTool({tools: fuTools, status: isDisabled});
fuToolsJQ.prop('disabled', isDisabled);
};
timepointAutoCheck = function(templateData) {
if (templateData && templateData.timepointIds) {
templateData.timepointIds.forEach(function(timepointId) {
var timepoint = Timepoints.findOne({timepointId: timepointId});
setTimepointTools(timepoint);
});
}
};
@@ -18,7 +18,7 @@ toggleLesionTrackerTools = function() {
activate: [ 'deleteLesionKeyboardTool' ],
deactivate: [],
enable: [],
disable: [ 'lesion', 'nonTarget', 'scaleOverlayTool', 'length' ]
disable: [ 'bidirectional', 'nonTarget', 'scaleOverlayTool', 'length', 'crTool', 'unTool', 'exTool' ]
};
toolManager.setToolDefaultStates(toolDefaultStates);
@@ -33,9 +33,6 @@ function dblClickOnStudy(data) {
return;
}
// Set active tool for timepoint
setTimepointActiveTool(timepoint);
// Add the Timepoint name to the Patient name to create the tab title
title += ' ' + getTimepointName(timepoint);