Commit c9456e6c6b55fd0587d7304a0fcad8955a1b2bfb
1 parent
ac4791d6
Refs: #4403
First level of highlight functionality is completed for both mirror and non mirror images. POCproject is added at location of prototype.
Showing
1 changed file
with
44 additions
and
46 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -468,7 +468,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
468 | 468 | "Height": rectangle.scaledHeight, |
469 | 469 | "Width": rectangle.scaledWidth, |
470 | 470 | "x": rectangle.scaledX, |
471 | - "y": rectangle.scaledY | |
471 | + "y": rectangle.scaledY, | |
472 | + "haveMirror": 'true' | |
472 | 473 | } |
473 | 474 | ); |
474 | 475 | |
... | ... | @@ -496,6 +497,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
496 | 497 | //0. Scaling as per default zoom |
497 | 498 | var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, 0); |
498 | 499 | |
500 | + $scope.ColoredImageSRC.push( | |
501 | + { | |
502 | + "bodyRegionId": value._BodyRegionId, "SRC": src, | |
503 | + "Height": rectangle.scaledHeight, | |
504 | + "Width": rectangle.scaledWidth, | |
505 | + "x": rectangle.scaledX, | |
506 | + "y": rectangle.scaledY, | |
507 | + "haveMirror": 'false' | |
508 | + } | |
509 | + ); | |
510 | + | |
499 | 511 | //1.Draw body region which have mirror image |
500 | 512 | $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N'); |
501 | 513 | $scope.BodyRegionCordinatesData.push( |
... | ... | @@ -534,7 +546,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
534 | 546 | "Height": rectangle.scaledHeight, |
535 | 547 | "Width": rectangle.scaledWidth, |
536 | 548 | "x": rectangle.scaledX, |
537 | - "y": rectangle.scaledY | |
549 | + "y": rectangle.scaledY, | |
550 | + "haveMirror": 'false' | |
538 | 551 | } |
539 | 552 | ); |
540 | 553 | |
... | ... | @@ -1998,7 +2011,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1998 | 2011 | |
1999 | 2012 | } |
2000 | 2013 | |
2001 | - | |
2002 | 2014 | } |
2003 | 2015 | |
2004 | 2016 | |
... | ... | @@ -2033,64 +2045,50 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
2033 | 2045 | |
2034 | 2046 | $scope.HighLightBody = function() |
2035 | 2047 | { |
2036 | - // debugger; | |
2037 | - //alert('Please Dont highLight me'); | |
2038 | 2048 | |
2039 | 2049 | angular.forEach($scope.ColoredImageSRC, function (value, key) { |
2040 | 2050 | |
2041 | - var img = new Image(); | |
2042 | - img.scaledHeight = value.Height; | |
2043 | - img.scaledWidth = value.Width; | |
2044 | - img.onload = start; | |
2045 | 2051 | |
2046 | - img.src = "http://localhost/AIA/" + value.SRC; | |
2047 | - var id = 'imageCanvas' + value.bodyRegionId; | |
2048 | - var imageCanvas = document.getElementById(id); | |
2052 | + var id; | |
2053 | + if (value.haveMirror == 'true') { | |
2054 | + id = 'imageCanvas' + value.bodyRegionId + '_MR'; | |
2055 | + } | |
2056 | + else { | |
2057 | + id = 'imageCanvas' + value.bodyRegionId; | |
2058 | + } | |
2059 | + var FlipedImgCanvas = document.getElementById(id); | |
2049 | 2060 | |
2050 | - var context = imageCanvas.getContext('2d'); | |
2051 | - img.cntx = context; | |
2052 | - img.canvas = imageCanvas; | |
2061 | + var context_gray = FlipedImgCanvas.getContext('2d'); | |
2053 | 2062 | |
2054 | - function start() { | |
2055 | - img.cntx.save(); | |
2056 | - img.cntx.translate(img.scaledWidth, 0); | |
2057 | - img.cntx.scale(-1, 1); | |
2058 | - img.cntx.drawImage(img, 0, 0); | |
2059 | - img.cntx.restore(); | |
2063 | + var dataURL = FlipedImgCanvas.toDataURL(); | |
2060 | 2064 | |
2061 | - | |
2062 | - //var wantType = "image/bmp"; | |
2063 | - //var DAData = img.canvas.toDataURL(wantType); | |
2064 | - //alert('image data: ' + DAData); | |
2065 | + | |
2066 | + var flippedImage = new Image(); | |
2065 | 2067 | |
2066 | - var DAData = new BitmapData(img.scaledWidth, img.scaledHeight); | |
2067 | - DAData.draw(img); | |
2068 | + flippedImage.src = dataURL; | |
2068 | 2069 | |
2069 | 2070 | |
2071 | + var DAData = new BitmapData(flippedImage.width, flippedImage.height); | |
2072 | + DAData.draw(flippedImage); | |
2073 | + var RED = 0.3086; // luminance contrast value for red | |
2074 | + var GREEN = 0.694; // luminance contrast value for green | |
2075 | + var BLUE = 0.0820; // luminance contrast value for blue | |
2070 | 2076 | |
2077 | + var RGB = [RED, GREEN, BLUE, 0, 0]; | |
2078 | + var RGB2 = [RED, GREEN, BLUE, 0, 0]; | |
2079 | + var RGB3 = [RED, GREEN, BLUE, 0, 0]; | |
2080 | + var ALPHA = [0, 0, 0, 1, 0]; | |
2071 | 2081 | |
2072 | - var RED = 0.3086; // luminance contrast value for red | |
2073 | - var GREEN = 0.694; // luminance contrast value for green | |
2074 | - var BLUE = 0.0820; // luminance contrast value for blue | |
2075 | - | |
2076 | - var RGB = [RED, GREEN, BLUE, 0, 0]; | |
2077 | - var RGB2 = [RED, GREEN, BLUE, 0, 0]; | |
2078 | - var RGB3 = [RED, GREEN, BLUE, 0, 0]; | |
2079 | - var ALPHA = [0, 0, 0, 1, 0]; | |
2082 | + var rgbPx = RGB.concat(RGB2); | |
2083 | + var rgbPx2 = rgbPx.concat(RGB3); | |
2084 | + var matrix = rgbPx2.concat(ALPHA); | |
2080 | 2085 | |
2081 | - var rgbPx = RGB.concat(RGB2); | |
2082 | - var rgbPx2 = rgbPx.concat(RGB3); | |
2083 | - var matrix = rgbPx2.concat(ALPHA); | |
2086 | + var zeroPoint = new Point(); | |
2087 | + var grayScale = new ColorMatrixFilter(matrix); | |
2088 | + DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale); | |
2084 | 2089 | |
2085 | - var zeroPoint = new Point(); | |
2086 | - var grayScale = new ColorMatrixFilter(matrix); | |
2087 | - DAData.applyFilter(DAData, DAData.rect, zeroPoint, grayScale); | |
2090 | + context_gray.putImageData(DAData.data, 0, 0) | |
2088 | 2091 | |
2089 | - | |
2090 | - //alert('image Gray ho gai... '); | |
2091 | - | |
2092 | - context.putImageData(DAData.data, 0, 0) | |
2093 | - } | |
2094 | 2092 | }); |
2095 | 2093 | |
2096 | 2094 | ... | ... |