Commit dc69a664bae8e1840f2b40016c667874c0a5a854

Authored by Amrita Vishnoi
1 parent 848e2447

Refs: #4464

unhighlight is done but now have issue in multi highlight which need to see.
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -30,10 +30,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
30 30 $rootScope.coloredImageCanvasList = [];
31 31 $rootScope.coloredImageMRCanvasList = [];
32 32  
  33 + $rootScope.grayImageDataList = [];
  34 + $rootScope.grayImageMRDataList = [];
  35 +
33 36 $scope.zoomInOut = 75;
34 37 $scope.i = 0;
35 38 $scope.speachBubbleArray = [];
36 39 $scope.multiAnnotationIsON = true;
  40 + $scope.previousGrayImageDataVar;
  41 + $scope.previousGrayCanvas;
  42 +
  43 + $scope.machedBodyRegion = [];
37 44  
38 45 //array for bodyviewid correspoing to male female(used for gender change)
39 46 $scope.correspondingBodyViewIds = {
... ... @@ -1028,6 +1035,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1028 1035 }
1029 1036 imgCanvas.addEventListener('click', function (evt) {
1030 1037  
  1038 +
1031 1039 // debugger;
1032 1040 var annotationText;
1033 1041 var context = imgCanvas.getContext("2d");
... ... @@ -1061,28 +1069,70 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1061 1069 //debugger;
1062 1070 var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
1063 1071  
  1072 +
1064 1073  
1065   - if ($rootScope.isHighLight) {
1066   - //2. Find Actul Term No Based on Icolor.
1067   - var ActualTermNo = $scope.getActualTermNumber(RGBColor);
1068   - //alert('actual term no: ' + ActualTermNo);
  1074 + if ($rootScope.isHighLight)
  1075 + {
  1076 + if ($scope.machedBodyRegion.length > 0)
  1077 + {
  1078 + for(var i=0;i<$scope.machedBodyRegion.length;i++)
  1079 + {
  1080 + var bodyRegionId = $scope.machedBodyRegion[i];
1069 1081  
1070   - //3. Find Term No List Based on ActualTermNo
1071   - var TermList = $scope.getTermNumberList(ActualTermNo);
1072   - // alert('termList.count: ' + TermList.length);
  1082 + var grayCanvasID = 'imageCanvas' + bodyRegionId;
  1083 + var grayCanvas = document.getElementById(grayCanvasID);
1073 1084  
1074   - //4.
  1085 + var grayCanvasContext = grayCanvas.getContext("2d");
  1086 +
  1087 + var grayImageData = $rootScope.grayImageDataList[bodyRegionId - 1];
1075 1088  
1076   - $scope.machedTermNoLocation = [];
1077   - for (var i = 0; i < TermList.length; i++) {
  1089 + grayCanvasContext.putImageData(grayImageData, 0, 0)
  1090 + }
1078 1091  
1079   - var termNumber = parseInt(TermList[i]._TermNumber);
  1092 + var ActualTermNo = $scope.getActualTermNumber(RGBColor);
  1093 + //alert('actual term no: ' + ActualTermNo);
  1094 +
  1095 + //3. Find Term No List Based on ActualTermNo
  1096 + var TermList = $scope.getTermNumberList(ActualTermNo);
  1097 + // alert('termList.count: ' + TermList.length);
  1098 +
  1099 + //4.
  1100 +
  1101 + $scope.machedTermNoLocation = [];
  1102 + for (var i = 0; i < TermList.length; i++) {
  1103 +
  1104 + var termNumber = parseInt(TermList[i]._TermNumber);
  1105 +
  1106 + //Match Term No List in each bodyRegion
  1107 + $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);
  1108 + }
1080 1109  
1081   - //Match Term No List in each bodyRegion
1082   - $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);
1083 1110 }
1084   - }
1085 1111  
  1112 + else
  1113 + {
  1114 +
  1115 + //2. Find Actul Term No Based on Icolor.
  1116 + var ActualTermNo = $scope.getActualTermNumber(RGBColor);
  1117 + //alert('actual term no: ' + ActualTermNo);
  1118 +
  1119 + //3. Find Term No List Based on ActualTermNo
  1120 + var TermList = $scope.getTermNumberList(ActualTermNo);
  1121 + // alert('termList.count: ' + TermList.length);
  1122 +
  1123 + //4.
  1124 +
  1125 + $scope.machedTermNoLocation = [];
  1126 + for (var i = 0; i < TermList.length; i++) {
  1127 +
  1128 + var termNumber = parseInt(TermList[i]._TermNumber);
  1129 +
  1130 + //Match Term No List in each bodyRegion
  1131 + $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);
  1132 + }
  1133 + }
  1134 + }
  1135 +
