LT-323: First measurement is activated on Case Load

This commit is contained in:
Erik Ziegler committed 2016-11-15 19:03:05 +01:00
1 parent 880569196a
commit de86d4141f
4 files changed
+60 -41

No files matched your search

@@ -48,45 +48,6 @@ Template.measurementTable.onRendered(() => {
});
});
Template.measurementTable.onRendered(() => {
// Find and activate the first measurement by Lesion Number
// NOTE: This is inefficient, we should be using a hanging protocol
// to hang the first measurement's imageId immediately, rather
// than changing images after initial loading...
const instance = Template.instance();
const config = OHIF.measurements.MeasurementApi.getConfiguration();
const measurementTypeId = config.measurementTools[0].id;
const measurementApi = instance.data.measurementApi;
const collection = measurementApi[measurementTypeId];
const sorting = {
sort: {
measurementNumber: -1
}
};
const data = collection.find({}, sorting).fetch();
const timepoints = instance.data.timepoints.get();
// TODO: Clean this up, it's probably an inefficient way to get what we need
const groupObject = _.groupBy(data, entry => entry.measurementNumber);
// Reformat the data
const rows = Object.keys(groupObject).map(key => ({
measurementTypeId: measurementTypeId,
measurementNumber: key,
entries: groupObject[key]
}));
const rowItem = rows[0];
// Activate the first lesion
if (rowItem) {
OHIF.measurements.jumpToRowItem(rowItem, timepoints);
}
});
Template.measurementTable.helpers({
buttonGroupData() {
const instance = Template.instance();
@@ -71,11 +71,11 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
// Retrieve the timepoints that are currently being displayed in the
// Measurement Table
const numTimepoints = timepoints.length;
const numTimepoints = Math.max(timepoints.length, 1);
// Retrieve the list of available viewports
const $viewports = $('.imageViewerViewport');
const numViewports = $viewports.length;
const numViewports = Math.max($viewports.length, 1);
/*
Two Timepoints, Two measurements, load Followup (FU and BA), display FU in left and BA in right
@@ -37,6 +37,8 @@ Template.viewerMain.onRendered(() => {
// Enable hotkeys
enableHotkeys();
Session.set('ViewerMainReady', Random.id());
});
});