Commit 8eb0a24f3471a5a555aff5ced54528fcf7da8c55

Authored by Amrita Vishnoi
1 parent 2c852328

Approach1 in highlighting code for each term for single body region but code having issues

400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 <Content Include="app\views\da\da-view.html" /> 73 <Content Include="app\views\da\da-view.html" />
74 <Content Include="app\views\LabExerc\LabExerc-view.html" /> 74 <Content Include="app\views\LabExerc\LabExerc-view.html" />
75 <Content Include="app\widget\MainMenu.html" /> 75 <Content Include="app\widget\MainMenu.html" />
76 - <Content Include="app\workeroprocess\match-pixel-wp.js" /> 76 + <Content Include="match-pixel-wp.js" />
77 <Content Include="content\css\main.css" /> 77 <Content Include="content\css\main.css" />
78 <Content Include="content\data\json\da\body-views\1\da_dat_tm_sg_1.json" /> 78 <Content Include="content\data\json\da\body-views\1\da_dat_tm_sg_1.json" />
79 <Content Include="content\data\json\da\body-views\10\da_dat_body_system_term_10.json" /> 79 <Content Include="content\data\json\da\body-views\10\da_dat_body_system_term_10.json" />
@@ -42998,6 +42998,7 @@ @@ -42998,6 +42998,7 @@
42998 </Content> 42998 </Content>
42999 </ItemGroup> 42999 </ItemGroup>
43000 <ItemGroup> 43000 <ItemGroup>
  43001 + <Folder Include="app\workeroprocess\" />
43001 <Folder Include="content\data\json\ca\" /> 43002 <Folder Include="content\data\json\ca\" />
43002 <Folder Include="content\images\ca\" /> 43003 <Folder Include="content\images\ca\" />
43003 <Folder Include="content\images\DA\75\body-views\4\layers\329\6\" /> 43004 <Folder Include="content\images\DA\75\body-views\4\layers\329\6\" />
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -32,7 +32,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -32,7 +32,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
32 $rootScope.isHighLight = false; 32 $rootScope.isHighLight = false;
33 $rootScope.coloredImageCanvasList = []; 33 $rootScope.coloredImageCanvasList = [];
34 $rootScope.coloredImageMRCanvasList = []; 34 $rootScope.coloredImageMRCanvasList = [];
35 - 35 + $rootScope.ColoredCanvasData= [];
36 $rootScope.grayImageDataList = []; 36 $rootScope.grayImageDataList = [];
37 $rootScope.grayImageMRDataList = []; 37 $rootScope.grayImageMRDataList = [];
38 38
@@ -1073,6 +1073,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1073,6 +1073,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1073 } 1073 }
1074 ); 1074 );
1075 } 1075 }
  1076 + else {
  1077 + var colorImgData = context.getImageData(0, 0, w, h);
  1078 + $scope.ColoredCanvasData.push(
  1079 + {
  1080 + "bodyRegionId": bodyRegionId,
  1081 + "canvasId": FlipedImgCanvas.id,
  1082 + "coloredImageData": colorImgData.data,
  1083 +
  1084 + }
  1085 + );
  1086 + }
1076 1087
1077 } 1088 }
1078 1089
@@ -1339,6 +1350,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1339,6 +1350,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1339 } 1350 }
1340 ); 1351 );
1341 } 1352 }
  1353 + else {
  1354 + var colorImgData = context.getImageData(0, 0, w, h);
  1355 + $scope.ColoredCanvasData.push(
  1356 + {
  1357 + "bodyRegionId": bodyRegionId,
  1358 + "canvasId": imgCanvas.id,
  1359 + "coloredImageData": colorImgData.data,
  1360 +
  1361 + }
  1362 + );
  1363 + }
1342 }; 1364 };
1343 1365
1344 document.getElementById('canvasDiv').appendChild(imgCanvas); 1366 document.getElementById('canvasDiv').appendChild(imgCanvas);
@@ -1359,6 +1381,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1359,6 +1381,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1359 $scope.machedTermNoLocation = []; 1381 $scope.machedTermNoLocation = [];
1360 console.log(' TermList.length= ' + TermList.length) 1382 console.log(' TermList.length= ' + TermList.length)
1361 1383
  1384 +
  1385 +
  1386 + var dataForthisBR = new jinqJs()
  1387 + .from($scope.ColoredCanvasData)
  1388 + .where('bodyRegionId == ' + 1)
  1389 + .select();
  1390 + var coloredImageData = dataForthisBR.coloredImageData;
