Commit 0dcfe662590e4160ce8e1503709ecd11cc452772

Authored by Amrita Vishnoi
1 parent 795a933c

Modification in 9 body region count check based on body view

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -1842,120 +1842,136 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1842 1842  
1843 1843 $timeout(function () {
1844 1844  
1845   - for (var x = 0; x < 9; x++) {
1846   - if ($rootScope.MaskCanvasData[x] != null || $rootScope.MaskCanvasData[x] != undefined) {
1847   - var bodyRegionId = $rootScope.MaskCanvasData[x].bodyRegionId;
1848   - var canvasId = $rootScope.MaskCanvasData[x].canvasId;
1849   - var maskData = null;
1850   - maskData = $rootScope.MaskCanvasData[x].maskData;
1851   -
1852   - var coloredImageDataVar = null;
1853   - var grayImageDataVar = null;
  1845 + var loopLength = 0;
  1846 + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
  1847 + loopLength = 9;
  1848 + }
  1849 + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) {
  1850 + loopLength = 5;
  1851 + }
  1852 + else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) {
  1853 + loopLength = 4;
  1854 + }
  1855 + else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) {
  1856 + loopLength = 1;
  1857 + }
  1858 +
  1859 + if (loopLength !== 0) {
  1860 + for (var x = 0; x < loopLength; x++) {
  1861 + if ($rootScope.MaskCanvasData[x] != null || $rootScope.MaskCanvasData[x] != undefined) {
  1862 + var bodyRegionId = $rootScope.MaskCanvasData[x].bodyRegionId;
  1863 + var canvasId = $rootScope.MaskCanvasData[x].canvasId;
  1864 + var maskData = null;
  1865 + maskData = $rootScope.MaskCanvasData[x].maskData;
  1866 +
  1867 + var coloredImageDataVar = null;
  1868 + var grayImageDataVar = null;
  1869 +
  1870 + var white = null;
  1871 + if (canvasId.match('_MR')) {
  1872 + if ($rootScope.coloredImageMRCanvasList[bodyRegionId] != null || $rootScope.coloredImageMRCanvasList[bodyRegionId] != undefined) {
1854 1873  
1855   - var white = null;
1856   - if (canvasId.match('_MR')) {
1857   - if ($rootScope.coloredImageMRCanvasList[bodyRegionId] != null || $rootScope.coloredImageMRCanvasList[bodyRegionId] != undefined) {
  1874 + coloredImageDataVar = $rootScope.coloredImageMRCanvasList[bodyRegionId];
1858 1875  
1859   - coloredImageDataVar = $rootScope.coloredImageMRCanvasList[bodyRegionId];
  1876 + }
1860 1877  
1861   - }
  1878 + if ($rootScope.whiteImageMRDataList[bodyRegionId] != null || $rootScope.whiteImageMRDataList[bodyRegionId] != undefined) {
  1879 + white = $rootScope.whiteImageMRDataList[bodyRegionId];
  1880 + }
1862 1881  
1863   - if ($rootScope.whiteImageMRDataList[bodyRegionId] != null || $rootScope.whiteImageMRDataList[bodyRegionId] != undefined) {
1864   - white = $rootScope.whiteImageMRDataList[bodyRegionId];
1865 1882 }
1866 1883  
1867   - }
1868   -
1869   - else {
  1884 + else {
1870 1885  
1871   - if ($rootScope.coloredImageCanvasList[bodyRegionId - 1] != null || $rootScope.coloredImageCanvasList[bodyRegionId - 1] != undefined) {
1872   - coloredImageDataVar = $rootScope.coloredImageCanvasList[bodyRegionId - 1];
1873   - }
1874   - if ($rootScope.whiteImageDataList[bodyRegionId - 1] != null || $rootScope.whiteImageDataList[bodyRegionId - 1] != undefined) {
1875   - white = $rootScope.whiteImageDataList[bodyRegionId - 1];
  1886 + if ($rootScope.coloredImageCanvasList[bodyRegionId - 1] != null || $rootScope.coloredImageCanvasList[bodyRegionId - 1] != undefined) {
  1887 + coloredImageDataVar = $rootScope.coloredImageCanvasList[bodyRegionId - 1];
  1888 + }
  1889 + if ($rootScope.whiteImageDataList[bodyRegionId - 1] != null || $rootScope.whiteImageDataList[bodyRegionId - 1] != undefined) {
  1890 + white = $rootScope.whiteImageDataList[bodyRegionId - 1];
1876 1891  
  1892 + }
1877 1893 }
1878   - }
1879 1894  
1880 1895  
1881   - var worker = new Worker('extract-wp.js');
  1896 + var worker = new Worker('extract-wp.js');
1882 1897  
1883   - //push workers in array to further used the refernece to delete the workers
1884   - $scope.runningWorkers.push({ 'workerName': worker })
  1898 + //push workers in array to further used the refernece to delete the workers
  1899 + $scope.runningWorkers.push({ 'workerName': worker })
1885 1900  
1886   - // console.log('for bodyRegionId = ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))
  1901 + // console.log('for bodyRegionId = ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))
1887 1902  
1888   - if (coloredImageDataVar != null && maskData != null && white != null) {
1889   - worker.postMessage({
  1903 + if (coloredImageDataVar != null && maskData != null && white != null) {
  1904 + worker.postMessage({
1890 1905  
1891   - 'termList': multiTermList,
1892   - 'maskCanvasData': maskData,
1893   - 'coloredImageData': coloredImageDataVar,
1894   - 'grayImageData': white,
1895   - 'bodyRegionId': bodyRegionId,
1896   - 'canvasId': canvasId
  1906 + 'termList': multiTermList,
  1907 + 'maskCanvasData': maskData,
  1908 + 'coloredImageData': coloredImageDataVar,
  1909 + 'grayImageData': white,
  1910 + 'bodyRegionId': bodyRegionId,
  1911 + 'canvasId': canvasId
1897 1912  
1898   - });
1899   - }
1900   -
1901   - //}
  1913 + });
  1914 + }
1902 1915  
1903   - worker.onmessage = function (e) {
1904   - console.log('callback in extract for e.data.bodyRegionId: ' + e.data.bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
  1916 + //}
1905 1917  
  1918 + worker.onmessage = function (e) {
  1919 + console.log('callback in extract for e.data.bodyRegionId: ' + e.data.bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
1906 1920  
1907   - var updatedData = e.data.value;
1908 1921  
1909   - var bodyRegionId = e.data.bodyRegionId;
  1922 + var updatedData = e.data.value;
1910 1923  
  1924 + var bodyRegionId = e.data.bodyRegionId;
1911 1925  
1912   - var canvasId = (e.data.canvasId).replace('_mci', '');
1913   - //debugger;
1914   - //for (var i = 1; i <= updatedData.length; i++) {
1915   - var grayCanvasID = canvasId;
1916 1926  
1917   - // var grayCanvasID = 'imageCanvas' + bodyRegionId;
1918   - var grayCanvas = document.getElementById(grayCanvasID);
1919   - var grayCanvasContext = grayCanvas.getContext("2d");
  1927 + var canvasId = (e.data.canvasId).replace('_mci', '');
  1928 + //debugger;
  1929 + //for (var i = 1; i <= updatedData.length; i++) {
  1930 + var grayCanvasID = canvasId;
1920 1931  
  1932 + // var grayCanvasID = 'imageCanvas' + bodyRegionId;
  1933 + var grayCanvas = document.getElementById(grayCanvasID);
  1934 + var grayCanvasContext = grayCanvas.getContext("2d");
1921 1935  
1922 1936  
1923   - grayCanvasContext.putImageData(updatedData, 0, 0);
1924   - // }
1925 1937  
1926   - if ($rootScope.multiAnnotationIsON == true) {
1927   - //debugger;
1928   - if (canvasId.match('_MR'))
1929   - $rootScope.updatedWhiteImageMRDataList[bodyRegionId] = updatedData;
1930   - else
1931   - $rootScope.updatedWhiteImageDataList[bodyRegionId - 1] = updatedData;
  1938 + grayCanvasContext.putImageData(updatedData, 0, 0);
  1939 + // }
1932 1940  
  1941 + if ($rootScope.multiAnnotationIsON == true) {
  1942 + //debugger;
  1943 + if (canvasId.match('_MR'))
  1944 + $rootScope.updatedWhiteImageMRDataList[bodyRegionId] = updatedData;
  1945 + else
  1946 + $rootScope.updatedWhiteImageDataList[bodyRegionId - 1] = updatedData;
1933 1947  
1934   - }
1935   - else {
1936 1948  
1937   - if (canvasId.match('_MR'))
1938   - $rootScope.whiteImageMRDataList[bodyRegionId] = e.data.value;
  1949 + }
1939 1950 else {
1940   - if ($rootScope.whiteImageDataList[bodyRegionId - 1] != null || $rootScope.whiteImageDataList[bodyRegionId - 1] != undefined)
1941   - $rootScope.whiteImageDataList[bodyRegionId - 1] = e.data.value;
  1951 +
  1952 + if (canvasId.match('_MR'))
  1953 + $rootScope.whiteImageMRDataList[bodyRegionId] = e.data.value;
  1954 + else {
  1955 + if ($rootScope.whiteImageDataList[bodyRegionId - 1] != null || $rootScope.whiteImageDataList[bodyRegionId - 1] != undefined)
  1956 + $rootScope.whiteImageDataList[bodyRegionId - 1] = e.data.value;
  1957 + }
1942 1958 }
1943   - }
1944 1959  
1945   - //if ((CallBackBodyRegion != null || CallBackBodyRegion[i] != undefined) && (CallBackBodyRegion.length > 0)) {
1946   - // if (CallBackBodyRegion.length == 6) {
1947   - // $rootScope.isLoading = false;
1948   - // $('#spinner').css('visibility', 'hidden');
1949   - // }
1950   - //}
  1960 + //if ((CallBackBodyRegion != null || CallBackBodyRegion[i] != undefined) && (CallBackBodyRegion.length > 0)) {
  1961 + // if (CallBackBodyRegion.length == 6) {
  1962 + // $rootScope.isLoading = false;
  1963 + // $('#spinner').css('visibility', 'hidden');
  1964 + // }
  1965 + //}
1951 1966  
1952 1967  
1953   - $timeout(function () { $scope.DisableProgressBar() }, 1000);
  1968 + $timeout(function () { $scope.DisableProgressBar() }, 1000);
1954 1969  
1955   - };
1956   - worker.onerror = function (e) {
1957   - alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
1958   - };
  1970 + };
  1971 + worker.onerror = function (e) {
  1972 + alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
  1973 + };
  1974 + }
1959 1975 }
1960 1976 }
1961 1977 }, 50)
... ... @@ -1974,8 +1990,23 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1974 1990  
1975 1991  
1976 1992  
1977   - $timeout(function () {
1978   - for (var x = 0; x < 9; x++) {
  1993 + $timeout(function ()
  1994 + {
  1995 + var loopLength = 0;
  1996 + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
  1997 + loopLength = 9;
  1998 + }
  1999 + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) {
  2000 + loopLength = 5;
  2001 + }
  2002 + else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) {
  2003 + loopLength = 4;
  2004 + }
  2005 + else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) {
  2006 + loopLength = 1;
  2007 + }
  2008 +
  2009 + for (var x = 0; x < loopLength; x++) {
1979 2010 if ($rootScope.MaskCanvasData[x] != null || $rootScope.MaskCanvasData[x] != undefined) {
1980 2011  
1981 2012 var bodyRegionId = $rootScope.MaskCanvasData[x].bodyRegionId;
... ...