Clear tools button is added. Removes all target and nonTarget lesions data on image and deletes from Measurements collection
This commit is contained in:
parent
dbd7453980
commit
ca30e22464
@ -53,10 +53,44 @@ Template.viewerMain.helpers({
|
||||
iconClasses: 'fa fa-long-arrow-up'
|
||||
});
|
||||
|
||||
buttonData.push({
|
||||
id: 'clearTools',
|
||||
title: 'Clear tools',
|
||||
classes: 'imageViewerCommand',
|
||||
iconClasses: 'fa fa-trash'
|
||||
});
|
||||
|
||||
toolbarOptions.buttonData = buttonData;
|
||||
toolbarOptions.includePlayClipButton = false;
|
||||
toolbarOptions.includeLayoutButton = false;
|
||||
toolbarOptions.includeHangingProtocolButtons = false;
|
||||
return toolbarOptions;
|
||||
}
|
||||
});
|
||||
|
||||
Template.viewerMain.events({
|
||||
'click button#clearTools': function(e, template) {
|
||||
var toolTypes = ["lesion", "nonTarget"];
|
||||
var toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.toolState;
|
||||
var toolStateKeys = Object.keys(toolState).slice(0);
|
||||
toolStateKeys.forEach(function (imageId) {
|
||||
toolTypes.forEach(function (toolType) {
|
||||
toolState[imageId][toolType] = {
|
||||
data: []
|
||||
};
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Update imageViewerViewport elements
|
||||
$(".imageViewerViewport").each(function(viewportIndex, element) {
|
||||
cornerstone.updateImage(element);
|
||||
});
|
||||
|
||||
// Remove patient's measurements
|
||||
var patientId = template.data.studies[0].patientId;
|
||||
Meteor.call('removeMeasurementsByPatientId', patientId);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
8
Packages/lesiontracker/both/removeCollections.js
Normal file
8
Packages/lesiontracker/both/removeCollections.js
Normal file
@ -0,0 +1,8 @@
|
||||
Meteor.methods({
|
||||
"removeMeasurementsByPatientId": function(patientId) {
|
||||
Measurements.remove(
|
||||
{patientId: patientId},
|
||||
{multi: true}
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -51,6 +51,8 @@ Package.onUse(function (api) {
|
||||
|
||||
// Both client and server functions
|
||||
api.addFiles('both/collections.js', ['client', 'server']);
|
||||
api.addFiles('both/removeCollections.js', ['client', 'server']);
|
||||
|
||||
|
||||
// Library functions
|
||||
api.addFiles('lib/uuid.js', 'client');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user