LT-297: Implementing delete behavior on measurement table options
This commit is contained in:
parent
adb8e76aef
commit
8520b2aea8
@ -0,0 +1,8 @@
|
|||||||
|
<template name="dialogConfirm">
|
||||||
|
{{#dialogForm (extend this
|
||||||
|
dialogClass='modal-sm'
|
||||||
|
title=(choose this.title 'Confirmation')
|
||||||
|
)}}
|
||||||
|
<p>{{choose this.message 'Are you sure you want to perform this action?'}}</p>
|
||||||
|
{{/dialogForm}}
|
||||||
|
</template>
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
import './dialog/confirm.html';
|
||||||
import './dialog/form.html';
|
import './dialog/form.html';
|
||||||
import './dialog/form.js';
|
import './dialog/form.js';
|
||||||
import './dialog/login.html';
|
import './dialog/login.html';
|
||||||
|
|||||||
@ -85,7 +85,6 @@ class MeasurementApi {
|
|||||||
configuration.measurementTools.forEach(tool => {
|
configuration.measurementTools.forEach(tool => {
|
||||||
const measurements = this[tool.id].find().fetch();
|
const measurements = this[tool.id].find().fetch();
|
||||||
measurements.forEach(measurement => {
|
measurements.forEach(measurement => {
|
||||||
console.warn('>>>>MEASUREMENT', measurement);
|
|
||||||
OHIF.measurements.syncMeasurementAndToolData(measurement);
|
OHIF.measurements.syncMeasurementAndToolData(measurement);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Meteor } from 'meteor/meteor';
|
import { Meteor } from 'meteor/meteor';
|
||||||
import { Template } from 'meteor/templating';
|
import { Template } from 'meteor/templating';
|
||||||
import { OHIF } from 'meteor/ohif:core';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
import { _ } from 'meteor/underscore';
|
||||||
|
|
||||||
function doneCallback(measurementData, deleteTool) {
|
function doneCallback(measurementData, deleteTool) {
|
||||||
// If a Lesion or Non-Target is removed via a dialog
|
// If a Lesion or Non-Target is removed via a dialog
|
||||||
@ -43,6 +44,51 @@ Template.measurementTableRow.events({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'click .js-delete'(event, instance) {
|
||||||
|
const measurementTypeId = instance.data.rowItem.measurementTypeId;
|
||||||
|
const measurement = instance.data.rowItem.entries[0];
|
||||||
|
|
||||||
|
const dialogSettings = {
|
||||||
|
title: 'Delete measurements',
|
||||||
|
message: 'Are you sure you want to delete the measurement among all timepoints?'
|
||||||
|
};
|
||||||
|
|
||||||
|
OHIF.ui.showFormDialog('dialogConfirm', dialogSettings).then(formData => {
|
||||||
|
const collection = instance.data.measurementApi[measurementTypeId];
|
||||||
|
|
||||||
|
const filter = {
|
||||||
|
toolType: measurement.toolType,
|
||||||
|
measurementNumber: measurement.measurementNumber,
|
||||||
|
patientId: measurement.patientId
|
||||||
|
};
|
||||||
|
|
||||||
|
const entries = collection.find(filter).fetch();
|
||||||
|
|
||||||
|
collection.remove(filter);
|
||||||
|
|
||||||
|
// Synchronize the new data with cornerstone tools
|
||||||
|
const toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.toolState;
|
||||||
|
_.each(entries, entry => {
|
||||||
|
if (toolState[entry.imageId]) {
|
||||||
|
const toolData = toolState[entry.imageId][entry.toolType];
|
||||||
|
const measurementsData = toolData && toolData.data;
|
||||||
|
const measurementEntry = _.findWhere(measurementsData, {
|
||||||
|
_id: entry._id
|
||||||
|
});
|
||||||
|
|
||||||
|
if (measurementEntry) {
|
||||||
|
console.warn('>>>>REMOVING FROM CORNERSTONE', measurementEntry);
|
||||||
|
const index = measurementsData.indexOf(measurementEntry);
|
||||||
|
measurementsData.splice(index, 1);
|
||||||
|
|
||||||
|
// Repaint the images on all viewports without the removed measurements
|
||||||
|
_.each($('.imageViewerViewport'), elm => cornerstone.updateImage(elm));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
'dblclick .location'() {
|
'dblclick .location'() {
|
||||||
OHIF.log.info('Double clicked on Lesion Location cell');
|
OHIF.log.info('Double clicked on Lesion Location cell');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user