From 0dcfe662590e4160ce8e1503709ecd11cc452772 Mon Sep 17 00:00:00 2001 From: amrita.vishnoi Date: Mon, 22 Aug 2016 15:24:15 +0530 Subject: [PATCH] Modification in 9 body region count check based on body view --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 191 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------- 1 file changed, 111 insertions(+), 80 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index f4b54c3..143639a 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -1842,120 +1842,136 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $timeout(function () { - for (var x = 0; x < 9; x++) { - if ($rootScope.MaskCanvasData[x] != null || $rootScope.MaskCanvasData[x] != undefined) { - var bodyRegionId = $rootScope.MaskCanvasData[x].bodyRegionId; - var canvasId = $rootScope.MaskCanvasData[x].canvasId; - var maskData = null; - maskData = $rootScope.MaskCanvasData[x].maskData; - - var coloredImageDataVar = null; - var grayImageDataVar = null; + var loopLength = 0; + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) { + loopLength = 9; + } + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) { + loopLength = 5; + } + else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) { + loopLength = 4; + } + else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) { + loopLength = 1; + } + + if (loopLength !== 0) { + for (var x = 0; x < loopLength; x++) { + if ($rootScope.MaskCanvasData[x] != null || $rootScope.MaskCanvasData[x] != undefined) { + var bodyRegionId = $rootScope.MaskCanvasData[x].bodyRegionId; + var canvasId = $rootScope.MaskCanvasData[x].canvasId; + var maskData = null; + maskData = $rootScope.MaskCanvasData[x].maskData; + + var coloredImageDataVar = null; + var grayImageDataVar = null; + + var white = null; + if (canvasId.match('_MR')) { + if ($rootScope.coloredImageMRCanvasList[bodyRegionId] != null || $rootScope.coloredImageMRCanvasList[bodyRegionId] != undefined) { - var white = null; - if (canvasId.match('_MR')) { - if ($rootScope.coloredImageMRCanvasList[bodyRegionId] != null || $rootScope.coloredImageMRCanvasList[bodyRegionId] != undefined) { + coloredImageDataVar = $rootScope.coloredImageMRCanvasList[bodyRegionId]; - coloredImageDataVar = $rootScope.coloredImageMRCanvasList[bodyRegionId]; + } - } + if ($rootScope.whiteImageMRDataList[bodyRegionId] != null || $rootScope.whiteImageMRDataList[bodyRegionId] != undefined) { + white = $rootScope.whiteImageMRDataList[bodyRegionId]; + } - if ($rootScope.whiteImageMRDataList[bodyRegionId] != null || $rootScope.whiteImageMRDataList[bodyRegionId] != undefined) { - white = $rootScope.whiteImageMRDataList[bodyRegionId]; } - } - - else { + else { - if ($rootScope.coloredImageCanvasList[bodyRegionId - 1] != null || $rootScope.coloredImageCanvasList[bodyRegionId - 1] != undefined) { - coloredImageDataVar = $rootScope.coloredImageCanvasList[bodyRegionId - 1]; - } - if ($rootScope.whiteImageDataList[bodyRegionId - 1] != null || $rootScope.whiteImageDataList[bodyRegionId - 1] != undefined) { - white = $rootScope.whiteImageDataList[bodyRegionId - 1]; + if ($rootScope.coloredImageCanvasList[bodyRegionId - 1] != null || $rootScope.coloredImageCanvasList[bodyRegionId - 1] != undefined) { + coloredImageDataVar = $rootScope.coloredImageCanvasList[bodyRegionId - 1]; + } + if ($rootScope.whiteImageDataList[bodyRegionId - 1] != null || $rootScope.whiteImageDataList[bodyRegionId - 1] != undefined) { + white = $rootScope.whiteImageDataList[bodyRegionId - 1]; + } } - } - var worker = new Worker('extract-wp.js'); + var worker = new Worker('extract-wp.js'); - //push workers in array to further used the refernece to delete the workers - $scope.runningWorkers.push({ 'workerName': worker }) + //push workers in array to further used the refernece to delete the workers + $scope.runningWorkers.push({ 'workerName': worker }) - // 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")) - if (coloredImageDataVar != null && maskData != null && white != null) { - worker.postMessage({ + if (coloredImageDataVar != null && maskData != null && white != null) { + worker.postMessage({ - 'termList': multiTermList, - 'maskCanvasData': maskData, - 'coloredImageData': coloredImageDataVar, - 'grayImageData': white, - 'bodyRegionId': bodyRegionId, - 'canvasId': canvasId + 'termList': multiTermList, + 'maskCanvasData': maskData, + 'coloredImageData': coloredImageDataVar, + 'grayImageData': white, + 'bodyRegionId': bodyRegionId, + 'canvasId': canvasId - }); - } - - //} + }); + } - worker.onmessage = function (e) { - console.log('callback in extract for e.data.bodyRegionId: ' + e.data.bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); + //} + worker.onmessage = function (e) { + 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; - var bodyRegionId = e.data.bodyRegionId; + var updatedData = e.data.value; + var bodyRegionId = e.data.bodyRegionId; - var canvasId = (e.data.canvasId).replace('_mci', ''); - //debugger; - //for (var i = 1; i <= updatedData.length; i++) { - var grayCanvasID = canvasId; - // var grayCanvasID = 'imageCanvas' + bodyRegionId; - var grayCanvas = document.getElementById(grayCanvasID); - var grayCanvasContext = grayCanvas.getContext("2d"); + var canvasId = (e.data.canvasId).replace('_mci', ''); + //debugger; + //for (var i = 1; i <= updatedData.length; i++) { + var grayCanvasID = canvasId; + // var grayCanvasID = 'imageCanvas' + bodyRegionId; + var grayCanvas = document.getElementById(grayCanvasID); + var grayCanvasContext = grayCanvas.getContext("2d"); - grayCanvasContext.putImageData(updatedData, 0, 0); - // } - if ($rootScope.multiAnnotationIsON == true) { - //debugger; - if (canvasId.match('_MR')) - $rootScope.updatedWhiteImageMRDataList[bodyRegionId] = updatedData; - else - $rootScope.updatedWhiteImageDataList[bodyRegionId - 1] = updatedData; + grayCanvasContext.putImageData(updatedData, 0, 0); + // } + if ($rootScope.multiAnnotationIsON == true) { + //debugger; + if (canvasId.match('_MR')) + $rootScope.updatedWhiteImageMRDataList[bodyRegionId] = updatedData; + else + $rootScope.updatedWhiteImageDataList[bodyRegionId - 1] = updatedData; - } - else { - if (canvasId.match('_MR')) - $rootScope.whiteImageMRDataList[bodyRegionId] = e.data.value; + } else { - if ($rootScope.whiteImageDataList[bodyRegionId - 1] != null || $rootScope.whiteImageDataList[bodyRegionId - 1] != undefined) - $rootScope.whiteImageDataList[bodyRegionId - 1] = e.data.value; + + if (canvasId.match('_MR')) + $rootScope.whiteImageMRDataList[bodyRegionId] = e.data.value; + else { + if ($rootScope.whiteImageDataList[bodyRegionId - 1] != null || $rootScope.whiteImageDataList[bodyRegionId - 1] != undefined) + $rootScope.whiteImageDataList[bodyRegionId - 1] = e.data.value; + } } - } - //if ((CallBackBodyRegion != null || CallBackBodyRegion[i] != undefined) && (CallBackBodyRegion.length > 0)) { - // if (CallBackBodyRegion.length == 6) { - // $rootScope.isLoading = false; - // $('#spinner').css('visibility', 'hidden'); - // } - //} + //if ((CallBackBodyRegion != null || CallBackBodyRegion[i] != undefined) && (CallBackBodyRegion.length > 0)) { + // if (CallBackBodyRegion.length == 6) { + // $rootScope.isLoading = false; + // $('#spinner').css('visibility', 'hidden'); + // } + //} - $timeout(function () { $scope.DisableProgressBar() }, 1000); + $timeout(function () { $scope.DisableProgressBar() }, 1000); - }; - worker.onerror = function (e) { - alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message); - }; + }; + worker.onerror = function (e) { + alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message); + }; + } } } }, 50) @@ -1974,8 +1990,23 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo - $timeout(function () { - for (var x = 0; x < 9; x++) { + $timeout(function () + { + var loopLength = 0; + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) { + loopLength = 9; + } + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) { + loopLength = 5; + } + else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) { + loopLength = 4; + } + else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) { + loopLength = 1; + } + + for (var x = 0; x < loopLength; x++) { if ($rootScope.MaskCanvasData[x] != null || $rootScope.MaskCanvasData[x] != undefined) { var bodyRegionId = $rootScope.MaskCanvasData[x].bodyRegionId; -- libgit2 0.21.4