diff --git a/150-DOCUMENTATION/TestCasesForHighlight.xlsx b/150-DOCUMENTATION/TestCasesForHighlight.xlsx new file mode 100644 index 0000000..5712222 --- /dev/null +++ b/150-DOCUMENTATION/TestCasesForHighlight.xlsx diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 581c861..07b6643 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -39,7 +39,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.multiAnnotationIsON = true; $scope.previousGrayImageDataVar; $scope.previousGrayCanvas; - + $scope.previousIcolor =0; + $scope.previousX =0; + $scope.previousY=0; $scope.machedBodyRegion = []; //array for bodyviewid correspoing to male female(used for gender change) @@ -1074,7 +1076,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var actulalX = mousePos.x + horizontlScrollPosition; var actualY = mousePos.y + verticalScrollPosition; - //debugger; + + var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y); if ($rootScope.isHighLight) @@ -1095,52 +1098,62 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo grayCanvasContext.putImageData(grayImageData, 0, 0) - } + } } + } - var ActualTermNo = $scope.getActualTermNumber(RGBColor); - //alert('actual term no: ' + ActualTermNo); + - //3. Find Term No List Based on ActualTermNo - var TermList = $scope.getTermNumberList(ActualTermNo); - // alert('termList.count: ' + TermList.length); + $scope.previousIcolor= RGBColor; + $scope.previousX = x; + $scope.previousY = y; - //4. + $scope.highLightBodyBasedOnIcolor(RGBColor, x, y); - $scope.machedTermNoLocation = []; - for (var i = 0; i < TermList.length; i++) { + //var ActualTermNo = $scope.getActualTermNumber(RGBColor); + ////3. Find Term No List Based on ActualTermNo + //var TermList = $scope.getTermNumberList(ActualTermNo); + //// alert('termList.count: ' + TermList.length); - var termNumber = parseInt(TermList[i]._TermNumber); + ////4. - //Match Term No List in each bodyRegion - $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y); - } + //$scope.machedTermNoLocation = []; + //for (var i = 0; i < TermList.length; i++) { + + // var termNumber = parseInt(TermList[i]._TermNumber); + + // //Match Term No List in each bodyRegion + // $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y); + //} } else { + $scope.previousIcolor = RGBColor; + $scope.previousX = x; + $scope.previousY = y; + $scope.highLightBodyBasedOnIcolor(RGBColor,x,y); - //2. Find Actul Term No Based on Icolor. - var ActualTermNo = $scope.getActualTermNumber(RGBColor); - //alert('actual term no: ' + ActualTermNo); - - //3. Find Term No List Based on ActualTermNo - var TermList = $scope.getTermNumberList(ActualTermNo); - // alert('termList.count: ' + TermList.length); + ////2. Find Actul Term No Based on Icolor. + //var ActualTermNo = $scope.getActualTermNumber(RGBColor); + + ////3. Find Term No List Based on ActualTermNo + //var TermList = $scope.getTermNumberList(ActualTermNo); + - //4. + ////4. - $scope.machedTermNoLocation = []; - for (var i = 0; i < TermList.length; i++) { + //$scope.machedTermNoLocation = []; + //for (var i = 0; i < TermList.length; i++) { - var termNumber = parseInt(TermList[i]._TermNumber); + // var termNumber = parseInt(TermList[i]._TermNumber); - //Match Term No List in each bodyRegion - $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y); - } + // //Match Term No List in each bodyRegion + // $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y); + //} } - } + @@ -1218,6 +1231,28 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } + $scope.highLightBodyBasedOnIcolor = function (RGBColor,x,y) + { + + //2. Find Actul Term No Based on Icolor. + var ActualTermNo = $scope.getActualTermNumber(RGBColor); + + //3. Find Term No List Based on ActualTermNo + var TermList = $scope.getTermNumberList(ActualTermNo); + + + //4. + + $scope.machedTermNoLocation = []; + for (var i = 0; i < TermList.length; i++) { + + var termNumber = parseInt(TermList[i]._TermNumber); + + //Match Term No List in each bodyRegion + $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y); + } + } + $scope.getLocationsForMatchedTermsInWholeBody = function (termNo, x, y) { @@ -1484,13 +1519,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.imageVerticalScrollPosition = canvasDiv.scrollTop; $scope.imageHorizontlScrollPosition = canvasDiv.scrollLeft; - // debugger; - // $('#daLoaderLabel').css('visibility', 'visible'); - - - + if ($scope.isTransparencyActivated) { - //crete temp canavs to store the original data which will be used to chnange the transparency + if (document.getElementById('tempCanvas') != null) { $('#tempCanvas').remove(); } @@ -1579,6 +1610,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $timeout(function () { $scope.highLightBody() }, 350); + if ($scope.previousIcolor != 0 && $scope.previousX != 0 && $scope.previousY != 0) { + + $timeout(function () { $scope.highLightBodyBasedOnIcolor($scope.previousIcolor, $scope.previousX, $scope.previousY) }, 350); + } + } } @@ -3063,93 +3099,94 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.highLightBody = function () { - angular.forEach($scope.ColoredImageSRC, function (value, key) { + + if ($rootScope.isHighLight == true) { + angular.forEach($scope.ColoredImageSRC, function (value, key) { + var id; + if (value.haveMirror == 'true') { + id = 'imageCanvas' + value.bodyRegionId + '_MR'; + } + else { + id = 'imageCanvas' + value.bodyRegionId; + } - var id; - if (value.haveMirror == 'true') { - id = 'imageCanvas' + value.bodyRegionId + '_MR'; - } - else { - id = 'imageCanvas' + value.bodyRegionId; - } + var imageCanvas = document.getElementById(id); - var imageCanvas = document.getElementById(id); + //var coloredCanvasID = 'imageCanvas' + bodyRegionId; + //var coloredCanvas = document.getElementById(coloredCanvasID); - //var coloredCanvasID = 'imageCanvas' + bodyRegionId; - //var coloredCanvas = document.getElementById(coloredCanvasID); + var width = value.Width; + var ht = value.Height; - var width = value.Width; - var ht = value.Height; + var coloredCanvasContext = imageCanvas.getContext("2d"); + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); + var coloredImageDataVar = coloredImageData.data; - var coloredCanvasContext = imageCanvas.getContext("2d"); - var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); - var coloredImageDataVar = coloredImageData.data; - - - if (value.haveMirror == 'true') { - $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; - } - else - { - //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1; - $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; - } + if (value.haveMirror == 'true') { + $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; + } + else { + //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1; + $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; + } - //$rootScope.coloredImageCanvasList.push(parts); - - - var context_gray = imageCanvas.getContext('2d'); + //$rootScope.coloredImageCanvasList.push(parts); - var dataURL = imageCanvas.toDataURL(); + var context_gray = imageCanvas.getContext('2d'); - var img = new Image(); - img.src = dataURL; + var dataURL = imageCanvas.toDataURL(); - var DAData = new BitmapData(img.width, img.height); - DAData.draw(img); - var RED = 0.3086; // luminance contrast value for red - var GREEN = 0.694; // luminance contrast value for green - var BLUE = 0.0820; // luminance contrast value for blue - var RGB = [RED, GREEN, BLUE, 0, 0]; - var RGB2 = [RED, GREEN, BLUE, 0, 0]; - var RGB3 = [RED, GREEN, BLUE, 0, 0]; - var ALPHA = [0, 0, 0, 1, 0]; + var img = new Image(); - var rgbPx = RGB.concat(RGB2); - var rgbPx2 = rgbPx.concat(RGB3); - var matrix = rgbPx2.concat(ALPHA); + img.src = dataURL; - var zeroPoint = new Point(); - var grayScale = new ColorMatrixFilter(matrix); - DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale); + var DAData = new BitmapData(img.width, img.height); + DAData.draw(img); + var RED = 0.3086; // luminance contrast value for red + var GREEN = 0.694; // luminance contrast value for green + var BLUE = 0.0820; // luminance contrast value for blue - context_gray.putImageData(DAData.data, 0, 0) + var RGB = [RED, GREEN, BLUE, 0, 0]; + var RGB2 = [RED, GREEN, BLUE, 0, 0]; + var RGB3 = [RED, GREEN, BLUE, 0, 0]; + var ALPHA = [0, 0, 0, 1, 0]; - var grayImageData = context_gray.getImageData(0, 0, width, ht); - var grayImageImageDataVar = grayImageData.data; + var rgbPx = RGB.concat(RGB2); + var rgbPx2 = rgbPx.concat(RGB3); + var matrix = rgbPx2.concat(ALPHA); - if (value.haveMirror == 'true') { - $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; - } - else { - //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1; + var zeroPoint = new Point(); + var grayScale = new ColorMatrixFilter(matrix); + DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale); - $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; - } - + context_gray.putImageData(DAData.data, 0, 0) - }); + var grayImageData = context_gray.getImageData(0, 0, width, ht); + var grayImageImageDataVar = grayImageData.data; + + if (value.haveMirror == 'true') { + $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; + } + else { + //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1; + + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; + } - // alert('length: '+ $scope.coloredImageCanvasList.length); + }); + + // alert('length: '+ $scope.coloredImageCanvasList.length); + + } } $scope.applyGrayMatrix = function (img, context_gray)