Bug fixing: First measurement of target tool is shown as 0 in the table until it is moved
This commit is contained in:
parent
6ebff476a2
commit
5010307b6e
@ -7,10 +7,18 @@ var cornerstoneTools = (function($, cornerstone, cornerstoneMath, cornerstoneToo
|
|||||||
}
|
}
|
||||||
|
|
||||||
var configuration = {
|
var configuration = {
|
||||||
|
setLesionNumberCallback: setLesionNumberCallback,
|
||||||
getLesionLocationCallback: getLesionLocationCallback,
|
getLesionLocationCallback: getLesionLocationCallback,
|
||||||
changeLesionLocationCallback: changeLesionLocationCallback
|
changeLesionLocationCallback: changeLesionLocationCallback
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Set lesion number
|
||||||
|
// Get Target lesions on image
|
||||||
|
function setLesionNumberCallback(measurementData, eventData, doneCallback) {
|
||||||
|
var lesionNumber = 1;
|
||||||
|
doneCallback(lesionNumber);
|
||||||
|
}
|
||||||
|
|
||||||
// Define a callback to get your text annotation
|
// Define a callback to get your text annotation
|
||||||
// This could be used, e.g. to open a modal
|
// This could be used, e.g. to open a modal
|
||||||
function getLesionLocationCallback(measurementData, eventData, doneCallback) {
|
function getLesionLocationCallback(measurementData, eventData, doneCallback) {
|
||||||
@ -40,6 +48,7 @@ var cornerstoneTools = (function($, cornerstone, cornerstoneMath, cornerstoneToo
|
|||||||
var eventData = {
|
var eventData = {
|
||||||
mouseButtonMask: mouseEventData.which
|
mouseButtonMask: mouseEventData.which
|
||||||
};
|
};
|
||||||
|
var config = cornerstoneTools.lesion.getConfiguration();
|
||||||
|
|
||||||
// associate this data with this imageId so we can render it and manipulate it
|
// associate this data with this imageId so we can render it and manipulate it
|
||||||
cornerstoneTools.addToolState(element, toolType, measurementData);
|
cornerstoneTools.addToolState(element, toolType, measurementData);
|
||||||
@ -50,6 +59,11 @@ var cornerstoneTools = (function($, cornerstone, cornerstoneMath, cornerstoneToo
|
|||||||
$(element).off('CornerstoneToolsMouseDown', cornerstoneTools.lesion.mouseDownCallback);
|
$(element).off('CornerstoneToolsMouseDown', cornerstoneTools.lesion.mouseDownCallback);
|
||||||
$(element).off('CornerstoneToolsMouseDownActivate', cornerstoneTools.lesion.mouseDownActivateCallback);
|
$(element).off('CornerstoneToolsMouseDownActivate', cornerstoneTools.lesion.mouseDownActivateCallback);
|
||||||
|
|
||||||
|
// Set lesion number and lesion name
|
||||||
|
if (measurementData.lesionNumber === undefined) {
|
||||||
|
config.setLesionNumberCallback(measurementData, mouseEventData, doneCallback);
|
||||||
|
}
|
||||||
|
|
||||||
cornerstone.updateImage(element);
|
cornerstone.updateImage(element);
|
||||||
cornerstoneTools.moveNewHandle(mouseEventData, toolType, measurementData, measurementData.handles.end, function() {
|
cornerstoneTools.moveNewHandle(mouseEventData, toolType, measurementData, measurementData.handles.end, function() {
|
||||||
if (cornerstoneTools.anyHandlesOutsideImage(mouseEventData, measurementData.handles)) {
|
if (cornerstoneTools.anyHandlesOutsideImage(mouseEventData, measurementData.handles)) {
|
||||||
@ -57,8 +71,7 @@ var cornerstoneTools = (function($, cornerstone, cornerstoneMath, cornerstoneToo
|
|||||||
cornerstoneTools.removeToolState(element, toolType, measurementData);
|
cornerstoneTools.removeToolState(element, toolType, measurementData);
|
||||||
} else {
|
} else {
|
||||||
// Set lesionMeasurementData Session
|
// Set lesionMeasurementData Session
|
||||||
var config = cornerstoneTools.lesion.getConfiguration();
|
config.getLesionLocationCallback(measurementData, mouseEventData);
|
||||||
config.getLesionLocationCallback(measurementData, mouseEventData, doneCallback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(element).on('CornerstoneToolsMouseMove', eventData, cornerstoneTools.lesion.mouseMoveCallback);
|
$(element).on('CornerstoneToolsMouseMove', eventData, cornerstoneTools.lesion.mouseMoveCallback);
|
||||||
@ -232,7 +245,6 @@ var cornerstoneTools = (function($, cornerstone, cornerstoneMath, cornerstoneToo
|
|||||||
// draw the handles
|
// draw the handles
|
||||||
cornerstoneTools.drawHandles(context, eventData, data.handles, color);
|
cornerstoneTools.drawHandles(context, eventData, data.handles, color);
|
||||||
|
|
||||||
if (data.lesionName) {
|
|
||||||
//Draw linked line as dashed
|
//Draw linked line as dashed
|
||||||
context.beginPath();
|
context.beginPath();
|
||||||
context.strokeStyle = color;
|
context.strokeStyle = color;
|
||||||
@ -269,7 +281,7 @@ var cornerstoneTools = (function($, cornerstone, cornerstoneMath, cornerstoneToo
|
|||||||
|
|
||||||
// Set measurement text to show lesion table
|
// Set measurement text to show lesion table
|
||||||
data.measurementText = length.toFixed(1);
|
data.measurementText = length.toFixed(1);
|
||||||
}
|
|
||||||
|
|
||||||
context.restore();
|
context.restore();
|
||||||
|
|
||||||
@ -278,6 +290,7 @@ var cornerstoneTools = (function($, cornerstone, cornerstoneMath, cornerstoneToo
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateLesionCollection(lesionData) {
|
function updateLesionCollection(lesionData) {
|
||||||
|
console.log(lesionData.measurementText);
|
||||||
// TODO = Remove this in favour of measurement events
|
// TODO = Remove this in favour of measurement events
|
||||||
if (!lesionData.active) {
|
if (!lesionData.active) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -60,7 +60,7 @@
|
|||||||
var config = cornerstoneTools.nonTarget.getConfiguration();
|
var config = cornerstoneTools.nonTarget.getConfiguration();
|
||||||
|
|
||||||
// Set lesion number and lesion name
|
// Set lesion number and lesion name
|
||||||
if (measurementData.lesionName === undefined) {
|
if (measurementData.lesionNumber === undefined) {
|
||||||
config.setLesionNumberCallback(measurementData, mouseEventData, doneCallback);
|
config.setLesionNumberCallback(measurementData, mouseEventData, doneCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,10 +70,11 @@
|
|||||||
if (cornerstoneTools.anyHandlesOutsideImage(mouseEventData, measurementData.handles)) {
|
if (cornerstoneTools.anyHandlesOutsideImage(mouseEventData, measurementData.handles)) {
|
||||||
// delete the measurement
|
// delete the measurement
|
||||||
cornerstoneTools.removeToolState(mouseEventData.element, toolType, measurementData);
|
cornerstoneTools.removeToolState(mouseEventData.element, toolType, measurementData);
|
||||||
}
|
}else{
|
||||||
|
|
||||||
config.getNonTargetLesionLocationCallback(measurementData, mouseEventData, doneCallback);
|
config.getNonTargetLesionLocationCallback(measurementData, mouseEventData, doneCallback);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$(mouseEventData.element).on('CornerstoneToolsMouseMove', eventData, cornerstoneTools.nonTarget.mouseMoveCallback);
|
$(mouseEventData.element).on('CornerstoneToolsMouseMove', eventData, cornerstoneTools.nonTarget.mouseMoveCallback);
|
||||||
$(mouseEventData.element).on('CornerstoneToolsMouseDown', eventData, cornerstoneTools.nonTarget.mouseDownCallback);
|
$(mouseEventData.element).on('CornerstoneToolsMouseDown', eventData, cornerstoneTools.nonTarget.mouseDownCallback);
|
||||||
$(mouseEventData.element).on('CornerstoneToolsMouseDownActivate', eventData, cornerstoneTools.nonTarget.mouseDownActivateCallback);
|
$(mouseEventData.element).on('CornerstoneToolsMouseDownActivate', eventData, cornerstoneTools.nonTarget.mouseDownActivateCallback);
|
||||||
|
|||||||
@ -1,21 +1,17 @@
|
|||||||
// This event determines whether or not to show the lesion dialog
|
// This event sets lesion number for new lesion
|
||||||
// If there already exists a lesion with this specific lesion number,
|
|
||||||
// related to the chosen location.
|
|
||||||
function getLesionLocationCallback(measurementData, eventData, doneCallback) {
|
|
||||||
// Get the lesion location dialog
|
|
||||||
var lesionDialog = $("#lesionLocationDialog");
|
|
||||||
|
|
||||||
// Find the select option box
|
|
||||||
var selector = lesionDialog.find("select#selectLesionLocation");
|
|
||||||
|
|
||||||
|
function setLesionNumberCallback(measurementData, eventData, doneCallback) {
|
||||||
// Get the current element's timepointID from the study date metadata
|
// Get the current element's timepointID from the study date metadata
|
||||||
var element = eventData.element;
|
var element = eventData.element;
|
||||||
var enabledElement = cornerstone.getEnabledElement(element);
|
var enabledElement = cornerstone.getEnabledElement(element);
|
||||||
var study = cornerstoneTools.metaData.get('study', enabledElement.image.imageId);
|
var imageId = enabledElement.image.imageId;
|
||||||
|
|
||||||
|
var study = cornerstoneTools.metaData.get('study', imageId);
|
||||||
var timepoint = Timepoints.findOne({timepointName: study.studyDate});
|
var timepoint = Timepoints.findOne({timepointName: study.studyDate});
|
||||||
if (!timepoint) {
|
if (!timepoint) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
measurementData.timepointID = timepoint.timepointID;
|
measurementData.timepointID = timepoint.timepointID;
|
||||||
|
|
||||||
// Get a lesion number for this lesion, depending on whether or not the same lesion previously
|
// Get a lesion number for this lesion, depending on whether or not the same lesion previously
|
||||||
@ -23,6 +19,20 @@ function getLesionLocationCallback(measurementData, eventData, doneCallback) {
|
|||||||
var lesionNumber = measurementManagerDAL.getNewLesionNumber(measurementData.timepointID, isTarget=true);
|
var lesionNumber = measurementManagerDAL.getNewLesionNumber(measurementData.timepointID, isTarget=true);
|
||||||
measurementData.lesionNumber = lesionNumber;
|
measurementData.lesionNumber = lesionNumber;
|
||||||
|
|
||||||
|
// Set lesion number
|
||||||
|
doneCallback(lesionNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This event determines whether or not to show the lesion dialog
|
||||||
|
// If there already exists a lesion with this specific lesion number,
|
||||||
|
// related to the chosen location.
|
||||||
|
function getLesionLocationCallback(measurementData, eventData) {
|
||||||
|
// Get the lesion location dialog
|
||||||
|
var lesionDialog = $("#lesionLocationDialog");
|
||||||
|
|
||||||
|
// Find the select option box
|
||||||
|
var selector = lesionDialog.find("select#selectLesionLocation");
|
||||||
|
|
||||||
// Find out if this lesion number is already added in the lesion manager for another timepoint
|
// Find out if this lesion number is already added in the lesion manager for another timepoint
|
||||||
// If it is, stop here because we don't need the dialog.
|
// If it is, stop here because we don't need the dialog.
|
||||||
var locationUID = measurementManagerDAL.lesionNumberExists(measurementData);
|
var locationUID = measurementManagerDAL.lesionNumberExists(measurementData);
|
||||||
@ -45,9 +55,6 @@ function getLesionLocationCallback(measurementData, eventData, doneCallback) {
|
|||||||
// Hide the lesion dialog
|
// Hide the lesion dialog
|
||||||
lesionDialog.css('display', 'none');
|
lesionDialog.css('display', 'none');
|
||||||
|
|
||||||
// Fire the doneCallback with the lesion number
|
|
||||||
doneCallback(lesionNumber);
|
|
||||||
|
|
||||||
// Select the first option for the next time the dialog is opened
|
// Select the first option for the next time the dialog is opened
|
||||||
selector.find("option:first").prop("selected", true);
|
selector.find("option:first").prop("selected", true);
|
||||||
|
|
||||||
@ -135,6 +142,7 @@ function changeLesionLocationCallback(measurementData, eventData, doneCallback)
|
|||||||
}
|
}
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
|
setLesionNumberCallback: setLesionNumberCallback,
|
||||||
getLesionLocationCallback: getLesionLocationCallback,
|
getLesionLocationCallback: getLesionLocationCallback,
|
||||||
changeLesionLocationCallback: changeLesionLocationCallback
|
changeLesionLocationCallback: changeLesionLocationCallback
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user