Commit cdb74fb642bf667ab5f514d37fa48341056f444c

Authored by Amrita Vishnoi
1 parent fcaafcc9

Refs: #4464

Feature Implemented:
Maintained previous highlight without annotation.
150-DOCUMENTATION/TestCasesForHighlight.xlsx 0 → 100644
No preview for this file type
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -39,7 +39,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -39,7 +39,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
39 $scope.multiAnnotationIsON = true; 39 $scope.multiAnnotationIsON = true;
40 $scope.previousGrayImageDataVar; 40 $scope.previousGrayImageDataVar;
41 $scope.previousGrayCanvas; 41 $scope.previousGrayCanvas;
42 - 42 + $scope.previousIcolor =0;
  43 + $scope.previousX =0;
  44 + $scope.previousY=0;
43 $scope.machedBodyRegion = []; 45 $scope.machedBodyRegion = [];
44 46
45 //array for bodyviewid correspoing to male female(used for gender change) 47 //array for bodyviewid correspoing to male female(used for gender change)
@@ -1074,7 +1076,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1074,7 +1076,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1074 var actulalX = mousePos.x + horizontlScrollPosition; 1076 var actulalX = mousePos.x + horizontlScrollPosition;
1075 var actualY = mousePos.y + verticalScrollPosition; 1077 var actualY = mousePos.y + verticalScrollPosition;
1076 1078
1077 - //debugger; 1079 +
  1080 +
1078 var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y); 1081 var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
1079 1082
1080 if ($rootScope.isHighLight) 1083 if ($rootScope.isHighLight)
@@ -1095,52 +1098,62 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1095,52 +1098,62 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1095 1098
1096 grayCanvasContext.putImageData(grayImageData, 0, 0) 1099 grayCanvasContext.putImageData(grayImageData, 0, 0)
1097 1100
1098 - } 1101 + }
1099 } 1102 }
  1103 + }
1100 1104
1101 - var ActualTermNo = $scope.getActualTermNumber(RGBColor);  
1102 - //alert('actual term no: ' + ActualTermNo); 1105 +
1103 1106
1104 - //3. Find Term No List Based on ActualTermNo  
1105 - var TermList = $scope.getTermNumberList(ActualTermNo);  
1106 - // alert('termList.count: ' + TermList.length); 1107 + $scope.previousIcolor= RGBColor;
  1108 + $scope.previousX = x;
  1109 + $scope.previousY = y;
1107 1110
1108 - //4. 1111 + $scope.highLightBodyBasedOnIcolor(RGBColor, x, y);
1109 1112
1110 - $scope.machedTermNoLocation = [];  
1111 - for (var i = 0; i < TermList.length; i++) { 1113 + //var ActualTermNo = $scope.getActualTermNumber(RGBColor);
  1114 + ////3. Find Term No List Based on ActualTermNo
  1115 + //var TermList = $scope.getTermNumberList(ActualTermNo);
  1116 + //// alert('termList.count: ' + TermList.length);
1112 1117
1113 - var termNumber = parseInt(TermList[i]._TermNumber); 1118 + ////4.
1114 1119
1115 - //Match Term No List in each bodyRegion  
1116 - $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);  
1117 - } 1120 + //$scope.machedTermNoLocation = [];
  1121 + //for (var i = 0; i < TermList.length; i++) {
  1122 +
  1123 + // var termNumber = parseInt(TermList[i]._TermNumber);
  1124 +
  1125 + // //Match Term No List in each bodyRegion
  1126 + // $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);
  1127 + //}
