Changeset 133
- Timestamp:
- Nov 25, 2010, 12:21:39 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r130 r133 457 457 if isfield(browse,'nom_type_ima') 458 458 nom_type_ima=browse.nom_type_ima;% get an image nomenclature type already determined by an input image name 459 end 460 if isfield(browse,'ext_ima') 459 461 ext_ima=browse.ext_ima; 460 462 end … … 1546 1548 end 1547 1549 1548 %------------------------------------------------------------------------1549 % --- Executes on button press in RUN.1550 1551 1552 1553 % compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3)1554 % %check the list of operations:1555 % operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'};1556 % run_flag=1;1557 % box_test(1)=get(handles.CIV1,'Value');1558 % box_test(2)=get(handles.FIX1,'Value');1559 % box_test(3)=get(handles.PATCH1,'Value');1560 % box_test(4)=get(handles.CIV2,'Value');1561 % box_test(5)=get(handles.FIX2,'Value');1562 % box_test(6)=get(handles.PATCH2,'Value');1563 % index=find(box_test==1);1564 % if isempty(index)1565 % msgbox_uvmat('ERROR','no selected operation')1566 % return1567 % end1568 % index_first=min(index);1569 % index_last=max(index);1570 % box_used=box_test([index_first : index_last]);1571 % [box_missing,ind_missing]=min(box_used);1572 % if isequal(box_missing,0)1573 % msgbox_uvmat('ERROR',['missing' cell2mat(operations(ind_missing))]);1574 % return1575 % end1576 %1577 % %root name1578 % filebase=get(handles.RootName,'String');1579 % if isempty(filebase)||isequal(filebase,'')1580 % msgbox_uvmat('ERROR','no input files')1581 % return1582 % end1583 % %check mask if selecetd1584 % if isequal(get(handles.get_mask_civ1,'Value'),1)1585 % maskname=get(handles.mask_civ1,'String');1586 % if ~exist(maskname,'file')1587 % get_mask_civ1_Callback(hObject, eventdata, handles);1588 % end1589 % end1590 % if isequal(get(handles.get_mask_fix1,'Value'),1)1591 % maskname=get(handles.mask_fix1,'String');1592 % if ~exist(maskname,'file')1593 % get_mask_fix1_Callback(hObject, eventdata, handles);1594 % end1595 % end1596 % if isequal(get(handles.get_mask_civ2,'Value'),1)1597 % maskname=get(handles.mask_civ2,'String');1598 % if ~exist(maskname,'file')1599 % get_mask_civ2_Callback(hObject, eventdata, handles);1600 % end1601 % end1602 % if isequal(get(handles.get_mask_fix2,'Value'),1)1603 % maskname=get(handles.mask_fix2,'String');1604 % if ~exist(maskname,'file')1605 % get_mask_fix2_Callback(hObject, eventdata, handles);1606 % end1607 % end1608 %1609 % %read names of the .exe file1610 % if box_test(1)==1 || box_test(3)==1 || box_test(4)==1 || box_test(6)==11611 % path_uvmat=which('uvmat');% check the path detected for source file uvmat1612 % path_UVMAT=fileparts(path_uvmat); %path to UVMAT1613 % %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ binary names1614 % xmlfile=fullfile(path_UVMAT,'PARAM.xml');1615 % if exist(xmlfile,'file')1616 % t=xmltree(xmlfile);1617 % sparam=convert(t);1618 % end1619 % if isfield(sparam,'Civ1Bin')1620 % civ1Bin=sparam.Civ1Bin;1621 % if ~exist(civ1Bin,'file')1622 % civ1Bin=fullfile(path_UVMAT,civ1Bin);1623 % end1624 % end1625 % if isfield(sparam,'Civ2Bin')1626 % civ2Bin=sparam.Civ2Bin;1627 % if ~exist(civ2_exe,'file')%the binary is defined in /bin, default setting1628 % civ2_exe=fullfile(path_UVMAT,civ2_exe);1629 % end1630 % end1631 % if isfield(sparam,'Patch_exe')1632 % patch_exe=sparam.Patch_exe;1633 % if ~exist(patch_exe,'file')%the binary is defined in /bin, default setting1634 % patch_exe=fullfile(path_UVMAT,patch_exe);1635 % end1636 % end1637 % if isfield(sparam,'Stinterp_exe')1638 % stinterp_exe=sparam.Stinterp_exe;1639 % end1640 % if isfield(sparam,'SGE')1641 % sge=str2double(sparam.SGE);1642 % end1643 % if ~isunix % for windows system, check whether the Matlab working dir is a UBC name1644 % dircur=pwd;1645 % if ~isequal(dircur([2 3]),':\')1646 % msgbox_uvmat('ERROR','move to a Matlab current working directory with a Windows name, e.g. m:/...')1647 % return;1648 % end1649 % end1650 % end1651 %1652 % %initialize the waitbars1653 % set(handles.waitbar_1,'Position',[0.946 0.877 0.03 0.001])1654 % set(handles.waitbar_patch1,'Position',[0.946 0.626 0.03 0.001])1655 % set(handles.waitbar_civ2,'Position',[0.946 0.406 0.03 0.001])1656 % set(handles.waitbar_patch2,'Position',[0.946 0.187 0.03 0.001])1657 % set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])1658 % set(handles.RUN, 'Enable','Off')1659 % drawnow1660 %1661 % % get the list of file names and check the files1662 % display('checking the files...')1663 % [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=...1664 % set_civ_filenames(handles,compare,box_test);1665 % nbfield=numel(num1_civ1);1666 % nbslice=size(num_a_civ1);1667 %1668 % if isempty(filecell)1669 % set(handles.RUN, 'Enable','On')1670 % set(handles.RUN,'BackgroundColor',[1 0 0])1671 % set(handles.BATCH, 'Enable','On')1672 % set(handles.BATCH,'BackgroundColor',[1 0 0])1673 % return1674 % end1675 % display('files OK, processing...')1676 % nbfield=size(num1_civ1,2);1677 % nbslice=size(num1_civ1,1);1678 %1679 % %RUN CIV11680 % if box_test(1)==11681 % RUN_CIV1(handles,filecell.ima1.civ1,filecell.ima2.civ1,filecell.nc.civ1,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,nom_type_nc)1682 % if compare==31683 % RUN_CIV1(handles,filecell.imaA1.civ1,filecell.imaA2.civ1,filecell.ncA.civ1,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,nom_type_nc)1684 % end1685 % end1686 %1687 % %RUN FIX11688 % if box_test(2)==11689 % filebase=get(handles.RootName,'String');1690 % %names of the civ1 fields1691 % field1.vel_type='civ1';1692 % field1.nb='nb_vectors';1693 % % field1.X='vec_X';1694 % % field1.Y='vec_Y';1695 % % field1.U='vec_U';1696 % % field1.V='vec_V';1697 % field1.fixflag='vec_FixFlag';1698 % flagindex(1)=get(handles.vec_Fmin2, 'Value');1699 % flagindex(2)=get(handles.vec_F3, 'Value');1700 % flagindex(3)=get(handles.vec_F2, 'Value');1701 % thresh_vecC=str2double(get(handles.thresh_vecC,'String'));%threshold on image correlation vec_C1702 % thresh_vel=str2double(get(handles.thresh_vel,'String'));%threshold on velocity modulus1703 % inf_sup=get(handles.inf_sup1,'Value');1704 % menu=get(handles.field_ref1,'String');1705 % index=get(handles.field_ref1,'Value');1706 % if isempty(menu)1707 % fieldchoice='';1708 % else1709 % fieldchoice=menu{index};1710 % end1711 % h = waitbar(0,'removing velocity vectors, fix1');% display a wait bar1712 % test_mask=get(handles.get_mask_fix1,'Value');1713 % if test_mask1714 % maskdispl=get(handles.mask_fix1,'String');1715 % if exist(maskdispl,'file')1716 % test_mask=2;1717 % maskname=maskdispl;1718 % else1719 % maskbase=[get(handles.RootName,'String') '_' maskdispl]; % mask root name1720 % end1721 % end1722 % for ifile=1:nbfield1723 % waitbar(ifile/nbfield); %update the waitbar1724 % for j=1:nbslice1725 % if test_mask==01726 % maskname='noFile use default';1727 % maskflag=0;1728 % elseif test_mask==11729 % nbslice_mask=str2double(maskdispl(1:end-4)); %1730 % num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1;1731 % maskname=name_generator(maskbase,num1_mask,1,'.png','_i');% mask corresponding to the first image of the pair1732 % maskflag= exist(maskname,'file')==2;1733 % if ~maskflag;1734 % maskname='noFile use default';1735 % end1736 % end1737 % if ~isempty(file_ref_fix1)1738 % file_ref=file_ref_fix1{ifile,j};1739 % else1740 % file_ref='';1741 % end1742 % error=RUN_FIX(filecell.nc.civ1{ifile,j},field1,flagindex,1,thresh_vecC,maskflag,maskname,...1743 % thresh_vel,inf_sup,file_ref,fieldchoice);1744 %1745 % if compare==3 &&(isequal(mode,'pair j1-j2') || isequal(mode,'series(Dj)') || isequal(mode,'series(Di)'))1746 % if test_mask==01747 % maskname='noFile use default';1748 % maskflag=0;1749 % else1750 % maskbase=[get(handles.RootName2,'String') '_' maskdispl]; % mask root name1751 % nbslice_mask=str2num(maskdispl(1:end-4)); %1752 % num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1;1753 % maskname=name_generator(maskbase,num1_mask,1,'.png','_i');1754 % maskflag= exist(maskname,'file')==2;1755 % if ~maskflag;1756 % maskname='noFile use default';1757 % end1758 % end1759 % error=RUN_FIX(filecell.ncA.civ1{ifile,j},field1,flagindex,1,thresh_vecC,maskflag,maskname,...1760 % thresh_vel,inf_sup,file_ref,fieldchoice);1761 % if ~isempty(error)1762 % msgbox_uvmat('ERROR',error)1763 % return1764 % end1765 % end1766 % end1767 % end1768 % close(h)1769 % end1770 %1771 % % RUN PATCH11772 % if box_test(3)==11773 % rho_patch1=str2num(get(handles.rho_patch1,'String'));1774 % if isempty(rho_patch1)1775 % rho_patch1='1000';1776 % set(handles.rho_patch1,'String','1')1777 % else1778 % rho_patch1=num2str(1000*rho_patch1);1779 % end1780 % nx_patch1=get(handles.nx_patch1,'String');1781 % if isequal(str2num(nx_patch1),[])1782 % nx_patch1='50' ;%default1783 % set(handles.nx_patch1,'String','50');1784 % end1785 % ny_patch1=get(handles.ny_patch1,'String');1786 % if isequal(str2num(ny_patch1),[])1787 % ny_patch1='50' ;%default1788 % set(handles.ny_patch1,'String','50');1789 % end1790 % subdomain_patch1=get(handles.subdomain_patch1,'String');1791 % thresh_patch1=get(handles.thresh_patch1,'String');1792 % test_interp=get(handles.test_interp,'Value');1793 % icount=0;1794 % for ifile=1:nbfield1795 % for j=1:nbslice1796 % icount=icount+1;1797 % barlength=0.188*icount/(nbfield*nbslice);1798 % set(handles.waitbar_patch1,'Position',[0.946 0.627-barlength 0.03 barlength])1799 % drawnow1800 % if isequal(get(handles.test_stereo1,'Value'),0)1801 % cmd=RUN_PATCH(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp);1802 % s=-1;1803 % if sge1804 % [s,w]=unix(['qrsh -q -fast.q ' cmd]);1805 % end1806 % if s~=01807 % display(['!' cmd])1808 % eval(['!' cmd]);1809 % end1810 %1811 % %stereo case:1812 % elseif isequal(get(handles.test_stereo1,'Value'),1)1813 % if exist('stinterp_exe','var')%Prog Gauthier1814 % cmd=RUN_STINTERP(stinterp_exe,filecell.ncA.civ1{ifile,j},filecell.nc.civ1{ifile,j},filecell.st{ifile,j},...1815 % nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,[filebase_A '.xml'],[filebase_B '.xml']);1816 % display(['!' cmd])1817 % eval(['!' cmd]);1818 % else1819 % RUN_STLIN(filecell.ncA.civ1{ifile,j},filecell.nc.civ1{ifile,j},'civ1',filecell.st{ifile,j},...1820 % str2num(nx_patch1),str2num(ny_patch1),str2num(thresh_patch1),[filebase_A '.xml'],[filebase_B '.xml']);1821 % end1822 % end1823 % if compare==3 && isequal(get(handles.test_stereo1,'Value'),0)1824 % cmd=RUN_PATCH(filecell.ncA.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp);1825 % s=-1;1826 % if sge1827 % [s,w]=unix(['qrsh -q -fast.q ' cmd]);1828 % end1829 % if s~=01830 % display(['!' cmd])1831 % eval(['!' cmd]);1832 % end1833 % end1834 % end1835 % end1836 % end1837 %1838 % % CIV21839 % if box_test(4)==11840 % RUN_CIV2(handles,filecell.ima1.civ2,filecell.ima2.civ2,filecell.nc.civ1,filecell.nc.civ2,num1_civ2,num2_civ2,...1841 % num_a_civ2,num_b_civ2,nom_type_nc)1842 % end1843 %1844 % % FIX21845 % if box_test(5)==11846 % %names of the civ2 fields1847 % field2.vel_type='civ2';1848 % field2.nb='nb_vectors2';1849 % field2.X='vec2_X';1850 % field2.Y='vec2_Y';1851 % field2.U='vec2_U';1852 % field2.V='vec2_V';1853 % field2.fixflag='vec2_FixFlag';1854 % flagindex(1)=get(handles.vec_Fmin2_2, 'Value');1855 % flagindex(2)=get(handles.vec_F3_2, 'Value');1856 % flagindex(3)=get(handles.vec_F4, 'Value');1857 % thresh_vec2C=str2num(get(handles.thresh_vec2C,'String'));%threshold on image correlation vec_C1858 % thresh_vel2=str2num(get(handles.thresh_vel2,'String'));%threshold on velocity modulus1859 % inf_sup=get(handles.inf_sup2,'Value');1860 % menu=get(handles.field_ref2,'String');1861 % index=get(handles.field_ref2,'Value');1862 % if isempty(menu)1863 % fieldchoice='';1864 % else1865 % fieldchoice=menu{index};1866 % end1867 % h = waitbar(0,['removing velocity vectors, fix2']);% display a wait bar1868 % test_mask=get(handles.get_mask_fix2,'Value');1869 % if test_mask1870 % maskdispl=get(handles.mask_fix2,'String');1871 % if exist(maskdispl,'file')1872 % test_mask=2;1873 % maskname=maskdispl;1874 % else1875 % maskbase=[get(handles.RootName,'String') '_' maskdispl]; % mask root name1876 % end1877 % end1878 % for ifile=1:nbfield1879 % waitbar(ifile/nbfield); %update the waitbar1880 % for j=1:nbslice1881 % if test_mask==01882 % maskname='noFile use default';1883 % maskflag=0;1884 % elseif test_mask==11885 % nbslice_mask=str2num(maskdispl(1:end-4)); %1886 % num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1;1887 % maskname=name_generator(maskbase,num1_mask,1,'.png','_i');1888 % maskflag= exist(maskname,'file')==2;1889 % if ~maskflag;1890 % maskname='noFile use default';1891 % end1892 % end1893 % if ~isempty(file_ref_fix2)1894 % file_ref=file_ref_fix2{ifile,j};1895 % else1896 % file_ref='';1897 % end1898 % error=RUN_FIX(filecell.nc.civ2{ifile,j},field2,flagindex,2,thresh_vec2C,maskflag,maskname,...1899 % thresh_vel2,inf_sup,file_ref,fieldchoice);1900 % if ~isempty(error)1901 % msgbox_uvmat('ERROR',error)1902 % return1903 % end1904 % if compare==31905 % if test_mask==01906 % maskname='noFile use default';1907 % maskflag=0;1908 % else1909 % maskbase=[get(handles.RootName2,'String') '_' maskdispl]; % mask root name1910 % nbslice_mask=str2num(maskdispl(1:end-4)); %1911 % num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1;1912 % maskname=name_generator(maskbase,num1_mask,1,'.png','_i');1913 % maskflag= exist(maskname,'file')==2;1914 % if ~maskflag;1915 % maskname='noFile use default';1916 % end1917 % end1918 % error=RUN_FIX(filecell.ncA.civ2{ifile,j},field2,flagindex,1,thresh_vec2C,maskflag,maskname,...1919 % thresh_vel2,inf_sup,file_ref,fieldchoice);1920 % if ~isempty(error)1921 % msgbox_uvmat('ERROR',error)1922 % return1923 % end1924 % end1925 % end1926 % end1927 % close(h)1928 % end1929 %1930 % %PATCH 21931 % if box_test(6)==11932 % rho_patch2=str2num(get(handles.rho_patch2,'String'));1933 % if isempty(rho_patch2)1934 % rho_patch2='1000';1935 % set(handles.rho_patch2,'String','1')1936 % else1937 % rho_patch2=num2str(1000*rho_patch2);1938 % end1939 % nx_patch2=get(handles.nx_patch2,'String');1940 % ny_patch2=get(handles.ny_patch2,'String');1941 % thresh_patch2=get(handles.thresh_patch2,'String');1942 % if isequal(str2num(nx_patch2),[])1943 % nx_patch2='50' ;%default1944 % set(handles.nx_patch2,'String','50');1945 % end1946 % if isequal(str2num(ny_patch2),[])1947 % ny_patch2='50' ;%default1948 % set(handles.ny_patch2,'String','50');1949 % end1950 % subdomain_patch2=get(handles.subdomain_patch2,'String');1951 % icount=0;1952 % for ifile=1:nbfield1953 % for j=1:nbslice1954 % icount=icount+1;1955 % barlength=0.188*icount/(nbfield*nbslice);1956 % set(handles.waitbar_patch2,'Position',[0.946 0.188-barlength 0.03 barlength])1957 % drawnow1958 % if compare~=3 | isequal(get(handles.test_stereo2,'Value'),0)1959 % cmd=RUN_PATCH(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,1,0);1960 % s=-1;1961 % if sge1962 % [s,w]=unix(['qrsh -q -fast.q ' cmd]);1963 % end1964 % if s~=01965 % display(['!' cmd])1966 % eval(['!' cmd]);1967 % end1968 % elseif compare==3 && isequal(get(handles.test_stereo2,'Value'),1)1969 % if exist('stinterp_exe','var')%Prog Gauthier1970 % cmd=RUN_STINTERP(stinterp_exe,filecell.ncA.civ2{ifile,j},filecell.nc.civ2{ifile,j},filecell.st{ifile,j},...1971 % nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,[filebase_A '.xml'],[filebase_B '.xml']);1972 % display(['!' cmd])1973 % eval(['!' cmd])1974 % else1975 % RUN_STLIN(filecell.ncA.civ2{ifile,j},filecell.nc.civ2{ifile,j},'civ2',filecell.st{ifile,j},...1976 % str2num(nx_patch2),str2num(ny_patch2),str2num(thresh_patch2),[filebase_A '.xml'],[filebase_B '.xml'])1977 % end1978 % end1979 % if compare==3 && isequal(get(handles.test_stereo2,'Value'),0)1980 % cmd=RUN_PATCH(filecell.ncA.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,1,0);1981 % s=-1;1982 % if sge1983 % [s,w]=unix(['qrsh -q -fast.q ' cmd]);1984 % end1985 % if s~=01986 % display(['!' cmd])1987 % eval(['!' cmd]);1988 % end1989 % end1990 % end1991 % end1992 % end1993 %1994 % set(handles.RUN, 'Enable','On')1995 % set(handles.RUN,'BackgroundColor',[1 0 0])1996 %1997 % %save the current interface setting as figure namefig, append .0 to the name if it already exists1998 % if isfield(filecell,'st')1999 % fileresu=filecell.st{1,1};2000 % elseif isfield(filecell,'nc')2001 % if isfield(filecell.nc,'civ2')2002 % fileresu=filecell.nc.civ2{1,1};2003 % else2004 % fileresu=filecell.nc.civ1{1,1};2005 % end2006 % end2007 % [RootPath,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileresu);2008 % namedoc=fullfile(RootPath,subdir,RootFile);2009 % detect=1;2010 % while detect==12011 % namefigfull=[namedoc '.fig'];2012 % hh=dir(namefigfull);2013 % if ~isempty(hh)2014 % detect=1;2015 % namedoc=[namedoc '.0'];2016 % else2017 % detect=0;2018 % end2019 % end2020 % saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml)2021 2022 1550 function RUN_Callback(hObject, eventdata, handles) 2023 1551 %------------------------------------------------------------------------ … … 2033 1561 % --- Executes on button press in BATCH: remote processing 2034 1562 function BATCH_Callback(hObject, eventdata, handles) 2035 % ------------------------------------------------------------------------1563 %% ----------------------------------------------------------------------- 2036 1564 %global civ1_exe civ2_exe patch_exe patch_new_exe fix_exe todo_path sge Civ_exe % probabely to remove 2037 1565 set(handles.BATCH, 'Enable','Off') … … 2043 1571 2044 1572 %------------------------------------------------------------------------ 2045 % --- Executes on button press inBATCH: remote processing1573 % --- Lauch command called by RUN and BATCH: remote processing 2046 1574 function launch_jobs(hObject, eventdata, handles, batch) 2047 1575 %----------------------------------------------------------------------- 2048 compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3) 2049 2050 %check the list of operations: 1576 %% check the selected list of operations: 2051 1577 operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'}; 2052 % run_flag=1;2053 1578 box_test(1)=get(handles.CIV1,'Value'); 2054 1579 box_test(2)=get(handles.FIX1,'Value'); … … 2071 1596 end 2072 1597 2073 % root name1598 %% get the root names 2074 1599 filebase=get(handles.RootName,'String'); 2075 1600 if isempty(filebase)||isequal(filebase,'') … … 2104 1629 end 2105 1630 2106 %read names of the .exe file 2107 path_uvmat=which('uvmat');% check the path detected for source file uvmat 2108 path_UVMAT=fileparts(path_uvmat); %path to UVMAT 2109 xmlfile='PARAM.xml'; 2110 if exist(xmlfile,'file') 2111 t=xmltree(xmlfile); 2112 s=convert(t); 2113 end 2114 test_interp=0; 2115 if batch 2116 if isfield(s,'BatchParam') 2117 sparam=s.BatchParam; 2118 if ~ismember(sparam.BatchMode,{'sge'}) 2119 msgbox_uvmat('ERROR',['batch mode ' sparam.BatchMode ' not supported by UVMAT']) 2120 end 2121 else 2122 msgbox_uvmat('ERROR','no batch mode defined in PARAM.xml') 2123 return 2124 end 2125 else 2126 if isfield(s,'RunParam') 2127 sparam=s.RunParam; 2128 else 2129 msgbox_uvmat('ERROR','no civ binaries defined in PARAM.xml') 2130 return 2131 end 2132 if isfield(sparam,'CivBin') 2133 if ~exist(sparam.CivBin,'file') 2134 sparam.CivBin=fullfile(path_UVMAT,sparam.CivBin); 2135 end 2136 end 2137 if isfield(sparam,'Civ1Bin') 2138 if ~exist(sparam.Civ1Bin,'file') 2139 sparam.Civ1Bin=fullfile(path_UVMAT,sparam.Civ1Bin); 2140 end 2141 end 2142 if isfield(sparam,'Civ2Bin') 2143 if ~exist(sparam.Civ2Bin,'file') 2144 sparam.Civ2Bin=fullfile(path_UVMAT,sparam.Civ2Bin); 2145 end 2146 end 2147 %test_interp=get(handles.test_interp,'Value'); 2148 2149 if isfield(sparam,'PatchBin') 2150 if ~exist(sparam.PatchBin,'file') 2151 sparam.PatchBin=fullfile(path_UVMAT,sparam.PatchBin); 2152 end 2153 end 2154 % if test_interp && isfield(sparam,'PatchNewBin') 2155 % if ~exist(sparam.PatchNewBin,'file') 2156 % sparam.PatchNewBin=fullfile(path_UVMAT,sparam.PatchNewBin); 2157 % end 2158 % end 2159 if isfield(sparam,'FixBin') 2160 if ~exist(sparam.FixBin,'file') 2161 sparam.FixBin=fullfile(path_UVMAT,sparam.FixBin); 2162 end 2163 end 2164 end 2165 if batch 2166 if isfield(sparam,'BatchMode') 2167 batch_mode=sparam.BatchMode; 2168 end 2169 else 2170 MaxCivProcesses=50; 2171 if isfield(sparam,'MaxCivProcesses') 2172 MaxCivProcesses=str2double(sparam.MaxCivProcesses); 2173 end 2174 end 2175 2176 %initialize the waitbars 1631 %% initialize the waitbars 2177 1632 set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001]) 2178 1633 set(handles.waitbar_patch1,'Position',[0.946 0.439 0.03 0.001]) … … 2181 1636 drawnow 2182 1637 2183 % set the list of files and check them1638 %% set the list of files and check them 2184 1639 display('checking the files...') 2185 [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=... 1640 compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3) 1641 [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc]=... 2186 1642 set_civ_filenames(handles,compare,box_test); 2187 1643 if isempty(filecell) 2188 1644 return 2189 1645 end 2190 %choice of batch priority 1646 nbfield=numel(num1_civ1); 1647 nbslice=numel(num_a_civ1); 1648 1649 %% choice of batch priority 2191 1650 ind_answer=2; 2192 1651 if batch … … 2210 1669 [xx,w]=unix('ps faux |grep civ|wc -l'); 2211 1670 w(end)=[]; 2212 if str2double(w)+numel(num1_civ1)> MaxCivProcesses1671 if str2double(w)+numel(num1_civ1)> 50 2213 1672 msgbox_uvmat('ERROR',{['There are already ' w ' civ processes running locally'];'Use BATCH or submit RUN later'}) 2214 1673 return … … 2216 1675 end 2217 1676 end 1677 1678 1679 %% read names of the .exe files for PIV and patch 1680 path_UVMAT=fileparts(which('uvmat')); %path to the source directory of uvmat 1681 xmlfile='PARAM.xml'; 1682 if exist(xmlfile,'file')% search parameter xml file in the whole matlab path 1683 t=xmltree(xmlfile); 1684 s=convert(t); 1685 end 1686 test_interp=0; 1687 if batch 1688 if isfield(s,'BatchParam') 1689 sparam=s.BatchParam; 1690 if ~ismember(sparam.BatchMode,{'sge'}) 1691 msgbox_uvmat('ERROR',['batch mode ' sparam.BatchMode ' not supported by UVMAT']) 1692 end 1693 else 1694 msgbox_uvmat('ERROR','no batch mode defined in PARAM.xml') 1695 return 1696 end 1697 else 1698 if isfield(s,'RunParam') 1699 sparam=s.RunParam; 1700 else 1701 msgbox_uvmat('ERROR','no civ binaries defined in PARAM.xml') 1702 return 1703 end 1704 if isfield(sparam,'CivBin') 1705 if ~exist(sparam.CivBin,'file') 1706 sparam.CivBin=fullfile(path_UVMAT,sparam.CivBin); 1707 end 1708 end 1709 if isfield(sparam,'Civ1Bin') 1710 if ~exist(sparam.Civ1Bin,'file') 1711 sparam.Civ1Bin=fullfile(path_UVMAT,sparam.Civ1Bin); 1712 end 1713 end 1714 if isfield(sparam,'Civ2Bin') 1715 if ~exist(sparam.Civ2Bin,'file') 1716 sparam.Civ2Bin=fullfile(path_UVMAT,sparam.Civ2Bin); 1717 end 1718 end 1719 %test_interp=get(handles.test_interp,'Value'); 1720 1721 if isfield(sparam,'PatchBin') 1722 if ~exist(sparam.PatchBin,'file') 1723 sparam.PatchBin=fullfile(path_UVMAT,sparam.PatchBin); 1724 end 1725 end 1726 % if test_interp && isfield(sparam,'PatchNewBin') 1727 % if ~exist(sparam.PatchNewBin,'file') 1728 % sparam.PatchNewBin=fullfile(path_UVMAT,sparam.PatchNewBin); 1729 % end 1730 % end 1731 if isfield(sparam,'FixBin') 1732 if ~exist(sparam.FixBin,'file') 1733 sparam.FixBin=fullfile(path_UVMAT,sparam.FixBin); 1734 end 1735 end 1736 end 1737 if batch 1738 if isfield(sparam,'BatchMode') 1739 batch_mode=sparam.BatchMode; 1740 end 1741 else 1742 % MaxCivProcesses=50; 1743 % if isfield(sparam,'MaxCivProcesses') 1744 % MaxCivProcesses=str2double(sparam.MaxCivProcesses); 1745 % end 1746 end 1747 1748 1749 %% get civ1 parameters: 2218 1750 display('files OK, processing...') 2219 nbfield=numel(num1_civ1);2220 nbslice=numel(num_a_civ1);2221 2222 %GET PARAMETERS:2223 1751 %get civ parameters 2224 1752 if box_test(1)==1 … … 2226 1754 end 2227 1755 2228 % get fix1 parameters1756 %% get fix1 parameters 2229 1757 if box_test(2)==1 2230 1758 flagindex1(1)=get(handles.vec_Fmin2, 'Value'); … … 2250 1778 end 2251 1779 2252 % get patch1 parameters1780 %% get patch1 parameters 2253 1781 if box_test(3)==1 2254 1782 rho_patch1=str2double(get(handles.rho_patch1,'String')); … … 2273 1801 end 2274 1802 2275 % get civ2 parameters1803 %% get civ2 parameters: 2276 1804 if box_test(4)==1 2277 1805 par_civ2=read_param_civ2(handles,cell2mat(filecell.ima1.civ2(1,1))); 2278 1806 end 2279 1807 2280 % get fix2 parameters1808 %% get fix2 parameters 2281 1809 if box_test(5)==1 2282 1810 flagindex2(1)=get(handles.vec_Fmin2_2, 'Value'); … … 2294 1822 end 2295 1823 2296 % get patch2 parameters1824 %% get patch2 parameters 2297 1825 if box_test(6)==1 2298 1826 rho_patch2=str2double(get(handles.rho_patch2,'String')); … … 2318 1846 end 2319 1847 2320 %MAIN LOOP 2321 % for ifile=1:nbfield 2322 % p1text=[];%initiate command text 1848 %% MAIN LOOP 2323 1849 time=get(handles.RootName,'UserData'); %get the set of times 2324 1850 civAll=get(handles.Experimental,'Value'); % Boolean for new civ excution method 1851 super_cmd='#!/bin/bash \n'; 1852 super_cmd=[super_cmd '#$ -cwd \n']; 1853 super_cmd=[super_cmd 'hostname && date \n']; 2325 1854 for ifile=1:nbfield 2326 1855 for j=1:nbslice … … 2697 2226 case 'sge' 2698 2227 pvalue=num2str((1-ind_answer)*500); 2699 namelog=[filename_bat '.patch.log'];2228 %namelog=[filename_bat '.patch.log']; 2700 2229 display(['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]); 2701 2230 eval( ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]); … … 2704 2233 %% to lauch the jobs locally : 2705 2234 if(isunix) 2706 cmd_str=['!. ' filename_bat ' &']; 2707 % cmd_str=['!at -qb now -f ' filename_bat ' &']; %ou at -qb now -f bad idea... 2708 eval(cmd_str); 2709 display(cmd_str); 2710 else 2711 cmd_str=['!' filename_bat ' &']; 2712 eval(cmd_str); 2713 display(cmd_str); 2714 end 2715 end 2716 end 2717 end 2718 % set(handles.BATCH, 'Enable','On') 2719 % set(handles.BATCH,'BackgroundColor',[1 0 0]) 2235 % cmd_str=['!. ' filename_bat ' &']; 2236 cmd_str=['!. ' filename_bat]; 2237 display(cmd_str) 2238 % super_cmd=[super_cmd filename_bat] 2239 % cmd_str=['!at -qb now -f ' filename_bat ' &']; %ou at -qb now -f bad idea... 2240 else %case of Windows 2241 cmd_str=['!' filename_bat ' &']; 2242 end 2243 eval(cmd_str); 2244 display(cmd_str); 2245 end 2246 end 2247 end 2248 if ~batch%TODO: a revoir, cas 'run as background task' 2249 eval(['!.' super_cmd]) 2250 end 2720 2251 2721 2252 %save interface state … … 2742 2273 saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) 2743 2274 2744 %------------------------------------------------------------------------2745 %OUTPUT:2746 % filecell: structure of input and output files2747 % .ima1.civ1{i,j}, .ima1.civ2{i,j}; set of first image names for correlations, for civ1 and civ22748 % .ima2.civ1{i,j}, .ima2.civ2{i,j} ; set of second image names for correlations2749 % .imaA1.civ1{i,j}, .ima1.civ2{i,j}; set of first image names for correlations, for civ1 and civ2, with camA in stereo case (then .ima1 corresponds to camB)2750 % .imaA2.civ1{i,j}, .ima2.civ2{i,j} ; set of second image names for correlations, with camA in stereo case (then .ima1 corresponds to camB)2751 % .nc.civ1{i,j}, .nc.civ2{i,j}; set of nc files for PIV results2752 % .ncA.civ1{i,j}, .ncA.civ2{i,j}; set of nc files for PIV results with camA (then .nc corresponds to camB)2753 % .st{i,j}; set of nc files for the combined stereo fields2754 % num1_civ1(i),num2_civ1(i): lists of first and last i indices for civ12755 % num_a_civ1(j),num_b_civ1(j): lists of first and last j indices for civ12756 % num1_civ2(i),num2_civ2(i): lists of first and last i indices for civ22757 % num_a_civ2(j),num_b_civ2(j): lists of first and last j indices for civ22758 % nom_type_nc: nomenclature type for velocity files2759 % file_ref_fix1,file_ref_fix2: reference files possibly used by Fix1 and 22760 2275 function [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=... 2761 2276 set_civ_filenames(handles,compare,box_test) … … 3377 2892 type_ima1='none';%default 3378 2893 movieobject1=[];%default 3379 if isequal(lower(ext_ima),'.avi')2894 if strcmpi(ext_ima,'.avi') 3380 2895 hhh=which('mmreader'); 3381 2896 if ~isequal(hhh,'')&& mmreader.isPlatformSupported()% if the mmreader function is found (recent version of matlab) … … 3385 2900 type_ima1='avi'; 3386 2901 end 3387 else 2902 elseif ischar(ext_ima) && ~isempty(ext_ima(2:end)) 3388 2903 form=imformats(ext_ima(2:end)); 3389 2904 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab … … 3397 2912 type_ima2='none';%default 3398 2913 movieobject2=[]; 3399 if isequal(lower(ext_ima),'.avi')2914 if strcmpi(ext_ima,'.avi') 3400 2915 hhh=which('mmreader'); 3401 2916 if ~isequal(hhh,'')&& mmreader.isPlatformSupported()% if the mmreader function is found (recent version of matlab) … … 3405 2920 type_ima2='avi'; 3406 2921 end 3407 else 2922 elseif ischar(ext_ima) && ~isempty(ext_ima(2:end)) 3408 2923 form=imformats(ext_ima(2:end)); 3409 2924 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab … … 3467 2982 end 3468 2983 end 3469 3470 2984 3471 2985 %------------------------------------------------------------------------ … … 3646 3160 3647 3161 %------------------------------------------------------------------------ 3648 % --- Executes on button press in get_mask_civ1 .3162 % --- Executes on button press in get_mask_civ1: select box for mask option 3649 3163 function get_mask_civ1_Callback(hObject, eventdata, handles) 3650 3164 %------------------------------------------------------------------------ … … 3691 3205 set(handles.mask_fix2,'String',mask_displ) 3692 3206 end 3693 set(handles. mask_civ2,'Value',maskval)3207 set(handles.get_mask_civ2,'Value',maskval)%update the civ2 mask with the same option as civ1 3694 3208 3695 3209 %------------------------------------------------------------------------ … … 3738 3252 3739 3253 %------------------------------------------------------------------------ 3740 % --- Executes on button press in get_mask_civ2 .3254 % --- Executes on button press in get_mask_civ2: select box for mask option 3741 3255 function get_mask_civ2_Callback(hObject, eventdata, handles) 3742 3256 %------------------------------------------------------------------------ … … 5010 4524 set(handles.thresh_vel2,'String','0'); 5011 4525 5012 % %------------------------------------------------------------------------5013 % % transform letters to numbers5014 % function numres=stra2num(str)5015 % %------------------------------------------------------------------------5016 % numres=double(str)-96;5017 % if double(str) >= 48 & double(str) <= 57 % = 1 for numbers5018 % numres=str2num(str);5019 % end5020 5021 4526 %------------------------------------------------------------------------ 5022 4527 % --- Executes on button press in test_stereo1.
Note: See TracChangeset
for help on using the changeset viewer.