2015-12-11 17:55:19 +01:00
|
|
|
clearTools = function() {
|
2016-01-11 11:32:20 +01:00
|
|
|
var patientId = Session.get('patientId');
|
2016-03-06 17:22:45 +01:00
|
|
|
var toolTypes = [ 'bidirectional', 'nonTarget', 'length', 'ellipticalRoi', 'crTool', 'unTool', 'exTool' ];
|
2015-12-11 17:55:19 +01:00
|
|
|
var toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.toolState;
|
|
|
|
|
var toolStateKeys = Object.keys(toolState).slice(0);
|
|
|
|
|
|
2016-01-19 22:57:52 +01:00
|
|
|
var viewportElements = $('.imageViewerViewport').not('.empty');
|
2016-02-09 23:46:04 +01:00
|
|
|
var seriesInstanceUids = []; // Holds seriesInstanceUid of imageViewerViewport elements
|
2016-01-19 22:57:52 +01:00
|
|
|
viewportElements.each(function(index, element) {
|
|
|
|
|
var enabledElement = cornerstone.getEnabledElement(element);
|
2016-04-04 06:00:33 +02:00
|
|
|
var study = cornerstoneTools.metaData.get('study', enabledElement.image.imageId);
|
|
|
|
|
if (!study) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// Set reviewer for this timepoint
|
|
|
|
|
if (study.studyInstanceUid) {
|
|
|
|
|
Meteor.call('setReviewer',study.studyInstanceUid);
|
|
|
|
|
}
|
2016-01-19 22:57:52 +01:00
|
|
|
var series = cornerstoneTools.metaData.get('series', enabledElement.image.imageId);
|
2016-02-09 23:46:04 +01:00
|
|
|
if (!series) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
seriesInstanceUids.push(series.seriesInstanceUid);
|
2016-01-19 22:57:52 +01:00
|
|
|
});
|
|
|
|
|
|
2015-12-11 17:55:19 +01:00
|
|
|
// Set null array for toolState data found by imageId and toolType
|
2016-01-11 11:32:20 +01:00
|
|
|
toolStateKeys.forEach(function(imageId) {
|
|
|
|
|
toolTypes.forEach(function(toolType) {
|
2015-12-11 17:55:19 +01:00
|
|
|
var toolTypeData = toolState[imageId][toolType];
|
2016-01-11 11:32:20 +01:00
|
|
|
if (toolTypeData && toolTypeData.data.length > 0) {
|
2016-01-19 22:57:52 +01:00
|
|
|
var series = cornerstoneTools.metaData.get('series', imageId);
|
2016-02-09 23:46:04 +01:00
|
|
|
if (!series) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If seriesInstanceUid is found in seriesInstanceUids, set toolState data as null
|
|
|
|
|
if (seriesInstanceUids.indexOf(series.seriesInstanceUid) > -1) {
|
2015-12-11 17:55:19 +01:00
|
|
|
toolState[imageId][toolType] = {
|
|
|
|
|
data: []
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Update imageViewerViewport elements to remove lesions on current image
|
|
|
|
|
viewportElements.each(function(index, element) {
|
|
|
|
|
cornerstone.updateImage(element);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Remove patient's measurements
|
|
|
|
|
Meteor.call('removeMeasurementsByPatientId', patientId);
|
2016-02-13 18:57:04 +01:00
|
|
|
Meteor.call('removeImageMeasurementsByPatientId', patientId);
|
2016-01-13 16:17:32 +01:00
|
|
|
|
|
|
|
|
// Clear all validation errors
|
|
|
|
|
ValidationErrors.remove({});
|
2016-01-11 11:32:20 +01:00
|
|
|
};
|