Applied JSCS and added JSCS/jsHint config files
This commit is contained in:
1 parent
a9266608d2
commit
90a16a8059
68 files changed
+24956
-6399
No files matched your search
@@ -1,2 +1,2 @@
|
||||
Timepoints = new Meteor.Collection('timepoints');
|
||||
Measurements = new Meteor.Collection('measurements');
|
||||
Measurements = new Meteor.Collection('measurements');
|
||||
@@ -3,106 +3,106 @@ LesionLocations = new Meteor.Collection(null);
|
||||
LesionLocations.insert({
|
||||
id: 'liverLeft',
|
||||
group: 'liver',
|
||||
location: "Liver Left",
|
||||
location: 'Liver Left',
|
||||
hasDescription: false,
|
||||
description: "",
|
||||
description: '',
|
||||
selected: false
|
||||
});
|
||||
|
||||
LesionLocations.insert({
|
||||
id: 'liverRight',
|
||||
group: 'liver',
|
||||
location: "Liver Right",
|
||||
location: 'Liver Right',
|
||||
hasDescription: false,
|
||||
description: "",
|
||||
description: '',
|
||||
selected: false
|
||||
});
|
||||
|
||||
LesionLocations.insert({
|
||||
id: 'liverCaudate',
|
||||
group: 'liver',
|
||||
location: "Liver Caudate",
|
||||
location: 'Liver Caudate',
|
||||
hasDescription: false,
|
||||
description: "",
|
||||
description: '',
|
||||
selected: false
|
||||
});
|
||||
|
||||
LesionLocations.insert({
|
||||
id: 'lungLLL',
|
||||
group: 'lung',
|
||||
location: "Lung LLL",
|
||||
location: 'Lung LLL',
|
||||
hasDescription: false,
|
||||
description: "",
|
||||
description: '',
|
||||
selected: false
|
||||
});
|
||||
|
||||
LesionLocations.insert({
|
||||
id: 'lungLUL',
|
||||
group: 'lung',
|
||||
location: "Lung LUL",
|
||||
location: 'Lung LUL',
|
||||
hasDescription: false,
|
||||
description: "",
|
||||
description: '',
|
||||
selected: false
|
||||
});
|
||||
|
||||
LesionLocations.insert({
|
||||
id: 'lungRLL',
|
||||
group: 'lung',
|
||||
location: "Lung RLL",
|
||||
location: 'Lung RLL',
|
||||
hasDescription: false,
|
||||
description: "",
|
||||
description: '',
|
||||
selected: false
|
||||
});
|
||||
|
||||
LesionLocations.insert({
|
||||
id: 'lungRML',
|
||||
group: 'lung',
|
||||
location: "Lung RML",
|
||||
location: 'Lung RML',
|
||||
hasDescription: false,
|
||||
description: "",
|
||||
description: '',
|
||||
selected: false
|
||||
});
|
||||
|
||||
LesionLocations.insert({
|
||||
id: 'lungRUL',
|
||||
group: 'lung',
|
||||
location: "Lung RUL",
|
||||
location: 'Lung RUL',
|
||||
hasDescription: false,
|
||||
description: "",
|
||||
description: '',
|
||||
selected: false
|
||||
});
|
||||
|
||||
LesionLocations.insert({
|
||||
id: 'pleuraLeft',
|
||||
group: 'pleura',
|
||||
location: "Pleura Left",
|
||||
location: 'Pleura Left',
|
||||
hasDescription: false,
|
||||
description: "",
|
||||
description: '',
|
||||
selected: false
|
||||
});
|
||||
|
||||
LesionLocations.insert({
|
||||
id: 'pleuraRight',
|
||||
group: 'pleura',
|
||||
location: "Pleura Right",
|
||||
location: 'Pleura Right',
|
||||
hasDescription: false,
|
||||
description: "",
|
||||
description: '',
|
||||
selected: false
|
||||
});
|
||||
|
||||
LesionLocations.insert({
|
||||
id: 'kidneyLeft',
|
||||
group: 'kidney',
|
||||
location: "Kidney Left",
|
||||
location: 'Kidney Left',
|
||||
hasDescription: false,
|
||||
description: "",
|
||||
description: '',
|
||||
selected: false
|
||||
});
|
||||
|
||||
LesionLocations.insert({
|
||||
id: 'kidneyRight',
|
||||
group: 'kidney',
|
||||
location: "Kidney Right",
|
||||
location: 'Kidney Right',
|
||||
hasDescription: false,
|
||||
description: ""
|
||||
});
|
||||
description: ''
|
||||
});
|
||||
@@ -1,43 +1,43 @@
|
||||
LocationResponses = new Meteor.Collection(null);
|
||||
|
||||
LocationResponses.insert({
|
||||
text: "Complete response",
|
||||
code: "CR",
|
||||
description: ""
|
||||
text: 'Complete response',
|
||||
code: 'CR',
|
||||
description: ''
|
||||
});
|
||||
|
||||
LocationResponses.insert({
|
||||
text: "Progressive disease",
|
||||
code: "PD",
|
||||
description: ""
|
||||
text: 'Progressive disease',
|
||||
code: 'PD',
|
||||
description: ''
|
||||
});
|
||||
|
||||
LocationResponses.insert({
|
||||
text: "Stable disease",
|
||||
code: "SD",
|
||||
description: ""
|
||||
text: 'Stable disease',
|
||||
code: 'SD',
|
||||
description: ''
|
||||
});
|
||||
|
||||
LocationResponses.insert({
|
||||
text: "Present",
|
||||
text: 'Present',
|
||||
code: false,
|
||||
description: ""
|
||||
description: ''
|
||||
});
|
||||
|
||||
LocationResponses.insert({
|
||||
text: "Not Evaluable",
|
||||
code: "NE",
|
||||
description: ""
|
||||
text: 'Not Evaluable',
|
||||
code: 'NE',
|
||||
description: ''
|
||||
});
|
||||
|
||||
LocationResponses.insert({
|
||||
text: "Non-CR/Non-PD",
|
||||
code: "NN",
|
||||
description: ""
|
||||
text: 'Non-CR/Non-PD',
|
||||
code: 'NN',
|
||||
description: ''
|
||||
});
|
||||
|
||||
LocationResponses.insert({
|
||||
text: "Excluded from Assessment",
|
||||
code: "EX",
|
||||
description: ""
|
||||
});
|
||||
text: 'Excluded from Assessment',
|
||||
code: 'EX',
|
||||
description: ''
|
||||
});
|
||||
@@ -29,7 +29,9 @@ var LesionManager = (function() {
|
||||
function updateLesionData(lesionData) {
|
||||
// Find the related Timepoint from the Timepoints Collection
|
||||
var timepointID = lesionData.timepointID;
|
||||
var timepoint = Timepoints.findOne({timepointID: timepointID});
|
||||
var timepoint = Timepoints.findOne({
|
||||
timepointID: timepointID
|
||||
});
|
||||
if (!timepoint) {
|
||||
log.warn('Timepoint in an image is not present in the Timepoints Collection?');
|
||||
return;
|
||||
@@ -126,7 +128,9 @@ var LesionManager = (function() {
|
||||
var measurements = Measurements.find({
|
||||
isTarget: isTarget
|
||||
}, {
|
||||
sort: {lesionNumber: 1}
|
||||
sort: {
|
||||
lesionNumber: 1
|
||||
}
|
||||
}).fetch();
|
||||
|
||||
// If measurements exist, find the last lesion number
|
||||
@@ -176,4 +180,4 @@ var LesionManager = (function() {
|
||||
lesionNumberExists: lesionNumberExists,
|
||||
getLocationName: getLocationName
|
||||
};
|
||||
})();
|
||||
})();
|
||||
@@ -31,7 +31,7 @@
|
||||
nearbyToolIndex,
|
||||
nearbyToolType;
|
||||
|
||||
toolTypes.forEach(function(toolType){
|
||||
toolTypes.forEach(function(toolType) {
|
||||
var toolData = cornerstoneTools.getToolState(element, toolType);
|
||||
if (!toolData) {
|
||||
return;
|
||||
@@ -75,7 +75,7 @@
|
||||
if (keyCode === keys.DELETE ||
|
||||
(keyCode === keys.D && eventData.event.ctrlKey === true)) {
|
||||
|
||||
var toolTypes = ["lesion", "nonTarget"];
|
||||
var toolTypes = [ 'lesion', 'nonTarget' ];
|
||||
var nearbyToolData = getNearbyToolData(eventData.element, eventData.currentPoints.canvas, toolTypes);
|
||||
|
||||
if (!nearbyToolData) {
|
||||
@@ -95,4 +95,4 @@
|
||||
// module/private exports
|
||||
cornerstoneTools.deleteLesionKeyboardTool = cornerstoneTools.keyboardTool(keyDownCallback);
|
||||
|
||||
})(cornerstoneTools);
|
||||
})(cornerstoneTools);
|
||||
@@ -1,8 +1,8 @@
|
||||
(function($, cornerstone, cornerstoneMath, cornerstoneTools) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var toolType = "lesion";
|
||||
var toolType = 'lesion';
|
||||
|
||||
var configuration = {
|
||||
setLesionNumberCallback: setLesionNumberCallback,
|
||||
@@ -221,6 +221,7 @@
|
||||
if (!handle.boundingBox) {
|
||||
return;
|
||||
}
|
||||
|
||||
return cornerstoneMath.point.insideRect(coords, handle.boundingBox);
|
||||
}
|
||||
|
||||
@@ -514,7 +515,7 @@
|
||||
// Sets drawnIndependently property of control points(handles)
|
||||
function setControlPoints(handles, value) {
|
||||
Object.keys(handles).forEach(function(name) {
|
||||
if (name !== "textBox") {
|
||||
if (name !== 'textBox') {
|
||||
var handle = handles[name];
|
||||
handle.drawnIndependently = value;
|
||||
}
|
||||
@@ -730,7 +731,6 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
function findDottedLinePosition(data) {
|
||||
|
||||
var distancesArr = [];
|
||||
@@ -775,6 +775,7 @@
|
||||
minDistance = distanceToPerpendicularEnd;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < distancesArr.length; i++) {
|
||||
var obj = distancesArr[i];
|
||||
if (obj.distance === minDistance) {
|
||||
@@ -840,7 +841,7 @@
|
||||
context.beginPath();
|
||||
context.strokeStyle = color;
|
||||
context.lineWidth = lineWidth;
|
||||
context.setLineDash([2, 3]);
|
||||
context.setLineDash([ 2, 3 ]);
|
||||
|
||||
// Set position of text
|
||||
var perpendicularStartCanvas = cornerstone.pixelToCanvas(element, findDottedLinePosition(data));
|
||||
@@ -858,7 +859,6 @@
|
||||
var wy = (data.handles.perpendicularStart.y - data.handles.perpendicularEnd.y) * (eventData.image.rowPixelSpacing || 1);
|
||||
var width = Math.sqrt(wx * wx + wy * wy);
|
||||
|
||||
|
||||
var suffix = ' mm';
|
||||
if (!eventData.image.rowPixelSpacing || !eventData.image.columnPixelSpacing) {
|
||||
suffix = ' pixels';
|
||||
@@ -866,7 +866,7 @@
|
||||
|
||||
var lengthText = ' L ' + length.toFixed(1) + suffix;
|
||||
var widthText = ' W ' + width.toFixed(1) + suffix;
|
||||
var textLines = ['Target ' + data.lesionNumber, lengthText, widthText];
|
||||
var textLines = [ 'Target ' + data.lesionNumber, lengthText, widthText ];
|
||||
|
||||
var boundingBox = cornerstoneTools.drawTextBox(context,
|
||||
textLines,
|
||||
@@ -948,4 +948,4 @@
|
||||
|
||||
cornerstoneTools.lesion.setConfiguration(configuration);
|
||||
|
||||
})($, cornerstone, cornerstoneMath, cornerstoneTools);
|
||||
})($, cornerstone, cornerstoneMath, cornerstoneTools);
|
||||
@@ -68,7 +68,7 @@
|
||||
if (cornerstoneTools.anyHandlesOutsideImage(mouseEventData, measurementData.handles)) {
|
||||
// delete the measurement
|
||||
cornerstoneTools.removeToolState(mouseEventData.element, toolType, measurementData);
|
||||
}else{
|
||||
}else {
|
||||
config.getLesionLocationCallback(measurementData, mouseEventData, doneCallback);
|
||||
|
||||
}
|
||||
@@ -150,6 +150,7 @@
|
||||
if (!handle.boundingBox) {
|
||||
return;
|
||||
}
|
||||
|
||||
return cornerstoneMath.point.insideRect(coords, handle.boundingBox);
|
||||
}
|
||||
|
||||
@@ -217,7 +218,7 @@
|
||||
context.beginPath();
|
||||
context.strokeStyle = color;
|
||||
context.lineWidth = lineWidth;
|
||||
context.setLineDash([2, 3]);
|
||||
context.setLineDash([ 2, 3 ]);
|
||||
|
||||
context.moveTo(mid.x, mid.y);
|
||||
context.lineTo(canvasTextLocation.x + 20, canvasTextLocation.y + 20);
|
||||
@@ -254,6 +255,7 @@
|
||||
if (measurementData.lesionName === undefined) {
|
||||
config.setLesionNumberCallback(measurementData, touchEventData, doneCallback);
|
||||
}
|
||||
|
||||
cornerstone.updateImage(element);
|
||||
|
||||
cornerstoneTools.moveNewHandleTouch(touchEventData, toolType, measurementData, measurementData.handles.end, function() {
|
||||
@@ -266,14 +268,12 @@
|
||||
|
||||
config.getLesionLocationCallback(measurementData, touchEventData, doneCallback);
|
||||
|
||||
|
||||
$(element).on('CornerstoneToolsTouchDrag', cornerstoneTools.nonTargetTouch.touchMoveHandle);
|
||||
$(element).on('CornerstoneToolsDragStartActive', cornerstoneTools.nonTargetTouch.touchDownActivateCallback);
|
||||
$(element).on('CornerstoneToolsTap', cornerstoneTools.nonTargetTouch.tapCallback);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function doubleClickCallback(e, eventData) {
|
||||
var element = eventData.element;
|
||||
var data;
|
||||
@@ -339,5 +339,4 @@
|
||||
// pressCallback: doubleClickCallback
|
||||
});
|
||||
|
||||
|
||||
})($, cornerstone, cornerstoneMath, cornerstoneTools);
|
||||
@@ -1,331 +1,348 @@
|
||||
|
||||
(function($, cornerstone, cornerstoneTools) {
|
||||
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
// Draw Intervals
|
||||
function drawIntervals (context, config) {
|
||||
// Draw Intervals
|
||||
function drawIntervals (context, config) {
|
||||
|
||||
var i = 0;
|
||||
var i = 0;
|
||||
|
||||
while (config.verticalLine.start.y + i * config.verticalMinorTick <= config.vscaleBounds.bottom) {
|
||||
while (config.verticalLine.start.y + i * config.verticalMinorTick <= config.vscaleBounds.bottom) {
|
||||
|
||||
var startPoint = {
|
||||
x: config.verticalLine.start.x,
|
||||
y: config.verticalLine.start.y + i*config.verticalMinorTick
|
||||
};
|
||||
var startPoint = {
|
||||
x: config.verticalLine.start.x,
|
||||
y: config.verticalLine.start.y + i * config.verticalMinorTick
|
||||
};
|
||||
|
||||
var endPoint = {x: 0, y: config.verticalLine.start.y + i*config.verticalMinorTick};
|
||||
if (i%5 === 0) {
|
||||
var endPoint = {
|
||||
x: 0,
|
||||
y: config.verticalLine.start.y + i * config.verticalMinorTick
|
||||
};
|
||||
if (i% 5 === 0) {
|
||||
|
||||
endPoint.x = config.verticalLine.start.x - config.majorTickLength;
|
||||
} else{
|
||||
endPoint.x = config.verticalLine.start.x - config.majorTickLength;
|
||||
} else {
|
||||
|
||||
endPoint.x = config.verticalLine.start.x - config.minorTickLength;
|
||||
}
|
||||
endPoint.x = config.verticalLine.start.x - config.minorTickLength;
|
||||
}
|
||||
|
||||
context.beginPath();
|
||||
context.strokeStyle = config.color;
|
||||
context.lineWidth = config.lineWidth;
|
||||
context.moveTo(startPoint.x, startPoint.y);
|
||||
context.lineTo(endPoint.x, endPoint.y);
|
||||
context.stroke();
|
||||
context.beginPath();
|
||||
context.strokeStyle = config.color;
|
||||
context.lineWidth = config.lineWidth;
|
||||
context.moveTo(startPoint.x, startPoint.y);
|
||||
context.lineTo(endPoint.x, endPoint.y);
|
||||
context.stroke();
|
||||
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
i = 0;
|
||||
|
||||
while (config.horizontalLine.start.x + i * config.horizontalMinorTick <= config.hscaleBounds.right) {
|
||||
while (config.horizontalLine.start.x + i * config.horizontalMinorTick <= config.hscaleBounds.right) {
|
||||
|
||||
startPoint = {
|
||||
x: config.horizontalLine.start.x + i * config.horizontalMinorTick,
|
||||
y: config.horizontalLine.start.y
|
||||
};
|
||||
|
||||
startPoint = {
|
||||
x: config.horizontalLine.start.x + i * config.horizontalMinorTick,
|
||||
y: config.horizontalLine.start.y
|
||||
};
|
||||
endPoint = {
|
||||
x: config.horizontalLine.start.x + i * config.horizontalMinorTick,
|
||||
y: 0
|
||||
};
|
||||
if (i% 5 === 0) {
|
||||
|
||||
endPoint = {x: config.horizontalLine.start.x + i * config.horizontalMinorTick, y: 0};
|
||||
if (i%5 === 0) {
|
||||
endPoint.y = config.horizontalLine.start.y - config.majorTickLength;
|
||||
} else {
|
||||
|
||||
endPoint.y = config.horizontalLine.start.y - config.majorTickLength;
|
||||
} else{
|
||||
endPoint.y = config.horizontalLine.start.y - config.minorTickLength;
|
||||
}
|
||||
|
||||
endPoint.y = config.horizontalLine.start.y - config.minorTickLength;
|
||||
}
|
||||
context.beginPath();
|
||||
context.strokeStyle = config.color;
|
||||
context.lineWidth = config.lineWidth;
|
||||
context.moveTo(startPoint.x, startPoint.y);
|
||||
context.lineTo(endPoint.x, endPoint.y);
|
||||
context.stroke();
|
||||
|
||||
context.beginPath();
|
||||
context.strokeStyle = config.color;
|
||||
context.lineWidth = config.lineWidth;
|
||||
context.moveTo(startPoint.x, startPoint.y);
|
||||
context.lineTo(endPoint.x, endPoint.y);
|
||||
context.stroke();
|
||||
i++;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// Draws long horizontal and vertical lines
|
||||
function drawFrameLines(context, config){
|
||||
|
||||
// Draws long horizontal and vertical lines
|
||||
function drawFrameLines(context, config){
|
||||
// Vertical Line
|
||||
var startPoint = {
|
||||
x: config.verticalLine.start.x,
|
||||
y: config.verticalLine.start.y
|
||||
};
|
||||
var endPoint = {
|
||||
x: config.verticalLine.end.x,
|
||||
y: config.verticalLine.end.y
|
||||
};
|
||||
|
||||
// Vertical Line
|
||||
var startPoint = {x: config.verticalLine.start.x, y: config.verticalLine.start.y};
|
||||
var endPoint = {x: config.verticalLine.end.x, y: config.verticalLine.end.y};
|
||||
context.beginPath();
|
||||
context.strokeStyle = config.color;
|
||||
context.lineWidth = config.lineWidth;
|
||||
context.moveTo(startPoint.x, startPoint.y);
|
||||
context.lineTo(endPoint.x, endPoint.y);
|
||||
context.stroke();
|
||||
|
||||
context.beginPath();
|
||||
context.strokeStyle = config.color;
|
||||
context.lineWidth = config.lineWidth;
|
||||
context.moveTo(startPoint.x, startPoint.y);
|
||||
context.lineTo(endPoint.x, endPoint.y);
|
||||
context.stroke();
|
||||
// Horizontal line
|
||||
startPoint = {
|
||||
x: config.horizontalLine.start.x ,
|
||||
y: config.horizontalLine.start.y
|
||||
};
|
||||
endPoint = {
|
||||
x: config.horizontalLine.end.x,
|
||||
y: config.horizontalLine.end.y
|
||||
};
|
||||
|
||||
context.beginPath();
|
||||
context.strokeStyle = config.color;
|
||||
context.lineWidth = config.lineWidth;
|
||||
context.moveTo(startPoint.x, startPoint.y);
|
||||
context.lineTo(endPoint.x, endPoint.y);
|
||||
context.stroke();
|
||||
|
||||
// Horizontal line
|
||||
startPoint = {x: config.horizontalLine.start.x , y: config.horizontalLine.start.y};
|
||||
endPoint = {x: config.horizontalLine.end.x, y: config.horizontalLine.end.y};
|
||||
|
||||
context.beginPath();
|
||||
context.strokeStyle = config.color;
|
||||
context.lineWidth = config.lineWidth;
|
||||
context.moveTo(startPoint.x, startPoint.y);
|
||||
context.lineTo(endPoint.x, endPoint.y);
|
||||
context.stroke();
|
||||
|
||||
// Draw intervals
|
||||
drawIntervals(context, config);
|
||||
|
||||
}
|
||||
|
||||
function doesIntersect(canvasBounds, imageBounds) {
|
||||
var intersectLeftRight;
|
||||
var intersectTopBottom;
|
||||
|
||||
if (canvasBounds.width >= 0)
|
||||
{
|
||||
if (imageBounds.width >= 0)
|
||||
intersectLeftRight = !((canvasBounds.right <= imageBounds.left) || (imageBounds.right <= canvasBounds.left));
|
||||
else
|
||||
intersectLeftRight = !((canvasBounds.right <= imageBounds.right) || (imageBounds.left <= canvasBounds.left));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (imageBounds.width >= 0)
|
||||
intersectLeftRight = !((canvasBounds.left <= imageBounds.left) || (imageBounds.right <= canvasBounds.right));
|
||||
else
|
||||
intersectLeftRight = !((canvasBounds.left <= imageBounds.right) || (imageBounds.left <= canvasBounds.right));
|
||||
}
|
||||
|
||||
if (canvasBounds.height >= 0)
|
||||
{
|
||||
if (imageBounds.height >= 0)
|
||||
intersectTopBottom = !((canvasBounds.bottom <= imageBounds.top) || (imageBounds.bottom <= canvasBounds.top));
|
||||
else
|
||||
intersectTopBottom = !((canvasBounds.bottom <= imageBounds.bottom) || (imageBounds.top <= canvasBounds.top));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (imageBounds.height >= 0)
|
||||
intersectTopBottom = !((canvasBounds.top <= imageBounds.top) || (imageBounds.bottom <= canvasBounds.bottom));
|
||||
else
|
||||
intersectTopBottom = !((canvasBounds.top <= imageBounds.bottom) || (imageBounds.top <= canvasBounds.bottom));
|
||||
}
|
||||
|
||||
return intersectLeftRight && intersectTopBottom;
|
||||
}
|
||||
|
||||
function getIntersectionRectangle(canvasBounds, imageBounds) {
|
||||
var intersectPoints = {
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0
|
||||
};
|
||||
|
||||
if(!doesIntersect(canvasBounds, imageBounds)) {
|
||||
return intersectPoints;
|
||||
// Draw intervals
|
||||
drawIntervals(context, config);
|
||||
|
||||
}
|
||||
|
||||
if (canvasBounds.width >= 0)
|
||||
{
|
||||
if (imageBounds.width >= 0)
|
||||
{
|
||||
intersectPoints.left = Math.max(canvasBounds.left, imageBounds.left);
|
||||
intersectPoints.right = Math.min(canvasBounds.right, imageBounds.right);
|
||||
}
|
||||
else
|
||||
{
|
||||
intersectPoints.left = Math.max(canvasBounds.left, imageBounds.right);
|
||||
intersectPoints.right = Math.min(canvasBounds.right, imageBounds.left);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (imageBounds.width >= 0)
|
||||
{
|
||||
intersectPoints.left = Math.min(canvasBounds.left, imageBounds.right);
|
||||
intersectPoints.right = Math.max(canvasBounds.right, imageBounds.left);
|
||||
}
|
||||
else
|
||||
{
|
||||
intersectPoints.left = Math.min(canvasBounds.left, imageBounds.left);
|
||||
intersectPoints.right = Math.max(canvasBounds.right, imageBounds.right);
|
||||
}
|
||||
function doesIntersect(canvasBounds, imageBounds) {
|
||||
var intersectLeftRight;
|
||||
var intersectTopBottom;
|
||||
|
||||
if (canvasBounds.width >= 0) {
|
||||
if (imageBounds.width >= 0)
|
||||
intersectLeftRight = !((canvasBounds.right <= imageBounds.left) || (imageBounds.right <= canvasBounds.left));
|
||||
else
|
||||
intersectLeftRight = !((canvasBounds.right <= imageBounds.right) || (imageBounds.left <= canvasBounds.left));
|
||||
} else {
|
||||
if (imageBounds.width >= 0)
|
||||
intersectLeftRight = !((canvasBounds.left <= imageBounds.left) || (imageBounds.right <= canvasBounds.right));
|
||||
else
|
||||
intersectLeftRight = !((canvasBounds.left <= imageBounds.right) || (imageBounds.left <= canvasBounds.right));
|
||||
}
|
||||
|
||||
if (canvasBounds.height >= 0) {
|
||||
if (imageBounds.height >= 0)
|
||||
intersectTopBottom = !((canvasBounds.bottom <= imageBounds.top) || (imageBounds.bottom <= canvasBounds.top));
|
||||
else
|
||||
intersectTopBottom = !((canvasBounds.bottom <= imageBounds.bottom) || (imageBounds.top <= canvasBounds.top));
|
||||
} else {
|
||||
if (imageBounds.height >= 0)
|
||||
intersectTopBottom = !((canvasBounds.top <= imageBounds.top) || (imageBounds.bottom <= canvasBounds.bottom));
|
||||
else
|
||||
intersectTopBottom = !((canvasBounds.top <= imageBounds.bottom) || (imageBounds.top <= canvasBounds.bottom));
|
||||
}
|
||||
|
||||
return intersectLeftRight && intersectTopBottom;
|
||||
}
|
||||
|
||||
if (canvasBounds.height >= 0)
|
||||
{
|
||||
if (imageBounds.height >= 0)
|
||||
{
|
||||
intersectPoints.top = Math.max(canvasBounds.top, imageBounds.top);
|
||||
intersectPoints.bottom = Math.min(canvasBounds.bottom, imageBounds.bottom);
|
||||
}
|
||||
else
|
||||
{
|
||||
intersectPoints.top = Math.max(canvasBounds.top, imageBounds.bottom);
|
||||
intersectPoints.bottom = Math.min(canvasBounds.bottom, imageBounds.top);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (imageBounds.height >= 0)
|
||||
{
|
||||
intersectPoints.top = Math.min(canvasBounds.top, imageBounds.bottom);
|
||||
intersectPoints.bottom = Math.max(canvasBounds.bottom, imageBounds.top);
|
||||
}
|
||||
else
|
||||
{
|
||||
intersectPoints.top = Math.min(canvasBounds.top, imageBounds.top);
|
||||
intersectPoints.bottom = Math.max(canvasBounds.bottom, imageBounds.bottom);
|
||||
}
|
||||
function getIntersectionRectangle(canvasBounds, imageBounds) {
|
||||
var intersectPoints = {
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0
|
||||
};
|
||||
|
||||
if (!doesIntersect(canvasBounds, imageBounds)) {
|
||||
return intersectPoints;
|
||||
|
||||
}
|
||||
|
||||
if (canvasBounds.width >= 0) {
|
||||
if (imageBounds.width >= 0) {
|
||||
intersectPoints.left = Math.max(canvasBounds.left, imageBounds.left);
|
||||
intersectPoints.right = Math.min(canvasBounds.right, imageBounds.right);
|
||||
} else {
|
||||
intersectPoints.left = Math.max(canvasBounds.left, imageBounds.right);
|
||||
intersectPoints.right = Math.min(canvasBounds.right, imageBounds.left);
|
||||
}
|
||||
} else {
|
||||
if (imageBounds.width >= 0) {
|
||||
intersectPoints.left = Math.min(canvasBounds.left, imageBounds.right);
|
||||
intersectPoints.right = Math.max(canvasBounds.right, imageBounds.left);
|
||||
} else {
|
||||
intersectPoints.left = Math.min(canvasBounds.left, imageBounds.left);
|
||||
intersectPoints.right = Math.max(canvasBounds.right, imageBounds.right);
|
||||
}
|
||||
}
|
||||
|
||||
if (canvasBounds.height >= 0) {
|
||||
if (imageBounds.height >= 0) {
|
||||
intersectPoints.top = Math.max(canvasBounds.top, imageBounds.top);
|
||||
intersectPoints.bottom = Math.min(canvasBounds.bottom, imageBounds.bottom);
|
||||
} else {
|
||||
intersectPoints.top = Math.max(canvasBounds.top, imageBounds.bottom);
|
||||
intersectPoints.bottom = Math.min(canvasBounds.bottom, imageBounds.top);
|
||||
}
|
||||
} else {
|
||||
if (imageBounds.height >= 0) {
|
||||
intersectPoints.top = Math.min(canvasBounds.top, imageBounds.bottom);
|
||||
intersectPoints.bottom = Math.max(canvasBounds.bottom, imageBounds.top);
|
||||
} else {
|
||||
intersectPoints.top = Math.min(canvasBounds.top, imageBounds.top);
|
||||
intersectPoints.bottom = Math.max(canvasBounds.bottom, imageBounds.bottom);
|
||||
}
|
||||
}
|
||||
|
||||
return intersectPoints;
|
||||
|
||||
}
|
||||
|
||||
return intersectPoints;
|
||||
// Computes the max bound for scales on the image
|
||||
function computeScaleBounds(eventData, canvasSize, imageSize, horizontalReduction, verticalReduction) {
|
||||
|
||||
}
|
||||
var canvasBounds = {
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: canvasSize.width,
|
||||
bottom: canvasSize.height,
|
||||
width: canvasSize.width,
|
||||
height: canvasSize.height
|
||||
};
|
||||
|
||||
// Computes the max bound for scales on the image
|
||||
function computeScaleBounds(eventData, canvasSize, imageSize, horizontalReduction, verticalReduction) {
|
||||
var hReduction = horizontalReduction * Math.min(1000, canvasSize.width);
|
||||
var vReduction = verticalReduction * Math.min(1000, canvasSize.height);
|
||||
canvasBounds = {
|
||||
left: canvasBounds.left + hReduction,
|
||||
top: canvasBounds.top + vReduction,
|
||||
right: (canvasBounds.left + hReduction) + (canvasBounds.width - 2 * hReduction),
|
||||
bottom: (canvasBounds.top + vReduction) + (canvasBounds.height - 2 * vReduction),
|
||||
width: canvasBounds.width - 2 * hReduction,
|
||||
height: canvasBounds.height - 2 * vReduction
|
||||
};
|
||||
|
||||
var canvasBounds = {
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: canvasSize.width,
|
||||
bottom: canvasSize.height,
|
||||
width: canvasSize.width,
|
||||
height: canvasSize.height
|
||||
};
|
||||
var startPoint = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
var startPointImageBounds = {
|
||||
x: startPoint.x,
|
||||
y: startPoint.y
|
||||
};
|
||||
var endPointImageBounds = {
|
||||
x: startPoint.x + imageSize.width,
|
||||
y: startPoint.y + imageSize.height
|
||||
};
|
||||
|
||||
var hReduction = horizontalReduction * Math.min(1000, canvasSize.width);
|
||||
var vReduction = verticalReduction * Math.min(1000, canvasSize.height);
|
||||
canvasBounds = {
|
||||
left: canvasBounds.left + hReduction,
|
||||
top: canvasBounds.top + vReduction,
|
||||
right: (canvasBounds.left + hReduction) + (canvasBounds.width - 2 * hReduction),
|
||||
bottom: (canvasBounds.top + vReduction) + (canvasBounds.height - 2 * vReduction),
|
||||
width: canvasBounds.width - 2 * hReduction,
|
||||
height: canvasBounds.height - 2 * vReduction
|
||||
};
|
||||
var startPointCanvasImageBounds = cornerstone.pixelToCanvas(eventData.element, startPointImageBounds);
|
||||
var endPointCanvasImageBounds = cornerstone.pixelToCanvas(eventData.element, endPointImageBounds);
|
||||
|
||||
var startPoint = {x: 0, y: 0};
|
||||
var startPointImageBounds = {x: startPoint.x, y: startPoint.y};
|
||||
var endPointImageBounds = {x: startPoint.x + imageSize.width, y: startPoint.y + imageSize.height};
|
||||
var imageBoundsWidth = Math.abs(startPointCanvasImageBounds.x - endPointCanvasImageBounds.x);
|
||||
var imageBoundsHeight = Math.abs(startPointCanvasImageBounds.y - endPointCanvasImageBounds.y);
|
||||
|
||||
var startPointCanvasImageBounds = cornerstone.pixelToCanvas(eventData.element, startPointImageBounds);
|
||||
var endPointCanvasImageBounds = cornerstone.pixelToCanvas(eventData.element, endPointImageBounds);
|
||||
hReduction = horizontalReduction * imageBoundsWidth;
|
||||
vReduction = verticalReduction * imageBoundsHeight;
|
||||
|
||||
var imageBoundsWidth = Math.abs(startPointCanvasImageBounds.x - endPointCanvasImageBounds.x);
|
||||
var imageBoundsHeight = Math.abs(startPointCanvasImageBounds.y - endPointCanvasImageBounds.y);
|
||||
var imageBounds = {
|
||||
left: startPointCanvasImageBounds.x + hReduction,
|
||||
top: startPointCanvasImageBounds.y + vReduction,
|
||||
right: (startPointCanvasImageBounds.x + hReduction) + (imageBoundsWidth - 2 * hReduction),
|
||||
bottom: (startPointCanvasImageBounds.y + vReduction) + (imageBoundsHeight - 2 * vReduction),
|
||||
width: imageBoundsWidth - 2 * hReduction,
|
||||
height: imageBoundsHeight - 2 * vReduction
|
||||
|
||||
};
|
||||
|
||||
hReduction = horizontalReduction * imageBoundsWidth;
|
||||
vReduction = verticalReduction * imageBoundsHeight;
|
||||
return getIntersectionRectangle(canvasBounds, imageBounds);
|
||||
|
||||
var imageBounds = {
|
||||
left: startPointCanvasImageBounds.x + hReduction,
|
||||
top: startPointCanvasImageBounds.y + vReduction,
|
||||
right: (startPointCanvasImageBounds.x + hReduction) + (imageBoundsWidth - 2 * hReduction),
|
||||
bottom: (startPointCanvasImageBounds.y + vReduction) + (imageBoundsHeight - 2 * vReduction),
|
||||
width: imageBoundsWidth - 2 * hReduction,
|
||||
height: imageBoundsHeight - 2 * vReduction
|
||||
|
||||
};
|
||||
|
||||
return getIntersectionRectangle(canvasBounds, imageBounds);
|
||||
|
||||
}
|
||||
|
||||
function onImageRendered(e, eventData) {
|
||||
|
||||
// Check whether pixel spacing is defined
|
||||
if (!eventData.image.rowPixelSpacing || !eventData.image.columnPixelSpacing) {
|
||||
return;
|
||||
}
|
||||
|
||||
var viewport = cornerstone.getViewport(eventData.enabledElement.element);
|
||||
if (!viewport) {
|
||||
return;
|
||||
function onImageRendered(e, eventData) {
|
||||
|
||||
// Check whether pixel spacing is defined
|
||||
if (!eventData.image.rowPixelSpacing || !eventData.image.columnPixelSpacing) {
|
||||
return;
|
||||
}
|
||||
|
||||
var viewport = cornerstone.getViewport(eventData.enabledElement.element);
|
||||
if (!viewport) {
|
||||
return;
|
||||
}
|
||||
|
||||
var canvasSize = {
|
||||
width: eventData.enabledElement.canvas.width,
|
||||
height: eventData.enabledElement.canvas.height
|
||||
};
|
||||
var imageSize = {
|
||||
width: eventData.enabledElement.image.width ,
|
||||
height: eventData.enabledElement.image.height
|
||||
};
|
||||
|
||||
// Distance between intervals is 10mm
|
||||
var verticalIntervalScale = (10.0 / eventData.enabledElement.image.rowPixelSpacing) * eventData.viewport.scale;
|
||||
var horizontalIntervalScale = (10.0 / eventData.enabledElement.image.rowPixelSpacing) * eventData.viewport.scale;
|
||||
|
||||
if (!canvasSize.width || !canvasSize.height || !imageSize.width || !imageSize.height ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 0.1 and 0.05 gives margin to horizontal and vertical lines
|
||||
var hscaleBounds = computeScaleBounds(eventData, canvasSize, imageSize, 0.1, 0.05);
|
||||
var vscaleBounds = computeScaleBounds(eventData, canvasSize, imageSize, 0.05, 0.1);
|
||||
|
||||
var config = {
|
||||
width: imageSize.width,
|
||||
height: imageSize.height,
|
||||
hscaleBounds: hscaleBounds,
|
||||
vscaleBounds: vscaleBounds,
|
||||
verticalMinorTick: verticalIntervalScale,
|
||||
horizontalMinorTick: horizontalIntervalScale,
|
||||
minorTickLength: 12.5,
|
||||
majorTickLength: 25,
|
||||
verticalLine: {
|
||||
start: {
|
||||
x: vscaleBounds.right ,
|
||||
y: vscaleBounds.top
|
||||
},
|
||||
end: {
|
||||
x: vscaleBounds.right,
|
||||
y: vscaleBounds.bottom
|
||||
}
|
||||
},
|
||||
horizontalLine: {
|
||||
start: {
|
||||
x: hscaleBounds.left,
|
||||
y: hscaleBounds.bottom
|
||||
},
|
||||
end: {
|
||||
x: hscaleBounds.right,
|
||||
y: hscaleBounds.bottom
|
||||
}
|
||||
},
|
||||
color: cornerstoneTools.toolColors.getToolColor(),
|
||||
lineWidth: cornerstoneTools.toolStyle.getToolWidth()
|
||||
};
|
||||
|
||||
var context = eventData.enabledElement.canvas.getContext('2d');
|
||||
context.setTransform(1, 0, 0, 1, 0, 0);
|
||||
context.save();
|
||||
|
||||
// Draw frame lines
|
||||
drawFrameLines(context, config);
|
||||
|
||||
context.restore();
|
||||
|
||||
}
|
||||
|
||||
var canvasSize = { width: eventData.enabledElement.canvas.width, height: eventData.enabledElement.canvas.height};
|
||||
var imageSize = {width: eventData.enabledElement.image.width , height: eventData.enabledElement.image.height};
|
||||
///////// END IMAGE RENDERING ///////
|
||||
|
||||
// Distance between intervals is 10mm
|
||||
var verticalIntervalScale = (10.0 / eventData.enabledElement.image.rowPixelSpacing) * eventData.viewport.scale;
|
||||
var horizontalIntervalScale = (10.0 / eventData.enabledElement.image.rowPixelSpacing) * eventData.viewport.scale;
|
||||
|
||||
|
||||
if (!canvasSize.width || !canvasSize.height || !imageSize.width || !imageSize.height ) {
|
||||
return false;
|
||||
function disable(element) {
|
||||
// TODO: displayTool does not have cornerstone.updateImage(element) method to hide tool
|
||||
$(element).off('CornerstoneImageRendered', onImageRendered);
|
||||
cornerstone.updateImage(element);
|
||||
}
|
||||
|
||||
// 0.1 and 0.05 gives margin to horizontal and vertical lines
|
||||
var hscaleBounds = computeScaleBounds(eventData, canvasSize, imageSize, 0.1, 0.05);
|
||||
var vscaleBounds = computeScaleBounds(eventData, canvasSize, imageSize, 0.05, 0.1);
|
||||
// module exports
|
||||
cornerstoneTools.scaleOverlayTool = cornerstoneTools.displayTool(onImageRendered);
|
||||
cornerstoneTools.scaleOverlayTool.disable = disable;
|
||||
|
||||
var config = {
|
||||
width: imageSize.width,
|
||||
height: imageSize.height,
|
||||
hscaleBounds: hscaleBounds,
|
||||
vscaleBounds: vscaleBounds,
|
||||
verticalMinorTick: verticalIntervalScale,
|
||||
horizontalMinorTick: horizontalIntervalScale,
|
||||
minorTickLength: 12.5,
|
||||
majorTickLength: 25,
|
||||
verticalLine: {
|
||||
start: {x: vscaleBounds.right , y: vscaleBounds.top},
|
||||
end: {x: vscaleBounds.right, y: vscaleBounds.bottom}
|
||||
},
|
||||
horizontalLine: {
|
||||
start: {x: hscaleBounds.left, y: hscaleBounds.bottom},
|
||||
end: {x: hscaleBounds.right, y: hscaleBounds.bottom}
|
||||
},
|
||||
color: cornerstoneTools.toolColors.getToolColor(),
|
||||
lineWidth: cornerstoneTools.toolStyle.getToolWidth()
|
||||
};
|
||||
|
||||
var context = eventData.enabledElement.canvas.getContext('2d');
|
||||
context.setTransform(1, 0, 0, 1, 0, 0);
|
||||
context.save();
|
||||
|
||||
// Draw frame lines
|
||||
drawFrameLines(context, config);
|
||||
|
||||
context.restore();
|
||||
|
||||
}
|
||||
|
||||
///////// END IMAGE RENDERING ///////
|
||||
|
||||
function disable(element) {
|
||||
// TODO: displayTool does not have cornerstone.updateImage(element) method to hide tool
|
||||
$(element).off('CornerstoneImageRendered', onImageRendered);
|
||||
cornerstone.updateImage(element);
|
||||
}
|
||||
|
||||
// module exports
|
||||
cornerstoneTools.scaleOverlayTool = cornerstoneTools.displayTool(onImageRendered);
|
||||
cornerstoneTools.scaleOverlayTool.disable = disable;
|
||||
|
||||
})($, cornerstone, cornerstoneTools);
|
||||
})($, cornerstone, cornerstoneTools);
|
||||
@@ -1,9 +1,9 @@
|
||||
function closeHandler() {
|
||||
// Hide the lesion dialog
|
||||
$("#confirmDeleteDialog").css('display', 'none');
|
||||
$('#confirmDeleteDialog').css('display', 'none');
|
||||
|
||||
// Remove the backdrop
|
||||
$(".removableBackdrop").remove();
|
||||
$('.removableBackdrop').remove();
|
||||
|
||||
// Remove the callback from the template data
|
||||
delete Template.confirmDeleteDialog.doneCallback;
|
||||
@@ -17,18 +17,18 @@ showConfirmDialog = function(doneCallback, options) {
|
||||
options = options || {};
|
||||
UI.renderWithData(Template.removableBackdrop, options, document.body);
|
||||
|
||||
var confirmDeleteDialog = $("#confirmDeleteDialog");
|
||||
var confirmDeleteDialog = $('#confirmDeleteDialog');
|
||||
confirmDeleteDialog.remove();
|
||||
|
||||
var viewer = document.getElementById('viewer');
|
||||
UI.renderWithData(Template.confirmDeleteDialog, options, viewer);
|
||||
|
||||
// Make sure the context menu is closed when the user clicks away
|
||||
$(".removableBackdrop").one('mousedown touchstart', function() {
|
||||
$('.removableBackdrop').one('mousedown touchstart', function() {
|
||||
closeHandler();
|
||||
});
|
||||
|
||||
confirmDeleteDialog = $("#confirmDeleteDialog");
|
||||
confirmDeleteDialog = $('#confirmDeleteDialog');
|
||||
confirmDeleteDialog.css('display', 'block');
|
||||
confirmDeleteDialog.focus();
|
||||
|
||||
@@ -76,4 +76,4 @@ Template.confirmDeleteDialog.events({
|
||||
closeHandler();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
+30
-18
@@ -3,7 +3,7 @@ function closeHandler(dialog) {
|
||||
$(dialog).css('display', 'none');
|
||||
|
||||
// Remove the backdrop
|
||||
$(".removableBackdrop").remove();
|
||||
$('.removableBackdrop').remove();
|
||||
|
||||
// Restore the focus to the active viewport
|
||||
setFocusToActiveViewport();
|
||||
@@ -17,7 +17,9 @@ function setLesionNumberCallback(measurementData, eventData, doneCallback) {
|
||||
var imageId = enabledElement.image.imageId;
|
||||
|
||||
var study = cornerstoneTools.metaData.get('study', imageId);
|
||||
var timepoint = Timepoints.findOne({timepointName: study.studyDate});
|
||||
var timepoint = Timepoints.findOne({
|
||||
timepointName: study.studyDate
|
||||
});
|
||||
if (!timepoint) {
|
||||
return;
|
||||
}
|
||||
@@ -26,7 +28,7 @@ function setLesionNumberCallback(measurementData, eventData, doneCallback) {
|
||||
|
||||
// Get a lesion number for this lesion, depending on whether or not the same lesion previously
|
||||
// exists at a different timepoint
|
||||
var lesionNumber = LesionManager.getNewLesionNumber(measurementData.timepointID, isTarget=true);
|
||||
var lesionNumber = LesionManager.getNewLesionNumber(measurementData.timepointID, isTarget = true);
|
||||
measurementData.lesionNumber = lesionNumber;
|
||||
|
||||
// Set lesion number
|
||||
@@ -43,20 +45,20 @@ function getLesionLocationCallback(measurementData, eventData) {
|
||||
Template.lesionLocationDialog.doneCallback = undefined;
|
||||
|
||||
// Get the lesion location dialog
|
||||
var dialog = $("#lesionLocationDialog");
|
||||
var dialog = $('#lesionLocationDialog');
|
||||
Template.lesionLocationDialog.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() {
|
||||
$('.removableBackdrop').one('mousedown touchstart', function() {
|
||||
closeHandler(dialog);
|
||||
});
|
||||
|
||||
// Select the first option for now
|
||||
var selector = dialog.find("select.selectLesionLocation");
|
||||
selector.find("option:first").prop("selected", true);
|
||||
var selector = dialog.find('select.selectLesionLocation');
|
||||
selector.find('option:first').prop('selected', true);
|
||||
|
||||
// Find out if this lesion number is already added in the lesion manager for another timepoint
|
||||
// If it is, stop here because we don't need the dialog.
|
||||
@@ -73,7 +75,7 @@ function getLesionLocationCallback(measurementData, eventData) {
|
||||
// If it isn't, continue to open the dialog and have the user choose a lesion location
|
||||
|
||||
// Show the lesion location dialog above
|
||||
var dialogProperty = {
|
||||
var dialogProperty = {
|
||||
top: eventData.currentPoints.page.y - dialog.outerHeight() - 40,
|
||||
left: eventData.currentPoints.page.x - dialog.outerWidth() / 2,
|
||||
display: 'block'
|
||||
@@ -91,7 +93,7 @@ function getLesionLocationCallback(measurementData, eventData) {
|
||||
// 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");
|
||||
dialog.addClass('dialogMobile');
|
||||
dialogProperty.top = 0;
|
||||
dialogProperty.left = 0;
|
||||
dialogProperty.right = 0;
|
||||
@@ -107,14 +109,14 @@ changeLesionLocationCallback = function(measurementData, eventData, doneCallback
|
||||
Template.lesionLocationDialog.doneCallback = doneCallback;
|
||||
|
||||
// Get the lesion location dialog
|
||||
var dialog = $("#lesionLocationRelabelDialog");
|
||||
var dialog = $('#lesionLocationRelabelDialog');
|
||||
Template.lesionLocationDialog.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() {
|
||||
$('.removableBackdrop').one('mousedown touchstart', function() {
|
||||
closeHandler(dialog);
|
||||
});
|
||||
|
||||
@@ -127,7 +129,7 @@ changeLesionLocationCallback = function(measurementData, eventData, doneCallback
|
||||
// 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");
|
||||
dialog.addClass('dialogMobile');
|
||||
dialogProperty.top = 0;
|
||||
dialogProperty.left = 0;
|
||||
dialogProperty.right = 0;
|
||||
@@ -146,8 +148,14 @@ changeLesionLocationCallback = function(measurementData, eventData, doneCallback
|
||||
}
|
||||
|
||||
LesionLocations.update({},
|
||||
{$set: {selected: false}},
|
||||
{ multi: true });
|
||||
{
|
||||
$set: {
|
||||
selected: false
|
||||
}
|
||||
},
|
||||
{
|
||||
multi: true
|
||||
});
|
||||
|
||||
var currentLocation = LesionLocations.findOne({
|
||||
id: measurement.locationId
|
||||
@@ -188,10 +196,14 @@ Template.lesionLocationDialog.events({
|
||||
}
|
||||
|
||||
// Get selected location data
|
||||
var locationObj = LesionLocations.findOne({_id: selectedOptionId});
|
||||
var locationObj = LesionLocations.findOne({
|
||||
_id: selectedOptionId
|
||||
});
|
||||
|
||||
var id;
|
||||
var existingLocation = PatientLocations.findOne({location: locationObj.location});
|
||||
var existingLocation = PatientLocations.findOne({
|
||||
location: locationObj.location
|
||||
});
|
||||
if (existingLocation) {
|
||||
id = existingLocation._id;
|
||||
} else {
|
||||
@@ -269,7 +281,7 @@ Template.lesionLocationDialog.events({
|
||||
});
|
||||
|
||||
Template.lesionLocationDialog.helpers({
|
||||
'lesionLocations': function() {
|
||||
lesionLocations: function() {
|
||||
return LesionLocations.find();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
Template.lesionTable.helpers({
|
||||
'measurement': function() {
|
||||
measurement: function() {
|
||||
// All Targets shall be listed first followed by Non-Targets
|
||||
return Measurements.find({}, {
|
||||
sort: {
|
||||
@@ -8,7 +8,7 @@ Template.lesionTable.helpers({
|
||||
}
|
||||
});
|
||||
},
|
||||
'timepoints': function() {
|
||||
timepoints: function() {
|
||||
return Timepoints.find({}, {
|
||||
sort: {
|
||||
timepointName: 1
|
||||
@@ -49,10 +49,10 @@ Template.lesionTable.events({
|
||||
height: newHeight
|
||||
});
|
||||
|
||||
var viewportAndLesionTableHeight = $("#viewportAndLesionTable").height();
|
||||
var viewportAndLesionTableHeight = $('#viewportAndLesionTable').height();
|
||||
var newPercentageHeightofLesionTable = (startHeight - topPosition) / viewportAndLesionTableHeight * 100;
|
||||
var newPercentageHeightofViewermain = 100 - newPercentageHeightofLesionTable;
|
||||
$(".viewerMain").height(newPercentageHeightofViewermain + "%");
|
||||
$('.viewerMain').height(newPercentageHeightofViewermain + '%');
|
||||
|
||||
// Resize viewport
|
||||
resizeViewportElements();
|
||||
@@ -71,19 +71,19 @@ Template.lesionTable.onRendered(function() {
|
||||
// Put a visual indicator (<) in timepoint header in lesion table for active timepoints
|
||||
// timepointLoaded property is used to put indicator for loaded timepoints in viewport
|
||||
self.autorun(function() {
|
||||
var ViewerData = Session.get("ViewerData");
|
||||
var contentId = Session.get("activeContentId");
|
||||
var ViewerData = Session.get('ViewerData');
|
||||
var contentId = Session.get('activeContentId');
|
||||
if (contentId) {
|
||||
var viewerData = ViewerData[contentId];
|
||||
if (viewerData) {
|
||||
if (viewerData.loadedSeriesData) {
|
||||
// Get study dates of imageViewerViewport elements
|
||||
var loadedStudyDates = {
|
||||
patientId: "",
|
||||
patientId: '',
|
||||
dates: []
|
||||
};
|
||||
|
||||
$(".imageViewerViewport").each(function(viewportIndex, element) {
|
||||
$('.imageViewerViewport').each(function(viewportIndex, element) {
|
||||
var enabledElement = cornerstone.getEnabledElement(element);
|
||||
if (!enabledElement || !enabledElement.image) {
|
||||
return;
|
||||
@@ -125,4 +125,4 @@ Template.lesionTable.onRendered(function() {
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,10 @@
|
||||
Template.lesionTableRow.helpers({
|
||||
'timepoints': function() {
|
||||
return Timepoints.find({}, {sort: {timepointName: 1}});
|
||||
timepoints: function() {
|
||||
return Timepoints.find({}, {
|
||||
sort: {
|
||||
timepointName: 1
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,7 +13,7 @@ function doneCallback(measurementData, deleteTool) {
|
||||
// opened by the Lesion Table, we should clear the data for
|
||||
// the specified Timepoint Cell
|
||||
if (deleteTool === true) {
|
||||
Meteor.call("removeMeasurement", measurementData.id, function(error, response) {
|
||||
Meteor.call('removeMeasurement', measurementData.id, function(error, response) {
|
||||
if (error) {
|
||||
log.warn(error);
|
||||
}
|
||||
@@ -47,7 +51,7 @@ Template.lesionTableRow.events({
|
||||
};
|
||||
|
||||
showConfirmDialog(function() {
|
||||
Meteor.call("removeMeasurement", currentMeasurement._id, function(error, response) {
|
||||
Meteor.call('removeMeasurement', currentMeasurement._id, function(error, response) {
|
||||
if (error) {
|
||||
log.warn(error);
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
Template.lesionTableTimepointCell.helpers({
|
||||
'hasDataAtThisTimepoint': function() {
|
||||
hasDataAtThisTimepoint: function() {
|
||||
// This simple function just checks whether or not timepoint data
|
||||
// exists for this Measurement at this Timepoint
|
||||
var lesionData = Template.parentData(1);
|
||||
@@ -7,7 +7,7 @@ Template.lesionTableTimepointCell.helpers({
|
||||
lesionData.timepoints &&
|
||||
lesionData.timepoints[this.timepointID]);
|
||||
},
|
||||
'displayData': function() {
|
||||
displayData: function() {
|
||||
// Search Measurements by lesion and timepoint
|
||||
var lesionData = Template.parentData(1);
|
||||
if (!lesionData ||
|
||||
@@ -20,7 +20,7 @@ Template.lesionTableTimepointCell.helpers({
|
||||
|
||||
if (lesionData.isTarget === true) {
|
||||
if (data.shortestDiameter) {
|
||||
return data.longestDiameter + " x " + data.shortestDiameter;
|
||||
return data.longestDiameter + ' x ' + data.shortestDiameter;
|
||||
}
|
||||
|
||||
return data.longestDiameter;
|
||||
@@ -28,7 +28,7 @@ Template.lesionTableTimepointCell.helpers({
|
||||
return data.response;
|
||||
}
|
||||
},
|
||||
'isTarget': function() {
|
||||
isTarget: function() {
|
||||
var lesionData = Template.parentData(1);
|
||||
return lesionData.isTarget;
|
||||
}
|
||||
@@ -90,4 +90,4 @@ Template.lesionTableTimepointCell.events({
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
+32
-31
@@ -1,23 +1,26 @@
|
||||
Template.lesionTableTimepointHeader.events({
|
||||
'click th': function(e, template){
|
||||
|
||||
'click th.lesionTableTimepointCell': function(e, template) {
|
||||
var parentPosition = getPosition(e.currentTarget);
|
||||
var cellText = e.currentTarget.innerText;
|
||||
|
||||
// Remove spaces in string
|
||||
cellText = cellText.replace(/\s/g, ''); // Remove spaces
|
||||
cellText = cellText.replace('<', ''); // Remove <
|
||||
var splitCellText = cellText.split('/');
|
||||
var dateStr = splitCellText[2].replace(/\D/g,'') + "" + splitCellText[0].replace(/\D/g,'') + ""+splitCellText[1].replace(/\D/g,''); // Remove non-digit chars
|
||||
var dateStr = splitCellText[2].replace(/\D/g,'') + '' + splitCellText[0].replace(/\D/g,'') + '' + splitCellText[1].replace(/\D/g,''); // Remove non-digit chars
|
||||
|
||||
// Check patient has a timepointText as Baseline
|
||||
var patientId = template.data.patientId;
|
||||
|
||||
// Open popup
|
||||
var timepointTextDialog = $("#timepointTextDialog");
|
||||
var dialogDisplay = timepointTextDialog.css("display");
|
||||
if(dialogDisplay === "none") {
|
||||
|
||||
var isBaselineInCollection = Timepoints.findOne({patientId: patientId, timepointName: dateStr, timepointText: "Baseline"});
|
||||
var timepointTextDialog = $('#timepointTextDialog');
|
||||
var dialogDisplay = timepointTextDialog.css('display');
|
||||
if (dialogDisplay === 'none') {
|
||||
var isBaselineInCollection = Timepoints.findOne({
|
||||
patientId: patientId,
|
||||
timepointName: dateStr,
|
||||
timepointText: 'Baseline'
|
||||
});
|
||||
|
||||
// If isBaselineInCollection is true, "Baseline" is found in collection for patient and set checkbox as checked
|
||||
if (isBaselineInCollection) {
|
||||
@@ -29,30 +32,31 @@ Template.lesionTableTimepointHeader.events({
|
||||
}
|
||||
|
||||
// Open dialog
|
||||
var dialogProperty = {
|
||||
var dialogProperty = {
|
||||
top: parentPosition.y - 30,
|
||||
left: parentPosition.x,
|
||||
display: 'block'
|
||||
};
|
||||
|
||||
timepointTextDialog.css(dialogProperty);
|
||||
|
||||
} else if(dialogDisplay === "block") {
|
||||
|
||||
} else {
|
||||
// Get timepoints of patient
|
||||
// Set timepointText as Baseline for selected timepoint
|
||||
var timepoints = Timepoints.find({patientId: patientId}).fetch();
|
||||
var timepoints = Timepoints.find({
|
||||
patientId: patientId
|
||||
}).fetch();
|
||||
|
||||
// Check checkbox is selected
|
||||
var checkboxBaselineChecked = $("#checkBoxBaseline").is(":checked");
|
||||
var checkboxBaselineChecked = $('#checkBoxBaseline').is(':checked');
|
||||
|
||||
timepoints.forEach(function(timepoint) {
|
||||
// timepointText defines a custom text for timepoint such as Baseline, Nadir, Current
|
||||
if (timepoint.timepointName === dateStr) {
|
||||
// If checkbox is selected, set timepointText as Baseline
|
||||
// Else set timepointText as ""
|
||||
var timepointText = "Baseline";
|
||||
if(!checkboxBaselineChecked) {
|
||||
timepointText = "";
|
||||
var timepointText = 'Baseline';
|
||||
if (!checkboxBaselineChecked) {
|
||||
timepointText = '';
|
||||
}
|
||||
|
||||
Timepoints.update(timepoint._id,{
|
||||
@@ -60,36 +64,29 @@ Template.lesionTableTimepointHeader.events({
|
||||
timepointText: timepointText
|
||||
}
|
||||
});
|
||||
} else{
|
||||
} else {
|
||||
// Set timepointText as empty
|
||||
Timepoints.update(timepoint._id,{
|
||||
$set: {
|
||||
timepointText: ""
|
||||
timepointText: ''
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Close dialog
|
||||
timepointTextDialog.css("display", "none");
|
||||
|
||||
timepointTextDialog.css('display', 'none');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Template.lesionTableTimepointHeader.helpers({
|
||||
'timepointTextFound': function(){
|
||||
timepointTextFound: function() {
|
||||
var timepointText = this.timepointText;
|
||||
if(timepointText && timepointText === 'Baseline') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return (timepointText && timepointText === 'Baseline');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Gets parent's position of element which mouse pointer is clicked in
|
||||
function getPosition(element) {
|
||||
var xPosition = 0;
|
||||
@@ -100,5 +97,9 @@ function getPosition(element) {
|
||||
yPosition += (element.offsetTop - element.scrollTop + element.clientTop);
|
||||
element = element.offsetParent;
|
||||
}
|
||||
return { x: xPosition, y: yPosition };
|
||||
}
|
||||
|
||||
return {
|
||||
x: xPosition,
|
||||
y: yPosition
|
||||
};
|
||||
}
|
||||
+57
-38
@@ -3,7 +3,7 @@ function closeHandler(dialog) {
|
||||
$(dialog).css('display', 'none');
|
||||
|
||||
// Remove the backdrop
|
||||
$(".removableBackdrop").remove();
|
||||
$('.removableBackdrop').remove();
|
||||
|
||||
// Restore the focus to the active viewport
|
||||
setFocusToActiveViewport();
|
||||
@@ -17,7 +17,9 @@ function setLesionNumberCallback(measurementData, eventData, doneCallback) {
|
||||
var imageId = enabledElement.image.imageId;
|
||||
|
||||
var study = cornerstoneTools.metaData.get('study', imageId);
|
||||
var timepoint = Timepoints.findOne({timepointName: study.studyDate});
|
||||
var timepoint = Timepoints.findOne({
|
||||
timepointName: study.studyDate
|
||||
});
|
||||
if (!timepoint) {
|
||||
return;
|
||||
}
|
||||
@@ -29,7 +31,7 @@ function setLesionNumberCallback(measurementData, eventData, doneCallback) {
|
||||
|
||||
// Get a lesion number for this lesion, depending on whether or not the same lesion previously
|
||||
// exists at a different timepoint
|
||||
var lesionNumber = LesionManager.getNewLesionNumber(measurementData.timepointID, isTarget=false);
|
||||
var lesionNumber = LesionManager.getNewLesionNumber(measurementData.timepointID, isTarget = false);
|
||||
measurementData.lesionNumber = lesionNumber;
|
||||
|
||||
// Set lesion number
|
||||
@@ -43,26 +45,26 @@ function getLesionLocationCallback(measurementData, eventData) {
|
||||
Template.nonTargetLesionDialog.measurementData = measurementData;
|
||||
|
||||
// Get the non-target lesion location dialog
|
||||
var dialog = $("#nonTargetLesionLocationDialog");
|
||||
var dialog = $('#nonTargetLesionLocationDialog');
|
||||
Template.nonTargetLesionDialog.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() {
|
||||
$('.removableBackdrop').one('mousedown touchstart', function() {
|
||||
closeHandler(dialog);
|
||||
});
|
||||
|
||||
// Find the select option box
|
||||
var selectorLocation = dialog.find("select#selectNonTargetLesionLocation");
|
||||
var selectorResponse = dialog.find("select#selectNonTargetLesionLocationResponse");
|
||||
var selectorLocation = dialog.find('select#selectNonTargetLesionLocation');
|
||||
var selectorResponse = dialog.find('select#selectNonTargetLesionLocationResponse');
|
||||
|
||||
selectorLocation.find("option:first").prop("selected", "selected");
|
||||
selectorResponse.find("option:first").prop("selected", "selected");
|
||||
selectorLocation.find('option:first').prop('selected', 'selected');
|
||||
selectorResponse.find('option:first').prop('selected', 'selected');
|
||||
|
||||
// Allow location selection
|
||||
selectorLocation.removeAttr("disabled");
|
||||
selectorLocation.removeAttr('disabled');
|
||||
|
||||
// Find out if this lesion number is already added in the lesion manager for another timepoint
|
||||
// If it is, disable selector location
|
||||
@@ -83,15 +85,15 @@ function getLesionLocationCallback(measurementData, eventData) {
|
||||
selectorLocation.find('option').each(function() {
|
||||
if ($(this).text() === locationName) {
|
||||
// Select location in locations dropdown list
|
||||
selectorLocation.find('option').eq($(this).index()).prop("selected", true);
|
||||
selectorLocation.find('option').eq($(this).index()).prop('selected', true);
|
||||
}
|
||||
});
|
||||
|
||||
selectorLocation.prop("disabled", true);
|
||||
selectorLocation.prop('disabled', true);
|
||||
}
|
||||
|
||||
// Show the nonTargetLesion dialog above
|
||||
var dialogProperty = {
|
||||
var dialogProperty = {
|
||||
top: eventData.currentPoints.page.y - dialog.outerHeight() - 40,
|
||||
left: eventData.currentPoints.page.x - dialog.outerWidth() / 2,
|
||||
display: 'block'
|
||||
@@ -109,7 +111,7 @@ function getLesionLocationCallback(measurementData, eventData) {
|
||||
// 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");
|
||||
dialog.addClass('dialogMobile');
|
||||
dialogProperty.top = 0;
|
||||
dialogProperty.left = 0;
|
||||
dialogProperty.right = 0;
|
||||
@@ -125,14 +127,14 @@ changeNonTargetLocationCallback = function(measurementData, eventData, doneCallb
|
||||
Template.nonTargetLesionDialog.doneCallback = doneCallback;
|
||||
|
||||
// Get the non-target lesion location dialog
|
||||
var dialog = $("#nonTargetLesionRelabelDialog");
|
||||
var dialog = $('#nonTargetLesionRelabelDialog');
|
||||
Template.nonTargetLesionDialog.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() {
|
||||
$('.removableBackdrop').one('mousedown touchstart', function() {
|
||||
closeHandler(dialog);
|
||||
|
||||
if (doneCallback && typeof doneCallback === 'function') {
|
||||
@@ -142,17 +144,17 @@ changeNonTargetLocationCallback = function(measurementData, eventData, doneCallb
|
||||
});
|
||||
|
||||
// Find the select option box
|
||||
var selectorLocation = dialog.find("select#selectNonTargetLesionLocation");
|
||||
var selectorResponse = dialog.find("select#selectNonTargetLesionLocationResponse");
|
||||
var selectorLocation = dialog.find('select#selectNonTargetLesionLocation');
|
||||
var selectorResponse = dialog.find('select#selectNonTargetLesionLocationResponse');
|
||||
|
||||
selectorLocation.find("option:first").prop("selected", "selected");
|
||||
selectorResponse.find("option:first").prop("selected", "selected");
|
||||
selectorLocation.find('option:first').prop('selected', 'selected');
|
||||
selectorResponse.find('option:first').prop('selected', 'selected');
|
||||
|
||||
// Allow location selection
|
||||
selectorLocation.removeAttr("disabled");
|
||||
selectorLocation.removeAttr('disabled');
|
||||
|
||||
// Show the nonTargetLesion dialog above
|
||||
var dialogProperty = {
|
||||
var dialogProperty = {
|
||||
display: 'block'
|
||||
};
|
||||
|
||||
@@ -160,7 +162,7 @@ changeNonTargetLocationCallback = function(measurementData, eventData, doneCallb
|
||||
// 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");
|
||||
dialog.addClass('dialogMobile');
|
||||
dialogProperty.top = 0;
|
||||
dialogProperty.left = 0;
|
||||
dialogProperty.right = 0;
|
||||
@@ -179,8 +181,14 @@ changeNonTargetLocationCallback = function(measurementData, eventData, doneCallb
|
||||
}
|
||||
|
||||
LesionLocations.update({},
|
||||
{$set: {selected: false}},
|
||||
{ multi: true });
|
||||
{
|
||||
$set: {
|
||||
selected: false
|
||||
}
|
||||
},
|
||||
{
|
||||
multi: true
|
||||
});
|
||||
|
||||
var currentLocation = LesionLocations.findOne({
|
||||
id: measurement.locationId
|
||||
@@ -197,8 +205,14 @@ changeNonTargetLocationCallback = function(measurementData, eventData, doneCallb
|
||||
});
|
||||
|
||||
LocationResponses.update({},
|
||||
{$set: {selected: false}},
|
||||
{ multi: true });
|
||||
{
|
||||
$set: {
|
||||
selected: false
|
||||
}
|
||||
},
|
||||
{
|
||||
multi: true
|
||||
});
|
||||
|
||||
var response = measurement.timepoints[measurementData.timepointID].response;
|
||||
|
||||
@@ -233,12 +247,12 @@ Template.nonTargetLesionDialog.events({
|
||||
var measurementData = Template.nonTargetLesionDialog.measurementData;
|
||||
|
||||
// Find the select option box
|
||||
var selectorLocation = dialog.find("select#selectNonTargetLesionLocation");
|
||||
var selectorResponse = dialog.find("select#selectNonTargetLesionLocationResponse");
|
||||
var selectorLocation = dialog.find('select#selectNonTargetLesionLocation');
|
||||
var selectorResponse = dialog.find('select#selectNonTargetLesionLocationResponse');
|
||||
|
||||
// Get the current value of the selector
|
||||
var selectedOptionId = selectorLocation.find("option:selected").val();
|
||||
var responseOptionId = selectorResponse.find("option:selected").val();
|
||||
var selectedOptionId = selectorLocation.find('option:selected').val();
|
||||
var responseOptionId = selectorResponse.find('option:selected').val();
|
||||
|
||||
// If the selected option is still the default (-1)
|
||||
// then stop here
|
||||
@@ -253,15 +267,21 @@ Template.nonTargetLesionDialog.events({
|
||||
}
|
||||
|
||||
// Get selected location data
|
||||
var locationObj = LesionLocations.findOne({_id: selectedOptionId});
|
||||
var locationObj = LesionLocations.findOne({
|
||||
_id: selectedOptionId
|
||||
});
|
||||
|
||||
var id;
|
||||
var existingLocation = PatientLocations.findOne({location: locationObj.location});
|
||||
var existingLocation = PatientLocations.findOne({
|
||||
location: locationObj.location
|
||||
});
|
||||
if (existingLocation) {
|
||||
id = existingLocation._id;
|
||||
} else {
|
||||
// Adds location data to PatientLocation and retrieve the location ID
|
||||
id = PatientLocations.insert({location: locationObj.location});
|
||||
id = PatientLocations.insert({
|
||||
location: locationObj.location
|
||||
});
|
||||
}
|
||||
|
||||
if (measurementData.id) {
|
||||
@@ -323,12 +343,11 @@ Template.nonTargetLesionDialog.events({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Template.nonTargetLesionDialog.helpers({
|
||||
'lesionLocations': function() {
|
||||
lesionLocations: function() {
|
||||
return LesionLocations.find();
|
||||
},
|
||||
'locationResponses': function() {
|
||||
locationResponses: function() {
|
||||
return LocationResponses.find();
|
||||
}
|
||||
});
|
||||
});
|
||||
+9
-10
@@ -3,7 +3,7 @@ function closeHandler(dialog) {
|
||||
$(dialog).css('display', 'none');
|
||||
|
||||
// Remove the backdrop
|
||||
$(".removableBackdrop").remove();
|
||||
$('.removableBackdrop').remove();
|
||||
|
||||
// Restore the focus to the active viewport
|
||||
setFocusToActiveViewport();
|
||||
@@ -14,14 +14,14 @@ changeNonTargetResponse = function(measurementData, eventData, doneCallback) {
|
||||
Template.nonTargetResponseDialog.doneCallback = doneCallback;
|
||||
|
||||
// Get the non-target lesion location dialog
|
||||
var dialog = $("#nonTargetResponseDialog");
|
||||
var dialog = $('#nonTargetResponseDialog');
|
||||
Template.nonTargetResponseDialog.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() {
|
||||
$('.removableBackdrop').one('mousedown touchstart', function() {
|
||||
closeHandler(dialog);
|
||||
|
||||
if (doneCallback && typeof doneCallback === 'function') {
|
||||
@@ -31,7 +31,7 @@ changeNonTargetResponse = function(measurementData, eventData, doneCallback) {
|
||||
});
|
||||
|
||||
// Show the nonTargetLesion dialog above
|
||||
var dialogProperty = {
|
||||
var dialogProperty = {
|
||||
display: 'block'
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ changeNonTargetResponse = function(measurementData, eventData, doneCallback) {
|
||||
// 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");
|
||||
dialog.addClass('dialogMobile');
|
||||
dialogProperty.top = 0;
|
||||
dialogProperty.left = 0;
|
||||
dialogProperty.right = 0;
|
||||
@@ -90,10 +90,10 @@ Template.nonTargetResponseDialog.events({
|
||||
var measurementData = Template.nonTargetResponseDialog.measurementData;
|
||||
|
||||
// Find the select option box
|
||||
var selectorResponse = dialog.find("select#selectNonTargetLesionLocationResponse");
|
||||
var selectorResponse = dialog.find('select#selectNonTargetLesionLocationResponse');
|
||||
|
||||
// Get the current value of the selector
|
||||
var responseOptionId = selectorResponse.find("option:selected").val();
|
||||
var responseOptionId = selectorResponse.find('option:selected').val();
|
||||
|
||||
// If the selected response option is still the default (-1)
|
||||
// then stop here
|
||||
@@ -148,9 +148,8 @@ Template.nonTargetResponseDialog.events({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Template.nonTargetResponseDialog.helpers({
|
||||
'locationResponses': function() {
|
||||
locationResponses: function() {
|
||||
return LocationResponses.find();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -12,10 +12,14 @@ Template.studyDateList.helpers({
|
||||
// since the WorklistStudies Collection only contains the studies on-screen
|
||||
|
||||
// Check which study is currently loaded into the study browser
|
||||
var currentStudyInBrowser = ViewerStudies.findOne({selected: true});
|
||||
var currentStudyInBrowser = ViewerStudies.findOne({
|
||||
selected: true
|
||||
});
|
||||
|
||||
// Find studies which have the same patientId as the currently selected study
|
||||
var relatedStudies = WorklistStudies.find({patientId: currentStudyInBrowser.patientId}).fetch();
|
||||
var relatedStudies = WorklistStudies.find({
|
||||
patientId: currentStudyInBrowser.patientId
|
||||
}).fetch();
|
||||
|
||||
// Modify the array of related studies so the default option is the currently selected study
|
||||
relatedStudies.forEach(function(study) {
|
||||
@@ -31,7 +35,6 @@ Template.studyDateList.helpers({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Template.studyDateList.events({
|
||||
/**
|
||||
* When the study date selector combo box is changed, we will
|
||||
@@ -65,16 +68,26 @@ Template.studyDateList.events({
|
||||
|
||||
// Set "Selected" to false for the entire collection
|
||||
ViewerStudies.update({},
|
||||
{$set: {selected: false}},
|
||||
{ multi: true });
|
||||
{
|
||||
$set: {
|
||||
selected: false
|
||||
}
|
||||
},
|
||||
{
|
||||
multi: true
|
||||
});
|
||||
|
||||
// Check if this study already exists in the ViewerStudies collection
|
||||
// of loaded studies. If it does, set it's 'selected' value to true.
|
||||
var existingStudy = ViewerStudies.findOne({studyInstanceUid: studyInstanceUid});
|
||||
var existingStudy = ViewerStudies.findOne({
|
||||
studyInstanceUid: studyInstanceUid
|
||||
});
|
||||
if (existingStudy) {
|
||||
// Set the current finding in the collection to true
|
||||
ViewerStudies.update(existingStudy._id, {
|
||||
$set: {selected: true}
|
||||
$set: {
|
||||
selected: true
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -86,15 +99,17 @@ Template.studyDateList.events({
|
||||
|
||||
var timepointID = uuid.v4();
|
||||
|
||||
var timepoint = Timepoints.findOne({timepointName: study.studyDate});
|
||||
var timepoint = Timepoints.findOne({
|
||||
timepointName: study.studyDate
|
||||
});
|
||||
if (timepoint) {
|
||||
log.warn("A timepoint with that study date already exists!");
|
||||
log.warn('A timepoint with that study date already exists!');
|
||||
return;
|
||||
}
|
||||
|
||||
var testTimepoint = Timepoints.findOne({});
|
||||
if (testTimepoint && testTimepoint.patientId !== study.patientId) {
|
||||
log.warn("Timepoints collection related to the wrong subject");
|
||||
log.warn('Timepoints collection related to the wrong subject');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
activateLesion = function(measurementId, templateData) {
|
||||
|
||||
// Set background color of selected row
|
||||
$("tr[data-measurementid=" + measurementId + "]").addClass("selectedRow").siblings().removeClass("selectedRow");
|
||||
$('tr[data-measurementid=' + measurementId + ']').addClass('selectedRow').siblings().removeClass('selectedRow');
|
||||
|
||||
var measurementData = Measurements.findOne(measurementId);
|
||||
|
||||
@@ -26,9 +26,9 @@ activateLesion = function(measurementId, templateData) {
|
||||
Object.keys(timepoints).forEach(function(key) {
|
||||
var timepoint = timepoints[key];
|
||||
|
||||
if (timepoint.imageId === "" ||
|
||||
timepoint.studyInstanceUid === "" ||
|
||||
timepoint.seriesInstanceUid === "") {
|
||||
if (timepoint.imageId === '' ||
|
||||
timepoint.studyInstanceUid === '' ||
|
||||
timepoint.seriesInstanceUid === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ activateLesion = function(measurementId, templateData) {
|
||||
}
|
||||
|
||||
// Loop through the viewports and display each timepoint
|
||||
$(".imageViewerViewport").not('.empty').each(function(viewportIndex, element) {
|
||||
$('.imageViewerViewport').not('.empty').each(function(viewportIndex, element) {
|
||||
// Stop if we run out of timepoints before viewports
|
||||
if (viewportIndex >= timepointsWithEntries.length) {
|
||||
// Update the element anyway, to remove any other highlights that are present
|
||||
@@ -93,4 +93,4 @@ activateLesion = function(measurementId, templateData) {
|
||||
activateMeasurements(element, measurementId, templateData, viewportIndex);
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
@@ -80,4 +80,4 @@ function activateTool(element, measurementData, timepointID) {
|
||||
}
|
||||
|
||||
cornerstone.updateImage(element);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ clearMeasurementTimepointData = function(measurementId, timepointId) {
|
||||
delete data.timepoints[timepointId];
|
||||
|
||||
if (Object.keys(data.timepoints).length === 0) {
|
||||
Meteor.call("removeMeasurement", measurementId, function(error, response) {
|
||||
Meteor.call('removeMeasurement', measurementId, function(error, response) {
|
||||
console.log('Removed!');
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
clearTools = function() {
|
||||
var patientId = Session.get("patientId");
|
||||
var toolTypes = ["lesion", "nonTarget"];
|
||||
var patientId = Session.get('patientId');
|
||||
var toolTypes = [ 'lesion', 'nonTarget' ];
|
||||
var toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.toolState;
|
||||
var toolStateKeys = Object.keys(toolState).slice(0);
|
||||
|
||||
// Set null array for toolState data found by imageId and toolType
|
||||
toolStateKeys.forEach(function (imageId) {
|
||||
toolTypes.forEach(function (toolType) {
|
||||
toolStateKeys.forEach(function(imageId) {
|
||||
toolTypes.forEach(function(toolType) {
|
||||
var toolTypeData = toolState[imageId][toolType];
|
||||
if(toolTypeData && toolTypeData.data.length > 0) {
|
||||
if(toolTypeData.data[0].patientId === patientId) {
|
||||
if (toolTypeData && toolTypeData.data.length > 0) {
|
||||
if (toolTypeData.data[0].patientId === patientId) {
|
||||
toolState[imageId][toolType] = {
|
||||
data: []
|
||||
};
|
||||
@@ -19,11 +19,11 @@ clearTools = function() {
|
||||
});
|
||||
|
||||
// Update imageViewerViewport elements to remove lesions on current image
|
||||
var viewportElements = $(".imageViewerViewport").not('.empty');
|
||||
var viewportElements = $('.imageViewerViewport').not('.empty');
|
||||
viewportElements.each(function(index, element) {
|
||||
cornerstone.updateImage(element);
|
||||
});
|
||||
|
||||
// Remove patient's measurements
|
||||
Meteor.call('removeMeasurementsByPatientId', patientId);
|
||||
};
|
||||
};
|
||||
@@ -15,4 +15,4 @@ deactivateAllToolData = function(element, toolType) {
|
||||
var data = toolData.data[i];
|
||||
data.active = false;
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -9,5 +9,8 @@ getTimepointObject = function(imageId) {
|
||||
if (!study) {
|
||||
return;
|
||||
}
|
||||
return Timepoints.findOne({timepointName: study.studyDate});
|
||||
};
|
||||
|
||||
return Timepoints.findOne({
|
||||
timepointName: study.studyDate
|
||||
});
|
||||
};
|
||||
@@ -4,14 +4,13 @@ sign = function(x) {
|
||||
return typeof x === 'number' ? x ? x < 0 ? -1 : 1 : x === x ? 0 : NaN : NaN;
|
||||
};
|
||||
|
||||
|
||||
// Returns intersection points of lines and whether lines are intersected
|
||||
getLineIntersection = function (point1, point2, point3, point4) {
|
||||
getLineIntersection = function(point1, point2, point3, point4) {
|
||||
|
||||
var intersectionPoint = {};
|
||||
|
||||
var x1 = point1.x, y1 = point1.y, x2 = point2.x, y2 = point2.y,
|
||||
x3 = point3.x, y3 = point3.y, x4 = point4.x, y4 = point4.y;
|
||||
var x1 = point1.x, y1 = point1.y, x2 = point2.x, y2 = point2.y,
|
||||
x3 = point3.x, y3 = point3.y, x4 = point4.x, y4 = point4.y;
|
||||
|
||||
var a1, a2, b1, b2, c1, c2; // Coefficients of line equations
|
||||
var r1, r2, r3, r4; // Sign values
|
||||
@@ -33,8 +32,7 @@ getLineIntersection = function (point1, point2, point3, point4) {
|
||||
|
||||
if (r3 != 0 &&
|
||||
r4 != 0 &&
|
||||
sign(r3) == sign(r4))
|
||||
{
|
||||
sign(r3) == sign(r4)) {
|
||||
intersectionPoint.x = 0;
|
||||
intersectionPoint.y = 0;
|
||||
intersectionPoint.intersected = false;
|
||||
@@ -59,8 +57,7 @@ getLineIntersection = function (point1, point2, point3, point4) {
|
||||
|
||||
if (r1 != 0 &&
|
||||
r2 != 0 &&
|
||||
sign(r1) == sign(r2))
|
||||
{
|
||||
sign(r1) == sign(r2)) {
|
||||
intersectionPoint.x = 0;
|
||||
intersectionPoint.y = 0;
|
||||
intersectionPoint.intersected = false;
|
||||
@@ -98,7 +95,7 @@ getDistance = function(point1, point2) {
|
||||
};
|
||||
|
||||
// Returns distance from point to a line
|
||||
getDistanceFromPointToLine = function (ptTest, pt1, pt2) {
|
||||
getDistanceFromPointToLine = function(ptTest, pt1, pt2) {
|
||||
var ptNearest = {};
|
||||
|
||||
// Point on line segment nearest to pt0
|
||||
@@ -106,29 +103,23 @@ getDistanceFromPointToLine = function (ptTest, pt1, pt2) {
|
||||
var dy = pt2.y - pt1.y;
|
||||
|
||||
// It's a point, not a line
|
||||
if (dx == 0 && dy == 0)
|
||||
{
|
||||
if (dx == 0 && dy == 0) {
|
||||
ptNearest.x = pt1.x;
|
||||
ptNearest.y = pt1.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Parameter
|
||||
var t = ((ptTest.x - pt1.x) * dx + (ptTest.y - pt1.y) * dy) / (dx * dx + dy * dy);
|
||||
|
||||
// Nearest point is pt1
|
||||
if (t < 0)
|
||||
{
|
||||
if (t < 0) {
|
||||
ptNearest = pt1;
|
||||
}
|
||||
// Nearest point is pt2
|
||||
else if (t > 1)
|
||||
{
|
||||
else if (t > 1) {
|
||||
ptNearest = pt2;
|
||||
}
|
||||
// Nearest point is on the line segment
|
||||
else
|
||||
{
|
||||
else {
|
||||
// Parametric equation
|
||||
ptNearest.x = (pt1.x + t * dx);
|
||||
ptNearest.y = (pt1.y + t * dy);
|
||||
|
||||
@@ -25,4 +25,4 @@ removeToolDataWithMeasurementId = function(imageId, toolType, measurementId) {
|
||||
toRemove.forEach(function(index) {
|
||||
toolData.splice(index, 1);
|
||||
});
|
||||
};
|
||||
};
|
||||
@@ -15,10 +15,10 @@ toggleLesionTrackerTools = function() {
|
||||
|
||||
// Hide the tools (set them all to disabled)
|
||||
var toolDefaultStates = {
|
||||
activate: ['deleteLesionKeyboardTool'],
|
||||
activate: [ 'deleteLesionKeyboardTool' ],
|
||||
deactivate: [],
|
||||
enable: [],
|
||||
disable: ['lesion', 'nonTarget', 'scaleOverlayTool', 'length']
|
||||
disable: [ 'lesion', 'nonTarget', 'scaleOverlayTool', 'length' ]
|
||||
};
|
||||
|
||||
toolManager.setToolDefaultStates(toolDefaultStates);
|
||||
@@ -38,4 +38,4 @@ toggleLesionTrackerTools = function() {
|
||||
|
||||
toolsShown = true;
|
||||
}
|
||||
};
|
||||
};
|
||||
+215
-215
@@ -4,247 +4,247 @@
|
||||
// MIT License - http://opensource.org/licenses/mit-license.php
|
||||
|
||||
(function() {
|
||||
var _global = this;
|
||||
var _global = this;
|
||||
|
||||
// Unique ID creation requires a high quality random # generator. We feature
|
||||
// detect to determine the best RNG source, normalizing to a function that
|
||||
// returns 128-bits of randomness, since that's what's usually required
|
||||
var _rng;
|
||||
// Unique ID creation requires a high quality random # generator. We feature
|
||||
// detect to determine the best RNG source, normalizing to a function that
|
||||
// returns 128-bits of randomness, since that's what's usually required
|
||||
var _rng;
|
||||
|
||||
// Allow for MSIE11 msCrypto
|
||||
var _crypto = _global.crypto || _global.msCrypto;
|
||||
// Allow for MSIE11 msCrypto
|
||||
var _crypto = _global.crypto || _global.msCrypto;
|
||||
|
||||
// Node.js crypto-based RNG - http://nodejs.org/docs/v0.6.2/api/crypto.html
|
||||
//
|
||||
// Moderately fast, high quality
|
||||
if (typeof(_global.require) == 'function') {
|
||||
try {
|
||||
var _rb = _global.require('crypto').randomBytes;
|
||||
_rng = _rb && function() {return _rb(16);};
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
if (!_rng && _crypto && _crypto.getRandomValues) {
|
||||
// WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
|
||||
// Node.js crypto-based RNG - http://nodejs.org/docs/v0.6.2/api/crypto.html
|
||||
//
|
||||
// Moderately fast, high quality
|
||||
var _rnds8 = new Uint8Array(16);
|
||||
_rng = function whatwgRNG() {
|
||||
_crypto.getRandomValues(_rnds8);
|
||||
return _rnds8;
|
||||
};
|
||||
}
|
||||
if (typeof(_global.require) == 'function') {
|
||||
try {
|
||||
var _rb = _global.require('crypto').randomBytes;
|
||||
_rng = _rb && function() {return _rb(16);};
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
if (!_rng) {
|
||||
// Math.random()-based (RNG)
|
||||
if (!_rng && _crypto && _crypto.getRandomValues) {
|
||||
// WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
|
||||
//
|
||||
// Moderately fast, high quality
|
||||
var _rnds8 = new Uint8Array(16);
|
||||
_rng = function whatwgRNG() {
|
||||
_crypto.getRandomValues(_rnds8);
|
||||
return _rnds8;
|
||||
};
|
||||
}
|
||||
|
||||
if (!_rng) {
|
||||
// Math.random()-based (RNG)
|
||||
//
|
||||
// If all else fails, use Math.random(). It's fast, but is of unspecified
|
||||
// quality.
|
||||
var _rnds = new Array(16);
|
||||
_rng = function() {
|
||||
for (var i = 0, r; i < 16; i++) {
|
||||
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
|
||||
_rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
|
||||
}
|
||||
|
||||
return _rnds;
|
||||
};
|
||||
}
|
||||
|
||||
// Buffer class to use
|
||||
var BufferClass = typeof(_global.Buffer) == 'function' ? _global.Buffer : Array;
|
||||
|
||||
// Maps for number <-> hex string conversion
|
||||
var _byteToHex = [];
|
||||
var _hexToByte = {};
|
||||
for (var i = 0; i < 256; i++) {
|
||||
_byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
||||
_hexToByte[_byteToHex[i]] = i;
|
||||
}
|
||||
|
||||
// **`parse()` - Parse a UUID into it's component bytes**
|
||||
function parse(s, buf, offset) {
|
||||
var i = (buf && offset) || 0, ii = 0;
|
||||
|
||||
buf = buf || [];
|
||||
s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) {
|
||||
if (ii < 16) { // Don't overflow!
|
||||
buf[i + ii++] = _hexToByte[oct];
|
||||
}
|
||||
});
|
||||
|
||||
// Zero out remaining bytes if string was short
|
||||
while (ii < 16) {
|
||||
buf[i + ii++] = 0;
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
// **`unparse()` - Convert UUID byte array (ala parse()) into a string**
|
||||
function unparse(buf, offset) {
|
||||
var i = offset || 0, bth = _byteToHex;
|
||||
return bth[buf[i++]] + bth[buf[i++]] +
|
||||
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] +
|
||||
bth[buf[i++]] + bth[buf[i++]] +
|
||||
bth[buf[i++]] + bth[buf[i++]];
|
||||
}
|
||||
|
||||
// **`v1()` - Generate time-based UUID**
|
||||
//
|
||||
// If all else fails, use Math.random(). It's fast, but is of unspecified
|
||||
// quality.
|
||||
var _rnds = new Array(16);
|
||||
_rng = function() {
|
||||
for (var i = 0, r; i < 16; i++) {
|
||||
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
|
||||
_rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
|
||||
}
|
||||
// Inspired by https://github.com/LiosK/UUID.js
|
||||
// and http://docs.python.org/library/uuid.html
|
||||
|
||||
return _rnds;
|
||||
};
|
||||
}
|
||||
// random #'s we need to init node and clockseq
|
||||
var _seedBytes = _rng();
|
||||
|
||||
// Buffer class to use
|
||||
var BufferClass = typeof(_global.Buffer) == 'function' ? _global.Buffer : Array;
|
||||
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
||||
var _nodeId = [
|
||||
_seedBytes[0] | 0x01,
|
||||
_seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
|
||||
];
|
||||
|
||||
// Maps for number <-> hex string conversion
|
||||
var _byteToHex = [];
|
||||
var _hexToByte = {};
|
||||
for (var i = 0; i < 256; i++) {
|
||||
_byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
||||
_hexToByte[_byteToHex[i]] = i;
|
||||
}
|
||||
// Per 4.2.2, randomize (14 bit) clockseq
|
||||
var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
|
||||
|
||||
// **`parse()` - Parse a UUID into it's component bytes**
|
||||
function parse(s, buf, offset) {
|
||||
var i = (buf && offset) || 0, ii = 0;
|
||||
// Previous uuid creation time
|
||||
var _lastMSecs = 0, _lastNSecs = 0;
|
||||
|
||||
buf = buf || [];
|
||||
s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) {
|
||||
if (ii < 16) { // Don't overflow!
|
||||
buf[i + ii++] = _hexToByte[oct];
|
||||
}
|
||||
});
|
||||
// See https://github.com/broofa/node-uuid for API details
|
||||
function v1(options, buf, offset) {
|
||||
var i = buf && offset || 0;
|
||||
var b = buf || [];
|
||||
|
||||
// Zero out remaining bytes if string was short
|
||||
while (ii < 16) {
|
||||
buf[i + ii++] = 0;
|
||||
options = options || {};
|
||||
|
||||
var clockseq = options.clockseq != null ? options.clockseq : _clockseq;
|
||||
|
||||
// UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
||||
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
||||
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
||||
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
||||
var msecs = options.msecs != null ? options.msecs : new Date().getTime();
|
||||
|
||||
// Per 4.2.1.2, use count of uuid's generated during the current clock
|
||||
// cycle to simulate higher resolution clock
|
||||
var nsecs = options.nsecs != null ? options.nsecs : _lastNSecs + 1;
|
||||
|
||||
// Time since last uuid creation (in msecs)
|
||||
var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs) / 10000;
|
||||
|
||||
// Per 4.2.1.2, Bump clockseq on clock regression
|
||||
if (dt < 0 && options.clockseq == null) {
|
||||
clockseq = clockseq + 1 & 0x3fff;
|
||||
}
|
||||
|
||||
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
||||
// time interval
|
||||
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs == null) {
|
||||
nsecs = 0;
|
||||
}
|
||||
|
||||
// Per 4.2.1.2 Throw error if too many uuids are requested
|
||||
if (nsecs >= 10000) {
|
||||
throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
|
||||
}
|
||||
|
||||
_lastMSecs = msecs;
|
||||
_lastNSecs = nsecs;
|
||||
_clockseq = clockseq;
|
||||
|
||||
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
||||
msecs += 12219292800000;
|
||||
|
||||
// `time_low`
|
||||
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
||||
b[i++] = tl >>> 24 & 0xff;
|
||||
b[i++] = tl >>> 16 & 0xff;
|
||||
b[i++] = tl >>> 8 & 0xff;
|
||||
b[i++] = tl & 0xff;
|
||||
|
||||
// `time_mid`
|
||||
var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
|
||||
b[i++] = tmh >>> 8 & 0xff;
|
||||
b[i++] = tmh & 0xff;
|
||||
|
||||
// `time_high_and_version`
|
||||
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
||||
b[i++] = tmh >>> 16 & 0xff;
|
||||
|
||||
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
||||
b[i++] = clockseq >>> 8 | 0x80;
|
||||
|
||||
// `clock_seq_low`
|
||||
b[i++] = clockseq & 0xff;
|
||||
|
||||
// `node`
|
||||
var node = options.node || _nodeId;
|
||||
for (var n = 0; n < 6; n++) {
|
||||
b[i + n] = node[n];
|
||||
}
|
||||
|
||||
return buf ? buf : unparse(b);
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
// **`v4()` - Generate random UUID**
|
||||
|
||||
// **`unparse()` - Convert UUID byte array (ala parse()) into a string**
|
||||
function unparse(buf, offset) {
|
||||
var i = offset || 0, bth = _byteToHex;
|
||||
return bth[buf[i++]] + bth[buf[i++]] +
|
||||
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] +
|
||||
bth[buf[i++]] + bth[buf[i++]] +
|
||||
bth[buf[i++]] + bth[buf[i++]];
|
||||
}
|
||||
// See https://github.com/broofa/node-uuid for API details
|
||||
function v4(options, buf, offset) {
|
||||
// Deprecated - 'format' argument, as supported in v1.2
|
||||
var i = buf && offset || 0;
|
||||
|
||||
// **`v1()` - Generate time-based UUID**
|
||||
//
|
||||
// Inspired by https://github.com/LiosK/UUID.js
|
||||
// and http://docs.python.org/library/uuid.html
|
||||
if (typeof(options) == 'string') {
|
||||
buf = options == 'binary' ? new BufferClass(16) : null;
|
||||
options = null;
|
||||
}
|
||||
|
||||
// random #'s we need to init node and clockseq
|
||||
var _seedBytes = _rng();
|
||||
options = options || {};
|
||||
|
||||
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
||||
var _nodeId = [
|
||||
_seedBytes[0] | 0x01,
|
||||
_seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
|
||||
];
|
||||
var rnds = options.random || (options.rng || _rng)();
|
||||
|
||||
// Per 4.2.2, randomize (14 bit) clockseq
|
||||
var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
|
||||
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
||||
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
||||
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
||||
|
||||
// Previous uuid creation time
|
||||
var _lastMSecs = 0, _lastNSecs = 0;
|
||||
// Copy bytes to buffer, if provided
|
||||
if (buf) {
|
||||
for (var ii = 0; ii < 16; ii++) {
|
||||
buf[i + ii] = rnds[ii];
|
||||
}
|
||||
}
|
||||
|
||||
// See https://github.com/broofa/node-uuid for API details
|
||||
function v1(options, buf, offset) {
|
||||
var i = buf && offset || 0;
|
||||
var b = buf || [];
|
||||
|
||||
options = options || {};
|
||||
|
||||
var clockseq = options.clockseq != null ? options.clockseq : _clockseq;
|
||||
|
||||
// UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
||||
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
||||
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
||||
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
||||
var msecs = options.msecs != null ? options.msecs : new Date().getTime();
|
||||
|
||||
// Per 4.2.1.2, use count of uuid's generated during the current clock
|
||||
// cycle to simulate higher resolution clock
|
||||
var nsecs = options.nsecs != null ? options.nsecs : _lastNSecs + 1;
|
||||
|
||||
// Time since last uuid creation (in msecs)
|
||||
var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
|
||||
|
||||
// Per 4.2.1.2, Bump clockseq on clock regression
|
||||
if (dt < 0 && options.clockseq == null) {
|
||||
clockseq = clockseq + 1 & 0x3fff;
|
||||
return buf || unparse(rnds);
|
||||
}
|
||||
|
||||
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
||||
// time interval
|
||||
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs == null) {
|
||||
nsecs = 0;
|
||||
}
|
||||
// Export public API
|
||||
var uuid = v4;
|
||||
uuid.v1 = v1;
|
||||
uuid.v4 = v4;
|
||||
uuid.parse = parse;
|
||||
uuid.unparse = unparse;
|
||||
uuid.BufferClass = BufferClass;
|
||||
|
||||
// Per 4.2.1.2 Throw error if too many uuids are requested
|
||||
if (nsecs >= 10000) {
|
||||
throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
|
||||
}
|
||||
|
||||
_lastMSecs = msecs;
|
||||
_lastNSecs = nsecs;
|
||||
_clockseq = clockseq;
|
||||
|
||||
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
||||
msecs += 12219292800000;
|
||||
|
||||
// `time_low`
|
||||
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
||||
b[i++] = tl >>> 24 & 0xff;
|
||||
b[i++] = tl >>> 16 & 0xff;
|
||||
b[i++] = tl >>> 8 & 0xff;
|
||||
b[i++] = tl & 0xff;
|
||||
|
||||
// `time_mid`
|
||||
var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
|
||||
b[i++] = tmh >>> 8 & 0xff;
|
||||
b[i++] = tmh & 0xff;
|
||||
|
||||
// `time_high_and_version`
|
||||
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
||||
b[i++] = tmh >>> 16 & 0xff;
|
||||
|
||||
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
||||
b[i++] = clockseq >>> 8 | 0x80;
|
||||
|
||||
// `clock_seq_low`
|
||||
b[i++] = clockseq & 0xff;
|
||||
|
||||
// `node`
|
||||
var node = options.node || _nodeId;
|
||||
for (var n = 0; n < 6; n++) {
|
||||
b[i + n] = node[n];
|
||||
}
|
||||
|
||||
return buf ? buf : unparse(b);
|
||||
}
|
||||
|
||||
// **`v4()` - Generate random UUID**
|
||||
|
||||
// See https://github.com/broofa/node-uuid for API details
|
||||
function v4(options, buf, offset) {
|
||||
// Deprecated - 'format' argument, as supported in v1.2
|
||||
var i = buf && offset || 0;
|
||||
|
||||
if (typeof(options) == 'string') {
|
||||
buf = options == 'binary' ? new BufferClass(16) : null;
|
||||
options = null;
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
var rnds = options.random || (options.rng || _rng)();
|
||||
|
||||
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
||||
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
||||
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
||||
|
||||
// Copy bytes to buffer, if provided
|
||||
if (buf) {
|
||||
for (var ii = 0; ii < 16; ii++) {
|
||||
buf[i + ii] = rnds[ii];
|
||||
}
|
||||
}
|
||||
|
||||
return buf || unparse(rnds);
|
||||
}
|
||||
|
||||
// Export public API
|
||||
var uuid = v4;
|
||||
uuid.v1 = v1;
|
||||
uuid.v4 = v4;
|
||||
uuid.parse = parse;
|
||||
uuid.unparse = unparse;
|
||||
uuid.BufferClass = BufferClass;
|
||||
|
||||
if (typeof(module) != 'undefined' && module.exports) {
|
||||
// Publish as node.js module
|
||||
module.exports = uuid;
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
// Publish as AMD module
|
||||
define(function() {return uuid;});
|
||||
if (typeof(module) != 'undefined' && module.exports) {
|
||||
// Publish as node.js module
|
||||
module.exports = uuid;
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
// Publish as AMD module
|
||||
define(function() {return uuid;});
|
||||
|
||||
} else {
|
||||
// Publish as global (in browsers)
|
||||
var _previousRoot = _global.uuid;
|
||||
|
||||
} else {
|
||||
// Publish as global (in browsers)
|
||||
var _previousRoot = _global.uuid;
|
||||
// **`noConflict()` - (browser only) to reset global 'uuid' var**
|
||||
uuid.noConflict = function() {
|
||||
_global.uuid = _previousRoot;
|
||||
return uuid;
|
||||
};
|
||||
|
||||
// **`noConflict()` - (browser only) to reset global 'uuid' var**
|
||||
uuid.noConflict = function() {
|
||||
_global.uuid = _previousRoot;
|
||||
return uuid;
|
||||
};
|
||||
|
||||
_global.uuid = uuid;
|
||||
}
|
||||
_global.uuid = uuid;
|
||||
}
|
||||
}).call(this);
|
||||
@@ -1,3 +1,3 @@
|
||||
// Create package logger using loglevel
|
||||
// https://atmospherejs.com/spacejamio/loglevel
|
||||
log = loglevel.createPackageLogger('lesiontracker', defaultLevel = 'info');
|
||||
log = loglevel.createPackageLogger('lesiontracker', defaultLevel = 'info');
|
||||
@@ -1,10 +1,10 @@
|
||||
Package.describe({
|
||||
name: "lesiontracker",
|
||||
summary: "OHIF Lesion Tracker Tools",
|
||||
version: '0.0.1'
|
||||
name: 'lesiontracker',
|
||||
summary: 'OHIF Lesion Tracker Tools',
|
||||
version: '0.0.1'
|
||||
});
|
||||
|
||||
Package.onUse(function (api) {
|
||||
Package.onUse(function(api) {
|
||||
api.versionsFrom('1.2.0.2');
|
||||
|
||||
api.use('standard-app-packages');
|
||||
@@ -15,16 +15,26 @@ Package.onUse(function (api) {
|
||||
// Our custom package
|
||||
api.use('cornerstone');
|
||||
|
||||
api.addFiles('log.js', ['client', 'server']);
|
||||
api.addFiles('log.js', [ 'client', 'server' ]);
|
||||
|
||||
api.addFiles('client/collections/LesionLocations.js', 'client');
|
||||
api.addFiles('client/collections/LocationResponses.js', 'client');
|
||||
|
||||
api.addFiles('client/compatibility/lesionTool.js', 'client', {bare: true});
|
||||
api.addFiles('client/compatibility/nonTargetTool.js', 'client', {bare: true});
|
||||
api.addFiles('client/compatibility/scaleOverlayTool.js', 'client', {bare: true});
|
||||
api.addFiles('client/compatibility/deleteLesionKeyboardTool.js', 'client', {bare: true});
|
||||
api.addFiles('client/compatibility/LesionManager.js', 'client', {bare: true});
|
||||
api.addFiles('client/compatibility/lesionTool.js', 'client', {
|
||||
bare: true
|
||||
});
|
||||
api.addFiles('client/compatibility/nonTargetTool.js', 'client', {
|
||||
bare: true
|
||||
});
|
||||
api.addFiles('client/compatibility/scaleOverlayTool.js', 'client', {
|
||||
bare: true
|
||||
});
|
||||
api.addFiles('client/compatibility/deleteLesionKeyboardTool.js', 'client', {
|
||||
bare: true
|
||||
});
|
||||
api.addFiles('client/compatibility/LesionManager.js', 'client', {
|
||||
bare: true
|
||||
});
|
||||
|
||||
api.addFiles('client/components/lesionLocationDialog/lesionLocationDialog.html', 'client');
|
||||
api.addFiles('client/components/lesionLocationDialog/lesionLocationDialog.js', 'client');
|
||||
@@ -66,10 +76,10 @@ Package.onUse(function (api) {
|
||||
|
||||
// Server functions
|
||||
api.addFiles('server/collections.js', 'server');
|
||||
api.addFiles('server/removeCollections.js', ['server']);
|
||||
api.addFiles('server/removeCollections.js', [ 'server' ]);
|
||||
|
||||
// Both client and server functions
|
||||
api.addFiles('both/collections.js', ['client', 'server']);
|
||||
api.addFiles('both/collections.js', [ 'client', 'server' ]);
|
||||
|
||||
// Library functions
|
||||
api.addFiles('lib/uuid.js', 'client');
|
||||
@@ -83,7 +93,6 @@ Package.onUse(function (api) {
|
||||
api.addFiles('lib/clearTools.js', 'client');
|
||||
api.addFiles('lib/mathUtils.js', 'client');
|
||||
|
||||
|
||||
// Export gloabal functions
|
||||
api.export('activateLesion','client');
|
||||
api.export('activateMeasurements','client');
|
||||
@@ -107,6 +116,6 @@ Package.onUse(function (api) {
|
||||
api.export('PatientLocations', 'client');
|
||||
|
||||
// Export collections spanning both client and server
|
||||
api.export('Measurements', ['client', 'server']);
|
||||
api.export('Timepoints', ['client', 'server']);
|
||||
});
|
||||
api.export('Measurements', [ 'client', 'server' ]);
|
||||
api.export('Timepoints', [ 'client', 'server' ]);
|
||||
});
|
||||
@@ -10,7 +10,6 @@ Meteor.publish('measurements', function(patientId) {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Temporary fix to drop all Collections on server restart
|
||||
// http://stackoverflow.com/questions/23891631/meteor-how-can-i-drop-all-mongo-collections-and-clear-all-data-on-startup
|
||||
Meteor.startup(function() {
|
||||
@@ -21,4 +20,4 @@ Meteor.startup(function() {
|
||||
object.remove({});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,11 +1,13 @@
|
||||
Meteor.methods({
|
||||
"removeMeasurement": function(id) {
|
||||
removeMeasurement: function(id) {
|
||||
Measurements.remove(id);
|
||||
},
|
||||
"removeMeasurementsByPatientId": function(patientId) {
|
||||
Measurements.remove({patientId: patientId});
|
||||
removeMeasurementsByPatientId: function(patientId) {
|
||||
Measurements.remove({
|
||||
patientId: patientId
|
||||
});
|
||||
},
|
||||
"decrementLesionNumbers": function(lesionData) {
|
||||
decrementLesionNumbers: function(lesionData) {
|
||||
// Update all Measurements to decrement the lesion numbers for those
|
||||
// that were created after the current lesion by 1
|
||||
|
||||
@@ -41,4 +43,4 @@ Meteor.methods({
|
||||
multi: true
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user