PWV-15: Creating routing branch
This commit is contained in:
1 parent
e618e32341
commit
efb4ca23b5
24 files changed
+158
-437
No files matched your search
@@ -12,8 +12,6 @@ Template.caseProgress.onCreated(() => {
|
||||
instance.path = 'viewer.studyViewer.measurements';
|
||||
|
||||
instance.saveData = () => {
|
||||
const api = instance.data.measurementApi;
|
||||
|
||||
// Clear signaled unsaved changes...
|
||||
const successHandler = () => {
|
||||
OHIF.ui.unsavedChanges.clear(`${instance.path}.*`);
|
||||
@@ -22,7 +20,7 @@ Template.caseProgress.onCreated(() => {
|
||||
// Display the error messages
|
||||
const errorHandler = data => OHIF.ui.showDialog('dialogInfo', data);
|
||||
|
||||
const promise = api.storeMeasurements();
|
||||
const promise = instance.data.measurementApi.storeMeasurements();
|
||||
promise.then(successHandler).catch(errorHandler);
|
||||
OHIF.ui.showDialog('dialogLoading', {
|
||||
promise,
|
||||
@@ -51,16 +49,17 @@ Template.caseProgress.onDestroyed(() => {
|
||||
|
||||
Template.caseProgress.onRendered(() => {
|
||||
const instance = Template.instance();
|
||||
const { timepointApi, measurementApi } = instance.data;
|
||||
|
||||
// Stop here if we have no current timepoint ID (and therefore no defined timepointAPI)
|
||||
if (!instance.data.timepointApi) {
|
||||
if (!timepointApi) {
|
||||
instance.progressPercent.set(100);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the current timepoint
|
||||
const current = instance.data.timepointApi.current();
|
||||
const prior = instance.data.timepointApi.prior();
|
||||
const current = timepointApi.current();
|
||||
const prior = timepointApi.prior();
|
||||
if (!current || !prior || !current.timepointId) {
|
||||
instance.progressPercent.set(100);
|
||||
return;
|
||||
@@ -72,7 +71,6 @@ Template.caseProgress.onRendered(() => {
|
||||
// follow-up. Note that this is done outside of the reactive function
|
||||
// below so that new lesions don't change the initial target count.
|
||||
|
||||
const api = instance.data.measurementApi;
|
||||
const config = OHIF.measurements.MeasurementApi.getConfiguration();
|
||||
const toolGroups = config.measurementTools;
|
||||
|
||||
@@ -95,7 +93,7 @@ Template.caseProgress.onRendered(() => {
|
||||
|
||||
let count = 0;
|
||||
toolGroups.forEach(toolGroup => {
|
||||
count += api.fetch(toolGroup.id, filter).length;
|
||||
count += measurementApi.fetch(toolGroup.id, filter).length;
|
||||
});
|
||||
|
||||
return count;
|
||||
@@ -108,8 +106,8 @@ Template.caseProgress.onRendered(() => {
|
||||
let totalRemaining = 0;
|
||||
toolGroups.forEach(toolGroup => {
|
||||
const toolGroupId = toolGroup.id;
|
||||
const numCurrent = api.fetch(toolGroupId, currentFilter).length;
|
||||
const numPrior = api.fetch(toolGroupId, priorFilter).length;
|
||||
const numCurrent = measurementApi.fetch(toolGroupId, currentFilter).length;
|
||||
const numPrior = measurementApi.fetch(toolGroupId, priorFilter).length;
|
||||
const remaining = Math.max(numPrior - numCurrent, 0);
|
||||
totalRemaining += remaining;
|
||||
});
|
||||
@@ -125,7 +123,7 @@ Template.caseProgress.onRendered(() => {
|
||||
// Setup a reactive function to update the progress whenever
|
||||
// a measurement is made
|
||||
instance.autorun(() => {
|
||||
api.changeObserver.depend();
|
||||
measurementApi.changeObserver.depend();
|
||||
// Obtain the number of Measurements for which the current Timepoint has
|
||||
// no Measurement data
|
||||
const totalMeasurements = getNumMeasurementsAtTimepoint(prior.timepointId);
|
||||
|
||||
@@ -14,13 +14,14 @@ Template.measurementTable.onCreated(() => {
|
||||
// Get the current table layout
|
||||
const tableLayout = instance.data.measurementTableLayout.get();
|
||||
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
let timepoints;
|
||||
if (!instance.data.timepointApi) {
|
||||
if (!timepointApi) {
|
||||
timepoints = [];
|
||||
} else if (tableLayout === 'key') {
|
||||
timepoints = instance.data.timepointApi.key();
|
||||
timepoints = timepointApi.key();
|
||||
} else {
|
||||
timepoints = instance.data.timepointApi.currentAndPrior();
|
||||
timepoints = timepointApi.currentAndPrior();
|
||||
}
|
||||
|
||||
// Return key timepoints
|
||||
|
||||
+8
-2
@@ -1,9 +1,14 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { Session } from 'meteor/session';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
|
||||
Template.measurementTableHUD.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
|
||||
instance.isRemoved = true;
|
||||
if (instance.data.timepointApi) {
|
||||
instance.data.timepoints = new ReactiveVar(instance.data.timepointApi.currentAndPrior());
|
||||
if (timepointApi) {
|
||||
instance.data.timepoints = new ReactiveVar(timepointApi.currentAndPrior());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,6 +42,7 @@ Template.measurementTableHUD.helpers({
|
||||
|
||||
return instance.isRemoved !== true ? 'dialog-animated dialog-closed' : 'hidden';
|
||||
},
|
||||
|
||||
toolbarButtons() {
|
||||
let buttonData = [];
|
||||
|
||||
|
||||
+1
-3
@@ -52,7 +52,6 @@ Template.measurementTableRow.events({
|
||||
|
||||
// Show the measure flow for targets
|
||||
OHIF.measurements.toggleLabelButton({
|
||||
instance,
|
||||
measurement: entry,
|
||||
element: document.body,
|
||||
measurementApi: instance.data.measurementApi,
|
||||
@@ -78,8 +77,7 @@ Template.measurementTableRow.events({
|
||||
const measurementTypeId = instance.data.rowItem.measurementTypeId;
|
||||
const measurement = instance.data.rowItem.entries[0];
|
||||
const measurementNumber = measurement.measurementNumber;
|
||||
const measurementApi = instance.data.measurementApi;
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
const { timepointApi, measurementApi } = instance.data;
|
||||
|
||||
// Remove all the measurements with the given type and number
|
||||
measurementApi.deleteMeasurements(measurementTypeId, { measurementNumber });
|
||||
|
||||
+15
-23
@@ -1,3 +1,5 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { _ } from 'meteor/underscore';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Template.measurementTableTimepointCell.helpers({
|
||||
@@ -15,6 +17,7 @@ Template.measurementTableTimepointCell.helpers({
|
||||
return rowItem.entries.length > 0;
|
||||
}
|
||||
},
|
||||
|
||||
displayData() {
|
||||
const instance = Template.instance();
|
||||
const rowItem = instance.data.rowItem;
|
||||
@@ -26,6 +29,7 @@ Template.measurementTableTimepointCell.helpers({
|
||||
if (dataAtThisTimepoint.length > 1) {
|
||||
throw 'More than one measurement was found at the same timepoint with the same measurement number?';
|
||||
}
|
||||
|
||||
data = dataAtThisTimepoint[0];
|
||||
} else {
|
||||
data = rowItem.entries[0];
|
||||
@@ -38,29 +42,14 @@ Template.measurementTableTimepointCell.helpers({
|
||||
const tool = _.findWhere(toolGroup.childTools, { id: data.toolType });
|
||||
if (!tool) {
|
||||
// TODO: Figure out what is going on here?
|
||||
console.warn('Something went wrong?');
|
||||
OHIF.log.warn('Something went wrong?');
|
||||
}
|
||||
|
||||
const displayFunction = tool.options.measurementTable.displayFunction;
|
||||
return displayFunction(data);
|
||||
}
|
||||
});
|
||||
|
||||
function doneCallback(measurementData, deleteTool) {
|
||||
// If a Lesion or Non-Target is removed via a dialog
|
||||
// opened by the Lesion Table, we should clear the data for
|
||||
// the specified Timepoint Cell
|
||||
if (deleteTool === true) {
|
||||
OHIF.log.info('Confirm clicked!');
|
||||
OHIF.lesiontracker.clearMeasurementTimepointData(measurementData.id, measurementData.timepointId);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete a lesion if Ctrl+D or DELETE is pressed while a lesion is selected
|
||||
const keys = {
|
||||
D: 68,
|
||||
DELETE: 46
|
||||
};
|
||||
|
||||
Template.measurementTableTimepointCell.events({
|
||||
'click .measurementTableTimepointCell'(event, instance) {
|
||||
if (!instance.data.timepointId) {
|
||||
@@ -71,14 +60,18 @@ Template.measurementTableTimepointCell.events({
|
||||
const timepoints = instance.data.timepoints.get();
|
||||
OHIF.measurements.jumpToRowItem(rowItem, timepoints);
|
||||
},
|
||||
|
||||
|
||||
'keydown .measurementTableTimepointCell'(event, instance) {
|
||||
// Delete a lesion if Ctrl+D or DELETE is pressed while a lesion is selected
|
||||
const keys = {
|
||||
D: 68,
|
||||
DELETE: 46
|
||||
};
|
||||
const keyCode = event.which;
|
||||
|
||||
if (keyCode === keys.DELETE || keyCode === keys.BACKSPACE || (keyCode === keys.D && event.ctrlKey === true)) {
|
||||
const currentMeasurement = Template.parentData(1).rowItem;
|
||||
const timepointId = this.timepointId;
|
||||
|
||||
const timepointId = instance.data.timepointId;
|
||||
|
||||
const dialogSettings = {
|
||||
title: 'Delete measurements',
|
||||
message: 'Are you sure you want to delete this measurement?'
|
||||
@@ -88,8 +81,7 @@ Template.measurementTableTimepointCell.events({
|
||||
const measurementTypeId = instance.data.rowItem.measurementTypeId;
|
||||
const measurement = instance.data.rowItem.entries[0];
|
||||
const measurementNumber = measurement.measurementNumber;
|
||||
const measurementApi = instance.data.measurementApi;
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
const { timepointApi, measurementApi } = instance.data;
|
||||
|
||||
// Remove all the measurements with the given type and number
|
||||
measurementApi.deleteMeasurements(measurementTypeId, {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<template name="measurementTableTimepointHeader">
|
||||
<div class="measurementTableTimepointHeader">
|
||||
<div class="timepointName">
|
||||
{{timepointName}}
|
||||
{{timepointName this}}
|
||||
</div>
|
||||
<div class="timepointDate">
|
||||
{{formatDA latestDate "DD-MMM-YY"}}
|
||||
|
||||
+5
-6
@@ -1,8 +1,7 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
|
||||
Template.measurementTableTimepointHeader.helpers({
|
||||
'timepointName': function() {
|
||||
const timepoint = this;
|
||||
const instance = Template.instance();
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
return timepointApi.name(timepoint);
|
||||
timepointName(timepoint) {
|
||||
return Template.instance().data.timepointApi.name(timepoint);
|
||||
}
|
||||
});
|
||||
});
|
||||
+4
-5
@@ -1,5 +1,6 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { Tracker } from 'meteor/tracker';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { _ } from 'meteor/underscore';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
@@ -31,7 +32,7 @@ Template.measurementTableView.helpers({
|
||||
if (!groups) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const group = _.find(groups, item => item.toolGroup.id === toolGroupId);
|
||||
return group && !!group.measurementRows.length;
|
||||
},
|
||||
@@ -57,10 +58,8 @@ Template.measurementTableView.helpers({
|
||||
},
|
||||
|
||||
newMeasurements(toolGroup) {
|
||||
const instance = Template.instance();
|
||||
const measurementApi = instance.data.measurementApi;
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
const current = instance.data.timepointApi.current();
|
||||
const { measurementApi, timepointApi } = Template.instance().data;
|
||||
const current = timepointApi.current();
|
||||
const baseline = timepointApi.baseline();
|
||||
|
||||
if (!measurementApi || !timepointApi || !current || !baseline) return;
|
||||
|
||||
Reference in new issue
Block a user