1118 1128
1119 } 1129 }
1120 1130
1121 else 1131 else
1122 { 1132 {
  1133 + $scope.previousIcolor = RGBColor;
  1134 + $scope.previousX = x;
  1135 + $scope.previousY = y;
  1136 + $scope.highLightBodyBasedOnIcolor(RGBColor,x,y);
1123 1137
1124 - //2. Find Actul Term No Based on Icolor.  
1125 - var ActualTermNo = $scope.getActualTermNumber(RGBColor);  
1126 - //alert('actual term no: ' + ActualTermNo);  
1127 -  
1128 - //3. Find Term No List Based on ActualTermNo  
1129 - var TermList = $scope.getTermNumberList(ActualTermNo);  
1130 - // alert('termList.count: ' + TermList.length); 1138 + ////2. Find Actul Term No Based on Icolor.
  1139 + //var ActualTermNo = $scope.getActualTermNumber(RGBColor);
  1140 +
  1141 + ////3. Find Term No List Based on ActualTermNo
  1142 + //var TermList = $scope.getTermNumberList(ActualTermNo);
  1143 +
1131 1144
1132 - //4. 1145 + ////4.
1133 1146
1134 - $scope.machedTermNoLocation = [];  
1135 - for (var i = 0; i < TermList.length; i++) { 1147 + //$scope.machedTermNoLocation = [];
  1148 + //for (var i = 0; i < TermList.length; i++) {
1136 1149
1137 - var termNumber = parseInt(TermList[i]._TermNumber); 1150 + // var termNumber = parseInt(TermList[i]._TermNumber);
1138 1151
1139 - //Match Term No List in each bodyRegion  
1140 - $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);  
1141 - } 1152 + // //Match Term No List in each bodyRegion
  1153 + // $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);
  1154 + //}
1142 } 1155 }
1143 - } 1156 +
1144 1157
1145 1158
1146 1159
@@ -1218,6 +1231,28 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1218,6 +1231,28 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1218 1231
1219 } 1232 }
1220 1233
  1234 + $scope.highLightBodyBasedOnIcolor = function (RGBColor,x,y)
  1235 + {
  1236 +
  1237 + //2. Find Actul Term No Based on Icolor.
  1238 + var ActualTermNo = $scope.getActualTermNumber(RGBColor);
  1239 +
  1240 + //3. Find Term No List Based on ActualTermNo
  1241 + var TermList = $scope.getTermNumberList(ActualTermNo);
  1242 +
  1243 +
  1244 + //4.
  1245 +
  1246 + $scope.machedTermNoLocation = [];
  1247 + for (var i = 0; i < TermList.length; i++) {
  1248 +
  1249 + var termNumber = parseInt(TermList[i]._TermNumber);
  1250 +
  1251 + //Match Term No List in each bodyRegion
  1252 + $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);
  1253 + }
  1254 + }
  1255 +
