Commit 97944f00f84a3c21c8b2f2dd2132e3321402f991

Authored by Nikita Kulshreshtha
1 parent 65d737e0

working code for single term. it is coloring right but for multiple term numbers…

… it is coloring the last one because the grayimage data is the initial one and on second iteration the worker process is having initial gary data so we need to send updated gray data for each iteration of term number
400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj
... ... @@ -73,6 +73,8 @@
73 73 <Content Include="app\views\da\da-view.html" />
74 74 <Content Include="app\views\LabExerc\LabExerc-view.html" />
75 75 <Content Include="app\widget\MainMenu.html" />
  76 + <Content Include="match-pixel-wp.js" />
  77 + <Content Include="term-number-wp.js" />
76 78 <Content Include="term-wp.js" />
77 79 <Content Include="content\css\main.css" />
78 80 <Content Include="content\data\json\da\body-views\1\da_dat_tm_sg_1.json" />
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -32,7 +32,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
32 32 $rootScope.isHighLight = false;
33 33 $rootScope.coloredImageCanvasList = [];
34 34 $rootScope.coloredImageMRCanvasList = [];
35   -
  35 + $rootScope.ColoredCanvasData = [];
36 36 $rootScope.grayImageDataList = [];
37 37 $rootScope.grayImageMRDataList = [];
38 38  
... ... @@ -44,11 +44,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
44 44 $scope.previousGrayCanvas;
45 45  
46 46 $scope.previousSelectedTermList = [];
47   - $scope.MaskCanvasData = [];
  47 +
48 48  
49 49 // This variable is used for unhighlight previously highlighted body portion, if multiAnnotation is false.
50 50 $scope.machedIcolorInBodyRegion = [];
51 51  
  52 + $scope.MaskCanvasData = [];
  53 +
52 54 //array for bodyviewid correspoing to male female(used for gender change)
53 55 $scope.correspondingBodyViewIds = {
54 56 '1': '5',
... ... @@ -478,7 +480,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
478 480 //}
479 481  
480 482 $scope.ColoredImageSRC = [];
481   -
482 483  
483 484 angular.forEach($scope.bodyRegionCoordinates, function (value, key) {
484 485  
... ... @@ -1057,19 +1058,33 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1057 1058  
1058 1059 };
1059 1060  
1060   - if (document.getElementById('canvasDiv') != null)
1061   - document.getElementById('canvasDiv').appendChild(FlipedImgCanvas);
  1061 + document.getElementById('canvasDiv').appendChild(FlipedImgCanvas);
1062 1062  
1063   - //push mask data
1064   - var maskImgData = context.getImageData(0, 0, w, h);
1065   - $scope.MaskCanvasData.push(
1066   - {
1067   - "bodyRegionId": bodyRegionId,
1068   - "canvasId": FlipedImgCanvas.id,
1069   - "maskData": maskImgData,
  1063 + if (FlipedImgCanvas.id.match('_mci')) {
  1064 +
  1065 + var maskImgData = context.getImageData(0, 0, w, h);
  1066 +
  1067 + $scope.MaskCanvasData.push(
  1068 + {
  1069 + "bodyRegionId": bodyRegionId,
  1070 + "canvasId": FlipedImgCanvas.id,
  1071 + "maskData": maskImgData,
  1072 +
  1073 + }
  1074 + );
  1075 + }
  1076 + else {
  1077 + var colorImgData = context.getImageData(0, 0, w, h);
  1078 + $scope.ColoredCanvasData.push(
  1079 + {
  1080 + "bodyRegionId": bodyRegionId,
  1081 + "canvasId": FlipedImgCanvas.id,
  1082 + "coloredImageData": colorImgData.data,
  1083 +
  1084 + }
  1085 + );
  1086 + }
1070 1087  
1071   - }
1072   - );
1073 1088 }
1074 1089  
1075 1090 $scope.DrawImage = function (h, w, x, y, src, bodyRegionId, isMaskImage) {
... ... @@ -1320,24 +1335,35 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1320 1335 function start() {
1321 1336 // debugger;
1322 1337 context.drawImage(img, 0, 0);
1323   - };
1324 1338  
1325   - if (document.getElementById('canvasDiv') != null)
1326   - document.getElementById('canvasDiv').appendChild(imgCanvas);
  1339 + if (imgCanvas.id.match('_mci')) {
  1340 + var maskImgData = context.getImageData(0, 0, w, h);
  1341 + $scope.MaskCanvasData.push(
  1342 + {
  1343 + "bodyRegionId": bodyRegionId,
  1344 + "canvasId": imgCanvas.id,
  1345 + "maskData": maskImgData,
1327 1346  
1328   - //push mask data
1329   - var maskImgData = context.getImageData(0, 0, w, h);
1330   - $scope.MaskCanvasData.push(
1331   - {
1332   - "bodyRegionId": bodyRegionId,
1333   - "canvasId": imgCanvas.id,
1334   - "maskData": maskImgData,
  1347 + }
  1348 + );
  1349 + }
  1350 + else {
  1351 + var colorImgData = context.getImageData(0, 0, w, h);
  1352 + $scope.ColoredCanvasData.push(
  1353 + {
  1354 + "bodyRegionId": bodyRegionId,
  1355 + "canvasId": imgCanvas.id,
  1356 + "coloredImageData": colorImgData.data,
1335 1357  
1336   - }
1337   - );
  1358 + }
  1359 + );
  1360 + }
  1361 + };
  1362 +
  1363 + document.getElementById('canvasDiv').appendChild(imgCanvas);
1338 1364  
1339   - }
1340 1365  
  1366 + }
