nonTarget tool is added

This commit is contained in:
Evren Ozkan committed 2015-11-09 08:08:50 -05:00
1 parent 02a5b2fc53
commit db21685473
16 files changed
+814 -20

No files matched your search

@@ -4,7 +4,7 @@ Template.lesionDialog.onRendered(function () {
// related to the chosen location.
$(document).on("ShowLesionDialog", function (e, eventData, lesionData) {
var locationUID = measurementManagerDAL.isLesionNumberAdded(lesionData.lesionNumber);
var locationUID = measurementManagerDAL.isLesionNumberAdded(lesionData);
if (locationUID) {
lesionData.locationUID = locationUID;
@@ -51,8 +51,6 @@ Template.lesionLocationDialog.onRendered(function() {
Template.lesionLocationDialog.events({
'click button#btnCloseLesionPopup': function(e) {
$("#lesionDialog").modal("hide");
// TODO: Remove lastAddedLesionData from canvas
// TODO: Remove lastAddedLesionData from collection
},
'change select#selectLesionLocation': function(e) {
@@ -1,14 +1,51 @@
Measurements = new Meteor.Collection(null);
Timepoints = new Meteor.Collection(null);
// When nonTarget lesion is added to image, insert data to lesion table
function nonTargetToolAdded(e, eventData, lesionData) {
lesionData.timepointID = $(e.currentTarget).data('timepointID');
var locationUID = measurementManagerDAL.isLesionNumberAdded(lesionData);
if (locationUID) {
// location is selected and disable select location in dialog
lesionData.locationUID = locationUID;
var locationName = measurementManagerDAL.getLocationName(locationUID);
var locationIndex;
$("#selectNonTargetLesionLocation option").each(function()
{
if ($(this).text() === locationName) {
locationIndex = $(this).index();
return;
}
});
$("#selectNonTargetLesionLocation option").eq(locationIndex).attr("selected", "selected");
// $("#selectNonTargetLesionLocation").attr("disabled", "disabled");
}
// Save lesionData in Session to use after location and response are selected
Session.set("nonTargetLesionData", lesionData);
var dialogPointsOnPage = eventData.currentPoints.page;
$("#modal-dialog-container-nonTargetLesion").css({
"top": dialogPointsOnPage.y,
"left": dialogPointsOnPage.x
});
$("#nonTargetLesionLocationDialog").modal("show");
}
// Activate selected lesions when lesion table row is clicked
function updateLesions(e) {
// lesionNumber of measurement = id of row
var lesionNumber = parseInt($(e.currentTarget).attr("id"), 10);
var isTarget = $(e.currentTarget).find('td').eq(2).html().trim() === 'N'?false:true;
// Find data for specific lesion
var measurementData = Measurements.find({
lesionNumber: lesionNumber
lesionNumber: lesionNumber,
isTarget: isTarget
}).fetch()[0];
var timepoints = measurementData.timepoints;
@@ -24,6 +61,7 @@ function updateLesions(e) {
var eventData = {
enabledElement: cornerstone.getEnabledElement(element),
lesionData: {
isTarget: isTarget,
lesionNumber: lesionNumber,
imageId: timepointObject.imageId
},
@@ -34,7 +72,11 @@ function updateLesions(e) {
eventData.type = "inactive";
}
if(!isTarget) {
$(element).trigger("nonTargetToolModified", eventData);
}
$(element).trigger("LesionToolModified", eventData);
});
}
@@ -59,9 +101,13 @@ Template.lesionTable.onRendered(function() {
});
$(element).data('timepointID', timepointID);
// Listen NonTargetToolAdded Event
$(element).on("NonTargetToolAdded", nonTargetToolAdded);
});
});
Template.lesionTable.helpers({
'measurement': function() {
return Measurements.find();
@@ -0,0 +1,32 @@
#nonTargetLesionLocationDialog {
background: transparent;
}
#modal-dialog-container-nonTargetLesion {
position: absolute;
border: none;
}
#btnCloseNonTargetLesionPopup {
outline: 0;
border: none;
background-color: transparent;
}
#selectNonTargetLesionLocation, #selectNonTargetLesionLocationResponse {
width: 80%;
}
.dialogContent, .lesionLocation, .locationResponse {
margin-bottom: 20px;
}
.elementContainer {
width: 100%;
margin: 0 auto;
float: none;
}
.locationOK {
text-align: center;
}
@@ -0,0 +1,40 @@
<template name="nonTargetLesionDialog">
<div class="modal fade" id="nonTargetLesionLocationDialog">
<div id="modal-dialog-container-nonTargetLesion" class="modal-dialog modal-sm">
<div class="modal-content" style="padding: 10px;">
<div class="dialogHeader">
<div style="float:left;"><h4>Select Lesion Location</h4></div>
<div style="float:right;"><button class="btn" id="btnCloseNonTargetLesionPopup"><i class="fa fa-close"></i></button></div>
</div>
<div class="dialogContent">
<div class="lesionLocation">
<div class="elementContainer">
<label>Lesion Location</label>
</div>
<div class="elementContainer">
<select id="selectNonTargetLesionLocation">
<option value="-1"></option>
</select>
</div>
</div>
<div class="locationResponse">
<div class="elementContainer">
<label>Response</label>
</div>
<div class="elementContainer">
<select id="selectNonTargetLesionLocationResponse">
<option value="-1"></option>
</select>
</div>
</div>
<div class="locationOK">
<button class="btn" id="nonTargetLesionOK">OK</button>
</div>
</div>
</div>
</div>
</div>
</template>
@@ -0,0 +1,133 @@
//fill selectLesionLocation element
var lesionLocationsArray = [{
location: "Brain Brainstem",
hasDescription: false,
description: ""
}, {
location: "Brain Cerebellum Left",
hasDescription: false,
description: ""
}, {
location: "Brain Cerebrum Left",
hasDescription: false,
description: ""
}, {
location: "Brain Cerebrum Right",
hasDescription: false,
description: ""
}, {
location: "Brain Multiple Sites",
hasDescription: false,
description: ""
}];
var lesionLocationsResponseArray = [
{
text: "Complete response",
code: "CR",
description: ""
},
{
text: "Progressive disease",
code: "PD",
description: ""
},
{
text: "Stable disease",
code: "SD",
description: ""
},
{
text: "Non-measurable",
code: "NM",
description: ""
},
{
text: "Unknown",
code: "UN",
description: ""
},
{
text: "Not Evaluable",
code: "NE",
description: ""
},
{
text: "Non-CR/Non-PD",
code: "NN",
description: ""
},
{
text: "Excluded",
code: "EX",
description: ""
}
];
Template.nonTargetLesionDialog.onRendered(function() {
function fillSelectLesionLocation() {
var el = $("#selectNonTargetLesionLocation");
el.find('option:not(:first)').remove();
$.each(lesionLocationsArray, function(key, value) {
el.append("<option value='" + key + "'>" + value.location + "</option>");
});
}
function fillResponses() {
var el = $("#selectNonTargetLesionLocationResponse");
el.find('option:not(:first)').remove();
$.each(lesionLocationsResponseArray, function(key, value) {
el.append("<option value='" + value.code + "'>" + value.code +" - "+value.text + "</option>");
});
}
// Fill dropdown
fillSelectLesionLocation();
// Fill location responses
fillResponses();
});
Template.nonTargetLesionDialog.events({
'click button#btnCloseNonTargetLesionPopup': function(e) {
$("#nonTargetLesionLocationDialog").modal("hide");
},
'click button#nonTargetLesionOK': function() {
// Set activeModule parameters in index.html
$("#nonTargetLesionLocationDialog").modal("hide");
var lesionData = Session.get("nonTargetLesionData");
// Get selected location data
var selectedLocationIndex = $("#selectNonTargetLesionLocation").val();
if (selectedLocationIndex < 0) {
return;
}
// Get selected location data
var locationObj = lesionLocationsArray[selectedLocationIndex];
lesionData.location = $("#selectNonTargetLesionLocation :selected").text();
lesionData.measurementText = $("#selectNonTargetLesionLocationResponse").val();
// Select first option
$("#selectNonTargetLesionLocation").val($("#selectNonTargetLesionLocation option:first").val());
$("#selectNonTargetLesionLocationResponse").val($("#selectNonTargetLesionLocationResponse option:first").val());
if (typeof lesionData.locationUID !== 'undefined') {
measurementManagerDAL.updateTimepointData(lesionData);
return;
}
// Adds location data to trialPatientLocations array and returns locationUID
var locationUID = measurementManagerDAL.addNewLocation(locationObj);
// Linkk locationUID with activeLesionMeasurementData
lesionData.locationUID = locationUID;
measurementManagerDAL.addLesionData(lesionData);
}
});