Commit f324e0dc6ce14b7a19c7efa52cb7d2d4305cd94c

Authored by Amrita Vishnoi
1 parent 93895fb4

Highlight in mirror body Region is under progress...

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -28,6 +28,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -28,6 +28,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
28 28
29 $rootScope.isHighLight = false; 29 $rootScope.isHighLight = false;
30 $rootScope.coloredImageCanvasList = []; 30 $rootScope.coloredImageCanvasList = [];
  31 + $rootScope.coloredImageMRCanvasList = [];
31 32
32 $scope.zoomInOut = 75; 33 $scope.zoomInOut = 75;
33 34
@@ -362,8 +363,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -362,8 +363,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
362 363
363 364
364 365
365 -  
366 -  
367 $scope.LoadDefaultLayerImage = function () { 366 $scope.LoadDefaultLayerImage = function () {
368 // debugger; 367 // debugger;
369 368
@@ -887,6 +886,27 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -887,6 +886,27 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
887 } 886 }
888 var RGBColor = (Red + Green + Blue); 887 var RGBColor = (Red + Green + Blue);
889 888
  889 + if ($rootScope.isHighLight) {
  890 + //2. Find Actul Term No Based on Icolor.
  891 + var ActualTermNo = $scope.getActualTermNumber(RGBColor);
  892 + //alert('actual term no: ' + ActualTermNo);
  893 +
  894 + //3. Find Term No List Based on ActualTermNo
  895 + var TermList = $scope.getTermNumberList(ActualTermNo);
  896 + // alert('termList.count: ' + TermList.length);
  897 +
  898 + //4.
  899 +
  900 + $scope.machedTermNoLocation = [];
  901 + for (var i = 0; i < TermList.length; i++) {
  902 +
  903 + var termNumber = parseInt(TermList[i]._TermNumber);
  904 +
  905 + //Match Term No List in each bodyRegion
  906 + $scope.getLocationsForMatchedTermsInWholeBody(termNumber, x, y);
  907 + }
  908 + }
  909 +
890 910
891 var annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); 911 var annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
892 912
@@ -1151,27 +1171,38 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1151,27 +1171,38 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1151 var maskCanvasContext = maskCanvas.getContext("2d"); 1171 var maskCanvasContext = maskCanvas.getContext("2d");
1152 var maskImgData = maskCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight); 1172 var maskImgData = maskCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
1153 1173
1154 - //// 2. get coloured canvas for this body region. 1174 + // 2. get coloured canvas for this body region.
1155 1175
1156 - var coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)]; 1176 + var coloredImageDataVar;
  1177 + var coloredImageDataMRVar
1157 1178
  1179 + if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
1158 1180
1159 - //var coloredCanvasContext = coloredCanvas.getContext("2d");  
1160 - //var coloredImageData = coloredCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);  
1161 - //var coloredImageDataVar = coloredImageData.data;  
1162 -  
1163 - //var coloredCanvasID = 'imageCanvas' + bodyRegionId;  
1164 - //var coloredCanvas = document.getElementById(coloredCanvasID);  
1165 - //var coloredCanvasContext = coloredCanvas.getContext("2d");  
1166 - //var coloredImageData = coloredCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);  
1167 - //var coloredImageDataVar = coloredImageData.data; 1181 + coloredImageDataVar = $rootScope.coloredImageMRCanvasList[parseInt(bodyRegionId)];
  1182 + }
  1183 + else
  1184 + {
  1185 + coloredImageDataVar = $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)];
  1186 + }
  1187 + var grayImageDataVar;
  1188 + if ($scope.ColoredImageSRC[x].haveMirror == 'true') {
  1189 +
  1190 + //// 3. get mask canvas for this body region._MR
  1191 + var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR';
  1192 + var grayCanvas = document.getElementById(grayCanvasID);
  1193 + var grayCanvasContext = grayCanvas.getContext("2d");
  1194 + var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
  1195 + grayImageDataVar = grayImageData.data;
  1196 + }
1168 1197
1169 - //// 3. get mask canvas for this body region._MR  
1170 - var grayCanvasID = 'imageCanvas' + bodyRegionId;  
1171 - var grayCanvas = document.getElementById(grayCanvasID);  
1172 - var grayCanvasContext = grayCanvas.getContext("2d");  
1173 - var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);  
1174 - var grayImageDataVar = grayImageData.data; 1198 + else
  1199 + {
  1200 + var grayCanvasID = 'imageCanvas' + bodyRegionId;
  1201 + var grayCanvas = document.getElementById(grayCanvasID);
  1202 + var grayCanvasContext = grayCanvas.getContext("2d");
  1203 + var grayImageData = grayCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
  1204 + grayImageDataVar = grayImageData.data;
  1205 + }
