Commit 1fb4c9bb88d0b1eb7297cb37c38145fd0f879d74

Authored by Nikita Kulshreshtha
1 parent 5349c08d

highlight option working for non mirrored but it is slow

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -42,7 +42,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
42 42 $scope.zoomInOut = 75;
43 43 $scope.i = 0;
44 44 $scope.speachBubbleArray = [];
45   - $scope.multiAnnotationIsON = true;
  45 + $scope.multiAnnotationIsON = false;
46 46 $scope.previousGrayImageDataVar;
47 47 $scope.previousGrayCanvas;
48 48  
... ... @@ -1371,18 +1371,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1371 1371 }
1372 1372 $scope.highLightBodyBasedOnIcolor = function (RGBColor) {
1373 1373  
1374   - // console.log(' $scope.highLightBodyBasedOnIcolor')
  1374 + // console.log(' $scope.highLightBodyBasedOnIcolor')
  1375 +
1375 1376  
1376   - //terminate previous running workers to create space for new workers
1377   - var workerCount = $scope.runningWorkers.length;
1378   - if(workerCount>0){
1379   - for (var i = workerCount-1; i >= 0; i--) {
1380   - var runningWorker = $scope.runningWorkers[i].workerName;
1381   - runningWorker.terminate();
1382   - $scope.runningWorkers.splice(i, 1);
1383   - // workerCount--;
1384   - }
1385   - }
1386 1377  
1387 1378  
1388 1379 //2. Find Actul Term No Based on Icolor.
... ... @@ -1394,16 +1385,33 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1394 1385  
1395 1386 //4.
1396 1387  
1397   - $scope.machedTermNoLocation = [];
1398   -
  1388 + $scope.HighlightBodyByTermList(TermList);
  1389 +
  1390 +
  1391 + }
  1392 +
  1393 + $scope.HighlightBodyByTermList = function (TermList) {
  1394 +
  1395 +
  1396 + //terminate previous running workers to create space for new workers
  1397 + var workerCount = $scope.runningWorkers.length;
  1398 + if (workerCount > 0) {
  1399 + for (var i = workerCount - 1; i >= 0; i--) {
  1400 + var runningWorker = $scope.runningWorkers[i].workerName;
  1401 + runningWorker.terminate();
  1402 + $scope.runningWorkers.splice(i, 1);
  1403 + // workerCount--;
  1404 + }
  1405 + }
  1406 +
1399 1407  
1400 1408 var n = $scope.MaskCanvasData.length;
1401   - console.log('$scope.MaskCanvasData.length= ' + n)
  1409 + console.log('$rootScope.MaskCanvasData.length= ' + n)
1402 1410  
1403 1411 // console.log('Start time taken for term: ' + TermList[i]._TermNumber + 'in posting: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
1404   - // debugger
  1412 + // debugger
1405 1413 for (var x = 0; x < 9; x++) {
1406   - console.log('$scope.MaskCanvasData.length= ' + n)
  1414 + console.log('$rootScope.MaskCanvasData.length= ' + n)
1407 1415  
1408 1416 var bodyRegionId = $scope.MaskCanvasData[x].bodyRegionId;
1409 1417 var canvasId = $scope.MaskCanvasData[x].canvasId;
... ... @@ -1414,12 +1422,23 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1414 1422  
1415 1423 if (canvasId.match('_MR')) {
1416 1424 coloredImageDataVar = $rootScope.coloredImageMRCanvasList[bodyRegionId];
  1425 +
  1426 +
1417 1427 if ($scope.multiAnnotationIsON == true) {
1418 1428  
1419 1429 grayImageDataVar = $rootScope.grayImageMRDataListCurrent[bodyRegionId]
1420 1430 }
1421 1431 else
1422   - grayImageDataVar = $rootScope.grayImageMRDataList[bodyRegionId];
  1432 + grayImageDataVar = $rootScope.grayImageMRDataList[bodyRegionId];
  1433 +
  1434 + if ($rootScope.isExtract) {
  1435 + if ($scope.multiAnnotationIsON == true) {
  1436 +
  1437 + grayImageDataVar = $rootScope.grayImageMRDataListCurrent[bodyRegionId]
  1438 + }
  1439 + else
  1440 + grayImageDataVar = $rootScope.whiteImageMRDataList[bodyRegionId];
  1441 + }
1423 1442 }
1424 1443  
1425 1444 else {
... ... @@ -1429,7 +1448,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1429 1448 grayImageDataVar = $rootScope.grayImageDataListCurrent[bodyRegionId - 1]
1430 1449 }
1431 1450 else
1432   - grayImageDataVar = $rootScope.grayImageDataList[bodyRegionId - 1];
  1451 + grayImageDataVar = $rootScope.grayImageDataList[bodyRegionId - 1];
  1452 +
  1453 +
  1454 + if ($rootScope.isExtract) {
  1455 + if ($scope.multiAnnotationIsON == true) {
  1456 +
  1457 + grayImageDataVar = $rootScope.grayImageDataListCurrent[bodyRegionId]
  1458 + }
  1459 + else
  1460 + grayImageDataVar = $rootScope.whiteImageDataList[bodyRegionId];
  1461 + }
1433 1462 }
1434 1463  
1435 1464 //var coloredImageDataVar = $rootScope.coloredImageCanvasList[bodyRegionId - 1];
... ... @@ -1438,9 +1467,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1438 1467 var worker = new Worker('term-number-wp.js');
1439 1468  
1440 1469 //push workers in array to further used the refernece to delete the workers
1441   - $scope.runningWorkers.push({'workerName':worker})
  1470 + $scope.runningWorkers.push({ 'workerName': worker })
1442 1471  
1443   - // console.log('for bodyRegionId = ' + bodyRegionId+ ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))
  1472 + // console.log('for bodyRegionId = ' + bodyRegionId+ ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))
1444 1473 worker.postMessage({
1445 1474  
1446 1475 'termList': TermList,
... ... @@ -1455,18 +1484,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1455 1484 //}
1456 1485  
1457 1486 worker.onmessage = function (e) {
1458   - // console.log('callback: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
  1487 + console.log('callback for e.data.bodyRegionId: ' + e.data.bodyRegionId +', time: '+ new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
  1488 +
1459 1489  
1460   -
1461 1490 var updatedData = e.data.value;
1462 1491  
1463 1492 var bodyRegionId = e.data.bodyRegionId;
1464   - var canvasId = (e.data.canvasId).replace('_mci','');
  1493 + var canvasId = (e.data.canvasId).replace('_mci', '');
1465 1494 //debugger;
1466 1495 //for (var i = 1; i <= updatedData.length; i++) {
1467 1496 var grayCanvasID = canvasId;
1468 1497  
1469   - // var grayCanvasID = 'imageCanvas' + bodyRegionId;
  1498 + // var grayCanvasID = 'imageCanvas' + bodyRegionId;
1470 1499 var grayCanvas = document.getElementById(grayCanvasID);
1471 1500 var grayCanvasContext = grayCanvas.getContext("2d");
1472 1501  
... ... @@ -1476,7 +1505,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1476 1505 // }
1477 1506  
1478 1507  
1479   - // worker.terminate();
  1508 + // worker.terminate();
1480 1509  
1481 1510 if (canvasId.match('_MR'))
1482 1511 $rootScope.grayImageMRDataListCurrent[bodyRegionId] = updatedData;
... ... @@ -1488,12 +1517,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1488 1517 alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
1489 1518 };
1490 1519 }
1491   -
1492 1520 }
1493   -
1494   -
1495   -
1496   -
1497 1521 $scope.GetRGBColor = function (maskCanvasContext, actulalX, actualY, x, y) {
1498 1522 var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
1499 1523  
... ... @@ -3652,17 +3676,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3652 3676 $scope.highLightBody();
3653 3677 //now highlight the selected body system in whole body
3654 3678  
3655   - var termNumber = parseInt(systemMatchedTermList[0]._TermNumber);
3656 3679  
3657   - //Match Term No List in each bodyRegion
3658   - $scope.getLocationsForMatchedTermsInWholeBody(termNumber);
3659   - //for (var i = 0; i < systemMatchedTermList.length; i++) {
  3680 + $timeout(function(){ $scope.HighlightBodyByTermList(systemMatchedTermList)},100);
3660 3681  
3661   - // var termNumber = parseInt(systemMatchedTermList[i]._TermNumber);
3662   -
3663   - // //Match Term No List in each bodyRegion
3664   - // $scope.getLocationsForMatchedTermsInWholeBody(termNumber, 0, 0);
3665   - //}
3666 3682 }
3667 3683  
3668 3684 }]
... ...
400-SOURCECODE/AIAHTML5.Web/term-number-wp.js
... ... @@ -3,11 +3,11 @@ var doneBRID = [];
3 3 var abc = 'hello';
4 4 previousGrayImageDataList = [];
5 5 getLocationForMatchedTermsInWholeBody = function (termList, maskCanvasData, coloredImageData, grayImageData, bodyRegionId, canvasId) {
6   - // console.log('for bodyRegionId: ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))
  6 + console.log('for bodyRegionId: ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))
7 7 var matchedRGBLocationInBodyRegion = [];
8 8 var matched;
9 9  
10   - // debugger;
  10 + console.log(grayImageData)
11 11 var n = maskCanvasData.data.length;
12 12 var maskData = maskCanvasData.data;
13 13 for (var z = 0; z < termList.length; z++) {
... ...