PWV-15: Creating routing branch

This commit is contained in:
Bruno Alves de Faria committed 2017-03-21 10:16:46 -03:00
1 parent e618e32341
commit efb4ca23b5
24 files changed
+158 -437

No files matched your search

@@ -7,7 +7,3 @@ import './optionsModal/optionsModal.js';
import './optionsModal/recistDescription/recistDescription.html';
import './optionsModal/irRCDescription/irRCDescription.html';
import './measurementLocationDialog/measurementLocationDialog.html';
import './measurementLocationDialog/measurementLocationDialog.js';
import './measurementLocationDialog/measurementLocationDialog.styl';
@@ -1,38 +0,0 @@
<template name="measurementLocationDialog">
<div id="measurementLocationDialog" class="dialog-animated" tabindex="0">
<div class="dialogHeader">
<h4>Select Location</h4>
</div>
<div class="dialogContent">
<div class="measurementLocation">
<label>Location</label>
<select class="selectMeasurementLocation">
<option value="-1"></option>
{{ #each measurementLocations}}
<option value='{{_id}}'>{{location}}</option>
{{ /each}}
</select>
</div>
</div>
</div>
<div id="measurementLocationRelabelDialog" class="dialog-animated" tabindex="0">
<div class="dialogHeader">
<h4>Change Location</h4>
</div>
<a></a>
<div class="dialogContent">
<div class="measurementLocation">
<label>Location</label>
<select class="selectMeasurementLocation">
<option value="-1"></option>
{{ #each measurementLocations}}
<option value='{{_id}}' selected={{selected}}>{{location}}</option>
{{ /each}}
</select>
</div>
<button id="removeLesion" class="btn btn-link">Remove</button>
<button id="convertToNonTarget" class="btn btn-link">Convert to Non-Target</button>
</div>
</div>
</template>
@@ -1,91 +0,0 @@
// 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';
Template.measurementLocationDialog.onCreated(() => {
const instance = Template.instance();
const measurementApi = instance.data.measurementApi;
const toggleLabel = (measurementData, eventData, doneCallback) => {
delete measurementData.isCreating;
if (OHIF.lesiontracker.removeMeasurementIfInvalid(measurementData, eventData)) {
return;
}
const getHandlePosition = key => _.pick(measurementData.handles[key], ['x', 'y']);
const start = getHandlePosition('start');
const end = getHandlePosition('end');
const getDirection = axis => start[axis] < end[axis] ? 1 : -1;
const position = OHIF.cornerstone.pixelToPage(eventData.element, end);
OHIF.measurements.toggleLabelButton({
instance,
measurement: measurementData,
element: eventData.element,
measurementApi,
position: position,
direction: {
x: getDirection('x'),
y: getDirection('y')
}
});
};
const callbackConfig = {
// TODO: Check the position for these, the Add Label button position seems very awkward
getMeasurementLocationCallback: toggleLabel,
changeMeasurementLocationCallback: toggleLabel,
};
// TODO: Reconcile this with the configuration in toolManager
// it would be better to have this all in one place.
const bidirectionalConfig = cornerstoneTools.bidirectional.getConfiguration();
const config = {
...bidirectionalConfig,
...callbackConfig
};
cornerstoneTools.bidirectional.setConfiguration(config);
// Set CR-Tool, UN-Tool, EX-Tool configurations
cornerstoneTools.targetCR.setConfiguration(config);
cornerstoneTools.targetUN.setConfiguration(config);
cornerstoneTools.targetEX.setConfiguration(config);
});
// Note: None of these events work anymore
Template.measurementLocationDialog.events({
'click #removeMeasurement'() {
const measurementData = Template.measurementLocationDialog.measurementData;
const doneCallback = Template.measurementLocationDialog.doneCallback;
const dialog = Template.measurementLocationDialog.dialog;
const options = {
keyPressAllowed: false,
title: 'Remove measurement?',
text: 'Are you sure you would like to remove the entire measurement?'
};
showConfirmDialog(function() {
if (doneCallback && typeof doneCallback === 'function') {
const deleteTool = true;
doneCallback(measurementData, deleteTool);
}
}, options);
closeHandler(dialog);
},
'click #convertToNonTarget'() {
const measurementData = Template.measurementLocationDialog.measurementData;
const dialog = Template.measurementLocationDialog.dialog;
const instance = Template.instance();
const measurementApi = instance.data.measurementApi;
OHIF.measurementTracker.convertToNonTarget(measurementApi, measurementData);
closeHandler(dialog);
}
});
@@ -1,35 +0,0 @@
#measurementLocationDialog, #measurementLocationRelabelDialog
display: none
position: absolute
top: 0
bottom: 0
left: 0
right: 0
z-index: 100
width: 300px
height: 130px
border-radius: 5px
padding: 10px 20px 10px 20px
background-color: rgba(255,255,255,1)
outline: none
#closeLesionPopup
outline: none
border: none
background-color: transparent
#selectMeasurementLocation
margin-top: 5px
.dialogContent
margin-bottom: 10px
#removeLesion
outline: none
text-decoration: none
#measurementLocationDialog
height: 110px
#measurementLocationRelabelDialog
height: 125px
@@ -1,4 +1,3 @@
import { Template } from 'meteor/templating';
import { OHIF } from 'meteor/ohif:core';
// Define the Trial Criteria Structure
@@ -21,9 +20,9 @@ OHIF.lesiontracker.TrialCriteriaConstraints = {
* - Time Point Measurement Total = Sum of long axis measurements for extranodal target lesion + short axis measurements for nodal lesions
*/
function RECIST(image) {
var acquisitionSliceThickness;
let acquisitionSliceThickness;
var isChestXray;
let isChestXray;
if (image) {
acquisitionSliceThickness = image.acquisitionSliceThickness;
@@ -32,7 +31,7 @@ function RECIST(image) {
}
// Define the RECIST 1.1 structure
var criteria = {
const criteria = {
baseline: {
target: {},
nonTarget: {},
@@ -160,13 +159,13 @@ function RECIST(image) {
* - Target lesions must have measurements (cannot be assessed as CR, UN/NE, EX)
*/
function irRC(image) {
var acquisitionSliceThickness;
let acquisitionSliceThickness;
if (image) {
acquisitionSliceThickness = image.acquisitionSliceThickness;
}
// Define the irRC structure
var criteria = {
const criteria = {
baseline: {
target: {},
nonTarget: {}
@@ -372,7 +371,7 @@ OHIF.lesiontracker.getTrialCriteriaConstraints = (criteriaTypes, imageId) => {
}
// Find the related Timepoint document
const timepointApi = Template.instance().timepointApi;
const { timepointApi } = OHIF.viewer;
if (!timepointApi) {
return;
}
@@ -0,0 +1,47 @@
import { _ } from 'meteor/underscore';
import { OHIF } from 'meteor/ohif:core';
OHIF.lesiontracker.configureTargetToolsHandles = () => {
const toggleLabel = (measurementData, eventData, doneCallback) => {
delete measurementData.isCreating;
if (OHIF.lesiontracker.removeMeasurementIfInvalid(measurementData, eventData)) {
return;
}
const getHandlePosition = key => _.pick(measurementData.handles[key], ['x', 'y']);
const start = getHandlePosition('start');
const end = getHandlePosition('end');
const getDirection = axis => start[axis] < end[axis] ? 1 : -1;
const position = OHIF.cornerstone.pixelToPage(eventData.element, end);
OHIF.measurements.toggleLabelButton({
measurement: measurementData,
element: eventData.element,
measurementApi: OHIF.viewer.measurementApi,
position: position,
direction: {
x: getDirection('x'),
y: getDirection('y')
}
});
};
const callbackConfig = {
// TODO: Check the position for these, the Add Label button position seems very awkward
getMeasurementLocationCallback: toggleLabel,
changeMeasurementLocationCallback: toggleLabel,
};
// TODO: Reconcile this with the configuration in toolManager
// it would be better to have this all in one place.
const bidirectionalConfig = cornerstoneTools.bidirectional.getConfiguration();
const config = Object.assign({}, bidirectionalConfig, callbackConfig);
cornerstoneTools.bidirectional.setConfiguration(config);
// Set CR-Tool, UN-Tool, EX-Tool configurations
cornerstoneTools.targetCR.setConfiguration(config);
cornerstoneTools.targetUN.setConfiguration(config);
cornerstoneTools.targetEX.setConfiguration(config);
};
@@ -1,72 +0,0 @@
import { OHIF } from 'meteor/ohif:core';
var responseTypes = {
targetCR: 'CR',
targetUN: 'UN',
targetEX: 'EX'
};
convertNonTarget = function(measurementApi, measurementData, newTooltype) {
if (measurementData.toolType !== 'nonTarget') {
return;
}
var measurement = Measurements.findOne(measurementData.id);
var timepoint = Timepoints.findOne({
timepointId: measurementData.timepointId
});
if (timepoint && timepoint.timepointType !== 'followup') {
OHIF.log.warn('Not a followup');
return;
}
// Next, update the measurementData and add it to the new tool type
var newMeasurement = {
id: 'notready',
lesionNumber: measurementApi.getNewLesionNumber(measurementData.timepointId, false),
visible: true,
active: true,
imageId: measurementData.imageId,
seriesInstanceUid: measurementData.seriesInstanceUid,
studyInstanceUid: measurementData.studyInstanceUid,
patientId: measurementData.patientId,
isTarget: false,
toolType: newTooltype
};
newMeasurement.handles = measurementData.handles;
if (responseTypes[newTooltype]) {
newMeasurement.response = responseTypes[newTooltype];
}
// Adds lesion data to timepoints array
measurementApi.updateLesionData(newMeasurement);
// Set the new Measurement to have the same location as the old one
if (measurement.location && measurement.locationId) {
var existingMeasurement = Measurements.findOne({
lesionNumber: newMeasurement.lesionNumber,
isTarget: newMeasurement.isTarget
});
if (!existingMeasurement) {
return;
}
Measurements.update(existingMeasurement._id, {
$set: {
location: measurement.location,
locationId: measurement.locationId
}
});
}
if (measurement) {
// Remove the timepointData from this Measurement and update it
// in the database, if it is already in the database
OHIF.lesiontracker.clearMeasurementTimepointData(measurement._id, measurementData.timepointId);
}
};
@@ -1,86 +0,0 @@
import { OHIF } from 'meteor/ohif:core';
OHIF.lesiontracker.convertToNonTarget = (measurementApi, measurementData) => {
if (measurementData.isTarget === false) {
return;
}
const measurement = Measurements.findOne(measurementData.id);
const timepoint = Timepoints.findOne({
timepointId: measurementData.timepointId
});
// Next, update the measurementData and add it to the new tool type
const toolType = 'nonTarget';
const newMeasurement = {
id: 'notready',
lesionNumber: LesionManager.getNewLesionNumber(measurementData.timepointId, false),
visible: true,
active: true,
imageId: measurementData.imageId,
seriesInstanceUid: measurementData.seriesInstanceUid,
studyInstanceUid: measurementData.studyInstanceUid,
patientId: measurementData.patientId,
isTarget: false,
toolType: toolType
};
if (timepoint && timepoint.timepointType === 'baseline') {
newMeasurement.response = 'Present';
} else {
newMeasurement.response = '';
}
newMeasurement.handles = {
start: {
x: (measurementData.handles.start.x + measurementData.handles.end.x) / 2,
y: (measurementData.handles.start.y + measurementData.handles.end.y) / 2,
highlight: true,
active: false
},
end: {
x: Math.min(measurementData.handles.start.x, measurementData.handles.end.x),
y: Math.min(measurementData.handles.start.y, measurementData.handles.end.y),
highlight: true,
active: false
},
textBox: {
x: measurementData.handles.textBox.x,
y: measurementData.handles.textBox.y,
active: false,
movesIndependently: false,
drawnIndependently: true,
allowedOutsideImage: true,
hasBoundingBox: true
}
};
// Adds lesion data to timepoints array
LesionManager.updateLesionData(newMeasurement);
// Set the new Measurement to have the same location as the old one
if (measurement.location && measurement.locationId) {
var existingMeasurement = Measurements.findOne({
lesionNumber: newMeasurement.lesionNumber,
isTarget: newMeasurement.isTarget
});
if (!existingMeasurement) {
return;
}
Measurements.update(existingMeasurement._id, {
$set: {
location: measurement.location,
locationId: measurement.locationId
}
});
}
if (measurement) {
// Remove the timepointData from this Measurement and update it
// in the database, if it is already in the database
OHIF.lesiontracker.clearMeasurementTimepointData(measurement._id, measurementData.timepointId);
}
};
@@ -9,5 +9,4 @@ import './pixelSpacingAutorunCheck.js';
import './removeMeasurementIfInvalid.js';
import './toggleLesionTrackerTools.js';
import './clearMeasurementTimepointData.js';
import './convertToNonTarget.js';
import './convertNonTarget.js';
import './configureTargetToolsHandles.js';