diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 7a7d2a4..2fed84e 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -37,10 +37,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.grayImageDataList = []; $rootScope.grayImageMRDataList = []; + $rootScope.grayImageDataListCurrent = []; + $rootScope.grayImageMRDataListCurrent = []; + $scope.zoomInOut = 75; $scope.i = 0; $scope.speachBubbleArray = []; - $scope.multiAnnotationIsON = true; + $scope.multiAnnotationIsON = false; $scope.previousGrayImageDataVar; $scope.previousGrayCanvas; @@ -1375,18 +1378,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $scope.highLightBodyBasedOnIcolor = function (RGBColor) { - // console.log(' $scope.highLightBodyBasedOnIcolor') + // console.log(' $scope.highLightBodyBasedOnIcolor') + - //terminate previous running workers to create space for new workers - var workerCount = $scope.runningWorkers.length; - if(workerCount>0){ - for (var i = workerCount-1; i >= 0; i--) { - var runningWorker = $scope.runningWorkers[i].workerName; - runningWorker.terminate(); - $scope.runningWorkers.splice(i, 1); - // workerCount--; - } - } //2. Find Actul Term No Based on Icolor. @@ -1398,16 +1392,33 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //4. - $scope.machedTermNoLocation = []; - + $scope.HighlightBodyByTermList(TermList); + + + } + + $scope.HighlightBodyByTermList = function (TermList) { + + + //terminate previous running workers to create space for new workers + var workerCount = $scope.runningWorkers.length; + if (workerCount > 0) { + for (var i = workerCount - 1; i >= 0; i--) { + var runningWorker = $scope.runningWorkers[i].workerName; + runningWorker.terminate(); + $scope.runningWorkers.splice(i, 1); + // workerCount--; + } + } + var n = $scope.MaskCanvasData.length; - console.log('$scope.MaskCanvasData.length= ' + n) + console.log('$rootScope.MaskCanvasData.length= ' + n) // console.log('Start time taken for term: ' + TermList[i]._TermNumber + 'in posting: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); - // debugger + // debugger for (var x = 0; x < 9; x++) { - console.log('$scope.MaskCanvasData.length= ' + n) + console.log('$rootScope.MaskCanvasData.length= ' + n) var bodyRegionId = $scope.MaskCanvasData[x].bodyRegionId; var canvasId = $scope.MaskCanvasData[x].canvasId; @@ -1417,14 +1428,44 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var grayImageDataVar; if (canvasId.match('_MR')) { - coloredImageDataVar = $rootScope.coloredImageMRCanvasList[bodyRegionId]; - grayImageDataVar = $rootScope.grayImageMRDataList[bodyRegionId]; + coloredImageDataVar = $rootScope.coloredImageMRCanvasList[bodyRegionId]; + + + if ($scope.multiAnnotationIsON == true) { + + grayImageDataVar = $rootScope.grayImageMRDataListCurrent[bodyRegionId] + } + else + grayImageDataVar = $rootScope.grayImageMRDataList[bodyRegionId]; + + if ($rootScope.isExtract) { + if ($scope.multiAnnotationIsON == true) { + + grayImageDataVar = $rootScope.grayImageMRDataListCurrent[bodyRegionId] + } + else + grayImageDataVar = $rootScope.whiteImageMRDataList[bodyRegionId]; + } } else { coloredImageDataVar = $rootScope.coloredImageCanvasList[bodyRegionId - 1]; - grayImageDataVar = $rootScope.grayImageDataList[bodyRegionId - 1]; + if ($scope.multiAnnotationIsON == true) { + grayImageDataVar = $rootScope.grayImageDataListCurrent[bodyRegionId - 1] + } + else + grayImageDataVar = $rootScope.grayImageDataList[bodyRegionId - 1]; + + + if ($rootScope.isExtract) { + if ($scope.multiAnnotationIsON == true) { + + grayImageDataVar = $rootScope.grayImageDataListCurrent[bodyRegionId] + } + else + grayImageDataVar = $rootScope.whiteImageDataList[bodyRegionId]; + } } //var coloredImageDataVar = $rootScope.coloredImageCanvasList[bodyRegionId - 1]; @@ -1433,9 +1474,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var worker = new Worker('term-number-wp.js'); //push workers in array to further used the refernece to delete the workers - $scope.runningWorkers.push({'workerName':worker}) + $scope.runningWorkers.push({ 'workerName': worker }) - // console.log('for bodyRegionId = ' + bodyRegionId+ ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")) + // console.log('for bodyRegionId = ' + bodyRegionId+ ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")) worker.postMessage({ 'termList': TermList, @@ -1450,18 +1491,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //} worker.onmessage = function (e) { - // console.log('callback: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); + console.log('callback for e.data.bodyRegionId: ' + e.data.bodyRegionId +', time: '+ new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); + - var updatedData = e.data.value; var bodyRegionId = e.data.bodyRegionId; - var canvasId = (e.data.canvasId).replace('_mci',''); + var canvasId = (e.data.canvasId).replace('_mci', ''); //debugger; //for (var i = 1; i <= updatedData.length; i++) { var grayCanvasID = canvasId; - // var grayCanvasID = 'imageCanvas' + bodyRegionId; + // var grayCanvasID = 'imageCanvas' + bodyRegionId; var grayCanvas = document.getElementById(grayCanvasID); var grayCanvasContext = grayCanvas.getContext("2d"); @@ -1471,22 +1512,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // } - // worker.terminate(); + // worker.terminate(); - - // $rootScope.grayImageDataList[bodyRegionId - 1] = upadteddata; + if (canvasId.match('_MR')) + $rootScope.grayImageMRDataListCurrent[bodyRegionId] = updatedData; + else + $rootScope.grayImageDataListCurrent[bodyRegionId - 1] = updatedData; }; worker.onerror = function (e) { alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message); }; } - } - - - - $scope.GetRGBColor = function (maskCanvasContext, actulalX, actualY, x, y) { var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1); @@ -3645,17 +3683,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.highLightBody(); //now highlight the selected body system in whole body - var termNumber = parseInt(systemMatchedTermList[0]._TermNumber); - - //Match Term No List in each bodyRegion - $scope.getLocationsForMatchedTermsInWholeBody(termNumber); - //for (var i = 0; i < systemMatchedTermList.length; i++) { - // var termNumber = parseInt(systemMatchedTermList[i]._TermNumber); + $timeout(function(){ $scope.HighlightBodyByTermList(systemMatchedTermList)},100); - // //Match Term No List in each bodyRegion - // $scope.getLocationsForMatchedTermsInWholeBody(termNumber, 0, 0); - //} } //$scope.showTermddl = function () { diff --git a/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js b/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js index 7fe38a6..0e1d15c 100644 --- a/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js +++ b/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js @@ -3,11 +3,11 @@ var doneBRID = []; var abc = 'hello'; previousGrayImageDataList = []; getLocationForMatchedTermsInWholeBody = function (termList, maskCanvasData, coloredImageData, grayImageData, bodyRegionId, canvasId) { - // console.log('for bodyRegionId: ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")) + console.log('for bodyRegionId: ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")) var matchedRGBLocationInBodyRegion = []; var matched; - // debugger; + console.log(grayImageData) var n = maskCanvasData.data.length; var maskData = maskCanvasData.data; for (var z = 0; z < termList.length; z++) {