LT-296: Clicking on measurement data in table activates the measurement
This commit is contained in:
1 parent
42c938fb44
commit
80337f271e
19 files changed
+288
-307
No files matched your search
@@ -40,6 +40,7 @@ Template.caseProgress.onRendered(() => {
|
||||
const api = instance.data.measurementApi;
|
||||
|
||||
const getNumMeasurementsAtTimepoint = timepointId => {
|
||||
OHIF.log.info('getNumMeasurementsAtTimepoint');
|
||||
const filter = {
|
||||
timepointId: timepointId
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
|
||||
@@ -48,28 +49,42 @@ Template.measurementTable.onRendered(() => {
|
||||
});
|
||||
|
||||
Template.measurementTable.onRendered(() => {
|
||||
// Find the first measurement by Lesion Number
|
||||
let firstLesion; // = instance.data.measurementApi.firstLesion();
|
||||
// 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();
|
||||
|
||||
// Create an object to store the ContentId inside
|
||||
const templateData = {
|
||||
contentId: Session.get('activeContentId')
|
||||
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
|
||||
}
|
||||
};
|
||||
|
||||
// Activate the first lesion
|
||||
if (firstLesion) {
|
||||
OHIF.measurements.activateLesion(firstLesion._id, templateData);
|
||||
}
|
||||
});
|
||||
const data = collection.find({}, sorting).fetch();
|
||||
|
||||
Template.measurementTable.events({
|
||||
/**
|
||||
* Retrieve the lesion id from the DOM data for this row
|
||||
*/
|
||||
/*'click table#tblLesion tbody tr': function(e, template) {
|
||||
var measurementId = $(e.currentTarget).data('measurementid');
|
||||
OHIF.measurements.activateLesion(measurementId, template.data);
|
||||
},*/
|
||||
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({
|
||||
|
||||
+22
-5
@@ -46,19 +46,35 @@ Template.measurementTableHeaderRow.onCreated(() => {
|
||||
|
||||
Template.measurementTableHeaderRow.helpers({
|
||||
numberOfMeasurements() {
|
||||
return Template.instance().data.measurements.length;
|
||||
const instance = Template.instance();
|
||||
if (!instance.data.measurements) {
|
||||
return;
|
||||
}
|
||||
return instance.data.measurements.length;
|
||||
},
|
||||
|
||||
maxNumMeasurements() {
|
||||
return Template.instance().maxNumMeasurements.get();
|
||||
const instance = Template.instance();
|
||||
if (!instance.data.measurements) {
|
||||
return;
|
||||
}
|
||||
return instance.maxNumMeasurements.get();
|
||||
},
|
||||
|
||||
anyUnmarkedLesionsLeft() {
|
||||
// Skip New Lesions section
|
||||
const instance = Template.instance();
|
||||
const measurementType = instance.data.measurementType;
|
||||
const measurementApi = instance.data.measurementApi;
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
if (!instance.data.measurements) {
|
||||
return;
|
||||
}
|
||||
|
||||
const measurementType = instance.data.measurementType;
|
||||
const config = OHIF.measurements.MeasurementApi.getConfiguration();
|
||||
if (measurementType.id === config.newMeasurementTool.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
const current = instance.data.timepointApi.current();
|
||||
const prior = instance.data.timepointApi.prior();
|
||||
if (!prior) {
|
||||
@@ -69,6 +85,7 @@ Template.measurementTableHeaderRow.helpers({
|
||||
const priorFilter = { timepointId: prior.timepointId };
|
||||
const measurementTypeId = measurementType.id;
|
||||
|
||||
const measurementApi = instance.data.measurementApi;
|
||||
const numCurrent = measurementApi.fetch(measurementTypeId, currentFilter).length;
|
||||
const numPrior = measurementApi.fetch(measurementTypeId, priorFilter).length;
|
||||
const remaining = Math.max(numPrior - numCurrent, 0);
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
<template name="measurementTableTimepointCell">
|
||||
{{#if hasDataAtThisTimepoint}}
|
||||
<div class="measurementTableTimepointCell" tabindex="1">
|
||||
<div class="measurementTableTimepointCell noselect" tabindex="1">
|
||||
{{displayData}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="measurementTableTimepointCell empty">
|
||||
<div class="measurementTableTimepointCell noselect empty">
|
||||
...
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
+9
-31
@@ -59,39 +59,17 @@ const keys = {
|
||||
};
|
||||
|
||||
Template.measurementTableTimepointCell.events({
|
||||
'dblclick .measurementTableTimepointCell': function() {
|
||||
OHIF.log.info('Double clicked on a timepoint cell');
|
||||
// Search Measurements by lesion and timepoint
|
||||
const currentMeasurement = Template.parentData(1).rowItem;
|
||||
|
||||
// Create some fake measurement data
|
||||
const currentTimepointID = this.timepointId;
|
||||
|
||||
const timepointData = currentMeasurement.timepoints[currentTimepointID];
|
||||
if (!timepointData) {
|
||||
'click .measurementTableTimepointCell'(event, instance) {
|
||||
if (!instance.data.timepointId) {
|
||||
return;
|
||||
}
|
||||
|
||||
let measurementData = {
|
||||
id: currentMeasurement._id,
|
||||
timepointId: currentTimepointID,
|
||||
response: timepointData.response,
|
||||
imageId: timepointData.imageId,
|
||||
handles: timepointData.handles,
|
||||
seriesInstanceUid: timepointData.seriesInstanceUid,
|
||||
studyInstanceUid: timepointData.studyInstanceUid
|
||||
};
|
||||
|
||||
if (currentMeasurement.isTarget) {
|
||||
showConfirmDialog(function() {
|
||||
OHIF.lesiontracker.clearMeasurementTimepointData(currentMeasurement._id, currentTimepointID);
|
||||
});
|
||||
} else {
|
||||
changeNonTargetResponse(measurementData, null, doneCallback);
|
||||
}
|
||||
},
|
||||
'keydown .measurementTableTimepointCell': function(e) {
|
||||
const keyCode = e.which;
|
||||
const rowItem = instance.data.rowItem;
|
||||
const timepoints = instance.data.timepoints.get();
|
||||
OHIF.measurements.jumpToRowItem(rowItem, timepoints);
|
||||
}/*,
|
||||
'keydown .measurementTableTimepointCell'(event, instance) {
|
||||
const keyCode = event.which;
|
||||
if (keyCode === keys.DELETE ||
|
||||
(keyCode === keys.D && e.ctrlKey === true)) {
|
||||
const currentMeasurement = Template.parentData(1).rowItem;
|
||||
@@ -101,5 +79,5 @@ Template.measurementTableTimepointCell.events({
|
||||
OHIF.lesiontracker.clearMeasurementTimepointData(currentMeasurement._id, currentTimepointID);
|
||||
});
|
||||
}
|
||||
}
|
||||
}*/
|
||||
});
|
||||
+8
-3
@@ -1,6 +1,11 @@
|
||||
@import "{design}/app"
|
||||
|
||||
.measurementTableTimepointCell
|
||||
theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness)
|
||||
theme('color', '$textPrimaryColor')
|
||||
padding: 0 10px
|
||||
theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness)
|
||||
theme('color', '$textPrimaryColor')
|
||||
padding: 0 10px
|
||||
outline: none
|
||||
cursor: pointer
|
||||
|
||||
&:hover
|
||||
theme('color', '$activeColor')
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
{{#if config.newMeasurementTool}}
|
||||
{{#let measurementType=(getNewMeasurementType config.newMeasurementTool)}}
|
||||
{{#let newMeasure=(newMeasurements measurementType)}}
|
||||
{{#if newMeasure}}
|
||||
{{#if newMeasure.length}}
|
||||
{{#let collection=newMeasure}}
|
||||
{{>measurementTableHeaderRow
|
||||
measurementType=measurementType
|
||||
|
||||
+10
-7
@@ -1,7 +1,7 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { _ } from 'meteor/underscore';
|
||||
|
||||
const getLocation = collection => {
|
||||
OHIF.measurements.getLocation = collection => {
|
||||
for (let i = 0; i < collection.length; i++) {
|
||||
if (collection[i].location) {
|
||||
return collection[i].location;
|
||||
@@ -9,6 +9,8 @@ const getLocation = collection => {
|
||||
}
|
||||
};
|
||||
|
||||
const getLocation = OHIF.measurements.getLocation;
|
||||
|
||||
Template.measurementTableView.helpers({
|
||||
getNewMeasurementType(tool) {
|
||||
// TODO: Check Conformance criteria here.
|
||||
@@ -25,13 +27,13 @@ Template.measurementTableView.helpers({
|
||||
const instance = Template.instance();
|
||||
const measurementApi = instance.data.measurementApi;
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
if (!measurementApi || !timepointApi) {
|
||||
const baseline = timepointApi.baseline();
|
||||
if (!measurementApi || !timepointApi || !baseline) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Retrieve all the data for this Measurement type (e.g. 'targets')
|
||||
// which was recorded at baseline.
|
||||
const baseline = timepointApi.baseline();
|
||||
const atBaseline = measurementApi.fetch(measurementTypeId, {
|
||||
timepointId: baseline.timepointId
|
||||
});
|
||||
@@ -65,14 +67,15 @@ Template.measurementTableView.helpers({
|
||||
const instance = Template.instance();
|
||||
const measurementApi = instance.data.measurementApi;
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
const measurementTypeId = measurementType.measurementTypeId;
|
||||
const current = instance.data.timepointApi.current();
|
||||
const baseline = timepointApi.baseline();
|
||||
|
||||
if (!timepointApi) {
|
||||
if (!measurementApi || !timepointApi || !current) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If this is a baseline, stop here since there are no new measurements to display
|
||||
const current = instance.data.timepointApi.current();
|
||||
|
||||
if (!current || current.timepointType === 'baseline') {
|
||||
console.log('Skipping New Measurements section');
|
||||
return;
|
||||
@@ -80,7 +83,7 @@ Template.measurementTableView.helpers({
|
||||
|
||||
// Retrieve all the data for this Measurement type (e.g. 'targets')
|
||||
// which was recorded at baseline.
|
||||
const baseline = timepointApi.baseline();
|
||||
const measurementTypeId = measurementType.measurementTypeId;
|
||||
const atBaseline = measurementApi.fetch(measurementTypeId, {
|
||||
timepointId: baseline.timepointId
|
||||
});
|
||||
|
||||
+1
-2
@@ -7,9 +7,8 @@
|
||||
overflow-y: auto
|
||||
margin-left: -6px
|
||||
margin-right: -16px
|
||||
padding-bottom: 100px
|
||||
padding-bottom: 116px
|
||||
padding-left: 6px
|
||||
|
||||
-webkit-overflow-scrolling: touch
|
||||
|
||||
&::-webkit-scrollbar
|
||||
|
||||
Reference in new issue
Block a user