Work on refactoring measurements out of Lesion Tracker package
- Removed AssociatedStudies Collection - Measurement API is generated from configuration files - Data exchange methods are defined in configuration
This commit is contained in:
1 parent
c511edd419
commit
ab4d4c9008
537 files changed
+5122
-3545
No files matched your search
+11
@@ -0,0 +1,11 @@
|
||||
<template name="measurementTableTimepointCell">
|
||||
{{#if hasDataAtThisTimepoint}}
|
||||
<div class="measurementTableTimepointCell" tabindex="1">
|
||||
{{displayData}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="measurementTableTimepointCell empty">
|
||||
...
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
import { MeasurementsConfiguration } from 'meteor/ohif:measurements/both/configuration/measurements';
|
||||
|
||||
Template.measurementTableTimepointCell.helpers({
|
||||
hasDataAtThisTimepoint() {
|
||||
// This simple function just checks whether or not timepoint data
|
||||
// exists for this Measurement at this Timepoint
|
||||
const instance = Template.instance();
|
||||
const rowItem = instance.data.rowItem;
|
||||
|
||||
if (this.timepointId) {
|
||||
const dataAtThisTimepoint = _.where(rowItem.entries, {timepointId: this.timepointId});
|
||||
return dataAtThisTimepoint.length > 0;
|
||||
} else {
|
||||
return rowItem.entries.length > 0;
|
||||
}
|
||||
},
|
||||
displayData() {
|
||||
const instance = Template.instance();
|
||||
|
||||
const rowItem = instance.data.rowItem;
|
||||
let data;
|
||||
if (this.timepointId) {
|
||||
const dataAtThisTimepoint = _.where(rowItem.entries, {timepointId: this.timepointId});
|
||||
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];
|
||||
}
|
||||
|
||||
const config = MeasurementsConfiguration.getConfiguration();
|
||||
const measurementTools = config.measurementTools;
|
||||
|
||||
const tool = _.where(measurementTools, {id: rowItem.measurementTypeId})[0];
|
||||
const displayFunction = tool.options.measurementTableOptions.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) {
|
||||
log.info('Confirm clicked!');
|
||||
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({
|
||||
'dblclick .measurementTableTimepointCell': function() {
|
||||
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) {
|
||||
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() {
|
||||
clearMeasurementTimepointData(currentMeasurement._id, currentTimepointID);
|
||||
});
|
||||
} else {
|
||||
changeNonTargetResponse(measurementData, null, doneCallback);
|
||||
}
|
||||
},
|
||||
'keydown .measurementTableTimepointCell': function(e) {
|
||||
const keyCode = e.which;
|
||||
if (keyCode === keys.DELETE ||
|
||||
(keyCode === keys.D && e.ctrlKey === true)) {
|
||||
const currentMeasurement = Template.parentData(1).rowItem;
|
||||
const currentTimepointID = this.timepointId;
|
||||
|
||||
showConfirmDialog(function() {
|
||||
clearMeasurementTimepointData(currentMeasurement._id, currentTimepointID);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
@import "{design}/app"
|
||||
|
||||
.measurementTableTimepointCell
|
||||
theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness)
|
||||
theme('color', '$textPrimaryColor')
|
||||
padding: 0 10px
|
||||
Reference in new issue
Block a user