Changeset 376


Ignore:
Timestamp:
Jan 17, 2012, 12:11:00 AM (12 years ago)
Author:
sommeria
Message:

introduce get_file_type to get easily the type of file (image, multimage, civdata...)
a few bugs corrected in series

Location:
trunk/src
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_file_series.m

    r372 r376  
    3737%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    3838
    39 function [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPath,fileinput,option)
     39function [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPath,fileinput)
    4040%------------------------------------------------------------------------
    4141if ~exist('option','var')
     
    4747
    4848%% check for particular file types: images, movies, civ data
    49 FileType='';
    50 Object=[];
    5149i1_series=zeros(1,1,1);
    5250i2_series=zeros(1,1,1);
    5351j1_series=zeros(1,1,1);
    5452j2_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);
     54if strcmp( FileType,'multimage')||strcmp( FileType,'video')
     55        NomType='*';
     56        i1_series=(1:FileInfo.NbFrame)'
    10557end
    10658
     
    172124    star_string=[RootFile sep1 i1_star sep2 i2_star sep3 j1_star sep4 j2_star '*'];
    173125    wd=pwd;%current working directory
    174     %RR=fullfile(RootPath,SubDir);
    175126    cd (RootPath)% move to the local dir to save time in the operation dir.
    176127    dirpair=dir([star_string FileExt]);% look for relevant files in the file directory
     
    258209
    259210%% 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');
     211if isempty(FileType)
     212    [FileType,tild,Object]=get_file_type(dirpair(ifile_min).name);
    264213end
    265214
  • 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
    112function [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param)
    2 Param
     13
    314filecell={};
    415InputTable=Param.InputTable;
  • trunk/src/series.m

    r372 r376  
    101101end
    102102
    103 %file name and browser initialisation
     103%% file name and browser initialisation
    104104if isfield(param,'menu_coord_str')
    105105    set(handles.transform_fct,'String',param.menu_coord_str)
     
    110110     set(handles.transform_fct,'Value',1);%default
    111111end
    112 
    113112if isfield(param,'FileName')
    114113    if isfield(param,'FileName_1')
     
    120119end 
    121120
    122 %fields input initialisation
     121%% fields input initialisation
    123122if isfield(param,'list_fields')&& isfield(param,'index_fields') &&~isempty(param.list_fields) &&~isempty(param.index_fields)
    124123    set(handles.FieldMenu,'String',param.list_fields);% list menu fields
     
    126125    FieldCell{1}=param.list_fields{param.index_fields};
    127126end
    128 % NomType_Callback(hObject, eventdata, handles)
    129 REFRESH_INDICES_Callback(hObject, eventdata, handles)
     127
     128%REFRESH_INDICES_Callback(hObject, eventdata, handles)
    130129%loads the information stored in prefdir to initiate  the list of ACTION functions
    131130fct_menu={'check_data_files';'aver_stat';'time_series';'merge_proj';'clean_civ_cmx'};
     
    141140end
    142141
    143 %TRANSFORM menu: loads the information stored in prefdir to initiate  the list of field transform functions
     142%% TRANSFORM menu: loads the information stored in prefdir to initiate  the list of field transform functions
    144143menu_str={'';'phys';'px';'phys_polar'};
    145144nb_builtin_transform=numel(menu_str); %number of functions
     
    158157rmpath(fullfile(path_uvmat,'transform_field'))
    159158
    160 % read the list of functions stored in the personal file 'uvmat_perso.mat' in prefdir
     159%% read the list of functions stored in the personal file 'uvmat_perso.mat' in prefdir
    161160if test_profil_perso
    162161    if isfield(h,'series_fct') && iscell(h.series_fct)
     
    187186set(handles.ACTION,'String',fct_menu)
    188187set(handles.ACTION,'UserData',fct_path)% store the list of path in UserData of ACTION
    189 
    190188menu_str=menu_str(find(testexist));
    191189fct_handle=fct_handle(find(testexist));
     
    207205% Get default command line output from handles structure
    208206varargout{1} = handles.output;
    209 
    210207
    211208% --------------------------------------------------------------------
     
    454451[RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomType]=fileparts_uvmat(fileinput);
    455452
    456 %% determine the selected reference field indices for pair dispaly
    457 ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV
    458 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 file
    462     end
    463 end
    464 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 PIV
    466 if ~isempty(j1)
    467     ref_j=j1;
    468     if ~isempty(j2)
    469         ref_j=floor((j1+j2)/2);
    470     end         
    471 end
    472 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 empty
    477 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 end
    484 
    485 %
    486 % % FileBase=fullfile(RootPath,RootFile);
    487 % TimeUnit=''; %default
    488 % time=[];%default
    489 % testima=0; %test for image input
    490 % if isequal(lower(FileExt),'.avi') %.avi file
    491 %     testima=1;
    492 % elseif ~isempty(imformats(FileExt(2:end)))
    493 %     testima=1;
    494 % elseif isequal(FileExt,'.vol')
    495 %      testima=1;
    496 % end
    497 
    498453%% fill the list of file series
    499454InputTable=get(handles.InputTable,'Data');
     
    513468set(handles.REFRESH_INDICES,'UserData',check_lines);
    514469
    515 %% refresh menus with info fromthe new series
     470%% refresh menus with info from the new series
    516471REFRESH_INDICES_Callback([],[], handles)
     472
     473%% determine the selected reference field indices for pair dispaly
     474ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV
     475if ~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
     480end
     481set(handles.ref_i,'String',num2str(ref_i));
     482ref_j=1; %default  ref_j is a reference frame index used to find existing pairs from PIV
     483if ~isempty(j1)
     484    ref_j=j1;
     485    if ~isempty(j2)
     486        ref_j=floor((j1+j2)/2);
     487    end         
     488end
     489set(handles.ref_j,'String',num2str(ref_j));
     490ref_i_Callback([],[], handles)
     491ref_j_Callback([],[], handles)
     492
     493%% update the first and last reference indices if empty
     494first_i=str2num(get(handles.num_first_i,'String'));
     495if isempty(first_i)
     496set(handles.num_first_i,'String',num2str(ref_i));
     497set(handles.num_last_i,'String',num2str(ref_i));
     498set(handles.num_first_j,'String',num2str(ref_j))
     499set(handles.num_last_j,'String',num2str(ref_j));
     500end
    517501
    518502%% store the root name for future opening of uvmat
     
    536520%num_last_i_Callback([], [], handles)
    537521
    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 window
    561 % 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 introduced
    569 % 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 introduced
    577 % %------------------------------------------------------------
    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 introduced
    584 % %------------------------------------------------------------
    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 introduced
    591 % %------------------------------------------------------------
    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 introduced
    598 % %------------------------------------------------------------
    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 introduced
    605 % %------------------------------------------------------------
    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 % %------------------------------------------------------------------------
    614522
    615523% --- Executes when entered data in editable cell(s) in InputTable.
     
    623531%       Error: error string when failed to convert EditData to appropriate value for Data
    624532% handles    structure with handles and user data (see GUIDATA)
    625 eventdata
    626533check_lines=get(handles.REFRESH_INDICES,'UserData');
    627534check_lines(eventdata.Indices(1))=1; %select the edited line for refresh
     
    633540% --- Executes on button press in mode.
    634541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    635     function mode_Callback(hObject, eventdata, handles)
     542function mode_Callback(hObject, eventdata, handles)
    636543       
    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
     544SeriesData=get(handles.series,'UserData');
     545mode_list=get(handles.mode,'String');
     546mode_value=get(handles.mode,'Value');
     547mode=mode_list{mode_value};
     548time=[];
     549if isfield(SeriesData,'Time')
     550    time=SeriesData.Time{1}; %get the set of times
     551end
     552if 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)
     555else
     556    enable_i(handles,'On')
     557    enable_j(handles,'Off')
     558end
     559find_netcpair_civ(handles)
    676560
    677561%-------------------------------------
     
    719603function find_netcpair_civ(handles)
    720604SeriesData=get(handles.series,'UserData');
    721 % NomTypeCell=get(handles.NomType,'String');
    722 % NomTypeCell=SeriesData.NomType;
    723 % NomType=NomTypeCell{Val};
    724 
    725605set(handles.Pairs,'Visible','on')% makes the panel "Pairs' visible
    726 %nomenclature types
    727 % 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 %          return
    738 % end
    739606mode_list=get(handles.mode,'String');
    740607mode_value=get(handles.mode,'Value');
     
    834701end
    835702set(handles.list_pair_civ,'String',displ_pair)
    836 displ_pair
    837 
    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==1
    844 %                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 %                 end
    856 %                 if isfield(Cte,'absolut_time_TO_2')
    857 %                     ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority
    858 %                 elseif isfield(Cte,'absolut_time_TO')
    859 %                     ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit
    860 %                 elseif isfield(Cte,'Time')
    861 %                     ref_time(ind_exist)=Cte.Time;
    862 %                 end
    863 %                 displ_pair{ind_exist}=['Di= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit];
    864 %          end
    865 %      end
    866 %      set(handles.list_pair_civ,'String',[displ_pair';{'Di=*|*'}]);   
    867 % elseif isequal(mode,'series(Dj)')% series on the j index
    868 %        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==1
    872 %                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 %                 end
    883 %                 if isfield(Cte,'absolut_time_TO_2')
    884 %                     ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority
    885 %                 elseif isfield(Cte,'absolut_time_TO')
    886 %                     ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit
    887 %                 elseif isfield(Cte,'Time')
    888 %                     ref_time(ind_exist)=Cte.Time;
    889 %                 end
    890 %                 displ_pair{ind_exist}=['Dj= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit];
    891 %            end
    892 %        end
    893 %        set(handles.list_pair_civ,'String',[displ_pair';{'Dj=*|*'}]);
    894 % elseif isequal(mode,'bursts') %case of bursts
    895 %     for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'bursts' mode
    896 %         for numod_b=(numod_a+1):nbfield2
    897 %             [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==1
    900 %                 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 %                 else
    912 %                    dt(ind_exist)=NaN;%no information on dt
    913 %                 end
    914 %                 %determine nom_type_ima for pair display (used in num2stra.m)
    915 %                 switch NomType
    916 %                     case {'#ab'}
    917 %                         nom_type_ima='#a';
    918 %                     case {'#AB'}
    919 %                         nom_type_ima='#A';
    920 %                     otherwise
    921 %                          nom_type_ima='_1_1';
    922 %                 end
    923 %                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 %             end
    926 %          end
    927 %          set(handles.list_pair_civ,'String',[displ_pair';{'j=*-*'}]);
    928 %      end
    929 %      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 %      end
    938 % end
    939703if isempty(displ_pair)
    940704    msgbox_uvmat('ERROR',['no file available for the selected subdirectory ' subdir])
     
    13471111mode=mode_list{mode_value};
    13481112SeriesData=get(handles.series,'UserData');
     1113% if ~isempty(SeriesData)
    13491114if ~isempty(SeriesData.i2_series)||~isempty(SeriesData.j2_series)
    13501115    if isequal(mode,'series(Di)')
     
    13521117    end
    13531118end
     1119% end
    13541120
    13551121%------------------------------------------------------------------------
     
    13601126mode=mode_list{mode_value};
    13611127SeriesData=get(handles.series,'UserData');
     1128if ~isempty(SeriesData)
    13621129if ~isempty(SeriesData.i2_series)||~isempty(SeriesData.j2_series)
    13631130    if isequal(mode,'series(Di)')
    13641131        find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files
    13651132    end
     1133end
    13661134end
    13671135% NomTypeCell=SeriesData.NomType;
     
    18491617     else
    18501618         %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');
    18521622         if isempty(defaultname)
    18531623            defaultname={''};
     
    19821752   set(handles.path_transform,'String',''); %show the path to the senlected function
    19831753end
    1984 %------------------------------------------------------------------------
    1985 % --- generates a series of file names with reference numbers between range1 and
    1986 % --- range2 with increment incr. The reference number num_ref is the image number at the middle of the
    1987 % --- image pair. The set of first numbers num1 of the image pairs is also
    1988 % --- given as output
    1989 % 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={};%default
    1994 % 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 % else
    2009 %     msgbox_uvmat('ERROR','option *|* not yet implemented')
    2010 %     return
    2011 % end
    2012 % if isempty(dirpair)
    2013 %         msgbox_uvmat('ERROR','no pair detected in the selected range')
    2014 %         return
    2015 % end
    2016 %
    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 %         end     
    2027 %     end
    2028 %     test_range= (num_i1 >=first_i)&(num_i1<= last_i);% =1 when both numbers are in the range
    2029 %     ind_i=((num_i1-first_i)/incr_i)+1;%indices i in the list of prescribed file indices
    2030 %     select=find(test_range &(floor(ind_i)==ind_i));%selected indices of num_i1 in the file directory
    2031 %     ind_i=ind_i(select);%set of selected indices ind_i
    2032 %     [ind_i,indsort]=sort(ind_i);%sorted list of ind_i
    2033 %     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);%default
    2043 %     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 %     end
    2062 %     num_i=floor((num_i1_r+num_i2_r)/2); %list of reference indices of the detected files
    2063 %     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 range
    2064 %     ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices
    2065 %     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 indices
    2067 %     select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory
    2068 %     ind_ij=ind_ij(select);%set of selected indices ind_ij
    2069 %     [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij
    2070 %     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);%default
    2079 %     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 %     end
    2094 %     num_j=floor((num_a+num_b)/2); %list of reference indices of the detected files
    2095 %     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 range
    2096 %     ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices
    2097 %     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 indices
    2099 %     select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory
    2100 %     ind_ij=ind_ij(select);%set of selected indices ind_ij
    2101 %     [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij
    2102 %     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);%default
    2112 %     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 % end
    2121 
    21221754
    21231755% --- Executes on button press in REFRESH_INDICES.
    2124 
    2125    
    21261756    function REFRESH_INDICES_Callback(hObject, eventdata, handles)
    21271757% hObject    handle to REFRESH_INDICES (see GCBO)
     
    21621792if ~isempty(SeriesData)
    21631793%     ListViewString={};
    2164     for ilist=1:size(InputTable,1)
    2165         if ~isempty(SeriesData.j1_series{ilist})
     1794    for iview=1:size(InputTable,1)
     1795        if ~isempty(SeriesData.j1_series{iview})
    21661796            state_j='on';
    21671797        end
    2168         if ~isempty(SeriesData.i2_series{ilist})||~isempty(SeriesData.j2_series{ilist})
     1798        if ~isempty(SeriesData.i2_series{iview})||~isempty(SeriesData.j2_series{iview})
    21691799            state_Pairs='on';
    2170             ListViewString{ilist}=num2str(ilist);
    2171             if check_lines(ilist)
    2172                 val=ilist;%select the last pair if it is a new entry
     1800            ListViewString{iview}=num2str(iview);
     1801            if check_lines(iview)
     1802                val=iview;%select the last pair if it is a new entry
    21731803            end
    21741804        end
    2175         if strcmp(SeriesData.FileType,'civx')||strcmp(SeriesData.FileType,'civdata')
     1805        if strcmp(SeriesData.FileType{iview},'civx')||strcmp(SeriesData.FileType{iview},'civdata')
    21761806            state_InputFields='on';
    21771807        end
Note: See TracChangeset for help on using the changeset viewer.