Commit 0729a1a794a6606a62b0d11a0657ab36834b723b
1 parent
722197ea
Refs: #6544
Fixed blacking issue. This is fixed by handling the asynchronous call. Now onwards we are highlighting selected term only when the gray canvas or normal mode canvas is completed its creating for all 9 body regions and also we have moved LS manager code where with 9 check where the drawing body is going on.
Showing
4 changed files
with
468 additions
and
379 deletions
150-DOCUMENTATION/AIA-July-Report.pptx
No preview for this file type
150-DOCUMENTATION/AIA-June-Report.pptx
No preview for this file type
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -396,7 +396,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
396 | 396 | $('#daBodyview').css("width", $(window).outerWidth()); |
397 | 397 | |
398 | 398 | //1. load navigator man first |
399 | - $scope.LoadBodyViewNavigatorImage(); | |
399 | + // $scope.LoadBodyViewNavigatorImage(); | |
400 | + | |
401 | + $scope.loadSearchDataForBodyView(); | |
400 | 402 | |
401 | 403 | //2. |
402 | 404 | |
... | ... | @@ -570,7 +572,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
570 | 572 | //1. |
571 | 573 | console.log('DATA.NOT.LOADED FOR:' + NavigatorManJsonPath + ', ERROR: ' + data); |
572 | 574 | //2. |
573 | - $scope.LoadBodyViewNavigatorImage() | |
575 | + // $scope.LoadBodyViewNavigatorImage() | |
574 | 576 | }); |
575 | 577 | } |
576 | 578 | |
... | ... | @@ -660,9 +662,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
660 | 662 | .from($rootScope.bgartData.BackgroundArts.BackgroundArtDetail) |
661 | 663 | .where('_ViewOrientationId == ' + viewOrientationId) |
662 | 664 | .select(); |
663 | - //} | |
664 | 665 | |
665 | - $scope.ColoredImageSRC = []; | |
666 | + if ($scope.ColoredImageSRC != null && $scope.ColoredImageSRC.length > 0) { | |
667 | + $scope.ColoredImageSRC = null; | |
668 | + $scope.ColoredImageSRC = []; | |
669 | + $scope.flushCanvas(); | |
670 | + } | |
671 | + else { | |
672 | + $scope.ColoredImageSRC = []; | |
673 | + } | |
666 | 674 | |
667 | 675 | if ($scope.bodyRegionCoordinates != null || $scope.bodyRegionCoordinates != undefined) { |
668 | 676 | angular.forEach($scope.bodyRegionCoordinates, function (value, key) { |
... | ... | @@ -678,19 +686,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
678 | 686 | |
679 | 687 | //1.Get image source |
680 | 688 | var src = $scope.GetImageSource(value._BodyRegionId); |
689 | + | |
681 | 690 | $scope.imageSource = src; |
682 | 691 | // debugger; |
683 | 692 | |
684 | - $scope.ColoredImageSRC.push( | |
685 | - { | |
686 | - "bodyRegionId": value._BodyRegionId, "SRC": src, | |
687 | - "Height": rectangle.scaledHeight, | |
688 | - "Width": rectangle.scaledWidth, | |
689 | - "x": rectangle.scaledX, | |
690 | - "y": rectangle.scaledY, | |
691 | - "haveMirror": 'true' | |
692 | - } | |
693 | - ); | |
693 | + //$scope.ColoredImageSRC.push( | |
694 | + // { | |
695 | + // "bodyRegionId": value._BodyRegionId, "SRC": src, | |
696 | + // "Height": rectangle.scaledHeight, | |
697 | + // "Width": rectangle.scaledWidth, | |
698 | + // "x": rectangle.scaledX, | |
699 | + // "y": rectangle.scaledY, | |
700 | + // "haveMirror": 'true' | |
701 | + // } | |
702 | + // ); | |
694 | 703 | |
695 | 704 | |
696 | 705 | //2.Draw mirror image |
... | ... | @@ -715,16 +724,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
715 | 724 | //0. Scaling as per default zoom |
716 | 725 | var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, 0); |
717 | 726 | |
718 | - $scope.ColoredImageSRC.push( | |
719 | - { | |
720 | - "bodyRegionId": value._BodyRegionId, "SRC": src, | |
721 | - "Height": rectangle.scaledHeight, | |
722 | - "Width": rectangle.scaledWidth, | |
723 | - "x": rectangle.scaledX, | |
724 | - "y": rectangle.scaledY, | |
725 | - "haveMirror": 'false' | |
726 | - } | |
727 | - ); | |
727 | + //$scope.ColoredImageSRC.push( | |
728 | + // { | |
729 | + // "bodyRegionId": value._BodyRegionId, "SRC": src, | |
730 | + // "Height": rectangle.scaledHeight, | |
731 | + // "Width": rectangle.scaledWidth, | |
732 | + // "x": rectangle.scaledX, | |
733 | + // "y": rectangle.scaledY, | |
734 | + // "haveMirror": 'false' | |
735 | + // } | |
736 | + // ); | |
728 | 737 | |
729 | 738 | |
730 | 739 | //1.Draw body region which have mirror image |
... | ... | @@ -758,16 +767,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
758 | 767 | $scope.imageSource = src; |
759 | 768 | } |
760 | 769 | |
761 | - $scope.ColoredImageSRC.push( | |
762 | - { | |
763 | - "bodyRegionId": value._BodyRegionId, "SRC": src, | |
764 | - "Height": rectangle.scaledHeight, | |
765 | - "Width": rectangle.scaledWidth, | |
766 | - "x": rectangle.scaledX, | |
767 | - "y": rectangle.scaledY, | |
768 | - "haveMirror": 'false' | |
769 | - } | |
770 | - ); | |
770 | + //$scope.ColoredImageSRC.push( | |
771 | + // { | |
772 | + // "bodyRegionId": value._BodyRegionId, "SRC": src, | |
773 | + // "Height": rectangle.scaledHeight, | |
774 | + // "Width": rectangle.scaledWidth, | |
775 | + // "x": rectangle.scaledX, | |
776 | + // "y": rectangle.scaledY, | |
777 | + // "haveMirror": 'false' | |
778 | + // } | |
779 | + // ); | |
771 | 780 | |
772 | 781 | //2.Draw body region which don't have mirror image |
773 | 782 | $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 |
847 | 856 | } |
848 | 857 | } |
849 | 858 | |
850 | - if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) && ($scope.ColoredImageSRC.length == 9)) { | |
851 | 859 | |
852 | - $rootScope.isLoading = false; | |
853 | - $('#spinner').css('visibility', 'hidden'); | |
854 | - | |
855 | - if ($rootScope.isListManagerSelected == true) { | |
856 | - $rootScope.isLoading = true; | |
857 | - $('#spinner').css('visibility', 'visible'); | |
858 | - $timeout(function () { | |
859 | - console.log('$scope.ColoredImageSRC.length= ' + $scope.ColoredImageSRC.length) | |
860 | - $rootScope.isHighLight = true; | |
861 | - $scope.highLightBody() | |
862 | - }, 500); | |
863 | - } | |
864 | - } | |
865 | 860 | }); |
866 | 861 | } |
867 | 862 | |
... | ... | @@ -994,42 +989,44 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
994 | 989 | $scope.one = 1; |
995 | 990 | |
996 | 991 | $scope.userInput = parseInt($scope.layerNumber); |
997 | - | |
992 | + $scope.skinTone = DA[0].ethnicity; | |
998 | 993 | |
999 | 994 | var SelectedLayerData = []; |
1000 | 995 | SelectedLayerData = $rootScope.BodyLayerData.Layers.DataLayer[dataLength - $scope.userInput - 1]; |
1001 | - if ($scope.layerNumber == 0) { | |
1002 | - for (var z = 0; z <= SelectedLayerData.BodyRegion.length; z++) { | |
996 | + if ((SelectedLayerData != null || SelectedLayerData != undefined) && SelectedLayerData.BodyRegion.length > 0) { | |
997 | + if ($scope.layerNumber == 0) { | |
998 | + for (var z = 0; z < SelectedLayerData.BodyRegion.length; z++) { | |
1003 | 999 | |
1004 | - var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId; | |
1005 | - var bodyRegionSkinTone = SelectedLayerData.BodyRegion[z].Image._SkintTone; | |
1000 | + var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId; | |
1001 | + var bodyRegionSkinTone = SelectedLayerData.BodyRegion[z].Image._SkintTone; | |
1006 | 1002 | |
1007 | - if (bodyRegion == bodyRegionId && bodyRegionSkinTone == $scope.skinTone) { | |
1003 | + if (bodyRegion == bodyRegionId && bodyRegionSkinTone == $scope.skinTone) { | |
1008 | 1004 | |
1009 | - return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName; | |
1005 | + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName; | |
1006 | + } | |
1010 | 1007 | } |
1011 | 1008 | } |
1012 | - } | |
1013 | 1009 | |
1014 | - else { | |
1015 | - // debugger; | |
1016 | - //below 4 bodyviews have only single body region | |
1017 | - if ($rootScope.voId == 9 || $rootScope.voId == 11 || $rootScope.voId == 10 || $rootScope.voId == 12) { | |
1018 | - var bodyRegion = SelectedLayerData.BodyRegion._BodyRegionId; | |
1010 | + else { | |
1011 | + // debugger; | |
1012 | + //below 4 bodyviews have only single body region | |
1013 | + if ($rootScope.voId == 9 || $rootScope.voId == 11 || $rootScope.voId == 10 || $rootScope.voId == 12) { | |
1014 | + var bodyRegion = SelectedLayerData.BodyRegion._BodyRegionId; | |
1019 | 1015 | |
1020 | - return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion.Image._ImageName; | |
1016 | + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion.Image._ImageName; | |
1021 | 1017 | |
1022 | - } | |
1023 | - else // it is for other body view which have multiple body regions and layer no > 0 | |
1024 | - { | |
1025 | - // debugger; | |
1026 | - for (var z = 0; z <= SelectedLayerData.BodyRegion.length; z++) { | |
1027 | - var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId; | |
1028 | - if (bodyRegion == bodyRegionId) { | |
1018 | + } | |
1019 | + else // it is for other body view which have multiple body regions and layer no > 0 | |
1020 | + { | |
1021 | + // debugger; | |
1022 | + for (var z = 0; z <= SelectedLayerData.BodyRegion.length; z++) { | |
1023 | + var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId; | |
1024 | + if (bodyRegion == bodyRegionId) { | |
1029 | 1025 | |
1030 | - return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName; | |
1026 | + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName; | |
1031 | 1027 | |
1032 | 1028 | |
1029 | + } | |
1033 | 1030 | } |
1034 | 1031 | } |
1035 | 1032 | } |
... | ... | @@ -1307,6 +1304,40 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1307 | 1304 | context.restore(); |
1308 | 1305 | |
1309 | 1306 | |
1307 | + if (isMaskImage == 'N') { | |
1308 | + $scope.ColoredImageSRC.push( | |
1309 | + { | |
1310 | + "bodyRegionId": bodyRegionId, "SRC": src, | |
1311 | + "Height": h, | |
1312 | + "Width": w, | |
1313 | + "x": x, | |
1314 | + "y": y, | |
1315 | + "haveMirror": 'true' | |
1316 | + } | |
1317 | + ); | |
1318 | + | |
1319 | + console.log('$rootScope.isListManagerSelected= ' + $rootScope.isListManagerSelected + ' length= ' + $scope.ColoredImageSRC.length) | |
1320 | + | |
1321 | + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) && ($scope.ColoredImageSRC.length == 9)) { | |
1322 | + console.log('after check= ' + $scope.ColoredImageSRC.length) | |
1323 | + $rootScope.isLoading = false; | |
1324 | + $('#spinner').css('visibility', 'hidden'); | |
1325 | + | |
1326 | + if ($rootScope.isListManagerSelected == true) { | |
1327 | + $rootScope.isLoading = true; | |
1328 | + $('#spinner').css('visibility', 'visible'); | |
1329 | + $timeout(function () { | |
1330 | + console.log('$scope.ColoredImageSRC.length= ' + $scope.ColoredImageSRC.length) | |
1331 | + $rootScope.isHighLight = true; | |
1332 | + | |
1333 | + $scope.highLightBody() | |
1334 | + }, 500); | |
1335 | + } | |
1336 | + } | |
1337 | + | |
1338 | + console.log('ColoredImageSRC. pushed and length: ' + $scope.ColoredImageSRC.length); | |
1339 | + } | |
1340 | + | |
1310 | 1341 | if (FlipedImgCanvas.id.match('_mci')) { |
1311 | 1342 | |
1312 | 1343 | var maskImgData = context.getImageData(0, 0, w, h); |
... | ... | @@ -1325,6 +1356,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1325 | 1356 | if (document.getElementById('canvasDiv') != null) |
1326 | 1357 | document.getElementById('canvasDiv').appendChild(FlipedImgCanvas); |
1327 | 1358 | |
1359 | + | |
1360 | + | |
1328 | 1361 | } |
1329 | 1362 | |
1330 | 1363 | $scope.DrawImage = function (h, w, x, y, src, bodyRegionId, isMaskImage) { |
... | ... | @@ -1569,9 +1602,44 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1569 | 1602 | img.src = src; |
1570 | 1603 | |
1571 | 1604 | function start() { |
1572 | - // debugger; | |
1605 | + //debugger; | |
1573 | 1606 | context.drawImage(img, 0, 0); |
1574 | 1607 | |
1608 | + if (isMaskImage == 'N') { | |
1609 | + if (bodyRegionId != 'modestyImg3') { | |
1610 | + $scope.ColoredImageSRC.push( | |
1611 | + { | |
1612 | + "bodyRegionId": bodyRegionId, "SRC": src, | |
1613 | + "Height": h, | |
1614 | + "Width": w, | |
1615 | + "x": x, | |
1616 | + "y": y, | |
1617 | + "haveMirror": 'false' | |
1618 | + } | |
1619 | + | |
1620 | + ); | |
1621 | + | |
1622 | + console.log('$rootScope.isListManagerSelected= ' + $rootScope.isListManagerSelected + ' length= ' + $scope.ColoredImageSRC.length) | |
1623 | + | |
1624 | + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) && ($scope.ColoredImageSRC.length == 9)) { | |
1625 | + console.log('after check= ' + $scope.ColoredImageSRC.length) | |
1626 | + $rootScope.isLoading = false; | |
1627 | + $('#spinner').css('visibility', 'hidden'); | |
1628 | + | |
1629 | + if ($rootScope.isListManagerSelected == true) { | |
1630 | + $rootScope.isLoading = true; | |
1631 | + $('#spinner').css('visibility', 'visible'); | |
1632 | + $timeout(function () { | |
1633 | + console.log('$scope.ColoredImageSRC.length= ' + $scope.ColoredImageSRC.length) | |
1634 | + $rootScope.isHighLight = true; | |
1635 | + | |
1636 | + $scope.highLightBody() | |
1637 | + }, 500); | |
1638 | + } | |
1639 | + } | |
1640 | + } | |
1641 | + | |
1642 | + } | |
1575 | 1643 | if (imgCanvas.id.match('_mci')) { |
1576 | 1644 | var maskImgData = context.getImageData(0, 0, w, h); |
1577 | 1645 | $rootScope.MaskCanvasData.push( |
... | ... | @@ -1647,22 +1715,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1647 | 1715 | |
1648 | 1716 | //terminate previous running workers to create space for new workers |
1649 | 1717 | |
1650 | - if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { | |
1651 | - var workerCount = $scope.runningWorkers.length; | |
1652 | - if (workerCount > 0) { | |
1653 | - for (var i = workerCount - 1; i >= 0; i--) { | |
1654 | - var runningWorker = $scope.runningWorkers[i].workerName; | |
1655 | - runningWorker.terminate(); | |
1656 | - $scope.runningWorkers.splice(i, 1); | |
1657 | - // workerCount--; | |
1658 | - } | |
1659 | - } | |
1660 | - } | |
1661 | - | |
1662 | - | |
1663 | - | |
1664 | - | |
1665 | - | |
1718 | + $scope.terminateCurrentlyRunningWPs(); | |
1666 | 1719 | |
1667 | 1720 | $timeout(function () { |
1668 | 1721 | |
... | ... | @@ -1782,19 +1835,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1782 | 1835 | $scope.highlightedBR = null; |
1783 | 1836 | $scope.highlightedBR = []; |
1784 | 1837 | |
1785 | - if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { | |
1786 | - | |
1787 | - //terminate previous running workers to create space for new workers | |
1788 | - var workerCount = $scope.runningWorkers.length; | |
1789 | - if (workerCount > 0) { | |
1790 | - for (var i = workerCount - 1; i >= 0; i--) { | |
1791 | - var runningWorker = $scope.runningWorkers[i].workerName; | |
1792 | - runningWorker.terminate(); | |
1793 | - $scope.runningWorkers.splice(i, 1); | |
1794 | - // workerCount--; | |
1795 | - } | |
1796 | - } | |
1797 | - } | |
1838 | + $scope.terminateCurrentlyRunningWPs(); | |
1798 | 1839 | |
1799 | 1840 | |
1800 | 1841 | |
... | ... | @@ -1912,9 +1953,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1912 | 1953 | if (grayCanvas != null) { |
1913 | 1954 | var grayCanvasContext = grayCanvas.getContext("2d"); |
1914 | 1955 | |
1915 | - | |
1956 | + //Niki remove previous data from canvas | |
1957 | + var canvasHeight = grayCanvas.height + 'px'; | |
1958 | + var canvasWidth = grayCanvas.width + 'px'; | |
1959 | + //alert('height= ' + canvasHeight + ', width= ' + canvasWidth) | |
1960 | + grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth) | |
1916 | 1961 | |
1917 | 1962 | grayCanvasContext.putImageData(updatedData, 0, 0); |
1963 | + $scope.highlightedBR.push({ 'bodyRegionId': bodyRegionId }); | |
1964 | + | |
1918 | 1965 | } |
1919 | 1966 | |
1920 | 1967 | //debugger; |
... | ... | @@ -1929,7 +1976,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1929 | 1976 | else |
1930 | 1977 | $rootScope.updatedGrayDataList[bodyRegionId - 1] = updatedData; |
1931 | 1978 | |
1932 | - $scope.highlightedBR.push({ 'bodyRegionId': bodyRegionId }); | |
1979 | + //$scope.highlightedBR.push({ 'bodyRegionId': bodyRegionId }); | |
1933 | 1980 | |
1934 | 1981 | console.log('$scope.highlightedBR.length= ' + $scope.highlightedBR.length) |
1935 | 1982 | |
... | ... | @@ -2059,21 +2106,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
2059 | 2106 | |
2060 | 2107 | //layer change function |
2061 | 2108 | $scope.LayerChange = function () { |
2062 | - // alert('layer chnage') | |
2063 | 2109 | |
2064 | 2110 | |
2065 | - if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { | |
2066 | - | |
2067 | - var workerCount = $scope.runningWorkers.length; | |
2068 | - if (workerCount > 0) { | |
2069 | - for (var i = workerCount - 1; i >= 0; i--) { | |
2070 | - var runningWorker = $scope.runningWorkers[i].workerName; | |
2071 | - runningWorker.terminate(); | |
2072 | - $scope.runningWorkers.splice(i, 1); | |
2073 | - // workerCount--; | |
2074 | - } | |
2075 | - } | |
2076 | - } | |
2111 | + $scope.terminateCurrentlyRunningWPs(); | |
2077 | 2112 | |
2078 | 2113 | var canvasDiv = document.getElementById('canvasDiv'); |
2079 | 2114 | $scope.imageVerticalScrollPosition = canvasDiv.scrollTop; |
... | ... | @@ -4242,16 +4277,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4242 | 4277 | } |
4243 | 4278 | |
4244 | 4279 | $scope.enableZoom = function () { |
4245 | - if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { | |
4246 | - //0. terminate current worker process | |
4247 | - var workerCount = $scope.runningWorkers.length; | |
4248 | - for (var i = workerCount - 1; i >= 0; i--) { | |
4249 | - var runningWorker = $scope.runningWorkers[i].workerName; | |
4250 | - runningWorker.terminate(); | |
4251 | - $scope.runningWorkers.splice(i, 1); | |
4252 | - // workerCount--; | |
4253 | - } | |
4254 | - } | |
4280 | + | |
4281 | + $scope.terminateCurrentlyRunningWPs(); | |
4255 | 4282 | |
4256 | 4283 | if ($scope.isTransparencyActivated) { |
4257 | 4284 | |
... | ... | @@ -4296,36 +4323,98 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4296 | 4323 | } |
4297 | 4324 | } |
4298 | 4325 | |
4326 | + | |
4299 | 4327 | $scope.flushCanvas = function () { |
4300 | - angular.forEach($scope.ColoredImageSRC, function (value, key) { | |
4301 | 4328 | |
4329 | + //if ($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) { | |
4330 | + // angular.forEach($scope.ColoredImageSRC, function (value, key) { | |
4331 | + | |
4332 | + // var id; | |
4333 | + // var maskId; | |
4334 | + // if (value.haveMirror == 'true') { | |
4335 | + // id = 'imageCanvas' + value.bodyRegionId + '_MR'; | |
4336 | + // maskId = 'imageCanvas' + value.bodyRegionId + '_MR_mci' | |
4337 | + // } | |
4338 | + // else { | |
4339 | + // id = 'imageCanvas' + value.bodyRegionId; | |
4340 | + // maskId = 'imageCanvas' + value.bodyRegionId + '_mci'; | |
4341 | + // } | |
4342 | + | |
4343 | + // var canvas = document.getElementById(id); | |
4344 | + // if (canvas != null || canvas != undefined) { | |
4345 | + // document.getElementById('canvasDiv').removeChild(canvas); | |
4346 | + // } | |
4347 | + | |
4348 | + // var maskcanvas = document.getElementById(maskId); | |
4349 | + // if (maskcanvas != null || maskcanvas != undefined) { | |
4350 | + // document.getElementById('canvasDiv').removeChild(maskcanvas); | |
4351 | + | |
4352 | + // } | |
4353 | + | |
4354 | + // var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); | |
4355 | + // for (var i = 0; i < modestyCanvases.length; i++) { | |
4356 | + // modestyCanvases[i].remove(); | |
4357 | + // } | |
4358 | + // }); | |
4359 | + //} | |
4360 | + | |
4361 | + for (var i = 1; i < 7; i++) { | |
4302 | 4362 | |
4303 | 4363 | var id; |
4304 | 4364 | var maskId; |
4305 | - if (value.haveMirror == 'true') { | |
4306 | - id = 'imageCanvas' + value.bodyRegionId + '_MR'; | |
4307 | - maskId = 'imageCanvas' + value.bodyRegionId + '_MR_mci' | |
4308 | - } | |
4309 | - else { | |
4310 | - id = 'imageCanvas' + value.bodyRegionId; | |
4311 | - maskId = 'imageCanvas' + value.bodyRegionId + '_mci'; | |
4312 | - } | |
4365 | + | |
4366 | + id = 'imageCanvas' + i; | |
4367 | + maskId = 'imageCanvas' + i + '_mci'; | |
4313 | 4368 | |
4314 | 4369 | var canvas = document.getElementById(id); |
4315 | - document.getElementById('canvasDiv').removeChild(canvas); | |
4370 | + if (canvas != null || canvas!=undefined) | |
4371 | + document.getElementById('canvasDiv').removeChild(canvas); | |
4316 | 4372 | |
4317 | 4373 | var maskcanvas = document.getElementById(maskId); |
4318 | - document.getElementById('canvasDiv').removeChild(maskcanvas); | |
4374 | + if (maskcanvas != null || maskcanvas != undefined) | |
4375 | + document.getElementById('canvasDiv').removeChild(maskcanvas); | |
4376 | + | |
4377 | + if (i == 4 || i == 5 || i == 6) { | |
4378 | + id = 'imageCanvas' + i + '_MR'; | |
4379 | + maskId = 'imageCanvas' + i + '_MR_mci'; | |
4380 | + | |
4381 | + var canvas = document.getElementById(id); | |
4382 | + if (canvas != null || canvas != undefined) | |
4383 | + document.getElementById('canvasDiv').removeChild(canvas); | |
4384 | + | |
4385 | + var maskcanvas = document.getElementById(maskId); | |
4386 | + if (maskcanvas != null || maskcanvas != undefined) | |
4387 | + document.getElementById('canvasDiv').removeChild(maskcanvas); | |
4388 | + } | |
4319 | 4389 | |
4390 | + //remove modesty canavs | |
4320 | 4391 | var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); |
4321 | - for (var i = 0; i < modestyCanvases.length; i++) { | |
4322 | - modestyCanvases[i].remove(); | |
4392 | + if (modestyCanvases != null || modestyCanvases != undefined && modestyCanvases.length > 0) { | |
4393 | + for (var j = 0; j < modestyCanvases.length; j++) { | |
4394 | + modestyCanvases[j].remove(); | |
4395 | + } | |
4323 | 4396 | } |
4324 | - }); | |
4397 | + } | |
4398 | + } | |
4399 | + | |
4400 | + $scope.terminateCurrentlyRunningWPs = function () { | |
4401 | + if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { | |
4402 | + var workerCount = $scope.runningWorkers.length; | |
4403 | + if (workerCount > 0) { | |
4404 | + for (var i = workerCount - 1; i >= 0; i--) { | |
4405 | + var runningWorker = $scope.runningWorkers[i].workerName; | |
4406 | + runningWorker.terminate(); | |
4407 | + $scope.runningWorkers.splice(i, 1); | |
4408 | + // workerCount--; | |
4409 | + } | |
4410 | + } | |
4411 | + } | |
4325 | 4412 | } |
4326 | 4413 | |
4414 | + | |
4327 | 4415 | $scope.enableHighlight = function () { |
4328 | 4416 | |
4417 | + console.log('enableHighlight is called') | |
4329 | 4418 | if ($rootScope.isHighLight == true) { |
4330 | 4419 | |
4331 | 4420 | } |
... | ... | @@ -4337,16 +4426,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4337 | 4426 | if ($rootScope.isExtract == true) { |
4338 | 4427 | //1. |
4339 | 4428 | $rootScope.isExtract = false; |
4429 | + | |
4340 | 4430 | //2. |
4341 | 4431 | $scope.flushCanvas(); |
4342 | 4432 | |
4343 | - //2. | |
4433 | + //3. | |
4344 | 4434 | $scope.CalculateImageCordinates($scope.viewOrientationId); |
4345 | 4435 | |
4346 | 4436 | |
4347 | 4437 | } |
4348 | 4438 | |
4349 | - //3. | |
4350 | 4439 | |
4351 | 4440 | $timeout(function () { $scope.highLightBody() }, 50); |
4352 | 4441 | |
... | ... | @@ -4386,17 +4475,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4386 | 4475 | |
4387 | 4476 | $scope.enableExtract = function () { |
4388 | 4477 | |
4389 | - if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { | |
4390 | - var workerCount = $scope.runningWorkers.length; | |
4391 | - if (workerCount > 0) { | |
4392 | - for (var i = workerCount - 1; i >= 0; i--) { | |
4393 | - var runningWorker = $scope.runningWorkers[i].workerName; | |
4394 | - runningWorker.terminate(); | |
4395 | - $scope.runningWorkers.splice(i, 1); | |
4396 | - // workerCount--; | |
4397 | - } | |
4398 | - } | |
4399 | - } | |
4478 | + $scope.terminateCurrentlyRunningWPs(); | |
4400 | 4479 | |
4401 | 4480 | if ($rootScope.isExtract == true) { |
4402 | 4481 | |
... | ... | @@ -4427,277 +4506,296 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4427 | 4506 | $('#sppeachBubble').remove(); |
4428 | 4507 | } |
4429 | 4508 | |
4509 | + | |
4510 | + | |
4430 | 4511 | $scope.highLightBody = function () { |
4431 | 4512 | |
4432 | - console.log('highLightBody is called'); | |
4513 | + console.log('highLightBody is called and ColoredImageSRC length: ' + $scope.ColoredImageSRC.length); | |
4433 | 4514 | |
4434 | - if ($rootScope.isHighLight == true) { | |
4435 | 4515 | |
4436 | - $scope.grayeddBR = []; | |
4437 | 4516 | |
4438 | - angular.forEach($scope.ColoredImageSRC, function (value, key) { | |
4439 | - var id; | |
4440 | - if (value.haveMirror == 'true') { | |
4441 | - id = 'imageCanvas' + value.bodyRegionId + '_MR'; | |
4442 | - } | |
4443 | - else { | |
4444 | - id = 'imageCanvas' + value.bodyRegionId; | |
4445 | - } | |
4517 | + $timeout(function () { | |
4518 | + $scope.terminateCurrentlyRunningWPs(); | |
4446 | 4519 | |
4447 | - var imageCanvas = document.getElementById(id); | |
4520 | + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) && $scope.ColoredImageSRC.length == 9) { | |
4448 | 4521 | |
4449 | - //var coloredCanvasID = 'imageCanvas' + bodyRegionId; | |
4450 | - //var coloredCanvas = document.getElementById(coloredCanvasID); | |
4522 | + if ($rootScope.isHighLight == true) { | |
4451 | 4523 | |
4452 | - var width = value.Width; | |
4453 | - var ht = value.Height; | |
4524 | + $scope.grayeddBR = []; | |
4454 | 4525 | |
4455 | - var coloredCanvasContext = imageCanvas.getContext("2d"); | |
4456 | - var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); | |
4457 | - var coloredImageDataVar = coloredImageData; | |
4526 | + angular.forEach($scope.ColoredImageSRC, function (value, key) { | |
4527 | + var id; | |
4528 | + if (value.haveMirror == 'true') { | |
4529 | + id = 'imageCanvas' + value.bodyRegionId + '_MR'; | |
4530 | + } | |
4531 | + else { | |
4532 | + id = 'imageCanvas' + value.bodyRegionId; | |
4533 | + } | |
4458 | 4534 | |
4535 | + var imageCanvas = document.getElementById(id); | |
4459 | 4536 | |
4460 | - if (value.haveMirror == 'true') { | |
4461 | - $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; | |
4462 | - } | |
4463 | - else { | |
4537 | + //var coloredCanvasID = 'imageCanvas' + bodyRegionId; | |
4538 | + //var coloredCanvas = document.getElementById(coloredCanvasID); | |
4464 | 4539 | |
4540 | + var width = value.Width; | |
4541 | + var ht = value.Height; | |
4465 | 4542 | |
4466 | - $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; | |
4543 | + var coloredCanvasContext = imageCanvas.getContext("2d"); | |
4544 | + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); | |
4545 | + var coloredImageDataVar = coloredImageData; | |
4467 | 4546 | |
4468 | - } | |
4469 | 4547 | |
4548 | + if (value.haveMirror == 'true') { | |
4549 | + $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; | |
4550 | + } | |
4551 | + else { | |
4470 | 4552 | |
4471 | - var context_gray = imageCanvas.getContext('2d'); | |
4472 | 4553 | |
4554 | + $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; | |
4473 | 4555 | |
4474 | - var dataURL = imageCanvas.toDataURL(); | |
4556 | + } | |
4475 | 4557 | |
4476 | 4558 | |
4477 | - var img = new Image(); | |
4559 | + var context_gray = imageCanvas.getContext('2d'); | |
4478 | 4560 | |
4479 | - img.src = dataURL; | |
4480 | 4561 | |
4562 | + var dataURL = imageCanvas.toDataURL(); | |
4481 | 4563 | |
4482 | 4564 | |
4483 | - img.onload = function () { | |
4484 | - //console.log(Math.max(img.width) + ', ' + Math.max(img.height)) | |
4565 | + var img = new Image(); | |
4485 | 4566 | |
4486 | - var DAData = new BitmapData(Math.max(img.width), Math.max(img.height)); | |
4487 | - DAData.draw(img); | |
4567 | + img.src = dataURL; | |
4488 | 4568 | |
4489 | - var colorMode; | |
4490 | 4569 | |
4491 | - if ($scope.isExtract == true) { | |
4492 | - colorMode = $scope.applyWhiteMatrix(img, context_gray); | |
4493 | - } | |
4494 | - else { | |
4495 | - colorMode = $scope.applyGrayMatrix(img, context_gray); | |
4496 | - } | |
4497 | 4570 | |
4498 | - var zeroPoint = new Point(); | |
4571 | + img.onload = function () { | |
4572 | + console.log('Before BitmapData call, width: ' + Math.max(img.width) + ', height: ' + Math.max(img.height)) | |
4499 | 4573 | |
4500 | - DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode); | |
4574 | + var DAData = new BitmapData(Math.max(img.width), Math.max(img.height)); | |
4575 | + DAData.draw(img); | |
4501 | 4576 | |
4502 | - context_gray.putImageData(DAData.data, 0, 0) | |
4577 | + var colorMode; | |
4503 | 4578 | |
4504 | - var grayImageData = context_gray.getImageData(0, 0, width, ht); | |
4505 | - var grayImageImageDataVar = grayImageData.data; | |
4579 | + if ($scope.isExtract == true) { | |
4580 | + colorMode = $scope.applyWhiteMatrix(img, context_gray); | |
4581 | + } | |
4582 | + else { | |
4583 | + colorMode = $scope.applyGrayMatrix(img, context_gray); | |
4584 | + } | |
4506 | 4585 | |
4507 | - if ($scope.isExtract == true) { | |
4508 | - if (value.haveMirror == 'true') { | |
4509 | - $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
4510 | - } | |
4511 | - else { | |
4586 | + var zeroPoint = new Point(); | |
4512 | 4587 | |
4513 | - $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
4514 | - } | |
4515 | - } | |
4516 | - else { | |
4588 | + DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode); | |
4517 | 4589 | |
4518 | - if (value.haveMirror == 'true') { | |
4519 | - $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
4520 | - } | |
4521 | - else { | |
4590 | + context_gray.putImageData(DAData.data, 0, 0) | |
4522 | 4591 | |
4523 | - $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
4524 | - } | |
4525 | - } | |
4526 | - } | |
4592 | + //push BRID into array | |
4593 | + $scope.grayeddBR.push({ 'BRID': value.bodyRegionId }); | |
4527 | 4594 | |
4528 | - $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50); | |
4595 | + if ($scope.grayeddBR.length == 9) { | |
4529 | 4596 | |
4597 | + if (($scope.isHighlightBodysystem == true) && ($scope.systemMatchedTermList != null || $scope.systemMatchedTermList != undefined)) { | |
4530 | 4598 | |
4531 | - //if list manager is active and user selected any term then highlight that | |
4532 | - $scope.grayeddBR.push({ 'BRID': value.bodyRegionId }) | |
4599 | + $timeout(function () { $scope.HighlightBodyByTermList($scope.systemMatchedTermList) }, 100); | |
4600 | + } | |
4601 | + else if ($scope.isHighlightByListManager == true) { | |
4533 | 4602 | |
4534 | - if ($scope.grayeddBR.length == 9) { | |
4603 | + console.log('$scope.grayeddBR.length is ' + $scope.grayeddBR.length); | |
4604 | + $timeout(function () { | |
4535 | 4605 | |
4536 | - if (($scope.isHighlightBodysystem == true) && ($scope.systemMatchedTermList != null || $scope.systemMatchedTermList != undefined)) { | |
4606 | + // $rootScope.isHighLight = false; | |
4607 | + //align | |
4608 | + // $scope.aligneCanvasWithTerm(); | |
4537 | 4609 | |
4538 | - $timeout(function () { $scope.HighlightBodyByTermList($scope.systemMatchedTermList) }, 100); | |
4539 | - } | |
4540 | - else if ($scope.isHighlightByListManager == true) { | |
4610 | + $scope.HighlightBodyByTermList($scope.AllTerms) | |
4611 | + }, 800); | |
4541 | 4612 | |
4542 | - console.log('$scope.grayeddBR.length is ' + $scope.grayeddBR.length); | |
4543 | - $timeout(function () { | |
4613 | + } | |
4614 | + } | |
4544 | 4615 | |
4545 | - // $rootScope.isHighLight = false; | |
4546 | - //align | |
4547 | - // $scope.aligneCanvasWithTerm(); | |
4548 | 4616 | |
4549 | - $scope.HighlightBodyByTermList($scope.AllTerms) | |
4550 | - }, 800); | |
4617 | + var grayImageData = context_gray.getImageData(0, 0, width, ht); | |
4618 | + var grayImageImageDataVar = grayImageData.data; | |
4551 | 4619 | |
4552 | - } | |
4553 | - } | |
4620 | + if ($scope.isExtract == true) { | |
4621 | + if (value.haveMirror == 'true') { | |
4622 | + $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
4623 | + } | |
4624 | + else { | |
4554 | 4625 | |
4626 | + $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
4627 | + } | |
4628 | + } | |
4629 | + else { | |
4555 | 4630 | |
4556 | - if ($rootScope.isExtract == true) { | |
4557 | - if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { | |
4631 | + if (value.haveMirror == 'true') { | |
4632 | + $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
4633 | + } | |
4634 | + else { | |
4558 | 4635 | |
4559 | - $timeout(function () { $scope.HighlightBodyOnExtract() }, 50); | |
4560 | - } | |
4561 | - } | |
4562 | - else { | |
4563 | - // 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 | |
4564 | - //and then highlight the previously selected body regions at the time of normal mode. | |
4636 | + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
4637 | + } | |
4638 | + } | |
4639 | + } | |
4565 | 4640 | |
4566 | - if ($scope.grayeddBR.length == 9) { | |
4641 | + $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50); | |
4567 | 4642 | |
4568 | - if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { | |
4569 | 4643 | |
4570 | - var multiTermList = []; | |
4571 | - angular.forEach($rootScope.previousHighlightList, function (value, key) { | |
4644 | + console.log('the value of isHighlightByListManager ' + $scope.isHighlightByListManager); | |
4572 | 4645 | |
4573 | - //debugger; | |
4646 | + console.log('$scope.grayeddBR.length: ' + $scope.grayeddBR.length) | |
4574 | 4647 | |
4575 | - var ActualTermNo = $scope.getActualTermNumber(value); | |
4576 | - if (ActualTermNo != null) { | |
4577 | - var TermList = $scope.getTermNumberList(ActualTermNo); | |
4578 | - if (TermList != null) { | |
4579 | - for (var i = 0; i < TermList.length; i++) { | |
4580 | 4648 | |
4581 | - multiTermList.push(TermList[i]); | |
4582 | - } | |
4583 | - } | |
4584 | - } | |
4585 | 4649 | |
4586 | - }); | |
4587 | 4650 | |
4651 | + if ($rootScope.isExtract == true) { | |
4652 | + if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { | |
4588 | 4653 | |
4589 | - $timeout(function () { $scope.HighlightBodyByTermList(multiTermList) }, 80); | |
4654 | + $timeout(function () { $scope.HighlightBodyOnExtract() }, 50); | |
4655 | + } | |
4590 | 4656 | } |
4657 | + else { | |
4658 | + // 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 | |
4659 | + //and then highlight the previously selected body regions at the time of normal mode. | |
4591 | 4660 | |
4661 | + if ($scope.grayeddBR.length == 9) { | |
4592 | 4662 | |
4593 | - } | |
4594 | - } | |
4595 | - }) | |
4663 | + if (($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined) && $rootScope.previousHighlightList.length > 0) { | |
4596 | 4664 | |
4597 | - } | |
4598 | - else { | |
4599 | - // This code will execute when user will select normal Mode but this time isHighlight will be false | |
4665 | + var multiTermList = []; | |
4666 | + angular.forEach($rootScope.previousHighlightList, function (value, key) { | |
4600 | 4667 | |
4601 | - angular.forEach($scope.ColoredImageSRC, function (value, key) { | |
4602 | - var id; | |
4603 | - if (value.haveMirror == 'true') { | |
4604 | - id = 'imageCanvas' + value.bodyRegionId + '_MR'; | |
4605 | - } | |
4606 | - else { | |
4607 | - id = 'imageCanvas' + value.bodyRegionId; | |
4608 | - } | |
4668 | + //debugger; | |
4669 | + | |
4670 | + var ActualTermNo = $scope.getActualTermNumber(value); | |
4671 | + if (ActualTermNo != null) { | |
4672 | + var TermList = $scope.getTermNumberList(ActualTermNo); | |
4673 | + if (TermList != null) { | |
4674 | + for (var i = 0; i < TermList.length; i++) { | |
4675 | + | |
4676 | + multiTermList.push(TermList[i]); | |
4677 | + } | |
4678 | + } | |
4679 | + } | |
4609 | 4680 | |
4610 | - var imageCanvas = document.getElementById(id); | |
4681 | + }); | |
4611 | 4682 | |
4612 | - //var coloredCanvasID = 'imageCanvas' + bodyRegionId; | |
4613 | - //var coloredCanvas = document.getElementById(coloredCanvasID); | |
4614 | 4683 | |
4615 | - var width = value.Width; | |
4616 | - var ht = value.Height; | |
4684 | + $timeout(function () { $scope.HighlightBodyByTermList(multiTermList) }, 80); | |
4685 | + } | |
4617 | 4686 | |
4618 | - var coloredCanvasContext = imageCanvas.getContext("2d"); | |
4619 | - var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); | |
4620 | - var coloredImageDataVar = coloredImageData; | |
4621 | 4687 | |
4688 | + } | |
4689 | + } | |
4690 | + }) | |
4622 | 4691 | |
4623 | - if (value.haveMirror == 'true') { | |
4624 | - $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; | |
4625 | 4692 | } |
4693 | + | |
4626 | 4694 | else { |
4695 | + // This code will execute when user will select normal Mode but this time isHighlight will be false | |
4627 | 4696 | |
4628 | - $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; | |
4697 | + angular.forEach($scope.ColoredImageSRC, function (value, key) { | |
4698 | + var id; | |
4699 | + if (value.haveMirror == 'true') { | |
4700 | + id = 'imageCanvas' + value.bodyRegionId + '_MR'; | |
4701 | + } | |
4702 | + else { | |
4703 | + id = 'imageCanvas' + value.bodyRegionId; | |
4704 | + } | |
4629 | 4705 | |
4630 | - } | |
4706 | + var imageCanvas = document.getElementById(id); | |
4631 | 4707 | |
4708 | + //var coloredCanvasID = 'imageCanvas' + bodyRegionId; | |
4709 | + //var coloredCanvas = document.getElementById(coloredCanvasID); | |
4632 | 4710 | |
4633 | - var context_white = imageCanvas.getContext('2d'); | |
4711 | + var width = value.Width; | |
4712 | + var ht = value.Height; | |
4634 | 4713 | |
4714 | + var coloredCanvasContext = imageCanvas.getContext("2d"); | |
4715 | + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); | |
4716 | + var coloredImageDataVar = coloredImageData; | |
4635 | 4717 | |
4636 | - var dataURL = imageCanvas.toDataURL(); | |
4637 | 4718 | |
4719 | + if (value.haveMirror == 'true') { | |
4720 | + $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar; | |
4721 | + } | |
4722 | + else { | |
4638 | 4723 | |
4639 | - var img = new Image(); | |
4724 | + $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; | |
4640 | 4725 | |
4641 | - img.src = dataURL; | |
4726 | + } | |
4642 | 4727 | |
4643 | 4728 | |
4729 | + var context = imageCanvas.getContext('2d'); | |
4644 | 4730 | |
4645 | - img.onload = function () { | |
4646 | - //console.log(Math.max(img.width) + ', ' + Math.max(img.height)) | |
4647 | 4731 | |
4648 | - var DAData = new BitmapData(Math.max(img.width), Math.max(img.height)); | |
4649 | - DAData.draw(img); | |
4732 | + var dataURL = imageCanvas.toDataURL(); | |
4650 | 4733 | |
4651 | - var colorMode; | |
4652 | 4734 | |
4653 | - if ($scope.isExtract == true) { | |
4654 | - colorMode = $scope.applyWhiteMatrix(img, context_white); | |
4655 | - } | |
4735 | + var img = new Image(); | |
4656 | 4736 | |
4657 | - var zeroPoint = new Point(); | |
4737 | + img.src = dataURL; | |
4658 | 4738 | |
4659 | - DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode); | |
4660 | 4739 | |
4661 | - context_white.putImageData(DAData.data, 0, 0) | |
4662 | 4740 | |
4663 | - var grayImageData = context_white.getImageData(0, 0, width, ht); | |
4664 | - var grayImageImageDataVar = grayImageData.data; | |
4741 | + img.onload = function () { | |
4742 | + //console.log(Math.max(img.width) + ', ' + Math.max(img.height)) | |
4665 | 4743 | |
4666 | - if ($scope.isExtract == true) { | |
4667 | - if (value.haveMirror == 'true') { | |
4668 | - $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
4669 | - } | |
4670 | - else { | |
4744 | + var DAData = new BitmapData(Math.max(img.width), Math.max(img.height)); | |
4745 | + DAData.draw(img); | |
4671 | 4746 | |
4672 | - $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
4673 | - } | |
4674 | - } | |
4675 | - else { | |
4747 | + var colorMode; | |
4676 | 4748 | |
4677 | - if (value.haveMirror == 'true') { | |
4678 | - $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
4679 | - } | |
4680 | - else { | |
4749 | + if ($scope.isExtract == true) { | |
4750 | + colorMode = $scope.applyWhiteMatrix(img, context); | |
4751 | + } | |
4752 | + | |
4753 | + var zeroPoint = new Point(); | |
4754 | + | |
4755 | + DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode); | |
4756 | + | |
4757 | + context.putImageData(DAData.data, 0, 0) | |
4758 | + | |
4759 | + var grayImageData = context.getImageData(0, 0, width, ht); | |
4760 | + var grayImageImageDataVar = grayImageData.data; | |
4761 | + | |
4762 | + if ($scope.isExtract == true) { | |
4763 | + if (value.haveMirror == 'true') { | |
4764 | + $rootScope.whiteImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
4765 | + } | |
4766 | + else { | |
4767 | + | |
4768 | + $rootScope.whiteImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
4769 | + } | |
4770 | + } | |
4771 | + else { | |
4772 | + | |
4773 | + if (value.haveMirror == 'true') { | |
4774 | + $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData; | |
4775 | + } | |
4776 | + else { | |
4681 | 4777 | |
4682 | - $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
4778 | + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData; | |
4779 | + } | |
4780 | + } | |
4683 | 4781 | } |
4684 | - } | |
4685 | - } | |
4686 | 4782 | |
4687 | - $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50); | |
4688 | - }) | |
4783 | + $timeout(function () { imageCanvas.style.visibility = 'visible' }, 50); | |
4784 | + }) | |
4689 | 4785 | |
4690 | - if ($rootScope.isExtract == true) { | |
4691 | - if ($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined || $rootScope.previousHighlightList.length > 0) { | |
4692 | - angular.forEach($rootScope.previousHighlightList, function (value, key) { | |
4693 | - $timeout(function () { $scope.HighlightBodyOnExtract(value) }, 50); | |
4786 | + if ($rootScope.isExtract == true) { | |
4787 | + if ($rootScope.previousHighlightList != null || $rootScope.previousHighlightList != undefined || $rootScope.previousHighlightList.length > 0) { | |
4788 | + angular.forEach($rootScope.previousHighlightList, function (value, key) { | |
4789 | + $timeout(function () { $scope.HighlightBodyOnExtract(value) }, 50); | |
4790 | + | |
4791 | + // to do | |
4792 | + }); | |
4793 | + } | |
4794 | + } | |
4694 | 4795 | |
4695 | - // to do | |
4696 | - }); | |
4697 | 4796 | } |
4698 | 4797 | } |
4699 | - | |
4700 | - } | |
4798 | + }, 1000) | |
4701 | 4799 | } |
4702 | 4800 | |
4703 | 4801 | |
... | ... | @@ -4790,7 +4888,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4790 | 4888 | $scope.loadSelectedBodyView(currentBodyViewId); |
4791 | 4889 | |
4792 | 4890 | //3. |
4793 | - $scope.loadSelectedBodyViewNavigator(currentBodyViewId); | |
4891 | + // $scope.loadSelectedBodyViewNavigator(currentBodyViewId); | |
4794 | 4892 | |
4795 | 4893 | |
4796 | 4894 | $('#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 |
4806 | 4904 | $scope.loadSelectedBodyView(currentBodyViewId); |
4807 | 4905 | |
4808 | 4906 | //2. |
4809 | - $scope.loadSelectedBodyViewNavigator(currentBodyViewId); | |
4907 | + // $scope.loadSelectedBodyViewNavigator(currentBodyViewId); | |
4810 | 4908 | |
4811 | 4909 | //3. |
4812 | 4910 | $('#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 |
4838 | 4936 | |
4839 | 4937 | console.log('terminate worker process') |
4840 | 4938 | //terminate previous running workers to create space for new workers |
4841 | - if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { | |
4842 | - var workerCount = $scope.runningWorkers.length; | |
4843 | - if (workerCount > 0) { | |
4844 | - for (var i = workerCount - 1; i >= 0; i--) { | |
4845 | - var runningWorker = $scope.runningWorkers[i].workerName; | |
4846 | - runningWorker.terminate(); | |
4847 | - $scope.runningWorkers.splice(i, 1); | |
4848 | - // workerCount--; | |
4849 | - } | |
4850 | - } | |
4851 | - } | |
4939 | + $scope.terminateCurrentlyRunningWPs(); | |
4852 | 4940 | |
4853 | 4941 | $rootScope.isLoading = false; |
4854 | 4942 | $('#spinner').css('visibility', 'hidden'); |
... | ... | @@ -4927,7 +5015,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4927 | 5015 | $scope.loadSelectedBodyView($rootScope.voId); |
4928 | 5016 | |
4929 | 5017 | //2. load corresponding navigator man |
4930 | - $scope.loadSelectedBodyViewNavigator($rootScope.voId); | |
5018 | + // $scope.loadSelectedBodyViewNavigator($rootScope.voId); | |
4931 | 5019 | |
4932 | 5020 | }; |
4933 | 5021 | |
... | ... | @@ -4953,7 +5041,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
4953 | 5041 | $scope.loadSelectedBodyView($rootScope.voId); |
4954 | 5042 | |
4955 | 5043 | //2. |
4956 | - $scope.loadSelectedBodyViewNavigator($rootScope.voId); | |
5044 | + // $scope.loadSelectedBodyViewNavigator($rootScope.voId); | |
4957 | 5045 | }; |
4958 | 5046 | |
4959 | 5047 | |
... | ... | @@ -5422,7 +5510,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
5422 | 5510 | |
5423 | 5511 | $scope.HighlightBodyOnListManagerSelection = function (event) { |
5424 | 5512 | |
5425 | - | |
5513 | + $scope.terminateCurrentlyRunningWPs(); | |
5426 | 5514 | //debugger |
5427 | 5515 | $rootScope.isListManagerSelected = true; |
5428 | 5516 | $rootScope.isLoading = true; |
... | ... | @@ -5514,43 +5602,44 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
5514 | 5602 | $('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.layerNumber)); |
5515 | 5603 | |
5516 | 5604 | //8.remove current layer canavses |
5517 | - for (var i = 1; i < 7; i++) { | |
5605 | + $scope.flushCanvas(); | |
5606 | + //for (var i = 1; i < 7; i++) { | |
5518 | 5607 | |
5519 | - var id; | |
5520 | - var maskId; | |
5608 | + // var id; | |
5609 | + // var maskId; | |
5521 | 5610 | |
5522 | - id = 'imageCanvas' + i; | |
5523 | - maskId = 'imageCanvas' + i + '_mci'; | |
5611 | + // id = 'imageCanvas' + i; | |
5612 | + // maskId = 'imageCanvas' + i + '_mci'; | |
5524 | 5613 | |
5525 | - var canvas = document.getElementById(id); | |
5526 | - document.getElementById('canvasDiv').removeChild(canvas); | |
5614 | + // var canvas = document.getElementById(id); | |
5615 | + // document.getElementById('canvasDiv').removeChild(canvas); | |
5527 | 5616 | |
5528 | - var maskcanvas = document.getElementById(maskId); | |
5529 | - document.getElementById('canvasDiv').removeChild(maskcanvas); | |
5617 | + // var maskcanvas = document.getElementById(maskId); | |
5618 | + // document.getElementById('canvasDiv').removeChild(maskcanvas); | |
5530 | 5619 | |
5531 | - if (i == 4 || i == 5 || i == 6) { | |
5532 | - id = 'imageCanvas' + i + '_MR'; | |
5533 | - maskId = 'imageCanvas' + i + '_MR_mci'; | |
5620 | + // if (i == 4 || i == 5 || i == 6) { | |
5621 | + // id = 'imageCanvas' + i + '_MR'; | |
5622 | + // maskId = 'imageCanvas' + i + '_MR_mci'; | |
5534 | 5623 | |
5535 | - var canvas = document.getElementById(id); | |
5536 | - document.getElementById('canvasDiv').removeChild(canvas); | |
5624 | + // var canvas = document.getElementById(id); | |
5625 | + // document.getElementById('canvasDiv').removeChild(canvas); | |
5537 | 5626 | |
5538 | - var maskcanvas = document.getElementById(maskId); | |
5539 | - document.getElementById('canvasDiv').removeChild(maskcanvas); | |
5540 | - } | |
5627 | + // var maskcanvas = document.getElementById(maskId); | |
5628 | + // document.getElementById('canvasDiv').removeChild(maskcanvas); | |
5629 | + // } | |
5541 | 5630 | |
5542 | - //remove modesty canavs | |
5543 | - var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); | |
5544 | - for (var j = 0; j < modestyCanvases.length; j++) { | |
5545 | - modestyCanvases[j].remove(); | |
5546 | - } | |
5547 | - } | |
5631 | + // //remove modesty canavs | |
5632 | + // var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); | |
5633 | + // for (var j = 0; j < modestyCanvases.length; j++) { | |
5634 | + // modestyCanvases[j].remove(); | |
5635 | + // } | |
5636 | + //} | |
5548 | 5637 | |
5549 | 5638 | //9. |
5550 | 5639 | $timeout(function () { |
5551 | 5640 | $rootScope.isHighLight = false; |
5552 | 5641 | $scope.CalculateImageCordinates($scope.viewOrientationId) |
5553 | - }, 10); | |
5642 | + }, 1000); | |
5554 | 5643 | |
5555 | 5644 | $scope.isHighlightByListManager = true; |
5556 | 5645 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html
... | ... | @@ -123,22 +123,22 @@ |
123 | 123 | </div> |
124 | 124 | <div class="col-sm-6 dropdown hover-tool"> |
125 | 125 | <div class="custom-tooltip">Highlight Options</div> |
126 | - <button class="btn btn-black btn-sm pull-right marginTop5 dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" ng-click="LoadBodySystemData()"><img src="content/images/icon-highlight.png" alt="" title=""></button> | |
126 | + <button class="btn btn-black btn-sm pull-right marginTop5 dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" ng-click="LoadBodySystemData()" ><img src="content/images/icon-highlight.png" alt="" title=""></button> | |
127 | 127 | <ul class="dropdown-menu" aria-labelledby="dropdownMenu2"> |
128 | 128 | <li><a href="#" title="Current Structure">Current Structure</a></li> |
129 | 129 | <li role="separator" class="divider"></li> |
130 | 130 | <li><a href="#" title="Cardiovascular" id="1" ng-click="HighlightBodysystem($event)">Cardiovascular</a></li> |
131 | - <li><a href="#" title="Digestive" id="2" ng-click="HighlightBodysystem($event)">Digestive</a></li> | |
132 | - <li><a href="#" title="Endocrine" id="3" ng-click="HighlightBodysystem($event)">Endocrine</a></li> | |
133 | - <li><a href="#" title="Immune" id="4" ng-click="HighlightBodysystem($event)">Immune</a></li> | |
134 | - <li><a href="#" title="Integumentary" id="5" ng-click="HighlightBodysystem($event)">Integumentary</a></li> | |
135 | - <li><a href="#" title="Lymphatic" id="6" ng-click="HighlightBodysystem($event)">Lymphatic</a></li> | |
136 | - <li><a href="#" title="Muscular" id="7" ng-click="HighlightBodysystem($event)">Muscular</a></li> | |
137 | - <li><a href="#" title="Nervous" id="8" ng-click="HighlightBodysystem($event)">Nervous</a></li> | |
138 | - <li><a href="#" title="Reproductive" id="9" ng-click="HighlightBodysystem($event)">Reproductive</a></li> | |
139 | - <li><a href="#" title="Respiratory" id="10" ng-click="HighlightBodysystem($event)">Respiratory</a></li> | |
140 | - <li><a href="#" title="Skeletal" id="11" ng-click="HighlightBodysystem($event)">Skeletal</a></li> | |
141 | - <li><a href="#" title="Urinary" id="12" ng-click="HighlightBodysystem($event)">Urinary</a></li> | |
131 | + <li><a href="#" title="Digestive" id="2" ng-click="HighlightBodysystem($event)" >Digestive</a></li> | |
132 | + <li><a href="#" title="Endocrine" id="3" ng-click="HighlightBodysystem($event)" >Endocrine</a></li> | |
133 | + <li><a href="#" title="Immune" id="4" ng-click="HighlightBodysystem($event)" >Immune</a></li> | |
134 | + <li><a href="#" title="Integumentary" id="5" ng-click="HighlightBodysystem($event)" >Integumentary</a></li> | |
135 | + <li><a href="#" title="Lymphatic" id="6" ng-click="HighlightBodysystem($event)" >Lymphatic</a></li> | |
136 | + <li><a href="#" title="Muscular" id="7" ng-click="HighlightBodysystem($event)" >Muscular</a></li> | |
137 | + <li><a href="#" title="Nervous" id="8" ng-click="HighlightBodysystem($event)" >Nervous</a></li> | |
138 | + <li><a href="#" title="Reproductive" id="9" ng-click="HighlightBodysystem($event)" >Reproductive</a></li> | |
139 | + <li><a href="#" title="Respiratory" id="10" ng-click="HighlightBodysystem($event)" >Respiratory</a></li> | |
140 | + <li><a href="#" title="Skeletal" id="11" ng-click="HighlightBodysystem($event)" >Skeletal</a></li> | |
141 | + <li><a href="#" title="Urinary" id="12" ng-click="HighlightBodysystem($event)" >Urinary</a></li> | |
142 | 142 | </ul> |
143 | 143 | </div> |
144 | 144 | <div class="col-sm-6 hover-gender-tool" ng-init="switchGender()"> |
... | ... | @@ -167,7 +167,7 @@ |
167 | 167 | </div> |
168 | 168 | <div class=""> |
169 | 169 | <p> |
170 | - <input type="number" id="txtlayerNumber" value="0" step="1" min="0" style="width:80px; margin:10px 0 0 15px;" ng-model="layerNumber" ng-change="LayerChange()"> | |
170 | + <input type="number" id="txtlayerNumber" value="0" step="1" min="0" style="width:80px; margin:10px 0 0 15px;" ng-model="layerNumber" ng-change="LayerChange()" /> | |
171 | 171 | </p> |
172 | 172 | <div id="layerChangeSlider" style="height:140px;" class="vert_slider " ng-model="layerNumber"></div> |
173 | 173 | </div> |
... | ... | @@ -179,8 +179,8 @@ |
179 | 179 | <div class=""> |
180 | 180 | <div class="input-group col-sm-8 col-xs-7 col-md-10 pull-left"> |
181 | 181 | |
182 | - <input type="text" class="form-control input-sm pull-left" id="typedtermname" ng-init="loadSearchDataForBodyView()" ng-blur="HideSearch()" ng-click="ShowSearch()" ng-model="searchFilter" ng-change="textChange(searchFilter)" placeholder="Search..."> | |
183 | - | |
182 | + <input type="text" class="form-control input-sm pull-left" id="typedtermname" ng-blur="HideSearch()" ng-click="ShowSearch()" ng-dblclick="ShowSearch()" ng-model="searchFilter" ng-change="textChange(searchFilter)" placeholder="Search..."> | |
183 | + | |
184 | 184 | <div id="backdrop" ng-show="IsSearchVisible"> |
185 | 185 | <div class="col-sm-12 col-xs-12 col-md-12 col-lg-12 pull-left"> |
186 | 186 | <ul id="termlistfilter" class="form-control dropdown-menu" style="height:100px;width:100%;overflow-y:scroll;position:absolute;display:none;z-index:1000;"> | ... | ... |