1341 1367 $scope.highLightBodyBasedOnIcolor = function (RGBColor) {
1342 1368  
1343 1369 //2. Find Actul Term No Based on Icolor.
... ... @@ -1352,379 +1378,273 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1352 1378 $scope.machedTermNoLocation = [];
1353 1379 console.log(' TermList.length= ' + TermList.length)
1354 1380  
1355   - var worker = new Worker('term-wp.js');
1356 1381  
1357   - for (var i = 0; i < TermList.length; i++) {
1358 1382  
1359   - //start the worker
  1383 + var dataForthisBR = new jinqJs()
  1384 + .from($scope.ColoredCanvasData)
  1385 + .where('bodyRegionId == ' + 1)
  1386 + .select();
  1387 + var coloredImageData = dataForthisBR.coloredImageData;
  1388 + var worker = new Worker('term-number-wp.js');
  1389 +
  1390 + for (var i = 0; i < TermList.length; i++) {
  1391 + debugger
  1392 +
  1393 + console.log('Start time taken for term: ' + TermList[i]._TermNumber + 'in posting: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
1360 1394 worker.postMessage({
1361   - 'termNumber': TermList[i],
1362   - 'maskData': $scope.MaskCanvasData
  1395 + 'termNumber': TermList[i]._TermNumber,
  1396 + 'maskCanvasData': $scope.MaskCanvasData,
  1397 + 'coloredImageCanvasList': $rootScope.coloredImageCanvasList,
  1398 + 'coloredImageMRCanvasList': $rootScope.coloredImageMRCanvasList,
  1399 + 'grayImageDataList': $rootScope.grayImageDataList,
  1400 + 'grayImageMRDataList': $rootScope.grayImageMRDataList
  1401 +
1363 1402 });
1364   - }
1365   - worker.onmessage = function (e) {
1366   - alert(e.data.PiValue);
1367   - };
1368   - worker.onerror = function (e) {
1369   - alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
1370   - };
1371   - }
1372 1403  
  1404 + }
1373 1405  
1374   - function callHight(termNumber) {
  1406 + //var candata = e.value;
  1407 + //var grayCanvasID = 'imageCanvas1'
  1408 + //var grayCanvas = document.getElementById(grayCanvasID);
  1409 + //var grayCanvasContext = grayCanvas.getContext("2d");
  1410 + //var imageData = grayCanvasContext.getImageData(0, 0 ,348,507);
1375 1411  
1376   - console.log('timeout function call. termNumber = ' + termNumber + ' -time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
1377   - // var termNumber = parseInt(TermList[i]._TermNumber);
1378 1412  
1379   - //Match Term No List in each bodyRegion
1380   - $timeout($scope.getLocationsForMatchedTermsInWholeBody(termNumber, 1), 5);
1381   - $timeout($scope.getLocationsForMatchedTermsInWholeBody(termNumber, 2), 5);
  1413 + // worker.postMessage({ candata: coloredImageData });
1382 1414  
1383   - $timeout($scope.getLocationsForMatchedTermsInWholeBody(termNumber, 3), 5);
  1415 + worker.onmessage = function (e) {
  1416 + var upadteddata = e.data.value;
  1417 + var bodyRegionId = e.data.bodyRegionId;
  1418 +
  1419 + var grayCanvasID = 'imageCanvas' + bodyRegionId;
  1420 + var grayCanvas = document.getElementById(grayCanvasID);
  1421 + var grayCanvasContext = grayCanvas.getContext("2d");
1384 1422  
1385   - $timeout($scope.getLocationsForMatchedTermsInWholeBody(termNumber, 4), 5);
  1423 + // var tempCanvas = document.createElement('canvas');
  1424 + // tempCanvas.id = 'tempCanvas';
  1425 + // $scope.tempCanvas = tempCanvas.id;
  1426 + // tempCanvas.height = 507;
  1427 + // tempCanvas.width = 348;
  1428 + // tempCanvas.style.position = "absolute";
  1429 + // tempCanvas.style.left = 200 + 'px';
  1430 + // tempCanvas.style.top = 100 + 'px';
1386 1431  
1387   - $timeout($scope.getLocationsForMatchedTermsInWholeBody(termNumber, 5), 5);
  1432 + //// tempCanvas.style.backgroundColor = "transparent";
  1433 + // tempCanvas.style.visibility = 'visible';
  1434 + // document.getElementById('canvasDiv').appendChild(tempCanvas);
1388 1435  
1389   - $timeout($scope.getLocationsForMatchedTermsInWholeBody(termNumber, 6), 5);
1390   - }
1391   - //$scope.getLocationsForMatchedTermsInWholeBody = function (termNo) {
  1436 + // var tempCanvas1 = document.getElementById('tempCanvas');
  1437 + // var Context = tempCanvas1.getContext("2d");
  1438 +
  1439 + grayCanvasContext.putImageData(upadteddata, 0, 0);
  1440 +
1392 1441  
1393   - // for (var x = 0; x < $scope.ColoredImageSRC.length; x++) {
1394   - // // alert('called for bodyRegionId: ' + $scope.MaskImageSRC[x].bodyRegionId);
1395   - // var bodyRegionId = $scope.ColoredImageSRC[x].bodyRegionId;
1396 1442  
1397   - // {
1398   - // var scaledWidth = $scope.ColoredImageSRC[x].Width;
1399   - // var scaledHeight = $scope.ColoredImageSRC[x].Height;
1400   - // //var maskImg = $scope.ColoredImageSRC[x].SRC;
  1443 + };
  1444 + worker.onerror = function (e) {
  1445 + alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
  1446 + };
  1447 + }
1401 1448  
1402 1449  
1403   - // var coloredImg = $scope.ColoredImageSRC[x].SRC;
1404 1450  
1405   - // var maskImg = $scope.GetMaskImageSource(coloredImg);
  1451 + //$scope.highLightBodyBasedOnIcolor = function (RGBColor) {
1406 1452  
  1453 + // $scope.previousSelectedTermList.length = 0;
1407 1454  
1408   - // var scledX = $scope.ColoredImageSRC[x].x;
1409   - // var scledY = $scope.ColoredImageSRC[x].y;
  1455 + // var RGBColor = $scope.previousSelectedTermList[i];
1410 1456  
  1457 + // //2. Find Actul Term No Based on Icolor.
  1458 + // var ActualTermNo = $scope.getActualTermNumber(RGBColor);
1411 1459  
1412   - // // 1. get mask canvas for this body region.
1413   - // var maskCanvasID;
1414   - // if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
1415   - // maskCanvasID = 'imageCanvas' + bodyRegionId + '_MR_mci';
1416   - // }
1417   - // else {
1418   - // maskCanvasID = 'imageCanvas' + bodyRegionId + '_mci';
  1460 + // //3. Find Term No List Based on ActualTermNo
  1461 + // var TermList = $scope.getTermNumberList(ActualTermNo);
1419 1462  
1420   - // }
1421   - // var maskCanvas = document.getElementById(maskCanvasID);
1422   - // var maskCanvasContext = maskCanvas.getContext("2d");
1423   - // var maskImgData = maskCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
  1463 + // if ($scope.previousSelectedTermList.length > 0) {
1424 1464  
1425   - // // 2. get coloured canvas for this body region.
  1465 + // var worker = new Worker('term-number-wp.js');
1426 1466  
1427 1467  
1428   - // var coloredImageDataVar;
1429   - // var coloredImageDataMRVar
  1468 + // for (var i = 0; i < $scope.previousSelectedTermList.length; i++) {
  1469 + // $scope.machedTermNoLocation = [];
  1470 + // for (var i = 0; i < TermList.length; i++) {
1430 1471  
1431   - // if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
  1472 + // var termNumber = parseInt(TermList[i]._TermNumber);
1432 1473  
1433   - // coloredImageDataVar = $rootScope.coloredImageMRCanvasList[parseInt(bodyRegionId)];
1434   - // }
1435   - // else {
1436   - // coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)];
1437   - // }
1438   - // var grayImageDataVar;
1439   - // var grayCanvas;
1440   - // if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
1441   -
1442   - // //// 3. get mask canvas for this body region._MR
1443   - // var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
1444   - // grayCanvas = document.getElementById(grayCanvasID);
1445   - // var grayCanvasContext = grayCanvas.getContext("2d");
1446   - // var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
1447   - // grayImageDataVar = grayImageData.data;
1448   - // }
  1474 + // // //Match Term No List in each bodyRegion
  1475 + // // $scope.getLocationsForMatchedTermsInWholeBody(termNumber);
1449 1476  
1450   - // else {
1451   - // var grayCanvasID = 'imageCanvas' + bodyRegionId;
1452   - // grayCanvas = document.getElementById(grayCanvasID);
1453   - // var grayCanvasContext = grayCanvas.getContext("2d");
1454   - // var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
1455   - // grayImageDataVar = grayImageData.data;
  1477 + // worker.postMessage({
  1478 + // 'cmd': 'abc',
  1479 + // 'value': termNumber
  1480 + // });
1456 1481 // }
1457 1482  
1458   - // var coloredImageDataVarMR;
1459   - // var coloredImageDataMR
1460   -
1461   -
1462   - // var counter = 0;
1463   -
1464   - // var imageDataVar = maskImgData.data;
1465   -
1466   - // // var previousBRID;
1467   -
1468   - // var counter = 0;
1469   -
1470   -
1471   - // var n = maskImgData.data.length;
1472   -
1473   - // for (var i = 0; i < n; i += 4) {
1474   -
1475   -
1476   - // var RED = imageDataVar[i] - 9;
1477   - // var GREEN = imageDataVar[i + 1] - 9;
1478   - // var BLUE = imageDataVar[i + 2] - 9;
1479   -
1480   - // var Red;
1481   - // var Green;
1482   - // var Blue;
1483   - // var zero = "0";
1484   -
1485   - // if ((RED).toString().length != 2) {
1486   - // Red = zero.concat((RED).toString())
1487   - // }
1488   - // else {
1489   - // Red = (RED).toString()
1490   - // }
1491   - // if ((GREEN).toString().length != 2) {
1492   - // Green = zero.concat((GREEN).toString())
1493   - // }
1494   - // else {
1495   - // Green = (GREEN).toString()
1496   -
1497   - // }
1498   - // if ((BLUE).toString().length != 2) {
1499   - // Blue = zero.concat((BLUE).toString())
1500   - // }
1501   - // else {
1502   - // Blue = (BLUE).toString()
1503   -
1504   - // }
1505   -
1506   - // var Icolor = (Red + Green + Blue);
1507   - // // alert('Icolor: ' + Icolor)
1508   -
1509   - // if (parseInt(termNo) == parseInt(Icolor)) {
1510   -
1511   - // counter++;
1512   - // var have = $scope.machedIcolorInBodyRegion.indexOf(bodyRegionId);
1513   -
1514   -
1515   - // if (have == -1) {
1516   - // $scope.machedIcolorInBodyRegion.push(bodyRegionId);
1517   - // }
1518   - // else {
1519   -
1520   - // }
1521   -
1522   -
1523   - // //previousGrayColoredData = i;
1524   - // if (coloredImageDataVar != null) {
1525   -
1526   -
1527   - // var RED_coloredImage = coloredImageDataVar[i];
1528   -
1529   - // grayImageDataVar[i] = RED_coloredImage;
1530   -
1531   -
1532   - // var GREEN_coloredImage = coloredImageDataVar[i + 1];
1533   - // grayImageDataVar[i + 1] = GREEN_coloredImage;
1534   -
1535   - // var BLUE_coloredImage = coloredImageDataVar[i + 2];
1536   - // grayImageDataVar[i + 2] = BLUE_coloredImage;
1537   -
  1483 + // }
1538 1484  
1539   - // var ALPHA_coloredImage = coloredImageDataVar[i + 3];
1540   - // grayImageDataVar[i + 3] = ALPHA_coloredImage;
  1485 + // worker.onmessage = function (e) {
  1486 + // var msg = e.data.msg1;
  1487 + // };
  1488 + // worker.onerror = function (e) {
  1489 + // alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
  1490 + // };
  1491 + // }
  1492 + // else {
1541 1493  
  1494 + // $scope.machedTermNoLocation = [];
  1495 + // for (var i = 0; i < TermList.length; i++) {
1542 1496  
1543   - // }
  1497 + // var termNumber = parseInt(TermList[i]._TermNumber);
1544 1498  
1545   - // }
  1499 + // var worker = new Worker('term-number-wp.js');
1546 1500  
  1501 + // //start the worker
  1502 + // worker.postMessage({
  1503 + // 'cmd': 'abc',
  1504 + // 'value': termNumber
  1505 + // });
1547 1506  
1548   - // }
1549   -
1550   - // grayCanvasContext.putImageData(grayImageData, 0, 0);
  1507 + // worker.onmessage = function (e) {
  1508 + // var msg = e.data.msg;
  1509 + // };
  1510 + // worker.onerror = function (e) {
  1511 + // alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
  1512 + // };
  1513 + // //Match Term No List in each bodyRegion
  1514 + // //$scope.getLocationsForMatchedTermsInWholeBody(termNumber);
1551 1515 // }
1552   - // }
1553 1516  
1554 1517  
  1518 + // }
1555 1519 //}
1556 1520  
1557 1521  
1558   - $scope.getLocationsForMatchedTermsInWholeBody = function (termNo, bodyRegionId) {
1559   - // debugger;
1560   - //console.log('bodyRegionId = ' + bodyRegionId + '-time: ' + new Date().getTime());
1561   - console.log('bodyRegionId = ' + bodyRegionId + '-time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
1562   - var bodyRegionIdDetails = new jinqJs()
1563   - .from($scope.ColoredImageSRC)
1564   - .where('bodyRegionId == ' + bodyRegionId)
1565   - .select();
1566   -
1567   - var scaledWidth = bodyRegionIdDetails[0].Width;
1568   - var scaledHeight = bodyRegionIdDetails[0].Height;
1569   - //var maskImg = $scope.ColoredImageSRC[x].SRC;
1570   -
1571   -
1572   - var coloredImg = bodyRegionIdDetails[0].SRC;
1573   -
1574   - var maskImg = $scope.GetMaskImageSource(coloredImg);
1575   -
1576   -
1577   - var scledX = bodyRegionIdDetails[0].x;
1578   - var scledY = bodyRegionIdDetails[0].y;
1579   -
1580   -
1581   - // 1. get mask canvas for this body region.
1582   - var maskCanvasID;
1583   - if (bodyRegionIdDetails[0].haveMirror == 'true') {
1584   - maskCanvasID = 'imageCanvas' + bodyRegionId + '_MR_mci';
1585   - }
1586   - else {
1587   - maskCanvasID = 'imageCanvas' + bodyRegionId + '_mci';
1588   -
1589   - }
1590   - var maskCanvas = document.getElementById(maskCanvasID);
1591   - var maskCanvasContext = maskCanvas.getContext("2d");
1592   - var maskImgData = maskCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
1593   -
1594   - // 2. get coloured canvas for this body region.
1595   -
1596   -
1597   - var coloredImageDataVar;
1598   - var coloredImageDataMRVar
1599   -
1600   - if (bodyRegionIdDetails[0].haveMirror == 'true') {
1601 1522  
1602   - coloredImageDataVar = $rootScope.coloredImageMRCanvasList[parseInt(bodyRegionId)];
1603   - }
1604   - else {
1605   - coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)];
1606   - }
1607   - var grayImageDataVar;
1608   - var grayCanvas;
1609   - if (bodyRegionIdDetails[0].haveMirror == 'true') {
  1523 + $scope.fillMatchedTerm = function (grayImageDataVar, BrId) {
  1524 + console.log('Start time taken in fillMatchedTerm: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
1610 1525  
1611   - //// 3. get mask canvas for this body region._MR
1612   - var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
1613   - grayCanvas = document.getElementById(grayCanvasID);
1614   - var grayCanvasContext = grayCanvas.getContext("2d");
1615   - var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
1616   - grayImageDataVar = grayImageData.data;
1617   - }
  1526 + //for (var x = 0; x < $scope.ColoredImageSRC.length; x++) {
  1527 + // // alert('called for bodyRegionId: ' + $scope.MaskImageSRC[x].bodyRegionId);
  1528 + // var bodyRegionId = $scope.ColoredImageSRC[x].bodyRegionId;
1618 1529  
1619   - else {
1620   - var grayCanvasID = 'imageCanvas' + bodyRegionId;
1621   - grayCanvas = document.getElementById(grayCanvasID);
1622   - var grayCanvasContext = grayCanvas.getContext("2d");
1623   - var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
1624   - grayImageDataVar = grayImageData.data;
1625   - }
  1530 + // {
1626 1531  
1627   - var coloredImageDataVarMR;
1628   - var coloredImageDataMR
  1532 + // var scaledWidth = $scope.ColoredImageSRC[x].Width;
  1533 + // var scaledHeight = $scope.ColoredImageSRC[x].Height;
  1534 + // //var maskImg = $scope.ColoredImageSRC[x].SRC;
1629 1535  
1630 1536  
1631   - var counter = 0;
  1537 + // var coloredImg = $scope.ColoredImageSRC[x].SRC;
1632 1538  
1633   - var imageDataVar = maskImgData.data;
  1539 + // var maskImg = $scope.GetMaskImageSource(coloredImg);
1634 1540  
1635   - // var previousBRID;
1636 1541  
1637   - var counter = 0;
  1542 + // var scledX = $scope.ColoredImageSRC[x].x;
  1543 + // var scledY = $scope.ColoredImageSRC[x].y;
1638 1544  
1639 1545  
1640   - var n = maskImgData.data.length;
  1546 + // // 1. get mask canvas for this body region.
  1547 + // //var maskCanvasID;
  1548 + // //if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
  1549 + // // maskCanvasID = 'imageCanvas' + bodyRegionId + '_MR_mci';
  1550 + // //}
  1551 + // //else {
  1552 + // // maskCanvasID = 'imageCanvas' + bodyRegionId + '_mci';
1641 1553  
1642   - for (var i = 0; i < n; i += 4) {
  1554 + // //}
  1555 + // //var maskCanvas = document.getElementById(maskCanvasID);
  1556 + // //var maskCanvasContext = maskCanvas.getContext("2d");
  1557 + // //var maskImgData = maskCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
1643 1558  
  1559 + // // 2. get coloured canvas for this body region.
1644 1560  
1645   - var RED = imageDataVar[i] - 9;
1646   - var GREEN = imageDataVar[i + 1] - 9;
1647   - var BLUE = imageDataVar[i + 2] - 9;
1648   -
1649   - var Red;
1650   - var Green;
1651   - var Blue;
1652   - var zero = "0";
1653   -
1654   - if ((RED).toString().length != 2) {
1655   - Red = zero.concat((RED).toString())
1656   - }
1657   - else {
1658   - Red = (RED).toString()
1659   - }
1660   - if ((GREEN).toString().length != 2) {
1661   - Green = zero.concat((GREEN).toString())
1662   - }
1663   - else {
1664   - Green = (GREEN).toString()
1665   -
1666   - }
1667   - if ((BLUE).toString().length != 2) {
1668   - Blue = zero.concat((BLUE).toString())
1669   - }
1670   - else {
1671   - Blue = (BLUE).toString()
1672 1561  
1673   - }
  1562 + // var coloredImageDataVar;
  1563 + // var coloredImageDataMRVar
1674 1564  
1675   - var Icolor = (Red + Green + Blue);
1676   - // alert('Icolor: ' + Icolor)
  1565 + // if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
1677 1566  
1678   - if (parseInt(termNo) == parseInt(Icolor)) {
  1567 + // coloredImageDataVar = $rootScope.coloredImageMRCanvasList[parseInt(bodyRegionId)];
  1568 + // }
  1569 + // else {
  1570 + // coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)];
  1571 + // }
  1572 + // var grayImageDataVar;
  1573 + // var grayCanvas;
  1574 + // if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
1679 1575  
1680   - counter++;
1681   - var have = $scope.machedIcolorInBodyRegion.indexOf(bodyRegionId);
  1576 + // //// 3. get mask canvas for this body region._MR
  1577 + // var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
  1578 + // grayCanvas = document.getElementById(grayCanvasID);
  1579 + // var grayCanvasContext = grayCanvas.getContext("2d");
  1580 + // var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
  1581 + // grayImageDataVar = grayImageData.data;
  1582 + // }
1682 1583  
  1584 + // else {
  1585 + // var grayCanvasID = 'imageCanvas' + bodyRegionId;
  1586 + // grayCanvas = document.getElementById(grayCanvasID);
  1587 + // var grayCanvasContext = grayCanvas.getContext("2d");
  1588 + // var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
  1589 + // grayImageDataVar = grayImageData.data;
  1590 + // }
1683 1591  
1684   - if (have == -1) {
1685   - $scope.machedIcolorInBodyRegion.push(bodyRegionId);
1686   - }
1687   - else {
  1592 + // var coloredImageDataVarMR;
  1593 + // var coloredImageDataMR
1688 1594  
1689   - }
1690 1595  
  1596 + // var counter = 0;
1691 1597  
1692   - //previousGrayColoredData = i;
1693   - if (coloredImageDataVar != null) {
1694 1598  
  1599 + // var dataForthisBR = new jinqJs()
  1600 + // .from(matchedLocationData)
  1601 + // .where('BRId == ' + bodyRegionId)
  1602 + // .select();
1695 1603  
1696   - var RED_coloredImage = coloredImageDataVar[i];
  1604 + // for (var z = 0; z < dataForthisBR.length; z++)
  1605 + // {
  1606 + // var location = parseInt(dataForthisBR[z].location);
1697 1607  
1698   - grayImageDataVar[i] = RED_coloredImage;
1699 1608  
  1609 + // var RED_coloredImage = coloredImageDataVar[location];
1700 1610  
1701   - var GREEN_coloredImage = coloredImageDataVar[i + 1];
1702   - grayImageDataVar[i + 1] = GREEN_coloredImage;
  1611 + // grayImageDataVar[location] = RED_coloredImage;
1703 1612  
1704   - var BLUE_coloredImage = coloredImageDataVar[i + 2];
1705   - grayImageDataVar[i + 2] = BLUE_coloredImage;
1706 1613  
  1614 + // var GREEN_coloredImage = coloredImageDataVar[location + 1];
  1615 + // grayImageDataVar[location + 1] = GREEN_coloredImage;
1707 1616  
1708   - var ALPHA_coloredImage = coloredImageDataVar[i + 3];
1709   - grayImageDataVar[i + 3] = ALPHA_coloredImage;
  1617 + // var BLUE_coloredImage = coloredImageDataVar[location + 2];
  1618 + // grayImageDataVar[location + 2] = BLUE_coloredImage;
1710 1619  
1711 1620  
1712   - }
  1621 + // var ALPHA_coloredImage = coloredImageDataVar[location + 3];
  1622 + // grayImageDataVar[location + 3] = ALPHA_coloredImage;
1713 1623  
1714   - }
  1624 + // }
  1625 + var grayCanvasID = 'imageCanvas' + BrId;
  1626 + var grayCanvas = document.getElementById(grayCanvasID);
  1627 + var grayCanvasContext = grayCanvas.getContext("2d");
1715 1628  
1716 1629  
  1630 + debugger;
  1631 + var garyDatalength = grayImageDataVar.length;
  1632 + var pixelData = new Uint8ClampedArray(garyDatalength);
  1633 + for (var i = 0; i < garyDatalength; i++) {
  1634 + pixelData[i] = grayImageDataVar[i];
1717 1635 }
  1636 + var imgDta = grayCanvasContext.getImageData(0, 0, 348, 507);
  1637 + imgDta.data.set
  1638 + grayCanvasContext.putImageData(imgDta, 0, 0);
  1639 + //}
1718 1640  
1719   - grayCanvasContext.putImageData(grayImageData, 0, 0);
  1641 + // }
1720 1642  
  1643 + console.log('End time taken in fillMatchedTerm: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
1721 1644 }
1722 1645  
1723   -
1724   -
1725   -
1726 1646 $scope.GetRGBColor = function (maskCanvasContext, actulalX, actualY, x, y) {
1727   -
  1647 + debugger;
1728 1648 var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
1729 1649  
1730 1650 pixelData.data[0] = pixelData.data[0] - 9;
... ... @@ -1844,8 +1764,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1844 1764 tempCanvas.style.left = 200 + 'px';
1845 1765 tempCanvas.style.backgroundColor = "transparent";
1846 1766 tempCanvas.style.visibility = 'hidden';
1847   - if (document.getElementById('canvasDiv') != null)
1848   - document.getElementById('canvasDiv').appendChild(tempCanvas);
  1767 + document.getElementById('canvasDiv').appendChild(tempCanvas);
1849 1768  
1850 1769 // //debugger;
1851 1770  
... ... @@ -2291,8 +2210,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2291 2210 tempCanvas.style.backgroundColor = "transparent";
2292 2211 tempCanvas.style.visibility = 'hidden';
2293 2212 tempCanvas.style.border = "black 1px solid";
2294   - if (document.getElementById('canvasDiv') != null)
2295   - document.getElementById('canvasDiv').appendChild(tempCanvas);
  2213 + document.getElementById('canvasDiv').appendChild(tempCanvas);
2296 2214 }
2297 2215  
2298 2216  
... ... @@ -2326,8 +2244,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2326 2244 transparencyCanvas.style.border = "black 1px solid";
2327 2245 transparencyCanvas.style.backgroundColor = "transparent";
2328 2246 // transparencyCanvas.style.visibility = 'hidden';
2329   - if (document.getElementById('canvasDiv') != null)
2330   - document.getElementById('canvasDiv').appendChild(transparencyCanvas);
  2247 + document.getElementById('canvasDiv').appendChild(transparencyCanvas);
2331 2248 $scope.transparencyChangeCounter = 0;
2332 2249  
2333 2250 $('#transparencyCanvas').resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeCanvas(); }, start: function (event, ui) { clearTransCanvas(); } });
... ... @@ -2603,8 +2520,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2603 2520 transparencyTempCanvas.style.visibility = 'hidden';
2604 2521 //transparencyTempCanvas.style.visibility = 'visible';
2605 2522 // transparencyCanvas.style.zIndex = 4000;
2606   - if (document.getElementById('canvasDiv') != null)
2607   - document.getElementById('canvasDiv').appendChild(transparencyTempCanvas);
  2523 + document.getElementById('canvasDiv').appendChild(transparencyTempCanvas);
2608 2524  
2609 2525 //create temp mask canvas
2610 2526 transparencyTempcanavsMask.height = Height;
... ... @@ -2615,8 +2531,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2615 2531 transparencyTempcanavsMask.style.visibility = 'hidden';
2616 2532 //transparencyTempCanvas.style.visibility = 'visible';
2617 2533 // transparencyCanvas.style.border = "black 1px solid";
2618   - if (document.getElementById('canvasDiv') != null)
2619   - document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);
  2534 + document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);
