init
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
function ImageOrientation() {
|
||||
this.obliquityThresholdCosineValue = 0.8;
|
||||
}
|
||||
|
||||
ImageOrientation.prototype.getMajorAxisFromPatientRelativeDirectionCosine = function(x, y, z) {
|
||||
var axis = null;
|
||||
|
||||
var orientationX = x < 0 ? "R" : "L";
|
||||
var orientationY = y < 0 ? "A" : "P";
|
||||
var orientationZ = z < 0 ? "F" : "H";
|
||||
|
||||
var absX = Math.abs(x);
|
||||
var absY = Math.abs(y);
|
||||
var absZ = Math.abs(z);
|
||||
|
||||
if (absX > this.obliquityThresholdCosineValue && absX>absY && absX>absZ) {
|
||||
axis=orientationX;
|
||||
} else if (absY > this.obliquityThresholdCosineValue && absY>absX && absY>absZ) {
|
||||
axis=orientationY;
|
||||
} else if (absZ > this.obliquityThresholdCosineValue && absZ>absX && absZ>absY) {
|
||||
axis=orientationZ;
|
||||
}
|
||||
|
||||
return axis;
|
||||
}
|
||||
|
||||
ImageOrientation.prototype.makeImageOrientationLabelFromImageOrientationPatient = function(rowX, rowY, rowZ, colX, colY, colZ) {
|
||||
var label = null;
|
||||
var rowAxis = this.getMajorAxisFromPatientRelativeDirectionCosine(rowX,rowY,rowZ);
|
||||
var colAxis = this.getMajorAxisFromPatientRelativeDirectionCosine(colX,colY,colZ);
|
||||
|
||||
if ((rowAxis != null) && (colAxis != null)) {
|
||||
if (((rowAxis == "R") || (rowAxis == "L")) && ((colAxis == "A") || (colAxis == "P")))
|
||||
label="AXIAL";
|
||||
else if (((colAxis == "R") || (colAxis == "L")) && ((rowAxis == "A") || (rowAxis == "P")))
|
||||
label="AXIAL";
|
||||
else if (((rowAxis == "R") || (rowAxis == "L")) && ((colAxis == "H") || (colAxis == "F")))
|
||||
label="CORONAL";
|
||||
else if (((colAxis == "R") || (colAxis == "L")) && ((rowAxis == "H") || (rowAxis == "F")))
|
||||
label="CORONAL";
|
||||
else if (((rowAxis == "A") || (rowAxis == "P")) && ((colAxis == "H") || (colAxis == "F")))
|
||||
label="SAGITTAL";
|
||||
else if (((colAxis == "A") || (colAxis == "P")) && ((rowAxis == "H") || (rowAxis == "F")))
|
||||
label="SAGITTAL";
|
||||
} else {
|
||||
label="OBLIQUE";
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
ImageOrientation.prototype.makePatientOrientationFromPatientRelativeDirectionCosine = function(x, y, z) {
|
||||
var buffer = "";
|
||||
|
||||
var orientationX = x < 0 ? "R" : "L";
|
||||
var orientationY = y < 0 ? "A" : "P";
|
||||
var orientationZ = z < 0 ? "F" : "H";
|
||||
|
||||
var absX = Math.abs(x);
|
||||
var absY = Math.abs(y);
|
||||
var absZ = Math.abs(z);
|
||||
|
||||
for (var i=0; i<3; ++i) {
|
||||
if (absX>0.0001 && absX>absY && absX>absZ) {
|
||||
buffer += orientationX;
|
||||
absX = 0;
|
||||
} else if (absY>0.0001 && absY>absX && absY>absZ) {
|
||||
buffer += orientationY;
|
||||
absY = 0;
|
||||
} else if (absZ>0.0001 && absZ>absX && absZ>absY) {
|
||||
buffer += orientationZ;
|
||||
absZ = 0;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
ImageOrientation.prototype.getImagePlane = function(imageOrientation) {
|
||||
var imageOrientationArray = [];
|
||||
imageOrientationArray = imageOrientation.split("\\");
|
||||
var _imgRowCosx = parseFloat(imageOrientationArray[0]);
|
||||
var _imgRowCosy = parseFloat(imageOrientationArray[1]);
|
||||
var _imgRowCosz = parseFloat(imageOrientationArray[2]);
|
||||
var _imgColCosx = parseFloat(imageOrientationArray[3]);
|
||||
var _imgColCosy = parseFloat(imageOrientationArray[4]);
|
||||
var _imgColCosz = parseFloat(imageOrientationArray[5]);
|
||||
|
||||
var plane = this.makeImageOrientationLabelFromImageOrientationPatient(_imgRowCosx, _imgRowCosy, _imgRowCosz, _imgColCosx, _imgColCosy, _imgColCosz);
|
||||
return plane;
|
||||
}
|
||||
|
||||
ImageOrientation.prototype.getOrientation = function(imageOrientation) {
|
||||
var imageOrientationArray = [];
|
||||
//var imgOrientation = [];
|
||||
imageOrientationArray = imageOrientation.split("\\");
|
||||
var _imgRowCosx = parseFloat(imageOrientationArray[0]);
|
||||
var _imgRowCosy = parseFloat(imageOrientationArray[1]);
|
||||
var _imgRowCosz = parseFloat(imageOrientationArray[2]);
|
||||
var _imgColCosx = parseFloat(imageOrientationArray[3]);
|
||||
var _imgColCosy = parseFloat(imageOrientationArray[4]);
|
||||
var _imgColCosz = parseFloat(imageOrientationArray[5]);
|
||||
|
||||
imgOrientation = new Array(2);
|
||||
imgOrientation[0] = this.makePatientOrientationFromPatientRelativeDirectionCosine(_imgRowCosx, _imgRowCosy, _imgRowCosz);
|
||||
imgOrientation[1] = this.makePatientOrientationFromPatientRelativeDirectionCosine(_imgColCosx, _imgColCosy, _imgColCosz);
|
||||
|
||||
|
||||
var plane = this.makeImageOrientationLabelFromImageOrientationPatient(_imgRowCosx, _imgRowCosy, _imgRowCosz, _imgColCosx, _imgColCosy, _imgColCosz);
|
||||
|
||||
if(plane == "SAGITTAL") {
|
||||
imgOrientation[1] = imgOrientation[1].replace("H", "S");
|
||||
imgOrientation[1] = imgOrientation[1].replace("F", "I");
|
||||
}
|
||||
|
||||
return(imgOrientation[0].substring(0, Math.min(imgOrientation[0].length, 2)) + "\\" + imgOrientation[1].substring(0, Math.min(imgOrientation[1].length, 2)));
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
|
||||
// getting selected language from cookies
|
||||
var lang = getCookie('language');
|
||||
if (typeof lang == 'undefined' || lang.trim() == 'en_GB') {
|
||||
$.getScript('js/i18n/Bundle.js', function() {
|
||||
loadLabels();
|
||||
});
|
||||
} else {
|
||||
var fileName = 'js/i18n/' + "Bundle_" + lang + ".js";
|
||||
$.getScript(fileName, function() {
|
||||
loadLabels();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function loadLabels() {
|
||||
//index.html
|
||||
$(document).attr('title', languages['PageTitle']);
|
||||
$('#productName').html(languages['PageTitle'] + "<span style='font-size:15px; '> "+languages['Version'] + "</span> " );
|
||||
$('#lblPatientName').html(languages['PatientName']);
|
||||
$('#lblPatientID').html(languages['PatientId']);
|
||||
$('#lblDOB').html(languages['BirthDate']);
|
||||
$('#lblAccessionNumber').html(languages['AccessionNumber']);
|
||||
$('#lblStudyDate').html(languages['StudyDate']);
|
||||
$('#lblStudyDescription').html(languages['StudyDesc']);
|
||||
$('#lblModality').html(languages['Modality']);
|
||||
$('#lblInstanceCount').html(languages['InstanceCount']);
|
||||
|
||||
//Tools.html
|
||||
$('#lblLayout').attr('title', languages['Layout']);
|
||||
$('#lblWindowing').attr('title', languages['Windowing']);
|
||||
$('#lblZoom').attr('title', languages['Zoom']);
|
||||
$('#lblMove').attr('title', languages['Move']);
|
||||
$('#lblScoutLine').attr('title', languages['ScoutLine']);
|
||||
$('#lblScrollImages').attr('title', languages['ScrollImage']);
|
||||
$('#lblSynchronize').attr('title', languages['Synchronize']);
|
||||
$('#lblVFlip').attr('title', languages['VFlip']);
|
||||
$('#lblHFlip').attr('title', languages['HFlip']);
|
||||
$('#lblLRotate').attr('title', languages['LRotate']);
|
||||
$('#lblRRotate').attr('title', languages['RRotate']);
|
||||
$('#lblReset').attr('title', languages['Reset']);
|
||||
$('#lblInvert').attr('title', languages['Invert']);
|
||||
$('#lblTextOverlay').attr('title', languages['TextOverlay']);
|
||||
$('#lblfullscreen').attr('title', languages['FullScreen']);
|
||||
$('#lblMetadata').attr('title', languages['MetaData']);
|
||||
$('#lblLines').attr('title', languages['Lines']);
|
||||
|
||||
//config.html
|
||||
$('#lblServer').html(languages['Server']);
|
||||
$('#lblQueryParam').html(languages['QueryParam']);
|
||||
$('#lblPreferences').html(languages['Preferences']);
|
||||
|
||||
//server.html
|
||||
$('#verifyBtn').html(languages['']);
|
||||
$('#addBtn').html(languages['']);
|
||||
$('#editBtn').html(languages['']);
|
||||
$('#deleteBtn').html(languages['']);
|
||||
$('#lblDescription').html(languages['Description']);
|
||||
$('#lblAETitle').html(languages['AETitle']);
|
||||
$('#lblHostName').html(languages['HostName']);
|
||||
$('#lblDicomPort').html(languages['Port']);
|
||||
$('#lblRetrieve').html(languages['']);
|
||||
$('#lblAET').html(languages['AETitle']);
|
||||
$('#lblport').html(languages['Port']);
|
||||
$('#updateListener').html(languages['Update']);
|
||||
$('#lblIoviyamCxt').html(languages['IOviyamCxt']);
|
||||
$('#updIoviyamCxt').html(languages['Update']);
|
||||
|
||||
//query param.html
|
||||
$('#qpAddBtn').html(languages['Add']);
|
||||
$('#qpDeleteBtn').html(languages['Delete']);
|
||||
$('#lblFilterName').html(languages['FilterName']);
|
||||
$('#lblStudyDateFilter').html(languages['StudyDateFilter']);
|
||||
$('#lblStudytimeFilter').html(languages['StudytimeFilter']);
|
||||
$('#lblModalityFilter').html(languages['ModalityFilter']);
|
||||
$('#lblAutoRefresh').html(languages['AutoRefresh']);
|
||||
|
||||
//preference.html
|
||||
$('#saveSlider').html(languages['Update']);
|
||||
$('#saveTimeout').html(languages['Update']);
|
||||
$('#saveTheme').html(languages['Update']);
|
||||
$('#saveLanguage').html(languages['Update']);
|
||||
|
||||
//New Search.html
|
||||
$("label[for=patId]").text(languages['PatientId']);
|
||||
$("label[for=patName]").text(languages['PatientName']);
|
||||
$("label[for=accessionNo]").text(languages['AccessionNumber']);
|
||||
$("label[for=birthDate]").text(languages['BirthDate']);
|
||||
$("label[for=studyDesc]").text(languages['StudyDesc']);
|
||||
$("label[for=referPhysician]").text(languages['ReferPhysician']);
|
||||
$(".bdate").prev().text(languages['BirthDate']);
|
||||
$(".fsdate").prev().text(languages['FromStudyDate']);
|
||||
$(".tsdate").prev().text(languages['ToStudyDate']);
|
||||
$(".searchBtn").text(languages['Search']);
|
||||
$(".clearBtn").text(languages['Reset']);
|
||||
}
|
||||
|
||||
function getCookie(c_name)
|
||||
{
|
||||
var i, x, y, ARRcookies = document.cookie.split(";");
|
||||
for (i = 0; i < ARRcookies.length; i++)
|
||||
{
|
||||
x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
|
||||
y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
|
||||
x = x.replace(/^\s+|\s+$/g, "");
|
||||
if (x == c_name)
|
||||
{
|
||||
return unescape(y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setCookie(c_name, value, exdays)
|
||||
{
|
||||
var exdate = new Date();
|
||||
exdate.setDate(exdate.getDate() + exdays);
|
||||
var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
|
||||
document.cookie = c_name + "=" + c_value;
|
||||
}
|
||||
@@ -0,0 +1,335 @@
|
||||
var isLevelLine = false;
|
||||
var locator = null;
|
||||
var slope = null;
|
||||
|
||||
function Localizer() {
|
||||
}
|
||||
|
||||
//Static method
|
||||
Localizer.drawScout = function() {
|
||||
var frames = jQuery(window.parent.document).find('iframe');
|
||||
|
||||
if (frames.length <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
for ( var i = 0; i < frames.length; i++) {
|
||||
var contents = jQuery(frames[i]).contents();
|
||||
|
||||
if (contents.find('body').css('border') !== '1px solid rgb(255, 138, 0)') {
|
||||
|
||||
var modality = contents.find('#modalityDiv').text().indexOf('CT') >= 0 ? 'CT' : 'MR';
|
||||
|
||||
if (modality === 'CT') {
|
||||
if (jQuery('#imgType').text() === 'AXIAL' && jQuery(frames[i]).contents().find('#imgType').text() === 'LOCALIZER') {
|
||||
var sopUid = contents.find('#frameSrc').html();
|
||||
sopUid = sopUid.substring(sopUid.indexOf('objectUID=') + 10);
|
||||
|
||||
var refArr = jQuery('#refSOPInsUID').html().split(',');
|
||||
|
||||
if ((jQuery('#forUIDPanel').text() === contents.find('#forUIDPanel').text()) || jQuery.inArray(sopUid, refArr) >= 0) {
|
||||
project(contents, modality);
|
||||
}
|
||||
|
||||
} else if (jQuery(frames[i]).contents().find('#imgType').text() === 'AXIAL' && jQuery('#imgType').text() === "LOCALIZER") {
|
||||
project(contents, modality);
|
||||
} else {
|
||||
var tmpCanvas = contents.find('#canvasLayer1').get(0);
|
||||
clearCanvas(tmpCanvas.getContext('2d'), tmpCanvas.width,tmpCanvas.height);
|
||||
tmpCanvas = contents.find('#canvasLayer2').get(0);
|
||||
clearCanvas(tmpCanvas.getContext('2d'), tmpCanvas.width,tmpCanvas.height);
|
||||
}
|
||||
} else { //MR
|
||||
var sopUid = contents.find('#frameSrc').text();
|
||||
sopUid = sopUid.substring(sopUid.indexOf('objectUID=') + 10);
|
||||
var refArr = jQuery('#refSOPInsUID').html().split(',');
|
||||
|
||||
if ((jQuery('#forUIDPanel').text() === contents.find('#forUIDPanel').text()) || jQuery.inArray(sopUid, refArr) >= 0) {
|
||||
project(contents, modality)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
isLevelLine = true;
|
||||
}
|
||||
|
||||
function project(contents, modality) {
|
||||
//Current slice
|
||||
locator = new SliceLocator();
|
||||
var imgPlane = contents.find('#imgPlane').text();
|
||||
|
||||
var scoutPos = contents.find('#imgPosition').html();
|
||||
var scoutOrientation = contents.find('#imgOrientation').html();
|
||||
var scoutPixelSpacing = contents.find('#pixelSpacing').html();
|
||||
var scoutImgSize = contents.find('#imageSize').html();
|
||||
|
||||
if (scoutImgSize) {
|
||||
scoutImgSize = scoutImgSize.substring(11).split("x");
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
var scoutRow = scoutImgSize[1];
|
||||
var scoutColumn = scoutImgSize[0];
|
||||
|
||||
var zoomPer = contents.find('#zoomPercent').html();
|
||||
zoomPer = zoomPer.substring(zoomPer.indexOf(':') + 1,zoomPer.indexOf('%'))/100;
|
||||
|
||||
var canvas = contents.find('#canvasLayer2').get(0);
|
||||
var context = canvas.getContext('2d');
|
||||
|
||||
context.clearRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
context.save();
|
||||
// reset the transformation matrix
|
||||
context.setTransform(1, 0, 0, 1, 0, 0);
|
||||
// move origin to center of canvas
|
||||
context.translate((canvas.width - zoomPer * scoutColumn) / 2,(canvas.height - zoomPer * scoutRow) / 2);
|
||||
context.scale(zoomPer, zoomPer);
|
||||
|
||||
if (imgPlane === '') {
|
||||
var oImgOrient = new ImageOrientation();
|
||||
var imgOri = contents.find('#imgOrientation').html();
|
||||
imgPlane = oImgOrient.getImagePlane(imgOri);
|
||||
contents.find('#imgPlane').html(imgPlane);
|
||||
}
|
||||
|
||||
if (!isLevelLine) {
|
||||
//First and last slice
|
||||
drawBorder(contents, zoomPer, imgPlane, modality);
|
||||
}
|
||||
|
||||
// Current Slice
|
||||
var imgPos = jQuery('#imgPosition').html();
|
||||
var imgOrientation = jQuery('#imgOrientation').html();
|
||||
var imgPixelSpacing = jQuery('#pixelSpacing').html();
|
||||
var imgSize = jQuery('#imageSize').html();
|
||||
if (imgSize) {
|
||||
imgSize = imgSize.substring(11).split("x");
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
var imgRow = imgSize[1];
|
||||
var imgColumn = imgSize[0];
|
||||
|
||||
var ps = jQuery('#pixelSpacing').text();
|
||||
var cThickLoc = null;
|
||||
var cThick = null;
|
||||
|
||||
var psArr = ps.split("\\");
|
||||
ps = parseFloat(psArr[0]) / parseFloat(psArr[1]);
|
||||
|
||||
if (jQuery('#imgType').text() !== 'LOCALIZER') {
|
||||
cThickLoc = jQuery('#thickLocationPanel').html();
|
||||
cThick = parseFloat(cThickLoc.match("Thick:(.*)mm Loc")[1]);
|
||||
} else {
|
||||
cThickLoc = contents.find('#thickLocationPanel').html();
|
||||
cThick = parseFloat(cThickLoc.match("Thick:(.*)mm Loc")[1]);
|
||||
}
|
||||
|
||||
var thick = cThick * ps * zoomPer;
|
||||
thick /= 2;
|
||||
|
||||
if (imgPlane === "SAGITTAL") {
|
||||
locator.projectSlice(scoutPos, scoutOrientation, scoutPixelSpacing,
|
||||
scoutRow, scoutColumn, imgPos, imgOrientation, imgPixelSpacing,
|
||||
imgRow, imgColumn);
|
||||
drawLine(parseInt(locator.getBoxUlx()), parseInt(locator.getBoxUly()),
|
||||
parseInt(locator.getBoxLlx()), parseInt(locator.getBoxLly()),
|
||||
context, "GREEN", null);
|
||||
|
||||
drawLine(parseInt(locator.getBoxUlx()), parseInt(locator.getBoxUly())
|
||||
+ thick, parseInt(locator.getBoxLlx()), parseInt(locator
|
||||
.getBoxLly())
|
||||
+ thick, context, "GREEN", null);
|
||||
drawLine(parseInt(locator.getBoxUlx()), parseInt(locator.getBoxUly())
|
||||
- thick, parseInt(locator.getBoxLlx()), parseInt(locator
|
||||
.getBoxLly())
|
||||
- thick, context, "GREEN", null);
|
||||
} else if (imgPlane === "CORONAL" && modality === 'CT' || modality === 'MR') {
|
||||
locator.projectSlice(scoutPos, scoutOrientation, scoutPixelSpacing,
|
||||
scoutRow, scoutColumn, imgPos, imgOrientation, imgPixelSpacing,
|
||||
imgRow, imgColumn);
|
||||
drawLine(parseInt(locator.getmAxisLeftx()), parseInt(locator
|
||||
.getmAxisLefty()), parseInt(locator.getmAxisRightx()),
|
||||
parseInt(locator.getmAxisRighty()), context, "GREEN", null);
|
||||
|
||||
drawLine(parseInt(locator.getmAxisLeftx()), parseInt(locator
|
||||
.getmAxisLefty())
|
||||
+ thick, parseInt(locator.getmAxisRightx()), parseInt(locator
|
||||
.getmAxisRighty())
|
||||
+ thick, context, "GREEN", null);
|
||||
drawLine(parseInt(locator.getmAxisLeftx()), parseInt(locator
|
||||
.getmAxisLefty())
|
||||
- thick, parseInt(locator.getmAxisRightx()), parseInt(locator
|
||||
.getmAxisRighty())
|
||||
- thick, context, "GREEN", null);
|
||||
} else {
|
||||
locator.projectSlice(scoutPos, scoutOrientation, scoutPixelSpacing,
|
||||
scoutRow, scoutColumn, imgPos, imgOrientation, imgPixelSpacing,
|
||||
imgRow, imgColumn);
|
||||
drawLine(parseInt(locator.getmAxisLeftx()), parseInt(locator
|
||||
.getmAxisLefty()), parseInt(locator.getmAxisRightx()),
|
||||
parseInt(locator.getmAxisRighty()), context, "GREEN",
|
||||
parseFloat(cThick * ps * zoomPer));
|
||||
}
|
||||
|
||||
// translate the origin back to the corner of the image so the event handlers can draw in image coordinate system
|
||||
context.translate(-scoutColumn / 2 / zoomPer, -scoutRow / 2 / zoomPer);
|
||||
context.restore();
|
||||
}
|
||||
|
||||
Localizer.hideScoutLine = function() {
|
||||
var frames = jQuery(window.parent.document).find('iframe');
|
||||
for ( var i = 0; i < frames.length; i++) {
|
||||
var localCanvas = jQuery(frames[i]).contents().find('#canvasLayer1').get(0);
|
||||
if (localCanvas != null && localCanvas !== undefined) {
|
||||
clearCanvas(localCanvas.getContext('2d'), localCanvas.width,localCanvas.height);
|
||||
}
|
||||
localCanvas = jQuery(frames[i]).contents().find('#canvasLayer2').get(0);
|
||||
if (localCanvas != null && localCanvas !== undefined) {
|
||||
clearCanvas(localCanvas.getContext('2d'), localCanvas.width,localCanvas.height);
|
||||
}
|
||||
}
|
||||
isLevelLine = false;
|
||||
}
|
||||
|
||||
Localizer.toggleLevelLine = function(levelLine) {
|
||||
isLevelLine = levelLine;
|
||||
}
|
||||
|
||||
|
||||
/*Localizer.clearCanvasContent = function() {
|
||||
var localCanvas = jQuery(parent.jcanvas).siblings().get(0);
|
||||
clearCanvas(localCanvas);
|
||||
localCanvas = jQuery(parent.jcanvas).siblings().get(1);
|
||||
clearCanvas(localCanvas);
|
||||
isLevelLine = false;
|
||||
}*/
|
||||
|
||||
function drawLine(x1, y1, x2, y2, oCtx, color, lineWidth) {
|
||||
if (lineWidth != null) {
|
||||
oCtx.lineWidth = lineWidth;
|
||||
}
|
||||
|
||||
oCtx.beginPath();
|
||||
oCtx.moveTo(x1, y1);
|
||||
oCtx.lineTo(x2, y2);
|
||||
oCtx.closePath();
|
||||
oCtx.strokeStyle = color;
|
||||
oCtx.stroke();
|
||||
}
|
||||
|
||||
function clearCanvas(oCtx, width, height) {
|
||||
// Store the current transformation matrix
|
||||
oCtx.save();
|
||||
|
||||
// Use the identity matrix while clearing the canvas
|
||||
oCtx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
oCtx.clearRect(0, 0, width, height);
|
||||
|
||||
// Restore the transform
|
||||
oCtx.restore();
|
||||
}
|
||||
|
||||
function drawBorder(contents, zoomPer, imgPlane, modality) {
|
||||
var imageType = jQuery('#imgType').html();
|
||||
var firstImage = null, lastImage = null;
|
||||
|
||||
var instanceData = JSON.parse(sessionStorage[seriesUid]);
|
||||
|
||||
|
||||
for ( var i = 0; i < instanceData.length; i++) {
|
||||
if((instanceData[i])['imageType']==imageType) {
|
||||
firstImage = instanceData[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for ( var i = instanceData.length - 1; i > 0; i--) {
|
||||
if((instanceData[i])['imageType']==imageType) {
|
||||
lastImage = instanceData[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (firstImage != null && lastImage != null) {
|
||||
var imgSize = contents.find('#imageSize').html().substring(11).split("x");
|
||||
var scoutRow = imgSize[1];
|
||||
var scoutColumn = imgSize[0];
|
||||
|
||||
var canvas = contents.find('#canvasLayer1').get(0);
|
||||
var context = canvas.getContext('2d');
|
||||
|
||||
context.clearRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
context.save();
|
||||
// reset the transformation matrix
|
||||
context.setTransform(1, 0, 0, 1, 0, 0);
|
||||
// move origin to center of canvas
|
||||
context.translate((canvas.width - zoomPer * scoutColumn) / 2,
|
||||
(canvas.height - zoomPer * scoutRow) / 2);
|
||||
context.scale(zoomPer, zoomPer);
|
||||
|
||||
slope = null;
|
||||
projectBorder(contents, firstImage, context, imgPlane, modality,
|
||||
zoomPer);
|
||||
projectBorder(contents, lastImage, context, imgPlane, modality, zoomPer);
|
||||
|
||||
// translate the origin back to the corner of the image so the event handlers can draw in image coordinate system
|
||||
context.translate(-scoutColumn / 2 / zoomPer, -scoutRow / 2 / zoomPer);
|
||||
context.restore();
|
||||
}
|
||||
}
|
||||
|
||||
function projectBorder(contents, dataset, context, imgPlane, modality, zoomPer) {
|
||||
var scoutPos = contents.find('#imgPosition').html();
|
||||
var scoutOrientation = contents.find('#imgOrientation').html();
|
||||
var scoutPixelSpacing = contents.find('#pixelSpacing').html();
|
||||
var imgSize = contents.find('#imageSize').html().substring(11).split("x");
|
||||
var scoutRow = imgSize[1];
|
||||
var scoutColumn = imgSize[0];
|
||||
|
||||
var imgPos = dataset['imagePositionPatient'];
|
||||
var imgOrientation = dataset['imageOrientPatient'];
|
||||
var imgPixelSpacing = dataset['pixelSpacing'];
|
||||
var imgRow = dataset['nativeRows'];
|
||||
var imgColumn = dataset['nativeColumns'];
|
||||
|
||||
locator.projectSlice(scoutPos, scoutOrientation, scoutPixelSpacing,
|
||||
scoutRow, scoutColumn, imgPos, imgOrientation, imgPixelSpacing,
|
||||
imgRow, imgColumn);
|
||||
|
||||
if (modality === "MR") {
|
||||
var slp = findSlope(parseInt(locator.getBoxUlx() * zoomPer),
|
||||
parseInt(locator.getBoxUly() * zoomPer), parseInt(locator
|
||||
.getBoxLlx()
|
||||
* zoomPer), parseInt(locator.getBoxLly() * zoomPer));
|
||||
if (slope == null) {
|
||||
slope = slp;
|
||||
} else {
|
||||
if (slp != slope) {
|
||||
canvas = contents.find('#canvasLayer1').get(0);
|
||||
clearCanvas(canvas.getContext('2d'), canvas.width,canvas.height);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (imgPlane == "SAGITTAL") {
|
||||
drawLine(parseInt(locator.getBoxUlx()), parseInt(locator.getBoxUly()),
|
||||
parseInt(locator.getBoxLlx()), parseInt(locator.getBoxLly()),
|
||||
context, "YELLOW", null);
|
||||
|
||||
} else {
|
||||
drawLine(parseInt(locator.getmAxisLeftx()), parseInt(locator
|
||||
.getmAxisLefty()), parseInt(locator.getmAxisRightx()),
|
||||
parseInt(locator.getmAxisRighty()), context, "YELLOW", null);
|
||||
}
|
||||
}
|
||||
|
||||
function findSlope(x1, y1, x2, y2) {
|
||||
var sl = (y2-y1)!=0 ? (y2 - y1) / (x2 - x1) : 0;
|
||||
return sl;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
function ScoutLineModel(seriesUid) {
|
||||
this.seriesUid = seriesUid;
|
||||
this.imgPosition = null;
|
||||
this.imgOrientation = null;
|
||||
this.pixelSpacing = null;
|
||||
this.rows = null;
|
||||
this.columns = null;
|
||||
this.instanceNo = null;
|
||||
|
||||
this.getImgPosition = function() {
|
||||
return this.imgPosition;
|
||||
}
|
||||
|
||||
this.getImgOrientation = function() {
|
||||
return this.imgOrientation;
|
||||
}
|
||||
|
||||
this.getPixelSpacing = function() {
|
||||
return this.pixelSpacing;
|
||||
}
|
||||
|
||||
this.getRows = function() {
|
||||
return this.rows;
|
||||
}
|
||||
|
||||
this.getColumns = function() {
|
||||
return this.columns;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,532 @@
|
||||
function SliceLocator() {
|
||||
this.scoutRowCosx = 0;
|
||||
this.scoutRowCosy = 0;
|
||||
this.scoutRowCosz = 0;
|
||||
this.scoutColCosx = 0;
|
||||
this.scoutColCosy = 0;
|
||||
this.scoutColCosz = 0;
|
||||
this.scoutx = 0;
|
||||
this.scouty = 0;
|
||||
this.scoutz = 0;
|
||||
this.imgRowCosx = 0;
|
||||
this.imgRowCosy = 0;
|
||||
this.imgRowCosz = 0;
|
||||
this.imgColCosx = 0;
|
||||
this.imgColCosy = 0;
|
||||
this.imgColCosz = 0;
|
||||
this.imgx = 0;
|
||||
this.imgy = 0;
|
||||
this.imgz = 0;
|
||||
this.nrmCosX = 0;
|
||||
this.nrmCosY = 0;
|
||||
this.nrmCosZ = 0;
|
||||
this.scoutxSpacing = 0;
|
||||
this.scoutySpacing = 0;
|
||||
this.imgxSpacing = 0;
|
||||
this.imgySpacing = 0;
|
||||
this.scoutValid = false;
|
||||
this.imgValid = false;
|
||||
this.scoutPosX = 0;
|
||||
this.scoutPosY = 0;
|
||||
this.scoutPosZ = 0;
|
||||
this.scoutRowLen = 0;
|
||||
this.scoutColLen = 0;
|
||||
this.scoutRows = 0;
|
||||
this.scoutCols = 0;
|
||||
this.imgRowLen = 0;
|
||||
this.imgColLen = 0;
|
||||
this.imgRows = 0;
|
||||
this.imgCols = 0;
|
||||
this.boxUlx = 0;
|
||||
this.boxUly = 0;
|
||||
this.boxUrx = 0;
|
||||
this.boxUry = 0;
|
||||
this.boxLrx = 0;
|
||||
this.boxLry = 0;
|
||||
this.boxLlx = 0;
|
||||
this.boxLly = 0;
|
||||
this.mAxisTopx = 0;
|
||||
this.mAxisTopy = 0;
|
||||
this.mAxisRightx = 0;
|
||||
this.mAxisRighty = 0;
|
||||
this.mAxisBottomx = 0;
|
||||
this.mAxisBottomy = 0;
|
||||
this.mAxisLeftx = 0;
|
||||
this.mAxisLefty = 0;
|
||||
|
||||
this.getBoxLlx = function() {
|
||||
return this.boxLlx;
|
||||
}
|
||||
|
||||
this.getBoxLly = function() {
|
||||
return this.boxLly;
|
||||
}
|
||||
|
||||
this.getBoxLrx = function() {
|
||||
return this.boxLrx;
|
||||
}
|
||||
|
||||
this.getBoxLry = function() {
|
||||
return this.boxLry;
|
||||
}
|
||||
|
||||
this.getBoxUlx = function() {
|
||||
return this.boxUlx;
|
||||
}
|
||||
|
||||
this.getBoxUly = function() {
|
||||
return this.boxUly;
|
||||
}
|
||||
|
||||
this.getBoxUrx = function() {
|
||||
return this.boxUrx;
|
||||
}
|
||||
|
||||
this.getBoxUry = function() {
|
||||
return this.boxUry;
|
||||
}
|
||||
|
||||
this.getmAxisBottomx = function() {
|
||||
return this.mAxisBottomx;
|
||||
}
|
||||
|
||||
this.getmAxisBottomy = function() {
|
||||
return this.mAxisBottomy;
|
||||
}
|
||||
|
||||
this.getmAxisLeftx = function() {
|
||||
return this.mAxisLeftx;
|
||||
}
|
||||
|
||||
this.getmAxisLefty = function() {
|
||||
return this.mAxisLefty;
|
||||
}
|
||||
|
||||
this.getmAxisRightx = function() {
|
||||
return this.mAxisRightx;
|
||||
}
|
||||
|
||||
this.getmAxisRighty = function() {
|
||||
return this.mAxisRighty;
|
||||
}
|
||||
|
||||
this.getmAxisTopx = function() {
|
||||
return this.mAxisTopx;
|
||||
}
|
||||
|
||||
this.getmAxisTopy = function() {
|
||||
return this.mAxisTopy;
|
||||
}
|
||||
|
||||
this.projectSlice = projectSlicing;
|
||||
}
|
||||
|
||||
SliceLocator.prototype.setScoutPosition = function (scoutPosition) {
|
||||
var retVal = true;
|
||||
var _scoutPositionArray = [];
|
||||
// set the member variables
|
||||
// _mScoutx, _mScouty, _mScoutz to the actual position information
|
||||
// if the input pointer is null or the string is empty set all position to 0 and
|
||||
// set the position valid flag (_mScoutvalid) to false
|
||||
retVal = this.checkPosString(scoutPosition);
|
||||
if (retVal) {
|
||||
_scoutPositionArray = scoutPosition.split("\\");
|
||||
this.scoutx = parseFloat(_scoutPositionArray[0]);
|
||||
this.scouty = parseFloat(_scoutPositionArray[1]);
|
||||
this.scoutz = parseFloat(_scoutPositionArray[2]);
|
||||
this.scoutValid = true;
|
||||
} else {
|
||||
// The Pos contains no valid information it is assumed that the sout position is to be clweared of all valid
|
||||
// entries
|
||||
this.clearScout();
|
||||
}
|
||||
return (retVal);
|
||||
}
|
||||
|
||||
SliceLocator.prototype.setScoutOrientation = function(scoutOrientation) {
|
||||
var retVal;
|
||||
var scoutOrientationArray = [];
|
||||
// Scna the sout orientation vactor into the local variables and chack it for validity
|
||||
retVal = this.checkVectorString(scoutOrientation);
|
||||
if (retVal) {
|
||||
scoutOrientationArray = scoutOrientation.split("\\");
|
||||
this.scoutRowCosx = parseFloat(scoutOrientationArray[0]);
|
||||
this.scoutRowCosy = parseFloat(scoutOrientationArray[1]);
|
||||
this.scoutRowCosz = parseFloat(scoutOrientationArray[2]);
|
||||
this.scoutColCosx = parseFloat(scoutOrientationArray[3]);
|
||||
this.scoutColCosy = parseFloat(scoutOrientationArray[4]);
|
||||
this.scoutColCosz = parseFloat(scoutOrientationArray[5]);
|
||||
this.scoutValid = this.checkScoutVector();
|
||||
if (!this.scoutValid) {
|
||||
this.clearScout();
|
||||
}
|
||||
}
|
||||
return (retVal);
|
||||
}
|
||||
|
||||
SliceLocator.prototype.clearScout = function() {
|
||||
// clear all the scout parameters and set the scout valid flag to false.
|
||||
this.scoutRowCosx = 0;
|
||||
this.scoutRowCosy = 0;
|
||||
this.scoutRowCosz = 0;
|
||||
this.scoutColCosx = 0;
|
||||
this.scoutColCosy = 0;
|
||||
this.scoutColCosz = 0;
|
||||
this.scoutx = 0;
|
||||
this.scouty = 0;
|
||||
this.scoutz = 0;
|
||||
this.scoutValid = false;
|
||||
}
|
||||
|
||||
SliceLocator.prototype.clearImg = function() {
|
||||
// clear all the image prameters and set the image valid flag to false.
|
||||
this.imgRowCosx = 0;
|
||||
this.imgRowCosy = 0;
|
||||
this.imgRowCosz = 0;
|
||||
this.imgColCosx = 0;
|
||||
this.imgColCosy = 0;
|
||||
this.imgColCosz = 0;
|
||||
this.imgx = 0;
|
||||
this.imgy = 0;
|
||||
this.imgz = 0;
|
||||
this.imgValid = false;
|
||||
}
|
||||
|
||||
SliceLocator.prototype.setImgPosition = function(imagePosition) {
|
||||
var retVal = true;
|
||||
var _imgPositionArray = [];
|
||||
// set the member variables
|
||||
// _mImgx, _mImgy, _mImgz to the actual position information
|
||||
// if the input pointer is null or the string is empty set all position to 0 and
|
||||
// set the position valid flag (_mImgvalid) to false
|
||||
retVal = this.checkPosString(imagePosition);
|
||||
if (retVal) {
|
||||
// the position information contains valid data. It has been checked prior to
|
||||
// the activation of theis member function
|
||||
_imgPositionArray = imagePosition.split("\\");
|
||||
this.imgx = parseFloat(_imgPositionArray[0]);
|
||||
this.imgy = parseFloat(_imgPositionArray[1]);
|
||||
this.imgz = parseFloat(_imgPositionArray[2]);
|
||||
|
||||
this.imgValid = true;
|
||||
} else {
|
||||
// The Pos contains no valid information it is assumed that the sout position is to be clweared of all valid
|
||||
// entries
|
||||
this.clearImg();
|
||||
}
|
||||
return (retVal);
|
||||
}
|
||||
|
||||
SliceLocator.prototype.setImgOrientation = function(imageOrientation) {
|
||||
var retVal;
|
||||
var imageOrientationArray = [];
|
||||
// Scna the sout orientation vactor into the local variables and chack it for validity
|
||||
retVal = this.checkVectorString(imageOrientation);
|
||||
if (retVal) {
|
||||
imageOrientationArray = imageOrientation.split("\\");
|
||||
this.imgRowCosx = parseFloat(imageOrientationArray[0]);
|
||||
this.imgRowCosy = parseFloat(imageOrientationArray[1]);
|
||||
this.imgRowCosz = parseFloat(imageOrientationArray[2]);
|
||||
this.imgColCosx = parseFloat(imageOrientationArray[3]);
|
||||
this.imgColCosy = parseFloat(imageOrientationArray[4]);
|
||||
this.imgColCosz = parseFloat(imageOrientationArray[5]);
|
||||
this.imgValid = this.checkImgVector();
|
||||
|
||||
if (!this.imgValid) {
|
||||
this.clearImg();
|
||||
}
|
||||
}
|
||||
return (retVal);
|
||||
}
|
||||
|
||||
SliceLocator.prototype.checkScoutVector = function() {
|
||||
var retVal;
|
||||
|
||||
// check the row vector and check the column vector
|
||||
retVal = this.checkVector(this.scoutRowCosx, this.scoutRowCosy, this.scoutRowCosz);
|
||||
retVal = this.checkVector(this.scoutColCosx, this.scoutColCosy, this.scoutColCosz);
|
||||
return (retVal);
|
||||
}
|
||||
|
||||
SliceLocator.prototype.checkImgVector = function() {
|
||||
var retVal;
|
||||
// check the row vector and check the column vector
|
||||
retVal = this.checkVector(this.imgRowCosx, this.imgRowCosy, this.imgRowCosz);
|
||||
retVal = this.checkVector(this.imgColCosx, this.imgColCosy, this.imgColCosz);
|
||||
return (retVal);
|
||||
}
|
||||
|
||||
SliceLocator.prototype.checkPosString = function(position) {
|
||||
var retVal = true;
|
||||
var positionArray = [];
|
||||
positionArray = position.split("\\");
|
||||
for (var i = 0; i < positionArray.length; i++) {
|
||||
if (positionArray[i].match("((-|\\+)?[0-9]+(\\.[0-9]+)?)+")) {
|
||||
retVal = true;
|
||||
} else {
|
||||
retVal = false;
|
||||
}
|
||||
}
|
||||
//I just want to check the existance of the numeric values in the position.
|
||||
return retVal;
|
||||
}
|
||||
|
||||
SliceLocator.prototype.checkVectorString = function(vector) {
|
||||
var retVal = true;
|
||||
var vectorArray = [];
|
||||
vectorArray = vector.split("\\");
|
||||
for (var i = 0; i < vectorArray.length; i++) {
|
||||
if (vectorArray[i].match("((-|\\+)?[0-9]+(\\.[0-9]+)?)+")) {
|
||||
retVal = true;
|
||||
} else {
|
||||
retVal = false;
|
||||
}
|
||||
}
|
||||
//I just want to check the existance of the vector string.
|
||||
return retVal;
|
||||
}
|
||||
|
||||
SliceLocator.prototype.checkVector = function(CosX, CosY, CosZ) {
|
||||
// Check if the vector passed is a unit vector
|
||||
if (Math.abs(CosX * CosX + CosY * CosY + CosZ * CosZ - 1) < 0) {
|
||||
return (false);
|
||||
} else {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
SliceLocator.prototype.normalizeScout = function() {
|
||||
// first create the scout normal vector
|
||||
this.nrmCosX = this.scoutRowCosy * this.scoutColCosz - this.scoutRowCosz * this.scoutColCosy;
|
||||
this.nrmCosY = this.scoutRowCosz * this.scoutColCosx - this.scoutRowCosx * this.scoutColCosz;
|
||||
this.nrmCosZ = this.scoutRowCosx * this.scoutColCosy - this.scoutRowCosy * this.scoutColCosx;
|
||||
return (this.checkVector(this.nrmCosX, this.nrmCosY, this.nrmCosZ));
|
||||
}
|
||||
|
||||
SliceLocator.prototype.setScoutSpacing = function(scoutPixelSpacing) {
|
||||
// Convert the pixelspacing for the scout image and return true if both values are > 0
|
||||
// the pixel spacing is specified in adjacent row/adjacent column spacing
|
||||
// in this code ..xSpacing refers to column spacing
|
||||
var scoutPixelSpacingArray = [];
|
||||
scoutPixelSpacingArray = scoutPixelSpacing.split("\\");
|
||||
this.scoutxSpacing = parseFloat(scoutPixelSpacingArray[1]);
|
||||
this.scoutySpacing = parseFloat(scoutPixelSpacingArray[0]);
|
||||
if (this.scoutxSpacing == 0 || this.scoutySpacing == 0) {
|
||||
return (false);
|
||||
} else {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
SliceLocator.prototype.setImgSpacing = function(imgPixelSpacing) {
|
||||
// Convert the pixelspacing for the Img image and return true if both values are > 0
|
||||
// the pixel spacing is specified in adjacent row/adjacent column spacing
|
||||
// in this code ..xSpacing refers to column spacing
|
||||
var imgPixelSpacingArray = [];
|
||||
imgPixelSpacingArray = imgPixelSpacing.split("\\");
|
||||
|
||||
this.imgxSpacing = parseFloat(imgPixelSpacingArray[1]);
|
||||
this.imgySpacing = parseFloat(imgPixelSpacingArray[0]);
|
||||
if (this.imgxSpacing == 0 || this.imgySpacing == 0) {
|
||||
return (false);
|
||||
} else {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
SliceLocator.prototype.rotateImage = function(imgPosx, imgPosy, imgPosz) {
|
||||
// projet the points passed into the space of the normalized scout image
|
||||
|
||||
this.scoutPosX = this.scoutRowCosx * imgPosx + this.scoutRowCosy * imgPosy + this.scoutRowCosz * imgPosz;
|
||||
this.scoutPosY = this.scoutColCosx * imgPosx + this.scoutColCosy * imgPosy + this.scoutColCosz * imgPosz;
|
||||
this.scoutPosZ = this.nrmCosX * imgPosx + this.nrmCosY * imgPosy + this.nrmCosZ * imgPosz;
|
||||
return (true);
|
||||
}
|
||||
|
||||
SliceLocator.prototype.setScoutDimensions = function() {
|
||||
this.scoutRowLen = this.scoutRows * this.scoutxSpacing;
|
||||
this.scoutColLen = this.scoutCols * this.scoutySpacing;
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
SliceLocator.prototype.setImgDimensions = function() {
|
||||
this.imgRowLen = this.imgRows * this.imgxSpacing;
|
||||
this.imgColLen = this.imgCols * this.imgySpacing;
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
SliceLocator.prototype.calculateBoundingBox = function() {
|
||||
// the four points in 3d space that defines the corners of the bounding box
|
||||
var posX = new Array(4);
|
||||
var posY = new Array(4);
|
||||
var posZ = new Array(4);
|
||||
var rowPixel = new Array(4);
|
||||
var colPixel = new Array(4);
|
||||
var i;
|
||||
|
||||
// upper left hand Corner
|
||||
posX[0] = this.imgx;
|
||||
posY[0] = this.imgy;
|
||||
posZ[0] = this.imgz;
|
||||
|
||||
// upper right hand corner
|
||||
|
||||
posX[1] = posX[0] + this.imgRowCosx * this.imgRowLen;
|
||||
posY[1] = posY[0] + this.imgRowCosy * this.imgRowLen;
|
||||
posZ[1] = posZ[0] + this.imgRowCosz * this.imgRowLen;
|
||||
|
||||
// Buttom right hand corner
|
||||
|
||||
posX[2] = posX[1] + this.imgColCosx * this.imgColLen;
|
||||
posY[2] = posY[1] + this.imgColCosy * this.imgColLen;
|
||||
posZ[2] = posZ[1] + this.imgColCosz * this.imgColLen;
|
||||
|
||||
// bottom left hand corner
|
||||
|
||||
posX[3] = posX[0] + this.imgColCosx * this.imgColLen;
|
||||
posY[3] = posY[0] + this.imgColCosy * this.imgColLen;
|
||||
posZ[3] = posZ[0] + this.imgColCosz * this.imgColLen;
|
||||
|
||||
// Go through all four corners
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
// we want to view the source slice from the "point of view" of
|
||||
// the target localizer, i.e. a parallel projection of the source
|
||||
// onto the target
|
||||
|
||||
// do this by imaging that the target localizer is a view port
|
||||
// into a relocated and rotated co-ordinate space, where the
|
||||
// viewport has a row vector of +X, col vector of +Y and normal +Z,
|
||||
// then the X and Y values of the projected target correspond to
|
||||
// row and col offsets in mm from the TLHC of the localizer image !
|
||||
|
||||
// move everything to origin of target
|
||||
posX[i] -= this.scoutx;
|
||||
posY[i] -= this.scouty;
|
||||
posZ[i] -= this.scoutz;
|
||||
|
||||
this.rotateImage(posX[i], posY[i], posZ[i]);
|
||||
// at this point the position contains the location on the scout image. calculate the pixel position
|
||||
// dicom coordinates are center of pixel 1\1
|
||||
colPixel[i] = parseInt(this.scoutPosX / this.scoutySpacing + 0.5);
|
||||
rowPixel[i] = parseInt(this.scoutPosY / this.scoutxSpacing + 0.5);
|
||||
}
|
||||
// sort out the column and row pixel coordinates into the bounding box named coordinates
|
||||
// same order as the position ULC -> URC -> BRC -> BLC
|
||||
this.boxUlx = colPixel[0];
|
||||
this.boxUly = rowPixel[0];
|
||||
this.boxUrx = colPixel[1];
|
||||
this.boxUry = rowPixel[1];
|
||||
this.boxLrx = colPixel[2];
|
||||
this.boxLry = rowPixel[2];
|
||||
this.boxLlx = colPixel[3];
|
||||
this.boxLly = rowPixel[3];
|
||||
|
||||
//console.log(this.boxUlx + " : " + this.boxUly + " : " + this.boxLlx + " : " + this.boxLly);
|
||||
}
|
||||
|
||||
function projectSlicing(scoutPos, scoutOrient, scoutPixSpace, scoutRows, scoutCols, imgPos, imgOrient, imgPixSpace, imgRows, imgCols) {
|
||||
var retVal = true;
|
||||
|
||||
// Fisrs step check if either the scout or the image has to be updated.
|
||||
|
||||
if (scoutPos != null && scoutOrient != null && scoutPixSpace != null && scoutRows != -1 && scoutCols != -1) {
|
||||
// scout parameters appear to be semi-valid try to update the scout information
|
||||
if (this.setScoutPosition(scoutPos) && this.setScoutOrientation(scoutOrient) && this.setScoutSpacing(scoutPixSpace)) {
|
||||
this.scoutRows = scoutRows;
|
||||
this.scoutCols = scoutCols;
|
||||
this.setScoutDimensions();
|
||||
retVal = this.normalizeScout();
|
||||
}
|
||||
}
|
||||
// Image and scout information is independent of one and other
|
||||
if (imgPos != null && imgOrient != null && imgPixSpace != null && imgRows != -1 && imgCols != -1) {
|
||||
// Img parameters appear to be semi-valid try to update the Img information
|
||||
if (this.setImgPosition(imgPos) && this.setImgOrientation(imgOrient) && this.setImgSpacing(imgPixSpace)) {
|
||||
this.imgRows = imgRows;
|
||||
this.imgCols = imgCols;
|
||||
|
||||
this.setImgDimensions();
|
||||
}
|
||||
}
|
||||
if (retVal) {
|
||||
// start the calculation of the projected bounding box and the ends of the axes along the sides.
|
||||
this.calculateBoundingBox();
|
||||
this.calculateAxisPoints();
|
||||
}
|
||||
return (retVal);
|
||||
}
|
||||
|
||||
SliceLocator.prototype.calculateAxisPoints = function() {
|
||||
|
||||
// the four points in 3d space that defines the corners of the bounding box
|
||||
var posX = new Array(4);
|
||||
var posY = new Array(4);
|
||||
var posZ = new Array(4);
|
||||
var rowPixel = new Array(4);
|
||||
var colPixel = new Array(4);
|
||||
var i;
|
||||
|
||||
// upper center
|
||||
posX[0] = this.imgx + this.imgRowCosx * this.imgRowLen / 2;
|
||||
posY[0] = this.imgy + this.imgRowCosy * this.imgRowLen / 2;
|
||||
posZ[0] = this.imgz + this.imgRowCosz * this.imgRowLen / 2;
|
||||
|
||||
// right hand center
|
||||
|
||||
posX[1] = this.imgx + this.imgRowCosx * this.imgRowLen + this.imgColCosx * this.imgColLen / 2;
|
||||
posY[1] = this.imgy + this.imgRowCosy * this.imgRowLen + this.imgColCosy * this.imgColLen / 2;
|
||||
posZ[1] = this.imgz + this.imgRowCosz * this.imgRowLen + this.imgColCosz * this.imgColLen / 2;
|
||||
|
||||
// Bottom center
|
||||
|
||||
posX[2] = posX[0] + this.imgColCosx * this.imgColLen;
|
||||
posY[2] = posY[0] + this.imgColCosy * this.imgColLen;
|
||||
posZ[2] = posZ[0] + this.imgColCosz * this.imgColLen;
|
||||
|
||||
// left hand center
|
||||
|
||||
posX[3] = this.imgx + this.imgColCosx * this.imgColLen / 2;
|
||||
posY[3] = this.imgy + this.imgColCosy * this.imgColLen / 2;
|
||||
posZ[3] = this.imgz + this.imgColCosz * this.imgColLen / 2;
|
||||
|
||||
// Go through all four corners
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
// we want to view the source slice from the "point of view" of
|
||||
// the target localizer, i.e. a parallel projection of the source
|
||||
// onto the target
|
||||
|
||||
// do this by imaging that the target localizer is a view port
|
||||
// into a relocated and rotated co-ordinate space, where the
|
||||
// viewport has a row vector of +X, col vector of +Y and normal +Z,
|
||||
// then the X and Y values of the projected target correspond to
|
||||
// row and col offsets in mm from the TLHC of the localizer image !
|
||||
|
||||
// move everything to origin of target
|
||||
posX[i] -= this.scoutx;
|
||||
posY[i] -= this.scouty;
|
||||
posZ[i] -= this.scoutz;
|
||||
|
||||
this.rotateImage(posX[i], posY[i], posZ[i]);
|
||||
// at this point the position contains the location on the scout image. calculate the pixel position
|
||||
// dicom coordinates are center of pixel 1\1
|
||||
colPixel[i] = parseInt(this.scoutPosX / this.scoutySpacing + 0.5);
|
||||
rowPixel[i] = parseInt(this.scoutPosY / this.scoutxSpacing + 0.5);
|
||||
}
|
||||
// sort out the column and row pixel coordinates into the bounding box axis named coordinates
|
||||
// same order as the position top -> right -> bottom -> left
|
||||
this.mAxisTopx = colPixel[0];
|
||||
this.mAxisTopy = rowPixel[0];
|
||||
this.mAxisRightx = colPixel[1];
|
||||
this.mAxisRighty = rowPixel[1];
|
||||
this.mAxisBottomx = colPixel[2];
|
||||
this.mAxisBottomy = rowPixel[2];
|
||||
this.mAxisLeftx = colPixel[3];
|
||||
this.mAxisLefty = rowPixel[3];
|
||||
|
||||
//console.log(parseInt(this.mAxisLeftx) + " : " + parseInt(this.mAxisLefty) + " : " + parseInt(this.mAxisRightx) + " : " + parseInt(this.mAxisRighty) + " : " + parseInt(this.mAxisTopx) + " : " + parseInt(this.mAxisTopy) + " : " + parseInt(this.mAxisBottomx) + " : " + parseInt(this.mAxisBottomy));
|
||||
|
||||
}
|
||||
@@ -0,0 +1,629 @@
|
||||
/**
|
||||
* Definition of shape
|
||||
*/
|
||||
ovm.shape.angle = function() {
|
||||
var handleSize = 5;
|
||||
var angles = [];
|
||||
this.curr_angle = null;
|
||||
this.isCurrentDrawingAngle = false;
|
||||
|
||||
this.initAngle = function() {
|
||||
this.curr_angle = new ovm.angle();
|
||||
};
|
||||
|
||||
this.angleStarted = function() {
|
||||
return this.curr_angle!=null;
|
||||
};
|
||||
|
||||
this.drawAngle = function(canvasCtx) {
|
||||
canvasCtx.save();
|
||||
this.draw(canvasCtx,this.curr_angle);
|
||||
canvasCtx.restore();
|
||||
};
|
||||
|
||||
this.draw = function(canvasCtx,graphic) {
|
||||
canvasCtx.strokeStyle=canvasCtx.fillStyle='orange';
|
||||
canvasCtx.lineWidth='2';
|
||||
canvasCtx.beginPath();
|
||||
canvasCtx.moveTo(graphic.xA,graphic.yA);
|
||||
canvasCtx.lineTo(graphic.x0,graphic.y0);
|
||||
if(graphic.xB!=undefined && graphic.yB!=undefined) {
|
||||
canvasCtx.lineTo(graphic.xB,graphic.yB);
|
||||
}
|
||||
canvasCtx.stroke();
|
||||
canvasCtx.closePath();
|
||||
|
||||
if(graphic.arcAngle1!=undefined && graphic.arcAngle2!=undefined) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.beginPath();
|
||||
canvasCtx.moveTo(graphic.x0,graphic.y0);
|
||||
canvasCtx.arc(graphic.x0,graphic.y0,graphic.arcRadius,graphic.arcAngle1,graphic.arcAngle2,graphic.counterClockwise);
|
||||
canvasCtx.closePath();
|
||||
canvasCtx.stroke();
|
||||
canvasCtx.restore();
|
||||
}
|
||||
|
||||
// Handles
|
||||
canvasCtx.strokeStyle=canvasCtx.fillStyle=graphic.active ? 'red' : 'white';
|
||||
canvasCtx.beginPath();
|
||||
canvasCtx.fillRect(graphic.xA-handleSize,graphic.yA-handleSize,handleSize*2,handleSize*2);
|
||||
canvasCtx.fillRect(graphic.x0-handleSize,graphic.y0-handleSize,handleSize*2,handleSize*2);
|
||||
canvasCtx.fillRect(graphic.xB-handleSize,graphic.yB-handleSize,handleSize*2,handleSize*2);
|
||||
canvasCtx.closePath();
|
||||
|
||||
// Text
|
||||
if(graphic.angle!=undefined) {
|
||||
canvasCtx.beginPath();
|
||||
canvasCtx.fillStyle = !graphic.txtActive ? "maroon" : "blue";
|
||||
canvasCtx.globalAlpha = 0.7;
|
||||
canvasCtx.font = "14px Arial";
|
||||
var text = canvasCtx.measureText(graphic.angle);
|
||||
canvasCtx.fillRect(graphic.textX,graphic.textY,Math.ceil(text.width)+5,20);
|
||||
canvasCtx.globalAlpha = 0.9;
|
||||
canvasCtx.fillStyle = "white";
|
||||
//canvasCtx.fillText(graphic.angle,graphic.textX+2,graphic.textY+15);
|
||||
|
||||
if(state.hflip && !state.vflip && !state.rotate!=0 && !this.isCurrentDrawingAngle){
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width,0);
|
||||
canvasCtx.scale(-1,1);
|
||||
canvasCtx.fillText(graphic.angle,(drawCanvas.width - graphic.textX)-60,graphic.textY+14);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
if(state.vflip && !state.hflip && !state.rotate!=0 && !this.isCurrentDrawingAngle){
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(0,drawCanvas.height);
|
||||
canvasCtx.scale(1,-1);
|
||||
canvasCtx.fillText(graphic.angle, graphic.textX,(drawCanvas.height -graphic.textY));
|
||||
canvasCtx.restore();
|
||||
}
|
||||
|
||||
if(!state.vflip && state.hflip && (state.rotate===90 || state.rotate===180 || state.rotate===270) && !this.isCurrentDrawingAngle){
|
||||
if(state.rotate===90 || state.rotate===180 || state.rotate===270) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(0,drawCanvas.height);
|
||||
canvasCtx.scale(1,-1);
|
||||
canvasCtx.fillText(graphic.angle,graphic.textX,(drawCanvas.height -graphic.textY));
|
||||
canvasCtx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
if(state.vflip && !state.hflip && (state.rotate===90 || state.rotate===180 || state.rotate===270) && !this.isCurrentDrawingAngle){
|
||||
if(state.rotate===90 || state.rotate===180 || state.rotate===270) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width,0);
|
||||
canvasCtx.scale(-1,1);
|
||||
canvasCtx.fillText(graphic.angle, (drawCanvas.width - graphic.textX)-60, graphic.textY+14);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
if(state.rotate!=0 && !state.vflip && !state.hflip && !this.isCurrentDrawingAngle) {
|
||||
if(state.rotate===180) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width/2,drawCanvas.height/2);
|
||||
canvasCtx.rotate(Math.PI);
|
||||
canvasCtx.translate(-drawCanvas.width/2,-drawCanvas.height/2);
|
||||
canvasCtx.fillText(graphic.angle, (drawCanvas.width -graphic.textX)-60,(drawCanvas.height -graphic.textY));
|
||||
canvasCtx.restore();
|
||||
}
|
||||
else {
|
||||
canvasCtx.fillText(graphic.angle,graphic.textX+2,graphic.textY+14);
|
||||
}
|
||||
}
|
||||
|
||||
if((state.rotate===0 || state.rotate===90 || state.rotate===180 || state.rotate===270) && state.vflip && state.hflip && !this.isCurrentDrawingAngle) {
|
||||
if(state.rotate===0) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width,drawCanvas.height);
|
||||
canvasCtx.scale(-1,-1);
|
||||
canvasCtx.fillText(graphic.angle, (drawCanvas.width -graphic.textX)-60,(drawCanvas.height -graphic.textY));
|
||||
canvasCtx.restore();
|
||||
}
|
||||
else {
|
||||
canvasCtx.fillText(graphic.angle,graphic.textX+2,graphic.textY+14);
|
||||
}
|
||||
}
|
||||
//if((!state.rotate===0 || !state.rotate===90 || !state.rotate===180 || !state.rotate===270) && state.hflip && state.vflip) {
|
||||
//console.log("if(state.hflip && state.vflip) called state.rotate="+state.rotate);
|
||||
//canvasCtx.save();
|
||||
//canvasCtx.translate(drawCanvas.width,drawCanvas.height);
|
||||
//canvasCtx.scale(-1,-1);
|
||||
//canvasCtx.fillText(graphic.angle, (drawCanvas.width -graphic.textX)-60,(drawCanvas.height -graphic.textY));
|
||||
//canvasCtx.restore();
|
||||
//}
|
||||
|
||||
if(!state.hflip && !state.vflip && !state.rotate!=0) {
|
||||
canvasCtx.fillText(graphic.angle,graphic.textX+2,graphic.textY+14);
|
||||
}
|
||||
|
||||
if(this.isCurrentDrawingAngle) {
|
||||
canvasCtx.fillText(graphic.angle,graphic.textX+2,graphic.textY+14);
|
||||
}
|
||||
|
||||
canvasCtx.closePath();
|
||||
|
||||
// Reference Lines
|
||||
if(graphic.textX!=(graphic.xB+15)) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.beginPath();
|
||||
canvasCtx.globalAlpha = 0.5;
|
||||
canvasCtx.strokeStyle = "yellow";
|
||||
canvasCtx.setLineDash([10,7]);
|
||||
var closestPt = this.getClosestAnchor([{x:graphic.textX,y:graphic.textY},{x:graphic.textX+Math.ceil(text.width+5),y:graphic.textY},{x:graphic.textX,y:graphic.textY+20},{x:graphic.textX+Math.ceil(text.width+5),y:graphic.textY+20}],{x:graphic.refX,y:graphic.refY});
|
||||
canvasCtx.moveTo(closestPt.x, closestPt.y);
|
||||
canvasCtx.lineTo(graphic.refX,graphic.refY);
|
||||
canvasCtx.stroke();
|
||||
canvasCtx.closePath();
|
||||
canvasCtx.restore();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.createNewAngle = function() {
|
||||
this.curr_angle.generateTrueGraphic();
|
||||
angles.push(this.curr_angle);
|
||||
this.curr_angle = null;
|
||||
};
|
||||
|
||||
this.drawData = function(ctx) {
|
||||
ctx.save();
|
||||
for(var i=0;i<angles.length;i++) {
|
||||
var angle_i = angles[i];
|
||||
this.draw(ctx,this.viewPortGraphic(angle_i));
|
||||
}
|
||||
ctx.restore();
|
||||
};
|
||||
|
||||
this.getActiveAngle = function(canvasCtx,mouseX,mouseY) {
|
||||
for(var i=0;i<angles.length;i++) {
|
||||
var curr = angles[i];
|
||||
if(curr.isActiveShape(canvasCtx,mouseX,mouseY)) {
|
||||
return curr;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
this.setOAorOB = function(canvasCtx,x1,y1,x2,y2) {
|
||||
this.curr_angle.setLine(x1,y1,x2,y2);
|
||||
this.isCurrentDrawingAngle = true;
|
||||
this.drawAngle(canvasCtx);
|
||||
this.isCurrentDrawingAngle = false;
|
||||
};
|
||||
|
||||
this.getActiveAngleText = function(canvasCtx,mouseX,mouseY) {
|
||||
for(var i=0;i<angles.length;i++) {
|
||||
var curr = angles[i];
|
||||
if(curr.isTextSelection(canvasCtx,mouseX,mouseY)) {
|
||||
return curr;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
this.viewPortGraphic = function(shape) {
|
||||
return {
|
||||
xA: shape.xA*state.scale+state.translationX,
|
||||
yA: shape.yA*state.scale+state.translationY,
|
||||
x0: shape.x0*state.scale+state.translationX,
|
||||
y0: shape.y0*state.scale+state.translationY,
|
||||
xB: shape.xB*state.scale+state.translationX,
|
||||
yB: shape.yB*state.scale+state.translationY,
|
||||
angle: shape.angle,
|
||||
active: shape.active,
|
||||
arcAngle1:shape.arcAngle1,
|
||||
arcAngle2: shape.arcAngle2,
|
||||
arcRadius: shape.arcRadius,
|
||||
counterClockwise: shape.counterClockwise,
|
||||
textX: shape.textX*state.scale+state.translationX,
|
||||
textY: shape.textY*state.scale+state.translationY,
|
||||
txtActive: shape.txtActive,
|
||||
refX: shape.refX*state.scale+state.translationX,
|
||||
refY: shape.refY*state.scale+state.translationY,
|
||||
};
|
||||
};
|
||||
|
||||
this.removeShape = function(shape) {
|
||||
angles.splice(angles.indexOf(shape), 1);
|
||||
};
|
||||
|
||||
this.clearAll = function() {
|
||||
angles = [];
|
||||
};
|
||||
|
||||
this.getClosestAnchor = function(points,refPt) {
|
||||
var dist1 = Math.round(Math.sqrt(Math.pow(points[0].x-refPt.x,2) + Math.pow(points[0].y-refPt.y,2)));
|
||||
var dist2 = Math.round(Math.sqrt(Math.pow(points[1].x-refPt.x,2) + Math.pow(points[1].y-refPt.y,2)));
|
||||
var dist3 = Math.round(Math.sqrt(Math.pow(points[2].x-refPt.x,2) + Math.pow(points[2].y-refPt.y,2)));
|
||||
var dist4 = Math.round(Math.sqrt(Math.pow(points[3].x-refPt.x,2) + Math.pow(points[3].y-refPt.y,2)));
|
||||
var min = Math.min(dist1,dist2,dist3,dist4);
|
||||
|
||||
switch(min) {
|
||||
case dist1:
|
||||
return points[0];
|
||||
case dist2:
|
||||
return points[1];
|
||||
case dist3:
|
||||
return points[2];
|
||||
case dist4:
|
||||
return points[3];
|
||||
default:
|
||||
return points[0];
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @namespace angle
|
||||
*/
|
||||
|
||||
ovm.angle = function() {
|
||||
// Variables
|
||||
var handleSize = 5;
|
||||
this.xA = undefined;
|
||||
this.yA = undefined;
|
||||
this.x0 = undefined;
|
||||
this.y0 = undefined;
|
||||
this.xB = undefined;
|
||||
this.yB = undefined;
|
||||
this.angle = undefined;
|
||||
this.OAvalid = false;
|
||||
this.OBvalid = false;
|
||||
this.active = false;
|
||||
this.arcAngle1 = undefined;
|
||||
this.arcAngle2 = undefined;
|
||||
this.arcRadius = 30;
|
||||
this.counterClockwise = true;
|
||||
this.lineColinear = false;
|
||||
this.textX = undefined;
|
||||
this.textY = undefined;
|
||||
this.txtActive = false;
|
||||
this.refX = undefined;
|
||||
this.refY = undefined;
|
||||
|
||||
// Functions
|
||||
this.lineOAValid = function() {
|
||||
return this.OAvalid;
|
||||
};
|
||||
|
||||
this.lineOBValid = function() {
|
||||
return this.OBvalid;
|
||||
};
|
||||
|
||||
this.setLine = function(x1,y1,x2,y2) {
|
||||
if(!this.OAvalid) {
|
||||
this.setOA(x1,y1,x2,y2,false);
|
||||
} else {
|
||||
this.setEnd(x2,y2);
|
||||
}
|
||||
};
|
||||
|
||||
this.setOA = function(xa,ya,x,y,oavalid) {
|
||||
this.xA = xa;
|
||||
this.yA = ya;
|
||||
this.x0 = x;
|
||||
this.y0 = y;
|
||||
this.OAvalid = oavalid;
|
||||
};
|
||||
|
||||
this.setIntersectionPt = function(x,y) {
|
||||
if(this.OAvalid) {
|
||||
this.xB = x;
|
||||
this.yB = y;
|
||||
this.OBvalid = true;
|
||||
return true;
|
||||
} else if(this.xA!=undefined && this.yA!=undefined) {
|
||||
this.x0 = x;
|
||||
this.y0 = y;
|
||||
this.OAvalid = true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
this.setEnd = function(x,y) {
|
||||
this.xB = x;
|
||||
this.yB = y;
|
||||
this.textX = x+15;
|
||||
this.textY = y+15;
|
||||
this.validate();
|
||||
};
|
||||
|
||||
this.generateTrueGraphic = function() {
|
||||
|
||||
var tmpDrawCanvas = document.getElementById("canvasLayer2");
|
||||
if(state.hflip){
|
||||
this.xA = tmpDrawCanvas.width - this.xA;
|
||||
this.x0 = tmpDrawCanvas.width - this.x0;
|
||||
this.xB = tmpDrawCanvas.width - this.xB;
|
||||
this.textX = this.xB+15;
|
||||
this.validate();
|
||||
}
|
||||
if(state.vflip){
|
||||
this.yA = tmpDrawCanvas.height - this.yA;
|
||||
this.y0 = tmpDrawCanvas.height - this.y0;
|
||||
this.yB = tmpDrawCanvas.height - this.yB;
|
||||
this.textY = this.yB+15;
|
||||
this.validate();
|
||||
}
|
||||
if(state.rotate!=0) {
|
||||
var tempXA,tempYA,tempX0,tempY0,tempXB,tempYB ;
|
||||
var widthHeightDifference = tmpDrawCanvas.width - tmpDrawCanvas.height;
|
||||
widthHeightDifference = widthHeightDifference/2;
|
||||
if(state.rotate===90) {
|
||||
tempXA = this.yA + widthHeightDifference;
|
||||
tempYA = (tmpDrawCanvas.width - widthHeightDifference) - this.xA;
|
||||
tempX0 = this.y0 + widthHeightDifference;
|
||||
tempY0 = (tmpDrawCanvas.width - widthHeightDifference) - this.x0;
|
||||
tempXB = this.yB + widthHeightDifference;
|
||||
tempYB = (tmpDrawCanvas.width - widthHeightDifference) - this.xB;
|
||||
this.xA = tempXA;
|
||||
this.yA = tempYA;
|
||||
this.x0 = tempX0;
|
||||
this.y0 = tempY0;
|
||||
this.xB = tempXB;
|
||||
this.yB = tempYB;
|
||||
this.textX = this.xB+15;
|
||||
this.textY = this.yB+15;
|
||||
this.validate();
|
||||
}
|
||||
else if(state.rotate===180) {
|
||||
tempXA = tmpDrawCanvas.width - this.xA;
|
||||
tempYA = tmpDrawCanvas.height - this.yA;
|
||||
tempX0 = tmpDrawCanvas.width - this.x0;
|
||||
tempY0 = tmpDrawCanvas.height - this.y0;
|
||||
tempXB = tmpDrawCanvas.width - this.xB;
|
||||
tempYB = tmpDrawCanvas.height - this.yB;
|
||||
this.xA = tempXA;
|
||||
this.yA = tempYA;
|
||||
this.x0 = tempX0;
|
||||
this.y0 = tempY0;
|
||||
this.xB = tempXB;
|
||||
this.yB = tempYB;
|
||||
this.textX = this.xB+15;
|
||||
this.textY = this.yB+15;
|
||||
this.validate();
|
||||
} else {
|
||||
tempXA = (tmpDrawCanvas.width - widthHeightDifference) - this.yA;
|
||||
tempYA = this.xA - widthHeightDifference;
|
||||
tempX0 = (tmpDrawCanvas.width - widthHeightDifference) - this.y0;
|
||||
tempY0 = this.x0 - widthHeightDifference;
|
||||
tempXB = (tmpDrawCanvas.width - widthHeightDifference) - this.yB;
|
||||
tempYB = this.xB - widthHeightDifference;
|
||||
this.xA = tempXA;
|
||||
this.yA = tempYA;
|
||||
this.x0 = tempX0;
|
||||
this.y0 = tempY0;
|
||||
this.xB = tempXB;
|
||||
this.yB = tempYB;
|
||||
this.textX = this.xB+15;
|
||||
this.textY = this.yB+15;
|
||||
this.validate();
|
||||
}
|
||||
}
|
||||
|
||||
this.xA = ((this.xA-state.translationX)/state.scale);
|
||||
this.yA = ((this.yA-state.translationY)/state.scale);
|
||||
this.x0 = ((this.x0-state.translationX)/state.scale);
|
||||
this.y0 = ((this.y0-state.translationY)/state.scale);
|
||||
this.xB = ((this.xB-state.translationX)/state.scale);
|
||||
this.yB = ((this.yB-state.translationY)/state.scale);
|
||||
this.textX = ((this.textX-state.translationX)/state.scale);
|
||||
this.textY = ((this.textY-state.translationY)/state.scale);
|
||||
this.fixReferencePoints();
|
||||
};
|
||||
|
||||
this.calculateAngle = function() {
|
||||
if(!this.lineColinear) {
|
||||
this.calculateArcAngles({x:this.xA,y:this.yA},{x:this.x0,y:this.y0},{x:this.xB,y:this.yB});
|
||||
this.counterClockwise = (this.arcAngle1>this.arcAngle2);
|
||||
}
|
||||
|
||||
var tangent = this.getRadians({x:this.xA,y:this.yA},{x:this.x0,y:this.y0},{x:this.xB,y:this.yB});
|
||||
var deg = tangent * (180/Math.PI);
|
||||
this.angle = deg % 360.0;
|
||||
if (Math.abs(this.angle) > 180.0) {
|
||||
this.counterClockwise = (this.arcAngle2>this.arcAngle1);
|
||||
this.angle -= Math.sign(this.angle) * 360.0;
|
||||
}
|
||||
this.angle = Math.abs(this.angle).toFixed(2) + " deg";
|
||||
};
|
||||
|
||||
this.validate = function() {
|
||||
this.OAvalid = (this.xA!=undefined && this.yA!=undefined && this.x0!=undefined && this.y0!=undefined && this.x0!=this.xA && this.y0!=this.yA);
|
||||
this.OBvalid = (this.x0!=undefined && this.y0!=undefined && this.xB!=undefined && this.yB!=undefined && this.x0!=this.xB && this.y0!=this.yB);
|
||||
this.arcAngle1 = this.arcAngle2 = undefined;
|
||||
this.lineColinear = false;
|
||||
this.counterClockwise = false;
|
||||
this.angle = 0.0;
|
||||
|
||||
if(this.OAvalid && this.OBvalid) {
|
||||
this.lineColinear = this.isColinear({x:this.x0,y:this.yo}, {x:this.xA,y:this.yA}, {x:this.x0,y:this.y0}, {x:this.xB,y:this.yB});
|
||||
this.calculateAngle();
|
||||
}
|
||||
};
|
||||
|
||||
this.isColinear = function(ptA,ptB,ptC,ptD) {
|
||||
if(this.isParallel(ptA, ptB, ptC, ptD)) {
|
||||
if (((ptA.y - ptC.y) * (ptD.x - ptC.x) - (ptA.x - ptC.x)
|
||||
* (ptD.y - ptC.y)) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
this.isParallel = function(ptA,ptB,ptC,ptD) {
|
||||
if (((ptB.x - ptA.x) * (ptD.y - ptC.y) - (ptB.y - ptA.y)
|
||||
* (ptD.x - ptC.x)) == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
this.calculateArcAngles = function(pt1,pt2,pt3) {
|
||||
this.arcAngle1 = Math.atan2(pt3.y - pt2.y, pt3.x - pt2.x);
|
||||
this.arcAngle2 = Math.atan2(pt1.y - pt2.y, pt1.x - pt2.x);
|
||||
};
|
||||
|
||||
this.getRadians2 = function(ptA,ptB) {
|
||||
return Math.atan2(ptA.y-ptB.y,ptB.x-ptA.x);
|
||||
};
|
||||
|
||||
this.getRadians = function(ptA,ptB,ptC) {
|
||||
return this.getRadians2(ptB,ptC)-this.getRadians2(ptB,ptA);
|
||||
};
|
||||
|
||||
this.getType = function() {
|
||||
return "angle";
|
||||
};
|
||||
|
||||
this.detectHandle = function(mouseX,mouseY,target) {
|
||||
var x = (mouseX-state.translationX)/state.scale;
|
||||
var y = (mouseY-state.translationY)/state.scale;
|
||||
|
||||
if(x>=this.xA-handleSize && x<=this.xA+handleSize && y>=this.yA-handleSize && y<=this.yA+handleSize) {
|
||||
target.style.cursor = "pointer";
|
||||
return 0;
|
||||
} else if(x>=this.x0-handleSize && x<=this.x0+handleSize && y>=this.y0-handleSize && y<=this.y0+handleSize) {
|
||||
target.style.cursor = "pointer";
|
||||
return 1;
|
||||
} else if(x>=this.xB-handleSize && x<=this.xB+handleSize && y>=this.yB-handleSize && y<=this.yB+handleSize) {
|
||||
target.style.cursor = "pointer";
|
||||
return 2;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
this.detectLine = function(start,end,mouse) {
|
||||
var a = Math.round(Math.sqrt(Math.pow((end.x+handleSize)-(start.x+handleSize),2) + Math.pow((end.y+handleSize)-(start.y+handleSize),2)));
|
||||
var b = Math.round(Math.sqrt(Math.pow(mouse.x-(start.x+handleSize),2) + Math.pow(mouse.y-(start.y+handleSize),2)));
|
||||
var c = Math.round(Math.sqrt(Math.pow((end.x+handleSize)-mouse.x,2) + Math.pow((end.y+handleSize)-mouse.y,2)));
|
||||
return (a==b+c);
|
||||
};
|
||||
|
||||
this.isActiveShape = function(canvasCtx,mouseX,mouseY) {
|
||||
var x = (mouseX-state.translationX)/state.scale;
|
||||
var y = (mouseY-state.translationY)/state.scale;
|
||||
|
||||
if(this.detectLine({x:this.xA,y:this.yA},{x:this.x0,y:this.y0},{x:x,y:y}) || this.detectLine({x:this.x0,y:this.y0},{x:this.xB,y:this.yB},{x:x,y:y})) {
|
||||
this.active = true;
|
||||
} else {
|
||||
this.active = false;
|
||||
}
|
||||
return this.active || this.isTextSelection(canvasCtx,mouseX,mouseY);
|
||||
};
|
||||
|
||||
this.moveShape = function(deltaX,deltaY) {
|
||||
if(this.active) {
|
||||
this.x0+=deltaX;
|
||||
this.y0+=deltaY;
|
||||
this.xA+=deltaX;
|
||||
this.yA+=deltaY;
|
||||
this.xB+=deltaX;
|
||||
this.yB+=deltaY;
|
||||
}
|
||||
this.textX+=deltaX;
|
||||
this.textY+=deltaY;
|
||||
this.fixReferencePoints();
|
||||
};
|
||||
|
||||
this.resizeShape = function(deltaX,deltaY,handleIndex) {
|
||||
switch(handleIndex) {
|
||||
case 0:
|
||||
this.xA+=deltaX;
|
||||
this.yA+=deltaY;
|
||||
break;
|
||||
case 1:
|
||||
this.x0+=deltaX;
|
||||
this.y0+=deltaY;
|
||||
break;
|
||||
case 2:
|
||||
this.xB+=deltaX;
|
||||
this.yB+=deltaY;
|
||||
this.textX = this.xB+15;
|
||||
this.textY = this.yB+15;
|
||||
break;
|
||||
}
|
||||
this.validate();
|
||||
this.fixReferencePoints();
|
||||
};
|
||||
|
||||
this.isTextSelection = function(canvasCtx,mouseX,mouseY) {
|
||||
var x = Math.ceil((mouseX-state.translationX)/state.scale);
|
||||
var y = Math.floor((mouseY-state.translationY)/state.scale);
|
||||
|
||||
var textWid = Math.ceil(canvasCtx.measureText(this.angle).width)+5;
|
||||
this.txtActive = (x>=this.textX && x<=this.textX+(textWid/state.scale)+5 && y>=this.textY && y<=(this.textY+(15/state.scale)));
|
||||
return this.txtActive;
|
||||
};
|
||||
|
||||
this.distanceToLine = function(line,point) {
|
||||
return Math.round(Math.sqrt(Math.pow(point.x-line.x1,2) + Math.pow(point.y-line.y1,2))) + Math.round(Math.sqrt(Math.pow(line.x2-point.x,2) + Math.pow(line.y2-point.y,2)));
|
||||
};
|
||||
|
||||
this.distanceToPoint = function(point1,point2) {
|
||||
return Math.round(Math.sqrt(Math.pow(point2.x-point1.x,2) + Math.pow(point2.y-point1.y,2)));
|
||||
};
|
||||
|
||||
this.fixReferencePoints = function() {
|
||||
var dist1 = this.distanceToLine({x1:this.xA,y1:this.yA,x2:this.x0,y2:this.y0}, {x:this.textX,y:this.textY});
|
||||
var dist2 = this.distanceToLine({x1:this.xB,y1:this.yB,x2:this.x0,y2:this.y0}, {x:this.textX,y:this.textY});
|
||||
|
||||
if(dist1<dist2) {
|
||||
this.findClosestPointForLine({x:this.x0,y:this.y0},{x:this.xA,y:this.yA},{x:this.textX,y:this.textY});
|
||||
|
||||
if(!this.isPtWithinAngle({x:this.x0,y:this.y0},{x:this.xA,y:this.yA},{x:this.refX,y:this.refY})) {
|
||||
this.selectNearestAnchor({x:this.x0,y:this.y0},{x:this.xA,y:this.yA},{x:this.textX,y:this.textY});
|
||||
}
|
||||
|
||||
} else {
|
||||
this.findClosestPointForLine({x:this.x0,y:this.y0},{x:this.xB,y:this.yB},{x:this.textX,y:this.textY});
|
||||
|
||||
if(!this.isPtWithinAngle({x:this.x0,y:this.y0},{x:this.xB,y:this.yB},{x:this.refX,y:this.refY})) {
|
||||
this.selectNearestAnchor({x:this.x0,y:this.y0},{x:this.xB,y:this.yB},{x:this.textX,y:this.textY});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.findClosestPointForLine = function(A,B,P) {
|
||||
var a_to_p = [P.x - A.x , P.y - A.y]; // Vector A to P
|
||||
var a_to_b = [B.x - A.x , B.y - A.y]; // Vector A to B
|
||||
|
||||
// Find squared magnitude of a_to_b
|
||||
var atb2 = Math.pow(a_to_b[0],2) + Math.pow(a_to_b[1],2);
|
||||
|
||||
// Find dot product of a_to_p and a_to_b
|
||||
var atp_dot_atb = a_to_p[0] * a_to_b[0] + a_to_p[1] * a_to_b[1];
|
||||
|
||||
// Normalized distance from a to closest point
|
||||
var t = atp_dot_atb / atb2;
|
||||
|
||||
// Add the distance to A, moving towards B
|
||||
this.refX = A.x + a_to_b[0] * t;
|
||||
this.refY = A.y + a_to_b[1] * t;
|
||||
};
|
||||
|
||||
this.isPtWithinAngle = function(A,B,P) {
|
||||
if(A.x<=P.x && B.x>=P.x || A.x>=P.x && B.x<=P.x) {
|
||||
if(A.y<=P.y && B.y>=P.y || A.y>=P.y && B.y<=P.y) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
this.selectNearestAnchor = function(ptA,ptB,ptC) {
|
||||
var d1 = this.distanceToPoint(ptA, ptC);
|
||||
var d2 = this.distanceToPoint(ptB, ptC);
|
||||
|
||||
if(d1<d2) {
|
||||
this.refX = ptA.x;
|
||||
this.refY = ptA.y;
|
||||
} else {
|
||||
this.refX = ptB.x;
|
||||
this.refY = ptB.y;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* DicomElement.js
|
||||
* Version 0.5
|
||||
* Author: BabuHussain<babuhussain.a@raster.in>
|
||||
*/
|
||||
function DicomElement(name,vr,vl,group,element,value,offset) {
|
||||
this.vr_type=vr;
|
||||
// Element Value
|
||||
this.value=value;
|
||||
// Element code
|
||||
this.code;
|
||||
this.length=vl;
|
||||
this.header;
|
||||
this.group=group;
|
||||
this.element=element;
|
||||
this.offset=offset;
|
||||
this.name=name;
|
||||
this.transfer_syntax;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
function DicomInputStreamReader()
|
||||
{
|
||||
this.inputBuffer;
|
||||
this.inputStreamReader;
|
||||
this.readDicom=readDicom;
|
||||
this.getInputBuffer=getInputBuffer;
|
||||
this.getReader=getReader;
|
||||
}
|
||||
|
||||
function readDicom(url)
|
||||
{
|
||||
this.inputStreamReader=new BinFileReader(url);
|
||||
this.inputBuffer = new Array(this.inputStreamReader.getFileSize);
|
||||
this.inputBuffer=this.inputStreamReader.readBytes();
|
||||
}
|
||||
|
||||
function getInputBuffer()
|
||||
{
|
||||
return this.inputBuffer;
|
||||
}
|
||||
|
||||
function getReader()
|
||||
{
|
||||
return this.inputStreamReader;
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
/**
|
||||
* DicomParser.js
|
||||
* Version 0.5
|
||||
* Author: BabuHussain<babuhussain.a@raster.in>
|
||||
*/
|
||||
function DicomParser(inputBuffer,reader)
|
||||
{
|
||||
this.inputBuffer=inputBuffer;
|
||||
this.reader=reader;
|
||||
this.parseAll=parseAll;
|
||||
this.index = 0;
|
||||
this.pixelBuffer;
|
||||
this.bitsStored;
|
||||
this.pixelRepresentation;
|
||||
this.minPix;
|
||||
this.maxPix;
|
||||
this.imgData = null;
|
||||
}
|
||||
|
||||
function getPixelBuffer()
|
||||
{
|
||||
return this.pixelBuffer;
|
||||
}
|
||||
|
||||
function parseAll()
|
||||
{
|
||||
// var imgPixelSpacing = this.readTag(24,0,17,100,"ImagerPixelSpacing");
|
||||
var monochrome1 = this.readTag(40,0,4,0,"PhotometricInterpretation");
|
||||
var rows = this.readTagAsNumber(40,0,16,0,"Rows");
|
||||
var columns = this.readTagAsNumber(40,0,17,0,"Columns");
|
||||
var pxlSpacing = this.readTag(40,0,48,0,"PixelSpacing");
|
||||
this.bitsStored = this.readTagAsNumber(40,0,1,1,"BitsStored");
|
||||
this.pixelRepresentation = this.readTagAsNumber(40,0,3,1,"PixelRepresentation");
|
||||
var wc = this.readTag(40,0,80,16,"windowCenter");
|
||||
var ww = this.readTag(40,0,81,16,"windowWidth");
|
||||
var rescale_Intercept = this.readTag(40,0,82,16,"rescaleIntercept");
|
||||
var rescale_slope = this.readTag(40,0,83,16,"rescaleSlope");
|
||||
// this.imgData={"monochrome1":monochrome1=="MONOCHROME1","BitsStored":this.bitsStored,"PixelRepresentation":this.pixelRepresentation,"windowCenter":wc!=undefined? wc[0] : wc,"windowWidth":ww!=undefined ? ww[0] : ww,"rescaleIntercept":rescale_Intercept!=undefined?rescale_Intercept:0.0 ,"rescaleSlope":rescale_slope!=undefined ?rescale_slope:1.0,"nativeRows":rows,"nativeColumns":columns,"pixelSpacing":pxlSpacing,"imagerPixelSpacing":imgPixelSpacing};
|
||||
this.imgData={"monochrome1":monochrome1=="MONOCHROME1","BitsStored":this.bitsStored,"PixelRepresentation":this.pixelRepresentation,"windowCenter":wc!=undefined? wc[0] : wc,"windowWidth":ww!=undefined ? ww[0] : ww,"rescaleIntercept":rescale_Intercept!=undefined?rescale_Intercept:0.0 ,"rescaleSlope":rescale_slope!=undefined ?rescale_slope:1.0,"nativeRows":rows,"nativeColumns":columns,"pixelSpacing":pxlSpacing};
|
||||
|
||||
this.moveToPixelDataTag();
|
||||
this.readImage();
|
||||
}
|
||||
|
||||
DicomParser.prototype.readTag=function(firstContent,secondContent,thirdContent,fourthContent,tagName)
|
||||
{
|
||||
var i=this.index;
|
||||
|
||||
for(; i<this.inputBuffer.length; i++)
|
||||
{
|
||||
if(this.reader.readNumber(1,i)==firstContent && this.reader.readNumber(1,i+1)==secondContent&&this.reader.readNumber(1,i+2)==thirdContent&&this.reader.readNumber(1,i+3)==fourthContent)
|
||||
{
|
||||
i=i+4;
|
||||
var vr= this.reader.readString(2,i);
|
||||
var vl=this.reader.readNumber(2,i+2);
|
||||
var val=this.reader.readString(vl,i+4);
|
||||
var tagValue=val.split("\\");
|
||||
i=i+4+vl;
|
||||
this.index = i;
|
||||
return tagValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DicomParser.prototype.readTagAsNumber=function(firstContent,secondContent,thirdContent,fourthContent,tagName)
|
||||
{
|
||||
var i=this.index;
|
||||
for(; i<this.inputBuffer.length; i++)
|
||||
{
|
||||
if(this.reader.readNumber(1,i)==firstContent && this.reader.readNumber(1,i+1)==secondContent&&this.reader.readNumber(1,i+2)==thirdContent&&this.reader.readNumber(1,i+3)==fourthContent)
|
||||
{
|
||||
i=i+4;
|
||||
var vr= this.reader.readString(2,i);
|
||||
var vl=this.reader.readNumber(2,i+2);
|
||||
var val=this.reader.readNumber(vl,i+4);
|
||||
i=i+4+vl;
|
||||
this.index = i;
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DicomParser.prototype.moveToPixelDataTag=function()
|
||||
{
|
||||
var i=this.index;
|
||||
for(; i<this.inputBuffer.length; i++)
|
||||
{
|
||||
if(this.reader.readNumber(1,i)==224 &&this.reader.readNumber(1,i+1)==127&&this.reader.readNumber(1,i+2)==16&&this.reader.readNumber(1,i+3)==0)
|
||||
{
|
||||
i+=4;
|
||||
var vr= this.reader.readString(2,i);
|
||||
i+=4;
|
||||
|
||||
if(vr=="OB") {
|
||||
i+=2;
|
||||
} else if(vr=="OW") {
|
||||
i+=4;
|
||||
} else if(vr=="OF") {
|
||||
i+=8;
|
||||
} else {
|
||||
i+=4;
|
||||
}
|
||||
this.index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DicomParser.prototype.readImage=function()
|
||||
{
|
||||
this.minPix = 65535;
|
||||
this.maxPix = -32768;
|
||||
|
||||
if(this.pixelRepresentation === 0 && this.bitsStored ===8) {
|
||||
this.pixelBuffer = new Uint8Array(this.reader.getBytes(this.index).buffer);
|
||||
} else if(this.pixelRepresentation === 0 && this.bitsStored>8) {
|
||||
this.pixelBuffer = new Uint16Array(this.reader.getBytes(this.index).buffer);
|
||||
} else if(this.pixelRepresentation === 1 && this.bitsStored>8) {
|
||||
this.pixelBuffer = new Int16Array(this.reader.getBytes(this.index).buffer);
|
||||
} else {
|
||||
this.pixelBuffer = new Array();
|
||||
}
|
||||
|
||||
for(var j=0;j<this.pixelBuffer.length;j++) {
|
||||
var pix = this.pixelBuffer[j];
|
||||
this.minPix = Math.min(this.minPix,pix);
|
||||
this.maxPix = Math.max(this.maxPix,pix);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* LookupTable.js
|
||||
* Version 0.5
|
||||
* Author: BabuHussain<babuhussain.a@raster.in>
|
||||
*/
|
||||
function LookupTable() {
|
||||
this.ylookup;
|
||||
this.rescaleSlope;
|
||||
this.rescaleIntercept;
|
||||
this.windowCenter;
|
||||
this.windowWidth;
|
||||
this.lutSize;
|
||||
this.minPixel;
|
||||
this.maxPixel;
|
||||
this.getPixelAt = getPixelAt;
|
||||
this.calculateLookup = calculateLookup;
|
||||
this.setWindowingdata = setWindowingdata;
|
||||
this.setPixelInfo = setPixelInfo;
|
||||
}
|
||||
|
||||
LookupTable.prototype.setData = function(wc, ww, rs, ri,bitsStored, invert) {
|
||||
this.rescaleSlope = rs;
|
||||
this.rescaleIntercept = ri;
|
||||
this.windowCenter = wc;
|
||||
this.windowWidth = ww;
|
||||
this.lutSize = Math.pow(2, parseInt(bitsStored));
|
||||
this.invert = invert;
|
||||
}
|
||||
|
||||
var setPixelInfo = function(minPix,maxPix,invert) {
|
||||
this.minPixel = minPix;
|
||||
this.maxPixel = maxPix;
|
||||
this.invert = invert;
|
||||
};
|
||||
|
||||
var setWindowingdata = function(wc, ww) {
|
||||
this.windowCenter = wc;
|
||||
this.windowWidth = ww;
|
||||
}
|
||||
|
||||
function calculateLookup() {
|
||||
this.ylookup=new Array(this.lutSize);
|
||||
for(var inputValue=this.minPixel;inputValue<=this.maxPixel;inputValue++) {
|
||||
var lutVal = ((((inputValue * this.rescaleSlope + this.rescaleIntercept) - (this.windowCenter)) / (this.windowWidth) + 0.5) * 255.0);
|
||||
var newVal = Math.min(Math.max(lutVal, 0), 255);
|
||||
this.ylookup[inputValue] = this.invert===true ? Math.round(255 - newVal) : Math.round(newVal);
|
||||
}
|
||||
}
|
||||
|
||||
function getPixelAt(i) {
|
||||
return i!=undefined ? (i * this.rescaleSlope + this.rescaleIntercept) : 0;
|
||||
}
|
||||
@@ -0,0 +1,495 @@
|
||||
/**
|
||||
* @namespace DICOM related.
|
||||
*/
|
||||
ovm.dicom = ovm.dicom || {};
|
||||
|
||||
/**
|
||||
* @class Big Endian reader
|
||||
* @param file
|
||||
*/
|
||||
ovm.dicom.BigEndianReader = function(file)
|
||||
{
|
||||
this.readByteAt = function(i) {
|
||||
return file.charCodeAt(i) & 0xff;
|
||||
};
|
||||
this.readNumber = function(nBytes, startByte) {
|
||||
var result = 0;
|
||||
for(var i=startByte; i<startByte + nBytes; ++i){
|
||||
result = result * 256 + this.readByteAt(i);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
this.readCouple = function(a,b) {
|
||||
return (b + a*256).toString(16);
|
||||
};
|
||||
this.readUint16Array = function(nBytes, startByte) {
|
||||
return new Uint16Array(file.buffer, startByte, nBytes/2);
|
||||
};
|
||||
this.readUint16Array = function(nBytes, startByte) {
|
||||
var data = [];
|
||||
for(var i=startByte; i<startByte+nBytes; i+=2)
|
||||
{
|
||||
data.push(this.readNumber(1,i+1) + this.readNumber(1,i)*256);
|
||||
}
|
||||
return data;
|
||||
};
|
||||
this.readString = function(nChars, startChar) {
|
||||
var result = "";
|
||||
for(var i=startChar; i<startChar + nChars; i++){
|
||||
result += String.fromCharCode(this.readNumber(1,i));
|
||||
}
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @class Litte Endian reader
|
||||
* @param file
|
||||
*/
|
||||
ovm.dicom.LittleEndianReader = function(file)
|
||||
{
|
||||
this.readByteAt = function(i) {
|
||||
return file.charCodeAt(i) & 0xff;
|
||||
};
|
||||
this.readNumber = function(nBytes, startByte) {
|
||||
var result = 0;
|
||||
for(var i=startByte + nBytes; i>startByte; i--){
|
||||
result = result * 256 + this.readByteAt(i-1);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
this.readCouple = function(a,b) {
|
||||
return (a + b*256).toString(16);
|
||||
};
|
||||
this.readUint16Array = function(nBytes, startByte) {
|
||||
var data = [];
|
||||
for(var i=startByte; i<startByte+nBytes; i+=2)
|
||||
{
|
||||
data.push(this.readNumber(2,i));
|
||||
}
|
||||
return data;
|
||||
};
|
||||
this.readString = function(nChars, startChar) {
|
||||
var result = "";
|
||||
for(var i=startChar; i<startChar + nChars; i++){
|
||||
result += String.fromCharCode(this.readNumber(1,i));
|
||||
}
|
||||
return result;
|
||||
};
|
||||
// beta...
|
||||
this.readRaw = function(nBytes, startByte) {
|
||||
var data = [];
|
||||
for(var i=startByte; i<startByte+nBytes; ++i)
|
||||
{
|
||||
data.push(file[i]);
|
||||
}
|
||||
return data;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @class DicomParser class.
|
||||
*/
|
||||
ovm.dicom.DicomParser = function(file)
|
||||
{
|
||||
// the list of DICOM elements
|
||||
this.dicomElements = {};
|
||||
// the number of DICOM Items
|
||||
this.numberOfItems = 0;
|
||||
// the DICOM dictionary used to find tag names
|
||||
this.dict = new ovm.dicom.Dictionary();
|
||||
// the file
|
||||
this.file = file;
|
||||
// the pixel buffer
|
||||
this.pixelBuffer = [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the DICOM data pixel buffer.
|
||||
* @returns The pixel buffer (as an array).
|
||||
*/
|
||||
ovm.dicom.DicomParser.prototype.getPixelBuffer=function()
|
||||
{
|
||||
return this.pixelBuffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Append a DICOM element to the dicomElements member object.
|
||||
* Allows for easy retrieval of DICOM tag values from the tag name.
|
||||
* If tags have same name (for the 'unknown' and private tags cases), a number is appended
|
||||
* making the name unique.
|
||||
* @param element The element to add.
|
||||
*/
|
||||
ovm.dicom.DicomParser.prototype.appendDicomElement=function( element )
|
||||
{
|
||||
// find a good tag name
|
||||
var name = element.name;
|
||||
// count the number of items
|
||||
if( name === "Item" ) {
|
||||
++this.numberOfItems;
|
||||
}
|
||||
var count = 1;
|
||||
while( this.dicomElements[name] ) {
|
||||
name = element.name + (count++).toString();
|
||||
}
|
||||
// store it
|
||||
this.dicomElements[name] = {
|
||||
"group": element.group,
|
||||
"element": element.element,
|
||||
"vr": element.vr,
|
||||
"vl": element.vl,
|
||||
"value": element.value };
|
||||
};
|
||||
|
||||
/**
|
||||
* Read a DICOM tag.
|
||||
* @param reader The raw data reader.
|
||||
* @param offset The offset where to start to read.
|
||||
* @returns An object containing the tags 'group', 'element' and 'name'.
|
||||
*/
|
||||
ovm.dicom.DicomParser.prototype.readTag=function(reader, offset)
|
||||
{
|
||||
// group
|
||||
var g0 = reader.readNumber( 1, offset );
|
||||
var g1 = reader.readNumber( 1, offset+1 );
|
||||
var group_str = reader.readCouple(g0, g1);
|
||||
var group = "0x0000".substr(0, 6 - group_str.length) + group_str.toUpperCase();
|
||||
// element
|
||||
var e2 = reader.readNumber( 1, offset+2 );
|
||||
var e3 = reader.readNumber( 1, offset+3 );
|
||||
var element_str = reader.readCouple(e2, e3);
|
||||
var element = "0x0000".substr(0, 6 - element_str.length) + element_str.toUpperCase();
|
||||
// name
|
||||
var name = "ovm::unknown";
|
||||
if( this.dict.newDictionary[group] ) {
|
||||
if( this.dict.newDictionary[group][element] ) {
|
||||
name = this.dict.newDictionary[group][element][2];
|
||||
}
|
||||
}
|
||||
// return as hex
|
||||
return {'group': group, 'element': element, 'name': name};
|
||||
};
|
||||
|
||||
/**
|
||||
* Read a DICOM data element.
|
||||
* @param reader The raw data reader.
|
||||
* @param offset The offset where to start to read.
|
||||
* @param implicit Is the DICOM VR implicit?
|
||||
* @returns An object containing the element 'tag', 'vl', 'vr', 'data' and 'offset'.
|
||||
*/
|
||||
ovm.dicom.DicomParser.prototype.readDataElement=function(reader, offset, implicit)
|
||||
{
|
||||
// tag: group, element
|
||||
var tag = this.readTag(reader, offset);
|
||||
var tagOffset = 4;
|
||||
|
||||
var vr; // Value Representation (VR)
|
||||
var vl; // Value Length (VL)
|
||||
var vrOffset = 0; // byte size of VR
|
||||
var vlOffset = 0; // byte size of VL
|
||||
|
||||
// (private) Item group case
|
||||
if( tag.group === "0xFFFE" ) {
|
||||
vr = "N/A";
|
||||
vrOffset = 0;
|
||||
vl = reader.readNumber( 4, offset+tagOffset );
|
||||
vlOffset = 4;
|
||||
}
|
||||
// non Item case
|
||||
else {
|
||||
// implicit VR?
|
||||
if(implicit) {
|
||||
vr = "UN";
|
||||
if( this.dict.newDictionary[tag.group] ) {
|
||||
if( this.dict.newDictionary[tag.group][tag.element] ) {
|
||||
vr = this.dict.newDictionary[tag.group][tag.element][0];
|
||||
}
|
||||
}
|
||||
vrOffset = 0;
|
||||
vl = reader.readNumber( 4, offset+tagOffset+vrOffset );
|
||||
vlOffset = 4;
|
||||
}
|
||||
else {
|
||||
vr = reader.readString( 2, offset+tagOffset );
|
||||
vrOffset = 2;
|
||||
// long representations
|
||||
if(vr === "OB" || vr === "OF" || vr === "SQ" || vr === "OW" || vr === "UN") {
|
||||
vl = reader.readNumber( 4, offset+tagOffset+vrOffset+2 );
|
||||
vlOffset = 6;
|
||||
}
|
||||
// short representation
|
||||
else {
|
||||
vl = reader.readNumber( 2, offset+tagOffset+vrOffset );
|
||||
vlOffset = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check the value of VL
|
||||
if( vl === 0xffffffff ) {
|
||||
vl = 0;
|
||||
}
|
||||
|
||||
// data
|
||||
var data;
|
||||
if( vr === "US" || vr === "UL")
|
||||
{
|
||||
data = [reader.readNumber( vl, offset+tagOffset+vrOffset+vlOffset)];
|
||||
}
|
||||
else if( vr === "OX" || vr === "OW" )
|
||||
{
|
||||
data = reader.readUint16Array(vl, offset+tagOffset+vrOffset+vlOffset);
|
||||
}
|
||||
else if( vr === "OB" || vr === "N/A")
|
||||
{
|
||||
var begin = offset+tagOffset+vrOffset+vlOffset;
|
||||
var end = begin + vl;
|
||||
data = [];
|
||||
for(var i=begin; i<end; ++i)
|
||||
{
|
||||
data.push(reader.readNumber(1,i));
|
||||
}
|
||||
//data = reader.readRaw(vl, begin);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = reader.readString( vl, offset+tagOffset+vrOffset+vlOffset);
|
||||
data = data.split("\\");
|
||||
}
|
||||
|
||||
// total element offset
|
||||
var elementOffset = tagOffset + vrOffset + vlOffset + vl;
|
||||
|
||||
// return
|
||||
return {
|
||||
'tag': tag, 'vr': vr, 'vl': vl,
|
||||
'data': data,
|
||||
'offset': elementOffset};
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the complete DICOM file (given as input to the class).
|
||||
* Fills in the member object 'dicomElements'.
|
||||
*/
|
||||
ovm.dicom.DicomParser.prototype.parseAll = function()
|
||||
{
|
||||
var offset = 0;
|
||||
var i;
|
||||
var implicit = false;
|
||||
var jpeg = false;
|
||||
var jpeg2000 = false;
|
||||
// dictionary
|
||||
this.dict.init();
|
||||
// default readers
|
||||
var metaReader = new ovm.dicom.LittleEndianReader(this.file);
|
||||
var dataReader = new ovm.dicom.LittleEndianReader(this.file);
|
||||
|
||||
// 128 -> 132: magic word
|
||||
offset = 128;
|
||||
var magicword = metaReader.readString(4, offset);
|
||||
if(magicword !== "DICM")
|
||||
{
|
||||
throw new Error("No magic DICM word found");
|
||||
}
|
||||
offset += 4;
|
||||
|
||||
// 0x0002, 0x0000: MetaElementGroupLength
|
||||
var dataElement = this.readDataElement(metaReader, offset);
|
||||
var metaLength = parseInt(dataElement.data, 10);
|
||||
offset += dataElement.offset;
|
||||
|
||||
// meta elements
|
||||
var metaStart = offset;
|
||||
var metaEnd = offset + metaLength;
|
||||
for( i=metaStart; i<metaEnd; i++ )
|
||||
{
|
||||
// get the data element
|
||||
dataElement = this.readDataElement(metaReader, i, false);
|
||||
// check the transfer syntax
|
||||
if( dataElement.tag.name === "TransferSyntaxUID" ) {
|
||||
var syntax = dataElement.data[0];
|
||||
// get rid of ending zero-width space (u200B)
|
||||
if( syntax[syntax.length-1] === String.fromCharCode("u200B") ) {
|
||||
syntax = syntax.substring(0, syntax.length-1);
|
||||
}
|
||||
|
||||
// Implicit VR - Little Endian
|
||||
if( syntax === "1.2.840.10008.1.2" ) {
|
||||
implicit = true;
|
||||
}
|
||||
// Explicit VR - Little Endian (default): 1.2.840.10008.1.2.1
|
||||
// Deflated Explicit VR - Little Endian
|
||||
else if( syntax === "1.2.840.10008.1.2.1.99" ) {
|
||||
throw new Error("Unsupported DICOM transfer syntax (Deflated Explicit VR): "+syntax);
|
||||
}
|
||||
// Explicit VR - Big Endian
|
||||
else if( syntax === "1.2.840.10008.1.2.2" ) {
|
||||
dataReader = new ovm.dicom.BigEndianReader(this.file);
|
||||
}
|
||||
// JPEG
|
||||
else if( syntax.match(/1.2.840.10008.1.2.4.5/)
|
||||
|| syntax.match(/1.2.840.10008.1.2.4.6/)
|
||||
|| syntax.match(/1.2.840.10008.1.2.4.7/)
|
||||
|| syntax.match(/1.2.840.10008.1.2.4.8/) ) {
|
||||
jpeg = true;
|
||||
throw new Error("Unsupported DICOM transfer syntax (JPEG): "+syntax);
|
||||
}
|
||||
// JPEG 2000
|
||||
else if( syntax.match(/1.2.840.10008.1.2.4.9/) ) {
|
||||
jpeg2000 = true;
|
||||
throw new Error("Unsupported DICOM transfer syntax (JPEG 2000): "+syntax);
|
||||
}
|
||||
// MPEG2 Image Compression
|
||||
else if( syntax === "1.2.840.10008.1.2.4.100" ) {
|
||||
throw new Error("Unsupported DICOM transfer syntax (MPEG2): "+syntax);
|
||||
}
|
||||
// RLE (lossless)
|
||||
else if( syntax === "1.2.840.10008.1.2.4.5" ) {
|
||||
throw new Error("Unsupported DICOM transfer syntax (RLE): "+syntax);
|
||||
}
|
||||
}
|
||||
// store the data element
|
||||
this.appendDicomElement( {
|
||||
'name': dataElement.tag.name,
|
||||
'group': dataElement.tag.group,
|
||||
'element': dataElement.tag.element,
|
||||
'value': dataElement.data } );
|
||||
// increment index
|
||||
i += dataElement.offset-1;
|
||||
}
|
||||
|
||||
var startedPixelItems = false;
|
||||
|
||||
// DICOM data elements
|
||||
for( i=metaEnd; i<this.file.length; i++)
|
||||
{
|
||||
// get the data element
|
||||
dataElement = this.readDataElement(dataReader, i, implicit);
|
||||
// store pixel data from multiple items
|
||||
if( startedPixelItems ) {
|
||||
if( dataElement.tag.name === "Item" ) {
|
||||
if( dataElement.data.length !== 0 ) {
|
||||
this.pixelBuffer = this.pixelBuffer.concat( dataElement.data );
|
||||
}
|
||||
}
|
||||
else if( dataElement.tag.name === "SequenceDelimitationItem" ) {
|
||||
startedPixelItems = false;
|
||||
}
|
||||
else {
|
||||
throw new Error("Unexpected tag in encapsulated pixel data: "+dataElement.tag.name);
|
||||
}
|
||||
}
|
||||
// check the pixel data tag
|
||||
if( dataElement.tag.name === "PixelData") {
|
||||
if( dataElement.data.length !== 0 ) {
|
||||
this.pixelBuffer = dataElement.data;
|
||||
}
|
||||
else {
|
||||
startedPixelItems = true;
|
||||
}
|
||||
}
|
||||
// store the data element
|
||||
this.appendDicomElement( {
|
||||
'name': dataElement.tag.name,
|
||||
'group' : dataElement.tag.group,
|
||||
'vr' : dataElement.vr,
|
||||
'vl' : dataElement.vl,
|
||||
'element': dataElement.tag.element,
|
||||
'value': dataElement.data } );
|
||||
// increment index
|
||||
i += dataElement.offset-1;
|
||||
}
|
||||
|
||||
// uncompress data
|
||||
if( jpeg ) {
|
||||
console.log("JPEG");
|
||||
// using jpgjs from https://github.com/notmasteryet/jpgjs
|
||||
// -> error with ffc3 and ffc1 jpeg jfif marker
|
||||
/*var j = new JpegImage();
|
||||
j.parse(this.pixelBuffer);
|
||||
var d = 0;
|
||||
j.copyToImageData(d);
|
||||
this.pixelBuffer = d.data;*/
|
||||
}
|
||||
else if( jpeg2000 ) {
|
||||
console.log("JPEG 2000");
|
||||
// using openjpeg.js from https://github.com/kripken/j2k.js
|
||||
// -> 2 layers results????
|
||||
/*var data = new Uint16Array(this.pixelBuffer);
|
||||
var result = openjpeg(data, "j2k");
|
||||
this.pixelBuffer = result.data;*/
|
||||
|
||||
// using jpx.js from https://github.com/mozilla/pdf.js
|
||||
// -> ...
|
||||
/*var j = new JpxImage();
|
||||
j.parse(this.pixelBuffer);
|
||||
console.log("width: "+j.width);
|
||||
console.log("height: "+j.height);
|
||||
console.log("tiles: "+j.tiles.length);
|
||||
console.log("count: "+j.componentsCount);
|
||||
this.pixelBuffer = j.tiles[0].items;*/
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get an Image object from the read DICOM file.
|
||||
* @returns A new Image.
|
||||
*/
|
||||
ovm.dicom.DicomParser.prototype.getImage = function()
|
||||
{
|
||||
// size
|
||||
if( !this.dicomElements.Columns ) {
|
||||
throw new Error("Missing DICOM image number of columns");
|
||||
}
|
||||
if( !this.dicomElements.Rows ) {
|
||||
throw new Error("Missing DICOM image number of rows");
|
||||
}
|
||||
var size = new ovm.image.ImageSize(
|
||||
this.dicomElements.Columns.value[0],
|
||||
this.dicomElements.Rows.value[0]);
|
||||
// spacing
|
||||
var rowSpacing = 1;
|
||||
var columnSpacing = 1;
|
||||
if( this.dicomElements.PixelSpacing ) {
|
||||
rowSpacing = parseFloat(this.dicomElements.PixelSpacing.value[0]);
|
||||
columnSpacing = parseFloat(this.dicomElements.PixelSpacing.value[1]);
|
||||
}
|
||||
else if( this.dicomElements.ImagerPixelSpacing ) {
|
||||
rowSpacing = parseFloat(this.dicomElements.ImagerPixelSpacing.value[0]);
|
||||
columnSpacing = parseFloat(this.dicomElements.ImagerPixelSpacing.value[1]);
|
||||
}
|
||||
var spacing = new ovm.image.ImageSpacing(
|
||||
columnSpacing, rowSpacing);
|
||||
// image
|
||||
var image = new ovm.image.Image( size, spacing, this.pixelBuffer );
|
||||
// lookup
|
||||
var rescaleSlope = 1;
|
||||
if( this.dicomElements.RescaleSlope ) {
|
||||
rescaleSlope = parseFloat(this.dicomElements.RescaleSlope.value[0]);
|
||||
}
|
||||
var rescaleIntercept = 0;
|
||||
if( this.dicomElements.RescaleIntercept ) {
|
||||
rescaleIntercept = parseFloat(this.dicomElements.RescaleIntercept.value[0]);
|
||||
}
|
||||
var windowPresets = [];
|
||||
var name;
|
||||
if( this.dicomElements.WindowCenter && this.dicomElements.WindowWidth ) {
|
||||
for( var i = 0; i < this.dicomElements.WindowCenter.value.length; ++i) {
|
||||
if( this.dicomElements.WindowCenterWidthExplanation ) {
|
||||
name = this.dicomElements.WindowCenterWidthExplanation.value[i];
|
||||
}
|
||||
else {
|
||||
name = "Default"+i;
|
||||
}
|
||||
windowPresets.push({
|
||||
"center": parseInt( this.dicomElements.WindowCenter.value[i], 10 ),
|
||||
"width": parseInt( this.dicomElements.WindowWidth.value[i], 10 ),
|
||||
"name": name
|
||||
});
|
||||
}
|
||||
}
|
||||
var lookup = new ovm.image.LookupTable( windowPresets, rescaleSlope, rescaleIntercept);
|
||||
image.setLookup( lookup );
|
||||
// return
|
||||
return image;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* TransferSyntax.js
|
||||
* Version 0.5
|
||||
* Author: BabuHussain<babuhussain.a@raster.in>
|
||||
*/
|
||||
function TransferSyntax()
|
||||
{
|
||||
this._uid;
|
||||
|
||||
this._bigEndian;
|
||||
|
||||
this._explicitVR;
|
||||
|
||||
this._deflated;
|
||||
|
||||
this._encapsulated;
|
||||
|
||||
this.ImplicitVRLittleEndian =new TransferSyntax("1.2.840.10008.1.2", false, false, false, false);
|
||||
|
||||
this.ImplicitVRBigEndian = new TransferSyntax(null, false, true, false, false);
|
||||
|
||||
this.ExplicitVRLittleEndian =
|
||||
new TransferSyntax("1.2.840.10008.1.2.1", true, false, false, false);
|
||||
|
||||
this.ExplicitVRBigEndian =
|
||||
new TransferSyntax("1.2.840.10008.1.2.2", true, true, false, false);
|
||||
|
||||
this.DeflatedExplicitVRLittleEndian =
|
||||
new TransferSyntax("1.2.840.10008.1.2.1.99", true, false, true, false);
|
||||
this.init= initializer;
|
||||
this.uid=function()
|
||||
{
|
||||
return this._uid;
|
||||
}
|
||||
this.bigEndian=function()
|
||||
{
|
||||
return this._bigEndian;
|
||||
}
|
||||
|
||||
this.explicitVR=function()
|
||||
{
|
||||
return this._explicitVR;
|
||||
}
|
||||
|
||||
this.deflated=function()
|
||||
{
|
||||
return this._deflated;
|
||||
}
|
||||
|
||||
this.encapsulated=function()
|
||||
{
|
||||
return this._encapsulated;
|
||||
}
|
||||
|
||||
this.uncompressed=function()
|
||||
{
|
||||
return !this._deflated && !this._encapsulated;
|
||||
}
|
||||
this.valueOf=function(uid)
|
||||
{
|
||||
if (uid == null)
|
||||
throw new Error("uid");
|
||||
if (uid ==ImplicitVRLittleEndian._uid)
|
||||
return ImplicitVRLittleEndian;
|
||||
if (uid==ExplicitVRLittleEndian._uid)
|
||||
return ExplicitVRLittleEndian;
|
||||
if (uid ==ExplicitVRBigEndian._uid)
|
||||
return ExplicitVRBigEndian;
|
||||
if (uid ==DeflatedExplicitVRLittleEndian._uid)
|
||||
return DeflatedExplicitVRLittleEndian;
|
||||
return new TransferSyntax(uid, true, false, false, true);
|
||||
}
|
||||
}
|
||||
function initializer(uid,explicitVR,bigEndian,deflated,encapsulated)
|
||||
{
|
||||
_uid = uid;
|
||||
_explicitVR = explicitVR;
|
||||
_bigEndian = bigEndian;
|
||||
_deflated = deflated;
|
||||
_encapsulated = encapsulated;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,768 @@
|
||||
/**
|
||||
* UID.js
|
||||
* Version 0.5
|
||||
* Author: BabuHussain<babuhussain.a@raster.in>
|
||||
*/
|
||||
function UID () {
|
||||
this.init=function() {
|
||||
}
|
||||
/** Private Study Root Query/Retrieve Information Model - FIND - SOP Class */
|
||||
this. PrivateStudyRootQueryRetrieveInformationModelFIND = "1.2.40.0.13.1.5.1.4.1.2.2.1";
|
||||
|
||||
/** Private Blocked Study Root Query/Retrieve Information Model - FIND - SOP Class */
|
||||
this. PrivateBlockedStudyRootQueryRetrieveInformationModelFIND = "1.2.40.0.13.1.5.1.4.1.2.2.1.1";
|
||||
|
||||
/** Private Virtual Multiframe Study Root Query/Retrieve Information Model - FIND - SOP Class */
|
||||
this. PrivateVirtualMultiframeStudyRootQueryRetrieveInformationModelFIND = "1.2.40.0.13.1.5.1.4.1.2.2.1.2";
|
||||
|
||||
/** Verification SOP Class - SOP Class */
|
||||
this. VerificationSOPClass = "1.2.840.10008.1.1";
|
||||
|
||||
/** Implicit VR Little Endian - Transfer Syntax */
|
||||
this. ImplicitVRLittleEndian = "1.2.840.10008.1.2";
|
||||
|
||||
/** Explicit VR Little Endian - Transfer Syntax */
|
||||
this. ExplicitVRLittleEndian = "1.2.840.10008.1.2.1";
|
||||
|
||||
/** Deflated Explicit VR Little Endian - Transfer Syntax */
|
||||
this. DeflatedExplicitVRLittleEndian = "1.2.840.10008.1.2.1.99";
|
||||
|
||||
/** Explicit VR Big Endian - Transfer Syntax */
|
||||
this. ExplicitVRBigEndian = "1.2.840.10008.1.2.2";
|
||||
|
||||
/** MPEG2 Main Profile @ Main Level - Transfer Syntax */
|
||||
this. MPEG2 = "1.2.840.10008.1.2.4.100";
|
||||
|
||||
/** JPEG Baseline (Process 1) - Transfer Syntax */
|
||||
this. JPEGBaseline1 = "1.2.840.10008.1.2.4.50";
|
||||
|
||||
/** JPEG Extended (Process 2 & 4) - Transfer Syntax */
|
||||
this. JPEGExtended24 = "1.2.840.10008.1.2.4.51";
|
||||
|
||||
/** JPEG Extended (Process 3 & 5) (Retired) - Transfer Syntax */
|
||||
this. JPEGExtended35Retired = "1.2.840.10008.1.2.4.52";
|
||||
|
||||
/** JPEG Spectral Selection, Non-Hierarchical (Process 6 & 8) (Retired) - Transfer Syntax */
|
||||
this. JPEGSpectralSelectionNonHierarchical68Retired = "1.2.840.10008.1.2.4.53";
|
||||
|
||||
/** JPEG Spectral Selection, Non-Hierarchical (Process 7 & 9) (Retired) - Transfer Syntax */
|
||||
this. JPEGSpectralSelectionNonHierarchical79Retired = "1.2.840.10008.1.2.4.54";
|
||||
|
||||
/** JPEG Full Progression, Non-Hierarchical (Process 10 & 12) (Retired) - Transfer Syntax */
|
||||
this. JPEGFullProgressionNonHierarchical1012Retired = "1.2.840.10008.1.2.4.55";
|
||||
|
||||
/** JPEG Full Progression, Non-Hierarchical (Process 11 & 13) (Retired) - Transfer Syntax */
|
||||
this. JPEGFullProgressionNonHierarchical1113Retired = "1.2.840.10008.1.2.4.56";
|
||||
|
||||
/** JPEG Lossless, Non-Hierarchical (Process 14) - Transfer Syntax */
|
||||
this. JPEGLosslessNonHierarchical14 = "1.2.840.10008.1.2.4.57";
|
||||
|
||||
/** JPEG Lossless, Non-Hierarchical (Process 15) (Retired) - Transfer Syntax */
|
||||
this. JPEGLosslessNonHierarchical15Retired = "1.2.840.10008.1.2.4.58";
|
||||
|
||||
/** JPEG Extended, Hierarchical (Process 16 & 18) (Retired) - Transfer Syntax */
|
||||
this. JPEGExtendedHierarchical1618Retired = "1.2.840.10008.1.2.4.59";
|
||||
|
||||
/** JPEG Extended, Hierarchical (Process 17 & 19) (Retired) - Transfer Syntax */
|
||||
this. JPEGExtendedHierarchical1719Retired = "1.2.840.10008.1.2.4.60";
|
||||
|
||||
/** JPEG Spectral Selection, Hierarchical (Process 20 & 22) (Retired) - Transfer Syntax */
|
||||
this. JPEGSpectralSelectionHierarchical2022Retired = "1.2.840.10008.1.2.4.61";
|
||||
|
||||
/** JPEG Spectral Selection, Hierarchical (Process 21 & 23) (Retired) - Transfer Syntax */
|
||||
this. JPEGSpectralSelectionHierarchical2123Retired = "1.2.840.10008.1.2.4.62";
|
||||
|
||||
/** JPEG Full Progression, Hierarchical (Process 24 & 26) (Retired) - Transfer Syntax */
|
||||
this. JPEGFullProgressionHierarchical2426Retired = "1.2.840.10008.1.2.4.63";
|
||||
|
||||
/** JPEG Full Progression, Hierarchical (Process 25 & 27) (Retired) - Transfer Syntax */
|
||||
this. JPEGFullProgressionHierarchical2527Retired = "1.2.840.10008.1.2.4.64";
|
||||
|
||||
/** JPEG Lossless, Hierarchical (Process 28) (Retired) - Transfer Syntax */
|
||||
this. JPEGLosslessHierarchical28Retired = "1.2.840.10008.1.2.4.65";
|
||||
|
||||
/** JPEG Lossless, Hierarchical (Process 29) (Retired) - Transfer Syntax */
|
||||
this. JPEGLosslessHierarchical29Retired = "1.2.840.10008.1.2.4.66";
|
||||
|
||||
/** JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1]) - Transfer Syntax */
|
||||
this. JPEGLossless = "1.2.840.10008.1.2.4.70";
|
||||
|
||||
/** JPEG-LS Lossless Image Compression - Transfer Syntax */
|
||||
this. JPEGLSLossless = "1.2.840.10008.1.2.4.80";
|
||||
|
||||
/** JPEG-LS Lossy (Near-Lossless) Image Compression - Transfer Syntax */
|
||||
this. JPEGLSLossyNearLossless = "1.2.840.10008.1.2.4.81";
|
||||
|
||||
/** JPEG 2000 Image Compression (Lossless Only) - Transfer Syntax */
|
||||
this. JPEG2000LosslessOnly = "1.2.840.10008.1.2.4.90";
|
||||
|
||||
/** JPEG 2000 Image Compression - Transfer Syntax */
|
||||
this. JPEG2000 = "1.2.840.10008.1.2.4.91";
|
||||
|
||||
/** JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only) - Transfer Syntax */
|
||||
this. JPEG2000Part2MulticomponentLosslessOnly = "1.2.840.10008.1.2.4.92";
|
||||
|
||||
/** JPEG 2000 Part 2 Multi-component Image Compression - Transfer Syntax */
|
||||
this. JPEG2000Part2Multicomponent = "1.2.840.10008.1.2.4.93";
|
||||
|
||||
/** JPIP Referenced - Transfer Syntax */
|
||||
this. JPIPReferenced = "1.2.840.10008.1.2.4.94";
|
||||
|
||||
/** JPIP Referenced Deflate - Transfer Syntax */
|
||||
this. JPIPReferencedDeflate = "1.2.840.10008.1.2.4.95";
|
||||
|
||||
/** RLE Lossless - Transfer Syntax */
|
||||
this. RLELossless = "1.2.840.10008.1.2.5";
|
||||
|
||||
/** RFC 2557 MIME encapsulation - Transfer Syntax */
|
||||
this. RFC2557MIMEencapsulation = "1.2.840.10008.1.2.6.1";
|
||||
|
||||
/** XML Encoding - Transfer Syntax */
|
||||
this. XMLEncoding = "1.2.840.10008.1.2.6.2";
|
||||
|
||||
/** Storage Commitment Push Model SOP Class - SOP Class */
|
||||
this. StorageCommitmentPushModelSOPClass = "1.2.840.10008.1.20.1";
|
||||
|
||||
/** Storage Commitment Push Model SOP Instance - Well-known SOP Instance */
|
||||
this. StorageCommitmentPushModelSOPInstance = "1.2.840.10008.1.20.1.1";
|
||||
|
||||
/** Storage Commitment Pull Model SOP Class (Retired) - SOP Class */
|
||||
this. StorageCommitmentPullModelSOPClassRetired = "1.2.840.10008.1.20.2";
|
||||
|
||||
/** Storage Commitment Pull Model SOP Instance (Retired) - Well-known SOP Instance */
|
||||
this. StorageCommitmentPullModelSOPInstanceRetired = "1.2.840.10008.1.20.2.1";
|
||||
|
||||
/** Media Storage Directory Storage - SOP Class */
|
||||
this. MediaStorageDirectoryStorage = "1.2.840.10008.1.3.10";
|
||||
|
||||
/** Talairach Brain Atlas Frame of Reference - Well-known frame of reference */
|
||||
this. TalairachBrainAtlasFrameofReference = "1.2.840.10008.1.4.1.1";
|
||||
|
||||
/** SPM2 GRAY Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2GRAYFrameofReference = "1.2.840.10008.1.4.1.10";
|
||||
|
||||
/** SPM2 WHITE Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2WHITEFrameofReference = "1.2.840.10008.1.4.1.11";
|
||||
|
||||
/** SPM2 CSF Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2CSFFrameofReference = "1.2.840.10008.1.4.1.12";
|
||||
|
||||
/** SPM2 BRAINMASK Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2BRAINMASKFrameofReference = "1.2.840.10008.1.4.1.13";
|
||||
|
||||
/** SPM2 AVG305T1 Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2AVG305T1FrameofReference = "1.2.840.10008.1.4.1.14";
|
||||
|
||||
/** SPM2 AVG152T1 Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2AVG152T1FrameofReference = "1.2.840.10008.1.4.1.15";
|
||||
|
||||
/** SPM2 AVG152T2 Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2AVG152T2FrameofReference = "1.2.840.10008.1.4.1.16";
|
||||
|
||||
/** SPM2 AVG152PD Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2AVG152PDFrameofReference = "1.2.840.10008.1.4.1.17";
|
||||
|
||||
/** SPM2 SINGLESUBJT1 Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2SINGLESUBJT1FrameofReference = "1.2.840.10008.1.4.1.18";
|
||||
|
||||
/** SPM2 T1 Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2T1FrameofReference = "1.2.840.10008.1.4.1.2";
|
||||
|
||||
/** SPM2 T2 Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2T2FrameofReference = "1.2.840.10008.1.4.1.3";
|
||||
|
||||
/** SPM2 PD Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2PDFrameofReference = "1.2.840.10008.1.4.1.4";
|
||||
|
||||
/** SPM2 EPI Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2EPIFrameofReference = "1.2.840.10008.1.4.1.5";
|
||||
|
||||
/** SPM2 FIL T1 Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2FILT1FrameofReference = "1.2.840.10008.1.4.1.6";
|
||||
|
||||
/** SPM2 PET Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2PETFrameofReference = "1.2.840.10008.1.4.1.7";
|
||||
|
||||
/** SPM2 TRANSM Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2TRANSMFrameofReference = "1.2.840.10008.1.4.1.8";
|
||||
|
||||
/** SPM2 SPECT Frame of Reference - Well-known frame of reference */
|
||||
this. SPM2SPECTFrameofReference = "1.2.840.10008.1.4.1.9";
|
||||
|
||||
/** ICBM 452 T1 Frame of Reference - Well-known frame of reference */
|
||||
this. ICBM452T1FrameofReference = "1.2.840.10008.1.4.2.1";
|
||||
|
||||
/** ICBM Single Subject MRI Frame of Reference - Well-known frame of reference */
|
||||
this. ICBMSingleSubjectMRIFrameofReference = "1.2.840.10008.1.4.2.2";
|
||||
|
||||
/** Procedural Event Logging SOP Class - SOP Class */
|
||||
this. ProceduralEventLoggingSOPClass = "1.2.840.10008.1.40";
|
||||
|
||||
/** Procedural Event Logging SOP Instance - Well-known SOP Instance */
|
||||
this. ProceduralEventLoggingSOPInstance = "1.2.840.10008.1.40.1";
|
||||
|
||||
/** Basic Study Content Notification SOP Class (Retired) - SOP Class */
|
||||
this. BasicStudyContentNotificationSOPClassRetired = "1.2.840.10008.1.9";
|
||||
|
||||
/** dicomDeviceName - LDAP OID */
|
||||
this. dicomDeviceName = "1.2.840.10008.15.0.3.1";
|
||||
|
||||
/** dicomAssociationInitiator - LDAP OID */
|
||||
this. dicomAssociationInitiator = "1.2.840.10008.15.0.3.10";
|
||||
|
||||
/** dicomAssociationAcceptor - LDAP OID */
|
||||
this. dicomAssociationAcceptor = "1.2.840.10008.15.0.3.11";
|
||||
|
||||
/** dicomHostname - LDAP OID */
|
||||
this. dicomHostname = "1.2.840.10008.15.0.3.12";
|
||||
|
||||
/** dicomPort - LDAP OID */
|
||||
this. dicomPort = "1.2.840.10008.15.0.3.13";
|
||||
|
||||
/** dicomSOPClass - LDAP OID */
|
||||
this. dicomSOPClass = "1.2.840.10008.15.0.3.14";
|
||||
|
||||
/** dicomTransferRole - LDAP OID */
|
||||
this. dicomTransferRole = "1.2.840.10008.15.0.3.15";
|
||||
|
||||
/** dicomTransferSyntax - LDAP OID */
|
||||
this. dicomTransferSyntax = "1.2.840.10008.15.0.3.16";
|
||||
|
||||
/** dicomPrimaryDeviceType - LDAP OID */
|
||||
this. dicomPrimaryDeviceType = "1.2.840.10008.15.0.3.17";
|
||||
|
||||
/** dicomRelatedDeviceReference - LDAP OID */
|
||||
this. dicomRelatedDeviceReference = "1.2.840.10008.15.0.3.18";
|
||||
|
||||
/** dicomPreferredCalledAETitle - LDAP OID */
|
||||
this. dicomPreferredCalledAETitle = "1.2.840.10008.15.0.3.19";
|
||||
|
||||
/** dicomDescription - LDAP OID */
|
||||
this. dicomDescription = "1.2.840.10008.15.0.3.2";
|
||||
|
||||
/** dicomTLSCyphersuite - LDAP OID */
|
||||
this. dicomTLSCyphersuite = "1.2.840.10008.15.0.3.20";
|
||||
|
||||
/** dicomAuthorizedNodeCertificateReference - LDAP OID */
|
||||
this. dicomAuthorizedNodeCertificateReference = "1.2.840.10008.15.0.3.21";
|
||||
|
||||
/** dicomThisNodeCertificateReference - LDAP OID */
|
||||
this. dicomThisNodeCertificateReference = "1.2.840.10008.15.0.3.22";
|
||||
|
||||
/** dicomInstalled - LDAP OID */
|
||||
this. dicomInstalled = "1.2.840.10008.15.0.3.23";
|
||||
|
||||
/** dicomStationName - LDAP OID */
|
||||
this. dicomStationName = "1.2.840.10008.15.0.3.24";
|
||||
|
||||
/** dicomDeviceSerialNumber - LDAP OID */
|
||||
this. dicomDeviceSerialNumber = "1.2.840.10008.15.0.3.25";
|
||||
|
||||
/** dicomInstitutionName - LDAP OID */
|
||||
this. dicomInstitutionName = "1.2.840.10008.15.0.3.26";
|
||||
|
||||
/** dicomInstitutionAddress - LDAP OID */
|
||||
this. dicomInstitutionAddress = "1.2.840.10008.15.0.3.27";
|
||||
|
||||
/** dicomInstitutionDepartmentName - LDAP OID */
|
||||
this. dicomInstitutionDepartmentName = "1.2.840.10008.15.0.3.28";
|
||||
|
||||
/** dicomIssuerOfPatientID - LDAP OID */
|
||||
this. dicomIssuerOfPatientID = "1.2.840.10008.15.0.3.29";
|
||||
|
||||
/** dicomManufacturer - LDAP OID */
|
||||
this. dicomManufacturer = "1.2.840.10008.15.0.3.3";
|
||||
|
||||
/** dicomPreferredCallingAETitle - LDAP OID */
|
||||
this. dicomPreferredCallingAETitle = "1.2.840.10008.15.0.3.30";
|
||||
|
||||
/** dicomSupportedCharacterSet - LDAP OID */
|
||||
this. dicomSupportedCharacterSet = "1.2.840.10008.15.0.3.31";
|
||||
|
||||
/** dicomManufacturerModelName - LDAP OID */
|
||||
this. dicomManufacturerModelName = "1.2.840.10008.15.0.3.4";
|
||||
|
||||
/** dicomSoftwareVersion - LDAP OID */
|
||||
this. dicomSoftwareVersion = "1.2.840.10008.15.0.3.5";
|
||||
|
||||
/** dicomVendorData - LDAP OID */
|
||||
this. dicomVendorData = "1.2.840.10008.15.0.3.6";
|
||||
|
||||
/** dicomAETitle - LDAP OID */
|
||||
this. dicomAETitle = "1.2.840.10008.15.0.3.7";
|
||||
|
||||
/** dicomNetworkConnectionReference - LDAP OID */
|
||||
this. dicomNetworkConnectionReference = "1.2.840.10008.15.0.3.8";
|
||||
|
||||
/** dicomApplicationCluster - LDAP OID */
|
||||
this. dicomApplicationCluster = "1.2.840.10008.15.0.3.9";
|
||||
|
||||
/** dicomConfigurationRoot - LDAP OID */
|
||||
this. dicomConfigurationRoot = "1.2.840.10008.15.0.4.1";
|
||||
|
||||
/** dicomDevicesRoot - LDAP OID */
|
||||
this. dicomDevicesRoot = "1.2.840.10008.15.0.4.2";
|
||||
|
||||
/** dicomUniqueAETitlesRegistryRoot - LDAP OID */
|
||||
this. dicomUniqueAETitlesRegistryRoot = "1.2.840.10008.15.0.4.3";
|
||||
|
||||
/** dicomDevice - LDAP OID */
|
||||
this. dicomDevice = "1.2.840.10008.15.0.4.4";
|
||||
|
||||
/** dicomNetworkAE - LDAP OID */
|
||||
this. dicomNetworkAE = "1.2.840.10008.15.0.4.5";
|
||||
|
||||
/** dicomNetworkConnection - LDAP OID */
|
||||
this. dicomNetworkConnection = "1.2.840.10008.15.0.4.6";
|
||||
|
||||
/** dicomUniqueAETitle - LDAP OID */
|
||||
this. dicomUniqueAETitle = "1.2.840.10008.15.0.4.7";
|
||||
|
||||
/** dicomTransferCapability - LDAP OID */
|
||||
this. dicomTransferCapability = "1.2.840.10008.15.0.4.8";
|
||||
|
||||
/** DICOM Controlled Terminology - Coding Scheme */
|
||||
this. DICOMControlledTerminology = "1.2.840.10008.2.16.4";
|
||||
|
||||
/** DICOM UID Registry - DICOM UIDs as a Coding Scheme */
|
||||
this. DICOMUIDRegistry = "1.2.840.10008.2.6.1";
|
||||
|
||||
/** DICOM Application Context Name - Application Context Name */
|
||||
this. DICOMApplicationContextName = "1.2.840.10008.3.1.1.1";
|
||||
|
||||
/** Detached Patient Management SOP Class (Retired) - SOP Class */
|
||||
this. DetachedPatientManagementSOPClassRetired = "1.2.840.10008.3.1.2.1.1";
|
||||
|
||||
/** Detached Patient Management Meta SOP Class (Retired) - Meta SOP Class */
|
||||
this. DetachedPatientManagementMetaSOPClassRetired = "1.2.840.10008.3.1.2.1.4";
|
||||
|
||||
/** Detached Visit Management SOP Class (Retired) - SOP Class */
|
||||
this. DetachedVisitManagementSOPClassRetired = "1.2.840.10008.3.1.2.2.1";
|
||||
|
||||
/** Detached Study Management SOP Class (Retired) - SOP Class */
|
||||
this. DetachedStudyManagementSOPClassRetired = "1.2.840.10008.3.1.2.3.1";
|
||||
|
||||
/** Study Component Management SOP Class (Retired) - SOP Class */
|
||||
this. StudyComponentManagementSOPClassRetired = "1.2.840.10008.3.1.2.3.2";
|
||||
|
||||
/** Modality Performed Procedure Step SOP Class - SOP Class */
|
||||
this. ModalityPerformedProcedureStepSOPClass = "1.2.840.10008.3.1.2.3.3";
|
||||
|
||||
/** Modality Performed Procedure Step Retrieve SOP Class - SOP Class */
|
||||
this. ModalityPerformedProcedureStepRetrieveSOPClass = "1.2.840.10008.3.1.2.3.4";
|
||||
|
||||
/** Modality Performed Procedure Step Notification SOP Class - SOP Class */
|
||||
this. ModalityPerformedProcedureStepNotificationSOPClass = "1.2.840.10008.3.1.2.3.5";
|
||||
|
||||
/** Detached Results Management SOP Class (Retired) - SOP Class */
|
||||
this. DetachedResultsManagementSOPClassRetired = "1.2.840.10008.3.1.2.5.1";
|
||||
|
||||
/** Detached Results Management Meta SOP Class (Retired) - Meta SOP Class */
|
||||
this. DetachedResultsManagementMetaSOPClassRetired = "1.2.840.10008.3.1.2.5.4";
|
||||
|
||||
/** Detached Study Management Meta SOP Class (Retired) - Meta SOP Class */
|
||||
this. DetachedStudyManagementMetaSOPClassRetired = "1.2.840.10008.3.1.2.5.5";
|
||||
|
||||
/** Detached Interpretation Management SOP Class (Retired) - SOP Class */
|
||||
this. DetachedInterpretationManagementSOPClassRetired = "1.2.840.10008.3.1.2.6.1";
|
||||
|
||||
/** Storage Service Class - Service Class */
|
||||
this. StorageServiceClass = "1.2.840.10008.4.2";
|
||||
|
||||
/** Basic Film Session SOP Class - SOP Class */
|
||||
this. BasicFilmSessionSOPClass = "1.2.840.10008.5.1.1.1";
|
||||
|
||||
/** Print Job SOP Class - SOP Class */
|
||||
this. PrintJobSOPClass = "1.2.840.10008.5.1.1.14";
|
||||
|
||||
/** Basic Annotation Box SOP Class - SOP Class */
|
||||
this. BasicAnnotationBoxSOPClass = "1.2.840.10008.5.1.1.15";
|
||||
|
||||
/** Printer SOP Class - SOP Class */
|
||||
this. PrinterSOPClass = "1.2.840.10008.5.1.1.16";
|
||||
|
||||
/** Printer Configuration Retrieval SOP Class - SOP Class */
|
||||
this. PrinterConfigurationRetrievalSOPClass = "1.2.840.10008.5.1.1.16.376";
|
||||
|
||||
/** Printer SOP Instance - Well-known Printer SOP Instance */
|
||||
this. PrinterSOPInstance = "1.2.840.10008.5.1.1.17";
|
||||
|
||||
/** Printer Configuration Retrieval SOP Instance - Well-known Printer SOP Instance */
|
||||
this. PrinterConfigurationRetrievalSOPInstance = "1.2.840.10008.5.1.1.17.376";
|
||||
|
||||
/** Basic Color Print Management Meta SOP Class - Meta SOP Class */
|
||||
this. BasicColorPrintManagementMetaSOPClass = "1.2.840.10008.5.1.1.18";
|
||||
|
||||
/** Referenced Color Print Management Meta SOP Class (Retired) - Meta SOP Class */
|
||||
this. ReferencedColorPrintManagementMetaSOPClassRetired = "1.2.840.10008.5.1.1.18.1";
|
||||
|
||||
/** Basic Film Box SOP Class - SOP Class */
|
||||
this. BasicFilmBoxSOPClass = "1.2.840.10008.5.1.1.2";
|
||||
|
||||
/** VOI LUT Box SOP Class - SOP Class */
|
||||
this. VOILUTBoxSOPClass = "1.2.840.10008.5.1.1.22";
|
||||
|
||||
/** Presentation LUT SOP Class - SOP Class */
|
||||
this. PresentationLUTSOPClass = "1.2.840.10008.5.1.1.23";
|
||||
|
||||
/** Image Overlay Box SOP Class (Retired) - SOP Class */
|
||||
this. ImageOverlayBoxSOPClassRetired = "1.2.840.10008.5.1.1.24";
|
||||
|
||||
/** Basic Print Image Overlay Box SOP Class (Retired) - SOP Class */
|
||||
this. BasicPrintImageOverlayBoxSOPClassRetired = "1.2.840.10008.5.1.1.24.1";
|
||||
|
||||
/** Print Queue SOP Instance (Retired) - Well-known Print Queue SOP Instance */
|
||||
this. PrintQueueSOPInstanceRetired = "1.2.840.10008.5.1.1.25";
|
||||
|
||||
/** Print Queue Management SOP Class (Retired) - SOP Class */
|
||||
this. PrintQueueManagementSOPClassRetired = "1.2.840.10008.5.1.1.26";
|
||||
|
||||
/** Stored Print Storage SOP Class (Retired) - SOP Class */
|
||||
this. StoredPrintStorageSOPClassRetired = "1.2.840.10008.5.1.1.27";
|
||||
|
||||
/** Hardcopy Grayscale Image Storage SOP Class (Retired) - SOP Class */
|
||||
this. HardcopyGrayscaleImageStorageSOPClassRetired = "1.2.840.10008.5.1.1.29";
|
||||
|
||||
/** Hardcopy Color Image Storage SOP Class (Retired) - SOP Class */
|
||||
this. HardcopyColorImageStorageSOPClassRetired = "1.2.840.10008.5.1.1.30";
|
||||
|
||||
/** Pull Print Request SOP Class (Retired) - SOP Class */
|
||||
this. PullPrintRequestSOPClassRetired = "1.2.840.10008.5.1.1.31";
|
||||
|
||||
/** Pull Stored Print Management Meta SOP Class (Retired) - Meta SOP Class */
|
||||
this. PullStoredPrintManagementMetaSOPClassRetired = "1.2.840.10008.5.1.1.32";
|
||||
|
||||
/** Media Creation Management SOP Class UID - SOP Class */
|
||||
this. MediaCreationManagementSOPClassUID = "1.2.840.10008.5.1.1.33";
|
||||
|
||||
/** Basic Grayscale Image Box SOP Class - SOP Class */
|
||||
this. BasicGrayscaleImageBoxSOPClass = "1.2.840.10008.5.1.1.4";
|
||||
|
||||
/** Basic Color Image Box SOP Class - SOP Class */
|
||||
this. BasicColorImageBoxSOPClass = "1.2.840.10008.5.1.1.4.1";
|
||||
|
||||
/** Referenced Image Box SOP Class (Retired) - SOP Class */
|
||||
this. ReferencedImageBoxSOPClassRetired = "1.2.840.10008.5.1.1.4.2";
|
||||
|
||||
/** Basic Grayscale Print Management Meta SOP Class - Meta SOP Class */
|
||||
this. BasicGrayscalePrintManagementMetaSOPClass = "1.2.840.10008.5.1.1.9";
|
||||
|
||||
/** Referenced Grayscale Print Management Meta SOP Class (Retired) - Meta SOP Class */
|
||||
this. ReferencedGrayscalePrintManagementMetaSOPClassRetired = "1.2.840.10008.5.1.1.9.1";
|
||||
|
||||
/** Computed Radiography Image Storage - SOP Class */
|
||||
this. ComputedRadiographyImageStorage = "1.2.840.10008.5.1.4.1.1.1";
|
||||
|
||||
/** Digital X-Ray Image Storage - For Presentation - SOP Class */
|
||||
this. DigitalXRayImageStorageForPresentation = "1.2.840.10008.5.1.4.1.1.1.1";
|
||||
|
||||
/** Digital X-Ray Image Storage - For Processing - SOP Class */
|
||||
this. DigitalXRayImageStorageForProcessing = "1.2.840.10008.5.1.4.1.1.1.1.1";
|
||||
|
||||
/** Digital Mammography X-Ray Image Storage - For Presentation - SOP Class */
|
||||
this. DigitalMammographyXRayImageStorageForPresentation = "1.2.840.10008.5.1.4.1.1.1.2";
|
||||
|
||||
/** Digital Mammography X-Ray Image Storage - For Processing - SOP Class */
|
||||
this. DigitalMammographyXRayImageStorageForProcessing = "1.2.840.10008.5.1.4.1.1.1.2.1";
|
||||
|
||||
/** Digital Intra-oral X-Ray Image Storage - For Presentation - SOP Class */
|
||||
this. DigitalIntraoralXRayImageStorageForPresentation = "1.2.840.10008.5.1.4.1.1.1.3";
|
||||
|
||||
/** Digital Intra-oral X-Ray Image Storage - For Processing - SOP Class */
|
||||
this. DigitalIntraoralXRayImageStorageForProcessing = "1.2.840.10008.5.1.4.1.1.1.3.1";
|
||||
|
||||
/** Standalone Modality LUT Storage (Retired) - SOP Class */
|
||||
this. StandaloneModalityLUTStorageRetired = "1.2.840.10008.5.1.4.1.1.10";
|
||||
|
||||
/** Encapsulated PDF Storage - SOP Class */
|
||||
this. EncapsulatedPDFStorage = "1.2.840.10008.5.1.4.1.1.104.1";
|
||||
|
||||
/** Encapsulated CDA Storage - SOP Class */
|
||||
this. EncapsulatedCDAStorage = "1.2.840.10008.5.1.4.1.1.104.2";
|
||||
|
||||
/** Standalone VOI LUT Storage (Retired) - SOP Class */
|
||||
this. StandaloneVOILUTStorageRetired = "1.2.840.10008.5.1.4.1.1.11";
|
||||
|
||||
/** Grayscale Softcopy Presentation State Storage SOP Class - SOP Class */
|
||||
this. GrayscaleSoftcopyPresentationStateStorageSOPClass = "1.2.840.10008.5.1.4.1.1.11.1";
|
||||
|
||||
/** Color Softcopy Presentation State Storage SOP Class - SOP Class */
|
||||
this. ColorSoftcopyPresentationStateStorageSOPClass = "1.2.840.10008.5.1.4.1.1.11.2";
|
||||
|
||||
/** Pseudo-Color Softcopy Presentation State Storage SOP Class - SOP Class */
|
||||
this. PseudoColorSoftcopyPresentationStateStorageSOPClass = "1.2.840.10008.5.1.4.1.1.11.3";
|
||||
|
||||
/** Blending Softcopy Presentation State Storage SOP Class - SOP Class */
|
||||
this. BlendingSoftcopyPresentationStateStorageSOPClass = "1.2.840.10008.5.1.4.1.1.11.4";
|
||||
|
||||
/** X-Ray Angiographic Image Storage - SOP Class */
|
||||
this. XRayAngiographicImageStorage = "1.2.840.10008.5.1.4.1.1.12.1";
|
||||
|
||||
/** Enhanced XA Image Storage - SOP Class */
|
||||
this. EnhancedXAImageStorage = "1.2.840.10008.5.1.4.1.1.12.1.1";
|
||||
|
||||
/** X-Ray Radiofluoroscopic Image Storage - SOP Class */
|
||||
this. XRayRadiofluoroscopicImageStorage = "1.2.840.10008.5.1.4.1.1.12.2";
|
||||
|
||||
/** Enhanced XRF Image Storage - SOP Class */
|
||||
this. EnhancedXRFImageStorage = "1.2.840.10008.5.1.4.1.1.12.2.1";
|
||||
|
||||
/** X-Ray Angiographic Bi-Plane Image Storage (Retired) - SOP Class */
|
||||
this. XRayAngiographicBiPlaneImageStorageRetired = "1.2.840.10008.5.1.4.1.1.12.3";
|
||||
|
||||
/** Positron Emission Tomography Image Storage - SOP Class */
|
||||
this. PositronEmissionTomographyImageStorage = "1.2.840.10008.5.1.4.1.1.128";
|
||||
|
||||
/** Standalone PET Curve Storage (Retired) - SOP Class */
|
||||
this. StandalonePETCurveStorageRetired = "1.2.840.10008.5.1.4.1.1.129";
|
||||
|
||||
/** X-Ray 3D Angiographic Image Storage - SOP Class */
|
||||
this. XRay3DAngiographicImageStorage = "1.2.840.10008.5.1.4.1.1.13.1.1";
|
||||
|
||||
/** X-Ray 3D Craniofacial Image Storage - SOP Class */
|
||||
this. XRay3DCraniofacialImageStorage = "1.2.840.10008.5.1.4.1.1.13.1.2";
|
||||
|
||||
/** CT Image Storage - SOP Class */
|
||||
this. CTImageStorage = "1.2.840.10008.5.1.4.1.1.2";
|
||||
|
||||
/** Enhanced CT Image Storage - SOP Class */
|
||||
this. EnhancedCTImageStorage = "1.2.840.10008.5.1.4.1.1.2.1";
|
||||
|
||||
/** Nuclear Medicine Image Storage - SOP Class */
|
||||
this. NuclearMedicineImageStorage = "1.2.840.10008.5.1.4.1.1.20";
|
||||
|
||||
/** Ultrasound Multi-frame Image Storage (Retired) - SOP Class */
|
||||
this. UltrasoundMultiframeImageStorageRetired = "1.2.840.10008.5.1.4.1.1.3";
|
||||
|
||||
/** Ultrasound Multi-frame Image Storage - SOP Class */
|
||||
this. UltrasoundMultiframeImageStorage = "1.2.840.10008.5.1.4.1.1.3.1";
|
||||
|
||||
/** MR Image Storage - SOP Class */
|
||||
this. MRImageStorage = "1.2.840.10008.5.1.4.1.1.4";
|
||||
|
||||
/** Enhanced MR Image Storage - SOP Class */
|
||||
this. EnhancedMRImageStorage = "1.2.840.10008.5.1.4.1.1.4.1";
|
||||
|
||||
/** MR Spectroscopy Storage - SOP Class */
|
||||
this. MRSpectroscopyStorage = "1.2.840.10008.5.1.4.1.1.4.2";
|
||||
|
||||
/** RT Image Storage - SOP Class */
|
||||
this. RTImageStorage = "1.2.840.10008.5.1.4.1.1.481.1";
|
||||
|
||||
/** RT Dose Storage - SOP Class */
|
||||
this. RTDoseStorage = "1.2.840.10008.5.1.4.1.1.481.2";
|
||||
|
||||
/** RT Structure Set Storage - SOP Class */
|
||||
this. RTStructureSetStorage = "1.2.840.10008.5.1.4.1.1.481.3";
|
||||
|
||||
/** RT Beams Treatment Record Storage - SOP Class */
|
||||
this. RTBeamsTreatmentRecordStorage = "1.2.840.10008.5.1.4.1.1.481.4";
|
||||
|
||||
/** RT Plan Storage - SOP Class */
|
||||
this. RTPlanStorage = "1.2.840.10008.5.1.4.1.1.481.5";
|
||||
|
||||
/** RT Brachy Treatment Record Storage - SOP Class */
|
||||
this. RTBrachyTreatmentRecordStorage = "1.2.840.10008.5.1.4.1.1.481.6";
|
||||
|
||||
/** RT Treatment Summary Record Storage - SOP Class */
|
||||
this. RTTreatmentSummaryRecordStorage = "1.2.840.10008.5.1.4.1.1.481.7";
|
||||
|
||||
/** RT Ion Plan Storage - SOP Class */
|
||||
this. RTIonPlanStorage = "1.2.840.10008.5.1.4.1.1.481.8";
|
||||
|
||||
/** RT Ion Beams Treatment Record Storage - SOP Class */
|
||||
this. RTIonBeamsTreatmentRecordStorage = "1.2.840.10008.5.1.4.1.1.481.9";
|
||||
|
||||
/** Nuclear Medicine Image Storage (Retired) - SOP Class */
|
||||
this. NuclearMedicineImageStorageRetired = "1.2.840.10008.5.1.4.1.1.5";
|
||||
|
||||
/** Ultrasound Image Storage (Retired) - SOP Class */
|
||||
this. UltrasoundImageStorageRetired = "1.2.840.10008.5.1.4.1.1.6";
|
||||
|
||||
/** Ultrasound Image Storage - SOP Class */
|
||||
this. UltrasoundImageStorage = "1.2.840.10008.5.1.4.1.1.6.1";
|
||||
|
||||
/** Raw Data Storage - SOP Class */
|
||||
this. RawDataStorage = "1.2.840.10008.5.1.4.1.1.66";
|
||||
|
||||
/** Spatial Registration Storage - SOP Class */
|
||||
this. SpatialRegistrationStorage = "1.2.840.10008.5.1.4.1.1.66.1";
|
||||
|
||||
/** Spatial Fiducials Storage - SOP Class */
|
||||
this. SpatialFiducialsStorage = "1.2.840.10008.5.1.4.1.1.66.2";
|
||||
|
||||
/** Deformable Spatial Registration Storage - SOP Class */
|
||||
this. DeformableSpatialRegistrationStorage = "1.2.840.10008.5.1.4.1.1.66.3";
|
||||
|
||||
/** Segmentation Storage - SOP Class */
|
||||
this. SegmentationStorage = "1.2.840.10008.5.1.4.1.1.66.4";
|
||||
|
||||
/** Real World Value Mapping Storage - SOP Class */
|
||||
this. RealWorldValueMappingStorage = "1.2.840.10008.5.1.4.1.1.67";
|
||||
|
||||
/** Secondary Capture Image Storage - SOP Class */
|
||||
this. SecondaryCaptureImageStorage = "1.2.840.10008.5.1.4.1.1.7";
|
||||
|
||||
/** Multi-frame Single Bit Secondary Capture Image Storage - SOP Class */
|
||||
this. MultiframeSingleBitSecondaryCaptureImageStorage = "1.2.840.10008.5.1.4.1.1.7.1";
|
||||
|
||||
/** Multi-frame Grayscale Byte Secondary Capture Image Storage - SOP Class */
|
||||
this. MultiframeGrayscaleByteSecondaryCaptureImageStorage = "1.2.840.10008.5.1.4.1.1.7.2";
|
||||
|
||||
/** Multi-frame Grayscale Word Secondary Capture Image Storage - SOP Class */
|
||||
this. MultiframeGrayscaleWordSecondaryCaptureImageStorage = "1.2.840.10008.5.1.4.1.1.7.3";
|
||||
|
||||
/** Multi-frame True Color Secondary Capture Image Storage - SOP Class */
|
||||
this. MultiframeTrueColorSecondaryCaptureImageStorage = "1.2.840.10008.5.1.4.1.1.7.4";
|
||||
|
||||
/** VL Image Storage (Retired) - */
|
||||
this. VLImageStorageRetired = "1.2.840.10008.5.1.4.1.1.77.1";
|
||||
|
||||
/** VL Endoscopic Image Storage - SOP Class */
|
||||
this. VLEndoscopicImageStorage = "1.2.840.10008.5.1.4.1.1.77.1.1";
|
||||
|
||||
/** Video Endoscopic Image Storage - SOP Class */
|
||||
this. VideoEndoscopicImageStorage = "1.2.840.10008.5.1.4.1.1.77.1.1.1";
|
||||
|
||||
/** VL Microscopic Image Storage - SOP Class */
|
||||
this. VLMicroscopicImageStorage = "1.2.840.10008.5.1.4.1.1.77.1.2";
|
||||
|
||||
/** Video Microscopic Image Storage - SOP Class */
|
||||
this. VideoMicroscopicImageStorage = "1.2.840.10008.5.1.4.1.1.77.1.2.1";
|
||||
|
||||
/** VL Slide-Coordinates Microscopic Image Storage - SOP Class */
|
||||
this. VLSlideCoordinatesMicroscopicImageStorage = "1.2.840.10008.5.1.4.1.1.77.1.3";
|
||||
|
||||
/** VL Photographic Image Storage - SOP Class */
|
||||
this. VLPhotographicImageStorage = "1.2.840.10008.5.1.4.1.1.77.1.4";
|
||||
|
||||
/** Video Photographic Image Storage - SOP Class */
|
||||
this. VideoPhotographicImageStorage = "1.2.840.10008.5.1.4.1.1.77.1.4.1";
|
||||
|
||||
/** Ophthalmic Photography 8 Bit Image Storage - SOP Class */
|
||||
this. OphthalmicPhotography8BitImageStorage = "1.2.840.10008.5.1.4.1.1.77.1.5.1";
|
||||
|
||||
/** Ophthalmic Photography 16 Bit Image Storage - SOP Class */
|
||||
this. OphthalmicPhotography16BitImageStorage = "1.2.840.10008.5.1.4.1.1.77.1.5.2";
|
||||
|
||||
/** Stereometric Relationship Storage - SOP Class */
|
||||
this. StereometricRelationshipStorage = "1.2.840.10008.5.1.4.1.1.77.1.5.3";
|
||||
|
||||
/** VL Multi-frame Image Storage (Retired) - */
|
||||
this. VLMultiframeImageStorageRetired = "1.2.840.10008.5.1.4.1.1.77.2";
|
||||
|
||||
/** Standalone Overlay Storage (Retired) - SOP Class */
|
||||
this. StandaloneOverlayStorageRetired = "1.2.840.10008.5.1.4.1.1.8";
|
||||
|
||||
/** Basic Text SR - SOP Class */
|
||||
this. BasicTextSR = "1.2.840.10008.5.1.4.1.1.88.11";
|
||||
|
||||
/** Enhanced SR - SOP Class */
|
||||
this. EnhancedSR = "1.2.840.10008.5.1.4.1.1.88.22";
|
||||
|
||||
/** Comprehensive SR - SOP Class */
|
||||
this. ComprehensiveSR = "1.2.840.10008.5.1.4.1.1.88.33";
|
||||
|
||||
/** Procedure Log Storage - SOP Class */
|
||||
this. ProcedureLogStorage = "1.2.840.10008.5.1.4.1.1.88.40";
|
||||
|
||||
/** Mammography CAD SR - SOP Class */
|
||||
this. MammographyCADSR = "1.2.840.10008.5.1.4.1.1.88.50";
|
||||
|
||||
/** Key Object Selection Document - SOP Class */
|
||||
this. KeyObjectSelectionDocument = "1.2.840.10008.5.1.4.1.1.88.59";
|
||||
|
||||
/** Chest CAD SR - SOP Class */
|
||||
this. ChestCADSR = "1.2.840.10008.5.1.4.1.1.88.65";
|
||||
|
||||
/** X-Ray Radiation Dose SR - SOP Class */
|
||||
this. XRayRadiationDoseSR = "1.2.840.10008.5.1.4.1.1.88.67";
|
||||
|
||||
/** Standalone Curve Storage (Retired) - SOP Class */
|
||||
this. StandaloneCurveStorageRetired = "1.2.840.10008.5.1.4.1.1.9";
|
||||
|
||||
/** 12-lead ECG Waveform Storage - SOP Class */
|
||||
this. _12leadECGWaveformStorage = "1.2.840.10008.5.1.4.1.1.9.1.1";
|
||||
|
||||
/** General ECG Waveform Storage - SOP Class */
|
||||
this. GeneralECGWaveformStorage = "1.2.840.10008.5.1.4.1.1.9.1.2";
|
||||
|
||||
/** Ambulatory ECG Waveform Storage - SOP Class */
|
||||
this. AmbulatoryECGWaveformStorage = "1.2.840.10008.5.1.4.1.1.9.1.3";
|
||||
|
||||
/** Hemodynamic Waveform Storage - SOP Class */
|
||||
this. HemodynamicWaveformStorage = "1.2.840.10008.5.1.4.1.1.9.2.1";
|
||||
|
||||
/** Cardiac Electrophysiology Waveform Storage - SOP Class */
|
||||
this. CardiacElectrophysiologyWaveformStorage = "1.2.840.10008.5.1.4.1.1.9.3.1";
|
||||
|
||||
/** Basic Voice Audio Waveform Storage - SOP Class */
|
||||
this. BasicVoiceAudioWaveformStorage = "1.2.840.10008.5.1.4.1.1.9.4.1";
|
||||
|
||||
/** Patient Root Query/Retrieve Information Model - FIND - SOP Class */
|
||||
this. PatientRootQueryRetrieveInformationModelFIND = "1.2.840.10008.5.1.4.1.2.1.1";
|
||||
|
||||
/** Patient Root Query/Retrieve Information Model - MOVE - SOP Class */
|
||||
this. PatientRootQueryRetrieveInformationModelMOVE = "1.2.840.10008.5.1.4.1.2.1.2";
|
||||
|
||||
/** Patient Root Query/Retrieve Information Model - GET - SOP Class */
|
||||
this. PatientRootQueryRetrieveInformationModelGET = "1.2.840.10008.5.1.4.1.2.1.3";
|
||||
|
||||
/** Study Root Query/Retrieve Information Model - FIND - SOP Class */
|
||||
this. StudyRootQueryRetrieveInformationModelFIND = "1.2.840.10008.5.1.4.1.2.2.1";
|
||||
|
||||
/** Study Root Query/Retrieve Information Model - MOVE - SOP Class */
|
||||
this. StudyRootQueryRetrieveInformationModelMOVE = "1.2.840.10008.5.1.4.1.2.2.2";
|
||||
|
||||
/** Study Root Query/Retrieve Information Model - GET - SOP Class */
|
||||
this. StudyRootQueryRetrieveInformationModelGET = "1.2.840.10008.5.1.4.1.2.2.3";
|
||||
|
||||
/** Patient/Study Only Query/Retrieve Information Model - FIND (Retired) - SOP Class */
|
||||
this. PatientStudyOnlyQueryRetrieveInformationModelFINDRetired = "1.2.840.10008.5.1.4.1.2.3.1";
|
||||
|
||||
/** Patient/Study Only Query/Retrieve Information Model - MOVE (Retired) - SOP Class */
|
||||
this. PatientStudyOnlyQueryRetrieveInformationModelMOVERetired = "1.2.840.10008.5.1.4.1.2.3.2";
|
||||
|
||||
/** Patient/Study Only Query/Retrieve Information Model - GET (Retired) - SOP Class */
|
||||
this. PatientStudyOnlyQueryRetrieveInformationModelGETRetired = "1.2.840.10008.5.1.4.1.2.3.3";
|
||||
|
||||
/** Modality Worklist Information Model - FIND - SOP Class */
|
||||
this. ModalityWorklistInformationModelFIND = "1.2.840.10008.5.1.4.31";
|
||||
|
||||
/** General Purpose Worklist Management Meta SOP Class - Meta SOP Class */
|
||||
this. GeneralPurposeWorklistManagementMetaSOPClass = "1.2.840.10008.5.1.4.32";
|
||||
|
||||
/** General Purpose Worklist Information Model - FIND - SOP Class */
|
||||
this. GeneralPurposeWorklistInformationModelFIND = "1.2.840.10008.5.1.4.32.1";
|
||||
|
||||
/** General Purpose Scheduled Procedure Step SOP Class - SOP Class */
|
||||
this. GeneralPurposeScheduledProcedureStepSOPClass = "1.2.840.10008.5.1.4.32.2";
|
||||
|
||||
/** General Purpose Performed Procedure Step SOP Class - SOP Class */
|
||||
this. GeneralPurposePerformedProcedureStepSOPClass = "1.2.840.10008.5.1.4.32.3";
|
||||
|
||||
/** Instance Availability Notification SOP Class - SOP Class */
|
||||
this. InstanceAvailabilityNotificationSOPClass = "1.2.840.10008.5.1.4.33";
|
||||
|
||||
/** General Relevant Patient Information Query - SOP Class */
|
||||
this. GeneralRelevantPatientInformationQuery = "1.2.840.10008.5.1.4.37.1";
|
||||
|
||||
/** Breast Imaging Relevant Patient Information Query - SOP Class */
|
||||
this. BreastImagingRelevantPatientInformationQuery = "1.2.840.10008.5.1.4.37.2";
|
||||
|
||||
/** Cardiac Relevant Patient Information Query - SOP Class */
|
||||
this. CardiacRelevantPatientInformationQuery = "1.2.840.10008.5.1.4.37.3";
|
||||
|
||||
/** Hanging Protocol Storage - SOP Class */
|
||||
this. HangingProtocolStorage = "1.2.840.10008.5.1.4.38.1";
|
||||
|
||||
/** Hanging Protocol Information Model - FIND - SOP Class */
|
||||
this. HangingProtocolInformationModelFIND = "1.2.840.10008.5.1.4.38.2";
|
||||
|
||||
/** Hanging Protocol Information Model - MOVE - SOP Class */
|
||||
this. HangingProtocolInformationModelMOVE = "1.2.840.10008.5.1.4.38.3";
|
||||
|
||||
/** Siemens CSA Non-Image Storage - SOP Class */
|
||||
this. SiemensCSANonImageStorage = "1.3.12.2.1107.5.9.1";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* VR.js
|
||||
* Version 0.5
|
||||
* Author: BabuHussain<babuhussain.a@raster.in>
|
||||
*/
|
||||
|
||||
function VR()
|
||||
{
|
||||
this.AE="AE";
|
||||
this.AS="AS";
|
||||
this.AT="AT";
|
||||
this.CS="CS";
|
||||
this.DA="DA";
|
||||
this.DS="DS";
|
||||
this.DT="DT";
|
||||
this.FD="FD";
|
||||
this.FL="FL";
|
||||
this.IS="IS";
|
||||
this.LO="IO";
|
||||
this.LT="LT";
|
||||
this.OB="OB";
|
||||
this.OF="OF";
|
||||
this.OW="OW";
|
||||
this.PN="PN";
|
||||
this.SH="SH";
|
||||
this.SL="SL";
|
||||
this.SQ="SQ";
|
||||
this.SS="SS";
|
||||
this.ST="ST";
|
||||
this.TM="TM";
|
||||
this.UI="UI";
|
||||
this.UL="UL";
|
||||
this.UN="UN";
|
||||
this.US="US";
|
||||
this.UT="UT";
|
||||
function valueOf(vr)
|
||||
{
|
||||
switch (vr)
|
||||
{
|
||||
case this.AE:
|
||||
return this.AE;
|
||||
case this.AS:
|
||||
return this.AS;
|
||||
case this.AT:
|
||||
return this.AT;
|
||||
case this.CS:
|
||||
return this.CS;
|
||||
case this.DA:
|
||||
return this.DA;
|
||||
case this.DS:
|
||||
return this.DS;
|
||||
case this.DT:
|
||||
return this.DT;
|
||||
case this.FD:
|
||||
return this.FD;
|
||||
case this.FL:
|
||||
return this.FL;
|
||||
case this.IS:
|
||||
return this.IS;
|
||||
case this.LO:
|
||||
return this.LO;
|
||||
case this.LT:
|
||||
return this.LT;
|
||||
case this.OB:
|
||||
return this.OB;
|
||||
case this.OF:
|
||||
return this.OF;
|
||||
case this.OW:
|
||||
return this.OW;
|
||||
case this.PN:
|
||||
return this.PN;
|
||||
case this.SH:
|
||||
return this.SH;
|
||||
case this.SL:
|
||||
return this.SL;
|
||||
case this.SQ:
|
||||
return this.SQ;
|
||||
case this.SS:
|
||||
return this.SS;
|
||||
case this.ST:
|
||||
return this.ST;
|
||||
case this.TM:
|
||||
return this.TM;
|
||||
case this.UI:
|
||||
return this.UI;
|
||||
case this.UL:
|
||||
return this.UL;
|
||||
case this.UN:
|
||||
return this.UN;
|
||||
case this.US:
|
||||
return this.US;
|
||||
case this.UT:
|
||||
return this.UT;
|
||||
}
|
||||
throw new Error("VR does not match ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,334 @@
|
||||
var syncEnabled = true;
|
||||
var displayScout = false;
|
||||
var mouseLocX;
|
||||
var mouseLocY;
|
||||
var mousePressed;
|
||||
var loopSpeed = 500;
|
||||
|
||||
var imageCanvas = null,pixelBuffer = null, lookupObj = null, pixelData = null, state = null, tmpCanvas = null, numPixels = 0;
|
||||
var windowCenter,windowWidth,wlDisplay,modifiedWC,modifiedWW;
|
||||
var wlApplied = false;
|
||||
|
||||
String.prototype.replaceAll = function(pcFrom, pcTo){
|
||||
var i = this.indexOf(pcFrom);
|
||||
var c = this;
|
||||
while (i > -1){
|
||||
c = c.replace(pcFrom, pcTo);
|
||||
i = c.indexOf(pcFrom);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
function createEvent(eventName, obj) {
|
||||
var event,ieVersion;
|
||||
if(ieVersion<=11) { //TODO
|
||||
} else {
|
||||
event = new CustomEvent(
|
||||
eventName,{
|
||||
detail: obj
|
||||
}
|
||||
);
|
||||
}
|
||||
window.dispatchEvent(event);
|
||||
}
|
||||
|
||||
jQuery(document).mouseup(function(e) {
|
||||
createEvent("ToolSelection",{tool:"mouseup"});
|
||||
});
|
||||
|
||||
function hideToolbar() {
|
||||
jQuery("#toolbarContainer").css("display","none");
|
||||
jQuery("#westPane").css("height","100%");
|
||||
jQuery("#tabs_div").css("height","100%");
|
||||
}
|
||||
|
||||
function doLayout() {
|
||||
jQuery('.toggleOff').removeClass('toggleOff');
|
||||
var divElement = document.getElementById('tabs_div');
|
||||
jQuery(divElement).children().remove();
|
||||
|
||||
var seriesData = JSON.parse(sessionStorage[pat.studyUID]);
|
||||
var cnt = 0,divContent='<table width="100%" height="100%" cellspacing="2" cellpadding="0" border="0" >';
|
||||
|
||||
for(var x=0; x<rowIndex+1;x++) {
|
||||
divContent+='<tr>';
|
||||
for(var y=0;y<colIndex+1;y++) {
|
||||
divContent += '<td><iframe id="frame' + cnt;
|
||||
divContent += '" height="100%" width="100%" frameBorder="0" scrolling="yes" ';
|
||||
|
||||
if(cnt < seriesData.length) {
|
||||
var data = seriesData[cnt];
|
||||
while(cnt<seriesData.length && hasOnlyRawData(data['seriesUID'])) {
|
||||
cnt+=1;
|
||||
data = seriesData[cnt];
|
||||
}
|
||||
if(cnt<seriesData.length) {
|
||||
divContent+='src="frameContent.html?study=' + pat.studyUID + '&series=' + data['seriesUID'] + '&seriesDesc=' + data['seriesDesc'] + '&images=' + data['totalInstances'] + '&modality=' + data['modality'] +'" style="background:#000; visibility: hidden;"></iframe></td>';
|
||||
} else {
|
||||
divContent += ' ' + 'style="background:#000; visibility: hidden;"></iframe></td>';
|
||||
}
|
||||
cnt+=1;
|
||||
} else {
|
||||
divContent += ' ' + 'style="background:#000; visibility: hidden;" src="frameContent.html' + '"></iframe></td>';
|
||||
cnt+=1;
|
||||
}
|
||||
} // End of column iteration
|
||||
} // End of row iteration
|
||||
divContent += '</table>';
|
||||
divElement.innerHTML = divContent;
|
||||
}
|
||||
|
||||
function hasOnlyRawData(ser_Uid) {
|
||||
return $('#'+ser_Uid.replace(/\./g,'_')+"_table").find('.image').length==0;
|
||||
}
|
||||
|
||||
function showMetaData(queryString) {
|
||||
jQuery('#loadingView').show();
|
||||
setTimeout(function() {
|
||||
var insUID = getParameter(queryString, 'object');
|
||||
|
||||
var url = "";
|
||||
if(pat.serverURL.indexOf("wado") >=0) {
|
||||
url = "Image.do?serverURL=" + pat.serverURL;
|
||||
url += '&contentType=application/dicom&study=' + pat.studyUID;
|
||||
url += '&series=' + getParameter(queryString,'series');
|
||||
url += '&object=' + insUID;
|
||||
url += '&transferSyntax=1.2.840.10008.1.2';
|
||||
} else {
|
||||
url = "Wado.do?study=" + pat.studyUID + "&object=" + insUID + "&contentType=application/dicom";
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', url, true);
|
||||
xhr.responseType = 'blob';
|
||||
|
||||
xhr.onload = function(e) {
|
||||
if (this.status == 200) {
|
||||
var myBlob = this.response;
|
||||
var reader = new FileReader();
|
||||
reader.onloadend = function(evt) {
|
||||
var dicomParser = new ovm.dicom.DicomParser(evt.target.result);
|
||||
dicomParser.parseAll();
|
||||
|
||||
// tag list table (without the pixel data)
|
||||
var data = dicomParser.dicomElements;
|
||||
if(data.PixelData!=undefined) {
|
||||
data.PixelData.value = "...";
|
||||
}
|
||||
|
||||
var node = document.createElement('div');
|
||||
// new table
|
||||
var table = ovm.html.toTable(data);
|
||||
table.className = "tagList";
|
||||
|
||||
// append new table
|
||||
node.appendChild(table);
|
||||
// display it
|
||||
node.style.display='';
|
||||
|
||||
// table search form
|
||||
var tagSearchform = document.createElement("form");
|
||||
tagSearchform.setAttribute("class", "filter");
|
||||
var input = document.createElement("input");
|
||||
input.onkeyup = function() {
|
||||
ovm.html.filterTable(input, table);
|
||||
};
|
||||
|
||||
var span = document.createElement("span");
|
||||
span.innerHTML = "Search: ";
|
||||
tagSearchform.appendChild(span);
|
||||
tagSearchform.appendChild(input);
|
||||
node.insertBefore(tagSearchform, table);
|
||||
|
||||
jQuery(node).dialog({
|
||||
title: 'Meta-data',
|
||||
modal: true,
|
||||
height: 500,
|
||||
width: 700
|
||||
});
|
||||
};
|
||||
|
||||
reader.readAsBinaryString(myBlob);
|
||||
}
|
||||
jQuery('#loadingView').hide();
|
||||
};
|
||||
xhr.send();
|
||||
},1);
|
||||
}
|
||||
|
||||
// To view in fullscreen
|
||||
function doFullScreen(fullscreenDiv) {
|
||||
var fsImg = jQuery(fullscreenDiv).children().get(0);
|
||||
var viewContent = document.getElementById('optional-container');
|
||||
if(!window.fullScreenApi.isFullScreen()) {
|
||||
window.fullScreenApi.requestFullScreen(viewContent);
|
||||
fsImg.src = 'images/fullscreen0.png';
|
||||
} else {
|
||||
window.fullScreenApi.cancelFullScreen(viewContent);
|
||||
fsImg.src = 'images/fullscreen1.png';
|
||||
}
|
||||
}
|
||||
|
||||
function doInvert(imageCanvas,wlApplied) {
|
||||
var iNewWidth = imageCanvas.width;
|
||||
var iNewHeight = imageCanvas.height;
|
||||
|
||||
var oCtx = imageCanvas.getContext("2d");
|
||||
var dataSrc = oCtx.getImageData(0,0,iNewWidth,iNewHeight);
|
||||
var dataDst = oCtx.getImageData(0,0,iNewWidth,iNewHeight);
|
||||
var aDataSrc = dataSrc.data;
|
||||
var aDataDst = dataDst.data;
|
||||
|
||||
var y = iNewHeight;
|
||||
do {
|
||||
var iOffsetY = (y-1)*iNewWidth*4;
|
||||
var x = iNewWidth;
|
||||
do {
|
||||
var iOffset = iOffsetY + (x-1)*4;
|
||||
if(!wlApplied) {
|
||||
aDataDst[iOffset] = 255 - aDataSrc[iOffset];
|
||||
aDataDst[iOffset+1] = 255 - aDataSrc[iOffset+1];
|
||||
aDataDst[iOffset+2] = 255 - aDataSrc[iOffset+2];
|
||||
aDataDst[iOffset+3] = aDataSrc[iOffset+3];
|
||||
} else {
|
||||
aDataDst[iOffset+3] = 255 - aDataSrc[iOffset+3];
|
||||
}
|
||||
} while (--x);
|
||||
} while (--y);
|
||||
oCtx.putImageData(dataDst,0,0);
|
||||
}
|
||||
|
||||
function getActiveFrame() {
|
||||
var frames = jQuery(document).find('iframe');
|
||||
|
||||
if(frames.length <= 1) {
|
||||
return frames[0];
|
||||
} else {
|
||||
for(var k=0; k<frames.length; k++) {
|
||||
if(jQuery(frames[k]).contents().find('body').css('border') == '1px solid rgb(255, 138, 0)') {
|
||||
return frames[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getActiveFrameForStudy(studyUid) {
|
||||
var frames = jQuery(document).find('iframe');
|
||||
|
||||
for(var k=0; k<frames.length; k++) {
|
||||
if(pat.studyUID==studyUid) {
|
||||
if(frames.length<=1) {
|
||||
return frames[0];
|
||||
}
|
||||
|
||||
if(jQuery(frames[k]).contents().find('body').css('border') == '1px solid rgb(255, 138, 0)') {
|
||||
return frames[k];
|
||||
}
|
||||
} else { // Other study
|
||||
if(jQuery(frames[k]).contents().find('#studyId').html()==studyUid) {
|
||||
return frames[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function changeLayout(layoutUrl) {
|
||||
jQuery('#contentDiv').html('');
|
||||
jQuery('#contentDiv').load(layoutUrl);
|
||||
jQuery('#contentDiv').show();
|
||||
|
||||
jQuery("#contentDiv").mouseleave(function() {
|
||||
jQuery(this).hide();
|
||||
});
|
||||
}
|
||||
|
||||
function setSeriesIdentification() {
|
||||
var framesCnt = jQuery(document).find('iframe');
|
||||
|
||||
jQuery('.seriesImgsIndex', document).each(function() {
|
||||
var children = jQuery(this).children();
|
||||
var imgCnt = 0;
|
||||
children.each(function() {
|
||||
var bgColor = jQuery(this).css('background-color');
|
||||
|
||||
if(bgColor == 'rgb(255, 0, 0)') {
|
||||
var imgToggleMode = jQuery(this).parent().next().find('img').attr('src');
|
||||
if(imgToggleMode == 'images/three.png') {
|
||||
if(imgCnt == 0 || imgCnt == Math.round(children.size()/2)-1 || imgCnt == children.size()-1) {
|
||||
jQuery(this).css('background-color', 'rgb(0, 0, 255)');
|
||||
} else {
|
||||
jQuery(this).css('background-color', !jQuery(this).hasClass('waiting') ? 'rgb(166, 166, 166)' : 'rgb(70, 70, 70)');
|
||||
}
|
||||
} else if(imgToggleMode == "images/one.png") {
|
||||
if(imgCnt==0) {
|
||||
jQuery(this).css('background-color', 'rgb(0, 0, 255)');
|
||||
} else {
|
||||
jQuery(this).css('background-color', !jQuery(this).hasClass('waiting') ? 'rgb(166, 166, 166)' : 'rgb(70, 70, 70)');
|
||||
}
|
||||
} else {
|
||||
jQuery(this).css('background-color', 'rgb(0, 0, 255)');
|
||||
}
|
||||
}
|
||||
imgCnt++;
|
||||
});
|
||||
});
|
||||
for(var x=0;x<framesCnt.size();x++) {
|
||||
var contents = jQuery(framesCnt[x]).contents();
|
||||
if(contents.find('#serId').html()!=null){
|
||||
if(jQuery(contents.find('#multiframe')).css('visibility')!="hidden") {
|
||||
var object = getParameter(contents.find('#frameSrc').html(),"object");
|
||||
var cont_td = jQuery('#' + object.replace(/\./g,'_'), document);
|
||||
|
||||
jQuery(cont_td.children().get(0)).css('background-color', 'rgb(255,0,0)');
|
||||
} else {
|
||||
var serUidTmp = contents.find('#serId').html().split('_');
|
||||
var cont_td = jQuery('#' + serUidTmp[0].replace(/\./g,'_'), document);
|
||||
|
||||
var i = 1;
|
||||
|
||||
cont_td.children().each(function(){
|
||||
if(i==serUidTmp[1]) {
|
||||
jQuery(this).css('background-color', 'rgb(255,0,0)');
|
||||
}
|
||||
i++;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function doSyncSeries() {
|
||||
var curr = jQuery('#syncSeries');
|
||||
|
||||
if(!syncEnabled) {
|
||||
syncEnabled = true;
|
||||
curr.children().get(0).src= 'images/Link.png';
|
||||
} else {
|
||||
syncEnabled = false;
|
||||
curr.children().get(0).src= 'images/unlink.png';
|
||||
}
|
||||
}
|
||||
|
||||
function enableWindowingContext() {
|
||||
jQuery('#windowing').enableContextMenu();
|
||||
}
|
||||
|
||||
function disableWindowingContext() {
|
||||
jQuery('#windowing').disableContextMenu();
|
||||
}
|
||||
|
||||
function enableMeasureContext() {
|
||||
jQuery('#measure').enableContextMenu();
|
||||
}
|
||||
|
||||
function disableMeasureContext() {
|
||||
jQuery('#measure').disableContextMenu();
|
||||
}
|
||||
|
||||
function repositionTiles(src) {
|
||||
var table = jQuery('#tabs_div').children().get(0);
|
||||
var tr = table.rows[0];
|
||||
var td = tr.insertCell(jQuery(tr).children().length);
|
||||
td.innerHTML = '<td> <iframe height="100%" width="100%" frameBorder=0 scrolling="no" style="visibility: hidden;" src="' + src+ '"></iframe> </td>';
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
function viewImage(fileName, container) {
|
||||
if(fileName.indexOf(".pdf") == -1) {
|
||||
jQuery(container).attr('sopUID', fileName.substring(0, fileName.indexOf('.jpg')));
|
||||
} else {
|
||||
jQuery(container).attr('sopUID', fileName.substring(0, fileName.indexOf('.jpg')));
|
||||
}
|
||||
|
||||
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
|
||||
|
||||
window.requestFileSystem(window.TEMPORARY, 1024*1024, function(fs) {
|
||||
fs.root.getFile(fileName, {}, function(fileEntry) {
|
||||
fileEntry.file(function(file) {
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onloadend = function(e) {
|
||||
var img = document.createElement("img");
|
||||
if(fileName.indexOf(".pdf") == -1) {
|
||||
img.src = reader.result;
|
||||
}
|
||||
if(container.name == '1.2.840.10008.5.1.4.1.1.104.1') {
|
||||
container.src = 'images/pdf.png';
|
||||
} else {
|
||||
container.src = img.src;
|
||||
}
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}, fileHandler);
|
||||
}, fileHandler);
|
||||
}, fileHandler);
|
||||
}
|
||||
|
||||
function fileHandler(e) {
|
||||
var msg = '';
|
||||
|
||||
switch (e.code) {
|
||||
case FileError.QUOTA_EXCEEDED_ERR:
|
||||
msg = 'QUOTA_EXCEEDED_ERR';
|
||||
break;
|
||||
case FileError.NOT_FOUND_ERR:
|
||||
msg = 'NOT_FOUND_ERR';
|
||||
break;
|
||||
case FileError.SECURITY_ERR:
|
||||
msg = 'SECURITY_ERR';
|
||||
break;
|
||||
case FileError.INVALID_MODIFICATION_ERR:
|
||||
msg = 'INVALID_MODIFICATION_ERR';
|
||||
break;
|
||||
case FileError.INVALID_STATE_ERR:
|
||||
msg = 'INVALID_STATE_ERR';
|
||||
break;
|
||||
default:
|
||||
msg = 'Unknown Error';
|
||||
break;
|
||||
};
|
||||
|
||||
console.log('Error: ' + msg);
|
||||
}
|
||||
@@ -0,0 +1,874 @@
|
||||
var imgInc=1, inc = 5,total,frameInc=1;
|
||||
var seriesUid;
|
||||
var data;
|
||||
var state = {translationX : 0,translationY: 0,scale: 0,vflip: false,hflip: false,rotate: 0,invert: false,drag: false};
|
||||
var navState = {screenNavImgFactor: 0.15,navigationImgFactor:0.3,scale:0,width:0,height:0,outline:{x:0,y:0,w:0,h:0},drag:false};
|
||||
var doMouseWheel = true;
|
||||
var loopTimer = null;
|
||||
var pixelBuffer = null, lookupObj = null, pixelData = null, tmpCanvas = null, numPixels = 0;
|
||||
var windowCenter='',windowWidth,modifiedWC=undefined,modifiedWW=undefined,maxPix=0,minPix=0;
|
||||
var mouseLocX;
|
||||
var mouseLocY;
|
||||
var mousePressed;
|
||||
var columns;
|
||||
var isSliderLoaded = false;
|
||||
var winProgress = 100;
|
||||
|
||||
jQuery('#ImagePane').ready(function() {
|
||||
|
||||
var ht = jQuery(window).height();
|
||||
jQuery('body').css('height',ht - 3 + 'px' );
|
||||
|
||||
jQuery('#footer').css("height",(ht-165) + "px");
|
||||
jQuery('#trackbar1').css("height",(ht-200) + "px");
|
||||
jQuery('#end').css("top",(ht-170) + "px");
|
||||
|
||||
jQuery("#frameSrc").html(window.location.href);
|
||||
jQuery('#studyId').html(getParameter(window.location.href,'study'));
|
||||
|
||||
parent.window.addEventListener('selection',onTileSelection,false);
|
||||
parent.window.addEventListener('ToolSelection',onToolSelection,false);
|
||||
parent.window.addEventListener('sync',synchronize,false);
|
||||
window.parent.createEvent('selection',{"ImagePane":jQuery('#ImagePane')});
|
||||
loadImage();
|
||||
loadTextOverlay();
|
||||
|
||||
var canvasDiv = jQuery('#canvasDiv');
|
||||
|
||||
canvasDiv.on('mousewheel DOMMouseScroll', function (e) {
|
||||
|
||||
if(jQuery('body').css('border').indexOf('none')>=0){
|
||||
window.parent.createEvent('selection',{"ImagePane":jQuery('#ImagePane')});
|
||||
}
|
||||
|
||||
if(doMouseWheel) {
|
||||
if (e.originalEvent.wheelDelta < 0 || e.originalEvent.detail > 0) {
|
||||
nextImage();
|
||||
} else {
|
||||
prevImage();
|
||||
}
|
||||
}
|
||||
//prevent page from scrolling
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).keydown(function(e) {
|
||||
if(doMouseWheel) {
|
||||
if(e.which == 38 || e.which == 37) {
|
||||
prevImage();
|
||||
} else if(e.keyCode == 40 || e.keyCode == 39) {
|
||||
nextImage();
|
||||
}
|
||||
}
|
||||
if(e.which==46) {
|
||||
deleteSelectedMeasurement();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var oy,ny;
|
||||
canvasDiv.mousedown(function(e) {
|
||||
if(e.which==1) {
|
||||
if(jQuery('#tool').text()==='stackImage' && doMouseWheel) {
|
||||
oy = e.pageY;
|
||||
state.drag = true;
|
||||
|
||||
jQuery('#canvasDiv').mousemove(function(e1) {
|
||||
if(jQuery('#tool').text()==='stackImage' && state.drag) {
|
||||
ny = e1.pageY;
|
||||
if( (oy-ny) >inc) {
|
||||
prevImage();
|
||||
oy = ny;
|
||||
} else if( (oy-ny) < -(inc)) {
|
||||
nextImage();
|
||||
oy = ny;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('#canvasDiv').mouseup(function(e2) {
|
||||
state.drag = false;
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
canvasDiv.click(function(e) {
|
||||
window.parent.createEvent('selection',{"ImagePane":jQuery('#ImagePane')});
|
||||
});
|
||||
|
||||
jQuery("#canvasLayer2").dblclick(function(e) {
|
||||
toggleResolution();
|
||||
});
|
||||
|
||||
window.addEventListener('resize', resizeCanvas, false);
|
||||
jQuery('#tool').html('');
|
||||
|
||||
loadInstanceText(true,true);
|
||||
|
||||
if(window.parent.displayScout && (jQuery('#modalityDiv').html().indexOf('CT')>=0 || jQuery('#modalityDiv').html().indexOf('MR')>=0)) {
|
||||
Localizer.drawScout();
|
||||
}
|
||||
|
||||
if(window.parent.syncEnabled) {
|
||||
window.parent.createEvent('sync',{forUid:jQuery('#forUIDPanel').html(),fromTo:getFromToLoc()});
|
||||
}
|
||||
loadContextMenu();
|
||||
|
||||
});
|
||||
|
||||
jQuery(document).mouseup(function(e) {
|
||||
window.parent.createEvent("ToolSelection",{tool:"mouseup"});
|
||||
});
|
||||
|
||||
function loadImage() {
|
||||
var src = jQuery('#frameSrc').html();
|
||||
seriesUid = getParameter(src,'series');
|
||||
var instanceNo = getParameter(src,'instanceNumber');
|
||||
imgInc = instanceNo!=null ? parseInt(instanceNo)+1 : 1;
|
||||
|
||||
var img = jQuery('#' + (seriesUid+"_"+imgInc).replace(/\./g,'_'), window.parent.document).get(0);
|
||||
|
||||
if(img.src.indexOf('SR_Latest.png')>=0) {
|
||||
loadSR(jQuery(img).attr('imgSrc'));
|
||||
} else if(img.src.indexOf('pdf.png')>=0) {
|
||||
loadPDF(jQuery(img).attr('imgSrc'));
|
||||
} else {
|
||||
eliminateRawData();
|
||||
}
|
||||
jQuery('#loadingView', window.parent.document).hide();
|
||||
jQuery('iframe',window.parent.document).css('visibility','visible');
|
||||
}
|
||||
|
||||
function eliminateRawData() {
|
||||
try {
|
||||
showImage(seriesUid + "_" + imgInc);
|
||||
} catch(err) {
|
||||
if(err=='rawdata') {
|
||||
imgInc = imgInc+1;
|
||||
eliminateRawData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showImage(imgSrc,image) {
|
||||
var image = imgSrc!=null ? jQuery('#' + imgSrc.replace(/\./g,'_'), window.parent.document).get(0) : image;
|
||||
var canvas = document.getElementById('imageCanvas');
|
||||
|
||||
|
||||
var vWidth = canvas.parentNode.offsetWidth;
|
||||
var vHeight = canvas.parentNode.offsetHeight;
|
||||
|
||||
if(vWidth!=0 && vHeight!=0) {
|
||||
canvas.width = vWidth;
|
||||
canvas.height = vHeight;
|
||||
canvas.style.width = vWidth;
|
||||
canvas.style.height = vHeight;
|
||||
|
||||
var top = (canvas.parentNode.offsetHeight-canvas.height) / 2;
|
||||
canvas.style.marginTop = parseInt(top) + "px";
|
||||
|
||||
var left = (canvas.parentNode.offsetWidth - canvas.width) / 2;
|
||||
canvas.style.marginLeft = parseInt(left) + "px";
|
||||
|
||||
var siblings = jQuery(canvas).siblings().not('.preview');
|
||||
for(var j=0; j<siblings.length; j++) {
|
||||
var tmpCanvas = siblings.get(j);
|
||||
if(tmpCanvas != null) {
|
||||
tmpCanvas.width = vWidth;
|
||||
tmpCanvas.height = vHeight;
|
||||
tmpCanvas.style.width = vWidth;
|
||||
tmpCanvas.style.height = vHeight;
|
||||
tmpCanvas.style.marginTop = parseInt(top) + "px";
|
||||
tmpCanvas.style.marginLeft = parseInt(left) + "px";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
state.scale = Math.min(canvas.width/image.naturalWidth, canvas.height/image.naturalHeight);
|
||||
state.translationX = (canvas.width- parseInt(state.scale * image.naturalWidth))/2;
|
||||
state.translationY = (canvas.height- parseInt(state.scale * image.naturalHeight))/2;
|
||||
showImg(null,image,true);
|
||||
}
|
||||
|
||||
function showImg(imgSrc,img,updatePreview) {
|
||||
var image = imgSrc!=null ? jQuery('#'+imgSrc.replace(/\./g,'_'), window.parent.document).get(0) : img;
|
||||
if(image.src.indexOf('rawdata.png')>=0) {
|
||||
throw 'rawdata';
|
||||
return;
|
||||
}
|
||||
var canvas = document.getElementById('imageCanvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.save();
|
||||
ctx.setTransform(1,0,0,1,0,0);
|
||||
ctx.clearRect(0,0,canvas.width,canvas.height);
|
||||
|
||||
var translate = true;
|
||||
if(jQuery("#tool").html()=="move") {
|
||||
ctx.translate(state.translationX, state.translationY);
|
||||
translate = false;
|
||||
}
|
||||
|
||||
if(state.vflip) {
|
||||
ctx.translate(0,canvas.height);
|
||||
ctx.scale(1,-1);
|
||||
}
|
||||
|
||||
if(state.hflip) {
|
||||
ctx.translate(canvas.width,0);
|
||||
ctx.scale(-1,1);
|
||||
}
|
||||
|
||||
if(state.rotate!=0) {
|
||||
ctx.translate(canvas.width/2,canvas.height/2);
|
||||
ctx.rotate(state.rotate===90 ? Math.PI/2 : state.rotate===180? Math.PI : (Math.PI*3)/2);
|
||||
ctx.translate(-canvas.width/2,-canvas.height/2);
|
||||
}
|
||||
|
||||
if(translate) {
|
||||
ctx.translate(state.translationX, state.translationY);
|
||||
}
|
||||
ctx.scale(state.scale,state.scale);
|
||||
|
||||
ctx.drawImage(image,0,0);
|
||||
ctx.restore();
|
||||
|
||||
if(state.invert) {
|
||||
window.parent.doInvert(jQuery('#imageCanvas').get(0),false);
|
||||
}
|
||||
|
||||
if(updatePreview===true) {
|
||||
jQuery('#zoomPercent').html('Zoom: ' + parseInt(state.scale * 100) + '%');
|
||||
jQuery('#imageSize').html('Image size:' + image.naturalWidth + "x" + image.naturalHeight);
|
||||
jQuery('#viewSize').html('View size:' + canvas.width + "x" + canvas.height);
|
||||
loadPreview(image);
|
||||
}
|
||||
}
|
||||
|
||||
function loadTextOverlay() {
|
||||
jQuery('#patName').html(window.parent.pat.pat_Name);
|
||||
jQuery('#patID').html(window.parent.pat.pat_ID);
|
||||
jQuery("#patGender").html(window.parent.pat.pat_gender);
|
||||
|
||||
var src = jQuery('#frameSrc').html();
|
||||
jQuery('#seriesDesc').html(getParameter(src,'seriesDesc'));
|
||||
jQuery('#modalityDiv').html(getParameter(src,'modality'));
|
||||
total = parseInt(getParameter(src,'images'));
|
||||
jQuery('#totalImages').html(total>1 ? 'Images:' + (imgInc) + '/ ' + total :'Image:' + (imgInc) + '/ ' + total);
|
||||
loadSlider();
|
||||
|
||||
var studyData = JSON.parse(sessionStorage[window.parent.pat.pat_ID]);
|
||||
var thisStudy = getParameter(window.location.href,"study");
|
||||
|
||||
if(studyData!=undefined) {
|
||||
for(var st=0;st<studyData.length;st++) {
|
||||
var curr_study = studyData[st];
|
||||
|
||||
if(curr_study["studyUID"]==thisStudy) {
|
||||
jQuery('#studyDesc').html(curr_study['studyDesc']);
|
||||
jQuery('#studyDate').html(curr_study['studyDate']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadInstanceText(checkForUpdate,autoplay) {
|
||||
data = sessionStorage[seriesUid];
|
||||
if(data) {
|
||||
// try {
|
||||
data = JSON.parse(data);
|
||||
if(data!=null) {
|
||||
data = data[imgInc-1];
|
||||
if(data) {
|
||||
if(data['imageOrientation']!=undefined && data['imageOrientation']!='') {
|
||||
var imgOrient = data['imageOrientation'].split("\\");
|
||||
|
||||
jQuery('#imgOriRight').html(imgOrient[0]);
|
||||
jQuery('#imgOriBottom').html(imgOrient[1]);
|
||||
jQuery('#imgOriLeft').html(getOppositeOrientation(imgOrient[0]));
|
||||
jQuery('#imgOriTop').html(getOppositeOrientation(imgOrient[1]));
|
||||
}
|
||||
|
||||
if(modifiedWC!=undefined) {
|
||||
jQuery("#windowLevel").html('WL: ' + modifiedWC + ' / ' + 'WW: ' + modifiedWW);
|
||||
} else if(windowCenter=='') {
|
||||
windowCenter = data['windowCenter'];
|
||||
windowWidth = data['windowWidth'];
|
||||
|
||||
if(windowCenter && windowCenter.indexOf('|') >=0) {
|
||||
windowCenter = windowCenter.substring(0, windowCenter.indexOf('|'));
|
||||
}
|
||||
|
||||
if(windowWidth && windowWidth.indexOf('|') >=0) {
|
||||
windowWidth = windowWidth.substring(0, windowWidth.indexOf('|'));
|
||||
}
|
||||
jQuery("#windowLevel").html('WL: ' + windowCenter + ' / ' + 'WW: ' + windowWidth);
|
||||
}
|
||||
|
||||
if(data['numberOfFrames'] != undefined && data['numberOfFrames'] != '') {
|
||||
jQuery("#totalImages").html('Frames: ' + frameInc + ' / ' + data['numberOfFrames']);
|
||||
total = data['numberOfFrames'];
|
||||
jQuery('#multiframe').css('visibility','visible');
|
||||
|
||||
var frmSrc = jQuery('#frameSrc').text();
|
||||
frmSrc = frmSrc.substring(0,frmSrc.indexOf("&object"));
|
||||
jQuery('#frameSrc').html(frmSrc + "&object=" + data['SopUID']);
|
||||
|
||||
if(!isSliderLoaded) {
|
||||
jQuery("#totalImages").text('Frames:' + frameInc + '/' + data['numberOfFrames']);
|
||||
loadSlider();
|
||||
isSliderLoaded = true;
|
||||
}
|
||||
|
||||
if(autoplay) {
|
||||
var frameTime = parseFloat(data['frameTime']);
|
||||
if(frameTime>0.0) {
|
||||
doAutoplay(frameTime);
|
||||
} else {
|
||||
doAutoplay(15); // 15 FPS by default
|
||||
}
|
||||
}
|
||||
} else {
|
||||
jQuery('#totalImages').html(total>1 ? 'Images:' + (imgInc) + '/ ' + total :'Image:' + (imgInc) + '/ ' + total);
|
||||
jQuery('#multiframe').css('visibility','hidden');
|
||||
}
|
||||
|
||||
var sliceInfo = '';
|
||||
|
||||
if(data['sliceThickness'] != undefined && data['sliceThickness'] != '') {
|
||||
sliceInfo = 'Thick: ' + parseFloat(data['sliceThickness']).toFixed(2) + ' mm ';
|
||||
}
|
||||
|
||||
if(data['sliceLocation'] != undefined && data['sliceLocation'] != '') {
|
||||
sliceInfo += 'Loc: ' + parseFloat(data['sliceLocation']).toFixed(2) + ' mm';
|
||||
}
|
||||
|
||||
jQuery('#thickLocationPanel').html(sliceInfo);
|
||||
|
||||
if(data['frameOfReferenceUID'] != undefined) {
|
||||
jQuery('#forUIDPanel').html(data['frameOfReferenceUID']);
|
||||
}
|
||||
|
||||
if(data['refSOPInsUID'] != undefined) {
|
||||
jQuery('#refSOPInsUID').html(data['refSOPInsUID']);
|
||||
}
|
||||
|
||||
if(jQuery('#imgType').html()!=data['imageType']) {
|
||||
jQuery('#imgType').html(data['imageType']);
|
||||
Localizer.toggleLevelLine();
|
||||
}
|
||||
|
||||
jQuery('#imgPosition').html(data['imagePositionPatient']);
|
||||
jQuery('#imgOrientation').html(data['imageOrientPatient']);
|
||||
jQuery('#pixelSpacing').html(data['pixelSpacing']);
|
||||
jQuery('#imgPixelSpacing').html(data['imagerPixelSpacing']);
|
||||
} else {
|
||||
jQuery('#totalImages').html(total>1 ? 'Images:' + (imgInc) + '/ ' + total :'Image:' + (imgInc) + '/ ' + total);
|
||||
}
|
||||
} else if(checkForUpdate===true){
|
||||
setTimeout("loadInstanceText("+checkForUpdate + "," + autoplay +")",200);
|
||||
} else {
|
||||
jQuery('#totalImages').html(total>1 ? 'Images:' + (imgInc) + '/ ' + total :'Image:' + (imgInc) + '/ ' + total);
|
||||
}
|
||||
// } catch(e) {
|
||||
// console.log("DICOM attributes not available " + e);
|
||||
// jQuery('#totalImages').html(total>1 ? 'Images:' + (imgInc) + '/ ' + total :'Image:' + (imgInc) + '/ ' + total);
|
||||
// }
|
||||
} else if(checkForUpdate===true) {
|
||||
if(window.parent.pat.studyUID==jQuery('#studyId').html()) {
|
||||
setTimeout("loadInstanceText("+checkForUpdate + "," + autoplay +")",200);
|
||||
}
|
||||
} else {
|
||||
jQuery('#totalImages').html(total>1 ? 'Images:' + (imgInc) + '/ ' + total :'Image:' + (imgInc) + '/ ' + total);
|
||||
}
|
||||
setSliderValue();
|
||||
jQuery('#serId').html(seriesUid+'_'+imgInc);
|
||||
window.parent.setSeriesIdentification();
|
||||
|
||||
if(window.parent.displayScout && (jQuery('#modalityDiv').html().indexOf('CT')>=0 || jQuery('#modalityDiv').html().indexOf('MR')>=0)) {
|
||||
Localizer.drawScout();
|
||||
}
|
||||
}
|
||||
|
||||
function nextImage() {
|
||||
var isMultiframe = jQuery('#totalImages').html().indexOf('Frame')>=0;
|
||||
var iNo = !isMultiframe ? imgInc : frameInc;
|
||||
iNo = (iNo+1) <= total ? (iNo+1) : 1;
|
||||
loadImg(isMultiframe,iNo);
|
||||
imgLoaded();
|
||||
|
||||
}
|
||||
|
||||
function prevImage() {
|
||||
var isMultiframe = jQuery('#totalImages').html().indexOf('Frame')>=0;
|
||||
var iNo = !isMultiframe ? imgInc : frameInc;
|
||||
iNo = (iNo-1) >= 1 ? (iNo-1) : total;
|
||||
loadImg(isMultiframe,iNo);
|
||||
imgLoaded();
|
||||
}
|
||||
|
||||
function loadImg(isMultiframe,iNo) {
|
||||
var imgSrc = null;
|
||||
|
||||
if(window.parent.pat.serverURL.indexOf('wado')>0 && modifiedWC!=undefined && modifiedWW!=undefined && (modifiedWC!=windowCenter || modifiedWW!=windowWidth)) {
|
||||
if(!isMultiframe) {
|
||||
imgSrc = jQuery('#' + (seriesUid + "_" + iNo).replace(/\./g,'_'), window.parent.document).attr('src');
|
||||
this.imgInc = iNo;
|
||||
} else {
|
||||
imgSrc = jQuery('#' + (getParameter(jQuery('#frameSrc').html(),'object')+"_"+iNo).replace(/\./g,'_'), window.parent.document).attr('src');
|
||||
this.frameInc = iNo;
|
||||
}
|
||||
if(imgSrc.indexOf('windowCenter') >= 0) {
|
||||
imgSrc = imgSrc.substring(0, imgSrc.indexOf('&windowCenter='));
|
||||
}
|
||||
imgSrc += '&windowCenter=' + modifiedWC;
|
||||
imgSrc = imgSrc.trim() + '&windowWidth=' + modifiedWW;
|
||||
jQuery("#wltmpImg").attr('src',imgSrc);
|
||||
jQuery("#wltmpImg").attr("pos",iNo);
|
||||
} else {
|
||||
if(!isMultiframe) {
|
||||
try {
|
||||
showImg(seriesUid + "_" + iNo,null,true);
|
||||
} catch(err) { // Some times it might be raw data
|
||||
if(err=='rawdata') {
|
||||
iNo = imgInc;
|
||||
loadInstanceText(false,false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.imgInc = iNo;
|
||||
} else {
|
||||
imgSrc = getParameter(jQuery('#frameSrc').html(),'object')+"_"+iNo;
|
||||
showImg(imgSrc,null,true);
|
||||
this.frameInc = iNo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function imgLoaded() {
|
||||
loadInstanceText(false, false);
|
||||
clearMeasurements();
|
||||
if(window.parent.syncEnabled) {
|
||||
window.parent.createEvent('sync',{forUid:jQuery('#forUIDPanel').html(),fromTo:getFromToLoc()});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getParameter(queryString, parameterName) {
|
||||
//Add "=" to the parameter name (i.e. parameterName=value);
|
||||
var parameterName = parameterName + "=";
|
||||
if(queryString.length > 0) {
|
||||
//Find the beginning of the string
|
||||
var begin = queryString.indexOf(parameterName);
|
||||
if(begin != -1) {
|
||||
//Add the length (integer) to the beginning
|
||||
begin += parameterName.length;
|
||||
var end = queryString.indexOf("&", begin);
|
||||
if(end == -1) {
|
||||
end = queryString.length;
|
||||
}
|
||||
return unescape(queryString.substring(begin, end));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function onTileSelection(e) {
|
||||
if(e.detail.ImagePane.is(jQuery('#ImagePane'))) {
|
||||
jQuery('body').css('border','1px solid rgb(255, 138, 0)');
|
||||
if(window && window.parent.displayScout && jQuery('#tool').text()!='measure') {
|
||||
Localizer.hideScoutLine();
|
||||
Localizer.drawScout();
|
||||
}
|
||||
var tool = jQuery('#tool').text();
|
||||
jQuery('.toggleOff',window.parent.document).not('#scoutLine').removeClass('toggleOff');
|
||||
if(tool!='') {
|
||||
jQuery('#'+tool,window.parent.document).addClass('toggleOff');
|
||||
}
|
||||
if(tool=='measure') {
|
||||
init(jQuery('#totalImages').html().indexOf('Frame')>=0 ? frameInc : imgInc);
|
||||
}
|
||||
} else {
|
||||
jQuery('body').css('border','none');
|
||||
}
|
||||
}
|
||||
|
||||
function resizeCanvas() { //To resize the canvas on any screen size change
|
||||
var height = jQuery(window).height() - 3;
|
||||
jQuery('body').css('height',height +"px");
|
||||
jQuery('#footer').css("height",(height-195) + "px");
|
||||
var width = jQuery(window).width()-3;
|
||||
jQuery('body').css('width',width + "px");
|
||||
|
||||
var imgSrc = seriesUid + "_" + imgInc;
|
||||
showImage(imgSrc);
|
||||
drawAllShapes();
|
||||
}
|
||||
|
||||
function loadPDF(src) {
|
||||
var imgSrc = 'Image.do?serverURL=' + parent.pat.serverURL + '&study=' + getParameter(src,'study') + '&series=' + seriesUid + '&object=' + getParameter(src,'object') + '&rid=' + getParameter(src,'rid');
|
||||
var frame = window.parent.getActiveFrame();
|
||||
frame.src = imgSrc;
|
||||
}
|
||||
|
||||
function loadSR(src) {
|
||||
var imgSrc = 'Image.do?serverURL=' + parent.pat.serverURL + '&study=' + getParameter(src,'study') + '&series=' + seriesUid + '&object=' + getParameter(src,'object');
|
||||
imgSrc += '&contentType=text/html';
|
||||
var frame = window.parent.getActiveFrame();
|
||||
frame.src = imgSrc;
|
||||
jQuery(frame).css("background","white");
|
||||
}
|
||||
|
||||
function toggleResolution() {
|
||||
if(jQuery('#tool').html()!='measure') {
|
||||
var canvas = document.getElementById('imageCanvas');
|
||||
var image = getCurrentImage();
|
||||
|
||||
if(state.scale==1.0) {
|
||||
var scaleFac = Math.min(canvas.width/image.naturalWidth, canvas.height/image.naturalHeight);
|
||||
state.scale = scaleFac;
|
||||
state.translationX = (canvas.width- state.scale * image.naturalWidth)/2;
|
||||
state.translationY = (canvas.height- state.scale * image.naturalHeight)/2;
|
||||
showImg(null,image);
|
||||
} else {
|
||||
state.scale = 1.0;
|
||||
state.translationX = (canvas.width- state.scale * image.naturalWidth)/2;
|
||||
state.translationY = (canvas.height- state.scale * image.naturalHeight)/2;
|
||||
showImg(null,image);
|
||||
if(jQuery('#tool').html()!="move") {
|
||||
activateMove("move");
|
||||
}
|
||||
}
|
||||
jQuery('#zoomPercent').html('Zoom: ' + parseInt(state.scale * 100) + '%');
|
||||
drawoutline();
|
||||
}
|
||||
}
|
||||
|
||||
String.prototype.replaceAll = function(pcFrom, pcTo){
|
||||
var i = this.indexOf(pcFrom);
|
||||
var c = this;
|
||||
while (i > -1){
|
||||
c = c.replace(pcFrom, pcTo);
|
||||
i = c.indexOf(pcFrom);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
function parseDicom(imageData,sopUID) {
|
||||
var wadoUrl = window.parent.pat.serverURL + "/wado?requestType=WADO&contentType=application/dicom&studyUID=" + window.parent.pat.studyUID + "&seriesUID=" + seriesUid + "&objectUID=" + (imageData!=null ? imageData['SopUID'] : sopUID);
|
||||
|
||||
var reader = new DicomInputStreamReader();
|
||||
|
||||
if (!(!(wadoUrl.indexOf('C-GET') >= 0) && !(wadoUrl.indexOf('C-MOVE') >= 0))) {
|
||||
var imgSrc = jQuery('#' + (seriesUid + "_" + imgInc).replace(/\./g,'_'), window.parent.document).attr('src');
|
||||
/*var urlTmp = "Wado.do?study=" + getParameter(wadoUrl, "studyUID") + "&series=" + getParameter(wadoUrl,"seriesUID")
|
||||
+ "&object=" + getParameter(wadoUrl, "objectUID")
|
||||
+ "&contentType=application/dicom" + "&retrieveType=" + window.parent.pat.serverURL + "&dicomURL=" + window.parent.pat.dicomURL;*/
|
||||
var urlTmp = imgSrc + "&contentType=application/dicom";
|
||||
reader.readDicom(urlTmp);
|
||||
} else {
|
||||
reader.readDicom("DcmStream.do?wadourl="
|
||||
+ wadoUrl.replaceAll("&", "_"));
|
||||
}
|
||||
|
||||
var dicomParser = new DicomParser(reader.getInputBuffer(), reader.getReader());
|
||||
dicomParser.parseAll();
|
||||
imageData = dicomParser.imgData;
|
||||
|
||||
this.minPix = dicomParser.minPix;
|
||||
this.maxPix = dicomParser.maxPix;
|
||||
this.pixelBuffer = dicomParser.pixelBuffer;
|
||||
this.lookupObj = new LookupTable();
|
||||
|
||||
lookupObj.setPixelInfo(this.minPix,this.maxPix,imageData['monochrome1']);
|
||||
columns = imageData['nativeColumns'];
|
||||
return imageData;
|
||||
}
|
||||
|
||||
function renderImg() {
|
||||
var canvas = document.getElementById('imageCanvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.save();
|
||||
ctx.setTransform(1,0,0,1,0,0);
|
||||
ctx.clearRect(0,0,canvas.width,canvas.height);
|
||||
|
||||
if(state.vflip) {
|
||||
ctx.translate(0,canvas.height);
|
||||
ctx.scale(1,-1);
|
||||
}
|
||||
|
||||
if(state.hflip) {
|
||||
ctx.translate(canvas.width,0);
|
||||
ctx.scale(-1,1);
|
||||
}
|
||||
|
||||
if(state.rotate!=0) {
|
||||
ctx.translate(canvas.width/2,canvas.height/2);
|
||||
ctx.rotate(state.rotate===90 ? Math.PI/2 : state.rotate===180? Math.PI : (Math.PI*3)/2);
|
||||
ctx.translate(-canvas.width/2,-canvas.height/2);
|
||||
}
|
||||
|
||||
ctx.translate(state.translationX, state.translationY);
|
||||
ctx.scale(state.scale,state.scale);
|
||||
|
||||
ctx.drawImage(tmpCanvas,0,0);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
function iterateOverPixels() {
|
||||
var canvasIndex = 3, pixelIndex = 0;
|
||||
var localData = pixelData.data;
|
||||
|
||||
lookupObj.calculateLookup();
|
||||
var lookupTable=lookupObj.ylookup;
|
||||
|
||||
while(pixelIndex<numPixels) {
|
||||
localData[canvasIndex] = lookupTable[pixelBuffer[pixelIndex++]];
|
||||
canvasIndex+=4;
|
||||
}
|
||||
//tmpCanvas.getContext('2d').putImageData(pixelData,0,0);
|
||||
if(state.invert) {
|
||||
for (var i = 0; i < pixelData.data.length; i += 4) {
|
||||
pixelData.data[i] = pixelData.data[i];
|
||||
pixelData.data[i+1] = pixelData.data[i+1];
|
||||
pixelData.data[i+2] = pixelData.data[i+2];
|
||||
pixelData.data[i+3] = 255 - pixelData.data[i+3];
|
||||
}
|
||||
tmpCanvas.getContext('2d').putImageData(pixelData,0,0);
|
||||
} else {
|
||||
tmpCanvas.getContext('2d').putImageData(pixelData,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
function doAutoplay(frameTime) {
|
||||
if(loopTimer==null) {
|
||||
jQuery('#loopSlider',window.parent.document).slider({max:frameTime*2,value: frameTime});
|
||||
parent.loopSpeed = frameTime;
|
||||
window.parent.document.getElementById('loopChkBox').checked = true;
|
||||
doLoop(true);
|
||||
}
|
||||
}
|
||||
|
||||
//Preview
|
||||
function loadPreview(image) {
|
||||
var imageCanvas = document.getElementById("imageCanvas");
|
||||
var previewCanvas = document.getElementById("previewCanvas");
|
||||
var highlightCanvas = document.getElementById("highlightCanvas");
|
||||
navState.width = parseInt(imageCanvas.width*navState.navigationImgFactor);
|
||||
navState.height = parseInt(navState.width*image.naturalHeight/image.naturalWidth);
|
||||
var scrNavImgWidth = parseInt(imageCanvas.width*navState.screenNavImgFactor);
|
||||
navState.scale = scrNavImgWidth/navState.width;
|
||||
previewCanvas.width = highlightCanvas.width = getScreenNavImageWidth();
|
||||
previewCanvas.height = highlightCanvas.height = getScreenNavImageHeight();
|
||||
//context.drawImage(image,0,0,getScreenNavImageWidth(),getScreenNavImageHeight());
|
||||
drawPreview(document.getElementById("previewCanvas"), image);
|
||||
drawoutline();
|
||||
addNavigationListener(highlightCanvas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders preview image in preview canvase
|
||||
* @param canvas Preview canvas
|
||||
* @param image Preview image
|
||||
*/
|
||||
function drawPreview(canvas,image) {
|
||||
var context = canvas.getContext('2d');
|
||||
context.save();
|
||||
context.setTransform(1,0,0,1,0,0);
|
||||
context.clearRect(0,0,canvas.width,canvas.height);
|
||||
if(state.vflip) {
|
||||
context.translate(0,canvas.height);
|
||||
context.scale(1,-1);
|
||||
}
|
||||
if(state.hflip) {
|
||||
context.translate(canvas.width,0);
|
||||
context.scale(-1,1);
|
||||
}
|
||||
if(state.rotate!=0) {
|
||||
context.translate(canvas.width/2,canvas.height/2);
|
||||
context.rotate(state.rotate===90 ? Math.PI/2 : state.rotate===180? Math.PI : (Math.PI*3)/2);
|
||||
context.translate(-canvas.width/2,-canvas.height/2);
|
||||
}
|
||||
context.drawImage(image,0,0,getScreenNavImageWidth(),getScreenNavImageHeight());
|
||||
context.restore();
|
||||
|
||||
if(state.invert) {
|
||||
window.parent.doInvert(jQuery('#previewCanvas').get(0),false);
|
||||
}
|
||||
}
|
||||
|
||||
function getScreenNavImageWidth() {
|
||||
return parseInt(navState.scale*navState.width);
|
||||
}
|
||||
|
||||
function getScreenNavImageHeight() {
|
||||
return parseInt(navState.scale*navState.height);
|
||||
}
|
||||
|
||||
function getScreenImageWidth() {
|
||||
return parseInt(state.scale*parseInt(jQuery('#imageSize').html().split("x")[0].split(":")[1]));
|
||||
}
|
||||
|
||||
function getScreenImageHeight() {
|
||||
return parseInt(state.scale*jQuery('#imageSize').html().split("x")[1]);
|
||||
}
|
||||
|
||||
function addNavigationListener(highlightCanvas) {
|
||||
var context = highlightCanvas.getContext('2d');
|
||||
var startCoords = [],img = null;
|
||||
|
||||
jQuery(highlightCanvas).mousedown(function(e) {
|
||||
if(e.which==1) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if(e.offsetX>=navState.outline.x && e.offsetX*navState.scale<=navState.outline.x+(navState.outline.w*navState.scale) && e.offsetY>=navState.outline.y && e.offsetY*navState.scale<=navState.outline.y+(navState.outline.h*navState.scale)) {
|
||||
navState.drag = true;
|
||||
startCoords = [
|
||||
e.offsetX - navState.outline.x,
|
||||
e.offsetY - navState.outline.y
|
||||
];
|
||||
jQuery(highlightCanvas).css('cursor','move');
|
||||
img = getCurrentImage();
|
||||
}
|
||||
}
|
||||
}).mousemove(function(e1) {
|
||||
e1.preventDefault();
|
||||
e1.stopPropagation();
|
||||
if(navState.drag) {
|
||||
var x = e1.offsetX;
|
||||
var y = e1.offsetY;
|
||||
|
||||
navState.outline.x = x-startCoords[0];
|
||||
navState.outline.y = y-startCoords[1];
|
||||
|
||||
context.clearRect(0,0,highlightCanvas.width,highlightCanvas.height);
|
||||
context.strokeRect(navState.outline.x,navState.outline.y,navState.outline.w,navState.outline.h);
|
||||
|
||||
var point = {x:navState.outline.x,y:navState.outline.y};
|
||||
var scrImgPoint = navToScaledImgCoords(point);
|
||||
state.translationX = -scrImgPoint.x;
|
||||
state.translationY = -scrImgPoint.y;
|
||||
showImg(null,img,false);
|
||||
drawAllShapes();
|
||||
}
|
||||
}).mouseup(function(e2) {
|
||||
e2.preventDefault();
|
||||
e2.stopPropagation();
|
||||
navState.drag = false;
|
||||
jQuery(highlightCanvas).css('cursor','default');
|
||||
});
|
||||
}
|
||||
|
||||
function navToScaledImgCoords(point) {
|
||||
return {x:point.x * getScreenImageWidth() / getScreenNavImageHeight(),y: point.y * getScreenImageHeight() / getScreenNavImageHeight()};
|
||||
}
|
||||
|
||||
function needPreview(canvasWidth,canvasHeight) {
|
||||
return !(state.translationX>=0 && (state.translationX+getScreenImageWidth())<=canvasWidth && state.translationY>=0 && (state.translationY+getScreenImageHeight())<=canvasHeight);
|
||||
}
|
||||
|
||||
function drawoutline() {
|
||||
var imageCanvas = document.getElementById("imageCanvas");
|
||||
if(needPreview(imageCanvas.width,imageCanvas.height)) {
|
||||
var highlightCanvas = document.getElementById('highlightCanvas');
|
||||
jQuery('#previewCanvas').show();
|
||||
jQuery(highlightCanvas).show();
|
||||
var x = -state.translationX * getScreenNavImageWidth()/getScreenImageWidth();
|
||||
var y = -state.translationY * getScreenNavImageHeight()/getScreenImageHeight();
|
||||
var w = imageCanvas.width * getScreenNavImageWidth()/getScreenImageWidth();
|
||||
var h = imageCanvas.height * getScreenNavImageHeight()/getScreenImageHeight();
|
||||
if(x<0) {
|
||||
x = 0;
|
||||
}
|
||||
if(y<=0) {
|
||||
y =0;
|
||||
}
|
||||
|
||||
if(x+w>highlightCanvas.width) {
|
||||
w = highlightCanvas.width-x;
|
||||
}
|
||||
if(y+h>highlightCanvas.height) {
|
||||
h = highlightCanvas.height-y;
|
||||
}
|
||||
navState.outline = {x:x,y:y,w:w,h:h};
|
||||
var context = highlightCanvas.getContext('2d');
|
||||
context.clearRect(0,0,highlightCanvas.width,highlightCanvas.height);
|
||||
context.strokeStyle="yellow";
|
||||
context.strokeRect(x,y,w,h);
|
||||
} else {
|
||||
jQuery('#previewCanvas').hide();
|
||||
jQuery('#highlightCanvas').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function loadContextMenu() {
|
||||
var queryString = window.location.href;
|
||||
var study = getParameter(queryString,'study');
|
||||
var data = sessionStorage[study];
|
||||
if(data!=undefined) {
|
||||
var seriesData = JSON.parse(data);
|
||||
var cxtContent = '<ul id="contextmenu1" class="menu"';
|
||||
|
||||
if(isCompatible()) {
|
||||
for(var i=0;i<seriesData.length;i++) {
|
||||
var series = seriesData[i];
|
||||
// jQuery('#studyDesc').html(series['studyDesc']);
|
||||
// jQuery('#studyDate').html(series['studyDate']);
|
||||
var seriesDesc = convertSplChars(series['seriesDesc']);
|
||||
if(seriesDesc== undefined && seriesDesc==='') {
|
||||
seriesDesc = 'UNKNOWN';
|
||||
}
|
||||
cxtContent+= '<li><a class="cmenuItem" href="#" link="frameContent.html?study=' + study + '&series=' + series['seriesUID'] + '&seriesDesc=' + series['seriesDesc'] + '&images=' + series['totalInstances'] + '&modality='+ series['modality'] + '" onclick="triggerContext(jQuery(this));">' + seriesDesc + ' </a></li>';
|
||||
}
|
||||
cxtContent+='</ul>';
|
||||
} else {
|
||||
for(var i=0;i<seriesData.length;i++) {
|
||||
var series = seriesData[i];
|
||||
// jQuery('#studyDesc').html(series['studyDesc']);
|
||||
// jQuery('#studyDate').html(series['studyDate']);
|
||||
var seriesDesc = convertSplChars(series['seriesDesc']);
|
||||
if(seriesDesc==undefined && seriesDesc==='') {
|
||||
seriesDesc = 'UNKNOWN';
|
||||
}
|
||||
cxtContent +='<li><a href="#" link="frameContent.html?serverURL=';
|
||||
cxtContent += getParameter(queryString, 'serverURL');
|
||||
cxtContent += '&study=' + study;
|
||||
cxtContent += '&series=' + series['seriesUID'];
|
||||
cxtContent += '&seriesDesc=' + series['seriesDesc'];
|
||||
cxtContent += '&images=' + series['totalInstances'];
|
||||
cxtContent += '&modality=' + series['modality'] + '" onclick="triggerContext(jQuery(this));">' + seriesDesc + '</a></li>';
|
||||
}
|
||||
cxtContent+='</ul>';
|
||||
}
|
||||
var div = document.createElement("div");
|
||||
div.innerHTML = cxtContent;
|
||||
document.body.appendChild(div);
|
||||
jQuery("#canvasLayer2").contextMenu({menu: 'contextmenu1'});
|
||||
} else {
|
||||
setTimeout("loadContextMenu", 100);
|
||||
}
|
||||
}
|
||||
|
||||
function triggerContext(contextItem) {
|
||||
window.location.href = contextItem.attr('link');
|
||||
}
|
||||
|
||||
function getCurrentImage() {
|
||||
if(window.parent.pat.serverURL.indexOf('wado')>0 && modifiedWC!=undefined && modifiedWW!=undefined && (modifiedWC!=windowCenter || modifiedWW!=windowWidth)) {
|
||||
return jQuery("#wltmpImg").get(0);
|
||||
} else {
|
||||
var isMultiframe = jQuery('#totalImages').html().indexOf('Frame')>=0;
|
||||
var iNo = jQuery('#totalImages').text().split("/")[0].split(":")[1];
|
||||
if(!isMultiframe) {
|
||||
return jQuery('#' + (seriesUid + "_" + iNo).replace(/\./g,'_'), window.parent.document).get(0);
|
||||
} else {
|
||||
return jQuery("#" + getParameter(jQuery('#frameSrc').html(),'object').replace(/\./g,'_')+"_"+iNo,window.parent.document).get(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
Native FullScreen JavaScript API
|
||||
--------------------------------
|
||||
Assumes Mozilla naming conventions instead of W3C for now
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var
|
||||
fullScreenApi = {
|
||||
supportsFullScreen: false,
|
||||
isFullScreen: function() {
|
||||
return false;
|
||||
},
|
||||
requestFullScreen: function() {},
|
||||
cancelFullScreen: function() {},
|
||||
fullScreenEventName: '',
|
||||
prefix: ''
|
||||
},
|
||||
browserPrefixes = 'webkit moz o ms khtml'.split(' ');
|
||||
|
||||
// check for native support
|
||||
if (typeof document.cancelFullScreen != 'undefined') {
|
||||
fullScreenApi.supportsFullScreen = true;
|
||||
} else {
|
||||
// check for fullscreen support by vendor prefix
|
||||
for (var i = 0, il = browserPrefixes.length; i < il; i++ ) {
|
||||
fullScreenApi.prefix = browserPrefixes[i];
|
||||
|
||||
if (typeof document[fullScreenApi.prefix + 'CancelFullScreen' ] != 'undefined' ) {
|
||||
fullScreenApi.supportsFullScreen = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update methods to do something useful
|
||||
if (fullScreenApi.supportsFullScreen) {
|
||||
fullScreenApi.fullScreenEventName = fullScreenApi.prefix + 'fullscreenchange';
|
||||
|
||||
fullScreenApi.isFullScreen = function() {
|
||||
switch (this.prefix) {
|
||||
case '':
|
||||
return document.fullScreen;
|
||||
case 'webkit':
|
||||
return document.webkitIsFullScreen;
|
||||
default:
|
||||
return document[this.prefix + 'FullScreen'];
|
||||
}
|
||||
}
|
||||
fullScreenApi.requestFullScreen = function(el) {
|
||||
return (this.prefix === '') ? el.requestFullScreen() : el[this.prefix + 'RequestFullScreen']();
|
||||
}
|
||||
fullScreenApi.cancelFullScreen = function(el) {
|
||||
return (this.prefix === '') ? document.cancelFullScreen() : document[this.prefix + 'CancelFullScreen']();
|
||||
}
|
||||
}
|
||||
|
||||
// jQuery plugin
|
||||
if (typeof jQuery != 'undefined') {
|
||||
jQuery.fn.requestFullScreen = function() {
|
||||
|
||||
return this.each(function() {
|
||||
var el = jQuery(this);
|
||||
if (fullScreenApi.supportsFullScreen) {
|
||||
fullScreenApi.requestFullScreen(el);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// export api
|
||||
window.fullScreenApi = fullScreenApi;
|
||||
})();
|
||||
@@ -0,0 +1,745 @@
|
||||
var myLayout;
|
||||
$.fn.dataTableInstances = [];
|
||||
var timer;
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
loadTabs();
|
||||
|
||||
$("#buttonContainer").buttonset();
|
||||
|
||||
if (/chrome/.test(navigator.userAgent.toLowerCase())) {
|
||||
$('.ui-helper-hidden-accessible').css('display', 'none');
|
||||
}
|
||||
|
||||
$('#buttonContainer').addClass('ui-widget-content');
|
||||
|
||||
$.get("UserConfig.do", {
|
||||
'settings': 'userName',
|
||||
'todo': 'READ'
|
||||
}, function (data) {
|
||||
$('#user').html(data);
|
||||
}, 'text');
|
||||
|
||||
$(".header-footer").hover(
|
||||
function () {
|
||||
$(this).addClass('ui-state-hover');
|
||||
}
|
||||
, function () {
|
||||
$(this).removeClass('ui-state-hover');
|
||||
}
|
||||
);
|
||||
|
||||
myLayout = $('#optional-container').layout({
|
||||
closable: false,
|
||||
resizable: false
|
||||
});
|
||||
|
||||
/* myLayout = $('#optional-container').layout({
|
||||
west: {
|
||||
size: 205
|
||||
}
|
||||
}); */
|
||||
|
||||
// //start listener
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// url: "Listener.do",
|
||||
// data: {
|
||||
// 'action':'Verify'
|
||||
// }
|
||||
// });
|
||||
|
||||
// get the buttons from configuration
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "UserConfig.do",
|
||||
data: {
|
||||
'settings': 'buttons',
|
||||
'todo': 'READ'
|
||||
},
|
||||
dataType: "json",
|
||||
success: parseJson
|
||||
});
|
||||
|
||||
/*if( !location.search ) {
|
||||
showAllLocalStudies();
|
||||
}*/
|
||||
|
||||
function parseJson(json) {
|
||||
|
||||
$('#buttonContainer').html('');
|
||||
//createButton("Search", null, null, null);
|
||||
// createButton({"label":"Search"});
|
||||
|
||||
// if( !location.search || location.search==="?q=sukraa") {
|
||||
if (!location.search) {
|
||||
$(json).each(function () {
|
||||
createButton(this);
|
||||
});
|
||||
}
|
||||
|
||||
$.get("UserConfig.do", {
|
||||
'settings': 'theme',
|
||||
'todo': 'READ'
|
||||
}, function (data) {
|
||||
$('#switcher').themeswitcher({
|
||||
loadTheme: data.trim(),
|
||||
cookieName: '',
|
||||
width: 160
|
||||
}, 'text');
|
||||
}, 'text');
|
||||
//addThemeSwitcher('.ui-layout-north',{ top: '13px', right: '20px' });
|
||||
}
|
||||
|
||||
function createButton(that) {
|
||||
var txt = that['label'];
|
||||
var crit = that['dateCrit'];
|
||||
var tCrit = that['timeCrit'];
|
||||
var modality = that['modality'];
|
||||
var studyDesc = that['studyDesc'];
|
||||
var autoRef = that['autoRefresh'];
|
||||
|
||||
var id = '';
|
||||
if (txt == 'Search') {
|
||||
id = 'btn-search';
|
||||
} else {
|
||||
id = 'btn-' + new Date().valueOf().toString();
|
||||
}
|
||||
|
||||
$('#buttonContainer').append('<input type="radio" id="' + id + '" name="radio" /><label for="' + id + '" style="font-size:13px;">' + txt + '</label>');
|
||||
jQuery('#' + id).click(function () {
|
||||
var divContent = $('.ui-tabs-selected').find('a').attr('href');
|
||||
$(divContent + '_content').html('');
|
||||
var dUrl = $('.ui-tabs-selected').find('a').attr('name');
|
||||
$('.ui-tabs-selected').find('a').attr('searchBtn', id);
|
||||
|
||||
//if($('.ui-tabs-selected').length == 0) {
|
||||
if (dUrl == null) {
|
||||
var msg = "Please select remote server!!!";
|
||||
noty({
|
||||
text: msg,
|
||||
layout: 'topRight',
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (id == "btn-search") {
|
||||
$.get('search.html', function (data) {
|
||||
modal.open({
|
||||
content: data
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$.get("Echo.do?dicomURL=" + dUrl, function (data) {
|
||||
if (data == "EchoSuccess") {
|
||||
var searchURL = "queryResult.jsp?";
|
||||
if (modality != null && modality != '') {
|
||||
searchURL += "modality=" + modality;
|
||||
}
|
||||
|
||||
var days = 0;
|
||||
|
||||
if (crit != null && crit != '') {
|
||||
if (crit.indexOf("-") >= 0) {
|
||||
days = crit.substring(crit.indexOf("t-") + 2);
|
||||
var fromDate = Date.today().addDays(-days).toString("yyyyMMdd");
|
||||
var toDate = Date.today().toString("yyyyMMdd");
|
||||
searchURL += "&searchDays=between&from=" + fromDate + "&to=" + toDate;
|
||||
} else {
|
||||
var tDate = Date.today().toString("yyyyMMdd");
|
||||
searchURL += "&searchDays=between&from=" + tDate + "&to=" + tDate;
|
||||
}
|
||||
}
|
||||
|
||||
if (tCrit != null) {
|
||||
if (tCrit == '-30m') {
|
||||
var fTime = new Date().addMinutes(-30).toString("HHmmss");
|
||||
var tTime = new Date().toString("HHmmss");
|
||||
searchURL += '&fromTime=' + fTime + '&toTime=' + tTime;
|
||||
} else if (tCrit.indexOf('-') == 0) {
|
||||
var fTime = new Date().addHours(parseInt(tCrit)).toString("HHmmss");
|
||||
var tTime = new Date().toString("HHmmss");
|
||||
searchURL += '&fromTime=' + fTime + '&toTime=' + tTime;
|
||||
} else if (tCrit.indexOf('-') > 0) {
|
||||
var tArr = tCrit.split('-');
|
||||
searchURL += '&fromTime=' + tArr[0] + '&toTime=' + tArr[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (studyDesc != null) {
|
||||
searchURL += '&studyDesc=' + studyDesc + "*";
|
||||
}
|
||||
|
||||
if (searchURL.trim() == ('queryResult.jsp?')) {
|
||||
jConfirm('No filters have been selected. The search may take long time. Do you want to proceed?', 'No search criteria', function (doQry) {
|
||||
if (doQry == true) {
|
||||
searchURL += "&dcmURL=" + dUrl;
|
||||
doQuery(searchURL, autoRef, divContent);
|
||||
} else {
|
||||
$('label[for="' + id + '"]').removeClass("ui-state-active");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
searchURL += "&dcmURL=" + dUrl;
|
||||
doQuery(searchURL, autoRef, divContent);
|
||||
}
|
||||
|
||||
} else {
|
||||
var msg = "Server not available";
|
||||
noty({
|
||||
text: msg,
|
||||
layout: 'topRight',
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#buttonContainer").buttonset();
|
||||
|
||||
if (/chrome/.test(navigator.userAgent.toLowerCase())) {
|
||||
$('.ui-helper-hidden-accessible').css('display', 'none');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function doQuery(searchURL, autoRef, divContent) {
|
||||
searchURL += '&tabName=' + divContent.replace('#', '');
|
||||
var tabIndex = $('#tabs_div').data('tabs').options.selected;
|
||||
searchURL += '&tabIndex=' + tabIndex;
|
||||
searchURL += "&preview=" + $('.ui-tabs-selected').find('a').attr('preview');
|
||||
searchURL += "&search=" + ((!location.search) ? 'true' : 'false');
|
||||
divContent += '_content';
|
||||
|
||||
$(divContent).html('<div id="loading" style="height: 100%; width: 100%; text-align: center; z-index: 10000;"><div style="position: absolute; left: 45%; top: 45%;"><img src="images/overlay_spinner.gif" alt=""><div style="font-size: 12px; font-weight: bold;">Querying...</div></div></div>');
|
||||
$('#westPane').html('');
|
||||
|
||||
$(divContent).load(encodeURI(searchURL), function () {
|
||||
clearInterval(timer);
|
||||
// checkLocalStudies();
|
||||
|
||||
if (parseInt(autoRef) > 0) {
|
||||
timer = setInterval(function () {
|
||||
startTimer(searchURL)
|
||||
}, parseInt(autoRef));
|
||||
}
|
||||
});
|
||||
|
||||
$('.ui-tabs-selected').find('a').attr('searchurl', searchURL);
|
||||
}
|
||||
|
||||
function startTimer(searchURL) {
|
||||
// if( searchURL.indexOf(Date.today().toString("yyyyMMdd")) >= 0) {
|
||||
$.getJSON('RefreshStudies.do', {
|
||||
'query': searchURL
|
||||
}, function (data) {
|
||||
var tabIndex = $('#tabs_div').data('tabs').options.selected;
|
||||
var oTable = $.fn.dataTableInstances[tabIndex];
|
||||
|
||||
var selectedTabTxt = $('.ui-tabs-selected').find('span').html();
|
||||
var searchTab = searchURL.substring(searchURL.indexOf('tabName=') + 8, searchURL.indexOf("tabIndex") - 1);
|
||||
if (searchTab.trim() == selectedTabTxt.trim()) {
|
||||
for (var itr = 0; itr < data.length; itr++) {
|
||||
var newRow = data[itr];
|
||||
oTable.fnAddData([
|
||||
'<img src="images/details_open.png" alt="" /> <img src="images/red.png" id="' + newRow.studyInstanceUID + '" alt="" />',
|
||||
newRow.patientID,
|
||||
newRow.patientName,
|
||||
newRow.patientBirthDate,
|
||||
newRow.accessionNumber,
|
||||
newRow.studyDate,
|
||||
newRow.studyDescription,
|
||||
newRow.modalitiesInStudy,
|
||||
newRow.studyRelatedInstances,
|
||||
newRow.studyInstanceUID,
|
||||
newRow.physicianName,
|
||||
newRow.studyRelatedSeries,
|
||||
newRow.patientGender
|
||||
]);
|
||||
}
|
||||
}
|
||||
});
|
||||
// } // if
|
||||
}
|
||||
|
||||
function checkLocalStudies() {
|
||||
var myDB = initDB();
|
||||
var sql = "select StudyInstanceUID from study";
|
||||
myDB.transaction(function (tx) {
|
||||
tx.executeSql(sql, [], function (trans, results) {
|
||||
for (var i = 0; i < results.rows.length; i++) {
|
||||
var row = results.rows.item(i);
|
||||
var img = document.getElementById(row['StudyInstanceUID']);
|
||||
if (img != null) {
|
||||
img.style.visibility = 'visible';
|
||||
}
|
||||
}
|
||||
}, errorHandler);
|
||||
});
|
||||
}
|
||||
|
||||
function loadTabs() {
|
||||
var tabName = getParameterByName("serverName");
|
||||
var patId = getParameterByName("patientID");
|
||||
var tabIndex = 0;
|
||||
|
||||
$.getJSON('DicomNodes.do', function (results) {
|
||||
var callingAET = results[results.length - 1].callingAET.trim();
|
||||
for (var i = 0; i < results.length - 1; i++) {
|
||||
var node = results[i];
|
||||
console.log(node);
|
||||
//var li = '<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#tab_3"><span>Local</span></a></li>';
|
||||
|
||||
var showSearch = true;
|
||||
if (node.logicalname == tabName || results.length == 1) {
|
||||
tabIndex = parseInt(i);
|
||||
showSearch = false;
|
||||
}
|
||||
|
||||
var dcmUrl = '';
|
||||
if (callingAET == '') {
|
||||
dcmUrl = "DICOM://" + node.aetitle + "@" + node.hostname + ":" + node.port;
|
||||
} else {
|
||||
dcmUrl = "DICOM://" + node.aetitle + ":" + callingAET + "@" + node.hostname + ":" + node.port;
|
||||
}
|
||||
|
||||
var wadoUrl = null;
|
||||
if (node.retrieve == 'WADO') {
|
||||
if (node.wadoport == '') {
|
||||
wadoUrl = "http://" + node.hostname + "/" + node.wadocontext;
|
||||
} else {
|
||||
wadoUrl = "http://" + node.hostname + ":" + node.wadoport + "/" + node.wadocontext;
|
||||
}
|
||||
} else {
|
||||
wadoUrl = node.retrieve;
|
||||
}
|
||||
|
||||
var preview = true;
|
||||
|
||||
if (typeof (node.previews) != "undefined") {
|
||||
preview = node.previews;
|
||||
}
|
||||
|
||||
var imgType = "jpeg";
|
||||
|
||||
if (typeof (node.imageType) != "undefined") {
|
||||
imgType = node.imageType.toLowerCase();
|
||||
}
|
||||
|
||||
var li = '<li class="ui-state-default ui-corner-top"><a href="#' + node.logicalname + '" name="' + dcmUrl + '" wadoUrl="' + wadoUrl + '" preview="' + preview + '" imgType="' + imgType + '"><span>' + node.logicalname + '</span></a></li>';
|
||||
$('#tabUL').append(li);
|
||||
|
||||
var div = '';
|
||||
|
||||
if (!location.search) {
|
||||
div = '<div id="' + node.logicalname + '" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" style="padding: 0; width: 100%;">';
|
||||
div += '<div id="' + node.logicalname + '_search" style="height:13%; width:100%;"></div>';
|
||||
div += '<div id="' + node.logicalname + '_content" style="height:85%; width:100%; cursor: pointer;"></div></div>';
|
||||
$('#tabContent').append(div);
|
||||
$('#' + node.logicalname + '_search').load('newSearch.jsp?tabName=' + node.logicalname);
|
||||
} else {
|
||||
div = '<div id="' + node.logicalname + '" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" style="padding: 0; width: 100%">';
|
||||
div += '<div id="' + node.logicalname + '_content" style="height:99%; width:100%; cursor: pointer;"></div></div>';
|
||||
$('#tabContent').append(div);
|
||||
|
||||
//load studies in data table.
|
||||
if (node.logicalname == tabName || results.length == 1) {
|
||||
var searchURL = "queryResult.jsp?";
|
||||
searchURL += 'patientId=' + patId;
|
||||
searchURL += "&dcmURL=" + dcmUrl;
|
||||
searchURL += '&tabName=' + node.logicalname;
|
||||
searchURL += '&tabIndex=' + tabIndex;
|
||||
searchURL += '&preview=' + preview;
|
||||
searchURL += '&search=' + showSearch;
|
||||
// searchURL += '&imgType=' + imgtype;
|
||||
// var wado = $('.ui-tabs-selected').find('a').attr('wadoUrl');
|
||||
// searchURL += '&ris=' + wado.substring(0,wado.indexOf('wado'))+"ris/Report.do?studyUID=";
|
||||
|
||||
var divContent = '#' + node.logicalname + '_content';
|
||||
|
||||
$(divContent).html('');
|
||||
$('#westPane').html('');
|
||||
|
||||
$(divContent).load(encodeURI(searchURL), function () {
|
||||
clearInterval(timer);
|
||||
//checkLocalStudies();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$("#tabs_div").tabs({
|
||||
selected: tabIndex,
|
||||
select: function (event, ui) {
|
||||
clearInterval(timer);
|
||||
// var selTabText = ui.tab.text;
|
||||
// var oTable = $.fn.dataTableInstances[ui.index];
|
||||
|
||||
/* var search_url = $(ui.tab).attr("searchurl");
|
||||
if(typeof search_url != 'undefined') {
|
||||
timer = setInterval(function() {startTimer(search_url)}, 10000);
|
||||
} */
|
||||
|
||||
var searchBtn = $(ui.tab).attr('searchBtn');
|
||||
if (typeof searchBtn != 'undefined') {
|
||||
$('#' + searchBtn).attr('checked', 'checked');
|
||||
$("#buttonContainer").buttonset("refresh");
|
||||
} else {
|
||||
$("#buttonContainer").find("input:radio:checked").prop('checked', false);
|
||||
$("#buttonContainer").buttonset("refresh");
|
||||
}
|
||||
|
||||
/* if(selTabText == 'Local') {
|
||||
$('#buttonContainer').hide();
|
||||
oTable.fnClearTable();
|
||||
//oTable.fnDestroy();
|
||||
showAllLocalStudies(oTable);
|
||||
} else {*/
|
||||
// $('#buttonContainer').show();
|
||||
|
||||
/*if(typeof oTable != 'undefined') {
|
||||
oTable.fnClearTable();
|
||||
}*/
|
||||
//}
|
||||
|
||||
/* $('.modalitiesList').multiselect({
|
||||
selectedList: 12,
|
||||
minWidth: 130,
|
||||
header: false,
|
||||
noneSelectedText: "ALL"
|
||||
});*/
|
||||
|
||||
} // for select event
|
||||
});
|
||||
|
||||
$("#tabs_div LI").contextMenu({
|
||||
menu: 'tabMenu'
|
||||
}, function (action, el, pos) {
|
||||
var url = 'Echo.do?dicomURL=' + el.find('a').attr('name');
|
||||
$.get(url, function (data) {
|
||||
if (data == "EchoSuccess") {
|
||||
var msg = 'Echo ' + el.find('a').text() + ' is successful!';
|
||||
noty({
|
||||
text: msg,
|
||||
layout: 'topRight',
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
var msg = 'Echo ' + el.find('a').text() + ' is failed!';
|
||||
noty({
|
||||
text: msg,
|
||||
layout: 'topRight',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$.fn.dataTableInstances.push($('#resultTable').dataTable({
|
||||
"bJQueryUI": true,
|
||||
"oLanguage": {
|
||||
"sSearch": "Filter:"
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
$('.display tbody tr').live("click", function () {
|
||||
var seriesTblHr = $(this).closest('table').find('th').get(0).innerHTML;
|
||||
if (seriesTblHr.indexOf('Series Number') >= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tabIndex = $('#tabs_div').data('tabs').options.selected;
|
||||
var oTable = $.fn.dataTableInstances[tabIndex];
|
||||
|
||||
if ($(this).hasClass('row_selected')) {
|
||||
return;
|
||||
} else {
|
||||
oTable.$('tr.row_selected').removeClass('row_selected');
|
||||
$(this).addClass('row_selected');
|
||||
}
|
||||
|
||||
var preview = $('.ui-tabs-selected').find('a').attr('preview');
|
||||
|
||||
if (preview == 'true') {
|
||||
var iPos = oTable.row(this).data();
|
||||
if (iPos == null) {
|
||||
return;
|
||||
}
|
||||
showWestPane(iPos);
|
||||
/* } else {
|
||||
if(!!(window.requestFileSystem || window.webkitRequestFileSystem)) {
|
||||
viewWPSeries(this);
|
||||
} else {
|
||||
var tmpUrl = "westContainer1.jsp?patient=" + iPos[1] + "&study=" + iPos[9] + "&patientName=" + iPos[2];
|
||||
tmpUrl += "&studyDesc=" + iPos[6] + "&studyDate=" + iPos[5].split(" ")[0] + "&totalSeries=" + iPos[11];
|
||||
|
||||
var lSql = "select DicomURL, ServerURL from study where StudyInstanceUID='" + iPos[9] + "'";
|
||||
var myDb = initDB();
|
||||
myDb.transaction(function(tx) {
|
||||
tx.executeSql(lSql, [], function(trans, results) {
|
||||
var row = results.rows.item(0);
|
||||
tmpUrl += "&dcmURL=" + row['DicomURL'] + "&wadoUrl=" + row['ServerURL'];
|
||||
$('#' + selTabText + '_westPane').load(encodeURI(tmpUrl));
|
||||
}, errorHandler);
|
||||
});
|
||||
|
||||
}
|
||||
}*/
|
||||
}
|
||||
});
|
||||
|
||||
//$("#resultTable tbody tr").live("dblclick", function() {
|
||||
$('.display tbody tr').live("dblclick", function () {
|
||||
var seriesTblHr = $(this).closest('table').find('th').get(0).innerHTML;
|
||||
|
||||
if (seriesTblHr.indexOf('Series Number') >= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tabIndex = $('#tabs_div').data('tabs').options.selected;
|
||||
var oTable = $.fn.dataTableInstances[tabIndex];
|
||||
// var nTrContent = oTable.fnGetData(this);
|
||||
var nTrContent = oTable.row(this).data();
|
||||
|
||||
if (nTrContent == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* var ser_url = $('.ui-tabs-selected').find('a').attr('wadoUrl');
|
||||
if(typeof ser_url == 'undefined') {
|
||||
var lSql = "select DicomURL, ServerURL from study where StudyInstanceUID='" + nTrContent[7] + "'";
|
||||
var myDb = initDB();
|
||||
myDb.transaction(function(tx) {
|
||||
tx.executeSql(lSql, [], function(trans, results) {
|
||||
var row = results.rows.item(0);
|
||||
var jsonObj = {
|
||||
"pat_ID" : nTrContent[1],
|
||||
"pat_Name" : nTrContent[2],
|
||||
"pat_Birthdate" : nTrContent[3],
|
||||
"accNumber" : nTrContent[4],
|
||||
"studyDate" : nTrContent[5],
|
||||
"studyDesc" : nTrContent[6],
|
||||
"modality" : nTrContent[7],
|
||||
"totalIns" : nTrContent[8],
|
||||
"studyUID" : nTrContent[9],
|
||||
"refPhysician" : nTrContent[10],
|
||||
"totalSeries" : nTrContent[11],
|
||||
"pat_gender" : nTrContent[12],
|
||||
"serverURL" : row['ServerURL'],
|
||||
"dicomURL" : row['DicomURL'],
|
||||
"bgColor" : $('.ui-widget-content').css('background-color')
|
||||
};
|
||||
|
||||
$.cookies.set( 'patient', jsonObj );
|
||||
|
||||
window.open("viewer.html", "_blank");
|
||||
}, errorHandler);
|
||||
});
|
||||
} else {*/
|
||||
openViewer(nTrContent);
|
||||
//}
|
||||
});
|
||||
|
||||
$('.display tbody td img').live('click', function () {
|
||||
var tabIndex = $('#tabs_div').data('tabs').options.selected;
|
||||
var oTable = $.fn.dataTableInstances[tabIndex];
|
||||
|
||||
var nTr = this.parentNode.parentNode;
|
||||
var nTrContent = oTable.row(nTr).data();
|
||||
|
||||
if (this.src.match('details_close')) {
|
||||
this.src = "images/details_open.png";
|
||||
oTable.row(nTr).child.hide();
|
||||
} else if (this.src.match('details_open')) {
|
||||
/* Open this row */
|
||||
this.src = "images/details_close.png";
|
||||
var selectedTabTxt = $('.ui-tabs-selected').find('span').html();
|
||||
if (selectedTabTxt != 'Local') {
|
||||
var urlDcm = $('.ui-tabs-selected').find('a').attr('name');
|
||||
var tmpUrl = "seriesDetails.jsp?patient=" + nTrContent[1] + "&study=" + nTrContent[8] + "&dcmURL=" + urlDcm;
|
||||
$.get(tmpUrl, function (series) {
|
||||
oTable.row(nTr).child(series);
|
||||
var now = new Date().getTime();
|
||||
var table = oTable.row(nTr).child().find(".display");
|
||||
$(table).attr("id", now);
|
||||
sTable = $(table).DataTable({
|
||||
"bJQueryUI": true,
|
||||
"bPaginate": false,
|
||||
"bFilter": false
|
||||
});
|
||||
oTable.row(nTr).child.show();
|
||||
});
|
||||
}
|
||||
/*else {
|
||||
var sql = "select SeriesNo, SeriesDescription, Modality, BodyPartExamined, NoOfSeriesRelatedInstances from series where StudyInstanceUID='" + nTrContent[8] + "';";
|
||||
var content = '<head><style>.dataTables_wrapper .fg-toolbar{display: none;}</style>';
|
||||
content += '<script type="text/javascript">$(document).ready(function() {var now = new Date().getTime();';
|
||||
content += '$("#seriesTable").attr("id", now); sTable = $("#" + now).dataTable({"bJQueryUI": true,"bPaginate": false,"bFilter": false});';
|
||||
content += '}); </script></head></body>';
|
||||
content += '<body><table class="display" id="seriesTable" style="font-size:12px;"><thead>';
|
||||
content += '<tr><th>Series Number</th><th>Series Desc</th><th>Modality</th><th>Body Part Examined</th><th>Total Instances</th></tr>';
|
||||
content += '</thead><tbody>';
|
||||
|
||||
var myDb = initDB();
|
||||
myDb.transaction(function(tx) {
|
||||
tx.executeSql(sql, [], function(trans, results) {
|
||||
for(var i=0; i<results.rows.length; i++) {
|
||||
var row = results.rows.item(i);
|
||||
content += '<tr><td>' + row['SeriesNo'] + '</td><td>' + row['SeriesDescription'] + '</td>';
|
||||
content += '<td>' + row['Modality'] + '</td><td>' + row['BodyPartExamined'] + '</td>';
|
||||
content += '<td>' + row['NoOfSeriesRelatedInstances'] + '</td></tr>';
|
||||
}
|
||||
content += '</tbody></table></body>';
|
||||
oTable.fnOpen(nTr, content, 'details');
|
||||
}, errorHandler);
|
||||
});
|
||||
}*/
|
||||
}
|
||||
});
|
||||
|
||||
$('#liConfig').click(function () {
|
||||
$('ul.the_menu').slideToggle('medium');
|
||||
window.open('config.html', '_blank');
|
||||
});
|
||||
|
||||
$('#deleteDb').click(function () {
|
||||
if (confirm('All the studies stored in the local storage will be deleted. Are you sure?')) {
|
||||
resetLocalDB();
|
||||
var selTabText = $('.ui-tabs-selected').find('span').html();
|
||||
if (selTabText == 'Local') {
|
||||
$('#westPane').html('');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// $('img.menu_class').click(function () {
|
||||
$('#imgToggle').click(function () {
|
||||
|
||||
$('ul.the_menu').slideToggle();
|
||||
|
||||
/*if($('ul.the_menu').find('.jquery-ui-themeswitcher-trigger').length == 0) {
|
||||
$('ul.the_menu').find('#theme').themeswitcher({
|
||||
cookieName: '',
|
||||
onSelect: function() {
|
||||
$('#westPane').addClass('ui-widget-content');
|
||||
$('#buttonContainer').addClass('ui-widget-content');
|
||||
$('#user').addClass('ui-widget-content');
|
||||
},
|
||||
onClose: function() {
|
||||
var selTheme = $(".jquery-ui-themeswitcher-title").html();
|
||||
selTheme = selTheme.split(': ')[1];
|
||||
//$.get("Theme.do", {'theme':selTheme});
|
||||
|
||||
if(typeof selTheme != 'undefined') {
|
||||
$.get("UserConfig.do", {'settings':'theme', 'settingsValue':selTheme, 'todo':'UPDATE'});
|
||||
}
|
||||
}
|
||||
});
|
||||
} */
|
||||
});
|
||||
|
||||
$('#logout').click(function () {
|
||||
$.post('logout.jsp', null, function (data) {
|
||||
$(document).empty();
|
||||
window.location.replace('.');
|
||||
});
|
||||
});
|
||||
|
||||
$(document).click(function (e) {
|
||||
var myTarget = 'fa fa-user-circle-o fa-3x';
|
||||
// var myTarget = 'menu_class';
|
||||
var clicked = e.target.className;
|
||||
// alert(clicked)
|
||||
if (myTarget != clicked) {
|
||||
if (!$('ul.the_menu').is(':hidden')) {
|
||||
$('ul.the_menu').slideToggle();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('nav').live('click', function () {
|
||||
var selTabText = $('.ui-tabs-selected').find('a').attr('href');
|
||||
var tmpStr = selTabText + '_search';
|
||||
if ($(tmpStr).is(":visible")) {
|
||||
$(tmpStr).slideUp();
|
||||
tmpStr = selTabText + '_content';
|
||||
$(tmpStr).css('height', '100%');
|
||||
} else {
|
||||
$(tmpStr).slideDown();
|
||||
tmpStr = selTabText + '_content';
|
||||
$(tmpStr).css('height', '85%');
|
||||
}
|
||||
});
|
||||
|
||||
$('.ui-layout-resizer').css('visibility', 'hidden');
|
||||
|
||||
}); // for document ready
|
||||
|
||||
function openViewer(nTrContent) {
|
||||
|
||||
var jsonObj = {
|
||||
"pat_ID": nTrContent[1],
|
||||
"pat_Name": nTrContent[2],
|
||||
|
||||
/* "pat_Birthdate" : nTrContent[3],
|
||||
"accNumber" : nTrContent[4],*/
|
||||
"studyDate": nTrContent[4].display,
|
||||
"studyDesc": nTrContent[5],
|
||||
"modality": nTrContent[6],
|
||||
"totalIns": nTrContent[7],
|
||||
"studyUID": nTrContent[8],
|
||||
"refPhysician": nTrContent[9],
|
||||
"totalSeries": nTrContent[10],
|
||||
"pat_gender": nTrContent[3],
|
||||
"serverURL": $('.ui-tabs-selected').find('a').attr('wadoUrl'),
|
||||
"dicomURL": $('.ui-tabs-selected').find('a').attr('name'),
|
||||
"bgColor": $('.ui-widget-content').css('background-color'),
|
||||
"imgType": $('.ui-tabs-selected').find('a').attr('imgType'),
|
||||
};
|
||||
|
||||
$.cookies.set('patient', jsonObj);
|
||||
|
||||
window.open("viewer.html", "_blank");
|
||||
}
|
||||
|
||||
function showWestPane(iPos) {
|
||||
var urlDcm = $('.ui-tabs-selected').find('a').attr('name');
|
||||
var urlWado = $('.ui-tabs-selected').find('a').attr('wadoUrl');
|
||||
var imgType = $('.ui-tabs-selected').find('a').attr('imgType');
|
||||
|
||||
var tmpUrl = "westContainer1.jsp?patient=" + iPos[1] + "&study=" + iPos[8] + "&patientName=" + iPos[2];
|
||||
tmpUrl += "&studyDesc=" + iPos[5] + "&studyDate=" + iPos[4]["display"].split(" ")[0] + "&totalSeries=" + iPos[10] + "&dcmURL=" + urlDcm;
|
||||
tmpUrl += "&wadoUrl=" + urlWado;
|
||||
tmpUrl += "&contentType=image/" + imgType;
|
||||
|
||||
var selTabText = $('.ui-tabs-selected').find('a').attr('href');
|
||||
var container = selTabText + '_westPane';
|
||||
$(container).load(encodeURI(tmpUrl));
|
||||
|
||||
}
|
||||
|
||||
function getParameterByName(name) {
|
||||
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
|
||||
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
||||
results = regex.exec(location.search);
|
||||
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||
}
|
||||
|
||||
function multiselectModality() {
|
||||
$('.modalitiesList').multiselect({
|
||||
selectedList: 12,
|
||||
minWidth: 130,
|
||||
header: false,
|
||||
noneSelectedText: "ALL"
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
/**
|
||||
* @namespace HTML related.
|
||||
*/
|
||||
ovm.html = ovm.html || {};
|
||||
|
||||
/**
|
||||
* @function Get an HTML table corresponding to an input javascript array.
|
||||
* @param input The input can be either a 1D array,
|
||||
* 2D array, an array of objects or an object.
|
||||
*/
|
||||
ovm.html.appendCell = function(row, text)
|
||||
{
|
||||
var cell = row.insertCell(-1);
|
||||
cell.appendChild(document.createTextNode(text));
|
||||
};
|
||||
|
||||
/**
|
||||
* @function
|
||||
*/
|
||||
ovm.html.appendRowForArray = function(table, input, level, maxLevel, rowHeader)
|
||||
{
|
||||
var row = null;
|
||||
// loop through
|
||||
for(var i=0; i<input.length; ++i) {
|
||||
// more to come
|
||||
if( typeof input[i] === 'number'
|
||||
|| typeof input[i] === 'string'
|
||||
|| input[i] === null
|
||||
|| input[i] === undefined
|
||||
|| level >= maxLevel ) {
|
||||
if( !row ) {
|
||||
row = table.insertRow(-1);
|
||||
}
|
||||
ovm.html.appendCell(row, input[i]);
|
||||
}
|
||||
// last level
|
||||
else {
|
||||
ovm.html.appendRow(table, input[i], level+i, maxLevel, rowHeader);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @function
|
||||
*/
|
||||
ovm.html.appendRowForObject = function(table, input, level, maxLevel, rowHeader)
|
||||
{
|
||||
var keys = Object.keys(input);
|
||||
var row = null;
|
||||
for( var o=0; o<keys.length; ++o ) {
|
||||
// more to come
|
||||
if( typeof input[keys[o]] === 'number'
|
||||
|| typeof input[keys[o]] === 'string'
|
||||
|| input[keys[o]] === null
|
||||
|| input[keys[o]] === undefined
|
||||
|| level >= maxLevel ) {
|
||||
if( !row ) {
|
||||
row = table.insertRow(-1);
|
||||
}
|
||||
if( o === 0 && rowHeader) {
|
||||
ovm.html.appendCell(row, rowHeader);
|
||||
}
|
||||
ovm.html.appendCell(row, input[keys[o]]);
|
||||
}
|
||||
// last level
|
||||
else {
|
||||
ovm.html.appendRow(table, input[keys[o]], level+o, maxLevel, keys[o]);
|
||||
}
|
||||
}
|
||||
// header row
|
||||
// warn: need to create the header after the rest
|
||||
// otherwise the data will inserted in the thead...
|
||||
if( level === 2 ) {
|
||||
var header = table.createTHead();
|
||||
var th = header.insertRow(-1);
|
||||
if( rowHeader ) {
|
||||
ovm.html.appendCell(th, "");
|
||||
}
|
||||
for( var k=0; k<keys.length; ++k ) {
|
||||
ovm.html.appendCell(th, ovm.utils.capitaliseFirstLetter(keys[k]));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @function
|
||||
*/
|
||||
ovm.html.appendRow = function(table, input, level, maxLevel, rowHeader)
|
||||
{
|
||||
// array
|
||||
if( input instanceof Array ) {
|
||||
ovm.html.appendRowForArray(table, input, level+1, maxLevel, rowHeader);
|
||||
}
|
||||
// object
|
||||
else if( typeof input === 'object') {
|
||||
ovm.html.appendRowForObject(table, input, level+1, maxLevel, rowHeader);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @function
|
||||
*/
|
||||
ovm.html.toTable = function(input)
|
||||
{
|
||||
var table = document.createElement('table');
|
||||
ovm.html.appendRow(table, input, 0, 2);
|
||||
return table;
|
||||
};
|
||||
|
||||
/**
|
||||
* @function
|
||||
* @param term
|
||||
* @param table
|
||||
*/
|
||||
ovm.html.filterTable = function(term, table) {
|
||||
// de-highlight
|
||||
ovm.html.dehighlight(table);
|
||||
// split search terms
|
||||
var terms = term.value.toLowerCase().split(" ");
|
||||
|
||||
// search
|
||||
var text = 0;
|
||||
var display = 0;
|
||||
for (var r = 1; r < table.rows.length; ++r) {
|
||||
display = '';
|
||||
for (var i = 0; i < terms.length; ++i) {
|
||||
text = table.rows[r].innerHTML.replace(/<[^>]+>/g, "").toLowerCase();
|
||||
if (text.indexOf(terms[i]) < 0) {
|
||||
display = 'none';
|
||||
} else {
|
||||
if (terms[i].length) {
|
||||
ovm.html.highlight(terms[i], table.rows[r]);
|
||||
}
|
||||
}
|
||||
table.rows[r].style.display = display;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @function Transform back each
|
||||
* <span>preText <span class="highlighted">term</span> postText</span>
|
||||
* into its original preText term postText
|
||||
* @param container The container to de-highlight.
|
||||
*/
|
||||
ovm.html.dehighlight = function(container) {
|
||||
for (var i = 0; i < container.childNodes.length; i++) {
|
||||
var node = container.childNodes[i];
|
||||
|
||||
if (node.attributes
|
||||
&& node.attributes['class']
|
||||
&& node.attributes['class'].value === 'highlighted') {
|
||||
node.parentNode.parentNode.replaceChild(
|
||||
document.createTextNode(
|
||||
node.parentNode.innerHTML.replace(/<[^>]+>/g, "")),
|
||||
node.parentNode);
|
||||
// Stop here and process next parent
|
||||
return;
|
||||
} else if (node.nodeType !== 3) {
|
||||
// Keep going onto other elements
|
||||
ovm.html.dehighlight(node);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @function Create a
|
||||
* <span>preText <span class="highlighted">term</span> postText</span>
|
||||
* around each search term
|
||||
* @param term The term to highlight.
|
||||
* @param container The container where to highlight the term.
|
||||
*/
|
||||
ovm.html.highlight = function(term, container) {
|
||||
for (var i = 0; i < container.childNodes.length; i++) {
|
||||
var node = container.childNodes[i];
|
||||
|
||||
if (node.nodeType === 3) {
|
||||
// Text node
|
||||
var data = node.data;
|
||||
var data_low = data.toLowerCase();
|
||||
if (data_low.indexOf(term) >= 0) {
|
||||
//term found!
|
||||
var new_node = document.createElement('span');
|
||||
node.parentNode.replaceChild(new_node, node);
|
||||
|
||||
var result;
|
||||
while ((result = data_low.indexOf(term)) !== -1) {
|
||||
// before term
|
||||
new_node.appendChild(document.createTextNode(
|
||||
data.substr(0, result)));
|
||||
// term
|
||||
new_node.appendChild(ovm.html.createHighlightNode(
|
||||
document.createTextNode(data.substr(
|
||||
result, term.length))));
|
||||
// reduce search string
|
||||
data = data.substr(result + term.length);
|
||||
data_low = data_low.substr(result + term.length);
|
||||
}
|
||||
new_node.appendChild(document.createTextNode(data));
|
||||
}
|
||||
} else {
|
||||
// Keep going onto other elements
|
||||
ovm.html.highlight(term, node);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @function
|
||||
*/
|
||||
ovm.html.createHighlightNode = function(child) {
|
||||
var node = document.createElement('span');
|
||||
node.setAttribute('class', 'highlighted');
|
||||
node.attributes['class'].value = 'highlighted';
|
||||
node.appendChild(child);
|
||||
return node;
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
var languages = {
|
||||
PageTitle: "Oviyam",
|
||||
Version:"2.6",
|
||||
UserName: "User Name",
|
||||
Password: "Password",
|
||||
Login: "Login",
|
||||
Footer: "Oviyam2.6 requires latest version of Google Chrome / Safari.",
|
||||
PatientName: "Patient Name",
|
||||
PatientId: "Patient ID",
|
||||
BirthDate: "Birth Date",
|
||||
AccessionNumber: "Accession Number",
|
||||
FromStudyDate: "Study Date (From)",
|
||||
ToStudyDate: "Study Date (To)",
|
||||
StudyDate: "Study Date ",
|
||||
StudyDesc: "Study Description",
|
||||
ReferPhysician: "Referring Physician",
|
||||
Modality: "Modality",
|
||||
InstanceCount: "Instance Count",
|
||||
Reset: "Reset",
|
||||
Search: "Search",
|
||||
Layout: "Layout",
|
||||
Windowing: "Windowing",
|
||||
Zoom: "Zoom",
|
||||
Move: "Move",
|
||||
ScoutLine: "ScoutLine",
|
||||
ScrollImage: "ScrollImage",
|
||||
Synchronize: "Synchronize",
|
||||
VFlip: "Vertical Flip",
|
||||
HFlip: "Horizontal Flip",
|
||||
LRotate: "Left Rotate",
|
||||
RRotate: "Right Rotate",
|
||||
Invert: "Invert",
|
||||
TextOverlay: "Text Overlay ",
|
||||
FullScreen: "Full Screen",
|
||||
MetaData: "Meta Data",
|
||||
Lines: "Lines",
|
||||
Server: "Server",
|
||||
QueryParam: "Query Param",
|
||||
Preferences: "Preferences",
|
||||
Verify: "Verify",
|
||||
Add: "Add",
|
||||
Edit: "Edit",
|
||||
Delete: "Delete",
|
||||
Description: "Description",
|
||||
HostName: "Host Name",
|
||||
AETitle: "AE Title",
|
||||
Port: "Port",
|
||||
Retrieve: "Retrieve",
|
||||
Update: "Update",
|
||||
FilterName: "Filter Name",
|
||||
StudyDateFilter: "Study Date Filter",
|
||||
StudytimeFilter: "Study time Filter",
|
||||
ModalityFilter: "Modality Filter",
|
||||
AutoRefresh: "Auto Refresh",
|
||||
IOviyamCxt: "iOviyam Context",
|
||||
disclaimer: "This version of Oviyam, being a free open-source software (FOSS), is not certified as a commercial medical device (FDA or CE-1).",
|
||||
limitation: "Please check with local compliance office for possible limitations in its clinical use."
|
||||
|
||||
};
|
||||
@@ -0,0 +1,58 @@
|
||||
var languages = {
|
||||
PageTitle: "Radiologie WebViewer",
|
||||
Version:"2.6",
|
||||
UserName: "Benutzername",
|
||||
Password: "Passwort",
|
||||
Login: "Login",
|
||||
Footer: "Dieser Viewer benötigt Google Chrome / Safari.",
|
||||
PatientName: "Patienten Name",
|
||||
PatientId: "Patienten ID",
|
||||
BirthDate: "Geburtsdatum",
|
||||
AccessionNumber: "Accession Number",
|
||||
FromStudyDate: "Studien Datum (von)",
|
||||
ToStudyDate: "Studien Datum (bis)",
|
||||
StudyDate: "Studien Datum ",
|
||||
StudyDesc: "Studienbeschreibung",
|
||||
ReferPhysician: "Überweisender Arzt",
|
||||
Modality: "Modalität",
|
||||
InstanceCount: "Anzahl Bilder",
|
||||
Reset: "Zurücksetzen",
|
||||
Search: "Suche",
|
||||
Layout: "Layout",
|
||||
Windowing: "Windowing",
|
||||
Zoom: "Zoom",
|
||||
Move: "Bewegen",
|
||||
ScoutLine: "Referenzlinie",
|
||||
ScrollImage: "ScrollImage",
|
||||
Synchronize: "Synchronisieren",
|
||||
VFlip: "Vertikal spiegeln",
|
||||
HFlip: "Horizontal spiegeln",
|
||||
LRotate: "Links drehen",
|
||||
RRotate: "Rechts drehen",
|
||||
Invert: "Invertieren",
|
||||
TextOverlay: "Text Overlay ",
|
||||
FullScreen: "Vollbild",
|
||||
MetaData: "Meta Daten",
|
||||
Lines: "Linien",
|
||||
Server: "Server",
|
||||
QueryParam: "Query Parameter",
|
||||
Preferences: "Darstellung",
|
||||
Verify: "Verifizieren",
|
||||
Add: "Hinzufügen",
|
||||
Edit: "Bearbeiten",
|
||||
Delete: "Löschen",
|
||||
Description: "Beschreibung",
|
||||
HostName: "IP",
|
||||
AETitle: "AET",
|
||||
Port: "Port",
|
||||
Retrieve: "Retrieve",
|
||||
Update: "Update",
|
||||
FilterName: "Filter Name",
|
||||
StudyDateFilter: "Studiendatums Filter",
|
||||
StudytimeFilter: "Studienzeit Filter",
|
||||
ModalityFilter: "Modalitäten Filter",
|
||||
AutoRefresh: "Automatisch aktualisieren",
|
||||
IOviyamCxt: "iOviyam Context",
|
||||
disclaimer: "This version of Oviyam, being a free open-source software (FOSS), is not certified as a commercial medical device (FDA or CE-1).",
|
||||
limitation: "Please check with local compliance office for possible limitations in its clinical use."
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
var languages = {
|
||||
PageTitle: "Oviyam",
|
||||
Version:"2.6",
|
||||
UserName: "ユーザ名",
|
||||
Password: "パスワード",
|
||||
Login: "ログイン",
|
||||
Footer: "Oviyam2.6 は Google Chrome もしくは Safari の最新バージョンが必要です",
|
||||
PatientName: "患者名",
|
||||
PatientId: "患者ID",
|
||||
BirthDate: "生年月日",
|
||||
AccessionNumber: "アクセッションNo",
|
||||
FromStudyDate: "検査日付 (From)",
|
||||
ToStudyDate: "検査日付 (to)",
|
||||
StudyDate: "検査日付 ",
|
||||
StudyDesc: "検査説明",
|
||||
ReferPhysician: "診断医師",
|
||||
Modality: "モダリティ",
|
||||
InstanceCount: "インスタンス",
|
||||
Reset: "リセット",
|
||||
Search: "検索",
|
||||
Layout: "レイアウト",
|
||||
Windowing: "ウインドニング",
|
||||
Zoom: "拡大縮小",
|
||||
Move: "移動",
|
||||
ScoutLine: "スカウトライン",
|
||||
ScrollImage: "スクロールイメージ",
|
||||
Synchronize: "同期",
|
||||
VFlip: "上下反転",
|
||||
HFlip: "左右反転",
|
||||
LRotate: "左回転",
|
||||
RRotate: "右回転",
|
||||
Invert: "白黒反転",
|
||||
TextOverlay: "テキストオーバレイ",
|
||||
FullScreen: "フルスクリーン",
|
||||
MetaData: "メタデータ",
|
||||
Line: "線",
|
||||
Rectangle: "矩形",
|
||||
Ellipse: "楕円形",
|
||||
Server: "サーバ",
|
||||
QueryParam: "クエリ",
|
||||
Preferences: "プリファレンス",
|
||||
Verify: "検証",
|
||||
Add: "新規",
|
||||
Edit: "編集",
|
||||
Delete: "削除",
|
||||
Description: "説明",
|
||||
HostName: "ホスト名",
|
||||
AETitle: "AEタイトル",
|
||||
Port: "ポート番号",
|
||||
Retrieve: "リトリーブ",
|
||||
Update: "更新",
|
||||
FilterName: "フィルタ名",
|
||||
StudyDateFilter: "検査日付 フィルタ",
|
||||
StudytimeFilter: "検査時間 フィルタ",
|
||||
ModalityFilter: "モダリティ フィルタ",
|
||||
AutoRefresh: "自動更新",
|
||||
IOviyamCxt: "iOviyamコンテキスト",
|
||||
disclaimer: "This version of Oviyam, being a free open-source software (FOSS), is not certified as a commercial medical device (FDA or CE-1).",
|
||||
limitation: "Please check with local compliance office for possible limitations in its clinical use."
|
||||
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
var languages = {
|
||||
PageTitle: "ஓவியம்",
|
||||
Version:"2.6",
|
||||
UserName: "பயனர் பெயர்",
|
||||
Password: "கடவுச்சொல்",
|
||||
Login: "உள்நுழைக",
|
||||
Footer: "ஓவியம்2.6 -க்கு தேவை google chrome / safari புதிய பதிப்பு. ",
|
||||
PatientName: "நோயாளியின் பெயர்",
|
||||
PatientId: "நோயாளியின் எண்",
|
||||
BirthDate: "பிறந்த தேதி",
|
||||
AccessionNumber: "அக்ஸசன் எண்",
|
||||
FromStudyDate: "ஆய்வு தேதி (முதல்)",
|
||||
ToStudyDate: "ஆய்வு தேதி (முடிவு)",
|
||||
StudyDate: "ஆய்வு தேதி",
|
||||
StudyDesc: "ஆய்வு குறிப்பு",
|
||||
ReferPhysician: "பரிந்துரைத்த மருத்துவர்",
|
||||
Modality: "Modality",
|
||||
InstanceCount: "படிமங்கள்",
|
||||
Reset: "மீட்டமைக்க",
|
||||
Search: "தேடல்",
|
||||
Layout: "மனைப்பிரிவு",
|
||||
Windowing: "Windowing",
|
||||
Zoom: "உரு பெரிதாக்கு",
|
||||
Move: "நகர்த்து",
|
||||
ScoutLine: "Scout Line",
|
||||
ScrollImage: "Stack Image",
|
||||
Synchronize: "ScoutLine",
|
||||
VFlip: "Vert.Flip",
|
||||
HFlip: "Hori.Flip",
|
||||
LRotate: "இடப்பக்கம் சுழற்று",
|
||||
RRotate: "வலப்பக்கம் சுழற்று",
|
||||
Invert: "புரட்டுக",
|
||||
TextOverlay: "Text Overlay ",
|
||||
FullScreen: "முழுத் திரை",
|
||||
MetaData: "Meta Data",
|
||||
Lines: "அளவு",
|
||||
Server: "Server",
|
||||
QueryParam: "Query Param",
|
||||
Preferences: "Preferences",
|
||||
Verify: "உறுதிப்படுத்து",
|
||||
Add: "கூட்டு",
|
||||
Edit: "தொகு",
|
||||
Delete: "அழி",
|
||||
Description: "விளக்கம்",
|
||||
HostName: "Host Name",
|
||||
AETitle: "AE Title",
|
||||
Port: "Port",
|
||||
Retrieve: "Retrieve",
|
||||
Update: "புதுப்பிப்பு",
|
||||
FilterName: "Filter Name",
|
||||
StudyDateFilter: "Study Date Filter",
|
||||
StudytimeFilter: "Study time Filter",
|
||||
ModalityFilter: "Modality Filter",
|
||||
AutoRefresh: "Auto Refresh",
|
||||
IOviyamCxt: "iOviyam Context",
|
||||
disclaimer: "This version of Oviyam, being a free open-source software (FOSS), is not certified as a commercial medical device (FDA or CE-1).",
|
||||
limitation: "Please check with local compliance office for possible limitations in its clinical use."
|
||||
|
||||
};
|
||||
@@ -0,0 +1,148 @@
|
||||
/**
|
||||
* BinFileReader.js
|
||||
* You can find more about this function at
|
||||
* http://nagoon97.com/reading-binary-files-using-ajax/
|
||||
*
|
||||
* Copyright (c) 2008 Andy G.P. Na <nagoon97@naver.com>
|
||||
* The source code is freely distributable under the terms of an MIT-style license.
|
||||
*/
|
||||
function BinFileReader(fileURL){
|
||||
var _exception = {};
|
||||
_exception.FileLoadFailed = 1;
|
||||
_exception.EOFReached = 2;
|
||||
|
||||
var filePointer = 0;
|
||||
var fileSize = -1;
|
||||
var fileContents;
|
||||
|
||||
this.getFileSize = function(){
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
this.getFilePointer = function(){
|
||||
return filePointer;
|
||||
}
|
||||
this.readBytes=function()
|
||||
{
|
||||
return fileContents;
|
||||
}
|
||||
|
||||
this.movePointerTo = function(iTo){
|
||||
if(iTo < 0) filePointer = 0;
|
||||
else if(iTo > this.getFileSize()) throwException(_exception.EOFReached);
|
||||
else filePointer = iTo;
|
||||
|
||||
return filePointer;
|
||||
};
|
||||
|
||||
this.movePointer = function(iDirection){
|
||||
this.movePointerTo(filePointer + iDirection);
|
||||
|
||||
return filePointer;
|
||||
};
|
||||
|
||||
this.readNumber = function(iNumBytes, iFrom){
|
||||
iNumBytes = iNumBytes || 1;
|
||||
iFrom = iFrom || filePointer;
|
||||
|
||||
this.movePointerTo(iFrom + iNumBytes);
|
||||
|
||||
var result = 0;
|
||||
for(var i=iFrom + iNumBytes; i>iFrom; i--){
|
||||
result = result * 256 + this.readByteAt(i-1);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
this.readString = function(iNumChars, iFrom){
|
||||
iNumChars = iNumChars || 1;
|
||||
iFrom = iFrom || filePointer;
|
||||
|
||||
this.movePointerTo(iFrom);
|
||||
|
||||
var result = "";
|
||||
var tmpTo = iFrom + iNumChars;
|
||||
for(var i=iFrom; i<tmpTo; i++){
|
||||
result += String.fromCharCode(this.readNumber(1));
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
this.getBytes = function(iFrom) {
|
||||
this.movePointerTo(iFrom);
|
||||
var tmpTo = fileContents.length;
|
||||
|
||||
var result = new Uint8Array(tmpTo-iFrom);
|
||||
var index = 0;
|
||||
for(var i=iFrom;i<tmpTo;i++) {
|
||||
result[index] = this.readByteAt(i);
|
||||
index++;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
this.readUnicodeString = function(iNumChars, iFrom){
|
||||
iNumChars = iNumChars || 1;
|
||||
iFrom = iFrom || filePointer;
|
||||
|
||||
this.movePointerTo(iFrom);
|
||||
|
||||
var result = "";
|
||||
var tmpTo = iFrom + iNumChars*2;
|
||||
for(var i=iFrom; i<tmpTo; i+=2){
|
||||
result += String.fromCharCode(this.readNumber(2));
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
function throwException(errorCode){
|
||||
switch(errorCode){
|
||||
case _exception.FileLoadFailed:
|
||||
throw new Error('Error: Filed to load "'+fileURL+'"');
|
||||
break;
|
||||
case _exception.EOFReached:
|
||||
throw new Error("Error: EOF reached");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function BinFileReaderImpl_IE(fileURL){
|
||||
var vbArr = BinFileReaderImpl_IE_VBAjaxLoader(fileURL);
|
||||
fileContents = vbArr.toArray();
|
||||
|
||||
fileSize = fileContents.length-1;
|
||||
|
||||
if(fileSize < 0) throwException(_exception.FileLoadFailed);
|
||||
|
||||
this.readByteAt = function(i){
|
||||
return fileContents[i];
|
||||
}
|
||||
}
|
||||
|
||||
function BinFileReaderImpl(fileURL){
|
||||
var req = new XMLHttpRequest();
|
||||
|
||||
req.open('GET', fileURL, false);
|
||||
|
||||
//XHR binary charset opt by Marcus Granado 2006 [http://mgran.blogspot.com]
|
||||
req.overrideMimeType('text/plain; charset=x-user-defined');
|
||||
req.send(null);
|
||||
|
||||
if (req.status != 200) throwException(_exception.FileLoadFailed);
|
||||
{
|
||||
fileContents = req.responseText;
|
||||
}
|
||||
fileSize = fileContents.length;
|
||||
this.readByteAt = function(i){
|
||||
return fileContents.charCodeAt(i) & 0xff;
|
||||
}
|
||||
}
|
||||
if(/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent))
|
||||
BinFileReaderImpl_IE.apply(this, [fileURL]);
|
||||
else
|
||||
BinFileReaderImpl.apply(this, [fileURL]);
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* Version: 1.0 Alpha-1
|
||||
* Build Date: 13-Nov-2007
|
||||
* Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
|
||||
* License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/.
|
||||
* Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
|
||||
*/
|
||||
Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};
|
||||
Date.getMonthNumberFromName=function(name){var n=Date.CultureInfo.monthNames,m=Date.CultureInfo.abbreviatedMonthNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
|
||||
return-1;};Date.getDayNumberFromName=function(name){var n=Date.CultureInfo.dayNames,m=Date.CultureInfo.abbreviatedDayNames,o=Date.CultureInfo.shortestDayNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
|
||||
return-1;};Date.isLeapYear=function(year){return(((year%4===0)&&(year%100!==0))||(year%400===0));};Date.getDaysInMonth=function(year,month){return[31,(Date.isLeapYear(year)?29:28),31,30,31,30,31,31,30,31,30,31][month];};Date.getTimezoneOffset=function(s,dst){return(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST[s.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[s.toUpperCase()];};Date.getTimezoneAbbreviation=function(offset,dst){var n=(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,p;for(p in n){if(n[p]===offset){return p;}}
|
||||
return null;};Date.prototype.clone=function(){return new Date(this.getTime());};Date.prototype.compareTo=function(date){if(isNaN(this)){throw new Error(this);}
|
||||
if(date instanceof Date&&!isNaN(date)){return(this>date)?1:(this<date)?-1:0;}else{throw new TypeError(date);}};Date.prototype.equals=function(date){return(this.compareTo(date)===0);};Date.prototype.between=function(start,end){var t=this.getTime();return t>=start.getTime()&&t<=end.getTime();};Date.prototype.addMilliseconds=function(value){this.setMilliseconds(this.getMilliseconds()+value);return this;};Date.prototype.addSeconds=function(value){return this.addMilliseconds(value*1000);};Date.prototype.addMinutes=function(value){return this.addMilliseconds(value*60000);};Date.prototype.addHours=function(value){return this.addMilliseconds(value*3600000);};Date.prototype.addDays=function(value){return this.addMilliseconds(value*86400000);};Date.prototype.addWeeks=function(value){return this.addMilliseconds(value*604800000);};Date.prototype.addMonths=function(value){var n=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+value);this.setDate(Math.min(n,this.getDaysInMonth()));return this;};Date.prototype.addYears=function(value){return this.addMonths(value*12);};Date.prototype.add=function(config){if(typeof config=="number"){this._orient=config;return this;}
|
||||
var x=config;if(x.millisecond||x.milliseconds){this.addMilliseconds(x.millisecond||x.milliseconds);}
|
||||
if(x.second||x.seconds){this.addSeconds(x.second||x.seconds);}
|
||||
if(x.minute||x.minutes){this.addMinutes(x.minute||x.minutes);}
|
||||
if(x.hour||x.hours){this.addHours(x.hour||x.hours);}
|
||||
if(x.month||x.months){this.addMonths(x.month||x.months);}
|
||||
if(x.year||x.years){this.addYears(x.year||x.years);}
|
||||
if(x.day||x.days){this.addDays(x.day||x.days);}
|
||||
return this;};Date._validate=function(value,min,max,name){if(typeof value!="number"){throw new TypeError(value+" is not a Number.");}else if(value<min||value>max){throw new RangeError(value+" is not a valid value for "+name+".");}
|
||||
return true;};Date.validateMillisecond=function(n){return Date._validate(n,0,999,"milliseconds");};Date.validateSecond=function(n){return Date._validate(n,0,59,"seconds");};Date.validateMinute=function(n){return Date._validate(n,0,59,"minutes");};Date.validateHour=function(n){return Date._validate(n,0,23,"hours");};Date.validateDay=function(n,year,month){return Date._validate(n,1,Date.getDaysInMonth(year,month),"days");};Date.validateMonth=function(n){return Date._validate(n,0,11,"months");};Date.validateYear=function(n){return Date._validate(n,1,9999,"seconds");};Date.prototype.set=function(config){var x=config;if(!x.millisecond&&x.millisecond!==0){x.millisecond=-1;}
|
||||
if(!x.second&&x.second!==0){x.second=-1;}
|
||||
if(!x.minute&&x.minute!==0){x.minute=-1;}
|
||||
if(!x.hour&&x.hour!==0){x.hour=-1;}
|
||||
if(!x.day&&x.day!==0){x.day=-1;}
|
||||
if(!x.month&&x.month!==0){x.month=-1;}
|
||||
if(!x.year&&x.year!==0){x.year=-1;}
|
||||
if(x.millisecond!=-1&&Date.validateMillisecond(x.millisecond)){this.addMilliseconds(x.millisecond-this.getMilliseconds());}
|
||||
if(x.second!=-1&&Date.validateSecond(x.second)){this.addSeconds(x.second-this.getSeconds());}
|
||||
if(x.minute!=-1&&Date.validateMinute(x.minute)){this.addMinutes(x.minute-this.getMinutes());}
|
||||
if(x.hour!=-1&&Date.validateHour(x.hour)){this.addHours(x.hour-this.getHours());}
|
||||
if(x.month!==-1&&Date.validateMonth(x.month)){this.addMonths(x.month-this.getMonth());}
|
||||
if(x.year!=-1&&Date.validateYear(x.year)){this.addYears(x.year-this.getFullYear());}
|
||||
if(x.day!=-1&&Date.validateDay(x.day,this.getFullYear(),this.getMonth())){this.addDays(x.day-this.getDate());}
|
||||
if(x.timezone){this.setTimezone(x.timezone);}
|
||||
if(x.timezoneOffset){this.setTimezoneOffset(x.timezoneOffset);}
|
||||
return this;};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;};Date.prototype.isLeapYear=function(){var y=this.getFullYear();return(((y%4===0)&&(y%100!==0))||(y%400===0));};Date.prototype.isWeekday=function(){return!(this.is().sat()||this.is().sun());};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth());};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1});};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()});};Date.prototype.moveToDayOfWeek=function(day,orient){var diff=(day-this.getDay()+7*(orient||+1))%7;return this.addDays((diff===0)?diff+=7*(orient||+1):diff);};Date.prototype.moveToMonth=function(month,orient){var diff=(month-this.getMonth()+12*(orient||+1))%12;return this.addMonths((diff===0)?diff+=12*(orient||+1):diff);};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000);};Date.prototype.getWeekOfYear=function(firstDayOfWeek){var y=this.getFullYear(),m=this.getMonth(),d=this.getDate();var dow=firstDayOfWeek||Date.CultureInfo.firstDayOfWeek;var offset=7+1-new Date(y,0,1).getDay();if(offset==8){offset=1;}
|
||||
var daynum=((Date.UTC(y,m,d,0,0,0)-Date.UTC(y,0,1,0,0,0))/86400000)+1;var w=Math.floor((daynum-offset+7)/7);if(w===dow){y--;var prevOffset=7+1-new Date(y,0,1).getDay();if(prevOffset==2||prevOffset==8){w=53;}else{w=52;}}
|
||||
return w;};Date.prototype.isDST=function(){console.log('isDST');return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D";};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST());};Date.prototype.setTimezoneOffset=function(s){var here=this.getTimezoneOffset(),there=Number(s)*-6/10;this.addMinutes(there-here);return this;};Date.prototype.setTimezone=function(s){return this.setTimezoneOffset(Date.getTimezoneOffset(s));};Date.prototype.getUTCOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-10000).toString();return r[0]+r.substr(2);}else{r=(n+10000).toString();return"+"+r.substr(1);}};Date.prototype.getDayName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()];};Date.prototype.getMonthName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()];};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(format){var self=this;var p=function p(s){return(s.toString().length==1)?"0"+s:s;};return format?format.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(format){switch(format){case"hh":return p(self.getHours()<13?self.getHours():(self.getHours()-12));case"h":return self.getHours()<13?self.getHours():(self.getHours()-12);case"HH":return p(self.getHours());case"H":return self.getHours();case"mm":return p(self.getMinutes());case"m":return self.getMinutes();case"ss":return p(self.getSeconds());case"s":return self.getSeconds();case"yyyy":return self.getFullYear();case"yy":return self.getFullYear().toString().substring(2,4);case"dddd":return self.getDayName();case"ddd":return self.getDayName(true);case"dd":return p(self.getDate());case"d":return self.getDate().toString();case"MMMM":return self.getMonthName();case"MMM":return self.getMonthName(true);case"MM":return p((self.getMonth()+1));case"M":return self.getMonth()+1;case"t":return self.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return self.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return"";}}):this._toString();};
|
||||
Date.now=function(){return new Date();};Date.today=function(){return Date.now().clearTime();};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this;};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this;};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this;};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var c={};c[this._dateElement]=this;return Date.now().add(c);};Number.prototype.ago=function(){var c={};c[this._dateElement]=this*-1;return Date.now().add(c);};(function(){var $D=Date.prototype,$N=Number.prototype;var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),de;var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;}
|
||||
return this.moveToDayOfWeek(n,this._orient);};};for(var i=0;i<dx.length;i++){$D[dx[i]]=$D[dx[i].substring(0,3)]=df(i);}
|
||||
var mf=function(n){return function(){if(this._is){this._is=false;return this.getMonth()===n;}
|
||||
return this.moveToMonth(n,this._orient);};};for(var j=0;j<mx.length;j++){$D[mx[j]]=$D[mx[j].substring(0,3)]=mf(j);}
|
||||
var ef=function(j){return function(){if(j.substring(j.length-1)!="s"){j+="s";}
|
||||
return this["add"+j](this._orient);};};var nf=function(n){return function(){this._dateElement=n;return this;};};for(var k=0;k<px.length;k++){de=px[k].toLowerCase();$D[de]=$D[de+"s"]=ef(px[k]);$N[de]=$N[de+"s"]=nf(de);}}());Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ");};Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern);};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern);};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern);};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern);};Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};
|
||||
(function(){Date.Parsing={Exception:function(s){this.message="Parse error at '"+s.substring(0,10)+" ...'";}};var $P=Date.Parsing;var _=$P.Operators={rtoken:function(r){return function(s){var mx=s.match(r);if(mx){return([mx[0],s.substring(mx[0].length)]);}else{throw new $P.Exception(s);}};},token:function(s){return function(s){return _.rtoken(new RegExp("^\s*"+s+"\s*"))(s);};},stoken:function(s){return _.rtoken(new RegExp("^"+s));},until:function(p){return function(s){var qx=[],rx=null;while(s.length){try{rx=p.call(this,s);}catch(e){qx.push(rx[0]);s=rx[1];continue;}
|
||||
break;}
|
||||
return[qx,s];};},many:function(p){return function(s){var rx=[],r=null;while(s.length){try{r=p.call(this,s);}catch(e){return[rx,s];}
|
||||
rx.push(r[0]);s=r[1];}
|
||||
return[rx,s];};},optional:function(p){return function(s){var r=null;try{r=p.call(this,s);}catch(e){return[null,s];}
|
||||
return[r[0],r[1]];};},not:function(p){return function(s){try{p.call(this,s);}catch(e){return[null,s];}
|
||||
throw new $P.Exception(s);};},ignore:function(p){return p?function(s){var r=null;r=p.call(this,s);return[null,r[1]];}:null;},product:function(){var px=arguments[0],qx=Array.prototype.slice.call(arguments,1),rx=[];for(var i=0;i<px.length;i++){rx.push(_.each(px[i],qx));}
|
||||
return rx;},cache:function(rule){var cache={},r=null;return function(s){try{r=cache[s]=(cache[s]||rule.call(this,s));}catch(e){r=cache[s]=e;}
|
||||
if(r instanceof $P.Exception){throw r;}else{return r;}};},any:function(){var px=arguments;return function(s){var r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
|
||||
try{r=(px[i].call(this,s));}catch(e){r=null;}
|
||||
if(r){return r;}}
|
||||
throw new $P.Exception(s);};},each:function(){var px=arguments;return function(s){var rx=[],r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
|
||||
try{r=(px[i].call(this,s));}catch(e){throw new $P.Exception(s);}
|
||||
rx.push(r[0]);s=r[1];}
|
||||
return[rx,s];};},all:function(){var px=arguments,_=_;return _.each(_.optional(px));},sequence:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;if(px.length==1){return px[0];}
|
||||
return function(s){var r=null,q=null;var rx=[];for(var i=0;i<px.length;i++){try{r=px[i].call(this,s);}catch(e){break;}
|
||||
rx.push(r[0]);try{q=d.call(this,r[1]);}catch(ex){q=null;break;}
|
||||
s=q[1];}
|
||||
if(!r){throw new $P.Exception(s);}
|
||||
if(q){throw new $P.Exception(q[1]);}
|
||||
if(c){try{r=c.call(this,r[1]);}catch(ey){throw new $P.Exception(r[1]);}}
|
||||
return[rx,(r?r[1]:s)];};},between:function(d1,p,d2){d2=d2||d1;var _fn=_.each(_.ignore(d1),p,_.ignore(d2));return function(s){var rx=_fn.call(this,s);return[[rx[0][0],r[0][2]],rx[1]];};},list:function(p,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return(p instanceof Array?_.each(_.product(p.slice(0,-1),_.ignore(d)),p.slice(-1),_.ignore(c)):_.each(_.many(_.each(p,_.ignore(d))),px,_.ignore(c)));},set:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return function(s){var r=null,p=null,q=null,rx=null,best=[[],s],last=false;for(var i=0;i<px.length;i++){q=null;p=null;r=null;last=(px.length==1);try{r=px[i].call(this,s);}catch(e){continue;}
|
||||
rx=[[r[0]],r[1]];if(r[1].length>0&&!last){try{q=d.call(this,r[1]);}catch(ex){last=true;}}else{last=true;}
|
||||
if(!last&&q[1].length===0){last=true;}
|
||||
if(!last){var qx=[];for(var j=0;j<px.length;j++){if(i!=j){qx.push(px[j]);}}
|
||||
p=_.set(qx,d).call(this,q[1]);if(p[0].length>0){rx[0]=rx[0].concat(p[0]);rx[1]=p[1];}}
|
||||
if(rx[1].length<best[1].length){best=rx;}
|
||||
if(best[1].length===0){break;}}
|
||||
if(best[0].length===0){return best;}
|
||||
if(c){try{q=c.call(this,best[1]);}catch(ey){throw new $P.Exception(best[1]);}
|
||||
best[1]=q[1];}
|
||||
return best;};},forward:function(gr,fname){return function(s){return gr[fname].call(this,s);};},replace:function(rule,repl){return function(s){var r=rule.call(this,s);return[repl,r[1]];};},process:function(rule,fn){return function(s){var r=rule.call(this,s);return[fn.call(this,r[0]),r[1]];};},min:function(min,rule){return function(s){var rx=rule.call(this,s);if(rx[0].length<min){throw new $P.Exception(s);}
|
||||
return rx;};}};var _generator=function(op){return function(){var args=null,rx=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments);}else if(arguments[0]instanceof Array){args=arguments[0];}
|
||||
if(args){for(var i=0,px=args.shift();i<px.length;i++){args.unshift(px[i]);rx.push(op.apply(null,args));args.shift();return rx;}}else{return op.apply(null,arguments);}};};var gx="optional not ignore cache".split(/\s/);for(var i=0;i<gx.length;i++){_[gx[i]]=_generator(_[gx[i]]);}
|
||||
var _vector=function(op){return function(){if(arguments[0]instanceof Array){return op.apply(null,arguments[0]);}else{return op.apply(null,arguments);}};};var vx="each any all".split(/\s/);for(var j=0;j<vx.length;j++){_[vx[j]]=_vector(_[vx[j]]);}}());(function(){var flattenAndCompact=function(ax){var rx=[];for(var i=0;i<ax.length;i++){if(ax[i]instanceof Array){rx=rx.concat(flattenAndCompact(ax[i]));}else{if(ax[i]){rx.push(ax[i]);}}}
|
||||
return rx;};Date.Grammar={};Date.Translator={hour:function(s){return function(){this.hour=Number(s);};},minute:function(s){return function(){this.minute=Number(s);};},second:function(s){return function(){this.second=Number(s);};},meridian:function(s){return function(){this.meridian=s.slice(0,1).toLowerCase();};},timezone:function(s){return function(){var n=s.replace(/[^\d\+\-]/g,"");if(n.length){this.timezoneOffset=Number(n);}else{this.timezone=s.toLowerCase();}};},day:function(x){var s=x[0];return function(){this.day=Number(s.match(/\d+/)[0]);};},month:function(s){return function(){this.month=((s.length==3)?Date.getMonthNumberFromName(s):(Number(s)-1));};},year:function(s){return function(){var n=Number(s);this.year=((s.length>2)?n:(n+(((n+2000)<Date.CultureInfo.twoDigitYearMax)?2000:1900)));};},rday:function(s){return function(){switch(s){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break;}};},finishExact:function(x){x=(x instanceof Array)?x:[x];var now=new Date();this.year=now.getFullYear();this.month=now.getMonth();this.day=1;this.hour=0;this.minute=0;this.second=0;for(var i=0;i<x.length;i++){if(x[i]){x[i].call(this);}}
|
||||
this.hour=(this.meridian=="p"&&this.hour<13)?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.");}
|
||||
var r=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){r.set({timezone:this.timezone});}else if(this.timezoneOffset){r.set({timezoneOffset:this.timezoneOffset});}
|
||||
return r;},finish:function(x){x=(x instanceof Array)?flattenAndCompact(x):[x];if(x.length===0){return null;}
|
||||
for(var i=0;i<x.length;i++){if(typeof x[i]=="function"){x[i].call(this);}}
|
||||
if(this.now){return new Date();}
|
||||
var today=Date.today();var method=null;var expression=!!(this.days!=null||this.orient||this.operator);if(expression){var gap,mod,orient;orient=((this.orient=="past"||this.operator=="subtract")?-1:1);if(this.weekday){this.unit="day";gap=(Date.getDayNumberFromName(this.weekday)-today.getDay());mod=7;this.days=gap?((gap+(orient*mod))%mod):(orient*mod);}
|
||||
if(this.month){this.unit="month";gap=(this.month-today.getMonth());mod=12;this.months=gap?((gap+(orient*mod))%mod):(orient*mod);this.month=null;}
|
||||
if(!this.unit){this.unit="day";}
|
||||
if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1;}
|
||||
if(this.unit=="week"){this.unit="day";this.value=this.value*7;}
|
||||
this[this.unit+"s"]=this.value*orient;}
|
||||
return today.add(this);}else{if(this.meridian&&this.hour){this.hour=(this.hour<13&&this.meridian=="p")?this.hour+12:this.hour;}
|
||||
if(this.weekday&&!this.day){this.day=(today.addDays((Date.getDayNumberFromName(this.weekday)-today.getDay()))).getDate();}
|
||||
if(this.month&&!this.day){this.day=1;}
|
||||
return today.set(this);}}};var _=Date.Parsing.Operators,g=Date.Grammar,t=Date.Translator,_fn;g.datePartDelimiter=_.rtoken(/^([\s\-\.\,\/\x27]+)/);g.timePartDelimiter=_.stoken(":");g.whiteSpace=_.rtoken(/^\s*/);g.generalDelimiter=_.rtoken(/^(([\s\,]|at|on)+)/);var _C={};g.ctoken=function(keys){var fn=_C[keys];if(!fn){var c=Date.CultureInfo.regexPatterns;var kx=keys.split(/\s+/),px=[];for(var i=0;i<kx.length;i++){px.push(_.replace(_.rtoken(c[kx[i]]),kx[i]));}
|
||||
fn=_C[keys]=_.any.apply(null,px);}
|
||||
return fn;};g.ctoken2=function(key){return _.rtoken(Date.CultureInfo.regexPatterns[key]);};g.h=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),t.hour));g.hh=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/),t.hour));g.H=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),t.hour));g.HH=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/),t.hour));g.m=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.minute));g.mm=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.minute));g.s=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.second));g.ss=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.second));g.hms=_.cache(_.sequence([g.H,g.mm,g.ss],g.timePartDelimiter));g.t=_.cache(_.process(g.ctoken2("shortMeridian"),t.meridian));g.tt=_.cache(_.process(g.ctoken2("longMeridian"),t.meridian));g.z=_.cache(_.process(_.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),t.timezone));g.zz=_.cache(_.process(_.rtoken(/^(\+|\-)\s*\d\d\d\d/),t.timezone));g.zzz=_.cache(_.process(g.ctoken2("timezone"),t.timezone));g.timeSuffix=_.each(_.ignore(g.whiteSpace),_.set([g.tt,g.zzz]));g.time=_.each(_.optional(_.ignore(_.stoken("T"))),g.hms,g.timeSuffix);g.d=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.dd=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.ddd=g.dddd=_.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"),function(s){return function(){this.weekday=s;};}));g.M=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/),t.month));g.MM=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/),t.month));g.MMM=g.MMMM=_.cache(_.process(g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),t.month));g.y=_.cache(_.process(_.rtoken(/^(\d\d?)/),t.year));g.yy=_.cache(_.process(_.rtoken(/^(\d\d)/),t.year));g.yyy=_.cache(_.process(_.rtoken(/^(\d\d?\d?\d?)/),t.year));g.yyyy=_.cache(_.process(_.rtoken(/^(\d\d\d\d)/),t.year));_fn=function(){return _.each(_.any.apply(null,arguments),_.not(g.ctoken2("timeContext")));};g.day=_fn(g.d,g.dd);g.month=_fn(g.M,g.MMM);g.year=_fn(g.yyyy,g.yy);g.orientation=_.process(g.ctoken("past future"),function(s){return function(){this.orient=s;};});g.operator=_.process(g.ctoken("add subtract"),function(s){return function(){this.operator=s;};});g.rday=_.process(g.ctoken("yesterday tomorrow today now"),t.rday);g.unit=_.process(g.ctoken("minute hour day week month year"),function(s){return function(){this.unit=s;};});g.value=_.process(_.rtoken(/^\d\d?(st|nd|rd|th)?/),function(s){return function(){this.value=s.replace(/\D/g,"");};});g.expression=_.set([g.rday,g.operator,g.value,g.unit,g.orientation,g.ddd,g.MMM]);_fn=function(){return _.set(arguments,g.datePartDelimiter);};g.mdy=_fn(g.ddd,g.month,g.day,g.year);g.ymd=_fn(g.ddd,g.year,g.month,g.day);g.dmy=_fn(g.ddd,g.day,g.month,g.year);g.date=function(s){return((g[Date.CultureInfo.dateElementOrder]||g.mdy).call(this,s));};g.format=_.process(_.many(_.any(_.process(_.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(fmt){if(g[fmt]){return g[fmt];}else{throw Date.Parsing.Exception(fmt);}}),_.process(_.rtoken(/^[^dMyhHmstz]+/),function(s){return _.ignore(_.stoken(s));}))),function(rules){return _.process(_.each.apply(null,rules),t.finishExact);});var _F={};var _get=function(f){return _F[f]=(_F[f]||g.format(f)[0]);};g.formats=function(fx){if(fx instanceof Array){var rx=[];for(var i=0;i<fx.length;i++){rx.push(_get(fx[i]));}
|
||||
return _.any.apply(null,rx);}else{return _get(fx);}};g._formats=g.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","d"]);g._start=_.process(_.set([g.date,g.time,g.expression],g.generalDelimiter,g.whiteSpace),t.finish);g.start=function(s){try{var r=g._formats.call({},s);if(r[1].length===0){return r;}}catch(e){}
|
||||
return g._start.call({},s);};}());Date._parse=Date.parse;Date.parse=function(s){var r=null;if(!s){return null;}
|
||||
try{r=Date.Grammar.start.call({},s);}catch(e){return null;}
|
||||
return((r[1].length===0)?r[0]:null);};Date.getParseFunction=function(fx){var fn=Date.Grammar.formats(fx);return function(s){var r=null;try{r=fn.call({},s);}catch(e){return null;}
|
||||
return((r[1].length===0)?r[0]:null);};};Date.parseExact=function(s,fx){return Date.getParseFunction(fx)(s);};
|
||||
@@ -0,0 +1,350 @@
|
||||
/*
|
||||
* DEMO HELPERS
|
||||
*/
|
||||
|
||||
/**
|
||||
* debugData
|
||||
*
|
||||
* Pass me a data structure {} and I'll output all the key/value pairs - recursively
|
||||
*
|
||||
* @example var HTML = debugData( oElem.style, "Element.style", { keys: "top,left,width,height", recurse: true, sort: true, display: true, returnHTML: true });
|
||||
*
|
||||
* @param Object o_Data A JSON-style data structure
|
||||
* @param String s_Title Title for dialog (optional)
|
||||
* @param Hash options Pass additional options in a hash
|
||||
*/
|
||||
function debugData (o_Data, s_Title, options) {
|
||||
options = options || {};
|
||||
var
|
||||
str=(s_Title||s_Title==='' ? s_Title : 'DATA')
|
||||
// maintain backward compatibility with OLD 'recurseData' param
|
||||
, recurse=(typeof options=='boolean' ? options : options.recurse !==false)
|
||||
, keys=(options.keys?','+options.keys+',':false)
|
||||
, display=options.display !==false
|
||||
, html=options.returnHTML !==false
|
||||
, sort=options.sort !==false
|
||||
, D=[], i=0 // Array to hold data, i=counter
|
||||
, hasSubKeys = false
|
||||
, k, t, skip, x // loop vars
|
||||
;
|
||||
if (typeof o_Data != 'object') {
|
||||
alert( (s_Title ? s_Title +': ' : '')+ o_Data );
|
||||
return;
|
||||
}
|
||||
if (o_Data.jquery) {
|
||||
str=s_Title+'jQuery Collection ('+ o_Data.length +')\n context="'+ o_Data.context +'"';
|
||||
}
|
||||
else if (o_Data.tagName && typeof o_Data.style == 'object') {
|
||||
str=s_Title+o_Data.tagName;
|
||||
var id = o_Data.id, cls=o_Data.className, src=o_Data.src, hrf=o_Data.href;
|
||||
if (id) str+='\n id="'+ id+'"';
|
||||
if (cls) str+='\n class="'+ cls+'"';
|
||||
if (src) str+='\n src="'+ src+'"';
|
||||
if (hrf) str+='\n href="'+ hrf+'"';
|
||||
}
|
||||
else {
|
||||
parse(o_Data,''); // recursive parsing
|
||||
if (sort && !hasSubKeys) D.sort(); // sort by keyName - but NOT if has subKeys!
|
||||
if (str) str += '\n***'+ '****************************'.substr(0,str.length) +'\n';
|
||||
str += D.join('\n'); // add line-breaks
|
||||
}
|
||||
|
||||
if (display) alert(str); // display data
|
||||
if (html) str=str.replace(/\n/g, ' <br>').replace(/ /g, ' '); // format as HTML
|
||||
return str;
|
||||
|
||||
function parse ( data, prefix ) {
|
||||
if (typeof prefix=='undefined') prefix='';
|
||||
try {
|
||||
$.each( data, function (key, val) {
|
||||
k = prefix+key+': ';
|
||||
skip = (keys && keys.indexOf(','+key+',') == -1);
|
||||
if (typeof val==='function') { // FUNCTION
|
||||
if (!skip) D[i++] = k +'function()';
|
||||
}
|
||||
else if (typeof val==='string') { // STRING
|
||||
if (!skip) D[i++] = k +'"'+ val +'"';
|
||||
}
|
||||
else if (val===null || val===undefined || typeof val !=='object') { // NULL, UNDEFINED, NUMBER or BOOLEAN
|
||||
if (!skip) D[i++] = k + val;
|
||||
}
|
||||
else if (debugIsArray(val)) { // ARRAY
|
||||
if (!skip) {
|
||||
if (val.length && typeof val[0] == "object") { // array of objects (hashs or arrays)
|
||||
D[i++] = k +'{';
|
||||
parse( val, prefix+' '); // RECURSE
|
||||
D[i++] = prefix +'}';
|
||||
}
|
||||
else
|
||||
D[i++] = k +'[ '+ val.toString() +' ]'; // output delimited array
|
||||
}
|
||||
}
|
||||
else if (val.jquery) {
|
||||
if (!skip) D[i++] = k +'jQuery ('+ val.length +') context="'+ val.context +'"';
|
||||
}
|
||||
else if (val.tagName && typeof val.style == 'object') {
|
||||
var id = val.id, cls=val.className, src=val.src, hrf=val.href;
|
||||
if (skip) D[i++] = k +' '+
|
||||
id ? 'id="'+ id+'"' :
|
||||
src ? 'src="'+ src+'"' :
|
||||
hrf ? 'href="'+ hrf+'"' :
|
||||
cls ? 'class="'+cls+'"' :
|
||||
'';
|
||||
}
|
||||
else { // Object or JSON
|
||||
if (!recurse || !hasKeys(val)) { // show an empty hash
|
||||
if (!skip) D[i++] = k +'{ }';
|
||||
}
|
||||
else { // recurse into JSON hash - indent output
|
||||
D[i++] = k +'{';
|
||||
parse( val, prefix+' '); // RECURSE
|
||||
D[i++] = prefix +'}';
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (e) {}
|
||||
function hasKeys(o) {
|
||||
var c=0;
|
||||
for (x in o) c++;
|
||||
if (!hasSubKeys) hasSubKeys = !!c;
|
||||
return !!c;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function debugIsArray(o) { return (o && typeof o==='object' && !o.propertyIsEnumerable('length') && typeof o.length==='number'); };
|
||||
|
||||
function debugStackTrace (s_Title, options) {
|
||||
var
|
||||
callstack = []
|
||||
, isCallstackPopulated = false
|
||||
;
|
||||
try {
|
||||
i.dont.exist += 0; // doesn't exist- that's the point
|
||||
} catch(e) {
|
||||
if (e.stack) { // Firefox
|
||||
var lines = e.stack.split('\n');
|
||||
for (var i=0, len=lines.length; i<len; i++) {
|
||||
if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
|
||||
callstack.push(lines[i]);
|
||||
}
|
||||
}
|
||||
//Remove call to printStackTrace()
|
||||
callstack.shift();
|
||||
isCallstackPopulated = true;
|
||||
}
|
||||
else if (window.opera && e.message) { // Opera
|
||||
var lines = e.message.split('\n');
|
||||
for (var i=0, len=lines.length; i<len; i++) {
|
||||
if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
|
||||
var entry = lines[i];
|
||||
//Append next line also since it has the file info
|
||||
if (lines[i+1]) {
|
||||
entry += ' at ' + lines[i+1];
|
||||
i++;
|
||||
}
|
||||
callstack.push(entry);
|
||||
}
|
||||
}
|
||||
//Remove call to printStackTrace()
|
||||
callstack.shift();
|
||||
isCallstackPopulated = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCallstackPopulated) { // IE and Safari
|
||||
var currentFunction = arguments.callee.caller;
|
||||
while (currentFunction) {
|
||||
var fn = currentFunction.toString();
|
||||
var fname = fn.substring(fn.indexOf('function') + 8, fn.indexOf('')) || 'anonymous';
|
||||
callstack.push(fname);
|
||||
currentFunction = currentFunction.caller;
|
||||
}
|
||||
}
|
||||
|
||||
debugData( callstack, s_Title, options );
|
||||
};
|
||||
|
||||
// this end up displaying errors when layout.showErrorMessages = false, so disable it
|
||||
//if (!window.console) window.console = { log: debugData };
|
||||
|
||||
if (window.console) {
|
||||
|
||||
if (!window.console.trace)
|
||||
window.console.trace = function (s_Title) {
|
||||
window.console.log( debugStackTrace(s_Title, { display: false, returnHTML: false, sort: false }) );
|
||||
};
|
||||
|
||||
// add method to output 'hash data' inside an string
|
||||
window.console.data = function (o_Data) {
|
||||
var A = debugIsArray( o_Data ) ? o_Data : [ o_Data ], S='', i=0, c=A.length;
|
||||
for (; i<c; i++)
|
||||
S += (S ? '\n' : '') +'{\n'+ debugData( A[i], '', { display: false, returnHTML: false, sort: false }) +'\n}';
|
||||
return S;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* timer
|
||||
*
|
||||
* Utility for debug timing of events
|
||||
* Can track multiple timers and returns either a total time or interval from last event
|
||||
* @param String timerName Name of the timer - defaults to debugTimer
|
||||
* @param String action Keyword for action or return-value...
|
||||
* action: 'reset' = reset; 'clear' = delete; 'total' = ms since init; 'step' or '' = ms since last event
|
||||
*/
|
||||
/**
|
||||
* timer
|
||||
*
|
||||
* Utility method for timing performance
|
||||
* Can track multiple timers and returns either a total time or interval from last event
|
||||
*
|
||||
* returns time-data: {
|
||||
* start: Date Object
|
||||
* , last: Date Object
|
||||
* , step: 99 // time since 'last'
|
||||
* , total: 99 // time since 'start'
|
||||
* }
|
||||
*
|
||||
* USAGE SAMPLES
|
||||
* =============
|
||||
* timer('name'); // create/init timer
|
||||
* timer('name', 'reset'); // re-init timer
|
||||
* timer('name', 'clear'); // clear/remove timer
|
||||
* var i = timer('name'); // how long since last timer request?
|
||||
* var i = timer('name', 'total'); // how long since timer started?
|
||||
*
|
||||
* @param String timerName Name of the timer - defaults to debugTimer
|
||||
* @param String action Keyword for action or return-value...
|
||||
* @param Hash options Options to customize return data
|
||||
* action: 'reset' = reset; 'clear' = delete; 'total' = ms since init; 'step' or '' = ms since last event
|
||||
*/
|
||||
function timer (timerName, action, options) {
|
||||
var
|
||||
name = timerName || 'debugTimer'
|
||||
, Timer = window[ name ]
|
||||
, defaults = {
|
||||
returnString: true
|
||||
, padNumbers: true
|
||||
, timePrefix: ''
|
||||
, timeSuffix: ''
|
||||
}
|
||||
;
|
||||
|
||||
// init the timer first time called
|
||||
if (!Timer || action == 'reset') { // init timer
|
||||
Timer = window[ name ] = {
|
||||
start: new Date()
|
||||
, last: new Date()
|
||||
, step: 0 // time since 'last'
|
||||
, total: 0 // time since 'start'
|
||||
, options: $.extend({}, defaults, options)
|
||||
};
|
||||
}
|
||||
else if (action == 'clear') { // remove timer
|
||||
window[ name ] = null;
|
||||
return null;
|
||||
}
|
||||
else { // update existing timer
|
||||
Timer.step = (new Date()) - Timer.last; // time since 'last'
|
||||
Timer.total = (new Date()) - Timer.start; // time since 'start'
|
||||
Timer.last = new Date();
|
||||
}
|
||||
|
||||
var
|
||||
time = (action == 'total') ? Timer.total : Timer.step
|
||||
, o = Timer.options // alias
|
||||
;
|
||||
|
||||
if (o.returnString) {
|
||||
time += ""; // convert integer to string
|
||||
// pad time to 4 chars with underscores
|
||||
if (o.padNumbers)
|
||||
switch (time.length) {
|
||||
case 1: time = "   "+ time; break;
|
||||
case 2: time = "  "+ time; break;
|
||||
case 3: time = " "+ time; break;
|
||||
}
|
||||
// add prefix and suffix
|
||||
if (o.timePrefix || o.timeSuffix)
|
||||
time = o.timePrefix + time + o.timeSuffix;
|
||||
}
|
||||
|
||||
return time;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* showOptions
|
||||
*
|
||||
* Pass a layout-options object, and the pane/key you want to display
|
||||
*/
|
||||
function showOptions (Layout, key, debugOpts) {
|
||||
var data = Layout.options;
|
||||
$.each(key.split("."), function() {
|
||||
data = data[this]; // recurse through multiple key-levels
|
||||
});
|
||||
debugData( data, 'options.'+key, debugOpts );
|
||||
};
|
||||
|
||||
/**
|
||||
* showState
|
||||
*
|
||||
* Pass a layout-options object, and the pane/key you want to display
|
||||
*/
|
||||
function showState (Layout, key, debugOpts) {
|
||||
var data = Layout.state;
|
||||
$.each(key.split("."), function() {
|
||||
data = data[this]; // recurse through multiple key-levels
|
||||
});
|
||||
debugData( data, 'state.'+key, debugOpts );
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* addThemeSwitcher
|
||||
*
|
||||
* Remove the cookie set by the UI Themeswitcher to reset a page to default styles
|
||||
*
|
||||
* Dependancies: /lib/js/themeswitchertool.js
|
||||
*/
|
||||
function addThemeSwitcher ( container, position ) {
|
||||
var pos = { top: '10px', right: '10px', zIndex: 10 };
|
||||
$('<div id="themeContainer" style="position: absolute; overflow-x: hidden;"></div>')
|
||||
.css( $.extend( pos, position ) )
|
||||
.appendTo( container || 'body')
|
||||
.themeswitcher()
|
||||
;
|
||||
};
|
||||
|
||||
/**
|
||||
* removeUITheme
|
||||
*
|
||||
* Remove the cookie set by the UI Themeswitcher to reset a page to default styles
|
||||
*/
|
||||
function removeUITheme ( cookieName, removeCookie ) {
|
||||
$('link.ui-theme').remove();
|
||||
$('.jquery-ui-themeswitcher-title').text( 'Switch Theme' );
|
||||
if (removeCookie !== false)
|
||||
$.cookie( cookieName || 'jquery-ui-theme', null );
|
||||
};
|
||||
|
||||
|
||||
|
||||
function debugWindow ( content, options ) {
|
||||
var defaults = {
|
||||
css: {
|
||||
position: 'fixed'
|
||||
, top: 0
|
||||
}
|
||||
};
|
||||
$.extend( true, (options || {}), defaults );
|
||||
var $W = $('<div></div>')
|
||||
.html( content.replace(/\n/g, '<br>').replace(/ /g, ' ') ) // format as HTML
|
||||
.css( options.css )
|
||||
;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
// JavaScript Document
|
||||
$(document).ready(function() {
|
||||
$.widget( "ui.combobox", {
|
||||
_create: function() {
|
||||
var input,
|
||||
self = this,
|
||||
select = this.element.hide(),
|
||||
selected = select.children( ":selected" ),
|
||||
value = selected.val() ? selected.text() : "",
|
||||
wrapper = $( "<span>" )
|
||||
.addClass( "ui-combobox" )
|
||||
.insertAfter( select );
|
||||
|
||||
input = $( "<input>" )
|
||||
.appendTo( wrapper )
|
||||
.val( value )
|
||||
.addClass( "ui-state-default" )
|
||||
.autocomplete({
|
||||
delay: 0,
|
||||
minLength: 0,
|
||||
source: function( request, response ) {
|
||||
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
|
||||
response( select.children( "option" ).map(function() {
|
||||
var text = $( this ).text();
|
||||
if ( this.value && ( !request.term || matcher.test(text) ) )
|
||||
return {
|
||||
label: text.replace(
|
||||
new RegExp(
|
||||
"(?![^&;]+;)(?!<[^<>]*)(" +
|
||||
$.ui.autocomplete.escapeRegex(request.term) +
|
||||
")(?![^<>]*>)(?![^&;]+;)", "gi"
|
||||
), "<strong>$1</strong>" ),
|
||||
value: text,
|
||||
option: this
|
||||
};
|
||||
}) );
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
ui.item.option.selected = true;
|
||||
self._trigger( "selected", event, {
|
||||
item: ui.item.option
|
||||
});
|
||||
},
|
||||
change: function( event, ui ) {
|
||||
if ( !ui.item ) {
|
||||
var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ),
|
||||
valid = false;
|
||||
select.children( "option" ).each(function() {
|
||||
if ( $( this ).text().match( matcher ) ) {
|
||||
this.selected = valid = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if ( !valid ) {
|
||||
// remove invalid value, as it didn't match anything
|
||||
$( this ).val( "" );
|
||||
select.val( "" );
|
||||
input.data( "autocomplete" ).term = "";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.addClass( "ui-widget ui-widget-content ui-corner-left" );
|
||||
|
||||
input.data( "autocomplete" )._renderItem = function( ul, item ) {
|
||||
return $( "<li></li>" )
|
||||
.data( "item.autocomplete", item )
|
||||
.append( "<a>" + item.label + "</a>" )
|
||||
.appendTo( ul );
|
||||
};
|
||||
|
||||
$( "<a>" )
|
||||
.attr( "tabIndex", -1 )
|
||||
.attr( "title", "Show All Items" )
|
||||
.appendTo( wrapper )
|
||||
.button({
|
||||
icons: {
|
||||
primary: "ui-icon-triangle-1-s"
|
||||
},
|
||||
text: false
|
||||
})
|
||||
.removeClass( "ui-corner-all" )
|
||||
.addClass( "ui-corner-right ui-button-icon" )
|
||||
.click(function() {
|
||||
// close if already visible
|
||||
if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
|
||||
input.autocomplete( "close" );
|
||||
return;
|
||||
}
|
||||
|
||||
// work around a bug (likely same cause as #5265)
|
||||
$( this ).blur();
|
||||
|
||||
// pass empty string as value to search for, displaying all results
|
||||
input.autocomplete( "search", "" );
|
||||
input.focus();
|
||||
});
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
this.wrapper.remove();
|
||||
this.element.show();
|
||||
$.Widget.prototype.destroy.call( this );
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,112 @@
|
||||
/* jQuery Context Menu
|
||||
* Created: Dec 16th, 2009 by DynamicDrive.com. This notice must stay intact for usage
|
||||
* Author: Dynamic Drive at http://www.dynamicdrive.com/
|
||||
* Visit http://www.dynamicdrive.com/ for full source code
|
||||
*/
|
||||
|
||||
jQuery.noConflict()
|
||||
|
||||
var jquerycontextmenu={
|
||||
arrowpath: 'images/arrow.gif', //full URL or path to arrow image
|
||||
contextmenuoffsets: [1, -1], //additional x and y offset from mouse cursor for contextmenus
|
||||
|
||||
//***** NO NEED TO EDIT BEYOND HERE
|
||||
|
||||
builtcontextmenuids: [], //ids of context menus already built (to prevent repeated building of same context menu)
|
||||
|
||||
positionul:function($, $ul, e){
|
||||
var istoplevel=$ul.hasClass('jqcontextmenu') //Bool indicating whether $ul is top level context menu DIV
|
||||
var docrightedge=$(document).scrollLeft()+$(window).width()-40 //40 is to account for shadows in FF
|
||||
var docbottomedge=$(document).scrollTop()+$(window).height()-40
|
||||
if (istoplevel){ //if main context menu DIV
|
||||
var x=e.pageX+this.contextmenuoffsets[0] //x pos of main context menu UL
|
||||
var y=e.pageY+this.contextmenuoffsets[1]
|
||||
x=(x+$ul.data('dimensions').w > docrightedge)? docrightedge-$ul.data('dimensions').w : x //if not enough horizontal room to the ridge of the cursor
|
||||
y=(y+$ul.data('dimensions').h > docbottomedge)? docbottomedge-$ul.data('dimensions').h : y
|
||||
}
|
||||
else{ //if sub level context menu UL
|
||||
var $parentli=$ul.data('$parentliref')
|
||||
var parentlioffset=$parentli.offset()
|
||||
var x=$ul.data('dimensions').parentliw //x pos of sub UL
|
||||
var y=0
|
||||
|
||||
x=(parentlioffset.left+x+$ul.data('dimensions').w > docrightedge)? x-$ul.data('dimensions').parentliw-$ul.data('dimensions').w : x //if not enough horizontal room to the ridge parent LI
|
||||
y=(parentlioffset.top+$ul.data('dimensions').h > docbottomedge)? y-$ul.data('dimensions').h+$ul.data('dimensions').parentlih : y
|
||||
}
|
||||
$ul.css({left:x, top:y})
|
||||
},
|
||||
|
||||
showbox:function($, $contextmenu, e){
|
||||
$contextmenu.show()
|
||||
},
|
||||
|
||||
hidebox:function($, $contextmenu){
|
||||
$contextmenu.find('ul').andSelf().hide() //hide context menu plus all of its sub ULs
|
||||
},
|
||||
|
||||
|
||||
buildcontextmenu:function($, $menu){
|
||||
$menu.css({display:'block', visibility:'hidden'}).appendTo(document.body)
|
||||
$menu.data('dimensions', {w:$menu.outerWidth(), h:$menu.outerHeight()}) //remember main menu's dimensions
|
||||
var $lis=$menu.find("ul").parent() //find all LIs within menu with a sub UL
|
||||
$lis.each(function(i){
|
||||
var $li=$(this).css({zIndex: 1000+i})
|
||||
var $subul=$li.find('ul:eq(0)').css({display:'block'}) //set sub UL to "block" so we can get dimensions
|
||||
$subul.data('dimensions', {w:$subul.outerWidth(), h:$subul.outerHeight(), parentliw:this.offsetWidth, parentlih:this.offsetHeight})
|
||||
$subul.data('$parentliref', $li) //cache parent LI of each sub UL
|
||||
$li.data('$subulref', $subul) //cache sub UL of each parent LI
|
||||
$li.children("a:eq(0)").append( //add arrow images
|
||||
'<img src="'+jquerycontextmenu.arrowpath+'" class="rightarrowclass" style="border:0;" />'
|
||||
)
|
||||
$li.bind('mouseenter', function(e){ //show sub UL when mouse moves over parent LI
|
||||
var $targetul=$(this).data('$subulref')
|
||||
if ($targetul.queue().length<=1){ //if 1 or less queued animations
|
||||
jquerycontextmenu.positionul($, $targetul, e)
|
||||
$targetul.show()
|
||||
}
|
||||
})
|
||||
$li.bind('mouseleave', function(e){ //hide sub UL when mouse moves out of parent LI
|
||||
$(this).data('$subulref').hide()
|
||||
})
|
||||
})
|
||||
$menu.find('ul').andSelf().css({display:'none', visibility:'visible'}) //collapse all ULs again
|
||||
this.builtcontextmenuids.push($menu.get(0).id) //remember id of context menu that was just built
|
||||
},
|
||||
|
||||
|
||||
init:function($, $target, $contextmenu){
|
||||
if (this.builtcontextmenuids.length==0){ //only bind click event to document once
|
||||
$(document).bind("click", function(e){
|
||||
if (e.button==0){ //hide all context menus (and their sub ULs) when left mouse button is clicked
|
||||
jquerycontextmenu.hidebox($, $('.jqcontextmenu'))
|
||||
}
|
||||
})
|
||||
}
|
||||
if (jQuery.inArray($contextmenu.get(0).id, this.builtcontextmenuids)==-1) //if this context menu hasn't been built yet
|
||||
this.buildcontextmenu($, $contextmenu)
|
||||
$(document).bind("click", function(e){
|
||||
if (e.button==0){ //hide all context menus (and their sub ULs) when left mouse button is clicked
|
||||
jquerycontextmenu.hidebox($, $('.jqcontextmenu'))
|
||||
}
|
||||
})
|
||||
if ($target.parents().filter('ul.jqcontextmenu').length>0) //if $target matches an element within the context menu markup, don't bind oncontextmenu to that element
|
||||
return
|
||||
$target.bind("contextmenu", function(e){
|
||||
jquerycontextmenu.hidebox($, $('.jqcontextmenu')) //hide all context menus (and their sub ULs)
|
||||
jquerycontextmenu.positionul($, $contextmenu, e)
|
||||
jquerycontextmenu.showbox($, $contextmenu, e)
|
||||
return false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
jQuery.fn.addcontextmenu=function(contextmenuid){
|
||||
var $=jQuery
|
||||
return this.each(function(){ //return jQuery obj
|
||||
var $target=$(this)
|
||||
jquerycontextmenu.init($, $target, $('#'+contextmenuid))
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
//Usage: $(elementselector).addcontextmenu('id_of_context_menu_on_page')
|
||||
300
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery-gentleSelect.js
vendored
Normal file
300
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery-gentleSelect.js
vendored
Normal file
@@ -0,0 +1,300 @@
|
||||
/*
|
||||
* jQuery gentleSelect plugin
|
||||
* http://shawnchin.github.com/jquery-gentleSelect
|
||||
*
|
||||
* Copyright (c) 2010 Shawn Chin.
|
||||
* Licensed under the MIT license.
|
||||
*
|
||||
* Usage:
|
||||
* (JS)
|
||||
*
|
||||
* $('#myselect').gentleSelect(); // default. single column
|
||||
*
|
||||
* $('#myselect').gentleSelect({ // 3 columns, 150px wide each
|
||||
* itemWidth : 150,
|
||||
* columns : 3,
|
||||
* });
|
||||
*
|
||||
* (HTML)
|
||||
* <select id='myselect'><options> .... </options></select>
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
var defaults = {
|
||||
minWidth : 100, // only applies if columns and itemWidth not set
|
||||
itemWidth : undefined,
|
||||
columns : undefined,
|
||||
rows : undefined,
|
||||
title : undefined,
|
||||
prompt : "Make A Selection",
|
||||
maxDisplay: 0, // set to 0 for unlimited
|
||||
openSpeed : 400,
|
||||
closeSpeed : 400,
|
||||
openEffect : "slide",
|
||||
closeEffect : "slide",
|
||||
hideOnMouseOut : true
|
||||
}
|
||||
|
||||
function defined(obj) {
|
||||
if (typeof obj == "undefined") { return false; }
|
||||
else { return true; }
|
||||
}
|
||||
|
||||
function hasError(c, o) {
|
||||
if (defined(o.columns) && defined(o.rows)) {
|
||||
$.error("gentleSelect: You cannot supply both 'rows' and 'columns'");
|
||||
return true;
|
||||
}
|
||||
if (defined(o.columns) && !defined(o.itemWidth)) {
|
||||
$.error("gentleSelect: itemWidth must be supplied if 'columns' is specified");
|
||||
return true;
|
||||
}
|
||||
if (defined(o.rows) && !defined(o.itemWidth)) {
|
||||
$.error("gentleSelect: itemWidth must be supplied if 'rows' is specified");
|
||||
return true;
|
||||
}
|
||||
if (!defined(o.openSpeed) || typeof o.openSpeed != "number" &&
|
||||
(typeof o.openSpeed == "string" && (o.openSpeed != "slow" && o.openSpeed != "fast"))) {
|
||||
$.error("gentleSelect: openSpeed must be an integer or \"slow\" or \"fast\"");
|
||||
return true;
|
||||
}
|
||||
if (!defined(o.closeSpeed) || typeof o.closeSpeed != "number" &&
|
||||
(typeof o.closeSpeed == "string" && (o.closeSpeed != "slow" && o.closeSpeed != "fast"))) {
|
||||
$.error("gentleSelect: closeSpeed must be an integer or \"slow\" or \"fast\"");
|
||||
return true;
|
||||
}
|
||||
if (!defined(o.openEffect) || (o.openEffect != "fade" && o.openEffect != "slide")) {
|
||||
$.error("gentleSelect: openEffect must be either 'fade' or 'slide'!");
|
||||
return true;
|
||||
}
|
||||
if (!defined(o.closeEffect)|| (o.closeEffect != "fade" && o.closeEffect != "slide")) {
|
||||
$.error("gentleSelect: closeEffect must be either 'fade' or 'slide'!");
|
||||
return true;
|
||||
}
|
||||
if (!defined(o.hideOnMouseOut) || (typeof o.hideOnMouseOut != "boolean")) {
|
||||
$.error("gentleSelect: hideOnMouseOut must be supplied and either \"true\" or \"false\"!");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function optionOverrides(c, o) {
|
||||
if (c.attr("multiple")) {
|
||||
o.hideOnMouseOut = true; // must be true or dialog will never hide
|
||||
}
|
||||
}
|
||||
|
||||
function getSelectedAsText(elemList, opts) {
|
||||
// If no items selected, return prompt
|
||||
if (elemList.length < 1) { return opts.prompt; }
|
||||
|
||||
// Truncate if exceed maxDisplay
|
||||
if (opts.maxDisplay != 0 && elemList.length > opts.maxDisplay) {
|
||||
var arr = elemList.slice(0, opts.maxDisplay).map(function(){return $(this).text();});
|
||||
arr.push("...");
|
||||
} else {
|
||||
var arr = elemList.map(function(){return $(this).text();});
|
||||
}
|
||||
return arr.get().join(", ");
|
||||
}
|
||||
|
||||
var methods = {
|
||||
init : function(options) {
|
||||
var o = $.extend({}, defaults, options);
|
||||
|
||||
if (hasError(this, o)) { return this; }; // check for errors
|
||||
optionOverrides(this, o); //
|
||||
this.hide(); // hide original select box
|
||||
|
||||
// initialise <span> to replace select box
|
||||
label_text = getSelectedAsText(this.find(":selected"), o);
|
||||
var label = $("<span class='gentleselect-label'>" + label_text + "</span>")
|
||||
.insertBefore(this)
|
||||
.bind("mouseenter.gentleselect", event_handlers.labelHoverIn)
|
||||
.bind("mouseleave.gentleselect", event_handlers.labelHoverOut)
|
||||
.bind("click.gentleselect", event_handlers.labelClick)
|
||||
.data("root", this);
|
||||
this.data("label", label)
|
||||
.data("options", o);
|
||||
|
||||
// generate list of options
|
||||
var ul = $("<ul></ul>");
|
||||
this.find("option").each(function() {
|
||||
var li = $("<li>" + $(this).text() + "</li>")
|
||||
.data("value", $(this).attr("value"))
|
||||
.data("name", $(this).text())
|
||||
.appendTo(ul);
|
||||
if ($(this).attr("selected")) { li.addClass("selected"); }
|
||||
});
|
||||
|
||||
// build dialog box
|
||||
var dialog = $("<div class='gentleselect-dialog'></div>")
|
||||
.append(ul)
|
||||
.insertAfter(label)
|
||||
.bind("click.gentleselect", event_handlers.dialogClick)
|
||||
.bind("mouseleave.gentleselect", event_handlers.dialogHoverOut)
|
||||
.data("label", label)
|
||||
.data("root", this);
|
||||
this.data("dialog", dialog);
|
||||
|
||||
// if to be displayed in columns
|
||||
if (defined(o.columns) || defined(o.rows)) {
|
||||
|
||||
// Update CSS
|
||||
ul.css("float", "left")
|
||||
.find("li").width(o.itemWidth).css("float","left");
|
||||
|
||||
var f = ul.find("li:first");
|
||||
var actualWidth = o.itemWidth
|
||||
+ parseInt(f.css("padding-left"))
|
||||
+ parseInt(f.css("padding-right"));
|
||||
var elemCount = ul.find("li").length;
|
||||
if (defined(o.columns)) {
|
||||
var cols = parseInt(o.columns);
|
||||
var rows = Math.ceil(elemCount / cols);
|
||||
} else {
|
||||
var rows = parseInt(o.rows);
|
||||
var cols = Math.ceil(elemCount / rows);
|
||||
}
|
||||
dialog.width(actualWidth * cols);
|
||||
|
||||
// add padding
|
||||
for (var i = 0; i < (rows * cols) - elemCount; i++) {
|
||||
$("<li style='float:left' class='gentleselect-dummy'><span> </span></li>").appendTo(ul);
|
||||
}
|
||||
|
||||
// reorder elements
|
||||
var ptr = [];
|
||||
var idx = 0;
|
||||
ul.find("li").each(function() {
|
||||
if (idx < rows) {
|
||||
ptr[idx] = $(this);
|
||||
} else {
|
||||
var p = idx % rows;
|
||||
$(this).insertAfter(ptr[p]);
|
||||
ptr[p] = $(this);
|
||||
}
|
||||
idx++;
|
||||
});
|
||||
} else if (typeof o.minWidth == "number") {
|
||||
dialog.css("min-width", o.minWidth);
|
||||
}
|
||||
|
||||
if (defined(o.title)) {
|
||||
$("<div class='gentleselect-title'>" + o.title + "</div>").prependTo(dialog);
|
||||
}
|
||||
|
||||
// ESC key should hide all dialog boxes
|
||||
$(document).bind("keyup.gentleselect", event_handlers.keyUp);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
// if select box was updated externally, we need to bring everything
|
||||
// else up to speed.
|
||||
update : function() {
|
||||
var opts = this.data("options");
|
||||
|
||||
// Update li with selected data
|
||||
var v = (this.attr("multiple")) ? this.val() : [this.val()];
|
||||
$("li", this.data("dialog")).each(function() {
|
||||
var $li = $(this);
|
||||
var isSelected = ($.inArray($li.data("value"), v) != -1);
|
||||
$li.toggleClass("selected", isSelected);
|
||||
});
|
||||
|
||||
// Update label
|
||||
var label = getSelectedAsText(this.find(":selected"), opts);
|
||||
this.data("label").text(label);
|
||||
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
var event_handlers = {
|
||||
|
||||
labelHoverIn : function() {
|
||||
$(this).addClass('gentleselect-label-highlight');
|
||||
},
|
||||
|
||||
labelHoverOut : function() {
|
||||
$(this).removeClass('gentleselect-label-highlight');
|
||||
},
|
||||
|
||||
labelClick : function() {
|
||||
var $this = $(this);
|
||||
var pos = $this.position();
|
||||
var root = $this.data("root");
|
||||
var opts = root.data("options");
|
||||
var dialog = root.data("dialog")
|
||||
.css("top", pos.top + $this.height())
|
||||
.css("left", pos.left + 1);
|
||||
if (opts.openEffect == "fade") {
|
||||
dialog.fadeIn(opts.openSpeed);
|
||||
} else {
|
||||
dialog.slideDown(opts.openSpeed);
|
||||
}
|
||||
},
|
||||
|
||||
dialogHoverOut : function() {
|
||||
var $this = $(this);
|
||||
if ($this.data("root").data("options").hideOnMouseOut) {
|
||||
$this.hide();
|
||||
}
|
||||
},
|
||||
|
||||
dialogClick : function(e) {
|
||||
var clicked = $(e.target);
|
||||
var $this = $(this);
|
||||
var root = $this.data("root");
|
||||
var opts = root.data("options");
|
||||
if (!root.attr("multiple")) {
|
||||
if (opts.closeEffect == "fade") {
|
||||
$this.fadeOut(opts.closeSpeed);
|
||||
} else {
|
||||
$this.slideUp(opts.closeSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
if (clicked.is("li") && !clicked.hasClass("gentleselect-dummy")) {
|
||||
var value = clicked.data("value");
|
||||
var name = clicked.data("name");
|
||||
var label = $this.data("label")
|
||||
|
||||
if ($this.data("root").attr("multiple")) {
|
||||
clicked.toggleClass("selected");
|
||||
var s = $this.find("li.selected");
|
||||
label.text(getSelectedAsText(s, opts));
|
||||
var v = s.map(function(){ return $(this).data("value"); });
|
||||
// update actual selectbox and trigger change event
|
||||
root.val(v.get()).trigger("change");
|
||||
} else {
|
||||
$this.find("li.selected").removeClass("selected");
|
||||
clicked.addClass("selected");
|
||||
label.text(clicked.data("name"));
|
||||
// update actual selectbox and trigger change event
|
||||
root.val(value).trigger("change");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
keyUp : function(e) {
|
||||
if (e.keyCode == 27 ) { // ESC
|
||||
$(".gentleselect-dialog").hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.gentleSelect = function(method) {
|
||||
if (methods[method]) {
|
||||
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
} else if (typeof method === 'object' || ! method) {
|
||||
return methods.init.apply(this, arguments);
|
||||
} else {
|
||||
$.error( 'Method ' + method + ' does not exist on jQuery.gentleSelect' );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
})(jQuery);
|
||||
9267
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery-latest.js
vendored
Normal file
9267
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery-latest.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11802
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery-ui-latest.js
vendored
Normal file
11802
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery-ui-latest.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1530
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery-ui-timepicker.js
vendored
Normal file
1530
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery-ui-timepicker.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,234 @@
|
||||
// jQuery Alert Dialogs Plugin
|
||||
//
|
||||
// Version 1.0
|
||||
//
|
||||
// Cory S.N. LaViska
|
||||
// A Beautiful Site (http://abeautifulsite.net/)
|
||||
// 29 December 2008
|
||||
//
|
||||
// Visit http://abeautifulsite.net/notebook/87 for more information
|
||||
//
|
||||
// Usage:
|
||||
// jAlert( message, [title, callback] )
|
||||
// jConfirm( message, [title, callback] )
|
||||
// jPrompt( message, [value, title, callback] )
|
||||
//
|
||||
// History:
|
||||
//
|
||||
// 1.00 - Released (29 December 2008)
|
||||
//
|
||||
// License:
|
||||
//
|
||||
// This plugin is licensed under the GNU General Public License: http://www.gnu.org/licenses/gpl.html
|
||||
//
|
||||
(function($) {
|
||||
|
||||
$.alerts = {
|
||||
|
||||
// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
|
||||
|
||||
verticalOffset: -75, // vertical offset of the dialog from center screen, in pixels
|
||||
horizontalOffset: 0, // horizontal offset of the dialog from center screen, in pixels/
|
||||
repositionOnResize: true, // re-centers the dialog on window resize
|
||||
overlayOpacity: .01, // transparency level of overlay
|
||||
overlayColor: '#FFF', // base color of overlay
|
||||
draggable: true, // make the dialogs draggable (requires UI Draggables plugin)
|
||||
okButton: ' OK ', // text for the OK button
|
||||
cancelButton: ' Cancel ', // text for the Cancel button
|
||||
dialogClass: null, // if specified, this class will be applied to all dialogs
|
||||
|
||||
// Public methods
|
||||
|
||||
alert: function(message, title, callback) {
|
||||
if( title == null ) title = 'Alert';
|
||||
$.alerts._show(title, message, null, 'alert', function(result) {
|
||||
if( callback ) callback(result);
|
||||
});
|
||||
},
|
||||
|
||||
confirm: function(message, title, callback) {
|
||||
if( title == null ) title = 'Confirm';
|
||||
$.alerts._show(title, message, null, 'confirm', function(result) {
|
||||
if( callback ) callback(result);
|
||||
});
|
||||
},
|
||||
|
||||
prompt: function(message, value, title, callback) {
|
||||
if( title == null ) title = 'Prompt';
|
||||
$.alerts._show(title, message, value, 'prompt', function(result) {
|
||||
if( callback ) callback(result);
|
||||
});
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
_show: function(title, msg, value, type, callback) {
|
||||
|
||||
$.alerts._hide();
|
||||
$.alerts._overlay('show');
|
||||
|
||||
$("BODY").append(
|
||||
'<div id="popup_container">' +
|
||||
'<h1 id="popup_title"></h1>' +
|
||||
'<div id="popup_content">' +
|
||||
'<div id="popup_message"></div>' +
|
||||
'</div>' +
|
||||
'</div>');
|
||||
|
||||
if( $.alerts.dialogClass ) $("#popup_container").addClass($.alerts.dialogClass);
|
||||
|
||||
// IE6 Fix
|
||||
var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';
|
||||
|
||||
$("#popup_container").css({
|
||||
position: pos,
|
||||
zIndex: 99999,
|
||||
padding: 0,
|
||||
margin: 0
|
||||
});
|
||||
|
||||
$("#popup_title").text(title);
|
||||
$("#popup_content").addClass(type);
|
||||
$("#popup_message").text(msg);
|
||||
$("#popup_message").html( $("#popup_message").text().replace(/\n/g, '<br />') );
|
||||
|
||||
$("#popup_container").css({
|
||||
minWidth: $("#popup_container").outerWidth(),
|
||||
maxWidth: $("#popup_container").outerWidth()
|
||||
});
|
||||
|
||||
$.alerts._reposition();
|
||||
$.alerts._maintainPosition(true);
|
||||
|
||||
switch( type ) {
|
||||
case 'alert':
|
||||
$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /></div>');
|
||||
$("#popup_ok").click( function() {
|
||||
$.alerts._hide();
|
||||
callback(true);
|
||||
});
|
||||
$("#popup_ok").focus().keypress( function(e) {
|
||||
if( e.keyCode == 13 || e.keyCode == 27 ) $("#popup_ok").trigger('click');
|
||||
});
|
||||
break;
|
||||
case 'confirm':
|
||||
$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
|
||||
$("#popup_ok").click( function() {
|
||||
$.alerts._hide();
|
||||
if( callback ) callback(true);
|
||||
});
|
||||
$("#popup_cancel").click( function() {
|
||||
$.alerts._hide();
|
||||
if( callback ) callback(false);
|
||||
});
|
||||
$("#popup_ok").focus();
|
||||
$("#popup_ok, #popup_cancel").keypress( function(e) {
|
||||
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
|
||||
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
|
||||
});
|
||||
break;
|
||||
case 'prompt':
|
||||
$("#popup_message").append('<br /><input type="text" size="30" id="popup_prompt" />').after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
|
||||
$("#popup_prompt").width( $("#popup_message").width() );
|
||||
$("#popup_ok").click( function() {
|
||||
var val = $("#popup_prompt").val();
|
||||
$.alerts._hide();
|
||||
if( callback ) callback( val );
|
||||
});
|
||||
$("#popup_cancel").click( function() {
|
||||
$.alerts._hide();
|
||||
if( callback ) callback( null );
|
||||
});
|
||||
$("#popup_prompt, #popup_ok, #popup_cancel").keypress( function(e) {
|
||||
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
|
||||
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
|
||||
});
|
||||
if( value ) $("#popup_prompt").val(value);
|
||||
$("#popup_prompt").focus().select();
|
||||
break;
|
||||
}
|
||||
|
||||
// Make draggable
|
||||
if( $.alerts.draggable ) {
|
||||
try {
|
||||
$("#popup_container").draggable({ handle: $("#popup_title") });
|
||||
$("#popup_title").css({ cursor: 'move' });
|
||||
} catch(e) { /* requires jQuery UI draggables */ }
|
||||
}
|
||||
},
|
||||
|
||||
_hide: function() {
|
||||
$("#popup_container").remove();
|
||||
$.alerts._overlay('hide');
|
||||
$.alerts._maintainPosition(false);
|
||||
},
|
||||
|
||||
_overlay: function(status) {
|
||||
switch( status ) {
|
||||
case 'show':
|
||||
$.alerts._overlay('hide');
|
||||
$("BODY").append('<div id="popup_overlay"></div>');
|
||||
$("#popup_overlay").css({
|
||||
position: 'absolute',
|
||||
zIndex: 99998,
|
||||
top: '0px',
|
||||
left: '0px',
|
||||
width: '100%',
|
||||
height: $(document).height(),
|
||||
background: $.alerts.overlayColor,
|
||||
opacity: $.alerts.overlayOpacity
|
||||
});
|
||||
break;
|
||||
case 'hide':
|
||||
$("#popup_overlay").remove();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_reposition: function() {
|
||||
var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
|
||||
var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
|
||||
if( top < 0 ) top = 0;
|
||||
if( left < 0 ) left = 0;
|
||||
|
||||
// IE6 fix
|
||||
if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
|
||||
|
||||
$("#popup_container").css({
|
||||
top: top + 'px',
|
||||
left: left + 'px'
|
||||
});
|
||||
$("#popup_overlay").height( $(document).height() );
|
||||
},
|
||||
|
||||
_maintainPosition: function(status) {
|
||||
if( $.alerts.repositionOnResize ) {
|
||||
switch(status) {
|
||||
case true:
|
||||
$(window).bind('resize', function() {
|
||||
$.alerts._reposition();
|
||||
});
|
||||
break;
|
||||
case false:
|
||||
$(window).unbind('resize');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Shortuct functions
|
||||
jAlert = function(message, title, callback) {
|
||||
$.alerts.alert(message, title, callback);
|
||||
}
|
||||
|
||||
jConfirm = function(message, title, callback) {
|
||||
$.alerts.confirm(message, title, callback);
|
||||
};
|
||||
|
||||
jPrompt = function(message, value, title, callback) {
|
||||
$.alerts.prompt(message, value, title, callback);
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,87 @@
|
||||
/*!
|
||||
* Ambiance - Notification Plugin for jQuery
|
||||
* Version 1.0.1
|
||||
* @requires jQuery v1.7.2
|
||||
*
|
||||
* Copyright (c) 2012 Richard Hsu
|
||||
* Documentation: http://www.github.com/richardhsu/jquery.ambiance
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
$.fn.ambiance = function(options) {
|
||||
|
||||
var defaults = {
|
||||
title: "",
|
||||
message: "",
|
||||
type: "default",
|
||||
permanent: false,
|
||||
timeout: 2,
|
||||
fade: true,
|
||||
width: 300
|
||||
};
|
||||
|
||||
var options = $.extend(defaults, options);
|
||||
var note_area = $("#ambiance-notification");
|
||||
|
||||
// Construct the new notification.
|
||||
var note = $(window.document.createElement('div'))
|
||||
.addClass("ambiance")
|
||||
.addClass("ambiance-" + options['type']);
|
||||
|
||||
note.css({width: options['width']});
|
||||
|
||||
|
||||
// Deal with adding the close feature or not.
|
||||
if (!options['permanent']) {
|
||||
note.prepend($(window.document.createElement('a'))
|
||||
.addClass("ambiance-close")
|
||||
.attr("href", "#_")
|
||||
.html("×"));
|
||||
}
|
||||
|
||||
// Deal with adding the title if given.
|
||||
if (options['title'] !== "") {
|
||||
note.append($(window.document.createElement('div'))
|
||||
.addClass("ambiance-title")
|
||||
.append(options['title']));
|
||||
}
|
||||
|
||||
// Append the message (this can also be HTML or even an object!).
|
||||
note.append(options['message']);
|
||||
|
||||
// Add the notification to the notification area.
|
||||
note_area.append(note);
|
||||
|
||||
// Deal with non-permanent note.
|
||||
if (!options['permanent']) {
|
||||
if (options['timeout'] != 0) {
|
||||
if (options['fade']) {
|
||||
note.delay(options['timeout'] * 1000).fadeOut('slow');
|
||||
note.queue(function() { $(this).remove(); });
|
||||
} else {
|
||||
note.delay(options['timeout'] * 1000)
|
||||
.queue(function() { $(this).remove(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
$.ambiance = $.fn.ambiance; // Rename for easier calling.
|
||||
})(jQuery);
|
||||
|
||||
$(document).ready(function() {
|
||||
// Deal with adding the notification area to the page.
|
||||
if ($("#ambiance-notification").length == 0) {
|
||||
var note_area = $(window.document.createElement('div'))
|
||||
.attr("id", "ambiance-notification");
|
||||
$('body').append(note_area);
|
||||
}
|
||||
});
|
||||
|
||||
// Deal with close event on a note.
|
||||
$(document).on("click", ".ambiance-close", function () {
|
||||
$(this).parent().remove();
|
||||
return false;
|
||||
});
|
||||
@@ -0,0 +1,211 @@
|
||||
// jQuery Context Menu Plugin
|
||||
//
|
||||
// Version 1.01
|
||||
//
|
||||
// Cory S.N. LaViska
|
||||
// A Beautiful Site (http://abeautifulsite.net/)
|
||||
//
|
||||
// More info: http://abeautifulsite.net/2008/09/jquery-context-menu-plugin/
|
||||
//
|
||||
// Terms of Use
|
||||
//
|
||||
// This plugin is dual-licensed under the GNU General Public License
|
||||
// and the MIT License and is copyright A Beautiful Site, LLC.
|
||||
//
|
||||
if(jQuery)( function() {
|
||||
$.extend($.fn, {
|
||||
|
||||
contextMenu: function(o, callback) {
|
||||
// Defaults
|
||||
if( o.menu == undefined ) return false;
|
||||
if( o.inSpeed == undefined ) o.inSpeed = 150;
|
||||
if( o.outSpeed == undefined ) o.outSpeed = 75;
|
||||
// 0 needs to be -1 for expected results (no fade)
|
||||
if( o.inSpeed == 0 ) o.inSpeed = -1;
|
||||
if( o.outSpeed == 0 ) o.outSpeed = -1;
|
||||
// Loop each context menu
|
||||
$(this).each( function() {
|
||||
var el = $(this);
|
||||
var offset = $(el).offset();
|
||||
// Add contextMenu class
|
||||
$('#' + o.menu).addClass('contextMenu');
|
||||
// Simulate a true right click
|
||||
$(this).mousedown( function(e) {
|
||||
var evt = e;
|
||||
evt.stopPropagation();
|
||||
$(this).mouseup( function(e) {
|
||||
e.stopPropagation();
|
||||
var srcElement = $(this);
|
||||
$(this).unbind('mouseup');
|
||||
if( evt.button == 2 ) {
|
||||
// Hide context menus that may be showing
|
||||
$(".contextMenu").hide();
|
||||
// Get this context menu
|
||||
var menu = $('#' + o.menu);
|
||||
|
||||
if( $(el).hasClass('disabled') ) return false;
|
||||
|
||||
// Detect mouse position
|
||||
var d = {}, x, y;
|
||||
if( self.innerHeight ) {
|
||||
d.pageYOffset = self.pageYOffset;
|
||||
d.pageXOffset = self.pageXOffset;
|
||||
d.innerHeight = self.innerHeight;
|
||||
d.innerWidth = self.innerWidth;
|
||||
} else if( document.documentElement &&
|
||||
document.documentElement.clientHeight ) {
|
||||
d.pageYOffset = document.documentElement.scrollTop;
|
||||
d.pageXOffset = document.documentElement.scrollLeft;
|
||||
d.innerHeight = document.documentElement.clientHeight;
|
||||
d.innerWidth = document.documentElement.clientWidth;
|
||||
} else if( document.body ) {
|
||||
d.pageYOffset = document.body.scrollTop;
|
||||
d.pageXOffset = document.body.scrollLeft;
|
||||
d.innerHeight = document.body.clientHeight;
|
||||
d.innerWidth = document.body.clientWidth;
|
||||
}
|
||||
(e.pageX) ? x = e.pageX : x = e.clientX + d.scrollLeft;
|
||||
(e.pageY) ? y = e.pageY : y = e.clientY + d.scrollTop;
|
||||
|
||||
// Show the menu
|
||||
$(document).unbind('click');
|
||||
$(menu).css({ top: y, left: x }).fadeIn(o.inSpeed);
|
||||
// Hover events
|
||||
$(menu).find('A').mouseover( function() {
|
||||
$(menu).find('LI.hover').removeClass('hover');
|
||||
$(this).parent().addClass('hover');
|
||||
}).mouseout( function() {
|
||||
$(menu).find('LI.hover').removeClass('hover');
|
||||
});
|
||||
|
||||
// Keyboard
|
||||
$(document).keypress( function(e) {
|
||||
switch( e.keyCode ) {
|
||||
case 38: // up
|
||||
if( $(menu).find('LI.hover').size() == 0 ) {
|
||||
$(menu).find('LI:last').addClass('hover');
|
||||
} else {
|
||||
$(menu).find('LI.hover').removeClass('hover').prevAll('LI:not(.disabled)').eq(0).addClass('hover');
|
||||
if( $(menu).find('LI.hover').size() == 0 ) $(menu).find('LI:last').addClass('hover');
|
||||
}
|
||||
break;
|
||||
case 40: // down
|
||||
if( $(menu).find('LI.hover').size() == 0 ) {
|
||||
$(menu).find('LI:first').addClass('hover');
|
||||
} else {
|
||||
$(menu).find('LI.hover').removeClass('hover').nextAll('LI:not(.disabled)').eq(0).addClass('hover');
|
||||
if( $(menu).find('LI.hover').size() == 0 ) $(menu).find('LI:first').addClass('hover');
|
||||
}
|
||||
break;
|
||||
case 13: // enter
|
||||
$(menu).find('LI.hover A').trigger('click');
|
||||
break;
|
||||
case 27: // esc
|
||||
$(document).trigger('click');
|
||||
break
|
||||
}
|
||||
});
|
||||
|
||||
// When items are selected
|
||||
$('#' + o.menu).find('A').unbind('click');
|
||||
$('#' + o.menu).find('LI:not(.disabled) A').click( function() {
|
||||
$(document).unbind('click').unbind('keypress');
|
||||
$(".contextMenu").hide();
|
||||
// Callback
|
||||
if( callback ) callback( $(this).attr('href').substr(1), $(srcElement), {x: x - offset.left, y: y - offset.top, docX: x, docY: y} );
|
||||
return false;
|
||||
});
|
||||
|
||||
// Hide bindings
|
||||
setTimeout( function() { // Delay for Mozilla
|
||||
$(document).click( function() {
|
||||
$(document).unbind('click').unbind('keypress');
|
||||
$(menu).fadeOut(o.outSpeed);
|
||||
return false;
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Disable text selection
|
||||
if( $.browser.mozilla ) {
|
||||
$('#' + o.menu).each( function() { $(this).css({ 'MozUserSelect' : 'none' }); });
|
||||
} else if( $.browser.msie ) {
|
||||
$('#' + o.menu).each( function() { $(this).bind('selectstart.disableTextSelect', function() { return false; }); });
|
||||
} else {
|
||||
$('#' + o.menu).each(function() { $(this).bind('mousedown.disableTextSelect', function() { return false; }); });
|
||||
}
|
||||
// Disable browser context menu (requires both selectors to work in IE/Safari + FF/Chrome)
|
||||
$(el).add($('UL.contextMenu')).bind('contextmenu', function() { return false; });
|
||||
|
||||
});
|
||||
return $(this);
|
||||
},
|
||||
|
||||
// Disable context menu items on the fly
|
||||
disableContextMenuItems: function(o) {
|
||||
if( o == undefined ) {
|
||||
// Disable all
|
||||
$(this).find('LI').addClass('disabled');
|
||||
return( $(this) );
|
||||
}
|
||||
$(this).each( function() {
|
||||
if( o != undefined ) {
|
||||
var d = o.split(',');
|
||||
for( var i = 0; i < d.length; i++ ) {
|
||||
$(this).find('A[href="' + d[i] + '"]').parent().addClass('disabled');
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
return( $(this) );
|
||||
},
|
||||
|
||||
// Enable context menu items on the fly
|
||||
enableContextMenuItems: function(o) {
|
||||
if( o == undefined ) {
|
||||
// Enable all
|
||||
$(this).find('LI.disabled').removeClass('disabled');
|
||||
return( $(this) );
|
||||
}
|
||||
$(this).each( function() {
|
||||
if( o != undefined ) {
|
||||
var d = o.split(',');
|
||||
for( var i = 0; i < d.length; i++ ) {
|
||||
$(this).find('A[href="' + d[i] + '"]').parent().removeClass('disabled');
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
return( $(this) );
|
||||
},
|
||||
|
||||
// Disable context menu(s)
|
||||
disableContextMenu: function() {
|
||||
$(this).each( function() {
|
||||
$(this).addClass('disabled');
|
||||
});
|
||||
return( $(this) );
|
||||
},
|
||||
|
||||
// Enable context menu(s)
|
||||
enableContextMenu: function() {
|
||||
$(this).each( function() {
|
||||
$(this).removeClass('disabled');
|
||||
});
|
||||
return( $(this) );
|
||||
},
|
||||
|
||||
// Destroy context menu(s)
|
||||
destroyContextMenu: function() {
|
||||
// Destroy specified context menus
|
||||
$(this).each( function() {
|
||||
// Disable action
|
||||
$(this).unbind('mousedown').unbind('mouseup');
|
||||
});
|
||||
return( $(this) );
|
||||
}
|
||||
|
||||
});
|
||||
})(jQuery);
|
||||
18
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery.cookies.min.js
vendored
Normal file
18
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery.cookies.min.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2005 - 2010, James Auldridge
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the BSD, MIT, and GPL (your choice!) Licenses:
|
||||
* http://code.google.com/p/cookies/wiki/License
|
||||
*
|
||||
*/
|
||||
var jaaulde=window.jaaulde||{};jaaulde.utils=jaaulde.utils||{};jaaulde.utils.cookies=(function(){var resolveOptions,assembleOptionsString,parseCookies,constructor,defaultOptions={expiresAt:null,path:'/',domain:null,secure:false};resolveOptions=function(options){var returnValue,expireDate;if(typeof options!=='object'||options===null){returnValue=defaultOptions;}else
|
||||
{returnValue={expiresAt:defaultOptions.expiresAt,path:defaultOptions.path,domain:defaultOptions.domain,secure:defaultOptions.secure};if(typeof options.expiresAt==='object'&&options.expiresAt instanceof Date){returnValue.expiresAt=options.expiresAt;}else if(typeof options.hoursToLive==='number'&&options.hoursToLive!==0){expireDate=new Date();expireDate.setTime(expireDate.getTime()+(options.hoursToLive*60*60*1000));returnValue.expiresAt=expireDate;}if(typeof options.path==='string'&&options.path!==''){returnValue.path=options.path;}if(typeof options.domain==='string'&&options.domain!==''){returnValue.domain=options.domain;}if(options.secure===true){returnValue.secure=options.secure;}}return returnValue;};assembleOptionsString=function(options){options=resolveOptions(options);return((typeof options.expiresAt==='object'&&options.expiresAt instanceof Date?'; expires='+options.expiresAt.toGMTString():'')+'; path='+options.path+(typeof options.domain==='string'?'; domain='+options.domain:'')+(options.secure===true?'; secure':''));};parseCookies=function(){var cookies={},i,pair,name,value,separated=document.cookie.split(';'),unparsedValue;for(i=0;i<separated.length;i=i+1){pair=separated[i].split('=');name=pair[0].replace(/^\s*/,'').replace(/\s*$/,'');try
|
||||
{value=decodeURIComponent(pair[1]);}catch(e1){value=pair[1];}if(typeof JSON==='object'&&JSON!==null&&typeof JSON.parse==='function'){try
|
||||
{unparsedValue=value;value=JSON.parse(value);}catch(e2){value=unparsedValue;}}cookies[name]=value;}return cookies;};constructor=function(){};constructor.prototype.get=function(cookieName){var returnValue,item,cookies=parseCookies();if(typeof cookieName==='string'){returnValue=(typeof cookies[cookieName]!=='undefined')?cookies[cookieName]:null;}else if(typeof cookieName==='object'&&cookieName!==null){returnValue={};for(item in cookieName){if(typeof cookies[cookieName[item]]!=='undefined'){returnValue[cookieName[item]]=cookies[cookieName[item]];}else
|
||||
{returnValue[cookieName[item]]=null;}}}else
|
||||
{returnValue=cookies;}return returnValue;};constructor.prototype.filter=function(cookieNameRegExp){var cookieName,returnValue={},cookies=parseCookies();if(typeof cookieNameRegExp==='string'){cookieNameRegExp=new RegExp(cookieNameRegExp);}for(cookieName in cookies){if(cookieName.match(cookieNameRegExp)){returnValue[cookieName]=cookies[cookieName];}}return returnValue;};constructor.prototype.set=function(cookieName,value,options){if(typeof options!=='object'||options===null){options={};}if(typeof value==='undefined'||value===null){value='';options.hoursToLive=-8760;}else if(typeof value!=='string'){if(typeof JSON==='object'&&JSON!==null&&typeof JSON.stringify==='function'){value=JSON.stringify(value);}else
|
||||
{throw new Error('cookies.set() received non-string value and could not serialize.');}}var optionsString=assembleOptionsString(options);document.cookie=cookieName+'='+encodeURIComponent(value)+optionsString;};constructor.prototype.del=function(cookieName,options){var allCookies={},name;if(typeof options!=='object'||options===null){options={};}if(typeof cookieName==='boolean'&&cookieName===true){allCookies=this.get();}else if(typeof cookieName==='string'){allCookies[cookieName]=true;}for(name in allCookies){if(typeof name==='string'&&name!==''){this.set(name,null,options);}}};constructor.prototype.test=function(){var returnValue=false,testName='cT',testValue='data';this.set(testName,testValue);if(this.get(testName)===testValue){this.del(testName);returnValue=true;}return returnValue;};constructor.prototype.setOptions=function(options){if(typeof options!=='object'){options=null;}defaultOptions=resolveOptions(options);};return new constructor();})();(function(){if(window.jQuery){(function($){$.cookies=jaaulde.utils.cookies;var extensions={cookify:function(options){return this.each(function(){var i,nameAttrs=['name','id'],name,$this=$(this),value;for(i in nameAttrs){if(!isNaN(i)){name=$this.attr(nameAttrs[i]);if(typeof name==='string'&&name!==''){if($this.is(':checkbox, :radio')){if($this.attr('checked')){value=$this.val();}}else if($this.is(':input')){value=$this.val();}else
|
||||
{value=$this.html();}if(typeof value!=='string'||value===''){value=null;}$.cookies.set(name,value,options);break;}}}});},cookieFill:function(){return this.each(function(){var n,getN,nameAttrs=['name','id'],name,$this=$(this),value;getN=function(){n=nameAttrs.pop();return!!n;};while(getN()){name=$this.attr(n);if(typeof name==='string'&&name!==''){value=$.cookies.get(name);if(value!==null){if($this.is(':checkbox, :radio')){if($this.val()===value){$this.attr('checked','checked');}else
|
||||
{$this.removeAttr('checked');}}else if($this.is(':input')){$this.val(value);}else
|
||||
{$this.html(value);}}break;}}});},cookieBind:function(options){return this.each(function(){var $this=$(this);$this.cookieFill().change(function(){$this.cookify(options);});});}};$.each(extensions,function(i){$.fn[i]=this;});})(window.jQuery);}})();
|
||||
14878
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery.dataTables.js
vendored
Normal file
14878
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery.dataTables.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,727 @@
|
||||
/* jshint forin:true, noarg:true, noempty:true, eqeqeq:true, boss:true, undef:true, curly:true, browser:true, jquery:true */
|
||||
/*
|
||||
* jQuery MultiSelect UI Widget 1.14pre
|
||||
* Copyright (c) 2012 Eric Hynds
|
||||
*
|
||||
* http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/
|
||||
*
|
||||
* Depends:
|
||||
* - jQuery 1.4.2+
|
||||
* - jQuery UI 1.8 widget factory
|
||||
*
|
||||
* Optional:
|
||||
* - jQuery UI effects
|
||||
* - jQuery UI position utility
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
(function($, undefined) {
|
||||
|
||||
var multiselectID = 0;
|
||||
var $doc = $(document);
|
||||
|
||||
$.widget("ech.multiselect", {
|
||||
|
||||
// default options
|
||||
options: {
|
||||
header: true,
|
||||
height: 175,
|
||||
minWidth: 225,
|
||||
classes: '',
|
||||
checkAllText: 'Check all',
|
||||
uncheckAllText: 'Uncheck all',
|
||||
noneSelectedText: 'Select options',
|
||||
selectedText: '# selected',
|
||||
selectedList: 0,
|
||||
show: null,
|
||||
hide: null,
|
||||
autoOpen: false,
|
||||
multiple: true,
|
||||
position: {}
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
var el = this.element.hide();
|
||||
var o = this.options;
|
||||
|
||||
this.speed = $.fx.speeds._default; // default speed for effects
|
||||
this._isOpen = false; // assume no
|
||||
|
||||
// create a unique namespace for events that the widget
|
||||
// factory cannot unbind automatically. Use eventNamespace if on
|
||||
// jQuery UI 1.9+, and otherwise fallback to a custom string.
|
||||
this._namespaceID = this.eventNamespace || ('multiselect' + multiselectID);
|
||||
|
||||
var button = (this.button = $('<button type="button"><span class="ui-icon ui-icon-triangle-2-n-s"></span></button>'))
|
||||
.addClass('ui-multiselect ui-widget ui-state-default ui-corner-all')
|
||||
.addClass(o.classes)
|
||||
.attr({ 'title':el.attr('title'), 'aria-haspopup':true, 'tabIndex':el.attr('tabIndex') })
|
||||
.insertAfter(el),
|
||||
|
||||
buttonlabel = (this.buttonlabel = $('<span />'))
|
||||
.html(o.noneSelectedText)
|
||||
.appendTo(button),
|
||||
|
||||
menu = (this.menu = $('<div />'))
|
||||
.addClass('ui-multiselect-menu ui-widget ui-widget-content ui-corner-all')
|
||||
.addClass(o.classes)
|
||||
.appendTo(document.body),
|
||||
|
||||
header = (this.header = $('<div />'))
|
||||
.addClass('ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix')
|
||||
.appendTo(menu),
|
||||
|
||||
headerLinkContainer = (this.headerLinkContainer = $('<ul />'))
|
||||
.addClass('ui-helper-reset')
|
||||
.html(function() {
|
||||
if(o.header === true) {
|
||||
return '<li><a class="ui-multiselect-all" href="#"><span class="ui-icon ui-icon-check"></span><span>' + o.checkAllText + '</span></a></li><li><a class="ui-multiselect-none" href="#"><span class="ui-icon ui-icon-closethick"></span><span>' + o.uncheckAllText + '</span></a></li>';
|
||||
} else if(typeof o.header === "string") {
|
||||
return '<li>' + o.header + '</li>';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
})
|
||||
.append('<li class="ui-multiselect-close"><a href="#" class="ui-multiselect-close"><span class="ui-icon ui-icon-circle-close"></span></a></li>')
|
||||
.appendTo(header),
|
||||
|
||||
checkboxContainer = (this.checkboxContainer = $('<ul />'))
|
||||
.addClass('ui-multiselect-checkboxes ui-helper-reset')
|
||||
.appendTo(menu);
|
||||
|
||||
// perform event bindings
|
||||
this._bindEvents();
|
||||
|
||||
// build menu
|
||||
this.refresh(true);
|
||||
|
||||
// some addl. logic for single selects
|
||||
if(!o.multiple) {
|
||||
menu.addClass('ui-multiselect-single');
|
||||
}
|
||||
|
||||
// bump unique ID
|
||||
multiselectID++;
|
||||
},
|
||||
|
||||
_init: function() {
|
||||
if(this.options.header === false) {
|
||||
this.header.hide();
|
||||
}
|
||||
if(!this.options.multiple) {
|
||||
this.headerLinkContainer.find('.ui-multiselect-all, .ui-multiselect-none').hide();
|
||||
}
|
||||
if(this.options.autoOpen) {
|
||||
this.open();
|
||||
}
|
||||
if(this.element.is(':disabled')) {
|
||||
this.disable();
|
||||
}
|
||||
},
|
||||
|
||||
refresh: function(init) {
|
||||
var el = this.element;
|
||||
var o = this.options;
|
||||
var menu = this.menu;
|
||||
var checkboxContainer = this.checkboxContainer;
|
||||
var optgroups = [];
|
||||
var html = "";
|
||||
var id = el.attr('id') || multiselectID++; // unique ID for the label & option tags
|
||||
|
||||
// build items
|
||||
el.find('option').each(function(i) {
|
||||
var $this = $(this);
|
||||
var parent = this.parentNode;
|
||||
var title = this.innerHTML;
|
||||
var description = this.title;
|
||||
var value = this.value;
|
||||
var inputID = 'ui-multiselect-' + (this.id || id + '-option-' + i);
|
||||
var isDisabled = this.disabled;
|
||||
var isSelected = this.selected;
|
||||
var labelClasses = [ 'ui-corner-all' ];
|
||||
var liClasses = (isDisabled ? 'ui-multiselect-disabled ' : ' ') + this.className;
|
||||
var optLabel;
|
||||
|
||||
// is this an optgroup?
|
||||
if(parent.tagName === 'OPTGROUP') {
|
||||
optLabel = parent.getAttribute('label');
|
||||
|
||||
// has this optgroup been added already?
|
||||
if($.inArray(optLabel, optgroups) === -1) {
|
||||
html += '<li class="ui-multiselect-optgroup-label ' + parent.className + '"><a href="#">' + optLabel + '</a></li>';
|
||||
optgroups.push(optLabel);
|
||||
}
|
||||
}
|
||||
|
||||
if(isDisabled) {
|
||||
labelClasses.push('ui-state-disabled');
|
||||
}
|
||||
|
||||
// browsers automatically select the first option
|
||||
// by default with single selects
|
||||
if(isSelected && !o.multiple) {
|
||||
labelClasses.push('ui-state-active');
|
||||
}
|
||||
|
||||
html += '<li class="' + liClasses + '">';
|
||||
|
||||
// create the label
|
||||
html += '<label for="' + inputID + '" title="' + description + '" class="' + labelClasses.join(' ') + '">';
|
||||
html += '<input id="' + inputID + '" name="multiselect_' + id + '" type="' + (o.multiple ? "checkbox" : "radio") + '" value="' + value + '" title="' + title + '"';
|
||||
|
||||
// pre-selected?
|
||||
if(isSelected) {
|
||||
html += ' checked="checked"';
|
||||
html += ' aria-selected="true"';
|
||||
}
|
||||
|
||||
// disabled?
|
||||
if(isDisabled) {
|
||||
html += ' disabled="disabled"';
|
||||
html += ' aria-disabled="true"';
|
||||
}
|
||||
|
||||
// add the title and close everything off
|
||||
html += ' /><span>' + title + '</span></label></li>';
|
||||
});
|
||||
|
||||
// insert into the DOM
|
||||
checkboxContainer.html(html);
|
||||
|
||||
// cache some moar useful elements
|
||||
this.labels = menu.find('label');
|
||||
this.inputs = this.labels.children('input');
|
||||
|
||||
// set widths
|
||||
this._setButtonWidth();
|
||||
this._setMenuWidth();
|
||||
|
||||
// remember default value
|
||||
this.button[0].defaultValue = this.update();
|
||||
|
||||
// broadcast refresh event; useful for widgets
|
||||
if(!init) {
|
||||
this._trigger('refresh');
|
||||
}
|
||||
},
|
||||
|
||||
// updates the button text. call refresh() to rebuild
|
||||
update: function() {
|
||||
var o = this.options;
|
||||
var $inputs = this.inputs;
|
||||
var $checked = $inputs.filter(':checked');
|
||||
var numChecked = $checked.length;
|
||||
var value;
|
||||
|
||||
if(numChecked === 0) {
|
||||
value = o.noneSelectedText;
|
||||
} else {
|
||||
if($.isFunction(o.selectedText)) {
|
||||
value = o.selectedText.call(this, numChecked, $inputs.length, $checked.get());
|
||||
} else if(/\d/.test(o.selectedList) && o.selectedList > 0 && numChecked <= o.selectedList) {
|
||||
value = $checked.map(function() { return $(this).next().html(); }).get().join(', ');
|
||||
} else {
|
||||
value = o.selectedText.replace('#', numChecked).replace('#', $inputs.length);
|
||||
}
|
||||
}
|
||||
|
||||
this._setButtonValue(value);
|
||||
|
||||
return value;
|
||||
},
|
||||
|
||||
// this exists as a separate method so that the developer
|
||||
// can easily override it.
|
||||
_setButtonValue: function(value) {
|
||||
this.buttonlabel.text(value);
|
||||
},
|
||||
|
||||
// binds events
|
||||
_bindEvents: function() {
|
||||
var self = this;
|
||||
var button = this.button;
|
||||
|
||||
function clickHandler() {
|
||||
self[ self._isOpen ? 'close' : 'open' ]();
|
||||
return false;
|
||||
}
|
||||
|
||||
// webkit doesn't like it when you click on the span :(
|
||||
button
|
||||
.find('span')
|
||||
.bind('click.multiselect', clickHandler);
|
||||
|
||||
// button events
|
||||
button.bind({
|
||||
click: clickHandler,
|
||||
keypress: function(e) {
|
||||
switch(e.which) {
|
||||
case 27: // esc
|
||||
case 38: // up
|
||||
case 37: // left
|
||||
self.close();
|
||||
break;
|
||||
case 39: // right
|
||||
case 40: // down
|
||||
self.open();
|
||||
break;
|
||||
}
|
||||
},
|
||||
mouseenter: function() {
|
||||
if(!button.hasClass('ui-state-disabled')) {
|
||||
$(this).addClass('ui-state-hover');
|
||||
}
|
||||
},
|
||||
mouseleave: function() {
|
||||
$(this).removeClass('ui-state-hover');
|
||||
},
|
||||
focus: function() {
|
||||
if(!button.hasClass('ui-state-disabled')) {
|
||||
$(this).addClass('ui-state-focus');
|
||||
}
|
||||
},
|
||||
blur: function() {
|
||||
$(this).removeClass('ui-state-focus');
|
||||
}
|
||||
});
|
||||
|
||||
// header links
|
||||
this.header.delegate('a', 'click.multiselect', function(e) {
|
||||
// close link
|
||||
if($(this).hasClass('ui-multiselect-close')) {
|
||||
self.close();
|
||||
|
||||
// check all / uncheck all
|
||||
} else {
|
||||
self[$(this).hasClass('ui-multiselect-all') ? 'checkAll' : 'uncheckAll']();
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// optgroup label toggle support
|
||||
this.menu.delegate('li.ui-multiselect-optgroup-label a', 'click.multiselect', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $this = $(this);
|
||||
var $inputs = $this.parent().nextUntil('li.ui-multiselect-optgroup-label').find('input:visible:not(:disabled)');
|
||||
var nodes = $inputs.get();
|
||||
var label = $this.parent().text();
|
||||
|
||||
// trigger event and bail if the return is false
|
||||
if(self._trigger('beforeoptgrouptoggle', e, { inputs:nodes, label:label }) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// toggle inputs
|
||||
self._toggleChecked(
|
||||
$inputs.filter(':checked').length !== $inputs.length,
|
||||
$inputs
|
||||
);
|
||||
|
||||
self._trigger('optgrouptoggle', e, {
|
||||
inputs: nodes,
|
||||
label: label,
|
||||
checked: nodes[0].checked
|
||||
});
|
||||
})
|
||||
.delegate('label', 'mouseenter.multiselect', function() {
|
||||
if(!$(this).hasClass('ui-state-disabled')) {
|
||||
self.labels.removeClass('ui-state-hover');
|
||||
$(this).addClass('ui-state-hover').find('input').focus();
|
||||
}
|
||||
})
|
||||
.delegate('label', 'keydown.multiselect', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
switch(e.which) {
|
||||
case 9: // tab
|
||||
case 27: // esc
|
||||
self.close();
|
||||
break;
|
||||
case 38: // up
|
||||
case 40: // down
|
||||
case 37: // left
|
||||
case 39: // right
|
||||
self._traverse(e.which, this);
|
||||
break;
|
||||
case 13: // enter
|
||||
$(this).find('input')[0].click();
|
||||
break;
|
||||
}
|
||||
})
|
||||
.delegate('input[type="checkbox"], input[type="radio"]', 'click.multiselect', function(e) {
|
||||
var $this = $(this);
|
||||
var val = this.value;
|
||||
var checked = this.checked;
|
||||
var tags = self.element.find('option');
|
||||
|
||||
// bail if this input is disabled or the event is cancelled
|
||||
if(this.disabled || self._trigger('click', e, { value: val, text: this.title, checked: checked }) === false) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
// make sure the input has focus. otherwise, the esc key
|
||||
// won't close the menu after clicking an item.
|
||||
$this.focus();
|
||||
|
||||
// toggle aria state
|
||||
$this.attr('aria-selected', checked);
|
||||
|
||||
// change state on the original option tags
|
||||
tags.each(function() {
|
||||
if(this.value === val) {
|
||||
this.selected = checked;
|
||||
} else if(!self.options.multiple) {
|
||||
this.selected = false;
|
||||
}
|
||||
});
|
||||
|
||||
// some additional single select-specific logic
|
||||
if(!self.options.multiple) {
|
||||
self.labels.removeClass('ui-state-active');
|
||||
$this.closest('label').toggleClass('ui-state-active', checked);
|
||||
|
||||
// close menu
|
||||
self.close();
|
||||
}
|
||||
|
||||
// fire change on the select box
|
||||
self.element.trigger("change");
|
||||
|
||||
// setTimeout is to fix multiselect issue #14 and #47. caused by jQuery issue #3827
|
||||
// http://bugs.jquery.com/ticket/3827
|
||||
setTimeout($.proxy(self.update, self), 10);
|
||||
});
|
||||
|
||||
// close each widget when clicking on any other element/anywhere else on the page
|
||||
$doc.bind('mousedown.' + this._namespaceID, function(e) {
|
||||
if(self._isOpen && !$.contains(self.menu[0], e.target) && !$.contains(self.button[0], e.target) && e.target !== self.button[0]) {
|
||||
self.close();
|
||||
}
|
||||
});
|
||||
|
||||
// deal with form resets. the problem here is that buttons aren't
|
||||
// restored to their defaultValue prop on form reset, and the reset
|
||||
// handler fires before the form is actually reset. delaying it a bit
|
||||
// gives the form inputs time to clear.
|
||||
$(this.element[0].form).bind('reset.multiselect', function() {
|
||||
setTimeout($.proxy(self.refresh, self), 10);
|
||||
});
|
||||
},
|
||||
|
||||
// set button width
|
||||
_setButtonWidth: function() {
|
||||
var width = this.element.outerWidth();
|
||||
var o = this.options;
|
||||
|
||||
if(/\d/.test(o.minWidth) && width < o.minWidth) {
|
||||
width = o.minWidth;
|
||||
}
|
||||
|
||||
// set widths
|
||||
this.button.outerWidth(width);
|
||||
},
|
||||
|
||||
// set menu width
|
||||
_setMenuWidth: function() {
|
||||
var m = this.menu;
|
||||
m.outerWidth(this.button.outerWidth());
|
||||
},
|
||||
|
||||
// move up or down within the menu
|
||||
_traverse: function(which, start) {
|
||||
var $start = $(start);
|
||||
var moveToLast = which === 38 || which === 37;
|
||||
|
||||
// select the first li that isn't an optgroup label / disabled
|
||||
$next = $start.parent()[moveToLast ? 'prevAll' : 'nextAll']('li:not(.ui-multiselect-disabled, .ui-multiselect-optgroup-label)')[ moveToLast ? 'last' : 'first']();
|
||||
|
||||
// if at the first/last element
|
||||
if(!$next.length) {
|
||||
var $container = this.menu.find('ul').last();
|
||||
|
||||
// move to the first/last
|
||||
this.menu.find('label')[ moveToLast ? 'last' : 'first' ]().trigger('mouseover');
|
||||
|
||||
// set scroll position
|
||||
$container.scrollTop(moveToLast ? $container.height() : 0);
|
||||
|
||||
} else {
|
||||
$next.find('label').trigger('mouseover');
|
||||
}
|
||||
},
|
||||
|
||||
// This is an internal function to toggle the checked property and
|
||||
// other related attributes of a checkbox.
|
||||
//
|
||||
// The context of this function should be a checkbox; do not proxy it.
|
||||
_toggleState: function(prop, flag) {
|
||||
return function() {
|
||||
if(!this.disabled) {
|
||||
this[ prop ] = flag;
|
||||
}
|
||||
|
||||
if(flag) {
|
||||
this.setAttribute('aria-selected', true);
|
||||
} else {
|
||||
this.removeAttribute('aria-selected');
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
_toggleChecked: function(flag, group) {
|
||||
var $inputs = (group && group.length) ? group : this.inputs;
|
||||
var self = this;
|
||||
|
||||
// toggle state on inputs
|
||||
$inputs.each(this._toggleState('checked', flag));
|
||||
|
||||
// give the first input focus
|
||||
$inputs.eq(0).focus();
|
||||
|
||||
// update button text
|
||||
this.update();
|
||||
|
||||
// gather an array of the values that actually changed
|
||||
var values = $inputs.map(function() {
|
||||
return this.value;
|
||||
}).get();
|
||||
|
||||
// toggle state on original option tags
|
||||
this.element
|
||||
.find('option')
|
||||
.each(function() {
|
||||
if(!this.disabled && $.inArray(this.value, values) > -1) {
|
||||
self._toggleState('selected', flag).call(this);
|
||||
}
|
||||
});
|
||||
|
||||
// trigger the change event on the select
|
||||
if($inputs.length) {
|
||||
this.element.trigger("change");
|
||||
}
|
||||
},
|
||||
|
||||
_toggleDisabled: function(flag) {
|
||||
this.button.attr({ 'disabled':flag, 'aria-disabled':flag })[ flag ? 'addClass' : 'removeClass' ]('ui-state-disabled');
|
||||
|
||||
var inputs = this.menu.find('input');
|
||||
var key = "ech-multiselect-disabled";
|
||||
|
||||
if(flag) {
|
||||
// remember which elements this widget disabled (not pre-disabled)
|
||||
// elements, so that they can be restored if the widget is re-enabled.
|
||||
inputs = inputs.filter(':enabled').data(key, true)
|
||||
} else {
|
||||
inputs = inputs.filter(function() {
|
||||
return $.data(this, key) === true;
|
||||
}).removeData(key);
|
||||
}
|
||||
|
||||
inputs
|
||||
.attr({ 'disabled':flag, 'arial-disabled':flag })
|
||||
.parent()[ flag ? 'addClass' : 'removeClass' ]('ui-state-disabled');
|
||||
|
||||
this.element.attr({
|
||||
'disabled':flag,
|
||||
'aria-disabled':flag
|
||||
});
|
||||
},
|
||||
|
||||
// open the menu
|
||||
open: function(e) {
|
||||
var self = this;
|
||||
var button = this.button;
|
||||
var menu = this.menu;
|
||||
var speed = this.speed;
|
||||
var o = this.options;
|
||||
var args = [];
|
||||
|
||||
// bail if the multiselectopen event returns false, this widget is disabled, or is already open
|
||||
if(this._trigger('beforeopen') === false || button.hasClass('ui-state-disabled') || this._isOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $container = menu.find('ul').last();
|
||||
var effect = o.show;
|
||||
|
||||
// figure out opening effects/speeds
|
||||
if($.isArray(o.show)) {
|
||||
effect = o.show[0];
|
||||
speed = o.show[1] || self.speed;
|
||||
}
|
||||
|
||||
// if there's an effect, assume jQuery UI is in use
|
||||
// build the arguments to pass to show()
|
||||
if(effect) {
|
||||
args = [ effect, speed ];
|
||||
}
|
||||
|
||||
// set the scroll of the checkbox container
|
||||
$container.scrollTop(0).height(o.height);
|
||||
|
||||
// positon
|
||||
this.position();
|
||||
|
||||
// show the menu, maybe with a speed/effect combo
|
||||
$.fn.show.apply(menu, args);
|
||||
|
||||
// select the first option
|
||||
// triggering both mouseover and mouseover because 1.4.2+ has a bug where triggering mouseover
|
||||
// will actually trigger mouseenter. the mouseenter trigger is there for when it's eventually fixed
|
||||
this.labels.eq(0).trigger('mouseover').trigger('mouseenter').find('input').trigger('focus');
|
||||
|
||||
button.addClass('ui-state-active');
|
||||
this._isOpen = true;
|
||||
this._trigger('open');
|
||||
},
|
||||
|
||||
// close the menu
|
||||
close: function() {
|
||||
if(this._trigger('beforeclose') === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
var o = this.options;
|
||||
var effect = o.hide;
|
||||
var speed = this.speed;
|
||||
var args = [];
|
||||
|
||||
// figure out opening effects/speeds
|
||||
if($.isArray(o.hide)) {
|
||||
effect = o.hide[0];
|
||||
speed = o.hide[1] || this.speed;
|
||||
}
|
||||
|
||||
if(effect) {
|
||||
args = [ effect, speed ];
|
||||
}
|
||||
|
||||
$.fn.hide.apply(this.menu, args);
|
||||
this.button.removeClass('ui-state-active').trigger('blur').trigger('mouseleave');
|
||||
this._isOpen = false;
|
||||
this._trigger('close');
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
this._toggleDisabled(false);
|
||||
},
|
||||
|
||||
disable: function() {
|
||||
this._toggleDisabled(true);
|
||||
},
|
||||
|
||||
checkAll: function(e) {
|
||||
this._toggleChecked(true);
|
||||
this._trigger('checkAll');
|
||||
},
|
||||
|
||||
uncheckAll: function() {
|
||||
this._toggleChecked(false);
|
||||
this._trigger('uncheckAll');
|
||||
},
|
||||
|
||||
getChecked: function() {
|
||||
return this.menu.find('input').filter(':checked');
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
// remove classes + data
|
||||
$.Widget.prototype.destroy.call(this);
|
||||
|
||||
// unbind events
|
||||
$doc.unbind(this._namespaceID);
|
||||
|
||||
this.button.remove();
|
||||
this.menu.remove();
|
||||
this.element.show();
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
isOpen: function() {
|
||||
return this._isOpen;
|
||||
},
|
||||
|
||||
widget: function() {
|
||||
return this.menu;
|
||||
},
|
||||
|
||||
getButton: function() {
|
||||
return this.button;
|
||||
},
|
||||
|
||||
position: function() {
|
||||
var o = this.options;
|
||||
|
||||
// use the position utility if it exists and options are specifified
|
||||
if($.ui.position && !$.isEmptyObject(o.position)) {
|
||||
o.position.of = o.position.of || this.button;
|
||||
|
||||
this.menu
|
||||
.show()
|
||||
.position(o.position)
|
||||
.hide();
|
||||
|
||||
// otherwise fallback to custom positioning
|
||||
} else {
|
||||
var pos = this.button.offset();
|
||||
|
||||
this.menu.css({
|
||||
top: pos.top + this.button.outerHeight(),
|
||||
left: pos.left
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// react to option changes after initialization
|
||||
_setOption: function(key, value) {
|
||||
var menu = this.menu;
|
||||
|
||||
switch(key) {
|
||||
case 'header':
|
||||
menu.find('div.ui-multiselect-header')[value ? 'show' : 'hide']();
|
||||
break;
|
||||
case 'checkAllText':
|
||||
menu.find('a.ui-multiselect-all span').eq(-1).text(value);
|
||||
break;
|
||||
case 'uncheckAllText':
|
||||
menu.find('a.ui-multiselect-none span').eq(-1).text(value);
|
||||
break;
|
||||
case 'height':
|
||||
menu.find('ul').last().height(parseInt(value, 10));
|
||||
break;
|
||||
case 'minWidth':
|
||||
this.options[key] = parseInt(value, 10);
|
||||
this._setButtonWidth();
|
||||
this._setMenuWidth();
|
||||
break;
|
||||
case 'selectedText':
|
||||
case 'selectedList':
|
||||
case 'noneSelectedText':
|
||||
this.options[key] = value; // these all needs to update immediately for the update() call
|
||||
this.update();
|
||||
break;
|
||||
case 'classes':
|
||||
menu.add(this.button).removeClass(this.options.classes).addClass(value);
|
||||
break;
|
||||
case 'multiple':
|
||||
menu.toggleClass('ui-multiselect-single', !value);
|
||||
this.options.multiple = value;
|
||||
this.element[0].multiple = value;
|
||||
this.refresh();
|
||||
break;
|
||||
case 'position':
|
||||
this.position();
|
||||
}
|
||||
|
||||
$.Widget.prototype._setOption.apply(this, arguments);
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,265 @@
|
||||
/**
|
||||
* noty - jQuery Notification Plugin v1.2.1
|
||||
* Contributors: https://github.com/needim/noty/graphs/contributors
|
||||
*
|
||||
* Examples and Documentation - http://needim.github.com/noty/
|
||||
*
|
||||
* Licensed under the MIT licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
**/
|
||||
(function($) {
|
||||
$.noty = function(options, customContainer) {
|
||||
|
||||
var base = {};
|
||||
var $noty = null;
|
||||
var isCustom = false;
|
||||
|
||||
base.init = function(options) {
|
||||
base.options = $.extend({}, $.noty.defaultOptions, options);
|
||||
base.options.type = base.options.cssPrefix+base.options.type;
|
||||
base.options.id = base.options.type+'_'+new Date().getTime();
|
||||
base.options.layout = base.options.cssPrefix+'layout_'+base.options.layout;
|
||||
|
||||
if (base.options.custom.container) customContainer = base.options.custom.container;
|
||||
isCustom = ($.type(customContainer) === 'object') ? true : false;
|
||||
|
||||
return base.addQueue();
|
||||
};
|
||||
|
||||
// Push notification to queue
|
||||
base.addQueue = function() {
|
||||
var isGrowl = ($.inArray(base.options.layout, $.noty.growls) == -1) ? false : true;
|
||||
if (!isGrowl) (base.options.force) ? $.noty.queue.unshift({options: base.options}) : $.noty.queue.push({options: base.options});
|
||||
return base.render(isGrowl);
|
||||
};
|
||||
|
||||
// Render the noty
|
||||
base.render = function(isGrowl) {
|
||||
|
||||
// Layout spesific container settings
|
||||
var container = (isCustom) ? customContainer.addClass(base.options.theme+' '+base.options.layout+' noty_custom_container') : $('body');
|
||||
if (isGrowl) {
|
||||
if ($('ul.noty_cont.' + base.options.layout).length == 0)
|
||||
container.prepend($('<ul/>').addClass('noty_cont ' + base.options.layout));
|
||||
container = $('ul.noty_cont.' + base.options.layout);
|
||||
} else {
|
||||
if ($.noty.available) {
|
||||
var fromQueue = $.noty.queue.shift(); // Get noty from queue
|
||||
if ($.type(fromQueue) === 'object') {
|
||||
$.noty.available = false;
|
||||
base.options = fromQueue.options;
|
||||
} else {
|
||||
$.noty.available = true; // Queue is over
|
||||
return base.options.id;
|
||||
}
|
||||
} else {
|
||||
return base.options.id;
|
||||
}
|
||||
}
|
||||
base.container = container;
|
||||
|
||||
// Generating noty bar
|
||||
base.bar = $('<div class="noty_bar"/>').attr('id', base.options.id).addClass(base.options.theme+' '+base.options.layout+' '+base.options.type);
|
||||
$noty = base.bar;
|
||||
$noty.append(base.options.template).find('.noty_text').html(base.options.text);
|
||||
$noty.data('noty_options', base.options);
|
||||
|
||||
// Close button display
|
||||
(base.options.closeButton) ? $noty.addClass('noty_closable').find('.noty_close').show() : $noty.find('.noty_close').remove();
|
||||
|
||||
// Bind close event to button
|
||||
$noty.find('.noty_close').bind('click', function() { $noty.trigger('noty.close'); });
|
||||
|
||||
// If we have a button we must disable closeOnSelfClick and closeOnSelfOver option
|
||||
if (base.options.buttons) base.options.closeOnSelfClick = base.options.closeOnSelfOver = false;
|
||||
// Close on self click
|
||||
if (base.options.closeOnSelfClick) $noty.bind('click', function() { $noty.trigger('noty.close'); }).css('cursor', 'pointer');
|
||||
// Close on self mouseover
|
||||
if (base.options.closeOnSelfOver) $noty.bind('mouseover', function() { $noty.trigger('noty.close'); }).css('cursor', 'pointer');
|
||||
|
||||
// Set buttons if available
|
||||
if (base.options.buttons) {
|
||||
$buttons = $('<div/>').addClass('noty_buttons');
|
||||
$noty.find('.noty_message').append($buttons);
|
||||
$.each(base.options.buttons, function(i, button) {
|
||||
bclass = (button.type) ? button.type : 'gray';
|
||||
$button = $('<button/>').addClass(bclass).html(button.text).appendTo($noty.find('.noty_buttons'))
|
||||
.bind('click', function() {
|
||||
if ($.isFunction(button.click)) {
|
||||
button.click.call($button, $noty);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return base.show(isGrowl);
|
||||
};
|
||||
|
||||
base.show = function(isGrowl) {
|
||||
|
||||
// is Modal?
|
||||
if (base.options.modal) $('<div/>').addClass('noty_modal').addClass(base.options.theme).prependTo($('body')).fadeIn('fast');
|
||||
|
||||
$noty.close = function() { return this.trigger('noty.close'); };
|
||||
|
||||
// Prepend noty to container
|
||||
(isGrowl) ? base.container.prepend($('<li/>').append($noty)) : base.container.prepend($noty);
|
||||
|
||||
// topCenter and center specific options
|
||||
if (base.options.layout == 'noty_layout_topCenter' || base.options.layout == 'noty_layout_center') {
|
||||
$.noty.reCenter($noty);
|
||||
}
|
||||
|
||||
$noty.bind('noty.setText', function(event, text) {
|
||||
$noty.find('.noty_text').html(text);
|
||||
|
||||
if (base.options.layout == 'noty_layout_topCenter' || base.options.layout == 'noty_layout_center') {
|
||||
$.noty.reCenter($noty);
|
||||
}
|
||||
});
|
||||
|
||||
$noty.bind('noty.setType', function(event, type) {
|
||||
$noty.removeClass($noty.data('noty_options').type);
|
||||
|
||||
type = $noty.data('noty_options').cssPrefix+type;
|
||||
|
||||
$noty.data('noty_options').type = type;
|
||||
|
||||
$noty.addClass(type);
|
||||
|
||||
if (base.options.layout == 'noty_layout_topCenter' || base.options.layout == 'noty_layout_center') {
|
||||
$.noty.reCenter($noty);
|
||||
}
|
||||
});
|
||||
|
||||
$noty.bind('noty.getId', function(event) {
|
||||
return $noty.data('noty_options').id;
|
||||
});
|
||||
|
||||
// Bind close event
|
||||
$noty.one('noty.close', function(event) {
|
||||
var options = $noty.data('noty_options');
|
||||
if(options.onClose){options.onClose();}
|
||||
|
||||
// Modal Cleaning
|
||||
if (options.modal) $('.noty_modal').fadeOut('fast', function() { $(this).remove(); });
|
||||
|
||||
$noty.clearQueue().stop().animate(
|
||||
$noty.data('noty_options').animateClose,
|
||||
$noty.data('noty_options').speed,
|
||||
$noty.data('noty_options').easing,
|
||||
$noty.data('noty_options').onClosed)
|
||||
.promise().done(function() {
|
||||
|
||||
// Layout spesific cleaning
|
||||
if ($.inArray($noty.data('noty_options').layout, $.noty.growls) > -1) {
|
||||
$noty.parent().remove();
|
||||
} else {
|
||||
$noty.remove();
|
||||
|
||||
// queue render
|
||||
$.noty.available = true;
|
||||
base.render(false);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// Start the show
|
||||
if(base.options.onShow){base.options.onShow();}
|
||||
$noty.animate(base.options.animateOpen, base.options.speed, base.options.easing, base.options.onShown);
|
||||
|
||||
// If noty is have a timeout option
|
||||
if (base.options.timeout) $noty.delay(base.options.timeout).promise().done(function() { $noty.trigger('noty.close'); });
|
||||
return base.options.id;
|
||||
};
|
||||
|
||||
// Run initializer
|
||||
return base.init(options);
|
||||
};
|
||||
|
||||
// API
|
||||
$.noty.get = function(id) { return $('#'+id); };
|
||||
$.noty.close = function(id) {
|
||||
//remove from queue if not already visible
|
||||
for(var i=0;i<$.noty.queue.length;) {
|
||||
if($.noty.queue[i].options.id==id)
|
||||
$.noty.queue.splice(id,1);
|
||||
else
|
||||
i++;
|
||||
}
|
||||
//close if already visible
|
||||
$.noty.get(id).trigger('noty.close');
|
||||
};
|
||||
$.noty.setText = function(id, text) {
|
||||
$.noty.get(id).trigger('noty.setText', text);
|
||||
};
|
||||
$.noty.setType = function(id, type) {
|
||||
$.noty.get(id).trigger('noty.setType', type);
|
||||
};
|
||||
$.noty.closeAll = function() {
|
||||
$.noty.clearQueue();
|
||||
$('.noty_bar').trigger('noty.close');
|
||||
};
|
||||
$.noty.reCenter = function(noty) {
|
||||
noty.css({'left': ($(window).width() - noty.outerWidth()) / 2 + 'px'});
|
||||
};
|
||||
$.noty.clearQueue = function() {
|
||||
$.noty.queue = [];
|
||||
};
|
||||
|
||||
var windowAlert = window.alert;
|
||||
$.noty.consumeAlert = function(options){
|
||||
window.alert = function(text){
|
||||
if(options){options.text = text;}
|
||||
else{options = {text:text};}
|
||||
$.noty(options);
|
||||
};
|
||||
}
|
||||
$.noty.stopConsumeAlert = function(){
|
||||
window.alert = windowAlert;
|
||||
}
|
||||
|
||||
$.noty.queue = [];
|
||||
$.noty.growls = ['noty_layout_topLeft', 'noty_layout_topRight', 'noty_layout_bottomLeft', 'noty_layout_bottomRight'];
|
||||
$.noty.available = true;
|
||||
$.noty.defaultOptions = {
|
||||
layout: 'top',
|
||||
theme: 'noty_theme_default',
|
||||
animateOpen: {height: 'toggle'},
|
||||
animateClose: {height: 'toggle'},
|
||||
easing: 'swing',
|
||||
text: '',
|
||||
type: 'alert',
|
||||
speed: 500,
|
||||
timeout: 5000,
|
||||
closeButton: false,
|
||||
closeOnSelfClick: true,
|
||||
closeOnSelfOver: false,
|
||||
force: false,
|
||||
onShow: false,
|
||||
onShown: false,
|
||||
onClose: false,
|
||||
onClosed: false,
|
||||
buttons: false,
|
||||
modal: false,
|
||||
template: '<div class="noty_message"><span class="noty_text"></span><div class="noty_close"></div></div>',
|
||||
cssPrefix: 'noty_',
|
||||
custom: {
|
||||
container: null
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.noty = function(options) {
|
||||
return this.each(function() {
|
||||
(new $.noty(options, $(this)));
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
//Helper
|
||||
function noty(options) {
|
||||
return jQuery.noty(options); // returns an id
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* jQuery Generic Plugin Module
|
||||
* Version 0.1
|
||||
* Copyright (c) 2011 Cyntax Technologies - http://cyntaxtech.com
|
||||
* Licensed under the Cyntax Open Technology License
|
||||
* http://code.cyntax.com/licenses/cyntax-open-technology
|
||||
*/
|
||||
|
||||
(function(a){a.jQueryPlugin=function(b){a.fn[b]=function(c){var d=Array.prototype.slice.call(arguments,1);if(this.length){return this.each(function(){var e=a.data(this,b)||a.data(this,b,(new cyntax.plugins[b](this,c))._init());if(typeof c==="string"){c=c.replace(/^_/,"");if(e[c]){e[c].apply(e,d)}}})}}}})(jQuery);var cyntax={plugins:{}}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
Sleep by Mark Hughes (AKA huzi8t9)
|
||||
http://www.360Gamer.net/
|
||||
|
||||
Usage:
|
||||
$.sleep ( 3, function()
|
||||
{
|
||||
alert ( "I slept for 3 seconds!" );
|
||||
});
|
||||
Use at free will, distribute free of charge
|
||||
*/
|
||||
|
||||
;(function(jQuery)
|
||||
{
|
||||
var _sleeptimer;
|
||||
jQuery.sleep = function( time2sleep, callback )
|
||||
{
|
||||
jQuery.sleep._sleeptimer = time2sleep;
|
||||
jQuery.sleep._cback = callback;
|
||||
jQuery.sleep.timer = setInterval('jQuery.sleep.count()', 1000);
|
||||
}
|
||||
jQuery.extend (jQuery.sleep, {
|
||||
current_i : 1,
|
||||
_sleeptimer : 0,
|
||||
_cback : null,
|
||||
timer : null,
|
||||
count : function()
|
||||
{
|
||||
if ( jQuery.sleep.current_i === jQuery.sleep._sleeptimer )
|
||||
{
|
||||
clearInterval(jQuery.sleep.timer);
|
||||
jQuery.sleep._cback.call(this);
|
||||
}
|
||||
jQuery.sleep.current_i++;
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
14
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery.timer.min.js
vendored
Normal file
14
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/jquery.timer.min.js
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* jQuery Timer Plugin
|
||||
* Project page - http://code.cyntaxtech.com/plugins/jquery-timer
|
||||
* Version 0.1.1
|
||||
* Copyright (c) 2011 Cyntax Technologies - http://cyntaxtech.com
|
||||
* dependencies: jquery.plugin.js
|
||||
* Licensed under the Cyntax Open Technology License
|
||||
* http://code.cyntax.com/licenses/cyntax-open-technology
|
||||
* ------------------------------------
|
||||
* For details, please visit:
|
||||
* http://code.cyntaxtech.com/plugins/jquery-timer
|
||||
*/
|
||||
|
||||
(function(a){cyntax.plugins.timer=function(b,c){this.$this=a(b);this.options=a.extend({},this.defaults,c);this.timer_info={id:null,index:null,state:0}};cyntax.plugins.timer.prototype={defaults:{delay:1e3,repeat:false,autostart:true,callback:null,url:"",post:""},_init:function(){if(this.options.autostart){this.timer_info.state=1;this.timer_info.id=setTimeout(a.proxy(this._timer_fn,this),this.options.delay)}return this},_timer_fn:function(){if(typeof this.options.callback=="function")a.proxy(this.options.callback,this.$this).call(this,++this.timer_info.index);else if(typeof this.options.url=="string"){ajax_options={url:this.options.url,context:this,type:typeof this.options.post=="string"&&typeof this.options.post!=""==""?"POST":"GET",success:function(a,b,c){this.$this.html(a)}};if(typeof this.options.post=="string"&&typeof this.options.post!="")ajax_options.data=this.options.post;a.ajax(ajax_options)}if(this.options.repeat&&this.timer_info.state==1&&(typeof this.options.repeat=="boolean"||parseInt(this.options.repeat)>this.timer_info.index))this.timer_info.id=setTimeout(a.proxy(this._timer_fn,this),this.options.delay);else this.timer_id=null},start:function(){if(this.timer_info.state==0){this.timer_info.index=0;this.timer_info.state=1;this.timer_id=setTimeout(a.proxy(this._timer_fn,this),this.options.delay)}},stop:function(){if(this.timer_info.state==1&&this.timer_info.id){clearTimeout(this.timer_info.id);this.timer_id=null}this.timer_info.state=0},pause:function(){if(this.timer_info.state==1&&this.timer_info.id)clearTimeout(this.timer_info.id);this.timer_info.state=0},resume:function(){this.timer_info.state=1;this.timer_id=setTimeout(a.proxy(this._timer_fn,this),this.options.delay)}};a.jQueryPlugin("timer")})(jQuery)
|
||||
@@ -0,0 +1,2 @@
|
||||
/*! waitForImages jQuery Plugin 2013-07-20 */
|
||||
!function(a){var b="waitForImages";a.waitForImages={hasImageProperties:["backgroundImage","listStyleImage","borderImage","borderCornerImage","cursor"]},a.expr[":"].uncached=function(b){if(!a(b).is('img[src!=""]'))return!1;var c=new Image;return c.src=b.src,!c.complete},a.fn.waitForImages=function(c,d,e){var f=0,g=0;if(a.isPlainObject(arguments[0])&&(e=arguments[0].waitForAll,d=arguments[0].each,c=arguments[0].finished),c=c||a.noop,d=d||a.noop,e=!!e,!a.isFunction(c)||!a.isFunction(d))throw new TypeError("An invalid callback was supplied.");return this.each(function(){var h=a(this),i=[],j=a.waitForImages.hasImageProperties||[],k=/url\(\s*(['"]?)(.*?)\1\s*\)/g;e?h.find("*").addBack().each(function(){var b=a(this);b.is("img:uncached")&&i.push({src:b.attr("src"),element:b[0]}),a.each(j,function(a,c){var d,e=b.css(c);if(!e)return!0;for(;d=k.exec(e);)i.push({src:d[2],element:b[0]})})}):h.find("img:uncached").each(function(){i.push({src:this.src,element:this})}),f=i.length,g=0,0===f&&c.call(h[0]),a.each(i,function(e,i){var j=new Image;a(j).on("load."+b+" error."+b,function(a){return g++,d.call(i.element,g,f,"load"==a.type),g==f?(c.call(h[0]),!1):void 0}),j.src=i.src})})}}(jQuery);
|
||||
7
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/raphael-min.js
vendored
Normal file
7
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/raphael-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* Drag and drop for Raphael elements.
|
||||
*
|
||||
* Original Author: Gabe Hollombe. Rewritten several times over by Clifford Heath.
|
||||
* (c) Copyright. Subject to MIT License.
|
||||
*
|
||||
* You need to include jquery and Raphael first.
|
||||
*
|
||||
* When you call draggable() on any Raphael object, it becomes a handle that can start a drag.
|
||||
* A mousedown on the handle followed by enough motion causes a drag to start.
|
||||
*
|
||||
* The dragged object may be the handle itself, another object defined in the options to
|
||||
* draggable(), or an object returned from the handle's dragStart method (if defined).
|
||||
*
|
||||
* The drag proceeds by calling drag_obj.dragUpdate for each mouse motion, see below.
|
||||
* If no dragUpdate is defined, a Raphael translate() is used to provide simple motion.
|
||||
*
|
||||
* If the Escape key is pressed during the drag, the motion is reverted and the drag stops.
|
||||
* In this case, dragCancel will be called, see below.
|
||||
*
|
||||
* When a drag finished normally, dragFinish is called as defined below.
|
||||
*
|
||||
* Options:
|
||||
* drag_obj
|
||||
* A click on the handle will start a drag on this object.
|
||||
* Otherwise handle will be dragged, unless handle.dragStart()
|
||||
* returns a different draggable object.
|
||||
* right_button
|
||||
* unset means drag using either button, otherwise false/true means left/right only.
|
||||
* reluctance
|
||||
* Number of pixels of motion before a drag starts (default 3).
|
||||
*
|
||||
* Optional method on handle. The events are passed so you can see the modifier keys.
|
||||
* dragStart(x, y, mousedownevent, mousemoveevent)
|
||||
* called (after reluctance) with the mousedown event and canvas location.
|
||||
* Must return the object to drag. Good place to call toFront so the drag_obj doesn't hide.
|
||||
*
|
||||
* Optional methods on drag_obj. The event is passed so you can see the modifier keys.
|
||||
* dragUpdate(dragging_over, dx, dy, event)
|
||||
* dragging_over: the object under the cursor (after hiding drag_obj)
|
||||
* dx,dy: the number of units of motion
|
||||
* event: the mousemotion event
|
||||
* dragFinish(dropped_on, x, y, event)
|
||||
* dropped_on: the object under the cursor (after hiding drag_obj)
|
||||
* x,y: the page location
|
||||
* event: the mouseup event
|
||||
* dragCancel()
|
||||
* called if the drag is cancelled
|
||||
*/
|
||||
|
||||
Raphael.el.draggable = function(options) {
|
||||
var handle = this; // The object you click on
|
||||
if (!options) options = {};
|
||||
// If you define drag_obj to be null, you must provide a dragStart that returns one:
|
||||
var drag_obj = typeof options.drag_obj !== 'undefined' ? options.drag_obj : handle;
|
||||
|
||||
// Set right_button to true for right-click dragging only, to false for left-click only. Otherwise you get both.
|
||||
var right_button = options.right_button;
|
||||
|
||||
// Check that this is an ok thing to even think about doing
|
||||
if (!(handle.node && handle.node.raphael)) {
|
||||
alert(handle+' is not a Raphael object so you can\'t make it draggable');
|
||||
return;
|
||||
}
|
||||
if (drag_obj && !(drag_obj.node && drag_obj.node.raphael)) {
|
||||
alert(drag_obj+' is not a Raphael object so you can\'t make it draggable');
|
||||
return;
|
||||
}
|
||||
|
||||
// options.reluctance is the number of pixels of motion before a drag will start:
|
||||
var reluctance = options.reluctance;
|
||||
if (typeof reluctance == 'undefined') reluctance = 3;
|
||||
|
||||
var skip_click;
|
||||
var mousedown = function(event) {
|
||||
if (typeof right_button != 'undefined' && (right_button === false) === (event.button > 1))
|
||||
return true;
|
||||
|
||||
skip_click = false; // Used to skip a click after dragging
|
||||
var started = false; // Has the drag started?
|
||||
var start_event = event; // The starting mousedown
|
||||
var last_x = event.pageX, last_y = event.pageY; // Where did we move from last?
|
||||
|
||||
// Figure out what object (other than drag_obj) is under the pointer
|
||||
var over = function(event) {
|
||||
var paper = handle.paper || drag_obj.paper;
|
||||
if (!paper) return null; // Something was deleted
|
||||
if (drag_obj) drag_obj.hide();
|
||||
// Unfortunately Opera's elementFromPoint seems to be hopelessly broken in SVG
|
||||
var dragging_over = document.elementFromPoint(event.pageX, event.pageY);
|
||||
if (drag_obj) drag_obj.show();
|
||||
if (!dragging_over)
|
||||
return null;
|
||||
if (dragging_over.nodeType == 3)
|
||||
return dragging_over.parentNode; // Safari/Opera
|
||||
if (dragging_over.tagName != 'svg' && dragging_over == paper.canvas.parentNode)
|
||||
return paper.canvas; // Safari
|
||||
if (dragging_over == paper.canvas)
|
||||
return dragging_over;
|
||||
if (!dragging_over.raphael)
|
||||
return dragging_over.parentNode; // A tspan inside a Raphael text object perhaps?
|
||||
return dragging_over;
|
||||
};
|
||||
|
||||
var mousemove = function(event) {
|
||||
var delta_x = event.pageX-last_x;
|
||||
var delta_y = event.pageY-last_y;
|
||||
|
||||
if (!started && (delta_x>reluctance || delta_x<-reluctance || delta_y>reluctance || delta_y<-reluctance)) {
|
||||
if (handle.dragStart) {
|
||||
var position = jQuery.browser.opera ? jQuery(handle.paper.canvas.parentNode).offset() : jQuery(handle.paper.canvas).offset();
|
||||
|
||||
var o = handle.dragStart(event.pageX-delta_x-position.left, event.pageY-delta_y-position.top, start_event, event);
|
||||
if (!o) return false; // Don't start the drag yet if told not to
|
||||
drag_obj = o;
|
||||
}
|
||||
started = true;
|
||||
skip_click = true;
|
||||
}
|
||||
if (!started || !drag_obj) return false;
|
||||
|
||||
var dragging_over = over(event);
|
||||
// console.log("Move "+drag_obj.node.id+" over "+dragging_over.id+" to X="+event.pageX+", Y="+event.pageY);
|
||||
var update = drag_obj.dragUpdate ? drag_obj.dragUpdate : function(o, dx, dy, e) { drag_obj.translate(dx, dy); };
|
||||
update(dragging_over, delta_x, delta_y, event);
|
||||
last_x = event.pageX;
|
||||
last_y = event.pageY;
|
||||
return false;
|
||||
};
|
||||
|
||||
if (reluctance == 0 && handle.dragStart) {
|
||||
var o = handle.dragStart(0, 0, event, event);
|
||||
if (!o) return false;
|
||||
drag_obj = o;
|
||||
started = true;
|
||||
skip_click = true;
|
||||
}
|
||||
|
||||
var revert;
|
||||
var cancel;
|
||||
|
||||
// Process keyboard input so we can cancel
|
||||
var keydown = function(event) {
|
||||
if (event.keyCode == 27) { // Escape
|
||||
revert(event);
|
||||
if (drag_obj.dragCancel)
|
||||
drag_obj.dragCancel();
|
||||
cancel();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
// Revert to starting location
|
||||
revert = function(event) {
|
||||
if (!started) return;
|
||||
if (drag_obj && drag_obj.dragUpdate)
|
||||
drag_obj.dragUpdate(null, start_event.pageX-last_x, start_event.pageY-last_y, event);
|
||||
started = false; // Sometimes get the same event twice.
|
||||
};
|
||||
|
||||
// The drag has ended, deal with it.
|
||||
var mouseup = function(event) {
|
||||
if (started) {
|
||||
var dropped_on = over(event);
|
||||
if (drag_obj && drag_obj.dragFinish) {
|
||||
var position = jQuery.browser.opera ? jQuery(handle.paper.canvas.parentNode).offset() : jQuery(handle.paper.canvas).offset();
|
||||
|
||||
drag_obj.dragFinish(dropped_on, event.pageX-position.left, event.pageY-position.top, event);
|
||||
}
|
||||
cancel();
|
||||
return true; // Don't let it bubble
|
||||
}
|
||||
cancel();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Undo event bindings after the drag
|
||||
handle.originalDraggableNode = handle.node;
|
||||
cancel = function() {
|
||||
jQuery(handle.node).unbind('mouseup', mouseup);
|
||||
jQuery(handle.node).unbind('mousemove', mousemove);
|
||||
jQuery(handle.node).unbind('keydown', keydown);
|
||||
if (jQuery.browser.msie) {
|
||||
// Rebind the mousedown if it got lost when the node was recreated:
|
||||
if (handle.originalDraggableNode != handle.node)
|
||||
jQuery(handle.node).bind('mousedown', mousedown);
|
||||
handle.originalDraggableNode = handle.node;
|
||||
}
|
||||
|
||||
started = false;
|
||||
};
|
||||
|
||||
// Bind the appropriate events for the duration of the drag:
|
||||
jQuery(handle.node).bind('keydown', keydown);
|
||||
jQuery(handle.node).bind('mousemove', mousemove);
|
||||
jQuery(handle.node).bind('mouseup', mouseup);
|
||||
|
||||
event.stopImmediatePropagation(); // Ensure that whatever drag we start, there's only one!
|
||||
return false;
|
||||
};
|
||||
var click = function(event) {
|
||||
if (skip_click)
|
||||
event.stopImmediatePropagation();
|
||||
skip_click = false; // Used to skip a click after dragging
|
||||
return true;
|
||||
};
|
||||
jQuery(handle.node).bind('mousedown', mousedown);
|
||||
jQuery(handle.node).bind('click', click); // Bind click now so that we can stop other click handlers
|
||||
};
|
||||
@@ -0,0 +1,215 @@
|
||||
(function($) {
|
||||
$.fn.extend({
|
||||
strackbar: function(options) {
|
||||
var settings = $.extend({
|
||||
style: 'style1',
|
||||
defaultValue: 0,
|
||||
sliderHeight: 4,
|
||||
sliderWidth: 200,
|
||||
trackerHeight: 20,
|
||||
trackerWidth: 19,
|
||||
minValue: 0,
|
||||
maxValue: 10,
|
||||
borderWidth: 1,
|
||||
animate: true,
|
||||
ticks: true,
|
||||
labels: true,
|
||||
callback: null
|
||||
}, options);
|
||||
return this.each(function() {
|
||||
var mousecaptured = false;
|
||||
var mouseDown = false;
|
||||
var previousMousePosition = 0;
|
||||
var stepValue = parseFloat(settings.sliderWidth / settings.maxValue);
|
||||
var currentValue = settings.minValue;
|
||||
var sliderLeft = 0;
|
||||
var sliderRight = 0;
|
||||
var ltop = 0;
|
||||
var element = $(this);
|
||||
var minvallabel = $('<div></div>').attr('id', 'min-val').css('float', 'left');
|
||||
var maxvallabel = $('<div></div>').attr('id', 'max-val').css('float', 'left');
|
||||
var wrapper = $('<div></div>').css('float', 'left');
|
||||
var contents = $('<div></div>').attr('id', 'jscroll').addClass('jscroller');
|
||||
var slider = $('<div></div>').attr('id', 'slider').addClass('slider');
|
||||
var selection = $('<div></div>').attr('id', 'inner').html(' ').addClass('inner');
|
||||
var ltracker = $('<div></div>').attr('id', 'lgripper').addClass('lgripper');
|
||||
if (settings.labels)
|
||||
element.append(minvallabel);
|
||||
element.append(wrapper);
|
||||
wrapper.append(contents);
|
||||
contents.append(slider);
|
||||
slider.append(selection);
|
||||
contents.append(ltracker);
|
||||
if (settings.labels)
|
||||
element.append(maxvallabel);
|
||||
|
||||
ltracker.css('height', settings.trackerHeight + 'px').css('width', settings.trackerWidth + 'px').css('left', '0');
|
||||
slider.css('width', settings.sliderWidth - (settings.borderWidth * 2)).css('height', settings.sliderHeight);
|
||||
slider.css('-moz-border-radius', (settings.sliderHeight) + 'px');
|
||||
slider.css('-webkit-border-radius', (settings.sliderHeight) + 'px');
|
||||
slider.css('border-radius', (settings.sliderHeight) + 'px');
|
||||
slider.css('top', '40%');
|
||||
selection.css('-moz-border-radius', (settings.sliderHeight) + 'px');
|
||||
selection.css('-webkit-border-radius', (settings.sliderHeight) + 'px');
|
||||
selection.css('border-radius', (settings.sliderHeight) + 'px');
|
||||
slider.addClass(settings.style);
|
||||
selection.addClass(settings.style);
|
||||
ltracker.addClass(settings.style);
|
||||
contents.addClass(settings.style);
|
||||
|
||||
//element.css('padding-top', settings.trackerHeight / 2);
|
||||
var clear = $('<div></div>');
|
||||
clear.css('clear', 'both');
|
||||
element.append(clear);
|
||||
wrapper.css('width', settings.sliderWidth + 'px');
|
||||
//maxvallabel.html(settings.maxValue).css('margin-top', -(settings.trackerHeight / 4) + 'px').css('padding-left', '6px');
|
||||
//minvallabel.html(settings.minValue).css('margin-top', -(settings.trackerHeight / 4) + 'px').css('padding-right', '4px');
|
||||
maxvallabel.html(settings.maxValue).css('padding-left', '6px'); //.css('margin-top', '-2px');
|
||||
minvallabel.html(settings.minValue).css('padding-right', '4px'); //.css('margin-top', '-2px');
|
||||
var sliderBottom = settings.sliderHeight;
|
||||
sliderLeft = slider.offset().left;
|
||||
sliderRight = sliderLeft + settings.sliderWidth;
|
||||
ltop = (settings.trackerHeight / 2) - settings.sliderHeight / 2;
|
||||
previousMousePosition = sliderLeft;
|
||||
|
||||
/*generates tick marks */
|
||||
var ticks = $("<ul></ul>");
|
||||
ticks.css('position', 'absolute');
|
||||
var height = slider.get(0).offsetHeight - 4;
|
||||
//var height = settings.sliderHeight;
|
||||
var sliderBorder = slider.get(0).offsetHeight - settings.sliderHeight;
|
||||
ltop -= sliderBorder / 2;
|
||||
ticks.css('top', height + 'px')
|
||||
ticks.attr('id', 'ticks');
|
||||
ticks.addClass('ticks');
|
||||
ticks.css('width', settings.sliderWidth + 'px');
|
||||
ticks.css('margin-left', stepValue / 2 + 'px');
|
||||
ticks.css('margin-top', '0px');
|
||||
var totalTicks = settings.sliderWidth / stepValue;
|
||||
|
||||
for (var count = 0; count < totalTicks; count++) {
|
||||
var tick = $('<li><span>|</span></li>');
|
||||
tick.css('width', stepValue + 'px');
|
||||
ticks.append(tick);
|
||||
}
|
||||
if (settings.ticks)
|
||||
slider.after(ticks);
|
||||
ltracker.css('top', -ltop + 'px');
|
||||
//set the default position
|
||||
if (settings.defaultValue != 0) {
|
||||
setPosition(settings.defaultValue * stepValue);
|
||||
previousMousePosition = sliderLeft + settings.defaultValue * stepValue;
|
||||
if (settings.callback != null)
|
||||
settings.callback(settings.defaultValue);
|
||||
}
|
||||
ltracker.mousedown(function(e) {
|
||||
mousecaptured = true;
|
||||
previousMousePosition = e.pageX;
|
||||
$(this).css('cursor', 'pointer');
|
||||
});
|
||||
|
||||
ltracker.mouseup(function(e) {
|
||||
mousecaptured = false;
|
||||
$(this).css('cursor', 'default');
|
||||
});
|
||||
|
||||
$(document).mouseup(function() {
|
||||
mousecaptured = false;
|
||||
$(this).css('cursor', 'default');
|
||||
});
|
||||
$(document).mousemove(function(e) {
|
||||
if (mousecaptured) {
|
||||
setTrackerPosition(e.pageX);
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
});
|
||||
slider.mouseenter(function(e) { $(this).css('cursor', 'pointer'); });
|
||||
slider.mouseout(function(e) { $(this).css('cursor', 'default'); });
|
||||
slider.mousedown(function(e) {
|
||||
if (!mouseDown) {
|
||||
mouseDown = true;
|
||||
$(this).css('cursor', 'pointer');
|
||||
mousecaptured = false;
|
||||
setTrackerPosition(e.pageX);
|
||||
}
|
||||
});
|
||||
|
||||
function getpositionvalue(pos) {
|
||||
var val = parseInt(pos.replace('px', ''));
|
||||
return val;
|
||||
}
|
||||
function getDragAmount(cursorCurrentPosition, cursorPreviousPosition) {
|
||||
var dragAmount = cursorCurrentPosition - cursorPreviousPosition;
|
||||
if (cursorPreviousPosition <= 0) {
|
||||
dragAmount = cursorCurrentPosition - sliderLeft;
|
||||
previousMousePosition = sliderLeft + dragAmount;
|
||||
}
|
||||
if (cursorPreviousPosition > cursorCurrentPosition)
|
||||
dragAmount = cursorPreviousPosition - cursorCurrentPosition;
|
||||
|
||||
return dragAmount;
|
||||
}
|
||||
function isForwardDirection(cursorCurrentPosition, cursorPreviousPosition) {
|
||||
if (cursorCurrentPosition > cursorPreviousPosition)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
function validatePosition(position) {
|
||||
if (position >= 0 && position <= settings.sliderWidth)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
function setPosition(position) {
|
||||
|
||||
if (validatePosition(position)) {
|
||||
var selectionWidth = getpositionvalue(ltracker.css('left')) + settings.trackerWidth / 2;
|
||||
if (settings.animate && !mousecaptured) {
|
||||
ltracker.animate({ 'left': position + 'px' }, 500, function() {
|
||||
selectionWidth = getpositionvalue(ltracker.css('left')) + settings.trackerWidth / 2;
|
||||
selection.css('width', selectionWidth + 'px');
|
||||
mouseDown = false;
|
||||
});
|
||||
/*settings.animate = false;*/
|
||||
}
|
||||
else {
|
||||
ltracker.css('left', position + 'px');
|
||||
selectionWidth = getpositionvalue(ltracker.css('left')) + settings.trackerWidth / 2;
|
||||
selection.css('width', selectionWidth + 'px');
|
||||
mouseDown = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
function setTrackerPosition(cursorPosition) {
|
||||
var dragAmount = getDragAmount(cursorPosition, previousMousePosition);
|
||||
var isForward = isForwardDirection(cursorPosition, previousMousePosition);
|
||||
|
||||
var trackerPosition = getpositionvalue(ltracker.css('left'));
|
||||
if (cursorPosition >= sliderLeft && cursorPosition <= (sliderRight - stepValue / 10)) {
|
||||
if (trackerPosition >= 0 && trackerPosition <= settings.sliderWidth - stepValue / 10) {
|
||||
if (isForward)
|
||||
trackerPosition += dragAmount;
|
||||
else
|
||||
trackerPosition -= dragAmount;
|
||||
setPosition(trackerPosition);
|
||||
|
||||
var newPosition = cursorPosition - sliderLeft;
|
||||
var cVal = newPosition / stepValue;
|
||||
currentValue = parseInt(cVal);
|
||||
if (trackerPosition > (settings.sliderWidth - stepValue) + stepValue / 10) {
|
||||
currentValue = parseInt(settings.sliderWidth / stepValue);
|
||||
}
|
||||
if (settings.callback != null)
|
||||
settings.callback(currentValue);
|
||||
}
|
||||
previousMousePosition = cursorPosition;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
1
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/ui.panel.min.js
vendored
Normal file
1
dcm4chee/default/tmp/deploy/tmp7473912347174030350oviyam2-exp.war/js/lib/ui.panel.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,393 @@
|
||||
/**
|
||||
* @namespace shape
|
||||
*/
|
||||
ovm.shape = ovm.shape || {};
|
||||
|
||||
/**
|
||||
* Definition of shape Lines
|
||||
*/
|
||||
ovm.shape.ruler = function(xPixelSpacing,yPixelSpacing,measure_Unit) {
|
||||
var handle = 5;
|
||||
var lines = [];
|
||||
var curr_line=null;
|
||||
|
||||
var xPxlSpcing = xPixelSpacing;
|
||||
var yPxlSpcing = yPixelSpacing;
|
||||
var measureUnit = measure_Unit;
|
||||
var isCurrentDrawingLine = false;
|
||||
|
||||
this.createNewLine = function(x1,y1,x2,y2) {
|
||||
if(curr_line!=undefined) {
|
||||
curr_line.setCoords(x1,y1,x2,y2,false);
|
||||
if(parseInt(curr_line.len)>0) {
|
||||
lines.push(curr_line);
|
||||
curr_line = undefined;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.initNewLine = function() {
|
||||
curr_line = new ovm.line(xPxlSpcing, yPxlSpcing,measureUnit, 0, 0, 0, 0, 0);
|
||||
};
|
||||
|
||||
this.draw = function(graphic,ctx) {
|
||||
ctx.strokeStyle=ctx.fillStyle='orange';
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(graphic.x1,graphic.y1);
|
||||
ctx.lineTo(graphic.x2,graphic.y2);
|
||||
ctx.stroke();
|
||||
ctx.closePath();
|
||||
// Handles
|
||||
ctx.strokeStyle = ctx.fillStyle = graphic.active? 'red' : 'white';
|
||||
ctx.strokeRect(graphic.x1-handle,graphic.y1-handle,handle*2,handle*2);
|
||||
ctx.strokeRect(graphic.x2-handle,graphic.y2-handle,handle*2,handle*2);
|
||||
// Text
|
||||
ctx.fillStyle = graphic.txtActive? "blue" : "maroon";
|
||||
ctx.globalAlpha = 0.7;
|
||||
ctx.font = "14px Arial";
|
||||
var text = ctx.measureText(graphic.len + " " + measureUnit);
|
||||
ctx.fillRect(graphic.textX,graphic.textY,Math.ceil(text.width)+5,20);
|
||||
ctx.globalAlpha = 0.9;
|
||||
ctx.fillStyle = "white";
|
||||
//ctx.fillText(graphic.len+" " + measureUnit,graphic.textX+2,graphic.textY+14);
|
||||
|
||||
if(state.hflip && !state.vflip && !state.rotate!=0 && !this.isCurrentDrawingLine){
|
||||
ctx.save();
|
||||
ctx.translate(drawCanvas.width,0);
|
||||
ctx.scale(-1,1);
|
||||
ctx.fillText(graphic.len+ " " + measureUnit,(drawCanvas.width - graphic.textX)-60,graphic.textY+14);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
if(state.vflip && !state.hflip && !state.rotate!=0 && !this.isCurrentDrawingLine){
|
||||
ctx.save();
|
||||
ctx.translate(0,drawCanvas.height);
|
||||
ctx.scale(1,-1);
|
||||
ctx.fillText(graphic.len+ " " + measureUnit, graphic.textX,(drawCanvas.height -graphic.textY));
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
if(!state.vflip && state.hflip && (state.rotate===90 || state.rotate===180 || state.rotate===270) && !this.isCurrentDrawingLine){
|
||||
if(state.rotate===90|| state.rotate===180 || state.rotate===270) {
|
||||
ctx.save();
|
||||
ctx.translate(0,drawCanvas.height);
|
||||
ctx.scale(1,-1);
|
||||
ctx.fillText(graphic.len+ " " + measureUnit, graphic.textX,(drawCanvas.height -graphic.textY));
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
if(state.vflip && !state.hflip && (state.rotate===90 || state.rotate===180 || state.rotate===270) && !this.isCurrentDrawingLine){
|
||||
if(state.rotate===90 || state.rotate===180 || state.rotate===270) {
|
||||
ctx.save();
|
||||
ctx.translate(drawCanvas.width,0);
|
||||
ctx.scale(-1,1);
|
||||
ctx.fillText(graphic.len+ " " + measureUnit,(drawCanvas.width - graphic.textX)-60,graphic.textY+14);
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
if(state.rotate!=0 && !state.vflip && !state.hflip && !this.isCurrentDrawingLine) {
|
||||
if(state.rotate===180) {
|
||||
ctx.save();
|
||||
ctx.translate(drawCanvas.width/2,drawCanvas.height/2);
|
||||
ctx.rotate(Math.PI);
|
||||
ctx.translate(-drawCanvas.width/2,-drawCanvas.height/2);
|
||||
ctx.fillText(graphic.len+ " " + measureUnit, (drawCanvas.width -graphic.textX)-60,(drawCanvas.height -graphic.textY));
|
||||
ctx.restore();
|
||||
}
|
||||
else {
|
||||
ctx.fillText(graphic.len+ " " + measureUnit,graphic.textX+2,graphic.textY+14);
|
||||
}
|
||||
}
|
||||
|
||||
if((state.rotate===0 || state.rotate===90 || state.rotate===180 || state.rotate===270) && state.vflip && state.hflip && !this.isCurrentDrawingLine) {
|
||||
if(state.rotate===0) {
|
||||
ctx.save();
|
||||
ctx.translate(drawCanvas.width,drawCanvas.height);
|
||||
ctx.scale(-1,-1);
|
||||
ctx.fillText(graphic.len+ " " + measureUnit, (drawCanvas.width -graphic.textX)-60,(drawCanvas.height -graphic.textY));
|
||||
ctx.restore();
|
||||
} else {
|
||||
ctx.fillText(graphic.len+ " " + measureUnit,graphic.textX+2,graphic.textY+14);
|
||||
}
|
||||
}
|
||||
|
||||
if(!state.hflip && !state.vflip && !state.rotate!=0) {
|
||||
ctx.fillText(graphic.len+ " " + measureUnit,graphic.textX+2,graphic.textY+14);
|
||||
}
|
||||
|
||||
if(this.isCurrentDrawingLine) {
|
||||
ctx.fillText(graphic.len+ " " + measureUnit, graphic.textX+2,graphic.textY+14);
|
||||
}
|
||||
|
||||
|
||||
// Reference lines
|
||||
if(graphic.x1!=graphic.textX) {
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.globalAlpha = 0.5;
|
||||
ctx.strokeStyle = "yellow";
|
||||
ctx.setLineDash([10,7]);
|
||||
var closestPt = this.getClosestAnchor([{x:graphic.textX,y:graphic.textY},{x:graphic.textX+Math.ceil(text.width+5),y:graphic.textY},{x:graphic.textX,y:graphic.textY+20},{x:graphic.textX+Math.ceil(text.width+5),y:graphic.textY+20}],{x:graphic.refX,y:graphic.refY});
|
||||
ctx.moveTo(closestPt.x, closestPt.y);
|
||||
ctx.lineTo(graphic.refX,graphic.refY);
|
||||
ctx.stroke();
|
||||
ctx.closePath();
|
||||
ctx.restore();
|
||||
}
|
||||
};
|
||||
|
||||
this.drawData = function(ctx) {
|
||||
ctx.save();
|
||||
ctx.lineWidth='2';
|
||||
|
||||
for(var i=0;i<lines.length;i++) {
|
||||
this.draw(this.viewPortGraphic(lines[i]),ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
};
|
||||
|
||||
this.drawRuler = function(canvasCtx,x1,y1,x2,y2) {
|
||||
curr_line.setCoords(x1,y1,x2,y2,true);
|
||||
this.isCurrentDrawingLine = true;
|
||||
canvasCtx.save();
|
||||
canvasCtx.lineWidth='2';
|
||||
this.draw(this.viewPortGraphic(curr_line),canvasCtx);
|
||||
this.isCurrentDrawingLine = false;
|
||||
canvasCtx.restore();
|
||||
};
|
||||
|
||||
this.getActiveLine = function(canvasCtx,x,y) {
|
||||
for(var i=0;i<lines.length;i++) {
|
||||
var line = lines[i];
|
||||
if(line.isActiveShape(canvasCtx,x,y)) {
|
||||
return line;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
this.viewPortGraphic = function(shape) {
|
||||
return {
|
||||
x1:shape.x1*state.scale+state.translationX,
|
||||
y1:shape.y1*state.scale+state.translationY,
|
||||
x2:shape.x2*state.scale+state.translationX,
|
||||
y2:shape.y2*state.scale+state.translationY,
|
||||
textX:shape.textX*state.scale+state.translationX,
|
||||
textY:shape.textY*state.scale+state.translationY,
|
||||
refX:shape.refX*state.scale+state.translationX,
|
||||
refY:shape.refY*state.scale+state.translationY,
|
||||
active:shape.active,
|
||||
len:shape.len,
|
||||
txtActive:shape.txtActive
|
||||
};
|
||||
};
|
||||
|
||||
this.canvasToImgCoordinates = function(point) {
|
||||
return {x:(point.x-state.translationX)/state.scale,y:(point.y-state.translationY)/state.scale};
|
||||
};
|
||||
|
||||
this.removeShape = function(shape) {
|
||||
lines.splice(lines.indexOf(shape), 1);
|
||||
};
|
||||
|
||||
this.clearAll = function() {
|
||||
lines = [];
|
||||
};
|
||||
|
||||
this.getClosestAnchor = function(points,refPt) {
|
||||
var dist1 = Math.round(Math.sqrt(Math.pow(points[0].x-refPt.x,2) + Math.pow(points[0].y-refPt.y,2)));
|
||||
var dist2 = Math.round(Math.sqrt(Math.pow(points[1].x-refPt.x,2) + Math.pow(points[1].y-refPt.y,2)));
|
||||
var dist3 = Math.round(Math.sqrt(Math.pow(points[2].x-refPt.x,2) + Math.pow(points[2].y-refPt.y,2)));
|
||||
var dist4 = Math.round(Math.sqrt(Math.pow(points[3].x-refPt.x,2) + Math.pow(points[3].y-refPt.y,2)));
|
||||
var min = Math.min(dist1,dist2,dist3,dist4);
|
||||
|
||||
switch(min) {
|
||||
case dist1:
|
||||
return points[0];
|
||||
case dist2:
|
||||
return points[1];
|
||||
case dist3:
|
||||
return points[2];
|
||||
case dist4:
|
||||
return points[3];
|
||||
default:
|
||||
return points[0];
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @namespace line
|
||||
*/
|
||||
|
||||
ovm.line = function(xPixelSpacing,yPixelSpacing,measure_Unit,a,b,c,d,e) {
|
||||
// Variables
|
||||
var handle = 5;
|
||||
this.xPxlSpcing = xPixelSpacing;
|
||||
this.yPxlSpcing = yPixelSpacing;
|
||||
this.measureUnit = measure_Unit;
|
||||
this.x1=a;
|
||||
this.y1=b;
|
||||
this.x2=c;
|
||||
this.y2=d;
|
||||
this.active = false;
|
||||
this.len = e;
|
||||
|
||||
// Text
|
||||
this.textX = a;
|
||||
this.textY = b-25;
|
||||
this.txtActive = false;
|
||||
this.refX = 0;
|
||||
this.refY = 0;
|
||||
|
||||
// Functions
|
||||
this.setCoords = function(a,b,c,d,active) {
|
||||
this.x1=(a-state.translationX)/state.scale;
|
||||
this.y1=(b-state.translationY)/state.scale;
|
||||
this.x2=(c-state.translationX)/state.scale;
|
||||
this.y2=(d-state.translationY)/state.scale;
|
||||
this.active = active;
|
||||
this.len = this.calculateLength(this.x2-this.x1, this.y2-this.y1).toFixed(3);
|
||||
this.textX = this.x1;
|
||||
this.textY = this.y1-(25/state.scale);
|
||||
this.findClosestPointOnLine();
|
||||
};
|
||||
|
||||
this.getType = function() {
|
||||
return "ruler";
|
||||
};
|
||||
|
||||
this.isActiveShape = function(canvasCtx,x,y) {
|
||||
var start = this.ImgTocanvascoordinates({x:this.x1,y:this.y1});
|
||||
var end = this.ImgTocanvascoordinates({x:this.x2,y:this.y2});
|
||||
var a = Math.round(Math.sqrt(Math.pow((end.x+handle)-(start.x+handle),2) + Math.pow((end.y+handle)-(start.y+handle),2)));
|
||||
var b = Math.round(Math.sqrt(Math.pow(x-(start.x+handle),2) + Math.pow(y-(start.y+handle),2)));
|
||||
var c = Math.round(Math.sqrt(Math.pow((end.x+handle)-x,2) + Math.pow((end.y+handle)-y,2)));
|
||||
this.active = (a==b+c);
|
||||
return this.active || this.isTextSelection(canvasCtx,x,y);
|
||||
};
|
||||
|
||||
this.detectHandle = function(x,y,target) {
|
||||
var start = this.ImgTocanvascoordinates({x:this.x1,y:this.y1});
|
||||
var end = this.ImgTocanvascoordinates({x:this.x2,y:this.y2});
|
||||
|
||||
if(x>=start.x-handle && x<=start.x+handle && y>=start.y-handle && y<=start.y+handle) {
|
||||
target.style.cursor = "pointer";
|
||||
return 0;
|
||||
} else if(x>=end.x-handle && x<=end.x+handle && y>=end.y-handle && y<=end.y+handle) {
|
||||
target.style.cursor = "pointer";
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
this.moveShape = function(deltaX,deltaY) {
|
||||
if(this.active) {
|
||||
this.x1+=deltaX;
|
||||
this.y1+=deltaY;
|
||||
this.x2+=deltaX;
|
||||
this.y2+=deltaY;
|
||||
}
|
||||
this.textX+=deltaX;
|
||||
this.textY+=deltaY;
|
||||
this.findClosestPointOnLine();
|
||||
};
|
||||
|
||||
this.resizeShape = function(deltaX,deltaY,handle) {
|
||||
switch(handle) {
|
||||
case 0:
|
||||
this.x1+=deltaX;
|
||||
this.y1+=deltaY;
|
||||
this.len= this.calculateLength(this.x2-this.x1, this.y2-this.y1).toFixed(3);
|
||||
break;
|
||||
case 1:
|
||||
this.x2+=deltaX;
|
||||
this.y2+=deltaY;
|
||||
this.len = this.calculateLength(this.x2-this.x1, this.y2-this.y1).toFixed(3);
|
||||
break;
|
||||
}
|
||||
this.findClosestPointOnLine();
|
||||
};
|
||||
|
||||
this.calculateLength = function(xDiff,yDiff) {
|
||||
var mult = Math.max(this.getFloatShift(this.xPxlSpcing),this.getFloatShift(this.yPxlSpcing));
|
||||
var xDist = mult * this.xPxlSpcing * xDiff;
|
||||
var yDist = mult * this.yPxlSpcing * yDiff;
|
||||
|
||||
return ((Math.sqrt((Math.pow(xDist,2)+Math.pow(yDist,2))/Math.pow(mult,2))))/10;
|
||||
};
|
||||
|
||||
this.getFloatShift = function(floatNum) {
|
||||
var decimalLen = 0;
|
||||
var floatElements = floatNum.toString().split('\.');
|
||||
if(floatElements.length==2) {
|
||||
decimalLen = floatElements[1].length;
|
||||
}
|
||||
mult = Math.pow(10,decimalLen);
|
||||
return mult;
|
||||
};
|
||||
|
||||
this.canvasToImgcoordinates = function(point) {
|
||||
return {x:((point.x-state.translationX)/state.scale),y:((point.y-state.translationY)/state.scale)};
|
||||
};
|
||||
|
||||
this.ImgTocanvascoordinates = function(point) {
|
||||
return {x:point.x*state.scale+state.translationX,y:point.y*state.scale+state.translationY};
|
||||
};
|
||||
|
||||
this.isTextSelection = function(canvasCtx,mouseX,mouseY) {
|
||||
var x = (mouseX-state.translationX)/state.scale;
|
||||
var y = (mouseY-state.translationY)/state.scale;
|
||||
|
||||
var textWid = Math.ceil(canvasCtx.measureText(this.len + " " + this.measureUnit).width)+5;
|
||||
this.txtActive = (x>=this.textX && x<=this.textX+(textWid/state.scale) && y>=this.textY && y<=(this.textY+(20/state.scale)));
|
||||
return this.txtActive;
|
||||
};
|
||||
|
||||
this.findClosestPointOnLine = function() {
|
||||
var ptWithinLine = true;
|
||||
|
||||
var dotproduct = (this.textX - this.x1) * (this.x2 - this.x1) + (this.textY - this.y1)*(this.y2 - this.y1);
|
||||
if(dotproduct<0) {
|
||||
ptWithinLine = false;
|
||||
}
|
||||
|
||||
var squaredlengthBA = (this.x2 - this.x1)*(this.x2 - this.x1) + (this.y2 - this.y1)*(this.y2 - this.y1);
|
||||
|
||||
if(dotproduct > squaredlengthBA) {
|
||||
ptWithinLine = false;
|
||||
}
|
||||
|
||||
if(ptWithinLine) {
|
||||
var a_to_p = [this.textX - this.x1 , this.textY - this.y1]; // Vector A to P
|
||||
var a_to_b = [this.x2 - this.x1 , this.y2 - this.y1]; // Vector A to B
|
||||
|
||||
// Find squared magnitude of a_to_b
|
||||
var atb2 = Math.pow(a_to_b[0],2) + Math.pow(a_to_b[1],2);
|
||||
|
||||
// Find dot product of a_to_p and a_to_b
|
||||
var atp_dot_atb = a_to_p[0] * a_to_b[0] + a_to_p[1] * a_to_b[1];
|
||||
|
||||
// Normalized distance from a to closest point
|
||||
var t = atp_dot_atb / atb2;
|
||||
|
||||
// Add the distance to A, moving towards B
|
||||
this.refX = this.x1 + a_to_b[0] * t;
|
||||
this.refY = this.y1 + a_to_b[1] * t;
|
||||
} else {
|
||||
var p_to_a = Math.sqrt(Math.pow(this.textX-this.x1,2) + Math.pow(this.textY-this.y1,2)); // Distance from Point to A
|
||||
var p_to_b = Math.sqrt(Math.pow(this.textX-this.x2,2) + Math.pow(this.textY-this.y2,2)); // Distance from Point to B
|
||||
|
||||
if(p_to_b>p_to_a) {
|
||||
this.refX = this.x1;
|
||||
this.refY = this.y1;
|
||||
} else {
|
||||
this.refX = this.x2;
|
||||
this.refY = this.y2;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,386 @@
|
||||
var mouseLocX, mouseLocY,curr_Img = -1,nativeColumns;
|
||||
var drawCanvas = null, context = null;
|
||||
var tool = '';
|
||||
|
||||
var ruler = null,rect = null, oval = null, angle = null;
|
||||
var selectedShape = null, selectedHandle = -1;
|
||||
var startCoords = [];
|
||||
|
||||
var xPxl = null, yPxl = null,measure_Unit="cm";
|
||||
|
||||
function init(iNo) {
|
||||
if(xPxl==null) {
|
||||
/*var tagPxlSpacing = jQuery('#pixelSpacing').html();
|
||||
if(tagPxlSpacing==='') {
|
||||
loadInstanceText();
|
||||
tagPxlSpacing = jQuery('#pixelSpacing').html();
|
||||
}*/
|
||||
|
||||
var tagPxlSpacing = '1\\1';
|
||||
|
||||
if(jQuery("#imgPixelSpacing").html().length>0) {
|
||||
tagPxlSpacing = jQuery("#imgPixelSpacing").html();
|
||||
} else if(jQuery("#pixelSpacing").html().length>0) {
|
||||
tagPxlSpacing = jQuery('#pixelSpacing').html();
|
||||
} else {
|
||||
measure_Unit = "pix";
|
||||
}
|
||||
|
||||
|
||||
var pxlSpacing = tagPxlSpacing.split('\\');
|
||||
|
||||
xPxl = pxlSpacing.length>0?pxlSpacing[1]:1;
|
||||
yPxl = pxlSpacing.length>1?pxlSpacing[0]:1;
|
||||
}
|
||||
|
||||
if(curr_Img==-1 || curr_Img!=iNo) {
|
||||
clearMeasurements();
|
||||
curr_Img = iNo;
|
||||
}
|
||||
}
|
||||
|
||||
function initializeMeasureCanvas() {
|
||||
drawCanvas = document.getElementById("canvasLayer2");
|
||||
this.context = drawCanvas.getContext('2d');
|
||||
jQuery('#loadingView',window.parent.document).hide();
|
||||
addMouseEvents(drawCanvas);
|
||||
}
|
||||
|
||||
function activateRuler(iNo,columns) {
|
||||
init(iNo);
|
||||
var data = jQuery(drawCanvas).data('events');
|
||||
if(data==undefined || (data!=undefined && data.mousedown==undefined)) {
|
||||
initializeMeasureCanvas();
|
||||
}
|
||||
jQuery('#huDisplayPanel').hide();
|
||||
tool = "ruler";
|
||||
nativeColumns = columns;
|
||||
if(ruler==null) {
|
||||
ruler = new ovm.shape.ruler(xPxl,yPxl,measure_Unit);
|
||||
}
|
||||
}
|
||||
|
||||
function activateRect(iNo,columns) {
|
||||
init(iNo);
|
||||
var data = jQuery(drawCanvas).data('events');
|
||||
if(data==undefined || (data!=undefined && data.mousedown==undefined)) {
|
||||
initializeMeasureCanvas();
|
||||
}
|
||||
jQuery('#huDisplayPanel').show();
|
||||
tool = "rectangle";
|
||||
nativeColumns = columns;
|
||||
if(rect==null) {
|
||||
rect = new ovm.shape.rect(xPxl,yPxl,measure_Unit);
|
||||
}
|
||||
}
|
||||
|
||||
function activateOval(iNo,columns) {
|
||||
init(iNo);
|
||||
var data = jQuery(drawCanvas).data('events');
|
||||
if(data==undefined || (data!=undefined && data.mousedown==undefined)) {
|
||||
initializeMeasureCanvas();
|
||||
}
|
||||
jQuery('#huDisplayPanel').show();
|
||||
tool = "oval";
|
||||
nativeColumns = columns;
|
||||
if(oval==null) {
|
||||
oval = new ovm.shape.oval(xPxl,yPxl,measure_Unit);
|
||||
}
|
||||
}
|
||||
|
||||
function activateAngle(iNo,columns) {
|
||||
init(iNo);
|
||||
var data = jQuery(drawCanvas).data('events');
|
||||
if(data==undefined || (data!=undefined && data.mousedown==undefined)) {
|
||||
initializeMeasureCanvas();
|
||||
}
|
||||
jQuery('#huDisplayPanel').hide();
|
||||
tool = "angle";
|
||||
nativeColumns = columns;
|
||||
if(angle==null) {
|
||||
angle = new ovm.shape.angle(xPxl,yPxl);
|
||||
}
|
||||
}
|
||||
|
||||
function addMouseEvents(canvas) {
|
||||
jQuery(canvas).mousedown(function(e){
|
||||
mouseDownHandler(e);
|
||||
}).mousemove(function(e1){
|
||||
mouseMoveHandler(e1);
|
||||
}).mouseup(function (e2){
|
||||
mouseUpHandler(e2);
|
||||
});
|
||||
}
|
||||
|
||||
function mouseDownHandler(evt) {
|
||||
if(evt.which==1) {
|
||||
jQuery('.contextMenu',window.parent.dcoument).hide();
|
||||
state.drag = true;
|
||||
|
||||
mouseLocX = evt.pageX - drawCanvas.offsetLeft;
|
||||
mouseLocY = evt.pageY - drawCanvas.offsetTop;
|
||||
|
||||
this.startCoords = [
|
||||
(evt.pageX - state.translationX)/state.scale,
|
||||
(evt.pageY - state.translationY)/state.scale
|
||||
];
|
||||
|
||||
if(selectedShape!=null) {
|
||||
detectHandle(evt);
|
||||
|
||||
if(selectedHandle==-1 && !selectedShape.isActiveShape(context,mouseLocX,mouseLocY)) {
|
||||
if(selectedShape.getType()!="ruler" && selectedShape.getType()!="angle") {
|
||||
selectedShape.measure(selectedShape);
|
||||
}
|
||||
selectedShape.active = false;
|
||||
selectedShape = null;
|
||||
drawAllShapes();
|
||||
}
|
||||
}
|
||||
else {
|
||||
detectSelectedShape();
|
||||
|
||||
if(selectedShape==null) {
|
||||
if(tool=="ruler") {
|
||||
ruler.initNewLine();
|
||||
} else if(tool=="rectangle") {
|
||||
rect.initNewRect();
|
||||
} else if(tool=="oval") {
|
||||
oval.initNewOval();
|
||||
} else if(tool=="angle") {
|
||||
if(angle.angleStarted()) {
|
||||
if(angle.curr_angle.setIntersectionPt(mouseLocX, mouseLocY)) {
|
||||
state.drag = false;
|
||||
}
|
||||
} else {
|
||||
angle.initAngle();
|
||||
state.drag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
evt.stopPropagation();
|
||||
evt.preventDefault();
|
||||
evt.target.style.cursor = selectedShape!=null? 'move' : 'crosshair';
|
||||
}
|
||||
}
|
||||
|
||||
function mouseMoveHandler(evt) {
|
||||
var x = evt.pageX-drawCanvas.offsetLeft;
|
||||
var y = evt.pageY-drawCanvas.offsetTop;
|
||||
|
||||
var imgX = parseInt((x-state.translationX)/state.scale);
|
||||
var imgY = parseInt((y-state.translationY)/state.scale);
|
||||
|
||||
if(tool=="rectangle" || tool=="oval") {
|
||||
jQuery('#huDisplayPanel').html("X :"+imgX+" Y :"+imgY+" HU :"+getPixelValAt(imgX,imgY));
|
||||
}
|
||||
|
||||
if(state.drag) {
|
||||
drawAllShapes();
|
||||
|
||||
if(selectedShape==null ) { // New Shape
|
||||
switch(tool) {
|
||||
case 'ruler':
|
||||
ruler.drawRuler(context,mouseLocX,mouseLocY,x,y);
|
||||
break;
|
||||
case 'rectangle':
|
||||
rect.drawRect(context,mouseLocX,mouseLocY,x,y);
|
||||
break;
|
||||
case 'oval':
|
||||
oval.drawOval(context,mouseLocX,mouseLocY,x,y);
|
||||
break;
|
||||
case 'angle':
|
||||
if(angle.angleStarted()) {
|
||||
angle.setOAorOB(context, mouseLocX, mouseLocY, x, y);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if(selectedHandle==-1) { // Move a shape
|
||||
selectedShape.moveShape(Math.round(imgX-this.startCoords[0]),Math.round(imgY-this.startCoords[1]));
|
||||
this.startCoords = [imgX,imgY];
|
||||
evt.target.style.cursor = 'move';
|
||||
} else if(selectedShape.active) { // Resizing a shape
|
||||
selectedShape.resizeShape(Math.round(imgX-this.startCoords[0]),Math.round(imgY-this.startCoords[1]),selectedHandle);
|
||||
this.startCoords = [imgX,imgY];
|
||||
}
|
||||
} else if(selectedShape!=null && selectedShape.active) {
|
||||
detectHandle(evt);
|
||||
}
|
||||
}
|
||||
|
||||
function mouseUpHandler(evt) {
|
||||
if(selectedShape==null) { // New Shape
|
||||
switch(tool) {
|
||||
case 'ruler':
|
||||
//ruler.createNewLine(mouseLocX, mouseLocY, (evt.pageX-drawCanvas.offsetLeft), (evt.pageY-drawCanvas.offsetTop));
|
||||
var newLocation = changeMouseCoordinate(mouseLocX,mouseLocY,(evt.pageX-drawCanvas.offsetLeft), (evt.pageY-drawCanvas.offsetTop));
|
||||
ruler.createNewLine(newLocation.mouseLocX, newLocation.mouseLocY, newLocation.pageX, newLocation.pageY);
|
||||
break;
|
||||
case 'rectangle':
|
||||
//rect.createNewRect(mouseLocX, mouseLocY, (evt.pageX-drawCanvas.offsetLeft), (evt.pageY-drawCanvas.offsetTop));
|
||||
var newLocation = changeMouseCoordinate(mouseLocX,mouseLocY,(evt.pageX-drawCanvas.offsetLeft),(evt.pageY-drawCanvas.offsetTop));
|
||||
rect.createNewRect(newLocation.mouseLocX, newLocation.mouseLocY, newLocation.pageX, newLocation.pageY);
|
||||
break;
|
||||
case 'oval':
|
||||
//oval.createNewOval(mouseLocX, mouseLocY, (evt.pageX-drawCanvas.offsetLeft), (evt.pageY-drawCanvas.offsetTop));
|
||||
var newLocation = changeMouseCoordinate(mouseLocX,mouseLocY,(evt.pageX-drawCanvas.offsetLeft),(evt.pageY-drawCanvas.offsetTop));
|
||||
oval.createNewOval(newLocation.mouseLocX, newLocation.mouseLocY, newLocation.pageX, newLocation.pageY);
|
||||
break;
|
||||
case 'angle':
|
||||
if(angle.angleStarted() && angle.curr_angle.lineOAValid() && angle.curr_angle.lineOBValid()) {
|
||||
angle.createNewAngle();
|
||||
}
|
||||
break;
|
||||
}
|
||||
drawAllShapes();
|
||||
if(tool!="angle") {
|
||||
state.drag = false;
|
||||
}
|
||||
} else {
|
||||
state.drag = false;
|
||||
}
|
||||
}
|
||||
|
||||
function changeMouseCoordinate(mouseLocX,mouseLocY,pageX,pageY) {
|
||||
if(state.hflip){
|
||||
mouseLocX = drawCanvas.width - mouseLocX;
|
||||
pageX = drawCanvas.width - pageX;
|
||||
}
|
||||
if(state.vflip){
|
||||
mouseLocY = drawCanvas.height - mouseLocY;
|
||||
pageY = drawCanvas.height - pageY;
|
||||
}
|
||||
if(state.rotate!=0) {
|
||||
var tempMouseLocX,tempMouseLocY,tempPageX,tempPageY; // These variable is necessary otherwise it will subtract from original(mouseLocX,evt.pageY)
|
||||
if(state.rotate===90) {
|
||||
var newWidth = drawCanvas.width - drawCanvas.height;
|
||||
newWidth = newWidth/2;
|
||||
tempMouseLocX = mouseLocY + newWidth;
|
||||
tempMouseLocY = (drawCanvas.width - newWidth) - mouseLocX;
|
||||
tempPageX =pageY + newWidth;
|
||||
tempPageY = (drawCanvas.width-newWidth) - pageX;
|
||||
mouseLocX = tempMouseLocX;
|
||||
mouseLocY = tempMouseLocY;
|
||||
pageX = tempPageX;
|
||||
pageY = tempPageY;
|
||||
|
||||
} else if(state.rotate===180) {
|
||||
tempMouseLocX = drawCanvas.width - mouseLocX;
|
||||
tempMouseLocY = drawCanvas.height - mouseLocY;
|
||||
tempPageX = drawCanvas.width - pageX;
|
||||
tempPageY = drawCanvas.height - pageY;
|
||||
|
||||
mouseLocX = tempMouseLocX;
|
||||
mouseLocY = tempMouseLocY;
|
||||
pageX = tempPageX;
|
||||
pageY = tempPageY;
|
||||
|
||||
}
|
||||
|
||||
else { //270
|
||||
var newWidth = drawCanvas.width - drawCanvas.height;
|
||||
newWidth = newWidth/2;
|
||||
tempMouseLocX = (drawCanvas.width - newWidth) - mouseLocY;
|
||||
tempMouseLocY = mouseLocX - newWidth;
|
||||
tempPageX = (drawCanvas.width - newWidth) - pageY;
|
||||
tempPageY = pageX - newWidth;
|
||||
|
||||
mouseLocX = tempMouseLocX;
|
||||
mouseLocY = tempMouseLocY;
|
||||
pageX = tempPageX;
|
||||
pageY = tempPageY;
|
||||
}
|
||||
}
|
||||
|
||||
return {mouseLocX:mouseLocX, mouseLocY:mouseLocY, pageX:pageX, pageY:pageY};
|
||||
}
|
||||
|
||||
|
||||
function setShape(shape) {
|
||||
tool = shape;
|
||||
jQuery('.selectedshape',window.parent.document).removeClass('selectedshape');
|
||||
}
|
||||
|
||||
function detectSelectedShape() {
|
||||
if(ruler!=null && (selectedShape = ruler.getActiveLine(context,mouseLocX,mouseLocY))!=null || rect!=null && (selectedShape = rect.getActiveRect(context,mouseLocX,mouseLocY))!=null || oval!=null && (selectedShape = oval.getActiveOval(context,mouseLocX,mouseLocY))!=null || angle!=null && (selectedShape = angle.getActiveAngle(context,mouseLocX,mouseLocY))!=null) {
|
||||
drawAllShapes();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function detectHandle(e) {
|
||||
selectedHandle = selectedShape.detectHandle(e.pageX-drawCanvas.offsetLeft,e.pageY-drawCanvas.offsetTop,e.target);
|
||||
}
|
||||
|
||||
function clearMeasurements() {
|
||||
curr_Img = -1;
|
||||
if(ruler!=null) {
|
||||
ruler.clearAll();
|
||||
}
|
||||
if(rect!=null) {
|
||||
rect.clearAll();
|
||||
}
|
||||
if(oval!=null) {
|
||||
oval.clearAll();
|
||||
}
|
||||
if(angle!=null) {
|
||||
angle.clearAll();
|
||||
}
|
||||
if(context!=null) {
|
||||
context.clearRect(0,0,drawCanvas.width,drawCanvas.height);
|
||||
}
|
||||
}
|
||||
|
||||
function resetAnnotation() {
|
||||
clearMeasurements();
|
||||
tool = "";
|
||||
jQuery('.selectedshape',window.parent.document).removeClass('selectedshape');
|
||||
jQuery('#line',window.parent.document).addClass('selectedshape');
|
||||
this.context = null;
|
||||
}
|
||||
|
||||
function deleteSelectedMeasurement() {
|
||||
if(selectedShape!=null) {
|
||||
if(selectedShape.getType()=="ruler") {
|
||||
ruler.removeShape(selectedShape);
|
||||
} else if(selectedShape.getType()=="rect") {
|
||||
rect.removeShape(selectedShape);
|
||||
} else if(selectedShape.getType()=="oval") {
|
||||
oval.removeShape(selectedShape);
|
||||
} else if(selectedShape.getType()=="angle") {
|
||||
angle.removeShape(selectedShape);
|
||||
}
|
||||
selectedShape = null;
|
||||
drawAllShapes();
|
||||
}
|
||||
}
|
||||
|
||||
function drawAllShapes() {
|
||||
if(this.context!=null) {
|
||||
this.context.save();
|
||||
this.context.setTransform(1,0,0,1,0,0);
|
||||
this.context.clearRect(0,0,drawCanvas.width,drawCanvas.height);
|
||||
if(state.vflip) {
|
||||
this.context.translate(0,drawCanvas.height);
|
||||
this.context.scale(1,-1);
|
||||
}
|
||||
|
||||
if(state.hflip) {
|
||||
this.context.translate(drawCanvas.width,0);
|
||||
this.context.scale(-1,1);
|
||||
}
|
||||
|
||||
if(state.rotate!=0) {
|
||||
this.context.translate(drawCanvas.width/2,drawCanvas.height/2);
|
||||
this.context.rotate(state.rotate===90 ? Math.PI/2 : state.rotate===180? Math.PI : (Math.PI*3)/2);
|
||||
this.context.translate(-drawCanvas.width/2,-drawCanvas.height/2);
|
||||
}
|
||||
if(ruler!=null) ruler.drawData(context);
|
||||
if(rect!=null) rect.drawData(context);
|
||||
if(oval!=null) oval.drawData(context);
|
||||
if(angle!=null) angle.drawData(context);
|
||||
this.context.restore();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
var modal = (function(){
|
||||
var
|
||||
method = {},
|
||||
$overlay,
|
||||
$modal,
|
||||
$content,
|
||||
$close;
|
||||
|
||||
// Center the modal in the viewport
|
||||
method.center = function () {
|
||||
var top, left;
|
||||
|
||||
top = Math.max($(window).height() - $modal.outerHeight(), 0) / 2;
|
||||
left = Math.max($(window).width() - $modal.outerWidth(), 0) / 2;
|
||||
|
||||
$modal.css({
|
||||
top:top + $(window).scrollTop(),
|
||||
left:left + $(window).scrollLeft()
|
||||
});
|
||||
};
|
||||
|
||||
// Open the modal
|
||||
method.open = function (settings) {
|
||||
$content.empty().append(settings.content);
|
||||
|
||||
$modal.css({
|
||||
width: settings.width || 'auto',
|
||||
height: settings.height || 'auto'
|
||||
});
|
||||
|
||||
method.center();
|
||||
$(window).bind('resize.modal', method.center);
|
||||
$modal.show();
|
||||
$overlay.show();
|
||||
};
|
||||
|
||||
// Close the modal
|
||||
method.close = function () {
|
||||
$modal.hide();
|
||||
$overlay.hide();
|
||||
$content.empty();
|
||||
$(window).unbind('resize.modal');
|
||||
};
|
||||
|
||||
// Generate the HTML and add it to the document
|
||||
$overlay = $('<div id="overlay"></div>');
|
||||
$modal = $('<div id="modal"></div>');
|
||||
$content = $('<div id="content"></div>');
|
||||
$close = $('<a id="close" href="#">close</a>');
|
||||
|
||||
$modal.hide();
|
||||
$overlay.hide();
|
||||
$modal.append($content, $close);
|
||||
|
||||
$(document).ready(function(){
|
||||
$('body').append($overlay, $modal);
|
||||
});
|
||||
|
||||
$close.click(function(e){
|
||||
e.preventDefault();
|
||||
method.close();
|
||||
if(typeof qpTable != 'undefined') {
|
||||
qpTable.fnClearTable();
|
||||
loadQueryParamTable();
|
||||
}
|
||||
});
|
||||
|
||||
return method;
|
||||
}());
|
||||
@@ -0,0 +1,124 @@
|
||||
function searchClick(searchBtn) {
|
||||
$('#buttonContainer').find('.ui-state-active').removeClass('ui-state-active');
|
||||
var inputFields = $(searchBtn).parent().parent().parent().find('input');
|
||||
var searchURL = "queryResult.jsp?";
|
||||
inputFields.each(function() {
|
||||
if(this.id == 'patId') {
|
||||
if(this.value.trim() != '') {
|
||||
searchURL += 'patientId=' + this.value.trim();
|
||||
}
|
||||
} else if(this.id == 'patName') {
|
||||
if(this.value.trim() != '') {
|
||||
searchURL += '&patientName=' + this.value.trim();
|
||||
}
|
||||
} else if(this.id == 'accessionNo') {
|
||||
if(this.value.trim() != '') {
|
||||
searchURL += '&accessionNumber=' + this.value.trim();
|
||||
}
|
||||
// } else if($(this).siblings()[0].innerHTML == 'Birth Date') {
|
||||
} else if($(this).prop('class') == 'bdate hasDatepicker') {
|
||||
if(this.value.trim() != '') {
|
||||
searchURL += '&birthDate=' + convertToDcm4cheeDate(this.value.trim());
|
||||
}
|
||||
//} else if($(this).siblings()[0].innerHTML == 'Study Date (From)') {
|
||||
} else if($(this).prop('class') == 'fsdate hasDatepicker') {
|
||||
if(this.value.trim() != '') {
|
||||
searchURL += '&searchDays=between&from=' + convertToDcm4cheeDate(this.value.trim());
|
||||
}
|
||||
//} else if($(this).siblings()[0].innerHTML == 'Study Date (To)') {
|
||||
} else if($(this).prop('class') == 'tsdate hasDatepicker') {
|
||||
if(this.value.trim() != '') {
|
||||
searchURL += '&to=' + convertToDcm4cheeDate(this.value.trim());
|
||||
}
|
||||
} else if(this.id == 'studyDesc') {
|
||||
if(this.value.trim() != '') {
|
||||
searchURL += '&studyDesc=' + this.value.trim();
|
||||
}
|
||||
} else if(this.id == 'referPhysician') {
|
||||
if(this.value.trim() != '') {
|
||||
searchURL += '&referPhysician=' + this.value.trim();
|
||||
}
|
||||
}
|
||||
}); // for each
|
||||
|
||||
//var modalities = $(searchBtn).parent().prev().find('span')[1].innerHTML.replace(/, /g, '\\');
|
||||
//var modalities = $(searchBtn).parent().prev().find('span').html().replace(/\, /g,'\\');
|
||||
var modalities = '';
|
||||
$(searchBtn).parent().prev().find('.gentleselect-dialog li.selected').each(function(index) {
|
||||
if(index>0) {
|
||||
modalities+='\\' + $(this).text();
|
||||
} else {
|
||||
modalities=$(this).text();
|
||||
}
|
||||
});
|
||||
if(modalities!='') {
|
||||
searchURL += '&modality=' + modalities.trim();
|
||||
}
|
||||
|
||||
var divContent = $('.ui-tabs-selected').find('a').attr('href') + '_content';
|
||||
$(divContent).html('');
|
||||
|
||||
if(searchURL.trim()==('queryResult.jsp?')) {
|
||||
jConfirm('No filters have been selected. The search may take long time. Do you want to proceed?', 'No search criteria',function(doQry) {
|
||||
if(doQry==true) {
|
||||
var wado = $('.ui-tabs-selected').find('a').attr('wadoUrl');
|
||||
searchURL += '&ris=' + wado.substring(0,wado.indexOf('wado'))+"ris/Report.do?studyUID=";
|
||||
doQuery(searchURL,divContent);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var wado = $('.ui-tabs-selected').find('a').attr('wadoUrl');
|
||||
searchURL += '&ris=' + wado.substring(0,wado.indexOf('wado'))+"ris/Report.do?studyUID=";
|
||||
doQuery(searchURL,divContent);
|
||||
}
|
||||
|
||||
} // end of searchClick()
|
||||
|
||||
function doQuery(searchURL,divContent) {
|
||||
searchURL += "&dcmURL=" + $('.ui-tabs-selected').find('a').attr('name');
|
||||
searchURL += '&tabName=' + $('.ui-tabs-selected').find('a').attr('href').replace('#','');
|
||||
searchURL += '&tabIndex=' + $('#tabs_div').data('tabs').options.selected;
|
||||
searchURL += '&preview=' + $('.ui-tabs-selected').find('a').attr('preview');
|
||||
searchURL += "&search=true";
|
||||
|
||||
$(divContent).html('<div id="loading" style="height: 100%; width: 100%; text-align: center; z-index: 10000;"><div style="position: absolute; left: 45%; top: 45%;"><img src="images/overlay_spinner.gif" alt=""><div style="font-size: 12px; font-weight: bold;">Querying...</div></div></div>');
|
||||
$('#westPane').html('');
|
||||
|
||||
$(divContent).load(encodeURI(searchURL), function() {
|
||||
clearInterval(timer);
|
||||
//checkLocalStudies();
|
||||
});
|
||||
}
|
||||
|
||||
function resetClick(resetBtn, div) {
|
||||
var inputFields = $(resetBtn).parent().parent().parent().find('input');
|
||||
inputFields.each(function() {
|
||||
this.value = '';
|
||||
}); //for each
|
||||
$(div).val(0).gentleSelect("update");
|
||||
}
|
||||
|
||||
function convertToDcm4cheeDate(givenDate) {
|
||||
var retVal = "";
|
||||
if(givenDate != "") {
|
||||
var str = givenDate.split("/");
|
||||
retVal = str[2] + str[0] + str[1];
|
||||
}
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
function checkLocalStudies() {
|
||||
var myDB = initDB();
|
||||
var sql = "select StudyInstanceUID from study";
|
||||
myDB.transaction(function(tx) {
|
||||
tx.executeSql(sql, [], function(trans, results) {
|
||||
for(var i=0; i<results.rows.length; i++) {
|
||||
var row = results.rows.item(i);
|
||||
var img = document.getElementById(row['StudyInstanceUID']);
|
||||
if(img != null) {
|
||||
img.style.visibility = 'visible';
|
||||
}
|
||||
}
|
||||
}, errorHandler);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,600 @@
|
||||
/**
|
||||
* Definition of shape Oval
|
||||
*/
|
||||
|
||||
ovm.shape.oval = function(xPixelSpacing,yPixelSpacing,measure_Unit) {
|
||||
var handle = 5;
|
||||
var ovals = [];
|
||||
var curr_oval = null;
|
||||
var xPxlSpcing = xPixelSpacing;
|
||||
var yPxlSpcing = yPixelSpacing;
|
||||
var measureUnit = measure_Unit;
|
||||
this.isCurrentDrawingOval = false;
|
||||
|
||||
this.createNewOval = function(x1,y1,x2,y2) {
|
||||
if(curr_oval!=undefined) {
|
||||
curr_oval.setCoords(x1,y1,x2,y2,false);
|
||||
// if(parseFloat(curr_oval.area)>0.0) { // To avoid oval in negative area
|
||||
curr_oval.meanOfOval();
|
||||
curr_oval.stdDevOfOval();
|
||||
ovals.push(curr_oval);
|
||||
curr_oval = undefined;
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
this.initNewOval = function() {
|
||||
curr_oval = new ovm.oval(xPxlSpcing, yPxlSpcing,measureUnit, 0, 0, 0, 0, 0);
|
||||
};
|
||||
|
||||
this.draw = function(graphic,canvasCtx) {
|
||||
// Draw Shape
|
||||
canvasCtx.lineWidth='2';
|
||||
canvasCtx.strokeStyle=canvasCtx.fillStyle='orange';
|
||||
canvasCtx.save();
|
||||
var radX = graphic.endX-graphic.centerX;
|
||||
var radY = graphic.endY-graphic.centerY;
|
||||
canvasCtx.beginPath();
|
||||
canvasCtx.translate(graphic.centerX-radX,graphic.centerY-radY);
|
||||
//canvasCtx.translate(graphic.centerX,graphic.centerY);
|
||||
canvasCtx.scale(radX,radY);
|
||||
canvasCtx.arc(1,1,1,0,2*Math.PI,false);
|
||||
canvasCtx.restore();
|
||||
canvasCtx.stroke();
|
||||
|
||||
// Handles
|
||||
if(graphic.active) {
|
||||
canvasCtx.strokeStyle = canvasCtx.fillStyle = 'white';
|
||||
canvasCtx.strokeRect(graphic.centerX-radX,graphic.centerY-radY-handle,handle*2, handle*2);
|
||||
canvasCtx.strokeRect(graphic.centerX,graphic.centerY-radY-handle,handle*2, handle*2);
|
||||
canvasCtx.strokeRect(graphic.centerX+radX,graphic.centerY-radY-handle,handle*2,handle*2);
|
||||
canvasCtx.strokeRect(graphic.centerX-radX-handle,graphic.centerY,handle*2,handle*2);
|
||||
canvasCtx.strokeRect(graphic.centerX+radX-handle,graphic.centerY,handle*2,handle*2);
|
||||
canvasCtx.strokeRect(graphic.centerX-radX-handle,graphic.centerY+radY,handle*2,handle*2);
|
||||
canvasCtx.strokeRect(graphic.centerX,graphic.centerY+radY-handle,handle*2,handle*2);
|
||||
canvasCtx.strokeRect(graphic.centerX+radX-handle,graphic.centerY+radY,handle*2,handle*2);
|
||||
}
|
||||
|
||||
// Text
|
||||
canvasCtx.fillStyle = graphic.txtActive? "blue" : "maroon";
|
||||
canvasCtx.globalAlpha = 0.5;
|
||||
canvasCtx.font = "14px Arial";
|
||||
|
||||
var text = canvasCtx.measureText(graphic.stdDev.length>graphic.area.length? graphic.stdDev : graphic.area);
|
||||
canvasCtx.fillRect(graphic.textX,graphic.textY,Math.ceil(text.width)+20,60);
|
||||
canvasCtx.globalAlpha = 0.9;
|
||||
canvasCtx.fillStyle = "white";
|
||||
//canvasCtx.fillText(graphic.area,graphic.textX+2,graphic.textY+15);
|
||||
//canvasCtx.fillText(graphic.mean,graphic.textX+2,graphic.textY+35);
|
||||
//canvasCtx.fillText(graphic.stdDev,graphic.textX+2,graphic.textY+55);
|
||||
|
||||
if(state.hflip && !state.vflip && !state.rotate!=0 && !this.isCurrentDrawingOval){
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width,0);
|
||||
canvasCtx.scale(-1,1);
|
||||
canvasCtx.fillText(graphic.area,(drawCanvas.width -graphic.textX+2)-135,graphic.textY+15);
|
||||
canvasCtx.fillText(graphic.mean,(drawCanvas.width -graphic.textX+2)-135,graphic.textY+35);
|
||||
canvasCtx.fillText(graphic.stdDev,(drawCanvas.width -graphic.textX+2)-135,graphic.textY+55);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
if(state.vflip && !state.hflip && !state.rotate!=0 && !this.isCurrentDrawingOval){
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(0,drawCanvas.height);
|
||||
canvasCtx.scale(1,-1);
|
||||
canvasCtx.fillText(graphic.area, graphic.textX+2,(drawCanvas.height -graphic.textY)-48);
|
||||
canvasCtx.fillText(graphic.mean, graphic.textX+2,(drawCanvas.height -graphic.textY)-28);
|
||||
canvasCtx.fillText(graphic.stdDev, graphic.textX+2,(drawCanvas.height -graphic.textY)-8);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
|
||||
if(!state.vflip && state.hflip && (state.rotate===90 || state.rotate===180 || state.rotate===270) && !this.isCurrentDrawingOval){
|
||||
if(state.rotate===90 || state.rotate===180 || state.rotate===270) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(0,drawCanvas.height);
|
||||
canvasCtx.scale(1,-1);
|
||||
|
||||
canvasCtx.fillText(graphic.area,graphic.textX+2,(drawCanvas.height -graphic.textY)-50);
|
||||
canvasCtx.fillText(graphic.mean,graphic.textX+2,(drawCanvas.height -graphic.textY)-30);
|
||||
canvasCtx.fillText(graphic.stdDev,graphic.textX+2,(drawCanvas.height -graphic.textY)-10);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
if(state.vflip && !state.hflip && (state.rotate===90 || state.rotate===180 || state.rotate===270) && !this.isCurrentDrawingOval){
|
||||
if(state.rotate===90 || state.rotate===180 || state.rotate===270) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width,0);
|
||||
canvasCtx.scale(-1,1);
|
||||
|
||||
canvasCtx.fillText(graphic.area,(drawCanvas.width -graphic.textX+2)-130,graphic.textY+15);
|
||||
canvasCtx.fillText(graphic.mean,(drawCanvas.width -graphic.textX+2)-130,graphic.textY+35);
|
||||
canvasCtx.fillText(graphic.stdDev,(drawCanvas.width -graphic.textX+2)-130,graphic.textY+55);
|
||||
|
||||
canvasCtx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(state.rotate!=0 && !state.vflip && !state.hflip && !this.isCurrentDrawingOval) {
|
||||
if(state.rotate===180) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width/2,drawCanvas.height/2);
|
||||
canvasCtx.rotate(Math.PI);
|
||||
canvasCtx.translate(-drawCanvas.width/2,-drawCanvas.height/2);
|
||||
|
||||
canvasCtx.fillText(graphic.area,(drawCanvas.width -graphic.textX)-130, (drawCanvas.height -graphic.textY)-50); //,
|
||||
canvasCtx.fillText(graphic.mean, (drawCanvas.width -graphic.textX)-130, (drawCanvas.height -graphic.textY)-30); //
|
||||
canvasCtx.fillText(graphic.stdDev, (drawCanvas.width -graphic.textX)-130, (drawCanvas.height -graphic.textY)-10);//
|
||||
canvasCtx.restore();
|
||||
}
|
||||
|
||||
else {
|
||||
canvasCtx.fillText(graphic.area,graphic.textX+2,graphic.textY+15);
|
||||
canvasCtx.fillText(graphic.mean,graphic.textX+2,graphic.textY+35);
|
||||
canvasCtx.fillText(graphic.stdDev,graphic.textX+2,graphic.textY+55);
|
||||
}
|
||||
}
|
||||
|
||||
if((state.rotate===0 || state.rotate===90 || state.rotate===180 || state.rotate===270) && state.vflip && state.hflip && !this.isCurrentDrawingOval) {
|
||||
if(state.rotate===0) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width,drawCanvas.height);
|
||||
canvasCtx.scale(-1,-1);
|
||||
|
||||
canvasCtx.fillText(graphic.area,(drawCanvas.width -graphic.textX+2)-135,(drawCanvas.height -graphic.textY)-50);
|
||||
canvasCtx.fillText(graphic.mean,(drawCanvas.width -graphic.textX+2)-135,(drawCanvas.height -graphic.textY)-30);
|
||||
canvasCtx.fillText(graphic.stdDev,(drawCanvas.width -graphic.textX+2)-135,(drawCanvas.height -graphic.textY)-10);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
else {
|
||||
canvasCtx.fillText(graphic.area,graphic.textX+2,graphic.textY+15);
|
||||
canvasCtx.fillText(graphic.mean,graphic.textX+2,graphic.textY+35);
|
||||
canvasCtx.fillText(graphic.stdDev,graphic.textX+2,graphic.textY+55);
|
||||
}
|
||||
}
|
||||
|
||||
if((!state.rotate===0 || !state.rotate===90 || !state.rotate===180 || !state.rotate===270) && state.hflip && state.vflip && !this.isCurrentDrawingOval) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width,drawCanvas.height);
|
||||
canvasCtx.scale(-1,-1);
|
||||
|
||||
canvasCtx.fillText(graphic.area,(drawCanvas.width -graphic.textX+2)-135,(drawCanvas.height -graphic.textY)-50);
|
||||
canvasCtx.fillText(graphic.mean,(drawCanvas.width -graphic.textX+2)-135,(drawCanvas.height -graphic.textY)-30);
|
||||
canvasCtx.fillText(graphic.stdDev,(drawCanvas.width -graphic.textX+2)-135,(drawCanvas.height -graphic.textY)-10);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
|
||||
if(!state.hflip && !state.vflip && !state.rotate!=0) {
|
||||
//canvasCtx.save();
|
||||
canvasCtx.fillText(graphic.area,graphic.textX+2,graphic.textY+15);
|
||||
canvasCtx.fillText(graphic.mean,graphic.textX+2,graphic.textY+35);
|
||||
canvasCtx.fillText(graphic.stdDev,graphic.textX+2,graphic.textY+55);
|
||||
//canvasCtx.restore();
|
||||
}
|
||||
|
||||
if(this.isCurrentDrawingOval) {
|
||||
canvasCtx.fillText(graphic.area,graphic.textX+2,graphic.textY+15);
|
||||
canvasCtx.fillText(graphic.mean,graphic.textX+2,graphic.textY+35);
|
||||
canvasCtx.fillText(graphic.stdDev,graphic.textX+2,graphic.textY+55);
|
||||
}
|
||||
|
||||
// Reference Lines
|
||||
if(graphic.centerX!=graphic.textX) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.beginPath();
|
||||
canvasCtx.strokeStyle = "yellow";
|
||||
canvasCtx.setLineDash([10,7]);
|
||||
var closestPt = this.getClosestAnchor([{x:graphic.textX,y:graphic.textY},{x:graphic.textX+Math.ceil(text.width+10),y:graphic.textY},{x:graphic.textX,y:graphic.textY+60},{x:graphic.textX+Math.ceil(text.width+10),y:graphic.textY+60}],{x:graphic.refX,y:graphic.refY});
|
||||
canvasCtx.moveTo(closestPt.x,closestPt.y);
|
||||
canvasCtx.lineTo(graphic.refX,graphic.refY);
|
||||
canvasCtx.stroke();
|
||||
canvasCtx.closePath();
|
||||
canvasCtx.restore();
|
||||
}
|
||||
};
|
||||
|
||||
this.drawData = function(ctx) {
|
||||
ctx.save();
|
||||
|
||||
for(var i=0;i<ovals.length;i++) {
|
||||
this.draw(this.viewPortGraphic(ovals[i]),ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
};
|
||||
|
||||
this.drawOval = function(canvasCtx,x1,y1,x2,y2) {
|
||||
curr_oval.setCoords(x1,y1,x2,y2,true);
|
||||
this.isCurrentDrawingOval = true;
|
||||
canvasCtx.strokeStyle=canvasCtx.fillStyle='orange';
|
||||
canvasCtx.lineWidth='2';
|
||||
this.draw(this.viewPortGraphic(curr_oval),canvasCtx);
|
||||
this.isCurrentDrawingOval = false;
|
||||
};
|
||||
|
||||
this.getActiveOval = function(canvasCtx,x,y) {
|
||||
for(var i=0;i<ovals.length;i++) {
|
||||
var oval = ovals[i];
|
||||
if(oval.isShapeSelection(canvasCtx,x,y)) {
|
||||
return oval;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
this.viewPortGraphic = function(shape) {
|
||||
return {
|
||||
centerX:shape.centerX*state.scale+state.translationX,
|
||||
centerY:shape.centerY*state.scale+state.translationY,
|
||||
endX:shape.endX*state.scale+state.translationX,
|
||||
endY:shape.endY*state.scale+state.translationY,
|
||||
textX:shape.textX*state.scale+state.translationX,
|
||||
textY:shape.textY*state.scale+state.translationY,
|
||||
refX:shape.refX*state.scale+state.translationX,
|
||||
refY:shape.refY*state.scale+state.translationY,
|
||||
active:shape.active,
|
||||
txtActive:shape.txtActive,
|
||||
area:shape.txtArea,
|
||||
mean:shape.txtMean,
|
||||
stdDev:shape.txtStdDev
|
||||
};
|
||||
};
|
||||
|
||||
this.canvasToImgCoordinates = function(point) {
|
||||
return {x:(point.x-state.translationX)/state.scale,y:(point.y-state.translationY)/state.scale};
|
||||
};
|
||||
|
||||
this.removeShape = function(shape) {
|
||||
ovals.splice(ovals.indexOf(shape), 1);
|
||||
};
|
||||
|
||||
this.clearAll = function() {
|
||||
ovals = [];
|
||||
};
|
||||
|
||||
this.getClosestAnchor = function(points,refPt) {
|
||||
var dist1 = Math.round(Math.sqrt(Math.pow(points[0].x-refPt.x,2) + Math.pow(points[0].y-refPt.y,2)));
|
||||
var dist2 = Math.round(Math.sqrt(Math.pow(points[1].x-refPt.x,2) + Math.pow(points[1].y-refPt.y,2)));
|
||||
var dist3 = Math.round(Math.sqrt(Math.pow(points[2].x-refPt.x,2) + Math.pow(points[2].y-refPt.y,2)));
|
||||
var dist4 = Math.round(Math.sqrt(Math.pow(points[3].x-refPt.x,2) + Math.pow(points[3].y-refPt.y,2)));
|
||||
var min = Math.min(dist1,dist2,dist3,dist4);
|
||||
if(min==dist1) {
|
||||
return points[0];
|
||||
} else if(min==dist2) {
|
||||
return points[1];
|
||||
} else if(min==dist3) {
|
||||
return points[2];
|
||||
} else {
|
||||
return points[3];
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @namespace oval
|
||||
*/
|
||||
|
||||
ovm.oval = function(xPixelSpacing,yPixelSpacing,measure_Unit,a,b,c,d,e) {
|
||||
// Variables
|
||||
var handle = 5;
|
||||
this.xPxlSpcing = xPixelSpacing;
|
||||
this.yPxlSpcing = yPixelSpacing;
|
||||
this.measureUnit = measure_Unit;
|
||||
if(this.measureUnit=="mm") {
|
||||
this.measureUnit = this.measureUnit + String.fromCharCode(178);
|
||||
}
|
||||
this.centerX=a;
|
||||
this.centerY=b;
|
||||
this.endX=c;
|
||||
this.endY=d;
|
||||
this.radiusX;
|
||||
this.radiusY;
|
||||
this.active = false;
|
||||
this.area = e;
|
||||
this.mean = "";
|
||||
this.stdDev = "";
|
||||
|
||||
// Text
|
||||
this.textX = a;
|
||||
this.textY = b-50;
|
||||
this.txtActive = false;
|
||||
this.txtArea = "Area : " + this.area + " " + this.measureUnit;
|
||||
this.txtMean = "Mean : ";
|
||||
this.txtStdDev = "StdDev : ";
|
||||
this.refX = 0;
|
||||
this.refY = 0;
|
||||
|
||||
// Functions
|
||||
this.setCoords = function(a,b,c,d,active) {
|
||||
this.centerX = Math.round((a-state.translationX)/state.scale);
|
||||
this.centerY = Math.round((b-state.translationY)/state.scale);
|
||||
this.endX = Math.round((c-state.translationX)/state.scale);
|
||||
this.endY = Math.round((d-state.translationY)/state.scale);
|
||||
this.radiusX = Math.round((this.endX-this.centerX)*this.xPxlSpcing);
|
||||
this.radiusY = Math.round((this.endY-this.centerY)*this.yPxlSpcing);
|
||||
this.active = active;
|
||||
this.area = ((Math.PI * this.radiusX*this.radiusY)/100).toFixed(3);
|
||||
this.area = (this.area<0) ? Math.abs(this.area) : this.area; //change (-)ve to (+)ve
|
||||
this.txtArea = "Area : " + this.area + " " + this.measureUnit;
|
||||
this.textX = this.centerX;
|
||||
this.textY = this.centerY - (this.endY-this.centerY) - (100/state.scale);
|
||||
this.findClosestPointOnOval();
|
||||
};
|
||||
|
||||
this.getType = function() {
|
||||
return "oval";
|
||||
};
|
||||
|
||||
this.isShapeSelection = function(canvasCtx,x,y) {
|
||||
var point = this.canvasToImgcoordinates({x:x,y:y});
|
||||
this.active = (((Math.pow(point.x-this.centerX,2)/Math.pow(this.endX-this.centerX,2))+(Math.pow(point.y-this.centerY,2)/Math.pow(this.endY-this.centerY,2))).toFixed(0)==1) ? true : false;
|
||||
return this.active || this.isTextSelection(canvasCtx,x,y);
|
||||
};
|
||||
|
||||
this.isActiveShape = function(canvasCtx,x,y) {
|
||||
var point = this.canvasToImgcoordinates({x:x,y:y});
|
||||
this.active = ((Math.pow(point.x-this.centerX,2)/Math.pow(this.radiusX,2))+(Math.pow(point.y-this.centerY,2)/Math.pow(this.radiusY,2))).toFixed(0)<=1 ? true : false;
|
||||
return this.active || this.isTextSelection(canvasCtx,x,y);
|
||||
};
|
||||
|
||||
this.detectHandle = function(x,y,target) {
|
||||
var point = this.canvasToImgcoordinates({x:x,y:y});
|
||||
var radX = this.endX-this.centerX;
|
||||
var radY = this.endY-this.centerY;
|
||||
|
||||
if(point.x>=(this.centerX-radX-handle) && point.x<=(this.centerX-radX+handle) && point.y>=(this.centerY-radY-handle) && point.y<=(this.centerY-radY+handle)) {
|
||||
target.style.cursor = 'nw-resize';
|
||||
return 0;
|
||||
} else if(point.x>=(this.centerX-handle) && point.x<=(this.centerX+handle) && point.y>=(this.centerY-radY-handle) && point.y<=(this.centerY-radY+handle)) {
|
||||
target.style.cursor = 'n-resize';
|
||||
return 1;
|
||||
} else if(point.x>=(this.centerX+radX-handle) && point.x<=(this.centerX+this.radX+handle) && point.y>=(this.centerY-radY-handle) && point.y<=(this.centerY-radY+handle)) {
|
||||
target.style.cursor = 'ne-resize';
|
||||
return 2;
|
||||
} else if(point.x>=(this.centerX-radX-handle) && point.x<=(this.centerX-radX+handle) && point.y>=(this.centerY-handle) && point.y<=(this.centerY+handle)) {
|
||||
target.style.cursor = 'w-resize';
|
||||
return 3;
|
||||
} else if(point.x>=(this.centerX+radX-handle) && point.x<=(this.centerX+radX+handle) && point.y>=(this.centerY-handle) && point.y<=(this.centerY+handle)) {
|
||||
target.style.cursor = 'e-resize';
|
||||
return 4;
|
||||
} else if(point.x>=(this.centerX-radX-handle) && point.x<=(this.centerX-radX+handle) && point.y>=(this.centerY+radY-handle) && point.y<=(this.centerY+radY+handle)) {
|
||||
target.style.cursor = 'sw-resize';
|
||||
return 5;
|
||||
} else if(point.x>=(this.centerX-handle) && point.x<=(this.centerX+handle) && point.y>=(this.centerY+radY-handle) && point.y<=(this.centerY+radY+handle)) {
|
||||
target.style.cursor = 's-resize';
|
||||
return 6;
|
||||
} else if(point.x>=(this.centerX+radX-handle) && point.x<=(this.centerX+radX+handle) && point.y>=(this.centerY+radY-handle) && point.y<=(this.centerY+radY+handle)) {
|
||||
target.style.cursor = 'se-resize';
|
||||
return 7;
|
||||
} else {
|
||||
target.style.cursor = 'default';
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
this.moveShape = function(deltaX,deltaY) {
|
||||
if(this.active) {
|
||||
this.centerX+=deltaX;
|
||||
this.centerY+=deltaY;
|
||||
this.endX+=deltaX;
|
||||
this.endY+=deltaY;
|
||||
this.radiusX = Math.round((this.endX-this.centerX)*this.xPxlSpcing);
|
||||
this.radiusY = Math.round((this.endY-this.centerY)*this.yPxlSpcing);
|
||||
this.txtMean = "Mean : ";
|
||||
this.txtStdDev = "StdDev : ";
|
||||
}
|
||||
this.textX+=deltaX;
|
||||
this.textY+=deltaY;
|
||||
this.findClosestPointOnOval();
|
||||
};
|
||||
|
||||
this.resizeShape = function(deltaX,deltaY,handle) {
|
||||
switch(handle) {
|
||||
case 0:
|
||||
this.centerX+=deltaX;
|
||||
this.centerY+=deltaY;
|
||||
break;
|
||||
case 1:
|
||||
this.centerY+=deltaY;
|
||||
break;
|
||||
case 2:
|
||||
this.endX+=deltaX;
|
||||
this.centerY+=deltaY;
|
||||
break;
|
||||
case 3:
|
||||
this.centerX+=deltaX;
|
||||
break;
|
||||
case 4:
|
||||
this.endX+=deltaX*2;
|
||||
this.centerX+=deltaX;
|
||||
break;
|
||||
case 5:
|
||||
this.centerX+=deltaX;
|
||||
this.endY+=deltaY;
|
||||
break;
|
||||
case 6:
|
||||
this.endY+=deltaY*2;
|
||||
this.centerY+=deltaY;
|
||||
break;
|
||||
case 7:
|
||||
this.endX+=deltaX;
|
||||
this.endY+=deltaY;
|
||||
break;
|
||||
}
|
||||
this.radiusX = Math.round((this.endX-this.centerX)*this.xPxlSpcing);
|
||||
this.radiusY = Math.round((this.endY-this.centerY)*this.yPxlSpcing);
|
||||
this.area = ((Math.PI * this.radiusX*this.radiusY)/100).toFixed(3);
|
||||
this.txtArea = "Area : " + this.area + " " + this.measureUnit;
|
||||
this.txtMean = "Mean : ";
|
||||
this.txtStdDev = "StdDev : ";
|
||||
this.findClosestPointOnOval();
|
||||
|
||||
};
|
||||
|
||||
this.meanOfOval = function() {
|
||||
|
||||
var tempX,tempY,tempX2,tempY2,xAxisDifference = false,yAxisDifference =false,xyAxisDifference = false;
|
||||
if (this.centerX>this.endX && this.centerY < this.endY) {
|
||||
tempX = this.centerX;
|
||||
this.centerX = this.endX;
|
||||
this.endX = tempX;
|
||||
xAxisDifference = true;
|
||||
}
|
||||
|
||||
if(this.centerX < this.endX && this.centerY > this.endY) {
|
||||
tempY = this.centerY;
|
||||
this.centerY = this.endY;
|
||||
this.endY = tempY;
|
||||
yAxisDifference = true;
|
||||
}
|
||||
if(this.centerX>this.endX && this.centerY > this.endY){
|
||||
tempX2 = this.centerX;
|
||||
tempY2 = this.centerY;
|
||||
this.centerX = this.endX;
|
||||
this.centerY = this.endY;
|
||||
this.endX = tempX2;
|
||||
this.endY = tempY2;
|
||||
xyAxisDifference = true;
|
||||
}
|
||||
|
||||
var sum = 0, pixelCount = 0;
|
||||
for(var i = this.centerX;i<this.endX;i++) {
|
||||
for(var j = this.centerY;j<this.endY;j++) {
|
||||
if(this.pointInsideOval(i,j)) {
|
||||
++pixelCount;
|
||||
var pixel = getPixelValAt(i,j);
|
||||
if(pixel!=undefined) {
|
||||
sum+=pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(xAxisDifference == true) {
|
||||
tempX = this.centerX;
|
||||
this.centerX = this.endX;
|
||||
this.endX = tempX;
|
||||
xAxisDifference = false;
|
||||
}
|
||||
if(yAxisDifference == true) {
|
||||
tempY = this.centerY;
|
||||
this.centerY = this.endY;
|
||||
this.endY = tempY;
|
||||
yAxisDifference = false;
|
||||
}
|
||||
if(xyAxisDifference == true) {
|
||||
tempX2 = this.centerX;
|
||||
tempY2 = this.centerY;
|
||||
this.centerX = this.endX;
|
||||
this.centerY = this.endY;
|
||||
this.endX = tempX2;
|
||||
this.endY = tempY2;
|
||||
xyAxisDifference = false;
|
||||
}
|
||||
|
||||
if(pixelCount==0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
this.mean = (sum/pixelCount).toFixed(3);
|
||||
this.txtMean = "Mean : " + this.mean;
|
||||
};
|
||||
|
||||
this.stdDevOfOval = function() {
|
||||
|
||||
var tempX,tempY,tempX2,tempY2,xAxisDifference = false,yAxisDifference =false,xyAxisDifference = false;
|
||||
if ( this.centerX>this.endX && this.centerY < this.endY) {
|
||||
tempX = this.centerX;
|
||||
this.centerX = this.endX;
|
||||
this.endX = tempX;
|
||||
xAxisDifference = true;
|
||||
}
|
||||
if(this.centerX < this.endX && this.centerY > this.endY) {
|
||||
tempY = this.centerY;
|
||||
this.centerY = this.endY;
|
||||
this.endY = tempY;
|
||||
yAxisDifference = true;
|
||||
}
|
||||
if(this.centerX>this.endX && this.centerY > this.endY){
|
||||
tempX2 = this.centerX;
|
||||
tempY2 = this.centerY;
|
||||
this.centerX = this.endX;
|
||||
this.centerY = this.endY;
|
||||
this.endX = tempX2;
|
||||
this.endY = tempY2;
|
||||
xyAxisDifference = true;
|
||||
}
|
||||
|
||||
var sum = 0,pixelCount = 0;
|
||||
for(var i = this.centerX;i<this.endX;i++) {
|
||||
for(var j = this.centerY;j<this.endY;j++) {
|
||||
if(this.pointInsideOval(i,j)) {
|
||||
++pixelCount;
|
||||
var value = getPixelValAt(i,j);
|
||||
if(value!="undefined") {
|
||||
var deviation = value - this.mean;
|
||||
sum+=deviation * deviation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(xAxisDifference == true) {
|
||||
tempX = this.centerX;
|
||||
this.centerX = this.endX;
|
||||
this.endX = tempX;
|
||||
xAxisDifference = false;
|
||||
}
|
||||
if(yAxisDifference == true) {
|
||||
tempY = this.centerY;
|
||||
this.centerY = this.endY;
|
||||
this.endY = tempY;
|
||||
yAxisDifference = false;
|
||||
}
|
||||
if(xyAxisDifference == true) {
|
||||
tempX2 = this.centerX;
|
||||
tempY2 = this.centerY;
|
||||
this.centerX = this.endX;
|
||||
this.centerY = this.endY;
|
||||
this.endX = tempX2;
|
||||
this.endY = tempY2;
|
||||
xyAxisDifference = false;
|
||||
}
|
||||
|
||||
if(pixelCount==0) {
|
||||
return 0;
|
||||
}
|
||||
this.stdDev = Math.sqrt(sum/pixelCount).toFixed(3);
|
||||
this.txtStdDev = "StdDev : " + this.stdDev;
|
||||
};
|
||||
|
||||
this.measure = function() {
|
||||
this.meanOfOval();
|
||||
this.stdDevOfOval();
|
||||
};
|
||||
|
||||
this.pointInsideOval = function(pointX,pointY) {
|
||||
return ((Math.pow(pointX-this.centerX,2)/Math.pow(this.endX,2))+(Math.pow(pointY-this.centerY,2)/Math.pow(this.endY,2))).toFixed(0)<=1;
|
||||
};
|
||||
|
||||
this.canvasToImgcoordinates = function(point) {
|
||||
return {x:((point.x-state.translationX)/state.scale),y:((point.y-state.translationY)/state.scale)};
|
||||
};
|
||||
|
||||
this.ImgTocanvascoordinates = function(point) {
|
||||
return {x:point.x*state.scale+state.translationX,y:point.y*state.scale+state.translationY};
|
||||
};
|
||||
|
||||
this.isTextSelection = function(canvasCtx,mouseX,mouseY) {
|
||||
var point = this.canvasToImgcoordinates({x:mouseX,y:mouseY});
|
||||
|
||||
var text = canvasCtx.measureText(this.txtStdDev.length>this.txtArea.length? this.txtStdDev : this.txtArea);
|
||||
this.txtActive = (point.x>=this.textX && point.x<=this.textX+(Math.ceil((text.width+state.translationX)/state.scale)) && point.y>=this.textY && point.y<=(this.textY+(60/state.scale)));
|
||||
return this.txtActive;
|
||||
};
|
||||
|
||||
this.findClosestPointOnOval = function(ex,ey,ea,eb,x,y) {
|
||||
var angle = Math.atan2(this.centerY-this.textY,this.centerX-this.textX) * 180 / Math.PI;
|
||||
this.refX = this.centerX - (this.endX-this.centerX) * Math.cos(angle*Math.PI/180);
|
||||
this.refY = this.centerY - (this.endY-this.centerY) * Math.sin(angle*Math.PI/180);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @namespace Main Oviyam namespace.
|
||||
*/
|
||||
var ovm = ovm || {};
|
||||
@@ -0,0 +1,579 @@
|
||||
/**
|
||||
* Definition of shape Rectangles
|
||||
*/
|
||||
|
||||
ovm.shape.rect = function(xPixelSpacing,yPixelSpacing,measure_Unit) {
|
||||
var handle = 5;
|
||||
var rects = [];
|
||||
var curr_rect = null;
|
||||
var xPxlSpcing = xPixelSpacing;
|
||||
var yPxlSpcing = yPixelSpacing;
|
||||
var measureUnit = measure_Unit;
|
||||
var isCurrentDrawingRect = false;
|
||||
|
||||
this.createNewRect = function(x1,y1,x2,y2) {
|
||||
if(curr_rect!=undefined) {
|
||||
curr_rect.setCoords(x1,y1,x2,y2,false);
|
||||
// if(parseFloat(curr_rect.area)>0.0) { // To avoid rectangle in (-)ve area
|
||||
curr_rect.meanOfRect();
|
||||
curr_rect.stdDevOfRect();
|
||||
rects.push(curr_rect);
|
||||
curr_rect = undefined;
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
this.initNewRect = function() {
|
||||
curr_rect = new ovm.rect(xPxlSpcing, yPxlSpcing, measureUnit, 0, 0, 0, 0, 0);
|
||||
};
|
||||
|
||||
this.draw = function(graphic,canvasCtx) {
|
||||
canvasCtx.lineWidth='2';
|
||||
canvasCtx.strokeStyle=canvasCtx.fillStyle='orange';
|
||||
var w = graphic.x2-graphic.x1;
|
||||
var h = graphic.y2-graphic.y1;
|
||||
canvasCtx.strokeRect(graphic.x1,graphic.y1,w,h);
|
||||
|
||||
// Handles
|
||||
if(graphic.active) {
|
||||
canvasCtx.strokeStyle = canvasCtx.fillStyle = 'white';
|
||||
canvasCtx.strokeRect(graphic.x1-handle,graphic.y1-handle,handle*2,handle*2);
|
||||
canvasCtx.strokeRect(graphic.x1+(w/2)-handle,graphic.y1-handle,handle*2,handle*2);
|
||||
canvasCtx.strokeRect((graphic.x1+w)-handle,graphic.y1-handle,handle*2,handle*2);
|
||||
canvasCtx.strokeRect(graphic.x1-handle,graphic.y1+(h/2)-handle,handle*2,handle*2);
|
||||
canvasCtx.strokeRect((graphic.x1+w)-handle,graphic.y1+(h/2)-handle,handle*2,handle*2);
|
||||
canvasCtx.strokeRect(graphic.x1-handle,(graphic.y1+h)-handle,handle*2,handle*2);
|
||||
canvasCtx.strokeRect(graphic.x1+(w/2)-handle,(graphic.y1+h)-handle,handle*2,handle*2);
|
||||
canvasCtx.strokeRect((graphic.x1+w)-handle,(graphic.y1+h)-handle,handle*2,handle*2);
|
||||
}
|
||||
|
||||
// Text
|
||||
canvasCtx.fillStyle = graphic.txtActive? "blue" : "maroon";
|
||||
canvasCtx.globalAlpha = 0.5;
|
||||
canvasCtx.font = "14px Arial";
|
||||
|
||||
var text = canvasCtx.measureText(graphic.stdDev.length>graphic.area.length? graphic.stdDev : graphic.area);
|
||||
canvasCtx.fillRect(graphic.textX,graphic.textY,Math.ceil(text.width)+10,60);
|
||||
canvasCtx.globalAlpha = 0.9;
|
||||
canvasCtx.fillStyle = "white";
|
||||
//canvasCtx.fillText(graphic.area,graphic.textX+2,graphic.textY+15);
|
||||
//canvasCtx.fillText(graphic.mean,graphic.textX+2,graphic.textY+35);
|
||||
//canvasCtx.fillText(graphic.stdDev,graphic.textX+2,graphic.textY+55);
|
||||
|
||||
if(state.hflip && !state.vflip && !state.rotate!=0 && !this.isCurrentDrawingRect){
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width,0);
|
||||
canvasCtx.scale(-1,1);
|
||||
canvasCtx.fillText(graphic.area,(drawCanvas.width -graphic.textX+2)-135,graphic.textY+15);
|
||||
canvasCtx.fillText(graphic.mean,(drawCanvas.width -graphic.textX+2)-135,graphic.textY+35);
|
||||
canvasCtx.fillText(graphic.stdDev,(drawCanvas.width -graphic.textX+2)-135,graphic.textY+55);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
if(state.vflip && !state.hflip && !state.rotate!=0 && !this.isCurrentDrawingRect){
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(0,drawCanvas.height);
|
||||
canvasCtx.scale(1,-1);
|
||||
canvasCtx.fillText(graphic.area, graphic.textX+2,(drawCanvas.height -graphic.textY)-48);
|
||||
canvasCtx.fillText(graphic.mean, graphic.textX+2,(drawCanvas.height -graphic.textY)-28);
|
||||
canvasCtx.fillText(graphic.stdDev, graphic.textX+2,(drawCanvas.height -graphic.textY)-8);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
|
||||
if(!state.vflip && state.hflip && (state.rotate===90 || state.rotate===180 || state.rotate===270) && !this.isCurrentDrawingRect){
|
||||
if(state.rotate===90 || state.rotate===180 || state.rotate===270) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(0,drawCanvas.height);
|
||||
canvasCtx.scale(1,-1);
|
||||
|
||||
canvasCtx.fillText(graphic.area,graphic.textX+2,(drawCanvas.height -graphic.textY)-50);
|
||||
canvasCtx.fillText(graphic.mean,graphic.textX+2,(drawCanvas.height -graphic.textY)-30);
|
||||
canvasCtx.fillText(graphic.stdDev,graphic.textX+2,(drawCanvas.height -graphic.textY)-10);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
if(state.vflip && !state.hflip && (state.rotate===90 || state.rotate===180 || state.rotate===270) && !this.isCurrentDrawingRect){
|
||||
if(state.rotate===90 || state.rotate===180 || state.rotate===270) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width,0);
|
||||
canvasCtx.scale(-1,1);
|
||||
|
||||
canvasCtx.fillText(graphic.area,(drawCanvas.width -graphic.textX+2)-130,graphic.textY+15);
|
||||
canvasCtx.fillText(graphic.mean,(drawCanvas.width -graphic.textX+2)-130,graphic.textY+35);
|
||||
canvasCtx.fillText(graphic.stdDev,(drawCanvas.width -graphic.textX+2)-130,graphic.textY+55);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
if(state.rotate!=0 && !state.vflip && !state.hflip && !this.isCurrentDrawingRect) {
|
||||
if(state.rotate===180) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width/2,drawCanvas.height/2);
|
||||
canvasCtx.rotate(Math.PI);
|
||||
canvasCtx.translate(-drawCanvas.width/2,-drawCanvas.height/2);
|
||||
|
||||
canvasCtx.fillText(graphic.area,(drawCanvas.width -graphic.textX)-130, (drawCanvas.height -graphic.textY)-50);
|
||||
canvasCtx.fillText(graphic.mean, (drawCanvas.width -graphic.textX)-130, (drawCanvas.height -graphic.textY)-30);
|
||||
canvasCtx.fillText(graphic.stdDev, (drawCanvas.width -graphic.textX)-130, (drawCanvas.height -graphic.textY)-10);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
|
||||
else {
|
||||
canvasCtx.fillText(graphic.area,graphic.textX+2,graphic.textY+15);
|
||||
canvasCtx.fillText(graphic.mean,graphic.textX+2,graphic.textY+35);
|
||||
canvasCtx.fillText(graphic.stdDev,graphic.textX+2,graphic.textY+55);
|
||||
}
|
||||
}
|
||||
|
||||
if((state.rotate===0 || state.rotate===90 || state.rotate===180 || state.rotate===270) && state.vflip && state.hflip && !this.isCurrentDrawingRect) {
|
||||
if(state.rotate===0) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width,drawCanvas.height);
|
||||
canvasCtx.scale(-1,-1);
|
||||
|
||||
canvasCtx.fillText(graphic.area,(drawCanvas.width -graphic.textX+2)-135,(drawCanvas.height -graphic.textY)-50);
|
||||
canvasCtx.fillText(graphic.mean,(drawCanvas.width -graphic.textX+2)-135,(drawCanvas.height -graphic.textY)-30);
|
||||
canvasCtx.fillText(graphic.stdDev,(drawCanvas.width -graphic.textX+2)-135,(drawCanvas.height -graphic.textY)-10);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
else {
|
||||
canvasCtx.fillText(graphic.area,graphic.textX+2,graphic.textY+15);
|
||||
canvasCtx.fillText(graphic.mean,graphic.textX+2,graphic.textY+35);
|
||||
canvasCtx.fillText(graphic.stdDev,graphic.textX+2,graphic.textY+55);
|
||||
}
|
||||
}
|
||||
|
||||
if((!state.rotate===0 || !state.rotate===90 || !state.rotate===180 || !state.rotate===270) && state.hflip && state.vflip && !this.isCurrentDrawingRect) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.translate(drawCanvas.width,drawCanvas.height);
|
||||
canvasCtx.scale(-1,-1);
|
||||
|
||||
canvasCtx.fillText(graphic.area,(drawCanvas.width -graphic.textX+2)-135,(drawCanvas.height -graphic.textY)-50);
|
||||
canvasCtx.fillText(graphic.mean,(drawCanvas.width -graphic.textX+2)-135,(drawCanvas.height -graphic.textY)-30);
|
||||
canvasCtx.fillText(graphic.stdDev,(drawCanvas.width -graphic.textX+2)-135,(drawCanvas.height -graphic.textY)-10);
|
||||
canvasCtx.restore();
|
||||
}
|
||||
|
||||
if(!state.hflip && !state.vflip && !state.rotate!=0 ) {
|
||||
//canvasCtx.save();
|
||||
canvasCtx.fillText(graphic.area,graphic.textX+2,graphic.textY+15);
|
||||
canvasCtx.fillText(graphic.mean,graphic.textX+2,graphic.textY+35);
|
||||
canvasCtx.fillText(graphic.stdDev,graphic.textX+2,graphic.textY+55);
|
||||
//canvasCtx.restore();
|
||||
}
|
||||
|
||||
if(this.isCurrentDrawingRect) {
|
||||
canvasCtx.fillText(graphic.area,graphic.textX+2,graphic.textY+15);
|
||||
canvasCtx.fillText(graphic.mean,graphic.textX+2,graphic.textY+35);
|
||||
canvasCtx.fillText(graphic.stdDev,graphic.textX+2,graphic.textY+55);
|
||||
}
|
||||
|
||||
// Reference Lines
|
||||
if(graphic.x1!=graphic.textX) {
|
||||
canvasCtx.save();
|
||||
canvasCtx.beginPath();
|
||||
canvasCtx.strokeStyle = "yellow";
|
||||
canvasCtx.setLineDash([10,7]);
|
||||
var closestPt = this.getClosestAnchor([{x:graphic.textX,y:graphic.textY},{x:graphic.textX+Math.ceil(text.width+10),y:graphic.textY},{x:graphic.textX,y:graphic.textY+60},{x:graphic.textX+Math.ceil(text.width+10),y:graphic.textY+60}],{x:graphic.refX,y:graphic.refY});
|
||||
canvasCtx.moveTo(closestPt.x, closestPt.y);
|
||||
canvasCtx.lineTo(graphic.refX,graphic.refY);
|
||||
canvasCtx.stroke();
|
||||
canvasCtx.closePath();
|
||||
canvasCtx.restore();
|
||||
}
|
||||
};
|
||||
|
||||
this.drawData = function(ctx) {
|
||||
ctx.save();
|
||||
|
||||
for(var i=0;i<rects.length;i++) {
|
||||
this.draw(this.viewPortGraphic(rects[i]),ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
};
|
||||
|
||||
this.drawRect = function(canvasCtx,x1,y1,x2,y2) {
|
||||
curr_rect.setCoords(x1,y1,x2,y2,true);
|
||||
this.isCurrentDrawingRect = true;
|
||||
canvasCtx.save();
|
||||
canvasCtx.strokeStyle=canvasCtx.fillStyle='orange';
|
||||
canvasCtx.lineWidth='2';
|
||||
this.draw(this.viewPortGraphic(curr_rect),canvasCtx);
|
||||
this.isCurrentDrawingRect = false;
|
||||
canvasCtx.restore();
|
||||
};
|
||||
|
||||
this.getActiveRect = function(canvasCtx,x,y) {
|
||||
for(var i=0;i<rects.length;i++) {
|
||||
var rect = rects[i];
|
||||
if(rect.isShapeSelection(canvasCtx,x,y)) {
|
||||
return rect;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
this.viewPortGraphic = function(shape) {
|
||||
return {
|
||||
x1:shape.x1*state.scale+state.translationX,
|
||||
y1:shape.y1*state.scale+state.translationY,
|
||||
x2:shape.x2*state.scale+state.translationX,
|
||||
y2:shape.y2*state.scale+state.translationY,
|
||||
textX:shape.textX*state.scale+state.translationX,
|
||||
textY:shape.textY*state.scale+state.translationY,
|
||||
refX:shape.refX*state.scale+state.translationX,
|
||||
refY:shape.refY*state.scale+state.translationY,
|
||||
active:shape.active,
|
||||
txtActive:shape.txtActive,
|
||||
area:shape.txtArea,
|
||||
mean:shape.txtMean,
|
||||
stdDev:shape.txtStdDev
|
||||
};
|
||||
};
|
||||
|
||||
this.canvasToImgCoordinates = function(point) {
|
||||
return {x:(point.x-state.translationX)/state.scale,y:(point.y-state.translationY)/state.scale};
|
||||
};
|
||||
|
||||
this.removeShape = function(shape) {
|
||||
rects.splice(rects.indexOf(shape), 1);
|
||||
};
|
||||
|
||||
this.clearAll = function() {
|
||||
rects = [];
|
||||
};
|
||||
|
||||
this.getClosestAnchor = function(points,refPt) {
|
||||
var dist1 = Math.round(Math.sqrt(Math.pow(points[0].x-refPt.x,2) + Math.pow(points[0].y-refPt.y,2)));
|
||||
var dist2 = Math.round(Math.sqrt(Math.pow(points[1].x-refPt.x,2) + Math.pow(points[1].y-refPt.y,2)));
|
||||
var dist3 = Math.round(Math.sqrt(Math.pow(points[2].x-refPt.x,2) + Math.pow(points[2].y-refPt.y,2)));
|
||||
var dist4 = Math.round(Math.sqrt(Math.pow(points[3].x-refPt.x,2) + Math.pow(points[3].y-refPt.y,2)));
|
||||
var min = Math.min(dist1,dist2,dist3,dist4);
|
||||
|
||||
switch(min) {
|
||||
case dist1:
|
||||
return points[0];
|
||||
case dist2:
|
||||
return points[1];
|
||||
case dist3:
|
||||
return points[2];
|
||||
case dist4:
|
||||
return points[3];
|
||||
default:
|
||||
return points[0];
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @namespace rect
|
||||
*/
|
||||
|
||||
ovm.rect = function(xPixelSpacing,yPixelSpacing,measure_Unit,a,b,c,d,e) {
|
||||
// Variables
|
||||
var handle = 5;
|
||||
this.xPxlSpcing = xPixelSpacing;
|
||||
this.yPxlSpcing = yPixelSpacing;
|
||||
this.measureUnit = measure_Unit;
|
||||
if(this.measureUnit=="cm") {
|
||||
this.measureUnit = this.measureUnit + String.fromCharCode(178);
|
||||
}
|
||||
this.x1=a;
|
||||
this.y1=b;
|
||||
this.x2=c;
|
||||
this.y2=d;
|
||||
this.width;
|
||||
this.height;
|
||||
this.active = false;
|
||||
this.area = e;
|
||||
this.mean = "";
|
||||
this.stdDev = "";
|
||||
|
||||
// Text
|
||||
this.textX = a;
|
||||
this.textY = b-50;
|
||||
this.txtActive = false;
|
||||
this.txtArea = "Area : " + this.area + " " + this.measureUnit;
|
||||
this.txtMean = "Mean : ";
|
||||
this.txtStdDev = "StdDev : ";
|
||||
this.refX = 0;
|
||||
this.refY = 0;
|
||||
|
||||
// Functions
|
||||
this.setCoords = function(a,b,c,d,active) {
|
||||
this.x1 = Math.round((a-state.translationX)/state.scale);
|
||||
this.y1 = Math.round((b-state.translationY)/state.scale);
|
||||
this.x2 = Math.round((c-state.translationX)/state.scale);
|
||||
this.y2 = Math.round((d-state.translationY)/state.scale);
|
||||
this.width = Math.round((this.x2-this.x1)*this.xPxlSpcing);
|
||||
this.width = (this.width<0) ? Math.abs(this.width) : this.width; //Mouse drag opposite canvas direction (-)ve
|
||||
this.height = Math.round((this.y2-this.y1)*this.yPxlSpcing);
|
||||
this.height = (this.height<0) ? Math.abs(this.height) : this.height; //Mouse drag opposite canvas direction (-)ve
|
||||
this.active = active;
|
||||
this.area = ((this.width*this.height)/100).toFixed(3);
|
||||
this.area = (this.area<0) ? Math.abs(this.area) : this.area; //width or height (-)ve, change to (+)ve
|
||||
this.txtArea = "Area : " + this.area + " " + this.measureUnit;
|
||||
this.textX = this.x1;
|
||||
this.textY = this.y1-(100/state.scale);
|
||||
this.fixReferenceLinePoints();
|
||||
};
|
||||
|
||||
this.getType = function() {
|
||||
return "rect";
|
||||
};
|
||||
|
||||
this.isShapeSelection = function(canvasCtx,x,y) {
|
||||
var point = this.canvasToImgcoordinates({x:x,y:y});
|
||||
var w = this.x2-this.x1,h = this.y2-this.y1;
|
||||
point = {x:Math.round(point.x),y:Math.round(point.y)};
|
||||
|
||||
this.active = this.isLineIntersects(this.x1,this.y1,this.x1+w,this.y1,point.x,point.y) || this.isLineIntersects(this.x1,this.y1+h,this.x1+w,this.y1+h,point.x,point.y) || this.isLineIntersects(this.x1,this.y1,this.x1,this.y1+h,point.x,point.y) || this.isLineIntersects(this.x1+w,this.y1,this.x1+w,this.y1+h,point.x,point.y);
|
||||
|
||||
return this.active || this.isTextSelection(canvasCtx,x,y);
|
||||
};
|
||||
|
||||
|
||||
this.isActiveShape = function(canvasCtx,x,y) {
|
||||
var point = this.canvasToImgcoordinates({x:x,y:y});
|
||||
var w = this.x2-this.x1,h = this.y2-this.y1;
|
||||
this.active = (this.x1<=point.x && this.x1+w>=point.x && this.y1<=point.y && this.y1+h>=point.y) ? true : false;
|
||||
return this.active || this.isTextSelection(canvasCtx,x,y);
|
||||
};
|
||||
|
||||
this.detectHandle = function(x,y,target) {
|
||||
var point = this.canvasToImgcoordinates({x:x,y:y});
|
||||
var w = this.x2-this.x1;
|
||||
var h = this.y2-this.y1;
|
||||
|
||||
if(point.x>=this.x1-handle && point.x<=this.x1+handle && point.y>=this.y1-handle && point.y<=this.y1+handle) {
|
||||
target.style.cursor = 'nw-resize';
|
||||
return 0;
|
||||
} else if(point.x>=((this.x1+(w/2))-handle) && point.x<=((this.x1+(w/2))+handle) && point.y>=this.y1-handle && point.y<=this.y1+handle) {
|
||||
target.style.cursor = 'n-resize';
|
||||
return 1;
|
||||
} else if(point.x>=((this.x1+w)-handle) && point.x<=(this.x1+w+handle) && point.y>=this.y1-handle && point.y<=this.y1+handle) {
|
||||
target.style.cursor = 'ne-resize';
|
||||
return 2;
|
||||
} else if(point.x>=this.x1-handle && point.x<=this.x1+handle && point.y>=((this.y1+(h/2))-handle) && point.y<=((this.y1+(h/2))+handle)) {
|
||||
target.style.cursor = 'w-resize';
|
||||
return 3;
|
||||
} else if(point.x>=((this.x1+w)-handle) && point.x<=(this.x1+w+handle) && point.y>=((this.y1+(h/2))-handle) && point.y<=((this.y1+(h/2))+handle)) {
|
||||
target.style.cursor = 'e-resize';
|
||||
return 4;
|
||||
} else if(point.x>=(this.x1-handle) && point.x<=(this.x1+handle) && point.y>=((this.y1+h)-handle) && point.y<=(this.y1+h+handle)) {
|
||||
target.style.cursor = 'sw-resize';
|
||||
return 5;
|
||||
} else if(point.x>=((this.x1+(w/2))-handle) && point.x<=((this.x1+(w/2))+handle) && point.y>=((this.y1+h)-handle) && point.y<=(this.y1+h+handle)) {
|
||||
target.style.cursor = 's-resize';
|
||||
return 6;
|
||||
} else if(point.x>=((this.x1+w)-handle) && point.x<=(this.x1+w+handle) && point.y>=((this.y1+h)-handle) && point.y<=(this.y1+h+handle)) {
|
||||
target.style.cursor = 'se-resize';
|
||||
return 7;
|
||||
} else {
|
||||
target.style.cursor = 'default';
|
||||
return -1;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.moveShape = function(deltaX,deltaY) {
|
||||
if(this.active) {
|
||||
this.x1+=deltaX;
|
||||
this.y1+=deltaY;
|
||||
this.x2+=deltaX;
|
||||
this.y2+=deltaY;
|
||||
|
||||
this.width = Math.round((this.x2-this.x1)*this.xPxlSpcing);
|
||||
this.height = Math.round((this.y2-this.y1)*this.yPxlSpcing);
|
||||
this.txtMean = "Mean : ";
|
||||
this.txtStdDev = "StdDev : ";
|
||||
}
|
||||
this.textX+=deltaX;
|
||||
this.textY+=deltaY;
|
||||
this.fixReferenceLinePoints();
|
||||
};
|
||||
|
||||
this.resizeShape = function(deltaX,deltaY,handle) {
|
||||
switch(handle) {
|
||||
case 0:
|
||||
this.x1+=deltaX;
|
||||
this.y1+=deltaY;
|
||||
break;
|
||||
case 1:
|
||||
this.y1+=deltaY;
|
||||
break;
|
||||
case 2:
|
||||
this.x2+=deltaX;
|
||||
this.y1+=deltaY;
|
||||
break;
|
||||
case 3:
|
||||
this.x1+=deltaX;
|
||||
break;
|
||||
case 4:
|
||||
this.x2+=deltaX;
|
||||
break;
|
||||
case 5:
|
||||
this.x1+=deltaX;
|
||||
this.y2+=deltaY;
|
||||
break;
|
||||
case 6:
|
||||
this.y2+=deltaY;
|
||||
break;
|
||||
case 7:
|
||||
this.x2+=deltaX;
|
||||
this.y2+=deltaY;
|
||||
break;
|
||||
}
|
||||
this.textX+=deltaX;
|
||||
this.textY+=deltaY;
|
||||
|
||||
this.width = Math.round((this.x2-this.x1)*this.xPxlSpcing);
|
||||
this.height = Math.round((this.y2-this.y1)*this.yPxlSpcing);
|
||||
this.area = ((this.width*this.height)/100).toFixed(3);
|
||||
this.txtArea = "Area : " + this.area + " " + this.measureUnit;
|
||||
this.txtMean = "Mean : ";
|
||||
this.txtStdDev = "StdDev : ";
|
||||
this.fixReferenceLinePoints();
|
||||
};
|
||||
|
||||
this.meanOfRect = function() {
|
||||
var sum = 0, pixelCount = 0;
|
||||
|
||||
for(var i = this.x1;i<this.x1+this.width;i++) {
|
||||
for(var j = this.y1;j<this.y1+this.height;j++) {
|
||||
++pixelCount;
|
||||
var pixel = getPixelValAt(i,j);
|
||||
if(pixel!=undefined) {
|
||||
sum+=pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(pixelCount==0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
this.mean = (sum/pixelCount).toFixed(3);
|
||||
this.txtMean = "Mean : " + this.mean;
|
||||
};
|
||||
|
||||
this.stdDevOfRect = function() {
|
||||
var sum = 0,pixelCount = 0;
|
||||
for(var i = this.x1;i<this.x1+this.width;i++) {
|
||||
for(var j = this.y1;j<this.y1+this.height;j++) {
|
||||
++pixelCount;
|
||||
var value = getPixelValAt(i,j);
|
||||
if(value!="undefined") {
|
||||
var deviation = value - this.mean;
|
||||
sum+=deviation * deviation;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(pixelCount==0) {
|
||||
return 0;
|
||||
}
|
||||
this.stdDev = Math.sqrt(sum/pixelCount).toFixed(3);
|
||||
this.txtStdDev = "StdDev : " + this.stdDev;
|
||||
};
|
||||
|
||||
this.measure = function() {
|
||||
this.meanOfRect();
|
||||
this.stdDevOfRect();
|
||||
};
|
||||
|
||||
this.canvasToImgcoordinates = function(point) {
|
||||
return {x:((point.x-state.translationX)/state.scale),y:((point.y-state.translationY)/state.scale)};
|
||||
};
|
||||
|
||||
this.ImgTocanvascoordinates = function(point) {
|
||||
return {x:point.x*state.scale+state.translationX,y:point.y*state.scale+state.translationY};
|
||||
};
|
||||
|
||||
this.isTextSelection = function(canvasCtx,mouseX,mouseY) {
|
||||
var point = this.canvasToImgcoordinates({x:mouseX,y:mouseY});
|
||||
|
||||
var text = canvasCtx.measureText(this.txtStdDev.length>this.txtArea.length? this.txtStdDev : this.txtArea);
|
||||
this.txtActive = (point.x>=this.textX && point.x<=this.textX+(Math.ceil((text.width+state.translationX)/state.scale)) && point.y>=this.textY && point.y<=(this.textY+(60/state.scale)));
|
||||
return this.txtActive;
|
||||
};
|
||||
|
||||
this.isLineIntersects = function(x1,y1,x2,y2,x,y) {
|
||||
var a = Math.round(Math.sqrt(Math.pow((x2+handle)-(x1+handle),2) + Math.pow((y2+handle)-(y1+handle),2)));
|
||||
var b = Math.round(Math.sqrt(Math.pow(x-(x1+handle),2) + Math.pow(y-(y1+handle),2)));
|
||||
var c = Math.round(Math.sqrt(Math.pow((x2+handle)-x,2) + Math.pow((y2+handle)-y,2)));
|
||||
return (a==b+c);
|
||||
};
|
||||
|
||||
this.fixReferenceLinePoints = function() {
|
||||
if(this.textX>=this.x1 && this.textX<=this.x2 && this.textY<=this.y1 && this.textY<=this.y2 && this.isPtWithinLine({x:this.x1,y:this.y1}, {x:this.x2,y:this.y1}, {x:this.textX,y:this.textY})) {
|
||||
this.findClosestPointForLine({x:this.x1,y:this.y1}, {x:this.x2,y:this.y1}, {x:this.textX,y:this.textY});
|
||||
}
|
||||
else if(this.textY>=this.y1 && this.textY<=this.y2 && this.textX<=this.x1 && this.textX<=this.x2 && this.isPtWithinLine({x:this.x1,y:this.y1}, {x:this.x1,y:this.y2}, {x:this.textX,y:this.textY})) {
|
||||
this.findClosestPointForLine({x:this.x1,y:this.y1}, {x:this.x1,y:this.y2}, {x:this.textX,y:this.textY});
|
||||
}
|
||||
else if(this.textX>=this.x1 && this.textX<=this.x2 && this.textY>=this.y1 && this.textY>=this.y2 && this.isPtWithinLine({x:this.x1,y:this.y2},{x:this.x2,y:this.y2},{x:this.textX,y:this.textY})) {
|
||||
this.findClosestPointForLine({x:this.x1,y:this.y2},{x:this.x2,y:this.y2},{x:this.textX,y:this.textY});
|
||||
}
|
||||
else if(this.textY>=this.y1 && this.textY<=this.y2 && this.textX>=this.x1 && this.textX>=this.x2 && this.isPtWithinLine({x:this.x2,y:this.y1},{x:this.x2,y:this.y2},{x:this.textX,y:this.textY})) {
|
||||
this.findClosestPointForLine({x:this.x2,y:this.y1},{x:this.x2,y:this.y2},{x:this.textX,y:this.textY});
|
||||
} else {
|
||||
var closestPt = this.getClosestAnchor([{x:this.x1,y:this.y1},{x:this.x2,y:this.y1},{x:this.x1,y:this.y2},{x:this.x2,y:this.y2}],{x:this.textX,y:this.textY});
|
||||
this.refX = closestPt.x;
|
||||
this.refY = closestPt.y;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.isPtWithinLine = function(A,B,P) {
|
||||
var dotproduct = (P.x - A.x) * (B.x - A.x) + (P.y - A.y)*(B.y - A.y);
|
||||
|
||||
if(dotproduct<0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var squaredlengthBA = (B.x - A.x)*(B.X - A.x) + (B.y - A.y)*(B.y - A.y);
|
||||
|
||||
if(dotproduct > squaredlengthBA) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
this.findClosestPointForLine = function(A,B,P) {
|
||||
var a_to_p = [P.x - A.x , P.y - A.y]; // Vector A to P
|
||||
var a_to_b = [B.x - A.x , B.y - A.y]; // Vector A to B
|
||||
|
||||
// Find squared magnitude of a_to_b
|
||||
var atb2 = Math.pow(a_to_b[0],2) + Math.pow(a_to_b[1],2);
|
||||
|
||||
// Find dot product of a_to_p and a_to_b
|
||||
var atp_dot_atb = a_to_p[0] * a_to_b[0] + a_to_p[1] * a_to_b[1];
|
||||
|
||||
// Normalized distance from a to closest point
|
||||
var t = atp_dot_atb / atb2;
|
||||
|
||||
// Add the distance to A, moving towards B
|
||||
this.refX = A.x + a_to_b[0] * t;
|
||||
this.refY = A.y + a_to_b[1] * t;
|
||||
};
|
||||
|
||||
this.getClosestAnchor = function(points,refPt) {
|
||||
var dist1 = Math.round(Math.sqrt(Math.pow(points[0].x-refPt.x,2) + Math.pow(points[0].y-refPt.y,2)));
|
||||
var dist2 = Math.round(Math.sqrt(Math.pow(points[1].x-refPt.x,2) + Math.pow(points[1].y-refPt.y,2)));
|
||||
var dist3 = Math.round(Math.sqrt(Math.pow(points[2].x-refPt.x,2) + Math.pow(points[2].y-refPt.y,2)));
|
||||
var dist4 = Math.round(Math.sqrt(Math.pow(points[3].x-refPt.x,2) + Math.pow(points[3].y-refPt.y,2)));
|
||||
var min = Math.min(dist1,dist2,dist3,dist4);
|
||||
|
||||
switch(min) {
|
||||
case dist1:
|
||||
return points[0];
|
||||
case dist2:
|
||||
return points[1];
|
||||
case dist3:
|
||||
return points[2];
|
||||
case dist4:
|
||||
return points[3];
|
||||
default:
|
||||
return points[0];
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,125 @@
|
||||
$(document).ready(function() {
|
||||
$('button').button();
|
||||
$("#fromDate").datepicker();
|
||||
$("#toDate").datepicker();
|
||||
$("#birthDate").datepicker();
|
||||
|
||||
$('#okBtn').click(function() {
|
||||
var searchURL = "queryResult.jsp?";
|
||||
if($('#patName').val() != null && $('#patName').val() != '') {
|
||||
searchURL += 'patientName=' + $('#patName').val();
|
||||
}
|
||||
|
||||
if($('#patId').val() != null && $('#patId').val() != '') {
|
||||
searchURL += '&patientId=' + $('#patId').val();
|
||||
}
|
||||
|
||||
if($('#accessionNo').val() != null && $('#accessionNo').val() != '') {
|
||||
searchURL += '&accessionNumber=' + $('#accessionNo').val();
|
||||
}
|
||||
|
||||
if($('#birthDate').val() != null && $('#birthDate').val() != '') {
|
||||
searchURL += '&birthDate=' + convertToDcm4cheeDate($('#birthDate').val());
|
||||
}
|
||||
|
||||
if($('#fromDate').val() != null && $('#fromDate').val() != '') {
|
||||
searchURL += '&searchDays=between&from=' + convertToDcm4cheeDate($('#fromDate').val());
|
||||
}
|
||||
|
||||
if($('#toDate').val() != null && $('#toDate').val() != '') {
|
||||
searchURL += '&to=' + convertToDcm4cheeDate($('#toDate').val());
|
||||
}
|
||||
|
||||
if($('#modalities').val() != null && $('#modalities').val() != '') {
|
||||
searchURL += '&modality=' + $('#modalities').val();
|
||||
}
|
||||
|
||||
if($('#studyDesc').val() != null && $('#studyDesc').val() != '') {
|
||||
searchURL += '&studyDesc=' + $('#studyDesc').val();
|
||||
}
|
||||
|
||||
if($('#referPhysician').val() != null && $('#referPhysician').val() != '') {
|
||||
searchURL += '&referPhysician=' + $('#referPhysician').val();
|
||||
}
|
||||
|
||||
|
||||
var dUrl = $('.ui-tabs-selected').find('a').attr('name');
|
||||
searchURL += "&dcmURL=" + dUrl;
|
||||
|
||||
modal.close();
|
||||
|
||||
var divContent = $('.ui-tabs-selected').find('a').attr('href');
|
||||
searchURL += '&tabName=' + divContent.replace('#','');
|
||||
|
||||
var tabIndex = $('#tabs_div').data('tabs').options.selected;
|
||||
searchURL += '&tabIndex=' + tabIndex;
|
||||
|
||||
searchURL += "&preview=" + $('.ui-tabs-selected').find('a').attr('preview');
|
||||
|
||||
divContent += '_content';
|
||||
|
||||
$(divContent).load(encodeURI(searchURL), function() {
|
||||
clearInterval(timer);
|
||||
// checkLocalStudies();
|
||||
});
|
||||
|
||||
$('#westPane').html('');
|
||||
}); // for okBtn click
|
||||
|
||||
$('#resetBtn').click(function() {
|
||||
$('#patName').val('');
|
||||
$('#patId').val('');
|
||||
$('#accessionNo').val('');
|
||||
$('#birthDate').val('');
|
||||
$('#fromDate').val('');
|
||||
$('#toDate').val('');
|
||||
|
||||
//To clear modality filter
|
||||
var $checked = $("#modalitiesTable :checked");
|
||||
$checked.each(function() {
|
||||
$(this).attr('checked', false);
|
||||
});
|
||||
$('#modalities').val('');
|
||||
}); // for resetBtn click
|
||||
|
||||
$('#modalitiesTable tbody tr td').click(function() {
|
||||
var $checked = $("#modalitiesTable :checked");
|
||||
var $len = $checked.length;
|
||||
var selModalities = "";
|
||||
for(var i=0; i<$len; i++) {
|
||||
if(selModalities == "") {
|
||||
selModalities = selModalities + $checked[i].value;
|
||||
} else {
|
||||
selModalities = selModalities + "\\" + $checked[i].value;
|
||||
}
|
||||
}
|
||||
|
||||
$("#modalities").val(selModalities);
|
||||
});
|
||||
|
||||
function convertToDcm4cheeDate(givenDate) {
|
||||
var retVal = "";
|
||||
if(givenDate != "") {
|
||||
var str = givenDate.split("/");
|
||||
retVal = str[2] + str[0] + str[1];
|
||||
}
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
function checkLocalStudies() {
|
||||
var myDB = initDB();
|
||||
var sql = "select StudyInstanceUID from study";
|
||||
myDB.transaction(function(tx) {
|
||||
tx.executeSql(sql, [], function(trans, results) {
|
||||
for(var i=0; i<results.rows.length; i++) {
|
||||
var row = results.rows.item(i);
|
||||
var img = document.getElementById(row['StudyInstanceUID']);
|
||||
if(img != null) {
|
||||
img.style.visibility = 'visible';
|
||||
}
|
||||
}
|
||||
}, errorHandler);
|
||||
});
|
||||
}
|
||||
|
||||
}); //for document.ready
|
||||
@@ -0,0 +1,513 @@
|
||||
var db;
|
||||
var $url = "";
|
||||
var oTable;
|
||||
var addBtnPressed = false;
|
||||
var editBtnPressed = false;
|
||||
var callingAET = '';
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('button').button();
|
||||
|
||||
loadTable();
|
||||
$.get("do/IOviyamContext", function(data) {
|
||||
$('#ioviyamCxt').val(data.trim());
|
||||
}, 'text');
|
||||
|
||||
$("#addBtn").click(function() {
|
||||
if (!addBtnPressed) {
|
||||
var str = '<tr style="width:100%"><td><input type="checkbox" disabled="true" /></td><td><input type="text" id="desc" style="width:100%"></td>' +
|
||||
'<td><input type="text" id="aet" style="width:100%"></td>' +
|
||||
'<td><input type="text" id="host" style="width:100%"></td><td><input type="text" id="port" style="width:100%"></td>' +
|
||||
'<td><select id="retrieve" style="width:100%" onchange="hideWadoFields()"><option value="WADO">WADO</option><option value="C-MOVE">C-MOVE</option><option value="C-GET">C-GET</option></select></td>' +
|
||||
'<td><input type="text" id="wadoCxt" value="wado" style="width:100%" title="WADO Context"></td><td><input type="text" id="wadoPort" value="8080" style="width:100%" title="WADO Port">' +
|
||||
'<td><select id="imgType" style="width:100%"><option value="JPEG">JPEG</option><option value="PNG">PNG</option></select></td>' +
|
||||
'<td><input type="checkbox" id="preview" style="width: 50%;" checked>' +
|
||||
'<a href="#" onClick="insertTable();"><img src="images/save.png"></a></td></tr>';
|
||||
//var wid = $("#serverTable").css('width');
|
||||
$("#serverTable > tbody:last").append(str);
|
||||
addBtnPressed = true;
|
||||
}
|
||||
});
|
||||
|
||||
$("#verifyBtn").click(function() {
|
||||
var msg = '';
|
||||
if ($url != "" && ($('#serverTable :checked').not('.previewChk').length == 1)) {
|
||||
$.get("Echo.do?dicomURL=" + $url, function(data) {
|
||||
if (data == "EchoSuccess") {
|
||||
msg = "Echo " + $url + " successfully!!!";
|
||||
$.ambiance({
|
||||
message: msg,
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
msg = "Echo " + $url + " not successfully!!!";
|
||||
$.ambiance({
|
||||
message: msg,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
msg = "Please select server!!!";
|
||||
$.ambiance({
|
||||
message: msg,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
oTable = $('#serverTable').dataTable({
|
||||
"bJQueryUI": true,
|
||||
//"sPaginationType": "full_numbers"
|
||||
"bPaginate": false,
|
||||
"bFilter": false,
|
||||
"bSort": false
|
||||
});
|
||||
|
||||
$(".fg-toolbar.ui-corner-tl").html('<b>Servers</b>');
|
||||
|
||||
$("#deleteBtn").click(function() {
|
||||
deleteSelectedRow();
|
||||
//oTable.fnClearTable();
|
||||
//loadTable();
|
||||
});
|
||||
|
||||
$("#editBtn").click(function() {
|
||||
if (!editBtnPressed) {
|
||||
editSelectedRow();
|
||||
}
|
||||
});
|
||||
|
||||
$('.dataTables_wrapper').css('min-height', '200px');
|
||||
|
||||
$("#updateListener").click(function() {
|
||||
$.ajax({
|
||||
url: 'Listener.do',
|
||||
type: 'POST',
|
||||
data: {
|
||||
'aetitle': $('#listener_ae').val(),
|
||||
'port': $('#listener_port').val(),
|
||||
'action': 'Update'
|
||||
},
|
||||
dataType: 'text',
|
||||
success: function(msg1) {
|
||||
if (msg1.trim() == 'success') {
|
||||
$.ambiance({
|
||||
message: "Listener details updated and listener restarted!!!",
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.ambiance({
|
||||
message: "Error while updating listener details!!!",
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#updIoviyamCxt').click(function() {
|
||||
var iOvmCxt = $('#ioviyamCxt').val().trim();
|
||||
if (iOvmCxt.length == 0) {
|
||||
alert("iOviyam context should not be empty!!!");
|
||||
return;
|
||||
}
|
||||
if (iOvmCxt.indexOf("\/") != 0) {
|
||||
alert("iOviyam context must starts with /");
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: 'do/IOviyamContext',
|
||||
type: 'POST',
|
||||
data: {
|
||||
'iOviyamCxt': $('#ioviyamCxt').val(),
|
||||
'action': 'Update'
|
||||
},
|
||||
dataType: 'text',
|
||||
success: function(msg2) {
|
||||
if (msg2.trim() == 'success') {
|
||||
$.ambiance({
|
||||
message: "iOviyam context updated successfully!!!",
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.ambiance({
|
||||
message: 'Error while updating iOviyam context!!!',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#updDownloadStudy').click(function() {
|
||||
var dwnStudy = $('#downloadStudy').val();
|
||||
if (dwnStudy == 'none') {
|
||||
dwnStudy = 'no';
|
||||
}
|
||||
$.ajax({
|
||||
url: 'DwnStudyConfig.do',
|
||||
type: 'POST',
|
||||
data: {
|
||||
'downloadStudy': dwnStudy,
|
||||
'action': 'update'
|
||||
},
|
||||
dataType: 'text',
|
||||
success: function(msg3) {
|
||||
if (msg3.trim() == 'success') {
|
||||
$.ambiance({
|
||||
message: "Download Study updated successfully!!!",
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.ambiance({
|
||||
message: 'Error while updating Download Study!!!',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$.get("DwnStudyConfig.do", {
|
||||
'action': 'READ'
|
||||
}, function(data) {
|
||||
data = data.trim();
|
||||
$('#downloadStudy').val(data);
|
||||
}, 'text');
|
||||
|
||||
}); // for document.ready
|
||||
|
||||
// To create table
|
||||
function createTables(database) {
|
||||
database.transaction(function(tx) {
|
||||
var sql = "CREATE TABLE IF NOT EXISTS ae(pk integer NOT NULL PRIMARY KEY AUTOINCREMENT, logicalname varchar(255), hostname varchar(255),aetitle varchar(255),port integer);";
|
||||
tx.executeSql(sql, [], nullDataHandler, errorHandler);
|
||||
});
|
||||
}
|
||||
|
||||
function insertTable() {
|
||||
var msg = '';
|
||||
if ($('#desc').val().toLowerCase() == "local") {
|
||||
alert($('#desc').val() + " is reserved for local studies, please try some other name!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
if ($("#desc").val() != '' && $("#aet").val() != '' && $("#host").val() != '' && $("#port").val() != '' && $("#wadoport").val() != '') {
|
||||
$.ajax({
|
||||
url: 'ServerConfig.do',
|
||||
data: {
|
||||
'logicalName': $("#desc").val().replace(/ /g, ''),
|
||||
'aeTitle': $("#aet").val(),
|
||||
'hostName': $("#host").val(),
|
||||
'port': $("#port").val(),
|
||||
'retrieve': $("#retrieve").val(),
|
||||
'wadoContext': $("#wadoCxt").val(),
|
||||
'wadoPort': $("#wadoPort").val(),
|
||||
'imageType': $("#imgType").val(),
|
||||
'previews': $('#preview').prop('checked') ? 'true' : 'false',
|
||||
'todo': 'ADD'
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'text',
|
||||
success: function(msg1) {
|
||||
if (msg1.trim() == 'success') {
|
||||
oTable.fnClearTable();
|
||||
loadTable();
|
||||
msg = "Server added!!!";
|
||||
} else if (msg1.trim() == 'duplicate') {
|
||||
msg = "Logical name already exists!!!";
|
||||
}
|
||||
$.ambiance({
|
||||
message: msg,
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
msg = "Please enter all the details";
|
||||
$.ambiance({
|
||||
message: msg,
|
||||
type: 'error'
|
||||
});
|
||||
return;
|
||||
}
|
||||
addBtnPressed = false;
|
||||
}
|
||||
|
||||
function editTable() {
|
||||
|
||||
$.ajax({
|
||||
url: 'ServerConfig.do',
|
||||
data: {
|
||||
'logicalName': $("#desc").val(),
|
||||
'aeTitle': $("#aet").val(),
|
||||
'hostName': $("#host").val(),
|
||||
'port': $("#port").val(),
|
||||
'retrieve': $("#retrieve").val(),
|
||||
'wadoContext': $("#wadoCxt").val(),
|
||||
'wadoPort': $("#wadoPort").val(),
|
||||
'imageType': $("#imgType").val(),
|
||||
'previews': $('#preview').prop('checked') ? 'true' : 'false',
|
||||
'todo': 'EDIT'
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'text',
|
||||
success: function(msg1) {
|
||||
oTable.fnClearTable();
|
||||
loadTable();
|
||||
var msg = "Server edited!!!";
|
||||
$.ambiance({
|
||||
message: msg,
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
editBtnPressed = false;
|
||||
}
|
||||
|
||||
function loadTable() {
|
||||
$.getJSON('DicomNodes.do', function(result) {
|
||||
$.each(result, function(i, row) {
|
||||
if (typeof row['callingAET'] == 'undefined') {
|
||||
//$('#serverTable').databind(result);
|
||||
|
||||
var wadoCxt = '';
|
||||
if (typeof row['wadocontext'] != 'undefined') {
|
||||
wadoCxt = row['wadocontext'];
|
||||
}
|
||||
|
||||
var wadoPort = '';
|
||||
if (typeof row['wadoport'] != 'undefined') {
|
||||
wadoPort = row['wadoport'];
|
||||
}
|
||||
var retrieveType = row['retrieve'];
|
||||
|
||||
var imageType = 'JPEG';
|
||||
|
||||
if (typeof row['imageType'] != 'undefined' && retrieveType == 'WADO') {
|
||||
imageType = row['imageType'];
|
||||
}
|
||||
|
||||
|
||||
var preview = "<input type='checkbox' class='previewChk' style='text-align:center' disabled ";
|
||||
|
||||
if (row['previews'] != 'false') {
|
||||
preview += "checked>";
|
||||
} else {
|
||||
preview += ">";
|
||||
}
|
||||
|
||||
oTable.fnAddData([
|
||||
"<input type='checkbox' style='text-align:center'>",
|
||||
row['logicalname'],
|
||||
row['aetitle'],
|
||||
row['hostname'],
|
||||
row['port'],
|
||||
retrieveType,
|
||||
wadoCxt,
|
||||
wadoPort,
|
||||
imageType,
|
||||
preview
|
||||
]);
|
||||
} else {
|
||||
callingAET = row['callingAET'].trim();
|
||||
$("#listener_ae").val(callingAET);
|
||||
$("#listener_port").val(row['listenerPort'].trim());
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function deleteRow() {
|
||||
var host = $url.substring($url.indexOf("@") + 1, $url.lastIndexOf(":"));
|
||||
var port = $url.substring($url.lastIndexOf(":") + 1);
|
||||
var ae = $url.substring($url.lastIndexOf("/") + 1, $url.indexOf("@"));
|
||||
var sql = "delete from ae where hostname=? and aetitle=? and port=?";
|
||||
|
||||
db.transaction(function(tx) {
|
||||
tx.executeSql(sql, [host, ae, port], nullDataHandler, errorHandler);
|
||||
});
|
||||
}
|
||||
|
||||
function deleteSelectedRow() {
|
||||
var msg = '';
|
||||
var selectRow = $('#serverTable :checked').not('.previewChk').parent().parent();
|
||||
if ($('#serverTable :checked').not('.previewChk').length == 1) {
|
||||
var logical = selectRow.find('td:nth-child(2)').html();
|
||||
var ae = selectRow.find('td:nth-child(3)').html();
|
||||
var host = selectRow.find('td:nth-child(4)').html();
|
||||
var port = selectRow.find('td:nth-child(5)').html();
|
||||
var wado = selectRow.find('td:nth-child(6)').html();
|
||||
|
||||
$.ajax({
|
||||
url: 'ServerConfig.do',
|
||||
data: {
|
||||
'logicalName': logical,
|
||||
'aeTitle': ae,
|
||||
'hostName': host,
|
||||
'port': port,
|
||||
'wadoPort': wado,
|
||||
'todo': 'DELETE'
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'text',
|
||||
success: function(msg1) {
|
||||
oTable.fnClearTable();
|
||||
loadTable();
|
||||
|
||||
msg = "Server deleted";
|
||||
$.ambiance({
|
||||
message: msg,
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
msg = "Please select server to delete";
|
||||
$.ambiance({
|
||||
message: msg,
|
||||
type: 'error'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function editSelectedRow() {
|
||||
var $selRow = $('#serverTable :checked').not('.previewChk').parent().parent();
|
||||
if ($('#serverTable :checked').not('.previewChk').length == 1) {
|
||||
|
||||
var currDesc = $selRow.find('td:nth-child(2)').html();
|
||||
var currAET = $selRow.find('td:nth-child(3)').html();
|
||||
var currHost = $selRow.find('td:nth-child(4)').html();
|
||||
var currPort = $selRow.find('td:nth-child(5)').html();
|
||||
|
||||
var currRet = $selRow.find('td:nth-child(6)').html();
|
||||
var currWadoCxt = $selRow.find('td:nth-child(7)').html();
|
||||
var currWadoPort = $selRow.find('td:nth-child(8)').html();
|
||||
var currImageType = $selRow.find('td:nth-child(9)').html();
|
||||
var currentPreview = $selRow.find('td:nth-child(10)').find('.previewChk').prop('checked');
|
||||
|
||||
var str = '<td><input type="checkbox" disabled="true" CHECKED /></td><td><input type="text" id="desc" disabled="true" value="' + currDesc + '"></td>' +
|
||||
'<td><input type="text" id="aet" value="' + currAET + '"></td>' +
|
||||
'<td><input type="text" id="host" value="' + currHost + '"></td><td><input type="text" id="port" value="' + currPort + '"></td>';
|
||||
|
||||
var imgTypeDisabled = '';
|
||||
|
||||
if (currRet == 'C-MOVE') {
|
||||
str += '<td><select id="retrieve" value="' + currRet + '" style="width:100%" onchange="hideWadoFields()"><option value="WADO" selected>WADO</option><option value="C-MOVE" selected>C-MOVE</option><option value="C-GET">C-GET</option></select></td>';
|
||||
imgTypeDisabled = "disabled=disabled";
|
||||
} else if (currRet == 'C-GET') {
|
||||
str += '<td><select id="retrieve" value="' + currRet + '" style="width:100%" onchange="hideWadoFields()"><option value="WADO">WADO</option><option value="C-MOVE">C-MOVE</option><option value="C-GET" selected>C-GET</option></select></td>';
|
||||
imgTypeDisabled = "disabled=disabled";
|
||||
} else {
|
||||
str += '<td><select id="retrieve" value="' + currRet + '" style="width:100%" onchange="hideWadoFields()"><option value="WADO" selected>WADO</option><option value="C-MOVE">C-MOVE</option><option value="C-GET">C-GET</option></select></td>';
|
||||
}
|
||||
str += '<td><input type="text" id="wadoCxt" value="' + currWadoCxt + '" style="width:100%" title="WADO Context"></td><td><input type="text" id="wadoPort" value="' + currWadoPort + '" style="width:100%" title="WADO Port"></td>';
|
||||
|
||||
if (currImageType == "PNG") {
|
||||
str += '<td><select id="imgType" value="' + currImageType + '" style="width:100%"' + imgTypeDisabled + '><option value="JPEG">JPEG</option><option value="PNG" selected>PNG</option></select></td>';
|
||||
} else {
|
||||
str += '<td><select id="imgType" value="' + currImageType + '" style="width:100%"' + imgTypeDisabled + '><option value="JPEG" selected>JPEG</option><option value="PNG">PNG</option></select></td>';
|
||||
}
|
||||
|
||||
if (currentPreview != true) {
|
||||
str += '<td><input type="checkbox" id="preview" class="previewChk">';
|
||||
} else {
|
||||
str += '<td><input type="checkbox" id="preview" checked class="previewChk">';
|
||||
}
|
||||
str += '<a href="#" onClick="editTable(); $(this).parent().parent().remove();"><img src="images/save.png"></a></td>';
|
||||
|
||||
$selRow.html(str);
|
||||
|
||||
editBtnPressed = true;
|
||||
} else {
|
||||
var msg = "Please select server to edit";
|
||||
$.ambiance({
|
||||
message: msg,
|
||||
type: 'error'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function dataHandler(transaction, results) {
|
||||
|
||||
for (var i = 0; i < results.rows.length; i++) {
|
||||
var row = results.rows.item(i);
|
||||
oTable.fnAddData([
|
||||
"<input type='checkbox'>",
|
||||
row['logicalname'],
|
||||
row['aetitle'],
|
||||
row['hostname'],
|
||||
row['port']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* function selectServer(row) {
|
||||
var $checkbox = row.find(':checkbox');
|
||||
//deselect the already selected checkbox
|
||||
$("#serverTable :checkbox").not($checkbox).removeAttr("checked");
|
||||
// select current checkbox
|
||||
$checkbox.attr('checked', !$checkbox.attr('checked'));
|
||||
|
||||
if($("#serverTable input[type=checkbox]:checked").length == 1) {
|
||||
var aet = row.find('td:nth-child(3)').html();
|
||||
var host = row.find('td:nth-child(4)').html();
|
||||
var port = row.find('td:nth-child(5)').html();
|
||||
|
||||
$url = "dicom://" + aet + "@" + host + ":" + port;
|
||||
} else {
|
||||
$url = "";
|
||||
}
|
||||
//alert(e.find('td:nth-child(3)').html());
|
||||
//alert( $("#serverTable input[type=checkbox]:checked").length );
|
||||
}*/
|
||||
|
||||
$("#serverTable tbody tr").live('click', function(e) {
|
||||
var aet = $(this).find('td:nth-child(3)').html();
|
||||
var host = $(this).find('td:nth-child(4)').html();
|
||||
var port = $(this).find('td:nth-child(5)').html();
|
||||
|
||||
if (callingAET == '') {
|
||||
$url = "dicom://" + aet + "@" + host + ":" + port;
|
||||
} else {
|
||||
$url = "dicom://" + aet + ":" + callingAET + "@" + host + ":" + port;
|
||||
}
|
||||
|
||||
//get checkbox current checkbox
|
||||
var $checkbox = $(this).find(':checkbox').not('.previewChk');
|
||||
//deselect the already selected checkbox
|
||||
$("#serverTable :checkbox").not($checkbox).not('.previewChk').removeAttr("checked");
|
||||
if (e.target.type == 'checkbox') {
|
||||
//e.stopPropagation();
|
||||
$(this).filter(':has(:checkbox)').toggleClass('selected', $checkbox.attr('checked'));
|
||||
} else {
|
||||
$checkbox.attr('checked', !$checkbox.attr('checked'));
|
||||
//$(this).filter(':has(:checkbox)').toggleClass('selected', $checkbox.attr('checked'));
|
||||
}
|
||||
});
|
||||
|
||||
function hideWadoFields() {
|
||||
if ($("#retrieve").val() != 'WADO') {
|
||||
$("#wadoCxt").attr('disabled', 'disabled');
|
||||
$('#wadoPort').attr('disabled', 'disabled');
|
||||
$("#wadoCxt").val("");
|
||||
$('#wadoPort').val("");
|
||||
$('#imgType').val("JPEG");
|
||||
$('#imgType').attr('disabled', 'disabled');
|
||||
} else {
|
||||
$("#wadoCxt").removeAttr('disabled');
|
||||
$('#wadoPort').removeAttr('disabled');
|
||||
$("#wadoCxt").val("wado");
|
||||
$('#wadoPort').val("8080");
|
||||
$('#imgType').removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @namespace Utils classes and functions.
|
||||
*/
|
||||
ovm.utils = ovm.utils || {};
|
||||
|
||||
/**
|
||||
* @function Capitalise the first letter of a string.
|
||||
*/
|
||||
ovm.utils.capitaliseFirstLetter = function(string)
|
||||
{
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
};
|
||||
@@ -0,0 +1,292 @@
|
||||
var pat = null;
|
||||
var directLaunch = false;
|
||||
|
||||
|
||||
function enableDownload(downloadStudy) {
|
||||
$.post("DwnStudyConfig.do", {
|
||||
'action': 'READ'
|
||||
}, function(data) {
|
||||
if (data.trim() == "Yes") {
|
||||
downloadStudy.style.display = "block";
|
||||
} else {
|
||||
downloadStudy.style.display = "none";
|
||||
}
|
||||
}, 'text');
|
||||
}
|
||||
|
||||
function loadViewerPage() {
|
||||
initPage();
|
||||
$("#toolbarContainer").load("viewer_tools.html");
|
||||
}
|
||||
|
||||
function getStudyDetails() {
|
||||
pat = $.cookies.get('patient');
|
||||
var queryString = document.location.search.substring(1);
|
||||
var patId = getParameter(queryString, "patientID");
|
||||
var studyId = getParameter(queryString, "studyUID");
|
||||
var serverName = getParameter(queryString, "serverName");
|
||||
if (serverName == 'null') {
|
||||
serverName = '';
|
||||
}
|
||||
if (patId == 'null') {
|
||||
patId = '';
|
||||
}
|
||||
if (studyId == 'null') {
|
||||
studyId = '';
|
||||
}
|
||||
|
||||
if (patId != null && studyId != null && serverName != null) {
|
||||
$.post("StudyInfo.do", {
|
||||
"patientID": patId,
|
||||
"studyUID": studyId,
|
||||
"serverName": serverName
|
||||
}, function(data) {
|
||||
if (data['error'] != null) {
|
||||
if (data['error'].trim() == 'Server not found') {
|
||||
alert("Server not found!!!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
directLaunch = true;
|
||||
pat = data;
|
||||
loadStudy();
|
||||
}, "json");
|
||||
} else {
|
||||
loadStudy();
|
||||
}
|
||||
}
|
||||
|
||||
function isCompatible() {
|
||||
return !!(window.requestFileSystem || window.webkitRequestFileSystem);
|
||||
}
|
||||
|
||||
function saveJpgImages() {
|
||||
if (isCompatible()) {
|
||||
window.requestFileSystem = window.requestFileSystem ||
|
||||
window.webkitRequestFileSystem;
|
||||
var secondTR = $('.seriesTable');
|
||||
secondTR.find('img').each(function() {
|
||||
if (this.complete) {
|
||||
saveLocally(this);
|
||||
} else {
|
||||
this.onload = function() {
|
||||
saveLocally(this);
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function saveLocally(image) {
|
||||
var cvs = document.createElement('canvas');
|
||||
var ctx = cvs.getContext("2d");
|
||||
|
||||
var fn = '';
|
||||
if (image.src.indexOf('images/pdf.png') >= 0) {
|
||||
fn = getParameter($(image).attr('imgSrc'), 'object') + '.pdf';
|
||||
} else {
|
||||
fn = getParameter(image.src, 'object') + '.jpg';
|
||||
}
|
||||
cvs.width = image.naturalWidth;
|
||||
cvs.height = image.naturalHeight;
|
||||
ctx.drawImage(image, 0, 0);
|
||||
|
||||
if (image.src.indexOf('images/pdf.png') >= 0) {
|
||||
var imd = cvs.toDataURL('image/pdf');
|
||||
var ui8a = convertDataURIToBinary(imd);
|
||||
var bb = new Blob([ui8a], {
|
||||
type: 'image/pdf'
|
||||
});
|
||||
} else {
|
||||
var imd = cvs.toDataURL('image/jpeg');
|
||||
var ui8a = convertDataURIToBinary(imd);
|
||||
var bb = new Blob([ui8a], {
|
||||
type: 'image/jpeg'
|
||||
});
|
||||
}
|
||||
|
||||
window.requestFileSystem(window.TEMPORARY, 1024 * 1024, function(fs) {
|
||||
fs.root.getFile(fn, {
|
||||
create: true
|
||||
}, function(fileEntry) {
|
||||
// Create a FileWriter object for our FileEntry.
|
||||
fileEntry.createWriter(function(fileWriter) {
|
||||
fileWriter.onwriteend = function(e) {
|
||||
//console.log(fileEntry.fullPath + ' Write completed.');
|
||||
};
|
||||
|
||||
fileWriter.onerror = function(e) {
|
||||
console.log('Write failed: ' + e.toString());
|
||||
};
|
||||
|
||||
fileWriter.write(bb); //.getBlob(contentType[extname]));
|
||||
}, fileErrorHandler);
|
||||
}, fileErrorHandler);
|
||||
}, fileErrorHandler);
|
||||
}
|
||||
|
||||
function convertDataURIToBinary(dataURI) {
|
||||
var BASE64_MARKER = ';base64,';
|
||||
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
|
||||
var base64 = dataURI.substring(base64Index);
|
||||
var raw = window.atob(base64);
|
||||
var rawLength = raw.length;
|
||||
var array = new Uint8Array(new ArrayBuffer(rawLength));
|
||||
|
||||
for (i = 0; i < rawLength; i++) {
|
||||
array[i] = raw.charCodeAt(i);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
function loadStudy() {
|
||||
// load WestPane content
|
||||
var tmpUrl = "westContainer.jsp?patient=" + pat.pat_ID + "&study=" +
|
||||
pat.studyUID + "&patientName=" + pat.pat_Name;
|
||||
tmpUrl += "&studyDesc=" + pat.studyDesc + "&studyDate=" + pat.studyDate +
|
||||
"&totalSeries=" + pat.totalSeries + "&dcmURL=" + pat.dicomURL;
|
||||
tmpUrl += "&wadoUrl=" + pat.serverURL;
|
||||
tmpUrl += "&contentType=image/" + pat.imgType;
|
||||
$('#westPane').load(encodeURI(tmpUrl));
|
||||
document.title = pat.pat_Name;
|
||||
}
|
||||
|
||||
function loadDownloadModal() {
|
||||
if (pat.serverURL == "C-MOVE" || pat.serverURL == "C-GET") {
|
||||
$('#title').text("CANNOT INVOKE DOWNLOAD WINDOW");
|
||||
$('#errorInfo').text("Files can be downloaded only from the servers having retrieve type as WADO ");
|
||||
var downloadSelection = document.getElementById("downloadSelection-content");
|
||||
downloadSelection.style.display = "none";
|
||||
$("#downloadInfo").removeClass('modal-content').addClass('modal-error');
|
||||
} else {
|
||||
var errorMsg = document.getElementById("errorMsg");
|
||||
errorMsg.style.display = "none";
|
||||
$('#title').text("Download JPEG/DICOM files");
|
||||
var tempUrl = "downloadSelection.jsp?patient=" + pat.pat_ID + "&study=" +
|
||||
pat.studyUID + "&patientName=" + pat.pat_Name;
|
||||
tempUrl += "&studyDesc=" + pat.studyDesc + "&studyDate=" + pat.studyDate +
|
||||
"&totalSeries=" + pat.totalSeries + "&dcmURL=" + pat.dicomURL;
|
||||
tempUrl += "&wadoUrl=" + pat.serverURL;
|
||||
tempUrl += "&contentType=image/" + pat.imgType; // Image Type - png or Jpeg
|
||||
$('#downloadSelection-content').load(encodeURI(tempUrl));
|
||||
}
|
||||
|
||||
}
|
||||
/*function getSeries(patId, studyUID) {
|
||||
$.post("Series.do", {
|
||||
"patientID" : patId,
|
||||
"studyUID" : studyUID,
|
||||
"dcmURL" : pat.dicomURL
|
||||
}, function(data) {
|
||||
sessionStorage[studyUID] = JSON.stringify(data);
|
||||
firstSeries = data[0]['seriesUID'];
|
||||
if(pat.serverURL != 'C-MOVE' && pat.serverURL != 'C-GET') {
|
||||
$.each(data, function(i, series) {
|
||||
getInstances(patId, studyUID, series['seriesUID']);
|
||||
});
|
||||
}
|
||||
}, "json");
|
||||
}*/
|
||||
|
||||
function getSeries(patId, studyUID) {
|
||||
|
||||
$.post("Series.do", {
|
||||
"patientID": patId,
|
||||
"studyUID": studyUID,
|
||||
"dcmURL": pat.dicomURL,
|
||||
"retrieve": pat.serverURL
|
||||
}, function(data) {
|
||||
sessionStorage[studyUID] = JSON.stringify(data);
|
||||
if (pat.serverURL != "C-MOVE" && pat.serverURL != "C-GET") {
|
||||
$.each(data, function(i, series) {
|
||||
getInstances(patId, studyUID, series['seriesUID']);
|
||||
});
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
|
||||
function getInstances(patId, studyUID, seriesUID) {
|
||||
$.post("Instance.do", {
|
||||
"patientId": patId,
|
||||
"studyUID": studyUID,
|
||||
"seriesUID": seriesUID,
|
||||
"dcmURL": pat.dicomURL,
|
||||
"serverURL": pat.serverURL
|
||||
}, function(data) {
|
||||
sessionStorage[seriesUID] = JSON.stringify(data);
|
||||
}, "json");
|
||||
}
|
||||
|
||||
function storeSer(data) {
|
||||
$.each(data, function(i, series) {
|
||||
getInstances(pat.pat_ID, pat.studyUID, series['seriesUID']);
|
||||
});
|
||||
}
|
||||
|
||||
function getIns(seriesUID) {
|
||||
jQuery.ajax({
|
||||
url: "Instance.do?patientId=" + pat.pat_ID + "&studyUID=" + pat.studyUID + "&seriesUID=" + seriesUID + "&dcmURL=" + pat.dicomURL + "&serverURL=" + pat.serverURL,
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
success: function(data) {
|
||||
sessionStorage[seriesUID] = JSON.stringify(data);
|
||||
},
|
||||
error: function(request) {
|
||||
console.log('error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function fetchOtherStudies() {
|
||||
$.get("UserConfig.do", { 'settings': 'prefetch', 'todo': 'READ' }, function(data) {
|
||||
var doFetch = false;
|
||||
if (directLaunch) {
|
||||
if (data.trim() == 'Yes' && getParameter(document.location.search.substring(1), "patientID") != 'null') {
|
||||
doFetch = true;
|
||||
}
|
||||
} else {
|
||||
if (data.trim() == 'Yes' && pat.pat_ID.length > 0) {
|
||||
doFetch = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (doFetch) {
|
||||
$.post("otherStudies.do", {
|
||||
"patientID": pat.pat_ID,
|
||||
"studyUID": pat.studyUID,
|
||||
"dcmURL": pat.dicomURL
|
||||
}, function(data) {
|
||||
if (data.length > 0) {
|
||||
$("#otherStudiesInfo").text((data.length + " archived") + (data.length > 1 ? " studies" : " study") + " found.");
|
||||
} else {
|
||||
$("#otherStudiesInfo").text("No archived studies found.");
|
||||
}
|
||||
$.each(data, function(i, study) {
|
||||
var link = encodeURI("Study.jsp?patient=" + pat.pat_ID + "&study=" + study["studyUID"] + "&dcmURL=" + pat.dicomURL + "&wadoUrl=" + pat.serverURL + "&studyDesc=" + study["studyDesc"] + "&studyDate=" + study["studyDate"] + "&descDisplay=false" + "&contentType=image/" + pat.imgType);
|
||||
// var div = "<div id=" + study['studyUID'] + " class='accordion close' link=" + link + " onclick='loadOther(this);'>" + study['dateDesc'] + "</div>";
|
||||
var div = "<div id=" + study['studyUID'] + " class='accordion' link=" + link + " onclick='loadOther(this,false);'" + " >" + study['dateDesc'] + " <img src='images/download.png' style='padding-right: 5px; float: right;' title='Load this study' onclick='loadOther(this,true);' /> </div>";
|
||||
$('#otherStudies').append(div);
|
||||
$('#otherStudies').append(document.createElement("div"));
|
||||
});
|
||||
$("#otherStudies").show();
|
||||
$("#otherStudiesInfo").show();
|
||||
}, "json");
|
||||
}
|
||||
}, "text");
|
||||
}
|
||||
|
||||
function loadOther(div1, isRet) {
|
||||
var div = isRet ? $(div1).parent() : div1;
|
||||
var childDiv = $(div).next();
|
||||
|
||||
if ($(childDiv).children().length > 0) {
|
||||
acc($(div));
|
||||
} else if (isRet) {
|
||||
$(div).addClass("loading");
|
||||
$(div1).remove();
|
||||
$(childDiv).load($(div).attr('link'));
|
||||
acc($(div));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user