From 8c5fc71ba632e0c754300c93b6706b4a10493790 Mon Sep 17 00:00:00 2001 From: amrita.vishnoi Date: Fri, 22 Jul 2016 18:21:55 +0530 Subject: [PATCH] Single Extract is working in both mirror and non mirror. --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 55 ++++++++++++++++++++++++++++++------------------------- 400-SOURCECODE/AIAHTML5.Web/extract-wp.js | 15 ++++++--------- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 0b86bd0..5f3eef5 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -63,6 +63,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.whiteImageDataList = []; $rootScope.whiteImageMRDataList = []; $rootScope.previousHighlightList = []; + $rootScope.updatedWhiteImageDataList = []; + $rootScope.updatedWhiteImageMRDataList = []; //normal mode $rootScope.isNormalMode = false; @@ -1052,6 +1054,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $rootScope.previousHighlightList.push(RGBColor); + $scope.highLightBodyBasedOnIcolor(RGBColor); } @@ -1143,9 +1146,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (document.getElementById('canvasDiv') != null) document.getElementById('canvasDiv').appendChild(FlipedImgCanvas); - - - } $scope.DrawImage = function (h, w, x, y, src, bodyRegionId, isMaskImage) { @@ -1296,22 +1296,22 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var grayImageDataMR = $rootScope.grayImageMRDataList[bodyRegionId]; - grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0) + grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0); + + } } } } - - $rootScope.previousHighlightList.push(RGBColor); - - - //var previousIcolor = RGBColor; - // $scope.previousSelectedTermList.push(previousIcolor); + $rootScope.previousHighlightList.push(RGBColor); + if (maskCanvasId.match('modestyImg') && RGBColor != '000000') { } else + { $scope.highLightBodyBasedOnIcolor(RGBColor); + } } @@ -1448,7 +1448,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ($scope.multiAnnotationIsON == true) { - white = $rootScope.updatedImageMRDataList[bodyRegionId] + white = $rootScope.updatedWhiteImageMRDataList[bodyRegionId] } else white = $rootScope.whiteImageMRDataList[bodyRegionId]; @@ -1460,7 +1460,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ($scope.multiAnnotationIsON == true) { - grayImageDataVar = $rootScope.updatedImageDataList[bodyRegionId - 1] + white = $rootScope.updatedWhiteImageDataList[bodyRegionId - 1] } else { @@ -1488,7 +1488,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //} worker.onmessage = function (e) { - console.log('callback for e.data.bodyRegionId: ' + e.data.bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); + console.log('callback in extract for e.data.bodyRegionId: ' + e.data.bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); var updatedData = e.data.value; @@ -1512,9 +1512,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // worker.terminate(); if (canvasId.match('_MR')) - $rootScope.grayImageMRDataListCurrent[bodyRegionId] = updatedData; + $rootScope.whiteImageMRDataList[bodyRegionId] = e.data.value; else - $rootScope.grayImageDataListCurrent[bodyRegionId - 1] = updatedData; + $rootScope.whiteImageDataList[bodyRegionId - 1] = e.data.value; }; worker.onerror = function (e) { @@ -1606,11 +1606,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo worker.onmessage = function (e) { console.log('callback for e.data.bodyRegionId: ' + e.data.bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); - - debugger; - - var highlightedPortion; - + var updatedData = e.data.value; var bodyRegionId = e.data.bodyRegionId; @@ -1632,11 +1628,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (canvasId.match('_MR')) { $rootScope.grayImageMRDataListCurrent[bodyRegionId] = updatedData; - $rootScope.whiteImageMRDataList[bodyRegionId] = updatedData; + // $rootScope.updatedWhiteImageMRDataList[bodyRegionId] = updatedData; } else $rootScope.grayImageDataListCurrent[bodyRegionId - 1] = updatedData; - $rootScope.whiteImageDataList[bodyRegionId - 1] = updatedData; + // $rootScope.updatedWhiteImageMRDataList[bodyRegionId - 1] = updatedData; }; worker.onerror = function (e) { @@ -3657,10 +3653,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } - $scope.enableExtract = function () { - // alert('extract called'); + $scope.enableExtract = function () + { + - //debugger; + 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--; + } + } if ($rootScope.isExtract == true) { diff --git a/400-SOURCECODE/AIAHTML5.Web/extract-wp.js b/400-SOURCECODE/AIAHTML5.Web/extract-wp.js index b79a499..e10aed5 100644 --- a/400-SOURCECODE/AIAHTML5.Web/extract-wp.js +++ b/400-SOURCECODE/AIAHTML5.Web/extract-wp.js @@ -1,12 +1,13 @@ -var doneBRID = []; +var UpdatedGrayImageDataList = []; +var doneBRID = []; var abc = 'hello'; -var previousGrayImageDataList = []; +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++) { @@ -15,11 +16,7 @@ getLocationForMatchedTermsInWholeBody = function (termList, maskCanvasData, colo grayImageData = previousGrayImageDataList[parseInt(bodyRegionId - 1)]; } - - var grayImageDataVar; - if (grayImageData != null) { - grayImageDataVar = grayImageData.data; - } + var grayImageDataVar = grayImageData.data; var coloredImageDataVar = coloredImageData.data; for (var i = 0; i < n; i += 4) { -- libgit2 0.21.4