- Timestamp:
- Jan 14, 2012, 1:44:13 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r370 r371 23 23 %TODO: search range 24 24 25 % Last Modified by GUIDE v2.5 1 3-Jan-2012 08:01:2025 % Last Modified by GUIDE v2.5 14-Jan-2012 00:46:29 26 26 % Begin initialization code - DO NOT EDIT 27 27 gui_Singleton = 1; … … 102 102 %% prepare the GUI with parameters from the input file if opened from uvmat 103 103 if exist('fileinput','var')% && isfield(param,'RootName') && ~isempty(param.RootName) 104 set(handles.Root Name,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding104 set(handles.RootPath,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding 105 105 errormsg=display_file_name(handles,fileinput); 106 106 if ~isempty(errormsg) 107 107 msgbox_uvmat('ERROR',errormsg) 108 108 end 109 set(handles.Root Name,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished109 set(handles.RootPath,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished 110 110 end 111 111 … … 122 122 %------------------------------------------------------------------------ 123 123 %% get the current input root file name to initiate the browser 124 filebase=get(handles.Root Name,'String');124 filebase=get(handles.RootPath,'String'); 125 125 oldfile=''; %default 126 126 if isempty(filebase)|| isequal(filebase,'')%loads the previously stored root file name … … 183 183 184 184 %% prepare the GUI with parameters from the input file 185 set(handles.Root Name,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding185 set(handles.RootPath,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding 186 186 errormsg=display_file_name(handles,fileinput); 187 187 if ~isempty(errormsg) 188 188 msgbox_uvmat('ERROR',erromsg) 189 189 end 190 set(handles.Root Name,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished190 set(handles.RootPath,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished 191 191 192 192 %------------------------------------------------------------------------ … … 194 194 function MenuFile_1_Callback(hObject, eventdata, handles) 195 195 %------------------------------------------------------------------------ 196 set(handles.Root Name,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding196 set(handles.RootPath,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding 197 197 fileinput=get(handles.MenuFile_1,'Label'); 198 198 errormsg=display_file_name(handles,fileinput); … … 200 200 msgbox_uvmat('ERROR',errormsg) 201 201 end 202 set(handles.Root Name,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished202 set(handles.RootPath,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished 203 203 204 204 % ----------------------------------------------------------------------- … … 206 206 function MenuFile_2_Callback(hObject, eventdata, handles) 207 207 %------------------------------------------------------------------------ 208 set(handles.Root Name,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding208 set(handles.RootPath,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding 209 209 fileinput=get(handles.MenuFile_2,'Label'); 210 210 errormsg=display_file_name(handles,fileinput); … … 212 212 msgbox_uvmat('ERROR',errormsg) 213 213 end 214 set(handles.Root Name,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished214 set(handles.RootPath,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished 215 215 216 216 % ----------------------------------------------------------------------- … … 218 218 function MenuFile_3_Callback(hObject, eventdata, handles) 219 219 %------------------------------------------------------------------------ 220 set(handles.Root Name,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding220 set(handles.RootPath,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding 221 221 fileinput=get(handles.MenuFile_3,'Label'); 222 222 errormsg=display_file_name(handles,fileinput); … … 224 224 msgbox_uvmat('ERROR',errormsg) 225 225 end 226 set(handles.Root Name,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished226 set(handles.RootPath,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished 227 227 228 228 % ----------------------------------------------------------------------- … … 230 230 function MenuFile_4_Callback(hObject, eventdata, handles) 231 231 %------------------------------------------------------------------------ 232 set(handles.Root Name,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding232 set(handles.RootPath,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding 233 233 fileinput=get(handles.MenuFile_4,'Label'); 234 234 errormsg=display_file_name(handles,fileinput); … … 236 236 msgbox_uvmat('ERROR',errormsg) 237 237 end 238 set(handles.Root Name,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished238 set(handles.RootPath,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished 239 239 240 240 % ----------------------------------------------------------------------- … … 242 242 function MenuFile_5_Callback(hObject, eventdata, handles) 243 243 %------------------------------------------------------------------------ 244 set(handles.Root Name,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding244 set(handles.RootPath,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding 245 245 fileinput=get(handles.MenuFile_5,'Label'); 246 246 errormsg=display_file_name(handles,fileinput); … … 248 248 msgbox_uvmat('ERROR',errormsg) 249 249 end 250 set(handles.Root Name,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished250 set(handles.RootPath,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished 251 251 252 252 % ----------------------------------------------------------------------- … … 266 266 %------------------------------------------------------------------------ 267 267 % --- Function activated when a new filebase (image series) is introduced 268 function RootName_Callback(hObject, eventdata, handles) 269 %------------------------------------------------------------------------ 270 set(handles.RootName,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding 271 [RootPath,RootFile]=fileparts(get(handles.RootName,'String')); 268 function RootPath_Callback(hObject, eventdata, handles) 269 %------------------------------------------------------------------------ 270 set(handles.RootPath,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding 271 RootPath=get(handles.RootPath,'String'); 272 RootFile=get(handles.RootFile,'String'); 272 273 ref_i=str2num(get(handles.ref_i,'String')); 273 274 ref_j=str2num(get(handles.ref_j,'String')); … … 279 280 msgbox_uvmat('ERROR',errormsg) 280 281 end 281 set(handles.Root Name,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished282 set(handles.RootPath,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished 282 283 %------------------------------------------------------------------------ 283 284 % --- general function activated for an input file series … … 311 312 if strcmp(ExtInput,'.nc') 312 313 NomTypeNc=NomTypeInput; 313 Data=nc2struct(fileinput,'ListGlobalAttribute','Conventions','absolut_time_T0','CivStage','Civ2_ImageA','Civ1_ImageA','fix','patch','civ2','fix2'); 314 if isempty(regexp(NomTypeInput,'[ab|AB|-]')) 315 set(handles.ListCompareMode,'Value',2) %mode displacement advised if the nomencalture does not involve index pairs 316 [RootPath,SubDir]=fileparts(RootPath); 317 set(handles.RootFile_1,'Visible','On'); 318 else 319 set(handles.ListCompareMode,'Value',1) 320 set(handles.RootFile_1,'Visible','Off'); 321 end 322 Data=nc2struct(fileinput,'ListGlobalAttribute','Conventions','absolut_time_T0','CivStage','Civ2_ImageA','Civ1_ImageA','Civ2_ImageB','Civ1_ImageB','fix','patch','civ2','fix2'); 314 323 if isfield(Data,'Txt') 315 324 errormsg=Data.Txt; … … 322 331 ind_opening=Data.CivStage; 323 332 end 324 if ~isempty(Data.Civ2_ImageA)%get the corresponding input image in the netcdf file 325 imageinput=Data.Civ1_ImageA; 326 elseif ~isempty(Data.Civ1_ImageA) 327 imageinput=Data.Civ1_ImageA; 328 end 333 if ~isempty(Data.Civ2_ImageB)%get the corresponding input image in the netcdf file 334 imageinput=Data.Civ2_ImageB; 335 [tild,ImaName,ImaExt]=fileparts(Data.Civ2_ImageA); 336 set(handles.RootFile_1,'String',[ImaName ImaExt]) 337 elseif ~isempty(Data.Civ1_ImageB) 338 imageinput=Data.Civ1_ImageB; 339 [tild,ImaName,ImaExt]=fileparts(Data.Civ1_ImageA); 340 set(handles.RootFile_1,'String',[ImaName ImaExt]) 341 end 342 329 343 elseif ~isempty(Data.absolut_time_T0')% case of civx data, 330 344 set(handles.ListProgram,'Value',1) %select Cix by default … … 361 375 end 362 376 363 % % scan the image series when a nc file has been opened377 %no corresponding image found, select manually with the browser 364 378 ImaExt=ExtInput; 365 379 if ~isempty(NomTypeNc) … … 377 391 end 378 392 fileinput=imageinput; 379 [tild, tild,ImaExt]=fileparts(imageinput); 380 end 381 [RootPath,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,Object]=find_file_series(fileinput); 393 end 394 395 %% scan the image file series 396 [RootPath,FileName,ImaExt]=fileparts(fileinput); 397 [RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,Object]=find_file_series(RootPath,[FileName ImaExt]); 382 398 if strcmp(NomTypeInput,'*')% movies will be opened at the first frame 383 399 i1=1; … … 392 408 return 393 409 end 394 RootName=fullfile(RootPath,RootFile); 395 set(handles.RootName,'String',RootName) 396 browse=get(handles.RootName,'UserData'); 410 % RootName=fullfile(RootPath,RootFile); 411 set(handles.RootPath,'String',RootPath) 412 set(handles.RootFile,'String',RootFile) 413 browse=get(handles.RootPath,'UserData'); 397 414 % browse.nom_type_nc=NomTypeNc; 398 415 browse.incr_pair=[0 0];%default … … 409 426 410 427 %% scan the images if a civ file has been opened 411 if ~isempty(NomTypeNc)412 [RootPath,tild,i1_series,tild,j1_series,tild,NomTypeIma,ImageType,Object]=find_file_series(imageinput);413 end428 % if ~isempty(NomTypeNc) 429 % [tild,i1_series,tild,j1_series,tild,NomTypeIma,ImageType,Object]=find_file_series(RootPath,RootFile); 430 % end 414 431 MinIndex_i=min(i1_series(i1_series>0)); 415 432 MinIndex_j=min(j1_series(j1_series>0)); … … 419 436 %% look for an image documentation file 420 437 ext_imadoc='';%default 438 RootName=fullfile(RootPath,RootFile); 421 439 if exist([RootName '.xml'],'file') 422 440 ext_imadoc='.xml'; … … 543 561 first_i=str2num(get(handles.first_i,'String')); 544 562 last_i=str2num(get(handles.last_i,'String')); 545 if ind_opening~=0 || first_i<MinIndex_i || last_i>MaxIndex_i 563 if isempty(first_i) || isempty(last_i)||isempty(MinIndex_i)||isempty(MaxIndex_i) 564 set(handles.first_i,'String',num2str(num_ref_i)); 565 set(handles.last_i,'String',num2str(num_ref_i));% 566 end 567 if ind_opening~=0 || isempty(first_i) || isempty(last_i)|| first_i<MinIndex_i || last_i>MaxIndex_i 546 568 set(handles.first_i,'String',num2str(num_ref_i)); 547 569 set(handles.last_i,'String',num2str(num_ref_i));% … … 551 573 first_j=str2num(get(handles.first_j,'String')); 552 574 last_j=str2num(get(handles.last_i,'String')); 553 if ind_opening~=0 || first_j<MinIndex_j || last_j>MaxIndex_j 554 set(handles.first_j,'String',num2str(num_ref_j)); 575 if isempty(first_j) || isempty(last_j)||isempty(MinIndex_j)||isempty(MaxIndex_j) 576 set(handles.first_j,'String',num2str(num_ref_j)); 577 set(handles.last_j,'String',num2str(num_ref_j));% 578 elseif ind_opening~=0 || first_j<MinIndex_j || last_j>MaxIndex_j 579 set(handles.first_j,'String',num2str(num_ref_j)); 555 580 set(handles.last_j,'String',num2str(num_ref_j));% 556 581 end 557 582 558 583 %% set the civ options depending on the input file content when a nc file has been opened 559 584 ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'}; 560 585 if ind_opening~=0 561 586 for index = 1:ind_opening 562 587 set(handles.(ListOptions{index}),'value',0) 563 588 end 564 for index = ind_opening+2:6 565 set(handles.(ListOptions{index}),'value',0) 566 end589 end 590 for index = ind_opening+2:6 591 set(handles.(ListOptions{index}),'value',0) 567 592 end 568 593 set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1) … … 571 596 %% set the menus of image pairs and default selection for civ %%%%%%%%%%%%%%%%%%% 572 597 %check_letter=~isempty(regexp(NomTypeIma,'[ab|AB]$'));%detect pair label by letter 573 if isequal(NomTypeNc,'_1-2')|| (MaxIndex_j==1)598 if isequal(NomTypeNc,'_1-2')||isempty(MaxIndex_j)|| (MaxIndex_j==1) 574 599 set(handles.ListPairMode,'Value',1) 575 600 set(handles.ListPairMode,'String',{'series(Di)'}) … … 641 666 642 667 %% store info 643 set(handles.Root Name,'UserData',browse)% store the nomenclature type668 set(handles.RootPath,'UserData',browse)% store the nomenclature type 644 669 645 670 %% list the possible index pairs, depending on the option set in ListPairMode … … 660 685 end 661 686 end 662 set(handles.Root Name,'BackgroundColor',[1 1 1])687 set(handles.RootPath,'BackgroundColor',[1 1 1]) 663 688 664 689 %------------------------------------------------------------------------ … … 755 780 ind_selected=find(checkbox,1); 756 781 if ~isempty(ind_selected) 757 Root Name=get(handles.RootName,'String');758 if isempty(Root Name)782 RootPath=get(handles.RootPath,'String'); 783 if isempty(RootPath) 759 784 msgbox_uvmat('ERROR','Please open an image or PIV .nc file with the upper bar menu Open/Browse...') 760 785 return … … 764 789 set(handles.SubdirCiv1,'Visible','on') 765 790 set(handles.ListSubdirCiv1,'Visible','on') 791 set(handles.TitleSubdirCiv1,'Visible','on') 766 792 if ~opening 767 793 errormsg=find_netcpair_civ(handles,1); % select the available netcdf files … … 808 834 set(handles.RUN,'BackgroundColor',[1 0 0]) 809 835 810 % start status callback to visualise results836 % display errors or start status callback to visualise results 811 837 if ~isempty(errormsg) 812 838 display(errormsg) … … 828 854 set(handles.BATCH,'BackgroundColor',[1 0 0]) 829 855 830 % start status callback to visualise results856 % display errors or start status callback to visualise results 831 857 if ~isempty(errormsg) 832 858 display(errormsg) … … 884 910 hfig=figure('DeleteFcn',@stop_status); 885 911 set(hfig,'name','civ_status') 886 %hlist=uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @open_view_field,'tag','list');887 912 uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', {'open_uvmat'},'tag','list'); 888 913 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox','Max',2,'String','checking files...'); … … 918 943 option_list={'civ1','fix1','patch1','civ2','fix2','patch2'}; 919 944 if ~isempty(Data.CivStage) 920 option=Data.CivStage; 945 option=Data.CivStage;%case of Matlab civ 921 946 else 922 947 if ~isempty(Data.patch2) && isequal(Data.patch2,1) 923 948 option=6; 924 % option_str='patch2';925 949 elseif ~isempty(Data.fix2) && isequal(Data.fix2,1) 926 950 option=5; 927 % option_str='fix2';928 951 elseif ~isempty(Data.civ2) && isequal(Data.civ2,1); 929 952 option=4; 930 % option_str='civ2';931 953 elseif ~isempty(Data.patch) && isequal(Data.patch,1); 932 954 option=3; 933 % option_str='patch1';934 955 elseif ~isempty(Data.fix) && isequal(Data.fix,1); 935 956 option=2; 936 % option_str='fix1';937 957 else 938 958 option=1; 939 % option_str='civ1';940 959 end 941 960 end … … 1096 1115 1097 1116 %% check if the binaries exist 1098 % if isequal(get(handles.ListProgram,'Value'),2)1099 % CivMode='Matlab';1100 % else1101 % CivMode='CivX';1102 % end1103 1117 ListProgram=get(handles.ListProgram,'String'); 1104 1118 CivMode=ListProgram{get(handles.ListProgram,'Value')}; … … 1107 1121 case 'CivX' 1108 1122 binary_list={'Civ1Bin','Civ2Bin','PatchBin','FixBin'}; 1109 case 'CivAll' 1123 case 'CivAll'% desactivated option 1110 1124 binary_list={'Civ'}; 1111 1125 case 'Matlab' 1112 1126 if batch 1113 % v érifier MenuMatlab installésur le cluster1127 % verifier MenuMatlab installe sur le cluster 1114 1128 % difficile a faire a priori 1115 1129 end … … 1706 1720 t=struct2xml(Param); 1707 1721 t=set(t,1,'Name','CivDoc');% set the head label 1708 save(t,[namedoc '. xml']); %save GUI parameters as xml file1722 save(t,[namedoc '.CivDoc.xml']); %save GUI parameters as xml file 1709 1723 saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) 1710 1724 … … 1760 1774 %------------------------------------------------------------------------ 1761 1775 % --- determine the list of filenames and indices needed for launch_job 1762 function [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2,compare]=... 1776 %------------------------------------------------------------------------ 1777 % OUTPUT: 1778 % filecell: structure of cell arrays {ref_i,ref_j} containing all the filenames involved in the civ process 1779 % the indices ref_i and ref_j correspond to the list of reference indices 1780 % .filebase=fullfile(RootPath,RootFile) used to construct mask names, grid names, CivDoc xml file 1781 % .ima1.civ1,.ima1.civ2: first image for civ1 and civ2 respectively (possibly different) 1782 % .ima2.civ1,.ima2.civ2: second image for civ1 and civ2 respectively (possibly different) 1783 % .nc.civ1,.nc.civ2: netcdf files containing civ1 and civ2 data respectively (possibly different) 1784 % i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2: arrays of files indices, needed for timing records 1785 function [filecell,i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2,NomType_nc,file_ref_fix1,file_ref_fix2,compare]=... 1763 1786 set_civ_filenames(handles,ref_i,ref_j,checkbox) 1764 1787 %------------------------------------------------------------------------ 1765 1788 filecell=[];%default 1766 1789 1767 %% get the root names nomenclature and numbers 1768 filebase=get(handles.RootName,'String'); 1769 1770 if isempty(filebase)||isequal(filebase,'') 1790 %% get the root name and check dir 1791 RootPath=get(handles.RootPath,'String'); 1792 RootFile=get(handles.RootFile,'String'); 1793 filecell.filebase=fullfile(RootPath,RootFile); 1794 if isempty(filecell.filebase) 1771 1795 msgbox_uvmat('ERROR','please open an image with the upper menu option Open/Browse...') 1772 1796 return 1773 1797 end 1774 1775 %filebase=regexprep(filebase,'\.fsnet','fsnet');% temporary fix for cluster Coriolis 1776 filecell.filebase=filebase; 1777 1778 browse=get(handles.RootName,'UserData'); 1779 compare_list=get(handles.ListCompareMode,'String'); 1780 val=get(handles.ListCompareMode,'Value'); 1781 compare=compare_list{val}; 1798 if ~exist(RootPath,'dir') 1799 msgbox_uvmat('ERROR',['path to images ' RootPath ' not found']) 1800 return 1801 end 1802 [xx,message]=fileattrib(RootPath); 1803 if ~isempty(message) && ~isequal(message.UserWrite,1) 1804 msgbox_uvmat('ERROR',['No writting access to ' RootPath]) 1805 return 1806 end 1807 %check result directory 1808 subdir_civ1=get(handles.SubdirCiv1,'String');%subdirectory subdir_civ1 for the netcdf output data 1809 subdir_civ2=get(handles.SubdirCiv2,'String'); 1810 if isequal(subdir_civ1,''),subdir_civ1='CIV'; end% put default subdir 1811 if isequal(subdir_civ2,''),subdir_civ2=subdir_civ1; end% put default subdir 1812 1813 %% choose root names depending on ListCompareMode =displacement, shift, PIV or stereo PIV 1814 ListCompareMode=get(handles.ListCompareMode,'String'); 1815 compare=ListCompareMode{get(handles.ListCompareMode,'Value')}; 1816 1817 % set the nomenclature type of the nc files depending on the pair mode 1782 1818 if strcmp(compare,'displacement')||strcmp(compare,'shift') 1783 1819 mode='displacement'; … … 1787 1823 mode=mode_list{mode_value}; 1788 1824 end 1789 %time=get(handles.RootName,'UserData'); %get the set of times 1790 ext_ima=get(handles.ImaExt,'String'); 1791 if strcmp(compare,'displacement') 1792 nom_type_ima1='*'; 1793 else 1794 nom_type_ima1=get(handles.NomType,'String'); 1795 end 1796 nom_type_nc=nomtype2pair(nom_type_ima1,mode); 1797 1798 [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... 1825 NomType_ima2=get(handles.NomType,'String'); 1826 NomType_nc=nomtype2pair(NomType_ima2,mode); 1827 1828 % set the rootfile and image indexing 1829 RootFile_ima2=get(handles.RootFile,'String');%root file for the second image series 1830 ext_ima=get(handles.ImaExt,'String'); % image extension (the same for all images) 1831 switch compare 1832 case 'PIV' 1833 RootFile_ima1=RootFile_ima2;% root name of the two image series is the same 1834 NomType_ima1=NomType_ima2;% the index of the first image follows the index of the second one 1835 RootFile_nc=RootFile_ima2; 1836 case 'displacement' 1837 RootFile_ima1=get(handles.RootFile_1,'String');% root name of the first image series set by handles.RootFile_1 1838 NomType_ima1='';% no indexing of the first image, a fixed reference for the whole series 1839 RootFile_nc=RootFile_ima2; 1840 case 'shift' 1841 RootFile_ima1=get(handles.RootFile_1,'String');% root name of the first image series set by handles.RootFile_1 1842 NomType_ima1=NomType_ima2;% the index of the first image follows the index of the second one 1843 RootFile_nc=[RootFile_ima1 '-' RootFile_ima2]; 1844 end 1845 1846 %determine the list of file indices involved 1847 [i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2]=... 1799 1848 find_pair_indices(handles,ref_i,ref_j,mode); 1849 1800 1850 %determine the new filebase for 'displacement' ListPairMode (comparison of two series) 1801 filebase_B=filebase;% root name of the second field series for stereo 1802 if ~strcmp(compare,'PIV') 1803 [Path2,Name2]=fileparts(filebase_B); 1804 Path1=Path2; 1805 Name1=get(handles.RootName_1,'String');% root name of the first field series for stereo 1806 filebase_A=fullfile(Path1,Name1); 1807 if length(Name1)>6 1808 Name1=Name1(end-5:end); 1809 end 1810 if length(Name2)>6 1811 Name2=Name2(end-5:end); 1812 end 1813 filebase_AB=fullfile(Path2,[Name2 '-' Name1]); 1814 else 1815 % test_disp=0; 1816 filebase_A=filebase; 1817 nom_type_ima2=nom_type_ima1; 1818 filebase_AB=filebase; 1819 end 1820 if strcmp(compare,'displacement')||strcmp(compare,'shift') 1821 filebase_ima1=filebase_A; 1822 filebase_ima2=filebase_B; 1823 filebase_nc=filebase_AB; %root name for the result of civ2 1824 else 1825 filebase_ima1=filebase_B; 1826 filebase_ima2=filebase_B; 1827 filebase_nc=filebase_B; 1828 end 1829 [RootPath_ima1,RootFile_ima1]=fileparts(filebase_ima1); 1830 [RootPath_ima2,RootFile_ima2]=fileparts(filebase_ima2); 1831 [RootPath_nc,RootFile_nc]=fileparts(filebase_nc); 1832 [RootPath_A,RootFile_A]=fileparts(filebase_A); 1833 [RootPath_AB,RootFile_AB]=fileparts(filebase_AB); 1851 %filebase_B=filebase;% root name of the second field series for stereo 1852 % filebase_A=filebase;%default 1853 % if strcmp(compare,'PIV') 1854 % filebase_AB=filebase; 1855 % else 1856 % [Path2,Name2]=fileparts(filebase_B); 1857 % Name1=RootFile_ima1; 1858 % filebase_AB=fullfile(Path2,[Name2 '-' Name1]); 1859 % end 1860 % [RootPath_AB,RootFile_AB]=fileparts(filebase_AB); 1861 % % [RootPath_ima1,RootFile_ima1]=fileparts(filebase_B); 1862 % [RootPath_ima2,RootFile_ima2]=fileparts(filebase_B); 1863 % [RootPath_nc,RootFile_nc]=fileparts(filebase_B);%default 1864 % if strcmp(compare,'displacement') 1865 % % [RootPath_ima1,RootFile_ima1]=fileparts(filebase_B); 1866 % % [RootPath_ima2,RootFile_ima2]=fileparts(filebase_B); 1867 % [RootPath_nc,RootFile_nc]=fileparts(filebase_B); 1868 % elseif strcmp(compare,'shift') 1869 % RootPath_nc=RootPath_AB; 1870 % RootFile_nc=RootFile_AB; 1871 % end 1872 % else 1873 % filebase_ima1=filebase_B; 1874 % filebase_ima2=filebase_B; 1875 % filebase_nc=filebase_B; 1876 % [RootPath_ima1,RootFile_ima1]=fileparts(filebase_ima1); 1877 % [RootPath_ima2,RootFile_ima2]=fileparts(filebase_ima2); 1878 % [RootPath_nc,RootFile_nc]=fileparts(filebase_nc); 1879 % [RootPath_A,RootFile_A]=fileparts(filebase_A); 1880 1834 1881 1835 % determine reference files for fix:1882 %% determine reference files for fix: 1836 1883 file_ref_fix1={};%default 1837 1884 file_ref_fix2={}; 1838 nbfield=length( num1_civ1);1839 nbslice=length( num_a_civ1);1885 nbfield=length(i1_civ1); 1886 nbslice=length(j1_civ1); 1840 1887 if checkbox(2)==1% fix1 performed 1841 1888 ref=get(handles.ref_fix1,'UserData');%read data on the ref file stored by get_ref_fix1_Callback … … 1851 1898 if isequal(mode,'displacement') 1852 1899 num_i1=num_i_ref; 1853 name_gennanum_i2=num_i_ref;1900 num_i2=num_i_ref; 1854 1901 num_j1=num_j_ref; 1855 1902 num_j2=num_j_ref; … … 1879 1926 for ifile=1:nbfield 1880 1927 for j=1:nbslice 1881 [RootPath,RootFile]=fileparts(ref.filebase); 1882 file_ref=fullfile_uvmat(RootPath,ref.subdir,RootFile,'.nc',ref.nom_type,num_i1(ifile),num_i2(ifile),num_j1(j),num_j2(j)); 1883 % file_ref=name_generator(ref.filebase,num_i1(ifile),num_j1(j),'.nc',ref.nom_type,1,num_i2(ifile),num_j2(j),ref.subdir);% 1928 [RootPathRef,RootFile]=fileparts(ref.filebase); 1929 file_ref=fullfile_uvmat(RootPathRef,ref.subdir,RootFile,'.nc',ref.NomType,num_i1(ifile),num_i2(ifile),num_j1(j),num_j2(j)); 1884 1930 file_ref_fix1(ifile,j)={file_ref}; 1885 1931 if ~exist(file_ref,'file') … … 1893 1939 end 1894 1940 1895 % determine reference files for checkfix2:1941 %% determine reference files for fix2: 1896 1942 if checkbox(5)==1% fix2 performed 1897 1943 ref=get(handles.ref_fix2,'UserData'); … … 1932 1978 for ifile=1:nbfield 1933 1979 for j=1:nbslice 1934 [RootPath,RootFile]=fileparts(ref.filebase); 1935 file_ref=fullfile_uvmat(RootPath,ref.subdir,RootFile,'.nc',ref.nom_type,num_i1(ifile),num_i2(ifile),num_j1(j),num_j2(j)); 1936 %file_ref=name_generator(ref.filebase,num_i1(ifile),num_j1(j),'.nc',ref.nom_type,1,num_i2(ifile),num_j2(j),ref.subdir);% 1980 [RootPathRef,RootFile]=fileparts(ref.filebase); 1981 file_ref=fullfile_uvmat(RootPathRef,ref.subdir,RootFile,'.nc',ref.NomType,num_i1(ifile),num_i2(ifile),num_j1(j),num_j2(j)); 1937 1982 file_ref_fix2(ifile,j)={file_ref}; 1938 1983 if ~exist(file_ref,'file') … … 1946 1991 end 1947 1992 1948 %check dir 1949 subdir_civ1=get(handles.SubdirCiv1,'String');%subdirectory subdir_civ1 for the netcdf output data 1950 subdir_civ2=get(handles.SubdirCiv2,'String'); 1951 if isequal(subdir_civ1,''),subdir_civ1='CIV'; end% put default subdir 1952 if isequal(subdir_civ2,''),subdir_civ2=subdir_civ1; end% put default subdir 1953 % currentdir=pwd;%store the current working directory 1954 [Path_ima,Name]=fileparts(filebase);%Path of the image files (.civ) 1955 if ~exist(Path_ima,'dir') 1956 msgbox_uvmat('ERROR',['path to images ' Path_ima ' not found']) 1957 filecell={}; 1958 return 1959 end 1960 [xx,message]=fileattrib(Path_ima); 1961 if ~isempty(message) && ~isequal(message.UserWrite,1) 1962 msgbox_uvmat('ERROR',['No writting access to ' Path_ima]) 1963 filecell={}; 1964 % cd(currentdir); 1965 return 1966 end 1967 1968 %check the existence of the netcdf and image files involved 1993 %% check the existence of the netcdf and image files involved 1969 1994 % %%%%%%%%%%%% case CheckCiv1 activated %%%%%%%%%%%%% 1970 1995 if checkbox(1)==1; … … 1975 2000 for ifile=1:nbfield 1976 2001 for j=1:nbslice 1977 [RootPath,RootFile]=fileparts(filebase_nc); 1978 filename=fullfile_uvmat(RootPath_nc,subdir_civ1_new,RootFile_nc,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j)); 1979 % filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1_new); 2002 filename=fullfile_uvmat(RootPath,subdir_civ1_new,RootFile_nc,'.nc',NomType_nc,i1_civ1(ifile),i2_civ1(ifile),j1_civ1(j),j2_civ1(j)); 1980 2003 detect=exist(filename,'file')==2; 1981 2004 if detect% if a netcdf file already exists … … 1999 2022 2000 2023 %create the new SubdirCiv1 2001 if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir') 2002 % cd(Path_ima); 2003 [xx,msg1]=mkdir(fullfile(Path_ima,subdir_civ1_new)); 2024 if ~exist(fullfile(RootPath,subdir_civ1_new),'dir') 2025 [xx,msg1]=mkdir(fullfile(RootPath,subdir_civ1_new)); 2004 2026 2005 2027 if ~strcmp(msg1,'') … … 2008 2030 return 2009 2031 elseif isunix 2010 [xx,msg2] = fileattrib(fullfile( Path_ima,subdir_civ1_new),'+w','g'); %yield writing access (+w) to user group (g)2032 [xx,msg2] = fileattrib(fullfile(RootPath,subdir_civ1_new),'+w','g'); %yield writing access (+w) to user group (g) 2011 2033 if ~strcmp(msg2,'') 2012 msgbox_uvmat('ERROR',['pb of permission for ' fullfile( Path_ima,subdir_civ1_new) ': ' msg2])%error message for directory creation2034 msgbox_uvmat('ERROR',['pb of permission for ' fullfile(RootPath,subdir_civ1_new) ': ' msg2])%error message for directory creation 2013 2035 filecell={}; 2014 2036 return 2015 2037 end 2016 2038 end 2017 % cd(currentdir);2018 2039 end 2019 2040 if strcmp(compare,'stereo PIV')&&(strcmp(mode,'pair j1-j2')||strcmp(mode,'series(Dj)')||strcmp(mode,'series(Di)'))%check second nc series 2020 2041 for ifile=1:nbfield 2021 2042 for j=1:nbslice 2022 filename=fullfile_uvmat(RootPath _A,subdir_civ1_new,RootFile_A,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j));2023 % filename=name_generator(filebase_A, num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1_new);%2043 filename=fullfile_uvmat(RootPath,subdir_civ1_new,RootFile_A,'.nc',NomType_nc,i1_civ1(ifile),i2_civ1(ifile),j1_civ1(j),j2_civ1(j)); 2044 % filename=name_generator(filebase_A,i1_civ1(ifile),j1_civ1(j),'.nc',NomType_nc,1,i2_civ1(ifile),j2_civ1(j),subdir_civ1_new);% 2024 2045 detect=exist(filename,'file')==2; 2025 2046 if detect% if a netcdf file already exists … … 2042 2063 end 2043 2064 %create the new SubdirCiv1 2044 if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir') 2045 % cd(Path_ima); 2046 [xx,msg1]=mkdir(fullfile(Path_ima,subdir_civ1_new)); 2047 % cd(currentdir); 2065 if ~exist(fullfile(RootPath,subdir_civ1_new),'dir') 2066 [xx,msg1]=mkdir(fullfile(RootPath,subdir_civ1_new)); 2048 2067 if ~strcmp(msg1,'') 2049 2068 msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1]) 2050 % cd(currentdir)2051 2069 filecell={}; 2052 2070 return 2053 2071 else 2054 [xx,msg2] = fileattrib(fullfile( Path_ima,subdir_civ1_new),'+w','g'); %yield writing access (+w) to user group (g)2072 [xx,msg2] = fileattrib(fullfile(RootPath,subdir_civ1_new),'+w','g'); %yield writing access (+w) to user group (g) 2055 2073 if ~strcmp(msg2,'') 2056 2074 msgbox_uvmat('ERROR',['pb of permission for ' subdir_civ1_new ': ' msg2])%error message for directory creation 2057 % cd(currentdir)2058 2075 filecell={}; 2059 2076 return … … 2067 2084 for ifile=1:nbfield 2068 2085 for j=1:nbslice 2069 filename=fullfile_uvmat(RootPath_ima1,'',RootFile_ima1,ext_ima,nom_type_ima1,num1_civ1(ifile),[],num_a_civ1(j)); 2070 % filename=name_generator(filebase_ima1, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); 2086 filename=fullfile_uvmat(RootPath,'',RootFile_ima1,ext_ima,NomType_ima1,i1_civ1(ifile),[],j1_civ1(j)); 2071 2087 idetect(j)=exist(filename,'file')==2; 2072 2088 filecell.ima1.civ1(ifile,j)={filename}; %first image 2073 filename=fullfile_uvmat(RootPath_ima2,'',RootFile_ima2,ext_ima,nom_type_ima2,num2_civ1(ifile),[],num_b_civ1(j)); 2074 % filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); 2089 filename=fullfile_uvmat(RootPath,'',RootFile_ima2,ext_ima,NomType_ima2,i2_civ1(ifile),[],j2_civ1(j)); 2075 2090 idetect_1(j)=exist(filename,'file')==2; 2076 2091 filecell.ima2.civ1(ifile,j)={filename};%second image … … 2080 2095 msgbox_uvmat('ERROR',[filecell.ima1.civ1{ifile,indexj} ' not found']) 2081 2096 filecell={}; 2082 % cd(currentdir)2083 2097 return 2084 2098 end … … 2087 2101 msgbox_uvmat('ERROR',[filecell.ima2.civ1{ifile,indexj} ' not found']) 2088 2102 filecell={}; 2089 %cd(currentdir)2090 2103 return 2091 2104 end … … 2094 2107 for ifile=1:nbfield 2095 2108 for j=1:nbslice 2096 filename=fullfile_uvmat(RootPath_A,'',RootFile_A,ext_ima,nom_type_ima1,num1_civ1(ifile),[],num_a_civ1(j)); 2097 % filename=name_generator(filebase_A, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); 2109 filename=fullfile_uvmat(RootPath,'',RootFile_A,ext_ima,NomType_ima1,i1_civ1(ifile),[],j1_civ1(j)); 2098 2110 idetect(j)=exist(filename,'file')==2; 2099 2111 filecell.imaA1.civ1(ifile,j)={filename} ;%first image 2100 filename=fullfile_uvmat(RootPath_A,'',RootFile_A,ext_ima,nom_type_ima2,num2_civ1(ifile),[],num_b_civ1(j)); 2101 % filename=name_generator(filebase_A, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); 2112 filename=fullfile_uvmat(RootPath,'',RootFile_A,ext_ima,NomType_ima2,i2_civ1(ifile),[],j2_civ1(j)); 2102 2113 idetect_1(j)=exist(filename,'file')==2; 2103 2114 filecell.imaA2.civ1(ifile,j)={filename};%second image … … 2124 2135 for ifile=1:nbfield 2125 2136 for j=1:nbslice 2126 filename=fullfile_uvmat(RootPath_nc,subdir_civ1,RootFile_nc,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j)); 2127 % filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',... 2128 % nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 2137 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile_nc,'.nc',NomType_nc,i1_civ1(ifile),i2_civ1(ifile),j1_civ1(j),j2_civ1(j)); 2129 2138 detect=exist(filename,'file')==2; 2130 2139 if detect==0 … … 2140 2149 for ifile=1:nbfield 2141 2150 for j=1:nbslice 2142 filename=fullfile_uvmat(RootPath_A,subdir_civ1,RootFile_A,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j)); 2143 % filename=name_generator(filebase_A,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 2151 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile_A,'.nc',NomType_nc,i1_civ1(ifile),i2_civ1(ifile),j1_civ1(j),j2_civ1(j)); 2144 2152 filecell.ncA.civ1(ifile,j)={filename}; 2145 2153 if ~exist(filename,'file') … … 2167 2175 for ifile=1:nbfield 2168 2176 for j=1:nbslice 2169 filename=fullfile_uvmat(RootPath_nc,subdir_civ2_new,RootFile_nc,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j)); 2170 % filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2_new);% 2177 filename=fullfile_uvmat(RootPath,subdir_civ2_new,RootFile_nc,'.nc',NomType_nc,i1_civ2(ifile),i2_civ2(ifile),j1_civ2(j),j2_civ2(j)); 2171 2178 detect=exist(filename,'file')==2; 2172 2179 if detect% if a netcdf file already exists … … 2188 2195 end 2189 2196 %create the new subdir_civ2_new 2190 if ~exist(fullfile( Path_ima,subdir_civ2_new),'dir')2191 [xx,m2]=mkdir(fullfile( Path_ima,subdir_civ2_new));2192 [xx,msg2] = fileattrib(fullfile( Path_ima,subdir_civ2_new),'+w','g'); %yield writing access (+w) to user group (g)2197 if ~exist(fullfile(RootPath,subdir_civ2_new),'dir') 2198 [xx,m2]=mkdir(fullfile(RootPath,subdir_civ2_new)); 2199 [xx,msg2] = fileattrib(fullfile(RootPath,subdir_civ2_new),'+w','g'); %yield writing access (+w) to user group (g) 2193 2200 if ~isequal(m2,'') 2194 msgbox_uvmat('ERROR',['cannot create ' fullfile( Path_ima,subdir_civ2_new) ': ' m2])2201 msgbox_uvmat('ERROR',['cannot create ' fullfile(RootPath,subdir_civ2_new) ': ' m2]) 2195 2202 filecell={}; 2196 % cd(currentdir)2197 2203 return 2198 2204 end … … 2201 2207 for ifile=1:nbfield 2202 2208 for j=1:nbslice 2203 filename=fullfile_uvmat(RootPath_A,subdir_civ2_new,RootFile_A,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j)); 2204 % filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',... 2205 % nom_type_nc,1,num2_civ2(ifile),num_b_civ1(j),subdir_civ2_new);% 2209 filename=fullfile_uvmat(RootPath,subdir_civ2_new,RootFile_A,'.nc',NomType_nc,i1_civ2(ifile),i2_civ2(ifile),j1_civ2(j),j2_civ2(j)); 2206 2210 detect=exist(filename,'file')==2; 2207 2211 if detect% if a netcdf file already exists … … 2224 2228 subdir_civ2=subdir_civ2_new; 2225 2229 %create the new SubdirCiv1 2226 if ~exist(fullfile( Path_ima,subdir_civ2_new),'dir')2230 if ~exist(fullfile(RootPath,subdir_civ2_new),'dir') 2227 2231 [xx,m2]=mkdir(subdir_civ2_new); 2228 [xx,msg2] = fileattrib(fullfile( Path_ima,subdir_civ2_new),'+w','g'); %yield writing access (+w) to user group (g)2232 [xx,msg2] = fileattrib(fullfile(RootPath,subdir_civ2_new),'+w','g'); %yield writing access (+w) to user group (g) 2229 2233 if ~isequal(m2,'') 2230 msgbox_uvmat('ERROR', ['cannot create ' fullfile( Path_ima,subdir_civ2_new) ': ' m2])%error message for directory creation2234 msgbox_uvmat('ERROR', ['cannot create ' fullfile(RootPath,subdir_civ2_new) ': ' m2])%error message for directory creation 2231 2235 % cd(currentdir) 2232 2236 filecell={}; … … 2246 2250 for ifile=1:nbfield 2247 2251 for j=1:nbslice 2248 filename=fullfile_uvmat(RootPath_nc,subdir_civ1,RootFile_nc,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j)); 2249 %filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',... 2250 % nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 2252 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile_nc,'.nc',NomType_nc,i1_civ1(ifile),i2_civ1(ifile),j1_civ1(j),j2_civ1(j));% 2251 2253 filecell.nc.civ1(ifile,j)={filename};% name of the civ1 file 2252 2254 if ~exist(filename,'file') … … 2292 2294 for ifile=1:nbfield 2293 2295 for j=1:nbslice 2294 filename=fullfile_uvmat(RootPath _A,subdir_civ2,RootFile_A,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j));2296 filename=fullfile_uvmat(RootPath,subdir_civ2,RootFile_A,'.nc',NomType_nc,i1_civ2(ifile),i2_civ2(ifile),j1_civ2(j),j2_civ2(j)); 2295 2297 filecell.ncA.civ2(ifile,j)={filename}; 2296 2298 if ~exist(filename,'file') … … 2309 2311 for ifile=1:nbfield 2310 2312 for j=1:nbslice 2311 filename=fullfile_uvmat(RootPath _nc,subdir_civ2,RootFile_nc,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j));2313 filename=fullfile_uvmat(RootPath,subdir_civ2,RootFile_nc,'.nc',NomType_nc,i1_civ2(ifile),i2_civ2(ifile),j1_civ2(j),j2_civ2(j)); 2312 2314 detect=exist(filename,'file')==2; 2313 2315 filecell.nc.civ2(ifile,j)={filename}; … … 2315 2317 end 2316 2318 %get first image names for checkciv2 2317 if checkbox(1)==1 && isequal( num1_civ1,num1_civ2) && isequal(num_a_civ1,num_a_civ2)2319 if checkbox(1)==1 && isequal(i1_civ1,i1_civ2) && isequal(j1_civ1,j1_civ2) 2318 2320 filecell.ima1.civ2=filecell.ima1.civ1; 2319 2321 elseif checkbox(4)==1 2320 2322 for ifile=1:nbfield 2321 2323 for j=1:nbslice 2322 filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,ext_ima,nom_type_ima1,num1_civ2(ifile),[],num_a_civ2(j)); 2323 %filename=name_generator(filebase_ima1, num1_civ2(ifile),num_a_civ2(j),ext_ima,nom_type_ima1); 2324 filename=fullfile_uvmat(RootPath,[],RootFile_ima1,ext_ima,NomType_ima1,i1_civ2(ifile),[],j1_civ2(j)); 2324 2325 idetect_2(j)=exist(filename,'file')==2; 2325 2326 filecell.ima1.civ2(ifile,j)={filename};%first image … … 2335 2336 2336 2337 %get second image names for checkciv2 2337 if checkbox(1)==1 && isequal( num2_civ1,num2_civ2) && isequal(num_b_civ1,num_b_civ2)2338 if checkbox(1)==1 && isequal(i2_civ1,i2_civ2) && isequal(j2_civ1,j2_civ2) 2338 2339 filecell.ima2.civ2=filecell.ima2.civ1; 2339 2340 elseif checkbox(4)==1 2340 2341 for ifile=1:nbfield 2341 2342 for j=1:nbslice 2342 filename=fullfile_uvmat(RootPath_ima2,[],RootFile_ima2,ext_ima,nom_type_ima2,num2_civ2(ifile),[],num_b_civ2(j)); 2343 % filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),ext_ima,nom_type_ima2); 2343 filename=fullfile_uvmat(RootPath,[],RootFile_ima2,ext_ima,NomType_ima2,i2_civ2(ifile),[],j2_civ2(j)); 2344 2344 idetect_3(j)=exist(filename,'file')==2; 2345 2345 filecell.ima2.civ2(ifile,j)={filename};%first image … … 2360 2360 for ifile=1:nbfield 2361 2361 for j=1:nbslice 2362 filename=fullfile_uvmat(RootPath _nc,subdir_civ2,RootFile_nc,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j));2362 filename=fullfile_uvmat(RootPath,subdir_civ2,RootFile_nc,'.nc',NomType_nc,i1_civ2(ifile),i2_civ2(ifile),j1_civ2(j),j2_civ2(j)); 2363 2363 filecell.nc.civ2(ifile,j)={filename}; 2364 2364 if ~exist(filename,'file') … … 2388 2388 for ifile=1:nbfield 2389 2389 for j=1:nbslice 2390 filename=fullfile_uvmat(RootPath _AB,subdir_civ1,RootFile_AB,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j));2390 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile_AB,'.nc',NomType_nc,i1_civ1(ifile),i2_civ1(ifile),j1_civ1(j),j2_civ1(j)); 2391 2391 filecell.st(ifile,j)={filename}; 2392 2392 end … … 2396 2396 for ifile=1:nbfield 2397 2397 for j=1:nbslice 2398 filename=fullfile_uvmat(RootPath _AB,subdir_civ2,RootFile_AB,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j));2398 filename=fullfile_uvmat(RootPath,subdir_civ2,RootFile_AB,'.nc',NomType_nc,i1_civ2(ifile),i2_civ2(ifile),j1_civ2(j),j2_civ2(j)); 2399 2399 filecell.st(ifile,j)={filename}; 2400 2400 end … … 2404 2404 set(handles.SubdirCiv1,'String',subdir_civ1);%update the edit box 2405 2405 set(handles.SubdirCiv2,'String',subdir_civ2);%update the edit box 2406 browse.nom_type_nc=nom_type_nc;2407 set(handles.RootName,'UserData',browse); %update the nomenclature type for uvmat2408 2409 2406 2410 2407 %COPY IMAGES TO THE FORMAT .png IF NEEDED 2411 if isequal( nom_type_ima1,'*')%case of movie files2412 nom_type_imanew1='_i';2413 else 2414 nom_type_imanew1=nom_type_ima1;2415 end 2416 if isequal( nom_type_ima2,'*')%case of movie files2417 nom_type_imanew2='_i';2418 else 2419 nom_type_imanew2=nom_type_ima2;2408 if isequal(NomType_ima1,'*')%case of movie files 2409 NomType_imanew1='_i'; 2410 else 2411 NomType_imanew1=NomType_ima1; 2412 end 2413 if isequal(NomType_ima2,'*')%case of movie files 2414 NomType_imanew2='_i'; 2415 else 2416 NomType_imanew2=NomType_ima2; 2420 2417 end 2421 2418 if ~isequal(ext_ima,'.png') … … 2434 2431 form=imformats(ext_ima(2:end)); 2435 2432 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 2436 if isequal( nom_type_ima1,'*');2433 if isequal(NomType_ima1,'*'); 2437 2434 type_ima1='multimage';%image series in a single image file 2438 2435 else … … 2454 2451 form=imformats(ext_ima(2:end)); 2455 2452 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 2456 if isequal( nom_type_ima1,'*');2453 if isequal(NomType_ima1,'*'); 2457 2454 type_ima2='multimage';%image series in a single image file 2458 2455 else … … 2461 2458 end 2462 2459 end 2463 %npxy=get(handles.ImaExt,'UserData');2464 % % if numel(npxy)<22465 %2466 % filename=name_generator(filebase_ima1,num1_civ1(1),num_a_civ1(1),ImaExt,nom_type_ima1);2467 % A=imread(filename);2468 % npxy=size(A);2469 % % end2470 % npy=npxy(1);2471 % npx=npxy(2);2472 2460 if checkbox(1) %if civ1 is performed 2473 2461 h = waitbar(0,'copy images to the .png format for civ1');% display a wait bar … … 2475 2463 waitbar(ifile/nbfield); 2476 2464 for j=1:nbslice 2477 filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,'.png',nom_type_imanew1,num1_civ1(ifile),[],num_a_civ1(j)); 2478 % filename=name_generator(filebase_ima1,num1_civ1(ifile),num_a_civ1(j),'.png',nom_type_imanew1); 2465 filename=fullfile_uvmat(RootPath,[],RootFile_ima1,'.png',NomType_imanew1,i1_civ1(ifile),[],j1_civ1(j)); 2479 2466 if ~exist(filename,'file') 2480 A=read_image(filecell.ima1.civ1{ifile,j},type_ima1, num1_civ1(ifile),movieobject1);2467 A=read_image(filecell.ima1.civ1{ifile,j},type_ima1,i1_civ1(ifile),movieobject1); 2481 2468 imwrite(A,filename,'BitDepth',16); 2482 2469 end 2483 2470 filecell.ima1.civ1(ifile,j)={filename}; 2484 filename=fullfile_uvmat(RootPath_ima2,[],RootFile_ima2,'.png',nom_type_imanew2,num2_civ1(ifile),[],num_b_civ1(j)); 2485 %filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),'.png',nom_type_imanew2); 2471 filename=fullfile_uvmat(RootPath,[],RootFile_ima2,'.png',NomType_imanew2,i2_civ1(ifile),[],j2_civ1(j)); 2486 2472 if ~exist(filename,'file') 2487 A=read_image(filecell.ima2.civ1{ifile,j},type_ima2, num2_civ1(ifile),movieobject2);2473 A=read_image(filecell.ima2.civ1{ifile,j},type_ima2,i2_civ1(ifile),movieobject2); 2488 2474 imwrite(A,filename,'BitDepth',16); 2489 2475 end … … 2498 2484 waitbar(ifile/nbfield); 2499 2485 for j=1:nbslice 2500 filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,'.png',nom_type_imanew1,num1_civ2(ifile),[],num_a_civ2(j)); 2501 %filename=name_generator(filebase_ima1,num1_civ2(ifile),num_a_civ2(j),'.png',nom_type_imanew1); 2486 filename=fullfile_uvmat(RootPath,[],RootFile_ima1,'.png',NomType_imanew1,i1_civ2(ifile),[],j1_civ2(j)); 2502 2487 if ~exist(filename,'file') 2503 A=read_image(cell2mat(filecell.ima1.civ2(ifile,j)),type_ima2, num1_civ2(ifile));2488 A=read_image(cell2mat(filecell.ima1.civ2(ifile,j)),type_ima2,i1_civ2(ifile)); 2504 2489 imwrite(A,filename,'BitDepth',16); 2505 2490 end 2506 2491 filecell.ima1.civ2(ifile,j)={filename}; 2507 filename=fullfile_uvmat(RootPath_ima2,[],RootFile_ima2,'.png',nom_type_imanew2,num2_civ2(ifile),[],num_b_civ2(j)); 2508 % filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),'.png',nom_type_imanew2); 2492 filename=fullfile_uvmat(RootPath,[],RootFile_ima2,'.png',NomType_imanew2,i2_civ2(ifile),[],j2_civ2(j)); 2509 2493 if ~exist(filename,'file') 2510 A=read_image(cell2mat(filecell.ima2.civ2(ifile,j)),type_ima2, num2_civ2(ifile));2494 A=read_image(cell2mat(filecell.ima2.civ2(ifile,j)),type_ima2,i2_civ2(ifile)); 2511 2495 imwrite(A,filename,'BitDepth',16); 2512 2496 end … … 2620 2604 function ListCompareMode_Callback(hObject, eventdata, handles) 2621 2605 %------------------------------------------------------------------------ 2622 menu=get(handles.ListCompareMode,'String'); 2623 val=get(handles.ListCompareMode,'Value'); 2624 option=menu{val}; 2606 ListCompareMode=get(handles.ListCompareMode,'String'); 2607 option=ListCompareMode{get(handles.ListCompareMode,'Value')}; 2625 2608 if ~strcmp(option,'PIV') % case 'displacement' or 'stereo PIV' 2626 filebase=get(handles.RootName,'String'); 2627 browse=get(handles.RootName,'Userdata'); 2628 % browse.nom_type_ima1=browse.nom_type_ima; 2629 set(handles.RootName,'UserData',browse); 2609 filebase=get(handles.RootPath,'String'); 2630 2610 set(handles.sub_txt,'Visible','on') 2631 set(handles.Root Name_1,'Visible','On');%mkes the second file input window visible2611 set(handles.RootFile_1,'Visible','On');%mkes the second file input window visible 2632 2612 mode_store=get(handles.ListPairMode,'String');%get the present 'mode' 2633 2613 set(handles.ListCompareMode,'UserData',mode_store);%store the mode display 2634 2614 set(handles.ListPairMode,'Visible','off') 2635 if test==22636 set(handles.ListPairMode,'Visible','off')2637 set(handles.ListPairMode,'Value',1) % mode 'civX' selected by default2638 else2639 set(handles.ListPairMode,'Visible','on')2640 set(handles.ListPairMode,'Value',3) % mode 'Matlab' selected for stereo2641 end2642 2615 2643 %% menuopen an image file with the browser2616 %% open an image file with the browser 2644 2617 ind_opening=1;%default 2645 2618 browse.incr_pair=[0 0]; %default 2646 oldfile=get(handles.RootName,'String'); 2647 menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)'; 2648 '*.xml', '.xml files '; ... 2649 '*.civ', '.civ files '; ... 2619 oldfile=get(handles.RootPath,'String'); 2620 menu={'*.png;*.jpg;*.tif;*.avi;*.AVI;', ' (*.png,*.jpg ,.tif, *.avi,*.AVI)'; 2650 2621 '*.png','.png image files'; ... 2651 2622 '*.jpg',' jpeg image files'; ... 2652 2623 '*.tif','.tif image files'; ... 2653 2624 '*.avi;*.AVI','.avi movie files'; ... 2654 '*.nc','.netcdf files'; ...2655 2625 '*.*', 'All Files (*.*)'}; 2656 [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file of the second series',oldfile); 2626 if strcmp(option,'displacement') 2627 comment='Pick the reference file for displacements'; 2628 else 2629 comment='Pick a file of the second series'; 2630 end 2631 [FileName, PathName] = uigetfile( menu, comment,oldfile); 2657 2632 fileinput=[PathName FileName];%complete file name 2658 2633 sizf=size(fileinput); … … 2665 2640 end 2666 2641 if ~strcmp(path1,path) 2667 msgbox_uvmat('ERROR','The second image series must be in the same directory as the first one')2642 msgbox_uvmat('ERROR','The second image or series must be in the same directory as the first one') 2668 2643 return 2669 2644 end 2670 [tild,tild,RootFile,tild,tild,tild,tild,tild,nom_type]=fileparts_uvmat(name); 2671 set(handles.RootName_1,'String',RootFile); 2672 browse=get(handles.RootName,'UserData'); 2673 %browse.nom_type_ima_1=nom_type; 2674 set(handles.RootName,'UserData',browse) 2675 2676 %check image extension 2645 if strcmp(option,'displacement') 2646 [tild,RootFile_1]=fileparts(name); 2647 else 2648 [tild,tild,RootFile_1,tild,tild,tild,tild,tild,nom_type_1]=fileparts_uvmat(fileinput); 2649 [RootFile_1,i1_series,tild,j1_series,tild,nom_type_1,FileType,Object]=find_file_series(PathName,FileName); 2650 %check image nom type 2651 if ~strcmp(nom_type_1,get(handles.NomType,'String')) 2652 msgbox_uvmat('ERROR','The second image series must have the same indexing type as the first one, or use the option displacement for a fixed image') 2653 return 2654 end 2655 end 2656 %check image extension 2677 2657 if ~strcmp(ext,get(handles.ImaExt,'String')) 2678 2658 msgbox_uvmat('ERROR','The second image series must have the same extension name as the first one') 2679 2659 return 2680 end 2681 2660 end 2661 set(handles.RootFile_1,'String',RootFile_1); 2682 2662 else 2683 2663 set(handles.ListPairMode,'Visible','on') 2684 set(handles.Root Name_1,'Visible','Off');2664 set(handles.RootFile_1,'Visible','Off'); 2685 2665 set(handles.sub_txt,'Visible','off') 2686 set(handles.Root Name_1,'String',[]);2666 set(handles.RootFile_1,'String',[]); 2687 2667 mode_store=get(handles.ListCompareMode,'UserData'); 2688 2668 set(handles.ListPairMode,'Value',1) … … 2691 2671 set(handles.ListPairMode,'Value',1) % mode 'civX' selected by default 2692 2672 end 2693 if strcmp(option,'stereo PIV') && get(handles.CheckPatch1,'Value')2694 set(handles.CheckStereo,'Visible','on')2695 else2696 set(handles.CheckStereo,'Visible','off')2697 end2698 if strcmp(option,'stereo PIV') && get(handles.CheckPatch2,'Value')2699 set(handles.CheckStereo,'Visible','on')2700 else2701 set(handles.CheckStereo,'Visible','off')2702 end2673 % if strcmp(option,'stereo PIV') && get(handles.CheckPatch1,'Value') 2674 % set(handles.CheckStereo,'Visible','on') 2675 % else 2676 % set(handles.CheckStereo,'Visible','off') 2677 % end 2678 % if strcmp(option,'stereo PIV') && get(handles.CheckPatch2,'Value') 2679 % set(handles.CheckStereo,'Visible','on') 2680 % else 2681 % set(handles.CheckStereo,'Visible','off') 2682 % end 2703 2683 ListPairMode_Callback(hObject, eventdata, handles) 2704 2684 … … 2950 2930 %% initialisation 2951 2931 errormsg=''; 2952 filebase=get(handles.RootName,'String');2953 [filepath,Nme,ext_dir]=fileparts(filebase);2954 browse=get(handles.Root Name,'UserData');2932 % filebase=get(handles.RootPath,'String'); 2933 % [filepath,Nme,ext_dir]=fileparts(filebase); 2934 browse=get(handles.RootPath,'UserData'); 2955 2935 compare_list=get(handles.ListCompareMode,'String'); 2956 2936 val=get(handles.ListCompareMode,'Value'); 2957 2937 compare=compare_list{val}; 2958 if strcmp(compare,'displacement') 2938 if strcmp(compare,'displacement')||strcmp(compare,'shift') 2959 2939 mode='displacement'; 2960 2940 else … … 2977 2957 % end 2978 2958 % browse.nom_type_nc=nom_type_nc; 2979 % set(handles.Root Name,'UserData',browse)2959 % set(handles.RootPath,'UserData',browse) 2980 2960 2981 2961 %% reads .nc subdirectoy and image numbers from the interface … … 3011 2991 select=ones(size(1:nbpair));%flag for displayed pairs =1 for display 3012 2992 testpair=0; 3013 [RootPath,RootFile]=fileparts(filebase); 2993 RootPath=get(handles.RootPath,'String'); 2994 RootFile=get(handles.RootFile,'String'); 3014 2995 if index==1 % case civ1 3015 2996 if ~get(handles.CheckCiv1,'Value') % 3016 if ~exist(fullfile( filepath,subdir_civ1,ext_dir),'dir')2997 if ~exist(fullfile(RootPath,subdir_civ1),'dir') 3017 2998 errormsg=['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist']; 3018 2999 set(handles.ListPairCiv1,'String',{}); … … 3161 3142 set(handles.ListPairCiv2,'String',displ_pair'); 3162 3143 set(gcf,'Pointer','arrow') 3163 3164 %------------------------------------------------------------------------3165 % determine the menu for checkciv2 pairs depending on the existing netcdf file at the3166 %middle of the series set by first_i, incr, last_i3167 % function find_netcpair_civ2(handles)3168 % %------------------------------------------------------------------------3169 % set(gcf,'Pointer','watch')3170 % %nomenclature types3171 % filebase=get(handles.RootName,'String');3172 % [filepath,Nme,ext_dir]=fileparts(filebase);3173 % browse=get(handles.RootName,'UserData');3174 % compare_list=get(handles.ListCompareMode,'String');3175 % val=get(handles.ListCompareMode,'Value');3176 % compare=compare_list{val};3177 % if strcmp(compare,'displacement')3178 % mode='displacement';3179 % else3180 % mode_list=get(handles.ListPairMode,'String');3181 % if isempty(mode_list)3182 % msgbox_uvmat('ERROR','please enter an input image or netcdf file')3183 % return3184 % end3185 % mode_value=get(handles.ListPairMode,'Value');3186 % mode=mode_list{mode_value};3187 % end3188 %3189 % % nomenclature type of the .nc files3190 % nom_type_ima='ima_num';%default3191 % NomTypeIma=get(handles.NomType,'String');3192 % nom_type_nc='_1-2';%default3193 % if isfield(browse,'nom_type_nc')3194 % nom_type_nc=browse.nom_type_nc;3195 % end3196 % if isequal(nom_type_ima,'png_old') || isequal(nom_type_ima,'netc_old')|| isequal(nom_type_ima,'raw_SMD')|| isequal(nom_type_nc,'netc_old')3197 % nom_type_nc='netc_old';%nom_type for the netcdf files3198 % elseif isequal(nom_type_ima,'none')||isequal(nom_type_nc,'none')3199 % nom_type_nc='none';3200 % elseif isequal(nom_type_ima,'avi')||isequal(nom_type_ima,'_i')||isequal(nom_type_ima,'ima_num')||isequal(nom_type_nc,'_1-2')3201 % nom_type_nc='_1-2';3202 % else3203 % if isequal(mode,'series(Di)')%|isequal(mode,'st_series(Di)')3204 % nom_type_nc='_1-2_1'; % PIV in volume3205 % else3206 % nom_type_nc='_1_1-2';3207 % end3208 % end3209 % browse.nom_type_nc=nom_type_nc;3210 % set(handles.RootName,'UserData',browse)3211 %3212 % %reads .nc subdirectory and image numbers from the interface3213 % subdir_civ1=get(handles.SubdirCiv1,'String');%subdirectory subdir_civ1 for the netcdf data3214 % subdir_civ2=get(handles.SubdirCiv2,'String');%subdirectory subdir_civ2 for the netcdf data3215 % ref_i=str2double(get(handles.ref_i,'String'));3216 % if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')3217 % ref_j=0;3218 % else3219 % ref_j=str2double(get(handles.ref_j,'String'));3220 % end3221 % time=get(handles.ImaDoc,'UserData'); %get the set of times3222 % TimeUnit=get(handles.TimeUnit,'String');3223 % checkframe=strcmp(TimeUnit,'frame');3224 % % if isempty(time)3225 % % time=[0 1];%default3226 % % end3227 % displ_num=get(handles.ListPairCiv1,'UserData');3228 %3229 % %eliminate the first pairs inconsistent with the position3230 % if isempty(displ_num)3231 % nbpair=0;3232 % else3233 % nbpair=length(displ_num(1,:));%nbre of displayed pairs3234 % if isequal(mode,'series(Di)')% | isequal(mode,'st_series(Di)')3235 % nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index3236 % elseif isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)')3237 % nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index3238 % end3239 % end3240 % nbpair=min(200,nbpair);%limit the number of displayed pairs to 2003241 %3242 % %% look for existing processed pairs at the reference indices if Civ1 will not3243 % % be performed, while the result is needed for next steps.3244 % displ_pair={''}; %default3245 % select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs3246 % [RootPath,RootFile]=fileparts(filebase);3247 % if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value')3248 % if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir')3249 % errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist'])3250 % set(handles.ListPairCiv2,'Value',1);3251 % set(handles.ListPairCiv2,'String',{''});3252 % return3253 % end3254 % for ipair=1:nbpair3255 % filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,...3256 % ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair));3257 % % filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,...3258 % % ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1);3259 % select(ipair)=exist(filename,'file')==2;3260 % end3261 % if isequal(select,zeros(size(1:nbpair)))3262 % if isfield(browse,'incr_pair')3263 % num_i1=ref_i-floor(browse.incr_pair(1)/2);3264 % num_i2=ref_i+floor((browse.incr_pair(1)+1)/2);3265 % num_j1=ref_j-floor(browse.incr_pair(2)/2);3266 % num_j2=ref_j+floor((browse.incr_pair(2)+1)/2);3267 % filename=fullfile_uvmat(RootPath,subdir_civ2,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2);3268 % %filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ2);3269 % select(1)=exist(filename,'file')==2;3270 % else3271 % if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)')3272 % msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2])3273 % else3274 % msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2])3275 % end3276 % set(handles.ListPairCiv2,'Value',1);3277 % set(handles.ListPairCiv2,'String',{''});3278 % return3279 % end3280 % end3281 % end3282 % if isequal(mode,'series(Di)')3283 % for ipair=1:nbpair3284 % if select(ipair)3285 % displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ];3286 % if ~checkframe && size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)3287 % dt=time(ref_i+displ_num(4,ipair)+1,ref_j+displ_num(2,ipair)+1)-time(ref_i+displ_num(3,ipair)+1,ref_j+displ_num(1,ipair)+1);%time interval dt3288 % displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];3289 % end3290 % else3291 % displ_pair{ipair}='...'; %pair not displayed in the menu3292 % end3293 % end3294 % elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') % series on the j index3295 % for ipair=1:nbpair3296 % if select(ipair)3297 % displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ];3298 % if ~checkframe && size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)&& displ_num(1,ipair)>=1 && displ_num(2,ipair)>=13299 % dt=time(ref_i+displ_num(4,ipair)+1,ref_j+displ_num(2,ipair)+1)-time(ref_i+displ_num(3,ipair)+1,ref_j+displ_num(1,ipair)+1);%time interval dt3300 % else3301 % dt=1;3302 % end3303 % displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];3304 % else3305 % displ_pair{ipair}='...'; %pair not displayed in the menu3306 % end3307 % end3308 % elseif isequal(mode,'pair j1-j2')% | isequal(mode,'st_pair j1-j2') %case of pairs3309 % for ipair=1:nbpair3310 % if select(ipair)3311 % if ~checkframe && size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) && displ_num(1,ipair)>=1 && displ_num(2,ipair)>=13312 % dt=time(ref_i+displ_num(4,ipair)+1,displ_num(2,ipair)+1)-time(ref_i+displ_num(3,ipair)+1,displ_num(1,ipair)+1);%time interval dt3313 % else3314 % dt=1;3315 % end3316 % displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair)+1,nom_type_ima) '-' num2stra(displ_num(2,ipair)+1,nom_type_ima) ...3317 % ' :dt= ' num2str(dt*1000)];3318 %3319 % else3320 % displ_pair{ipair}='...'; %pair not displayed in the menu3321 % end3322 % end3323 % elseif isequal(mode,'displacement')3324 % displ_pair={'Di=Dj=0'};3325 % end3326 % val=get(handles.ListPairCiv2,'Value');3327 % ichoice=find(select,1);3328 % if (isempty(ichoice) || ichoice < 1); ichoice=1; end;3329 % if get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==03330 % val=ichoice;% first valid pair proposed by default in the menu3331 % end3332 % if val>length(displ_pair')3333 % set(handles.ListPairCiv2,'Value',1);% first valid pair proposed by default in the menu3334 % else3335 % set(handles.ListPairCiv2,'Value',val);3336 % end3337 % set(handles.ListPairCiv2,'String',displ_pair');3338 % set(gcf,'Pointer','arrow')3339 3144 3340 3145 %------------------------------------------------------------------- … … 3505 3310 else 3506 3311 mask_displ='no mask'; %default 3507 filebase=get(handles.Root Name,'String');3312 filebase=get(handles.RootPath,'String'); 3508 3313 [nbslice, flag_mask]=get_mask(filebase,handles); 3509 3314 if isequal(flag_mask,1) 3510 3315 mask_displ=[num2str(nbslice) 'mask']; 3511 3316 elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 3512 filebase_a=get(handles.Root Name_1,'String');3317 filebase_a=get(handles.RootFile_1,'String'); 3513 3318 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 3514 3319 if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) … … 3549 3354 else 3550 3355 mask_displ='no mask'; %default 3551 filebase=get(handles.Root Name,'String');3356 filebase=get(handles.RootPath,'String'); 3552 3357 [nbslice, flag_mask]=get_mask(filebase,handles); 3553 3358 if isequal(flag_mask,1) 3554 3359 mask_displ=[num2str(nbslice) 'mask']; 3555 3360 elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 3556 filebase_a=get(handles.Root Name_1,'String');3361 filebase_a=get(handles.RootFile_1,'String'); 3557 3362 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 3558 3363 if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) … … 3590 3395 else 3591 3396 mask_displ='no mask'; %default 3592 filebase=get(handles.Root Name,'String');3397 filebase=get(handles.RootPath,'String'); 3593 3398 [nbslice, flag_mask]=get_mask(filebase,handles); 3594 3399 if isequal(flag_mask,1) 3595 3400 mask_displ=[num2str(nbslice) 'mask']; 3596 3401 elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 3597 filebase_a=get(handles.Root Name_1,'String');3402 filebase_a=get(handles.RootFile_1,'String'); 3598 3403 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 3599 3404 if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) … … 3763 3568 filegrid=''; 3764 3569 if value 3765 filebase=get(handles.Root Name,'String');3570 filebase=get(handles.RootPath,'String'); 3766 3571 [nbslice, flag_grid]=get_grid(filebase,handles);% look for a grid with appropriate name 3767 3572 if isequal(flag_grid,1) … … 3843 3648 testmask=0; 3844 3649 if value 3845 filebase=get(handles.Root Name,'String');3650 filebase=get(handles.RootPath,'String'); 3846 3651 [nbslice, flag_mask]=get_mask(filebase,handles);% look for a mask with appropriate name 3847 3652 if isequal(flag_mask,1) … … 3891 3696 % --- Executes on button press in get_gridpatch1. 3892 3697 function get_gridpatch1_Callback(hObject, eventdata, handles) 3893 % hObject handle to get_gridpatch1 (see GCBO) 3894 % eventdata reserved - to be defined in a future version of MENUMATLAB 3895 % handles structure with handles and user data (see GUIDATA) 3896 3897 filebase=get(handles.RootName,'String'); 3698 filebase=get(handles.RootPath,'String'); 3898 3699 [FileName, PathName, filterindex] = uigetfile( ... 3899 3700 {'*.grid', ' (*.grid)'; … … 3903 3704 filegrid=fullfile(PathName,FileName); 3904 3705 set(handles.grid_patch1,'string',filegrid); 3905 % set(handles.grid_patch2,'string',filegrid 3706 3906 3707 3907 3708 %------------------------------------------------------------------------ … … 3946 3747 function get_ref_fix1_Callback(hObject, eventdata, handles) 3947 3748 %------------------------------------------------------------------------ 3948 filebase=get(handles.Root Name,'String');3749 filebase=get(handles.RootPath,'String'); 3949 3750 [FileName, PathName, filterindex] = uigetfile( ... 3950 3751 {'*.nc', ' (*.nc)'; … … 3992 3793 %------------------------------------------------------------------------ 3993 3794 if isequal(get(handles.get_ref_fix2,'Value'),1) 3994 filebase=get(handles.Root Name,'String');3795 filebase=get(handles.RootPath,'String'); 3995 3796 [FileName, PathName, filterindex] = uigetfile( ... 3996 3797 {'*.nc', ' (*.nc)'; … … 4059 3860 4060 3861 %------------------------------------------------------------------------ 4061 % --- Executes on button press in test_stereo1. 4062 function test_stereo1_Callback(hObject, eventdata, handles) 4063 %------------------------------------------------------------------------ 4064 if isequal(get(handles.test_stereo1,'Value'),0) 4065 set(handles.subdomain_patch1,'Visible','on') 4066 set(handles.rho_patch1,'Visible','on') 4067 else 4068 set(handles.subdomain_patch1,'Visible','off') 4069 set(handles.rho_patch1,'Visible','off') 4070 end 4071 4072 %------------------------------------------------------------------------ 4073 % --- Executes on button press in CheckStereo. 4074 function StereoCheck_Callback(hObject, eventdata, handles) 4075 %------------------------------------------------------------------------ 4076 if isequal(get(handles.CheckStereo,'Value'),0) 3862 % --- TO ABANDON Executes on button press in test_stereo1. 3863 function CheckStereo_Callback(hObject, eventdata, handles) 3864 %------------------------------------------------------------------------ 3865 hparent=get(hObject,'parent'); 3866 parent_tag=get(hparent,'Tag'); 3867 hchildren=get(hparent,'children'); 3868 handle_txtbox=findobj(hchildren,'tag','txt_Mask'); 3869 if isequal(get(hObject,'Value'),0) 4077 3870 set(handles.num_SubdomainSize,'Visible','on') 4078 3871 set(handles.num_SmoothingParam,'Visible','on') … … 4081 3874 set(handles.num_SmoothingParam,'Visible','off') 4082 3875 end 3876 3877 % %------------------------------------------------------------------------ 3878 % % --- Executes on button press in CheckStereo. 3879 % function StereoCheck_Callback(hObject, eventdata, handles) 3880 % %------------------------------------------------------------------------ 3881 % if isequal(get(handles.CheckStereo,'Value'),0) 3882 % set(handles.num_SubdomainSize,'Visible','on') 3883 % set(handles.num_SmoothingParam,'Visible','on') 3884 % else 3885 % set(handles.num_SubdomainSize,'Visible','off') 3886 % set(handles.num_SmoothingParam,'Visible','off') 3887 % end 4083 3888 4084 3889 %------------------------------------------------------------------------ … … 4544 4349 4545 4350 %determine nom_type_nc: 4546 NomTypeNc= '';%default4351 NomTypeNc=NomTypeIma;%default 4547 4352 switch mode 4548 4353 case 'pair j1-j2' … … 4604 4409 % --- Executes on button press in TestCiv2. 4605 4410 function TestCiv2_Callback(hObject, eventdata, handles) 4411 4412 4413 4414 function RootFile_Callback(hObject, eventdata, handles) 4415 4416 4417 -
trunk/src/find_file_series.m
r365 r371 4 4 % 5 5 % OUTPUT: 6 % Root Path,RootFile: root path and root name detected in fileinput, possibly modified for movies (indexing is then done on image view, not file)6 % RootFile: root file detected in fileinput, possibly modified for movies (indexing is then done on image view, not file) 7 7 % i1_series(ref_i+1, ref_j+1,pair),i2_series,j1_series,j2_series: set of indices (i1,i2,j1,j2) sorted by ref index ref_i, ref_j, and pairindex in case of multiple pairs with the same ref 8 8 % (ref_i+1 is used to deal with the image index zero sometimes used) … … 18 18 % 19 19 %INPUT 20 % fileinput: name (including path) of the input file 20 % RootPath: path to the directory to be scanned 21 % fileinput: name (without path) of the input file sample 21 22 % 22 23 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA … … 36 37 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 37 38 38 function [Root Path,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(fileinput)39 function [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPath,fileinput) 39 40 %------------------------------------------------------------------------ 40 41 41 42 %% get input root name and nomenclature type 42 [RootPath,SubDir,RootFile,tild,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fileinput); 43 [tild,tild,RootFile,tild,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fileinput); 44 fullfileinput=fullfile(RootPath,fileinput); 43 45 44 46 %% check for particular file types: images, movies, civ data … … 49 51 j1_series=zeros(1,1,1); 50 52 j2_series=zeros(1,1,1); 53 51 54 switch FileExt 52 55 % ancillary files, no field indexing … … 64 67 NomType=''; 65 68 otherwise 69 66 70 if ~isempty(FileExt)&& ~isempty(imformats(FileExt(2:end))) 67 71 try 68 imainfo=imfinfo(f ileinput);72 imainfo=imfinfo(fullfileinput); 69 73 FileType='image'; 70 74 if length(imainfo) >1 %case of image with multiple frames … … 72 76 FileType='multimage'; 73 77 i1_series=(1:length(imainfo))'; 74 [RootPath,RootFile]=fileparts(f ileinput);78 [RootPath,RootFile]=fileparts(fullfileinput); 75 79 end 76 80 end 77 81 else 78 82 try 79 Data=nc2struct(f ileinput,'ListGlobalAttribute','absolut_time_T0','Conventions');83 Data=nc2struct(fullfileinput,'ListGlobalAttribute','absolut_time_T0','Conventions'); 80 84 if ~isempty(Data.absolut_time_T0') 81 85 FileType='civx'; % test for civx velocity fields … … 88 92 try 89 93 if exist('VideoReader','file')%recent version of Matlab 90 Object=VideoReader(f ileinput);94 Object=VideoReader(fullfileinput); 91 95 else 92 Object=mmreader(f ileinput);%older Matlab function for movies96 Object=mmreader(fullfileinput);%older Matlab function for movies 93 97 end 94 98 NomType='*'; … … 100 104 101 105 if strcmp(NomType,'')||strcmp(NomType,'*') 102 if exist(fileinput,'file') 103 [RootPath,RootFile]=fileparts(fileinput);% case of constant name (no indexing) 104 else 105 RootPath=''; 106 if exist(fullfileinput,'file') 107 [tild,RootFile]=fileparts(fileinput);% case of constant name (no indexing) 108 else 106 109 RootFile=''; 107 110 end … … 163 166 end 164 167 end 165 detect_string=[ sep1 i1_str sep2 i2_str sep3 j1_str sep4 j2_str];%string used in regexp to detect file indices168 detect_string=['^' RootFile sep1 i1_str sep2 i2_str sep3 j1_str sep4 j2_str FileExt '$'];%string used in regexp to detect file indices 166 169 %find the string used to extract the relevant files with the command dir 167 star_string=[ '*'sep1 i1_star sep2 i2_star sep3 j1_star sep4 j2_star '*'];170 star_string=[RootFile sep1 i1_star sep2 i2_star sep3 j1_star sep4 j2_star '*']; 168 171 wd=pwd;%current working directory 169 RR=fullfile(RootPath,SubDir);170 cd (R R)% move to the local dir to save time in the operation dir.171 dirpair=dir([ RootFilestar_string FileExt]);% look for relevant files in the file directory172 %RR=fullfile(RootPath,SubDir); 173 cd (RootPath)% move to the local dir to save time in the operation dir. 174 dirpair=dir([star_string FileExt]);% look for relevant files in the file directory 172 175 cd(wd) 173 176 nbpair=numel(dirpair); -
trunk/src/fullfile_uvmat.m
r360 r371 115 115 end 116 116 end 117 if ~isempty(i2_str)||~isempty(j2_str)117 % if ~isempty(i2_str)||~isempty(j2_str) 118 118 filename=fullfile(RootPath,SubDir,RootFile); 119 else120 filename=fullfile(RootPath,RootFile);121 end119 % else 120 % filename=fullfile(RootPath,RootFile); 121 % end 122 122 filename=[filename sep1 i1_str sep2 i2_str sep3 j1_str sep4 j2_str FileExt]; 123 123 -
trunk/src/num2stra.m
r332 r371 25 25 % end 26 26 case 2 27 if isequal(nom_type(end),'a')||isequal(nom_type(end),'b')27 if ~isempty(nom_type) && (isequal(nom_type(end),'a')||isequal(nom_type(end),'b')) 28 28 str=char(96+num); 29 elseif isequal(nom_type(end),'A')|isequal(nom_type(end),'B')29 elseif ~isempty(nom_type) && (isequal(nom_type(end),'A')||isequal(nom_type(end),'B')) 30 30 str=char(64+num); 31 % elseif isequal(nom_type,'series_i')|isequal(nom_type,'netc_series')...32 % |isequal(nom_type,'ima_num')| isequal(nom_type,'avi')| isequal(nom_type,'none')...33 % isequal(nom_type,'_i')|isequal(nom_type,'_i1-i2')34 % str='';35 31 else 36 32 str=num2str(num); -
trunk/src/series.m
r360 r371 1177 1177 nbfield=cell2mat(Series.IndexRange.MaxIndex); 1178 1178 nb=min(nbfield,1); 1179 nbfield=nb(1);1180 nbfield2=nb(2);1179 % nbfield=nb(1); 1180 % nbfield2=nb(2); 1181 1181 1182 1182 %get complementary information from the 'series' interface … … 2194 2194 %% look for min and max indices existing in the file series and update SeriesData 2195 2195 errormsg=''; 2196 [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(fileinput); 2196 [RootPath,FileName,FileExt]=fileparts(fileinput); 2197 [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPath,[FileName FileExt]); 2197 2198 if isempty(RootFile)&&isempty(i1_series) 2198 2199 errormsg='no input file in the series'; -
trunk/src/uvmat.m
r368 r371 509 509 510 510 %% detect root name, nomenclature and indices in the input file name: 511 [tild,SubDir,tild,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput); 511 [RootPath,SubDir,tild,i1,i2,j1,j2]=fileparts_uvmat(fileinput); 512 [tild,FileName,FileExt]=fileparts(fileinput); 512 513 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 513 [Root Path,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput);514 [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[FileName FileExt]); 514 515 if strcmp(NomType,'*')% movies will be opened at the first frame 515 516 i1=1; … … 608 609 % read the current input file name: 609 610 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 610 fileinput=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];611 %fileinput=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 611 612 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 612 [ RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fileinput);613 [tild,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]); 613 614 % initiate the input file series and refresh the current field view: 614 615 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject); … … 1099 1100 % update_rootinfo_1(hObject,eventdata,handles) 1100 1101 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles); 1101 fileinput=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];1102 %fileinput=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 1102 1103 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 1103 [tild, tild,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fileinput);1104 [tild,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]); 1104 1105 % initiate the input file series and refresh the current field view: 1105 1106 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,2);
Note: See TracChangeset
for help on using the changeset viewer.