- Timestamp:
- Jan 17, 2012, 12:11:00 AM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_file_series.m
r372 r376 37 37 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 38 38 39 function [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPath,fileinput ,option)39 function [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPath,fileinput) 40 40 %------------------------------------------------------------------------ 41 41 if ~exist('option','var') … … 47 47 48 48 %% check for particular file types: images, movies, civ data 49 FileType='';50 Object=[];51 49 i1_series=zeros(1,1,1); 52 50 i2_series=zeros(1,1,1); 53 51 j1_series=zeros(1,1,1); 54 52 j2_series=zeros(1,1,1); 55 56 switch FileExt 57 % ancillary files, no field indexing 58 case {'.civ','.log','.cmx','.cmx2','.txt','.bat'} 59 FileType='txt'; 60 NomType=''; 61 case '.fig' 62 FileType='figure'; 63 NomType=''; 64 case '.xml' 65 FileType='xml'; 66 NomType=''; 67 case '.xls' 68 FileType='xls'; 69 NomType=''; 70 otherwise 71 72 if ~isempty(FileExt)&& ~isempty(imformats(FileExt(2:end))) 73 try 74 imainfo=imfinfo(fullfileinput); 75 FileType='image'; 76 if length(imainfo) >1 %case of image with multiple frames 77 NomType='*'; 78 FileType='multimage'; 79 i1_series=(1:length(imainfo))'; 80 [RootPath,RootFile]=fileparts(fullfileinput); 81 end 82 end 83 else 84 try 85 Data=nc2struct(fullfileinput,'ListGlobalAttribute','absolut_time_T0','Conventions'); 86 if ~isempty(Data.absolut_time_T0') 87 FileType='civx'; % test for civx velocity fields 88 elseif strcmp(Data.Conventions,'uvmat/civdata') 89 FileType='civdata'; % test for civx velocity fields 90 else 91 FileType='netcdf'; 92 end 93 end 94 try 95 if exist('VideoReader','file')%recent version of Matlab 96 Object=VideoReader(fullfileinput); 97 else 98 Object=mmreader(fullfileinput);%older Matlab function for movies 99 end 100 NomType='*'; 101 FileType='video'; 102 i1_series=(1:get(Object,'NumberOfFrames'))'; 103 end 104 end 53 [FileType,FileInfo,Object]=get_file_type(fullfileinput); 54 if strcmp( FileType,'multimage')||strcmp( FileType,'video') 55 NomType='*'; 56 i1_series=(1:FileInfo.NbFrame)' 105 57 end 106 58 … … 172 124 star_string=[RootFile sep1 i1_star sep2 i2_star sep3 j1_star sep4 j2_star '*']; 173 125 wd=pwd;%current working directory 174 %RR=fullfile(RootPath,SubDir);175 126 cd (RootPath)% move to the local dir to save time in the operation dir. 176 127 dirpair=dir([star_string FileExt]);% look for relevant files in the file directory … … 258 209 259 210 %% update the file type if the input file does not exist (pb of 0001) 260 if strcmp(option,'filetype') 261 return 262 elseif isempty(FileType) 263 [tild,tild, tild,tild,tild,tild,FileType,Object]=find_file_series(RootPath,dirpair(ifile_min).name,'filetype'); 211 if isempty(FileType) 212 [FileType,tild,Object]=get_file_type(dirpair(ifile_min).name); 264 213 end 265 214 -
trunk/src/get_file_series.m
r373 r376 1 %'get_file_series': determine the list of file names and file indices for functions called by 'series'. 2 %------------------------------------------------------------------------ 3 % [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param) 4 % 5 % OUTPUT: 6 % filecell{i,j}: cell array with the two reference indices i and j representing the list of file names 7 % i1_series,i2_series,j1_series,j2_series: corresponding arrays of indices i1,i2,j1,j2. 8 % 9 % INPUT: 10 % Param: structure of input parameters as read from the GUI series (by the function read_GUI) 11 1 12 function [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param) 2 Param 13 3 14 filecell={}; 4 15 InputTable=Param.InputTable; -
trunk/src/series.m
r372 r376 101 101 end 102 102 103 % file name and browser initialisation103 %% file name and browser initialisation 104 104 if isfield(param,'menu_coord_str') 105 105 set(handles.transform_fct,'String',param.menu_coord_str) … … 110 110 set(handles.transform_fct,'Value',1);%default 111 111 end 112 113 112 if isfield(param,'FileName') 114 113 if isfield(param,'FileName_1') … … 120 119 end 121 120 122 % fields input initialisation121 %% fields input initialisation 123 122 if isfield(param,'list_fields')&& isfield(param,'index_fields') &&~isempty(param.list_fields) &&~isempty(param.index_fields) 124 123 set(handles.FieldMenu,'String',param.list_fields);% list menu fields … … 126 125 FieldCell{1}=param.list_fields{param.index_fields}; 127 126 end 128 % NomType_Callback(hObject, eventdata, handles) 129 REFRESH_INDICES_Callback(hObject, eventdata, handles)127 128 %REFRESH_INDICES_Callback(hObject, eventdata, handles) 130 129 %loads the information stored in prefdir to initiate the list of ACTION functions 131 130 fct_menu={'check_data_files';'aver_stat';'time_series';'merge_proj';'clean_civ_cmx'}; … … 141 140 end 142 141 143 % TRANSFORM menu: loads the information stored in prefdir to initiate the list of field transform functions142 %% TRANSFORM menu: loads the information stored in prefdir to initiate the list of field transform functions 144 143 menu_str={'';'phys';'px';'phys_polar'}; 145 144 nb_builtin_transform=numel(menu_str); %number of functions … … 158 157 rmpath(fullfile(path_uvmat,'transform_field')) 159 158 160 % read the list of functions stored in the personal file 'uvmat_perso.mat' in prefdir159 %% read the list of functions stored in the personal file 'uvmat_perso.mat' in prefdir 161 160 if test_profil_perso 162 161 if isfield(h,'series_fct') && iscell(h.series_fct) … … 187 186 set(handles.ACTION,'String',fct_menu) 188 187 set(handles.ACTION,'UserData',fct_path)% store the list of path in UserData of ACTION 189 190 188 menu_str=menu_str(find(testexist)); 191 189 fct_handle=fct_handle(find(testexist)); … … 207 205 % Get default command line output from handles structure 208 206 varargout{1} = handles.output; 209 210 207 211 208 % -------------------------------------------------------------------- … … 454 451 [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomType]=fileparts_uvmat(fileinput); 455 452 456 %% determine the selected reference field indices for pair dispaly457 ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV458 if ~isempty(i1)459 ref_i=i1;460 if ~isempty(i2)461 ref_i=floor((ref_i+i2)/2);% reference image number corresponding to the file462 end463 end464 set(handles.ref_i,'String',num2str(ref_i));465 ref_j=1; %default ref_j is a reference frame index used to find existing pairs from PIV466 if ~isempty(j1)467 ref_j=j1;468 if ~isempty(j2)469 ref_j=floor((j1+j2)/2);470 end471 end472 set(handles.ref_j,'String',num2str(ref_j));473 ref_i_Callback([],[], handles)474 ref_j_Callback([],[], handles)475 476 %% update the first and last reference indices if empty477 first_i=str2num(get(handles.num_first_i,'String'));478 if isempty(first_i)479 set(handles.num_first_i,'String',num2str(ref_i));480 set(handles.num_last_i,'String',num2str(ref_i));481 set(handles.num_first_j,'String',num2str(ref_j))482 set(handles.num_last_j,'String',num2str(ref_j));483 end484 485 %486 % % FileBase=fullfile(RootPath,RootFile);487 % TimeUnit=''; %default488 % time=[];%default489 % testima=0; %test for image input490 % if isequal(lower(FileExt),'.avi') %.avi file491 % testima=1;492 % elseif ~isempty(imformats(FileExt(2:end)))493 % testima=1;494 % elseif isequal(FileExt,'.vol')495 % testima=1;496 % end497 498 453 %% fill the list of file series 499 454 InputTable=get(handles.InputTable,'Data'); … … 513 468 set(handles.REFRESH_INDICES,'UserData',check_lines); 514 469 515 %% refresh menus with info from the new series470 %% refresh menus with info from the new series 516 471 REFRESH_INDICES_Callback([],[], handles) 472 473 %% determine the selected reference field indices for pair dispaly 474 ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV 475 if ~isempty(i1) 476 ref_i=i1; 477 if ~isempty(i2) 478 ref_i=floor((ref_i+i2)/2);% reference image number corresponding to the file 479 end 480 end 481 set(handles.ref_i,'String',num2str(ref_i)); 482 ref_j=1; %default ref_j is a reference frame index used to find existing pairs from PIV 483 if ~isempty(j1) 484 ref_j=j1; 485 if ~isempty(j2) 486 ref_j=floor((j1+j2)/2); 487 end 488 end 489 set(handles.ref_j,'String',num2str(ref_j)); 490 ref_i_Callback([],[], handles) 491 ref_j_Callback([],[], handles) 492 493 %% update the first and last reference indices if empty 494 first_i=str2num(get(handles.num_first_i,'String')); 495 if isempty(first_i) 496 set(handles.num_first_i,'String',num2str(ref_i)); 497 set(handles.num_last_i,'String',num2str(ref_i)); 498 set(handles.num_first_j,'String',num2str(ref_j)) 499 set(handles.num_last_j,'String',num2str(ref_j)); 500 end 517 501 518 502 %% store the root name for future opening of uvmat … … 536 520 %num_last_i_Callback([], [], handles) 537 521 538 % %------------------------------------------------------------------------539 % function RootPath_Callback(hObject, eventdata, handles)540 % %------------------------------------------------------------------------541 % Val=get(handles.RootPath,'Value');542 % synchronise_view(handles,Val)543 % NomType_Callback(hObject, eventdata, handles)544 545 % %------------------------------------------------------------------------546 % function synchronise_view(handles,Val)547 % %------------------------------------------------------------------------548 % set(handles.RootPath,'Value',Val)549 % set(handles.SubDir,'Value',Val)550 % set(handles.RootFile,'Value',Val)551 % set(handles.NomType,'Value',Val)552 % set(handles.FileExt,'Value',Val)553 % set(handles.num_MaxIndex_i,'Value',Val)554 % set(handles.num_MaxIndex_j,'Value',Val)555 % % set(handles.time_first,'Value',Val)556 % % set(handles.time_last,'Value',Val)557 558 559 % %------------------------------------------------------------------------560 % % Executes on carriage return on the subdir civ1 edit window561 % function SubDir_Callback(hObject, eventdata, handles)562 % %------------------------------------------------------------------------563 % Val=get(handles.SubDir,'Value');564 % synchronise_view(handles,Val)565 % NomType_Callback(hObject, eventdata, handles)566 567 % %------------------------------------------------------------------------568 % % --- function activated when a new filebase (image series) is introduced569 % function RootFile_Callback(hObject, eventdata, handles)570 % %------------------------------------------------------------------------571 % Val=get(handles.RootFile,'Value');572 % synchronise_view(handles,Val)573 % NomType_Callback(hObject, eventdata, handles)574 575 %--------------------------------------------------------------576 % %function activated when a new filebase (image series) is introduced577 % %------------------------------------------------------------578 % function FileExt_Callback(hObject, eventdata, handles)579 % Val=get(handles.FileExt,'Value');580 % synchronise_view(handles,Val)581 582 % %--------------------------------------------------------------583 % %function activated when a new filebase (image series) is introduced584 % %------------------------------------------------------------585 % function num_MaxIndex_i_Callback(hObject, eventdata, handles)586 % Val=get(handles.num_MaxIndex_i,'Value');587 % synchronise_view(handles,Val)588 589 % %--------------------------------------------------------------590 % %function activated when a new filebase (image series) is introduced591 % %------------------------------------------------------------592 % function num_MaxIndex_j_Callback(hObject, eventdata, handles)593 % Val=get(handles.num_MaxIndex_j,'Value');594 % synchronise_view(handles,Val)595 %596 % %--------------------------------------------------------------597 % %function activated when a new filebase (image series) is introduced598 % %------------------------------------------------------------599 % function time_first_Callback(hObject, eventdata, handles)600 % Val=get(handles.time_first,'Value');601 % synchronise_view(handles,Val)602 %603 % %--------------------------------------------------------------604 % %function activated when a new filebase (image series) is introduced605 % %------------------------------------------------------------606 % function time_last_Callback(hObject, eventdata, handles)607 % Val=get(handles.time_last,'Value');608 % synchronise_view(handles,Val)609 % NomType_Callback(hObject, eventdata, handles)610 611 % %------------------------------------------------------------------------612 % function NomType_Callback(hObject, eventdata, handles)613 % %------------------------------------------------------------------------614 522 615 523 % --- Executes when entered data in editable cell(s) in InputTable. … … 623 531 % Error: error string when failed to convert EditData to appropriate value for Data 624 532 % handles structure with handles and user data (see GUIDATA) 625 eventdata626 533 check_lines=get(handles.REFRESH_INDICES,'UserData'); 627 534 check_lines(eventdata.Indices(1))=1; %select the edited line for refresh … … 633 540 % --- Executes on button press in mode. 634 541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 635 542 function mode_Callback(hObject, eventdata, handles) 636 543 637 SeriesData=get(handles.series,'UserData'); 638 mode_list=get(handles.mode,'String'); 639 mode_value=get(handles.mode,'Value'); 640 mode=mode_list{mode_value}; 641 % NomType=[]; 642 % test_find_pair=0; 643 % if isfield(SeriesData,'NomType') 644 % NomTypeCell=SeriesData.NomType; 645 % Val=get(handles.NomType,'Value'); 646 % NomType=NomTypeCell{Val}; 647 % check_pairs=0; 648 % for 649 % check_pairs=~isempty(SeriesData.i2_series{Val})||~isempty(SeriesData.j2_series{Val}); 650 651 time=[]; 652 if isfield(SeriesData,'Time') 653 time=SeriesData.Time{1}; %get the set of times 654 end 655 % siztime=size(time); 656 % nbfield=siztime(1); 657 % nbfield2=siztime(2); 658 % indchosen=1; %%first pair selected by default 659 if isequal(mode,'bursts') 660 enable_i(handles,'On') 661 enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 662 % elseif ~isempty(SeriesData.j2_series{Val}) 663 % enable_i(handles,'On') 664 % enable_j(handles,'On') % allow both i and j index scanning 665 else 666 enable_i(handles,'On') 667 enable_j(handles,'Off') 668 end 669 % set(handles.list_pair_civ,'Value',indchosen);%set the default choice of image pairs for civ1 670 % set(handles.series,'UserData',SeriesData) 671 672 %list pairs if relevant 673 % if check_pairs 674 find_netcpair_civ(handles) 675 % end 544 SeriesData=get(handles.series,'UserData'); 545 mode_list=get(handles.mode,'String'); 546 mode_value=get(handles.mode,'Value'); 547 mode=mode_list{mode_value}; 548 time=[]; 549 if isfield(SeriesData,'Time') 550 time=SeriesData.Time{1}; %get the set of times 551 end 552 if isequal(mode,'bursts') 553 enable_i(handles,'On') 554 enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 555 else 556 enable_i(handles,'On') 557 enable_j(handles,'Off') 558 end 559 find_netcpair_civ(handles) 676 560 677 561 %------------------------------------- … … 719 603 function find_netcpair_civ(handles) 720 604 SeriesData=get(handles.series,'UserData'); 721 % NomTypeCell=get(handles.NomType,'String');722 % NomTypeCell=SeriesData.NomType;723 % NomType=NomTypeCell{Val};724 725 605 set(handles.Pairs,'Visible','on')% makes the panel "Pairs' visible 726 %nomenclature types727 % RootPathCell=get(handles.RootPath,'String');728 % filepath=RootPathCell{Val};729 % RootFileCell=get(handles.RootFile,'String');730 % filename=RootFileCell{Val};731 % filebase=fullfile(filepath,filename);732 % SubDirCell=get(handles.SubDir,'String');733 % subdir=SubDirCell{Val};734 % if ~exist(fullfile(filepath,subdir),'dir')735 % msgbox_uvmat('ERROR',['no civ file available: subdirectory ' subdir ' does not exist'])736 % set(handles.list_pair_civ,'String',{''});737 % return738 % end739 606 mode_list=get(handles.mode,'String'); 740 607 mode_value=get(handles.mode,'Value'); … … 834 701 end 835 702 set(handles.list_pair_civ,'String',displ_pair) 836 displ_pair837 838 % displ_pair{ind_exist}=['Di= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit];839 % if strcmp(mode,'series(Di)')840 % for index=1:min(nbfield-1,50)841 % filename=name_generator(filebase,ref_i-floor(index/2),ref_j,'.nc',NomType,1,ref_i+ceil(index/2),ref_j,subdir);842 % select=(exist(filename,'file')==2);843 % if select==1844 % ind_exist=ind_exist+1;845 % displ_num(1,ind_exist)=0;846 % displ_num(2,ind_exist)=0;847 % displ_num(3,ind_exist)=-floor(index/2);848 % displ_num(4,ind_exist)=ceil(index/2);849 % %[cte_detect,vdt,cte_read]=read_netcdf(filename,{'dt','dt2','absolut_time_T0','absolute_time_TO_2'});850 % [Cte,var_detect,ichoice]=nc2struct(filename,{});851 % if isfield(Cte,'dt2')852 % dt=Cte.dt2;853 % elseif isfield(Cte,'dt')854 % dt=Cte.dt;855 % end856 % if isfield(Cte,'absolut_time_TO_2')857 % ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority858 % elseif isfield(Cte,'absolut_time_TO')859 % ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit860 % elseif isfield(Cte,'Time')861 % ref_time(ind_exist)=Cte.Time;862 % end863 % displ_pair{ind_exist}=['Di= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit];864 % end865 % end866 % set(handles.list_pair_civ,'String',[displ_pair';{'Di=*|*'}]);867 % elseif isequal(mode,'series(Dj)')% series on the j index868 % for index=1:min(nbfield2-1,50)869 % filename=name_generator(filebase,ref_i,ref_j-floor(index/2),'.nc',NomType,1,ref_i,ref_j+ceil(index/2),subdir);870 % select=(exist(filename,'file')==2);871 % if select==1872 % ind_exist=ind_exist+1;873 % displ_num(1,ind_exist)=-floor(index/2);874 % displ_num(2,ind_exist)=ceil(index/2);875 % displ_num(3,ind_exist)=0;876 % displ_num(4,ind_exist)=0;877 % [Cte,var_detect,ichoice]=nc2struct(filename,{});878 % if isfield(Cte,'dt2')879 % dt=Cte.dt2;880 % elseif isfield(Cte,'dt')881 % dt=Cte.dt;882 % end883 % if isfield(Cte,'absolut_time_TO_2')884 % ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority885 % elseif isfield(Cte,'absolut_time_TO')886 % ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit887 % elseif isfield(Cte,'Time')888 % ref_time(ind_exist)=Cte.Time;889 % end890 % displ_pair{ind_exist}=['Dj= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit];891 % end892 % end893 % set(handles.list_pair_civ,'String',[displ_pair';{'Dj=*|*'}]);894 % elseif isequal(mode,'bursts') %case of bursts895 % for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'bursts' mode896 % for numod_b=(numod_a+1):nbfield2897 % [filename]=name_generator(filebase,ref_i,numod_a,'.nc',NomType,1,ref_i,numod_b,subdir)898 % select=(exist(filename,'file')==2)899 % if select==1900 % ind_exist=ind_exist+1;901 % numlist_a(ind_exist)=numod_a;902 % numlist_b(ind_exist)=numod_b;903 % Attr=nc2struct(filename,[]);904 % isfield(Attr,'absolut_time_T0_2')905 % if isfield(Attr,'dt2')906 % dt(ind_exist)=Attr.dt2;907 % ref_time(ind_exist)=Attr.absolut_time_T0_2;908 % elseif isfield(Attr,'dt')& isfield(Attr,'absolut_time_T0')909 % dt(ind_exist)=Attr.dt;910 % ref_time(ind_exist)=Attr.absolut_time_T0;911 % else912 % dt(ind_exist)=NaN;%no information on dt913 % end914 % %determine nom_type_ima for pair display (used in num2stra.m)915 % switch NomType916 % case {'#ab'}917 % nom_type_ima='#a';918 % case {'#AB'}919 % nom_type_ima='#A';920 % otherwise921 % nom_type_ima='_1_1';922 % end923 % displ_pair{ind_exist}=['j= ' num2stra(numod_a,nom_type_ima,2) '-' num2stra(numod_b,nom_type_ima,2) ...924 % ' :dt= ' num2str(dt(ind_exist)*1000)];925 % end926 % end927 % set(handles.list_pair_civ,'String',[displ_pair';{'j=*-*'}]);928 % end929 % if exist('dt','var') & ~isempty(dt)930 % [dtsort,indsort]=sort(dt);931 % displ_num(1,:)=numlist_a(indsort);932 % displ_num(2,:)=numlist_b(indsort);933 % displ_num(3,:)=0;934 % displ_num(4,:)=0;935 % displ_pair=displ_pair(indsort);936 % ref_time=ref_time(indsort);937 % end938 % end939 703 if isempty(displ_pair) 940 704 msgbox_uvmat('ERROR',['no file available for the selected subdirectory ' subdir]) … … 1347 1111 mode=mode_list{mode_value}; 1348 1112 SeriesData=get(handles.series,'UserData'); 1113 % if ~isempty(SeriesData) 1349 1114 if ~isempty(SeriesData.i2_series)||~isempty(SeriesData.j2_series) 1350 1115 if isequal(mode,'series(Di)') … … 1352 1117 end 1353 1118 end 1119 % end 1354 1120 1355 1121 %------------------------------------------------------------------------ … … 1360 1126 mode=mode_list{mode_value}; 1361 1127 SeriesData=get(handles.series,'UserData'); 1128 if ~isempty(SeriesData) 1362 1129 if ~isempty(SeriesData.i2_series)||~isempty(SeriesData.j2_series) 1363 1130 if isequal(mode,'series(Di)') 1364 1131 find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files 1365 1132 end 1133 end 1366 1134 end 1367 1135 % NomTypeCell=SeriesData.NomType; … … 1849 1617 else 1850 1618 %get the object file 1851 defaultname=get(handles.RootPath,'String'); 1619 InputTable=get(handles.InputTable,'Data'); 1620 defaultname=InputTable{1,1}; 1621 % defaultname=get(handles.RootPath,'String'); 1852 1622 if isempty(defaultname) 1853 1623 defaultname={''}; … … 1982 1752 set(handles.path_transform,'String',''); %show the path to the senlected function 1983 1753 end 1984 %------------------------------------------------------------------------1985 % --- generates a series of file names with reference numbers between range1 and1986 % --- range2 with increment incr. The reference number num_ref is the image number at the middle of the1987 % --- image pair. The set of first numbers num1 of the image pairs is also1988 % --- given as output1989 % function [num_i1,num_i2,num_j1,num_j2,nbmissing]=netseries_generator(filebase,subdir,mode,first_i,incr_i,last_i,first_j,incr_j,last_j)1990 % %------------------------------------------------------------------------1991 % [Path,Name]=fileparts(filebase);1992 % filebasesub=fullfile(Path,subdir,Name);1993 % filecell={};%default1994 % num_i1=[];1995 % num_i2=[];1996 % num_j1=[];1997 % num_j2=[];1998 % ind0_i=first_i:incr_i:last_i;1999 % nbcolumn=length(ind0_i);2000 % ind0_j=first_j:incr_j:last_j;2001 % nbline=length(ind0_j);2002 % if isequal(mode,'#_ab')2003 % dirpair=dir([filebasesub '*_*.nc']);2004 % elseif isequal(mode,'bursts')||isequal(mode,'series(Dj)')2005 % dirpair=dir([filebasesub '_*_*-*.nc']);2006 % elseif isequal(mode,'series(Di)')2007 % dirpair=dir([filebasesub '_*-*_*.nc']);2008 % else2009 % msgbox_uvmat('ERROR','option *|* not yet implemented')2010 % return2011 % end2012 % if isempty(dirpair)2013 % msgbox_uvmat('ERROR','no pair detected in the selected range')2014 % return2015 % end2016 %2017 % if isequal(mode,'bursts')||isequal(mode,'#_ab')2018 % icount=0;2019 % for ifile=1:length(dirpair)2020 % [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name);2021 % num1_r=str2num(str_1);2022 % if isequal(RootFile,Name) & ~isempty(num1_r)2023 % num_i1(ifile)=num1_r;2024 % num_a(ifile)=stra2num(str_a);2025 % num_b(ifile)=stra2num(str_b);2026 % end2027 % end2028 % test_range= (num_i1 >=first_i)&(num_i1<= last_i);% =1 when both numbers are in the range2029 % ind_i=((num_i1-first_i)/incr_i)+1;%indices i in the list of prescribed file indices2030 % select=find(test_range &(floor(ind_i)==ind_i));%selected indices of num_i1 in the file directory2031 % ind_i=ind_i(select);%set of selected indices ind_i2032 % [ind_i,indsort]=sort(ind_i);%sorted list of ind_i2033 % select=select(indsort);2034 % num_i1=num_i1(select);2035 % num_a=num_a(select);2036 % num_b=num_b(select);2037 % dirpair=dirpair(select);2038 % [ind_remove]=find_pairs(dirpair,ind_i,nbcolumn);2039 % ind_i(ind_remove)=[];2040 % num_a(ind_remove)=[];2041 % num_b(ind_remove)=[];2042 % num_j1=zeros(1,nbcolumn);%default2043 % num_j2=num_j1;2044 % num_j1(ind_i)=num_a;2045 % num_j2(ind_i)=num_b;2046 % num_i1=first_i:incr_i:last_i;2047 % num_i2=num_i1;2048 % nbmissing=nbcolumn-length(ind_i);2049 %2050 % elseif isequal(mode,'series(Di)')2051 % %ind0_i=num_first_i:num_incr_i:num_last_i;2052 % %nbcolumn=length(ind0_i);2053 % %ind0_j=num_first_j:num_incr_j:num_last_j;2054 % %nbline=length(ind0_j);2055 % %dirpair=dir([filebasesub '_*-*_*.nc']);2056 % for ifile=1:length(dirpair)2057 % [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name);2058 % num_i1_r(ifile)=str2num(str_1);2059 % num_i2_r(ifile)=str2num(str_2);2060 % num_j(ifile)=str2num(str_a);2061 % end2062 % num_i=floor((num_i1_r+num_i2_r)/2); %list of reference indices of the detected files2063 % test_range= (num_i >=first_i)&(num_i<= last_i)&(num_j >=first_j)&(num_j<= last_j);% =1 when both numbers are in the range2064 % ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices2065 % ind_j=((num_j-first_j)/incr_j)+1;2066 % ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices2067 % select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory2068 % ind_ij=ind_ij(select);%set of selected indices ind_ij2069 % [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij2070 % select=select(indsort);2071 % num_i1_r=num_i1_r(select);2072 % num_i2_r=num_i2_r(select);2073 % dirpair=dirpair(select);2074 % [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ;2075 % ind_ij(ind_remove)=[];2076 % num_i1_r(ind_remove)=[];2077 % num_i2_r(ind_remove)=[];2078 % num_i1=zeros(1,nbline*nbcolumn);%default2079 % num_i2=num_i1;2080 % num_i1(ind_ij)=num_i1_r;2081 % num_j2(ind_ij)=num_i2_r;2082 % num_i1=reshape(num_i1,nbline,nbcolumn);2083 % num_i2=reshape(num_i2,nbline,nbcolumn);2084 % num_j1=meshgrid(ind0_i,ind0_j);2085 % num_j2=num_j1;2086 % nbmissing=nbline*nbcolumn-length(ind_ij);2087 % elseif isequal(mode,'series(Dj)')2088 % for ifile=1:length(dirpair)2089 % [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name);2090 % num_i(ifile)=str2num(str_1);2091 % num_a(ifile)=str2num(str_a);2092 % num_b(ifile)=str2num(str_b);2093 % end2094 % num_j=floor((num_a+num_b)/2); %list of reference indices of the detected files2095 % test_range= (num_i >=first_i)&(num_i<= last_i)&(num_j >=first_j)&(num_j<= last_j);% =1 when both numbers are in the range2096 % ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices2097 % ind_j=((num_j-first_j)/incr_j)+1;2098 % ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices2099 % select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory2100 % ind_ij=ind_ij(select);%set of selected indices ind_ij2101 % [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij2102 % select=select(indsort);2103 % num_i=num_i(select);2104 % num_a=num_a(select);2105 % num_b=num_b(select);2106 % dirpair=dirpair(select);2107 % [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ;2108 % ind_ij(ind_remove)=[];2109 % num_a(ind_remove)=[];2110 % num_b(ind_remove)=[];2111 % num_j1=zeros(1,nbline*nbcolumn);%default2112 % num_j2=num_j1;2113 % num_j1(ind_ij)=num_a;2114 % num_j2(ind_ij)=num_b;2115 % num_j1=reshape(num_j1,nbline,nbcolumn);2116 % num_j2=reshape(num_j2,nbline,nbcolumn);2117 % num_i1=meshgrid(ind0_i,ind0_j);2118 % num_i2=num_i1;2119 % nbmissing=nbline*nbcolumn-length(ind_ij);2120 % end2121 2122 1754 2123 1755 % --- Executes on button press in REFRESH_INDICES. 2124 2125 2126 1756 function REFRESH_INDICES_Callback(hObject, eventdata, handles) 2127 1757 % hObject handle to REFRESH_INDICES (see GCBO) … … 2162 1792 if ~isempty(SeriesData) 2163 1793 % ListViewString={}; 2164 for i list=1:size(InputTable,1)2165 if ~isempty(SeriesData.j1_series{i list})1794 for iview=1:size(InputTable,1) 1795 if ~isempty(SeriesData.j1_series{iview}) 2166 1796 state_j='on'; 2167 1797 end 2168 if ~isempty(SeriesData.i2_series{i list})||~isempty(SeriesData.j2_series{ilist})1798 if ~isempty(SeriesData.i2_series{iview})||~isempty(SeriesData.j2_series{iview}) 2169 1799 state_Pairs='on'; 2170 ListViewString{i list}=num2str(ilist);2171 if check_lines(i list)2172 val=i list;%select the last pair if it is a new entry1800 ListViewString{iview}=num2str(iview); 1801 if check_lines(iview) 1802 val=iview;%select the last pair if it is a new entry 2173 1803 end 2174 1804 end 2175 if strcmp(SeriesData.FileType ,'civx')||strcmp(SeriesData.FileType,'civdata')1805 if strcmp(SeriesData.FileType{iview},'civx')||strcmp(SeriesData.FileType{iview},'civdata') 2176 1806 state_InputFields='on'; 2177 1807 end
Note: See TracChangeset
for help on using the changeset viewer.