1221 $scope.getLocationsForMatchedTermsInWholeBody = function (termNo, x, y) 1256 $scope.getLocationsForMatchedTermsInWholeBody = function (termNo, x, y)
1222 { 1257 {
1223 1258
@@ -1484,13 +1519,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1484,13 +1519,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1484 $scope.imageVerticalScrollPosition = canvasDiv.scrollTop; 1519 $scope.imageVerticalScrollPosition = canvasDiv.scrollTop;
1485 $scope.imageHorizontlScrollPosition = canvasDiv.scrollLeft; 1520 $scope.imageHorizontlScrollPosition = canvasDiv.scrollLeft;
1486 1521
1487 - // debugger;  
1488 - // $('#daLoaderLabel').css('visibility', 'visible');  
1489 -  
1490 -  
1491 - 1522 +
1492 if ($scope.isTransparencyActivated) { 1523 if ($scope.isTransparencyActivated) {
1493 - //crete temp canavs to store the original data which will be used to chnange the transparency 1524 +
1494 if (document.getElementById('tempCanvas') != null) { 1525 if (document.getElementById('tempCanvas') != null) {
1495 $('#tempCanvas').remove(); 1526 $('#tempCanvas').remove();
1496 } 1527 }
@@ -1579,6 +1610,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1579,6 +1610,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1579 1610
1580 $timeout(function () { $scope.highLightBody() }, 350); 1611 $timeout(function () { $scope.highLightBody() }, 350);
1581 1612
  1613 + if ($scope.previousIcolor != 0 && $scope.previousX != 0 && $scope.previousY != 0) {
  1614 +
  1615 + $timeout(function () { $scope.highLightBodyBasedOnIcolor($scope.previousIcolor, $scope.previousX, $scope.previousY) }, 350);
  1616 + }
  1617 +
1582 } 1618 }
1583 1619
1584 } 1620 }
@@ -3063,93 +3099,94 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3063,93 +3099,94 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3063 3099
3064 $scope.highLightBody = function () { 3100 $scope.highLightBody = function () {
3065 3101
3066 - angular.forEach($scope.ColoredImageSRC, function (value, key) { 3102 +
  3103 + if ($rootScope.isHighLight == true) {
3067 3104
  3105 + angular.forEach($scope.ColoredImageSRC, function (value, key) {
  3106 + var id;
  3107 + if (value.haveMirror == 'true') {
  3108 + id = 'imageCanvas' + value.bodyRegionId + '_MR';
  3109 + }
  3110 + else {
  3111 + id = 'imageCanvas' + value.bodyRegionId;
  3112 + }
3068 3113
3069 - var id;  
3070 - if (value.haveMirror == 'true') {  
3071 - id = 'imageCanvas' + value.bodyRegionId + '_MR';  
3072 - }  
3073 - else {  
3074 - id = 'imageCanvas' + value.bodyRegionId;  
3075 - } 3114 + var imageCanvas = document.getElementById(id);
3076 3115
3077 - var imageCanvas = document.getElementById(id); 3116 + //var coloredCanvasID = 'imageCanvas' + bodyRegionId;
  3117 + //var coloredCanvas = document.getElementById(coloredCanvasID);
3078 3118
3079 - //var coloredCanvasID = 'imageCanvas' + bodyRegionId;  
3080 - //var coloredCanvas = document.getElementById(coloredCanvasID); 3119 + var width = value.Width;
  3120 + var ht = value.Height;
3081 3121
3082 - var width = value.Width;  
3083 - var ht = value.Height; 3122 + var coloredCanvasContext = imageCanvas.getContext("2d");
  3123 + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht);
  3124 + var coloredImageDataVar = coloredImageData.data;
3084 3125
3085 - var coloredCanvasContext = imageCanvas.getContext("2d");  
3086 - var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht);  
3087 - var coloredImageDataVar = coloredImageData.data;  
3088 -  
3089 -  
3090 - if (value.haveMirror == 'true') {  
3091 - $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar;  
3092 - }  
3093 - else  
3094 - {  
3095 - //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1;  
3096 3126
3097 - $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar;  
3098 - } 3127 + if (value.haveMirror == 'true') {
  3128 + $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar;
  3129 + }
  3130 + else {
  3131 + //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1;
3099 3132
  3133 + $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar;
  3134 + }
3100 3135
3101 - //$rootScope.coloredImageCanvasList.push(parts);  
3102 -  
3103 -  
3104 3136
3105 - var context_gray = imageCanvas.getContext('2d'); 3137 + //$rootScope.coloredImageCanvasList.push(parts);
3106 3138
3107 3139
3108 - var dataURL = imageCanvas.toDataURL();  
3109 3140
  3141 + var context_gray = imageCanvas.getContext('2d');
3110 3142
3111 - var img = new Image();  
3112 3143
3113 - img.src = dataURL; 3144 + var dataURL = imageCanvas.toDataURL();
3114 3145
3115 - var DAData = new BitmapData(img.width, img.height);  
3116 - DAData.draw(img);  
3117 - var RED = 0.3086; // luminance contrast value for red  
3118 - var GREEN = 0.694; // luminance contrast value for green  
3119 - var BLUE = 0.0820; // luminance contrast value for blue  
3120 3146
3121 - var RGB = [RED, GREEN, BLUE, 0, 0];  
3122 - var RGB2 = [RED, GREEN, BLUE, 0, 0];  
3123 - var RGB3 = [RED, GREEN, BLUE, 0, 0];  
3124 - var ALPHA = [0, 0, 0, 1, 0]; 3147 + var img = new Image();
3125 3148
3126 - var rgbPx = RGB.concat(RGB2);  
3127 - var rgbPx2 = rgbPx.concat(RGB3);  
3128 - var matrix = rgbPx2.concat(ALPHA); 3149 + img.src = dataURL;
3129 3150
3130 - var zeroPoint = new Point();  
3131 - var grayScale = new ColorMatrixFilter(matrix);  
3132 - DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale); 3151 + var DAData = new BitmapData(img.width, img.height);
  3152 + DAData.draw(img);
  3153 + var RED = 0.3086; // luminance contrast value for red
  3154 + var GREEN = 0.694; // luminance contrast value for green
  3155 + var BLUE = 0.0820; // luminance contrast value for blue
3133 3156
3134 - context_gray.putImageData(DAData.data, 0, 0) 3157 + var RGB = [RED, GREEN, BLUE, 0, 0];
  3158 + var RGB2 = [RED, GREEN, BLUE, 0, 0];
  3159 + var RGB3 = [RED, GREEN, BLUE, 0, 0];
  3160 + var ALPHA = [0, 0, 0, 1, 0];
3135 3161
3136 - var grayImageData = context_gray.getImageData(0, 0, width, ht);  
3137 - var grayImageImageDataVar = grayImageData.data; 3162 + var rgbPx = RGB.concat(RGB2);
  3163 + var rgbPx2 = rgbPx.concat(RGB3);
  3164 + var matrix = rgbPx2.concat(ALPHA);
3138 3165
3139 - if (value.haveMirror == 'true') {  
3140 - $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData;  
3141 - }  
3142 - else {  
3143 - //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1; 3166 + var zeroPoint = new Point();
  3167 + var grayScale = new ColorMatrixFilter(matrix);
  3168 + DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale);
3144 3169
3145 - $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData;  
3146 - }  
3147 - 3170 + context_gray.putImageData(DAData.data, 0, 0)
3148 3171
3149 - }); 3172 + var grayImageData = context_gray.getImageData(0, 0, width, ht);
  3173 + var grayImageImageDataVar = grayImageData.data;
  3174 +
  3175 + if (value.haveMirror == 'true') {
  3176 + $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData;
  3177 + }
  3178 + else {
  3179 + //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1;
  3180 +
  3181 + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData;
  3182 + }
3150 3183
3151 - // alert('length: '+ $scope.coloredImageCanvasList.length);  
3152 3184
  3185 + });
  3186 +
  3187 + // alert('length: '+ $scope.coloredImageCanvasList.length);
  3188 +
  3189 + }
3153 } 3190 }
3154 3191
3155 $scope.applyGrayMatrix = function (img, context_gray) 3192 $scope.applyGrayMatrix = function (img, context_gray)