Changeset 360
- Timestamp:
- Jan 9, 2012, 1:16:35 AM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r356 r360 23 23 %TODO: search range 24 24 25 % Last Modified by GUIDE v2.5 21-Dec-2011 00:34:4925 % Last Modified by GUIDE v2.5 08-Jan-2012 11:00:13 26 26 % Begin initialization code - DO NOT EDIT 27 27 gui_Singleton = 1; … … 139 139 oldfile=filebase; 140 140 end 141 % ind_opening=1;%default 142 % browse.incr_pair=[0 0]; %default 143 %% get the new input fiel with the browser 141 142 %% get the new input file with the browser 144 143 menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)'; 145 144 '*.xml', '.xml files '; ... … … 159 158 [path,name,ext]=fileparts(fileinput); 160 159 testeditxml=0; 161 if isequal(ext,'.xml') 162 testeditxml=1; 163 t_browse=xmltree(fileinput); 164 head_element=get(t_browse,1); 165 if isfield(head_element,'name')&& isequal(head_element.name,'ImaDoc') 166 testeditxml=0; 167 end 168 end 169 if testeditxml==1 || isequal(ext,'.xls') 170 heditxml=editxml({fileinput}); 171 set(heditxml,'Tag','browser') 172 waitfor(heditxml,'Tag','idle') 173 if ~ishandle(heditxml) 174 return 175 end 176 attr=findobj(get(heditxml,'children'),'Tag','CurrentAttributes'); 177 set(handles.browse,'UserData',fileinput)% store for future opening with browser 178 fileinput=get(attr,'UserData'); 179 if ~exist(fileinput,'file') 180 return 181 end 182 end 183 %[RootPath,RootFile,str1,str2,str_a,str_b,FileExt,NomType,subdir]=name2display(fileinput); 160 % if isequal(ext,'.xml') 161 % testeditxml=1; 162 % t_browse=xmltree(fileinput); 163 % head_element=get(t_browse,1); 164 % if isfield(head_element,'name')&& isequal(head_element.name,'ImaDoc') 165 % testeditxml=0; 166 % end 167 % end 168 % if testeditxml==1 || isequal(ext,'.xls') 169 % heditxml=editxml({fileinput}); 170 % set(heditxml,'Tag','browser') 171 % waitfor(heditxml,'Tag','idle') 172 % if ~ishandle(heditxml) 173 % return 174 % end 175 % attr=findobj(get(heditxml,'children'),'Tag','CurrentAttributes'); 176 % set(handles.browse,'UserData',fileinput)% store for future opening with browser 177 % fileinput=get(attr,'UserData'); 178 % if ~exist(fileinput,'file') 179 % return 180 % end 181 % end 184 182 [tild,tild,tild,i1,i2,j1,j2,FileExt,NomType]=fileparts_uvmat(fileinput); 185 % filebase=fullfile(RootPath,RootFile);186 187 %% record the information obtained from the input file188 % if isempty(i1),i1=1;end189 % if isempty(i2),i2=i1;end190 % if isempty(j1),j1=1;end191 % if isempty(j2),j2=j1;end192 % if isequal(get(handles.ListCompareMode,'Value'),1)193 % browse=[];%initialisation194 % else195 % browse=get(handles.RootName,'UserData');196 % end197 % browse.num_i1=i1;198 % browse.num_i2=i2;199 % browse.num_j1=j1;200 % browse.num_j2=j2;201 % if length(FileExt)>1 && (~isempty(imformats(FileExt(2:end)))||strcmpi(FileExt,'.avi'));%if an image file has been opened by uvmat202 % browse.nom_type_ima=NomType;203 % browse.ext_ima=FileExt;204 % set(handles.ImaExt,'String',FileExt)205 % end206 % set(handles.RootName,'UserData',browse);% store information from browser207 183 208 184 %% prepare the GUI with parameters from the input file … … 321 297 %------------------------------------------------------------------------ 322 298 set(handles.RootName,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding 323 filebase=get(handles.RootName,'String'); 324 errormsg=display_file_name(handles,filebase); 299 [RootPath,RootFile]=fileparts(get(handles.RootName,'String')); 300 ref_i=str2num(get(handles.ref_i,'String')); 301 ref_j=str2num(get(handles.ref_j,'String')); 302 NomType=get(handles.NomType,'String'); 303 ImaExt=get(handles.ImaExt,'String'); 304 fileinput=fullfile_uvmat(RootPath,'',RootFile,ImaExt,NomType,ref_i,[],ref_j) 305 errormsg=display_file_name(handles,fileinput); 325 306 if ~isempty(errormsg) 326 msgbox_uvmat('ERROR',erro msg)307 msgbox_uvmat('ERROR',errormsg) 327 308 end 328 309 set(handles.RootName,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished … … 346 327 347 328 %% determine nomenclature types and extension of the input files 348 ext_ima='';%default349 NomTypeIma='';%default350 NomTypeNc='';351 %[RootPath,RootFile,i1_str,i2_str,j1_str,j2_str,ext_input,nom_type_input,SubDir]=name2display(fileinput);352 329 [RootPath,SubDir,RootFile,i1,i2,j1,j2,ExtInput,NomTypeInput]=fileparts_uvmat(fileinput); 353 [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomTypeInput,FileType,Object]=find_file_series(fileinput); 354 if strcmp(NomTypeInput,'*')% movies will be opened at the first frame 355 i1=1; 356 i2=[]; 357 j1=[]; 358 j2=[]; 359 end 330 NomTypeNc='';%default 331 332 %% case of netcdf file as input, look for a coresponding image 360 333 ind_opening=0;%default 361 switch FileType 362 case 'civdata' 363 Data=nc2struct(fileinput,'ListGlobalAttribute','CivStage','Civ1_ImageA'); 364 if isfield(Data,'Txt') 365 errormsg=Data.Txt; 366 return 367 end 334 if strcmp(ExtInput,'.xml') 335 Param=xml2struct(fileinput); 336 fill_GUI(Param,handles);%fill the GUI with the parameters retrieved from the xml file 337 return 338 end 339 if strcmp(ExtInput,'.nc') 340 NomTypeNc=NomTypeInput; 341 Data=nc2struct(fileinput,'ListGlobalAttribute','Conventions','absolut_time_T0','CivStage','Civ2_ImageA','Civ1_ImageA','fix','patch','civ2','fix2'); 342 if isfield(Data,'Txt') 343 errormsg=Data.Txt; 344 return 345 end 346 if strcmp(Data.Conventions,'uvmat/civdata')% case of new civ data, 347 set(handles.MenuMatlab,'checked','on') %select civ/Matlab by default 348 set(handles.MenuCivX,'checked','off') 368 349 if ~isempty(Data.CivStage)%test for civ files 369 350 ind_opening=Data.CivStage; 370 351 end 371 if ~isempty(Data.Civ 1_ImageA)%test for civ files352 if ~isempty(Data.Civ2_ImageA)%get the corresponding input image in the netcdf file 372 353 imageinput=Data.Civ1_ImageA; 373 if ~exist(imageinput,'file') 374 errormsg=['the image ' imageinput ' does not exist, please enter an image']; 375 return 376 end 377 end 378 set(handles.MenuMatlab,'checked','on') 379 set(handles.MenuCivX,'checked','off') 380 NomTypeNc=NomTypeInput; 381 case 'civx' 382 Data=nc2struct(fileinput,'ListGlobalAttribute','fix','patch','civ2','fix2'); 354 elseif ~isempty(Data.Civ1_ImageA) 355 imageinput=Data.Civ1_ImageA; 356 end 357 elseif ~isempty(Data.absolut_time_T0')% case of civx data, 358 set(handles.MenuMatlab,'checked','off') %select Cix by default 359 set(handles.MenuCivX,'checked','on') 383 360 if ~isempty(Data.fix2) 384 361 ind_opening=5; … … 390 367 ind_opening=2; 391 368 end 392 % look for the input images369 % look for the corresponding input images 393 370 check_letter=~isempty(regexp(NomTypeInput,'[ab|AB]$'));%detect pair label by letter 394 371 NomTypeIma=NomTypeInput; … … 396 373 NomTypeIma=NomTypeInput(1:end-1); 397 374 else 398 r=regexp(NomTypeIma,'.-(?<num2>\d+ $','names');375 r=regexp(NomTypeIma,'.-(?<num2>\d+)$','names'); 399 376 if ~isempty(r) 400 377 NomTypeIma=regexprep(NomTypeIma,['-' r.num2],''); 401 378 end 379 r=regexp(NomTypeIma,'.-(?<num2>\d+)','names'); 380 if ~isempty(r) 381 NomTypeIma=regexprep(NomTypeIma,['-' r.num2],''); 382 end 402 383 end 403 384 imageinput=fullfile_uvmat(RootPath,'',RootFile,'.png',NomTypeIma,i1,[],j1); 404 if ~exist(imageinput,'file') 405 errormsg='no image corresponds to the input .nc file, please open an image'; 406 return 407 end 385 else 386 errormsg='the input netcdf file is not civ data'; 387 return 388 end 389 end 390 391 %% scan the image series when a nc file has been opened 392 ImaExt=ExtInput; 393 if ~isempty(NomTypeNc) 394 %no corresponding image found, select manually with the browser 395 if ~exist(imageinput,'file') 396 menu={'*.png;*.jpg;*.tif;*.avi;*.AVI', '(*.png,*.jpg ,*.tif, *.avi,*.AVI)'; 397 '*.png','.png image files'; ... 398 '*.jpg',' jpeg image files'; ... 399 '*.tif','.tif image files'; ... 400 '*.avi;*.AVI','.avi movie files'; ... 401 '*.*', 'All Files (*.*)'}; 402 [FileName, PathName] = uigetfile( menu, 'Pick an input image file',fileparts(fileparts(fileinput))); 403 imageinput=[PathName FileName];%complete file name 404 405 end 406 fileinput=imageinput; 407 [tild, tild,ImaExt]=fileparts(imageinput); 408 end 409 [RootPath,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,Object]=find_file_series(fileinput); 410 if strcmp(NomTypeInput,'*')% movies will be opened at the first frame 411 i1=1; 412 i2=[]; 413 j1=[]; 414 j2=[]; 415 end 416 switch FileType 408 417 case {'image','multimage','video'} 409 imageinput=fileinput;410 NomTypeIma=NomTypeInput;411 ext_ima=ExtInput;412 418 otherwise 413 errormsg='invalid input file: enter an image, a movie or .nc file';414 end 415 [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomTypeIma,ImageType,Object]=find_file_series(imageinput); 419 errormsg='invalid input file: enter an image, a movie or civ .nc file'; 420 return 421 end 416 422 RootName=fullfile(RootPath,RootFile); 417 423 set(handles.RootName,'String',RootName) 424 browse=get(handles.RootName,'UserData'); 425 browse.nom_type_nc=NomTypeNc; 426 browse.incr_pair=[0 0];%default 427 428 %% fill reference indices from the input file indices 429 num_ref_i=i1;%efaulmt ref index 430 if ~isempty(i2) 431 num_ref_i=floor((num_ref_i+i2)/2); 432 end 433 num_ref_j=j1; 434 if ~isempty(j2) 435 num_ref_i=floor((num_ref_j+j2)/2); 436 end 437 438 %% scan the images if a civ file has been opened 439 if ~isempty(NomTypeNc) 440 [RootPath,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,ImageType,Object]=find_file_series(imageinput); 441 end 418 442 MaxIndex_i=max(i1_series(i1_series>0)); 419 443 MaxIndex_j=max(j1_series(j1_series>0)); 420 421 num_ref_i=i1;%efaulmt ref index422 num_ref_j=j1;423 browse=get(handles.RootName,'UserData');424 browse.nom_type_nc=NomTypeNc;425 browse.nom_type_ima=NomTypeInput;426 browse.incr_pair=[0 0];%default427 428 % % form=imformats(ext_input(2:end));429 % check_letter=0;430 % check_separator=0;431 % if ~isempty(ext_input)&&(~isempty(imformats(ext_input(2:end)))||strcmpi(ext_input,'.avi'))% if the extension corresponds to an image or movie format recognized by Matlab432 % ext_ima=ext_input;433 % nom_type_ima=nom_type_input;434 % imagename=fileinput;435 % check_letter=~isempty(regexp(nom_type_ima,'[a|A]$'));%detect pair label by letter436 % else %case of netcdf input file, look for corresponding images437 % nom_type_nc=nom_type_input;438 % imagename=fullfile_uvmat(RootPath,[],RootFile,ext_ima,nom_type_ima,1,[],1);439 % %imagename=name_generator(fullfile(RootPath,RootFile),1,1,ext_ima,nom_type_ima);440 % i1_str='';441 % j1_str='';442 % if ~isnan(i2)443 % num_ref_i=floor((num_ref_i+i2)/2);% reference image number corresponding to the file444 % browse.incr_pair(1)=i2-i1;445 % browse.incr_pair(2)=0;446 % end447 % %TODO: read the image name in the netcdf file (if documented)448 % %look for double image series '_i_j'449 % check_letter=~isempty(regexp(nom_type_nc,'[ab|AB]$'));%detect pair label by letter450 % if check_letter451 % j1_str=nom_type_nc(end-1);452 % r=regexp(nom_type_nc,'_(?<num1>\d+)','names');453 % if ~isempty(r)454 % i1_str=r.num1;455 % end456 % else457 % NomTypeIma=regexprep(nom_type_nc,'-\d','');%458 % r_end=regexp(NomTypeIma,'.\D(?<num2>\d+$','names');459 % if ~isempty(r_end)460 % j1_str=r.num2;461 % end462 % end463 % r=regexp(NomTypeIma,'_(?<num1>\d+)','names');464 % if ~isempty(r)465 % i1_str=r.num1;466 % end467 % dirima=dir([RootName '_' i1_str '_' j1_str '.*']);468 % if isempty(dirima)469 % % look for images series with sub marker '_'470 % dirima=dir([RootName '_*' i1_str '.*']);471 % if isempty(dirima)472 % % look for other images series473 % dirima=dir([RootName '*' i1_str '.*']);474 % if isempty(dirima)475 % % look for other images series witth letter appendix476 % appendix=char(96+j1_str);477 % dirima=dir([RootName '*' i1_str appendix '.*']);478 % end479 % end480 % end481 % for ilist=1:numel(dirima)482 % %[pp,ff,i1_str,i2_str,j1_str,j2_str,ext_list,nom_type_list]=name2display(dirima(ilist).name);483 % [tild,tild,tild,i1,i2,j1,j2,ext_list,nom_type_list]=fileparts_uvmat(dirima(ilist).name);484 % form=imformats(ext_list(2:end));485 % if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab486 % ext_ima=ext_list;487 % nom_type_ima=nom_type_list;488 % % i1=str2double(i1_str);489 % % j1=str2double(j1_str);490 % % i2=str2double(i2_str);491 % % j2=str2double(j2_str);492 % % set the range of fields (1:1 by default) and selected pair493 % if isempty(i2)494 % num_ref_i=i1;495 % else496 % num_ref_i=floor((i1+i2)/2);497 % browse.incr_pair(1)=i2-i1;498 % browse.incr_pair(2)=0;499 % end500 % if isempty(j2)501 % if isempty(j1)502 % num_ref_j=1;503 % else504 % num_ref_j=j1;505 % end506 % else507 % num_ref_j=floor((j1+j2)/2);508 % browse.incr_pair(2)=j2-j1;509 % end510 % break511 % end512 % end513 % end514 515 444 516 445 %% look for an image documentation file … … 528 457 end 529 458 set(handles.ImaDoc,'String',ext_imadoc)% display the extension name for the image documentation file used 530 531 459 532 460 %% read the time in the image documentation file … … 594 522 case {'.avi','.AVI'} 595 523 nom_type_ima='*'; 596 ext_ima=ext_imadoc;524 ImaExt=ext_imadoc; 597 525 set(handles.ListPairMode,'Value',1); 598 526 set(handles.ListPairMode,'String',{'series(Di)'}) … … 632 560 set(handles.CoordUnit,'String',CoordUnit) 633 561 set(handles.SearchRange,'UserData',[pxcmx_search pxcmy_search]); 634 set(handles.ImaExt,'String',ext_ima) 562 set(handles.ImaExt,'String',ImaExt) 563 set(handles.NomType,'String',NomTypeIma) 635 564 set(handles.ref_i,'String',num2str(num_ref_i)) 636 565 set(handles.first_i,'String',num2str(num_ref_i)); … … 639 568 set(handles.first_j,'String',num2str(num_ref_j)); 640 569 set(handles.last_j,'String',num2str(num_ref_j));% 570 % set(handles.civ,'UserData',CivData) 641 571 642 572 %% set the civ options depending on the input file content 643 % ind_opening=0;%default644 % if isequal(ext_input,'.nc')645 % browse.nom_type_nc=nom_type_input;646 % ind_opening=2;% propose 'fix' as the default option647 % Data=nc2struct(fileinput,'ListGlobalAttribute','CivStage','absolut_time_T0','fix','patch','civ2','fix2');648 % if isfield(Data,'Txt')649 % msgbox_uvmat('ERROR',Data.Txt)650 % return651 % end652 % if ~isempty(Data.CivStage)%test for civ files653 % ind_opening=Data.CivStage;654 % set(handles.ListPairMode,'Value',3)655 % end656 % end657 573 ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'}; 658 574 for index = 1:ind_opening … … 664 580 update_CivOptions(handles,1) 665 581 666 667 582 %% set the menus of image pairs and default selection for civ %%%%%%%%%%%%%%%%%%% 668 % test_ima_i=numel(nom_type_ima)>1 && isempty(regexp(nom_type_ima(2:end),'\D','once'))%=1 for images with single indexing669 % TODO: determine MaxIndex_i and MaxIndex_j using find_file_series (in the absence of xml file)670 % try671 583 check_letter=~isempty(regexp(NomTypeIma,'[ab|AB]$'));%detect pair label by letter 672 584 if ~check_letter|| isequal(NomTypeNc,'_1-2')|| (MaxIndex_j==1) … … 680 592 else 681 593 set(handles.ListPairMode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice 682 if MaxIndex_j <= 10 594 if strcmp(NomTypeNc,'_1-2_1') 595 set(handles.ListPairMode,'Value',3)% advise 'series(Di)' 596 elseif MaxIndex_j <= 10 683 597 set(handles.ListPairMode,'Value',1)% advice 'pair j1-j2' except in MaxIndex_j is large 684 598 end 685 599 end 686 % end687 600 688 601 %% update the subdirectory display … … 728 641 729 642 %% store info 730 % browse.nom_type_ima=nom_type_ima;731 643 set(handles.RootName,'UserData',browse)% store the nomenclature type 732 644 733 645 %% list the possible index pairs, depending on the option set in ListPairMode 734 646 ListPairMode_Callback([], [], handles) 735 browse=get(handles.RootName,'UserData');736 647 737 648 %% store the root input filename for future opening 738 649 profil_perso=fullfile(prefdir,'uvmat_perso.mat'); 739 % RootPath=fileparts(RootName);740 650 if exist(profil_perso,'file') 741 651 save (profil_perso,'RootPath','-append'); %store the root name for future opening of uvmat … … 769 679 set(handles.ListSubdirCiv2,'Value',ilist) 770 680 else % if Civ1 data already exist 771 find_netcpair_civ 1(handles); %update the list of available pairs from netcdf files in the new directory681 find_netcpair_civ(handles,1); %update the list of available pairs from netcdf files in the new directory 772 682 end 773 683 … … 787 697 %update the list of available pairs from netcdf files in the new directory 788 698 if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value') 789 find_netcpair_civ 2(handles);699 find_netcpair_civ(handles,2); 790 700 end 791 701 … … 849 759 set(handles.ListSubdirCiv1,'Visible','on') 850 760 if ~opening 851 find_netcpair_civ 1(handles) % select the available netcdf files761 find_netcpair_civ(handles,1) % select the available netcdf files 852 762 end 853 763 if max(checkbox(4:6))% case of civ2 pair choice needed … … 858 768 set(handles.ListPairCiv2,'Visible','on') 859 769 if ~opening 860 find_netcpair_civ 2(handles) % select the available netcdf files770 find_netcpair_civ(handles,2) % select the available netcdf files 861 771 end 862 772 else … … 1757 1667 end 1758 1668 end 1759 %[RootPath,RootFile,field_count,str2,str_a,str_b,ext,nom_type,SubDir]=name2display(fileresu);1760 1669 [RootPath,SubDir,RootFile]=fileparts_uvmat(fileresu); 1761 1670 namedoc=fullfile(RootPath,SubDir,RootFile); … … 1771 1680 end 1772 1681 end 1682 t=struct2xml(Param); 1683 save(t,[namedoc '.xml']); %save GUI parameters as xml file 1773 1684 saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) 1774 1685 … … 1844 1755 val=get(handles.ListCompareMode,'Value'); 1845 1756 compare=compare_list{val}; 1846 if strcmp(compare,'displacement') 1757 if strcmp(compare,'displacement')||strcmp(compare,'shift') 1847 1758 mode='displacement'; 1848 1759 else … … 1853 1764 %time=get(handles.RootName,'UserData'); %get the set of times 1854 1765 ext_ima=get(handles.ImaExt,'String'); 1855 nom_type_nc=browse.nom_type_nc; 1856 if isfield(browse,'nom_type_ima') 1857 nom_type_ima2=browse.nom_type_ima; 1858 end 1859 if isempty(nom_type_ima2),nom_type_ima2='1';end; %default 1860 if isempty(nom_type_nc),nom_type_nc='_1-2';end; %default 1766 if strcmp(compare,'displacement') 1767 nom_type_ima1='*'; 1768 else 1769 nom_type_ima1=get(handles.NomType,'String'); 1770 end 1771 nom_type_nc=nomtype2pair(nom_type_ima1,mode); 1772 1861 1773 [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... 1862 1774 find_pair_indices(handles,ref_i,ref_j,mode); 1863 1775 %determine the new filebase for 'displacement' ListPairMode (comparison of two series) 1864 1776 filebase_B=filebase;% root name of the second field series for stereo 1865 if strcmp(compare,'displacement') || strcmp(compare,'stereo PIV') 1866 % test_disp=1; 1867 nom_type_ima1=browse.nom_type_ima_1; %nomenclature type of the second file series 1777 if ~strcmp(compare,'PIV') 1868 1778 [Path2,Name2]=fileparts(filebase_B); 1869 1779 Path1=Path2; … … 1880 1790 % test_disp=0; 1881 1791 filebase_A=filebase; 1882 nom_type_ima 1=nom_type_ima2;1792 nom_type_ima2=nom_type_ima1; 1883 1793 filebase_AB=filebase; 1884 1794 end 1885 if strcmp(compare,'displacement') 1795 if strcmp(compare,'displacement')||strcmp(compare,'shift') 1886 1796 filebase_ima1=filebase_A; 1887 1797 filebase_ima2=filebase_B; … … 2353 2263 for j=1:nbslice 2354 2264 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)); 2355 % filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',...2356 % nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);%2357 2265 filecell.ncA.civ2(ifile,j)={filename}; 2358 2266 if ~exist(filename,'file') … … 2372 2280 for j=1:nbslice 2373 2281 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)); 2374 % filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',...2375 % nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);2376 2282 detect=exist(filename,'file')==2; 2377 2283 filecell.nc.civ2(ifile,j)={filename}; … … 2425 2331 for j=1:nbslice 2426 2332 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)); 2427 % filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',...2428 % nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);%2429 2333 filecell.nc.civ2(ifile,j)={filename}; 2430 2334 if ~exist(filename,'file') … … 2455 2359 for j=1:nbslice 2456 2360 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)); 2457 % filename=name_generator(filebase_AB,num1_civ1(ifile),num_a_civ1(j),'.nc',...2458 % nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);%2459 2361 filecell.st(ifile,j)={filename}; 2460 2362 end … … 2465 2367 for j=1:nbslice 2466 2368 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)); 2467 % filename=name_generator(filebase_AB,num1_civ2(ifile),num_a_civ2(j),'.nc',...2468 % nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);%2469 2369 filecell.st(ifile,j)={filename}; 2470 2370 end … … 2690 2590 function ListCompareMode_Callback(hObject, eventdata, handles) 2691 2591 %------------------------------------------------------------------------ 2692 test=get(handles.ListCompareMode,'Value'); 2693 if test==2 || test==3 % case 'displacement' or 'stereo PIV' 2592 menu=get(handles.ListCompareMode,'String'); 2593 val=get(handles.ListCompareMode,'Value'); 2594 option=menu{val}; 2595 if ~strcmp(option,'PIV') % case 'displacement' or 'stereo PIV' 2694 2596 filebase=get(handles.RootName,'String'); 2695 2597 browse=get(handles.RootName,'Userdata'); 2696 browse.nom_type_ima1=browse.nom_type_ima;2598 % browse.nom_type_ima1=browse.nom_type_ima; 2697 2599 set(handles.RootName,'UserData',browse); 2698 2600 set(handles.sub_txt,'Visible','on') … … 2735 2637 msgbox_uvmat('ERROR','The second image series must be in the same directory as the first one') 2736 2638 return 2737 end 2738 % set(handles.RootName_1,'String',name); 2739 %[RootPath,RootFile,field_count,str2,str_a,str_b,xx,nom_type,SubDir]=name2display(name); 2639 end 2740 2640 [tild,tild,RootFile,tild,tild,tild,tild,tild,nom_type]=fileparts_uvmat(name); 2741 2641 set(handles.RootName_1,'String',RootFile); 2742 2642 browse=get(handles.RootName,'UserData'); 2743 browse.nom_type_ima_1=nom_type;2643 %browse.nom_type_ima_1=nom_type; 2744 2644 set(handles.RootName,'UserData',browse) 2745 2645 … … 2749 2649 return 2750 2650 end 2751 2752 %% check coincidence of image sizes 2753 % ref_i=get(handles.ref_i,'string'); 2754 % ref_j=get(handles.ref_j,'string'); 2755 % [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc]=set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]); 2756 % A=imread(filecell.ima1.checkciv1{1}); 2757 % A_1=imread(fileinput); 2758 % npxy=size(A); 2759 % npxy_1=size(A_1); 2760 % if ~isequal(size(A),size(A_1)) 2761 % msgbox_uvmat('ERROR','The two input image series do not have the same size') 2762 % return 2763 % end 2651 2764 2652 else 2765 2653 set(handles.ListPairMode,'Visible','on') … … 2770 2658 set(handles.ListPairMode,'Value',1) 2771 2659 set(handles.ListPairMode,'String',mode_store) 2772 % set(handles.test_stereo1,'Value',0)2773 2660 set(handles.CheckStereo,'Value',0) 2774 2661 set(handles.ListPairMode,'Value',1) % mode 'civX' selected by default 2775 2662 end 2776 if test==3&& get(handles.CheckPatch1,'Value')2663 if strcmp(option,'stereo PIV') && get(handles.CheckPatch1,'Value') 2777 2664 set(handles.CheckStereo,'Visible','on') 2778 2665 else 2779 2666 set(handles.CheckStereo,'Visible','off') 2780 2667 end 2781 if test==3&& get(handles.CheckPatch2,'Value')2668 if strcmp(option,'stereo PIV') && get(handles.CheckPatch2,'Value') 2782 2669 set(handles.CheckStereo,'Visible','on') 2783 2670 else … … 2797 2684 val=get(handles.ListCompareMode,'Value'); 2798 2685 compare=compare_list{val}; 2799 if strcmp(compare,'displacement') 2686 if strcmp(compare,'displacement')||strcmp(compare,'shift') 2800 2687 mode='displacement'; 2801 2688 else … … 2821 2708 % are relative to the reference indices ref_i and ref_j respectively. 2822 2709 if isequal(mode,'pair j1-j2')%| isequal(mode,'st_pair j1-j2') 2823 2824 2710 dt=1; 2825 2711 displ=''; … … 2850 2736 displ_num(3,:)=0; 2851 2737 displ_num(4,:)=0; 2852 set(handles.jtext,'Visible','Off') 2853 set(handles.first_j,'Visible','Off') 2854 set(handles.last_j,'Visible','Off') 2855 set(handles.incr_j,'Visible','Off') 2856 set(handles.nb_field2,'Visible','Off') 2857 set(handles.ref_j,'Visible','Off') 2738 enable_j(handles, 'off') 2858 2739 elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') 2859 2740 index=1:200; … … 2861 2742 displ_num(2,index)=ceil(index/2); 2862 2743 displ_num(3:4,index)=zeros(2,200); 2863 % for index=1:min(nbfield2-1,200) 2864 % displ_num(1,index)=-floor(index/2); 2865 % displ_num(2,index)=ceil(index/2); 2866 % displ_num(3,index)=0; 2867 % displ_num(4,index)=0; 2868 % end 2869 set(handles.jtext,'Visible','On') 2870 set(handles.first_j,'Visible','On') 2871 set(handles.last_j,'Visible','On') 2872 set(handles.incr_j,'Visible','On') 2873 set(handles.nb_field2,'Visible','On') 2874 set(handles.ref_j,'Visible','On') 2875 % if nbfield > 1 2876 % set(handles.itext,'Visible','On') 2877 % set(handles.first_i,'Visible','On') 2878 % set(handles.last_i,'Visible','On') 2879 % set(handles.incr_i,'Visible','On') 2880 % set(handles.nb_field,'Visible','On') 2881 % set(handles.ref_i,'Visible','On') 2882 % else 2883 % set(handles.itext,'Visible','Off') 2884 % set(handles.first_i,'Visible','Off') 2885 % set(handles.last_i,'Visible','Off') 2886 % set(handles.incr_i,'Visible','Off') 2887 % set(handles.nb_field,'Visible','Off') 2888 % set(handles.ref_i,'Visible','Off') 2889 % end 2744 enable_j(handles, 'on') 2890 2745 elseif isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') 2891 2746 index=1:200; … … 2893 2748 displ_num(3,index)=-floor(index/2); 2894 2749 displ_num(4,index)=ceil(index/2); 2895 % for index=1:200%min(nbfield-1,200) 2896 % displ_num(1,index)=0; 2897 % displ_num(2,index)=0; 2898 % displ_num(3,index)=-floor(index/2); 2899 % displ_num(4,index)=ceil(index/2); 2900 % end 2901 set(handles.itext,'Visible','On') 2902 set(handles.first_i,'Visible','On') 2903 set(handles.last_i,'Visible','On') 2904 set(handles.incr_i,'Visible','On') 2905 set(handles.nb_field,'Visible','On') 2906 set(handles.ref_i,'Visible','On') 2750 enable_i(handles, 'on') 2907 2751 if nbfield2 > 1 2908 set(handles.jtext,'Visible','On') 2909 set(handles.first_j,'Visible','On') 2910 set(handles.last_j,'Visible','On') 2911 set(handles.incr_j,'Visible','On') 2912 set(handles.nb_field2,'Visible','On') 2913 set(handles.ref_j,'Visible','On') 2752 enable_j(handles, 'on') 2914 2753 else 2915 set(handles.jtext,'Visible','Off') 2916 set(handles.first_j,'Visible','Off') 2917 set(handles.last_j,'Visible','Off') 2918 set(handles.incr_j,'Visible','Off') 2919 set(handles.nb_field2,'Visible','Off') 2920 set(handles.ref_j,'Visible','Off') 2754 enable_j(handles, 'off') 2921 2755 end 2922 2756 elseif isequal(mode,'displacement')%the pairs have the same indices … … 2926 2760 displ_num(4,1)=0; 2927 2761 if nbfield > 1 || nbfield==0 2928 set(handles.itext,'Visible','On') 2929 set(handles.first_i,'Visible','On') 2930 set(handles.last_i,'Visible','On') 2931 set(handles.incr_i,'Visible','On') 2932 set(handles.nb_field,'Visible','On') 2933 set(handles.ref_i,'Visible','On') 2762 enable_i(handles, 'on') 2934 2763 else 2935 set(handles.itext,'Visible','Off') 2936 set(handles.first_i,'Visible','Off') 2937 set(handles.last_i,'Visible','Off') 2938 set(handles.incr_i,'Visible','Off') 2939 set(handles.nb_field,'Visible','Off') 2940 set(handles.ref_i,'Visible','Off') 2764 enable_j(handles, 'off') 2941 2765 end 2942 2766 if nbfield2 > 1 2943 set(handles.jtext,'Visible','On') 2944 set(handles.first_j,'Visible','On') 2945 set(handles.last_j,'Visible','On') 2946 set(handles.incr_j,'Visible','On') 2947 set(handles.nb_field2,'Visible','On') 2948 set(handles.ref_j,'Visible','On') 2767 enable_j(handles, 'on') 2949 2768 else 2950 set(handles.jtext,'Visible','Off') 2951 set(handles.first_j,'Visible','Off') 2952 set(handles.last_j,'Visible','Off') 2953 set(handles.incr_j,'Visible','Off') 2954 set(handles.nb_field2,'Visible','Off') 2955 set(handles.ref_j,'Visible','Off') 2769 enable_j(handles, 'off') 2956 2770 end 2957 2771 end 2958 2772 set(handles.ListPairCiv1,'UserData',displ_num); 2959 find_netcpair_civ1( handles) 2960 find_netcpair_civ2(handles) 2961 browse=get(handles.RootName,'UserData'); 2773 find_netcpair_civ( handles,1) 2774 % find_netcpair_civ2(handles) 2775 2776 function enable_i(handles, state) 2777 set(handles.itext,'Visible',state) 2778 set(handles.first_i,'Visible',state) 2779 set(handles.last_i,'Visible',state) 2780 set(handles.incr_i,'Visible',state) 2781 set(handles.nb_field,'Visible',state) 2782 set(handles.ref_i,'Visible',state) 2783 2784 function enable_j(handles, state) 2785 set(handles.jtext,'Visible',state) 2786 set(handles.first_j,'Visible',state) 2787 set(handles.last_j,'Visible',state) 2788 set(handles.incr_j,'Visible',state) 2789 set(handles.nb_field2,'Visible',state) 2790 set(handles.ref_j,'Visible',state) 2791 2962 2792 2963 2793 %------------------------------------------------------------------------ … … 3052 2882 mode_value=get(handles.ListPairMode,'Value'); 3053 2883 mode=mode_list{mode_value}; 3054 find_netcpair_civ 1(handles);% update the menu of pairs depending on the available netcdf files2884 find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files 3055 2885 if isequal(mode,'series(Di)') || ...% we do patch2 only 3056 2886 (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0) 3057 find_netcpair_civ 2( handles);2887 find_netcpair_civ( handles,2); 3058 2888 end 3059 2889 … … 3065 2895 mode=mode_list{mode_value}; 3066 2896 if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)') 3067 find_netcpair_civ 1(handles);% update the menu of pairs depending on the available netcdf files2897 find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files 3068 2898 end 3069 2899 if isequal(mode,'series(Dj)') || ... 3070 2900 (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0) 3071 find_netcpair_civ 2(handles);2901 find_netcpair_civ(handles,2); 3072 2902 end 3073 2903 % 2904 3074 2905 %------------------------------------------------------------------------ 3075 2906 % determine the menu for checkciv1 pairs depending on existing netcdf file at the middle of 3076 2907 % the field series set by first_i, incr, last_i 3077 function find_netcpair_civ 1(handles)2908 function find_netcpair_civ(handles,index) 3078 2909 %------------------------------------------------------------------------ 3079 2910 set(gcf,'Pointer','watch') 3080 %nomenclature types3081 2911 filebase=get(handles.RootName,'String'); 3082 2912 [filepath,Nme,ext_dir]=fileparts(filebase); … … 3095 2925 mode=mode_list{mode_value}; 3096 2926 end 3097 3098 % nomenclature type of the .nc files 3099 nom_type_ima=[];%default 3100 if isfield(browse,'nom_type_ima') 3101 nom_type_ima=browse.nom_type_ima; 3102 end 3103 3104 %determine nom_type_nc: 3105 nom_type_nc=[];%default 2927 nom_type_ima=get(handles.NomType,'String'); 2928 2929 %% determine nom_type_nc, nomenclature type of the .nc files: 2930 nom_type_nc='';%default 3106 2931 if isfield(browse,'nom_type_nc') 3107 2932 nom_type_nc=browse.nom_type_nc; 3108 2933 end 3109 2934 if isempty(nom_type_nc) 3110 [nom_type_nc]=nomtype2pair(nom_type_ima, isequal(mode,'series(Di)'),isequal(mode,'series(Dj)'));2935 [nom_type_nc]=nomtype2pair(nom_type_ima,mode); 3111 2936 end 3112 2937 browse.nom_type_nc=nom_type_nc; … … 3115 2940 %reads .nc subdirectoy and image numbers from the interface 3116 2941 subdir_civ1=get(handles.txt_SubdirCiv1,'String');%subdirectory subdir_civ1 for the netcdf data 2942 subdir_civ2=get(handles.txt_SubdirCiv2,'String');%subdirectory subdir_civ2 for the netcdf data 3117 2943 ref_i=str2double(get(handles.ref_i,'String')); 3118 2944 if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') … … 3122 2948 end 3123 2949 time=get(handles.ImaDoc,'UserData');%get the set of times 3124 % if isempty(time)3125 % time=[0 1];3126 % end3127 2950 TimeUnit=get(handles.TimeUnit,'String'); 3128 2951 checkframe=strcmp(TimeUnit,'frame'); 3129 3130 2952 displ_num=get(handles.ListPairCiv1,'UserData'); 3131 2953 … … 3151 2973 %% case with no Civ1 operation, netcdf files need to exist for reading 3152 2974 [RootPath,RootFile]=fileparts(filebase); 2975 if index==1 % case civ1 3153 2976 if ~get(handles.CheckCiv1,'Value') % 3154 2977 if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir') … … 3160 2983 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,... 3161 2984 ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair)); 3162 % filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,...3163 % ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1);3164 2985 select(ipair)=exist(filename,'file')==2;% put flag to 0 if the file does not exist 3165 2986 end … … 3172 2993 num_j2=ref_j+ceil(browse.incr_pair(2)/2); 3173 2994 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2); 3174 %filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ1);3175 2995 select(1)=exist(filename,'file')==2; 3176 2996 testpair=1; … … 3186 3006 end 3187 3007 end 3008 end 3009 else %case civ2 3010 if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value') 3011 if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir') 3012 errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist']) 3013 set(handles.ListPairCiv2,'Value',1); 3014 set(handles.ListPairCiv2,'String',{''}); 3015 return 3016 end 3017 for ipair=1:nbpair 3018 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,... 3019 ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair)); 3020 select(ipair)=exist(filename,'file')==2; 3021 end 3022 if isequal(select,zeros(size(1:nbpair))) 3023 if isfield(browse,'incr_pair') 3024 num_i1=ref_i-floor(browse.incr_pair(1)/2); 3025 num_i2=ref_i+floor((browse.incr_pair(1)+1)/2); 3026 num_j1=ref_j-floor(browse.incr_pair(2)/2); 3027 num_j2=ref_j+floor((browse.incr_pair(2)+1)/2); 3028 filename=fullfile_uvmat(RootPath,subdir_civ2,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2); 3029 select(1)=exist(filename,'file')==2; 3030 else 3031 if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 3032 msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2]) 3033 else 3034 msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2]) 3035 end 3036 set(handles.ListPairCiv2,'Value',1); 3037 set(handles.ListPairCiv2,'String',{''}); 3038 return 3039 end 3040 end 3041 end 3188 3042 end 3189 3043 … … 3270 3124 % determine the menu for checkciv2 pairs depending on the existing netcdf file at the 3271 3125 %middle of the series set by first_i, incr, last_i 3272 function find_netcpair_civ2(handles) 3273 %------------------------------------------------------------------------ 3274 set(gcf,'Pointer','watch') 3275 %nomenclature types 3276 filebase=get(handles.RootName,'String'); 3277 [filepath,Nme,ext_dir]=fileparts(filebase); 3278 browse=get(handles.RootName,'UserData'); 3279 compare_list=get(handles.ListCompareMode,'String'); 3280 val=get(handles.ListCompareMode,'Value'); 3281 compare=compare_list{val}; 3282 if strcmp(compare,'displacement') 3283 mode='displacement'; 3284 else 3285 mode_list=get(handles.ListPairMode,'String'); 3286 if isempty(mode_list) 3287 msgbox_uvmat('ERROR','please enter an input image or netcdf file') 3288 return 3289 end 3290 mode_value=get(handles.ListPairMode,'Value'); 3291 mode=mode_list{mode_value}; 3292 end 3293 3294 % nomenclature type of the .nc files 3295 nom_type_ima='ima_num';%default 3296 if isfield(browse,'nom_type_ima') 3297 nom_type_ima=browse.nom_type_ima; 3298 end 3299 nom_type_nc='_1-2';%default 3300 if isfield(browse,'nom_type_nc') 3301 nom_type_nc=browse.nom_type_nc; 3302 end 3303 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') 3304 nom_type_nc='netc_old';%nom_type for the netcdf files 3305 elseif isequal(nom_type_ima,'none')||isequal(nom_type_nc,'none') 3306 nom_type_nc='none'; 3307 elseif isequal(nom_type_ima,'avi')||isequal(nom_type_ima,'_i')||isequal(nom_type_ima,'ima_num')||isequal(nom_type_nc,'_1-2') 3308 nom_type_nc='_1-2'; 3309 else 3310 if isequal(mode,'series(Di)')%|isequal(mode,'st_series(Di)') 3311 nom_type_nc='_1-2_1'; % PIV in volume 3312 else 3313 nom_type_nc='_1_1-2'; 3314 end 3315 end 3316 browse.nom_type_nc=nom_type_nc; 3317 set(handles.RootName,'UserData',browse) 3318 3319 %reads .nc subdirectory and image numbers from the interface 3320 subdir_civ1=get(handles.txt_SubdirCiv1,'String');%subdirectory subdir_civ1 for the netcdf data 3321 subdir_civ2=get(handles.txt_SubdirCiv2,'String');%subdirectory subdir_civ2 for the netcdf data 3322 ref_i=str2double(get(handles.ref_i,'String')); 3323 if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') 3324 ref_j=0; 3325 else 3326 ref_j=str2double(get(handles.ref_j,'String')); 3327 end 3328 time=get(handles.ImaDoc,'UserData'); %get the set of times 3329 TimeUnit=get(handles.TimeUnit,'String'); 3330 checkframe=strcmp(TimeUnit,'frame'); 3331 % if isempty(time) 3332 % time=[0 1];%default 3126 % function find_netcpair_civ2(handles) 3127 % %------------------------------------------------------------------------ 3128 % set(gcf,'Pointer','watch') 3129 % %nomenclature types 3130 % filebase=get(handles.RootName,'String'); 3131 % [filepath,Nme,ext_dir]=fileparts(filebase); 3132 % browse=get(handles.RootName,'UserData'); 3133 % compare_list=get(handles.ListCompareMode,'String'); 3134 % val=get(handles.ListCompareMode,'Value'); 3135 % compare=compare_list{val}; 3136 % if strcmp(compare,'displacement') 3137 % mode='displacement'; 3138 % else 3139 % mode_list=get(handles.ListPairMode,'String'); 3140 % if isempty(mode_list) 3141 % msgbox_uvmat('ERROR','please enter an input image or netcdf file') 3142 % return 3143 % end 3144 % mode_value=get(handles.ListPairMode,'Value'); 3145 % mode=mode_list{mode_value}; 3333 3146 % end 3334 displ_num=get(handles.ListPairCiv1,'UserData'); 3335 3336 %eliminate the first pairs inconsistent with the position 3337 if isempty(displ_num) 3338 nbpair=0; 3339 else 3340 nbpair=length(displ_num(1,:));%nbre of displayed pairs 3341 if isequal(mode,'series(Di)')% | isequal(mode,'st_series(Di)') 3342 nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index 3343 elseif isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 3344 nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index 3345 end 3346 end 3347 nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 3348 3349 %% look for existing processed pairs at the reference indices if Civ1 will not 3350 % be performed, while the result is needed for next steps. 3351 displ_pair={''}; %default 3352 select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs 3353 [RootPath,RootFile]=fileparts(filebase); 3354 if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value') 3355 if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir') 3356 errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist']) 3357 set(handles.ListPairCiv2,'Value',1); 3358 set(handles.ListPairCiv2,'String',{''}); 3359 return 3360 end 3361 for ipair=1:nbpair 3362 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,... 3363 ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair)); 3364 % filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... 3365 % ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); 3366 select(ipair)=exist(filename,'file')==2; 3367 end 3368 if isequal(select,zeros(size(1:nbpair))) 3369 if isfield(browse,'incr_pair') 3370 num_i1=ref_i-floor(browse.incr_pair(1)/2); 3371 num_i2=ref_i+floor((browse.incr_pair(1)+1)/2); 3372 num_j1=ref_j-floor(browse.incr_pair(2)/2); 3373 num_j2=ref_j+floor((browse.incr_pair(2)+1)/2); 3374 filename=fullfile_uvmat(RootPath,subdir_civ2,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2); 3375 %filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ2); 3376 select(1)=exist(filename,'file')==2; 3377 else 3378 if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 3379 msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2]) 3380 else 3381 msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2]) 3382 end 3383 set(handles.ListPairCiv2,'Value',1); 3384 set(handles.ListPairCiv2,'String',{''}); 3385 return 3386 end 3387 end 3388 end 3389 if isequal(mode,'series(Di)') 3390 for ipair=1:nbpair 3391 if select(ipair) 3392 displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]; 3393 if ~checkframe && size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) 3394 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 dt 3395 displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)]; 3396 end 3397 else 3398 displ_pair{ipair}='...'; %pair not displayed in the menu 3399 end 3400 end 3401 elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') % series on the j index 3402 for ipair=1:nbpair 3403 if select(ipair) 3404 displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]; 3405 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)>=1 3406 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 dt 3407 else 3408 dt=1; 3409 end 3410 displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)]; 3411 else 3412 displ_pair{ipair}='...'; %pair not displayed in the menu 3413 end 3414 end 3415 elseif isequal(mode,'pair j1-j2')% | isequal(mode,'st_pair j1-j2') %case of pairs 3416 for ipair=1:nbpair 3417 if select(ipair) 3418 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)>=1 3419 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 dt 3420 else 3421 dt=1; 3422 end 3423 displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair)+1,nom_type_ima) '-' num2stra(displ_num(2,ipair)+1,nom_type_ima) ... 3424 ' :dt= ' num2str(dt*1000)]; 3425 3426 else 3427 displ_pair{ipair}='...'; %pair not displayed in the menu 3428 end 3429 end 3430 elseif isequal(mode,'displacement') 3431 displ_pair={'Di=Dj=0'}; 3432 end 3433 val=get(handles.ListPairCiv2,'Value'); 3434 ichoice=find(select,1); 3435 if (isempty(ichoice) || ichoice < 1); ichoice=1; end; 3436 if get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0 3437 val=ichoice;% first valid pair proposed by default in the menu 3438 end 3439 if val>length(displ_pair') 3440 set(handles.ListPairCiv2,'Value',1);% first valid pair proposed by default in the menu 3441 else 3442 set(handles.ListPairCiv2,'Value',val); 3443 end 3444 set(handles.ListPairCiv2,'String',displ_pair'); 3445 set(gcf,'Pointer','arrow') 3147 % 3148 % % nomenclature type of the .nc files 3149 % nom_type_ima='ima_num';%default 3150 % NomTypeIma=get(handles.NomType,'String'); 3151 % nom_type_nc='_1-2';%default 3152 % if isfield(browse,'nom_type_nc') 3153 % nom_type_nc=browse.nom_type_nc; 3154 % end 3155 % 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') 3156 % nom_type_nc='netc_old';%nom_type for the netcdf files 3157 % elseif isequal(nom_type_ima,'none')||isequal(nom_type_nc,'none') 3158 % nom_type_nc='none'; 3159 % elseif isequal(nom_type_ima,'avi')||isequal(nom_type_ima,'_i')||isequal(nom_type_ima,'ima_num')||isequal(nom_type_nc,'_1-2') 3160 % nom_type_nc='_1-2'; 3161 % else 3162 % if isequal(mode,'series(Di)')%|isequal(mode,'st_series(Di)') 3163 % nom_type_nc='_1-2_1'; % PIV in volume 3164 % else 3165 % nom_type_nc='_1_1-2'; 3166 % end 3167 % end 3168 % browse.nom_type_nc=nom_type_nc; 3169 % set(handles.RootName,'UserData',browse) 3170 % 3171 % %reads .nc subdirectory and image numbers from the interface 3172 % subdir_civ1=get(handles.txt_SubdirCiv1,'String');%subdirectory subdir_civ1 for the netcdf data 3173 % subdir_civ2=get(handles.txt_SubdirCiv2,'String');%subdirectory subdir_civ2 for the netcdf data 3174 % ref_i=str2double(get(handles.ref_i,'String')); 3175 % if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') 3176 % ref_j=0; 3177 % else 3178 % ref_j=str2double(get(handles.ref_j,'String')); 3179 % end 3180 % time=get(handles.ImaDoc,'UserData'); %get the set of times 3181 % TimeUnit=get(handles.TimeUnit,'String'); 3182 % checkframe=strcmp(TimeUnit,'frame'); 3183 % % if isempty(time) 3184 % % time=[0 1];%default 3185 % % end 3186 % displ_num=get(handles.ListPairCiv1,'UserData'); 3187 % 3188 % %eliminate the first pairs inconsistent with the position 3189 % if isempty(displ_num) 3190 % nbpair=0; 3191 % else 3192 % nbpair=length(displ_num(1,:));%nbre of displayed pairs 3193 % if isequal(mode,'series(Di)')% | isequal(mode,'st_series(Di)') 3194 % nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index 3195 % elseif isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 3196 % nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index 3197 % end 3198 % end 3199 % nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 3200 % 3201 % %% look for existing processed pairs at the reference indices if Civ1 will not 3202 % % be performed, while the result is needed for next steps. 3203 % displ_pair={''}; %default 3204 % select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs 3205 % [RootPath,RootFile]=fileparts(filebase); 3206 % if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value') 3207 % if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir') 3208 % errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist']) 3209 % set(handles.ListPairCiv2,'Value',1); 3210 % set(handles.ListPairCiv2,'String',{''}); 3211 % return 3212 % end 3213 % for ipair=1:nbpair 3214 % filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,... 3215 % ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair)); 3216 % % filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... 3217 % % ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); 3218 % select(ipair)=exist(filename,'file')==2; 3219 % end 3220 % if isequal(select,zeros(size(1:nbpair))) 3221 % if isfield(browse,'incr_pair') 3222 % num_i1=ref_i-floor(browse.incr_pair(1)/2); 3223 % num_i2=ref_i+floor((browse.incr_pair(1)+1)/2); 3224 % num_j1=ref_j-floor(browse.incr_pair(2)/2); 3225 % num_j2=ref_j+floor((browse.incr_pair(2)+1)/2); 3226 % filename=fullfile_uvmat(RootPath,subdir_civ2,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2); 3227 % %filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ2); 3228 % select(1)=exist(filename,'file')==2; 3229 % else 3230 % if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 3231 % msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2]) 3232 % else 3233 % msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2]) 3234 % end 3235 % set(handles.ListPairCiv2,'Value',1); 3236 % set(handles.ListPairCiv2,'String',{''}); 3237 % return 3238 % end 3239 % end 3240 % end 3241 % if isequal(mode,'series(Di)') 3242 % for ipair=1:nbpair 3243 % if select(ipair) 3244 % displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]; 3245 % if ~checkframe && size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) 3246 % 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 dt 3247 % displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)]; 3248 % end 3249 % else 3250 % displ_pair{ipair}='...'; %pair not displayed in the menu 3251 % end 3252 % end 3253 % elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') % series on the j index 3254 % for ipair=1:nbpair 3255 % if select(ipair) 3256 % displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]; 3257 % 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)>=1 3258 % 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 dt 3259 % else 3260 % dt=1; 3261 % end 3262 % displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)]; 3263 % else 3264 % displ_pair{ipair}='...'; %pair not displayed in the menu 3265 % end 3266 % end 3267 % elseif isequal(mode,'pair j1-j2')% | isequal(mode,'st_pair j1-j2') %case of pairs 3268 % for ipair=1:nbpair 3269 % if select(ipair) 3270 % 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)>=1 3271 % 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 dt 3272 % else 3273 % dt=1; 3274 % end 3275 % displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair)+1,nom_type_ima) '-' num2stra(displ_num(2,ipair)+1,nom_type_ima) ... 3276 % ' :dt= ' num2str(dt*1000)]; 3277 % 3278 % else 3279 % displ_pair{ipair}='...'; %pair not displayed in the menu 3280 % end 3281 % end 3282 % elseif isequal(mode,'displacement') 3283 % displ_pair={'Di=Dj=0'}; 3284 % end 3285 % val=get(handles.ListPairCiv2,'Value'); 3286 % ichoice=find(select,1); 3287 % if (isempty(ichoice) || ichoice < 1); ichoice=1; end; 3288 % if get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0 3289 % val=ichoice;% first valid pair proposed by default in the menu 3290 % end 3291 % if val>length(displ_pair') 3292 % set(handles.ListPairCiv2,'Value',1);% first valid pair proposed by default in the menu 3293 % else 3294 % set(handles.ListPairCiv2,'Value',val); 3295 % end 3296 % set(handles.ListPairCiv2,'String',displ_pair'); 3297 % set(gcf,'Pointer','arrow') 3446 3298 3447 3299 %------------------------------------------------------------------- … … 3833 3685 end 3834 3686 set(handles.txt_SubdirCiv1,'String',SubDir); 3835 find_netcpair_civ 1(handles)3687 find_netcpair_civ(handles,1) 3836 3688 3837 3689 %------------------------------------------------------------------------ … … 4674 4526 % Dtj: ~=0 if i index pairs are used 4675 4527 4676 function [nom_type_pair]=nomtype2pair(nom_type,Dti,Dtj)4528 function NomTypeNc=nomtype2pair(NomTypeIma,mode) 4677 4529 4678 4530 %determine nom_type_nc: 4679 nom_type_pair=[];%default 4680 if ischar(nom_type) 4681 switch nom_type 4682 case {'_i_j'} 4683 if Dtj>0 || Dtj<0 4684 nom_type_pair='_i_j1-j2'; 4685 if Dti>0 || Dti<0 4686 nom_type_pair='_i1-i2_j1-j2'; 4687 end 4688 elseif Dti>0 || Dti<0 4689 nom_type_pair='_i1-i21_j'; 4690 else 4691 nom_type_pair='_i_j'; 4692 end 4693 case {'_i1-i2_j'} 4694 if Dtj>0 || Dtj<0 4695 nom_type_pair='_i1-i2_j1-j2'; 4696 else 4697 nom_type_pair='_i1-i2_j'; 4698 end 4699 case {'i_j1-j2'} 4700 if Dti>0 || Dti<0 4701 nom_type_pair='_i1-i2_j1-j2'; 4702 else 4703 nom_type_pair='_i1-i2_j'; 4704 end 4705 case {'i1-i2_j1-j2'} 4706 nom_type_pair='_i1-i2_j1-j2'; 4707 case '#a' 4708 if Dtj>0 || Dtj<0 4709 nom_type_pair='#_ab'; 4710 end 4711 otherwise 4712 if Dti>0 || Dti<0 4713 nom_type_pair='_i1-i2'; 4714 end 4715 end 4716 end 4717 4531 NomTypeNc='';%default 4532 switch mode 4533 case 'pair j1-j2' 4534 if ~isempty(regexp(NomTypeIma,'a$')) 4535 NomTypeNc=[NomTypeIma 'b']; 4536 elseif ~isempty(regexp(NomTypeIma,'A$')) 4537 NomTypeNc=[NomTypeIma 'B']; 4538 else 4539 r=regexp(NomTypeIma,'(?<num1>\d+)_(?<num2>\d+)$','names'); 4540 if ~isempty(r) 4541 NomTypeNc='_1_1-2'; 4542 end 4543 end 4544 case 'series(Dj)' 4545 r=regexp(NomTypeIma,'(?<num1>\d+)_(?<num2>\d+)$','names'); 4546 if ~isempty(r) 4547 NomTypeNc='_1_1-2'; 4548 end 4549 case 'series(Di)' 4550 r=regexp(NomTypeIma,'(?<num1>\d+)_(?<num2>\d+)$','names'); 4551 if ~isempty(r) 4552 NomTypeNc='_1-2_1'; 4553 else 4554 NomTypeNc='_1-2'; 4555 end 4556 end 4557 4558 function NomType_Callback(hObject, eventdata, handles) -
trunk/src/find_file_series.m
r356 r360 88 88 try 89 89 if exist('VideoReader','file')%recent version of Matlab 90 Object=VideoReader(fileinput); 90 Object=VideoReader(fileinput); 91 91 else 92 Object=mmreader(fileinput);%older Matlab function for movies 92 Object=mmreader(fileinput);%older Matlab function for movies 93 93 end 94 94 NomType='*'; 95 FileType='video'; 95 FileType='video'; 96 96 i1_series=(1:get(Object,'NumberOfFrames'))'; 97 97 end … … 99 99 end 100 100 101 %% get the list of existing files when relevant102 101 if strcmp(NomType,'')||strcmp(NomType,'*') 103 102 if exist(fileinput,'file') 104 [RootPath,RootFile]=fileparts(fileinput);% case of constant name (no indexing)103 [RootPath,RootFile]=fileparts(fileinput);% case of constant name (no indexing) 105 104 else 106 RootPath=''; 107 RootFile=''; 108 end 109 else 110 if strcmp(SubDir,'') 111 filebasesub=fullfile(RootPath,RootFile); 112 else 113 filebasesub=fullfile(RootPath,SubDir,RootFile); 114 end 115 detect_string=regexprep(NomType,'\d','*');%replace numbers by '*' 116 old_string=''; 117 detect_string=regexprep(detect_string,'[ab]$','*');%suppress the possible letter ab at the end 118 detect_string=regexprep(detect_string,'[AB]$','*');%suppress the possible letter ab at the end 119 detect_string=regexprep(detect_string,'[a|A]$','*');%suppress a possible second letter a,A at the end 120 while ~strcmp(detect_string,old_string)%removes multiple '*' 121 old_string=detect_string; 122 detect_string=regexprep(detect_string,'**','*'); 123 end 124 dirpair=dir([filebasesub detect_string FileExt]); 105 RootPath=''; 106 RootFile=''; 107 end 108 else 109 %% analyse the list of existing files when relevant 110 sep1=''; 111 i1_str='(?<i1>)'; 112 i1_star=''; 113 sep2=''; 114 i2_str='(?<i2>)'; 115 i2_star=''; 116 sep3=''; 117 j1_str='(?<j1>)'; 118 j1_star=''; 119 sep4=''; 120 j2_str='(?<j2>)'; 121 j2_star=''; 122 NomTypeStr=NomType; 123 if ~isempty(regexp(NomTypeStr,'^_\d')) 124 sep1='_'; 125 NomTypeStr(1)=[];%remove '_' from the beginning of NomTypeStr 126 end 127 r=regexp(NomTypeStr,'^(?<num1>\d+)','names');%look for a number at the beginning of NomTypeStr 128 if ~isempty(r) 129 i1_str='(?<i1>\d+)'; 130 i1_star='*'; 131 NomTypeStr=regexprep(NomTypeStr,['^' r.num1],''); 132 r=regexp(NomTypeStr,'^-(?<num2>\d+)','names');%look for a pair i1-i2 133 if ~isempty(r) 134 sep2='-'; 135 i2_str='(?<i2>\d+)'; 136 i2_star='*'; 137 NomTypeStr=regexprep(NomTypeStr,['^-' r.num2],''); 138 end 139 if ~isempty(regexp(NomTypeStr,'^_')); 140 sep3='_'; 141 NomTypeStr(1)=[];%remove '_' from the beginning of NomTypeStr 142 end 143 if ~isempty(regexp(NomTypeStr,'^[a|A]')); 144 j1_str='(?<j1>[a-z]|[A-Z])'; 145 j1_star='*'; 146 if ~isempty(regexp(NomTypeStr,'[b|B]$')); 147 j2_str='(?<j1>[a-z]|[A-Z])'; 148 j2_star='*'; 149 end 150 else 151 r=regexp(NomTypeStr,'^(?<num3>\d+)','names'); 152 if ~isempty(r) 153 j1_str='(?<j1>\d+)'; 154 j1_star='*'; 155 NomTypeStr=regexprep(NomTypeStr,['^' r.num3],''); 156 end 157 r=regexp(NomTypeStr,'-(?<num4>\d+)','names'); 158 if ~isempty(r) 159 sep4='-'; 160 j2_str='(?<j2>\d+)'; 161 j2_star='*'; 162 end 163 end 164 end 165 detect_string=[sep1 i1_str sep2 i2_str sep3 j1_str sep4 j2_str];%string used in regexp to detect file indices 166 %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 '*']; 168 wd=pwd;%current working directory 169 RR=fullfile(RootPath,SubDir); 170 cd (RR)% move to the local dir to save time in the operation dir. 171 dirpair=dir([RootFile star_string FileExt]);% look for relevant files in the file directory 172 cd(wd) 125 173 nbpair=numel(dirpair); 126 174 ref_i_list=zeros(1,nbpair); … … 130 178 RootFile=''; 131 179 end 180 % scan the list of relevant files, extract the indices 132 181 for ifile=1:nbpair 133 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(dirpair(ifile).name); 182 rr=regexp(dirpair(ifile).name,detect_string,'names'); 183 i1=str2num(rr.i1); 184 i2=str2num(rr.i2); 185 j1=stra2num(rr.j1); 186 j2=stra2num(rr.j2); 134 187 ref_i=i1; 135 188 if isempty(i2_input) … … 187 240 ref_ij=ref_i_list*max_j+ref_j_list; % ordered by index i, then by j for a given i. 188 241 end 189 [tild,ifile ]=min(ref_ij(ref_ij>0));190 if isempty(ifile )242 [tild,ifile_min]=min(ref_ij(ref_ij>0)); 243 if isempty(ifile_min) 191 244 RootPath=''; 192 245 RootFile=''; 193 246 NomType=''; 194 247 else 195 [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ifile).name);248 [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ifile_min).name); 196 249 end 197 250 end -
trunk/src/fullfile_uvmat.m
r354 r360 36 36 37 37 function filename=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i1,i2,j1,j2) 38 % sizf=size(filebase);39 % if (~ischar(filebase)||~isequal(sizf(1),1)),filebase='';end40 % if ~exist('ext','var')41 % ext='';42 % end43 % if ~exist('nom_type','var')44 % nom_type='';45 % end46 % if ~ischar(ext),ext='';end47 % % idetect=0;48 % if ~exist('i1','var') || isempty(i1) || isnan(i1)49 % i1=1; %default50 % end51 % if ~exist('j1','var') || isempty(j1) || isnan(j1)52 % j1=1; %default53 % end54 % if ~exist('i2','var') || isempty(i2) || isnan(i2)55 % i2=i1; %default56 % end57 % if ~exist('j2','var') || isempty(j2) || isnan(j2)58 % j2=j1; %default59 % end60 % if ~exist('subdir','var')|| isempty(subdir)61 % subdir='' ; %default62 % end63 64 38 65 39 %% display help and test function in the absence of input arument … … 75 49 end 76 50 if isequal(j1,j2) 77 j2=[]; 51 j2=[];% suppress the secodn index if equal to the first 78 52 end 79 53 if ~exist('j1','var') … … 84 58 end 85 59 if isequal(i1,i2) 86 i2=[]; 60 i2=[];% suppress the secodn index if equal to the first 87 61 end 88 62 if ~exist('i1','var') … … 108 82 if ~isempty(r) 109 83 i1_str=num2str(i1,['%0' num2str(length(r.num1)) 'd']); 110 NomType=regexprep(NomType,['^' r.num1],''); 84 NomType=regexprep(NomType,['^' r.num1],''); 111 85 r=regexp(NomType,'^-(?<num2>\d+)','names');%look for a pair i1-i2 112 86 if ~isempty(r) 87 if ~isempty(i2) 113 88 sep2='-'; 114 89 i2_str=num2str(i2,['%0' num2str(length(r.num2)) 'd']); 90 end 115 91 NomType=regexprep(NomType,['^-' r.num2],''); 116 92 end … … 121 97 if ~isempty(regexp(NomType,'^[a|A]')); 122 98 j1_str=num2stra(j1,NomType); 123 if ~isempty(regexp(NomType,'[b|B]$')) ;99 if ~isempty(regexp(NomType,'[b|B]$'))&& ~isempty(j2); 124 100 j2_str=num2stra(j2,NomType); 125 101 end … … 130 106 NomType=regexprep(NomType,['^' r.num3],''); 131 107 end 108 if ~isempty(j2) 132 109 r=regexp(NomType,'-(?<num4>\d+)','names'); 133 if ~isempty(r) && ~isempty(j2)110 if ~isempty(r) 134 111 sep4='-'; 135 112 j2_str=num2str(j2,['%0' num2str(length(r.num4)) 'd']); 113 end 136 114 end 137 115 end -
trunk/src/series.m
r358 r360 1087 1087 function RUN_Callback(hObject, eventdata, handles) 1088 1088 %------------------------------------------------------------------------ 1089 %% Read parameters from series 1090 Series=read_GUI(handles.series)%TODO: extend to all input param 1091 Series.hseries=handles.series; % handles to the series GUI 1092 1089 1093 %% read root name and field type 1090 1094 set(handles.RUN,'BusyAction','queue'); … … 1096 1100 Series.GetObject=0; 1097 1101 end 1098 SeriesData=get(handles.series,'UserData');1102 % SeriesData=get(handles.series,'UserData'); 1099 1103 1100 1104 % Series.hseries=handles.series; % handles to the series GUI 1101 1102 %% Read parameters from series1103 Series=read_GUI(handles.series);%TODO: extend to all input param1104 Series.hseries=handles.series; % handles to the series GUI1105 1106 1105 first_i=1; 1107 1106 last_i=1; … … 1129 1128 NomType=Series.InputTable(:,4); 1130 1129 FileExt=Series.InputTable(:,5); 1131 % RootPath=get(handles.RootPath,'String');% path of the root name of the first field series 1132 % RootFile=get(handles.RootFile,'String');% root name of the first field series 1133 % SubDir=get(handles.SubDir,'String');% subdirectory for netcdf files 1134 % FileExt=get(handles.FileExt,'String');%file extension 1135 if isempty(SeriesData) 1136 msgbox_uvmat('ERROR','no input file series') 1137 return 1138 end 1130 % if isempty(SeriesData) 1131 % msgbox_uvmat('ERROR','no input file series') 1132 % return 1133 % end 1139 1134 % NomType=SeriesData.NomType; 1140 if length(RootPath)==1 %string character input for user fct1141 Series.RootPath=RootPath{1};1142 Series.RootFile=RootFile{1};1143 Series.SubDir=SubDir{1};1144 Series.FileExt=FileExt{1};1145 Series.NomType=NomType{1};1146 else %cell input for user fct1147 Series.RootPath=RootPath;1148 Series.RootFile=RootFile;1149 Series.SubDir=SubDir;1150 Series.FileExt=FileExt;1151 Series.NomType=NomType;1152 end1153 if isequal(get(handles.FieldMenu,'Visible'),'on')1154 FieldMenu=get(handles.FieldMenu,'String');1155 FieldValue=get(handles.FieldMenu,'Value');1156 Series.Field=FieldMenu(FieldValue);1157 end1135 % if length(RootPath)==1 %string character input for user fct 1136 % Series.RootPath=RootPath{1}; 1137 % Series.RootFile=RootFile{1}; 1138 % Series.SubDir=SubDir{1}; 1139 % Series.FileExt=FileExt{1}; 1140 % Series.NomType=NomType{1}; 1141 % else %cell input for user fct 1142 % Series.RootPath=RootPath; 1143 % Series.RootFile=RootFile; 1144 % Series.SubDir=SubDir; 1145 % Series.FileExt=FileExt; 1146 % Series.NomType=NomType; 1147 % end 1148 % if isequal(get(handles.FieldMenu,'Visible'),'on') 1149 % FieldMenu=get(handles.FieldMenu,'String'); 1150 % FieldValue=get(handles.FieldMenu,'Value'); 1151 % Series.Field=FieldMenu(FieldValue); 1152 % end 1158 1153 menu_coord_state=get(handles.transform_fct,'Visible'); 1159 1154 Series.CoordType='';%default … … 1164 1159 Series.transform_fct=transform_list{menu_index};% transform function handles 1165 1160 end 1166 1167 %1168 % first_i=str2num(get(handles.num_first_i,'String'));1169 % last_i=str2num(get(handles.num_last_i,'String'));1170 % incr_i=str2num(get(handles.num_incr_i,'String'));1171 % first_j=str2num(get(handles.num_first_j,'String'));1172 % last_j=str2num(get(handles.num_last_j,'String'));1173 % incr_j=str2num(get(handles.num_incr_j,'String'));1174 % if ~isequal(get(handles.num_first_i,'Visible'),'on')1175 % first_i=1;1176 % last_i=1;1177 % incr_i=1;1178 % end1179 % if ~isequal(get(handles.num_first_j,'Visible'),'on')1180 % first_j=1;1181 % last_j=1;1182 % incr_j=1;1183 % end1184 1161 1185 1162 %reinitiate waitbar position … … 1202 1179 nbfield=nb(1); 1203 1180 nbfield2=nb(2); 1204 % nbfield2=cell2mat(Series.IndexRange.MaxIndex);1205 % nbfield=min(nbfield);1206 % % nbfield=[]; %default1207 % % for iview=1:length(nbfield_cell)1208 % % nb=nbfield_cell{iview};1209 % % if ~isempty(nb)1210 % % nbfield=[nbfield nb];1211 % % end1212 % % end1213 % % nbfield=min(nbfield);1214 % nbfield2_cell=get(handles.num_MaxIndex_j,'String');1215 % nbfield2=[]; %default1216 % for iview=1:length(nbfield2_cell)1217 % nb=str2num(nbfield2_cell{iview});1218 % if ~isempty(nb)1219 % nbfield2=[nbfield2 nb];1220 % end1221 % end1222 % nbfield2=min(nbfield2);1223 1181 1224 1182 %get complementary information from the 'series' interface … … 1233 1191 %determine the list of input file names 1234 1192 nbmissing=0; 1235 for iview=1:length(RootPath) 1236 %case of pairs (.nc files) 1237 fileinput=name_generator(fullfile(RootPath{iview},RootFile{iview}),first_i,first_j,FileExt{iview},NomType{iview},1,first_i+1,first_j+1,SubDir{iview}); 1238 if strcmp(get(handles.Pairs,'Visible'),'on') 1239 pair_list=get(handles.list_pair_civ,'String'); 1240 val=get(handles.list_pair_civ,'Value'); 1241 pair_string=pair_list{val}; 1242 r=regexp(pair_string,'.*\D(?<num1>[\d+|*])(?<delim>[-||])(?<num2>[\d+|*])','names'); 1243 if ~isempty(r) 1244 if strcmp(r.num1,'*')%free pairs 1245 [tild,RootFile,i1_series,i2_series,j1_series,j2_series,tild,tild,Object]=find_file_series(fileinput)% TODO: choice pair when multiple choice 1246 1247 if isempty(i2_series) %j pairs 1248 ind_sel=i1_series>=i1_series>=first_i & i1_series<=last_i & j1_series>first_j & j2_series<last_j; 1249 j2_series=j2_series(ind_sel); 1250 else%i pairs 1251 if isempty(j1_series) %j pairs 1252 ind_sel=i1_series>=first_i & i2_series<=last_i ; 1253 else 1254 ind_sel=i1_series>=first_i & i2_series<=last_i& j1_series>first_j & j1_series<last_j; 1255 j1_series=j1_series(ind_sel); 1256 i2_series=i2_series(ind_sel); 1257 end 1258 end 1259 i1_series=i1_series(ind_sel); 1260 else 1261 if strcmp(r.delim,'-') 1262 ind_shift(1)=str2num(r.num1); 1263 ind_shift(2)=str2num(r.num2); 1264 else 1265 ind_shift(1)=-str2num(r.num1); 1266 ind_shift(2)=str2num(r.num2); 1267 end 1268 [i1_series,i2_series,j1_series,j2_series,nbmissing]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode); 1269 end 1270 end 1271 if isempty(i1_series) 1272 msgbox_uvmat('ERROR','no file in the considered range') 1273 return 1274 end 1275 if isempty(i2_series) 1276 i2_series=i1_series; 1277 end 1278 if isempty(j2_series) 1279 j2_series=j1_series; 1280 end 1281 % if isequal(NomType{iview},'_1_1-2')|| isequal(NomType{iview},'_1-2_1')|| isequal(NomType{iview},'_1-2')|| isequal(NomType{iview},'#_ab') 1282 % ind_shift=SeriesData.displ_num(iview,:); 1283 % if isequal(ind_shift,[0 0 0 0]) % undefined pairs 1284 % if isequal(NomType{iview},'#_ab') 1285 % mode='#_ab'; 1286 % end 1287 % [num_i1,i2_series,j1_series,num_j2,nbmissing]=netseries_generator(fullfile(RootPath{iview},RootFile{iview}),SubDir{iview},mode,num_first_i,num_incr_i,num_last_i,num_first_j,num_incr_j,num_last_j); 1288 % else 1289 % [num_i1,num_i2,num_j1,num_j2,num_i,num_j]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode); 1290 % if isempty(num_i) 1291 % msgbox_uvmat('ERROR','ERROR: empty set of input files chosen') 1292 % return 1293 % end 1294 % if num_i(1)>num_first_i 1295 % set(handles.num_first_i,'String',num2str(num_i(1)))%update the display of first field 1296 % last_i_Callback(hObject, eventdata, handles) 1297 % end 1298 % if num_i(end)<num_last_i 1299 % set(handles.num_last_i,'String',num2str(num_i(end)))%update the display of last field 1300 % last_i_Callback(hObject, eventdata, handles) 1301 % end 1302 % if num_j(1)>num_first_j 1303 % set(handles.num_first_j,'String',num2str(num_j(1)))%update the display of first field 1304 % last_j_Callback(hObject, eventdata, handles) 1305 % end 1306 % if num_j(end)<num_last_j 1307 % set(handles.num_last_j,'String',num2str(num_j(end)))%update the display of last field 1308 % last_j_Callback(hObject, eventdata, handles) 1309 % end 1310 % end 1311 else%case of images 1312 [i1_series,j1_series]=meshgrid(num_i,num_j); 1313 i2_series=i1_series; 1314 j2_series=j1_series; 1315 end 1316 if length(RootPath)>1 1317 i1_series_cell{iview}=i1_series; 1318 i2_series_cell{iview}=i2_series; 1319 j1_series_cell{iview}=j1_series; 1320 j2_series_cell{iview}=j2_series; 1321 end 1322 end 1193 % for iview=1:length(RootPath) 1194 % %case of pairs (.nc files) 1195 % fileinput=name_generator(fullfile(RootPath{iview},RootFile{iview}),first_i,first_j,FileExt{iview},NomType{iview},1,first_i+1,first_j+1,SubDir{iview}); 1196 % if strcmp(get(handles.Pairs,'Visible'),'on') 1197 % pair_list=get(handles.list_pair_civ,'String'); 1198 % val=get(handles.list_pair_civ,'Value'); 1199 % pair_string=pair_list{val}; 1200 % r=regexp(pair_string,'.*\D(?<num1>[\d+|*])(?<delim>[-||])(?<num2>[\d+|*])','names'); 1201 % if ~isempty(r) 1202 % if strcmp(r.num1,'*')%free pairs 1203 % [tild,RootFile,i1_series,i2_series,j1_series,j2_series,tild,tild,Object]=find_file_series(fileinput);% TODO: choice pair when multiple choice 1204 % 1205 % if isempty(i2_series) %j pairs 1206 % ind_sel=i1_series>=i1_series>=first_i & i1_series<=last_i & j1_series>first_j & j2_series<last_j; 1207 % j2_series=j2_series(ind_sel); 1208 % else%i pairs 1209 % if isempty(j1_series) %j pairs 1210 % ind_sel=i1_series>=first_i & i2_series<=last_i ; 1211 % else 1212 % ind_sel=i1_series>=first_i & i2_series<=last_i& j1_series>first_j & j1_series<last_j; 1213 % j1_series=j1_series(ind_sel); 1214 % i2_series=i2_series(ind_sel); 1215 % end 1216 % end 1217 % i1_series=i1_series(ind_sel); 1218 % else 1219 % if strcmp(r.delim,'-') 1220 % ind_shift(1)=str2num(r.num1); 1221 % ind_shift(2)=str2num(r.num2); 1222 % else 1223 % ind_shift(1)=-str2num(r.num1); 1224 % ind_shift(2)=str2num(r.num2); 1225 % end 1226 % [i1_series,i2_series,j1_series,j2_series,nbmissing]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode); 1227 % end 1228 % end 1229 % if isempty(i1_series) 1230 % msgbox_uvmat('ERROR','no file in the considered range') 1231 % return 1232 % end 1233 % if isempty(i2_series) 1234 % i2_series=i1_series; 1235 % end 1236 % if isempty(j2_series) 1237 % j2_series=j1_series; 1238 % end 1239 % else%case of images 1240 % [i1_series,j1_series]=meshgrid(num_i,num_j); 1241 % i2_series=i1_series; 1242 % j2_series=j1_series; 1243 % end 1244 % if length(RootPath)>1 1245 % i1_series_cell{iview}=i1_series; 1246 % i2_series_cell{iview}=i2_series; 1247 % j1_series_cell{iview}=j1_series; 1248 % j2_series_cell{iview}=j2_series; 1249 % end 1250 % end 1323 1251 1324 1252 %% defining the ACTION function handle … … 1344 1272 %% RUN ACTION 1345 1273 Series.Action=action;%name of the processing programme 1274 Series 1346 1275 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 1347 if length(RootPath)>1 1348 h_fun(i1_series_cell,i2_series_cell,j1_series_cell,j2_series_cell,Series); 1349 else 1350 h_fun(i1_series,i2_series,j1_series,j2_series,Series); 1351 end 1276 h_fun(Series); 1277 % if length(RootPath)>1 1278 % h_fun(i1_series_cell,i2_series_cell,j1_series_cell,j2_series_cell,Series); 1279 % else 1280 % h_fun(i1_series,i2_series,j1_series,j2_series,Series); 1281 % end 1352 1282 set(handles.RUN,'BackgroundColor',[1 0 0]) 1353 1283 -
trunk/src/uvmat.m
r354 r360 469 469 function display_file_name(hObject, eventdata, handles,fileinput,index) 470 470 %------------------------------------------------------------------------ 471 %% analyse the input file471 %% look for the input file existence 472 472 if ~exist(fileinput,'file') 473 473 msgbox_uvmat('ERROR',['input file ' fileinput ' does not exist']) … … 475 475 end 476 476 477 %% have a unique function for fileinput (index=1) and fileinput_1 (index=2) 477 %% set the mouse pointer to 'watch' 478 set(handles.uvmat,'Pointer','watch') 479 set(handles.RootPath,'BackgroundColor',[1 1 0]) 480 drawnow 481 482 %% define the relevant handles for the first fiel series (index=1) or the second file series (index=2) 478 483 if ~exist('index','var') 479 484 index=1; … … 502 507 set(handles.NomType_1,'Visible','on'); 503 508 end 504 % detect root name, nomenclature and indices in the input file name: 509 510 %% detect root name, nomenclature and indices in the input file name: 505 511 [tild,SubDir,tild,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput); 506 512 % detect the file type, get the movie object if relevant, and look for the corresponding file series: … … 512 518 j2=[]; 513 519 end 514 % open the file or fill the GUI uvmat according to the detected file type 520 521 %% open the file or fill the GUI uvmat according to the detected file type 515 522 switch FileType 516 523 case '' … … 536 543 set(handles_FileExt,'String',FileExt); 537 544 if index==1 538 % fill file index counters 545 % fill file index counters if the first file series is opened 539 546 set(handles.i1,'String',num2str(i1)); 540 547 set(handles.i2,'String',num2str(i2)); 541 548 set(handles.j1,'String',num2stra(j1,NomType)); 542 549 set(handles.j2,'String',num2stra(j2,NomType)); 543 else %read the current field index 550 else %read the current field index if the second file series is opened 544 551 i1=str2num(get(handles.i1,'String')); 545 552 i2=str2num(get(handles.i2,'String')); … … 547 554 j2=stra2num(get(handles.j2,'String')); 548 555 end 556 549 557 % synchronise indices of the second input file if it exists 550 558 if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers 551 % if index==1552 559 Input=read_GUI(handles.InputFile); 553 560 if ~isfield(Input,'RootPath_1')||strcmp(Input.RootPath_1,'"') … … 564 571 if exist(FileName_1,'file') 565 572 FileIndex_1=fullfile_uvmat('','','','',Input.NomType_1,i1,i2,j1,j2); 566 %FileIndex_1=name_generator('',i1,i2,'',NomType_1,1,j1,j2,'');567 573 set(handles.FileIndex_1,'String',FileIndex_1) 568 574 else … … 588 594 set(handles.frame_object,'Visible','on') 589 595 590 % initiate input file series and refresh the current field view: 591 596 % initiate input file series and refresh the current field view: 592 597 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,index); 593 598 594 599 end 600 601 %% set back the mouse pointer to arrow 602 set(handles.uvmat,'Pointer','arrow') 595 603 596 604 %------------------------------------------------------------------------ … … 601 609 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 602 610 fileinput=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 603 % fileinput=read_file_boxes(handles);604 611 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 605 612 [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fileinput); … … 640 647 function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,index) 641 648 %------------------------------------------------------------------------ 642 %% TODO: have a unique function for update_rootinfo and update_rootinfo_1649 %% define the relevant handles depending on the index (1=first file series, 2= second file series) 643 650 if ~exist('index','var') 644 651 index=1; … … 650 657 handles_RootPath=handles.RootPath_1; 651 658 handles_Fields=handles.Fields_1; 652 %..........................653 659 end 654 660 … … 664 670 UvData.j1_series{index}=j1_series; 665 671 UvData.j2_series{index}=j2_series; 666 set(handles.fix_pair,'Value',1) % activate by default the comp_input '-'input window672 % set(handles.CheckFixPair,'Value',1) % activate by default the comp_input '-'input window 667 673 set(handles.FixVelType,'Value',0); %desactivate fixed veltype 668 %[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles);669 674 if index==1 670 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);675 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 671 676 else 672 677 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles); … … 681 686 nbfield_j=[];%default 682 687 683 % read timing and total frame number from the current file (movie files) !! may be overrid by xml file688 %% read timing and total frame number from the current file (movie files) !! may be overrid by xml file 684 689 XmlData.Time=[];%default 685 690 XmlData.GeometryCalib=[];%default … … 732 737 set(handles.CheckBW,'Value',strcmp(ColorType,'grayscale'))% select handles.CheckBW if grayscale image 733 738 734 % read parameters (time, geometric calibration..) from a documentation file (.xml advised)739 %% read parameters (time, geometric calibration..) from a documentation file (.xml advised) 735 740 filexml=[FileBase '.xml']; 736 741 fileciv=[FileBase '.civ']; 737 742 warntext='';%default warning message 738 743 NbSlice=1;%default 739 744 set(handles.RootPath,'BackgroundColor',[1 1 1]) 740 745 if exist(filexml,'file') 741 746 set(handles.view_xml,'Visible','on') 742 747 set(handles.view_xml,'BackgroundColor',[1 1 0]) 743 set(handles.RootPath,'BackgroundColor',[1 1 1])744 748 set(handles.view_xml,'String','view .xml') 745 749 drawnow … … 815 819 if isequal(nbfield,1) && ~isequal(nbfield_j,1)% .Time is a line vector 816 820 NomType=get(handles.NomType,'String'); 817 % NomType=get(handles.FileIndex,'UserData');818 821 if numel(NomType)>=2 &&(strcmp(NomType,'_i')||strcmp(NomType(1:2),'%0')||strcmp(NomType(1:2),'_%')) 819 822 XmlData.Time=(XmlData.Time)'; … … 838 841 set(handles.last_j,'String',last_j_cell); 839 842 840 % store geometric calibration in UvData843 %% store geometric calibration in UvData 841 844 if isfield(XmlData,'GeometryCalib') 842 845 GeometryCalib=XmlData.GeometryCalib; … … 877 880 end 878 881 879 % update the data attached to the uvmat interface882 %% update the data attached to the uvmat interface 880 883 if ~isempty(TimeUnit) 881 884 set(handles.time_txt,'String',['time (' TimeUnit ')']) 882 885 end 883 886 UvData.TimeUnit=TimeUnit; 884 UvData.XmlData =XmlData;887 UvData.XmlData{index}=XmlData; 885 888 UvData.NewSeries=1; 886 889 % UvData.MovieObject=MovieObject; … … 891 894 end 892 895 893 % set default options in menu 'Fields'896 %% set default options in menu 'Fields' 894 897 if ~testima 895 898 testcivx=0; … … 919 922 920 923 %% set index navigation options and refresh plots 921 set(handles.RootPath,'BackgroundColor',[1 1 1]) 922 drawnow 923 set_scan_options(handles) 924 925 %% update list of recent files in the menubar 926 MenuFile=[{get(handles.MenuFile_1,'Label')};{get(handles.MenuFile_2,'Label')};... 927 {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}]; 928 str_find=strcmp(FileName,MenuFile); 929 if isempty(find(str_find,1)) 930 MenuFile=[{FileName};MenuFile];%insert the current file if not already in the list 931 end 932 for ifile=1:min(length(MenuFile),5) 933 eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',MenuFile{ifile});']) 934 eval(['set(handles.MenuFile_' num2str(ifile) '_1,''Label'',MenuFile{ifile});']) 935 end 936 dir_perso=prefdir; 937 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 938 if exist(profil_perso,'file') 939 save (profil_perso,'MenuFile','-append'); %store the file names for future opening of uvmat 940 else 941 save (profil_perso,'MenuFile','-V6'); %store the file names for future opening of uvmat 942 end 943 944 %------------------------------------------------------------------------ 945 %--- Set index navigation options for new series input and refresh plot 946 %------------------------------------------------------------------------ 947 function set_scan_options(handles) 948 949 % set the corresponding index navigation options 950 NomType=get(handles.NomType,'String'); 951 NomType_1=get(handles.NomType_1,'String'); 952 % NomType=get(handles.FileIndex,'UserData'); 953 % NomType_1=get(handles.FileIndex_1,'UserData'); 954 last_i_str=get(handles.last_i,'String'); 955 nbfield=str2num(last_i_str{1}); 956 if numel(last_i_str)==2 957 nbfield=min(nbfield,str2num(last_i_str{2})); 958 end 924 scan_option='i';%default 959 925 state_j='off'; %default 960 scan_option='i';%default 961 NomTypeRaw=regexprep(NomType(2:end), '-', ''); 962 if numel(regexp(NomTypeRaw,'\D'))>=1 926 if index==2 927 if get(handles.scan_j,'Value') 928 scan_option='j'; %keep the scan option for the second fiel series 929 end 930 if strcmp(get(handles.j1,'Visible'),'on') 963 931 state_j='on'; 964 if isequal(nbfield,1) 932 end 933 end 934 if ~isempty(j1_series) 935 state_j='on'; 936 if isequal(nbfield,1) &&index==1 965 937 scan_option='j'; %scan j index by default if nbfield=1 966 938 end 967 end968 if ~isempty(NomType_1)969 NomTypeRaw=regexprep(NomType_1(2:end), '-', '');970 if numel(regexp(NomTypeRaw,'\D'))>=1971 state_j='on';972 if isequal(nbfield,1)973 scan_option='j';974 end975 end976 939 end 977 940 if isequal(scan_option,'i') … … 988 951 set(handles.frame_j,'Visible',state_j); 989 952 set(handles.j_text,'Visible',state_j); 990 if strcmp(state_j,'on')991 set(handles. fix_pair,'Visible','on')992 else 993 set(handles. fix_pair,'Visible','off')953 if ~isempty(i2_series)||~isempty(j2_series) 954 set(handles.CheckFixPair,'Visible','on') 955 elseif index==1 956 set(handles.CheckFixPair,'Visible','off') 994 957 end 995 958 … … 1004 967 CheckMask_Callback([],[],handles) 1005 968 end 969 970 %% update list of recent files in the menubar 971 MenuFile=[{get(handles.MenuFile_1,'Label')};{get(handles.MenuFile_2,'Label')};... 972 {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}]; 973 str_find=strcmp(FileName,MenuFile); 974 if isempty(find(str_find,1)) 975 MenuFile=[{FileName};MenuFile];%insert the current file if not already in the list 976 end 977 for ifile=1:min(length(MenuFile),5) 978 eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',MenuFile{ifile});']) 979 eval(['set(handles.MenuFile_' num2str(ifile) '_1,''Label'',MenuFile{ifile});']) 980 end 981 dir_perso=prefdir; 982 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 983 if exist(profil_perso,'file') 984 save (profil_perso,'MenuFile','-append'); %store the file names for future opening of uvmat 985 else 986 save (profil_perso,'MenuFile','-V6'); %store the file names for future opening of uvmat 987 end 988 1006 989 1007 990 %------------------------------------------------------------------------ … … 1110 1093 display_file_name(hObject,eventdata,handles,fileinput_1,2) 1111 1094 1112 %------------------------------------------------------------------------1113 % NOT USED fills the edit boxes RootPath_1, RootFile_1,NomType_1...from an input file name 'fileinput_1'1114 %------------------------------------------------------------------------1115 % function display_file_name_1(hObject,eventdata,handles,fileinput_1)1116 %1117 % %[path,name,ext]=fileparts(fileinput_1);1118 % [tild,SubDir_1,tild,i1,i2,j1,j2,FileExt_1]=fileparts_uvmat(fileinput_1);1119 % [RootPath_1,RootFile_1,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput_1);1120 % % [RootPath_1,RootFile_1,field_count,str2,str_a,str_b,FileExt_1,NomType_1,SubDir_1]=name2display(fileinput_1);1121 % switch FileType1122 % case ''1123 % msgbox_uvmat('ERROR','invalid input file type')1124 % case 'txt'1125 % edit(fileinput)1126 % case 'figure' %display matlab figure1127 % hfig=open(fileinput_1);1128 % set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action functio1129 % set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse click action function1130 % set(hfig,'WindowButtonUpFcn','mouse_down')%set mouse click action function1131 % case {'xml','xls'} % edit xml or Excel files1132 % editxml(fileinput_1);1133 % % case {'.avi','.image','.vol','.nc','.cdf'}1134 % otherwise1135 % set(handles.RootPath_1,'String',RootPath_1);1136 % if isequal(SubDir_1,'')1137 % rootname=fullfile(RootPath_1,RootFile_1);1138 % else1139 % rootname=fullfile(RootPath_1,SubDir_1,RootFile_1);1140 % SubDir=['/' SubDir_1]; %display the separator1141 % end1142 % set(handles.SubDir_1,'String',SubDir_1);1143 % set(handles.RootFile_1,'String',['/' RootFile_1]); %display the separator1144 % indices=fileinput_1(length(rootname)+1:end);1145 % indices(end-length(FileExt_1)+1:end)=[]; %remove extension1146 % set(handles.FileIndex,'String',indices);1147 % % set(handles.FileIndex,'UserData',NomType);1148 % set(handles.NomType_1,'String',NomType);1149 % set(handles.FileExt_1,'String',FileExt_1);1150 % % fill file index counters1151 % set(handles.i1,'String',num2str(i1));1152 % set(handles.i2,'String',num2str(i2));1153 % set(handles.j1,'String',num2str(j1));1154 % set(handles.j2,'String',num2str(j2));1155 %1156 % % synchronise indices of the second input file if it exists1157 % if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers1158 % [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles);1159 % %[ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles);1160 % NomType_1=get(handles.NomType_1,'String');1161 % % NomType_1=get(handles.FileIndex_1,'UserData');1162 % %FileName_1=name_generator(FileBase_1,i1,i2,FileExt_1,NomType_1,1,j1,j2,SubDir_1);1163 % FileName_1=fullfile_uvmat(RootPath_1,SubDir_1,RootFile_1,FileExt_1,NomType_1,i1,i2,j1,j2);1164 % if exist(FileName_1,'file')1165 % FileIndex_1=fullfile_uvmat('','','','',NomType_1,i1,i2,j1,j2);1166 % %FileIndex_1=name_generator('',i1,i2,'',NomType_1,1,j1,j2,'');1167 % set(handles.FileIndex_1,'String',FileIndex_1)1168 % else1169 % set(handles.SubField,'Value',0)1170 % SubField_Callback(hObject, eventdata, handles)1171 % end1172 % end1173 % end1174 %1175 % % test for image series in a single file and synchronise file indices of the two series1176 % if nbfield_1 >1 %case of image with multiple frames1177 % if nbfield_1 < num_i11178 % msgbox_uvmat('ERROR','current frame index beyond the input movie length')1179 % return1180 % else1181 % NomType_1='*'; %indicate a set of indexed frames within a single file1182 % filename_new=fileinput_1;1183 % end1184 % else % cases of data files1185 % RootPath=get(handles.RootPath,'String');1186 % RootFile=get(handles.RootFile,'String');1187 % FileBase=fullfile(RootPath,RootFile);1188 % FileBase_1=fullfile(RootPath_1,RootFile_1);1189 % if isequal(FileBase,FileBase_1)1190 % filename_new=fileinput_1;1191 % else1192 % num_i1=stra2num(get(handles.i1,'String'));%get the current file indices from counters1193 % num_j1=stra2num(get(handles.j1,'String'));1194 % num_i2=stra2num(get(handles.i2,'String'));1195 % num_j2=stra2num(get(handles.j2,'String'));1196 % [filename_new,idetect]=...1197 % name_generator(FileBase_1,num_i1,num_j1,FileExt_1,NomType_1,1,num_i2,num_j2,SubDir_1);%create name with indices synchronised with the first file1198 % indices=''; %default1199 % if ~idetect1200 % msgbox_uvmat('ERROR','second input file with indices corresponding to the first one does not exist')1201 % return1202 % end1203 % end1204 % end1205 % set(handles.NomType_1,'String',NomType_1);1206 % % set(handles.FileIndex_1,'UserData',NomType_1);1207 %1208 % % make visible and fill the second raw of edit boxes1209 % set(handles.RootPath_1,'Visible','on')1210 % set(handles.RootFile_1,'Visible','on')1211 % set(handles.SubDir_1,'Visible','on');1212 % set(handles.FileIndex_1,'Visible','on');1213 % set(handles.FileExt_1,'Visible','on');1214 % %[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles);1215 % [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);1216 % FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];1217 % FileBase=fullfile(RootPath,RootFile);1218 % if isequal(FileBase,FileBase_1)1219 % set(handles.RootPath_1,'String','"')1220 % set(handles.RootFile_1,'String','"');1221 % else1222 % set(handles.RootPath_1,'String',RootPath_1)1223 % set(handles.RootFile_1,'String',['/' RootFile_1]);1224 % end1225 % if isequal(SubDir_1,'')1226 % set(handles.SubDir_1,'String','');1227 % FileBaseSub_1=FileBase_1;1228 % else1229 % set(handles.SubDir_1,'String',['/' SubDir_1]);1230 % FileBaseSub_1=fullfile(FileBase_1,SubDir_1);1231 % end1232 % indices=filename_new(length(FileBaseSub_1)+1:end);1233 % indices(end-length(FileExt_1)+1:end)=[]; %remove extension1234 % set(handles.FileIndex_1,'String',indices)1235 % set(handles.NomType_1,'String',NomType_1)1236 % % set(handles.FileIndex_1,'UserData',NomType_1)1237 % set(handles.FileExt_1,'String',FileExt_1);1238 %1239 % % % default choice of fields1240 % %set(handles.SubField,'Visible','on')1241 % set(handles.SubField,'Value',1)1242 % RootPath_1_Callback(hObject,eventdata,handles);1243 1244 1095 %----------------------------------------------------------------------- 1245 1096 % --- Called by action in RootPath_1 edit box 1246 1097 function RootPath_1_Callback(hObject,eventdata,handles) 1247 1098 % ----------------------------------------------------------------------- 1248 update_rootinfo_1(hObject,eventdata,handles) 1249 1099 % update_rootinfo_1(hObject,eventdata,handles) 1100 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles); 1101 fileinput=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 1102 % 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 % initiate the input file series and refresh the current field view: 1105 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,2); 1250 1106 %----------------------------------------------------------------------- 1251 1107 % --- Called by action in RootFile_1 edit box 1252 1108 function RootFile_1_Callback(hObject, eventdata, handles) 1253 1109 % ----------------------------------------------------------------------- 1254 update_rootinfo_1(hObject,eventdata,handles)1110 RootPath_1_Callback(hObject,eventdata,handles) 1255 1111 1256 1112 %------------------------------------------------------------------------ … … 1259 1115 %------------------------------------------------------------------------ 1260 1116 run0_Callback(hObject, eventdata, handles) 1261 1262 % %------------------------------------------------------------------------1263 % % --- Update information about a new second field series (indices to scan, timing,1264 % % calibration from an xml file, then refresh current plots1265 % function update_rootinfo_1(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject) %A REVOIR1266 % % -----------------------------------------------------------------------1267 % set(handles.RootPath_1,'BackgroundColor',[1 1 0])% indicate active program by yellow color1268 % drawnow1269 % UvData=get(handles.uvmat,'UserData');%huvmat=handles of the uvmat interface1270 % UvData.NewSeries=1; %flag for run0: begin a new series1271 % [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles);1272 % FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];1273 % %[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes_1(handles);1274 % if ~exist(FileName,'file')1275 % msgbox_uvmat('ERROR',['input file ' FileName ' not found']);1276 % end1277 % set(handles.FixVelType,'Value',0); %desactivate fixed veltype1278 % nbfield_1=[];%default1279 % nbfield_j_1=[];%default1280 % XmlData.Time=[];1281 % XmlData.GeometryCalib=[];%default1282 % TimeUnit=[];1283 % if isfield(UvData,'TimeUnit')1284 % TimeUnit=UvData.TimeUnit;1285 % end1286 % TimeUnit_1=[];1287 % hhh='';%default, test for movie reading with mmreader1288 % imainfo=[];1289 % FileBase=fullfile(RootPath,RootFile);1290 % if isequal(lower(FileExt),'.avi') %.avi file1291 % imainfo=aviinfo([FileBase FileIndices FileExt]);1292 % nbfield_1=imainfo.NumFrames;1293 % nbfield_j_1=1;1294 % set(handles.Dt_txt,'String',['Dt=' num2str(1000/info.FramesPerSecond) 'ms']);%display the elementary time interval in millisec1295 % time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)';1296 % ColorType=imainfo.ImageType;%='truecolor' for color images1297 % hhh=which('mmreader');1298 % elseif ~isempty(imformats(FileExt(2:end)))|| isequal(FileExt,'.vol')1299 % if ~isequal(SubDir,'')1300 % RootFile=get(handles.RootFile,'String');1301 % imainfo=imfinfo([fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]);1302 % else1303 % imainfo=imfinfo([FileBase FileIndices FileExt]);1304 % end1305 % ColorType=imainfo.ColorType;%='truecolor' for color images1306 % if length(imainfo) >1 %case of image with multiple frames1307 % nbfield_1=length(imainfo);1308 % nbfield_j_1=1;1309 % end1310 % end1311 % if ~strcmp(hhh,'')&& mmreader.isPlatformSupported()% if the function is found (recent version of matlab)1312 % UvData.MovieObject_1=mmreader([FileBase FileIndices FileExt]);1313 % elseif isfield(UvData,'MovieObject_1')1314 % UvData=rmfield(UvData,'MovieObject_1');1315 % end1316 % if ~isempty(imainfo)% (an image has been introduced as second fierld input)1317 % if strcmp(get(handles.num_Npx,'String'),'') || strcmp(get(handles.num_Npy,'String'),'')%update npx and npy if it is not already filled by the first input field1318 % if isfield(imainfo,'Width') && isfield(imainfo,'Height')1319 % set(handles.num_Npx,'String',num2str(imainfo.Width));%fills nbre of pixels x box1320 % set(handles.num_Npy,'String',num2str(imainfo.Height));%fills nbre of pixels x box1321 % else1322 % set(handles.num_Npx,'String','');%fills nbre of pixels x box1323 % set(handles.num_Npy,'String','');%fills nbre of pixels x box1324 % end1325 % set(handles.CheckBW,'Value',strcmp(ColorType,'grayscale'))% select handles.CheckBW if grayscale image1326 % end1327 % end1328 % % find scaling parameters1329 % filexml=[FileBase '.xml'];1330 % fileciv=[FileBase '.civ'];1331 % warntext='';%default warning text1332 % if exist(filexml,'file')1333 % [XmlData,warntext]=imadoc2struct(filexml);1334 % if ~isempty(warntext)1335 % msgbox_uvmat('WARNING',warntext)1336 % end1337 % if isfield(XmlData,'Camera')1338 % if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit)1339 % TimeUnit=XmlData.Camera.TimeUnit;1340 % end1341 % end1342 % elseif exist(fileciv,'file')% if .civ file found1343 % [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']);1344 % GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0];1345 % GeometryCalib.Tx=0;1346 % GeometryCalib.Ty=0;1347 % GeometryCalib.Tz=1;1348 % GeometryCalib.dpx=1;1349 % GeometryCalib.dpy=1;1350 % GeometryCalib.sx=1;1351 % GeometryCalib.Cx=0;1352 % GeometryCalib.Cy=0;1353 % GeometryCalib.f=1;1354 % GeometryCalib.kappa1=0;1355 % GeometryCalib.CoordUnit='cm';1356 % XmlData.GeometryCalib=GeometryCalib;1357 % if error==2, warntext=['no file ' FileBase '.civ'];1358 % elseif error==1, warntext='inconsistent number of fields in the .civ file';1359 % end1360 %1361 % set(handles.num_Npx,'String',num2str(npx));%fills nbre of pixels x box1362 % set(handles.num_Npy,'String',num2str(npy));%fills nbre of pixels y box1363 % set(handles.pxcm,'String',num2str(pxcmx));%fills scale x (pixel/cm) box1364 % set(handles.pycm,'String',num2str(pxcmy));%fills scale y (pixel/cm) box1365 % set(handles.pxcm,'Visible','on');%fills scale x (pixel/cm) box1366 % set(handles.pycm,'Visible','on');%fills scale y (pixel/cm) box1367 % end1368 % if ~isempty(TimeUnit_1) && ~isequal(TimeUnit_1,TimeUnit)1369 % msgbox_uvmat('WARNING','the time units for the second series differs from the first one')1370 % end1371 %1372 % % store last index in handles.lat_i and .last_j1373 % if ~isempty(XmlData.Time)1374 % nbfield_1=size(XmlData.Time,1);1375 % nbfield_j_1=size(XmlData.Time,2);1376 % end1377 % last_i_cell=get(handles.last_i,'String');1378 % if isempty(nbfield_1)1379 % last_i_cell{2}='';1380 % else1381 % last_i_cell{2}=num2str(nbfield_1);1382 % end1383 % set(handles.last_i,'String',last_i_cell)1384 % last_j_cell=get(handles.last_j,'String');1385 % if isempty(nbfield_j_1)1386 % last_j_cell{2}='';1387 % else1388 % last_j_cell{2}=num2str(nbfield_j_1);1389 % end1390 % set(handles.last_j,'String',last_j_cell);1391 % if ~isequal(last_i_cell{1},last_i_cell{2}) || ~isequal(last_j_cell{1},last_j_cell{2})1392 % msgbox_uvmat('WARNING','the numbers of input file of the second series differs from the first one')1393 % end1394 %1395 % % store calibration data1396 % GeometryCalib=XmlData.GeometryCalib;1397 % if isempty(GeometryCalib)1398 % if isfield(UvData, 'GeometryCalib_1')1399 % UvData=rmfield(UvData,'GeometryCalib_1');1400 % end1401 % else1402 % UvData.GeometryCalib_1=GeometryCalib;1403 % if (isfield(GeometryCalib,'R')&& ~isequal(GeometryCalib.R(2,1),0) && ~isequal(GeometryCalib.R(1,2),0)) ||...1404 % (isfield(GeometryCalib,'kappa1')&& ~isequal(GeometryCalib.kappa1,0))1405 % set(handles.pxcm,'String','var')1406 % set(handles.pycm,'String','var')1407 % else1408 % if isfield(GeometryCalib,'fx_fy')1409 % pixcmx=GeometryCalib.fx_fy(1);1410 % pixcmy=GeometryCalib.fx_fy(2);1411 % set(handles.pxcm,'String',num2str(pixcmx))1412 % set(handles.pycm,'String',num2str(pixcmy))1413 % end1414 % end1415 % end1416 % UvData.XmlData_1=XmlData;1417 % set(handles.uvmat,'UserData',UvData)%update the data attached to the uvmat interface1418 %1419 % if ~isequal(warntext,'')1420 % msgbox_uvmat('WARNING',warntext)1421 % end1422 %1423 % set(handles.RootPath_1,'BackgroundColor',[1 1 1])% signa the end the input operation1424 % drawnow1425 %1426 % set_scan_options(handles)1427 1117 1428 1118 %------------------------------------------------------------------------ … … 1433 1123 set(handles.scan_i,'BackgroundColor',[1 1 0]) 1434 1124 set(handles.scan_j,'Value',0) 1435 % set(handles.scan_j,'BackgroundColor',[0.831 0.816 0.784])1436 1125 else 1437 1126 set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784]) 1438 1127 set(handles.scan_j,'Value',1) 1439 % set(handles.scan_j,'BackgroundColor',[1 1 0])1440 1128 end 1441 1129 scan_j_Callback(hObject, eventdata, handles) … … 1449 1137 set(handles.scan_i,'Value',0) 1450 1138 set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784]) 1451 NomType=get(handles.NomType,'String'); 1452 % NomType=get(handles.FileIndex,'UserData'); 1453 switch NomType 1454 case {'_1_1-2','#_ab','%3dab'},% pair with j index 1455 set(handles.fix_pair,'Visible','on')% option fixed pair on/off made visible (choice of avaible pair with buttons + and - if ='off') 1456 otherwise 1457 set(handles.fix_pair,'Visible','off') 1458 end 1139 % NomType=get(handles.NomType,'String'); 1140 % switch NomType 1141 % case {'_1_1-2','#_ab','%3dab'},% pair with j index 1142 % set(handles.CheckFixPair,'Visible','on')% option fixed pair on/off made visible (choice of avaible pair with buttons + and - if ='off') 1143 % otherwise 1144 % set(handles.CheckFixPair,'Visible','off') 1145 % end 1459 1146 else 1460 1147 set(handles.scan_j,'BackgroundColor',[0.831 0.816 0.784]) 1461 1148 set(handles.scan_i,'Value',1) 1462 1149 set(handles.scan_i,'BackgroundColor',[1 1 0]) 1463 set(handles. fix_pair,'Visible','off')1150 set(handles.CheckFixPair,'Visible','off') 1464 1151 end 1465 1152 … … 1705 1392 transform=transform_list{choice_value}; 1706 1393 if ~isequal(transform_name,'') && ~isequal(transform_name,'px') 1707 if isfield(UvData,'XmlData') && isfield(UvData.XmlData ,'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority1708 Calib=UvData.XmlData .GeometryCalib;1709 Mask=transform(Mask,UvData.XmlData );1394 if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority 1395 Calib=UvData.XmlData{1}.GeometryCalib; 1396 Mask=transform(Mask,UvData.XmlData{1}); 1710 1397 end 1711 1398 end … … 1763 1450 drawnow 1764 1451 %TODO: introduce the option: increment ='*' to move to the next available view 1765 increment=str2 double(get(handles.increment_scan,'String')); %get the field increment d1766 if isnan(increment)1767 set(handles.increment_scan,'String','1')%default value1768 increment=1;1769 end1452 increment=str2num(get(handles.increment_scan,'String')); %get the field increment d 1453 % if isnan(increment) 1454 % set(handles.increment_scan,'String','1')%default value 1455 % increment=1; 1456 % end 1770 1457 errormsg=runpm(hObject,eventdata,handles,increment); 1771 1458 if ~isempty(errormsg) … … 1782 1469 set(handles.runmin,'BackgroundColor',[1 1 0])%paint the command button in yellow 1783 1470 drawnow 1784 increment=-str2 double(get(handles.increment_scan,'String')); %get the field increment d1785 if isnan(increment)1786 set(handles.increment_scan,'String','1')%default value1787 increment=1;1788 end1471 increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d 1472 % if isnan(increment) 1473 % set(handles.increment_scan,'String','1')%default value 1474 % increment=1; 1475 % end 1789 1476 errormsg=runpm(hObject,eventdata,handles,increment); 1790 1477 if ~isempty(errormsg) … … 1799 1486 set(handles.Movie,'BackgroundColor',[1 1 0])%paint the command button in yellow 1800 1487 drawnow 1801 increment=str2 double(get(handles.increment_scan,'String')); %get the field increment d1802 if isnan(increment)1803 set(handles.increment_scan,'String','1')%default value1804 increment=1;1805 end1488 increment=str2num(get(handles.increment_scan,'String')); %get the field increment d 1489 % if isnan(increment) 1490 % set(handles.increment_scan,'String','1')%default value 1491 % increment=1; 1492 % end 1806 1493 set(handles.STOP,'Visible','on') 1807 1494 set(handles.speed,'Visible','on') … … 1830 1517 set(handles.MovieBackward,'BackgroundColor',[1 1 0])%paint the command button in yellow 1831 1518 drawnow 1832 increment=-str2double(get(handles.increment_scan,'String')); %get the field increment d 1833 if isnan(increment) 1834 set(handles.increment_scan,'String','1')%default value 1835 increment=1; 1836 end 1519 increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d 1837 1520 set(handles.STOP,'Visible','on') 1838 1521 set(handles.speed,'Visible','on') … … 1871 1554 function errormsg=runpm(hObject,eventdata,handles,increment) 1872 1555 %------------------------------------------------------------------------ 1556 errormsg='';%default 1873 1557 %% check for movie pair status 1874 1558 movie_status=get(handles.movie_pair,'Value'); … … 1881 1565 InputFile.RootFile=regexprep(InputFile.RootFile,'^[\\/]|[\\/]$','');%suppress possible / or \ separator at the beginning or the end of the string 1882 1566 InputFile.SubDir=regexprep(InputFile.SubDir,'^[\\/]|[\\/]$','');%suppress possible / or \ separator at the beginning or the end of the string 1883 % if isempty(InputFile.RootFile)1884 % filebase=InputFile.RootPath;1885 % else1886 filebase=fullfile(InputFile.RootPath,InputFile.RootFile);1887 % end1888 1567 FileExt=InputFile.FileExt; 1889 % [FileName,RootPath,filebase,FileIndices,FileExt,subdir]=read_file_boxes(handles);1890 1568 NomType=get(handles.NomType,'String'); 1891 % NomType=get(handles.FileIndex,'UserData');1892 1569 i1=str2num(get(handles.i1,'String'));%read the field indices (for movie, it is not given by the file name) 1893 1570 i2=str2num(get(handles.i2,'String')); … … 1895 1572 j2=stra2num(get(handles.j2,'String')); 1896 1573 sub_value= get(handles.SubField,'Value'); 1897 if sub_value % a second input file has been entered 1898 1574 if sub_value % a second input file has been entered 1899 1575 [FileName_1,RootPath_1,filebase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles); 1900 1576 [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndices_1); 1901 % [pp,ff,i1_1_str,i2_1_str,j1_1_str,j2_1_str]=name2display(FileIndices_1);1902 % i1_1=stra2num(i1_1_str);%current set of indices for the second field (may be set different than the main indices)1903 % i2_1=stra2num(i2_1_str);1904 % j1_1=stra2num(j1_1_str);1905 % j2_1=stra2num(j2_1_str);1906 1577 NomType_1=get(handles.NomType_1,'String'); 1907 % NomType_1=get(handles.FileIndex_1,'UserData');1908 1578 else 1909 1579 filename_1=[]; 1910 1580 end 1911 comp_input=get(handles.fix_pair,'Value');1912 1581 1913 1582 %% increment (or decrement) the field indices and update the input filename(s) 1914 if get(handles.scan_i,'Value')==1% case of scanning along index i 1915 i1=i1+increment; 1916 i2=i2+increment; 1917 if sub_value 1918 i1_1=i1_1+increment; 1919 i2_1=i2_1+increment; 1920 end 1921 else % case of scanning along index j (burst numbers) 1922 j1=j1+increment; 1923 j2=j2+increment; 1924 if sub_value 1925 j1_1=j1_1+increment; 1926 j2_1=j2_1+increment; 1927 end 1928 end 1929 if ~comp_input 1583 CheckSearch=0; 1584 if isempty(increment) 1585 CheckSearch=1;% search for the next available file 1586 set(handles.CheckFixPair,'Value',0) 1587 end 1588 CheckFixPair=get(handles.CheckFixPair,'Value'); 1589 if CheckFixPair 1590 if get(handles.scan_i,'Value')==1% case of scanning along index i 1591 i1=i1+increment; 1592 i2=i2+increment; 1593 if sub_value 1594 i1_1=i1_1+increment; 1595 i2_1=i2_1+increment; 1596 end 1597 else % case of scanning along index j (burst numbers) 1598 j1=j1+increment; 1599 j2=j2+increment; 1600 if sub_value 1601 j1_1=j1_1+increment; 1602 j2_1=j2_1+increment; 1603 end 1604 end 1605 else 1930 1606 UvData=get(handles.uvmat,'UserData'); 1931 1607 ref_i=i1; … … 1940 1616 end 1941 1617 end 1942 if ref_i+1>size(UvData.i1_series{1},1) 1943 msgbox_uvmat('ERROR','maximum i index exceeded'); 1944 return 1945 end 1946 if ref_j+1>size(UvData.i1_series{1},2) 1947 msgbox_uvmat('ERROR','maximum j index exceeded'); 1618 if ~isempty(increment) 1619 if get(handles.scan_i,'Value')==1% case of scanning along index i 1620 ref_i=ref_i+increment; 1621 else % case of scanning along index j (burst numbers) 1622 ref_j=ref_j+increment; 1623 end 1624 else% free increment 1625 if isequal(get(handles.runplus,'BackgroundColor'),[1 1 0])% if runplus is activated 1626 step=1; 1627 else 1628 step=-1; 1629 end 1630 if get(handles.scan_i,'Value')==1% case of scanning along index i 1631 ref_i=ref_i+step; 1632 while ref_i>=0 && size(UvData.i1_series{1},1)>=ref_i+1 && UvData.i1_series{1}(ref_i+1,ref_j+1,1)==0 1633 ref_i=ref_i+step; 1634 end 1635 else % case of scanning along index j (burst numbers) 1636 ref_j=ref_j+step; 1637 while ref_j>=0 && size(UvData.i1_series{1},2)>=ref_j+1 && UvData.i1_series{1}(ref_i+1,ref_j+1,1)==0 1638 ref_j=ref_j+step; 1639 end 1640 end 1641 end 1642 if ref_i<0 1643 errormsg='minimum i index reached'; 1644 elseif ref_j<0 1645 errormsg='minimum j index reached'; 1646 elseif ref_i+1>size(UvData.i1_series{1},1) 1647 errormsg='maximum i index reached'; 1648 elseif ref_j+1>size(UvData.i1_series{1},2) 1649 errormsg='maximum j index reached'; 1650 end 1651 if ~isempty(errormsg) 1948 1652 return 1949 1653 end … … 2121 1825 transform=transform_list{choice_value}; 2122 1826 if ~isequal(transform_name,'') && ~isequal(transform_name,'px') 2123 if test_1 && isfield(UvData,'XmlData _1') && isfield(UvData.XmlData_1,'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority2124 Field_a=transform(Field_a,UvData.XmlData _1);%the first field has been stored without transform2125 Field_b=transform(Field_b,UvData.XmlData _1);2126 elseif ~test_1 && isfield(UvData,'XmlData') && isfield(UvData.XmlData ,'GeometryCalib')%use geometry calib2127 Field_b=transform(Field_b,UvData.XmlData );1827 if test_1 && isfield(UvData,'XmlData') && numel(UvData.XmlData)==2 && isfield(UvData.XmlData{2},'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority 1828 Field_a=transform(Field_a,UvData.XmlData{2});%the first field has been stored without transform 1829 Field_b=transform(Field_b,UvData.XmlData{2}); 1830 elseif ~test_1 && isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'GeometryCalib')%use geometry calib 1831 Field_b=transform(Field_b,UvData.XmlData{1}); 2128 1832 end 2129 1833 end … … 2329 2033 end 2330 2034 end 2331 % if strcmp(get(handles.FileExt_1,'Visible'),'on')2332 % FileExt_1=get(handles.FileExt_1,'String');2333 % else2334 % FileExt_1=get(handles.FileExt,'String');%read the file extension for the first series (case of veltype comparison within a single file)2335 % end2336 2035 NomType_1=get(handles.NomType_1,'String'); 2337 % % NomType_1=get(handles.FileIndex_1,'UserData');2338 % if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf')2339 % FileType_1='netcdf';2340 % elseif isfield(UvData,'MovieObject_1')2341 % Name=UvData.MovieObject_1;2342 % FileType_1='movie';2343 % elseif isequal(lower(Ext_1),'.avi')2344 % FileType_1='avi';2345 % elseif isequal(lower(Ext_1),'.vol')2346 % FileType_1='vol';2347 % if isfield(UvData.XmlData_1,'Npy') && isfield(UvData.XmlData_1,'Npx')2348 % ParamIn.Npy=UvData.XmlData_1.Npy;2349 % ParamIn.Npx=UvData.XmlData_1.Npx;2350 % else2351 % errormsg='Npx and Npy need to be defined in the xml file for volume images .vol';2352 % return2353 % end2354 % else2355 % if length(Ext_1)>=22356 % form=imformats(Ext_1(2:end));2357 % if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab2358 % if isequal(NomType_1,'*');2359 % FileType_1='multimage';2360 % else2361 % FileType_1='image';2362 % end2363 % end2364 % end2365 % end2366 % if strcmp(FileType_1,'netcdf')2367 % list_fields=get(handles.Fields_1,'String');% list menu fields2368 % index_fields=get(handles.Fields_1,'Value');% selected string index2369 % FieldName_1= list_fields{index_fields}; % selected field2370 % if ~isequal(FieldName_1,'get_field...')% read the field names on the interface get_field...2371 % VelType_1='';2372 % if get(handles.FixVelType,'Value')2373 % VelTypeList=get(handles.VelType_1,'String');2374 % index=get(handles.VelType_1,'Value');2375 % VelType_1=VelTypeList{index};2376 % end2377 % end2378 % if strcmp(VelType_1,'*')% free veltype choice2379 % VelType_1=[];2380 % elseif strcmp(VelType_1,'"')% veltype the same as for the first field2381 % if isempty(VelType)2382 % VelType_1=[];2383 % else2384 % VelType_1=VelType;2385 % end2386 % end2387 % if strcmp(FieldName_1,'velocity')2388 % list_code=get(handles.ListColorCode,'String');% list menu fields2389 % index_code=get(handles.ListColorCode,'Value');% selected string index2390 % if ~strcmp(list_code{index_code},'black') && ~strcmp(list_code{index_code},'white')2391 % list_code=get(handles.ListColorScalar,'String');% list menu fields2392 % index_code=get(handles.ListColorScalar,'Value');% selected string index2393 % ParamIn.ColorVar= list_code{index_code}; % selected field2394 % end2395 % end2396 % end2397 2036 test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged 2398 2037 if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie) … … 2513 2152 %% apply coordinate transform or other user fct 2514 2153 XmlData=[];%default 2154 XmlData_1=[];%default 2515 2155 if isfield(UvData,'XmlData')%use geometry calib recorded from the ImaDoc xml file as first priority 2516 XmlData=UvData.XmlData ;2517 end 2518 XmlData_1=[];%default 2519 if isfield(UvData,'XmlData_1') 2520 XmlData_1=UvData.XmlData_1; 2521 end 2156 XmlData=UvData.XmlData{1}; 2157 if numel(UvData.XmlData)==2 2158 XmlData_1=UvData.XmlData{2}; 2159 end 2160 end 2161 2522 2162 % menu_transform=get(handles.transform_fct,'String'); 2523 2163 choice_value=get(handles.transform_fct,'Value'); … … 2684 2324 elseif isfield(UvData,'Z') 2685 2325 if isfield(UvData,'CoordType')&& isequal(UvData.CoordType,'phys') && isfield(UvData,'XmlData') 2686 XmlData=UvData.XmlData ;2326 XmlData=UvData.XmlData{1}; 2687 2327 if isfield(XmlData,'PlanePos') 2688 2328 UvData.Object{1}.Coord=XmlData.PlanePos(UvData.ZIndex,:); … … 2726 2366 UvData.Object={[]}; 2727 2367 set(handles.ListObject,'Value',1) 2728 % set(handles.list_object_2,'Value',1)2729 % set(handles.list_object_2,'String',{''})2730 % set(handles.list_object_2,'Visible','off')2731 2368 end 2732 2369 IndexObj=get(handles.ListObject,'Value');%selected projection object for main view … … 2928 2565 end 2929 2566 % time from xml file overset previous result 2930 if isfield(UvData,'XmlData') && isfield(UvData.XmlData ,'Time')2567 if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'Time') 2931 2568 if isempty(num_i2)||isnan(num_i2) 2932 2569 num_i2=num_i1; … … 2938 2575 num_j2=num_j1; 2939 2576 end 2940 siz=size(UvData.XmlData .Time);2577 siz=size(UvData.XmlData{1}.Time); 2941 2578 if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2) 2942 abstime=(UvData.XmlData .Time(num_i1,num_j1)+UvData.XmlData.Time(num_i2,num_j2))/2;%overset the time read from files2943 dt=(UvData.XmlData .Time(num_i2,num_j2)-UvData.XmlData.Time(num_i1,num_j1));2579 abstime=(UvData.XmlData{1}.Time(num_i1,num_j1)+UvData.XmlData{1}.Time(num_i2,num_j2))/2;%overset the time read from files 2580 dt=(UvData.XmlData{1}.Time(num_i2,num_j2)-UvData.XmlData{1}.Time(num_i1,num_j1)); 2944 2581 testimedoc=1; 2945 if isfield(UvData.XmlData,'TimeUnit') 2946 TimeUnit=UvData.XmlData.TimeUnit; 2947 end 2948 end 2949 end 2950 if isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'Time') 2951 [tild,tild,tild,num_i1,num_i2,num_j1,num_j2]=fileparts_uvmat(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]); 2952 % [P,F,str1,str2,str_a,str_b,E]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]); 2953 if isempty(num_i2) 2954 num_i2=num_i1; 2955 end 2956 if isempty(num_j1) 2957 num_j1=1; 2958 end 2959 if isempty(num_j2) 2960 num_j2=num_j1; 2961 end 2962 siz=size(UvData.XmlData_1.Time); 2963 if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2) 2964 abstime_1=(UvData.XmlData_1.Time(num_i1,num_j1)+UvData.XmlData_1.Time(num_i2,num_j2))/2;%overset the time read from files 2965 end 2966 end 2582 if isfield(UvData.XmlData{1},'TimeUnit') 2583 TimeUnit=UvData.XmlData{1}.TimeUnit; 2584 end 2585 end 2586 if numel(UvData.XmlData)==2 2587 [tild,tild,tild,num_i1,num_i2,num_j1,num_j2]=fileparts_uvmat(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]); 2588 % [P,F,str1,str2,str_a,str_b,E]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]); 2589 if isempty(num_i2) 2590 num_i2=num_i1; 2591 end 2592 if isempty(num_j1) 2593 num_j1=1; 2594 end 2595 if isempty(num_j2) 2596 num_j2=num_j1; 2597 end 2598 siz=size(UvData.XmlData{2}.Time); 2599 if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2) 2600 abstime_1=(UvData.XmlData{2}.Time(num_i1,num_j1)+UvData.XmlData{2}.Time(num_i2,num_j2))/2;%overset the time read from files 2601 end 2602 end 2603 end 2604 2967 2605 if ~isequal(numel(abstime),1) 2968 2606 abstime=[]; … … 3020 2658 end 3021 2659 3022 3023 2660 %------------------------------------------------------------------- 3024 2661 … … 3035 2672 set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7]) 3036 2673 end 3037 3038 2674 3039 2675 %------------------------------------------------------------------- … … 3098 2734 fin=close(nc); 3099 2735 3100 3101 2736 %------------------------------------------------------------------- 3102 2737 %determines the fields to read from the interface … … 3107 2742 VelType=VelTypeList{index}; 3108 2743 3109 % VelType=[]; %default3110 % if (get(handles.VelType,'Value') == 1);3111 % VelType='civ1';3112 % % interp13113 % elseif (get(handles.interp1,'Value') == 1);3114 % VelType='interp1';3115 % % filter13116 % elseif (get(handles.filter1,'Value') == 1);3117 % VelType='filter1';3118 % % CIV23119 % elseif (get(handles.civ2,'Value') == 1);3120 % VelType='civ2';3121 % % interp23122 % elseif (get(handles.interp2,'Value') == 1);3123 % VelType='interp2';3124 % % filter23125 % elseif (get(handles.filter2,'Value') == 1);3126 % VelType='filter2';3127 % end3128 %3129 % if isequal(get(handles.filter2,'Visible'),'on');3130 % civ=6;3131 % % interp13132 % elseif isequal(get(handles.interp2,'Visible'),'on');3133 % civ=5;3134 % % filter13135 % elseif isequal(get(handles.civ2,'Visible'),'on');3136 % civ=4;3137 % % CIV23138 % elseif isequal(get(handles.filter1,'Visible'),'on');3139 % civ=3;3140 % % interp23141 % elseif isequal(get(handles.interp1,'Visible'),'on');3142 % civ=2;3143 % % filter23144 % elseif isequal(get(handles.VelType,'Visible'),'on');3145 % civ=1;3146 % else3147 % civ=0;3148 % end3149 3150 2744 %------------------------------------------------------------------- 3151 2745 %determines the veltype of the second field to read from the iinterface … … 3155 2749 index=get(handles.VelType_1,'Value'); 3156 2750 VelType=VelTypeList{index}; 3157 % VelType=[]; %default3158 % if (get(handles.VelType_1,'Value') == 1);3159 % VelType='civ1';3160 % % interp13161 % elseif (get(handles.interp1_1,'Value') == 1);3162 % VelType='interp1';3163 % % filter13164 % elseif (get(handles.filter1_1,'Value') == 1);3165 % VelType='filter1';3166 % % CIV23167 % elseif (get(handles.civ2_1,'Value') == 1);3168 % VelType='civ2';3169 % % interp23170 % elseif (get(handles.interp2_1,'Value') == 1);3171 % VelType='interp2';3172 % % filter23173 % elseif (get(handles.filter2_1,'Value') == 1);3174 % VelType='filter2';3175 % end3176 3177 2751 3178 2752 %--------------------------------------------------- … … 3288 2862 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 3289 2863 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 3290 % [FileName,RootPath,FileBase,FileIndices,FileExt]=read_file_boxes(handles);3291 2864 [tild,tild,tild,i1,i2,j1,j2,tild,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]); 3292 % [P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt]); 3293 NomTypeNew=NomType;%default 2865 % NomTypeNew=NomType;%default 3294 2866 if isequal(field,'image') 3295 if isequal(NomType,'_1-2_1')||isequal(NomType,'_1_1-2') 3296 NomTypeNew='_1_1'; 3297 elseif isequal(NomType,'#_ab') 3298 NomTypeNew='#a'; 3299 elseif isequal(NomType,'_1-2') 3300 NomTypeNew='_1'; 3301 end 3302 imagename=fullfile_uvmat(RootPath,SubDir,RootFile,'.png',NomTypeNew,i1,i2,j1,j2); 3303 % imagename=name_generator(FileBase,i1,j1,'.png',NomTypeNew,1,i2,j2,''); 2867 % if isequal(NomType,'_1-2_1')||isequal(NomType,'_1_1-2') 2868 % NomTypeNew='_1_1'; 2869 % elseif isequal(NomType,'#_ab') 2870 % NomTypeNew='#a'; 2871 % elseif isequal(NomType,'_1-2') 2872 % NomTypeNew='_1'; 2873 % end 2874 imagename=fullfile_uvmat(RootPath,SubDir,RootFile,'.png',NomType,i1,[],j1,[]); 3304 2875 if ~exist(imagename,'file') 3305 2876 [FileName,PathName] = uigetfile( ... … … 3331 2902 end 3332 2903 end 3333 % indices=name_generator('',i1,j1,'',NomTypeNew,1,i2,j2,''); 3334 indices=fullfile_uvmat('','','','',NomTypeNew,i1,i2,j1,j2); 2904 indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2); 3335 2905 set(handles.FileIndex,'String',indices) 3336 set(handles.NomType,'String',NomTypeNew)3337 % set(handles.FileIndex,'UserData',NomTypeNew) 2906 % set(handles.NomType,'String',NomType) 2907 3338 2908 %common to Fields_1_Callback 3339 2909 if isequal(field,'image')||isequal(field_1,'image') … … 3361 2931 UvData=get(handles.uvmat,'UserData'); 3362 2932 if check_new && isfield(UvData,'XmlData') 3363 UvData.XmlData _1=UvData.XmlData;2933 UvData.XmlData{2}=UvData.XmlData{1}; 3364 2934 end 3365 2935 list_fields=get(handles.Fields,'String');% list menu fields … … 3387 2957 switch field_1 3388 2958 case 'get_field...' 3389 %veltype_handles=[handles.VelType handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];3390 2959 set_veltype_display(0) % no veltype display 3391 % [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles);3392 % filename=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1];3393 2960 hget_field=findobj(allchild(0),'name','get_field_1'); 3394 2961 if ~isempty(hget_field) … … 3406 2973 NomType=get(handles.NomType,'string'); 3407 2974 check_letter=~isempty(regexp(NomType,'[ab|AB]$'));%detect pair label by letter 3408 NomType_1=NomType;3409 if check_letter3410 NomType_1=NomType_1(1:end-1);3411 else3412 r=regexp(NomType_1,'.-(?<num2>\d+$','names');3413 if ~isempty(r)3414 NomType_1=regexprep(NomType_1,['-' r.num2],'');3415 end3416 end3417 imagename=fullfile_uvmat(RootPath_1,'',RootFile_1,'.png',NomType _1,i1,[],j1);2975 % NomType_1=NomType; 2976 % if check_letter 2977 % NomType_1=NomType_1(1:end-1); 2978 % else 2979 % r=regexp(NomType_1,'.-(?<num2>\d+$','names'); 2980 % if ~isempty(r) 2981 % NomType_1=regexprep(NomType_1,['-' r.num2],''); 2982 % end 2983 % end 2984 imagename=fullfile_uvmat(RootPath_1,'',RootFile_1,'.png',NomType,i1,[],j1); 3418 2985 if ~exist(imagename,'file') 3419 2986 [FileName,PathName] = uigetfile( ... … … 3452 3019 end 3453 3020 end 3454 3455 3021 3456 3022 %------------------------------------------------------------------------ … … 3638 3204 testphys=0; %coordinates in pixels by default 3639 3205 if isfield(ObjectData,'CoordType') && isequal(ObjectData.CoordType,'phys') 3640 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData ,'GeometryCalib')3641 Calib=UvData.XmlData .GeometryCalib;3206 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'GeometryCalib') 3207 Calib=UvData.XmlData{1}.GeometryCalib; 3642 3208 testphys=1; 3643 3209 end … … 3891 3457 UvData.Object=UvData.Object(1); 3892 3458 end 3893 %list_object=get(handles.ListObject,'String');3894 3459 set(handles.ListObject,'Value',1) 3895 3460 set(handles.ListObject,'String',{''}) 3896 %set(handles.list_object_2,'Value',1)3897 %set(handles.list_object_2,'String',{''})3898 %list_object_2_Callback(hObject, eventdata, handles)3899 3461 3900 3462 %delete mask if it is displayed … … 3986 3548 end 3987 3549 end 3988 % set(haxes,'XLimMode','auto')%reset auto mode (after CheckZoom effect)3989 % set(haxes,'YLimMode','auto')3990 % PlotParam.Auto_xy=1;3991 3550 plot_field(Histo,haxes); 3992 3551 end … … 4211 3770 [PP,PlotParamOut]= plot_field(AxeData,handles.axes3,PlotParam); 4212 3771 write_plot_param(handles,PlotParamOut); %update the auto plot parameters 4213 4214 % %-------------------------------------------------------------------4215 % % --- Executes on button press in grid.4216 % function grid_Callback(hObject, eventdata, handles)4217 4218 3772 4219 3773 %------------------------------------------------------------------- … … 4237 3791 UvData.MouseAction='none'; 4238 3792 set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 4239 % hset_object=findobj(allchild(0),'tag','set_object');% look for the set_object GUI4240 % if ~isempty(hset_object)4241 % delete(hset_object)% delete the current GUI set_object4242 % end4243 3793 end 4244 3794 set(handles.uvmat,'UserData',UvData); … … 4353 3903 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 4354 3904 plot_field(ProjData,ViewObjectAxes,read_GUI(get(ViewObjectAxes,'Parent')));%read plotting parameters on the uvmat interfacPlotHandles); 4355 %4356 % UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));4357 % set(handles.uvmat,'UserData',UvData)4358 3905 4359 3906 %------------------------------------------------------------------------ … … 4406 3953 end 4407 3954 end 4408 4409 % SubObjectData=get(ObjectData.DisplayHandle_uvmat,'UserData');4410 4411 4412 4413 4414 4415 4416 3955 4417 3956 %------------------------------------------------------ … … 4506 4045 UvData.plotaxes=newaxes;% the axis in the new figure becomes the current main plotting axes 4507 4046 set(huvmat,'UserData',UvData); 4508 increment=str2double(get(handles.increment_scan,'String')); %get the field increment d 4509 if isnan(increment) 4510 set(handles.increment_scan,'String','1')%default value 4511 increment=1; 4512 end 4047 increment=str2num(get(handles.increment_scan,'String')); %get the field increment d 4513 4048 set(handles.STOP,'Visible','on') 4514 4049 set(handles.speed,'Visible','on') … … 4607 4142 testphys=0; %coordinates in pixels by default 4608 4143 if isfield(ObjectData,'CoordUnit') && ~isequal(ObjectData.CoordUnit,'pixel') 4609 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData ,'GeometryCalib')4610 Calib=UvData.XmlData .GeometryCalib;4144 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'GeometryCalib') 4145 Calib=UvData.XmlData{1}.GeometryCalib; 4611 4146 testphys=1; 4612 4147 end … … 4695 4230 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 4696 4231 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 4697 %FileName=read_file_boxes(handles);4698 4232 CoordList=get(handles.transform_fct,'String'); 4699 4233 val=get(handles.transform_fct,'Value'); … … 4707 4241 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 4708 4242 param.FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 4709 %[param.FileName]=read_file_boxes(handles);4710 4243 if isequal(get(handles.SubField,'Value'),1) 4711 4244 [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles); … … 4720 4253 param.NomType_1=get(handles.NomType_1,'String'); 4721 4254 % param.NomType_1=get(handles.FileIndex_1,'UserData'); 4722 param. comp_input=get(handles.fix_pair,'Value');4255 param.CheckFixPair=get(handles.CheckFixPair,'Value'); 4723 4256 huvmat=get(handles.MenuSeries,'parent'); 4724 4257 UvData=get(huvmat,'UserData'); 4725 if isfield(UvData,' Time')4726 param.Time=UvData.XmlData .Time;4258 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'Time') 4259 param.Time=UvData.XmlData{1}.Time; 4727 4260 end 4728 4261 if isequal(get(handles.scan_i,'Value'),1) 4729 param.incr_i=str2 double(get(handles.increment_scan,'String'));4262 param.incr_i=str2num(get(handles.increment_scan,'String')); 4730 4263 elseif isequal(get(handles.scan_j,'Value'),1) 4731 param.incr_j=str2 double(get(handles.increment_scan,'String'));4264 param.incr_j=str2num(get(handles.increment_scan,'String')); 4732 4265 end 4733 4266 param.list_fields=get(handles.Fields,'String');% list menu fields … … 4753 4286 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 4754 4287 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 4755 %FileName=read_file_boxes(handles);4756 %[FileName,RootPath,filebase,FileIndices,ext,SubDir]=read_file_boxes(handles)4757 % num1=stra2num(get(handles.i1,'String'));4758 % num2=stra2num(get(handles.i2,'String'));4759 % num_a=stra2num(get(handles.j1,'String'));4760 % num_b=stra2num(get(handles.j2,'String'));4761 % NomType=get(handles.FileIndex,'UserData');4762 % ind_opening=1; % default (images): will advice civ1 option by default in the civ interface4763 % if isequal(ext,'.nc') || isequal(ext,'.cdf')% netcdf files4764 % ind_opening=2;% propose 'fix' as the default option4765 % % +read the current netcdf rootfile4766 % Data=nc2struct(FileName,'ListGlobalAttribute','fix','patch','civ2','fix2');4767 % if isfield(Data,'fix') && isequal(Data.fix,1)4768 % ind_opening=3;4769 % end4770 % if isfield(Data,'patch') && isequal(Data.patch,1)4771 % ind_opening=4;4772 % end4773 % if isfield(Data,'civ2') && isequal(Data.civ2,1)4774 % ind_opening=5;4775 % end4776 % if isfield(Data,'fix2') && isequal(Data.fix2,1)4777 % ind_opening=6;4778 % end4779 % end4780 % param.RootName=filebase;4781 % param.NomType=NomType;4782 % param.num1=num1;4783 % param.num2=num2;4784 % param.num_a=num_a;4785 % param.num_b=num_b;4786 % param.SubDir=SubDir;4787 % param.IndOpening=ind_opening;% A REVOIR +TRANSMETTRE IMADOC INFO4788 % param.ImaExt=ext;4789 4288 civ(FileName);% interface de civ(not in the uvmat file) 4790 4289 … … 4897 4396 'Pick an xml Object file',get(handles.RootPath,'String')); 4898 4397 fileinput=[PathName FileName];%complete file name 4899 % testblank=findstr(fileinput,' ');%look for blanks4900 % if ~isempty(testblank)4901 % msgbox_uvmat('ERROR','forbidden input file name: contain blanks')4902 % return4903 % end4904 4398 sizf=size(fileinput); 4905 4399 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end … … 4915 4409 delete(hset_object)% delete existing version of set_object 4916 4410 end 4917 % UvData=get(handles.uvmat,'UserData');4918 4411 set_object(data);% call the set_object interface 4919 % %position the set_object GUI with respect to uvmat4920 % pos_uvmat=get(handles.uvmat,'Position');4921 % if isfield(UvData,'SetObjectOrigin')4922 % pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);4923 % pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4);4924 % set(hset_object,'Position',pos_set_object)4925 % end4926 4412 set(handles.edit_object,'Value',0); %suppress the object edit mode 4927 4413 set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 4928 4414 set(handles.MenuObject,'checked','on') 4929 %UvData.MouseAction='create_object';4930 % set(handles.uvmat,'UserData',UvData)4931 4415 set(handles.delete_object,'Visible','on') 4932 % set(handles.uvmat_title,'Visible','on')4933 % set(handles.view_field_title,'Visible','on')4934 4416 4935 4417 %------------------------------------------------------------------------ … … 5042 4524 end 5043 4525 5044 5045 4526 % --- Executes on button press in ViewObject. 5046 4527 function ViewObject_Callback(hObject, eventdata, handles) … … 5065 4546 5066 4547 5067 5068 4548 function NomType_Callback(hObject, eventdata, handles) 5069 4549
Note: See TracChangeset
for help on using the changeset viewer.