2620 2535  
2621 2536  
2622 2537 var tempImg = new Image();
... ... @@ -2847,8 +2762,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2847 2762 transparencyCanvas.style.left = tCanvas.style.left; // x + "px";
2848 2763 transparencyCanvas.style.top = tCanvas.style.top//y + "px";
2849 2764 transparencyCanvas.style.border = "black 1px solid";
2850   - if (document.getElementById('canvasDiv') != null)
2851   - document.getElementById('canvasDiv').appendChild(transparencyCanvas);
  2765 + document.getElementById('canvasDiv').appendChild(transparencyCanvas);
2852 2766  
2853 2767 $('#transparencyCanvas').resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeCanvas(); }, start: function (event, ui) { clearTransCanvas(); } });
2854 2768  
... ... @@ -2873,8 +2787,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2873 2787 tempCanvas.style.visibility = 'hidden';
2874 2788 // tempCanvas.style.border = "black 1px solid";
2875 2789  
2876   - if (document.getElementById('canvasDiv') != null)
2877   - document.getElementById('canvasDiv').appendChild(tempCanvas);
  2790 + document.getElementById('canvasDiv').appendChild(tempCanvas);
2878 2791  
2879 2792  
2880 2793 var BodyRegionDictionary = $scope.BodyRegionCordinatesData;
... ... @@ -2986,8 +2899,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2986 2899 transparencyTempcanavsMask.style.top = nomMirroredBodyRegion[0].Y + "px"//y + "px";
2987 2900 transparencyTempcanavsMask.style.visibility = 'hidden';
2988 2901  
2989   - if (document.getElementById('canvasDiv') != null)
2990   - document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);
  2902 + document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);
