LT-305: Small fixes related to find/replace and target measurement functions being pulled from old code. Temporarily removed CR/UN/EX tools
This commit is contained in:
parent
16f7b39b44
commit
adb8e76aef
@ -111,10 +111,11 @@ Template.toolbarSection.helpers({
|
||||
|
||||
extraToolbarButtons() {
|
||||
// Check if the measure tools shall be disabled
|
||||
const isToolDisabled = false; //!Template.instance().data.timepointApi.currentTimepointId;
|
||||
const isToolDisabled = !Template.instance().data.timepointApi.currentTimepointId;
|
||||
const buttonData = [];
|
||||
|
||||
// TODO: Get real icons for CR / UN / EX
|
||||
/* Disabling these for now, since they aren't hooked up in the Lesion Tracker yet
|
||||
buttonData.push({
|
||||
id: 'crTool',
|
||||
title: 'CR Tool',
|
||||
@ -137,7 +138,7 @@ Template.toolbarSection.helpers({
|
||||
classes: 'imageViewerTool toolbarSectionButton',
|
||||
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-temp',
|
||||
disabled: isToolDisabled
|
||||
});
|
||||
});*/
|
||||
|
||||
return buttonData;
|
||||
}
|
||||
|
||||
@ -124,32 +124,5 @@ Template.viewer.events({
|
||||
},
|
||||
'CornerstoneToolsMeasurementRemoved .imageViewerViewport'(event, instance, eventData) {
|
||||
OHIF.measurements.MeasurementHandlers.onRemoved(event, instance, eventData);
|
||||
},
|
||||
CornerstoneToolsMouseClick(event, instance, data) {
|
||||
const element = event.target;
|
||||
|
||||
const toolState = cornerstoneTools.getToolState(element, 'bidirectional');
|
||||
|
||||
// Stop here if no tool state was found
|
||||
if (!toolState) {
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
for (let i = 0; i < toolState.data.length; i++) {
|
||||
const toolData = toolState.data[i];
|
||||
if (toolData.active) {
|
||||
OHIF.measurements.toggleLabelButton({
|
||||
instance,
|
||||
measurementId: toolData._id,
|
||||
toolType: toolData.toolType,
|
||||
element,
|
||||
measurementApi: instance.data.measurementApi,
|
||||
position: data.currentPoints.page
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -13,9 +13,9 @@
|
||||
}];
|
||||
|
||||
var configuration = {
|
||||
setmeasurementNumberCallback: setmeasurementNumberCallback,
|
||||
getLesionLocationCallback: getLesionLocationCallback,
|
||||
changeLesionLocationCallback: changeLesionLocationCallback,
|
||||
setMeasurementNumberCallback: setMeasurementNumberCallback,
|
||||
getMeasurementLocationCallback: getMeasurementLocationCallback,
|
||||
changeMeasurementLocationCallback: changeMeasurementLocationCallback,
|
||||
drawHandles: false,
|
||||
drawHandlesOnHover: false,
|
||||
arrowFirst: true
|
||||
@ -28,17 +28,17 @@
|
||||
|
||||
// Set lesion number
|
||||
// Get Non-Target lesions on image
|
||||
function setmeasurementNumberCallback(measurementData, eventData, doneCallback) {
|
||||
function setMeasurementNumberCallback(measurementData, eventData, doneCallback) {
|
||||
var measurementNumber = 1;
|
||||
doneCallback(measurementNumber);
|
||||
}
|
||||
// Define a callback to get your text annotation
|
||||
// This could be used, e.g. to open a modal
|
||||
function getLesionLocationCallback(measurementData, eventData, doneCallback) {
|
||||
function getMeasurementLocationCallback(measurementData, eventData, doneCallback) {
|
||||
doneCallback(prompt('Enter your lesion location:'));
|
||||
}
|
||||
|
||||
function changeLesionLocationCallback(measurementData, eventData, doneCallback) {
|
||||
function changeMeasurementLocationCallback(measurementData, eventData, doneCallback) {
|
||||
doneCallback(prompt('Change your lesion location:'));
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
|
||||
// Set lesion number and lesion name
|
||||
if (measurementData.measurementNumber === undefined) {
|
||||
config.setmeasurementNumberCallback(measurementData, mouseEventData, doneCallback);
|
||||
config.setMeasurementNumberCallback(measurementData, mouseEventData, doneCallback);
|
||||
}
|
||||
|
||||
// associate this data with this imageId so we can render it and manipulate it
|
||||
@ -115,7 +115,7 @@
|
||||
// delete the measurement
|
||||
cornerstoneTools.removeToolState(mouseEventData.element, toolType, measurementData);
|
||||
} else {
|
||||
config.getLesionLocationCallback(measurementData, mouseEventData, doneCallback);
|
||||
config.getMeasurementLocationCallback(measurementData, mouseEventData, doneCallback);
|
||||
}
|
||||
|
||||
// Unbind the Esc keydown hook
|
||||
@ -332,7 +332,7 @@
|
||||
|
||||
// Set lesion number and lesion name
|
||||
if (measurementData.lesionName === undefined) {
|
||||
config.setmeasurementNumberCallback(measurementData, touchEventData, doneCallback);
|
||||
config.setMeasurementNumberCallback(measurementData, touchEventData, doneCallback);
|
||||
}
|
||||
|
||||
cornerstone.updateImage(element);
|
||||
@ -345,7 +345,7 @@
|
||||
cornerstoneTools.removeToolState(element, toolType, measurementData);
|
||||
}
|
||||
|
||||
config.getLesionLocationCallback(measurementData, touchEventData, doneCallback);
|
||||
config.getMeasurementLocationCallback(measurementData, touchEventData, doneCallback);
|
||||
|
||||
$(element).on('CornerstoneToolsTouchDrag', cornerstoneTools[toolType + "Touch"].touchMoveHandle);
|
||||
$(element).on('CornerstoneToolsDragStartActive', cornerstoneTools[toolType + "Touch"].touchDownActivateCallback);
|
||||
@ -388,7 +388,7 @@
|
||||
data.active = true;
|
||||
cornerstone.updateImage(element);
|
||||
// Allow relabelling via a callback
|
||||
config.changeLesionLocationCallback(data, eventData, doneCallback);
|
||||
config.changeMeasurementLocationCallback(data, eventData, doneCallback);
|
||||
|
||||
e.stopImmediatePropagation();
|
||||
return false;
|
||||
|
||||
@ -1,16 +1,7 @@
|
||||
// Note: This component is not in use, but the functions below are still being used. This
|
||||
// is in the process of being moved into another location
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
function closeHandler(dialog) {
|
||||
// Hide the measurement dialog
|
||||
$(dialog).css('display', 'none');
|
||||
|
||||
// Remove the backdrop
|
||||
$('.removableBackdrop').remove();
|
||||
|
||||
// Restore the focus to the active viewport
|
||||
setFocusToActiveViewport();
|
||||
}
|
||||
|
||||
// This event sets measurement number for new measurement
|
||||
function getSetMeasurementNumberCallbackFunction(measurementTypeId, measurementApi, timepointApi) {
|
||||
return (measurementData, eventData, doneCallback) => {
|
||||
@ -42,162 +33,28 @@ function getSetMeasurementNumberCallbackFunction(measurementTypeId, measurementA
|
||||
};
|
||||
}
|
||||
|
||||
// This event determines whether or not to show the measurement dialog
|
||||
// If there already exists a measurement with this specific measurement number,
|
||||
// related to the chosen location.
|
||||
function getMeasurementLocationCallback(measurementData, eventData) {
|
||||
return;
|
||||
Template.measurementLocationDialog.measurementData = measurementData;
|
||||
|
||||
// Reset the doneCallback saved in the template so we don't call the change event's done callback
|
||||
Template.measurementLocationDialog.doneCallback = undefined;
|
||||
|
||||
// Get the measurement location dialog
|
||||
var dialog = $('#measurementLocationDialog');
|
||||
Template.measurementLocationDialog.dialog = dialog;
|
||||
|
||||
// Show the backdrop
|
||||
UI.render(Template.removableBackdrop, document.body);
|
||||
|
||||
// Make sure the context menu is closed when the user clicks away
|
||||
$('.removableBackdrop').one('mousedown touchstart', function() {
|
||||
closeHandler(dialog);
|
||||
});
|
||||
|
||||
// Select the first option for now
|
||||
var selector = dialog.find('select.selectMeasurementLocation');
|
||||
selector.find('option:first').prop('selected', true);
|
||||
|
||||
// Find out if this measurement number is already added in the measurement manager for another timepoint
|
||||
// If it is, stop here because we don't need the dialog.
|
||||
var locationUID = OHIF.measurements.MeasurementManager.getLocationIdIfMeasurementExists(measurementData);
|
||||
if (locationUID) {
|
||||
// Add an ID value to the tool data to link it to the Measurements collection
|
||||
measurementData.id = 'notready';
|
||||
|
||||
measurementData.locationUID = locationUID;
|
||||
MeasurementManager.updateMeasurementData(measurementData);
|
||||
closeHandler();
|
||||
return;
|
||||
}
|
||||
// If it isn't, continue to open the dialog and have the user choose a measurement location
|
||||
|
||||
// Show the measurement location dialog above
|
||||
var dialogProperty = {
|
||||
top: eventData.currentPoints.page.y - dialog.outerHeight() - 40,
|
||||
left: eventData.currentPoints.page.x - dialog.outerWidth() / 2,
|
||||
display: 'block'
|
||||
};
|
||||
|
||||
var pageHeight = $(window).height();
|
||||
dialogProperty.top = Math.max(dialogProperty.top, 0);
|
||||
dialogProperty.top = Math.min(dialogProperty.top, pageHeight - dialog.outerHeight());
|
||||
|
||||
var pageWidth = $(window).width();
|
||||
dialogProperty.left = Math.max(dialogProperty.left, 0);
|
||||
dialogProperty.left = Math.min(dialogProperty.left, pageWidth - dialog.outerWidth());
|
||||
|
||||
// Device is touch device or not
|
||||
// If device is touch device, set position center of screen vertically and horizontally
|
||||
if (isTouchDevice()) {
|
||||
// add dialogMobile class to provide a black,transparent background
|
||||
dialog.addClass('dialogMobile');
|
||||
dialogProperty.top = 0;
|
||||
dialogProperty.left = 0;
|
||||
dialogProperty.right = 0;
|
||||
dialogProperty.bottom = 0;
|
||||
}
|
||||
|
||||
dialog.css(dialogProperty);
|
||||
dialog.focus();
|
||||
}
|
||||
|
||||
changeMeasurementLocationCallback = function(measurementData, eventData, doneCallback) {
|
||||
return;
|
||||
Template.measurementLocationDialog.measurementData = measurementData;
|
||||
Template.measurementLocationDialog.doneCallback = doneCallback;
|
||||
|
||||
// Get the measurement location dialog
|
||||
var dialog = $('#measurementLocationRelabelDialog');
|
||||
|
||||
// Show/Hide Convert To NonTarget option in measurementLocationRelabelDialog
|
||||
if (measurementData.toolType === 'bidirectional') {
|
||||
dialog.find('#convertToNonTarget').css('visibility', 'visible');
|
||||
} else {
|
||||
dialog.find('#convertToNonTarget').css('visibility', 'hidden');
|
||||
}
|
||||
|
||||
Template.measurementLocationDialog.dialog = dialog;
|
||||
|
||||
// Show the backdrop
|
||||
UI.render(Template.removableBackdrop, document.body);
|
||||
|
||||
// Make sure the context menu is closed when the user clicks away
|
||||
$('.removableBackdrop').one('mousedown touchstart', function() {
|
||||
closeHandler(dialog);
|
||||
});
|
||||
|
||||
// Show the measurement location dialog above
|
||||
var dialogProperty = {
|
||||
display: 'block'
|
||||
};
|
||||
|
||||
// Device is touch device or not
|
||||
// If device is touch device, set position center of screen vertically and horizontally
|
||||
if (!eventData || isTouchDevice()) {
|
||||
// add dialogMobile class to provide a black,transparent background
|
||||
dialog.addClass('dialogMobile');
|
||||
dialogProperty.top = 0;
|
||||
dialogProperty.left = 0;
|
||||
dialogProperty.right = 0;
|
||||
dialogProperty.bottom = 0;
|
||||
} else {
|
||||
dialogProperty.top = eventData.currentPoints.page.y - dialog.outerHeight() - 40;
|
||||
dialogProperty.left = eventData.currentPoints.page.x - dialog.outerWidth() / 2;
|
||||
}
|
||||
|
||||
dialog.css(dialogProperty);
|
||||
dialog.focus();
|
||||
|
||||
var measurement = Measurements.findOne(measurementData.id);
|
||||
if (!measurement) {
|
||||
return;
|
||||
}
|
||||
|
||||
MeasurementLocations.update({},
|
||||
{
|
||||
$set: {
|
||||
selected: false
|
||||
}
|
||||
}, {
|
||||
multi: true
|
||||
});
|
||||
|
||||
var currentLocation = MeasurementLocations.findOne({
|
||||
id: measurement.locationId
|
||||
});
|
||||
|
||||
if (!currentLocation) {
|
||||
return;
|
||||
}
|
||||
|
||||
MeasurementLocations.update(currentLocation._id, {
|
||||
$set: {
|
||||
selected: true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Template.measurementLocationDialog.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
const measurementTypeId = 'targets';
|
||||
const measurementApi = instance.data.measurementApi;
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
|
||||
const toggleLabel = (measurementData, eventdata, doneCallback) => {
|
||||
OHIF.measurements.toggleLabelButton({
|
||||
instance,
|
||||
measurementId: measurementData._id,
|
||||
toolType: measurementData.toolType,
|
||||
element: eventdata.element,
|
||||
measurementApi: instance.data.measurementApi,
|
||||
position: eventdata.currentPoints.page
|
||||
});
|
||||
};
|
||||
|
||||
const config = {
|
||||
setMeasurementNumberCallback: getSetMeasurementNumberCallbackFunction(measurementTypeId, measurementApi, timepointApi),
|
||||
getMeasurementLocationCallback: getMeasurementLocationCallback,
|
||||
changeMeasurementLocationCallback: changeMeasurementLocationCallback
|
||||
// TODO: Check the position for these, the Add Label button position seems very awkward
|
||||
getMeasurementLocationCallback: toggleLabel,
|
||||
changeMeasurementLocationCallback: toggleLabel,
|
||||
};
|
||||
|
||||
cornerstoneTools.bidirectional.setConfiguration(config);
|
||||
@ -209,39 +66,8 @@ Template.measurementLocationDialog.onCreated(() => {
|
||||
|
||||
});
|
||||
|
||||
// Note: None of these events work anymore
|
||||
Template.measurementLocationDialog.events({
|
||||
'change .selectMeasurementLocation': function(e) {
|
||||
var measurementData = Template.measurementLocationDialog.measurementData;
|
||||
var doneCallback = Template.measurementLocationDialog.doneCallback;
|
||||
var dialog = Template.measurementLocationDialog.dialog;
|
||||
|
||||
// Get the current value of the selector
|
||||
var selectedOptionId = e.currentTarget.value;
|
||||
|
||||
// If the selected option is still the default (-1)
|
||||
// then stop here
|
||||
if (selectedOptionId < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get selected location data
|
||||
var locationObj = MeasurementLocations.findOne({
|
||||
_id: selectedOptionId
|
||||
});
|
||||
|
||||
Measurements.update(measurementData.id, {
|
||||
$set: {
|
||||
locationId: locationObj.id,
|
||||
}
|
||||
});
|
||||
|
||||
// Close the dialog
|
||||
closeHandler(dialog);
|
||||
|
||||
if (doneCallback && typeof doneCallback === 'function') {
|
||||
doneCallback(measurementData);
|
||||
}
|
||||
},
|
||||
'click #removeMeasurement': function() {
|
||||
var measurementData = Template.measurementLocationDialog.measurementData;
|
||||
var doneCallback = Template.measurementLocationDialog.doneCallback;
|
||||
@ -268,27 +94,8 @@ Template.measurementLocationDialog.events({
|
||||
|
||||
const instance = Template.instance();
|
||||
const measurementApi = instance.data.measurementApi;
|
||||
OHIF.measurementtracker.convertToNonTarget(measurementApi, measurementData);
|
||||
OHIF.measurementTracker.convertToNonTarget(measurementApi, measurementData);
|
||||
|
||||
closeHandler(dialog);
|
||||
},
|
||||
'click #btnCloseMeasurementPopup': function() {
|
||||
var dialog = Template.measurementLocationDialog.dialog;
|
||||
closeHandler(dialog);
|
||||
},
|
||||
'keydown #measurementLocationDialog, keydown #measurementLocationRelabelDialog': function(e) {
|
||||
var dialog = Template.measurementLocationDialog.dialog;
|
||||
|
||||
// If Esc or Enter are pressed, close the dialog
|
||||
if (e.which === keys.ESC || e.which === keys.ENTER) {
|
||||
closeHandler(dialog);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Template.measurementLocationDialog.helpers({
|
||||
measurementLocations() {
|
||||
return MeasurementLocations.find();
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -247,10 +247,10 @@ Template.nonTargetMeasurementDialog.onCreated(() => {
|
||||
const config = {
|
||||
setMeasurementNumberCallback: getSetMeasurementNumberCallbackFunction(measurementTypeId, measurementApi, timepointApi),
|
||||
getMeasurementLocationCallback: getMeasurementLocationCallback,
|
||||
changeMeasurementLocationCallback: changeMeasurementLocationCallback
|
||||
changeMeasurementLocationCallback: () => {}
|
||||
};
|
||||
|
||||
//cornerstoneTools.nonTarget.setConfiguration(config);
|
||||
cornerstoneTools.nonTarget.setConfiguration(config);
|
||||
});
|
||||
|
||||
Template.nonTargetMeasurementDialog.events({
|
||||
|
||||
@ -235,7 +235,7 @@ Template.selectTree.events({
|
||||
storedData[itemKey] = 1;
|
||||
}
|
||||
|
||||
// Updata the stored data with the new count
|
||||
// Update the stored data with the new count
|
||||
OHIF.user.setData(storageKey, storedData);
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,9 @@ Template.measurementTableView.helpers({
|
||||
const instance = Template.instance();
|
||||
const measurementApi = instance.data.measurementApi;
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
if (!measurementApi || !timepointApi) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Retrieve all the data for this Measurement type (e.g. 'targets')
|
||||
// which was recorded at baseline.
|
||||
|
||||
@ -4,7 +4,10 @@ import { _ } from 'meteor/underscore';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
const toolMap = {
|
||||
bidirectional: 'targets'
|
||||
bidirectional: 'targets',
|
||||
crTool: 'targets',
|
||||
unTool: 'targets',
|
||||
exTool: 'targets'
|
||||
};
|
||||
|
||||
OHIF.measurements.toggleLabelButton = options => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user