Commit ef5fc291337e531b6357b86a9dae77a354c69cbb
1 parent
6839aad4
fixed issue in highlight mode for gender switch and view switch
Showing
1 changed file
with
287 additions
and
264 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -41,7 +41,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
41 | 41 | $rootScope.updatedGrayDataList = []; |
42 | 42 | $rootScope.updatedGrayMRDataList = []; |
43 | 43 | $scope.isEligibleForHighlight = false; |
44 | - $scope.doHighlight = false; | |
44 | + $scope.doHighlightOrExtract = false; | |
45 | 45 | $scope.isEligibleForHighlightBodyByTermList = false; |
46 | 46 | |
47 | 47 | $scope.AnteriorView = "active"; |
... | ... | @@ -626,6 +626,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
626 | 626 | |
627 | 627 | //calculate coordinates for body region images |
628 | 628 | $scope.CalculateImageCordinates = function (viewOrientationId) { |
629 | + | |
630 | + $scope.terminateCurrentlyRunningWPs(); | |
631 | + | |
629 | 632 | var drawnBodyRegionCount = []; |
630 | 633 | |
631 | 634 | if ($rootScope.MaskCanvasData != null || $rootScope.MaskCanvasData != undefined) { |
... | ... | @@ -1328,9 +1331,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1328 | 1331 | } |
1329 | 1332 | ); |
1330 | 1333 | |
1331 | - console.log('$rootScope.isListManagerSelected= ' + $rootScope.isListManagerSelected + ' length= ' + $scope.ColoredImageSRC.length) | |
1334 | + // console.log('$rootScope.isListManagerSelected= ' + $rootScope.isListManagerSelected + ' length= ' + $scope.ColoredImageSRC.length) | |
1332 | 1335 | |
1333 | - if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)){ | |
1336 | + if (($rootScope.isListManagerSelected == true) || (($rootScope.isGenderChnage == true) && ($rootScope.isHighLight == true)) || (($rootScope.isViewChange == true) && ($rootScope.isHighLight == true))) { | |
1337 | + | |
1338 | + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) { | |
1334 | 1339 | |
1335 | 1340 | if((($rootScope.viewOrientationId=='1') || ($rootScope.viewOrientationId=='4')) && ($scope.ColoredImageSRC.length == 9)) |
1336 | 1341 | { |
... | ... | @@ -1340,14 +1345,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1340 | 1345 | { |
1341 | 1346 | $scope.isEligibleForHighlight = true; |
1342 | 1347 | } |
1343 | - else if((($rootScope.viewOrientationId=='5')) && ($scope.ColoredImageSRC.length == 4)) | |
1348 | + else if(($rootScope.viewOrientationId=='5') && ($scope.ColoredImageSRC.length == 4)) | |
1344 | 1349 | { |
1345 | 1350 | $scope.isEligibleForHighlight = true; |
1346 | 1351 | } |
1347 | - else if((($rootScope.viewOrientationId=='6')) && ($scope.ColoredImageSRC.length == 1)) | |
1352 | + else if(($rootScope.viewOrientationId=='6') && ($scope.ColoredImageSRC.length == 1)) | |
1348 | 1353 | { |
1349 | 1354 | $scope.isEligibleForHighlight = true; |
1350 | 1355 | } |
1356 | + else { | |
1357 | + $scope.isEligibleForHighlight = false; | |
1358 | + } | |
1351 | 1359 | |
1352 | 1360 | if($scope.isEligibleForHighlight == true) |
1353 | 1361 | { |
... | ... | @@ -1355,8 +1363,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1355 | 1363 | $rootScope.isLoading = false; |
1356 | 1364 | $('#spinner').css('visibility', 'hidden'); |
1357 | 1365 | |
1358 | - if (($rootScope.isListManagerSelected == true) || ( $rootScope.isGenderChnage == true && $rootScope.isHighLight==true) || ($rootScope.isViewChange == true&& $rootScope.isHighLight==true)) | |
1359 | - { | |
1366 | + | |
1360 | 1367 | $rootScope.isLoading = true; |
1361 | 1368 | $('#spinner').css('visibility', 'visible'); |
1362 | 1369 | $timeout(function () { |
... | ... | @@ -1369,7 +1376,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1369 | 1376 | } |
1370 | 1377 | } |
1371 | 1378 | |
1372 | - console.log('ColoredImageSRC. pushed and length: ' + $scope.ColoredImageSRC.length); | |
1379 | + // console.log('ColoredImageSRC. pushed and length: ' + $scope.ColoredImageSRC.length); | |
1373 | 1380 | } |
1374 | 1381 | |
1375 | 1382 | if (FlipedImgCanvas.id.match('_mci')) { |
... | ... | @@ -1658,30 +1665,32 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1658 | 1665 | ); |
1659 | 1666 | |
1660 | 1667 | console.log('$rootScope.isListManagerSelected= ' + $rootScope.isListManagerSelected + ' length= ' + $scope.ColoredImageSRC.length) |
1668 | + if (($rootScope.isListManagerSelected == true) || (($rootScope.isGenderChnage == true) && ($rootScope.isHighLight == true)) || (($rootScope.isViewChange == true) && ($rootScope.isHighLight == true))) { | |
1661 | 1669 | |
1670 | + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) { | |
1662 | 1671 | |
1672 | + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) { | |
1673 | + $scope.isEligibleForHighlight = true; | |
1674 | + } | |
1675 | + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) { | |
1676 | + $scope.isEligibleForHighlight = true; | |
1677 | + } | |
1678 | + else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) { | |
1679 | + $scope.isEligibleForHighlight = true; | |
1680 | + } | |
1681 | + else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) { | |
1682 | + $scope.isEligibleForHighlight = true; | |
1683 | + } | |
1684 | + else { | |
1685 | + $scope.isEligibleForHighlight = false; | |
1686 | + } | |
1663 | 1687 | |
1664 | - if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) { | |
1665 | - | |
1666 | - if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) { | |
1667 | - $scope.isEligibleForHighlight = true; | |
1668 | - } | |
1669 | - else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) { | |
1670 | - $scope.isEligibleForHighlight = true; | |
1671 | - } | |
1672 | - else if ((($rootScope.viewOrientationId == '5')) && ($scope.ColoredImageSRC.length == 4)) { | |
1673 | - $scope.isEligibleForHighlight = true; | |
1674 | - } | |
1675 | - else if ((($rootScope.viewOrientationId == '6')) && ($scope.ColoredImageSRC.length == 1)) { | |
1676 | - $scope.isEligibleForHighlight = true; | |
1677 | - } | |
1688 | + if ($scope.isEligibleForHighlight == true) { | |
1678 | 1689 | |
1679 | - if ($scope.isEligibleForHighlight == true) { | |
1690 | + $rootScope.isLoading = false; | |
1691 | + $('#spinner').css('visibility', 'hidden'); | |
1680 | 1692 | |
1681 | - $rootScope.isLoading = false; | |
1682 | - $('#spinner').css('visibility', 'hidden'); | |
1683 | 1693 | |
1684 | - if (($rootScope.isListManagerSelected == true) || ($rootScope.isGenderChnage == true && $rootScope.isHighLight == true) || ($rootScope.isViewChange == true && $rootScope.isHighLight == true)) { | |
1685 | 1694 | $rootScope.isLoading = true; |
1686 | 1695 | $('#spinner').css('visibility', 'visible'); |
1687 | 1696 | $timeout(function () { |
... | ... | @@ -4669,388 +4678,402 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4669 | 4678 | if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) { |
4670 | 4679 | |
4671 | 4680 | if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) { |
4672 | - $scope.doHighlight = true; | |
4681 | + $scope.doHighlightOrExtract = true; | |
4673 | 4682 | } |
4674 | 4683 | else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) { |
4675 | - $scope.doHighlight = true; | |
4684 | + $scope.doHighlightOrExtract = true; | |
4676 | 4685 | } |
4677 | 4686 | else if ((($rootScope.viewOrientationId == '5')) && ($scope.ColoredImageSRC.length == 4)) { |
4678 | - $scope.doHighlight = true; | |
4687 | + $scope.doHighlightOrExtract = true; | |
4679 | 4688 | } |
4680 | 4689 | else if ((($rootScope.viewOrientationId == '6')) && ($scope.ColoredImageSRC.length == 1)) { |
4681 | - $scope.doHighlight = true; | |
4690 | + $scope.doHighlightOrExtract = true; | |
4691 | + } | |
4692 | + else { | |
4693 | + $scope.doHighlightOrExtract = false; | |
4682 | 4694 | } |
4683 | 4695 | |
4684 | 4696 | |
4685 | - if( $scope.doHighlight == true){ | |
4686 | - if ($rootScope.isHighLight == true) { | |
4697 | + if ($scope.doHighlightOrExtract == true) { | |
4698 | + if ($rootScope.isHighLight == true) { | |
4687 | 4699 | |
4688 | - $scope.grayeddBR = []; | |
4700 | + $scope.grayeddBR = []; | |
4689 | 4701 | |
4690 | - angular.forEach($scope.ColoredImageSRC, function (value, key) { | |
4691 | - console.log('$scope.ColoredImageSRC length begore gray= ' + $scope.ColoredImageSRC.length) | |
4692 | - var id; | |
4693 | - if (value.haveMirror == 'true') { | |
4694 | - id = 'imageCanvas' + value.bodyRegionId + '_MR'; | |
4695 | - } | |
4696 | - else { | |
4697 | - id = 'imageCanvas' + value.bodyRegionId; | |
4698 | - } | |
4702 | + angular.forEach($scope.ColoredImageSRC, function (value, key) { | |
4703 | + console.log('$scope.ColoredImageSRC length begore gray= ' + $scope.ColoredImageSRC.length) | |
4704 | + var id; | |
4705 | + if (value.haveMirror == 'true') { | |
4706 | + id = 'imageCanvas' + value.bodyRegionId + '_MR'; | |
4707 | + } | |
4708 | + else { | |
4709 | + id = 'imageCanvas' + value.bodyRegionId; | |
4710 | + } | |
4699 | 4711 | |
4700 | - //alert(value.bodyRegionId) | |
4712 | + //alert(value.bodyRegionId) | |
4701 | 4713 | |
4702 | - var imageCanvas = document.getElementById(id); | |
4714 | + var imageCanvas = document.getElementById(id); | |
4703 | 4715 | |
4704 | - //var coloredCanvasID = 'imageCanvas' + bodyRegionId; | |
4705 | - //var coloredCanvas = document.getElementById(coloredCanvasID); | |
4716 | + //var coloredCanvasID = 'imageCanvas' + bodyRegionId; | |
4717 | + //var coloredCanvas = document.getElementById(coloredCanvasID); | |
4706 | 4718 | |
4707 | - var width = value.Width; | |
4708 | - var ht = value.Height; | |
4719 | + var width = value.Width; | |
4720 | + var ht = value.Height; | |
4709 | 4721 | |
4710 | - var coloredCanvasContext = imageCanvas.getContext("2d"); | |
4711 | - var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); | |
4712 | - var coloredImageDataVar = coloredImageData; | |
4722 | + var coloredCanvasContext = imageCanvas.getContext("2d"); | |
4723 | + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); | |
4724 | + var coloredImageDataVar = coloredImageData; | |
4713 | 4725 | |
4714 | 4726 | |
4715 | - if (value.haveMirror == 'true') { | |
4716 | - $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; | |
4717 | - } | |
4718 | - else { | |
4727 | + if (value.haveMirror == 'true') { | |
4728 | + $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; | |
4729 | + } | |
4730 | + else { | |
4719 | 4731 | |
4720 | 4732 | |
4721 | - $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; | |
4733 | + $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; | |
4722 | 4734 | |
4723 | - } | |
4735 | + } | |
4724 | 4736 | |
4725 | 4737 | |
4726 | - var context_gray = imageCanvas.getContext('2d'); | |
4738 | + var context_gray = imageCanvas.getContext('2d'); | |
4727 | 4739 | |
4728 | 4740 | |
4729 | - //NIKI- for lateral arm highlight issue | |
4741 | + //NIKI- for lateral arm highlight issue | |
4730 | 4742 | |
4731 | - if ($rootScope.viewOrientationId && value.bodyRegionId == 6) { | |
4732 | - var imgData = context_gray.getImageData(0, 0, width, ht); | |
4733 | - var data = imgData.data; | |
4734 | - for (var i = 0; i < data.length; i += 4) { | |
4735 | - // if (data[i + 3] < 255) { | |
4736 | - // data[i] = 255 - data[i]; | |
4737 | - // data[i + 1] = 255 - data[i + 1]; | |
4738 | - // data[i + 2] = 255 - data[i + 2]; | |
4743 | + if ($rootScope.viewOrientationId && value.bodyRegionId == 6) { | |
4744 | + var imgData = context_gray.getImageData(0, 0, width, ht); | |
4745 | + var data = imgData.data; | |
4746 | + for (var i = 0; i < data.length; i += 4) { | |
4747 | + // if (data[i + 3] < 255) { | |
4748 | + // data[i] = 255 - data[i]; | |
4749 | + // data[i + 1] = 255 - data[i + 1]; | |
4750 | + // data[i + 2] = 255 - data[i + 2]; | |
4739 | 4751 | data[i + 3] = 255//255 - data[i + 3]; |
4740 | - // } | |
4752 | + // } | |
4753 | + } | |
4754 | + context_gray.putImageData(imgData, 0, 0); | |
4741 | 4755 | } |
4742 | - context_gray.putImageData(imgData, 0, 0); | |
4743 | - } | |
4744 | - //NIKI | |
4756 | + //NIKI | |
4745 | 4757 | |
4746 | 4758 | |
4747 | 4759 | |
4748 | 4760 | |
4749 | - var dataURL = imageCanvas.toDataURL(); | |
4761 | + var dataURL = imageCanvas.toDataURL(); | |
4750 | 4762 | |
4751 | 4763 | |
4752 | - var img = new Image(); | |
4764 | + var img = new Image(); | |
4753 | 4765 | |
4754 | - img.src = dataURL; | |
4766 | + img.src = dataURL; | |
4755 | 4767 | |
4756 | 4768 | |
4757 | 4769 | |
4758 | - img.onload = function () { | |
4759 | - console.log('Before BitmapData call, width: ' + Math.max(img.width) + ', height: ' + Math.max(img.height) + ' value.bodyRegionId= ' | |
4760 | - + value.bodyRegionId) | |
4770 | + img.onload = function () { | |
4771 | + console.log('Before BitmapData call, width: ' + Math.max(img.width) + ', height: ' + Math.max(img.height) + ' value.bodyRegionId= ' | |
4772 | + + value.bodyRegionId) | |
4761 | 4773 | |
4762 | - var DAData = new BitmapData(Math.max(img.width), Math.max(img.height)); | |
4763 | - DAData.draw(img); | |
4774 | + var DAData = new BitmapData(Math.max(img.width), Math.max(img.height)); | |
4775 | + DAData.draw(img); | |
4764 | 4776 | |
4765 | - var colorMode; | |
4777 | + var colorMode; | |
4766 | 4778 | |
4767 | - if ($scope.isExtract == true) { | |
4768 | - colorMode = $scope.applyWhiteMatrix(img, context_gray); | |
4769 | - } | |
4770 | - else { | |
4771 | - colorMode = $scope.applyGrayMatrix(img, context_gray); | |
4772 | - } | |
4779 | + if ($scope.isExtract == true) { | |
4780 | + colorMode = $scope.applyWhiteMatrix(img, context_gray); | |
4781 | + } | |
4782 | + else { | |
4783 | + colorMode = $scope.applyGrayMatrix(img, context_gray); | |
4784 | + } | |
4773 | 4785 | |
4774 | - var zeroPoint = new Point(); | |
4786 | + var zeroPoint = new Point(); | |
4775 | 4787 | |
4776 | - DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode); | |
4788 | + DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode); | |
4777 | 4789 | |
4778 | - context_gray.putImageData(DAData.data, 0, 0) | |
4790 | + context_gray.putImageData(DAData.data, 0, 0) | |
4779 | 4791 | |
4780 | - var grayImageData = context_gray.getImageData(0, 0, width, ht); | |
4781 | - var grayImageImageDataVar = grayImageData.data; | |
4792 | + //push BRID into array | |
4793 | + $scope.grayeddBR.push({ 'BRID': value.bodyRegionId }); | |
4782 | 4794 | |
4783 | - if ($scope.isExtract == true) { | |
4784 | - if (value.haveMirror == 'true') { | |
4785 | - $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
4786 | - } | |
4787 | - else { | |
4795 | + var grayImageData = context_gray.getImageData(0, 0, width, ht); | |
4796 | + var grayImageImageDataVar = grayImageData.data; | |
4788 | 4797 | |
4789 | - $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
4790 | - } | |
4791 | - } | |
4792 | - else { | |
4798 | + if ($scope.isExtract == true) { | |
4799 | + if (value.haveMirror == 'true') { | |
4800 | + $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
4801 | + } | |
4802 | + else { | |
4793 | 4803 | |
4794 | - if (value.haveMirror == 'true') { | |
4795 | - $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
4804 | + $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
4805 | + } | |
4796 | 4806 | } |
4797 | 4807 | else { |
4798 | 4808 | |
4799 | - $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
4809 | + if (value.haveMirror == 'true') { | |
4810 | + $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
4811 | + } | |
4812 | + else { | |
4813 | + | |
4814 | + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
4815 | + } | |
4800 | 4816 | } |
4801 | - } | |
4802 | 4817 | |
4803 | - //push BRID into array | |
4804 | - $scope.grayeddBR.push({ 'BRID': value.bodyRegionId }); | |
4805 | 4818 | |
4806 | - if ($scope.grayeddBR != null || $scope.grayeddBR != undefined) { | |
4807 | - if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.grayeddBR.length == 9)) { | |
4808 | - $scope.isEligibleForHighlightBodyByTermList = true; | |
4809 | - } | |
4810 | - else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.grayeddBR.length == 5)) { | |
4811 | - $scope.isEligibleForHighlightBodyByTermList = true; | |
4812 | - } | |
4813 | - else if ((($rootScope.viewOrientationId == '5')) && ($scope.grayeddBR.length == 4)) { | |
4814 | - $scope.isEligibleForHighlightBodyByTermList = true; | |
4815 | - } | |
4816 | - else if ((($rootScope.viewOrientationId == '6')) && ($scope.grayeddBR.length == 1)) { | |
4817 | - $scope.isEligibleForHighlightBodyByTermList = true; | |
4818 | - } | |
4819 | 4819 | |
4820 | - if ($scope.isEligibleForHighlightBodyByTermList == true) { | |
4821 | - //DISABLE PROGERSS BAR FOR GENDER OR VIEW CHANGE | |
4822 | - if ($rootScope.isGenderChnage == true || $rootScope.isViewChange == true) { | |
4823 | - $scope.isLoading = false; | |
4820 | + if ($scope.grayeddBR != null || $scope.grayeddBR != undefined) { | |
4821 | + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.grayeddBR.length == 9)) { | |
4822 | + $scope.isEligibleForHighlightBodyByTermList = true; | |
4823 | + $scope.doHighlightOrExtract = false; | |
4824 | + } | |
4825 | + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.grayeddBR.length == 5)) { | |
4826 | + $scope.isEligibleForHighlightBodyByTermList = true; | |
4827 | + $scope.doHighlightOrExtract = false; | |
4828 | + } | |
4829 | + else if ((($rootScope.viewOrientationId == '5')) && ($scope.grayeddBR.length == 4)) { | |
4830 | + $scope.isEligibleForHighlightBodyByTermList = true; | |
4831 | + $scope.doHighlightOrExtract = false; | |
4832 | + } | |
4833 | + else if ((($rootScope.viewOrientationId == '6')) && ($scope.grayeddBR.length == 1)) { | |
4834 | + $scope.isEligibleForHighlightBodyByTermList = true; | |
4835 | + $scope.doHighlightOrExtract = false; | |
4836 | + } | |
4837 | + else { | |
4824 | 4838 | |
4825 | - $('#spinner').css('visibility', 'hidden'); | |
4839 | + $scope.isEligibleForHighlightBodyByTermList = false; | |
4826 | 4840 | } |
4827 | 4841 | |
4828 | - if (($scope.isHighlightBodysystem == true) && ($scope.systemMatchedTermList != null || $scope.systemMatchedTermList != undefined)) { | |
4842 | + if ($scope.isEligibleForHighlightBodyByTermList == true) { | |
4843 | + //DISABLE PROGERSS BAR FOR GENDER OR VIEW CHANGE | |
4844 | + if ($rootScope.isGenderChnage == true || $rootScope.isViewChange == true) { | |
4845 | + $scope.isLoading = false; | |
4829 | 4846 | |
4830 | - $timeout(function () { $scope.HighlightBodyByTermList($scope.systemMatchedTermList) }, 100); | |
4831 | - } | |
4832 | - else if ($scope.isHighlightByListManager == true) { | |
4847 | + $('#spinner').css('visibility', 'hidden'); | |
4848 | + } | |
4833 | 4849 | |
4834 | - // console.log('$scope.grayeddBR.length is ' + $scope.grayeddBR.length); | |
4835 | - $timeout(function () { | |
4850 | + if (($scope.isHighlightBodysystem == true) && ($scope.systemMatchedTermList != null || $scope.systemMatchedTermList != undefined)) { | |
4836 | 4851 | |
4837 | - // $rootScope.isHighLight = false; | |
4838 | - //align | |
4839 | - // $scope.aligneCanvasWithTerm(); | |
4852 | + $timeout(function () { $scope.HighlightBodyByTermList($scope.systemMatchedTermList) }, 100); | |
4853 | + } | |
4854 | + else if ($scope.isHighlightByListManager == true) { | |
4840 | 4855 | |
4841 | - $scope.HighlightBodyByTermList($scope.AllTerms) | |
4842 | - }, 800); | |
4856 | + // console.log('$scope.grayeddBR.length is ' + $scope.grayeddBR.length); | |
4857 | + $timeout(function () { | |
4843 | 4858 | |
4844 | - } | |
4859 | + // $rootScope.isHighLight = false; | |
4860 | + //align | |
4861 | + // $scope.aligneCanvasWithTerm(); | |
4845 | 4862 | |
4846 | - if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { | |
4863 | + $scope.HighlightBodyByTermList($scope.AllTerms) | |
4864 | + }, 800); | |
4847 | 4865 | |
4866 | + } | |
4848 | 4867 | |
4849 | - console.log('inside highlight body'); | |
4868 | + if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { | |
4850 | 4869 | |
4851 | - var multiTermList = []; | |
4852 | - angular.forEach($rootScope.previousHighlightList, function (value, key) { | |
4853 | 4870 | |
4854 | - //debugger; | |
4871 | + //console.log('inside highlight body'); | |
4855 | 4872 | |
4856 | - var ActualTermNo = $scope.getActualTermNumber(value); | |
4857 | - if (ActualTermNo != null) { | |
4858 | - var TermList = $scope.getTermNumberList(ActualTermNo); | |
4859 | - if (TermList != null) { | |
4860 | - for (var i = 0; i < TermList.length; i++) { | |
4873 | + var multiTermList = []; | |
4874 | + angular.forEach($rootScope.previousHighlightList, function (value, key) { | |
4861 | 4875 | |
4862 | - multiTermList.push(TermList[i]); | |
4876 | + //debugger; | |
4877 | + | |
4878 | + var ActualTermNo = $scope.getActualTermNumber(value); | |
4879 | + if (ActualTermNo != null) { | |
4880 | + var TermList = $scope.getTermNumberList(ActualTermNo); | |
4881 | + if (TermList != null) { | |
4882 | + for (var i = 0; i < TermList.length; i++) { | |
4883 | + | |
4884 | + multiTermList.push(TermList[i]); | |
4885 | + } | |
4863 | 4886 | } |
4864 | 4887 | } |
4865 | - } | |
4866 | 4888 | |
4867 | - }); | |
4889 | + }); | |
4868 | 4890 | |
4869 | 4891 | |
4870 | - $timeout(function () { $scope.HighlightBodyByTermList(multiTermList) }, 80); | |
4871 | - } | |
4892 | + $timeout(function () { $scope.HighlightBodyByTermList(multiTermList) }, 80); | |
4893 | + } | |
4872 | 4894 | |
4873 | 4895 | |
4874 | 4896 | |
4897 | + } | |
4898 | + | |
4875 | 4899 | } |
4876 | 4900 | |
4877 | 4901 | } |
4878 | - | |
4879 | - } | |
4880 | 4902 | |
4881 | - $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50); | |
4903 | + $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50); | |
4882 | 4904 | |
4883 | 4905 | |
4884 | - // console.log('the value of isHighlightByListManager ' + $scope.isHighlightByListManager); | |
4906 | + // console.log('the value of isHighlightByListManager ' + $scope.isHighlightByListManager); | |
4885 | 4907 | |
4886 | - // console.log('$scope.grayeddBR.length: ' + $scope.grayeddBR.length) | |
4908 | + // console.log('$scope.grayeddBR.length: ' + $scope.grayeddBR.length) | |
4887 | 4909 | |
4888 | 4910 | |
4889 | 4911 | |
4890 | 4912 | |
4891 | - if ($rootScope.isExtract == true) { | |
4892 | - if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { | |
4913 | + if ($rootScope.isExtract == true) { | |
4914 | + if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { | |
4893 | 4915 | |
4894 | - $timeout(function () { $scope.HighlightBodyOnExtract() }, 50); | |
4895 | - } | |
4896 | - } | |
4897 | - else { | |
4898 | - // 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 | |
4899 | - //and then highlight the previously selected body regions at the time of normal mode. | |
4900 | - if ($scope.grayeddBR != null || $scope.grayeddBR != undefined) { | |
4901 | - if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.grayeddBR.length == 9)) { | |
4902 | - $scope.isEligibleForHighlightBodyByTermList = true; | |
4903 | - } | |
4904 | - else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.grayeddBR.length == 5)) { | |
4905 | - $scope.isEligibleForHighlightBodyByTermList = true; | |
4906 | - } | |
4907 | - else if ((($rootScope.viewOrientationId == '5')) && ($scope.grayeddBR.length == 4)) { | |
4908 | - $scope.isEligibleForHighlightBodyByTermList = true; | |
4909 | - } | |
4910 | - else if ((($rootScope.viewOrientationId == '6')) && ($scope.grayeddBR.length == 1)) { | |
4911 | - $scope.isEligibleForHighlightBodyByTermList = true; | |
4916 | + $timeout(function () { $scope.HighlightBodyOnExtract() }, 50); | |
4912 | 4917 | } |
4918 | + } | |
4919 | + else { | |
4920 | + // 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 | |
4921 | + //and then highlight the previously selected body regions at the time of normal mode. | |
4922 | + if ($scope.grayeddBR != null || $scope.grayeddBR != undefined) { | |
4923 | + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.grayeddBR.length == 9)) { | |
4924 | + $scope.isEligibleForHighlightBodyByTermList = true; | |
4925 | + } | |
4926 | + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.grayeddBR.length == 5)) { | |
4927 | + $scope.isEligibleForHighlightBodyByTermList = true; | |
4928 | + } | |
4929 | + else if ((($rootScope.viewOrientationId == '5')) && ($scope.grayeddBR.length == 4)) { | |
4930 | + $scope.isEligibleForHighlightBodyByTermList = true; | |
4931 | + } | |
4932 | + else if ((($rootScope.viewOrientationId == '6')) && ($scope.grayeddBR.length == 1)) { | |
4933 | + $scope.isEligibleForHighlightBodyByTermList = true; | |
4934 | + } | |
4913 | 4935 | |
4914 | - if ($scope.isEligibleForHighlightBodyByTermList == true) { | |
4936 | + if ($scope.isEligibleForHighlightBodyByTermList == true) { | |
4915 | 4937 | |
4916 | - if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { | |
4938 | + if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { | |
4917 | 4939 | |
4918 | - var multiTermList = []; | |
4919 | - angular.forEach($rootScope.previousHighlightList, function (value, key) { | |
4940 | + var multiTermList = []; | |
4941 | + angular.forEach($rootScope.previousHighlightList, function (value, key) { | |
4920 | 4942 | |
4921 | - //debugger; | |
4943 | + //debugger; | |
4922 | 4944 | |
4923 | - var ActualTermNo = $scope.getActualTermNumber(value); | |
4924 | - if (ActualTermNo != null) { | |
4925 | - var TermList = $scope.getTermNumberList(ActualTermNo); | |
4926 | - if (TermList != null) { | |
4927 | - for (var i = 0; i < TermList.length; i++) { | |
4945 | + var ActualTermNo = $scope.getActualTermNumber(value); | |
4946 | + if (ActualTermNo != null) { | |
4947 | + var TermList = $scope.getTermNumberList(ActualTermNo); | |
4948 | + if (TermList != null) { | |
4949 | + for (var i = 0; i < TermList.length; i++) { | |
4928 | 4950 | |
4929 | - multiTermList.push(TermList[i]); | |
4951 | + multiTermList.push(TermList[i]); | |
4952 | + } | |
4930 | 4953 | } |
4931 | 4954 | } |
4932 | - } | |
4933 | 4955 | |
4934 | - }); | |
4956 | + }); | |
4935 | 4957 | |
4936 | 4958 | |
4937 | - $timeout(function () { $scope.HighlightBodyByTermList(multiTermList) }, 80); | |
4938 | - } | |
4959 | + $timeout(function () { $scope.HighlightBodyByTermList(multiTermList) }, 80); | |
4960 | + } | |
4939 | 4961 | |
4962 | + } | |
4940 | 4963 | } |
4941 | - } | |
4942 | 4964 | |
4943 | - // | |
4944 | - } | |
4945 | - }) | |
4965 | + // | |
4966 | + } | |
4967 | + }) | |
4946 | 4968 | |
4947 | - } | |
4948 | - } | |
4969 | + } | |
4949 | 4970 | |
4950 | - else { | |
4951 | - // This code will execute when user will select normal Mode but this time isHighlight will be false | |
4952 | 4971 | |
4953 | - angular.forEach($scope.ColoredImageSRC, function (value, key) { | |
4954 | - var id; | |
4955 | - if (value.haveMirror == 'true') { | |
4956 | - id = 'imageCanvas' + value.bodyRegionId + '_MR'; | |
4957 | - } | |
4958 | 4972 | else { |
4959 | - id = 'imageCanvas' + value.bodyRegionId; | |
4960 | - } | |
4973 | + // This code will execute when user will select normal Mode but this time isHighlight will be false | |
4961 | 4974 | |
4962 | - var imageCanvas = document.getElementById(id); | |
4975 | + angular.forEach($scope.ColoredImageSRC, function (value, key) { | |
4976 | + var id; | |
4977 | + if (value.haveMirror == 'true') { | |
4978 | + id = 'imageCanvas' + value.bodyRegionId + '_MR'; | |
4979 | + } | |
4980 | + else { | |
4981 | + id = 'imageCanvas' + value.bodyRegionId; | |
4982 | + } | |
4963 | 4983 | |
4964 | - //var coloredCanvasID = 'imageCanvas' + bodyRegionId; | |
4965 | - //var coloredCanvas = document.getElementById(coloredCanvasID); | |
4984 | + var imageCanvas = document.getElementById(id); | |
4966 | 4985 | |
4967 | - var width = value.Width; | |
4968 | - var ht = value.Height; | |
4986 | + //var coloredCanvasID = 'imageCanvas' + bodyRegionId; | |
4987 | + //var coloredCanvas = document.getElementById(coloredCanvasID); | |
4969 | 4988 | |
4970 | - var coloredCanvasContext = imageCanvas.getContext("2d"); | |
4971 | - var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); | |
4972 | - var coloredImageDataVar = coloredImageData; | |
4989 | + var width = value.Width; | |
4990 | + var ht = value.Height; | |
4973 | 4991 | |
4992 | + var coloredCanvasContext = imageCanvas.getContext("2d"); | |
4993 | + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); | |
4994 | + var coloredImageDataVar = coloredImageData; | |
4974 | 4995 | |
4975 | - if (value.haveMirror == 'true') { | |
4976 | - $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; | |
4977 | - } | |
4978 | - else { | |
4979 | 4996 | |
4980 | - $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; | |
4997 | + if (value.haveMirror == 'true') { | |
4998 | + $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; | |
4999 | + } | |
5000 | + else { | |
4981 | 5001 | |
4982 | - } | |
5002 | + $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; | |
4983 | 5003 | |
5004 | + } | |
4984 | 5005 | |
4985 | - var context = imageCanvas.getContext('2d'); | |
4986 | 5006 | |
5007 | + var context = imageCanvas.getContext('2d'); | |
4987 | 5008 | |
4988 | - var dataURL = imageCanvas.toDataURL(); | |
4989 | 5009 | |
5010 | + var dataURL = imageCanvas.toDataURL(); | |
4990 | 5011 | |
4991 | - var img = new Image(); | |
4992 | 5012 | |
4993 | - img.src = dataURL; | |
5013 | + var img = new Image(); | |
4994 | 5014 | |
5015 | + img.src = dataURL; | |
4995 | 5016 | |
4996 | 5017 | |
4997 | - img.onload = function () { | |
4998 | - //console.log(Math.max(img.width) + ', ' + Math.max(img.height)) | |
4999 | 5018 | |
5000 | - var DAData = new BitmapData(Math.max(img.width), Math.max(img.height)); | |
5001 | - DAData.draw(img); | |
5019 | + img.onload = function () { | |
5020 | + //console.log(Math.max(img.width) + ', ' + Math.max(img.height)) | |
5002 | 5021 | |
5003 | - var colorMode; | |
5022 | + var DAData = new BitmapData(Math.max(img.width), Math.max(img.height)); | |
5023 | + DAData.draw(img); | |
5004 | 5024 | |
5005 | - if ($scope.isExtract == true) { | |
5006 | - colorMode = $scope.applyWhiteMatrix(img, context); | |
5007 | - } | |
5025 | + var colorMode; | |
5008 | 5026 | |
5009 | - var zeroPoint = new Point(); | |
5027 | + if ($scope.isExtract == true) { | |
5028 | + colorMode = $scope.applyWhiteMatrix(img, context); | |
5029 | + } | |
5010 | 5030 | |
5011 | - DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode); | |
5031 | + var zeroPoint = new Point(); | |
5012 | 5032 | |
5013 | - context.putImageData(DAData.data, 0, 0) | |
5033 | + DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode); | |
5014 | 5034 | |
5015 | - var grayImageData = context.getImageData(0, 0, width, ht); | |
5016 | - var grayImageImageDataVar = grayImageData.data; | |
5035 | + context.putImageData(DAData.data, 0, 0) | |
5017 | 5036 | |
5018 | - if ($scope.isExtract == true) { | |
5019 | - if (value.haveMirror == 'true') { | |
5020 | - $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
5021 | - } | |
5022 | - else { | |
5037 | + var grayImageData = context.getImageData(0, 0, width, ht); | |
5038 | + var grayImageImageDataVar = grayImageData.data; | |
5023 | 5039 | |
5024 | - $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
5025 | - } | |
5026 | - } | |
5027 | - else { | |
5040 | + if ($scope.isExtract == true) { | |
5041 | + if (value.haveMirror == 'true') { | |
5042 | + $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
5043 | + } | |
5044 | + else { | |
5028 | 5045 | |
5029 | - if (value.haveMirror == 'true') { | |
5030 | - $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
5031 | - } | |
5032 | - else { | |
5046 | + $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
5047 | + } | |
5048 | + } | |
5049 | + else { | |
5033 | 5050 | |
5034 | - $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
5051 | + if (value.haveMirror == 'true') { | |
5052 | + $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
5053 | + } | |
5054 | + else { | |
5055 | + | |
5056 | + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
5057 | + } | |
5058 | + } | |
5035 | 5059 | } |
5036 | - } | |
5037 | - } | |
5038 | 5060 | |
5039 | - $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50); | |
5040 | - }) | |
5061 | + $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50); | |
5062 | + }) | |
5041 | 5063 | |
5042 | - if ($rootScope.isExtract == true) { | |
5043 | - if ($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined || $rootScope.previousHighlightList.length > 0) { | |
5044 | - | |
5045 | - $timeout(function () { $scope.HighlightBodyOnExtract() }, 50); | |
5064 | + if ($rootScope.isExtract == true) { | |
5065 | + if ($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined || $rootScope.previousHighlightList.length > 0) { | |
5066 | + | |
5067 | + $timeout(function () { $scope.HighlightBodyOnExtract() }, 50); | |
5068 | + | |
5069 | + // to do | |
5070 | + | |
5071 | + } | |
5072 | + } | |
5046 | 5073 | |
5047 | - // to do | |
5048 | - | |
5049 | 5074 | } |
5050 | 5075 | } |
5051 | - | |
5052 | - } | |
5053 | - } | |
5076 | + } | |
5054 | 5077 | } |
5055 | 5078 | |
5056 | 5079 | ... | ... |