LT-275: Fix case progress and measurement table tool buttons
This commit is contained in:
parent
61ba68d5e0
commit
be56608208
@ -223,9 +223,9 @@
|
|||||||
if (config.drawHandles) {
|
if (config.drawHandles) {
|
||||||
cornerstoneTools.drawHandles(context, eventData, data.handles, color);
|
cornerstoneTools.drawHandles(context, eventData, data.handles, color);
|
||||||
} else if (config.drawHandlesOnHover && data.handles.start.active) {
|
} else if (config.drawHandlesOnHover && data.handles.start.active) {
|
||||||
cornerstoneTools.drawHandles(context, eventData, [ measurement.handles.start ], color);
|
cornerstoneTools.drawHandles(context, eventData, [ data.handles.start ], color);
|
||||||
} else if (config.drawHandlesOnHover && data.handles.end.active) {
|
} else if (config.drawHandlesOnHover && data.handles.end.active) {
|
||||||
cornerstoneTools.drawHandles(context, eventData, [ measurement.handles.end ], color);
|
cornerstoneTools.drawHandles(context, eventData, [ data.handles.end ], color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the text
|
// Draw the text
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
import { Template } from 'meteor/templating';
|
||||||
|
import { ReactiveVar } from 'meteor/reactive-var';
|
||||||
|
|
||||||
Template.caseProgress.onCreated(() => {
|
Template.caseProgress.onCreated(() => {
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
|
|
||||||
@ -17,12 +20,8 @@ Template.caseProgress.onRendered(() => {
|
|||||||
|
|
||||||
// Get the current timepoint
|
// Get the current timepoint
|
||||||
const current = instance.data.timepointApi.current();
|
const current = instance.data.timepointApi.current();
|
||||||
if (!current) {
|
const prior = instance.data.timepointApi.prior();
|
||||||
instance.progressPercent.set(100);
|
if (!current || !prior || !current.timepointId) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!current.timepointId) {
|
|
||||||
instance.progressPercent.set(100);
|
instance.progressPercent.set(100);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -32,8 +31,47 @@ Template.caseProgress.onRendered(() => {
|
|||||||
// Retrieve the initial number of targets left to measure at this
|
// Retrieve the initial number of targets left to measure at this
|
||||||
// follow-up. Note that this is done outside of the reactive function
|
// follow-up. Note that this is done outside of the reactive function
|
||||||
// below so that new lesions don't change the initial target count.
|
// below so that new lesions don't change the initial target count.
|
||||||
const withPriors = true;
|
|
||||||
const totalTargets = 10; //instance.data.measurementApi.targets(withPriors).length;
|
const config = OHIF.measurements.MeasurementApi.getConfiguration();
|
||||||
|
const tools = config.measurementTools;
|
||||||
|
const toolsToInclude = tools.filter(tool => tool.options && tool.options.includeInCaseProgress);
|
||||||
|
const toolIds = toolsToInclude.map(tool => tool.id);
|
||||||
|
const api = instance.data.measurementApi;
|
||||||
|
|
||||||
|
const getNumMeasurementsAtTimepoint = timepointId => {
|
||||||
|
const filter = {
|
||||||
|
timepointId: timepointId
|
||||||
|
};
|
||||||
|
|
||||||
|
let count = 0;
|
||||||
|
toolIds.forEach(measurementTypeId => {
|
||||||
|
count += api.fetch(measurementTypeId, filter).length;
|
||||||
|
});
|
||||||
|
|
||||||
|
return count;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getNumRemainingBetweenTimepoints = (currentTimepointId, priorTimepointId) => {
|
||||||
|
const currentFilter = {
|
||||||
|
timepointId: currentTimepointId
|
||||||
|
};
|
||||||
|
|
||||||
|
const priorFilter = {
|
||||||
|
timepointId: priorTimepointId
|
||||||
|
};
|
||||||
|
|
||||||
|
let totalRemaining = 0;
|
||||||
|
toolIds.forEach(measurementTypeId => {
|
||||||
|
const numCurrent = api.fetch(measurementTypeId, currentFilter).length;
|
||||||
|
const numPrior = api.fetch(measurementTypeId, priorFilter).length;
|
||||||
|
const remaining = Math.max(numPrior - numCurrent, 0);
|
||||||
|
totalRemaining += remaining;
|
||||||
|
});
|
||||||
|
|
||||||
|
return totalRemaining;
|
||||||
|
};
|
||||||
|
|
||||||
|
const totalMeasurements = getNumMeasurementsAtTimepoint(prior.timepointId);
|
||||||
|
|
||||||
// If we're currently reviewing a Baseline timepoint, don't do any
|
// If we're currently reviewing a Baseline timepoint, don't do any
|
||||||
// progress measurement.
|
// progress measurement.
|
||||||
@ -45,15 +83,15 @@ Template.caseProgress.onRendered(() => {
|
|||||||
instance.autorun(() => {
|
instance.autorun(() => {
|
||||||
// Obtain the number of Measurements for which the current Timepoint has
|
// Obtain the number of Measurements for which the current Timepoint has
|
||||||
// no Measurement data
|
// no Measurement data
|
||||||
const numRemainingMeasurements = 5; //instance.data.measurementApi.unmarked().length;
|
const numRemainingMeasurements = getNumRemainingBetweenTimepoints(current.timepointId, prior.timepointId);
|
||||||
|
const numMeasurementsMade = totalMeasurements - numRemainingMeasurements;
|
||||||
|
|
||||||
// Update the Case Progress text with the remaining measurement count
|
// Update the Case Progress text with the remaining measurement count
|
||||||
instance.progressText.set(numRemainingMeasurements);
|
instance.progressText.set(numRemainingMeasurements);
|
||||||
|
|
||||||
// Calculate the Case Progress as a percentage in order to update the
|
// Calculate the Case Progress as a percentage in order to update the
|
||||||
// radial progress bar
|
// radial progress bar
|
||||||
const numMeasurementsMade = Math.max(totalTargets - numRemainingMeasurements, 0);
|
const progressPercent = Math.min(100, Math.round(100 * numMeasurementsMade / totalMeasurements));
|
||||||
const progressPercent = Math.round(100 * numMeasurementsMade / totalTargets);
|
|
||||||
instance.progressPercent.set(progressPercent);
|
instance.progressPercent.set(progressPercent);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -86,7 +124,6 @@ Template.caseProgress.helpers({
|
|||||||
Template.caseProgress.events({
|
Template.caseProgress.events({
|
||||||
'click .js-finish-case'() {
|
'click .js-finish-case'() {
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
console.log('Case Finished!');
|
|
||||||
switchToTab('studylistTab');
|
switchToTab('studylistTab');
|
||||||
instance.data.measurementApi.storeMeasurements();
|
instance.data.measurementApi.storeMeasurements();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,10 +57,22 @@ Template.measurementTableHeaderRow.helpers({
|
|||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
const measurementType = instance.data.measurementType;
|
const measurementType = instance.data.measurementType;
|
||||||
const measurementApi = instance.data.measurementApi;
|
const measurementApi = instance.data.measurementApi;
|
||||||
|
const timepointApi = instance.data.timepointApi;
|
||||||
|
|
||||||
// TODO: Add selector to check if there are unmarked lesions
|
const current = instance.data.timepointApi.current();
|
||||||
//return measurementApi.fetch(measurementType.id).length;
|
const prior = instance.data.timepointApi.prior();
|
||||||
return;
|
if (!prior) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentFilter = { timepointId: current.timepointId };
|
||||||
|
const priorFilter = { timepointId: prior.timepointId };
|
||||||
|
const measurementTypeId = measurementType.id;
|
||||||
|
|
||||||
|
const numCurrent = measurementApi.fetch(measurementTypeId, currentFilter).length;
|
||||||
|
const numPrior = measurementApi.fetch(measurementTypeId, priorFilter).length;
|
||||||
|
const remaining = Math.max(numPrior - numCurrent, 0);
|
||||||
|
return remaining > 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ Template.measurementTableView.helpers({
|
|||||||
const Collection = api[measurementTypeId];
|
const Collection = api[measurementTypeId];
|
||||||
const data = Collection.find().fetch();
|
const data = Collection.find().fetch();
|
||||||
|
|
||||||
const groupObject = _.groupBy(data, entry => { return entry.measurementNumber });
|
const groupObject = _.groupBy(data, entry => entry.measurementNumber);
|
||||||
|
|
||||||
return Object.keys(groupObject).map(key => {
|
return Object.keys(groupObject).map(key => {
|
||||||
const anEntry = groupObject[key][0];
|
const anEntry = groupObject[key][0];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user