2991 2903  
2992 2904 var tranparencyImgSrc = $scope.GetImageSource(clickedBodyRegion);
2993 2905 var tempMaskImg = new Image();
... ... @@ -3414,11 +3326,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3414 3326 }
3415 3327  
3416 3328 $scope.enableHighlight = function () {
3417   - $rootScope.isHighLight = true;
3418 3329  
3419   - // alert('enableHighlight is called');
  3330 + if ($rootScope.isHighLight == true) {
  3331 +
  3332 + }
  3333 + else {
  3334 + $rootScope.isHighLight = true;
  3335 + $scope.highLightBody();
  3336 + }
  3337 +
3420 3338  
3421   - $scope.highLightBody();
3422 3339 }
3423 3340  
3424 3341  
... ... @@ -3446,7 +3363,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3446 3363  
3447 3364 var coloredCanvasContext = imageCanvas.getContext("2d");
3448 3365 var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht);
3449   - var coloredImageDataVar = coloredImageData.data;
  3366 + var coloredImageDataVar = coloredImageData;
3450 3367  
3451 3368  
3452 3369 if (value.haveMirror == 'true') {
... ... @@ -3456,11 +3373,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3456 3373 //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1;
3457 3374  
3458 3375 $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar;
3459   - }
3460   -
3461   -
3462   - //$rootScope.coloredImageCanvasList.push(parts);
3463 3376  
  3377 + }
