From f324e0dc6ce14b7a19c7efa52cb7d2d4305cd94c Mon Sep 17 00:00:00 2001 From: amrita.vishnoi Date: Tue, 21 Jun 2016 16:20:52 +0530 Subject: [PATCH] Highlight in mirror body Region is under progress... --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------ 1 file changed, 104 insertions(+), 42 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 3b36dd3..8e866ef 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -28,6 +28,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.isHighLight = false; $rootScope.coloredImageCanvasList = []; + $rootScope.coloredImageMRCanvasList = []; $scope.zoomInOut = 75; @@ -362,8 +363,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo - - $scope.LoadDefaultLayerImage = function () { // debugger; @@ -887,6 +886,27 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } var RGBColor = (Red + Green + Blue); + if ($rootScope.isHighLight) { + //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); + + //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); + } + } + var annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); @@ -1151,27 +1171,38 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var maskCanvasContext = maskCanvas.getContext("2d"); var maskImgData = maskCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight); - //// 2. get coloured canvas for this body region. + // 2. get coloured canvas for this body region. - var coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)]; + var coloredImageDataVar; + var coloredImageDataMRVar + if ($scope.ColoredImageSRC[x].haveMirror == 'true') { - //var coloredCanvasContext = coloredCanvas.getContext("2d"); - //var coloredImageData = coloredCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight); - //var coloredImageDataVar = coloredImageData.data; - - //var coloredCanvasID = 'imageCanvas' + bodyRegionId; - //var coloredCanvas = document.getElementById(coloredCanvasID); - //var coloredCanvasContext = coloredCanvas.getContext("2d"); - //var coloredImageData = coloredCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight); - //var coloredImageDataVar = coloredImageData.data; + coloredImageDataVar = $rootScope.coloredImageMRCanvasList[parseInt(bodyRegionId)]; + } + else + { + coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)]; + } + var grayImageDataVar; + if ($scope.ColoredImageSRC[x].haveMirror == 'true') { + + //// 3. get mask canvas for this body region._MR + var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR'; + var grayCanvas = document.getElementById(grayCanvasID); + var grayCanvasContext = grayCanvas.getContext("2d"); + var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight); + grayImageDataVar = grayImageData.data; + } - //// 3. get mask canvas for this body region._MR - var grayCanvasID = 'imageCanvas' + bodyRegionId; - var grayCanvas = document.getElementById(grayCanvasID); - var grayCanvasContext = grayCanvas.getContext("2d"); - var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight); - var grayImageDataVar = grayImageData.data; + else + { + var grayCanvasID = 'imageCanvas' + bodyRegionId; + var grayCanvas = document.getElementById(grayCanvasID); + var grayCanvasContext = grayCanvas.getContext("2d"); + var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight); + grayImageDataVar = grayImageData.data; + } //var grayImageDataVarMR; @@ -1179,19 +1210,38 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var coloredImageDataVarMR; var coloredImageDataMR - if (bodyRegionId == 6 || bodyRegionId == 5 || bodyRegionId == 4) { - //var grayCanvasMRID = 'GrayImageCanvas' + bodyRegionId + '_MR'; - //var grayCanvasMR = document.getElementById(grayCanvasMRID); - //var grayCanvasContextMR = grayCanvasMR.getContext("2d"); - //grayImageDataMR = grayCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight); - //grayImageDataVarMR = grayImageDataMR.data; - - var coloredCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR'; - var coloredCanvasMR = document.getElementById(coloredCanvasMRID); - var coloredCanvasContextMR = coloredCanvasMR.getContext("2d"); - coloredImageDataMR = coloredCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight); - coloredImageDataVarMR = coloredImageDataMR.data; - } + //if ($scope.ColoredImageSRC[x].haveMirror) { + + + // var coloredCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR'; + // var coloredCanvasMR = document.getElementById(coloredCanvasMRID); + // var coloredCanvasContextMR = coloredCanvasMR.getContext("2d"); + // coloredImageDataMR = coloredCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight); + // coloredImageDataVarMR = coloredImageDataMR.data; + //} + + //else + //{ + // var coloredCanvas = 'imageCanvas' + bodyRegionId; + // var coloredCanvas = document.getElementById(coloredCanvas); + // var coloredCanvasContext = coloredCanvas.getContext("2d"); + // coloredImageData = coloredCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight); + // coloredImageDataVar = coloredImageData.data; + //} + + //if (bodyRegionId == 6 || bodyRegionId == 5 || bodyRegionId == 4) { + // //var grayCanvasMRID = 'GrayImageCanvas' + bodyRegionId + '_MR'; + // //var grayCanvasMR = document.getElementById(grayCanvasMRID); + // //var grayCanvasContextMR = grayCanvasMR.getContext("2d"); + // //grayImageDataMR = grayCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight); + // //grayImageDataVarMR = grayImageDataMR.data; + + // var coloredCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR'; + // var coloredCanvasMR = document.getElementById(coloredCanvasMRID); + // var coloredCanvasContextMR = coloredCanvasMR.getContext("2d"); + // coloredImageDataMR = coloredCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight); + // coloredImageDataVarMR = coloredImageDataMR.data; + //} var counter = 0; @@ -1268,19 +1318,23 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //if (!isHighLighted) { //alert('icolor matched with term no ' +termNo); - var RED_coloredImage = coloredImageDataVar[i]; - grayImageDataVar[i] = RED_coloredImage; + + if (coloredImageDataVar!= null) { + var RED_coloredImage = coloredImageDataVar[i]; + + grayImageDataVar[i] = RED_coloredImage; - var GREEN_coloredImage = coloredImageDataVar[i + 1]; - grayImageDataVar[i + 1] = GREEN_coloredImage; + var GREEN_coloredImage = coloredImageDataVar[i + 1]; + grayImageDataVar[i + 1] = GREEN_coloredImage; - var BLUE_coloredImage = coloredImageDataVar[i + 2]; - grayImageDataVar[i + 2] = BLUE_coloredImage; + var BLUE_coloredImage = coloredImageDataVar[i + 2]; + grayImageDataVar[i + 2] = BLUE_coloredImage; - var ALPHA_coloredImage = coloredImageDataVar[i + 3]; - grayImageDataVar[i + 3] = ALPHA_coloredImage; + var ALPHA_coloredImage = coloredImageDataVar[i + 3]; + grayImageDataVar[i + 3] = ALPHA_coloredImage; + } //} } @@ -1306,7 +1360,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // var grayCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR'; // var grayCanvasMR = document.getElementById(grayCanvasMRID); - // document.getElementById('canvasDiv').removeChild(grayCanvasMR); + // // document.getElementById('canvasDiv').removeChild(grayCanvasMR); // var tempCanvasMR = document.createElement('canvas'); // tempCanvasMR.id = 'imageCanvas' + bodyRegionId + '_MR'; @@ -2960,8 +3014,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo 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; + } - $rootScope.coloredImageCanvasList[parseInt (value.bodyRegionId -1)] = coloredImageDataVar; //$rootScope.coloredImageCanvasList.push(parts); -- libgit2 0.21.4