1086 1136  
1087 1137  
1088 1138 //Modesty ON
... ... @@ -1159,9 +1209,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1159 1209  
1160 1210 }
1161 1211  
1162   - $scope.getLocationsForMatchedTermsInWholeBody = function (termNo, x, y) {
1163   -
1164   - for (var x = 0; x < $scope.ColoredImageSRC.length; x++) {
  1212 + $scope.getLocationsForMatchedTermsInWholeBody = function (termNo, x, y)
  1213 + {
  1214 +
  1215 + for (var x = 0; x < $scope.ColoredImageSRC.length; x++)
  1216 + {
1165 1217 // alert('called for bodyRegionId: ' + $scope.MaskImageSRC[x].bodyRegionId);
1166 1218 var bodyRegionId = $scope.ColoredImageSRC[x].bodyRegionId;
1167 1219  
... ... @@ -1195,6 +1247,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1195 1247  
1196 1248 // 2. get coloured canvas for this body region.
1197 1249  
  1250 +
1198 1251 var coloredImageDataVar;
1199 1252 var coloredImageDataMRVar
1200 1253  
... ... @@ -1207,11 +1260,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1207 1260 coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)];
1208 1261 }
1209 1262 var grayImageDataVar;
  1263 + var grayCanvas;
1210 1264 if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
1211 1265  
1212 1266 //// 3. get mask canvas for this body region._MR
1213 1267 var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
1214   - var grayCanvas = document.getElementById(grayCanvasID);
  1268 + grayCanvas = document.getElementById(grayCanvasID);
1215 1269 var grayCanvasContext = grayCanvas.getContext("2d");
1216 1270 var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
1217 1271 grayImageDataVar = grayImageData.data;
... ... @@ -1220,7 +1274,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1220 1274 else
1221 1275 {
1222 1276 var grayCanvasID = 'imageCanvas' + bodyRegionId;
1223   - var grayCanvas = document.getElementById(grayCanvasID);
  1277 + grayCanvas = document.getElementById(grayCanvasID);
1224 1278 var grayCanvasContext = grayCanvas.getContext("2d");
1225 1279 var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
1226 1280 grayImageDataVar = grayImageData.data;
... ... @@ -1235,9 +1289,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1235 1289 var imageDataVar = maskImgData.data;
1236 1290  
1237 1291 // var previousBRID;
1238   - var n = maskImgData.data.length;
  1292 +
1239 1293 var counter = 0;
1240   -
  1294 +
  1295 +
  1296 + var n = maskImgData.data.length;
1241 1297  
1242 1298 for (var i = 0; i < n; i += 4) {
1243 1299  
... ... @@ -1277,8 +1333,23 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1277 1333  
1278 1334 if (parseInt(termNo) == parseInt(Icolor)) {
1279 1335 counter++;
  1336 + var have = $scope.machedBodyRegion.indexOf(bodyRegionId);
  1337 +
1280 1338  
1281   - if (coloredImageDataVar!= null) {
  1339 + if (have == -1)
  1340 + {
  1341 + $scope.machedBodyRegion.push(bodyRegionId);
  1342 + }
  1343 + else
  1344 + {
  1345 +
  1346 + }
  1347 +
  1348 +
  1349 + //previousGrayColoredData = i;
  1350 + if (coloredImageDataVar != null) {
  1351 +
  1352 +
1282 1353 var RED_coloredImage = coloredImageDataVar[i];
1283 1354  
1284 1355 grayImageDataVar[i] = RED_coloredImage;
... ... @@ -1581,7 +1652,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1581 1652 $scope.createDynamicSpeechBubble= function (event, text, x, y)
1582 1653 {
1583 1654  
1584   -
1585 1655 if (event.ctrlKey) {
1586 1656  
1587 1657 $scope.multiAnnotationIsON = true;
... ... @@ -2984,8 +3054,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2984 3054  
2985 3055 $scope.highLightBody = function () {
2986 3056  
2987   - //alert('highlight body is called');
2988   - angular.forEach($scope.ColoredImageSRC, function (value, key) {
  3057 + angular.forEach($scope.ColoredImageSRC, function (value, key) {
2989 3058  
2990 3059  
2991 3060 var id;
... ... @@ -3056,6 +3125,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3056 3125  
3057 3126 context_gray.putImageData(DAData.data, 0, 0)
3058 3127  
  3128 + var grayImageData = context_gray.getImageData(0, 0, width, ht);
  3129 + var grayImageImageDataVar = grayImageData.data;
  3130 +
  3131 +
  3132 + if (value.haveMirror == 'true') {
  3133 + $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData;
  3134 + }
  3135 + else {
  3136 + //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1;
  3137 +
  3138 + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData;
  3139 + }
  3140 +
  3141 +
3059 3142 });
3060 3143  
3061 3144 // alert('length: '+ $scope.coloredImageCanvasList.length);
... ...