3464 3378  
3465 3379  
3466 3380 var context_gray = imageCanvas.getContext('2d');
... ... @@ -3470,6 +3384,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3470 3384  
3471 3385  
3472 3386 var img = new Image();
  3387 +
3473 3388 img.src = dataURL;
3474 3389  
3475 3390  
... ... @@ -3510,23 +3425,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3510 3425 $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData;
3511 3426 }
3512 3427 }
3513   - $timeout(function () { imageCanvas.style.visibility = 'visible' }, 250);
3514   - })
3515   -
3516   -
3517   -
3518   - // alert('length: '+ $scope.coloredImageCanvasList.length);
3519   -
3520 3428  
  3429 + $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50);
  3430 + })
3521 3431  
3522   - //alert('length: ' + $scope.previousSelectedTermList.length);
3523 3432  
3524 3433 if ($scope.previousSelectedTermList.length > 0) {
3525 3434  
3526 3435 //alert('previousSelectedTermList length: ' + $scope.previousSelectedTermList.length);
3527 3436  
3528 3437 for (var i = 0; i < $scope.previousSelectedTermList.length; i++) {
3529   -
3530 3438 $scope.highLightBodyBasedOnIcolor($scope.previousSelectedTermList[i]);
3531 3439  
3532 3440 }
... ... @@ -3744,8 +3652,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3744 3652 paintCanvas.addEventListener('mousedown', OnPaintCanvasMouseDown, false)
3745 3653 paintCanvas.addEventListener('mouseup', OnPaintCanvasMouseUp, false)
3746 3654  
3747   - if (document.getElementById('canvasDiv') != null)
3748   - document.getElementById('canvasDiv').appendChild(paintCanvas);
  3655 + document.getElementById('canvasDiv').appendChild(paintCanvas);
3749 3656  
3750 3657 $scope.paintCanvasContext = document.getElementById('paintCanvas').getContext('2d');
3751 3658 }
... ... @@ -3880,10 +3787,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3880 3787  
3881 3788 var termNumber = parseInt(systemMatchedTermList[0]._TermNumber);
3882 3789  
3883   - $scope.highLightBodyBasedOnIcolor(termNumber);
3884   -
3885 3790 //Match Term No List in each bodyRegion
3886   - //$scope.getLocationsForMatchedTermsInWholeBody(termNumber);
  3791 + $scope.getLocationsForMatchedTermsInWholeBody(termNumber);
