Reverting wrong logic for baseline time points

This commit is contained in:
Bruno Alves de Faria committed 2017-09-18 15:45:55 -03:00
1 parent 45d660636b
commit 29a8a3db8f
9 files changed
+35 -39

No files matched your search

@@ -83,8 +83,8 @@ Template.measurementTableRow.events({
measurementApi.deleteMeasurements(measurementTypeId, { measurementNumber });
// Sync the new measurement data with cornerstone tools
const previous = timepointApi.priorOrBaseline();
measurementApi.sortMeasurements(previous.timepointId);
const baseline = timepointApi.baseline();
measurementApi.sortMeasurements(baseline.timepointId);
// Repaint the images on all viewports without the removed measurements
_.each($('.imageViewerViewport'), element => cornerstone.updateImage(element));
@@ -111,8 +111,8 @@ Template.measurementTableTimepointCell.events({
});
// Sync the new measurement data with cornerstone tools
const previous = timepointApi.priorOrBaseline();
measurementApi.sortMeasurements(previous.timepointId);
const baseline = timepointApi.baseline();
measurementApi.sortMeasurements(baseline.timepointId);
// Repaint the images on all viewports without the removed measurements
_.each($('.imageViewerViewport'), element => cornerstone.updateImage(element));
@@ -55,26 +55,27 @@ Template.measurementTableView.helpers({
newMeasurements(toolGroup) {
const { measurementApi, timepointApi } = Template.instance().data;
const current = timepointApi.current();
const previous = timepointApi.priorOrBaseline();
const baseline = timepointApi.baseline();
if (!measurementApi || !timepointApi || !current || !previous) return;
if (!measurementApi || !timepointApi || !current || !baseline) return;
// If this is a baseline, stop here since there are no new measurements to display
if (!current || current.timepointType === 'baseline') {
OHIF.log.info('Skipping New Measurements section');
return;
}
// Retrieve all the data for this Measurement type (e.g. 'targets')
// which was recorded at previous timepoint.
// which was recorded at baseline.
const measurementTypeId = toolGroup.measurementTypeId;
const atPrevious = measurementApi.fetch(measurementTypeId, {
timepointId: previous.timepointId
const atBaseline = measurementApi.fetch(measurementTypeId, {
timepointId: baseline.timepointId
});
// Obtain a list of the Measurement Numbers from the
// measurements which have previous timepoint's data
const numbers = atPrevious.map(m => m.measurementNumber);
// measurements which have baseline data
const numbers = atBaseline.map(m => m.measurementNumber);
// Retrieve all the data for this Measurement type which
// do NOT match the Measurement Numbers obtained above