Commit 343b9e46435d37088dae81ed9d957dc0cd0b541c
Merge branch 'highlightTermPOC' into Develop
Showing
1 changed file
with
118 additions
and
105 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -46,6 +46,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -46,6 +46,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
46 | $rootScope.coloredImageMRCanvasList = []; | 46 | $rootScope.coloredImageMRCanvasList = []; |
47 | $rootScope.ColoredCanvasData = []; | 47 | $rootScope.ColoredCanvasData = []; |
48 | $rootScope.grayImageDataList = []; | 48 | $rootScope.grayImageDataList = []; |
49 | + | ||
50 | + $rootScope.rawGrayImageDataList = []; | ||
51 | + | ||
49 | $rootScope.grayImageMRDataList = []; | 52 | $rootScope.grayImageMRDataList = []; |
50 | $rootScope.updatedGrayDataList = []; | 53 | $rootScope.updatedGrayDataList = []; |
51 | $rootScope.updatedGrayMRDataList = []; | 54 | $rootScope.updatedGrayMRDataList = []; |
@@ -2646,71 +2649,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -2646,71 +2649,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
2646 | 2649 | ||
2647 | if ($scope.layerNumber == 224) | 2650 | if ($scope.layerNumber == 224) |
2648 | { | 2651 | { |
2649 | - //debugger; | ||
2650 | - | ||
2651 | - //var matchedTermListPath = '~/../content/data/json/da/body-views/1/bodyLayers-CardioVascular.json'; | ||
2652 | - | ||
2653 | - //DataService.getJson(matchedTermListPath) | ||
2654 | - //.then( | ||
2655 | - // function (result) | ||
2656 | - // { | ||
2657 | - // $rootScope.macthedTermList = result; | ||
2658 | - // var termNo=0; | ||
2659 | - // var pixcelLocation = 0; | ||
2660 | - | ||
2661 | - // if ($rootScope.macthedTermList.length > 0) { | ||
2662 | - // angular.forEach($rootScope.macthedTermList, function (value, key) { | ||
2663 | - | ||
2664 | - // debugger; | ||
2665 | - | ||
2666 | - // var TermExistInBodyRegionId = value.bodyRegionId; | ||
2667 | - // var grayImageDataVar = $rootScope.grayImageDataList[TermExistInBodyRegionId - 1]; | ||
2668 | - // var coloredImageDataVar = $rootScope.coloredImageCanvasList[TermExistInBodyRegionId - 1]; | ||
2669 | - | ||
2670 | - // var grayImageDataValue = grayImageDataVar.data; | ||
2671 | - // var coloredImageDataValue = coloredImageDataVar.data; | ||
2672 | - | ||
2673 | - // $rootScope.termListWithLocation = value.terms; | ||
2674 | - | ||
2675 | - // angular.forEach($rootScope.termListWithLocation[0].PixelLocations, function (value1, key1) | ||
2676 | - // { | ||
2677 | - // //debugger; | ||
2678 | - | ||
2679 | - // var coloredImageData = coloredImageDataValue[value1]; | ||
2680 | - // grayImageDataValue[value1] = coloredImageData; | ||
2681 | - | ||
2682 | - | ||
2683 | - // }) | ||
2684 | - | ||
2685 | - // var grayCanvasID = 'imageCanvas' + TermExistInBodyRegionId; | ||
2686 | - // var grayCanvas = document.getElementById(grayCanvasID); | ||
2687 | - // if (grayCanvas != null) | ||
2688 | - // { | ||
2689 | - // debugger; | ||
2690 | - // var grayCanvasContext = grayCanvas.getContext("2d"); | ||
2691 | - | ||
2692 | - // var canvasHeight = grayCanvas.height + 'px'; | ||
2693 | - // var canvasWidth = grayCanvas.width + 'px'; | ||
2694 | - // grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth) | ||
2695 | - | ||
2696 | - // grayCanvasContext.putImageData(grayImageDataVar, 0, 0); | ||
2697 | - | ||
2698 | - | ||
2699 | - // } | ||
2700 | - // $('#spinner').css('visibility', 'hidden') | ||
2701 | - // $rootScope.isLoading = false; | ||
2702 | - | ||
2703 | - // }) | ||
2704 | - // } | ||
2705 | - | ||
2706 | - | ||
2707 | - | ||
2708 | - // }, | ||
2709 | - // function (error) { | ||
2710 | - // console.log(' Error in getting term data = ' + error.statusText); | ||
2711 | - | ||
2712 | - // }); | ||
2713 | - | ||
2714 | } | 2652 | } |
2715 | else { | 2653 | else { |
2716 | 2654 | ||
@@ -2846,71 +2784,144 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -2846,71 +2784,144 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
2846 | } | 2784 | } |
2847 | }, 100) | 2785 | }, 100) |
2848 | 2786 | ||
2787 | + | ||
2788 | + } | ||
2789 | + | ||
2790 | + | ||
2791 | + | ||
2792 | + $scope.HighlightBodyByTermListForBodySystem = function (TermList) { | ||
2793 | + | ||
2794 | + $("#btnTranparency").attr('disabled', 'disabled'); | ||
2795 | + $scope.currentLayerNumber = $scope.layerNumber; | ||
2796 | + | ||
2797 | + $scope.layerNumber = $('#txtlayerNumber').val(); | ||
2798 | + | ||
2799 | + $rootScope.isLoading = true; | ||
2800 | + $('#spinner').css('visibility', 'visible'); | ||
2801 | + | ||
2802 | + | ||
2803 | + if ($rootScope.isHighLight == true) { | ||
2804 | + false; | ||
2805 | + } | ||
2806 | + | ||
2807 | + console.log('HighlightBodyByTermList is called'); | ||
2808 | + | ||
2809 | + $scope.highlightedBR = []; | ||
2810 | + | ||
2849 | if ($scope.layerNumber == 224) { | 2811 | if ($scope.layerNumber == 224) { |
2850 | - // debugger; | ||
2851 | 2812 | ||
2852 | var matchedTermListPath = '~/../content/data/json/da/body-views/1/BodySystem_' + $rootScope.systemNumber + '.json'; | 2813 | var matchedTermListPath = '~/../content/data/json/da/body-views/1/BodySystem_' + $rootScope.systemNumber + '.json'; |
2853 | - | 2814 | + var grayImageDataVar = null; |
2815 | + | ||
2854 | DataService.getJson(matchedTermListPath) | 2816 | DataService.getJson(matchedTermListPath) |
2855 | .then( | 2817 | .then( |
2856 | function (result) { | 2818 | function (result) { |
2857 | $rootScope.macthedTermList = result; | 2819 | $rootScope.macthedTermList = result; |
2858 | var termNo = 0; | 2820 | var termNo = 0; |
2859 | var pixcelLocation = 0; | 2821 | var pixcelLocation = 0; |
2860 | - | 2822 | + var prevBRID = 0; |
2861 | if ($rootScope.macthedTermList.length > 0) { | 2823 | if ($rootScope.macthedTermList.length > 0) { |
2862 | 2824 | ||
2863 | - | 2825 | + for(var i=0; i<$rootScope.grayImageDataList.length;i++){ |
2826 | + var grayCanvasID = 'imageCanvas' + parseInt(i+1); | ||
2827 | + var grayCanvas = document.getElementById(grayCanvasID); | ||
2828 | + | ||
2829 | + if (grayCanvas != null) { | ||
2830 | + var grayCanvasContext = grayCanvas.getContext("2d"); | ||
2831 | + | ||
2832 | + var canvasHeight = grayCanvas.height; | ||
2833 | + var canvasWidth = grayCanvas.width; | ||
2834 | + grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth) | ||
2835 | + grayCanvasContext.putImageData($rootScope.grayImageDataList[parseInt(i)], 0, 0); | ||
2836 | + } | ||
2837 | + } | ||
2838 | + for (var i = 4; i <= $rootScope.grayImageMRDataList.length; i++) { | ||
2839 | + var grayCanvasMRID = 'imageCanvas' + i+'_MR'; | ||
2840 | + var grayCanvasMR = document.getElementById(grayCanvasMRID); | ||
2841 | + | ||
2842 | + if (grayCanvasMR != null) { | ||
2843 | + var grayCanvasContextMR = grayCanvasMR.getContext("2d"); | ||
2844 | + | ||
2845 | + var canvasHeight = grayCanvasMR.height; | ||
2846 | + var canvasWidth = grayCanvasMR.width; | ||
2847 | + grayCanvasContextMR.clearRect(0, 0, canvasHeight, canvasWidth) | ||
2848 | + grayCanvasContextMR.putImageData($rootScope.grayImageMRDataList[parseInt(i)], 0, 0); | ||
2849 | + } | ||
2850 | + } | ||
2864 | 2851 | ||
2865 | angular.forEach($rootScope.macthedTermList, function (value, key) { | 2852 | angular.forEach($rootScope.macthedTermList, function (value, key) { |
2866 | - // debugger; | ||
2867 | - var TermExistInBodyRegionId = value.bodyRegionId; | ||
2868 | 2853 | ||
2869 | - | ||
2870 | - var grayImageDataVar = $rootScope.grayImageDataList[parseInt(TermExistInBodyRegionId) - 1]; | ||
2871 | - | ||
2872 | - var coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(TermExistInBodyRegionId) - 1]; | ||
2873 | 2854 | ||
2874 | - var grayImageDataValue = grayImageDataVar.data; | ||
2875 | - var coloredImageDataValue = coloredImageDataVar.data; | 2855 | + var TermExistInBodyRegionId = value.bodyRegionId; |
2876 | 2856 | ||
2877 | - $rootScope.termListWithLocation = value.terms; | 2857 | + if (prevBRID != TermExistInBodyRegionId) { |
2858 | + var grayCanvasID = 'imageCanvas' + TermExistInBodyRegionId; | ||
2859 | + var grayCanvas = document.getElementById(grayCanvasID); | ||
2860 | + | ||
2861 | + if (grayCanvas != null) { | ||
2862 | + var grayCanvasContext = grayCanvas.getContext("2d"); | ||
2878 | 2863 | ||
2879 | - angular.forEach($rootScope.termListWithLocation.PixelLocations, function (value1, key1) { | ||
2880 | - //debugger; | 2864 | + var canvasHeight = grayCanvas.height; |
2865 | + var canvasWidth = grayCanvas.width; | ||
2866 | + grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth) | ||
2867 | + grayCanvasContext.putImageData($rootScope.grayImageDataList[parseInt(TermExistInBodyRegionId) - 1], 0, 0); | ||
2881 | 2868 | ||
2882 | - var RED = coloredImageDataValue[value1]; | ||
2883 | - var GREEN = coloredImageDataValue[value1 + 1]; | ||
2884 | - var BLUE = coloredImageDataValue[value1 + 2]; | 2869 | + var gData = grayCanvasContext.getImageData(0, 0, canvasWidth,canvasHeight ) |
2885 | 2870 | ||
2886 | - grayImageDataValue[value1] = RED; | ||
2887 | - grayImageDataValue[value1+1] = GREEN; | ||
2888 | - grayImageDataValue[value1+2] = BLUE; | ||
2889 | - }) | 2871 | + grayImageDataVar = null; |
2872 | + var macthedData = new jinqJs() | ||
2873 | + .from($rootScope.macthedTermList) | ||
2874 | + .where('bodyRegionId == ' + TermExistInBodyRegionId) | ||
2875 | + .select(); | ||
2890 | 2876 | ||
2891 | - var grayCanvasID = 'imageCanvas' + TermExistInBodyRegionId; | ||
2892 | - var grayCanvas = document.getElementById(grayCanvasID); | ||
2893 | - if (grayCanvas != null) { | ||
2894 | - debugger; | ||
2895 | - var grayCanvasContext = grayCanvas.getContext("2d"); | 2877 | + //grayImageDataVar = $rootScope.grayImageDataList[parseInt(TermExistInBodyRegionId) - 1] |
2878 | + | ||
2879 | + | ||
2880 | + var coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(TermExistInBodyRegionId) - 1]; | ||
2896 | 2881 | ||
2897 | - //var canvasHeight = grayCanvas.height + 'px'; | ||
2898 | - //var canvasWidth = grayCanvas.width + 'px'; | 2882 | + var grayImageDataValue = gData.data; |
2883 | + var coloredImageDataValue = coloredImageDataVar.data; | ||
2899 | 2884 | ||
2885 | + // $rootScope.termListWithLocation = value.terms; | ||
2900 | 2886 | ||
2901 | - var canvasHeight = grayCanvas.height; | ||
2902 | - var canvasWidth = grayCanvas.width; | 2887 | + angular.forEach(macthedData, function (value2, key) { |
2888 | + $rootScope.termListWithLocation = value2.terms; | ||
2889 | + angular.forEach($rootScope.termListWithLocation.PixelLocations, function (value1, key1) { | ||
2903 | 2890 | ||
2904 | - grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth) | 2891 | + var RED = coloredImageDataValue[value1]; |
2892 | + var GREEN = coloredImageDataValue[value1 + 1]; | ||
2893 | + var BLUE = coloredImageDataValue[value1 + 2]; | ||
2905 | 2894 | ||
2906 | - grayCanvasContext.putImageData(grayImageDataVar, 0, 0); | 2895 | + grayImageDataValue[value1] = RED; |
2896 | + grayImageDataValue[value1 + 1] = GREEN; | ||
2897 | + grayImageDataValue[value1 + 2] = BLUE; | ||
2898 | + }) | ||
2907 | 2899 | ||
2900 | + var grayCanvasID = 'imageCanvas' + TermExistInBodyRegionId; | ||
2901 | + var grayCanvas = document.getElementById(grayCanvasID); | ||
2902 | + if (grayCanvas != null) { | ||
2903 | + var grayCanvasContext = grayCanvas.getContext("2d"); | ||
2908 | 2904 | ||
2909 | - } | ||
2910 | - $('#spinner').css('visibility', 'hidden') | ||
2911 | - $rootScope.isLoading = false; | 2905 | + var canvasHeight = grayCanvas.height; |
2906 | + var canvasWidth = grayCanvas.width; | ||
2907 | + | ||
2908 | + //grayCanvasContext.clearRect(0, 0, canvasHeight, canvasWidth) | ||
2909 | + | ||
2910 | + grayCanvasContext.putImageData(gData, 0, 0); | ||
2911 | + | ||
2912 | + // grayCanvasContext.putImageData($rootScope.rawGrayImageDataList[parseInt(TermExistInBodyRegionId) - 1], 0, 0); | ||
2912 | 2913 | ||
2914 | + | ||
2915 | + } | ||
2916 | + $('#spinner').css('visibility', 'hidden') | ||
2917 | + $rootScope.isLoading = false; | ||
2918 | + | ||
2919 | + prevBRID = TermExistInBodyRegionId; | ||
2920 | + }) | ||
2921 | + } | ||
2922 | + } | ||
2913 | }) | 2923 | }) |
2924 | + | ||
2914 | } | 2925 | } |
2915 | 2926 | ||
2916 | 2927 | ||
@@ -2925,7 +2936,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -2925,7 +2936,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
2925 | } | 2936 | } |
2926 | 2937 | ||
2927 | 2938 | ||
2928 | - | ||
2929 | $scope.createTermListByPreviousTermsAndHighlight = function () { | 2939 | $scope.createTermListByPreviousTermsAndHighlight = function () { |
2930 | 2940 | ||
2931 | 2941 | ||
@@ -6922,7 +6932,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -6922,7 +6932,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
6922 | $scope.isLoading = true; | 6932 | $scope.isLoading = true; |
6923 | 6933 | ||
6924 | $('#spinner').css('visibility', 'visible'); | 6934 | $('#spinner').css('visibility', 'visible'); |
6925 | - $timeout(function () { $scope.HighlightBodyByTermList($scope.systemMatchedTermList) }, 100); | 6935 | + $timeout(function () { $scope.HighlightBodyByTermListForBodySystem($scope.systemMatchedTermList) }, 100); |
6926 | } | 6936 | } |
6927 | else if (($rootScope.isListManagerSelected == true) || ($rootScope.previousHighlightList != null && $rootScope.previousHighlightList.length > 0) && ($rootScope.isGenderChnage == true || $rootScope.isViewChange == true) || $rootScope.isListManagerAlreadySelected == true) { | 6937 | else if (($rootScope.isListManagerSelected == true) || ($rootScope.previousHighlightList != null && $rootScope.previousHighlightList.length > 0) && ($rootScope.isGenderChnage == true || $rootScope.isViewChange == true) || $rootScope.isListManagerAlreadySelected == true) { |
6928 | 6938 | ||
@@ -7808,7 +7818,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -7808,7 +7818,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
7808 | $scope.isLoading = true; | 7818 | $scope.isLoading = true; |
7809 | 7819 | ||
7810 | $('#spinner').css('visibility', 'visible'); | 7820 | $('#spinner').css('visibility', 'visible'); |
7811 | - $timeout(function () { $scope.HighlightBodyByTermList($scope.systemMatchedTermList) }, 100); | 7821 | + $timeout(function () { $scope.HighlightBodyByTermListForBodySystem($scope.systemMatchedTermList) }, 100); |
7812 | } | 7822 | } |
7813 | } | 7823 | } |
7814 | } | 7824 | } |
@@ -8872,7 +8882,10 @@ function OnViewChange(event) { | @@ -8872,7 +8882,10 @@ function OnViewChange(event) { | ||
8872 | function OnBodySystemSelection(event) { | 8882 | function OnBodySystemSelection(event) { |
8873 | console.log('OnBodySystem chnaged is called outside '); | 8883 | console.log('OnBodySystem chnaged is called outside '); |
8874 | var scope = angular.element(document.getElementById("daView")).scope(); | 8884 | var scope = angular.element(document.getElementById("daView")).scope(); |
8875 | - scope.$apply(function () { | 8885 | + |
8886 | + | ||
8887 | + scope.$apply(function () | ||
8888 | + { | ||
8876 | scope.HighlightBodyByBodySystem(event); | 8889 | scope.HighlightBodyByBodySystem(event); |
8877 | }); | 8890 | }); |
8878 | } | 8891 | } |