3887 3792 //for (var i = 0; i < systemMatchedTermList.length; i++) {
3888 3793  
3889 3794 // var termNumber = parseInt(systemMatchedTermList[i]._TermNumber);
... ...
400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js 0 → 100644
  1 +
  2 +function getLocationsForMatchedTermsInWholeBody(msg)
  3 +{
  4 + debugger;
  5 +
  6 + self.postMessage({ 'value': msg });
  7 +
  8 +}
  9 +
  10 +self.onmessage = function (e) {
  11 + getLocationsForMatchedTermsInWholeBody(e.data.candata);
  12 +}
0 13 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/term-number-wp.js 0 → 100644
  1 +function abc(msg) {
  2 +
  3 +
  4 + var msg1 = msg;
  5 +
  6 + self.postMessage({
  7 + 'cmd': 'getLocationForMatchedTermsInWholeBody',
  8 + 'value': msg1
  9 + });
  10 +
  11 +
  12 +}
  13 +
  14 +getLocationForMatchedTermsInWholeBody = function (termNo, maskCanvasData, coloredImageCanvasList, coloredImageMRCanvasList, grayImageDataList, grayImageMRDataList) {
  15 +
  16 + var matchedRGBLocationInBodyRegion = [];
  17 + var matched;
  18 + for (var x = 0; x < maskCanvasData.length; x++) {
  19 + debugger;
  20 + matched = false;
  21 + // alert('called for bodyRegionId: ' + $scope.MaskImageSRC[x].bodyRegionId);
  22 + var bodyRegionId = maskCanvasData[x].bodyRegionId;
  23 + var canvasId = maskCanvasData[x].canvasId;
  24 + var maskData = maskCanvasData[x].maskData;
  25 +
  26 + var coloredImageDataVar1 = coloredImageCanvasList[bodyRegionId - 1];
  27 + var grayImageDataVar1 = grayImageDataList[bodyRegionId - 1];
  28 + var coloredImageDataVar = coloredImageDataVar1.data;
  29 + var grayImageDataVar = grayImageDataVar1.data;
  30 +
  31 +
  32 +
  33 +
  34 + var counter = 0;
  35 +
  36 + var imageDataVar = maskData.data;
  37 +
  38 + // var previousBRID;
  39 +
  40 + var counter = 0;
  41 +
  42 +
  43 + var n = maskData.data.length;
  44 +
  45 + for (var i = 0; i < n; i += 4) {
  46 +
  47 +
  48 + var RED = imageDataVar[i] - 9;
  49 + var GREEN = imageDataVar[i + 1] - 9;
  50 + var BLUE = imageDataVar[i + 2] - 9;
  51 +
  52 + var Red;
  53 + var Green;
  54 + var Blue;
  55 + var zero = "0";
  56 +
  57 + if ((RED).toString().length != 2) {
  58 + Red = zero.concat((RED).toString())
  59 + }
  60 + else {
  61 + Red = (RED).toString()
  62 + }
  63 + if ((GREEN).toString().length != 2) {
  64 + Green = zero.concat((GREEN).toString())
  65 + }
  66 + else {
  67 + Green = (GREEN).toString()
  68 +
  69 + }
  70 + if ((BLUE).toString().length != 2) {
  71 + Blue = zero.concat((BLUE).toString())
  72 + }
  73 + else {
  74 + Blue = (BLUE).toString()
  75 +
  76 + }
  77 +
  78 + var Icolor = (Red + Green + Blue);
  79 + // alert('Icolor: ' + Icolor)
  80 +
  81 + if (parseInt(termNo) == parseInt(Icolor)) {
  82 +
  83 + counter++;
  84 +
  85 + //var obj = new Object();
  86 + //obj.bodyRegionId = bodyRegionId;
  87 + //obj.location = i;
  88 +
  89 + matchedRGBLocationInBodyRegion.push({ "BRId": bodyRegionId, "location": i });
  90 +
  91 +
  92 + matched = true;
  93 +
  94 + var RED_coloredImage = coloredImageDataVar[i];
  95 +
  96 + grayImageDataVar[i] = RED_coloredImage;
  97 +
  98 +
  99 + var GREEN_coloredImage = coloredImageDataVar[i + 1];
  100 + grayImageDataVar[i + 1] = GREEN_coloredImage;
  101 +
  102 + var BLUE_coloredImage = coloredImageDataVar[i + 2];
  103 + grayImageDataVar[i + 2] = BLUE_coloredImage;
  104 +
  105 +
  106 + var ALPHA_coloredImage = coloredImageDataVar[i + 3];
  107 + grayImageDataVar[i + 3] = ALPHA_coloredImage;
  108 +
  109 + }
  110 +
  111 +
  112 + }
  113 + self.postMessage({
  114 + 'bodyRegionId':bodyRegionId,
  115 + 'value': grayImageDataVar1,
  116 +
  117 + });
  118 +
  119 + }
  120 +
  121 +
  122 +
  123 +
  124 +}
  125 +
  126 +self.onmessage = function (e) {
  127 + getLocationForMatchedTermsInWholeBody(e.data.termNumber, e.data.maskCanvasData, e.data.coloredImageCanvasList,
  128 + e.data.coloredImageMRCanvasList, e.data.grayImageDataList, e.data.grayImageMRDataList);
  129 +
  130 +}
  131 +
  132 +function launchMatchPixelWorkerProcess() {
  133 +
  134 + var worker = new Worker('match-pixel-wp.js');
  135 +
  136 + worker.onmessage = function (e) {
  137 + var pixelLocation = e.data.msg;
  138 +
  139 + self.postMessage({ 'msg': pixelLocation });
  140 + };
  141 + worker.onerror = function (e) {
  142 + alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
  143 + };
  144 +
  145 +
  146 +
  147 +}
  148 +
... ...
400-SOURCECODE/AIAHTML5.Web/term-wp.js deleted
1   -
2   -function CalculatePi(loop) {
3   - var c = parseInt(loop);
4   - var f = parseFloat(loop);
5   - var n = 1;
6   -
7   -
8   - if (isNaN(c) || f != c) {
9   - throw ("errInvalidNumber");
10   - } else if (c <= 0) {
11   - throw ("errNegativeNumber");
12   - }
13   -
14   - for (var i = 0, Pi = 0; i <= c; i++) {
15   - Pi = Pi + (4 / n) - (4 / (n + 2));
16   - n = n + 4;
17   - }
18   - self.postMessage({ 'PiValue': loop });
19   -}
20   -
21   -self.onmessage = function (e) {
22   - CalculatePi(e.data.termNumber);
23   -}
24 0 \ No newline at end of file