LT-291: Changing measuement table rename behavior for Non-Targets
This commit is contained in:
parent
9998323cfb
commit
1b10665612
@ -1,4 +1,3 @@
|
||||
import { _ } from 'meteor/underscore';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
(function($, cornerstone, cornerstoneMath, cornerstoneTools) {
|
||||
@ -20,35 +19,21 @@ import { OHIF } from 'meteor/ohif:core';
|
||||
ESC: 27
|
||||
};
|
||||
|
||||
const toolMethods = {
|
||||
removeMeasurement() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
const showLocationDialog = settings => {
|
||||
const dialogSettings = _.extend({
|
||||
title: 'Lesion Location',
|
||||
toolMethods
|
||||
}, settings);
|
||||
OHIF.ui.showFormDialog('dialogNonTargetMeasurement', dialogSettings);
|
||||
};
|
||||
|
||||
// Define a callback to get your text annotation
|
||||
// This could be used, e.g. to open a modal
|
||||
function getMeasurementLocationCallback(measurementData, eventData) {
|
||||
showLocationDialog({
|
||||
OHIF.ui.showFormDialog('dialogNonTargetMeasurement', {
|
||||
title: 'Select Lesion Location',
|
||||
measurementData,
|
||||
eventData
|
||||
element: eventData.element,
|
||||
measurementData
|
||||
});
|
||||
}
|
||||
|
||||
function changeMeasurementLocationCallback(measurementData, eventData) {
|
||||
showLocationDialog({
|
||||
OHIF.ui.showFormDialog('dialogNonTargetMeasurement', {
|
||||
title: 'Change Lesion Location',
|
||||
element: eventData.element,
|
||||
measurementData,
|
||||
eventData,
|
||||
edit: true
|
||||
});
|
||||
}
|
||||
|
||||
@ -9,8 +9,6 @@ Template.dialogNonTargetMeasurement.onCreated(() => {
|
||||
|
||||
instance.measurementTypeId = 'nonTargets';
|
||||
|
||||
const measurementData = instance.data.measurementData;
|
||||
|
||||
instance.schema = new SimpleSchema({
|
||||
location: FieldLesionLocation,
|
||||
response: FieldLesionLocationResponse
|
||||
@ -19,11 +17,11 @@ Template.dialogNonTargetMeasurement.onCreated(() => {
|
||||
// Remove the measurement from the collection
|
||||
instance.removeMeasurement = () => {
|
||||
instance.viewerData.measurementApi.deleteMeasurements(instance.measurementTypeId, {
|
||||
_id: measurementData._id
|
||||
_id: instance.data.measurementData._id
|
||||
});
|
||||
|
||||
// Refresh the image with the measurement removed
|
||||
cornerstone.updateImage(instance.cornerstoneElement);
|
||||
cornerstone.updateImage(instance.data.element);
|
||||
};
|
||||
|
||||
// Close the current dialog
|
||||
@ -48,19 +46,20 @@ Template.dialogNonTargetMeasurement.onCreated(() => {
|
||||
Template.dialogNonTargetMeasurement.onRendered(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
instance.cornerstoneElement = instance.data.eventData.element;
|
||||
|
||||
const form = instance.$('form').data('component');
|
||||
|
||||
const viewerMain = $(instance.cornerstoneElement).closest('.viewerMain')[0];
|
||||
console.warn('>>>>instance.data', instance.data);
|
||||
|
||||
const viewerMain = $(instance.data.element).closest('.viewerMain')[0];
|
||||
instance.viewerData = Blaze.getData(viewerMain);
|
||||
|
||||
const measurementApi = instance.viewerData.measurementApi;
|
||||
const timepointApi = instance.viewerData.timepointApi;
|
||||
|
||||
const measurementData = instance.data.measurementData;
|
||||
const collection = measurementApi[instance.measurementTypeId];
|
||||
|
||||
const measurementData = instance.data.measurementData;
|
||||
|
||||
// Get the current inserted measurement from the collection
|
||||
const currentMeasurement = collection.findOne({ _id: measurementData._id });
|
||||
|
||||
@ -87,14 +86,14 @@ Template.dialogNonTargetMeasurement.onRendered(() => {
|
||||
location,
|
||||
response
|
||||
});
|
||||
|
||||
// Synchronize the measurement number with the one inserted in the collection
|
||||
measurementData.measurementNumber = currentMeasurement.measurementNumber;
|
||||
|
||||
// Refresh the image with the measurement number
|
||||
cornerstone.updateImage(instance.data.element);
|
||||
}
|
||||
|
||||
// Synchronize the measurement number with the one inserted in the collection
|
||||
measurementData.measurementNumber = currentMeasurement.measurementNumber;
|
||||
|
||||
// Refresh the image with the measurement number
|
||||
cornerstone.updateImage(instance.cornerstoneElement);
|
||||
|
||||
// Delete the measurement from collection when dialog is closed and not on edit mode
|
||||
instance.data.promise.catch(() => {
|
||||
if (instance.data.edit) {
|
||||
|
||||
@ -30,10 +30,13 @@ Template.measurementTableRow.events({
|
||||
},
|
||||
|
||||
'click .js-rename'(event, instance) {
|
||||
const rowItem = instance.data.rowItem;
|
||||
|
||||
// Show the measure flow for targets
|
||||
OHIF.measurements.toggleLabelButton({
|
||||
instance,
|
||||
measurementId: instance.data.rowItem.entries[0],
|
||||
measurementTypeId: instance.data.rowItem.measurementTypeId,
|
||||
measurementId: rowItem.entries[0]._id,
|
||||
measurementTypeId: rowItem.measurementTypeId,
|
||||
element: document.body,
|
||||
measurementApi: instance.data.measurementApi,
|
||||
position: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user