From 30a53778e5dbdd4cef0d3b713e2bf81864350657 Mon Sep 17 00:00:00 2001 From: amrita.vishnoi Date: Fri, 29 Jul 2016 16:09:22 +0530 Subject: [PATCH] Included Body system Code and one fix for extract. --- 400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj | 1 + 400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj | 5 ----- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 201 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------- 400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js | 108 ------------------------------------------------------------------------------------------------------------ 400-SOURCECODE/AIAHTML5.Web/term-number-wp.js | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------- 5 files changed, 194 insertions(+), 239 deletions(-) delete mode 100644 400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js diff --git a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj index 160b365..281432f 100644 --- a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj +++ b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj @@ -73,6 +73,7 @@ + diff --git a/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj b/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj index 0607880..4383a52 100644 --- a/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj +++ b/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj @@ -214,9 +214,6 @@ - - - @@ -43216,7 +43213,6 @@ - @@ -43312,7 +43308,6 @@ - diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index f625a15..9772a87 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -8,12 +8,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.BodyViewData; $scope.selectedGenderBodyViewData; $scope.imagePath = ""; - $scope.BodyRegionData; - $scope.BodyRegionCordinatesData; + $rootScope.BodyRegionData; + $rootScope.BodyRegionCordinatesData; $scope.isTransparencyActivated; - $scope.BodyLayerData; + $rootScope.BodyLayerData; $scope.VocabTermData; - //var vocabTermTxt = []; + $scope.VocabTermTxt; $scope.CommonData $scope.TermNumberData; @@ -37,9 +37,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.ColoredCanvasData = []; $rootScope.grayImageDataList = []; $rootScope.grayImageMRDataList = []; - - $rootScope.grayImageDataListCurrent = []; - $rootScope.grayImageMRDataListCurrent = []; + $rootScope.updatedGrayDataList = []; + $rootScope.updatedGrayMRDataList = []; $scope.AnteriorView = "active"; @@ -300,7 +299,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo brViewdata.then( function (result) { // debugger; - $scope.BodyRegionData = result; + $rootScope.BodyRegionData = result; $scope.isBodyRegionDataLoaded = true; // alert('da_dat_brview= ' + result) @@ -318,7 +317,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo function (result) { //debugger; - $scope.BodyLayerData = result; + $rootScope.BodyLayerData = result; $scope.isBodylayerdataLoaded = true; //load json for annotations @@ -472,13 +471,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }, function (error) { // handle errors here - console.log(' $scope.BodyLayerData= ' + error.statusText); + console.log(' $rootScope.BodyLayerData= ' + error.statusText); } ); }, function (error) { // handle errors here - console.log(' $scope.BodyRegionData = ' + error.statusText); + console.log(' $rootScope.BodyRegionData = ' + error.statusText); } ); @@ -567,7 +566,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } //set height of canvas div and left tool bar as per window size - $scope.BodyRegionCordinatesData = []; // create an empty array + $rootScope.BodyRegionCordinatesData = []; // create an empty array $('#daBodyview').css('width', '100%'); $('#canvasDiv').css('height', $('#daImagePanel').outerHeight() - 104) @@ -577,12 +576,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //calculate image coordinates and draw image - var bodyRegionCoordinates = $scope.BodyRegionData.BodyRegionViews; + var bodyRegionCoordinates = $rootScope.BodyRegionData.BodyRegionViews; // var viewOrientationId = String($scope.voId); $scope.bodyRegionCoordinates = new jinqJs() - .from($scope.BodyRegionData.BodyRegionViews.BodyRegionCordinates) + .from($rootScope.BodyRegionData.BodyRegionViews.BodyRegionCordinates) .where('_ViewOrientationId == ' + viewOrientationId) .select(); @@ -627,7 +626,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //2.Draw mirror image $scope.DrawMirroredImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N'); // debugger; - $scope.BodyRegionCordinatesData.push( + $rootScope.BodyRegionCordinatesData.push( { "bodyRegionId": value._BodyRegionId, "Height": Math.round(rectangle.scaledHeight), "Width": Math.round(rectangle.scaledWidth), "X": Math.round(rectangle.scaledX), "Y": Math.round(rectangle.scaledY), "IsMirror": 'Yes' @@ -797,7 +796,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } // $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition) $('#canvasDiv').scrollTop(50) - var abc = $scope.BodyRegionCordinatesData; + var abc = $rootScope.BodyRegionCordinatesData; //debugger; $('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.layerNumber)); // $('#spinner').css('visibility', 'hidden'); @@ -860,7 +859,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.GetImageSource = function (bodyRegionId) { // debugger; - var dataLength = $scope.BodyLayerData.Layers.DataLayer.length; + var dataLength = $rootScope.BodyLayerData.Layers.DataLayer.length; //set max for LayerNumber input $scope.totalLayers = dataLength - 1; @@ -875,7 +874,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var SelectedLayerData = []; - SelectedLayerData = $scope.BodyLayerData.Layers.DataLayer[dataLength - $scope.userInput - 1]; + SelectedLayerData = $rootScope.BodyLayerData.Layers.DataLayer[dataLength - $scope.userInput - 1]; if ($scope.layerNumber == 0) { for (var z = 0; z <= SelectedLayerData.BodyRegion.length; z++) { @@ -1217,7 +1216,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo imgCanvas.id = 'imageCanvas' + bodyRegionId; - + if (bodyRegionId == 3) { //set z index of hip canavs to fix the issue caused by overlapping of arm canavs on hip canavs. @@ -1244,8 +1243,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } } - - + + } imgCanvas.addEventListener('click', function (evt) { @@ -1631,6 +1630,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.HighlightBodyByTermList = function (TermList) { + $scope.highlightedBR = null; + $scope.highlightedBR = []; //terminate previous running workers to create space for new workers var workerCount = $scope.runningWorkers.length; @@ -1653,7 +1654,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $timeout(function () { for (var x = 0; x < 9; x++) { // console.log('$rootScope.MaskCanvasData.length= ' + n) - // debugger + // debugger var bodyRegionId = $rootScope.MaskCanvasData[x].bodyRegionId; var canvasId = $rootScope.MaskCanvasData[x].canvasId; @@ -1667,8 +1668,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo coloredImageDataVar = $rootScope.coloredImageMRCanvasList[bodyRegionId]; if ($rootScope.multiAnnotationIsON == true) { + if ($rootScope.updatedGrayDataList[bodyRegionId - 1] == null || $rootScope.updatedGrayDataList[bodyRegionId - 1].length == 0) { - grayImageDataVar = $rootScope.grayImageMRDataListCurrent[bodyRegionId] + grayImageDataVar = $rootScope.grayImageMRDataList[bodyRegionId]; + } + else + grayImageDataVar = $rootScope.updatedGrayMRDataList[bodyRegionId] } else grayImageDataVar = $rootScope.grayImageMRDataList[bodyRegionId]; @@ -1685,13 +1690,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // 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 ($rootScope.grayImageDataListCurrent[bodyRegionId - 1] == null || $rootScope.grayImageDataListCurrent[bodyRegionId - 1].length > 0) { + if ($rootScope.updatedGrayDataList[bodyRegionId - 1] == null || $rootScope.updatedGrayDataList[bodyRegionId - 1].length == 0) { grayImageDataVar = $rootScope.grayImageDataList[bodyRegionId - 1]; } else { // for normal case means without interdepency button case. - grayImageDataVar = $rootScope.grayImageDataListCurrent[bodyRegionId - 1] + grayImageDataVar = $rootScope.updatedGrayDataList[bodyRegionId - 1] } } else @@ -1741,24 +1746,38 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //debugger; if (canvasId.match('_MR')) { - $rootScope.grayImageMRDataListCurrent[bodyRegionId] = updatedData; + $rootScope.updatedGrayMRDataList[bodyRegionId] = updatedData; //alert('HighlightBodyByTermList, is mutiAnnotation on= ' + $rootScope.multiAnnotationIsON); //$rootScope.updatedWhiteImageMRDataList[bodyRegionId] = updatedData; } else - $rootScope.grayImageDataListCurrent[bodyRegionId - 1] = updatedData; - //alert('HighlightBodyByTermList, is mutiAnnotation on= ' + $rootScope.multiAnnotationIsON); + $rootScope.updatedGrayDataList[bodyRegionId - 1] = updatedData; + + $scope.highlightedBR.push({ 'bodyRegionId': bodyRegionId }); + + console.log('$scope.highlightedBR.length= ' + $scope.highlightedBR.length) + + if ($scope.highlightedBR.length == 9) { + //debugger; + if ($scope.isHighlightBodysystem == true || $rootScope.isListManagerSelected == true) + + $rootScope.isLoading = false; + + $('#spinner').css('visibility', 'hidden'); - //$rootScope.updatedWhiteImageDataList[bodyRegionId - 1] = updatedData; + $scope.isHighlightBodysystem = false; + if ($rootScope.isListManagerSelected == true) + $scope.aligneCanvasWithTerm(); + } }; worker.onerror = function (e) { alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message); }; } - }, 50) + }, 100) } @@ -1921,7 +1940,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var transparencyBoxBottom = parseInt(TransparencyBoxStartY) + parseInt(tCanvasHeight); var transparencyBoxRight = parseInt(TransparencyBoxStartX) + parseInt(tCanvasWidth); - var BodyRegionDictionary = $scope.BodyRegionCordinatesData; + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; $.each(BodyRegionDictionary, function (index, value) { //debugger; @@ -1947,7 +1966,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo else { // Dated:13-07-2016 Issue #4965 : The layer number should not extend beyond its level through layer text box. - var dataLength = $scope.BodyLayerData.Layers.DataLayer.length; + var dataLength = $rootScope.BodyLayerData.Layers.DataLayer.length; if (parseInt($('#txtlayerNumber').val()) > (dataLength - 1)) { $('#txtlayerNumber').val(dataLength - 1); $scope.currentLayerNumber = parseInt(dataLength - 1); @@ -2050,7 +2069,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var pointClicked = parseInt(x) + parseInt(y); var Exists = $("#canvasDiv").find("div[id=" + pointClicked + "]").length; // alert(pointClicked); - var sppechBubbleHTML = "
"; + var sppechBubbleHTML = "
"; $("#canvasDiv").append(sppechBubbleHTML); @@ -2955,7 +2974,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } - var BodyRegionDictionary = $scope.BodyRegionCordinatesData; + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; $scope.IncludedBodyRegions = []; ////debugger; @@ -3203,7 +3222,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo else if (isLayerChanged) { // debugger //Dated:22-07-2016 Issue#5764:The layer number should not extend beyond its level through layer text box while using transparency box. - var dataLength = $scope.BodyLayerData.Layers.DataLayer.length; + var dataLength = $rootScope.BodyLayerData.Layers.DataLayer.length; if (parseInt($('#txtlayerNumber').val()) > (dataLength - 1)) { $('#txtlayerNumber').val(dataLength - 1); $scope.layerNumber = parseInt(dataLength - 1); @@ -3544,7 +3563,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo document.getElementById('canvasDiv').appendChild(tempCanvas); - var BodyRegionDictionary = $scope.BodyRegionCordinatesData; + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; $scope.IncludedBodyRegions = []; // $scope.layerNo = parseInt(document.getElementById('')) @@ -3602,7 +3621,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var y; var isMirror; var width; - var BodyRegionDictionary = $scope.BodyRegionCordinatesData; + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; $.each(BodyRegionDictionary, function (index, value) { var bodyRegionRight = parseInt(value.X) + parseInt(value.Width); @@ -3903,7 +3922,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo ctx.putImageData(originalTransparencyData, 0, 0); - var BodyRegionDictionary = $scope.BodyRegionCordinatesData; + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; $scope.IncludedBodyRegions = []; var counter = 0; @@ -4117,8 +4136,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }); } - $scope.enableHighlight = function () - { + $scope.enableHighlight = function () { if ($rootScope.isHighLight == true) { @@ -4137,7 +4155,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //2. $scope.CalculateImageCordinates($scope.viewOrientationId); - + } //3. @@ -4171,8 +4189,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //6. $scope.CalculateImageCordinates($scope.viewOrientationId); - - + + } @@ -4214,18 +4232,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } } - $scope.enableShowHideStructureBox = function () - { + $scope.enableShowHideStructureBox = function () { $(".com").remove(); $('#dot').remove(); $('#sppeachBubble').remove(); } - $scope.highLightBody = function () { + $scope.highLightBody = function () + { if ($rootScope.isHighLight == true) { + $scope.grayeddBR = []; + angular.forEach($scope.ColoredImageSRC, function (value, key) { var id; if (value.haveMirror == 'true') { @@ -4319,22 +4339,39 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50); - }) + + + //if list manager is active and user selected any term then highlight that + $scope.grayeddBR.push({ 'BRID': value.bodyRegionId }) + + if ($scope.grayeddBR.length == 9) { + if ($scope.isHighlightByListManager == true) { + $timeout(function () { + + // $rootScope.isHighLight = false; + //align + // $scope.aligneCanvasWithTerm(); + + $scope.HighlightBodyByTermList($scope.AllTerms) + }, 800); + + } + } + if ($rootScope.isExtract == true) { if ($rootScope.previousHighlightList.length > 0) { - //angular.forEach($rootScope.previousHighlightList, function (value, key) - //{ - // $timeout(function () { $scope.HighlightBodyOnExtract(value) }, 50); - - // // to do - //}); + $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) + { + console.log('normal,extract,highlight and this time the length: ' + $scope.grayeddBR.length); if ($rootScope.previousHighlightList.length > 0) { var multiTermList = []; @@ -4345,16 +4382,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo multiTermList.push(TermList[i]); } - // to do }); - $timeout(function () { $scope.HighlightBodyByTermList(multiTermList) }, 50); + + $timeout(function () { $scope.HighlightBodyByTermList(multiTermList) }, 80); + } + + } } + }) } else { - //alert('came iside normal mode for extract'); + // This code will execute when user will select normal Mode but this time isHighlight will be false angular.forEach($scope.ColoredImageSRC, function (value, key) { var id; @@ -4462,9 +4503,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } - - - $scope.applyGrayMatrix = function (img, context_gray) { var RED = 0.3086; // luminance contrast value for red var GREEN = 0.694; // luminance contrast value for green @@ -4573,6 +4611,25 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo + //clsoe worker process + $scope.$on('jsPanelCloseEvent', function (event, data) { + + console.log('terminate worker process') + //terminate previous running workers to create space for new workers + if ($scope.runningWorkers != null) { + 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.loadSelectedBodyView = function (currentBodyViewId) { //remove transaprency scale @@ -4591,7 +4648,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo function (result) { //debugger; - $scope.BodyLayerData = result; + $rootScope.BodyLayerData = result; $scope.isBodylayerdataLoaded = true; //load json for annotations @@ -4618,7 +4675,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo function (error) { // handle errors here - console.log(' $scope.BodyLayerData= ' + error.statusText); + console.log(' $rootScope.BodyLayerData= ' + error.statusText); } ); } @@ -4864,19 +4921,27 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $scope.HighlightBodysystem = function (event) { + var systemMatchedTermList = new jinqJs() - .from($rootScope.BodySystemData.BodySystem.BodySystemTerm) - .where('_SystemNumber == ' + event.currentTarget.id) - .select(); + .from($rootScope.BodySystemData.BodySystem.BodySystemTerm) + .where('_SystemNumber == ' + event.currentTarget.id) + .select(); - //color the body gray - $rootScope.isHighLight = true - $scope.highLightBody(); + if ($rootScope.isHighLight == false) { + //color the body gray + $rootScope.isHighLight = true + $scope.highLightBody(); + } //now highlight the selected body system in whole body + //$rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + + $scope.isHighlightBodysystem = true; + $timeout(function () { $scope.HighlightBodyByTermList(systemMatchedTermList) }, 100); - $(".custom-tooltip").css("diisplay", "none"); + } $scope.ShowSearch = function () { diff --git a/400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js b/400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js deleted file mode 100644 index 9213b6b..0000000 --- a/400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js +++ /dev/null @@ -1,108 +0,0 @@ -previousGrayImageDataList = []; - -function updateGrayCanvasDataOnMatcghedLocation(termList, maskCanvasData, coloreImageData, - grayImageData, grayImageMRDataList, bodyRegionId) { - console.log('updateGrayCanvasDataOnMatcghedLocation= ' + bodyRegionId) - - debugger; - var n = maskCanvasData.data.length; - var maskData = maskCanvasData.data; - for (var z = 0; z < termList.length; z++) { - - if (previousGrayImageDataList[parseInt(bodyRegionId - 1)] != null) { - grayImageData = previousGrayImageDataList[parseInt(bodyRegionId - 1)]; - - } - - var grayImageDataVar = grayImageData.data; - var coloredImageDataVar = coloreImageData.data; - - - for (var i = 0; i < n; i += 4) { - - - var RED = maskData[i] - 9; - var GREEN = maskData[i + 1] - 9; - var BLUE = maskData[i + 2] - 9; - - var Red; - var Green; - var Blue; - var zero = "0"; - - if ((RED).toString().length != 2) { - Red = zero.concat((RED).toString()) - } - else { - Red = (RED).toString() - } - if ((GREEN).toString().length != 2) { - Green = zero.concat((GREEN).toString()) - } - else { - Green = (GREEN).toString() - - } - if ((BLUE).toString().length != 2) { - Blue = zero.concat((BLUE).toString()) - } - else { - Blue = (BLUE).toString() - - } - - var Icolor = (Red + Green + Blue); - // alert('Icolor: ' + Icolor) - - if (parseInt(termList[z]._TermNumber) == parseInt(Icolor)) { - - - - - // matchedRGBLocationInBodyRegion.push({ "BRId": bodyRegionId, "location": i }); - - - // matched = true; - - var RED_coloredImage = coloredImageDataVar[i]; - - grayImageDataVar[i] = RED_coloredImage; - - - var GREEN_coloredImage = coloredImageDataVar[i + 1]; - grayImageDataVar[i + 1] = GREEN_coloredImage; - - var BLUE_coloredImage = coloredImageDataVar[i + 2]; - grayImageDataVar[i + 2] = BLUE_coloredImage; - - - var ALPHA_coloredImage = coloredImageDataVar[i + 3]; - grayImageDataVar[i + 3] = ALPHA_coloredImage; - - } - - - } - - previousGrayImageDataList[parseInt(bodyRegionId - 1)] = grayImageData; - - // if (matched == true) { - - // } - - } - self.postMessage({ - 'bodyRegionId': bodyRegionId, - 'value': grayImageData, - 'canvasId': canvasId - - - }); -} - -self.onmessage = function (e) { - console.log('shd') - updateGrayCanvasDataOnMatcghedLocation(e.data.termList, e.data.maskCanvasData, e.data.coloreImageData, - e.data.grayImageData, e.data.grayImageMRDataList, e.data.bodyRegionId, e.data.canvasId); - -} diff --git a/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js b/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js index f6f9c18..b555d37 100644 --- a/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js +++ b/400-SOURCECODE/AIAHTML5.Web/term-number-wp.js @@ -4,10 +4,11 @@ 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(grayImageData); var matchedRGBLocationInBodyRegion = []; var matched; - console.log(grayImageData) + // console.log(grayImageData) var n = maskCanvasData.data.length; var maskData = maskCanvasData.data; for (var z = 0; z < termList.length; z++) { @@ -17,94 +18,95 @@ getLocationForMatchedTermsInWholeBody = function (termList, maskCanvasData, colo } - if (grayImageData != null) { - var grayImageDataVar = grayImageData.data; - var coloredImageDataVar = coloredImageData.data; + + var grayImageDataVar = grayImageData.data; + var coloredImageDataVar = coloredImageData.data; - for (var i = 0; i < n; i += 4) { + for (var i = 0; i < n; i += 4) { - var RED = maskData[i] - 9; - var GREEN = maskData[i + 1] - 9; - var BLUE = maskData[i + 2] - 9; + var RED = maskData[i] - 9; + var GREEN = maskData[i + 1] - 9; + var BLUE = maskData[i + 2] - 9; - var Red; - var Green; - var Blue; - var zero = "0"; + var Red; + var Green; + var Blue; + var zero = "0"; - if ((RED).toString().length != 2) { - Red = zero.concat((RED).toString()) - } - else { - Red = (RED).toString() - } - if ((GREEN).toString().length != 2) { - Green = zero.concat((GREEN).toString()) - } - else { - Green = (GREEN).toString() - - } - if ((BLUE).toString().length != 2) { - Blue = zero.concat((BLUE).toString()) - } - else { - Blue = (BLUE).toString() - - } + if ((RED).toString().length != 2) { + Red = zero.concat((RED).toString()) + } + else { + Red = (RED).toString() + } + if ((GREEN).toString().length != 2) { + Green = zero.concat((GREEN).toString()) + } + else { + Green = (GREEN).toString() - var Icolor = (Red + Green + Blue); - // alert('Icolor: ' + Icolor) + } + if ((BLUE).toString().length != 2) { + Blue = zero.concat((BLUE).toString()) + } + else { + Blue = (BLUE).toString() - if (parseInt(termList[z]._TermNumber) == parseInt(Icolor)) { + } - // debugger; + var Icolor = (Red + Green + Blue); + // alert('Icolor: ' + Icolor) + if (parseInt(termList[z]._TermNumber) == parseInt(Icolor)) { - // matchedRGBLocationInBodyRegion.push({ "BRId": bodyRegionId, "location": i }); + // debugger; + // console.log('matched term= ' + termList[z]._TermNumber) - // matched = true; + // matchedRGBLocationInBodyRegion.push({ "BRId": bodyRegionId, "location": i }); - var RED_coloredImage = coloredImageDataVar[i]; - grayImageDataVar[i] = RED_coloredImage; + // matched = true; + var RED_coloredImage = coloredImageDataVar[i]; - var GREEN_coloredImage = coloredImageDataVar[i + 1]; - grayImageDataVar[i + 1] = GREEN_coloredImage; + grayImageDataVar[i] = RED_coloredImage; - var BLUE_coloredImage = coloredImageDataVar[i + 2]; - grayImageDataVar[i + 2] = BLUE_coloredImage; + var GREEN_coloredImage = coloredImageDataVar[i + 1]; + grayImageDataVar[i + 1] = GREEN_coloredImage; - var ALPHA_coloredImage = coloredImageDataVar[i + 3]; - grayImageDataVar[i + 3] = ALPHA_coloredImage; + var BLUE_coloredImage = coloredImageDataVar[i + 2]; + grayImageDataVar[i + 2] = BLUE_coloredImage; - } + var ALPHA_coloredImage = coloredImageDataVar[i + 3]; + grayImageDataVar[i + 3] = ALPHA_coloredImage; } - // debugger; - previousGrayImageDataList[parseInt(bodyRegionId - 1)] = grayImageData; - - // if (matched == true) { - // } } - self.postMessage({ - 'bodyRegionId': bodyRegionId, - 'value': grayImageData, - 'canvasId': canvasId + // debugger; + previousGrayImageDataList[parseInt(bodyRegionId - 1)] = grayImageData; + + // if (matched == true) { + + // } - }); } + self.postMessage({ + 'bodyRegionId': bodyRegionId, + 'value': grayImageData, + 'canvasId': canvasId + + }); + } self.onmessage = function (e) { getLocationForMatchedTermsInWholeBody(e.data.termList, e.data.maskCanvasData, e.data.coloredImageData, e.data.grayImageData, e.data.bodyRegionId, e.data.canvasId); -} +} \ No newline at end of file -- libgit2 0.21.4