diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
index 4ef7e64..f96b30e 100644
--- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
+++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -1376,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)
@@ -1387,12 +1387,11 @@ 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++) {
- debugger
+ //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"));
+ // 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,
+ 'termList': TermList,
'maskCanvasData': $scope.MaskCanvasData,
'coloredImageCanvasList': $rootScope.coloredImageCanvasList,
'coloredImageMRCanvasList': $rootScope.coloredImageMRCanvasList,
@@ -1401,18 +1400,11 @@ 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);
-
-
- // worker.postMessage({ candata: coloredImageData });
+ //}
worker.onmessage = function (e) {
+ // console.log('callback: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
+
var upadteddata = e.data.value;
var bodyRegionId = e.data.bodyRegionId;
@@ -1420,25 +1412,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
var grayCanvas = document.getElementById(grayCanvasID);
var grayCanvasContext = grayCanvas.getContext("2d");
- // var tempCanvas = document.createElement('canvas');
- // tempCanvas.id = 'tempCanvas';
- // $scope.tempCanvas = tempCanvas.id;
- // tempCanvas.height = 507;
- // tempCanvas.width = 348;
- // tempCanvas.style.position = "absolute";
- // 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");
+
+
+ grayCanvasContext.putImageData(upadteddata, 0, 0);
- grayCanvasContext.putImageData(upadteddata, 0, 0);
-
+ // $rootScope.grayImageDataList[bodyRegionId - 1] = upadteddata;
};
worker.onerror = function (e) {
@@ -1627,7 +1606,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
var grayCanvasContext = grayCanvas.getContext("2d");
- debugger;
var garyDatalength = grayImageDataVar.length;
var pixelData = new Uint8ClampedArray(garyDatalength);
for (var i = 0; i < garyDatalength; i++) {
@@ -1644,7 +1622,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
}
$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;
diff --git a/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js b/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js
index 52fd2cc..08c9c3d 100644
--- a/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js
+++ b/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js
@@ -1,22 +1,12 @@
-function abc(msg) {
-
-
- var msg1 = msg;
-
- self.postMessage({
- 'cmd': 'getLocationForMatchedTermsInWholeBody',
- 'value': msg1
- });
-
-
-}
-
-getLocationForMatchedTermsInWholeBody = function (termNo, maskCanvasData, coloredImageCanvasList, coloredImageMRCanvasList, grayImageDataList, grayImageMRDataList) {
+var previousGrayImageDataList = [];
+var abc = 'hello';
+getLocationForMatchedTermsInWholeBody = function (TermList, maskCanvasData, coloredImageCanvasList, coloredImageMRCanvasList, grayImageDataList, grayImageMRDataList) {
+
var matchedRGBLocationInBodyRegion = [];
var matched;
for (var x = 0; x < maskCanvasData.length; x++) {
- debugger;
+
matched = false;
// alert('called for bodyRegionId: ' + $scope.MaskImageSRC[x].bodyRegionId);
var bodyRegionId = maskCanvasData[x].bodyRegionId;
@@ -25,106 +15,119 @@ getLocationForMatchedTermsInWholeBody = function (termNo, maskCanvasData, colore
var coloredImageDataVar1 = coloredImageCanvasList[bodyRegionId - 1];
var grayImageDataVar1 = grayImageDataList[bodyRegionId - 1];
- var coloredImageDataVar = coloredImageDataVar1.data;
- var grayImageDataVar = grayImageDataVar1.data;
+
+
+ var coloredImageDataVar = coloredImageDataVar1.data;
+ var grayImageDataVar = grayImageDataVar1.data;
- var counter = 0;
-
- var imageDataVar = maskData.data;
+ var counter = 0;
- // var previousBRID;
+ var imageDataVar = maskData.data;
- var counter = 0;
+ // var previousBRID;
+ var counter = 0;
- var n = maskData.data.length;
- for (var i = 0; i < n; i += 4) {
+ var n = maskData.data.length;
+ for (var z = 0; z < TermList.length; z++)
+ {
+ if (previousGrayImageDataList[bodyRegionId - 1] != null) {
+ grayImageDataVar1 = previousGrayImageDataList[bodyRegionId - 1];
+ grayImageDataVar = grayImageDataVar1.data;
+ }
+ 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 RED = imageDataVar[i] - 9;
+ var GREEN = imageDataVar[i + 1] - 9;
+ var BLUE = imageDataVar[i + 2] - 9;
- var Red;
- var Green;
- var Blue;
- var zero = "0";
+ 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 ((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()
+ }
+ if ((BLUE).toString().length != 2) {
+ Blue = zero.concat((BLUE).toString())
+ }
+ else {
+ Blue = (BLUE).toString()
- }
+ }
- var Icolor = (Red + Green + Blue);
- // alert('Icolor: ' + Icolor)
+ var Icolor = (Red + Green + Blue);
+ // alert('Icolor: ' + Icolor)
- if (parseInt(termNo) == parseInt(Icolor)) {
+ if (parseInt(TermList[z]._TermNumber) == parseInt(Icolor)) {
- counter++;
+ counter++;
- //var obj = new Object();
- //obj.bodyRegionId = bodyRegionId;
- //obj.location = i;
- matchedRGBLocationInBodyRegion.push({ "BRId": bodyRegionId, "location": i });
+ matchedRGBLocationInBodyRegion.push({ "BRId": bodyRegionId, "location": i });
- matched = true;
+ matched = true;
- var RED_coloredImage = coloredImageDataVar[i];
+ var RED_coloredImage = coloredImageDataVar[i];
- grayImageDataVar[i] = RED_coloredImage;
+ grayImageDataVar[i] = RED_coloredImage;
- var GREEN_coloredImage = coloredImageDataVar[i + 1];
- grayImageDataVar[i + 1] = GREEN_coloredImage;
+ var GREEN_coloredImage = coloredImageDataVar[i + 1];
+ grayImageDataVar[i + 1] = GREEN_coloredImage;
- var BLUE_coloredImage = coloredImageDataVar[i + 2];
- grayImageDataVar[i + 2] = BLUE_coloredImage;
+ var BLUE_coloredImage = coloredImageDataVar[i + 2];
+ grayImageDataVar[i + 2] = BLUE_coloredImage;
- var ALPHA_coloredImage = coloredImageDataVar[i + 3];
- grayImageDataVar[i + 3] = ALPHA_coloredImage;
+ var ALPHA_coloredImage = coloredImageDataVar[i + 3];
+ grayImageDataVar[i + 3] = ALPHA_coloredImage;
- }
+ }
+ }
+ previousGrayImageDataList[parseInt(bodyRegionId - 1)] = grayImageDataVar1;
}
- self.postMessage({
- 'bodyRegionId':bodyRegionId,
- 'value': grayImageDataVar1,
-
- });
+
+
+ if (matched == true) {
+ self.postMessage({
+ 'bodyRegionId': bodyRegionId,
+ 'value': grayImageDataVar1,
+
+
+ });
+
+ }
}
+
}
self.onmessage = function (e) {
- getLocationForMatchedTermsInWholeBody(e.data.termNumber, e.data.maskCanvasData, e.data.coloredImageCanvasList,
+ getLocationForMatchedTermsInWholeBody(e.data.termList, e.data.maskCanvasData, e.data.coloredImageCanvasList,
e.data.coloredImageMRCanvasList, e.data.grayImageDataList, e.data.grayImageMRDataList);
}