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