Changeset 273
- Timestamp:
- Nov 17, 2011, 7:01:18 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r272 r273 21 21 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 22 22 function varargout = civ(varargin) 23 24 % Last Modified by GUIDE v2.5 27-May-2011 17:55:50 23 %TODO: search range 24 25 % Last Modified by GUIDE v2.5 16-Nov-2011 20:12:34 25 26 % Begin initialization code - DO NOT EDIT 26 27 gui_Singleton = 1; … … 47 48 %------------------------------------------------------------------------ 48 49 % This function has no output args, see OutputFcn. 49 % hObject handle to figure50 % eventdata reserved - to be defined in a future version of MATLAB51 % handles structure with handles and user data (see GUIDATA)52 % varargin command line arguments to civ (see VARARGIN)53 50 global patch_newBin %=1 if new patch processing available 54 51 %filebase: root name … … 67 64 ext=[]; 68 65 66 %% read names of the .exe file to adjust the interface according to available binaries 67 path_uvmat=which('uvmat');% check the path detected for source file uvmat 68 path_UVMAT=fileparts(path_uvmat); %path to UVMAT 69 errormsg=[];%default error message 70 xmlfile='PARAM.xml'; 71 if exist(xmlfile,'file') 72 try 73 t=xmltree(xmlfile); 74 sparam=convert(t); 75 catch 76 errormsg={' Unable to read the file PARAM.xml defining the civx binaries:'; lasterr}; 77 return 78 end 79 else 80 errormsg=[xmlfile ' not found: path to civx binaries undefined']; 81 return 82 end 83 if ~isempty(errormsg) 84 msgbox_uvmat('ERROR',errormsg); 85 end 86 87 test_batch=0;%default: ,no batch mode available 88 if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode') 89 test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod 90 end 91 if test_batch==0 92 set(handles.BATCH,'Enable','off')% put the BATCH button in grey (unactivated) 93 set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated) 94 end 95 if isfield(sparam.RunParam,'CivBin') 96 if ~exist(sparam.RunParam.CivBin,'file') 97 sparam.RunParam.CivBin=fullfile(path_UVMAT,sparam.RunParam.CivBin); 98 end 99 else 100 sparam.RunParam.CivBin=''; 101 end 102 103 %% load the list of previously browsed files in menu Open 104 dir_perso=prefdir; % path to the directory .matlab for personal data 105 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmauvmat_perso.mat' in .matlab 106 if exist(profil_perso,'file') 107 h=load (profil_perso); 108 if isfield(h,'MenuFile') 109 set(handles.MenuFile_1,'Label',h.MenuFile{1}) 110 %set(handles.MenuFile_1,'Label',h.MenuFile_1); 111 end 112 % if isfield(h,'MenuFile_2') 113 % set(handles.MenuFile_2,'Label',h.MenuFile_2); 114 % end 115 % if isfield(h,'MenuFile_3') 116 % set(handles.MenuFile_3,'Label',h.MenuFile_3); 117 % end 118 % if isfield(h,'MenuFile_4') 119 % set(handles.MenuFile_4,'Label',h.MenuFile_4); 120 % end 121 % if isfield(h,'MenuFile_5') 122 % set(handles.MenuFile_5,'Label',h.MenuFile_5); 123 % end 124 end 125 69 126 %default input parameters: 70 127 num_i1=1; % set of field i numbers … … 72 129 num_j1=1; % set of field j numbers (fields a) 73 130 num_j2=1; % second set of field j numbers (fields b) 74 subdir='A'; % subdir for the netcdf result files75 ind_opening= 1; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2)131 %subdir='A'; % subdir for the netcdf result files 132 ind_opening=0; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2) 76 133 %load the initial parameters if the interface is started from uvmat 77 134 if exist('param','var')&&isstruct(param)% the interface is opened from uvmat … … 108 165 set(handles.ImaDoc,'String',ext) 109 166 110 %read names of the .exe file to adjust the interface according to available binaries 111 path_uvmat=which('uvmat');% check the path detected for source file uvmat 112 path_UVMAT=fileparts(path_uvmat); %path to UVMAT 113 errormsg=[];%default error message 114 xmlfile='PARAM.xml'; 115 if exist(xmlfile,'file') 116 try 117 t=xmltree(xmlfile); 118 sparam=convert(t); 119 catch 120 errormsg={' Unable to read the file PARAM.xml defining the civx binaries:'; lasterr}; 121 return 122 end 123 else 124 errormsg=[xmlfile ' not found: path to civx binaries undefined']; 125 return 126 end 127 128 129 if ~isempty(errormsg) 130 msgbox_uvmat('ERROR',errormsg); 131 end 132 % patch_newBin=''; 133 test_batch=0;%default: ,no batch mode available 134 if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode') 135 test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod 136 end 137 if test_batch==0 138 set(handles.BATCH,'Enable','off')% put the BATCH button in grey (unactivated) 139 set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated) 140 end 141 if isfield(sparam.RunParam,'CivBin') 142 if ~exist(sparam.RunParam.CivBin,'file') 143 sparam.RunParam.CivBin=fullfile(path_UVMAT,sparam.RunParam.CivBin); 144 end 145 else 146 sparam.RunParam.CivBin=''; 147 end 148 patch_newBin=exist(sparam.RunParam.CivBin,'file'); 149 set(handles.subdir_civ1,'String',subdir)%default subdir on which uvmat was working 150 set(handles.subdir_civ2,'String',subdir)%default subdir on which uvmat was working 167 % patch_newBin=exist(sparam.RunParam.CivBin,'file'); 168 % set(handles.subdir_civ1,'String',subdir)%default subdir on which uvmat was working 169 % set(handles.subdir_civ2,'String',subdir)%default subdir on which uvmat was working 151 170 152 171 %initiate advised operations 153 if isequal(ind_opening,[])154 ind_opening=1; % default155 end172 % if isemp(ind_opening,[]) 173 % ind_opening=1; % default 174 % end 156 175 % set default operation options 157 enable_civ1(handles, 'off')158 enable_civ2(handles, 'off')159 enable_pair1(handles,'on')160 enable_fix1(handles, 'off')161 desable_patch1(handles)162 desable_fix2(handles)163 desable_patch2(handles)176 enable_civ1(handles,0) 177 enable_civ2(handles,0) 178 %enable_pair1(handles,'on') 179 enable_fix1(handles,0) 180 enable_patch1(handles,0) 181 enable_fix2(handles,0) 182 enable_patch2(handles,0) 164 183 set(handles.CIV1,'Value',0) 165 184 set(handles.FIX1,'Value',0) … … 168 187 set(handles.FIX2,'Value',0) 169 188 set(handles.PATCH2,'Value',0) 170 set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784])189 %set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) 171 190 if isequal(ind_opening,1) 172 191 set(handles.CIV1,'Value',1) 173 enable_civ1(handles, 'on')192 enable_civ1(handles,1) 174 193 elseif isequal(ind_opening,2) 175 194 set(handles.FIX1,'Value',1) 176 enable_fix1(handles, 'on')195 enable_fix1(handles,1) 177 196 elseif isequal(ind_opening,3) 178 197 set(handles.PATCH1,'Value',1) 179 enable_patch1(handles )198 enable_patch1(handles,1) 180 199 elseif isequal(ind_opening,4) 181 200 set(handles.CIV2,'Value',1) 182 enable_civ2(handles, 'on')201 enable_civ2(handles,1) 183 202 elseif isequal(ind_opening,5) 184 203 set(handles.FIX2,'Value',1) 185 enable_fix2(handles )204 enable_fix2(handles,1) 186 205 set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) 187 206 set(handles.list_pair_civ2,'Enable','On') … … 190 209 elseif isequal(ind_opening,6) 191 210 set(handles.PATCH2,'Value',1) 192 enable_patch2(handles )211 enable_patch2(handles,1) 193 212 set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) 194 213 set(handles.list_pair_civ2,'Enable','On') … … 220 239 set(handles.ref_i,'String',num2str(num_ref_i)); 221 240 set(handles.ref_j,'String',num2str(num_ref_j)); 222 set(handles.ref_i_civ2,'String',num2str(num_ref_i));223 set(handles.ref_j_civ2,'String',num2str(num_ref_j));224 set(handles. browse_root,'UserData',browse);241 % set(handles.ref_i_civ2,'String',num2str(num_ref_i)); 242 % set(handles.ref_j_civ2,'String',num2str(num_ref_j)); 243 set(handles.RootName,'UserData',browse); 225 244 if exist('param','var') && isfield(param,'RootName') && ~isempty(param.RootName)%varargin the interface is opened from uvmat 226 245 RootName_Callback(hObject, eventdata, handles); 227 246 end 228 247 229 % set(handles.waitbar_1,'Position',[0.946 0.877 0.03 0.001]) 230 % set(handles.waitbar_patch1,'Position',[0.946 0.626 0.03 0.001]) 231 % set(handles.waitbar_civ2,'Position',[0.946 0.406 0.03 0.001]) 232 % set(handles.waitbar_patch2,'Position',[0.946 0.187 0.03 0.001]) 248 249 %TESTS 250 251 252 struct=read_panel(handles.Patch2Panel) 233 253 234 254 %------------------------------------------------------------------------ … … 243 263 varargout{1} = handles.output; 244 264 245 %------------------------------------------------------------------------ 246 % --- Executes on button press in browse_root. 247 function browse_root_Callback(hObject, eventdata, handles) 248 %------------------------------------------------------------------------ 265 % -------------------------------------------------------------------- 266 function MenuBrowse_Callback(hObject, eventdata, handles) 267 249 268 %get the input file properties 250 269 filebase=get(handles.RootName,'String'); … … 317 336 browse=[];%initialisation 318 337 else 319 browse=get(handles .browse_root,'UserData');338 browse=get(handlesRootName,'UserData'); 320 339 end 321 340 browse.num_i1=num_i1; … … 375 394 set(handles.last_i,'String',num2str(ref_i)); 376 395 set(handles.ref_i,'String',num2str(ref_i)); 377 set(handles.ref_i_civ2,'String',num2str(ref_i))396 % set(handles.ref_i_civ2,'String',num2str(ref_i)) 378 397 end 379 398 if isempty(num_j1) … … 389 408 set(handles.last_j,'String',num2str(ref_j)); 390 409 set(handles.ref_j,'String',num2str(ref_j)); 391 set(handles.ref_j_civ2,'String',num2str(ref_j));410 % set(handles.ref_j_civ2,'String',num2str(ref_j)); 392 411 end 393 412 394 413 % set default operation options 395 enable_civ1(handles, 'off')396 enable_civ2(handles, 'off')414 enable_civ1(handles,0) 415 enable_civ2(handles,0') 397 416 enable_pair1(handles,'on') 398 enable_fix1(handles, 'off')399 desable_patch1(handles)400 desable_fix2(handles)401 desable_patch2(handles)417 enable_fix1(handles,0) 418 enable_patch1(handles,0) 419 enable_fix2(handles,0) 420 enable_patch2(handles,0) 402 421 set(handles.CIV1,'Value',0) 403 422 set(handles.FIX1,'Value',0) … … 406 425 set(handles.FIX2,'Value',0) 407 426 set(handles.PATCH2,'Value',0) 408 set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784])427 % set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) 409 428 if isequal(ind_opening,1) 410 429 set(handles.CIV1,'Value',1) … … 433 452 set(handles.list_pair_civ2,'Enable','On') 434 453 end 435 set(handles.browse_root,'UserData',browse);% store information from browser 436 454 set(handles.RootName,'UserData',browse);% store information from browser 437 455 RootName_Callback(hObject, eventdata, handles); 456 457 458 % ----------------------------------------------------------------------- 459 % --- Open again the file whose name has been recorded in MenuFile_1 460 function MenuFile_1_Callback(hObject, eventdata, handles) 461 %------------------------------------------------------------------------ 462 fileinput=get(handles.MenuFile_1,'Label'); 463 display_file_name(hObject, eventdata, handles,fileinput) 464 465 % ----------------------------------------------------------------------- 466 % --- Open again the file whose name has been recorded in MenuFile_2 467 function MenuFile_2_Callback(hObject, eventdata, handles) 468 %------------------------------------------------------------------------ 469 fileinput=get(handles.MenuFile_2,'Label'); 470 display_file_name(hObject, eventdata, handles,fileinput) 471 472 % ----------------------------------------------------------------------- 473 % --- Open again the file whose name has been recorded in MenuFile_3 474 function MenuFile_3_Callback(hObject, eventdata, handles) 475 %------------------------------------------------------------------------ 476 fileinput=get(handles.MenuFile_3,'Label'); 477 display_file_name(hObject, eventdata, handles,fileinput) 478 479 % ----------------------------------------------------------------------- 480 % --- Open again the file whose name has been recorded in MenuFile_4 481 function MenuFile_4_Callback(hObject, eventdata, handles) 482 %------------------------------------------------------------------------ 483 fileinput=get(handles.MenuFile_4,'Label'); 484 display_file_name(hObject, eventdata, handles,fileinput) 485 486 % ----------------------------------------------------------------------- 487 % --- Open again the file whose name has been recorded in MenuFile_5 488 function MenuFile_5_Callback(hObject, eventdata, handles) 489 %------------------------------------------------------------------------ 490 fileinput=get(handles.MenuFile_5,'Label'); 491 display_file_name(hObject, eventdata, handles,fileinput) 438 492 439 493 %------------------------------------------------------------------------ … … 445 499 % --- function activated when a new filebase (image series) is introduced 446 500 function RootName_Callback(hObject, eventdata, handles) 501 %------------------------------------------------------------------------ 502 filebase=get(handles.RootName,'String'); 503 display_file_name(hObject, eventdata, handles,filebase) 504 505 %------------------------------------------------------------------------ 506 function display_file_name(hObject, eventdata, handles,filebase) 447 507 %------------------------------------------------------------------------ 448 508 set(handles.compare,'Visible','on') … … 456 516 pxcmx_search=[];%default 457 517 pxcmy_search=[];%default 458 filebase=get(handles.RootName,'String'); 518 459 519 ext_imadoc=get(handles.ImaDoc,'String'); 460 browse=get(handles. browse_root,'UserData');%default520 browse=get(handles.RootName,'UserData');%default 461 521 if isfield(browse,'nom_type_ima') 462 522 nom_type_ima=browse.nom_type_ima;% get an image nomenclature type already determined by an input image name … … 594 654 nom_type_ima='*'; 595 655 ext_ima=ext_imadoc; 596 set(handles. mode,'Value',1);597 set(handles. mode,'String',{'series(Di)'})656 set(handles.CivMode,'Value',1); 657 set(handles.CivMode,'String',{'series(Di)'}) 598 658 dt=0.04;%default 599 659 if exist([filebase ext_imadoc],'file')==2 … … 677 737 end 678 738 first_i=max(field_i,1); 739 nom_type_search 679 740 if numel(regexp(nom_type_search,'\D'))>=1%two indices i and j 680 741 field_i=browse.num_i1; … … 708 769 nbfield=size(time,1); 709 770 nbfield2=size(time,2); 710 set(handles. RootName,'UserData',time); %store the set of times771 set(handles.ImaDoc,'UserData',time); %store the set of times 711 772 set(handles.dt_unit,'String',['dt in m' TimeUnit]); 712 set(handles.dt_unit_civ2,'String',['dt in m' TimeUnit]);773 % set(handles.dt_unit_civ2,'String',['dt in m' TimeUnit]); 713 774 set(handles.TimeUnit,'String',TimeUnit); 714 775 set(handles.nb_field,'String',num2str(nbfield)); … … 717 778 end 718 779 set(handles.CoordUnit,'String',CoordUnit) 719 set(handles. calcul_search,'UserData',[pxcmx_search pxcmy_search]);780 set(handles.SearchRange,'UserData',[pxcmx_search pxcmy_search]); 720 781 % npxy=[npy npx]; 721 782 set(handles.ImaExt,'String',ext_ima) … … 725 786 set(handles.last_j,'String',num2str(last_j));% 726 787 browse.nom_type_ima=nom_type_ima; 727 set(handles. browse_root,'UserData',browse)% store the nomenclature type728 729 %% %%%%%%%%%set the menus of image pairs and default selection for civ %%%%%%%%%%%%%%%%%%%788 set(handles.RootName,'UserData',browse)% store the nomenclature type 789 790 %% set the menus of image pairs and default selection for civ %%%%%%%%%%%%%%%%%%% 730 791 test_ima_i=numel(nom_type_ima)>1 && isempty(regexp(nom_type_ima(2:end),'\D','once'));%images with single indexing 731 792 if test_ima_i || isequal(nom_type_nc,'_i1-i2')||~(exist('nbfield2','var')&&(nbfield2~=1)) 732 set(handles. mode,'Value',1)733 set(handles. mode,'String',{'series(Di)'})793 set(handles.CivMode,'Value',1) 794 set(handles.CivMode,'String',{'series(Di)'}) 734 795 elseif (nbfield==1)% simple series in j 735 set(handles. mode,'Value',1)736 set(handles. mode,'String',{'series(Dj)'})737 else 738 set(handles. mode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice796 set(handles.CivMode,'Value',1) 797 set(handles.CivMode,'String',{'series(Dj)'}) 798 else 799 set(handles.CivMode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice 739 800 if nbfield2 <= 10 740 set(handles.mode,'Value',1)% advice 'pair j1-j2' for small burst 741 end 742 end 743 744 %update the subdir 801 set(handles.CivMode,'Value',1)% advice 'pair j1-j2' for small burst 802 end 803 end 804 805 806 %% desable status and RUN button 807 set(handles.RUN, 'Enable','On') 808 set(handles.RUN,'BackgroundColor',[1 0 0]) 809 set(handles.BATCH,'Enable','On') 810 set(handles.BATCH,'BackgroundColor',[1 0 0]) 811 if isfield(handles,'status') 812 set(handles.status,'Value',0);%suppress status display 813 status_Callback(hObject, eventdata, handles) 814 end 815 816 %% store the root input filename for future opening 817 dir_perso=prefdir; 818 profil_perso=fullfile(prefdir,'uvmat_perso.mat'); 819 RootPath=fileparts(filebase); 820 if exist(profil_perso,'file') 821 save (profil_perso,'RootPath','-append'); %store the root name for future opening of uvmat 822 else 823 txt=ver('MATLAB'); 824 Release=txt.Release; 825 relnumb=str2double(Release(3:4)); 826 if relnumb >= 14 827 save (profil_perso,'RootPath','-V6'); %store the root name for future opening of uvmat 828 else 829 save (profil_perso,'RootPath'); %store the root name for future opening of uvmat 830 end 831 end 832 833 %% update the subdir 745 834 pathdir=fileparts(filebase);%path to the current xml file 746 835 listot=dir(pathdir); … … 758 847 set(handles.list_subdir_civ1,'Value',1) 759 848 set(handles.list_subdir_civ2,'Value',1) 760 set(handles.list_subdir_civ1,'String',[{'browse...'};listdir]) 761 set(handles.list_subdir_civ2,'String',[{'browse...'};listdir]) 849 set(handles.list_subdir_civ1,'String',[listdir;'new...']) 850 set(handles.list_subdir_civ2,'String',[listdir;'new...']) 851 if isempty(listdir) 852 dirname=listdir{1}; 853 else 854 dirname='CIV'; %default civ directory name 855 end 856 set(handles.subdir_civ1,'String',dirname) 857 set(handles.subdir_civ2,'String',dirname) 762 858 %check wether the current subdir exists: 763 subdir_civ1=get(handles.subdir_civ1,'String'); 764 subdir_civ2=get(handles.subdir_civ2,'String'); 765 766 mode_Callback(hObject, eventdata, handles) 767 768 %% desable status and RUN button 769 % set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001]) 770 % set(handles.waitbar_patch1,'Position',[0.946 0.439 0.03 0.001]) 771 % set(handles.waitbar_civ2,'Position',[0.946 0.219 0.03 0.001]) 772 % set(handles.waitbar_patch2,'Position',[0.946 0.0 0.03 0.001]) 773 set(handles.RUN, 'Enable','On') 774 set(handles.RUN,'BackgroundColor',[1 0 0]) 775 set(handles.BATCH,'Enable','On') 776 set(handles.BATCH,'BackgroundColor',[1 0 0]) 777 if isfield(handles,'status') 778 set(handles.status,'Value',0);%suppress status display 779 status_Callback(hObject, eventdata, handles) 780 end 781 782 %% store the root input filename for future opening 783 dir_perso=prefdir; 784 profil_perso=fullfile(prefdir,'uvmat_perso.mat'); 785 RootPath=fileparts(filebase); 786 if exist(profil_perso,'file') 787 save (profil_perso,'RootPath','-append'); %store the root name for future opening of uvmat 788 else 789 txt=ver('MATLAB'); 790 Release=txt.Release; 791 relnumb=str2double(Release(3:4)); 792 if relnumb >= 14 793 save (profil_perso,'RootPath','-V6'); %store the root name for future opening of uvmat 794 else 795 save (profil_perso,'RootPath'); %store the root name for future opening of uvmat 796 end 797 end 798 799 %------------------------------------------------------------------------ 800 % --- Executes on button press in mode. 801 function mode_Callback(hObject, eventdata, handles) 802 %------------------------------------------------------------------------ 803 browse=get(handles.browse_root,'UserData'); 859 % subdir_civ1=get(handles.subdir_civ1,'String'); 860 % subdir_civ2=get(handles.subdir_civ2,'String'); 861 862 CivMode_Callback(hObject, eventdata, handles) 863 864 %------------------------------------------------------------------------ 865 % --- Executes on button press in CivMode. 866 function CivMode_Callback(hObject, eventdata, handles) 867 %------------------------------------------------------------------------ 868 browse=get(handles.RootName,'UserData'); 804 869 compare_list=get(handles.compare,'String'); 805 870 val=get(handles.compare,'Value'); … … 808 873 mode='displacement'; 809 874 else 810 mode_list=get(handles. mode,'String');875 mode_list=get(handles.CivMode,'String'); 811 876 if ischar(mode_list) 812 877 mode_list={mode_list}; 813 878 end 814 mode_value=get(handles. mode,'Value');879 mode_value=get(handles.CivMode,'Value'); 815 880 mode=mode_list{mode_value}; 816 881 end … … 818 883 ref_i=str2double(get(handles.ref_i,'String')); 819 884 % last_i=str2num(get(handles.last_i,'String')); 820 time=get(handles. RootName,'UserData'); %get the set of times885 time=get(handles.ImaDoc,'UserData'); %get the set of times 821 886 siztime=size(time); 822 887 nbfield=siztime(1); … … 961 1026 set(gcf,'Pointer','watch') 962 1027 %nomenclature types 1028 'TESTpair' 963 1029 filebase=get(handles.RootName,'String'); 964 1030 [filepath,Nme,ext_dir]=fileparts(filebase); 965 browse=get(handles. browse_root,'UserData');1031 browse=get(handles.RootName,'UserData'); 966 1032 compare_list=get(handles.compare,'String'); 967 1033 val=get(handles.compare,'Value'); … … 970 1036 mode='displacement'; 971 1037 else 972 mode_list=get(handles.mode,'String'); 973 mode_value=get(handles.mode,'Value'); 1038 mode_list=get(handles.CivMode,'String'); 1039 mode_value=get(handles.CivMode,'Value'); 1040 if isempty(mode_list) 1041 return 1042 end 974 1043 mode=mode_list{mode_value}; 975 1044 end … … 990 1059 end 991 1060 browse.nom_type_nc=nom_type_nc; 992 set(handles. browse_root,'UserData',browse)1061 set(handles.RootName,'UserData',browse) 993 1062 994 1063 %reads .nc subdirectoy and image numbers from the interface 995 1064 subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf data 996 % first_i=str2num(get(handles.first_i,'String'));997 % last_i=str2num(get(handles.last_i,'String'));998 % incr=str2num(get(handles.incr_i,'String'));999 % num1=first_i:incr:last_i;1000 % if isempty(num1)1001 % set(handles.list_pair_civ1,'String',{''});1002 % return1003 % end1004 1065 ref_i=str2double(get(handles.ref_i,'String')); 1005 1066 if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') … … 1008 1069 ref_j=str2double(get(handles.ref_j,'String')); 1009 1070 end 1010 time=get(handles. RootName,'UserData');%get the set of times1071 time=get(handles.ImaDoc,'UserData');%get the set of times 1011 1072 if isempty(time) 1012 1073 time=[0 1]; 1013 1074 end 1014 %dt_unit=str2double(get(handles.dt,'String'));% used when there is no image documentation file1015 1075 dt_unit=1000;%default 1016 1076 displ_num=get(handles.list_pair_civ1,'UserData'); … … 1032 1092 % be performed, while the result is needed for next steps. 1033 1093 displ_pair={''}; 1034 select=ones(size(1:nbpair));% default =1 for numbers of displayed pairs1094 select=ones(size(1:nbpair));%flag for displayed pairs =1 for display 1035 1095 testpair=0; 1096 % case with no civ1 operation, netcdf files need to exist for reading 1036 1097 if get(handles.CIV1,'Value')==0 % 1037 1098 if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir') … … 1043 1104 filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... 1044 1105 ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); 1045 select(ipair)=exist(filename,'file')==2; 1046 end 1047 if ~exist('select','var') || isequal(select,zeros(size(1:nbpair))) 1048 if isfield(browse,'incr_pair') 1106 select(ipair)=exist(filename,'file')==2;% put flag to 0 if the file does not exist 1107 end 1108 % case of no displayed pair 1109 if isequal(select,zeros(size(1:nbpair))) 1110 'TESTzero' 1111 browse 1112 if isfield(browse,'incr_pair') && ~isequal(browse.incr_pair,[0 0]) 1049 1113 num_i1=ref_i-floor(browse.incr_pair(1)/2); 1050 1114 num_i2=ref_i+ceil(browse.incr_pair(1)/2); … … 1069 1133 if testpair 1070 1134 displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; 1071 % elseif ~isequal(get(handles.root_txt,'String'),'dt(ms)=')1072 % for ipair=1:nbpair1073 % if select(ipair)1074 % if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)1075 % dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt1076 % displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];1077 % end1078 % else1079 % displ_pair{ipair}='...'; %pair not displayed in the menu1080 % end1081 % end1082 1135 else 1083 1136 for ipair=1:nbpair … … 1154 1207 filebase=get(handles.RootName,'String'); 1155 1208 [filepath,Nme,ext_dir]=fileparts(filebase); 1156 browse=get(handles. browse_root,'UserData');1209 browse=get(handles.RootName,'UserData'); 1157 1210 compare_list=get(handles.compare,'String'); 1158 1211 val=get(handles.compare,'Value'); … … 1161 1214 mode='displacement'; 1162 1215 else 1163 mode_list=get(handles. mode,'String')1216 mode_list=get(handles.CivMode,'String') 1164 1217 if isempty(mode_list) 1165 1218 msgbox_uvmat('ERROR','please enter an input image or netcdf file') 1166 1219 return 1167 1220 end 1168 mode_value=get(handles. mode,'Value')1221 mode_value=get(handles.CivMode,'Value') 1169 1222 mode=mode_list{mode_value}; 1170 1223 end … … 1193 1246 end 1194 1247 browse.nom_type_nc=nom_type_nc; 1195 set(handles. browse_root,'UserData',browse)1248 set(handles.RootName,'UserData',browse) 1196 1249 1197 1250 %reads .nc subdirectory and image numbers from the interface … … 1207 1260 % return 1208 1261 % end 1209 ref_i=str2double(get(handles.ref_i _civ2,'String'));1262 ref_i=str2double(get(handles.ref_i,'String')); 1210 1263 if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') 1211 1264 ref_j=0; 1212 1265 else 1213 ref_j=str2double(get(handles.ref_j _civ2,'String'));1214 end 1215 time=get(handles. RootName,'UserData'); %get the set of times1266 ref_j=str2double(get(handles.ref_j,'String')); 1267 end 1268 time=get(handles.ImaDoc,'UserData'); %get the set of times 1216 1269 if isempty(time) 1217 1270 time=[0 1];%default … … 1339 1392 1340 1393 %update first_i and last_i according to the chosen image pairs 1341 mode_list=get(handles. mode,'String');1342 mode_value=get(handles. mode,'Value');1394 mode_list=get(handles.CivMode,'String'); 1395 mode_value=get(handles.CivMode,'Value'); 1343 1396 mode=mode_list{mode_value}; 1344 1397 if isequal(mode,'series(Di)') … … 1377 1430 1378 1431 %update first_i and last_i according to the chosen image pairs 1379 mode_list=get(handles. mode,'String');1380 mode_value=get(handles. mode,'Value');1432 mode_list=get(handles.CivMode,'String'); 1433 mode_value=get(handles.CivMode,'Value'); 1381 1434 mode=mode_list{mode_value}; 1382 1435 if isequal(mode,'series(Di)') … … 1516 1569 end 1517 1570 [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,xx,yy,compare]=... 1518 set_civ_filenames(handles,ref_i,ref_j,box_test) 1571 set_civ_filenames(handles,ref_i,ref_j,box_test); 1519 1572 1520 1573 set(handles.civ,'UserData',filecell);%store for futur use of status callback … … 1577 1630 1578 1631 %% check if the binaries exist 1579 ProgList=get(handles.CivMode,'String'); 1580 CivMode=ProgList{get(handles.CivMode,'Value')}; 1581 1632 if isequal(get(handles.Matlab,'checked'),'on') 1633 CivMode='Matlab'; 1634 else 1635 CivMode='CivX'; 1636 end 1582 1637 switch CivMode 1583 1638 case {'CivX','CivAll'} … … 1649 1704 %% get patch2 parameters 1650 1705 if box_test(6)==1 1651 rho_patch2=str2double(get(handles. rho_patch2,'String'));1706 rho_patch2=str2double(get(handles.SmoothParam,'String')); 1652 1707 if isnan(rho_patch2) 1653 1708 rho_patch2='1000'; 1654 set(handles. rho_patch2,'String','1')1709 set(handles.SmoothParam,'String','1') 1655 1710 else 1656 1711 rho_patch2=num2str(1000*rho_patch2); 1657 1712 end 1658 nx_patch2=get(handles. nx_patch2,'String');1659 ny_patch2=get(handles. ny_patch2,'String');1713 nx_patch2=get(handles.Nx,'String'); 1714 ny_patch2=get(handles.Ny,'String'); 1660 1715 if isnan(str2double(nx_patch2)) 1661 1716 nx_patch2='50' ;%default 1662 set(handles. nx_patch2,'String','50');1717 set(handles.Nx,'String','50'); 1663 1718 end 1664 1719 if isnan(str2double(ny_patch2)) 1665 1720 ny_patch2='50' ;%default 1666 set(handles. ny_patch2,'String','50');1667 end 1668 subdomain_patch2=get(handles. subdomain_patch2,'String');1669 thresh_patch2=get(handles. thresh_patch2,'String');1721 set(handles.Ny,'String','50'); 1722 end 1723 subdomain_patch2=get(handles.SubdomainSize,'String'); 1724 thresh_patch2=get(handles.MaxDiff,'String'); 1670 1725 end 1671 1726 … … 1674 1729 1675 1730 %% MAIN LOOP 1676 time=get(handles. RootName,'UserData'); %get the set of times1731 time=get(handles.ImaDoc,'UserData'); %get the set of times 1677 1732 1678 1733 super_cmd=[]; … … 2271 2326 saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) 2272 2327 2328 %Save info in personal profile (initiate browser next time) TODO 2329 MenuFile={}; 2330 dir_perso=prefdir; 2331 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 2332 if exist(profil_perso,'file') 2333 hh=load (profil_perso); 2334 if isfield(hh,'MenuFile') 2335 MenuFile=hh.MenuFile; 2336 end 2337 MenuFile=[filecell.ima1.civ1(1,1); MenuFile]; 2338 save (profil_perso,'MenuFile','-append'); %store the file names for future opening of uvmat 2339 else 2340 MenuFile=filecell.ima1.civ1(1,1); 2341 save (profil_perso,'MenuFile') 2342 end 2343 2344 2273 2345 %------------------------------------------------------------------------ 2274 2346 % --- determine the list of reference indices of processing file … … 2318 2390 filecell.filebase=filebase; 2319 2391 2320 browse=get(handles. browse_root,'UserData');2392 browse=get(handles.RootName,'UserData'); 2321 2393 compare_list=get(handles.compare,'String'); 2322 2394 val=get(handles.compare,'Value'); … … 2325 2397 mode='displacement'; 2326 2398 else 2327 mode_list=get(handles. mode,'String');2328 mode_value=get(handles. mode,'Value');2399 mode_list=get(handles.CivMode,'String'); 2400 mode_value=get(handles.CivMode,'Value'); 2329 2401 mode=mode_list{mode_value}; 2330 2402 end … … 2339 2411 [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... 2340 2412 find_pair_indices(handles,ref_i,ref_j,mode); 2341 %determine the new filebase for 'displacement' mode (comparison of two series)2413 %determine the new filebase for 'displacement' CivMode (comparison of two series) 2342 2414 filebase_B=filebase;% root name of the second field series for stereo 2343 2415 if strcmp(compare,'displacement') || strcmp(compare,'stereo PIV') … … 2912 2984 end 2913 2985 end 2914 if box_test(6)==1 && isequal(get(handles. test_stereo2,'Value'),1)2986 if box_test(6)==1 && isequal(get(handles.StereoCheck,'Value'),1) 2915 2987 for ifile=1:nbfield 2916 2988 for j=1:nbslice … … 2925 2997 set(handles.subdir_civ2,'String',subdir_civ2);%update the edit box 2926 2998 browse.nom_type_nc=nom_type_nc; 2927 set(handles. browse_root,'UserData',browse); %update the nomenclature type for uvmat2999 set(handles.RootName,'UserData',browse); %update the nomenclature type for uvmat 2928 3000 2929 3001 … … 3169 3241 function CIV1_Callback(hObject, eventdata, handles) 3170 3242 %------------------------------------------------------------------------ 3171 val=get(handles.CIV1,'Value');3172 if isequal(val,1)3173 enable_civ1(handles,'on') 3243 state=get(handles.CIV1,'Value'); 3244 enable_civ1(handles,state) 3245 if state 3174 3246 enable_pair1(handles,'on') 3175 else3176 enable_civ1(handles,'off')3177 3247 end 3178 3248 find_netcpair_civ1(hObject, eventdata, handles); … … 3188 3258 function PATCH1_Callback(hObject, eventdata, handles) 3189 3259 %------------------------------------------------------------------------ 3190 if get(handles.PATCH1,'Value')==1 3191 enable_patch1(handles) 3192 else 3193 desable_patch1(handles) 3194 end 3260 enable_patch1(handles,get(handles.PATCH1,'Value')) 3195 3261 3196 3262 %------------------------------------------------------------------------ … … 3209 3275 function FIX2_Callback(hObject, eventdata, handles) 3210 3276 %------------------------------------------------------------------------ 3211 if get(handles.FIX2,'Value')==1 3212 enable_fix2(handles) 3213 if get(handles.CIV2,'Value')==0 3214 find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files 3215 end 3216 else 3217 desable_fix2(handles) 3277 state=get(handles.FIX2,'Value'); 3278 enable_fix2(handles,state) 3279 if state 3280 find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files 3218 3281 end 3219 3282 … … 3222 3285 function PATCH2_Callback(hObject, eventdata, handles) 3223 3286 %------------------------------------------------------------------------ 3224 if get(handles.PATCH2,'Value')==1 3225 enable_patch2(handles) 3226 if get(handles.CIV2,'Value')==0 3227 find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files 3228 end 3229 else 3230 desable_patch2(handles) 3287 state=get(handles.PATCH2,'Value'); 3288 enable_patch2(handles,state) 3289 if state 3290 find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files 3231 3291 end 3232 3292 … … 3239 3299 % ref_i=ceil((first_i+last_i)/2); 3240 3300 set(handles.ref_i,'String', num2str(first_i))% reference index for pair dt = first index 3241 set(handles.ref_i_civ2,'String', num2str(first_i))% reference index for pair dt = first index3301 %set(handles.ref_i_civ2,'String', num2str(first_i))% reference index for pair dt = first index 3242 3302 ref_i_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) 3243 3303 … … 3250 3310 3251 3311 %------------------------------------------------------------------------ 3252 % --- Executes on button press in calcul_search: determine the search range isx,isy3253 function calcul_search_Callback(hObject, eventdata, handles)3312 % --- Executes on button press in SearchRange: determine the search range isx,isy 3313 function SearchRange_Callback(hObject, eventdata, handles) 3254 3314 %------------------------------------------------------------------------ 3255 3315 %determine pair numbers 3256 list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs 3257 index=get(handles.list_pair_civ1,'Value'); 3258 displ_num=get(handles.list_pair_civ1,'UserData'); 3259 time=get(handles.RootName,'UserData'); %get the set of times 3260 pxcm_xy=get(handles.calcul_search,'UserData'); 3261 pxcmx=pxcm_xy(1); 3262 pxcmy=pxcm_xy(2); 3263 mode_list=get(handles.mode,'String'); 3264 mode_value=get(handles.mode,'Value'); 3265 mode=mode_list{mode_value}; 3266 if isequal (mode, 'series(Di)' ) 3267 ref_i=str2double(get(handles.ref_i,'String')); 3268 num1=ref_i-floor(index/2);% first image numbers 3269 num2=ref_i+ceil(index/2); 3270 num_a=1; 3271 num_b=1; 3272 elseif isequal (mode, 'series(Dj)') 3273 num1=1; 3274 num2=1; 3275 ref_j=str2double(get(handles.ref_j,'String')); 3276 num_a=ref_j-floor(index/2);% first image numbers 3277 num_b=ref_j+ceil(index/2); 3278 elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) 3279 ref_i=str2double(get(handles.ref_i,'String')); 3280 num1=ref_i; 3281 num2=ref_i; 3282 num_a=displ_num(1,index); 3283 num_b=displ_num(2,index); 3284 end 3285 dt=time(num2,num_b)-time(num1,num_a); 3286 ibx=str2double(get(handles.ibx,'String')); 3287 iby=str2double(get(handles.iby,'String')); 3288 umin=dt*pxcmx*str2double(get(handles.umin,'String')); 3289 umax=dt*pxcmx*str2double(get(handles.umax,'String')); 3290 vmin=dt*pxcmy*str2double(get(handles.vmin,'String')); 3291 vmax=dt*pxcmy*str2double(get(handles.vmax,'String')); 3292 shiftx=round((umin+umax)/2); 3293 shifty=round((vmin+vmax)/2); 3294 isx=(umax+2-shiftx)*2+ibx; 3295 isx=2*ceil(isx/2)+1; 3296 isy=(vmax+2-shifty)*2+iby; 3297 isy=2*ceil(isy/2)+1; 3298 set(handles.shiftx,'String',num2str(shiftx)); 3299 set(handles.shifty,'String',num2str(shifty)); 3300 set(handles.isx,'String',num2str(isx)); 3301 set(handles.isy,'String',num2str(isy)); 3316 if strcmp(get(handles.umin,'Visible'),'off') 3317 set(handles.u_title,'Visible','on') 3318 set(handles.v_title,'Visible','on') 3319 set(handles.umin,'Visible','on') 3320 set(handles.umax,'Visible','on') 3321 set(handles.vmin,'Visible','on') 3322 set(handles.vmax,'Visible','on') 3323 set(handles.CoordUnit,'Visible','on') 3324 set(handles.TimeUnit,'Visible','on') 3325 set(handles.slash_title,'Visible','on') 3326 set(handles.min_title,'Visible','on') 3327 set(handles.max_title,'Visible','on') 3328 set(handles.unit_title,'Visible','on') 3329 else 3330 get_search_range(hObject, eventdata, handles) 3331 end 3332 3333 %------------------------------------------------------------------------ 3334 % --- determine the search range isx,isy and shift 3335 function get_search_range(hObject, eventdata, handles) 3336 umin=str2double(get(handles.umin,'String')); 3337 umax=str2double(get(handles.umax,'String')); 3338 vmin=str2double(get(handles.umin,'String')); 3339 vmax=str2double(get(handles.vmax,'String')); 3340 %switch min_title and max_title in case of error 3341 if umax<=umin 3342 umin_old=umin; 3343 umin=umax; 3344 umax=umin_old; 3345 set(handles.umin,'String', num2str(umin)) 3346 set(handles.umax,'String', num2str(umax)) 3347 end 3348 if vmax<=vmin 3349 vmin_old=vmin; 3350 vmin=vmax; 3351 vmax=vmin_old; 3352 set(handles.vmin,'String', num2str(vmin)) 3353 set(handles.vmax,'String', num2str(vmax)) 3354 end 3355 if ~(isnan(umin)||isnan(umax)||isnan(vmin)||isnan(vmax)) 3356 list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs 3357 index=get(handles.list_pair_civ1,'Value'); 3358 displ_num=get(handles.list_pair_civ1,'UserData'); 3359 time=get(handles.ImaDoc,'UserData'); %get the set of times 3360 pxcm_xy=get(handles.SearchRange,'UserData'); 3361 pxcmx=pxcm_xy(1); 3362 pxcmy=pxcm_xy(2); 3363 mode_list=get(handles.CivMode,'String'); 3364 mode_value=get(handles.CivMode,'Value'); 3365 mode=mode_list{mode_value}; 3366 if isequal (mode, 'series(Di)' ) 3367 ref_i=str2double(get(handles.ref_i,'String')); 3368 num1=ref_i-floor(index/2);% first image numbers 3369 num2=ref_i+ceil(index/2); 3370 num_a=1; 3371 num_b=1; 3372 elseif isequal (mode, 'series(Dj)') 3373 num1=1; 3374 num2=1; 3375 ref_j=str2double(get(handles.ref_j,'String')); 3376 num_a=ref_j-floor(index/2);% first image numbers 3377 num_b=ref_j+ceil(index/2); 3378 elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) 3379 ref_i=str2double(get(handles.ref_i,'String')); 3380 num1=ref_i; 3381 num2=ref_i; 3382 num_a=displ_num(1,index); 3383 num_b=displ_num(2,index); 3384 end 3385 dt=time(num2,num_b)-time(num1,num_a); 3386 ibx=str2double(get(handles.ibx,'String')); 3387 iby=str2double(get(handles.iby,'String')); 3388 umin=dt*pxcmx*umin; 3389 umax=dt*pxcmx*umax; 3390 vmin=dt*pxcmy*vmin; 3391 vmax=dt*pxcmy*vmax; 3392 shiftx=round((umin+umax)/2); 3393 shifty=round((vmin+vmax)/2); 3394 isx=(umax+2-shiftx)*2+ibx; 3395 isx=2*ceil(isx/2)+1; 3396 isy=(vmax+2-shifty)*2+iby; 3397 isy=2*ceil(isy/2)+1; 3398 set(handles.shiftx,'String',num2str(shiftx)); 3399 set(handles.shifty,'String',num2str(shifty)); 3400 set(handles.isx,'String',num2str(isx)); 3401 set(handles.isy,'String',num2str(isy)); 3402 end 3302 3403 3303 3404 %------------------------------------------------------------------------ … … 3306 3407 %------------------------------------------------------------------------ 3307 3408 subdir=get(handles.subdir_civ1,'String'); 3308 set(handles.subdir_civ2,'String',subdir); 3409 set(handles.subdir_civ2,'String',subdir);% set civ2 directory the same as civ1 by default 3410 menu_str=get(handles.list_subdir_civ1,'String');% read the list of subdirectories for update 3411 ichoice=find(strcmp(subdir,menu_str),1); 3412 if isempty(ichoice) 3413 ilist=numel(menu_str); %select 'new...' in the menu 3414 else 3415 ilist=ichoice; 3416 end 3417 set(handles.list_subdir_civ1,'Value',ilist)% select the selected subdir in the menu 3309 3418 if get(handles.CIV1,'Value')==0 3310 3419 find_netcpair_civ1(hObject, eventdata, handles); %update the list of available pairs from netcdf files in the new directory … … 3315 3424 function subdir_civ2_Callback(hObject, eventdata, handles) 3316 3425 %------------------------------------------------------------------------ 3426 subdir=get(handles.subdir_civ1,'String'); 3427 menu_str=get(handles.list_subdir_civ2,'String');% read the list of subdirectories for update 3428 ichoice=find(strcmp(subdir,menu_str),1); 3429 if isempty(ichoice) 3430 ilist=numel(menu_str); %select 'new...' in the menu 3431 else 3432 ilist=ichoice; 3433 end 3434 set(handles.list_subdir_civ2,'Value',ilist)% select the selected subdir in the menu 3317 3435 %update the list of available pairs from netcdf files in the new directory 3318 if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==03436 if ~get(handles.CIV2,'Value') && ~get(handles.CIV1,'Value') && ~get(handles.FIX1,'Value') && ~get(handles.PATCH1,'Value') 3319 3437 find_netcpair_civ2(hObject, eventdata, handles); 3320 3438 end … … 3588 3706 list_subdir_civ1=get(handles.list_subdir_civ1,'String'); 3589 3707 val=get(handles.list_subdir_civ1,'Value'); 3590 if val>1 3591 subdir=list_subdir_civ1{val}; 3592 set(handles.subdir_civ1,'String',subdir); 3593 set(handles.list_subdir_civ1,'Value',1); 3594 end 3708 subdir=list_subdir_civ1{val}; 3709 if strcmp(subdir,'new...') 3710 subdir='CIV'; %default subdirectory 3711 end 3712 set(handles.subdir_civ1,'String',subdir); 3713 find_netcpair_civ1(hObject, eventdata, handles) 3714 % end 3595 3715 3596 3716 %------------------------------------------------------------------------ … … 3600 3720 list_subdir_civ2=get(handles.list_subdir_civ2,'String'); 3601 3721 val=get(handles.list_subdir_civ2,'Value'); 3602 if val>1 3603 subdir=list_subdir_civ2{val}; 3604 set(handles.subdir_civ2,'String',subdir); 3605 set(handles.list_subdir_civ2,'Value',1); 3606 end 3722 subdir=list_subdir_civ2{val}; 3723 if strcmp(subdir,'new...') 3724 subdir='CIV'; %default subdirectory 3725 end 3726 set(handles.subdir_civ2,'String',subdir); 3727 % set(handles.list_subdir_civ2,'Value',1); 3728 3607 3729 3608 3730 %------------------------------------------------------------------------ … … 3736 3858 function enable_civ1(handles,state) 3737 3859 %------------------------------------------------------------------------ 3738 if isequal(state,'on') 3739 set(handles.frame_civ1,'BackgroundColor',[1 1 0]) 3740 set(handles.frame_para_civ1,'BackgroundColor',[1 1 0]) 3741 set(handles.frame_grid_civ1,'BackgroundColor',[1 1 0]) 3742 else 3743 set(handles.frame_civ1,'BackgroundColor',[0.831 0.816 0.784]) 3744 set(handles.frame_para_civ1,'BackgroundColor',[0.831 0.816 0.784]) 3745 set(handles.frame_grid_civ1,'BackgroundColor',[0.831 0.816 0.784]) 3746 end 3860 if state 3861 RootName=get(handles.RootName,'String'); 3862 if isempty(RootName) 3863 msgbox_uvmat('ERROR','No input file') 3864 return 3865 end 3866 set(handles.Civ1Panel,'Visible','on') 3867 set(handles.PairPanel,'Visible','on') 3868 % set(handles.frame_civ1,'BackgroundColor',[1 1 0]) 3869 % set(handles.frame_para_civ1,'BackgroundColor',[1 1 0]) 3870 % set(handles.frame_grid_civ1,'BackgroundColor',[1 1 0]) 3871 else 3872 set(handles.Civ1Panel,'Visible','off') 3873 % set(handles.frame_civ1,'BackgroundColor',[0.831 0.816 0.784]) 3874 % set(handles.frame_para_civ1,'BackgroundColor',[0.831 0.816 0.784]) 3875 % set(handles.frame_grid_civ1,'BackgroundColor',[0.831 0.816 0.784]) 3876 end 3877 return 3747 3878 set(handles.ibx,'Visible',state) 3748 3879 set(handles.iby,'Visible',state) … … 3754 3885 set(handles.dx_civ1,'Visible',state) 3755 3886 set(handles.dy_civ1,'Visible',state) 3756 set(handles. calcul_search,'Visible',state)3757 set(handles.u_t ext,'Visible',state)3758 set(handles.v_t ext,'Visible',state)3759 set(handles.min ,'Visible',state)3760 set(handles.max ,'Visible',state)3887 set(handles.SearchRange,'Visible',state) 3888 set(handles.u_title,'Visible',state) 3889 set(handles.v_title,'Visible',state) 3890 set(handles.min_title,'Visible',state) 3891 set(handles.max_title,'Visible',state) 3761 3892 set(handles.umin,'Visible',state) 3762 3893 set(handles.umax,'Visible',state) … … 3790 3921 function enable_fix1(handles,state) 3791 3922 %------------------------------------------------------------------------ 3923 3792 3924 if isequal(state,0) 3793 3925 state='off'; … … 3795 3927 if isequal(state,1) 3796 3928 state='on'; 3929 RootName=get(handles.RootName,'String'); 3930 if isempty(RootName) 3931 msgbox_uvmat('ERROR','No input file') 3932 return 3933 end 3797 3934 end 3798 3935 if isequal(state,'on') 3799 set(handles.frame_fix1,'BackgroundColor',[1 1 0]) 3800 else 3801 set(handles.frame_fix1,'BackgroundColor',[0.7 0.7 0.7]) 3802 end 3803 set(handles.REMOVE,'Visible',state) 3936 set(handles.Fix1Panel,'Visible','on') 3937 % set(handles.frame_fix1,'BackgroundColor',[1 1 0]) 3938 else 3939 set(handles.Fix1Panel,'Visible','off') 3940 %set(handles.frame_fix1,'BackgroundColor',[0.7 0.7 0.7]) 3941 end 3942 % set(handles.REMOVE,'Visible',state) 3804 3943 set(handles.vec_Fmin2,'Visible',state) 3805 3944 set(handles.vec_F2,'Visible',state) … … 3817 3956 3818 3957 %------------------------------------------------------------------------ 3819 function enable_patch1(handles) 3820 %------------------------------------------------------------------------ 3958 function enable_patch1(handles,state) 3959 %------------------------------------------------------------------------ 3960 if state 3961 RootName=get(handles.RootName,'String'); 3962 if isempty(RootName) 3963 msgbox_uvmat('ERROR','No input file') 3964 return 3965 end 3966 set(handles.Patch1Panel,'Visible','on') 3967 else 3968 set(handles.Patch1Panel,'Visible','off') 3969 end 3970 return 3821 3971 set(handles.frame_patch1,'BackgroundColor',[1 1 0]) 3822 3972 set(handles.rho_patch1,'Visible','on') … … 3829 3979 set(handles.subdomain_text1,'Visible','on') 3830 3980 set(handles.nx_patch1,'Visible','on') 3831 set(handles. ny_patch1,'Visible','on')3981 set(handles.Ny,'Visible','on') 3832 3982 set(handles.nx_patch1_title,'Visible','on') 3833 3983 set(handles.ny_patch1_title,'Visible','on') … … 3843 3993 %set(handles.grid_patch1,'Visible','on') 3844 3994 3845 %------------------------------------------------------------------------ 3846 function desable_patch1(handles) 3847 %------------------------------------------------------------------------ 3848 set(handles.frame_patch1,'BackgroundColor',[0.831 0.816 0.784]) 3849 set(handles.rho_patch1,'Visible','off') 3850 set(handles.rho_text1,'Visible','off') 3851 set(handles.thresh_patch1,'Visible','off') 3852 set(handles.thresh_text1,'Visible','off') 3853 set(handles.subdomain_patch1,'Visible','off') 3854 set(handles.subdomain_text1,'Visible','off') 3855 set(handles.nx_patch1,'Visible','off') 3856 set(handles.ny_patch1,'Visible','off') 3857 set(handles.nx_patch1_title,'Visible','off') 3858 set(handles.ny_patch1_title,'Visible','off') 3859 set(handles.test_stereo1,'Visible','off') 3860 %set(handles.test_interp,'Visible','off') 3861 %set(handles.get_gridpatch1,'Visible','off') 3862 %set(handles.grid_patch1,'Visible','off') 3995 % %------------------------------------------------------------------------ 3996 % function desable_patch1(handles) 3997 % %------------------------------------------------------------------------ 3998 % return 3999 % set(handles.frame_patch1,'BackgroundColor',[0.831 0.816 0.784]) 4000 % set(handles.rho_patch1,'Visible','off') 4001 % set(handles.rho_text1,'Visible','off') 4002 % set(handles.thresh_patch1,'Visible','off') 4003 % set(handles.thresh_text1,'Visible','off') 4004 % set(handles.subdomain_patch1,'Visible','off') 4005 % set(handles.subdomain_text1,'Visible','off') 4006 % set(handles.nx_patch1,'Visible','off') 4007 % set(handles.Ny,'Visible','off') 4008 % set(handles.nx_patch1_title,'Visible','off') 4009 % set(handles.ny_patch1_title,'Visible','off') 4010 % set(handles.test_stereo1,'Visible','off') 4011 % %set(handles.test_interp,'Visible','off') 4012 % %set(handles.get_gridpatch1,'Visible','off') 4013 % %set(handles.grid_patch1,'Visible','off') 3863 4014 3864 4015 %------------------------------------------------------------------------ 3865 4016 function enable_civ2(handles,state) 3866 4017 %------------------------------------------------------------------------ 3867 if isequal(state,0) 3868 state='off'; 3869 end 3870 if isequal(state,1) 3871 state='on'; 3872 end 3873 if isequal(state,'on') 3874 set(handles.frame_civ2,'BackgroundColor',[1 1 0]) 3875 set(handles.frame_para_civ2,'BackgroundColor',[1 1 0]) 3876 set(handles.frame_grid_civ2,'BackgroundColor',[1 1 0]) 3877 set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) 3878 else 3879 set(handles.frame_civ2,'BackgroundColor',[0.831 0.816 0.784]) 3880 set(handles.frame_para_civ2,'BackgroundColor',[0.831 0.816 0.784]) 3881 set(handles.frame_grid_civ2,'BackgroundColor',[0.831 0.816 0.784]) 3882 set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) 3883 end 4018 if state 4019 RootName=get(handles.RootName,'String'); 4020 if isempty(RootName) 4021 msgbox_uvmat('ERROR','No input file') 4022 return 4023 end 4024 set(handles.Civ2Panel,'Visible','on') 4025 else 4026 set(handles.Civ2Panel,'Visible','off') 4027 end 4028 return 4029 3884 4030 set(handles.ibx_civ2,'Visible',state) 3885 4031 set(handles.iby_civ2,'Visible',state) … … 3912 4058 set(handles.subdir_civ2_text,'Visible','off') 3913 4059 set(handles.dt_unit_civ2,'Visible','off') 3914 set(handles.ref_i_civ2,'Visible','off')4060 %set(handles.ref_i_civ2,'Visible','off') 3915 4061 set(handles.i_ref_civ2_title,'Visible','off') 3916 4062 set(handles.j_ref_civ2_title,'Visible','off') … … 3922 4068 set(handles.subdir_civ2_text,'Visible','on') 3923 4069 set(handles.dt_unit_civ2,'Visible','on') 3924 set(handles.ref_i_civ2,'Visible','on')4070 % set(handles.ref_i_civ2,'Visible','on') 3925 4071 set(handles.i_ref_civ2_title,'Visible','on') 3926 4072 set(handles.j_ref_civ2_title,'Visible','on') … … 3930 4076 3931 4077 %------------------------------------------------------------------------ 3932 function enable_fix2(handles) 3933 %------------------------------------------------------------------------ 4078 function enable_fix2(handles,state) 4079 %------------------------------------------------------------------------ 4080 % if isequal(state,'on') 4081 % set(handles.Fix2Panel,'Visible','on') 4082 % 4083 % % set(handles.frame_civ2,'BackgroundColor',[1 1 0]) 4084 % % set(handles.frame_para_civ2,'BackgroundColor',[1 1 0]) 4085 % % set(handles.frame_grid_civ2,'BackgroundColor',[1 1 0]) 4086 % % set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) 4087 % else 4088 if state 4089 RootName=get(handles.RootName,'String'); 4090 if isempty(RootName) 4091 msgbox_uvmat('ERROR','No input file') 4092 return 4093 end 4094 set(handles.Fix2Panel,'Visible','on') 4095 else 4096 set(handles.Fix2Panel,'Visible','off') 4097 end 4098 return 3934 4099 set(handles.frame_fix2,'BackgroundColor',[1 1 0]) 3935 4100 set(handles.REMOVE2,'Visible','on') … … 3951 4116 set(handles.field_ref2,'Visible','on') 3952 4117 3953 %------------------------------------------------------------------------ 3954 function desable_fix2(handles) 3955 %------------------------------------------------------------------------ 3956 set(handles.frame_fix2,'BackgroundColor',[0.831 0.816 0.784]) 3957 set(handles.REMOVE2,'Visible','off') 3958 set(handles.vec_Fmin2_2,'Visible','off') 3959 set(handles.vec_F4,'Visible','off') 3960 set(handles.vec_F3_2,'Visible','off') 3961 set(handles.thresh_vec2C,'Visible','off') 3962 set(handles.thresh_vec2C_text,'Visible','off') 3963 set(handles.thresh_vel2,'Visible','off') 3964 set(handles.thresh_vel2_text,'Visible','off') 3965 set(handles.mask_fix2,'Visible','off') 3966 set(handles.get_mask_fix2,'Visible','off') 3967 set(handles.get_ref_fix2,'Visible','off') 3968 set(handles.ref_fix2,'Visible','off') 3969 set(handles.inf_sup2,'Visible','off') 3970 set(handles.field_ref2,'Visible','off') 3971 if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) 3972 set(handles.list_pair_civ2,'Visible','off') 3973 set(handles.subdir_civ2,'Visible','off') 3974 set(handles.subdir_civ2_text,'Visible','off') 3975 end 3976 3977 %------------------------------------------------------------------------ 3978 function enable_patch2(handles) 3979 %------------------------------------------------------------------------ 3980 set(handles.frame_patch2,'BackgroundColor',[1 1 0]) 3981 set(handles.rho_patch2,'Visible','on') 3982 set(handles.rho_text2,'Visible','on') 3983 set(handles.thresh_patch2,'Visible','on') 3984 set(handles.thresh_text2,'Visible','on') 3985 set(handles.subdomain_patch2,'Visible','on') 3986 set(handles.subdomain_text2,'Visible','on') 3987 set(handles.nx_patch2,'Visible','on') 3988 set(handles.ny_patch2,'Visible','on') 3989 set(handles.nx_patch2_title,'Visible','on') 3990 set(handles.ny_patch2_title,'Visible','on') 3991 % set(handles.get_gridpatch2,'Visible','on') 3992 % set(handles.grid_patch2,'Visible','on') 3993 set(handles.list_pair_civ2,'Visible','on') 3994 set(handles.subdir_civ2,'Visible','on') 3995 set(handles.subdir_civ2_text,'Visible','on') 3996 stereo_test=get(handles.compare,'Value'); 3997 if stereo_test==3 3998 set(handles.test_stereo2,'Visible','on') 3999 end 4000 4001 %------------------------------------------------------------------------ 4002 function desable_patch2(handles) 4003 %------------------------------------------------------------------------ 4004 set(handles.frame_patch2,'BackgroundColor',[0.831 0.816 0.784]) 4005 set(handles.rho_patch2,'Visible','off') 4006 set(handles.rho_text2,'Visible','off') 4007 set(handles.thresh_patch2,'Visible','off') 4008 set(handles.thresh_text2,'Visible','off') 4009 set(handles.subdomain_patch2,'Visible','off') 4010 set(handles.subdomain_text2,'Visible','off') 4011 set(handles.nx_patch2,'Visible','off') 4012 set(handles.ny_patch2,'Visible','off') 4013 set(handles.nx_patch2_title,'Visible','off') 4014 set(handles.ny_patch2_title,'Visible','off') 4015 % set(handles.get_gridpatch2,'Visible','off') 4016 % set(handles.grid_patch2,'Visible','off') 4017 if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0) 4018 set(handles.list_pair_civ2,'Visible','off') 4019 set(handles.subdir_civ2,'Visible','off') 4020 set(handles.subdir_civ2_text,'Visible','off') 4021 end 4022 set(handles.test_stereo2,'Visible','off') 4118 % %------------------------------------------------------------------------ 4119 % function desable_fix2(handles) 4120 % %------------------------------------------------------------------------ 4121 % set(handles.frame_fix2,'BackgroundColor',[0.831 0.816 0.784]) 4122 % set(handles.REMOVE2,'Visible','off') 4123 % set(handles.vec_Fmin2_2,'Visible','off') 4124 % set(handles.vec_F4,'Visible','off') 4125 % set(handles.vec_F3_2,'Visible','off') 4126 % set(handles.thresh_vec2C,'Visible','off') 4127 % set(handles.thresh_vec2C_text,'Visible','off') 4128 % set(handles.thresh_vel2,'Visible','off') 4129 % set(handles.thresh_vel2_text,'Visible','off') 4130 % set(handles.mask_fix2,'Visible','off') 4131 % set(handles.get_mask_fix2,'Visible','off') 4132 % set(handles.get_ref_fix2,'Visible','off') 4133 % set(handles.ref_fix2,'Visible','off') 4134 % set(handles.inf_sup2,'Visible','off') 4135 % set(handles.field_ref2,'Visible','off') 4136 % if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) 4137 % set(handles.list_pair_civ2,'Visible','off') 4138 % set(handles.subdir_civ2,'Visible','off') 4139 % set(handles.subdir_civ2_text,'Visible','off') 4140 % end 4141 4142 %------------------------------------------------------------------------ 4143 function enable_patch2(handles,state) 4144 %------------------------------------------------------------------------ 4145 if state 4146 RootName=get(handles.RootName,'String'); 4147 if isempty(RootName) 4148 msgbox_uvmat('ERROR','No input file') 4149 return 4150 end 4151 set(handles.Patch2Panel,'Visible','on') 4152 else 4153 set(handles.Patch2Panel,'Visible','off') 4154 end 4155 % set(handles.frame_patch2,'BackgroundColor',[1 1 0]) 4156 % set(handles.SmoothParam,'Visible','on') 4157 % set(handles.SmoothingParam,'Visible','on') 4158 % set(handles.MaxDiff,'Visible','on') 4159 % set(handles.thresh_text2,'Visible','on') 4160 % set(handles.SubdomainSize,'Visible','on') 4161 % set(handles.subdomain_text2,'Visible','on') 4162 % set(handles.Nx,'Visible','on') 4163 % set(handles.Ny,'Visible','on') 4164 % set(handles.nx_patch2_title,'Visible','on') 4165 % set(handles.ny_patch2_title,'Visible','on') 4166 % % set(handles.get_gridpatch2,'Visible','on') 4167 % % set(handles.grid_patch2,'Visible','on') 4168 % set(handles.list_pair_civ2,'Visible','on') 4169 % set(handles.subdir_civ2,'Visible','on') 4170 % set(handles.subdir_civ2_text,'Visible','on') 4171 % stereo_test=get(handles.compare,'Value'); 4172 % if stereo_test==3 4173 % set(handles.StereoCheck,'Visible','on') 4174 % end 4175 4176 % %------------------------------------------------------------------------ 4177 % function desable_patch2(handles) 4178 % %------------------------------------------------------------------------ 4179 % %set(handles.Patch2Panel,'Visible','off') 4180 % return 4181 % set(handles.frame_patch2,'BackgroundColor',[0.831 0.816 0.784]) 4182 % set(handles.SmoothParam,'Visible','off') 4183 % set(handles.SmoothingParam,'Visible','off') 4184 % set(handles.MaxDiff,'Visible','off') 4185 % set(handles.thresh_text2,'Visible','off') 4186 % set(handles.SubdomainSize,'Visible','off') 4187 % set(handles.subdomain_text2,'Visible','off') 4188 % set(handles.Nx,'Visible','off') 4189 % set(handles.Ny,'Visible','off') 4190 % set(handles.nx_patch2_title,'Visible','off') 4191 % set(handles.ny_patch2_title,'Visible','off') 4192 % % set(handles.get_gridpatch2,'Visible','off') 4193 % % set(handles.grid_patch2,'Visible','off') 4194 % if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0) 4195 % set(handles.list_pair_civ2,'Visible','off') 4196 % set(handles.subdir_civ2,'Visible','off') 4197 % set(handles.subdir_civ2_text,'Visible','off') 4198 % end 4199 % set(handles.StereoCheck,'Visible','off') 4023 4200 %------------------------------------------------------------------------ 4024 4201 function enable_pair1(handles,state) … … 4027 4204 set(handles.list_subdir_civ1,'Visible',state) 4028 4205 set(handles.SUBDIR_CIV1_txt,'Visible',state) 4029 set(handles.frame_subdirciv1,'Visible',state)4206 %set(handles.frame_subdirciv1,'Visible',state) 4030 4207 set(handles.list_pair_civ1,'Visible',state) 4031 set(handles.P AIR_txt,'Visible',state)4208 set(handles.PairCiv1_title,'Visible',state) 4032 4209 %set(handles.dt_unit,'Visible',state) 4033 set(handles.PAIR_frame,'Visible',state)4210 %set(handles.PAIR_frame,'Visible',state) 4034 4211 4035 4212 %------------------------------------------------------------------------ … … 4432 4609 4433 4610 %------------------------------------------------------------------------ 4434 % --- Executes on button press in HELP.4435 function HELP_Callback(hObject, eventdata, handles)4436 %------------------------------------------------------------------------4437 path_to_uvmat=which ('uvmat');% check the path of uvmat4438 pathelp=fileparts(path_to_uvmat);4439 helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html');4440 if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package')4441 else4442 addpath (fullfile(pathelp,'uvmat_doc'))4443 web([helpfile '#civ'])4444 end4445 4446 %------------------------------------------------------------------------4447 4611 %--read images and convert them to the uint16 format used for PIV 4448 4612 function A=read_image(filename,type_ima,num,movieobject) … … 4469 4633 function ref_i_Callback(hObject, eventdata, handles) 4470 4634 %------------------------------------------------------------------------ 4471 mode_list=get(handles. mode,'String');4472 mode_value=get(handles. mode,'Value');4635 mode_list=get(handles.CivMode,'String'); 4636 mode_value=get(handles.CivMode,'Value'); 4473 4637 mode=mode_list{mode_value}; 4474 4638 find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files … … 4481 4645 function ref_j_Callback(hObject, eventdata, handles) 4482 4646 %------------------------------------------------------------------------ 4483 mode_list=get(handles. mode,'String');4484 mode_value=get(handles. mode,'Value');4647 mode_list=get(handles.CivMode,'String'); 4648 mode_value=get(handles.CivMode,'Value'); 4485 4649 mode=mode_list{mode_value}; 4486 4650 if isequal(get(handles.CIV1,'Value'),0)|| isequal(mode,'series(Dj)') … … 4495 4659 function ref_i_civ2_Callback(hObject, eventdata, handles) 4496 4660 %------------------------------------------------------------------------ 4497 mode_list=get(handles. mode,'String');4498 mode_value=get(handles. mode,'Value');4661 mode_list=get(handles.CivMode,'String'); 4662 mode_value=get(handles.CivMode,'Value'); 4499 4663 mode=mode_list{mode_value}; 4500 4664 find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files … … 4503 4667 function ref_j_civ2_Callback(hObject, eventdata, handles) 4504 4668 %------------------------------------------------------------------------ 4505 mode_list=get(handles. mode,'String');4506 mode_value=get(handles. mode,'Value');4669 mode_list=get(handles.CivMode,'String'); 4670 mode_value=get(handles.CivMode,'Value'); 4507 4671 mode=mode_list{mode_value}; 4508 4672 if isequal(mode,'series(Dj)') … … 4517 4681 if test==2 || test==3 % case 'dispalcemen' or 'stereo PIV' 4518 4682 filebase=get(handles.RootName,'String'); 4519 browse=get(handles .browse_root,'Userdata');4683 browse=get(handlesRootName,'Userdata'); 4520 4684 browse.nom_type_ima1=browse.nom_type_ima; 4521 set(handles .browse_root,'UserData',browse);4685 set(handlesRootName,'UserData',browse); 4522 4686 set(handles.sub_txt,'Visible','on') 4523 4687 set(handles.RootName_1,'Visible','On');%mkes the second file input window visible 4524 mode_store=get(handles. mode,'String');%get the present 'mode'4688 mode_store=get(handles.CivMode,'String');%get the present 'mode' 4525 4689 set(handles.compare,'UserData',mode_store);%store the mode display 4526 set(handles. mode,'Visible','off')4690 set(handles.CivMode,'Visible','off') 4527 4691 if test==2 4528 set(handles. mode,'Visible','off')4692 set(handles.CivMode,'Visible','off') 4529 4693 set(handles.CivMode,'Value',1) % mode 'civX' selected by default 4530 4694 else 4531 set(handles. mode,'Visible','on')4695 set(handles.CivMode,'Visible','on') 4532 4696 set(handles.CivMode,'Value',3) % mode 'Matlab' selected for stereo 4533 4697 end 4534 4698 4535 %% open an image file with the browser4699 %% menuopen an image file with the browser 4536 4700 ind_opening=1;%default 4537 4701 browse.incr_pair=[0 0]; %default … … 4563 4727 [RootPath,RootFile,field_count,str2,str_a,str_b,xx,nom_type,subdir]=name2display(name); 4564 4728 set(handles.RootName_1,'String',RootFile); 4565 browse=get(handles .browse_root,'UserData');4729 browse=get(handlesRootName,'UserData'); 4566 4730 browse.nom_type_ima_1=nom_type; 4567 set(handles .browse_root,'UserData',browse)4731 set(handlesRootName,'UserData',browse) 4568 4732 4569 4733 %check image extension … … 4586 4750 % end 4587 4751 else 4588 set(handles. mode,'Visible','on')4752 set(handles.CivMode,'Visible','on') 4589 4753 set(handles.RootName_1,'Visible','Off'); 4590 4754 set(handles.sub_txt,'Visible','off') 4591 4755 set(handles.RootName_1,'String',[]); 4592 4756 mode_store=get(handles.compare,'UserData'); 4593 set(handles. mode,'Value',1)4594 set(handles. mode,'String',mode_store)4757 set(handles.CivMode,'Value',1) 4758 set(handles.CivMode,'String',mode_store) 4595 4759 set(handles.test_stereo1,'Value',0) 4596 set(handles. test_stereo2,'Value',0)4760 set(handles.StereoCheck,'Value',0) 4597 4761 set(handles.CivMode,'Value',1) % mode 'civX' selected by default 4598 4762 end … … 4603 4767 end 4604 4768 if test==3 && get(handles.PATCH2,'Value') 4605 set(handles. test_stereo2,'Visible','on')4606 else 4607 set(handles. test_stereo2,'Visible','off')4769 set(handles.StereoCheck,'Visible','on') 4770 else 4771 set(handles.StereoCheck,'Visible','off') 4608 4772 end 4609 4773 mode_Callback(hObject, eventdata, handles) … … 4736 4900 4737 4901 %------------------------------------------------------------------------ 4738 % --- Executes on button press in test_stereo2.4739 function test_stereo2_Callback(hObject, eventdata, handles)4740 %------------------------------------------------------------------------ 4741 if isequal(get(handles. test_stereo2,'Value'),0)4742 set(handles. subdomain_patch2,'Visible','on')4743 set(handles. rho_patch2,'Visible','on')4744 else 4745 set(handles. subdomain_patch2,'Visible','off')4746 set(handles. rho_patch2,'Visible','off')4902 % --- Executes on button press in StereoCheck. 4903 function StereoCheck_Callback(hObject, eventdata, handles) 4904 %------------------------------------------------------------------------ 4905 if isequal(get(handles.StereoCheck,'Value'),0) 4906 set(handles.SubdomainSize,'Visible','on') 4907 set(handles.SmoothParam,'Visible','on') 4908 else 4909 set(handles.SubdomainSize,'Visible','off') 4910 set(handles.SmoothParam,'Visible','off') 4747 4911 end 4748 4912 … … 4786 4950 end 4787 4951 [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]=... 4788 set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]) 4952 set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]); 4789 4953 Data.ListVarName={'ny','nx','A'}; 4790 4954 Data.VarDimName={'ny','nx',{'ny','nx'}}; … … 5010 5174 5011 5175 %------------------------------------------------------------------------ 5012 % --- Executes on button press in CivMode. 5013 function CivMode_Callback(hObject, eventdata, handles) 5014 %------------------------------------------------------------------------ 5015 Listprog=get(handles.CivMode,'String'); 5016 index=get(handles.CivMode,'Value'); 5017 prog=Listprog{index}; 5018 switch prog 5019 case 'CivX' 5020 set(handles.thresh_patch1,'Visible','off') 5021 set(handles.thresh_text1,'Visible','off') 5022 set(handles.thresh_patch2,'Visible','off') 5023 set(handles.thresh_text2,'Visible','off') 5024 set(handles.rho,'Style','edit') 5025 set(handles.rho,'String','1') 5026 set(handles.BATCH,'Enable','on') 5027 case 'CivAll' 5028 if get(handles.PATCH1,'Value') 5029 set(handles.thresh_patch1,'Visible','on') 5030 set(handles.thresh_text1,'Visible','on') 5031 end 5032 set(handles.rho,'Style','edit') 5033 set(handles.rho,'String','1') 5034 set(handles.BATCH,'Enable','on') 5035 case 'CivUvmat' 5036 if get(handles.PATCH1,'Value') 5037 set(handles.thresh_patch1,'Visible','on') 5038 set(handles.thresh_text1,'Visible','on') 5039 end 5040 if get(handles.PATCH2,'Value') 5041 set(handles.thresh_patch2,'Visible','on') 5042 set(handles.thresh_text2,'Visible','on') 5043 end 5044 set(handles.rho,'Style','popupmenu') 5045 set(handles.rho,'Value',1) 5046 set(handles.rho,'String',{'1';'2'}) 5047 set(handles.BATCH,'Enable','off') 5048 end 5176 % % --- Executes on button press in CivMode. 5177 % function CivMode_Callback(hObject, eventdata, handles) 5178 % %------------------------------------------------------------------------ 5179 % Listprog=get(handles.CivMode,'String'); 5180 % index=get(handles.CivMode,'Value'); 5181 % prog=Listprog{index}; 5182 % switch prog 5183 % case 'CivX' 5184 % set(handles.thresh_patch1,'Visible','off') 5185 % set(handles.thresh_text1,'Visible','off') 5186 % set(handles.MaxDiff,'Visible','off') 5187 % set(handles.thresh_text2,'Visible','off') 5188 % set(handles.rho,'Style','edit') 5189 % set(handles.rho,'String','1') 5190 % set(handles.BATCH,'Enable','on') 5191 % case 'CivAll' 5192 % if get(handles.PATCH1,'Value') 5193 % set(handles.thresh_patch1,'Visible','on') 5194 % set(handles.thresh_text1,'Visible','on') 5195 % end 5196 % set(handles.rho,'Style','edit') 5197 % set(handles.rho,'String','1') 5198 % set(handles.BATCH,'Enable','on') 5199 % case 'CivUvmat' 5200 % 5201 % end 5202 5203 5204 % --- Executes on button press in checkbox42. 5205 function checkbox42_Callback(hObject, eventdata, handles) 5206 % hObject handle to checkbox42 (see GCBO) 5207 % eventdata reserved - to be defined in a future version of MATLAB 5208 % handles structure with handles and user data (see GUIDATA) 5209 5210 % Hint: get(hObject,'Value') returns toggle state of checkbox42 5211 5212 5213 5214 function SubdomainSize_Callback(hObject, eventdata, handles) 5215 % hObject handle to SubdomainSize (see GCBO) 5216 % eventdata reserved - to be defined in a future version of MATLAB 5217 % handles structure with handles and user data (see GUIDATA) 5218 5219 % Hints: get(hObject,'String') returns contents of SubdomainSize as text 5220 % str2double(get(hObject,'String')) returns contents of SubdomainSize as a double 5221 5222 5223 5224 function SmoothingParam_Callback(hObject, eventdata, handles) 5225 % hObject handle to SmoothingParam (see GCBO) 5226 % eventdata reserved - to be defined in a future version of MATLAB 5227 % handles structure with handles and user data (see GUIDATA) 5228 5229 % Hints: get(hObject,'String') returns contents of SmoothingParam as text 5230 % str2double(get(hObject,'String')) returns contents of SmoothingParam as a double 5231 5232 5233 5234 function MaxDiff_Callback(hObject, eventdata, handles) 5235 % hObject handle to MaxDiff (see GCBO) 5236 % eventdata reserved - to be defined in a future version of MATLAB 5237 % handles structure with handles and user data (see GUIDATA) 5238 5239 % Hints: get(hObject,'String') returns contents of MaxDiff as text 5240 % str2double(get(hObject,'String')) returns contents of MaxDiff as a double 5241 5242 5243 function Nx_Callback(hObject, eventdata, handles) 5244 % hObject handle to Nx (see GCBO) 5245 % eventdata reserved - to be defined in a future version of MATLAB 5246 % handles structure with handles and user data (see GUIDATA) 5247 5248 % Hints: get(hObject,'String') returns contents of Nx as text 5249 % str2double(get(hObject,'String')) returns contents of Nx as a double 5250 5251 5252 function Ny_Callback(hObject, eventdata, handles) 5253 % hObject handle to Ny (see GCBO) 5254 % eventdata reserved - to be defined in a future version of MATLAB 5255 % handles structure with handles and user data (see GUIDATA) 5256 5257 % Hints: get(hObject,'String') returns contents of Ny as text 5258 % str2double(get(hObject,'String')) returns contents of Ny as a double 5259 5260 5261 % -------------------------------------------------------------------- 5262 function MenuHelp_Callback(hObject, eventdata, handles) 5263 path_to_uvmat=which ('uvmat');% check the path of uvmat 5264 pathelp=fileparts(path_to_uvmat); 5265 helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html'); 5266 if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package') 5267 else 5268 addpath (fullfile(pathelp,'uvmat_doc')) 5269 web([helpfile '#civ']) 5270 end 5271 5272 % -------------------------------------------------------------------- 5273 function CivX_Callback(hObject, eventdata, handles) 5274 %set(handles.thresh_patch1,'Visible','off') 5275 set(handles.thresh_text1,'Visible','off') 5276 set(handles.MaxDiff,'Visible','off') 5277 set(handles.thresh_text2,'Visible','off') 5278 set(handles.rho,'Style','edit') 5279 set(handles.rho,'String','1') 5280 set(handles.BATCH,'Enable','on') 5281 5282 % -------------------------------------------------------------------- 5283 function Matlab_Callback(hObject, eventdata, handles) 5284 set(handles.Matlab,'checked','on') 5285 set(handles.CivX,'checked','off') 5286 if get(handles.PATCH1,'Value') 5287 set(handles.thresh_patch1,'Visible','on') 5288 set(handles.thresh_text1,'Visible','on') 5289 end 5290 if get(handles.PATCH2,'Value') 5291 set(handles.MaxDiff,'Visible','on') 5292 set(handles.thresh_text2,'Visible','on') 5293 end 5294 set(handles.rho,'Style','popupmenu') 5295 set(handles.rho,'Value',1) 5296 set(handles.rho,'String',{'1';'2'}) 5297 set(handles.BATCH,'Enable','off') 5298 5299 % -------------------------------------------------------------------- 5300 % --- read a panel with handle 'handle' producing a structure 'struct' 5301 function struct=read_panel(handle) 5302 hchild=get(handle,'children'); 5303 for ichild=1:numel(hchild) 5304 object_style=get(hchild(ichild),'Style'); 5305 check_input=1;%default 5306 switch object_style 5307 case 'edit' 5308 input=str2double(get(hchild(ichild),'String')); 5309 %deal with undefined input: retrieve the default value stored as UserData 5310 if isnan(input) 5311 input=get(hchild(ichild),'UserData'); 5312 set(hchild(ichild),'String',num2str(input)) 5313 end 5314 case 'checkbox' 5315 input=get(hchild(ichild),'Value'); 5316 otherwise 5317 check_input=0; 5318 5319 end 5320 if check_input 5321 eval(['struct.' get(hchild(ichild),'tag') '=input;']) 5322 end 5323 end -
trunk/src/civ_uvmat.m
r270 r273 544 544 545 545 546 547 548 % U_patch = EM * spline_coeff;549 % U_patch=reshape(U_patch,npy,npx);550 % PM = [ones(size(dsites,1),1) dsites];551 % EM = [IM_sites PM];552 % U(test_false)=[];553 % U_nodes=EM * spline_coeff;554 555 %exact = testfunctions(epoints);556 %maxerr = norm(Pf-exact,inf);557 % PlotSurf(xe,ye,Pf,neval,exact,maxerr,[160,20]);558 % PlotError2D(xe,ye,Pf,exact,maxerr,neval,[160,20]);559 560 561 562 % DM = DistanceMatrix(dsites,ctrs)563 % Forms the distance matrix of two sets of points in R^s,564 % i.e., DM(i,j) = || datasite_i - center_j ||_2.565 % Input566 % dsites: Mxs matrix representing a set of M data sites in R^s567 % (i.e., each row contains one s-dimensional point)568 % ctrs: Nxs matrix representing a set of N centers in R^s569 % (one center per row)570 % Output571 572 573 574 -
trunk/src/pivlab.m
r248 r273 62 62 end 63 63 64 %% calculate correlations: MAINLOOP 64 %% calculate correlations: MAINLOOP on velocity vectors 65 65 corrmax=0; 66 66 sum_square=1;% default 67 for ivec=1:nbvec 67 for ivec=1:nbvec 68 68 iref=GridIndices(ivec,1); 69 69 jref=GridIndices(ivec,2); … … 82 82 end 83 83 end 84 if ~test0 85 image1_crop=image1(jref-iby2:jref+iby2,iref-ibx2:iref+ibx2); 86 image2_crop=image2(jref+shifty-isy2:jref+shifty+isy2,iref+shiftx-isx2:iref+shiftx+isx2); 87 image1_crop=image1_crop-mean(mean(image1_crop)); 84 if ~test0 85 image1_crop=image1(jref-iby2:jref+iby2,iref-ibx2:iref+ibx2);%extract a subimage (correlation box) from images 1 86 image2_crop=image2(jref+shifty-isy2:jref+shifty+isy2,iref+shiftx-isx2:iref+shiftx+isx2);%extract a larger subimage (search box) from image 2 87 image1_crop=image1_crop-mean(mean(image1_crop));%substract the mean 88 88 image2_crop=image2_crop-mean(mean(image2_crop)); 89 89 %reference: Oliver Pust, PIV: Direct Cross-Correlation -
trunk/src/read_field.m
r254 r273 49 49 if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist 50 50 Data=nc2struct(ObjectName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ'); 51 % case of new civdata conventions 51 52 if isequal(Data.Conventions,'uvmat/civdata') 52 53 ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default … … 55 56 [Field,ParamOut.VelType]=read_civdata(ObjectName,InputField,ParamIn.VelType); 56 57 test_civx=Field.CivStage; 58 %case of old civx conventions 57 59 elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0) 58 60 ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default … … 62 64 test_civx=Field.CivStage; 63 65 ParamOut.CivStage=Field.CivStage; 64 else % not cvix file, fields will be chosen through the GUI get_field 66 % not cvix file, fields will be chosen through the GUI get_field 67 else 65 68 ParamOut.FieldName='get_field...'; 66 69 hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI -
trunk/src/tps_eval.m
r246 r273 1 % DM: MxN matrix whose i,j position contains the Euclidean1 % EM: MxN matrix whose i,j position contains the Euclidean 2 2 % distance between the i-th data site and j-th center 3 3 function EM = tps_eval(dsites,ctrs)
Note: See TracChangeset
for help on using the changeset viewer.