Changeset 67


Ignore:
Timestamp:
Mar 25, 2010, 6:48:48 PM (14 years ago)
Author:
sommeria
Message:

civ: RUN civ lounched out of the Matlab work space. RUN and BATCH now runned by a unique sub-function lounch.m.
FiLE PARAM.xml modified to provide different paths for Batch and Run !!!!!
RUN_FIX: minor error message modif
geometry_calib: calib point editing by the mouse
improvement of the interactions between the different GUIs. Close function...

Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/RUN_FIX.m

    r56 r67  
    2626%check writing access
    2727[errorread,message]=fileattrib(filename);
    28 if ~isempty(message) && ~isequal(message.UserWrite,1)
     28if ischar(message)
     29    msgbox_uvmat('ERROR',[filename ':' message]);
     30    return
     31end
     32if ~isequal(message.UserWrite,1)
    2933     msgbox_uvmat('ERROR',['no writting access to ' filename ' (RUN_FIX.m)']);
    3034    return
  • trunk/src/civ.m

    r66 r67  
    5151% handles    structure with handles and user data (see GUIDATA)
    5252% varargin   command line arguments to civ (see VARARGIN)
    53 global test_batch patch_new_exe%=1 if patch processing available
     53global test_batch patch_newBin%=1 if patch processing available
    5454%filebase: root name
    5555%nom_type: nomencalture used ('png_old','_i_j'...)
     
    132132       msgbox_uvmat('ERROR',errormsg);
    133133end
    134 patch_new_exe='';
     134patch_newBin='';
    135135% todo_patch='';
    136136sge=0;
    137137
    138 if isfield(sparam,'PatchNew_exe')
    139     patch_new_exe=sparam.PatchNew_exe;
     138if isfield(sparam,'PatchNewBin')
     139    patch_newBin=sparam.PatchNewBin;
    140140end
    141141
     
    15571557%------------------------------------------------------------------------
    15581558% --- 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
    15592031function RUN_Callback(hObject, eventdata, handles)
    15602032%------------------------------------------------------------------------
    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
     2035batch=0;
     2036launch_jobs(hObject, eventdata, handles,batch);
     2037
     2038
     2039%------------------------------------------------------------------------
     2040% --- Executes on button press in BATCH: remote processing
     2041function 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
     2044batch=1;
     2045launch_jobs(hObject, eventdata, handles, batch)
     2046
     2047%------------------------------------------------------------------------
     2048% --- Executes on button press in BATCH: remote processing
     2049function launch_jobs(hObject, eventdata, handles, batch)
     2050%-----------------------------------------------------------------------
     2051% global civ2Bin patchBin patch_newBin fixBin CivBin % probabely to remove
    15622052
    15632053compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3)
     2054
    15642055%check the list of operations:
    15652056operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'};
     
    15912082    return
    15922083end
    1593 %check mask if selecetd
    1594 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     end
    1599 end
    1600 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     end
    1605 end
    1606 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     end
    1611 end
    1612 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     end
    1617 end
    1618 
    1619 %read names of the .exe file
    1620 if box_test(1)==1 || box_test(3)==1 || box_test(4)==1 || box_test(6)==1
    1621     path_uvmat=which('uvmat');% check the path detected for source file uvmat
    1622     path_UVMAT=fileparts(path_uvmat); %path to UVMAT
    1623     %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ binary names
    1624     xmlfile=fullfile(path_UVMAT,'PARAM.xml');
    1625     if exist(xmlfile,'file')
    1626         t=xmltree(xmlfile);
    1627         sparam=convert(t);
    1628     end
    1629     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         end
    1634     end
    1635     if isfield(sparam,'Civ2_exe')
    1636         civ2_exe=sparam.Civ2_exe;
    1637         if ~exist(civ2_exe,'file')%the binary is defined in /bin, default setting
    1638             civ2_exe=fullfile(path_UVMAT,civ2_exe);
    1639         end
    1640     end
    1641     if isfield(sparam,'Patch_exe')
    1642         patch_exe=sparam.Patch_exe;
    1643         if ~exist(patch_exe,'file')%the binary is defined in /bin, default setting
    1644             patch_exe=fullfile(path_UVMAT,patch_exe);
    1645         end
    1646     end
    1647     if isfield(sparam,'Stinterp_exe')
    1648         stinterp_exe=sparam.Stinterp_exe;
    1649     end
    1650     if isfield(sparam,'SGE')
    1651         sge=str2double(sparam.SGE);
    1652     end
    1653     if ~isunix % for windows system, check whether the Matlab working dir is a UBC name
    1654         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         end
    1659     end
    1660 end
    1661 
    1662 %initialize the waitbars
    1663 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 drawnow
    1670 
    1671 % get the list of file names and check the files
    1672 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    return
    1684 end
    1685 display('files OK, processing...')   
    1686 nbfield=size(num1_civ1,2);
    1687 nbslice=size(num1_civ1,1);
    1688 
    1689 %RUN CIV1
    1690 if box_test(1)==1
    1691       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==3
    1693             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      end
    1695 end
    1696 
    1697 %RUN FIX1
    1698 if box_test(2)==1
    1699     filebase=get(handles.displ_filebase,'String');
    1700     %names of the civ1 fields
    1701     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_C
    1712     thresh_vel=str2double(get(handles.thresh_vel,'String'));%threshold on velocity modulus
    1713     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     else
    1719         fieldchoice=menu{index};
    1720     end   
    1721     h = waitbar(0,'removing velocity vectors, fix1');% display a wait bar
    1722     test_mask=get(handles.get_mask_fix1,'Value');   
    1723     if test_mask
    1724         maskdispl=get(handles.mask_fix1,'String');
    1725         if exist(maskdispl,'file')
    1726             test_mask=2;
    1727             maskname=maskdispl;
    1728         else
    1729             maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name
    1730         end
    1731     end
    1732     for ifile=1:nbfield
    1733         waitbar(ifile/nbfield); %update the waitbar
    1734         for j=1:nbslice
    1735             if test_mask==0
    1736                 maskname='noFile use default';
    1737                 maskflag=0;
    1738             elseif test_mask==1
    1739                 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 pair
    1742                 maskflag= exist(maskname,'file')==2;
    1743                 if ~maskflag;
    1744                     maskname='noFile use default';
    1745                 end             
    1746             end
    1747             if ~isempty(file_ref_fix1)
    1748                 file_ref=file_ref_fix1{ifile,j};
    1749             else
    1750                 file_ref='';
    1751             end
    1752             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==0 
    1757                       maskname='noFile use default';
    1758                       maskflag=0;
    1759                  else
    1760                      maskbase=[get(handles.displ_filebase2,'String') '_' maskdispl]; % mask root name
    1761                      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                      end
    1768                  end
    1769                  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                     return
    1774                  end             
    1775             end
    1776         end
    1777     end
    1778     close(h)
    1779 end
    1780 
    1781 % RUN PATCH1
    1782 if box_test(3)==1
    1783     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     else
    1788         rho_patch1=num2str(1000*rho_patch1);
    1789     end
    1790     nx_patch1=get(handles.nx_patch1,'String');
    1791     if isequal(str2num(nx_patch1),[])
    1792          nx_patch1='50' ;%default
    1793          set(handles.nx_patch1,'String','50');
    1794     end
    1795     ny_patch1=get(handles.ny_patch1,'String');
    1796     if isequal(str2num(ny_patch1),[])
    1797          ny_patch1='50' ;%default
    1798          set(handles.ny_patch1,'String','50');
    1799     end
    1800     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:nbfield
    1805         for j=1:nbslice
    1806             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             drawnow
    1810             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 sge
    1814                     [s,w]=unix(['qrsh -q -fast.q ' cmd]);
    1815                 end
    1816                 if s~=0
    1817                     display(['!' cmd])
    1818                     eval(['!' cmd]);                 
    1819                 end
    1820 
    1821                 %stereo case:
    1822             elseif  isequal(get(handles.test_stereo1,'Value'),1)
    1823                 if exist('stinterp_exe','var')%Prog Gauthier
    1824                     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                 else
    1829                     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                 end
    1832             end
    1833             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 sge
    1837                     [s,w]=unix(['qrsh -q -fast.q ' cmd]);
    1838                 end
    1839                 if s~=0
    1840                    display(['!' cmd])
    1841                    eval(['!' cmd]);
    1842                 end
    1843             end
    1844         end
    1845     end
    1846 end
    1847 
    1848 % CIV2
    1849 if box_test(4)==1
    1850     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 end
    1853 
    1854 % FIX2
    1855 if box_test(5)==1
    1856     %names of the civ2 fields
    1857     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_C
    1868     thresh_vel2=str2num(get(handles.thresh_vel2,'String'));%threshold on velocity modulus
    1869     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     else
    1875         fieldchoice=menu{index};
    1876     end   
    1877     h = waitbar(0,['removing velocity vectors, fix2']);% display a wait bar
    1878     test_mask=get(handles.get_mask_fix2,'Value');
    1879     if test_mask
    1880         maskdispl=get(handles.mask_fix2,'String');
    1881         if exist(maskdispl,'file')
    1882             test_mask=2;
    1883             maskname=maskdispl;
    1884         else
    1885             maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name
    1886         end
    1887     end
    1888     for ifile=1:nbfield
    1889         waitbar(ifile/nbfield); %update the waitbar
    1890         for j=1:nbslice       
    1891            if test_mask==0
    1892                 maskname='noFile use default';
    1893                 maskflag=0;
    1894            elseif test_mask==1
    1895                 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                 end
    1902             end
    1903             if ~isempty(file_ref_fix2)
    1904                 file_ref=file_ref_fix2{ifile,j};
    1905             else
    1906                 file_ref='';
    1907             end
    1908             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                 return
    1913             end 
    1914             if compare==3
    1915                  if test_mask==0 
    1916                       maskname='noFile use default';
    1917                       maskflag=0;
    1918                  else
    1919                       maskbase=[get(handles.displ_filebase2,'String') '_' maskdispl]; % mask root name
    1920                       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                       end
    1927                  end
    1928                  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                     return
    1933                  end 
    1934             end
    1935         end
    1936     end
    1937     close(h)
    1938 end
    1939 
    1940 %PATCH 2
    1941 if box_test(6)==1
    1942     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     else
    1947         rho_patch2=num2str(1000*rho_patch2);
    1948     end
    1949     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' ;%default
    1954          set(handles.nx_patch2,'String','50');
    1955     end
    1956     if isequal(str2num(ny_patch2),[])
    1957          ny_patch2='50' ;%default
    1958          set(handles.ny_patch2,'String','50');
    1959     end
    1960     subdomain_patch2=get(handles.subdomain_patch2,'String');
    1961     icount=0;
    1962     for ifile=1:nbfield
    1963         for j=1:nbslice
    1964             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             drawnow
    1968             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 sge
    1972                     [s,w]=unix(['qrsh -q -fast.q ' cmd]);
    1973                 end
    1974                 if s~=0
    1975                     display(['!' cmd])
    1976                     eval(['!' cmd]);
    1977                 end
    1978             elseif compare==3 &&  isequal(get(handles.test_stereo2,'Value'),1)
    1979                if exist('stinterp_exe','var')%Prog Gauthier 
    1980                    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                else
    1985                    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                end
    1988             end   
    1989             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 sge
    1993                     [s,w]=unix(['qrsh -q -fast.q ' cmd]);
    1994                 end
    1995                 if s~=0
    1996                     display(['!' cmd])
    1997                     eval(['!' cmd]);
    1998                 end
    1999             end
    2000         end
    2001     end
    2002 end
    2003 
    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 exists
    2008 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     else
    2014         fileresu=filecell.nc.civ1{1,1};
    2015     end
    2016 end
    2017 [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==1
    2021     namefigfull=[namedoc '.fig'];
    2022     hh=dir(namefigfull);
    2023     if ~isempty(hh)
    2024         detect=1;
    2025         namedoc=[namedoc '.0'];
    2026     else
    2027         detect=0;
    2028     end
    2029 end
    2030 saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER  .xml)
    2031 
    2032 %------------------------------------------------------------------------
    2033 % --- Executes on button press in BATCH: remote processing
    2034 function BATCH_Callback(hObject, eventdata, handles)
    2035 %------------------------------------------------------------------------
    2036 global civ1_exe civ2_exe patch_exe patch_new_exe fix_exe todo_path sge Civ_exe
    2037 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     return
    2052 end
    2053 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     return
    2060 end
    2061 
    2062 %root name
    2063 filebase=get(handles.displ_filebase,'String');
    2064 if isempty(filebase)||isequal(filebase,'')
    2065     msgbox_uvmat('ERROR','no input files')
    2066     return
    2067 end
    20682084   
    20692085%check mask if selecetd
     
    20992115if exist(xmlfile,'file')
    21002116    t=xmltree(xmlfile);
    2101     sparam=convert(t);
     2117    s=convert(t);
    21022118end
    21032119% else
     
    21082124%     end
    21092125% 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;
     2127if 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
     2137else
     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
     2144end
     2145if isfield(sparam,'CivBin')
     2146    CivBin=sparam.CivBin;
     2147end
     2148if isfield(sparam,'Civ1Bin')
     2149    civ1Bin=sparam.Civ1Bin;
     2150end
     2151if isfield(sparam,'Civ2Bin')
     2152    civ2Bin=sparam.Civ2Bin;
     2153end
     2154if isfield(sparam,'PatchBin')
     2155    patchBin=sparam.PatchBin;
     2156end
     2157 if isfield(sparam,'PatchNewBin')
     2158    patch_newBin=sparam.PatchNewBin;
    21252159 end
    2126  if isfield(sparam,'Fix_exe')
    2127     fix_exe=sparam.Fix_exe;
     2160 if isfield(sparam,'FixBin')
     2161    fixBin=sparam.FixBin;
    21282162 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
     2166if batch
     2167    if isfield(sparam,'BatchMode')
     2168        batch_mode=sparam.BatchMode;
     2169    end
     2170else
     2171    MaxCivProcesses=50;
     2172   if isfield(sparam,'MaxCivProcesses')
     2173        MaxCivProcesses=str2double(sparam.MaxCivProcesses);
     2174   end
     2175end
     2176
     2177%initialize the waitbars
     2178set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001])
     2179set(handles.waitbar_patch1,'Position',[0.946 0.439 0.03 0.001])
     2180set(handles.waitbar_civ2,'Position',[0.946 0.219 0.03 0.001])
     2181set(handles.waitbar_patch2,'Position',[0.946 0.0 0.03 0.001])
     2182set(handles.BATCH, 'Enable','Off')
     2183set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])
     2184drawnow
     2185%get the filename root, nomenclature and numbers
     2186
     2187% for Windows system find the UBC path name if needed
     2188if ~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
     2208end
     2209
     2210% set the list of files and check them
     2211display('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);
    21352214
    21362215%choice of batch priority
    21372216ind_answer=2;
    2138 if sge
     2217if batch
    21392218    [s,w]=unix('qstat -q civ.q|grep job_| wc -l'); %check the waiting list (command unix)
    21402219    if isequal(s,0)
     
    21522231        return
    21532232    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);
     2233else
     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
     2242end
    21932243 
    21942244display('files OK, processing...') 
     
    22272277 
    22282278 %get patch1 parameters
    2229  if box_test(3)==1
     2279if box_test(3)==1
    22302280        rho_patch1=str2num(get(handles.rho_patch1,'String'));
    22312281        if isempty(rho_patch1)
     
    22962346end
    22972347
    2298 if ~sge
    2299        
    2300     %OPEN THE WAIT LIST FOR BATCH PROCESSES
    2301     name_lock=fullfile(todo_path,'lock'); %lock file
    2302     iwait=0;
    2303     while(exist(name_lock) & iwait<15)
    2304         pause(1); %wait 1 second
    2305         iwait=iwait+1;
    2306     end
    2307     if iwait==15
    2308         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         return
    2312     end
    2313     p0=fopen(name_lock,'w'); %create the file name_lock: prevents other users to interfere
    2314     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     end
    2322 end
     2348% 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
    23232373
    23242374%MAIN LOOP
     
    23312381        i_cmd=0;
    23322382        cmd='';
    2333         if sge
     2383        if batch
    23342384           %fid=fopen([filename '.cmx'],'w')
    23352385           cmd='#!/bin/bash';
     
    24072457            i_cmd=i_cmd+1;
    24082458            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)];
    24102460            else
    24112461                 civAllCmd=[civAllCmd ' civ1 '];
     
    24362486           end
    24372487           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)) ...
    24392489                   ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ...
    24402490                   ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName ' maskname];
     
    25732623            %endTESTgrid
    25742624            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);
    25762626            if isequal(civAll,0)
    25772627                if(isunix)
     
    25822632            else
    25832633                 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);
    25852635                 fieldnames=fields(str);
    25862636                [civAllxml,uid_civ2]=add(civAllxml,1,'element','civ2');
     
    26082658            end                 
    26092659           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)) ...
    26112661                   ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ...
    26122662                   ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname];
     
    26812731        if isequal(civAll,1)
    26822732            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]});
    26842734        end
    26852735      % create the .bat file:
    2686         if sge
     2736        if batch
    26872737                [Rootbat,Filebat,extbat]=fileparts(filename_cmx);
    26882738                filename_bat=fullfile(Rootbat,['job_' Filebat extbat]);
     
    26952745        fclose(fid);
    26962746        %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
    27022758        else
     2759%% to lauch the jobs locally :
    27032760            if(isunix)
    2704               cmdtodo=['. ' filename_bat ];%removed for Mathieu tests %' && rm -f ' filename_bat] ;
     2761              eval(['!. ' filename_bat ' &']);
    27052762            else
    2706                cmdtodo=[filename_bat];%removed for Mathieu tests %' && del /F /Q ' filename_bat' ;
     2763              eval(['!' filename_bat ' &']);
    27072764            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);
    27092771        end
    27102772     end
    27112773end
    2712 if ~sge
    2713     fclose(p1);
    2714     fclose(p0);
    2715     delete(name_lock);
    2716 end
     2774% if ~sge
     2775%     fclose(p1);
     2776%     fclose(p0);
     2777%     delete(name_lock);
     2778% end
    27172779
    27182780set(handles.BATCH, 'Enable','On')
     
    34033465%------------------------------------------------------------------------
    34043466%pixels per cm and matrix of the image times, read from the .civ file by uvmat
    3405 global civ1_exe sge%name of the executable for civ1 calculation
     3467global civ1Bin sge%name of the executable for civ1 calculation
    34063468
    34073469%get civ parameters
     
    35983660       
    35993661                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 ]);
    36023664%               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' ]);
    36043666%        end     
    36053667%         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]);       
    36083670%         end
    36093671    end
    36103672end
    36113673
    3612 %------------------------------------------------------------------------
    3613 % RUN CIV2   CIV2    CIV2   CIV2
    3614 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 image
    3617 %filecell_3: names of second images
    3618 global civ2_exe sge
    3619 
    3620 %names of the civ2 fields
    3621 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 parameters
    3629 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';%default
    3638 end
    3639 if isequal(str2num(dy),[])
    3640     dy='20';%default
    3641 end
    3642     pxcmx='1';%velocity fields are expressed in pixel displacement
    3643     pxcmy='1';
    3644 A=imread(cell2mat(filecell_2(1,1)));%read the first image to get the size
    3645 sizim=size(A);
    3646 npx=num2str(sizim(2));
    3647 npy=num2str(sizim(1));
    3648 time=get(handles.displ_filebase,'UserData'); %get the set of times
    3649 filebase=get(handles.displ_filebase,'String');
    3650 %grid
    3651 gridname='';%default  ='noFile use default'
    3652 gridflag='n';%default
    3653 test_grid=get(handles.browse_gridciv2,'Value');
    3654 nbslice_grid=[];
    3655 if test_grid
    3656     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         end
    3662     elseif exist(gridname,'file')
    3663         gridflag='y';
    3664     else
    3665         msgbox_uvmat('ERROR',['input grid file ' gridname ' not found'])
    3666         return
    3667     end
    3668 end
    3669 sizcell=size(filecell_2);
    3670 nbfield=sizcell(1);
    3671 nbslice=sizcell(2);
    3672  
    3673 %main loop
    3674 icount=0;
    3675 for ifile=1:nbfield
    3676     for j=1:nbslice
    3677         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         drawnow
    3681         filename_ima_2=cell2mat(filecell_2(ifile,j));
    3682         filename_ima_2([end-3:end])=[];%remove .png extension
    3683         filename_ima_3=cell2mat(filecell_3(ifile,j));
    3684         filename_ima_3([end-3:end])=[];%remove .png extension
    3685         filename_cmx=cell2mat(filecell_nc2(ifile,j));%output netcdf file
    3686         filename_cmx([end-1:end])=[ 'cm'];%name of cmx file
    3687         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' mode
    3693             end
    3694             T0=num2str((time(num2(ifile),num_b(j))+time(num1(ifile),num_a(j)))/2);
    3695         else
    3696             Dt='1';
    3697             T0='0';
    3698         end
    3699         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                 return
    3709             end
    3710         end     
    3711         test_mask=get(handles.get_mask_civ2,'Value');
    3712         if test_mask==0 
    3713             maskname='noFile use default';
    3714             maskflag='n';
    3715         else
    3716             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             else
    3724                 maskname='noFile use default';
    3725                 maskflag='n';
    3726             end
    3727         end
    3728    
    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 queue
    3766 %             [s,w] = unix(['qrsh -q fast.q ' civ2_exe ' -f ' filename_cmx ' > ' namelog ' 2>&1']);
    3767 %         end     
    3768 %         if s~=0
    3769 %             eval(['!' civ2_exe ' -f ' filename_cmx ' > ' namelog]);
    3770 %             ['!' civ2_exe ' -f ' filename_cmx ' > ' namelog]
    3771 %         end                     
    3772     end
    3773 end
    3774 % 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)
    37753837
    37763838%------------------------------------------------------------------------
     
    37783840function cmd_PATCH=RUN_PATCH(filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,test_interp)
    37793841%------------------------------------------------------------------------
    3780 global patch_exe patch_new_exe
     3842global patchBin patch_newBin
    37813843        namelog=[filename_nc([1:end-3]) '_patch.log'];
    37823844        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 ...
    37843846            '  > ' namelog ' 2>&1']; % redirect standard output to the log file
    37853847         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 ...
    37873849                ' -max ' thresh_value ' -nopt ' subdomain_patch  '  > ' namelog ' 2>&1']; % redirect standard output to the log file
    37883850        end
     
    37903852%------------------------------------------------------------------------
    37913853% --- 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)
     3854function cmd=RUN_STINTERP(stinterpBin,filename_A_nc,filename_B_nc,filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,xmlA,xmlB)
    37933855%------------------------------------------------------------------------
    37943856namelog=[filename_nc([1:end-3]) '_stinterp.log'];
    3795 cmd=[stinterp_exe ' -f1 ' filename_A_nc  ' -f2 ' filename_B_nc ' -f  ' filename_nc ...
     3857cmd=[stinterpBin ' -f1 ' filename_A_nc  ' -f2 ' filename_B_nc ' -f  ' filename_nc ...
    37963858    ' -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
    37973859
     
    44734535function enable_patch1(handles)
    44744536%------------------------------------------------------------------------
    4475 global patch_new_exe
     4537global patch_newBin
    44764538set(handles.frame_patch1,'BackgroundColor',[1 1 0])
    44774539set(handles.rho_patch1,'Visible','on')
     
    44854547set(handles.nx_patch1_title,'Visible','on')
    44864548set(handles.ny_patch1_title,'Visible','on')
    4487 if (~isequal(patch_new_exe,[]) & ~isequal(patch_new_exe,[]))
     4549if (~isequal(patch_newBin,[]) & ~isequal(patch_newBin,[]))
    44884550    set(handles.test_interp,'Visible','on');
    44894551end
     
    47774839%------------------------------------------------------------------------
    47784840% --- CIV1  CIV1  CIV1 CIV1
    4779 function cmd_CIV1=BATCH_CIV1(filename,namelog,par,handles)
     4841function cmd_CIV1=BATCH_CIV1(filename,namelog,par,handles,sparam)
    47804842%------------------------------------------------------------------------
    47814843%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 calculation
    47834844
    47844845%changes : filename_cmx -> filename ( no extension )
     
    48544915fclose(fid);
    48554916 
    4856 if sge 
    4857     cmd_CIV1=[civ1_exe ' -f ' filename '.cmx' ]; % redirect standard output to the log file
    4858 else
    4859     cmd_CIV1=[civ1_exe ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file
    4860 end
     4917% 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
    48614922if(isunix)
    48624923    [Rootbat,Filebat,extbat]=fileparts(namelog);
    48634924    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];
     4926else
     4927    cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y ' namelog ' ' regexprep(namelog,'\.log','') '.civ1.log'];
    48674928end
    48684929
     
    48724933%------------------------------------------------------------------------
    48734934%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 calculation
     4935global civ1Bin CivBin%name of the executable for civ1 calculation
    48754936
    48764937    civ1.image1=par.filename_ima_a;
     
    49114972%------------------------------------------------------------------------
    49124973%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 calculation
     4974global civ2Bin CivBin%name of the executable for civ1 calculation
    49144975
    49154976civ2.image1=par.filename_ima_a;
     
    49605021%------------------------------------------------------------------------
    49615022% --- CIV2  CIV2  CIV2 CIV2
    4962 function cmd_CIV2=BATCH_CIV2(filename_cmx,namelog,par)
     5023function cmd_CIV2=BATCH_CIV2(filename_cmx,namelog,par,sparam)
    49635024%------------------------------------------------------------------------
    49645025%pixels per cm and matrix of the image times, read from the .civ file by uvmat
    4965 global civ2_exe sge%name of the executable for civ1 calculation
     5026% global civ2Bin sge%name of the executable for civ1 calculation
    49665027   if isequal(par.Dt,'0')
    49675028                par.Dt='1' ;%case of 'displacement' mode
     
    50015062fprintf(fid,textout);
    50025063fclose(fid)
    5003 if sge
    5004     cmd_CIV2=[civ2_exe ' -f ' filename_cmx ]; % redirect standard output to the log file
    5005 else
    5006     cmd_CIV2=[civ2_exe ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file
    5007 end
     5064% 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
    50085069
    50095070%------------------------------------------------------------------------
  • trunk/src/geometry_calib.m

    r63 r67  
    7878% Update handles structure
    7979guidata(hObject, handles);
    80 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,handles_uvmat})%
    83 end
     80%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
    8484%set the position of the interface
    8585if exist('pos','var')& length(pos)>2
     
    100100    end   
    101101end
    102 set(handles.ListCoord,'String',{''})
     102set(handles.ListCoord,'String',{'...'})
    103103if exist(inputxml,'file')
    104104    loadfile(handles,inputxml)% load the point coordiantes existing in the xml file
     
    213213        CoordCell{iline,j}=num2str(Coord(iline,j),4);
    214214    end
    215 end       
     215end
     216CoordCell=[CoordCell;{' ',' ',' ',' ',' '}];
    216217Tabchar=cell2tab(CoordCell,'    |    ');%transform cells into table ready for display
    217218set(handles.ListCoord,'Value',1)
    218219set(handles.ListCoord,'String',Tabchar)
    219220
    220 
     221%
    221222%------------------------------------------------------------------------
    222223% executed when closing: set the parent interface button to value 0
    223 function closefcn(gcbo,eventdata,handles_uvmat)
     224function closefcn(gcbo,eventdata)
    224225%------------------------------------------------------------------------
    225226huvmat=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]);
     227if ~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   
    231241end
    232242
     
    582592%update the plot
    583593ListCoord_Callback(hObject, eventdata, handles)
    584 
     594MenuPlot_Callback(hObject, eventdata, handles)
    585595%------------------------------------------------------------------------
    586596% --- Executes on selection change in ListCoord.
     
    10171027set(handles.ListCoord,'Value',1)
    10181028set(handles.ListCoord,'String',Tabchar)
    1019 
     1029MenuPlot_Callback(hObject, eventdata, handles)
    10201030
    10211031%%%%%%%%%%%%%%%%%%%%
  • trunk/src/mouse_down.m

    r65 r67  
    2323
    2424function xy=mouse_down(hObject,eventdata)
    25 testzoom=0;%default
     25
    2626MouseAction='none'; %default
    2727huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle which controls theoption of  mouse action
     
    3131hhuvmat=guidata(huvmat);%handles of elements in uvmat
    3232UvData=get(huvmat,'UserData');
     33MouseAction='none'; %default
    3334testzoom=get(hhuvmat.zoom,'Value');% get the mouse action from the uvmat GUI: options:
    3435if isfield(UvData,'MouseAction')
     
    4041test_cal=strcmp(MouseAction,'calib');
    4142test_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};
    4543test_edit=strcmp(MouseAction,'edit_object');
    4644test_edit_vect=strcmp(MouseAction,'edit_vect');
    4745xdisplay=[];%default
    4846ydisplay=[];%default
    49 haxes=[];
    5047AxeData=[];%default
    5148
     
    5855xy_fig=get(hcurrentfig,'CurrentPoint');% current point of the current figure (gcbo)
    5956hchild=get(hcurrentfig,'Children');%handles of all objects in the current figure
     57haxes=[];
    6058% loop on all the objects in the current figure (selected by the last mouse click)
    6159for ichild=1:length(hchild)
     
    8381                    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
    8482                      (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
    8984                end
    9085            end
     
    113108     AxeData.Drawing='zoom'; %initiate drawing mode
    114109     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
     111end
     112if isempty(huvmat)
     113    return
     114end
     115
     116%selection of an existing projection object
     117if  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')
    159158                    end
    160159                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;
    177                            end
     160            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;
    178177                       end
    179178                   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
     188end
     189%  create new projection  object
     190if  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
    292202        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;
    304207        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';
     224end
     225
     226% create calibration points if the GUI geometry_calib is opened, if the main axes axes3 of uvmat has ben selected
     227if 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
     282end
     283
     284% edit vectors
     285if 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);
     296end   
     297
     298%create ruler
     299if 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)
    306304end
    307305set(haxes,'UserData',AxeData);
  • trunk/src/mouse_motion.m

    r65 r67  
    2727    return
    2828end
    29 % if ~isfield(handles, 'mouse_coord')
    30 %     'TEST'
    31 %     return
    32 % end
    33 % if ~ishandle(handles.mouse_coord)
    34 %     return
    35 % end
    36 % 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;
    3929test_create=0;%default
    4030test_edit=0;%default
    41 % if isfield(handles,'VOLUME') % mouse_motion not applied to the uvmat figure, no object creation
    42 %     test_create=get(handles.create,'Value');   
    43 % end
    4431test_edit=isfield(handles,'edit') & get(handles.edit,'Value');% edit test for mouse shap: an arrow
    4532test_zoom=isfield(handles,'zoom')& get(handles.zoom,'Value');% edit test for mouse shap: an arrow
     
    5441AxeData=[];%default
    5542mouse=[];
     43xy=[];%default
    5644
    5745pointershape='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 figure
    6146currentfig=gcbo;%store gcbo as variable currentfig
     47xy_fig=get(currentfig,'CurrentPoint');% current point of the current figure (gcbo)
     48hchild=get(currentfig,'Children');%handles of all objects in the current figure
     49
    6250% loop on all the objects in the current figure (selected by the last mouse click)
    6351for ichild=1:length(hchild)
     
    8876                    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
    8977                          (AxeData.Y<(xy(1,2)+AxeData.Mesh/3) & AxeData.Y>(xy(1,2)-AxeData.Mesh/3));%f
    90                     ivec=find(flag_vec);% search the selected vector index ivec
     78                    ivec=find(flag_vec,1);% search the (first) selected vector index ivec
    9179                    hhh=findobj(haxes,'Tag','vector_marker');
    92                     if length(ivec)>0
     80                    if ~isempty(ivec)
    9381                        %ivec=ivec(1);%choice the first selected vector if several are selected
    9482                        if ~test_create
    9583                            pointershape='arrow'; %mouse indicates  the detection of a vector
    96  
    9784                            if isempty(hhh)
    9885                                set(currentfig,'CurrentAxes',haxes)
     
    262249    end
    263250end   
     251
    264252%%%%%%%%%%%%%
    265 %draw a rectangle if no object creation is selected
     253%draw a zoom rectangle if no object creation is selected
    266254if ~isempty(haxes) & isfield(AxeData,'Drawing')& isequal(AxeData.Drawing,'zoom')& isfield(AxeData,'CurrentOrigin')...
    267255        & isequal(get(gcf,'SelectionType'),'normal')%
     
    281269        end
    282270   end
    283 end
    284 if test_zoom
     271% end
     272% if test_zoom
    285273    pointershape='arrow';
     274end
     275
     276% detect calibration points if the GUI geometry_calib is opened
     277h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
     278if ~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
    286312end
    287313
     
    291317    if isfield(UvData,'MouseAction') && isequal(UvData.MouseAction,'ruler')
    292318           if isfield(UvData,'RulerHandle')
     319               pointershape='crosshair';
    293320                RulerCoord=[UvData.RulerCoord ;xy(1,1:2)];
    294321                set(UvData.RulerHandle,'XData',RulerCoord(:,1));
  • trunk/src/mouse_up.m

    r61 r67  
    3737    zoomstate=get(hhuvmat.zoom,'Value');
    3838end
    39 if isequal(MouseAction,'calib') && ~zoomstate
    40     return
    41 end
     39% if isequal(MouseAction,'calib') && ~zoomstate
     40%     return
     41% end
    4242currentfig=gcbo;
    4343AxeData=get(gca,'UserData');
     
    138138            set(hhuvmat.edit,'Value',1);%
    139139            set(hhuvmat.edit,'Enable','on');%
     140            set(hhuvmat.MenuEditObject,'Enable','on');%
    140141            set(hhuvmat.MenuEdit,'Enable','on');%
    141             set(hhuvmat.MenuEdit,'Enable','on');%
    142             set(hhuvmat.MenuObject,'Enable','on');%
     142%             set(hhuvmat.MenuObject,'Enable','on');%
    143143            UvData.MouseAction='edit_object'; % set the edit button to 'on'
    144144        end
     
    261261      end
    262262end
    263 if isequal(MouseAction,'ruler')
     263
     264% editing calibration point
     265if 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)
     287end
     288
     289% finalising ruler
     290if strcmp(MouseAction,'ruler')
    264291    UvData.MouseAction='none';
    265292    UvData=rmfield(UvData,'RulerHandle');
  • trunk/src/set_object.m

    r61 r67  
    8989     PlotHandles=[];
    9090end
    91 desable_open=0;%default: allow reading of object from xml file
    92 desable_plot=0;%default
     91enable_plot=0;%default
    9392SetData.PlotHandles=PlotHandles;
    94 if exist('data','var') && isfield(data,'ParentButton')
    95         SetData.ParentButton=data.ParentButton;
    96         set(hObject,'DeleteFcn',{@closefcn,SetData.ParentButton})%
    97 end
     93% if exist('data','var') && isfield(data,'ParentButton')
     94%         SetData.ParentButton=data.ParentButton;
     95%         set(hObject,'DeleteFcn',{@closefcn,SetData.ParentButton})%
     96% end
    9897set(hObject,'UserData',SetData)
    9998
     
    101100if exist('data','var')
    102101    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)
    104103    end
    105104    if ~isfield(data,'NbDim')||~isequal(data.NbDim,3)%2D case
     
    242241%     set(handles.OPEN,'Visible','on')
    243242% end
    244 if desable_plot
    245    set(handles.PLOT,'Visible','off')
     243if enable_plot
     244   set(handles.PLOT,'enable','on')
    246245else
    247    set(handles.PLOT,'Visible','on')
     246   set(handles.PLOT,'enable','off')
    248247end
    249248
     
    793792%     set(hhuvmat.VOLUME,'BackgroundColor',[0 1 0])%put unactivated buttons to green
    794793% end
     794set(hhuvmat.MenuEditObject,'enable','on')
    795795set(hhuvmat.edit,'Value',1)
    796796set(hhuvmat.edit,'BackgroundColor',[1 1 0]);% paint the edit text in yellow
    797 set(hhuvmat.edit,'Value',1);%
    798797UvData.MouseAction='edit_object'; % set the edit button to 'on'
    799798set(huvmat,'UserData',UvData)
  • trunk/src/update_obj.m

    r61 r67  
    2828for iview=1:length(Object_set) %loop on projection planes iview
    2929      if isfield(Object_set{iview},'plotaxes')
    30          haxes=Object_set{iview}.plotaxes;% axes for the field plot
     30         haxes=Object_set{iview}.plotaxes% axes for the field plot
    3131         if ishandle(haxes) & isequal(get(haxes,'Type'),'axes')% update the representation of the object IndexObj on this axes if it exists
    3232             testupdate=0;
  • trunk/src/uvmat.m

    r65 r67  
    222222set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function
    223223set(hObject,'WindowButtonUpFcn',{'mouse_up',handles})
     224set(hObject,'DeleteFcn',{@closefcn})%
    224225
    225226%TRANSFORM menu: loads the information stored in prefdir to initiate the browser and the list of functions
     
    18411842if  ~isequal(transform_name,'') && ~isequal(transform_name,'px')
    18421843    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
    18431845        Field_b=transform(Field_b,UvData.XmlData_1);
    18441846    elseif ~test_1 && isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')%use geometry calib
     
    43524354
    43534355% --------------------------------------------------------------------
    4354 function MenuRun_Callback(hObject, eventdata, handles)
    4355 % --------------------------------------------------------------------
    4356 
    4357 % --------------------------------------------------------------------
    43584356function MenuHelp_Callback(hObject, eventdata, handles)
    43594357% --------------------------------------------------------------------
     
    43674365end
    43684366
    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 % --------------------------------------------------------------------
    43784367
    43794368% --------------------------------------------------------------------
     
    44684457set(handles.zoom,'Value',0)
    44694458set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
     4459set(handles.MenuTools,'enable','off')
     4460set(handles.MenuObject,'enable','off')
     4461set(handles.MenuEdit,'enable','off')
    44704462%         set(handles.create,'Value',0)
    44714463%         set(handles.create,'BackgroundColor',[0 1 0])
    44724464%         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')
    44794471set(handles.list_object_1,'Value',1)     
    44804472% initiate display of GUI geometry_calib
     
    46694661
    46704662% ------------------------------------------------------------------
    4671 function MenuEdit_Callback(hObject, eventdata, handles)
     4663function MenuEditObject_Callback(hObject, eventdata, handles)
     4664set(handles.edit,'Value',1)
     4665edit_Callback(hObject, eventdata, handles)
    46724666
    46734667%--------------------------------------------------------------------------
     
    48514845set(handles.uvmat,'UserData',UvData);
    48524846
     4847%------------------------------------------------------------------------
     4848% executed when closing: set the parent interface button to value 0
     4849function closefcn(gcbo,eventdata)
     4850%------------------------------------------------------------------------
     4851%delete all the associated figures if exist
     4852hh=findobj(allchild(0),'tag','view_field');
     4853if ~isempty(hh)
     4854    delete(hh)
     4855end
     4856hh=findobj(allchild(0),'name','geometry_calib');
     4857if ~isempty(hh)
     4858    delete(hh)
     4859end
     4860hh=findobj(allchild(0),'tag','set_object');
     4861if ~isempty(hh)
     4862    hhh=findobj(hh,'tag','PLOT');
     4863    set(hhh,'enable','off')
     4864end
  • trunk/src/view_field.m

    r61 r67  
    8989set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function
    9090set(hObject,'WindowButtonUpFcn',{'mouse_up',handles_mouse})
    91 % set(hObject,'CloseRequestFcn ',{'close_fcn'})
     91set(hObject,'CloseRequestFcn',{@closefcn})%
    9292
    9393[PlotType,PlotParamOut,haxes]= plot_field(Field,handles.axes3)%,PlotParam,KeepLim,PosColorbar)
     
    23372337write_plot_param(handles,PlotParamOut); %update the auto plot parameters
    23382338
    2339 
    2340 
    23412339%------------------------------------------------------
    23422340% --- Executes on button press in Menu/Export/field in workspace.
     
    23672365
    23682366function npx_Callback(hObject, eventdata, handles)
    2369 % hObject    handle to npx (see GCBO)
    2370 % eventdata  reserved - to be defined in a future version of MATLAB
    2371 % handles    structure with handles and user data (see GUIDATA)
    2372 
    2373 % Hints: get(hObject,'String') returns contents of npx as text
    2374 %        str2double(get(hObject,'String')) returns contents of npx as a double
    2375 
    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 MATLAB
    2381 % handles    empty - handles not created until after all CreateFcns called
    2382 
    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 end
    23882367
    23892368
    23902369
    23912370function npy_Callback(hObject, eventdata, handles)
    2392 % hObject    handle to npy (see GCBO)
    2393 % eventdata  reserved - to be defined in a future version of MATLAB
    2394 % handles    structure with handles and user data (see GUIDATA)
    2395 
    2396 % Hints: get(hObject,'String') returns contents of npy as text
    2397 %        str2double(get(hObject,'String')) returns contents of npy as a double
    2398 
    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 MATLAB
    2404 % handles    empty - handles not created until after all CreateFcns called
    2405 
    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 end
    2411 
    24122371
    24132372
    24142373function edit86_Callback(hObject, eventdata, handles)
    2415 % hObject    handle to MaxA (see GCBO)
    2416 % eventdata  reserved - to be defined in a future version of MATLAB
    2417 % handles    structure with handles and user data (see GUIDATA)
    2418 
    2419 % Hints: get(hObject,'String') returns contents of MaxA as text
    2420 %        str2double(get(hObject,'String')) returns contents of MaxA as a double
    2421 
    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 MATLAB
    2427 % handles    empty - handles not created until after all CreateFcns called
    2428 
    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 end
    2434 
    24352374
    24362375
    24372376function edit87_Callback(hObject, eventdata, handles)
    2438 % hObject    handle to MinA (see GCBO)
    2439 % eventdata  reserved - to be defined in a future version of MATLAB
    2440 % handles    structure with handles and user data (see GUIDATA)
    2441 
    2442 % Hints: get(hObject,'String') returns contents of MinA as text
    2443 %        str2double(get(hObject,'String')) returns contents of MinA as a double
    2444 
    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 MATLAB
    2450 % handles    empty - handles not created until after all CreateFcns called
    2451 
    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 end
    24572377
    24582378
     
    24662386
    24672387
    2468 
    24692388function 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
    24892390
    24902391
     
    25002401
    25012402function edit82_Callback(hObject, eventdata, handles)
    2502 % hObject    handle to edit82 (see GCBO)
    2503 % eventdata  reserved - to be defined in a future version of MATLAB
    2504 % handles    structure with handles and user data (see GUIDATA)
    2505 
    2506 % Hints: get(hObject,'String') returns contents of edit82 as text
    2507 %        str2double(get(hObject,'String')) returns contents of edit82 as a double
    2508 
    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 MATLAB
    2514 % handles    empty - handles not created until after all CreateFcns called
    2515 
    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 end
    25212403
    25222404
     
    25312413
    25322414
    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 MATLAB
    2537 % handles    empty - handles not created until after all CreateFcns called
    2538 
    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 end
    2544 
    2545 
    25462415% --- Executes on slider movement.
    25472416function slider9_Callback(hObject, eventdata, handles)
    2548 % hObject    handle to slider9 (see GCBO)
     2417% hObject    handle to slider2 (see GCBO)
    25492418% eventdata  reserved - to be defined in a future version of MATLAB
    25502419% handles    structure with handles and user data (see GUIDATA)
     
    25542423
    25552424
    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 MATLAB
    2560 % handles    empty - handles not created until after all CreateFcns called
    2561 
    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 end
    2566 
    2567 
    25682425% --- Executes on slider movement.
    25692426function slider10_Callback(hObject, eventdata, handles)
    2570 % hObject    handle to slider10 (see GCBO)
     2427% hObject    handle to slider1 (see GCBO)
    25712428% eventdata  reserved - to be defined in a future version of MATLAB
    25722429% handles    structure with handles and user data (see GUIDATA)
    25732430
    25742431% 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
    25882434
    25892435
     
    25972443
    25982444
    2599 
    26002445function edit89_Callback(hObject, eventdata, handles)
    26012446% hObject    handle to max_vec (see GCBO)
     
    26072452
    26082453
     2454function 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
     2465function closefcn(hObject, eventdata, handles)
     2466huvmat=findobj(allchild(0),'Name','uvmat');
     2467hhuvmat=guidata(huvmat);
     2468list_object_2=get(hhuvmat.list_object_2,'String');
     2469set(hhuvmat.list_object_2,'Value',numel(list_object_2))%select the last value ('...')
     2470delete(hObject)
     2471
     2472
    26092473% --- Executes during object creation, after setting all properties.
    2610 function max_vec_CreateFcn(hObject, eventdata, handles)
    2611 % hObject    handle to max_vec (see GCBO)
     2474function colcode1_CreateFcn(hObject, eventdata, handles)
     2475% hObject    handle to colcode1 (see GCBO)
    26122476% eventdata  reserved - to be defined in a future version of MATLAB
    26132477% handles    empty - handles not created until after all CreateFcns called
     
    26202484
    26212485
    2622 
    2623 function edit90_Callback(hObject, eventdata, handles)
    2624 % hObject    handle to edit90 (see GCBO)
     2486% --- Executes during object creation, after setting all properties.
     2487function slider2_CreateFcn(hObject, eventdata, handles)
     2488% hObject    handle to slider2 (see GCBO)
    26252489% 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.
     2493if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
     2494    set(hObject,'BackgroundColor',[.9 .9 .9]);
     2495end
    26302496
    26312497
    26322498% --- Executes during object creation, after setting all properties.
    2633 function edit90_CreateFcn(hObject, eventdata, handles)
    2634 % hObject    handle to edit90 (see GCBO)
     2499function 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.
     2505if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
     2506    set(hObject,'BackgroundColor',[.9 .9 .9]);
     2507end
     2508
     2509
     2510% --- Executes during object creation, after setting all properties.
     2511function colcode2_CreateFcn(hObject, eventdata, handles)
     2512% hObject    handle to colcode2 (see GCBO)
    26352513% eventdata  reserved - to be defined in a future version of MATLAB
    26362514% handles    empty - handles not created until after all CreateFcns called
     
    26432521
    26442522
    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 MATLAB
    2649 % 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.