-
+
diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
index 924d720..694a14d 100644
--- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
+++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -32,7 +32,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
$rootScope.isHighLight = false;
$rootScope.coloredImageCanvasList = [];
$rootScope.coloredImageMRCanvasList = [];
- $rootScope.ColoredCanvasData= [];
+ $rootScope.ColoredCanvasData = [];
$rootScope.grayImageDataList = [];
$rootScope.grayImageMRDataList = [];
@@ -1175,13 +1175,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
if ($rootScope.isHighLight) {
-
- if ($scope.machedIcolorInBodyRegion.length > 0)
- {
- if ($scope.multiAnnotationIsON == false)
- {
- for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++)
- {
+
+ if ($scope.machedIcolorInBodyRegion.length > 0) {
+ if ($scope.multiAnnotationIsON == false) {
+ for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++) {
var bodyRegionId = $scope.machedIcolorInBodyRegion[i];
var grayCanvasID = 'imageCanvas' + bodyRegionId;
@@ -1310,7 +1307,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
if ($('#sppeachBubble').length > 0) {
$('#sppeachBubble').remove();
}
-
+
$scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
@@ -1379,7 +1376,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
//4.
$scope.machedTermNoLocation = [];
- console.log(' TermList.length= ' + TermList.length)
+ // console.log(' TermList.length= ' + TermList.length)
@@ -1390,9 +1387,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
var coloredImageData = dataForthisBR.coloredImageData;
var worker = new Worker('term-number-wp.js');
- for (var i = 0; i < TermList.length; i++) {
- console.log('Start time taken for term: ' + TermList[i]._TermNumber + 'in posting: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
worker.postMessage({
'termNumber': TermList[i]._TermNumber,
'maskCanvasData': $scope.MaskCanvasData,
@@ -1403,24 +1398,27 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
});
- }
- //var candata = e.value;
- //var grayCanvasID = 'imageCanvas1'
- //var grayCanvas = document.getElementById(grayCanvasID);
- //var grayCanvasContext = grayCanvas.getContext("2d");
- //var imageData = grayCanvasContext.getImageData(0, 0 ,348,507);
+ var dataForthisBR = new jinqJs()
+ .from($scope.ColoredCanvasData)
+ .where('bodyRegionId == ' + 1)
+ .select();
+ var coloredImageData = dataForthisBR.coloredImageData;
+ //for (var i = 0; i < TermList.length; i++) {
+ var worker = new Worker('term-number-wp.js');
- // worker.postMessage({ candata: coloredImageData });
+ // console.log('Start time taken for term: ' + TermList[i]._TermNumber + 'in posting: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
+ worker.postMessage({
- worker.onmessage = function (e) {
- var candata = e.data.value;
- var grayCanvasID = 'imageCanvas1'
- var grayCanvas = document.getElementById(grayCanvasID);
- var grayCanvasContext = grayCanvas.getContext("2d");
+ 'termList': TermList,
+ 'maskCanvasData': $scope.MaskCanvasData,
+ 'coloredImageCanvasList': $rootScope.coloredImageCanvasList,
+ 'coloredImageMRCanvasList': $rootScope.coloredImageMRCanvasList,
+ 'grayImageDataList': $rootScope.grayImageDataList,
+ 'grayImageMRDataList': $rootScope.grayImageMRDataList
- // var tempCanvas = document.createElement('canvas');
+ });
// tempCanvas.id = 'tempCanvas';
// $scope.tempCanvas = tempCanvas.id;
// tempCanvas.height = 507;
@@ -1429,15 +1427,34 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
// tempCanvas.style.left = 200 + 'px';
// tempCanvas.style.top = 100 + 'px';
- //// tempCanvas.style.backgroundColor = "transparent";
+ //}
// tempCanvas.style.visibility = 'visible';
// document.getElementById('canvasDiv').appendChild(tempCanvas);
- // var tempCanvas1 = document.getElementById('tempCanvas');
- // var Context = tempCanvas1.getContext("2d");
+ worker.onmessage = function (e) {
+ console.log('callback: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
- grayCanvasContext.putImageData(e.data.value, 0, 0);
+ // alert(e.data.value + '....name= ' + e.data.name)
+ var updatedData = e.data.value;
+ // debugger;
+ for (var i = 1; i <= updatedData.length; i++) {
+ var grayCanvasID = 'imageCanvas' +i;
+ var grayCanvas = document.getElementById(grayCanvasID);
+ var grayCanvasContext = grayCanvas.getContext("2d");
+
+
+
+ grayCanvasContext.putImageData(updatedData[i], 0, 0);
+ }
+ //var upadteddata = e.data.value;
+ //var bodyRegionId = e.data.bodyRegionId;
+
+
+ //$scope.highLightBodyBasedOnIcolor = function (RGBColor) {
+
+
+ // $rootScope.grayImageDataList[bodyRegionId - 1] = upadteddata;
};
worker.onerror = function (e) {
@@ -1452,6 +1469,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
// $scope.previousSelectedTermList.length = 0;
// var RGBColor = $scope.previousSelectedTermList[i];
+ // $scope.machedTermNoLocation = [];
+ // for (var i = 0; i < TermList.length; i++) {
// //2. Find Actul Term No Based on Icolor.
// var ActualTermNo = $scope.getActualTermNumber(RGBColor);
@@ -1460,27 +1479,45 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
// var TermList = $scope.getTermNumberList(ActualTermNo);
// if ($scope.previousSelectedTermList.length > 0) {
-
+ // 'cmd': 'abc',
+ // 'value': termNumber
+ // });
+ // }
+
// var worker = new Worker('term-number-wp.js');
+ // var msg = e.data.msg1;
+ // };
+ // worker.onerror = function (e) {
+ // alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
+ // };
+ // }
+ // else {
// for (var i = 0; i < $scope.previousSelectedTermList.length; i++) {
// $scope.machedTermNoLocation = [];
// for (var i = 0; i < TermList.length; i++) {
-
+ // var termNumber = parseInt(TermList[i]._TermNumber);
+
// var termNumber = parseInt(TermList[i]._TermNumber);
// // //Match Term No List in each bodyRegion
// // $scope.getLocationsForMatchedTermsInWholeBody(termNumber);
+ // 'value': termNumber
+ // });
// worker.postMessage({
// 'cmd': 'abc',
// 'value': termNumber
// });
// }
-
+ // };
+ // //Match Term No List in each bodyRegion
+ // //$scope.getLocationsForMatchedTermsInWholeBody(termNumber);
// }
+ // }
+
// worker.onmessage = function (e) {
// var msg = e.data.msg1;
// };
@@ -1494,8 +1531,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
// for (var i = 0; i < TermList.length; i++) {
// var termNumber = parseInt(TermList[i]._TermNumber);
-
+
// var worker = new Worker('term-number-wp.js');
+ {
+ console.log('Start time taken in fillMatchedTerm: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
// //start the worker
// worker.postMessage({
@@ -1513,14 +1552,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
// //$scope.getLocationsForMatchedTermsInWholeBody(termNumber);
// }
-
+
// }
//}
+ // var coloredImg = $scope.ColoredImageSRC[x].SRC;
- $scope.fillMatchedTerm = function (grayImageDataVar, BrId)
- {
+ $scope.fillMatchedTerm = function (grayImageDataVar, BrId) {
console.log('Start time taken in fillMatchedTerm: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
//for (var x = 0; x < $scope.ColoredImageSRC.length; x++) {
@@ -1532,7 +1571,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
// var scaledWidth = $scope.ColoredImageSRC[x].Width;
// var scaledHeight = $scope.ColoredImageSRC[x].Height;
// //var maskImg = $scope.ColoredImageSRC[x].SRC;
+ // // maskCanvasID = 'imageCanvas' + bodyRegionId + '_MR_mci';
+ // //}
+ // //else {
+ // // maskCanvasID = 'imageCanvas' + bodyRegionId + '_mci';
+ // //var maskCanvasContext = maskCanvas.getContext("2d");
+ // //var maskImgData = maskCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
// var coloredImg = $scope.ColoredImageSRC[x].SRC;
@@ -1542,6 +1587,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
// var scledX = $scope.ColoredImageSRC[x].x;
// var scledY = $scope.ColoredImageSRC[x].y;
+ // }
+ // else {
+ // coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)];
+ // }
+ // var grayImageDataVar;
+ // var grayCanvas;
+ // if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
// // 1. get mask canvas for this body region.
// //var maskCanvasID;
@@ -1555,8 +1607,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
// //var maskCanvas = document.getElementById(maskCanvasID);
// //var maskCanvasContext = maskCanvas.getContext("2d");
// //var maskImgData = maskCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
+ // var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
+ // grayImageDataVar = grayImageData.data;
+ // }
// // 2. get coloured canvas for this body region.
+ // var coloredImageDataMR
// var coloredImageDataVar;
@@ -1604,7 +1660,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
// for (var z = 0; z < dataForthisBR.length; z++)
// {
// var location = parseInt(dataForthisBR[z].location);
-
+
// var RED_coloredImage = coloredImageDataVar[location];
@@ -1622,29 +1678,27 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
// grayImageDataVar[location + 3] = ALPHA_coloredImage;
// }
- var grayCanvasID = 'imageCanvas' + BrId;
- var grayCanvas = document.getElementById(grayCanvasID);
- var grayCanvasContext = grayCanvas.getContext("2d");
+ var grayCanvasID = 'imageCanvas' + BrId;
+ var grayCanvas = document.getElementById(grayCanvasID);
+ var grayCanvasContext = grayCanvas.getContext("2d");
- debugger;
- var garyDatalength = grayImageDataVar.length;
- var pixelData = new Uint8ClampedArray(garyDatalength);
- for (var i = 0; i < garyDatalength; i++) {
- pixelData[i] = grayImageDataVar[i];
+ var garyDatalength = grayImageDataVar.length;
+ var pixelData = new Uint8ClampedArray(garyDatalength);
+ for (var i = 0; i < garyDatalength; i++) {
+ pixelData[i] = grayImageDataVar[i];
}
- var imgDta = grayCanvasContext.getImageData(0, 0, 348, 507);
- imgDta.data.set
- grayCanvasContext.putImageData(imgDta, 0, 0);
- //}
+ var imgDta = grayCanvasContext.getImageData(0, 0, 348, 507);
+ imgDta.data.set
+ grayCanvasContext.putImageData(imgDta, 0, 0);
+ //}
- // }
+ // }
console.log('End time taken in fillMatchedTerm: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
}
$scope.GetRGBColor = function (maskCanvasContext, actulalX, actualY, x, y) {
- debugger;
var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
pixelData.data[0] = pixelData.data[0] - 9;
@@ -1847,15 +1901,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
$scope.DisableProgressBar = function () {
// alert('Disabled wait cursor is called');
-
-
+
+
if ($rootScope.isHighLight) {
//alert('isHighlight: ' + $scope.isHighLight);
$('#btnHighLight').removeClass('btn btn-black');
$('#btnHighLight').addClass('btn-primary');
- $scope.highLightBody() ;
+ $scope.highLightBody();
@@ -1943,7 +1997,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
$(".com").css("display", "none");
$("#bord").css({ "width": "0px", "display": "none" });
-
+
$(''
+ '' + text + ''
+ ''
@@ -3011,7 +3065,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
$scope.getAnnotationForTransparencyBox = function (pixelData, pixelDataTrans, scope) {
-
+
pixelData.data[0] = pixelData.data[0] - 9;
pixelData.data[1] = pixelData.data[1] - 9;
pixelData.data[2] = pixelData.data[2] - 9;
@@ -3327,20 +3381,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
$scope.enableHighlight = function () {
- if ($rootScope.isHighLight == true)
+ if ($rootScope.isHighLight == true) {
{
}
- else
- {
+ else {
+ $rootScope.isHighLight = true;
$rootScope.isHighLight = true;
- $scope.highLightBody();
+ $scope.highLightBody();
}
}
-
+
$scope.highLightBody = function () {
@@ -3445,7 +3499,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
}
}
-
+
$scope.applyGrayMatrix = function (img, context_gray) {
var DAData = new BitmapData(img.width, img.height);
@@ -3713,7 +3767,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
function OnPaintCanvasMouseMove(event) {
if ($rootScope.isDrawingToolSelected == true) {
- // console.log('moving');
+ // console.log('moving');
//var mousePos = $scope.getMousePos(event);
//var canvasDiv = document.getElementById('canvasDiv');
//var verticalScrollPosition = canvasDiv.scrollTop;
@@ -3781,9 +3835,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
.from($rootScope.BodySystemData.BodySystem.BodySystemTerm)
.where('_SystemNumber == ' + event.currentTarget.id)
.select();
-
+
//color the body gray
- $rootScope.isHighLight =true
+ $rootScope.isHighLight = true
$scope.highLightBody();
//now highlight the selected body system in whole body
diff --git a/400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js b/400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js
index 27d9e55..dcae699 100644
--- a/400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js
+++ b/400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js
@@ -1,12 +1,107 @@
-
-function getLocationsForMatchedTermsInWholeBody(msg)
+previousGrayImageDataList = [];
+
+function updateGrayCanvasDataOnMatcghedLocation(termList, maskCanvasData, coloreImageData,
+ grayImageData, grayImageMRDataList, bodyRegionId)
{
- debugger;
+ console.log('updateGrayCanvasDataOnMatcghedLocation= ' + bodyRegionId)
+
+
+ var n = maskCanvasData.data.length;
+ var maskData = maskCanvasData.data;
+ for (var z = 0; z < termList.length; z++) {
+
+ if (previousGrayImageDataList[parseInt(bodyRegionId - 1)] != null) {
+ grayImageData = previousGrayImageDataList[parseInt(bodyRegionId - 1)];
+
+ }
+ var grayImageDataVar = grayImageData.data;
+ var coloredImageDataVar = coloreImageData.data;
+
+ for (var i = 0; i < n; i += 4) {
+
+
+ var RED = maskData[i] - 9;
+ var GREEN = maskData[i + 1] - 9;
+ var BLUE = maskData[i + 2] - 9;
+
+ var Red;
+ var Green;
+ var Blue;
+ var zero = "0";
+
+ if ((RED).toString().length != 2) {
+ Red = zero.concat((RED).toString())
+ }
+ else {
+ Red = (RED).toString()
+ }
+ if ((GREEN).toString().length != 2) {
+ Green = zero.concat((GREEN).toString())
+ }
+ else {
+ Green = (GREEN).toString()
+
+ }
+ if ((BLUE).toString().length != 2) {
+ Blue = zero.concat((BLUE).toString())
+ }
+ else {
+ Blue = (BLUE).toString()
+
+ }
+
+ var Icolor = (Red + Green + Blue);
+ // alert('Icolor: ' + Icolor)
+
+ if (parseInt(termList[z]._TermNumber) == parseInt(Icolor)) {
+
+
+
+
+ // matchedRGBLocationInBodyRegion.push({ "BRId": bodyRegionId, "location": i });
+
+
+ // matched = true;
- self.postMessage({ 'value': msg });
+ var RED_coloredImage = coloredImageDataVar[i];
+
+ grayImageDataVar[i] = RED_coloredImage;
+
+
+ var GREEN_coloredImage = coloredImageDataVar[i + 1];
+ grayImageDataVar[i + 1] = GREEN_coloredImage;
+
+ var BLUE_coloredImage = coloredImageDataVar[i + 2];
+ grayImageDataVar[i + 2] = BLUE_coloredImage;
+
+
+ var ALPHA_coloredImage = coloredImageDataVar[i + 3];
+ grayImageDataVar[i + 3] = ALPHA_coloredImage;
+
+ }
+
+
+ }
+
+ previousGrayImageDataList[parseInt(bodyRegionId - 1)] = grayImageData;
+
+ // if (matched == true) {
+ self.postMessage({
+ 'bodyRegionId': bodyRegionId,
+ 'value': grayImageData,
+
+
+ });
+ // }
}
+
+}
self.onmessage = function (e) {
- getLocationsForMatchedTermsInWholeBody(e.data.candata);
-}
\ No newline at end of file
+ console.log('shd')
+ updateGrayCanvasDataOnMatcghedLocation(e.data.termList, e.data.maskCanvasData, e.data.coloreImageData,
+ e.data.grayImageData, e.data.grayImageMRDataList, e.data.bodyRegionId);
+
+}
+
diff --git a/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js b/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js
index 386dc50..cc7e069 100644
--- a/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js
+++ b/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js
@@ -1,223 +1,79 @@
-function abc(msg) {
-
-
- var msg1 = msg;
-
- self.postMessage({
- 'cmd': 'getLocationForMatchedTermsInWholeBody',
- 'value': msg1
- });
-
-
-}
-
-getLocationForMatchedTermsInWholeBody = function (termNo, maskCanvasData, coloredImageCanvasList, coloredImageMRCanvasList, grayImageDataList, grayImageMRDataList)
-{
+var UpdatedGrayImageDataList = [];
+var doneBRID = [];
+var abc = 'hello';
+getLocationForMatchedTermsInWholeBody = function (termList, maskCanvasData, coloredImageCanvasList, coloredImageMRCanvasList, grayImageDataList, grayImageMRDataList) {
+ // console.log('for termNumer: ' + termNo + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))
var matchedRGBLocationInBodyRegion = [];
- for (var x = 0; x < maskCanvasData.length; x++) {
+ var matched;
+
+ for (var x = 0; x < maskCanvasData.length; x++)
+ {
+
+ matched = false;
// alert('called for bodyRegionId: ' + $scope.MaskImageSRC[x].bodyRegionId);
var bodyRegionId = maskCanvasData[x].bodyRegionId;
var canvasId = maskCanvasData[x].canvasId;
var maskData = maskCanvasData[x].maskData;
- var coloredImageDataVar = coloredImageCanvasList[bodyRegionId -1];
- var grayImageDataVar = grayImageDataList[bodyRegionId-1];
-
-
- // {
- //var scaledWidth = $scope.ColoredImageSRC[x].Width;
- //var scaledHeight = $scope.ColoredImageSRC[x].Height;
- ////var maskImg = $scope.ColoredImageSRC[x].SRC;
-
-
- //var coloredImg = $scope.ColoredImageSRC[x].SRC;
-
- //var maskImg = $scope.GetMaskImageSource(coloredImg);
-
-
- //var scledX = $scope.ColoredImageSRC[x].x;
- //var scledY = $scope.ColoredImageSRC[x].y;
-
-
- //// 1. get mask canvas for this body region.
- //var maskCanvasID;
- //if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
- // maskCanvasID = 'imageCanvas' + bodyRegionId + '_MR_mci';
- //}
- //else {
- // maskCanvasID = 'imageCanvas' + bodyRegionId + '_mci';
-
- //}
- //var maskCanvas = document.getElementById(maskCanvasID);
- //var maskCanvasContext = maskCanvas.getContext("2d");
- //var maskImgData = maskCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
-
- //// 2. get coloured canvas for this body region.
-
-
- //var coloredImageDataVar;
- //var coloredImageDataMRVar
-
- //if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
-
- // coloredImageDataVar = $rootScope.coloredImageMRCanvasList[parseInt(bodyRegionId)];
- //}
- //else {
- // coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)];
- //}
-
- //var grayImageDataVar;
- //var grayCanvas;
- //if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
-
- // //// 3. get mask canvas for this body region._MR
- // var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
- // grayCanvas = document.getElementById(grayCanvasID);
- // var grayCanvasContext = grayCanvas.getContext("2d");
- // var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
- // grayImageDataVar = grayImageData.data;
- //}
-
- //else {
- // var grayCanvasID = 'imageCanvas' + bodyRegionId;
- // grayCanvas = document.getElementById(grayCanvasID);
- // var grayCanvasContext = grayCanvas.getContext("2d");
- // var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
- // grayImageDataVar = grayImageData.data;
- //}
-
- //var coloredImageDataVarMR;
- //var coloredImageDataMR
-
-
- var counter = 0;
-
- var imageDataVar = maskData.data;
-
- // var previousBRID;
-
- var counter = 0;
-
-
- var n = maskData.data.length;
-
- for (var i = 0; i < n; i += 4) {
-
-
- var RED = imageDataVar[i] - 9;
- var GREEN = imageDataVar[i + 1] - 9;
- var BLUE = imageDataVar[i + 2] - 9;
+ var coloredImageDataVar= coloredImageCanvasList[bodyRegionId - 1];
+ var grayImageDataVar = grayImageDataList[bodyRegionId - 1];
+
+ //var coloredImageDataVar = coloredImageDataVar1.data;
+ //var grayImageDataVar = grayImageDataVar1.data;
- var Red;
- var Green;
- var Blue;
- var zero = "0";
+ var counter = 0;
- if ((RED).toString().length != 2) {
- Red = zero.concat((RED).toString())
- }
- else {
- Red = (RED).toString()
- }
- if ((GREEN).toString().length != 2) {
- Green = zero.concat((GREEN).toString())
- }
- else {
- Green = (GREEN).toString()
+ var imageDataVar = maskData.data;
- }
- if ((BLUE).toString().length != 2) {
- Blue = zero.concat((BLUE).toString())
- }
- else {
- Blue = (BLUE).toString()
+ var machLocationWP = new Worker('match-pixel-wp.js');
+
- }
+ machLocationWP.postMessage({
- var Icolor = (Red + Green + Blue);
- // alert('Icolor: ' + Icolor)
+ 'termList': termList,
+ 'maskCanvasData': maskData,
+ 'coloreImageData': coloredImageDataVar,
+ 'grayImageData': grayImageDataVar,
+ 'grayImageMRDataList': grayImageMRDataList,
+ 'bodyRegionId': bodyRegionId
- if (parseInt(termNo) == parseInt(Icolor)) {
-
- counter++;
-
- //var obj = new Object();
- //obj.bodyRegionId = bodyRegionId;
- //obj.location = i;
-
- matchedRGBLocationInBodyRegion.push({ "BRId": bodyRegionId, "location": i });
-
-
-
-
- var RED_coloredImage = coloredImageDataVar[i];
-
- grayImageDataVar[i] = RED_coloredImage;
-
-
- var GREEN_coloredImage = coloredImageDataVar[i + 1];
- grayImageDataVar[i + 1] = GREEN_coloredImage;
-
- var BLUE_coloredImage = coloredImageDataVar[i + 2];
- grayImageDataVar[i + 2] = BLUE_coloredImage;
-
-
- var ALPHA_coloredImage = coloredImageDataVar[i + 3];
- grayImageDataVar[i + 3] = ALPHA_coloredImage;
-
-
-
-
-
-
- //// var have = machedIcolorInBodyRegion.indexOf(bodyRegionId);
-
-
- // //if (have == -1) {
- // // // machedIcolorInBodyRegion.push(bodyRegionId);
- // //}
- // //else {
-
- // //}
-
-
- // //previousGrayColoredData = i;
- // //if (coloredImageDataVar != null) {
-
-
- // // var RED_coloredImage = coloredImageDataVar[i];
-
- // // // grayImageDataVar[i] = RED_coloredImage;
-
-
- // // var GREEN_coloredImage = coloredImageDataVar[i + 1];
- // // /// grayImageDataVar[i + 1] = GREEN_coloredImage;
-
- // // var BLUE_coloredImage = coloredImageDataVar[i + 2];
- // // //grayImageDataVar[i + 2] = BLUE_coloredImage;
+ });
+ machLocationWP.onmessage = function (e) {
+ console.log('callback: ' + e.data.value+', x='+x);
+
+ //var upadteddata = e.data.value;
+ //var bodyRegionId = e.data.bodyRegionId;
- // // var ALPHA_coloredImage = coloredImageDataVar[i + 3];
- // // // grayImageDataVar[i + 3] = ALPHA_coloredImage;
+ //var grayCanvasID = 'imageCanvas' + bodyRegionId;
+ //var grayCanvas = document.getElementById(grayCanvasID);
+ //var grayCanvasContext = grayCanvas.getContext("2d");
- // //}
+
+ //grayCanvasContext.putImageData(upadteddata, 0, 0);
+ doneBRID.push(e.data.bodyRegionId);
+ UpdatedGrayImageDataList[e.data.bodyRegionId] = e.data.value
+
+ console.log('UpdatedGrayImageDataList: '+ UpdatedGrayImageDataList);
- }
-
+ console.log('doneBRID: ' + doneBRID.length);
- // grayCanvasContext.putImageData(grayImageData, 0, 0);
+ if (doneBRID.length==9) {
+ console.log('before sending UpdatedGrayImageDataList= ' + UpdatedGrayImageDataList)
+ self.postMessage({
+ 'value': UpdatedGrayImageDataList,
+ 'name': 'Happy'
+ })
}
- self.postMessage({
-
- 'value': grayImageDataVar
- });
- // grayCanvasContext.putImageData(grayImageData, 0, 0);
- //}
+ };
+ machLocationWP.onerror = function (e) {
+ console.log('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
+ };
-
+
}
@@ -226,25 +82,9 @@ getLocationForMatchedTermsInWholeBody = function (termNo, maskCanvasData, colore
}
self.onmessage = function (e) {
- getLocationForMatchedTermsInWholeBody(e.data.termNumber, e.data.maskCanvasData,e.data.coloredImageCanvasList,
- e.data.coloredImageMRCanvasList,e.data.grayImageDataList,e.data.grayImageMRDataList);
+ getLocationForMatchedTermsInWholeBody(e.data.termList, e.data.maskCanvasData, e.data.coloredImageCanvasList,
+ e.data.coloredImageMRCanvasList, e.data.grayImageDataList, e.data.grayImageMRDataList);
}
-function launchMatchPixelWorkerProcess() {
-
- var worker = new Worker('match-pixel-wp.js');
-
- worker.onmessage = function (e) {
- var pixelLocation = e.data.msg;
-
- self.postMessage({ 'msg': pixelLocation });
- };
- worker.onerror = function (e) {
- alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
- };
-
-
-
-}