1175 1206
1176 1207
1177 //var grayImageDataVarMR; 1208 //var grayImageDataVarMR;
@@ -1179,19 +1210,38 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1179,19 +1210,38 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1179 var coloredImageDataVarMR; 1210 var coloredImageDataVarMR;
1180 var coloredImageDataMR 1211 var coloredImageDataMR
1181 1212
1182 - if (bodyRegionId == 6 || bodyRegionId == 5 || bodyRegionId == 4) {  
1183 - //var grayCanvasMRID = 'GrayImageCanvas' + bodyRegionId + '_MR';  
1184 - //var grayCanvasMR = document.getElementById(grayCanvasMRID);  
1185 - //var grayCanvasContextMR = grayCanvasMR.getContext("2d");  
1186 - //grayImageDataMR = grayCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight);  
1187 - //grayImageDataVarMR = grayImageDataMR.data;  
1188 -  
1189 - var coloredCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR';  
1190 - var coloredCanvasMR = document.getElementById(coloredCanvasMRID);  
1191 - var coloredCanvasContextMR = coloredCanvasMR.getContext("2d");  
1192 - coloredImageDataMR = coloredCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight);  
1193 - coloredImageDataVarMR = coloredImageDataMR.data;  
1194 - } 1213 + //if ($scope.ColoredImageSRC[x].haveMirror) {
  1214 +
  1215 +
  1216 + // var coloredCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR';
  1217 + // var coloredCanvasMR = document.getElementById(coloredCanvasMRID);
  1218 + // var coloredCanvasContextMR = coloredCanvasMR.getContext("2d");
  1219 + // coloredImageDataMR = coloredCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight);
  1220 + // coloredImageDataVarMR = coloredImageDataMR.data;
  1221 + //}
  1222 +
  1223 + //else
  1224 + //{
  1225 + // var coloredCanvas = 'imageCanvas' + bodyRegionId;
  1226 + // var coloredCanvas = document.getElementById(coloredCanvas);
  1227 + // var coloredCanvasContext = coloredCanvas.getContext("2d");
  1228 + // coloredImageData = coloredCanvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
  1229 + // coloredImageDataVar = coloredImageData.data;
  1230 + //}
  1231 +
  1232 + //if (bodyRegionId == 6 || bodyRegionId == 5 || bodyRegionId == 4) {
  1233 + // //var grayCanvasMRID = 'GrayImageCanvas' + bodyRegionId + '_MR';
  1234 + // //var grayCanvasMR = document.getElementById(grayCanvasMRID);
  1235 + // //var grayCanvasContextMR = grayCanvasMR.getContext("2d");
  1236 + // //grayImageDataMR = grayCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight);
  1237 + // //grayImageDataVarMR = grayImageDataMR.data;
  1238 +
  1239 + // var coloredCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR';
  1240 + // var coloredCanvasMR = document.getElementById(coloredCanvasMRID);
  1241 + // var coloredCanvasContextMR = coloredCanvasMR.getContext("2d");
  1242 + // coloredImageDataMR = coloredCanvasContextMR.getImageData(0, 0, scaledWidth, scaledHeight);
  1243 + // coloredImageDataVarMR = coloredImageDataMR.data;
  1244 + //}
1195 1245
1196 var counter = 0; 1246 var counter = 0;
1197 1247
@@ -1268,19 +1318,23 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1268,19 +1318,23 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1268 1318
1269 //if (!isHighLighted) { 1319 //if (!isHighLighted) {
1270 //alert('icolor matched with term no ' +termNo); 1320 //alert('icolor matched with term no ' +termNo);
1271 - var RED_coloredImage = coloredImageDataVar[i];  
1272 - grayImageDataVar[i] = RED_coloredImage; 1321 +
  1322 + if (coloredImageDataVar!= null) {
  1323 + var RED_coloredImage = coloredImageDataVar[i];
  1324 +
  1325 + grayImageDataVar[i] = RED_coloredImage;
1273 1326
1274 1327
1275 - var GREEN_coloredImage = coloredImageDataVar[i + 1];  
1276 - grayImageDataVar[i + 1] = GREEN_coloredImage; 1328 + var GREEN_coloredImage = coloredImageDataVar[i + 1];
  1329 + grayImageDataVar[i + 1] = GREEN_coloredImage;
1277 1330
1278 - var BLUE_coloredImage = coloredImageDataVar[i + 2];  
1279 - grayImageDataVar[i + 2] = BLUE_coloredImage; 1331 + var BLUE_coloredImage = coloredImageDataVar[i + 2];
  1332 + grayImageDataVar[i + 2] = BLUE_coloredImage;
1280 1333
1281 1334
1282 - var ALPHA_coloredImage = coloredImageDataVar[i + 3];  
1283 - grayImageDataVar[i + 3] = ALPHA_coloredImage; 1335 + var ALPHA_coloredImage = coloredImageDataVar[i + 3];
  1336 + grayImageDataVar[i + 3] = ALPHA_coloredImage;
  1337 + }
1284 1338
1285 //} 1339 //}
1286 } 1340 }
@@ -1306,7 +1360,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1306,7 +1360,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1306 1360
1307 // var grayCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR'; 1361 // var grayCanvasMRID = 'imageCanvas' + bodyRegionId + '_MR';
1308 // var grayCanvasMR = document.getElementById(grayCanvasMRID); 1362 // var grayCanvasMR = document.getElementById(grayCanvasMRID);
1309 - // document.getElementById('canvasDiv').removeChild(grayCanvasMR); 1363 + // // document.getElementById('canvasDiv').removeChild(grayCanvasMR);
1310 1364
1311 // var tempCanvasMR = document.createElement('canvas'); 1365 // var tempCanvasMR = document.createElement('canvas');
1312 // tempCanvasMR.id = 'imageCanvas' + bodyRegionId + '_MR'; 1366 // tempCanvasMR.id = 'imageCanvas' + bodyRegionId + '_MR';
@@ -2960,8 +3014,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -2960,8 +3014,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2960 var coloredImageDataVar = coloredImageData.data; 3014 var coloredImageDataVar = coloredImageData.data;
2961 3015
2962 3016
  3017 + if (value.haveMirror == 'true') {
  3018 + $rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId)] = coloredImageDataVar;
  3019 + }
  3020 + else
  3021 + {
  3022 + //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1;
  3023 +
  3024 + $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar;
  3025 + }
2963 3026
2964 - $rootScope.coloredImageCanvasList[parseInt (value.bodyRegionId -1)] = coloredImageDataVar;  
2965 3027
2966 //$rootScope.coloredImageCanvasList.push(parts); 3028 //$rootScope.coloredImageCanvasList.push(parts);
2967 3029