1362 var worker = new Worker('term-number-wp.js'); 1391 var worker = new Worker('term-number-wp.js');
1363 1392
1364 for (var i = 0; i < TermList.length; i++) { 1393 for (var i = 0; i < TermList.length; i++) {
@@ -1375,9 +1404,39 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1375,9 +1404,39 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1375 }); 1404 });
1376 1405
1377 } 1406 }
  1407 +
  1408 + //var candata = e.value;
  1409 + //var grayCanvasID = 'imageCanvas1'
  1410 + //var grayCanvas = document.getElementById(grayCanvasID);
  1411 + //var grayCanvasContext = grayCanvas.getContext("2d");
  1412 + //var imageData = grayCanvasContext.getImageData(0, 0 ,348,507);
  1413 +
  1414 +
  1415 + // worker.postMessage({ candata: coloredImageData });
  1416 +
1378 worker.onmessage = function (e) { 1417 worker.onmessage = function (e) {
1379 - console.log('callback time taken : ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));  
1380 - $scope.fillMatchedTerm(e.data.value, e.data.BRId); 1418 + var candata = e.data.value;
  1419 + var grayCanvasID = 'imageCanvas1'
  1420 + var grayCanvas = document.getElementById(grayCanvasID);
  1421 + var grayCanvasContext = grayCanvas.getContext("2d");
  1422 +
  1423 + // var tempCanvas = document.createElement('canvas');
  1424 + // tempCanvas.id = 'tempCanvas';
  1425 + // $scope.tempCanvas = tempCanvas.id;
  1426 + // tempCanvas.height = 507;
  1427 + // tempCanvas.width = 348;
  1428 + // tempCanvas.style.position = "absolute";
  1429 + // tempCanvas.style.left = 200 + 'px';
  1430 + // tempCanvas.style.top = 100 + 'px';
  1431 +
  1432 + //// tempCanvas.style.backgroundColor = "transparent";
  1433 + // tempCanvas.style.visibility = 'visible';
  1434 + // document.getElementById('canvasDiv').appendChild(tempCanvas);
  1435 +
  1436 + // var tempCanvas1 = document.getElementById('tempCanvas');
  1437 + // var Context = tempCanvas1.getContext("2d");
  1438 +
  1439 + grayCanvasContext.putImageData(e.data.value, 0, 0);
1381 1440
1382 1441
1383 }; 1442 };
@@ -1567,7 +1626,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1567,7 +1626,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1567 var grayCanvas = document.getElementById(grayCanvasID); 1626 var grayCanvas = document.getElementById(grayCanvasID);
1568 var grayCanvasContext = grayCanvas.getContext("2d"); 1627 var grayCanvasContext = grayCanvas.getContext("2d");
1569 1628
1570 - grayCanvasContext.putImageData(grayImageDataVar.toDataURL, 0, 0); 1629 +
  1630 + debugger;
  1631 + var garyDatalength = grayImageDataVar.length;
  1632 + var pixelData = new Uint8ClampedArray(garyDatalength);
  1633 + for (var i = 0; i < garyDatalength; i++) {
  1634 + pixelData[i] = grayImageDataVar[i];
  1635 + }
  1636 + var imgDta = grayCanvasContext.getImageData(0, 0, 348, 507);
  1637 + imgDta.data.set
  1638 + grayCanvasContext.putImageData(imgDta, 0, 0);
1571 //} 1639 //}
1572 1640
1573 // } 1641 // }
@@ -1576,7 +1644,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1576,7 +1644,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1576 } 1644 }
1577 1645
1578 $scope.GetRGBColor = function (maskCanvasContext, actulalX, actualY, x, y) { 1646 $scope.GetRGBColor = function (maskCanvasContext, actulalX, actualY, x, y) {
1579 - 1647 + debugger;
1580 var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1); 1648 var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - x), Math.round(actualY - y), 1, 1);
1581 1649
1582 pixelData.data[0] = pixelData.data[0] - 9; 1650 pixelData.data[0] = pixelData.data[0] - 9;
@@ -3297,7 +3365,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3297,7 +3365,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3297 3365
3298 var coloredCanvasContext = imageCanvas.getContext("2d"); 3366 var coloredCanvasContext = imageCanvas.getContext("2d");
3299 var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); 3367 var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht);
3300 - var coloredImageDataVar = coloredImageData.data; 3368 + var coloredImageDataVar = coloredImageData;
3301 3369
3302 3370
3303 if (value.haveMirror == 'true') { 3371 if (value.haveMirror == 'true') {
@@ -3307,6 +3375,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3307,6 +3375,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3307 //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1; 3375 //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1;
3308 3376
3309 $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar; 3377 $rootScope.coloredImageCanvasList[parseInt(value.bodyRegionId - 1)] = coloredImageDataVar;
  3378 +
3310 } 3379 }
3311 3380
3312 3381
@@ -3350,12 +3419,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3350,12 +3419,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3350 var grayImageImageDataVar = grayImageData.data; 3419 var grayImageImageDataVar = grayImageData.data;
3351 3420
3352 if (value.haveMirror == 'true') { 3421 if (value.haveMirror == 'true') {
3353 - $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData.data; 3422 + $rootScope.grayImageMRDataList[parseInt(value.bodyRegionId)] = grayImageData;
3354 } 3423 }
3355 else { 3424 else {
3356 //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1; 3425 //$rootScope.coloredImageMRCanvasList[parseInt(value.bodyRegionId - 1)] = 1;
3357 3426
3358 - $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData.data; 3427 + $rootScope.grayImageDataList[parseInt(value.bodyRegionId - 1)] = grayImageData;
3359 } 3428 }
3360 } 3429 }
3361 3430
400-SOURCECODE/AIAHTML5.Web/app/workeroprocess/match-pixel-wp.js renamed to 400-SOURCECODE/AIAHTML5.Web/match-pixel-wp.js
@@ -3,10 +3,10 @@ function getLocationsForMatchedTermsInWholeBody(msg) @@ -3,10 +3,10 @@ function getLocationsForMatchedTermsInWholeBody(msg)
3 { 3 {
4 debugger; 4 debugger;
5 5
6 - self.postMessage({ 'msg': 'called match-pixel-wp' }); 6 + self.postMessage({ 'value': msg });
7 7
8 } 8 }
9 9
10 self.onmessage = function (e) { 10 self.onmessage = function (e) {
11 - getLocationsForMatchedTermsInWholeBody(e.data.value); 11 + getLocationsForMatchedTermsInWholeBody(e.data.candata);
12 } 12 }
13 \ No newline at end of file 13 \ No newline at end of file
400-SOURCECODE/AIAHTML5.Web/term-number-wp.js
@@ -171,38 +171,38 @@ getLocationForMatchedTermsInWholeBody = function (termNo, maskCanvasData, colore @@ -171,38 +171,38 @@ getLocationForMatchedTermsInWholeBody = function (termNo, maskCanvasData, colore
171 171
172 172
173 173
174 - // var have = machedIcolorInBodyRegion.indexOf(bodyRegionId); 174 + //// var have = machedIcolorInBodyRegion.indexOf(bodyRegionId);
175 175
176 176
177 - //if (have == -1) {  
178 - // // machedIcolorInBodyRegion.push(bodyRegionId);  
179 - //}  
180 - //else { 177 + // //if (have == -1) {
  178 + // // // machedIcolorInBodyRegion.push(bodyRegionId);
  179 + // //}
  180 + // //else {
181 181
182 - //} 182 + // //}
183 183
184 184
185 - //previousGrayColoredData = i;  
186 - //if (coloredImageDataVar != null) { 185 + // //previousGrayColoredData = i;
  186 + // //if (coloredImageDataVar != null) {
187 187
188 188
189 - // var RED_coloredImage = coloredImageDataVar[i]; 189 + // // var RED_coloredImage = coloredImageDataVar[i];
190 190
191 - // // grayImageDataVar[i] = RED_coloredImage; 191 + // // // grayImageDataVar[i] = RED_coloredImage;
192 192
193 193
194 - // var GREEN_coloredImage = coloredImageDataVar[i + 1];  
195 - // /// grayImageDataVar[i + 1] = GREEN_coloredImage; 194 + // // var GREEN_coloredImage = coloredImageDataVar[i + 1];
  195 + // // /// grayImageDataVar[i + 1] = GREEN_coloredImage;
196 196
197 - // var BLUE_coloredImage = coloredImageDataVar[i + 2];  
198 - // //grayImageDataVar[i + 2] = BLUE_coloredImage; 197 + // // var BLUE_coloredImage = coloredImageDataVar[i + 2];
  198 + // // //grayImageDataVar[i + 2] = BLUE_coloredImage;
199 199
200 200
201 - // var ALPHA_coloredImage = coloredImageDataVar[i + 3];  
202 - // // grayImageDataVar[i + 3] = ALPHA_coloredImage; 201 + // // var ALPHA_coloredImage = coloredImageDataVar[i + 3];
  202 + // // // grayImageDataVar[i + 3] = ALPHA_coloredImage;
203 203
204 204
205 - //} 205 + // //}
206 206
207 } 207 }
208 208
@@ -210,7 +210,7 @@ getLocationForMatchedTermsInWholeBody = function (termNo, maskCanvasData, colore @@ -210,7 +210,7 @@ getLocationForMatchedTermsInWholeBody = function (termNo, maskCanvasData, colore
210 // grayCanvasContext.putImageData(grayImageData, 0, 0); 210 // grayCanvasContext.putImageData(grayImageData, 0, 0);
211 } 211 }
212 self.postMessage({ 212 self.postMessage({
213 - 'BRId': bodyRegionId, 213 +
214 'value': grayImageDataVar 214 'value': grayImageDataVar
215 }); 215 });
216 216