- Timestamp:
- Mar 25, 2010, 6:48:48 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/RUN_FIX.m
r56 r67 26 26 %check writing access 27 27 [errorread,message]=fileattrib(filename); 28 if ~isempty(message) && ~isequal(message.UserWrite,1) 28 if ischar(message) 29 msgbox_uvmat('ERROR',[filename ':' message]); 30 return 31 end 32 if ~isequal(message.UserWrite,1) 29 33 msgbox_uvmat('ERROR',['no writting access to ' filename ' (RUN_FIX.m)']); 30 34 return -
trunk/src/civ.m
r66 r67 51 51 % handles structure with handles and user data (see GUIDATA) 52 52 % varargin command line arguments to civ (see VARARGIN) 53 global test_batch patch_new _exe%=1 if patch processing available53 global test_batch patch_newBin%=1 if patch processing available 54 54 %filebase: root name 55 55 %nom_type: nomencalture used ('png_old','_i_j'...) … … 132 132 msgbox_uvmat('ERROR',errormsg); 133 133 end 134 patch_new _exe='';134 patch_newBin=''; 135 135 % todo_patch=''; 136 136 sge=0; 137 137 138 if isfield(sparam,'PatchNew _exe')139 patch_new _exe=sparam.PatchNew_exe;138 if isfield(sparam,'PatchNewBin') 139 patch_newBin=sparam.PatchNewBin; 140 140 end 141 141 … … 1557 1557 %------------------------------------------------------------------------ 1558 1558 % --- Executes on button press in RUN. 1559 1560 1561 1562 % compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3) 1563 % %check the list of operations: 1564 % operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'}; 1565 % run_flag=1; 1566 % box_test(1)=get(handles.CIV1,'Value'); 1567 % box_test(2)=get(handles.FIX1,'Value'); 1568 % box_test(3)=get(handles.PATCH1,'Value'); 1569 % box_test(4)=get(handles.CIV2,'Value'); 1570 % box_test(5)=get(handles.FIX2,'Value'); 1571 % box_test(6)=get(handles.PATCH2,'Value'); 1572 % index=find(box_test==1); 1573 % if isempty(index) 1574 % msgbox_uvmat('ERROR','no selected operation') 1575 % return 1576 % end 1577 % index_first=min(index); 1578 % index_last=max(index); 1579 % box_used=box_test([index_first : index_last]); 1580 % [box_missing,ind_missing]=min(box_used); 1581 % if isequal(box_missing,0) 1582 % msgbox_uvmat('ERROR',['missing' cell2mat(operations(ind_missing))]); 1583 % return 1584 % end 1585 % 1586 % %root name 1587 % filebase=get(handles.displ_filebase,'String'); 1588 % if isempty(filebase)||isequal(filebase,'') 1589 % msgbox_uvmat('ERROR','no input files') 1590 % return 1591 % end 1592 % %check mask if selecetd 1593 % if isequal(get(handles.get_mask_civ1,'Value'),1) 1594 % maskname=get(handles.mask_civ1,'String'); 1595 % if ~exist(maskname,'file') 1596 % get_mask_civ1_Callback(hObject, eventdata, handles); 1597 % end 1598 % end 1599 % if isequal(get(handles.get_mask_fix1,'Value'),1) 1600 % maskname=get(handles.mask_fix1,'String'); 1601 % if ~exist(maskname,'file') 1602 % get_mask_fix1_Callback(hObject, eventdata, handles); 1603 % end 1604 % end 1605 % if isequal(get(handles.get_mask_civ2,'Value'),1) 1606 % maskname=get(handles.mask_civ2,'String'); 1607 % if ~exist(maskname,'file') 1608 % get_mask_civ2_Callback(hObject, eventdata, handles); 1609 % end 1610 % end 1611 % if isequal(get(handles.get_mask_fix2,'Value'),1) 1612 % maskname=get(handles.mask_fix2,'String'); 1613 % if ~exist(maskname,'file') 1614 % get_mask_fix2_Callback(hObject, eventdata, handles); 1615 % end 1616 % end 1617 % 1618 % %read names of the .exe file 1619 % if box_test(1)==1 || box_test(3)==1 || box_test(4)==1 || box_test(6)==1 1620 % path_uvmat=which('uvmat');% check the path detected for source file uvmat 1621 % path_UVMAT=fileparts(path_uvmat); %path to UVMAT 1622 % %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ binary names 1623 % xmlfile=fullfile(path_UVMAT,'PARAM.xml'); 1624 % if exist(xmlfile,'file') 1625 % t=xmltree(xmlfile); 1626 % sparam=convert(t); 1627 % end 1628 % if isfield(sparam,'Civ1Bin') 1629 % civ1Bin=sparam.Civ1Bin; 1630 % if ~exist(civ1Bin,'file') 1631 % civ1Bin=fullfile(path_UVMAT,civ1Bin); 1632 % end 1633 % end 1634 % if isfield(sparam,'Civ2Bin') 1635 % civ2Bin=sparam.Civ2Bin; 1636 % if ~exist(civ2_exe,'file')%the binary is defined in /bin, default setting 1637 % civ2_exe=fullfile(path_UVMAT,civ2_exe); 1638 % end 1639 % end 1640 % if isfield(sparam,'Patch_exe') 1641 % patch_exe=sparam.Patch_exe; 1642 % if ~exist(patch_exe,'file')%the binary is defined in /bin, default setting 1643 % patch_exe=fullfile(path_UVMAT,patch_exe); 1644 % end 1645 % end 1646 % if isfield(sparam,'Stinterp_exe') 1647 % stinterp_exe=sparam.Stinterp_exe; 1648 % end 1649 % if isfield(sparam,'SGE') 1650 % sge=str2double(sparam.SGE); 1651 % end 1652 % if ~isunix % for windows system, check whether the Matlab working dir is a UBC name 1653 % dircur=pwd; 1654 % if ~isequal(dircur([2 3]),':\') 1655 % msgbox_uvmat('ERROR','move to a Matlab current working directory with a Windows name, e.g. m:/...') 1656 % return; 1657 % end 1658 % end 1659 % end 1660 % 1661 % %initialize the waitbars 1662 % set(handles.waitbar_1,'Position',[0.946 0.877 0.03 0.001]) 1663 % set(handles.waitbar_patch1,'Position',[0.946 0.626 0.03 0.001]) 1664 % set(handles.waitbar_civ2,'Position',[0.946 0.406 0.03 0.001]) 1665 % set(handles.waitbar_patch2,'Position',[0.946 0.187 0.03 0.001]) 1666 % set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 1667 % set(handles.RUN, 'Enable','Off') 1668 % drawnow 1669 % 1670 % % get the list of file names and check the files 1671 % display('checking the files...') 1672 % [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]=... 1673 % set_civ_filenames(handles,compare,box_test); 1674 % nbfield=numel(num1_civ1); 1675 % nbslice=size(num_a_civ1); 1676 % 1677 % if isempty(filecell) 1678 % set(handles.RUN, 'Enable','On') 1679 % set(handles.RUN,'BackgroundColor',[1 0 0]) 1680 % set(handles.BATCH, 'Enable','On') 1681 % set(handles.BATCH,'BackgroundColor',[1 0 0]) 1682 % return 1683 % end 1684 % display('files OK, processing...') 1685 % nbfield=size(num1_civ1,2); 1686 % nbslice=size(num1_civ1,1); 1687 % 1688 % %RUN CIV1 1689 % if box_test(1)==1 1690 % 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) 1691 % if compare==3 1692 % 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) 1693 % end 1694 % end 1695 % 1696 % %RUN FIX1 1697 % if box_test(2)==1 1698 % filebase=get(handles.displ_filebase,'String'); 1699 % %names of the civ1 fields 1700 % field1.vel_type='civ1'; 1701 % field1.nb='nb_vectors'; 1702 % % field1.X='vec_X'; 1703 % % field1.Y='vec_Y'; 1704 % % field1.U='vec_U'; 1705 % % field1.V='vec_V'; 1706 % field1.fixflag='vec_FixFlag'; 1707 % flagindex(1)=get(handles.vec_Fmin2, 'Value'); 1708 % flagindex(2)=get(handles.vec_F3, 'Value'); 1709 % flagindex(3)=get(handles.vec_F2, 'Value'); 1710 % thresh_vecC=str2double(get(handles.thresh_vecC,'String'));%threshold on image correlation vec_C 1711 % thresh_vel=str2double(get(handles.thresh_vel,'String'));%threshold on velocity modulus 1712 % inf_sup=get(handles.inf_sup1,'Value'); 1713 % menu=get(handles.field_ref1,'String'); 1714 % index=get(handles.field_ref1,'Value'); 1715 % if isempty(menu) 1716 % fieldchoice=''; 1717 % else 1718 % fieldchoice=menu{index}; 1719 % end 1720 % h = waitbar(0,'removing velocity vectors, fix1');% display a wait bar 1721 % test_mask=get(handles.get_mask_fix1,'Value'); 1722 % if test_mask 1723 % maskdispl=get(handles.mask_fix1,'String'); 1724 % if exist(maskdispl,'file') 1725 % test_mask=2; 1726 % maskname=maskdispl; 1727 % else 1728 % maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name 1729 % end 1730 % end 1731 % for ifile=1:nbfield 1732 % waitbar(ifile/nbfield); %update the waitbar 1733 % for j=1:nbslice 1734 % if test_mask==0 1735 % maskname='noFile use default'; 1736 % maskflag=0; 1737 % elseif test_mask==1 1738 % nbslice_mask=str2double(maskdispl(1:end-4)); % 1739 % num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; 1740 % maskname=name_generator(maskbase,num1_mask,1,'.png','_i');% mask corresponding to the first image of the pair 1741 % maskflag= exist(maskname,'file')==2; 1742 % if ~maskflag; 1743 % maskname='noFile use default'; 1744 % end 1745 % end 1746 % if ~isempty(file_ref_fix1) 1747 % file_ref=file_ref_fix1{ifile,j}; 1748 % else 1749 % file_ref=''; 1750 % end 1751 % error=RUN_FIX(filecell.nc.civ1{ifile,j},field1,flagindex,1,thresh_vecC,maskflag,maskname,... 1752 % thresh_vel,inf_sup,file_ref,fieldchoice); 1753 % 1754 % if compare==3 &&(isequal(mode,'pair j1-j2') || isequal(mode,'series(Dj)') || isequal(mode,'series(Di)')) 1755 % if test_mask==0 1756 % maskname='noFile use default'; 1757 % maskflag=0; 1758 % else 1759 % maskbase=[get(handles.displ_filebase2,'String') '_' maskdispl]; % mask root name 1760 % nbslice_mask=str2num(maskdispl(1:end-4)); % 1761 % num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; 1762 % maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 1763 % maskflag= exist(maskname,'file')==2; 1764 % if ~maskflag; 1765 % maskname='noFile use default'; 1766 % end 1767 % end 1768 % error=RUN_FIX(filecell.ncA.civ1{ifile,j},field1,flagindex,1,thresh_vecC,maskflag,maskname,... 1769 % thresh_vel,inf_sup,file_ref,fieldchoice); 1770 % if ~isempty(error) 1771 % msgbox_uvmat('ERROR',error) 1772 % return 1773 % end 1774 % end 1775 % end 1776 % end 1777 % close(h) 1778 % end 1779 % 1780 % % RUN PATCH1 1781 % if box_test(3)==1 1782 % rho_patch1=str2num(get(handles.rho_patch1,'String')); 1783 % if isempty(rho_patch1) 1784 % rho_patch1='1000'; 1785 % set(handles.rho_patch1,'String','1') 1786 % else 1787 % rho_patch1=num2str(1000*rho_patch1); 1788 % end 1789 % nx_patch1=get(handles.nx_patch1,'String'); 1790 % if isequal(str2num(nx_patch1),[]) 1791 % nx_patch1='50' ;%default 1792 % set(handles.nx_patch1,'String','50'); 1793 % end 1794 % ny_patch1=get(handles.ny_patch1,'String'); 1795 % if isequal(str2num(ny_patch1),[]) 1796 % ny_patch1='50' ;%default 1797 % set(handles.ny_patch1,'String','50'); 1798 % end 1799 % subdomain_patch1=get(handles.subdomain_patch1,'String'); 1800 % thresh_patch1=get(handles.thresh_patch1,'String'); 1801 % test_interp=get(handles.test_interp,'Value'); 1802 % icount=0; 1803 % for ifile=1:nbfield 1804 % for j=1:nbslice 1805 % icount=icount+1; 1806 % barlength=0.188*icount/(nbfield*nbslice); 1807 % set(handles.waitbar_patch1,'Position',[0.946 0.627-barlength 0.03 barlength]) 1808 % drawnow 1809 % if isequal(get(handles.test_stereo1,'Value'),0) 1810 % cmd=RUN_PATCH(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp); 1811 % s=-1; 1812 % if sge 1813 % [s,w]=unix(['qrsh -q -fast.q ' cmd]); 1814 % end 1815 % if s~=0 1816 % display(['!' cmd]) 1817 % eval(['!' cmd]); 1818 % end 1819 % 1820 % %stereo case: 1821 % elseif isequal(get(handles.test_stereo1,'Value'),1) 1822 % if exist('stinterp_exe','var')%Prog Gauthier 1823 % cmd=RUN_STINTERP(stinterp_exe,filecell.ncA.civ1{ifile,j},filecell.nc.civ1{ifile,j},filecell.st{ifile,j},... 1824 % nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,[filebase_A '.xml'],[filebase_B '.xml']); 1825 % display(['!' cmd]) 1826 % eval(['!' cmd]); 1827 % else 1828 % RUN_STLIN(filecell.ncA.civ1{ifile,j},filecell.nc.civ1{ifile,j},'civ1',filecell.st{ifile,j},... 1829 % str2num(nx_patch1),str2num(ny_patch1),str2num(thresh_patch1),[filebase_A '.xml'],[filebase_B '.xml']); 1830 % end 1831 % end 1832 % if compare==3 && isequal(get(handles.test_stereo1,'Value'),0) 1833 % cmd=RUN_PATCH(filecell.ncA.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp); 1834 % s=-1; 1835 % if sge 1836 % [s,w]=unix(['qrsh -q -fast.q ' cmd]); 1837 % end 1838 % if s~=0 1839 % display(['!' cmd]) 1840 % eval(['!' cmd]); 1841 % end 1842 % end 1843 % end 1844 % end 1845 % end 1846 % 1847 % % CIV2 1848 % if box_test(4)==1 1849 % RUN_CIV2(handles,filecell.ima1.civ2,filecell.ima2.civ2,filecell.nc.civ1,filecell.nc.civ2,num1_civ2,num2_civ2,... 1850 % num_a_civ2,num_b_civ2,nom_type_nc) 1851 % end 1852 % 1853 % % FIX2 1854 % if box_test(5)==1 1855 % %names of the civ2 fields 1856 % field2.vel_type='civ2'; 1857 % field2.nb='nb_vectors2'; 1858 % field2.X='vec2_X'; 1859 % field2.Y='vec2_Y'; 1860 % field2.U='vec2_U'; 1861 % field2.V='vec2_V'; 1862 % field2.fixflag='vec2_FixFlag'; 1863 % flagindex(1)=get(handles.vec_Fmin2_2, 'Value'); 1864 % flagindex(2)=get(handles.vec_F3_2, 'Value'); 1865 % flagindex(3)=get(handles.vec_F4, 'Value'); 1866 % thresh_vec2C=str2num(get(handles.thresh_vec2C,'String'));%threshold on image correlation vec_C 1867 % thresh_vel2=str2num(get(handles.thresh_vel2,'String'));%threshold on velocity modulus 1868 % inf_sup=get(handles.inf_sup2,'Value'); 1869 % menu=get(handles.field_ref2,'String'); 1870 % index=get(handles.field_ref2,'Value'); 1871 % if isempty(menu) 1872 % fieldchoice=''; 1873 % else 1874 % fieldchoice=menu{index}; 1875 % end 1876 % h = waitbar(0,['removing velocity vectors, fix2']);% display a wait bar 1877 % test_mask=get(handles.get_mask_fix2,'Value'); 1878 % if test_mask 1879 % maskdispl=get(handles.mask_fix2,'String'); 1880 % if exist(maskdispl,'file') 1881 % test_mask=2; 1882 % maskname=maskdispl; 1883 % else 1884 % maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name 1885 % end 1886 % end 1887 % for ifile=1:nbfield 1888 % waitbar(ifile/nbfield); %update the waitbar 1889 % for j=1:nbslice 1890 % if test_mask==0 1891 % maskname='noFile use default'; 1892 % maskflag=0; 1893 % elseif test_mask==1 1894 % nbslice_mask=str2num(maskdispl(1:end-4)); % 1895 % num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; 1896 % maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 1897 % maskflag= exist(maskname,'file')==2; 1898 % if ~maskflag; 1899 % maskname='noFile use default'; 1900 % end 1901 % end 1902 % if ~isempty(file_ref_fix2) 1903 % file_ref=file_ref_fix2{ifile,j}; 1904 % else 1905 % file_ref=''; 1906 % end 1907 % error=RUN_FIX(filecell.nc.civ2{ifile,j},field2,flagindex,2,thresh_vec2C,maskflag,maskname,... 1908 % thresh_vel2,inf_sup,file_ref,fieldchoice); 1909 % if ~isempty(error) 1910 % msgbox_uvmat('ERROR',error) 1911 % return 1912 % end 1913 % if compare==3 1914 % if test_mask==0 1915 % maskname='noFile use default'; 1916 % maskflag=0; 1917 % else 1918 % maskbase=[get(handles.displ_filebase2,'String') '_' maskdispl]; % mask root name 1919 % nbslice_mask=str2num(maskdispl(1:end-4)); % 1920 % num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; 1921 % maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 1922 % maskflag= exist(maskname,'file')==2; 1923 % if ~maskflag; 1924 % maskname='noFile use default'; 1925 % end 1926 % end 1927 % error=RUN_FIX(filecell.ncA.civ2{ifile,j},field2,flagindex,1,thresh_vec2C,maskflag,maskname,... 1928 % thresh_vel2,inf_sup,file_ref,fieldchoice); 1929 % if ~isempty(error) 1930 % msgbox_uvmat('ERROR',error) 1931 % return 1932 % end 1933 % end 1934 % end 1935 % end 1936 % close(h) 1937 % end 1938 % 1939 % %PATCH 2 1940 % if box_test(6)==1 1941 % rho_patch2=str2num(get(handles.rho_patch2,'String')); 1942 % if isempty(rho_patch2) 1943 % rho_patch2='1000'; 1944 % set(handles.rho_patch2,'String','1') 1945 % else 1946 % rho_patch2=num2str(1000*rho_patch2); 1947 % end 1948 % nx_patch2=get(handles.nx_patch2,'String'); 1949 % ny_patch2=get(handles.ny_patch2,'String'); 1950 % thresh_patch2=get(handles.thresh_patch2,'String'); 1951 % if isequal(str2num(nx_patch2),[]) 1952 % nx_patch2='50' ;%default 1953 % set(handles.nx_patch2,'String','50'); 1954 % end 1955 % if isequal(str2num(ny_patch2),[]) 1956 % ny_patch2='50' ;%default 1957 % set(handles.ny_patch2,'String','50'); 1958 % end 1959 % subdomain_patch2=get(handles.subdomain_patch2,'String'); 1960 % icount=0; 1961 % for ifile=1:nbfield 1962 % for j=1:nbslice 1963 % icount=icount+1; 1964 % barlength=0.188*icount/(nbfield*nbslice); 1965 % set(handles.waitbar_patch2,'Position',[0.946 0.188-barlength 0.03 barlength]) 1966 % drawnow 1967 % if compare~=3 | isequal(get(handles.test_stereo2,'Value'),0) 1968 % cmd=RUN_PATCH(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,1,0); 1969 % s=-1; 1970 % if sge 1971 % [s,w]=unix(['qrsh -q -fast.q ' cmd]); 1972 % end 1973 % if s~=0 1974 % display(['!' cmd]) 1975 % eval(['!' cmd]); 1976 % end 1977 % elseif compare==3 && isequal(get(handles.test_stereo2,'Value'),1) 1978 % if exist('stinterp_exe','var')%Prog Gauthier 1979 % cmd=RUN_STINTERP(stinterp_exe,filecell.ncA.civ2{ifile,j},filecell.nc.civ2{ifile,j},filecell.st{ifile,j},... 1980 % nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,[filebase_A '.xml'],[filebase_B '.xml']); 1981 % display(['!' cmd]) 1982 % eval(['!' cmd]) 1983 % else 1984 % RUN_STLIN(filecell.ncA.civ2{ifile,j},filecell.nc.civ2{ifile,j},'civ2',filecell.st{ifile,j},... 1985 % str2num(nx_patch2),str2num(ny_patch2),str2num(thresh_patch2),[filebase_A '.xml'],[filebase_B '.xml']) 1986 % end 1987 % end 1988 % if compare==3 && isequal(get(handles.test_stereo2,'Value'),0) 1989 % cmd=RUN_PATCH(filecell.ncA.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,1,0); 1990 % s=-1; 1991 % if sge 1992 % [s,w]=unix(['qrsh -q -fast.q ' cmd]); 1993 % end 1994 % if s~=0 1995 % display(['!' cmd]) 1996 % eval(['!' cmd]); 1997 % end 1998 % end 1999 % end 2000 % end 2001 % end 2002 % 2003 % set(handles.RUN, 'Enable','On') 2004 % set(handles.RUN,'BackgroundColor',[1 0 0]) 2005 % 2006 % %save the current interface setting as figure namefig, append .0 to the name if it already exists 2007 % if isfield(filecell,'st') 2008 % fileresu=filecell.st{1,1}; 2009 % elseif isfield(filecell,'nc') 2010 % if isfield(filecell.nc,'civ2') 2011 % fileresu=filecell.nc.civ2{1,1}; 2012 % else 2013 % fileresu=filecell.nc.civ1{1,1}; 2014 % end 2015 % end 2016 % [RootPath,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileresu); 2017 % namedoc=fullfile(RootPath,subdir,RootFile); 2018 % detect=1; 2019 % while detect==1 2020 % namefigfull=[namedoc '.fig']; 2021 % hh=dir(namefigfull); 2022 % if ~isempty(hh) 2023 % detect=1; 2024 % namedoc=[namedoc '.0']; 2025 % else 2026 % detect=0; 2027 % end 2028 % end 2029 % saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) 2030 1559 2031 function RUN_Callback(hObject, eventdata, handles) 1560 2032 %------------------------------------------------------------------------ 1561 global civ1_exe civ2_exe patch_exe patch_new_exe sge 2033 % global civ1_exe civ2_exe patch_exe patch_new_exe sge 2034 2035 batch=0; 2036 launch_jobs(hObject, eventdata, handles,batch); 2037 2038 2039 %------------------------------------------------------------------------ 2040 % --- Executes on button press in BATCH: remote processing 2041 function BATCH_Callback(hObject, eventdata, handles) 2042 %------------------------------------------------------------------------ 2043 %global civ1_exe civ2_exe patch_exe patch_new_exe fix_exe todo_path sge Civ_exe % probabely to remove 2044 batch=1; 2045 launch_jobs(hObject, eventdata, handles, batch) 2046 2047 %------------------------------------------------------------------------ 2048 % --- Executes on button press in BATCH: remote processing 2049 function launch_jobs(hObject, eventdata, handles, batch) 2050 %----------------------------------------------------------------------- 2051 % global civ2Bin patchBin patch_newBin fixBin CivBin % probabely to remove 1562 2052 1563 2053 compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3) 2054 1564 2055 %check the list of operations: 1565 2056 operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'}; … … 1591 2082 return 1592 2083 end 1593 %check mask if selecetd1594 if isequal(get(handles.get_mask_civ1,'Value'),1)1595 maskname=get(handles.mask_civ1,'String');1596 if ~exist(maskname,'file')1597 get_mask_civ1_Callback(hObject, eventdata, handles);1598 end1599 end1600 if isequal(get(handles.get_mask_fix1,'Value'),1)1601 maskname=get(handles.mask_fix1,'String');1602 if ~exist(maskname,'file')1603 get_mask_fix1_Callback(hObject, eventdata, handles);1604 end1605 end1606 if isequal(get(handles.get_mask_civ2,'Value'),1)1607 maskname=get(handles.mask_civ2,'String');1608 if ~exist(maskname,'file')1609 get_mask_civ2_Callback(hObject, eventdata, handles);1610 end1611 end1612 if isequal(get(handles.get_mask_fix2,'Value'),1)1613 maskname=get(handles.mask_fix2,'String');1614 if ~exist(maskname,'file')1615 get_mask_fix2_Callback(hObject, eventdata, handles);1616 end1617 end1618 1619 %read names of the .exe file1620 if box_test(1)==1 || box_test(3)==1 || box_test(4)==1 || box_test(6)==11621 path_uvmat=which('uvmat');% check the path detected for source file uvmat1622 path_UVMAT=fileparts(path_uvmat); %path to UVMAT1623 %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ binary names1624 xmlfile=fullfile(path_UVMAT,'PARAM.xml');1625 if exist(xmlfile,'file')1626 t=xmltree(xmlfile);1627 sparam=convert(t);1628 end1629 if isfield(sparam,'Civ1_exe')1630 civ1_exe=sparam.Civ1_exe;1631 if ~exist(civ1_exe,'file')1632 civ1_exe=fullfile(path_UVMAT,civ1_exe);1633 end1634 end1635 if isfield(sparam,'Civ2_exe')1636 civ2_exe=sparam.Civ2_exe;1637 if ~exist(civ2_exe,'file')%the binary is defined in /bin, default setting1638 civ2_exe=fullfile(path_UVMAT,civ2_exe);1639 end1640 end1641 if isfield(sparam,'Patch_exe')1642 patch_exe=sparam.Patch_exe;1643 if ~exist(patch_exe,'file')%the binary is defined in /bin, default setting1644 patch_exe=fullfile(path_UVMAT,patch_exe);1645 end1646 end1647 if isfield(sparam,'Stinterp_exe')1648 stinterp_exe=sparam.Stinterp_exe;1649 end1650 if isfield(sparam,'SGE')1651 sge=str2double(sparam.SGE);1652 end1653 if ~isunix % for windows system, check whether the Matlab working dir is a UBC name1654 dircur=pwd;1655 if ~isequal(dircur([2 3]),':\')1656 msgbox_uvmat('ERROR','move to a Matlab current working directory with a Windows name, e.g. m:/...')1657 return;1658 end1659 end1660 end1661 1662 %initialize the waitbars1663 set(handles.waitbar_1,'Position',[0.946 0.877 0.03 0.001])1664 set(handles.waitbar_patch1,'Position',[0.946 0.626 0.03 0.001])1665 set(handles.waitbar_civ2,'Position',[0.946 0.406 0.03 0.001])1666 set(handles.waitbar_patch2,'Position',[0.946 0.187 0.03 0.001])1667 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])1668 set(handles.RUN, 'Enable','Off')1669 drawnow1670 1671 % get the list of file names and check the files1672 display('checking the files...')1673 [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]=...1674 set_civ_filenames(handles,compare,box_test);1675 nbfield=numel(num1_civ1);1676 nbslice=size(num_a_civ1);1677 1678 if isempty(filecell)1679 set(handles.RUN, 'Enable','On')1680 set(handles.RUN,'BackgroundColor',[1 0 0])1681 set(handles.BATCH, 'Enable','On')1682 set(handles.BATCH,'BackgroundColor',[1 0 0])1683 return1684 end1685 display('files OK, processing...')1686 nbfield=size(num1_civ1,2);1687 nbslice=size(num1_civ1,1);1688 1689 %RUN CIV11690 if box_test(1)==11691 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)1692 if compare==31693 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)1694 end1695 end1696 1697 %RUN FIX11698 if box_test(2)==11699 filebase=get(handles.displ_filebase,'String');1700 %names of the civ1 fields1701 field1.vel_type='civ1';1702 field1.nb='nb_vectors';1703 % field1.X='vec_X';1704 % field1.Y='vec_Y';1705 % field1.U='vec_U';1706 % field1.V='vec_V';1707 field1.fixflag='vec_FixFlag';1708 flagindex(1)=get(handles.vec_Fmin2, 'Value');1709 flagindex(2)=get(handles.vec_F3, 'Value');1710 flagindex(3)=get(handles.vec_F2, 'Value');1711 thresh_vecC=str2double(get(handles.thresh_vecC,'String'));%threshold on image correlation vec_C1712 thresh_vel=str2double(get(handles.thresh_vel,'String'));%threshold on velocity modulus1713 inf_sup=get(handles.inf_sup1,'Value');1714 menu=get(handles.field_ref1,'String');1715 index=get(handles.field_ref1,'Value');1716 if isempty(menu)1717 fieldchoice='';1718 else1719 fieldchoice=menu{index};1720 end1721 h = waitbar(0,'removing velocity vectors, fix1');% display a wait bar1722 test_mask=get(handles.get_mask_fix1,'Value');1723 if test_mask1724 maskdispl=get(handles.mask_fix1,'String');1725 if exist(maskdispl,'file')1726 test_mask=2;1727 maskname=maskdispl;1728 else1729 maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name1730 end1731 end1732 for ifile=1:nbfield1733 waitbar(ifile/nbfield); %update the waitbar1734 for j=1:nbslice1735 if test_mask==01736 maskname='noFile use default';1737 maskflag=0;1738 elseif test_mask==11739 nbslice_mask=str2double(maskdispl(1:end-4)); %1740 num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1;1741 maskname=name_generator(maskbase,num1_mask,1,'.png','_i');% mask corresponding to the first image of the pair1742 maskflag= exist(maskname,'file')==2;1743 if ~maskflag;1744 maskname='noFile use default';1745 end1746 end1747 if ~isempty(file_ref_fix1)1748 file_ref=file_ref_fix1{ifile,j};1749 else1750 file_ref='';1751 end1752 error=RUN_FIX(filecell.nc.civ1{ifile,j},field1,flagindex,1,thresh_vecC,maskflag,maskname,...1753 thresh_vel,inf_sup,file_ref,fieldchoice);1754 1755 if compare==3 &&(isequal(mode,'pair j1-j2') || isequal(mode,'series(Dj)') || isequal(mode,'series(Di)'))1756 if test_mask==01757 maskname='noFile use default';1758 maskflag=0;1759 else1760 maskbase=[get(handles.displ_filebase2,'String') '_' maskdispl]; % mask root name1761 nbslice_mask=str2num(maskdispl(1:end-4)); %1762 num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1;1763 maskname=name_generator(maskbase,num1_mask,1,'.png','_i');1764 maskflag= exist(maskname,'file')==2;1765 if ~maskflag;1766 maskname='noFile use default';1767 end1768 end1769 error=RUN_FIX(filecell.ncA.civ1{ifile,j},field1,flagindex,1,thresh_vecC,maskflag,maskname,...1770 thresh_vel,inf_sup,file_ref,fieldchoice);1771 if ~isempty(error)1772 msgbox_uvmat('ERROR',error)1773 return1774 end1775 end1776 end1777 end1778 close(h)1779 end1780 1781 % RUN PATCH11782 if box_test(3)==11783 rho_patch1=str2num(get(handles.rho_patch1,'String'));1784 if isempty(rho_patch1)1785 rho_patch1='1000';1786 set(handles.rho_patch1,'String','1')1787 else1788 rho_patch1=num2str(1000*rho_patch1);1789 end1790 nx_patch1=get(handles.nx_patch1,'String');1791 if isequal(str2num(nx_patch1),[])1792 nx_patch1='50' ;%default1793 set(handles.nx_patch1,'String','50');1794 end1795 ny_patch1=get(handles.ny_patch1,'String');1796 if isequal(str2num(ny_patch1),[])1797 ny_patch1='50' ;%default1798 set(handles.ny_patch1,'String','50');1799 end1800 subdomain_patch1=get(handles.subdomain_patch1,'String');1801 thresh_patch1=get(handles.thresh_patch1,'String');1802 test_interp=get(handles.test_interp,'Value');1803 icount=0;1804 for ifile=1:nbfield1805 for j=1:nbslice1806 icount=icount+1;1807 barlength=0.188*icount/(nbfield*nbslice);1808 set(handles.waitbar_patch1,'Position',[0.946 0.627-barlength 0.03 barlength])1809 drawnow1810 if isequal(get(handles.test_stereo1,'Value'),0)1811 cmd=RUN_PATCH(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp);1812 s=-1;1813 if sge1814 [s,w]=unix(['qrsh -q -fast.q ' cmd]);1815 end1816 if s~=01817 display(['!' cmd])1818 eval(['!' cmd]);1819 end1820 1821 %stereo case:1822 elseif isequal(get(handles.test_stereo1,'Value'),1)1823 if exist('stinterp_exe','var')%Prog Gauthier1824 cmd=RUN_STINTERP(stinterp_exe,filecell.ncA.civ1{ifile,j},filecell.nc.civ1{ifile,j},filecell.st{ifile,j},...1825 nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,[filebase_A '.xml'],[filebase_B '.xml']);1826 display(['!' cmd])1827 eval(['!' cmd]);1828 else1829 RUN_STLIN(filecell.ncA.civ1{ifile,j},filecell.nc.civ1{ifile,j},'civ1',filecell.st{ifile,j},...1830 str2num(nx_patch1),str2num(ny_patch1),str2num(thresh_patch1),[filebase_A '.xml'],[filebase_B '.xml']);1831 end1832 end1833 if compare==3 && isequal(get(handles.test_stereo1,'Value'),0)1834 cmd=RUN_PATCH(filecell.ncA.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp);1835 s=-1;1836 if sge1837 [s,w]=unix(['qrsh -q -fast.q ' cmd]);1838 end1839 if s~=01840 display(['!' cmd])1841 eval(['!' cmd]);1842 end1843 end1844 end1845 end1846 end1847 1848 % CIV21849 if box_test(4)==11850 RUN_CIV2(handles,filecell.ima1.civ2,filecell.ima2.civ2,filecell.nc.civ1,filecell.nc.civ2,num1_civ2,num2_civ2,...1851 num_a_civ2,num_b_civ2,nom_type_nc)1852 end1853 1854 % FIX21855 if box_test(5)==11856 %names of the civ2 fields1857 field2.vel_type='civ2';1858 field2.nb='nb_vectors2';1859 field2.X='vec2_X';1860 field2.Y='vec2_Y';1861 field2.U='vec2_U';1862 field2.V='vec2_V';1863 field2.fixflag='vec2_FixFlag';1864 flagindex(1)=get(handles.vec_Fmin2_2, 'Value');1865 flagindex(2)=get(handles.vec_F3_2, 'Value');1866 flagindex(3)=get(handles.vec_F4, 'Value');1867 thresh_vec2C=str2num(get(handles.thresh_vec2C,'String'));%threshold on image correlation vec_C1868 thresh_vel2=str2num(get(handles.thresh_vel2,'String'));%threshold on velocity modulus1869 inf_sup=get(handles.inf_sup2,'Value');1870 menu=get(handles.field_ref2,'String');1871 index=get(handles.field_ref2,'Value');1872 if isempty(menu)1873 fieldchoice='';1874 else1875 fieldchoice=menu{index};1876 end1877 h = waitbar(0,['removing velocity vectors, fix2']);% display a wait bar1878 test_mask=get(handles.get_mask_fix2,'Value');1879 if test_mask1880 maskdispl=get(handles.mask_fix2,'String');1881 if exist(maskdispl,'file')1882 test_mask=2;1883 maskname=maskdispl;1884 else1885 maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name1886 end1887 end1888 for ifile=1:nbfield1889 waitbar(ifile/nbfield); %update the waitbar1890 for j=1:nbslice1891 if test_mask==01892 maskname='noFile use default';1893 maskflag=0;1894 elseif test_mask==11895 nbslice_mask=str2num(maskdispl(1:end-4)); %1896 num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1;1897 maskname=name_generator(maskbase,num1_mask,1,'.png','_i');1898 maskflag= exist(maskname,'file')==2;1899 if ~maskflag;1900 maskname='noFile use default';1901 end1902 end1903 if ~isempty(file_ref_fix2)1904 file_ref=file_ref_fix2{ifile,j};1905 else1906 file_ref='';1907 end1908 error=RUN_FIX(filecell.nc.civ2{ifile,j},field2,flagindex,2,thresh_vec2C,maskflag,maskname,...1909 thresh_vel2,inf_sup,file_ref,fieldchoice);1910 if ~isempty(error)1911 msgbox_uvmat('ERROR',error)1912 return1913 end1914 if compare==31915 if test_mask==01916 maskname='noFile use default';1917 maskflag=0;1918 else1919 maskbase=[get(handles.displ_filebase2,'String') '_' maskdispl]; % mask root name1920 nbslice_mask=str2num(maskdispl(1:end-4)); %1921 num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1;1922 maskname=name_generator(maskbase,num1_mask,1,'.png','_i');1923 maskflag= exist(maskname,'file')==2;1924 if ~maskflag;1925 maskname='noFile use default';1926 end1927 end1928 error=RUN_FIX(filecell.ncA.civ2{ifile,j},field2,flagindex,1,thresh_vec2C,maskflag,maskname,...1929 thresh_vel2,inf_sup,file_ref,fieldchoice);1930 if ~isempty(error)1931 msgbox_uvmat('ERROR',error)1932 return1933 end1934 end1935 end1936 end1937 close(h)1938 end1939 1940 %PATCH 21941 if box_test(6)==11942 rho_patch2=str2num(get(handles.rho_patch2,'String'));1943 if isempty(rho_patch2)1944 rho_patch2='1000';1945 set(handles.rho_patch2,'String','1')1946 else1947 rho_patch2=num2str(1000*rho_patch2);1948 end1949 nx_patch2=get(handles.nx_patch2,'String');1950 ny_patch2=get(handles.ny_patch2,'String');1951 thresh_patch2=get(handles.thresh_patch2,'String');1952 if isequal(str2num(nx_patch2),[])1953 nx_patch2='50' ;%default1954 set(handles.nx_patch2,'String','50');1955 end1956 if isequal(str2num(ny_patch2),[])1957 ny_patch2='50' ;%default1958 set(handles.ny_patch2,'String','50');1959 end1960 subdomain_patch2=get(handles.subdomain_patch2,'String');1961 icount=0;1962 for ifile=1:nbfield1963 for j=1:nbslice1964 icount=icount+1;1965 barlength=0.188*icount/(nbfield*nbslice);1966 set(handles.waitbar_patch2,'Position',[0.946 0.188-barlength 0.03 barlength])1967 drawnow1968 if compare~=3 | isequal(get(handles.test_stereo2,'Value'),0)1969 cmd=RUN_PATCH(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,1,0);1970 s=-1;1971 if sge1972 [s,w]=unix(['qrsh -q -fast.q ' cmd]);1973 end1974 if s~=01975 display(['!' cmd])1976 eval(['!' cmd]);1977 end1978 elseif compare==3 && isequal(get(handles.test_stereo2,'Value'),1)1979 if exist('stinterp_exe','var')%Prog Gauthier1980 cmd=RUN_STINTERP(stinterp_exe,filecell.ncA.civ2{ifile,j},filecell.nc.civ2{ifile,j},filecell.st{ifile,j},...1981 nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,[filebase_A '.xml'],[filebase_B '.xml']);1982 display(['!' cmd])1983 eval(['!' cmd])1984 else1985 RUN_STLIN(filecell.ncA.civ2{ifile,j},filecell.nc.civ2{ifile,j},'civ2',filecell.st{ifile,j},...1986 str2num(nx_patch2),str2num(ny_patch2),str2num(thresh_patch2),[filebase_A '.xml'],[filebase_B '.xml'])1987 end1988 end1989 if compare==3 && isequal(get(handles.test_stereo2,'Value'),0)1990 cmd=RUN_PATCH(filecell.ncA.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,1,0);1991 s=-1;1992 if sge1993 [s,w]=unix(['qrsh -q -fast.q ' cmd]);1994 end1995 if s~=01996 display(['!' cmd])1997 eval(['!' cmd]);1998 end1999 end2000 end2001 end2002 end2003 2004 set(handles.RUN, 'Enable','On')2005 set(handles.RUN,'BackgroundColor',[1 0 0])2006 2007 %save the current interface setting as figure namefig, append .0 to the name if it already exists2008 if isfield(filecell,'st')2009 fileresu=filecell.st{1,1};2010 elseif isfield(filecell,'nc')2011 if isfield(filecell.nc,'civ2')2012 fileresu=filecell.nc.civ2{1,1};2013 else2014 fileresu=filecell.nc.civ1{1,1};2015 end2016 end2017 [RootPath,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileresu);2018 namedoc=fullfile(RootPath,subdir,RootFile);2019 detect=1;2020 while detect==12021 namefigfull=[namedoc '.fig'];2022 hh=dir(namefigfull);2023 if ~isempty(hh)2024 detect=1;2025 namedoc=[namedoc '.0'];2026 else2027 detect=0;2028 end2029 end2030 saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml)2031 2032 %------------------------------------------------------------------------2033 % --- Executes on button press in BATCH: remote processing2034 function BATCH_Callback(hObject, eventdata, handles)2035 %------------------------------------------------------------------------2036 global civ1_exe civ2_exe patch_exe patch_new_exe fix_exe todo_path sge Civ_exe2037 compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3)2038 2039 %check the list of operations:2040 operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'};2041 run_flag=1;2042 box_test(1)=get(handles.CIV1,'Value');2043 box_test(2)=get(handles.FIX1,'Value');2044 box_test(3)=get(handles.PATCH1,'Value');2045 box_test(4)=get(handles.CIV2,'Value');2046 box_test(5)=get(handles.FIX2,'Value');2047 box_test(6)=get(handles.PATCH2,'Value');2048 index=find(box_test==1);2049 if isempty(index)2050 msgbox_uvmat('ERROR','no selected operation')2051 return2052 end2053 index_first=min(index);2054 index_last=max(index);2055 box_used=box_test([index_first : index_last]);2056 [box_missing,ind_missing]=min(box_used);2057 if isequal(box_missing,0)2058 msgbox_uvmat('ERROR',['missing' cell2mat(operations(ind_missing))]);2059 return2060 end2061 2062 %root name2063 filebase=get(handles.displ_filebase,'String');2064 if isempty(filebase)||isequal(filebase,'')2065 msgbox_uvmat('ERROR','no input files')2066 return2067 end2068 2084 2069 2085 %check mask if selecetd … … 2099 2115 if exist(xmlfile,'file') 2100 2116 t=xmltree(xmlfile); 2101 s param=convert(t);2117 s=convert(t); 2102 2118 end 2103 2119 % else … … 2108 2124 % end 2109 2125 % end 2110 sge=0; 2111 if isfield(sparam,'Civ_exe') 2112 Civ_exe=sparam.Civ_exe; 2113 end 2114 if isfield(sparam,'Civ1_exe') 2115 civ1_exe=sparam.Civ1_exe; 2116 end 2117 if isfield(sparam,'Civ2_exe') 2118 civ2_exe=sparam.Civ2_exe; 2119 end 2120 if isfield(sparam,'Patch_exe') 2121 patch_exe=sparam.Patch_exe; 2122 end 2123 if isfield(sparam,'PatchNew_exe') 2124 patch_new_exe=sparam.PatchNew_exe; 2126 % batch=0; 2127 if batch 2128 if isfield(s,'BatchParam') 2129 sparam=s.BatchParam; 2130 if ~ismember(sparam.BatchMode,{'sge'}) 2131 msgbox_uvmat('ERROR',['batch mode ' sparam.BatchMode ' not supported by UVMAT']) 2132 end 2133 else 2134 msgbox_uvmat('ERROR','no batch mode defined in PARAM.xml') 2135 return 2136 end 2137 else 2138 if isfield(s,'RunParam') 2139 sparam=s.RunParam; 2140 else 2141 msgbox_uvmat('ERROR','no civ binaries defined in PARAM.xml') 2142 return 2143 end 2144 end 2145 if isfield(sparam,'CivBin') 2146 CivBin=sparam.CivBin; 2147 end 2148 if isfield(sparam,'Civ1Bin') 2149 civ1Bin=sparam.Civ1Bin; 2150 end 2151 if isfield(sparam,'Civ2Bin') 2152 civ2Bin=sparam.Civ2Bin; 2153 end 2154 if isfield(sparam,'PatchBin') 2155 patchBin=sparam.PatchBin; 2156 end 2157 if isfield(sparam,'PatchNewBin') 2158 patch_newBin=sparam.PatchNewBin; 2125 2159 end 2126 if isfield(sparam,'Fix _exe')2127 fix _exe=sparam.Fix_exe;2160 if isfield(sparam,'FixBin') 2161 fixBin=sparam.FixBin; 2128 2162 end 2129 if isfield(sparam,'Todo_path') 2130 todo_path=sparam.Todo_path; 2131 end 2132 if isfield(sparam,'SGE') 2133 sge=str2num(sparam.SGE); 2134 end 2163 % if isfield(sparam,'Todo_path') 2164 % todo_path=sparam.Todo_path; 2165 % end 2166 if batch 2167 if isfield(sparam,'BatchMode') 2168 batch_mode=sparam.BatchMode; 2169 end 2170 else 2171 MaxCivProcesses=50; 2172 if isfield(sparam,'MaxCivProcesses') 2173 MaxCivProcesses=str2double(sparam.MaxCivProcesses); 2174 end 2175 end 2176 2177 %initialize the waitbars 2178 set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001]) 2179 set(handles.waitbar_patch1,'Position',[0.946 0.439 0.03 0.001]) 2180 set(handles.waitbar_civ2,'Position',[0.946 0.219 0.03 0.001]) 2181 set(handles.waitbar_patch2,'Position',[0.946 0.0 0.03 0.001]) 2182 set(handles.BATCH, 'Enable','Off') 2183 set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784]) 2184 drawnow 2185 %get the filename root, nomenclature and numbers 2186 2187 % for Windows system find the UBC path name if needed 2188 if ~isunix & isequal(todo_path(1:2),'\\') & isequal(filebase(2:3),':\') 2189 cur_dir=pwd; 2190 if ~isequal(cur_dir(2:3),':\') 2191 cd(matlabroot); %move to the Matlab root directory if the current Matlab dir does not allow the dos command or is M: 2192 end 2193 [ss,ww]=dos(['net use ' filebase(1:2)]); 2194 if isequal(ss,0) 2195 rankpath=findstr(ww,'\\'); 2196 if ~isempty(rankpath) 2197 wwrest=ww(rankpath:end); 2198 rankend=min(find(double(wwrest)==10))-1; 2199 filebase=[wwrest(1:rankend) filebase(3:end)]; 2200 set(handles.displ_filebase,'String',filebase); 2201 end 2202 else 2203 msgbox_uvmat('ERROR','for BATCH option, UBC file names, beginning by \\, are needed'); 2204 set(handles.BATCH, 'Enable','On') 2205 set(handles.BATCH,'BackgroundColor',[1 0 0]) 2206 return 2207 end 2208 end 2209 2210 % set the list of files and check them 2211 display('checking the files...') 2212 [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]=... 2213 set_civ_filenames(handles,compare,box_test); 2135 2214 2136 2215 %choice of batch priority 2137 2216 ind_answer=2; 2138 if sge2217 if batch 2139 2218 [s,w]=unix('qstat -q civ.q|grep job_| wc -l'); %check the waiting list (command unix) 2140 2219 if isequal(s,0) … … 2152 2231 return 2153 2232 end 2154 end 2155 2156 %initialize the waitbars 2157 set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001]) 2158 set(handles.waitbar_patch1,'Position',[0.946 0.439 0.03 0.001]) 2159 set(handles.waitbar_civ2,'Position',[0.946 0.219 0.03 0.001]) 2160 set(handles.waitbar_patch2,'Position',[0.946 0.0 0.03 0.001]) 2161 set(handles.BATCH, 'Enable','Off') 2162 set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784]) 2163 drawnow 2164 %get the filename root, nomenclature and numbers 2165 2166 % for Windows system find the UBC path name if needed 2167 if ~isunix & isequal(todo_path(1:2),'\\') & isequal(filebase(2:3),':\') 2168 cur_dir=pwd; 2169 if ~isequal(cur_dir(2:3),':\') 2170 cd(matlabroot); %move to the Matlab root directory if the current Matlab dir does not allow the dos command or is M: 2171 end 2172 [ss,ww]=dos(['net use ' filebase(1:2)]); 2173 if isequal(ss,0) 2174 rankpath=findstr(ww,'\\'); 2175 if ~isempty(rankpath) 2176 wwrest=ww(rankpath:end); 2177 rankend=min(find(double(wwrest)==10))-1; 2178 filebase=[wwrest(1:rankend) filebase(3:end)]; 2179 set(handles.displ_filebase,'String',filebase); 2180 end 2181 else 2182 msgbox_uvmat('ERROR','for BATCH option, UBC file names, beginning by \\, are needed'); 2183 set(handles.BATCH, 'Enable','On') 2184 set(handles.BATCH,'BackgroundColor',[1 0 0]) 2185 return 2186 end 2187 end 2188 2189 % set the list of files and check them 2190 display('checking the files...') 2191 [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]=... 2192 set_civ_filenames(handles,compare,box_test); 2233 else 2234 if isunix 2235 [s,w]=unix('ps faux |grep civ|wc -l'); 2236 w(end)=[]; 2237 if str2num(w)+numel(filecell)> MaxCivProcesses 2238 msgbox_uvmat('ERROR',{['There are already ' w ' civ processes running locally'];'Use BATCH or submit RUN later'}) 2239 return 2240 end 2241 end 2242 end 2193 2243 2194 2244 display('files OK, processing...') … … 2227 2277 2228 2278 %get patch1 parameters 2229 2279 if box_test(3)==1 2230 2280 rho_patch1=str2num(get(handles.rho_patch1,'String')); 2231 2281 if isempty(rho_patch1) … … 2296 2346 end 2297 2347 2298 if ~sge2299 2300 %OPEN THE WAIT LIST FOR BATCH PROCESSES2301 name_lock=fullfile(todo_path,'lock'); %lock file2302 iwait=0;2303 while(exist(name_lock) & iwait<15)2304 pause(1); %wait 1 second2305 iwait=iwait+1;2306 end2307 if iwait==152308 msgbox_uvmat('ERROR',['I''m tired to wait for the lock file, please delete it then click again on BATCH' name_lock ])2309 set(handles.BATCH, 'Enable','On')2310 set(handles.BATCH,'BackgroundColor',[1 0 0])2311 return2312 end2313 p0=fopen(name_lock,'w'); %create the file name_lock: prevents other users to interfere2314 name_todo=fullfile(todo_path,'TODO.txt');2315 p1=fopen(name_todo,'a');2316 if (p1<0)2317 msgbox_uvmat('ERROR',['error in opening ' name_todo])2318 set(handles.BATCH, 'Enable','On')2319 set(handles.BATCH,'BackgroundColor',[1 0 0])2320 return;2321 end2322 end2348 % if ~sge 2349 % 2350 % %OPEN THE WAIT LIST FOR BATCH PROCESSES 2351 % name_lock=fullfile(todo_path,'lock'); %lock file 2352 % iwait=0; 2353 % while(exist(name_lock) & iwait<15) 2354 % pause(1); %wait 1 second 2355 % iwait=iwait+1; 2356 % end 2357 % if iwait==15 2358 % msgbox_uvmat('ERROR',['I''m tired to wait for the lock file, please delete it then click again on BATCH' name_lock ]) 2359 % set(handles.BATCH, 'Enable','On') 2360 % set(handles.BATCH,'BackgroundColor',[1 0 0]) 2361 % return 2362 % end 2363 % p0=fopen(name_lock,'w'); %create the file name_lock: prevents other users to interfere 2364 % name_todo=fullfile(todo_path,'TODO.txt'); 2365 % p1=fopen(name_todo,'a'); 2366 % if (p1<0) 2367 % msgbox_uvmat('ERROR',['error in opening ' name_todo]) 2368 % set(handles.BATCH, 'Enable','On') 2369 % set(handles.BATCH,'BackgroundColor',[1 0 0]) 2370 % return; 2371 % end 2372 % end 2323 2373 2324 2374 %MAIN LOOP … … 2331 2381 i_cmd=0; 2332 2382 cmd=''; 2333 if sge2383 if batch 2334 2384 %fid=fopen([filename '.cmx'],'w') 2335 2385 cmd='#!/bin/bash'; … … 2407 2457 i_cmd=i_cmd+1; 2408 2458 if isequal(civAll,0) 2409 cmd=[cmd '\n' BATCH_CIV1(filename_cmx(1:end-4),namelog,par_civ1,handles )];2459 cmd=[cmd '\n' BATCH_CIV1(filename_cmx(1:end-4),namelog,par_civ1,handles,sparam)]; 2410 2460 else 2411 2461 civAllCmd=[civAllCmd ' civ1 ']; … … 2436 2486 end 2437 2487 if isequal(civAll,0) 2438 cmd_FIX=[fix _exe' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(flagindex1(1)) ...2488 cmd_FIX=[fixBin ' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(flagindex1(1)) ... 2439 2489 ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ... 2440 2490 ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName ' maskname]; … … 2573 2623 %endTESTgrid 2574 2624 i_cmd=i_cmd+1; 2575 cmd_CIV2=BATCH_CIV2(filename_cmx,namelog,par_civ2 );2625 cmd_CIV2=BATCH_CIV2(filename_cmx,namelog,par_civ2,sparam); 2576 2626 if isequal(civAll,0) 2577 2627 if(isunix) … … 2582 2632 else 2583 2633 civAllCmd=[civAllCmd ' civ2 ']; 2584 str=BATCH_CIV2_Unified(filename_cmx([1:end-4]),namelog,par_civ2 );2634 str=BATCH_CIV2_Unified(filename_cmx([1:end-4]),namelog,par_civ2,sparam); 2585 2635 fieldnames=fields(str); 2586 2636 [civAllxml,uid_civ2]=add(civAllxml,1,'element','civ2'); … … 2608 2658 end 2609 2659 if isequal(civAll,0) 2610 cmd_FIX=[fix _exe' -f ' filecell.nc.civ2{ifile,j} ' -fi1 ' num2str(flagindex2(1)) ...2660 cmd_FIX=[fixBin ' -f ' filecell.nc.civ2{ifile,j} ' -fi1 ' num2str(flagindex2(1)) ... 2611 2661 ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ... 2612 2662 ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname]; … … 2681 2731 if isequal(civAll,1) 2682 2732 save(civAllxml,[filename_cmx([1:end-4]) '.xml']); 2683 cmd=char({cmd;[Civ _exe' -f ' [filename_cmx([1:end-4]) '.xml'] ' ' civAllCmd]});2733 cmd=char({cmd;[CivBin ' -f ' [filename_cmx([1:end-4]) '.xml'] ' ' civAllCmd]}); 2684 2734 end 2685 2735 % create the .bat file: 2686 if sge2736 if batch 2687 2737 [Rootbat,Filebat,extbat]=fileparts(filename_cmx); 2688 2738 filename_bat=fullfile(Rootbat,['job_' Filebat extbat]); … … 2695 2745 fclose(fid); 2696 2746 %dlmwrite(filename_bat,cmd,'');%write commands in filename_bat 2697 if sge 2698 pvalue=num2str((1-ind_answer)*500); 2699 namelog=[filename_bat '.patch.log']; 2700 ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]; 2701 eval( ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]); 2747 if batch 2748 switch batch_mode 2749 case 'sge' 2750 pvalue=num2str((1-ind_answer)*500); 2751 namelog=[filename_bat '.patch.log']; 2752 ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]; 2753 eval( ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]); 2754 end 2755 2756 2757 2702 2758 else 2759 %% to lauch the jobs locally : 2703 2760 if(isunix) 2704 cmdtodo=['. ' filename_bat ];%removed for Mathieu tests %' && rm -f ' filename_bat];2761 eval(['!. ' filename_bat ' &']); 2705 2762 else 2706 cmdtodo=[filename_bat];%removed for Mathieu tests %' && del /F /Q ' filename_bat';2763 eval(['!' filename_bat ' &']); 2707 2764 end 2708 count= fprintf(p1,'%s\n', cmdtodo); 2765 % if(isunix) 2766 % cmdtodo=['. ' filename_bat ];%removed for Mathieu tests %' && rm -f ' filename_bat] ; 2767 % else 2768 % cmdtodo=[filename_bat];%removed for Mathieu tests %' && del /F /Q ' filename_bat' ; 2769 % end 2770 % count= fprintf(p1,'%s\n', cmdtodo); 2709 2771 end 2710 2772 end 2711 2773 end 2712 if ~sge2713 fclose(p1);2714 fclose(p0);2715 delete(name_lock);2716 end2774 % if ~sge 2775 % fclose(p1); 2776 % fclose(p0); 2777 % delete(name_lock); 2778 % end 2717 2779 2718 2780 set(handles.BATCH, 'Enable','On') … … 3403 3465 %------------------------------------------------------------------------ 3404 3466 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 3405 global civ1 _exesge%name of the executable for civ1 calculation3467 global civ1Bin sge%name of the executable for civ1 calculation 3406 3468 3407 3469 %get civ parameters … … 3598 3660 3599 3661 s=-1; 3600 display(['!' civ1 _exe' -f ' filename_cmx ' > ' namelog ])3601 eval(['!' civ1 _exe' -f ' filename_cmx ' > ' namelog ]);3662 display(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog ]) 3663 eval(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog ]); 3602 3664 % if sge%dispatch computation on the cluster using interactive queue 3603 % % [s,w] = unix(['qrsh -q fast.q ' civ1 _exe' -f ' filename_cmx ' > ' namelog ' 2>&1' ]);3665 % % [s,w] = unix(['qrsh -q fast.q ' civ1Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1' ]); 3604 3666 % end 3605 3667 % if s~=0 3606 % % ['!' civ1 _exe' -f ' filename_cmx ' > ' namelog]3607 % % eval(['!' civ1 _exe' -f ' filename_cmx ' > ' namelog]);3668 % % ['!' civ1Bin ' -f ' filename_cmx ' > ' namelog] 3669 % % eval(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog]); 3608 3670 % end 3609 3671 end 3610 3672 end 3611 3673 3612 % ------------------------------------------------------------------------3613 % RUN CIV2 CIV2 CIV2 CIV23614 function RUN_CIV2(handles,filecell_2,filecell_3,filecell_nc1,filecell_nc2,num1,num2,num_a,num_b,nom_type_nc)3615 % ------------------------------------------------------------------------3616 % filecell_2: names of first image3617 % filecell_3: names of second images3618 global civ2_exesge3619 3620 % names of the civ2 fields3621 field.vel_type='civ2';3622 field.nb='nb_vectors2';3623 field.X='vec2_X';3624 field.Y='vec2_Y';3625 field.U='vec2_U';3626 field.V='vec2_V';3627 3628 % get civ parameters3629 ibx=get(handles.ibx_civ2,'String');3630 iby=get(handles.iby_civ2,'String');3631 rho=get(handles.rho_civ2,'String');3632 decimal=int2str(get(handles.decimal,'Value'));3633 deformation=int2str(get(handles.deformation,'Value'));3634 dx=get(handles.dx_civ2,'String');3635 dy=get(handles.dy_civ2,'String');3636 if isequal(str2num(dx),[])3637 dx='20';%default3638 end3639 if isequal(str2num(dy),[])3640 dy='20';%default3641 end3642 pxcmx='1';%velocity fields are expressed in pixel displacement3643 pxcmy='1';3644 A=imread(cell2mat(filecell_2(1,1)));%read the first image to get the size3645 sizim=size(A);3646 npx=num2str(sizim(2));3647 npy=num2str(sizim(1));3648 time=get(handles.displ_filebase,'UserData'); %get the set of times3649 filebase=get(handles.displ_filebase,'String');3650 % grid3651 gridname='';%default ='noFile use default'3652 gridflag='n';%default3653 test_grid=get(handles.browse_gridciv2,'Value');3654 nbslice_grid=[];3655 if test_grid3656 gridname=get(handles.grid_civ2,'String');3657 if numel(gridname)>4 && isequal(gridname(end-3:end),'grid')3658 nbslice_grid=str2num(gridname(1:end-4)); %3659 if ~isempty(nbslice_grid)3660 gridflag='y';3661 end3662 elseif exist(gridname,'file')3663 gridflag='y';3664 else3665 msgbox_uvmat('ERROR',['input grid file ' gridname ' not found'])3666 return3667 end3668 end3669 sizcell=size(filecell_2);3670 nbfield=sizcell(1);3671 nbslice=sizcell(2);3672 3673 % main loop3674 icount=0;3675 for ifile=1:nbfield3676 for j=1:nbslice3677 icount=icount+1;3678 barlength=0.188*icount/(nbfield*nbslice);3679 set(handles.waitbar_civ2,'Position',[0.946 0.407-barlength 0.03 barlength])3680 drawnow3681 filename_ima_2=cell2mat(filecell_2(ifile,j));3682 filename_ima_2([end-3:end])=[];%remove .png extension3683 filename_ima_3=cell2mat(filecell_3(ifile,j));3684 filename_ima_3([end-3:end])=[];%remove .png extension3685 filename_cmx=cell2mat(filecell_nc2(ifile,j));%output netcdf file3686 filename_cmx([end-1:end])=[ 'cm'];%name of cmx file3687 filename_cmx=[filename_cmx 'x'];3688 namelog=[filename_cmx([1:end-3]) 'log'];3689 if size(time,1)>=num2(ifile) & size(time,2)>=num_b(j)3690 Dt=num2str(time(num2(ifile),num_b(j))-time(num1(ifile),num_a(j)));3691 if isequal(Dt,'0')3692 Dt='1' ;%case of 'displacement' mode3693 end3694 T0=num2str((time(num2(ifile),num_b(j))+time(num1(ifile),num_a(j)))/2);3695 else3696 Dt='1';3697 T0='0';3698 end3699 term_a=num2stra(num_a(j),nom_type_nc);3700 term_b=num2stra(num_b(j),nom_type_nc);3701 filename_nc1=cell2mat(filecell_nc1(ifile,j));3702 filename_nc1([end-2:end])=[]; % remove '.nc'3703 if test_grid && ~isempty(nbslice_grid)3704 num1_grid=mod(num1(ifile)-1,nbslice_grid)+1;3705 gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')];3706 if ~exist(gridname,'file')3707 msgbox_uvmat('ERROR',['missing grid file ' gridname])3708 return3709 end3710 end3711 test_mask=get(handles.get_mask_civ2,'Value');3712 if test_mask==03713 maskname='noFile use default';3714 maskflag='n';3715 else3716 maskdispl=get(handles.mask_civ2,'String');3717 maskbase=[filebase '_' maskdispl]; %3718 nbslice_mask=str2num(maskdispl(1:end-4)); %3719 num1_mask=mod(num1(ifile)-1,nbslice_mask)+1;3720 maskname =name_generator(maskbase,num1_mask,1,'.png','_i');3721 if ~exist(maskname,'file')3722 maskflag='y';3723 else3724 maskname='noFile use default';3725 maskflag='n';3726 end3727 end3728 3729 textcmx={'############## CMX file';...3730 ['FirstImage ' filename_ima_2];...3731 ['LastImage ' filename_ima_3];...3732 'XX' ;...3733 ['Mask ' maskflag];...3734 ['MaskName ' maskname];...3735 ['ImageSize ' npx ' ' npy];...3736 ['CorrelationBoxesSize ' ibx ' ' iby];...3737 ['SearchBoxeSize ' ibx ' ' iby];...3738 ['RO ' rho];...3739 ['GridSpacing ' dx ' ' dy];...3740 'XX 1.0';...3741 ['Dt_TO ' Dt ' ' T0];...3742 ['PixCmXY ' pxcmx ' ' pxcmy];...3743 'XX 1';...3744 ['ShiftXY 0 0'];...3745 ['Grid ' gridflag];...3746 ['GridName ' gridname];...3747 'XX 85';...3748 'XX 1.0';...3749 'XX 1.0';...3750 'Hart 1';...3751 ['DecimalShift ' decimal];...3752 ['Deformation ' deformation];...3753 'CorrelationMin 0';...3754 'IntensityMin 0';...3755 'SeuilImage n';...3756 'SeuilImageValues 0 4096';...3757 ['ImageToUse ' term_a ' ' term_b];... % VERIFIER ?3758 ['ImageUsedBefore ' filename_nc1]};3759 textout=char(textcmx);3760 dlmwrite(filename_cmx,textout,'');3761 s=-1;3762 display(['!' civ2_exe' -f ' filename_cmx ' > ' namelog ])3763 eval(['!' civ2_exe' -f ' filename_cmx ' > ' namelog ]);3764 3765 % if sge%dispatch computation on the cluster using interactive queue3766 % [s,w] = unix(['qrsh -q fast.q ' civ2_exe' -f ' filename_cmx ' > ' namelog ' 2>&1']);3767 % end3768 % if s~=03769 % eval(['!' civ2_exe' -f ' filename_cmx ' > ' namelog]);3770 % ['!' civ2_exe' -f ' filename_cmx ' > ' namelog]3771 % end3772 end3773 end3774 % close(h)3674 % %------------------------------------------------------------------------ 3675 % % RUN CIV2 CIV2 CIV2 CIV2 3676 % function RUN_CIV2(handles,filecell_2,filecell_3,filecell_nc1,filecell_nc2,num1,num2,num_a,num_b,nom_type_nc) 3677 % %------------------------------------------------------------------------ 3678 % %filecell_2: names of first image 3679 % %filecell_3: names of second images 3680 % global civ2Bin sge 3681 % 3682 % %names of the civ2 fields 3683 % field.vel_type='civ2'; 3684 % field.nb='nb_vectors2'; 3685 % field.X='vec2_X'; 3686 % field.Y='vec2_Y'; 3687 % field.U='vec2_U'; 3688 % field.V='vec2_V'; 3689 % 3690 % %get civ parameters 3691 % ibx=get(handles.ibx_civ2,'String'); 3692 % iby=get(handles.iby_civ2,'String'); 3693 % rho=get(handles.rho_civ2,'String'); 3694 % decimal=int2str(get(handles.decimal,'Value')); 3695 % deformation=int2str(get(handles.deformation,'Value')); 3696 % dx=get(handles.dx_civ2,'String'); 3697 % dy=get(handles.dy_civ2,'String'); 3698 % if isequal(str2num(dx),[]) 3699 % dx='20';%default 3700 % end 3701 % if isequal(str2num(dy),[]) 3702 % dy='20';%default 3703 % end 3704 % pxcmx='1';%velocity fields are expressed in pixel displacement 3705 % pxcmy='1'; 3706 % A=imread(cell2mat(filecell_2(1,1)));%read the first image to get the size 3707 % sizim=size(A); 3708 % npx=num2str(sizim(2)); 3709 % npy=num2str(sizim(1)); 3710 % time=get(handles.displ_filebase,'UserData'); %get the set of times 3711 % filebase=get(handles.displ_filebase,'String'); 3712 % %grid 3713 % gridname='';%default ='noFile use default' 3714 % gridflag='n';%default 3715 % test_grid=get(handles.browse_gridciv2,'Value'); 3716 % nbslice_grid=[]; 3717 % if test_grid 3718 % gridname=get(handles.grid_civ2,'String'); 3719 % if numel(gridname)>4 && isequal(gridname(end-3:end),'grid') 3720 % nbslice_grid=str2num(gridname(1:end-4)); % 3721 % if ~isempty(nbslice_grid) 3722 % gridflag='y'; 3723 % end 3724 % elseif exist(gridname,'file') 3725 % gridflag='y'; 3726 % else 3727 % msgbox_uvmat('ERROR',['input grid file ' gridname ' not found']) 3728 % return 3729 % end 3730 % end 3731 % sizcell=size(filecell_2); 3732 % nbfield=sizcell(1); 3733 % nbslice=sizcell(2); 3734 % 3735 % %main loop 3736 % icount=0; 3737 % for ifile=1:nbfield 3738 % for j=1:nbslice 3739 % icount=icount+1; 3740 % barlength=0.188*icount/(nbfield*nbslice); 3741 % set(handles.waitbar_civ2,'Position',[0.946 0.407-barlength 0.03 barlength]) 3742 % drawnow 3743 % filename_ima_2=cell2mat(filecell_2(ifile,j)); 3744 % filename_ima_2([end-3:end])=[];%remove .png extension 3745 % filename_ima_3=cell2mat(filecell_3(ifile,j)); 3746 % filename_ima_3([end-3:end])=[];%remove .png extension 3747 % filename_cmx=cell2mat(filecell_nc2(ifile,j));%output netcdf file 3748 % filename_cmx([end-1:end])=[ 'cm'];%name of cmx file 3749 % filename_cmx=[filename_cmx 'x']; 3750 % namelog=[filename_cmx([1:end-3]) 'log']; 3751 % if size(time,1)>=num2(ifile) & size(time,2)>=num_b(j) 3752 % Dt=num2str(time(num2(ifile),num_b(j))-time(num1(ifile),num_a(j))); 3753 % if isequal(Dt,'0') 3754 % Dt='1' ;%case of 'displacement' mode 3755 % end 3756 % T0=num2str((time(num2(ifile),num_b(j))+time(num1(ifile),num_a(j)))/2); 3757 % else 3758 % Dt='1'; 3759 % T0='0'; 3760 % end 3761 % term_a=num2stra(num_a(j),nom_type_nc); 3762 % term_b=num2stra(num_b(j),nom_type_nc); 3763 % filename_nc1=cell2mat(filecell_nc1(ifile,j)); 3764 % filename_nc1([end-2:end])=[]; % remove '.nc' 3765 % if test_grid && ~isempty(nbslice_grid) 3766 % num1_grid=mod(num1(ifile)-1,nbslice_grid)+1; 3767 % gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 3768 % if ~exist(gridname,'file') 3769 % msgbox_uvmat('ERROR',['missing grid file ' gridname]) 3770 % return 3771 % end 3772 % end 3773 % test_mask=get(handles.get_mask_civ2,'Value'); 3774 % if test_mask==0 3775 % maskname='noFile use default'; 3776 % maskflag='n'; 3777 % else 3778 % maskdispl=get(handles.mask_civ2,'String'); 3779 % maskbase=[filebase '_' maskdispl]; % 3780 % nbslice_mask=str2num(maskdispl(1:end-4)); % 3781 % num1_mask=mod(num1(ifile)-1,nbslice_mask)+1; 3782 % maskname =name_generator(maskbase,num1_mask,1,'.png','_i'); 3783 % if ~exist(maskname,'file') 3784 % maskflag='y'; 3785 % else 3786 % maskname='noFile use default'; 3787 % maskflag='n'; 3788 % end 3789 % end 3790 % 3791 % textcmx={'############## CMX file';... 3792 % ['FirstImage ' filename_ima_2];... 3793 % ['LastImage ' filename_ima_3];... 3794 % 'XX' ;... 3795 % ['Mask ' maskflag];... 3796 % ['MaskName ' maskname];... 3797 % ['ImageSize ' npx ' ' npy];... 3798 % ['CorrelationBoxesSize ' ibx ' ' iby];... 3799 % ['SearchBoxeSize ' ibx ' ' iby];... 3800 % ['RO ' rho];... 3801 % ['GridSpacing ' dx ' ' dy];... 3802 % 'XX 1.0';... 3803 % ['Dt_TO ' Dt ' ' T0];... 3804 % ['PixCmXY ' pxcmx ' ' pxcmy];... 3805 % 'XX 1';... 3806 % ['ShiftXY 0 0'];... 3807 % ['Grid ' gridflag];... 3808 % ['GridName ' gridname];... 3809 % 'XX 85';... 3810 % 'XX 1.0';... 3811 % 'XX 1.0';... 3812 % 'Hart 1';... 3813 % ['DecimalShift ' decimal];... 3814 % ['Deformation ' deformation];... 3815 % 'CorrelationMin 0';... 3816 % 'IntensityMin 0';... 3817 % 'SeuilImage n';... 3818 % 'SeuilImageValues 0 4096';... 3819 % ['ImageToUse ' term_a ' ' term_b];... % VERIFIER ? 3820 % ['ImageUsedBefore ' filename_nc1]}; 3821 % textout=char(textcmx); 3822 % dlmwrite(filename_cmx,textout,''); 3823 % s=-1; 3824 % display(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog ]) 3825 % eval(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog ]); 3826 % 3827 % % if sge%dispatch computation on the cluster using interactive queue 3828 % % [s,w] = unix(['qrsh -q fast.q ' civ2Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1']); 3829 % % end 3830 % % if s~=0 3831 % % eval(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog]); 3832 % % ['!' civ2Bin ' -f ' filename_cmx ' > ' namelog] 3833 % % end 3834 % end 3835 % end 3836 % % close(h) 3775 3837 3776 3838 %------------------------------------------------------------------------ … … 3778 3840 function cmd_PATCH=RUN_PATCH(filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,test_interp) 3779 3841 %------------------------------------------------------------------------ 3780 global patch _exe patch_new_exe3842 global patchBin patch_newBin 3781 3843 namelog=[filename_nc([1:end-3]) '_patch.log']; 3782 3844 if test_interp==0 3783 cmd_PATCH=[patch _exe' -f ' filename_nc ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ...3845 cmd_PATCH=[patchBin ' -f ' filename_nc ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ... 3784 3846 ' > ' namelog ' 2>&1']; % redirect standard output to the log file 3785 3847 else %nouveau programme patch 3786 cmd_PATCH=[patch_new _exe' -f ' filename_nc ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ...3848 cmd_PATCH=[patch_newBin ' -f ' filename_nc ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ... 3787 3849 ' -max ' thresh_value ' -nopt ' subdomain_patch ' > ' namelog ' 2>&1']; % redirect standard output to the log file 3788 3850 end … … 3790 3852 %------------------------------------------------------------------------ 3791 3853 % --- STEREO Interp 3792 function cmd=RUN_STINTERP(stinterp _exe,filename_A_nc,filename_B_nc,filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,xmlA,xmlB)3854 function cmd=RUN_STINTERP(stinterpBin,filename_A_nc,filename_B_nc,filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,xmlA,xmlB) 3793 3855 %------------------------------------------------------------------------ 3794 3856 namelog=[filename_nc([1:end-3]) '_stinterp.log']; 3795 cmd=[stinterp _exe' -f1 ' filename_A_nc ' -f2 ' filename_B_nc ' -f ' filename_nc ...3857 cmd=[stinterpBin ' -f1 ' filename_A_nc ' -f2 ' filename_B_nc ' -f ' filename_nc ... 3796 3858 ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ' -c1 ' xmlA ' -c2 ' xmlB ' -xy x -Nfy 1024 > ' namelog ' 2>&1']; % redirect standard output to the log file 3797 3859 … … 4473 4535 function enable_patch1(handles) 4474 4536 %------------------------------------------------------------------------ 4475 global patch_new _exe4537 global patch_newBin 4476 4538 set(handles.frame_patch1,'BackgroundColor',[1 1 0]) 4477 4539 set(handles.rho_patch1,'Visible','on') … … 4485 4547 set(handles.nx_patch1_title,'Visible','on') 4486 4548 set(handles.ny_patch1_title,'Visible','on') 4487 if (~isequal(patch_new _exe,[]) & ~isequal(patch_new_exe,[]))4549 if (~isequal(patch_newBin,[]) & ~isequal(patch_newBin,[])) 4488 4550 set(handles.test_interp,'Visible','on'); 4489 4551 end … … 4777 4839 %------------------------------------------------------------------------ 4778 4840 % --- CIV1 CIV1 CIV1 CIV1 4779 function cmd_CIV1=BATCH_CIV1(filename,namelog,par,handles )4841 function cmd_CIV1=BATCH_CIV1(filename,namelog,par,handles,sparam) 4780 4842 %------------------------------------------------------------------------ 4781 4843 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 4782 global civ1_exe Civ_exe sge%name of the executable for civ1 calculation4783 4844 4784 4845 %changes : filename_cmx -> filename ( no extension ) … … 4854 4915 fclose(fid); 4855 4916 4856 if sge4857 cmd_CIV1=[ civ1_exe' -f ' filename '.cmx' ]; % redirect standard output to the log file4858 else4859 cmd_CIV1=[civ1_exe' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file4860 end4917 % if sge 4918 cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx' ]; % redirect standard output to the log file 4919 % else 4920 % cmd_CIV1=[civ1Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file 4921 % end 4861 4922 if(isunix) 4862 4923 [Rootbat,Filebat,extbat]=fileparts(namelog); 4863 4924 ncName=fullfile(Rootbat,[ Filebat '.nc']); 4864 cmd_CIV1=[cmd_CIV1 '\n' 'mv ' namelog ' ' namelog'.civ1.log' '\n' 'chmod g+w ' ncName];4865 else 4866 cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y ' namelog ' ' namelog'.civ1.log'];4925 cmd_CIV1=[cmd_CIV1 '\n' 'mv ' namelog ' ' regexprep(namelog,'\.log','') '.civ1.log' '\n' 'chmod g+w ' ncName]; 4926 else 4927 cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y ' namelog ' ' regexprep(namelog,'\.log','') '.civ1.log']; 4867 4928 end 4868 4929 … … 4872 4933 %------------------------------------------------------------------------ 4873 4934 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 4874 global civ1 _exe Civ_exe%name of the executable for civ1 calculation4935 global civ1Bin CivBin%name of the executable for civ1 calculation 4875 4936 4876 4937 civ1.image1=par.filename_ima_a; … … 4911 4972 %------------------------------------------------------------------------ 4912 4973 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 4913 global civ2 _exe Civ_exe%name of the executable for civ1 calculation4974 global civ2Bin CivBin%name of the executable for civ1 calculation 4914 4975 4915 4976 civ2.image1=par.filename_ima_a; … … 4960 5021 %------------------------------------------------------------------------ 4961 5022 % --- CIV2 CIV2 CIV2 CIV2 4962 function cmd_CIV2=BATCH_CIV2(filename_cmx,namelog,par )5023 function cmd_CIV2=BATCH_CIV2(filename_cmx,namelog,par,sparam) 4963 5024 %------------------------------------------------------------------------ 4964 5025 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 4965 global civ2_exesge%name of the executable for civ1 calculation5026 % global civ2Bin sge%name of the executable for civ1 calculation 4966 5027 if isequal(par.Dt,'0') 4967 5028 par.Dt='1' ;%case of 'displacement' mode … … 5001 5062 fprintf(fid,textout); 5002 5063 fclose(fid) 5003 if sge5004 cmd_CIV2=[ civ2_exe' -f ' filename_cmx ]; % redirect standard output to the log file5005 else5006 cmd_CIV2=[civ2_exe' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file5007 end5064 % if sge 5065 cmd_CIV2=[sparam.Civ2Bin ' -f ' filename_cmx ]; % redirect standard output to the log file 5066 % else 5067 % cmd_CIV2=[civ2Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file 5068 % end 5008 5069 5009 5070 %------------------------------------------------------------------------ -
trunk/src/geometry_calib.m
r63 r67 78 78 % Update handles structure 79 79 guidata(hObject, handles); 80 movegui(hObject,'east');% position the GUI ton the right of the screen81 if exist('handles_uvmat','var') %& isfield(data,'ParentButton')82 set(hObject,'DeleteFcn',{@closefcn,handles_uvmat})%83 end80 %movegui(hObject,'east');% position the GUI ton the right of the screen 81 % if exist('handles_uvmat','var') %& isfield(data,'ParentButton') 82 set(hObject,'DeleteFcn',{@closefcn})% 83 % end 84 84 %set the position of the interface 85 85 if exist('pos','var')& length(pos)>2 … … 100 100 end 101 101 end 102 set(handles.ListCoord,'String',{' '})102 set(handles.ListCoord,'String',{'...'}) 103 103 if exist(inputxml,'file') 104 104 loadfile(handles,inputxml)% load the point coordiantes existing in the xml file … … 213 213 CoordCell{iline,j}=num2str(Coord(iline,j),4); 214 214 end 215 end 215 end 216 CoordCell=[CoordCell;{' ',' ',' ',' ',' '}]; 216 217 Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display 217 218 set(handles.ListCoord,'Value',1) 218 219 set(handles.ListCoord,'String',Tabchar) 219 220 220 221 % 221 222 %------------------------------------------------------------------------ 222 223 % executed when closing: set the parent interface button to value 0 223 function closefcn(gcbo,eventdata ,handles_uvmat)224 function closefcn(gcbo,eventdata) 224 225 %------------------------------------------------------------------------ 225 226 huvmat=findobj(allchild(0),'Name','uvmat'); 226 if exist('handles_uvmat','var') 227 set(handles_uvmat.cal,'Value',0) 228 uvmat('cal_Callback',huvmat,[],handles_uvmat); 229 % set(parent_button,'Value',0)%put unactivated buttons to green 230 % set(parent_button,'BackgroundColor',[0 1 0]); 227 if ~isempty(huvmat) 228 handles=guidata(huvmat); 229 set(handles.MenuTools,'enable','on') 230 set(handles.MenuObject,'enable','on') 231 set(handles.MenuEdit,'enable','on') 232 set(handles.edit,'enable','on') 233 hobject=findobj(handles.axes3,'tag','calib_points'); 234 if ~isempty(hobject) 235 delete(hobject) 236 end 237 hobject=findobj(handles.axes3,'tag','calib_marker'); 238 if ~isempty(hobject) 239 delete(hobject) 240 end 231 241 end 232 242 … … 582 592 %update the plot 583 593 ListCoord_Callback(hObject, eventdata, handles) 584 594 MenuPlot_Callback(hObject, eventdata, handles) 585 595 %------------------------------------------------------------------------ 586 596 % --- Executes on selection change in ListCoord. … … 1017 1027 set(handles.ListCoord,'Value',1) 1018 1028 set(handles.ListCoord,'String',Tabchar) 1019 1029 MenuPlot_Callback(hObject, eventdata, handles) 1020 1030 1021 1031 %%%%%%%%%%%%%%%%%%%% -
trunk/src/mouse_down.m
r65 r67 23 23 24 24 function xy=mouse_down(hObject,eventdata) 25 testzoom=0;%default 25 26 26 MouseAction='none'; %default 27 27 huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle which controls theoption of mouse action … … 31 31 hhuvmat=guidata(huvmat);%handles of elements in uvmat 32 32 UvData=get(huvmat,'UserData'); 33 MouseAction='none'; %default 33 34 testzoom=get(hhuvmat.zoom,'Value');% get the mouse action from the uvmat GUI: options: 34 35 if isfield(UvData,'MouseAction') … … 40 41 test_cal=strcmp(MouseAction,'calib'); 41 42 test_ruler=strcmp(MouseAction,'ruler'); 42 % menu_coord=get(hhuvmat.transform_fct,'String');43 % coord_choice=get(hhuvmat.transform_fct,'Value');44 % coord_type=menu_coord{coord_choice};45 43 test_edit=strcmp(MouseAction,'edit_object'); 46 44 test_edit_vect=strcmp(MouseAction,'edit_vect'); 47 45 xdisplay=[];%default 48 46 ydisplay=[];%default 49 haxes=[];50 47 AxeData=[];%default 51 48 … … 58 55 xy_fig=get(hcurrentfig,'CurrentPoint');% current point of the current figure (gcbo) 59 56 hchild=get(hcurrentfig,'Children');%handles of all objects in the current figure 57 haxes=[]; 60 58 % loop on all the objects in the current figure (selected by the last mouse click) 61 59 for ichild=1:length(hchild) … … 83 81 flag_vec=(AxeData.X<(xy(1,1)+AxeData.Mesh/4) & AxeData.X>(xy(1,1)-AxeData.Mesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse 84 82 (AxeData.Y<(xy(1,2)+AxeData.Mesh/4) & AxeData.Y>(xy(1,2)-AxeData.Mesh/4));%f 85 ivec=find(flag_vec);% search the selected vector index ivec 86 if length(ivec)>0 87 ivec=ivec(1);%choice the first selected vector if several are selected 88 end 83 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 89 84 end 90 85 end … … 113 108 AxeData.Drawing='zoom'; %initiate drawing mode 114 109 AxeData.CurrentObject=[];%unselect objects 115 elseif ~isempty(huvmat) 116 %selection of an existing projection object 117 if test_edit && (isequal(tag_obj,'proj_object')||isequal(tag_obj,'DeformPoint')) 118 if ~(isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'create')) 119 userdata=get(hcurrentobject,'UserData'); 120 if ishandle(userdata)%the selected line depends on a parent line 121 AxeData.CurrentObject=userdata;% the parent object becomes the current one 122 else 123 AxeData.CurrentObject=hcurrentobject;% the selected object becomes the current one 124 end 125 ObjectData=get(AxeData.CurrentObject,'UserData'); 126 if test_edit & isfield(ObjectData,'IndexObj') 127 hother=findobj('Tag','proj_object','Type','line');%find all the proj objects 128 set(hother,'Color','b');%reset all the proj objects in 'blue' by default 129 set(hother,'Selected','off') 130 hother=findobj('Tag','proj_object','Type','rectangle'); 131 set(hother,'EdgeColor','b'); 132 set(hother,'Selected','off'); 133 hother=findobj('Tag','proj_object','Type','image'); 134 for iobj=1:length(hother) 135 Acolor=get(hother(iobj),'CData'); 136 Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2)); 137 set(hother(iobj),'CData',Acolor); 138 end 139 hother=findobj('Tag','DeformPoint'); 140 set(hother,'Color','b'); 141 set(hother,'Selected','off') 142 if isequal(get(AxeData.CurrentObject,'Type'),'line') 143 set(AxeData.CurrentObject,'Color','m'); %set the selected object to magenta color 144 elseif isequal(get(AxeData.CurrentObject,'Type'),'rectangle') 145 set(AxeData.CurrentObject,'EdgeColor','m'); %set the selected object to magenta color 146 end 147 if isfield(ObjectData,'SubObject')& ishandle(ObjectData.SubObject) 148 for iobj=1:length(ObjectData.SubObject) 149 hsub=ObjectData.SubObject(iobj); 150 if isequal(get(hsub,'Type'),'rectangle') 151 set(hsub,'EdgeColor','m'); %set the selected object to magenta color 152 elseif isequal(get(hsub,'Type'),'image') 153 Acolor=get(hsub,'CData'); 154 Acolor(:,:,1)=Acolor(:,:,3); 155 set(hsub,'CData',Acolor); 156 else 157 set(hsub,'Color','m') 158 end 110 return 111 end 112 if isempty(huvmat) 113 return 114 end 115 116 %selection of an existing projection object 117 if test_edit && (isequal(tag_obj,'proj_object')||isequal(tag_obj,'DeformPoint')) 118 if ~(isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'create')) 119 userdata=get(hcurrentobject,'UserData'); 120 if ishandle(userdata)%the selected line depends on a parent line 121 AxeData.CurrentObject=userdata;% the parent object becomes the current one 122 else 123 AxeData.CurrentObject=hcurrentobject;% the selected object becomes the current one 124 end 125 ObjectData=get(AxeData.CurrentObject,'UserData'); 126 if test_edit & isfield(ObjectData,'IndexObj') 127 hother=findobj('Tag','proj_object','Type','line');%find all the proj objects 128 set(hother,'Color','b');%reset all the proj objects in 'blue' by default 129 set(hother,'Selected','off') 130 hother=findobj('Tag','proj_object','Type','rectangle'); 131 set(hother,'EdgeColor','b'); 132 set(hother,'Selected','off'); 133 hother=findobj('Tag','proj_object','Type','image'); 134 for iobj=1:length(hother) 135 Acolor=get(hother(iobj),'CData'); 136 Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2)); 137 set(hother(iobj),'CData',Acolor); 138 end 139 hother=findobj('Tag','DeformPoint'); 140 set(hother,'Color','b'); 141 set(hother,'Selected','off') 142 if isequal(get(AxeData.CurrentObject,'Type'),'line') 143 set(AxeData.CurrentObject,'Color','m'); %set the selected object to magenta color 144 elseif isequal(get(AxeData.CurrentObject,'Type'),'rectangle') 145 set(AxeData.CurrentObject,'EdgeColor','m'); %set the selected object to magenta color 146 end 147 if isfield(ObjectData,'SubObject')& ishandle(ObjectData.SubObject) 148 for iobj=1:length(ObjectData.SubObject) 149 hsub=ObjectData.SubObject(iobj); 150 if isequal(get(hsub,'Type'),'rectangle') 151 set(hsub,'EdgeColor','m'); %set the selected object to magenta color 152 elseif isequal(get(hsub,'Type'),'image') 153 Acolor=get(hsub,'CData'); 154 Acolor(:,:,1)=Acolor(:,:,3); 155 set(hsub,'CData',Acolor); 156 else 157 set(hsub,'Color','m') 159 158 end 160 159 end 161 if isequal(tag_obj,'DeformPoint')162 set(hcurrentobject,'Color','m'); %set the selected DeformPoint to magenta color163 end164 IndexObj=ObjectData.IndexObj;165 set(hhuvmat.list_object_1,'Value',IndexObj);166 set(hhuvmat.list_object_2,'Value',IndexObj);167 testdeform=0;168 set(gcbo,'Pointer','circle');169 AxeData.Drawing='deform';170 if isequal(tag_obj,'DeformPoint')171 if isfield(ObjectData,'DeformPoint')172 set(hcurrentobject,'Selected','on')173 for ipt=1:length(ObjectData.DeformPoint)174 if isequal(ObjectData.DeformPoint(ipt),hcurrentobject)175 AxeData.CurrentIndex=ipt;176 testdeform=1;177 end160 end 161 if isequal(tag_obj,'DeformPoint') 162 set(hcurrentobject,'Color','m'); %set the selected DeformPoint to magenta color 163 end 164 IndexObj=ObjectData.IndexObj; 165 set(hhuvmat.list_object_1,'Value',IndexObj); 166 set(hhuvmat.list_object_2,'Value',IndexObj); 167 testdeform=0; 168 set(gcbo,'Pointer','circle'); 169 AxeData.Drawing='deform'; 170 if isequal(tag_obj,'DeformPoint') 171 if isfield(ObjectData,'DeformPoint') 172 set(hcurrentobject,'Selected','on') 173 for ipt=1:length(ObjectData.DeformPoint) 174 if isequal(ObjectData.DeformPoint(ipt),hcurrentobject) 175 AxeData.CurrentIndex=ipt; 176 testdeform=1; 178 177 end 179 178 end 180 end 181 if testdeform==0 182 AxeData.Drawing='translate'; 183 set(AxeData.CurrentObject,'Selected','on') 184 set(gcbo,'Pointer','fleur'); 185 end 186 end 187 end 188 end 189 % create new projection object 190 if test_create && ~isempty(xy) && ~(isfield(AxeData,'Drawing')&& isequal(AxeData.Drawing,'create')) 191 ObjectData=read_set_object(UvData.sethandles); 192 ObjectData.Coord=[]; %reset previous object coordinates 193 ObjectData.Coord(1,1)=xy(1,1); 194 ObjectData.Coord(1,2)=xy(1,2); 195 ObjectData.Coord(1,3)=0; 196 if isfield(AxeData,'ObjectCoord') & size(AxeData.ObjectCoord,2)==3 197 ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle 198 end 199 AxeData.CurrentObject=plot_object(ObjectData,[],haxes,'m');%draw the object and its handle becomes AxeData.CurrentObject 200 if isfield(UvData,'Object') 201 IndexObj=length(UvData.Object)+1;% add the object as index IndexObj on the list of the interface 202 else 203 IndexObj=2; 204 end 205 UvData.Object{IndexObj}=ObjectData; 206 UvData.Object{IndexObj}.HandlesDisplay(1)=AxeData.CurrentObject; 207 set(huvmat,'UserData',UvData) 208 list_str=get(hhuvmat.list_object_1,'String'); 209 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 210 if ~isequal(list_str{end},'...') 211 list_str{end+1}='...'; 212 end 213 set(hhuvmat.list_object_1,'String',list_str) 214 set(hhuvmat.list_object_2,'String',list_str) 215 if strcmp(fig_tag,'view_field')%we are in view_field plot 216 set(hhuvmat.list_object_1,'Value',IndexObj) 217 else%we are in uvmat plot 218 set(hhuvmat.list_object_2,'Value',IndexObj) 219 end 220 PlotData=get(AxeData.CurrentObject,'UserData'); 221 PlotData.IndexObj=IndexObj; 222 set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph 223 AxeData.Drawing='create'; 224 end 225 226 % create calibration points if the GUI geometry_calib is opened 227 if test_cal & ~isempty(xy) 228 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 229 hh_geometry_calib=guidata(h_geometry_calib); 230 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 231 h_edit_append=hh_geometry_calib.edit_append;%findobj(h_geometry_calib,'Tag','edit_append'); 232 if isequal(get(h_edit_append,'Value'),1) 233 coord_value=get(hhuvmat.transform_fct,'Value'); 234 if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys) 235 set(hhuvmat.transform_fct,'Value',1) 236 set(hhuvmat.FixedLimits,'Value',0)% put FixedLimits option to 'off' 237 set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7]) 238 uvmat('run0_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat 239 return 240 end 241 % if isequal(coord_type,'px')|isequal(coord_type,'');%px cordinates 242 strline=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; 243 % else %phys cordinates 244 % strline=[ num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4) ' | 0 | ' ' | ' ]; 245 % end 246 Coord=get(h_ListCoord,'String'); 247 val=get(h_ListCoord,'Value'); 248 if isequal(Coord,{''}) 249 val=0; 250 end 251 if length(Coord)>val 252 Coord(val+2:length(Coord)+1)=Coord(val+1:length(Coord));% push the list forward beyond the current point 253 end 254 Coord{val+1}=strline; 255 set(h_ListCoord,'String',Coord) 256 set(h_ListCoord,'Value',val+1) 257 geometry_calib('ListCoord_Callback',hObject,eventdata,hh_geometry_calib) 258 data=read_geometry_calib(Coord); 259 % if isequal(coord_type,'px')|isequal(coord_type,'');%px cordinates 260 XCoord=data.Coord(:,4); 261 YCoord=data.Coord(:,5); 262 % else %phys cordinates 263 % XCoord=data.Coord(:,1); 264 % YCoord=data.Coord(:,2); 265 % end 266 hh=findobj('Tag','calib_points'); 267 if isempty(hh) 268 line(XCoord,YCoord,'Color','m','Tag','calib_points','LineStyle','.','Marker','+'); 269 else 270 set(hh,'XData',XCoord) 271 set(hh,'YData',YCoord) 272 end 273 hhh=findobj('Tag','calib_marker'); 274 if ~isempty(hhh) 275 set(hhh,'XData',xy(1,1)) 276 set(hhh,'YData',xy(1,2)) 277 else 278 line(xy(1,1),xy(1,2),'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',20); 279 end 280 %uistack(h_geometry_calib,'top') 281 end 282 end 283 284 % edit vectors 285 if test_edit_vect & ~isempty(ivec) 286 % FF_100=FF-100*double(uint(abs(FF)/100); %value of FF without units and dizaines 287 if ~(isfield(AxeData,'FF')&& ~isempty(AxeData.FF)) 288 AxeData.FF=zeros(size(AxeData.X)); 289 end 290 if isequal(AxeData.FF(ivec),0) 291 AxeData.FF(ivec)=100; %mark vector #ivec as false 179 end 180 end 181 if testdeform==0 182 AxeData.Drawing='translate'; 183 set(AxeData.CurrentObject,'Selected','on') 184 set(gcbo,'Pointer','fleur'); 185 end 186 end 187 end 188 end 189 % create new projection object 190 if test_create && ~isempty(xy) && ~(isfield(AxeData,'Drawing')&& isequal(AxeData.Drawing,'create')) 191 ObjectData=read_set_object(UvData.sethandles); 192 ObjectData.Coord=[]; %reset previous object coordinates 193 ObjectData.Coord(1,1)=xy(1,1); 194 ObjectData.Coord(1,2)=xy(1,2); 195 ObjectData.Coord(1,3)=0; 196 if isfield(AxeData,'ObjectCoord') & size(AxeData.ObjectCoord,2)==3 197 ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle 198 end 199 AxeData.CurrentObject=plot_object(ObjectData,[],haxes,'m');%draw the object and its handle becomes AxeData.CurrentObject 200 if isfield(UvData,'Object') 201 IndexObj=length(UvData.Object)+1;% add the object as index IndexObj on the list of the interface 292 202 else 293 AxeData.FF(ivec)=0; 294 end 295 PlotParam=read_plot_param(hhuvmat); 296 [PlotType,ScalOut]= plot_field(AxeData,haxes,PlotParam,1); 297 end 298 299 %create ruler 300 if test_ruler 301 UvData.RulerCoord(1,1)=xy(1,1); 302 UvData.RulerCoord(1,2)=xy(1,2); 303 UvData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler'); 203 IndexObj=2; 204 end 205 UvData.Object{IndexObj}=ObjectData; 206 UvData.Object{IndexObj}.HandlesDisplay(1)=AxeData.CurrentObject; 304 207 set(huvmat,'UserData',UvData) 305 end 208 list_str=get(hhuvmat.list_object_1,'String'); 209 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 210 if ~isequal(list_str{end},'...') 211 list_str{end+1}='...'; 212 end 213 set(hhuvmat.list_object_1,'String',list_str) 214 set(hhuvmat.list_object_2,'String',list_str) 215 if strcmp(fig_tag,'view_field')%we are in view_field plot 216 set(hhuvmat.list_object_1,'Value',IndexObj) 217 else%we are in uvmat plot 218 set(hhuvmat.list_object_2,'Value',IndexObj) 219 end 220 PlotData=get(AxeData.CurrentObject,'UserData'); 221 PlotData.IndexObj=IndexObj; 222 set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph 223 AxeData.Drawing='create'; 224 end 225 226 % create calibration points if the GUI geometry_calib is opened, if the main axes axes3 of uvmat has ben selected 227 if test_cal && ~isempty(haxes) && strcmp(get(haxes,'tag'),'axes3') 228 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 229 hh_geometry_calib=guidata(h_geometry_calib); 230 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 231 h_edit_append=hh_geometry_calib.edit_append;%findobj(h_geometry_calib,'Tag','edit_append'); 232 if isequal(get(h_edit_append,'Value'),1) 233 coord_value=get(hhuvmat.transform_fct,'Value');% set uvmat to pixel coordinates, run it again if not 234 if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys) 235 set(hhuvmat.transform_fct,'Value',1) 236 set(hhuvmat.FixedLimits,'Value',0)% put FixedLimits option to 'off' 237 set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7]) 238 uvmat('run0_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat 239 return 240 end 241 Coord=get(h_ListCoord,'String'); 242 data=read_geometry_calib(Coord)%transform char cell to numbers 243 ind_range=10;%range of research around each existing point 244 test_newpoint=1; 245 if size(data.Coord,2)>=5 %if calibration points already exist 246 XCoord=(data.Coord(:,4)); 247 YCoord=(data.Coord(:,5)); 248 index_point=find((XCoord<xy(1,1)+ind_range) & (XCoord>xy(1,1)-ind_range) & ...%flagx=1 for the vectors with x position selected by the mouse 249 (YCoord<xy(1,2)+ind_range) & (YCoord>xy(1,2)-ind_range),1);%find the first calibration point in the neighborhood of the mouse 250 test_newpoint=isempty(index_point);%test for no existing calibration point near the mouse position 251 end 252 %create a new calib point if we are not close to an existing one 253 if test_newpoint 254 strline=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; 255 val=get(h_ListCoord,'Value'); 256 if length(Coord)>=val 257 Coord(val+1:length(Coord)+1)=Coord(val:length(Coord))% push the list forward beyond the current point 258 end 259 Coord{val}=strline; 260 set(h_ListCoord,'String',Coord) 261 set(h_ListCoord,'Value',val+1) 262 data=read_geometry_calib(Coord);%transform char cell to numbers 263 XCoord=data.Coord(:,4); 264 YCoord=data.Coord(:,5); 265 end 266 hh=findobj('Tag','calib_points');%look for handle of calibration points 267 if isempty(hh) 268 hh=line(XCoord,YCoord,'Color','m','Tag','calib_points','LineStyle','.','Marker','+'); 269 else 270 set(hh,'XData',XCoord) 271 set(hh,'YData',YCoord) 272 end 273 set(hh,'UserData','edit_mode')% flag the points to edit mode 274 hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle) 275 if ~isempty(hhh) 276 set(hhh,'XData',xy(1,1)) 277 set(hhh,'YData',xy(1,2)) 278 else 279 line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',20); 280 end 281 end 282 end 283 284 % edit vectors 285 if test_edit_vect & ~isempty(ivec) 286 if ~(isfield(AxeData,'FF')&& ~isempty(AxeData.FF)) 287 AxeData.FF=zeros(size(AxeData.X)); 288 end 289 if isequal(AxeData.FF(ivec),0) 290 AxeData.FF(ivec)=100; %mark vector #ivec as false 291 else 292 AxeData.FF(ivec)=0; 293 end 294 PlotParam=read_plot_param(hhuvmat); 295 [PlotType,ScalOut]= plot_field(AxeData,haxes,PlotParam,1); 296 end 297 298 %create ruler 299 if test_ruler 300 UvData.RulerCoord(1,1)=xy(1,1); 301 UvData.RulerCoord(1,2)=xy(1,2); 302 UvData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler'); 303 set(huvmat,'UserData',UvData) 306 304 end 307 305 set(haxes,'UserData',AxeData); -
trunk/src/mouse_motion.m
r65 r67 27 27 return 28 28 end 29 % if ~isfield(handles, 'mouse_coord')30 % 'TEST'31 % return32 % end33 % if ~ishandle(handles.mouse_coord)34 % return35 % end36 % proj_coord=get(handles.mouse_coord,'String');37 % choice=get(handles.mouse_coord,'Value');38 % if ~isempty(proj_coord); proj_coord=proj_coord{choice};else;proj_coord=[];end;39 29 test_create=0;%default 40 30 test_edit=0;%default 41 % if isfield(handles,'VOLUME') % mouse_motion not applied to the uvmat figure, no object creation42 % test_create=get(handles.create,'Value');43 % end44 31 test_edit=isfield(handles,'edit') & get(handles.edit,'Value');% edit test for mouse shap: an arrow 45 32 test_zoom=isfield(handles,'zoom')& get(handles.zoom,'Value');% edit test for mouse shap: an arrow … … 54 41 AxeData=[];%default 55 42 mouse=[]; 43 xy=[];%default 56 44 57 45 pointershape='arrow';% default pointer is an arrow 58 59 xy_fig=get(gcbo,'CurrentPoint');% current point of the current figure (gcbo)60 hchild=get(gcbo,'Children');%handles of all objects in the current figure61 46 currentfig=gcbo;%store gcbo as variable currentfig 47 xy_fig=get(currentfig,'CurrentPoint');% current point of the current figure (gcbo) 48 hchild=get(currentfig,'Children');%handles of all objects in the current figure 49 62 50 % loop on all the objects in the current figure (selected by the last mouse click) 63 51 for ichild=1:length(hchild) … … 88 76 flag_vec=(AxeData.X<(xy(1,1)+AxeData.Mesh/3) & AxeData.X>(xy(1,1)-AxeData.Mesh/3)) & ...%flagx=1 for the vectors with x position selected by the mouse 89 77 (AxeData.Y<(xy(1,2)+AxeData.Mesh/3) & AxeData.Y>(xy(1,2)-AxeData.Mesh/3));%f 90 ivec=find(flag_vec );% search theselected vector index ivec78 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 91 79 hhh=findobj(haxes,'Tag','vector_marker'); 92 if length(ivec)>080 if ~isempty(ivec) 93 81 %ivec=ivec(1);%choice the first selected vector if several are selected 94 82 if ~test_create 95 83 pointershape='arrow'; %mouse indicates the detection of a vector 96 97 84 if isempty(hhh) 98 85 set(currentfig,'CurrentAxes',haxes) … … 262 249 end 263 250 end 251 264 252 %%%%%%%%%%%%% 265 %draw a rectangle if no object creation is selected253 %draw a zoom rectangle if no object creation is selected 266 254 if ~isempty(haxes) & isfield(AxeData,'Drawing')& isequal(AxeData.Drawing,'zoom')& isfield(AxeData,'CurrentOrigin')... 267 255 & isequal(get(gcf,'SelectionType'),'normal')% … … 281 269 end 282 270 end 283 end284 if test_zoom271 % end 272 % if test_zoom 285 273 pointershape='arrow'; 274 end 275 276 % detect calibration points if the GUI geometry_calib is opened 277 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 278 if ~test_zoom && ~isempty(h_geometry_calib) 279 pointershape='crosshair';%default for geometry_calib: ready to create new points 280 hh_geometry_calib=guidata(h_geometry_calib); 281 if get(hh_geometry_calib.edit_append,'Value') && ~isempty(xy) 282 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 283 Coord=get(h_ListCoord,'String'); 284 data=read_geometry_calib(Coord);%transform char cell to numbers 285 if size(data.Coord,2)>=5 286 XCoord=(data.Coord(:,4)); 287 YCoord=(data.Coord(:,5)); 288 xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 289 if ~isempty(xy) 290 ind_range=10; 291 index_point=find((XCoord<xy(1,1)+ind_range) & (XCoord>xy(1,1)-ind_range) & ...%flagx=1 for the vectors with x position selected by the mouse 292 (YCoord<xy(1,2)+ind_range) & (YCoord>xy(1,2)-ind_range),1);%find the first calibration point in the neighborhood of the mouse 293 if ~isempty(index_point) 294 pointershape='arrow';% default pointer is an arrow 295 set(h_ListCoord,'Value',index_point)%mrk the point on the GUI geometry_calib 296 hh=findobj('Tag','calib_points');%look for handle of calibration points 297 if ~isempty(hh) && strcmp(get(hh,'UserData'),'edit_mode') 298 XCoord(index_point)=xy(1,1); 299 YCoord(index_point)=xy(1,2); 300 set(hh,'XData',XCoord) 301 set(hh,'YData',YCoord) 302 end 303 hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle) 304 if ~isempty(hhh) 305 set(hhh,'XData',XCoord(index_point)) 306 set(hhh,'YData',YCoord(index_point)) 307 end 308 end 309 end 310 end 311 end 286 312 end 287 313 … … 291 317 if isfield(UvData,'MouseAction') && isequal(UvData.MouseAction,'ruler') 292 318 if isfield(UvData,'RulerHandle') 319 pointershape='crosshair'; 293 320 RulerCoord=[UvData.RulerCoord ;xy(1,1:2)]; 294 321 set(UvData.RulerHandle,'XData',RulerCoord(:,1)); -
trunk/src/mouse_up.m
r61 r67 37 37 zoomstate=get(hhuvmat.zoom,'Value'); 38 38 end 39 if isequal(MouseAction,'calib') && ~zoomstate40 return41 end39 % if isequal(MouseAction,'calib') && ~zoomstate 40 % return 41 % end 42 42 currentfig=gcbo; 43 43 AxeData=get(gca,'UserData'); … … 138 138 set(hhuvmat.edit,'Value',1);% 139 139 set(hhuvmat.edit,'Enable','on');% 140 set(hhuvmat.MenuEditObject,'Enable','on');% 140 141 set(hhuvmat.MenuEdit,'Enable','on');% 141 set(hhuvmat.MenuEdit,'Enable','on');% 142 set(hhuvmat.MenuObject,'Enable','on');% 142 % set(hhuvmat.MenuObject,'Enable','on');% 143 143 UvData.MouseAction='edit_object'; % set the edit button to 'on' 144 144 end … … 261 261 end 262 262 end 263 if isequal(MouseAction,'ruler') 263 264 % editing calibration point 265 if strcmp(MouseAction,'calib') 266 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 267 hh=findobj('Tag','calib_points')%look for handle of calibration points 268 if ~isempty(hh) 269 set(hh,'UserData',[])%remove edit mode 270 end 271 strline=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; 272 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 273 hh_geometry_calib=guidata(h_geometry_calib); 274 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 275 Coord=get(h_ListCoord,'String'); 276 val=get(h_ListCoord,'Value'); 277 % if length(Coord)>=val 278 % Coord(val+1:length(Coord)+1)=Coord(val:length(Coord));% push the list forward beyond the current point 279 % end 280 Coord{val}=strline; 281 set(h_ListCoord,'String',Coord) 282 %set(h_ListCoord,'Value',val+1) 283 %geometry_calib('ListCoord_Callback',hObject,eventdata,hh_geometry_calib) 284 %data=read_geometry_calib(Coord);%transform char cell to numbers 285 %XCoord=data.Coord(:,4); 286 %YCoord=data.Coord(:,5) 287 end 288 289 % finalising ruler 290 if strcmp(MouseAction,'ruler') 264 291 UvData.MouseAction='none'; 265 292 UvData=rmfield(UvData,'RulerHandle'); -
trunk/src/set_object.m
r61 r67 89 89 PlotHandles=[]; 90 90 end 91 desable_open=0;%default: allow reading of object from xml file 92 desable_plot=0;%default 91 enable_plot=0;%default 93 92 SetData.PlotHandles=PlotHandles; 94 if exist('data','var') && isfield(data,'ParentButton')95 SetData.ParentButton=data.ParentButton;96 set(hObject,'DeleteFcn',{@closefcn,SetData.ParentButton})%97 end93 % if exist('data','var') && isfield(data,'ParentButton') 94 % SetData.ParentButton=data.ParentButton; 95 % set(hObject,'DeleteFcn',{@closefcn,SetData.ParentButton})% 96 % end 98 97 set(hObject,'UserData',SetData) 99 98 … … 101 100 if exist('data','var') 102 101 if isfield(data,'desable_plot') 103 desable_plot=data.desable_plot;%test to desable button PLOT (display mode)102 enable_plot=~data.desable_plot;%test to desable button PLOT (display mode) 104 103 end 105 104 if ~isfield(data,'NbDim')||~isequal(data.NbDim,3)%2D case … … 242 241 % set(handles.OPEN,'Visible','on') 243 242 % end 244 if desable_plot245 set(handles.PLOT,' Visible','off')243 if enable_plot 244 set(handles.PLOT,'enable','on') 246 245 else 247 set(handles.PLOT,' Visible','on')246 set(handles.PLOT,'enable','off') 248 247 end 249 248 … … 793 792 % set(hhuvmat.VOLUME,'BackgroundColor',[0 1 0])%put unactivated buttons to green 794 793 % end 794 set(hhuvmat.MenuEditObject,'enable','on') 795 795 set(hhuvmat.edit,'Value',1) 796 796 set(hhuvmat.edit,'BackgroundColor',[1 1 0]);% paint the edit text in yellow 797 set(hhuvmat.edit,'Value',1);%798 797 UvData.MouseAction='edit_object'; % set the edit button to 'on' 799 798 set(huvmat,'UserData',UvData) -
trunk/src/update_obj.m
r61 r67 28 28 for iview=1:length(Object_set) %loop on projection planes iview 29 29 if isfield(Object_set{iview},'plotaxes') 30 haxes=Object_set{iview}.plotaxes ;% axes for the field plot30 haxes=Object_set{iview}.plotaxes% axes for the field plot 31 31 if ishandle(haxes) & isequal(get(haxes,'Type'),'axes')% update the representation of the object IndexObj on this axes if it exists 32 32 testupdate=0; -
trunk/src/uvmat.m
r65 r67 222 222 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function 223 223 set(hObject,'WindowButtonUpFcn',{'mouse_up',handles}) 224 set(hObject,'DeleteFcn',{@closefcn})% 224 225 225 226 %TRANSFORM menu: loads the information stored in prefdir to initiate the browser and the list of functions … … 1841 1842 if ~isequal(transform_name,'') && ~isequal(transform_name,'px') 1842 1843 if test_1 && isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority 1844 Field_a=transform(Field_a,UvData.XmlData_1);%the first field has been stored without transform 1843 1845 Field_b=transform(Field_b,UvData.XmlData_1); 1844 1846 elseif ~test_1 && isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')%use geometry calib … … 4352 4354 4353 4355 % -------------------------------------------------------------------- 4354 function MenuRun_Callback(hObject, eventdata, handles)4355 % --------------------------------------------------------------------4356 4357 % --------------------------------------------------------------------4358 4356 function MenuHelp_Callback(hObject, eventdata, handles) 4359 4357 % -------------------------------------------------------------------- … … 4367 4365 end 4368 4366 4369 % --------------------------------------------------------------------4370 function MenuOpen_Callback(hObject, eventdata, handles)4371 % --------------------------------------------------------------------4372 % --------------------------------------------------------------------4373 function MenuOpen_1_Callback(hObject, eventdata, handles)4374 % --------------------------------------------------------------------4375 % --------------------------------------------------------------------4376 function MenuExport_Callback(hObject, eventdata, handles)4377 % --------------------------------------------------------------------4378 4367 4379 4368 % -------------------------------------------------------------------- … … 4468 4457 set(handles.zoom,'Value',0) 4469 4458 set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7]) 4459 set(handles.MenuTools,'enable','off') 4460 set(handles.MenuObject,'enable','off') 4461 set(handles.MenuEdit,'enable','off') 4470 4462 % set(handles.create,'Value',0) 4471 4463 % set(handles.create,'BackgroundColor',[0 1 0]) 4472 4464 % set(handles.create,'enable','off') 4473 set(handles.edit_vect,'Value',0)4474 set(handles.edit_vect,'enable','off')4475 edit_vect_Callback(hObject, eventdata, handles)4476 set(handles.edit,'Value',0)4477 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])4478 set(handles.edit,'enable','off')4465 % set(handles.edit_vect,'Value',0) 4466 % set(handles.edit_vect,'enable','off') 4467 % edit_vect_Callback(hObject, eventdata, handles) 4468 % set(handles.edit,'Value',0) 4469 % set(handles.edit,'BackgroundColor',[0.7 0.7 0.7]) 4470 % set(handles.edit,'enable','off') 4479 4471 set(handles.list_object_1,'Value',1) 4480 4472 % initiate display of GUI geometry_calib … … 4669 4661 4670 4662 % ------------------------------------------------------------------ 4671 function MenuEdit_Callback(hObject, eventdata, handles) 4663 function MenuEditObject_Callback(hObject, eventdata, handles) 4664 set(handles.edit,'Value',1) 4665 edit_Callback(hObject, eventdata, handles) 4672 4666 4673 4667 %-------------------------------------------------------------------------- … … 4851 4845 set(handles.uvmat,'UserData',UvData); 4852 4846 4847 %------------------------------------------------------------------------ 4848 % executed when closing: set the parent interface button to value 0 4849 function closefcn(gcbo,eventdata) 4850 %------------------------------------------------------------------------ 4851 %delete all the associated figures if exist 4852 hh=findobj(allchild(0),'tag','view_field'); 4853 if ~isempty(hh) 4854 delete(hh) 4855 end 4856 hh=findobj(allchild(0),'name','geometry_calib'); 4857 if ~isempty(hh) 4858 delete(hh) 4859 end 4860 hh=findobj(allchild(0),'tag','set_object'); 4861 if ~isempty(hh) 4862 hhh=findobj(hh,'tag','PLOT'); 4863 set(hhh,'enable','off') 4864 end -
trunk/src/view_field.m
r61 r67 89 89 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function 90 90 set(hObject,'WindowButtonUpFcn',{'mouse_up',handles_mouse}) 91 % set(hObject,'CloseRequestFcn ',{'close_fcn'}) 91 set(hObject,'CloseRequestFcn',{@closefcn})% 92 92 93 93 [PlotType,PlotParamOut,haxes]= plot_field(Field,handles.axes3)%,PlotParam,KeepLim,PosColorbar) … … 2337 2337 write_plot_param(handles,PlotParamOut); %update the auto plot parameters 2338 2338 2339 2340 2341 2339 %------------------------------------------------------ 2342 2340 % --- Executes on button press in Menu/Export/field in workspace. … … 2367 2365 2368 2366 function npx_Callback(hObject, eventdata, handles) 2369 % hObject handle to npx (see GCBO)2370 % eventdata reserved - to be defined in a future version of MATLAB2371 % handles structure with handles and user data (see GUIDATA)2372 2373 % Hints: get(hObject,'String') returns contents of npx as text2374 % str2double(get(hObject,'String')) returns contents of npx as a double2375 2376 2377 % --- Executes during object creation, after setting all properties.2378 function npx_CreateFcn(hObject, eventdata, handles)2379 % hObject handle to npx (see GCBO)2380 % eventdata reserved - to be defined in a future version of MATLAB2381 % handles empty - handles not created until after all CreateFcns called2382 2383 % Hint: edit controls usually have a white background on Windows.2384 % See ISPC and COMPUTER.2385 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))2386 set(hObject,'BackgroundColor','white');2387 end2388 2367 2389 2368 2390 2369 2391 2370 function npy_Callback(hObject, eventdata, handles) 2392 % hObject handle to npy (see GCBO)2393 % eventdata reserved - to be defined in a future version of MATLAB2394 % handles structure with handles and user data (see GUIDATA)2395 2396 % Hints: get(hObject,'String') returns contents of npy as text2397 % str2double(get(hObject,'String')) returns contents of npy as a double2398 2399 2400 % --- Executes during object creation, after setting all properties.2401 function npy_CreateFcn(hObject, eventdata, handles)2402 % hObject handle to npy (see GCBO)2403 % eventdata reserved - to be defined in a future version of MATLAB2404 % handles empty - handles not created until after all CreateFcns called2405 2406 % Hint: edit controls usually have a white background on Windows.2407 % See ISPC and COMPUTER.2408 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))2409 set(hObject,'BackgroundColor','white');2410 end2411 2412 2371 2413 2372 2414 2373 function edit86_Callback(hObject, eventdata, handles) 2415 % hObject handle to MaxA (see GCBO)2416 % eventdata reserved - to be defined in a future version of MATLAB2417 % handles structure with handles and user data (see GUIDATA)2418 2419 % Hints: get(hObject,'String') returns contents of MaxA as text2420 % str2double(get(hObject,'String')) returns contents of MaxA as a double2421 2422 2423 % --- Executes during object creation, after setting all properties.2424 function MaxA_CreateFcn(hObject, eventdata, handles)2425 % hObject handle to MaxA (see GCBO)2426 % eventdata reserved - to be defined in a future version of MATLAB2427 % handles empty - handles not created until after all CreateFcns called2428 2429 % Hint: edit controls usually have a white background on Windows.2430 % See ISPC and COMPUTER.2431 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))2432 set(hObject,'BackgroundColor','white');2433 end2434 2435 2374 2436 2375 2437 2376 function edit87_Callback(hObject, eventdata, handles) 2438 % hObject handle to MinA (see GCBO)2439 % eventdata reserved - to be defined in a future version of MATLAB2440 % handles structure with handles and user data (see GUIDATA)2441 2442 % Hints: get(hObject,'String') returns contents of MinA as text2443 % str2double(get(hObject,'String')) returns contents of MinA as a double2444 2445 2446 % --- Executes during object creation, after setting all properties.2447 function MinA_CreateFcn(hObject, eventdata, handles)2448 % hObject handle to MinA (see GCBO)2449 % eventdata reserved - to be defined in a future version of MATLAB2450 % handles empty - handles not created until after all CreateFcns called2451 2452 % Hint: edit controls usually have a white background on Windows.2453 % See ISPC and COMPUTER.2454 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))2455 set(hObject,'BackgroundColor','white');2456 end2457 2377 2458 2378 … … 2466 2386 2467 2387 2468 2469 2388 function edit88_Callback(hObject, eventdata, handles) 2470 % hObject handle to IncrA (see GCBO) 2471 % eventdata reserved - to be defined in a future version of MATLAB 2472 % handles structure with handles and user data (see GUIDATA) 2473 2474 % Hints: get(hObject,'String') returns contents of IncrA as text 2475 % str2double(get(hObject,'String')) returns contents of IncrA as a double 2476 2477 2478 % --- Executes during object creation, after setting all properties. 2479 function IncrA_CreateFcn(hObject, eventdata, handles) 2480 % hObject handle to IncrA (see GCBO) 2481 % eventdata reserved - to be defined in a future version of MATLAB 2482 % handles empty - handles not created until after all CreateFcns called 2483 2484 % Hint: edit controls usually have a white background on Windows. 2485 % See ISPC and COMPUTER. 2486 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2487 set(hObject,'BackgroundColor','white'); 2488 end 2389 2489 2390 2490 2391 … … 2500 2401 2501 2402 function edit82_Callback(hObject, eventdata, handles) 2502 % hObject handle to edit82 (see GCBO)2503 % eventdata reserved - to be defined in a future version of MATLAB2504 % handles structure with handles and user data (see GUIDATA)2505 2506 % Hints: get(hObject,'String') returns contents of edit82 as text2507 % str2double(get(hObject,'String')) returns contents of edit82 as a double2508 2509 2510 % --- Executes during object creation, after setting all properties.2511 function edit82_CreateFcn(hObject, eventdata, handles)2512 % hObject handle to edit82 (see GCBO)2513 % eventdata reserved - to be defined in a future version of MATLAB2514 % handles empty - handles not created until after all CreateFcns called2515 2516 % Hint: edit controls usually have a white background on Windows.2517 % See ISPC and COMPUTER.2518 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))2519 set(hObject,'BackgroundColor','white');2520 end2521 2403 2522 2404 … … 2531 2413 2532 2414 2533 % --- Executes during object creation, after setting all properties.2534 function min_vec_CreateFcn(hObject, eventdata, handles)2535 % hObject handle to min_vec (see GCBO)2536 % eventdata reserved - to be defined in a future version of MATLAB2537 % handles empty - handles not created until after all CreateFcns called2538 2539 % Hint: edit controls usually have a white background on Windows.2540 % See ISPC and COMPUTER.2541 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))2542 set(hObject,'BackgroundColor','white');2543 end2544 2545 2546 2415 % --- Executes on slider movement. 2547 2416 function slider9_Callback(hObject, eventdata, handles) 2548 % hObject handle to slider 9(see GCBO)2417 % hObject handle to slider2 (see GCBO) 2549 2418 % eventdata reserved - to be defined in a future version of MATLAB 2550 2419 % handles structure with handles and user data (see GUIDATA) … … 2554 2423 2555 2424 2556 % --- Executes during object creation, after setting all properties.2557 function slider9_CreateFcn(hObject, eventdata, handles)2558 % hObject handle to slider9 (see GCBO)2559 % eventdata reserved - to be defined in a future version of MATLAB2560 % handles empty - handles not created until after all CreateFcns called2561 2562 % Hint: slider controls usually have a light gray background.2563 if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))2564 set(hObject,'BackgroundColor',[.9 .9 .9]);2565 end2566 2567 2568 2425 % --- Executes on slider movement. 2569 2426 function slider10_Callback(hObject, eventdata, handles) 2570 % hObject handle to slider1 0(see GCBO)2427 % hObject handle to slider1 (see GCBO) 2571 2428 % eventdata reserved - to be defined in a future version of MATLAB 2572 2429 % handles structure with handles and user data (see GUIDATA) 2573 2430 2574 2431 % Hints: get(hObject,'Value') returns position of slider 2575 % get(hObject,'Min') and get(hObject,'Max') to determine range of slider 2576 2577 2578 % --- Executes during object creation, after setting all properties. 2579 function slider10_CreateFcn(hObject, eventdata, handles) 2580 % hObject handle to slider10 (see GCBO) 2581 % eventdata reserved - to be defined in a future version of MATLAB 2582 % handles empty - handles not created until after all CreateFcns called 2583 2584 % Hint: slider controls usually have a light gray background. 2585 if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2586 set(hObject,'BackgroundColor',[.9 .9 .9]); 2587 end 2432 % get(hObject,'Min') and get(hObject,'Max') to determine range of 2433 % slider 2588 2434 2589 2435 … … 2597 2443 2598 2444 2599 2600 2445 function edit89_Callback(hObject, eventdata, handles) 2601 2446 % hObject handle to max_vec (see GCBO) … … 2607 2452 2608 2453 2454 function edit90_Callback(hObject, eventdata, handles) 2455 % hObject handle to colcode2 (see GCBO) 2456 % eventdata reserved - to be defined in a future version of MATLAB 2457 % handles structure with handles and user data (see GUIDATA) 2458 2459 % Hints: get(hObject,'String') returns contents of colcode2 as text 2460 % str2double(get(hObject,'String')) returns contents of colcode2 as a double 2461 2462 2463 2464 2465 function closefcn(hObject, eventdata, handles) 2466 huvmat=findobj(allchild(0),'Name','uvmat'); 2467 hhuvmat=guidata(huvmat); 2468 list_object_2=get(hhuvmat.list_object_2,'String'); 2469 set(hhuvmat.list_object_2,'Value',numel(list_object_2))%select the last value ('...') 2470 delete(hObject) 2471 2472 2609 2473 % --- Executes during object creation, after setting all properties. 2610 function max_vec_CreateFcn(hObject, eventdata, handles)2611 % hObject handle to max_vec(see GCBO)2474 function colcode1_CreateFcn(hObject, eventdata, handles) 2475 % hObject handle to colcode1 (see GCBO) 2612 2476 % eventdata reserved - to be defined in a future version of MATLAB 2613 2477 % handles empty - handles not created until after all CreateFcns called … … 2620 2484 2621 2485 2622 2623 function edit90_Callback(hObject, eventdata, handles)2624 % hObject handle to edit90(see GCBO)2486 % --- Executes during object creation, after setting all properties. 2487 function slider2_CreateFcn(hObject, eventdata, handles) 2488 % hObject handle to slider2 (see GCBO) 2625 2489 % eventdata reserved - to be defined in a future version of MATLAB 2626 % handles structure with handles and user data (see GUIDATA) 2627 2628 % Hints: get(hObject,'String') returns contents of edit90 as text 2629 % str2double(get(hObject,'String')) returns contents of edit90 as a double 2490 % handles empty - handles not created until after all CreateFcns called 2491 2492 % Hint: slider controls usually have a light gray background. 2493 if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2494 set(hObject,'BackgroundColor',[.9 .9 .9]); 2495 end 2630 2496 2631 2497 2632 2498 % --- Executes during object creation, after setting all properties. 2633 function edit90_CreateFcn(hObject, eventdata, handles) 2634 % hObject handle to edit90 (see GCBO) 2499 function slider1_CreateFcn(hObject, eventdata, handles) 2500 % hObject handle to slider1 (see GCBO) 2501 % eventdata reserved - to be defined in a future version of MATLAB 2502 % handles empty - handles not created until after all CreateFcns called 2503 2504 % Hint: slider controls usually have a light gray background. 2505 if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2506 set(hObject,'BackgroundColor',[.9 .9 .9]); 2507 end 2508 2509 2510 % --- Executes during object creation, after setting all properties. 2511 function colcode2_CreateFcn(hObject, eventdata, handles) 2512 % hObject handle to colcode2 (see GCBO) 2635 2513 % eventdata reserved - to be defined in a future version of MATLAB 2636 2514 % handles empty - handles not created until after all CreateFcns called … … 2643 2521 2644 2522 2645 % --- Executes on button press in vec_col_bar.2646 function pushbutton35_Callback(hObject, eventdata, handles)2647 % hObject handle to vec_col_bar (see GCBO)2648 % eventdata reserved - to be defined in a future version of MATLAB2649 % handles structure with handles and user data (see GUIDATA)2650 2651 2652 function close_fcn(hObject, eventdata, handles)2653 huvmat=findobj(allchild(0),'Name','uvmat');2654 hhuvmat=guidata(huvmat);2655 set(hhuvmat.list_object_2,'Visible','off')
Note: See TracChangeset
for help on using the changeset viewer.