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