diff --git a/150-DOCUMENTATION/AIA-July-Report.pptx b/150-DOCUMENTATION/AIA-July-Report.pptx index 07ab44c..c05d403 100644 --- a/150-DOCUMENTATION/AIA-July-Report.pptx +++ b/150-DOCUMENTATION/AIA-July-Report.pptx diff --git a/150-DOCUMENTATION/AIA-June-Report.pptx b/150-DOCUMENTATION/AIA-June-Report.pptx index 07ab44c..412a2f5 100644 --- a/150-DOCUMENTATION/AIA-June-Report.pptx +++ b/150-DOCUMENTATION/AIA-June-Report.pptx diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 0e3f523..d77bad1 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -396,7 +396,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $('#daBodyview').css("width", $(window).outerWidth()); //1. load navigator man first - $scope.LoadBodyViewNavigatorImage(); + // $scope.LoadBodyViewNavigatorImage(); + + $scope.loadSearchDataForBodyView(); //2. @@ -570,7 +572,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //1. console.log('DATA.NOT.LOADED FOR:' + NavigatorManJsonPath + ', ERROR: ' + data); //2. - $scope.LoadBodyViewNavigatorImage() + // $scope.LoadBodyViewNavigatorImage() }); } @@ -660,9 +662,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo .from($rootScope.bgartData.BackgroundArts.BackgroundArtDetail) .where('_ViewOrientationId == ' + viewOrientationId) .select(); - //} - $scope.ColoredImageSRC = []; + if ($scope.ColoredImageSRC != null && $scope.ColoredImageSRC.length > 0) { + $scope.ColoredImageSRC = null; + $scope.ColoredImageSRC = []; + $scope.flushCanvas(); + } + else { + $scope.ColoredImageSRC = []; + } if ($scope.bodyRegionCoordinates != null || $scope.bodyRegionCoordinates != undefined) { angular.forEach($scope.bodyRegionCoordinates, function (value, key) { @@ -678,19 +686,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //1.Get image source var src = $scope.GetImageSource(value._BodyRegionId); + $scope.imageSource = src; // debugger; - $scope.ColoredImageSRC.push( - { - "bodyRegionId": value._BodyRegionId, "SRC": src, - "Height": rectangle.scaledHeight, - "Width": rectangle.scaledWidth, - "x": rectangle.scaledX, - "y": rectangle.scaledY, - "haveMirror": 'true' - } - ); + //$scope.ColoredImageSRC.push( + // { + // "bodyRegionId": value._BodyRegionId, "SRC": src, + // "Height": rectangle.scaledHeight, + // "Width": rectangle.scaledWidth, + // "x": rectangle.scaledX, + // "y": rectangle.scaledY, + // "haveMirror": 'true' + // } + // ); //2.Draw mirror image @@ -715,16 +724,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //0. Scaling as per default zoom var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, 0); - $scope.ColoredImageSRC.push( - { - "bodyRegionId": value._BodyRegionId, "SRC": src, - "Height": rectangle.scaledHeight, - "Width": rectangle.scaledWidth, - "x": rectangle.scaledX, - "y": rectangle.scaledY, - "haveMirror": 'false' - } - ); + //$scope.ColoredImageSRC.push( + // { + // "bodyRegionId": value._BodyRegionId, "SRC": src, + // "Height": rectangle.scaledHeight, + // "Width": rectangle.scaledWidth, + // "x": rectangle.scaledX, + // "y": rectangle.scaledY, + // "haveMirror": 'false' + // } + // ); //1.Draw body region which have mirror image @@ -758,16 +767,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.imageSource = src; } - $scope.ColoredImageSRC.push( - { - "bodyRegionId": value._BodyRegionId, "SRC": src, - "Height": rectangle.scaledHeight, - "Width": rectangle.scaledWidth, - "x": rectangle.scaledX, - "y": rectangle.scaledY, - "haveMirror": 'false' - } - ); + //$scope.ColoredImageSRC.push( + // { + // "bodyRegionId": value._BodyRegionId, "SRC": src, + // "Height": rectangle.scaledHeight, + // "Width": rectangle.scaledWidth, + // "x": rectangle.scaledX, + // "y": rectangle.scaledY, + // "haveMirror": 'false' + // } + // ); //2.Draw body region which don't have mirror image $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N'); @@ -847,21 +856,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } } - if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) && ($scope.ColoredImageSRC.length == 9)) { - $rootScope.isLoading = false; - $('#spinner').css('visibility', 'hidden'); - - if ($rootScope.isListManagerSelected == true) { - $rootScope.isLoading = true; - $('#spinner').css('visibility', 'visible'); - $timeout(function () { - console.log('$scope.ColoredImageSRC.length= ' + $scope.ColoredImageSRC.length) - $rootScope.isHighLight = true; - $scope.highLightBody() - }, 500); - } - } }); } @@ -994,42 +989,44 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.one = 1; $scope.userInput = parseInt($scope.layerNumber); - + $scope.skinTone = DA[0].ethnicity; var SelectedLayerData = []; SelectedLayerData = $rootScope.BodyLayerData.Layers.DataLayer[dataLength - $scope.userInput - 1]; - if ($scope.layerNumber == 0) { - for (var z = 0; z <= SelectedLayerData.BodyRegion.length; z++) { + if ((SelectedLayerData != null || SelectedLayerData != undefined) && SelectedLayerData.BodyRegion.length > 0) { + if ($scope.layerNumber == 0) { + for (var z = 0; z < SelectedLayerData.BodyRegion.length; z++) { - var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId; - var bodyRegionSkinTone = SelectedLayerData.BodyRegion[z].Image._SkintTone; + var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId; + var bodyRegionSkinTone = SelectedLayerData.BodyRegion[z].Image._SkintTone; - if (bodyRegion == bodyRegionId && bodyRegionSkinTone == $scope.skinTone) { + if (bodyRegion == bodyRegionId && bodyRegionSkinTone == $scope.skinTone) { - return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName; + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName; + } } } - } - else { - // debugger; - //below 4 bodyviews have only single body region - if ($rootScope.voId == 9 || $rootScope.voId == 11 || $rootScope.voId == 10 || $rootScope.voId == 12) { - var bodyRegion = SelectedLayerData.BodyRegion._BodyRegionId; + else { + // debugger; + //below 4 bodyviews have only single body region + if ($rootScope.voId == 9 || $rootScope.voId == 11 || $rootScope.voId == 10 || $rootScope.voId == 12) { + var bodyRegion = SelectedLayerData.BodyRegion._BodyRegionId; - return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion.Image._ImageName; + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion.Image._ImageName; - } - else // it is for other body view which have multiple body regions and layer no > 0 - { - // debugger; - for (var z = 0; z <= SelectedLayerData.BodyRegion.length; z++) { - var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId; - if (bodyRegion == bodyRegionId) { + } + else // it is for other body view which have multiple body regions and layer no > 0 + { + // debugger; + for (var z = 0; z <= SelectedLayerData.BodyRegion.length; z++) { + var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId; + if (bodyRegion == bodyRegionId) { - return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName; + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName; + } } } } @@ -1307,6 +1304,40 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo context.restore(); + if (isMaskImage == 'N') { + $scope.ColoredImageSRC.push( + { + "bodyRegionId": bodyRegionId, "SRC": src, + "Height": h, + "Width": w, + "x": x, + "y": y, + "haveMirror": 'true' + } + ); + + console.log('$rootScope.isListManagerSelected= ' + $rootScope.isListManagerSelected + ' length= ' + $scope.ColoredImageSRC.length) + + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) && ($scope.ColoredImageSRC.length == 9)) { + console.log('after check= ' + $scope.ColoredImageSRC.length) + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + + if ($rootScope.isListManagerSelected == true) { + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + $timeout(function () { + console.log('$scope.ColoredImageSRC.length= ' + $scope.ColoredImageSRC.length) + $rootScope.isHighLight = true; + + $scope.highLightBody() + }, 500); + } + } + + console.log('ColoredImageSRC. pushed and length: ' + $scope.ColoredImageSRC.length); + } + if (FlipedImgCanvas.id.match('_mci')) { var maskImgData = context.getImageData(0, 0, w, h); @@ -1325,6 +1356,8 @@ 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) { @@ -1569,9 +1602,44 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo img.src = src; function start() { - // debugger; + //debugger; context.drawImage(img, 0, 0); + if (isMaskImage == 'N') { + if (bodyRegionId != 'modestyImg3') { + $scope.ColoredImageSRC.push( + { + "bodyRegionId": bodyRegionId, "SRC": src, + "Height": h, + "Width": w, + "x": x, + "y": y, + "haveMirror": 'false' + } + + ); + + console.log('$rootScope.isListManagerSelected= ' + $rootScope.isListManagerSelected + ' length= ' + $scope.ColoredImageSRC.length) + + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) && ($scope.ColoredImageSRC.length == 9)) { + console.log('after check= ' + $scope.ColoredImageSRC.length) + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + + if ($rootScope.isListManagerSelected == true) { + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + $timeout(function () { + console.log('$scope.ColoredImageSRC.length= ' + $scope.ColoredImageSRC.length) + $rootScope.isHighLight = true; + + $scope.highLightBody() + }, 500); + } + } + } + + } if (imgCanvas.id.match('_mci')) { var maskImgData = context.getImageData(0, 0, w, h); $rootScope.MaskCanvasData.push( @@ -1647,22 +1715,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //terminate previous running workers to create space for new workers - if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { - 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--; - } - } - } - - - - - + $scope.terminateCurrentlyRunningWPs(); $timeout(function () { @@ -1782,19 +1835,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.highlightedBR = null; $scope.highlightedBR = []; - if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { - - //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--; - } - } - } + $scope.terminateCurrentlyRunningWPs(); @@ -1912,9 +1953,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (grayCanvas != null) { var grayCanvasContext = grayCanvas.getContext("2d"); - + //Niki remove previous data from canvas + var canvasHeight = grayCanvas.height + 'px'; + var canvasWidth = grayCanvas.width + 'px'; + //alert('height= ' + canvasHeight + ', width= ' + canvasWidth) + grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth) grayCanvasContext.putImageData(updatedData, 0, 0); + $scope.highlightedBR.push({ 'bodyRegionId': bodyRegionId }); + } //debugger; @@ -1929,7 +1976,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo else $rootScope.updatedGrayDataList[bodyRegionId - 1] = updatedData; - $scope.highlightedBR.push({ 'bodyRegionId': bodyRegionId }); + //$scope.highlightedBR.push({ 'bodyRegionId': bodyRegionId }); console.log('$scope.highlightedBR.length= ' + $scope.highlightedBR.length) @@ -2059,21 +2106,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //layer change function $scope.LayerChange = function () { - // alert('layer chnage') - if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { - - 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--; - } - } - } + $scope.terminateCurrentlyRunningWPs(); var canvasDiv = document.getElementById('canvasDiv'); $scope.imageVerticalScrollPosition = canvasDiv.scrollTop; @@ -4242,16 +4277,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $scope.enableZoom = function () { - if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { - //0. terminate current worker process - var workerCount = $scope.runningWorkers.length; - for (var i = workerCount - 1; i >= 0; i--) { - var runningWorker = $scope.runningWorkers[i].workerName; - runningWorker.terminate(); - $scope.runningWorkers.splice(i, 1); - // workerCount--; - } - } + + $scope.terminateCurrentlyRunningWPs(); if ($scope.isTransparencyActivated) { @@ -4296,36 +4323,98 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } } + $scope.flushCanvas = function () { - angular.forEach($scope.ColoredImageSRC, function (value, key) { + //if ($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) { + // angular.forEach($scope.ColoredImageSRC, function (value, key) { + + // var id; + // var maskId; + // if (value.haveMirror == 'true') { + // id = 'imageCanvas' + value.bodyRegionId + '_MR'; + // maskId = 'imageCanvas' + value.bodyRegionId + '_MR_mci' + // } + // else { + // id = 'imageCanvas' + value.bodyRegionId; + // maskId = 'imageCanvas' + value.bodyRegionId + '_mci'; + // } + + // var canvas = document.getElementById(id); + // if (canvas != null || canvas != undefined) { + // document.getElementById('canvasDiv').removeChild(canvas); + // } + + // var maskcanvas = document.getElementById(maskId); + // if (maskcanvas != null || maskcanvas != undefined) { + // document.getElementById('canvasDiv').removeChild(maskcanvas); + + // } + + // var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); + // for (var i = 0; i < modestyCanvases.length; i++) { + // modestyCanvases[i].remove(); + // } + // }); + //} + + for (var i = 1; i < 7; i++) { var id; var maskId; - if (value.haveMirror == 'true') { - id = 'imageCanvas' + value.bodyRegionId + '_MR'; - maskId = 'imageCanvas' + value.bodyRegionId + '_MR_mci' - } - else { - id = 'imageCanvas' + value.bodyRegionId; - maskId = 'imageCanvas' + value.bodyRegionId + '_mci'; - } + + id = 'imageCanvas' + i; + maskId = 'imageCanvas' + i + '_mci'; var canvas = document.getElementById(id); - document.getElementById('canvasDiv').removeChild(canvas); + if (canvas != null || canvas!=undefined) + document.getElementById('canvasDiv').removeChild(canvas); var maskcanvas = document.getElementById(maskId); - document.getElementById('canvasDiv').removeChild(maskcanvas); + if (maskcanvas != null || maskcanvas != undefined) + document.getElementById('canvasDiv').removeChild(maskcanvas); + + if (i == 4 || i == 5 || i == 6) { + id = 'imageCanvas' + i + '_MR'; + maskId = 'imageCanvas' + i + '_MR_mci'; + + var canvas = document.getElementById(id); + if (canvas != null || canvas != undefined) + document.getElementById('canvasDiv').removeChild(canvas); + + var maskcanvas = document.getElementById(maskId); + if (maskcanvas != null || maskcanvas != undefined) + document.getElementById('canvasDiv').removeChild(maskcanvas); + } + //remove modesty canavs var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); - for (var i = 0; i < modestyCanvases.length; i++) { - modestyCanvases[i].remove(); + if (modestyCanvases != null || modestyCanvases != undefined && modestyCanvases.length > 0) { + for (var j = 0; j < modestyCanvases.length; j++) { + modestyCanvases[j].remove(); + } } - }); + } + } + + $scope.terminateCurrentlyRunningWPs = function () { + if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { + 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--; + } + } + } } + $scope.enableHighlight = function () { + console.log('enableHighlight is called') if ($rootScope.isHighLight == true) { } @@ -4337,16 +4426,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ($rootScope.isExtract == true) { //1. $rootScope.isExtract = false; + //2. $scope.flushCanvas(); - //2. + //3. $scope.CalculateImageCordinates($scope.viewOrientationId); } - //3. $timeout(function () { $scope.highLightBody() }, 50); @@ -4386,17 +4475,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.enableExtract = function () { - if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { - 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--; - } - } - } + $scope.terminateCurrentlyRunningWPs(); if ($rootScope.isExtract == true) { @@ -4427,277 +4506,296 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $('#sppeachBubble').remove(); } + + $scope.highLightBody = function () { - console.log('highLightBody is called'); + console.log('highLightBody is called and ColoredImageSRC length: ' + $scope.ColoredImageSRC.length); - if ($rootScope.isHighLight == true) { - $scope.grayeddBR = []; - angular.forEach($scope.ColoredImageSRC, function (value, key) { - var id; - if (value.haveMirror == 'true') { - id = 'imageCanvas' + value.bodyRegionId + '_MR'; - } - else { - id = 'imageCanvas' + value.bodyRegionId; - } + $timeout(function () { + $scope.terminateCurrentlyRunningWPs(); - var imageCanvas = document.getElementById(id); + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) && $scope.ColoredImageSRC.length == 9) { - //var coloredCanvasID = 'imageCanvas' + bodyRegionId; - //var coloredCanvas = document.getElementById(coloredCanvasID); + if ($rootScope.isHighLight == true) { - var width = value.Width; - var ht = value.Height; + $scope.grayeddBR = []; - var coloredCanvasContext = imageCanvas.getContext("2d"); - var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); - var coloredImageDataVar = coloredImageData; + angular.forEach($scope.ColoredImageSRC, function (value, key) { + var id; + if (value.haveMirror == 'true') { + id = 'imageCanvas' + value.bodyRegionId + '_MR'; + } + else { + id = 'imageCanvas' + value.bodyRegionId; + } + var imageCanvas = document.getElementById(id); - if (value.haveMirror == 'true') { - $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; - } - else { + //var coloredCanvasID = 'imageCanvas' + bodyRegionId; + //var coloredCanvas = document.getElementById(coloredCanvasID); + var width = value.Width; + var ht = value.Height; - $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; + var coloredCanvasContext = imageCanvas.getContext("2d"); + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); + var coloredImageDataVar = coloredImageData; - } + if (value.haveMirror == 'true') { + $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; + } + else { - var context_gray = imageCanvas.getContext('2d'); + $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; - var dataURL = imageCanvas.toDataURL(); + } - var img = new Image(); + var context_gray = imageCanvas.getContext('2d'); - img.src = dataURL; + var dataURL = imageCanvas.toDataURL(); - img.onload = function () { - //console.log(Math.max(img.width) + ', ' + Math.max(img.height)) + var img = new Image(); - var DAData = new BitmapData(Math.max(img.width), Math.max(img.height)); - DAData.draw(img); + img.src = dataURL; - var colorMode; - if ($scope.isExtract == true) { - colorMode = $scope.applyWhiteMatrix(img, context_gray); - } - else { - colorMode = $scope.applyGrayMatrix(img, context_gray); - } - var zeroPoint = new Point(); + img.onload = function () { + console.log('Before BitmapData call, width: ' + Math.max(img.width) + ', height: ' + Math.max(img.height)) - DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode); + var DAData = new BitmapData(Math.max(img.width), Math.max(img.height)); + DAData.draw(img); - context_gray.putImageData(DAData.data, 0, 0) + var colorMode; - var grayImageData = context_gray.getImageData(0, 0, width, ht); - var grayImageImageDataVar = grayImageData.data; + if ($scope.isExtract == true) { + colorMode = $scope.applyWhiteMatrix(img, context_gray); + } + else { + colorMode = $scope.applyGrayMatrix(img, context_gray); + } - if ($scope.isExtract == true) { - if (value.haveMirror == 'true') { - $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; - } - else { + var zeroPoint = new Point(); - $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; - } - } - else { + DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode); - if (value.haveMirror == 'true') { - $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; - } - else { + context_gray.putImageData(DAData.data, 0, 0) - $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; - } - } - } + //push BRID into array + $scope.grayeddBR.push({ 'BRID': value.bodyRegionId }); - $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50); + if ($scope.grayeddBR.length == 9) { + if (($scope.isHighlightBodysystem == true) && ($scope.systemMatchedTermList != null || $scope.systemMatchedTermList != undefined)) { - //if list manager is active and user selected any term then highlight that - $scope.grayeddBR.push({ 'BRID': value.bodyRegionId }) + $timeout(function () { $scope.HighlightBodyByTermList($scope.systemMatchedTermList) }, 100); + } + else if ($scope.isHighlightByListManager == true) { - if ($scope.grayeddBR.length == 9) { + console.log('$scope.grayeddBR.length is ' + $scope.grayeddBR.length); + $timeout(function () { - if (($scope.isHighlightBodysystem == true) && ($scope.systemMatchedTermList != null || $scope.systemMatchedTermList != undefined)) { + // $rootScope.isHighLight = false; + //align + // $scope.aligneCanvasWithTerm(); - $timeout(function () { $scope.HighlightBodyByTermList($scope.systemMatchedTermList) }, 100); - } - else if ($scope.isHighlightByListManager == true) { + $scope.HighlightBodyByTermList($scope.AllTerms) + }, 800); - console.log('$scope.grayeddBR.length is ' + $scope.grayeddBR.length); - $timeout(function () { + } + } - // $rootScope.isHighLight = false; - //align - // $scope.aligneCanvasWithTerm(); - $scope.HighlightBodyByTermList($scope.AllTerms) - }, 800); + var grayImageData = context_gray.getImageData(0, 0, width, ht); + var grayImageImageDataVar = grayImageData.data; - } - } + if ($scope.isExtract == true) { + if (value.haveMirror == 'true') { + $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; + } + else { + $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; + } + } + else { - if ($rootScope.isExtract == true) { - if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { + if (value.haveMirror == 'true') { + $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; + } + else { - $timeout(function () { $scope.HighlightBodyOnExtract() }, 50); - } - } - else { - // this code is for the case where user first clcik on normal mode then extract then again highlight then we need to call highlight body in gray mode - //and then highlight the previously selected body regions at the time of normal mode. + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; + } + } + } - if ($scope.grayeddBR.length == 9) { + $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50); - if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { - var multiTermList = []; - angular.forEach($rootScope.previousHighlightList, function (value, key) { + console.log('the value of isHighlightByListManager ' + $scope.isHighlightByListManager); - //debugger; + console.log('$scope.grayeddBR.length: ' + $scope.grayeddBR.length) - var ActualTermNo = $scope.getActualTermNumber(value); - if (ActualTermNo != null) { - var TermList = $scope.getTermNumberList(ActualTermNo); - if (TermList != null) { - for (var i = 0; i < TermList.length; i++) { - multiTermList.push(TermList[i]); - } - } - } - }); + if ($rootScope.isExtract == true) { + if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { - $timeout(function () { $scope.HighlightBodyByTermList(multiTermList) }, 80); + $timeout(function () { $scope.HighlightBodyOnExtract() }, 50); + } } + else { + // this code is for the case where user first clcik on normal mode then extract then again highlight then we need to call highlight body in gray mode + //and then highlight the previously selected body regions at the time of normal mode. + if ($scope.grayeddBR.length == 9) { - } - } - }) + if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { - } - else { - // This code will execute when user will select normal Mode but this time isHighlight will be false + var multiTermList = []; + angular.forEach($rootScope.previousHighlightList, function (value, key) { - angular.forEach($scope.ColoredImageSRC, function (value, key) { - var id; - if (value.haveMirror == 'true') { - id = 'imageCanvas' + value.bodyRegionId + '_MR'; - } - else { - id = 'imageCanvas' + value.bodyRegionId; - } + //debugger; + + var ActualTermNo = $scope.getActualTermNumber(value); + if (ActualTermNo != null) { + var TermList = $scope.getTermNumberList(ActualTermNo); + if (TermList != null) { + for (var i = 0; i < TermList.length; i++) { + + multiTermList.push(TermList[i]); + } + } + } - var imageCanvas = document.getElementById(id); + }); - //var coloredCanvasID = 'imageCanvas' + bodyRegionId; - //var coloredCanvas = document.getElementById(coloredCanvasID); - var width = value.Width; - var ht = value.Height; + $timeout(function () { $scope.HighlightBodyByTermList(multiTermList) }, 80); + } - var coloredCanvasContext = imageCanvas.getContext("2d"); - var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); - var coloredImageDataVar = coloredImageData; + } + } + }) - if (value.haveMirror == 'true') { - $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; } + else { + // This code will execute when user will select normal Mode but this time isHighlight will be false - $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; + angular.forEach($scope.ColoredImageSRC, function (value, key) { + var id; + if (value.haveMirror == 'true') { + id = 'imageCanvas' + value.bodyRegionId + '_MR'; + } + else { + id = 'imageCanvas' + value.bodyRegionId; + } - } + var imageCanvas = document.getElementById(id); + //var coloredCanvasID = 'imageCanvas' + bodyRegionId; + //var coloredCanvas = document.getElementById(coloredCanvasID); - var context_white = imageCanvas.getContext('2d'); + var width = value.Width; + var ht = value.Height; + var coloredCanvasContext = imageCanvas.getContext("2d"); + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); + var coloredImageDataVar = coloredImageData; - var dataURL = imageCanvas.toDataURL(); + if (value.haveMirror == 'true') { + $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; + } + else { - var img = new Image(); + $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; - img.src = dataURL; + } + var context = imageCanvas.getContext('2d'); - img.onload = function () { - //console.log(Math.max(img.width) + ', ' + Math.max(img.height)) - var DAData = new BitmapData(Math.max(img.width), Math.max(img.height)); - DAData.draw(img); + var dataURL = imageCanvas.toDataURL(); - var colorMode; - if ($scope.isExtract == true) { - colorMode = $scope.applyWhiteMatrix(img, context_white); - } + var img = new Image(); - var zeroPoint = new Point(); + img.src = dataURL; - DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode); - context_white.putImageData(DAData.data, 0, 0) - var grayImageData = context_white.getImageData(0, 0, width, ht); - var grayImageImageDataVar = grayImageData.data; + img.onload = function () { + //console.log(Math.max(img.width) + ', ' + Math.max(img.height)) - if ($scope.isExtract == true) { - if (value.haveMirror == 'true') { - $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; - } - else { + var DAData = new BitmapData(Math.max(img.width), Math.max(img.height)); + DAData.draw(img); - $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; - } - } - else { + var colorMode; - if (value.haveMirror == 'true') { - $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; - } - else { + if ($scope.isExtract == true) { + colorMode = $scope.applyWhiteMatrix(img, context); + } + + var zeroPoint = new Point(); + + DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode); + + context.putImageData(DAData.data, 0, 0) + + var grayImageData = context.getImageData(0, 0, width, ht); + var grayImageImageDataVar = grayImageData.data; + + if ($scope.isExtract == true) { + if (value.haveMirror == 'true') { + $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; + } + else { + + $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; + } + } + else { + + if (value.haveMirror == 'true') { + $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; + } + else { - $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; + } + } } - } - } - $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50); - }) + $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50); + }) - if ($rootScope.isExtract == true) { - if ($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined || $rootScope.previousHighlightList.length > 0) { - angular.forEach($rootScope.previousHighlightList, function (value, key) { - $timeout(function () { $scope.HighlightBodyOnExtract(value) }, 50); + if ($rootScope.isExtract == true) { + if ($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined || $rootScope.previousHighlightList.length > 0) { + angular.forEach($rootScope.previousHighlightList, function (value, key) { + $timeout(function () { $scope.HighlightBodyOnExtract(value) }, 50); + + // to do + }); + } + } - // to do - }); } } - - } + }, 1000) } @@ -4790,7 +4888,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.loadSelectedBodyView(currentBodyViewId); //3. - $scope.loadSelectedBodyViewNavigator(currentBodyViewId); + // $scope.loadSelectedBodyViewNavigator(currentBodyViewId); $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("currentViewTitle").replace('Female', 'Male'); @@ -4806,7 +4904,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.loadSelectedBodyView(currentBodyViewId); //2. - $scope.loadSelectedBodyViewNavigator(currentBodyViewId); + // $scope.loadSelectedBodyViewNavigator(currentBodyViewId); //3. $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = localStorage.getItem("currentViewTitle").replace('Male', 'Female'); @@ -4838,17 +4936,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo console.log('terminate worker process') //terminate previous running workers to create space for new workers - if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { - 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--; - } - } - } + $scope.terminateCurrentlyRunningWPs(); $rootScope.isLoading = false; $('#spinner').css('visibility', 'hidden'); @@ -4927,7 +5015,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.loadSelectedBodyView($rootScope.voId); //2. load corresponding navigator man - $scope.loadSelectedBodyViewNavigator($rootScope.voId); + // $scope.loadSelectedBodyViewNavigator($rootScope.voId); }; @@ -4953,7 +5041,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.loadSelectedBodyView($rootScope.voId); //2. - $scope.loadSelectedBodyViewNavigator($rootScope.voId); + // $scope.loadSelectedBodyViewNavigator($rootScope.voId); }; @@ -5422,7 +5510,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.HighlightBodyOnListManagerSelection = function (event) { - + $scope.terminateCurrentlyRunningWPs(); //debugger $rootScope.isListManagerSelected = true; $rootScope.isLoading = true; @@ -5514,43 +5602,44 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.layerNumber)); //8.remove current layer canavses - for (var i = 1; i < 7; i++) { + $scope.flushCanvas(); + //for (var i = 1; i < 7; i++) { - var id; - var maskId; + // var id; + // var maskId; - id = 'imageCanvas' + i; - maskId = 'imageCanvas' + i + '_mci'; + // id = 'imageCanvas' + i; + // maskId = 'imageCanvas' + i + '_mci'; - var canvas = document.getElementById(id); - document.getElementById('canvasDiv').removeChild(canvas); + // var canvas = document.getElementById(id); + // document.getElementById('canvasDiv').removeChild(canvas); - var maskcanvas = document.getElementById(maskId); - document.getElementById('canvasDiv').removeChild(maskcanvas); + // var maskcanvas = document.getElementById(maskId); + // document.getElementById('canvasDiv').removeChild(maskcanvas); - if (i == 4 || i == 5 || i == 6) { - id = 'imageCanvas' + i + '_MR'; - maskId = 'imageCanvas' + i + '_MR_mci'; + // if (i == 4 || i == 5 || i == 6) { + // id = 'imageCanvas' + i + '_MR'; + // maskId = 'imageCanvas' + i + '_MR_mci'; - var canvas = document.getElementById(id); - document.getElementById('canvasDiv').removeChild(canvas); + // var canvas = document.getElementById(id); + // document.getElementById('canvasDiv').removeChild(canvas); - var maskcanvas = document.getElementById(maskId); - document.getElementById('canvasDiv').removeChild(maskcanvas); - } + // var maskcanvas = document.getElementById(maskId); + // document.getElementById('canvasDiv').removeChild(maskcanvas); + // } - //remove modesty canavs - var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); - for (var j = 0; j < modestyCanvases.length; j++) { - modestyCanvases[j].remove(); - } - } + // //remove modesty canavs + // var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); + // for (var j = 0; j < modestyCanvases.length; j++) { + // modestyCanvases[j].remove(); + // } + //} //9. $timeout(function () { $rootScope.isHighLight = false; $scope.CalculateImageCordinates($scope.viewOrientationId) - }, 10); + }, 1000); $scope.isHighlightByListManager = true; diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html b/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html index d0b9f8a..3cd0100 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html @@ -123,22 +123,22 @@
@@ -167,7 +167,7 @@

- +

@@ -179,8 +179,8 @@
- - + +