feat(measurement-table) Display support for measurements from DICOM Structured Reports (#225)

This commit is contained in:
Gustavo André Lelis authored and Erik Ziegler committed 2018-07-20 12:40:09 +02:00
1 parent e9832f62f7
commit d94f0eec16
64 files changed
+1797 -78

No files matched your search

@@ -0,0 +1,61 @@
import { Template } from 'meteor/templating';
import { Blaze } from 'meteor/blaze';
import { _ } from 'meteor/underscore';
import { OHIF } from 'meteor/ohif:core';
OHIF.measurements.openLocationModal = options => {
let { toolType } = options.measurement;
const { tool } = OHIF.measurements.getToolConfiguration(toolType);
if (!tool) return;
toolType = (tool && tool.parentTool) || toolType;
const measurementId = options.measurement._id;
let buttonView = null;
const removeButtonView = () => {
Blaze.remove(buttonView);
buttonView = null;
};
if (buttonView) {
removeButtonView();
}
const measurementApi = options.measurementApi;
const toolCollection = measurementApi.tools[toolType];
const measurement = toolCollection.findOne(measurementId);
const data = {
measurement,
position: options.position,
direction: options.direction,
threeColumns: true,
hideCommon: true,
autoClick: options.autoClick,
doneCallback: removeButtonView,
updateCallback(location) {
const groupId = measurementApi.toolsGroupsMap[toolType];
const config = OHIF.measurements.MeasurementApi.getConfiguration();
const group = _.findWhere(config.measurementTools, { id: groupId });
group.childTools.forEach(tool => {
measurementApi.tools[tool.id].update({
measurementNumber: measurement.measurementNumber,
patientId: measurement.patientId
}, {
$set: {
location
}
}, {
multi: true
});
});
options.measurement.location = location;
// Notify that viewer suffered changes
OHIF.measurements.triggerTimepointUnsavedChanges('relabel');
}
};
buttonView = Blaze.renderWithData(Template.measurementRelabel, data, document.body);
};