Changeset 339


Ignore:
Timestamp:
Dec 19, 2011, 10:12:56 AM (9 years ago)
Author:
sommeria
Message:

name2display replaced by fileparts_uvmat and find_file_series in series.
name2display partially replaced in civ.m (to be continued)
series.fig reorganized with panels.

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r336 r339  
    183183    end
    184184end
    185 [RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput);
     185%[RootPath,RootFile,str1,str2,str_a,str_b,FileExt,NomType,subdir]=name2display(fileinput);
     186[~,~,~,i1,i2,j1,j2,FileExt,NomType]=fileparts_uvmat(fileinput);
    186187% filebase=fullfile(RootPath,RootFile);
    187 num_i1=str2double(str1);
    188 if isnan(num_i1),num_i1=1;end
    189 num_i2=str2double(str2);
    190 if isnan(num_i2),num_i2=num_i1;end
    191 num_j1=stra2num(str_a);
    192 if isnan(num_j1),num_j1=1;end
    193 num_j2=stra2num(str_b);
    194 if isnan(num_j2),num_j2=num_j1;end
     188if isempty(i1),i1=1;end
     189if isempty(i2),i2=i1;end
     190if isempty(j1),j1=1;end
     191if isempty(j2),j2=j1;end
    195192if isequal(get(handles.ListCompareMode,'Value'),1)
    196193    browse=[];%initialisation
     
    198195    browse=get(handles.RootName,'UserData');
    199196end
    200 browse.num_i1=num_i1;
    201 browse.num_i2=num_i2;
    202 browse.num_j1=num_j1;
    203 browse.num_j2=num_j2;
    204 if length(ext)>1 && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat
    205     browse.nom_type_ima=nom_type;
    206     browse.ext_ima=ext;
    207     set(handles.ImaExt,'String',ext)
    208 end
    209 set(handles.ImaDoc,'String',ext);
     197browse.num_i1=i1;
     198browse.num_i2=i2;
     199browse.num_j1=j1;
     200browse.num_j2=j2;
     201if length(FileExt)>1 && (~isempty(imformats(FileExt(2:end)))||strcmpi(FileExt,'.avi'));%if an image file has been opened by uvmat
     202    browse.nom_type_ima=NomType;
     203    browse.ext_ima=FileExt;
     204    set(handles.ImaExt,'String',FileExt)
     205end
     206set(handles.ImaDoc,'String',FileExt);
    210207
    211208set(handles.RootName,'UserData',browse);% store information from browser
     
    335332nom_type_ima='';%default
    336333nom_type_nc='';
    337 [RootPath,FileName,i1_str,i2_str,j1_str,j2_str,ext_input,nom_type_input,subdir]=name2display(fileinput);
    338 RootName=fullfile(RootPath,FileName);
     334[RootPath,RootFile,i1_str,i2_str,j1_str,j2_str,ext_input,nom_type_input,subdir]=name2display(fileinput);
     335%[RootPath,subdir,RootFile,i1,i2,j1,j2,ext_input,nom_type_input]=fileparts_uvmat(fileinput);TODO: use to replace name2display
     336RootName=fullfile(RootPath,RootFile);
    339337set(handles.RootName,'String',RootName)
    340338set(handles.RootName,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding
  • trunk/src/fileparts_uvmat.m

    r334 r339  
    3838NomType='';
    3939
    40 
    41 
    4240%% display help and test function in the absence of input arument
    4341if ~exist('FileInput','var')
     
    4745end
    4846
     47%% default root name output
    4948[RootPath,FileName,FileExt]=fileparts(FileInput);
    50 RootFile=FileName;%default
    51 % switch FileExt
    52 %     case '.avi'
    53 %         NomType='*';
    54 %         return
    55 %     case {'.tif','.tiff'}
    56 %         if exist(FileInput,'file')
    57 %             info=iminfo(FileInput);
    58 %             if length(info)>1
    59 %                 NomType='*';
    60 %                 return
    61 %             end
    62 %         end
    63 % end
    64 
    65 % \D not a digit
    66 % \d digit
    67 
    68 
    69 %% recursive test on FileName starting from the end
    70 % case of pure number
     49RootFile=FileName;
     50
     51%% case of input file name which is a pure number
    7152if ~isnan(str2double(FileName))
    7253    RootFile='';
     
    7455    return
    7556end
     57
     58%% recursive test on FileName starting from the end
    7659% test whether FileName ends with a number or not
    7760r=regexp(FileName,'.*\D(?<num1>\d+)$','names');% \D = not a digit, \d =digit
     
    141124        i1=str2double(r.num1);
    142125        NomType=[get_type(r.num1) NomType];
    143         r=regexp(RootPath,'\<(?<newrootpath>.+)(\\|/)(?<subdir>[^\\^/]+)(\\|/)*\>','names');
    144         if ~isempty(r)
    145             SubDir=r.subdir;
    146             RootPath=r.newrootpath;
    147         end
    148126    end
    149127end
     
    153131    RootFile(end)=[];
    154132    NomType=['_' NomType];
     133end
     134
     135%% extract subdirectory for pairs i1-i2 or j1-j2 (or ab, AB)
     136if ~isempty(i2) || ~isempty(j2)
     137    r=regexp(RootPath,'\<(?<newrootpath>.+)(\\|/)(?<subdir>[^\\^/]+)(\\|/)*\>','names');
     138    if ~isempty(r)
     139        SubDir=r.subdir;
     140        RootPath=r.newrootpath;
     141    end
    155142end
    156143
     
    162149%     end
    163150% end
    164 
    165 
    166151
    167152
  • trunk/src/find_file_series.m

    r334 r339  
    11%'find_file_series': check the content onf an input field and find the corresponding file series
    22%--------------------------------------------------------------------------
    3 % function [i1,i2,j1,j2,NomType,FileType,Object]=find_file_series(fileinput)
     3% function [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(fileinput)
    44%
    55% OUTPUT:
    6 % i1,i2,j1,j2: set of i1 indices, respectively i2,j1,j2,  of the detected files
     6% RootPath,RootFile: root path and root name detected in fileinput, possibly modified for movies (indexing is then done on image view, not file)
     7% i1_series(ref_i, ref_j,pair),i2_series,j1_series,j2_series: set of indices (i1,i2,j1,j2) sorted by ref index ref_i, ref_j, and pairindex in case of multiple pairs with the same ref
    78% NomType: nomenclature type corrected after checking the first file (problem of 0 before the number string)
    89% FileType: type of file, =
     
    3435%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    3536
    36 function [i1,i2,j1,j2,NomType,FileType,Object]=find_file_series(fileinput)
     37function [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(fileinput)
    3738%------------------------------------------------------------------------
    38 i1=[];%default
    39 i2=[];%default
    40 j1=[];%default
    41 j2=[];%default
    4239
    4340%% get input root name and nomenclature type
    4441% [RootPath,RootFile,~,~,~,~,FileExt,NomType,SubDir]=name2display(fileinput);
    45 [RootPath,SubDir,RootFile,~,~,~,~,FileExt,NomType]=fileparts_uvmat(fileinput);
     42[RootPath,SubDir,RootFile,~,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fileinput);
    4643
    4744%% check for particular file types: images, movies, civ data
    4845FileType='';
    4946Object=[];
     47i1_series=zeros(1,1,1);
     48i2_series=zeros(1,1,1);
     49j1_series=zeros(1,1,1);
     50j2_series=zeros(1,1,1);
    5051switch FileExt
    5152    % ancillary files, no field indexing
     
    6465    otherwise
    6566        if ~isempty(FileExt)&& ~isempty(imformats(FileExt(2:end)))
    66             imainfo=imfinfo(fileinput);
    67             FileType='image';
    68             if length(imainfo) >1 %case of image with multiple frames
    69                 NomType='*';
    70                 FileType='multimage';
    71                 i1=1;
    72                 i2=length(imainfo);
    73                 [RootPath,RootFile]=fileparts(fileinput);
     67            try
     68                imainfo=imfinfo(fileinput);
     69                FileType='image';
     70                if length(imainfo) >1 %case of image with multiple frames
     71                    NomType='*';
     72                    FileType='multimage';
     73                    i1_series=1:length(imainfo);
     74                    [RootPath,RootFile]=fileparts(fileinput);
     75                end
    7476            end
    7577        else
     
    8890                NomType='*';
    8991                FileType='video';
    90                 i1=1;
    91                 i2=get(Object,'NumberOfFrames');
     92                i1_series=[1:get(Object,'NumberOfFrames')];
    9293                [RootPath,RootFile]=fileparts(fileinput);
    9394            end
    9495        end
    9596end
     97
     98%% get the list of existing files when relevant
    9699if strcmp(NomType,'')||strcmp(NomType,'*')
     100    if exist(fileinput,'file')
    97101    [RootPath,RootFile]=fileparts(fileinput);% case of constant name (no indexing)
    98 %% get the list of existing files
     102    else
     103       RootPath='';
     104       RootFile='';
     105    end
    99106else
    100107    if strcmp(SubDir,'')
     
    113120    end
    114121    dirpair=dir([filebasesub detect_string FileExt]);
    115     for ifile=1:length(dirpair)
    116        % [~,~,str_1,str_2,str_a,str_b]=name2display(dirpair(ifile).name);
    117        dirpair(ifile).name
    118         [~,~,~,i1_ifile,i2_ifile,j1_ifile,j2_ifile]=fileparts_uvmat(dirpair(ifile).name); 
    119         if isempty(i1_ifile)
    120             i1(ifile)=1;
     122    nbpair=numel(dirpair);
     123    ref_i_list=zeros(1,nbpair);
     124    ref_j_list=zeros(1,nbpair);
     125    if nbpair==0% no detected file
     126        RootPath='';
     127        RootFile='';
     128    end
     129    for ifile=1:nbpair
     130        [~,~,~,i1,i2,j1,j2]=fileparts_uvmat(dirpair(ifile).name);
     131        %             i1_series(ifile)=i1;
     132        ref_i=i1;
     133        if isempty(i2_input)
     134            if ~isempty(i2)% invalid file name if i2 does not exist in the input file
     135                break
     136            end
    121137        else
    122             i1(ifile)=i1_ifile;
    123         end
    124         if isempty(i2_ifile)
    125             i2(ifile)=i1(ifile);
     138            ref_i=floor((i1+i2)/2);
     139        end
     140        ref_j=1;
     141        if isempty(j1_input)
     142            if  ~isempty(j1)% invalid file name if j1 does not exist in the input file
     143                break
     144            end
    126145        else
    127             i2(ifile)=i2_ifile;
    128         end
    129         end
    130         if isempty(j1_ifile)
    131             j1(ifile)=1;
    132         else
    133             j1(ifile)=j1_ifile;
    134         end
    135         if isempty(j2_ifile)
    136             j2(ifile)=j1(ifile);
    137         else
    138             j2(ifile)=j2_ifile;
    139         end
    140     end 
    141     % TODO : sort by reference index
    142     % update the NomType from the minimal index detected (to deal with number strings beginning by 0)
    143     [~,ifile]=min(i1);
    144     %[~,~,~,~,~,~,~,NomType]=name2display(dirpair(ifile).name);
    145     if ~isempty(i1)
    146            [~,ifile]=min(i1);
     146            ref_j=j1;
     147            if isempty(j2_input)
     148                if  ~isempty(j2)% invalid file name if j2 does not exist in the input file
     149                    break
     150                end
     151            else
     152                ref_j=floor((j1+j2)/2);
     153            end
     154        end
     155        % update the detected index series
     156        ref_i_list(ifile)=ref_i;
     157        ref_j_list(ifile)=ref_j;
     158        nb_pairs=0;
     159        if ~isempty(i2_input)|| ~isempty(j2_input) %deals with  pairs
     160            if size(i1_series,1)>=ref_i && size(i1_series,2)>=ref_j
     161                nb_pairs=numel(find(i1_series(ref_i,ref_j,:)~=0));
     162            end
     163        end
     164        i1_series(ref_i,ref_j,nb_pairs+1)=i1;
     165        if ~isempty(i2_input)
     166            i2_series(ref_i,ref_j,nb_pairs+1)=i2;
     167        end
     168        if ~isempty(j1_input)
     169            j1_series(ref_i,ref_j,nb_pairs+1)=j1;
     170        end
     171        if ~isempty(j2_input)
     172            j1_series(ref_i,ref_j,nb_pairs+1)=j1;
     173            j2_series(ref_i,ref_j,nb_pairs+1)=j2;
     174        end
     175    end
     176    % look for the numerical string of the first files to update the NomType (take into account the 0 before the number)
     177    max_j=max(ref_j_list);
     178    ref_ij=ref_i_list*max_j+ref_j_list; % ordered by index i, then by j for a given i.
     179    [~,ifile]=min(ref_ij(ref_ij>0));
    147180    [~,~,~,~,~,~,~,~,NomType]=fileparts_uvmat(dirpair(ifile).name);
    148     end
    149181end
     182
     183%% set to empty array the irrelevant index series
     184if isequal(i1_series,0), i1_series=[]; end
     185if isequal(i2_series,0), i2_series=[]; end
     186if isequal(j1_series,0), j1_series=[]; end
     187if isequal(j2_series,0), j2_series=[]; end
     188
     189%% sort pairs by decreasing index differences in case of multiple pairs at the same reference index
     190if size(i2_series,3)>1 %pairs i1 -i2
     191    diff_index=abs(i2_series-i1_series);
     192    [~,ind_pair]=sort(diff_index,3,'descend');
     193    for ref_i=1:size(i1_series,1)
     194        for ref_j=1:size(j1_series,2)
     195            i1_series(ref_i,ref_j,:)=i1_series(ref_i,ref_j,ind_pair(ref_i,ref_j,:));
     196            i2_series(ref_i,ref_j,:)=i2_series(ref_i,ref_j,ind_pair(ref_i,ref_j,:));
     197            if ~isempty(j1_series)
     198                j1_series(ref_i,ref_j,:)=j1_series(ref_i,ref_j,ind_pair(ref_i,ref_j,:));
     199            end
     200        end
     201    end
     202elseif size(j2_series,3)>1 %pairs j1 -j2
     203    diff_index=abs(j2_series-j1_series);
     204    [~,ind_pair]=sort(diff_index,3,'descend');
     205    for ref_i=1:size(i1_series,1)
     206        for ref_j=1:size(j1_series,2)
     207            i1_series(ref_i,ref_j,:)=i1_series(ref_i,ref_j,ind_pair(ref_i,ref_j,:));
     208            if ~isempty(i2_series)
     209                i2_series(ref_i,ref_j,:)=i2_series(ref_i,ref_j,ind_pair(ref_i,ref_j,:));
     210            end
     211            j1_series(ref_i,ref_j,:)=j1_series(ref_i,ref_j,ind_pair(ref_i,ref_j,:));
     212            j2_series(ref_i,ref_j,:)=j2_series(ref_i,ref_j,ind_pair(ref_i,ref_j,:));
     213        end
     214    end
     215end
     216
  • trunk/src/series.m

    r332 r339  
    445445    return
    446446end
    447 [RootPath,RootFile,i1,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput);
     447[RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput);
     448
    448449
    449450%% look for min and max indices existing in the file series and update NomType
    450 [num_i1,num_i2,num_j1,num_j2,NomType,FileType,Object]=find_file_series(fileinput);
    451  if strcmp(NomType,'*')
    452      MinIndex_i=1;
    453      MinIndex_j=1;
    454      nb_field=num_i2;
    455      nb_field2=1;
    456  else
    457     MinIndex_i=min(floor((min(num_i1)+min(num_i2))/2));
    458     MinIndex_j=min(floor((min(num_j1)+min(num_j2))/2));
    459     nb_field=max(floor((max(num_i1)+max(num_i2))/2));
    460     nb_field2=max(floor((max(num_j1)+max(num_j2))/2));
    461  end
    462 if isnan(nb_field)
    463     nb_field_str='?';
    464     nb_field_str2='?';
    465 else
    466     MinIndex_i_str=num2str(MinIndex_i);
    467     MinIndex_j_str=num2str(MinIndex_j);
    468     nb_field_str=num2str(nb_field);
    469     nb_field_str2=num2str(nb_field2); 
     451[RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(fileinput);
     452MinIndex_i=min(i1_series(i1_series>0));
     453if ~isempty(i2_series)
     454    MaxIndex_i=max(i2_series(i2_series>0));
     455else
     456    MaxIndex_i=max(i1_series(i1_series>0));
     457end
     458MinIndex_j=min(j1_series(j1_series>0));
     459if ~isempty(j2_series)
     460    MaxIndex_j=max(j2_series(j2_series>0));
     461else
     462    MaxIndex_j=max(j1_series(j1_series>0));
    470463end
    471464if addtest% case of insertion of a new series (menu bar option Open_insert)
    472     MinIndex_i_cell=[{MinIndex_i_str} ;get(handles.MinIndex_i,'String')];
    473     MinIndex_j_cell=[{MinIndex_j_str} ;get(handles.MinIndex_j,'String')];
    474     nb_field_cell=[{nb_field_str} ;get(handles.nb_field,'String')];
    475     nb_field2_cell=[{nb_field_str2} ;get(handles.nb_field2,'String')];
     465    MinIndex_i_cell=[{num2str(MinIndex_i)} ;get(handles.num_MinIndex_i,'String')];
     466    nb_field_cell=[{num2str(MaxIndex_i)} ;get(handles.num_MaxIndex_i,'String')];
     467    MinIndex_j_cell=[{num2str(MinIndex_j)} ;get(handles.num_MinIndex_j,'String')];
     468    nb_field2_cell=[{num2str(MaxIndex_j)} ;get(handles.num_MaxIndex_j,'String')];
    476469else % refresh the list (menu bar option Open)
    477     MinIndex_i_cell={MinIndex_i_str};
    478     MinIndex_j_cell={MinIndex_j_str};
    479     nb_field_cell={nb_field_str};
    480     nb_field2_cell={nb_field_str2};
    481 end
    482 set(handles.MinIndex_i,'String',MinIndex_i_cell);
    483 set(handles.MinIndex_j,'String',MinIndex_j_cell);
    484 set(handles.nb_field,'String',nb_field_cell);
    485 set(handles.nb_field2,'String',nb_field2_cell);
     470    MinIndex_i_cell={num2str(MinIndex_i)};
     471    MinIndex_j_cell={num2str(MinIndex_j)};
     472    nb_field_cell={num2str(MaxIndex_i)};
     473    nb_field2_cell={num2str(MaxIndex_j)};
     474end
     475set(handles.num_MinIndex_i,'String',MinIndex_i_cell);
     476set(handles.num_MinIndex_j,'String',MinIndex_j_cell);
     477set(handles.num_MaxIndex_i,'String',nb_field_cell);
     478set(handles.num_MaxIndex_j,'String',nb_field2_cell);
     479
     480set(handles.waitbar_frame,'Units','pixels')
     481pos=get(handles.waitbar_frame,'Position');
     482xima=0.5:pos(3)-0.5;
     483yima=0.5:pos(4)-0.5;
     484[XIma,YIma]=meshgrid(xima,yima);
     485nb_i=size(i1_series,1);
     486nb_j=size(i1_series,2);
     487ind_i=(0.5:nb_i-0.5)*pos(3)/nb_i;
     488ind_j=(0.5:nb_j-0.5)*pos(4)/nb_j;
     489[Ind_i,Ind_j]=meshgrid(ind_i,ind_j);
     490CData=zeros([size(XIma) 3]);
     491file_ima=double((i1_series(:,:,1)>0)');
     492if size(file_ima,1)==1
     493    file_ima=ones(pos(4),1)*file_ima;
     494end
     495CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest');
     496set(handles.waitbar_frame,'CData',CData)
     497set(handles.waitbar_frame,'Units','normalized')
     498% CData(:,1:floor(advance_ratio*size(CData,2)),1:2)=1;
     499% set(hwaitbar,'CData',CData)
     500%update_waitbar(handles.waitbar_frame,[],0)
    486501
    487502
    488503%% determine reference field indices
    489504ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV
    490 if ~isempty(str2num(i1))
    491     ref_i=str2num(i1);
    492     if ~isempty(str2num(str2))
    493         ref_i=floor((ref_i+str2num(str2))/2);% reference image number corresponding to the file
    494         SeriesData.browse_Di=str2num(str2)-str2num(i1);
     505if ~isempty(i1)
     506    ref_i=i1;
     507    if ~isempty(i2)
     508        ref_i=floor((ref_i+i2)/2);% reference image number corresponding to the file
     509%         SeriesData.browse_Di=i2-i1;
    495510    end
    496511end
    497512set(handles.ref_i,'String',num2str(ref_i));
    498 set(handles.first_i,'String',num2str(ref_i));
    499 set(handles.last_i,'String',num2str(ref_i));
     513set(handles.num_first_i,'String',num2str(ref_i));
     514set(handles.num_last_i,'String',num2str(ref_i));
    500515ref_j=1; %default  ref_j is a reference frame index used to find existing pairs from PIV
    501 if ~isempty(str2num(str_a))
    502     ref_j=str2num(str_a);
    503     if ~isempty(str2num(str_b))
    504         ref_j=floor((str2num(str_a)+str2num(str_b))/2);
    505         SeriesData.browse_Dj=str2num(str_b)-str2num(str_a);
     516if ~isempty(j1)
     517    ref_j=j1;
     518    if ~isempty(j2)
     519        ref_j=floor((j1+j2)/2);
     520%         SeriesData.browse_Dj=j2-j1;
    506521    end         
    507522end
    508523set(handles.ref_j,'String',num2str(ref_j));
    509 set(handles.first_j,'String',num2str(ref_j))
    510 set(handles.last_j,'String',num2str(ref_j));
    511 
     524set(handles.num_first_j,'String',num2str(ref_j))
     525set(handles.num_last_j,'String',num2str(ref_j));
    512526TimeUnit=''; %default
    513527time=[];%default
    514 GeometryCalib=[];%default
    515 nb_field=NaN;%default
    516 nb_field2=NaN;%default
    517 SeriesData.PathCampaign=get(handles.PathCampaign,'String');
    518528
    519529% read timing and total frame number from the current file (movie files) !! may be overrid by xml file
     
    525535%     info=aviinfo([FileBase FileExt]);
    526536%     time=(0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond)';
    527 %     nb_field=info.NumFrames;
    528 %     nb_field2=1;
     537%     num_MaxIndex_i=info.NumFrames;
     538%     num_MaxIndex_j=1;
    529539elseif ~isempty(imformats(FileExt(2:end)))
    530540    testima=1;
     
    532542%         imainfo=imfinfo([FileBase FileExt]);     
    533543%         if length(imainfo) >1 %case of image with multiple frames
    534 %             nb_field=length(imainfo);
    535 %             nb_field2=1;
     544%             num_MaxIndex_i=length(imainfo);
     545%             num_MaxIndex_j=1;
    536546%         end
    537547%     end
     
    539549     testima=1;
    540550end
    541 
    542551
    543552%% fill the list of file series
     
    548557set(handles.NomType,'Value',1)
    549558set(handles.FileExt,'Value',1)
    550 set(handles.nb_field,'Value',1)
    551 set(handles.nb_field2,'Value',1)
    552 % append the current file series to the list
     559set(handles.num_MaxIndex_i,'Value',1)
     560set(handles.num_MaxIndex_j,'Value',1)
     561
     562% insert the current file series at the head of the list
    553563if addtest
    554564    SeriesData=get(handles.series,'UserData');
    555     SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num];
     565  %  SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num];
    556566    SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile;
     567    SeriesData.i1_series=[SeriesData.i1_series;{i1_series}];
     568    SeriesData.i2_series=[SeriesData.i2_series;{i2_series}];
     569    SeriesData.j1_series=[SeriesData.j1_series;{j1_series}];
     570    SeriesData.j2_series=[SeriesData.j2_series;{j2_series}];
    557571    RootPathCell=[{RootPath}; get(handles.RootPath,'String')] ;
    558572    SubDirCell=[{SubDir}; get(handles.SubDir,'String')];
     
    562576    FileTypeCell=[{FileType};SeriesData.FileType];
    563577    set(handles.NomType,'String',[{};get(handles.NomType,'String')])
     578   
    564579% or re-initialise the list of  input  file series   
    565580else
    566581    SeriesData=[];%re-initialisation
    567     SeriesData.displ_num=[0 0 0 0];
     582 %   SeriesData.displ_num=[0 0 0 0];
     583    SeriesData.i1_series={i1_series};
     584    SeriesData.i2_series={i2_series};
     585    SeriesData.j1_series={j1_series};
     586    SeriesData.j2_series={j2_series};
    568587    RootPathCell={RootPath};
    569588    SubDirCell={SubDir};
     
    650669end
    651670if testtransform && (testcivx || testima)
    652      view_TRANSFORM(handles,'on')
    653 else
    654     view_TRANSFORM(handles,'off')
     671    set(handles.FieldTransform,'Visible','on')
     672%      view_TRANSFORM(handles,'on')
     673else
     674    set(handles.FieldTransform,'Visible','off')
     675%     view_TRANSFORM(handles,'off')
    655676end
    656677if ~isequal(FileExt,'.nc') && ~isequal(FileExt,'.cdf') && ~testima
     
    701722end 
    702723
    703 
    704 
    705724%% display times
    706725if addtest
     
    720739           NbSlice=1;
    721740       end
    722        set(handles.NbSlice,'String',num2str(NbSlice))
     741       set(handles.num_NbSlice,'String',num2str(NbSlice))
    723742end
    724743
     
    743762set(handles.RootPath,'BackgroundColor',[1 1 1])
    744763% set(handles.PathCampaign,'String',SeriesData.PathCampaign)
    745 last_j_Callback([], [], handles)
    746 last_i_Callback([], [], handles)
     764num_last_j_Callback([], [], handles)
     765num_last_i_Callback([], [], handles)
    747766
    748767%------------------------------------------------------------------------
     
    761780set(handles.NomType,'Value',Val)
    762781set(handles.FileExt,'Value',Val)
    763 set(handles.nb_field,'Value',Val)
    764 set(handles.nb_field2,'Value',Val)
     782set(handles.num_MaxIndex_i,'Value',Val)
     783set(handles.num_MaxIndex_j,'Value',Val)
    765784set(handles.time_first,'Value',Val)
    766785set(handles.time_last,'Value',Val)
     
    793812%function activated when a new filebase (image series) is introduced
    794813%------------------------------------------------------------
    795 function nb_field_Callback(hObject, eventdata, handles)
    796 Val=get(handles.nb_field,'Value');
     814function num_MaxIndex_i_Callback(hObject, eventdata, handles)
     815Val=get(handles.num_MaxIndex_i,'Value');
    797816synchronise_view(handles,Val)
    798817
     
    800819%function activated when a new filebase (image series) is introduced
    801820%------------------------------------------------------------
    802 function nb_field2_Callback(hObject, eventdata, handles)
    803 Val=get(handles.nb_field2,'Value');
     821function num_MaxIndex_j_Callback(hObject, eventdata, handles)
     822Val=get(handles.num_MaxIndex_j,'Value');
    804823synchronise_view(handles,Val)
    805824
     
    822841function NomType_Callback(hObject, eventdata, handles)
    823842%------------------------------------------------------------------------
     843
    824844SeriesData=get(handles.series,'UserData');
    825845if isfield(SeriesData,'NomType')
     
    828848    NomTypeCell={};
    829849end
    830 nbfield2_cell=get(handles.nb_field2,'String');
    831 val=get(handles.nb_field2,'Value');
     850nbfield2_cell=get(handles.num_MaxIndex_j,'String');
     851val=get(handles.num_MaxIndex_j,'Value');
    832852if iscell(nbfield2_cell)
    833853    nbfield2=str2num(nbfield2_cell{val});
     
    835855    nbfield2=str2num(nbfield2_cell);
    836856end
    837 nbfield_cell=get(handles.nb_field,'String');
     857nbfield_cell=get(handles.num_MaxIndex_i,'String');
    838858if iscell(nbfield_cell)
    839859    nbfield=str2num(nbfield_cell{val});
     
    842862end
    843863
    844 set(handles.mode,'Visible','off') % do not show index pairs by default
    845 set(handles.list_pair_civ,'Visible','off')
    846 set(handles.ref_i,'Visible','off')
    847 set(handles.ref_i_text,'Visible','off')
     864% set(handles.mode,'Visible','off') % do not show index pairs by default
     865set(handles.Pairs,'Visible','off')
     866% set(handles.ref_i,'Visible','off')
     867% set(handles.ref_i_text,'Visible','off')
    848868testpair=0;
    849 state_j='off';
    850869%set the menus of image pairs and default selection for series
    851870%list pairs if relevant
    852871Val=get(handles.NomType,'Value');
    853872synchronise_view(handles,Val)
    854 if ~isempty(NomTypeCell)
    855     NomType=NomTypeCell{Val};
    856     switch NomType 
    857             case {'_1-2_1', '_1-2'}
    858                 set(handles.mode,'String',{'series(Di)'})
    859                 set(handles.mode,'Value',1);
    860                 set(handles.mode,'Visible','on')
    861                 testpair=1;
    862             case {'#_ab'}
    863                 set(handles.mode,'String',{'bursts'})
    864                 set(handles.mode,'Value',1);
    865                 testpair=1;
    866             case '_1_1-2'
    867                 set(handles.mode,'String',{'bursts';'series(Dj)'})%multiple choice
    868                 if ~isempty(nbfield) && ~isempty(nbfield2) && ((nbfield2>10) || (nbfield==1))
    869                     set(handles.mode,'Value',2);
    870                 else
    871                     set(handles.mode,'Value',1);% advice 'bursts' for small bursts
    872                 end
    873                 set(handles.mode,'Visible','on')
    874                 testpair=1;
    875     end
    876     switch NomType   
    877             case {'_1_1','_1_1-2','_1-2_1','1_ab','01_ab'},% two navigation indices
    878                 state_j='on';
    879     end
    880 end
     873if ~isfield(SeriesData,'j1_series')||isempty(SeriesData.j1_series{Val})
     874    state_j='off'; %no need for j index
     875else
     876    state_j='on'; %case of j index
     877end
     878% show index pairs if files exist
     879if isfield(SeriesData,'j1_series')&&(~isempty(SeriesData.i2_series{Val})||~isempty(SeriesData.j2_series{Val}))
     880    testpair=1;
     881    if ~isempty(SeriesData.i2_series{Val}) %pairs with i index
     882        set(handles.mode,'Value',1)
     883        set(handles.mode,'String',{'series(Di)'})
     884    else  %pairs with j index
     885        set(handles.mode,'Value',1)
     886        set(handles.mode,'String',{'bursts';'series(Dj)'})
     887        if nbfield2>10 || nbfield==1
     888            set(handles.mode,'Value',2);
     889        else
     890            set(handles.mode,'Value',1);
     891        end
     892    end
     893    set(handles.mode,'Visible','on')
     894else
     895    set(handles.mode,'Visible','off')
     896end
     897% if ~isempty(NomTypeCell)
     898%     NomType=NomTypeCell{Val};
     899%     switch NomType 
     900%             case {'_1-2_1', '_1-2'}
     901%                 set(handles.mode,'String',{'series(Di)'})
     902%                 set(handles.mode,'Value',1);
     903%                 set(handles.mode,'Visible','on')
     904%                 testpair=1;
     905%             case {'#_ab'}
     906%                 set(handles.mode,'String',{'bursts'})
     907%                 set(handles.mode,'Value',1);
     908%                 testpair=1;
     909%             case '_1_1-2'
     910%                 set(handles.mode,'String',{'bursts';'series(Dj)'})%multiple choice
     911%                 if ~isempty(nbfield) && ~isempty(nbfield2) && ((nbfield2>10) || (nbfield==1))
     912%                     set(handles.mode,'Value',2);
     913%                 else
     914%                     set(handles.mode,'Value',1);% advice 'bursts' for small bursts
     915%                 end
     916%                 set(handles.mode,'Visible','on')
     917%                 testpair=1;
     918%     end
     919%     switch NomType   
     920%             case {'_1_1','_1_1-2','_1-2_1','1_ab','01_ab'},% two navigation indices
     921%                 state_j='on';
     922%     end
     923% end
    881924if testpair
    882925    mode_Callback(hObject, eventdata, handles) 
     
    884927    set(handles.NomType,'String',NomTypeCell)
    885928    set(handles.j_txt,'Visible',state_j)
    886     set(handles.MinIndex_j,'Visible',state_j)
    887     set(handles.first_j,'Visible',state_j)
    888     set(handles.incr_j,'Visible',state_j)
    889     set(handles.last_j,'Visible',state_j)
    890     set(handles.nb_field2,'Visible',state_j)
     929    set(handles.num_MinIndex_j,'Visible',state_j)
     930    set(handles.num_first_j,'Visible',state_j)
     931    set(handles.num_incr_j,'Visible',state_j)
     932    set(handles.num_last_j,'Visible',state_j)
     933    set(handles.num_MaxIndex_j,'Visible',state_j)
    891934end
    892935
     
    896939%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    897940function mode_Callback(hObject, eventdata, handles)
     941
    898942SeriesData=get(handles.series,'UserData');
    899943mode_list=get(handles.mode,'String');
     
    901945mode=mode_list{mode_value};
    902946NomType=[];
    903 test_find_pair=0;
    904 if isfield(SeriesData,'NomType')
    905     NomTypeCell=SeriesData.NomType;
    906     Val=get(handles.NomType,'Value');
    907     NomType=NomTypeCell{Val};
    908     test_find_pair=isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2')|| isequal(NomType,'#_ab');
    909 end
     947% test_find_pair=0;
     948% if isfield(SeriesData,'NomType')
     949NomTypeCell=SeriesData.NomType;
     950Val=get(handles.NomType,'Value');
     951NomType=NomTypeCell{Val};
     952check_pairs=~isempty(SeriesData.i2_series{Val})||~isempty(SeriesData.j2_series{Val});
     953
    910954time=[];
    911955if isfield(SeriesData,'Time')
    912 time=SeriesData.Time{1}; %get the set of times
     956    time=SeriesData.Time{1}; %get the set of times
    913957end
    914958siztime=size(time);
    915959nbfield=siztime(1);
    916960nbfield2=siztime(2);
    917 indchosen=1;  %%first pair selected by default
     961% indchosen=1;  %%first pair selected by default
    918962if isequal(mode,'bursts')
    919963    enable_i(handles,'On')
    920964    enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 
    921 elseif  isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')
     965elseif  ~isempty(SeriesData.j2_series{Val})
    922966    enable_i(handles,'On')
    923967    enable_j(handles,'On') % allow both i and j index scanning
     
    926970    enable_j(handles,'Off')
    927971end   
    928 set(handles.list_pair_civ,'Value',indchosen);%set the default choice of image pairs for civ1
     972% set(handles.list_pair_civ,'Value',indchosen);%set the default choice of image pairs for civ1
    929973set(handles.series,'UserData',SeriesData)
    930974
    931975%list pairs if relevant
    932 if test_find_pair
    933      find_netcpair_civ(hObject, eventdata, handles,Val)
     976if check_pairs
     977     find_netcpair_civ(handles,Val)
    934978end
    935979
     
    937981function enable_i(handles,state)
    938982set(handles.i_txt,'Visible',state)
    939 set(handles.first_i,'Visible',state)
    940 set(handles.last_i,'Visible',state)
    941 set(handles.incr_i,'Visible',state)
    942 set(handles.nb_field,'Visible',state)
     983set(handles.num_first_i,'Visible',state)
     984set(handles.num_last_i,'Visible',state)
     985set(handles.num_incr_i,'Visible',state)
     986set(handles.num_MaxIndex_i,'Visible',state)
    943987set(handles.ref_i,'Visible',state)
    944988set(handles.ref_i_text,'Visible',state)
     
    947991function enable_j(handles,state)
    948992set(handles.j_txt,'Visible',state)
    949 set(handles.MinIndex_j,'Visible',state)
    950 set(handles.first_j,'Visible',state)
    951 set(handles.last_j,'Visible',state)
    952 set(handles.incr_j,'Visible',state)
    953 set(handles.nb_field2,'Visible',state)
     993set(handles.num_MinIndex_j,'Visible',state)
     994set(handles.num_first_j,'Visible',state)
     995set(handles.num_last_j,'Visible',state)
     996set(handles.num_incr_j,'Visible',state)
     997set(handles.num_MaxIndex_j,'Visible',state)
    954998set(handles.ref_j,'Visible',state)
    955999set(handles.ref_j_text,'Visible',state)
     
    9661010set(handles.Field_text_1,'Visible',state)
    9671011
    968 %-----------------------------------
    969 function view_TRANSFORM(handles,state)
    970 set(handles.TRANSFORM_frame,'Visible',state)
    971 set(handles.transform_fct,'Visible',state);
    972 set(handles.TRANSFORM_title,'Visible',state)
     1012% %-----------------------------------
     1013% function view_TRANSFORM(handles,state)
     1014% set(handles.TRANSFORM_frame,'Visible',state)
     1015% set(handles.transform_fct,'Visible',state);
     1016% set(handles.TRANSFORM_title,'Visible',state)
    9731017
    9741018%--------------------------------------------------------------
     
    9761020% with the reference indices ref_i and ref_j
    9771021%----------------------------------------------------------------
    978 function find_netcpair_civ(hObject, eventdata, handles,Val)
     1022function find_netcpair_civ(handles,Val)
    9791023SeriesData=get(handles.series,'UserData');
    9801024% NomTypeCell=get(handles.NomType,'String');
    9811025NomTypeCell=SeriesData.NomType;
    9821026NomType=NomTypeCell{Val};
    983   set(handles.list_pair_civ,'Visible','on')
     1027
     1028set(handles.Pairs,'Visible','on')% makes the panel "Pairs' visible
    9841029%nomenclature types
    9851030RootPathCell=get(handles.RootPath,'String');
     
    10001045
    10011046%reads image numbers from the interface
    1002 ref_i=str2num(get(handles.ref_i,'String'));
    1003 ref_j=str2num(get(handles.ref_j,'String'));
    1004 ref_time=0;
    1005 nbfield=50;
    1006 nbfield2=50;%default max number of pairs
     1047% ref_i=str2num(get(handles.ref_i,'String'));
     1048% ref_j=str2num(get(handles.ref_j,'String'));
     1049% ref_time=0;
     1050% nbfield=50;
     1051% nbfield2=50;%default max number of pairs
    10071052
    10081053%look for existing processed pairs involving the field at the middle of the series if civ1 will not
    10091054% be performed, while the result is needed for next steps.
    1010 displ_pair={''};
    1011 displ_num=[];
    1012 ind_exist=0;
     1055
     1056% ind_exist=0;
    10131057TimeUnit=get(handles.TimeUnit,'String');
    10141058if length(TimeUnit)>=1
     
    10171061    dtunit='e-03';
    10181062end
     1063
     1064%% NEW
     1065i1_series=SeriesData.i1_series{Val};
     1066i2_series=SeriesData.i2_series{Val};
     1067j1_series=SeriesData.j1_series{Val};
     1068j2_series=SeriesData.j2_series{Val};
     1069displ_pair={};
    10191070if strcmp(mode,'series(Di)')
    1020      for index=1:min(nbfield-1,50)
    1021          filename=name_generator(filebase,ref_i-floor(index/2),ref_j,'.nc',NomType,1,ref_i+ceil(index/2),ref_j,subdir);
    1022          select=(exist(filename,'file')==2);
    1023          if select==1
    1024                ind_exist=ind_exist+1;
    1025                 displ_num(1,ind_exist)=0;
    1026                 displ_num(2,ind_exist)=0;
    1027                 displ_num(3,ind_exist)=-floor(index/2);
    1028                 displ_num(4,ind_exist)=ceil(index/2);
    1029                 %[cte_detect,vdt,cte_read]=read_netcdf(filename,{'dt','dt2','absolut_time_T0','absolute_time_TO_2'});
    1030                 [Cte,var_detect,ichoice]=nc2struct(filename,{});
    1031                 if isfield(Cte,'dt2')
    1032                     dt=Cte.dt2;
    1033                 elseif isfield(Cte,'dt')
    1034                     dt=Cte.dt;
    1035                 end
    1036                 if isfield(Cte,'absolut_time_TO_2')
    1037                     ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority
    1038                 elseif isfield(Cte,'absolut_time_TO')
    1039                     ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit
    1040                 elseif isfield(Cte,'Time')
    1041                     ref_time(ind_exist)=Cte.Time;
    1042                 end
    1043                 displ_pair{ind_exist}=['Di= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit];
    1044          end
    1045      end
    1046      set(handles.list_pair_civ,'String',[displ_pair';{'Di=*|*'}]);   
    1047 elseif isequal(mode,'series(Dj)')% series on the j index
    1048        for index=1:min(nbfield2-1,50)
    1049            filename=name_generator(filebase,ref_i,ref_j-floor(index/2),'.nc',NomType,1,ref_i,ref_j+ceil(index/2),subdir);
    1050            select=(exist(filename,'file')==2);
    1051            if select==1
    1052                ind_exist=ind_exist+1;
    1053                 displ_num(1,ind_exist)=-floor(index/2);
    1054                 displ_num(2,ind_exist)=ceil(index/2);
    1055                 displ_num(3,ind_exist)=0;
    1056                 displ_num(4,ind_exist)=0;
    1057                 [Cte,var_detect,ichoice]=nc2struct(filename,{});
    1058                 if isfield(Cte,'dt2')
    1059                     dt=Cte.dt2;
    1060                 elseif isfield(Cte,'dt')
    1061                     dt=Cte.dt;
    1062                 end
    1063                 if isfield(Cte,'absolut_time_TO_2')
    1064                     ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority
    1065                 elseif isfield(Cte,'absolut_time_TO')
    1066                     ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit
    1067                 elseif isfield(Cte,'Time')
    1068                     ref_time(ind_exist)=Cte.Time;
    1069                 end
    1070 %                 if cte_detect(2)==1;
    1071 %                     dt=cte_read(2);
    1072 %                     ref_time(ind_exist)=cte_read(4);%civ2 data used in priority
     1071    if isempty(i2_series)
     1072        msgbox_uvmat('ERROR','no i1-i2 pair available')
     1073        return
     1074    end
     1075    diff_i=i2_series-i1_series;
     1076    min_diff=min(diff_i(diff_i>0));
     1077    max_diff=max(diff_i(diff_i>0));
     1078    for ipair=min_diff:max_diff
     1079        if numel(diff_i(diff_i==ipair))>0
     1080            displ_pair=[displ_pair;{['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]}];
     1081        end
     1082    end
     1083    if ~isempty(displ_pair)
     1084        displ_pair=[displ_pair;{'Di=*|*'}];
     1085    end
     1086elseif strcmp(mode,'series(Dj)')
     1087    if isempty(j2_series)
     1088        msgbox_uvmat('ERROR','no j1-j2 pair available')
     1089        return
     1090    end
     1091    diff_j=j2_series-j1_series;
     1092    min_diff=min(diff_j(diff_j>0));
     1093    max_diff=max(diff_j(diff_j>0));
     1094    for ipair=min_diff:max_diff
     1095        if numel(diff_j(diff_j==ipair))>0
     1096            displ_pair=[displ_pair;{['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]}];
     1097        end
     1098    end
     1099    if ~isempty(displ_pair)
     1100        displ_pair=[displ_pair;{'Dj=*|*'}];
     1101    end
     1102elseif strcmp(mode,'bursts')
     1103    if isempty(j2_series)
     1104        msgbox_uvmat('ERROR','no j1-j2 pair available')
     1105        return
     1106    end
     1107    diff_j=j2_series-j1_series;
     1108    min_j1=min(j1_series(j1_series>0));
     1109    max_j1=max(j1_series(j1_series>0));
     1110    min_j2=min(j2_series(j2_series>0));
     1111    max_j2=max(j2_series(j2_series>0));
     1112    for pair1=min_j1:min(max_j1,min_j1+20)
     1113        for pair2=min_j2:min(max_j2,min_j2+20)
     1114        if numel(j1_series(j1_series==pair1))>0 && numel(j2_series(j2_series==pair2))>0
     1115            displ_pair=[displ_pair;{['j= ' num2str(pair1) '-' num2str(pair2)]}];
     1116        end
     1117        end
     1118    end
     1119    if ~isempty(displ_pair)
     1120        displ_pair=[displ_pair;{'j=*-*'}];
     1121    end
     1122end
     1123
     1124%% display list of pairs
     1125displ_pair_list=get(handles.list_pair_civ,'String');
     1126NewVal=[];
     1127if ~isempty(displ_pair_list)
     1128Val=get(handles.list_pair_civ,'Value');
     1129NewVal=find(strcmp(displ_pair_list{Val},displ_pair),1);% look at the previous display in the new menu displ_pâir
     1130end
     1131if ~isempty(NewVal)
     1132    set(handles.list_pair_civ,'Value',NewVal)
     1133else
     1134    set(handles.list_pair_civ,'Value',1)
     1135end
     1136set(handles.list_pair_civ,'String',displ_pair)
     1137displ_pair
     1138
     1139 %   displ_pair{ind_exist}=['Di= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit];
     1140% if strcmp(mode,'series(Di)')
     1141%      for index=1:min(nbfield-1,50)
     1142%          filename=name_generator(filebase,ref_i-floor(index/2),ref_j,'.nc',NomType,1,ref_i+ceil(index/2),ref_j,subdir);
     1143%          select=(exist(filename,'file')==2);
     1144%          if select==1
     1145%                ind_exist=ind_exist+1;
     1146%                 displ_num(1,ind_exist)=0;
     1147%                 displ_num(2,ind_exist)=0;
     1148%                 displ_num(3,ind_exist)=-floor(index/2);
     1149%                 displ_num(4,ind_exist)=ceil(index/2);
     1150%                 %[cte_detect,vdt,cte_read]=read_netcdf(filename,{'dt','dt2','absolut_time_T0','absolute_time_TO_2'});
     1151%                 [Cte,var_detect,ichoice]=nc2struct(filename,{});
     1152%                 if isfield(Cte,'dt2')
     1153%                     dt=Cte.dt2;
     1154%                 elseif isfield(Cte,'dt')
     1155%                     dt=Cte.dt;
     1156%                 end
     1157%                 if isfield(Cte,'absolut_time_TO_2')
     1158%                     ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority
     1159%                 elseif isfield(Cte,'absolut_time_TO')
     1160%                     ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit
     1161%                 elseif isfield(Cte,'Time')
     1162%                     ref_time(ind_exist)=Cte.Time;
     1163%                 end
     1164%                 displ_pair{ind_exist}=['Di= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit];
     1165%          end
     1166%      end
     1167%      set(handles.list_pair_civ,'String',[displ_pair';{'Di=*|*'}]);   
     1168% elseif isequal(mode,'series(Dj)')% series on the j index
     1169%        for index=1:min(nbfield2-1,50)
     1170%            filename=name_generator(filebase,ref_i,ref_j-floor(index/2),'.nc',NomType,1,ref_i,ref_j+ceil(index/2),subdir);
     1171%            select=(exist(filename,'file')==2);
     1172%            if select==1
     1173%                ind_exist=ind_exist+1;
     1174%                 displ_num(1,ind_exist)=-floor(index/2);
     1175%                 displ_num(2,ind_exist)=ceil(index/2);
     1176%                 displ_num(3,ind_exist)=0;
     1177%                 displ_num(4,ind_exist)=0;
     1178%                 [Cte,var_detect,ichoice]=nc2struct(filename,{});
     1179%                 if isfield(Cte,'dt2')
     1180%                     dt=Cte.dt2;
     1181%                 elseif isfield(Cte,'dt')
     1182%                     dt=Cte.dt;
     1183%                 end
     1184%                 if isfield(Cte,'absolut_time_TO_2')
     1185%                     ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority
     1186%                 elseif isfield(Cte,'absolut_time_TO')
     1187%                     ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit
     1188%                 elseif isfield(Cte,'Time')
     1189%                     ref_time(ind_exist)=Cte.Time;
     1190%                 end
     1191%                 displ_pair{ind_exist}=['Dj= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit];
     1192%            end
     1193%        end
     1194%        set(handles.list_pair_civ,'String',[displ_pair';{'Dj=*|*'}]);
     1195% elseif isequal(mode,'bursts') %case of bursts
     1196%     for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'bursts' mode
     1197%         for numod_b=(numod_a+1):nbfield2
     1198%             [filename]=name_generator(filebase,ref_i,numod_a,'.nc',NomType,1,ref_i,numod_b,subdir)
     1199%             select=(exist(filename,'file')==2)
     1200%             if select==1
     1201%                 ind_exist=ind_exist+1;
     1202%                 numlist_a(ind_exist)=numod_a;
     1203%                 numlist_b(ind_exist)=numod_b;
     1204%                 Attr=nc2struct(filename,[]);
     1205%                 isfield(Attr,'absolut_time_T0_2')
     1206%                 if isfield(Attr,'dt2')
     1207%                    dt(ind_exist)=Attr.dt2;
     1208%                    ref_time(ind_exist)=Attr.absolut_time_T0_2;
     1209%                 elseif isfield(Attr,'dt')& isfield(Attr,'absolut_time_T0')
     1210%                    dt(ind_exist)=Attr.dt;
     1211%                    ref_time(ind_exist)=Attr.absolut_time_T0;
    10731212%                 else
    1074 %                     dt=cte_read(1);
    1075 %                     ref_time(ind_exist)=cte_read(3);
    1076 %                 end
    1077                 displ_pair{ind_exist}=['Dj= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit];
    1078            end
    1079        end
    1080        set(handles.list_pair_civ,'String',[displ_pair';{'Dj=*|*'}]);
    1081 elseif isequal(mode,'bursts') %case of bursts
    1082     for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'bursts' mode
    1083         for numod_b=(numod_a+1):nbfield2
    1084             [filename]=name_generator(filebase,ref_i,numod_a,'.nc',NomType,1,ref_i,numod_b,subdir)
    1085             select=(exist(filename,'file')==2)
    1086             if select==1
    1087                 ind_exist=ind_exist+1;
    1088                 numlist_a(ind_exist)=numod_a;
    1089                 numlist_b(ind_exist)=numod_b;
    1090                 Attr=nc2struct(filename,[]);
    1091                 isfield(Attr,'absolut_time_T0_2')
    1092                 if isfield(Attr,'dt2')
    1093                    dt(ind_exist)=Attr.dt2;
    1094                    ref_time(ind_exist)=Attr.absolut_time_T0_2;
    1095                 elseif isfield(Attr,'dt')& isfield(Attr,'absolut_time_T0')
    1096                    dt(ind_exist)=Attr.dt;
    1097                    ref_time(ind_exist)=Attr.absolut_time_T0;
    1098                 else
    1099                    dt(ind_exist)=NaN;%no information on dt
    1100                 end
    1101                 %determine nom_type_ima for pair display (used in num2stra.m)
    1102                 switch NomType
    1103                     case {'#ab'}
    1104                         nom_type_ima='#a';
    1105                     case {'#AB'}
    1106                         nom_type_ima='#A';
    1107                     otherwise
    1108                          nom_type_ima='_1_1';
    1109                 end
    1110                displ_pair{ind_exist}=['j= ' num2stra(numod_a,nom_type_ima,2) '-' num2stra(numod_b,nom_type_ima,2) ...
    1111                         ' :dt= ' num2str(dt(ind_exist)*1000)];
    1112             end
    1113          end
    1114          set(handles.list_pair_civ,'String',[displ_pair';{'j=*-*'}]);
    1115      end
    1116      if exist('dt','var') & ~isempty(dt)
    1117          [dtsort,indsort]=sort(dt);
    1118          displ_num(1,:)=numlist_a(indsort);
    1119          displ_num(2,:)=numlist_b(indsort);
    1120          displ_num(3,:)=0;
    1121          displ_num(4,:)=0;
    1122          displ_pair=displ_pair(indsort);
    1123          ref_time=ref_time(indsort);
    1124      end
    1125 end
     1213%                    dt(ind_exist)=NaN;%no information on dt
     1214%                 end
     1215%                 %determine nom_type_ima for pair display (used in num2stra.m)
     1216%                 switch NomType
     1217%                     case {'#ab'}
     1218%                         nom_type_ima='#a';
     1219%                     case {'#AB'}
     1220%                         nom_type_ima='#A';
     1221%                     otherwise
     1222%                          nom_type_ima='_1_1';
     1223%                 end
     1224%                displ_pair{ind_exist}=['j= ' num2stra(numod_a,nom_type_ima,2) '-' num2stra(numod_b,nom_type_ima,2) ...
     1225%                         ' :dt= ' num2str(dt(ind_exist)*1000)];
     1226%             end
     1227%          end
     1228%          set(handles.list_pair_civ,'String',[displ_pair';{'j=*-*'}]);
     1229%      end
     1230%      if exist('dt','var') & ~isempty(dt)
     1231%          [dtsort,indsort]=sort(dt);
     1232%          displ_num(1,:)=numlist_a(indsort);
     1233%          displ_num(2,:)=numlist_b(indsort);
     1234%          displ_num(3,:)=0;
     1235%          displ_num(4,:)=0;
     1236%          displ_pair=displ_pair(indsort);
     1237%          ref_time=ref_time(indsort);
     1238%      end
     1239% end
     1240if isempty(displ_pair)
     1241    msgbox_uvmat('ERROR',['no file available for the selected subdirectory ' subdir])
     1242end
     1243return
     1244%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%END FUNCTION
     1245
     1246
    11261247if ind_exist==0
    11271248         if  isequal(mode,'series(Dj)') | isequal(mode,'st_series(Dj)')
     
    11381259        end
    11391260end
    1140 
     1261return
     1262%TO update
    11411263val=get(handles.list_pair_civ,'Value');
    11421264if val > length(displ_pair)
     
    11481270SeriesData.ref_time=ref_time;
    11491271set(handles.series,'UserData',SeriesData)
    1150 list_pair_civ_Callback(hObject, eventdata, handles)
     1272list_pair_civ_Callback([],[],handles)
    11511273
    11521274%-------------------------------------------------------------
    11531275% --- Executes on selection in list_pair_civ.
    1154 function list_pair_civ_Callback(hObject, eventdata, handles)
     1276function list_pair_civ_Callback(hObject,eventdata,handles)
    11551277%------------------------------------------------------------
    1156 
    1157 %update first_i and last_i according to the chosen image pairs
     1278return
     1279%%%%%%%%
     1280%update num_first_i and num_last_i according to the chosen image pairs
    11581281testupdate=0;
    11591282Val=get(handles.RootPath,'Value');
     
    12281351    mode=mode_list{mode_value};
    12291352        if isequal(mode,'series(Di)')
    1230         first_i=str2num(get(handles.first_i,'String'));
    1231         last_i=str2num(get(handles.last_i,'String'));
    1232         incr_i=str2num(get(handles.incr_i,'String'));
     1353        first_i=str2num(get(handles.num_first_i,'String'));
     1354        last_i=str2num(get(handles.num_last_i,'String'));
     1355        incr_i=str2num(get(handles.num_incr_i,'String'));
    12331356        num1=first_i:incr_i:last_i;
    1234         lastfieldCell=get(handles.nb_field,'String');
     1357        lastfieldCell=get(handles.num_MaxIndex_i,'String');
    12351358        lastfield=str2num(lastfieldCell{1});
    12361359        if ~isempty(lastfield)
     
    12391362        end
    12401363        if ~isempty(num1)
    1241             set(handles.first_i,'String',num2str(num1(1)));
    1242             set(handles.last_i,'String',num2str(num1(end)));
     1364            set(handles.num_first_i,'String',num2str(num1(1)));
     1365            set(handles.num_last_i,'String',num2str(num1(end)));
    12431366        end
    12441367        testupdate=1;
    12451368        elseif isequal(mode,'series(Dj)')
    1246         first_j=str2num(get(handles.first_j,'String'));
    1247         last_j=str2num(get(handles.last_j,'String'));
    1248         incr_j=str2num(get(handles.incr_j,'String'));
     1369        first_j=str2num(get(handles.num_first_j,'String'));
     1370        last_j=str2num(get(handles.num_last_j,'String'));
     1371        incr_j=str2num(get(handles.num_incr_j,'String'));
    12491372        num_j=first_j:incr_j:last_j;
    1250         lastfieldCell=get(handles.nb_field2,'String');
     1373        lastfieldCell=get(handles.num_MaxIndex_j,'String');
    12511374        if ~isempty(lastfieldCell)
    12521375            lastfield2=lastfieldCell{1};
     
    12691392function RUN_Callback(hObject, eventdata, handles)
    12701393%------------------------------------------------------------------------
    1271 %read root name and field type
     1394%% read root name and field type
    12721395set(handles.RUN,'BusyAction','queue');
    12731396set(0,'CurrentFigure',handles.series)
     
    12801403SeriesData=get(handles.series,'UserData');
    12811404
    1282 %reinitiate waitbar position
    1283 Series.WaitbarPos=get(handles.waitbar_frame,'Position');%TO SUPPRESS
    1284 waitbarpos=Series.WaitbarPos;
    1285 waitbarpos(4)=0.005;%reinitialize waitbar to zero height
    1286 waitbarpos(2)=Series.WaitbarPos(2)+Series.WaitbarPos(4)-0.005;
    1287 set(handles.waitbar,'Position',waitbarpos)
    1288 
    1289 % read input file parameters and set menus
     1405% Series.hseries=handles.series; % handles to the series GUI
     1406
     1407%% Read parameters from series
     1408Series=read_GUI(handles.series);%TODO: extend to all input param
     1409Series.hseries=handles.series; % handles to the series GUI
     1410
     1411   first_i=1;
     1412   last_i=1;
     1413   incr_i=1;
     1414       first_j=1;
     1415    last_j=1;
     1416    incr_j=1;
     1417if isfield(Series.IndexRange,'first_i')
     1418    first_i=Series.IndexRange.first_i;
     1419    incr_i=Series.IndexRange.incr_i;
     1420    last_i=Series.IndexRange.last_i;
     1421end
     1422if isfield(Series.IndexRange,'first_j')
     1423    first_j=Series.IndexRange.first_j;
     1424    incr_j=Series.IndexRange.incr_j;
     1425    last_j=Series.IndexRange.last_j;
     1426end
     1427
     1428%% read input file parameters and set menus
    12901429Series.PathProject=get(handles.PathCampaign,'String');
    12911430RootPath=get(handles.RootPath,'String');% path of the root name of the first field series
     
    13241463    Series.transform_fct=transform_list{menu_index};% transform function handles
    13251464end
    1326 Series.hseries=handles.series; % handles to the series GUI
    1327 
    1328 %read the set of field numbers
    1329 first_i=str2num(get(handles.first_i,'String'));
    1330 last_i=str2num(get(handles.last_i,'String'));
    1331 incr_i=str2num(get(handles.incr_i,'String'));
    1332 first_j=str2num(get(handles.first_j,'String'));
    1333 last_j=str2num(get(handles.last_j,'String'));
    1334 incr_j=str2num(get(handles.incr_j,'String'));
    1335 if ~isequal(get(handles.first_i,'Visible'),'on')
    1336    first_i=1;
    1337    last_i=1;
    1338    incr_i=1;
    1339 end
    1340 if ~isequal(get(handles.first_j,'Visible'),'on')
    1341     first_j=1;
    1342     last_j=1;
    1343     incr_j=1;
    1344 end
    1345 Series.NbSlice=str2num(get(handles.NbSlice,'String'));
    1346 if isequal(first_i,[])|isequal(first_j,[]), msgbox_uvmat('ERROR','first field number not defined'),...
    1347     set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end;
    1348 if isequal(last_i,[])| isequal(last_j,[]),msgbox_uvmat('ERROR','last field number not defined'),...
    1349     set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end;
    1350 if isequal(incr_i,[])| isequal(incr_j,[]),msgbox_uvmat('ERROR','increment in field number not defined'),...
    1351     set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end;
     1465   
     1466%     
     1467% first_i=str2num(get(handles.num_first_i,'String'));
     1468% last_i=str2num(get(handles.num_last_i,'String'));
     1469% incr_i=str2num(get(handles.num_incr_i,'String'));
     1470% first_j=str2num(get(handles.num_first_j,'String'));
     1471% last_j=str2num(get(handles.num_last_j,'String'));
     1472% incr_j=str2num(get(handles.num_incr_j,'String'));
     1473% if ~isequal(get(handles.num_first_i,'Visible'),'on')
     1474%    first_i=1;
     1475%    last_i=1;
     1476%    incr_i=1;
     1477% end
     1478% if ~isequal(get(handles.num_first_j,'Visible'),'on')
     1479%     first_j=1;
     1480%     last_j=1;
     1481%     incr_j=1;
     1482% end
     1483
     1484%reinitiate waitbar position
     1485Series.WaitbarPos=get(handles.waitbar_frame,'Position');%TO SUPPRESS
     1486waitbarpos=Series.WaitbarPos;
     1487waitbarpos(4)=0.005;%reinitialize waitbar to zero height
     1488waitbarpos(2)=Series.WaitbarPos(2)+Series.WaitbarPos(4)-0.005;
     1489% set(handles.waitbar,'Position',waitbarpos)
     1490
     1491
     1492Series.NbSlice=Series.IndexRange.NbSlice;
    13521493if last_i < first_i | last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),...
    13531494    set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end;
    13541495num_i=first_i:incr_i:last_i;
    13551496num_j=first_j:incr_j:last_j;
    1356 nbfield_cell=get(handles.nb_field,'String');
     1497nbfield_cell=get(handles.num_MaxIndex_i,'String');
    13571498nbfield=[]; %default
    13581499for iview=1:length(nbfield_cell)
     
    13631504end
    13641505nbfield=min(nbfield);
    1365 nbfield2_cell=get(handles.nb_field2,'String');
     1506nbfield2_cell=get(handles.num_MaxIndex_j,'String');
    13661507nbfield2=[]; %default
    13671508for iview=1:length(nbfield2_cell)
     
    13861527for iview=1:length(RootPath)
    13871528    %case of pairs (.nc files)
    1388    
    1389     if isequal(NomType{iview},'_1_1-2')|| isequal(NomType{iview},'_1-2_1')|| isequal(NomType{iview},'_1-2')|| isequal(NomType{iview},'#_ab')
    1390         ind_shift=SeriesData.displ_num(iview,:);
    1391         if isequal(ind_shift,[0 0 0 0]) % undefined pairs
    1392             if isequal(NomType{iview},'#_ab')
    1393                 mode='#_ab';
    1394             end
    1395             [num_i1,num_i2,num_j1,num_j2,nbmissing]=netseries_generator(fullfile(RootPath{iview},RootFile{iview}),SubDir{iview},mode,first_i,incr_i,last_i,first_j,incr_j,last_j);
    1396         else   
    1397             [num_i1,num_i2,num_j1,num_j2,num_i,num_j]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode);
    1398             if isempty(num_i)
    1399                 msgbox_uvmat('ERROR','ERROR: empty set of input files chosen')
    1400                 return
    1401             end
    1402             if num_i(1)>first_i
    1403                set(handles.first_i,'String',num2str(num_i(1)))%update the display of first field
    1404                last_i_Callback(hObject, eventdata, handles)
    1405             end
    1406             if num_i(end)<last_i
    1407                set(handles.last_i,'String',num2str(num_i(end)))%update the display of last field
    1408                last_i_Callback(hObject, eventdata, handles)
    1409             end
    1410             if num_j(1)>first_j
    1411                set(handles.first_j,'String',num2str(num_j(1)))%update the display of first field
    1412                last_j_Callback(hObject, eventdata, handles)
    1413             end
    1414             if num_j(end)<last_j
    1415                set(handles.last_j,'String',num2str(num_j(end)))%update the display of last field
    1416                last_j_Callback(hObject, eventdata, handles)
    1417             end
    1418         end
     1529    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});
     1530    if strcmp(get(handles.Pairs,'Visible'),'on')
     1531       pair_list=get(handles.list_pair_civ,'String');
     1532       val=get(handles.list_pair_civ,'Value');
     1533       pair_string=pair_list{val};
     1534       r=regexp(pair_string,'.*\D(?<num1>[\d+|*])(?<delim>[-||])(?<num2>[\d+|*])','names');
     1535       if ~isempty(r)
     1536           if strcmp(r.num1,'*')%free pairs
     1537               [~,RootFile,i1_series,i2_series,j1_series,j2_series,~,~,Object]=find_file_series(fileinput)% TODO: choice pair when multiple choice
     1538 
     1539               if isempty(i2_series) %j pairs
     1540                   ind_sel=i1_series>=i1_series>=first_i & i1_series<=last_i & j1_series>first_j & j2_series<last_j;
     1541                   j2_series=j2_series(ind_sel);
     1542               else%i pairs
     1543                   if isempty(j1_series) %j pairs
     1544                        ind_sel=i1_series>=first_i & i2_series<=last_i ;
     1545                   else
     1546                       ind_sel=i1_series>=first_i & i2_series<=last_i& j1_series>first_j & j1_series<last_j;
     1547                       j1_series=j1_series(ind_sel);
     1548                       i2_series=i2_series(ind_sel);
     1549                   end
     1550               end
     1551               i1_series=i1_series(ind_sel);             
     1552           else
     1553               if strcmp(r.delim,'-')
     1554                   ind_shift(1)=str2num(r.num1);
     1555                   ind_shift(2)=str2num(r.num2);
     1556               else
     1557                   ind_shift(1)=-str2num(r.num1);
     1558                   ind_shift(2)=str2num(r.num2);
     1559               end
     1560               [i1_series,i2_series,j1_series,j2_series,nbmissing]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode);
     1561           end
     1562       end
     1563       if isempty(i1_series)
     1564           msgbox_uvmat('ERROR','no file in the considered range')
     1565           return
     1566       end
     1567       if isempty(i2_series)
     1568           i2_series=i1_series;
     1569       end
     1570       if isempty(j2_series)
     1571           j2_series=j1_series;
     1572       end
     1573%     if isequal(NomType{iview},'_1_1-2')|| isequal(NomType{iview},'_1-2_1')|| isequal(NomType{iview},'_1-2')|| isequal(NomType{iview},'#_ab')
     1574%         ind_shift=SeriesData.displ_num(iview,:);
     1575%         if isequal(ind_shift,[0 0 0 0]) % undefined pairs
     1576%             if isequal(NomType{iview},'#_ab')
     1577%                 mode='#_ab';
     1578%             end
     1579%             [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);
     1580%         else   
     1581%             [num_i1,num_i2,num_j1,num_j2,num_i,num_j]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode);
     1582%             if isempty(num_i)
     1583%                 msgbox_uvmat('ERROR','ERROR: empty set of input files chosen')
     1584%                 return
     1585%             end
     1586%             if num_i(1)>num_first_i
     1587%                set(handles.num_first_i,'String',num2str(num_i(1)))%update the display of first field
     1588%                last_i_Callback(hObject, eventdata, handles)
     1589%             end
     1590%             if num_i(end)<num_last_i
     1591%                set(handles.num_last_i,'String',num2str(num_i(end)))%update the display of last field
     1592%                last_i_Callback(hObject, eventdata, handles)
     1593%             end
     1594%             if num_j(1)>num_first_j
     1595%                set(handles.num_first_j,'String',num2str(num_j(1)))%update the display of first field
     1596%                last_j_Callback(hObject, eventdata, handles)
     1597%             end
     1598%             if num_j(end)<num_last_j
     1599%                set(handles.num_last_j,'String',num2str(num_j(end)))%update the display of last field
     1600%                last_j_Callback(hObject, eventdata, handles)
     1601%             end
     1602%         end
    14191603    else%case of images
    1420         [num_i1,num_j1]=meshgrid(num_i,num_j);
    1421         num_i2=num_i1;
    1422         num_j2=num_j1;
     1604        [i1_series,j1_series]=meshgrid(num_i,num_j);
     1605        i2_series=i1_series;
     1606        j2_series=j1_series;
    14231607    end
    14241608    if length(RootPath)>1
    1425         num_i1_cell{iview}=num_i1;
    1426         num_i2_cell{iview}=num_i2;
    1427         num_j1_cell{iview}=num_j1;
    1428         num_j2_cell{iview}=num_j2;
     1609        i1_series_cell{iview}=i1_series;
     1610        i2_series_cell{iview}=i2_series;
     1611        j1_series_cell{iview}=j1_series;
     1612        j2_series_cell{iview}=j2_series;
    14291613    end
    14301614end
     
    14531637Series.Action=action;%name of the processing programme
    14541638set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])
    1455 
    14561639if length(RootPath)>1
    1457     h_fun(num_i1_cell,num_i2_cell,num_j1_cell,num_j2_cell,Series);
    1458 else
    1459     h_fun(num_i1,num_i2,num_j1,num_j2,Series);
     1640    h_fun(i1_series_cell,i2_series_cell,j1_series_cell,j2_series_cell,Series);
     1641else
     1642    h_fun(i1_series,i2_series,j1_series,j2_series,Series);
    14601643end
    14611644set(handles.RUN,'BackgroundColor',[1 0 0])
     
    14831666
    14841667%------------------------------------------------------------------------
    1485 function first_i_Callback(hObject, eventdata, handles)
     1668function num_first_i_Callback(hObject, eventdata, handles)
    14861669%------------------------------------------------------------------------
    14871670last_i_Callback(hObject, eventdata, handles)
    14881671
    14891672%------------------------------------------------------------------------
    1490 function last_i_Callback(hObject, eventdata, handles)
     1673function num_last_i_Callback(hObject, eventdata, handles)
    14911674%------------------------------------------------------------------------
    14921675SeriesData=get(handles.series,'UserData');
     
    14971680
    14981681%------------------------------------------------------------------------
    1499 function first_j_Callback(hObject, eventdata, handles)
     1682function num_first_j_Callback(hObject, eventdata, handles)
    15001683%------------------------------------------------------------------------
    15011684 last_j_Callback(hObject, eventdata, handles)
    15021685
    15031686%------------------------------------------------------------------------
    1504 function last_j_Callback(hObject, eventdata, handles)
    1505 %------------------------------------------------------------------------
    1506 first_j=str2num(get(handles.first_j,'String'));
    1507 last_j=str2num(get(handles.last_j,'String'));
     1687function num_last_j_Callback(hObject, eventdata, handles)
     1688%------------------------------------------------------------------------
     1689first_j=str2num(get(handles.num_first_j,'String'));
     1690last_j=str2num(get(handles.num_last_j,'String'));
    15081691ref_j=ceil((first_j+last_j)/2);
    15091692set(handles.ref_j,'String', num2str(ref_j))
     
    15311714    if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2')
    15321715        if isequal(mode,'series(Di)')
    1533             find_netcpair_civ(hObject, eventdata, handles,Val);% update the menu of pairs depending on the available netcdf files
     1716            find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files
    15341717%             break
    15351718        end
     
    15501733    if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2')
    15511734        if isequal(mode,'series(Dj)')
    1552             find_netcpair_civ(hObject, eventdata, handles,Val);% update the menu of pairs depending on the available netcdf files
     1735            find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files
    15531736        end
    15541737    end
     
    16311814set(handles.NomType,'Visible','on')
    16321815set(handles.FileExt,'Visible','on')
    1633 set(handles.NbSlice,'Visible','off')
     1816set(handles.num_NbSlice,'Visible','off')
    16341817set(handles.NbSlice_title,'Visible','off')
    16351818set(handles.VelTypeMenu,'Visible','off');
     
    16391822view_FieldMenu(handles,'off')
    16401823view_FieldMenu_1(handles,'off')
    1641 view_TRANSFORM(handles,'off')
    1642 set(handles.ProjObject_frame,'Visible','off');
     1824set(handles.FieldTransform,'Visible','off')
     1825% view_TRANSFORM(handles,'off')Visible','off')
     1826set(handles.Objects,'Visible','off');
    16431827set(handles.GetMask,'Visible','off')
    16441828set(handles.Mask,'Visible','off')
    1645 set(handles.GetObject,'Visible','off');
    1646 set(handles.ProjObject,'Visible','off');
     1829% set(handles.GetObject,'Visible','off');
    16471830set(handles.OutputDir,'Visible','off');
    1648 set(handles.PARAMETERS_frame,'Visible','off');
    1649 set(handles.PARAMETERS_title,'Visible','off');
     1831% set(handles.PARAMETERS_frame,'Visible','off');
     1832% set(handles.PARAMETERS_title,'Visible','off');
    16501833set(handles.ParamKey,'Visible','off')
    16511834set(handles.ParamVal,'Visible','off')
     
    17261909        case 'NbSlice'   %hidden by default
    17271910            if isequal(lower(varargout{ilist+1}),'on')
    1728                 set(handles.NbSlice,'Visible','on')
     1911                set(handles.num_NbSlice,'Visible','on')
    17291912                set(handles.NbSlice_title,'Visible','on')
    17301913            end
     
    17611944            if isequal(lower(varargout{ilist+1}),'on')
    17621945                set(handles.transform_fct,'Enable','on')
    1763                 view_TRANSFORM(handles,'on')
     1946                set(handles.FieldTransform,'Visible','on')
     1947%                 view_TRANSFORM(handles,'on')
    17641948            end
    17651949        case 'GetObject'   %hidden by default
    17661950            if isequal(lower(varargout{ilist+1}),'on')   
    1767                 set(handles.ProjObject_frame,'Visible','on')
    1768                 set(handles.GetObject,'Visible','on');
     1951                set(handles.Objects,'Visible','on')
     1952%                 set(handles.GetObject,'Visible','on');
    17691953            end
    17701954        case 'Mask'   %hidden by default
    17711955            if isequal(lower(varargout{ilist+1}),'on')   
    1772                 set(handles.ProjObject_frame,'Visible','on')
    1773                 set(handles.GetMask,'Visible','on');
     1956                set(handles.Objects,'Visible','on')
     1957%                 set(handles.GetMask,'Visible','on');
    17741958            end
    17751959        case 'PARAMETER' 
     
    18452029%%%%%%%%%%%%%
    18462030function [ind_remove]=find_pairs(dirpair,ind_i,last_i)
    1847 
    1848         indsel=ind_i;
    1849         indiff=diff(ind_i); %test index increment to detect multiplets (several pairs with the same index ind_i) and holes in the series
    1850         indiff=[1 indiff last_i-ind_i(end)+1];%for testing gaps with the imposed bounds
    1851         if ~isempty(indiff)
    1852             indiff2=diff(indiff);
    1853             indiffp=[indiff2 1];
    1854             indiffm=[1 indiff2];
    1855             ind_multi_m=find((indiff==0)&(indiffm<0))-1;%indices of first members of multiplets
    1856             ind_multi_p=find((indiff==0)&(indiffp>0));%indices of last members of multiplets
    1857                 %for each multiplet, select the most recent file
    1858             ind_remove=[];
    1859             for i=1:length(ind_multi_m)
    1860                 ind_pairs=ind_multi_m(i):ind_multi_p(i);
    1861                 for imulti=1:length(ind_pairs)
    1862                     datepair(imulti)=datenum(dirpair(ind_pairs(imulti)).date);%dates of creation
    1863                 end
    1864                 [datenew,indsort2]=sort(datepair); %sort the multiplet by creation date
    1865                 ind_s=indsort2(1:end-1);%
    1866                 ind_remove=[ind_remove ind_pairs(ind_s)];%remove these indices, leave the last one
    1867             end
    1868         end
     2031indsel=ind_i;
     2032indiff=diff(ind_i); %test index increment to detect multiplets (several pairs with the same index ind_i) and holes in the series
     2033indiff=[1 indiff last_i-ind_i(end)+1];%for testing gaps with the imposed bounds
     2034if ~isempty(indiff)
     2035    indiff2=diff(indiff);
     2036    indiffp=[indiff2 1];
     2037    indiffm=[1 indiff2];
     2038    ind_multi_m=find((indiff==0)&(indiffm<0))-1;%indices of first members of multiplets
     2039    ind_multi_p=find((indiff==0)&(indiffp>0));%indices of last members of multiplets
     2040    %for each multiplet, select the most recent file
     2041    ind_remove=[];
     2042    for i=1:length(ind_multi_m)
     2043        ind_pairs=ind_multi_m(i):ind_multi_p(i);
     2044        for imulti=1:length(ind_pairs)
     2045            datepair(imulti)=datenum(dirpair(ind_pairs(imulti)).date);%dates of creation
     2046        end
     2047        [datenew,indsort2]=sort(datepair); %sort the multiplet by creation date
     2048        ind_s=indsort2(1:end-1);%
     2049        ind_remove=[ind_remove ind_pairs(ind_s)];%remove these indices, leave the last one
     2050    end
     2051end
    18692052
    18702053%------------------------------------------------------------------------
     
    18782061num_i_out=num_i;
    18792062num_j_out=num_j;
    1880 if isequal (NomType,'_1-2_1') || isequal (NomType,'_1-2')
     2063% if isequal (NomType,'_1-2_1') || isequal (NomType,'_1-2')
     2064if isequal(mode,'series(Di)')
    18812065    num_i1_line=num_i+ind_shift(3);% set of first image numbers
    18822066    num_i2_line=num_i+ind_shift(4);
     
    18902074    [xx,num_i1]=meshgrid(num_j,num_i1_line);
    18912075    [xx,num_i2]=meshgrid(num_j,num_i2_line);
    1892 elseif isequal (NomType,'_1_1-2') || isequal (NomType,'#_ab')
     2076elseif isequal (mode,'series(Dj)')||isequal (mode,'bursts')
    18932077    if isequal(mode,'bursts') %case of bursts (png_old or png_2D)
    18942078        num_j1=ind_shift(1)*ones(size(num_i));
     
    19122096%------------------------------------------------------------------------
    19132097SeriesData=get(handles.series,'UserData');%
    1914 first_i=str2num(get(handles.first_i,'String'));
    1915 first_j=str2num(get(handles.first_j,'String'));
    1916 last_i=str2num(get(handles.last_i,'String'));
    1917 last_j=str2num(get(handles.last_j,'String'));
     2098first_i=str2num(get(handles.num_first_i,'String'));
     2099first_j=str2num(get(handles.num_first_j,'String'));
     2100last_i=str2num(get(handles.num_last_i,'String'));
     2101last_j=str2num(get(handles.num_last_j,'String'));
    19182102NomType=SeriesData.NomType;
    19192103mode_list=get(handles.mode,'String');
     
    21562340% --- image pair. The set of first numbers num1 of the image pairs is also
    21572341% --- given as output
    2158 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)
    2159 %------------------------------------------------------------------------
    2160 [Path,Name]=fileparts(filebase);
    2161 filebasesub=fullfile(Path,subdir,Name);
    2162 filecell={};%default
    2163 num_i1=[];
    2164 num_i2=[];
    2165 num_j1=[];
    2166 num_j2=[];
    2167 ind0_i=first_i:incr_i:last_i;
    2168 nbcolumn=length(ind0_i);
    2169 ind0_j=first_j:incr_j:last_j;
    2170 nbline=length(ind0_j);
    2171 if isequal(mode,'#_ab')
    2172     dirpair=dir([filebasesub '*_*.nc']);
    2173 elseif isequal(mode,'bursts')||isequal(mode,'series(Dj)') 
    2174     dirpair=dir([filebasesub '_*_*-*.nc']);
    2175 elseif isequal(mode,'series(Di)')
    2176     dirpair=dir([filebasesub '_*-*_*.nc']);
    2177 else
    2178     msgbox_uvmat('ERROR','option *|* not yet implemented')
    2179     return
    2180 end
    2181 if isempty(dirpair)
    2182         msgbox_uvmat('ERROR','no pair detected in the selected range')
    2183         return
    2184 end
    2185 
    2186 if isequal(mode,'bursts')||isequal(mode,'#_ab')
    2187     icount=0;
    2188     for ifile=1:length(dirpair)
    2189         [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name);
    2190         num1_r=str2num(str_1);
    2191         if isequal(RootFile,Name) & ~isempty(num1_r)   
    2192             num_i1(ifile)=num1_r;
    2193             num_a(ifile)=stra2num(str_a);
    2194             num_b(ifile)=stra2num(str_b);
    2195         end     
    2196     end
    2197     test_range= (num_i1 >=first_i)&(num_i1<= last_i);% =1 when both numbers are in the range
    2198     ind_i=((num_i1-first_i)/incr_i)+1;%indices i in the list of prescribed file indices
    2199     select=find(test_range &(floor(ind_i)==ind_i));%selected indices of num_i1 in the file directory
    2200     ind_i=ind_i(select);%set of selected indices ind_i
    2201     [ind_i,indsort]=sort(ind_i);%sorted list of ind_i
    2202     select=select(indsort);
    2203     num_i1=num_i1(select);
    2204     num_a=num_a(select);
    2205     num_b=num_b(select);
    2206     dirpair=dirpair(select);
    2207     [ind_remove]=find_pairs(dirpair,ind_i,nbcolumn);
    2208     ind_i(ind_remove)=[];
    2209     num_a(ind_remove)=[];
    2210     num_b(ind_remove)=[];
    2211     num_j1=zeros(1,nbcolumn);%default
    2212     num_j2=num_j1;
    2213     num_j1(ind_i)=num_a;
    2214     num_j2(ind_i)=num_b;
    2215     num_i1=first_i:incr_i:last_i;
    2216     num_i2=num_i1;
    2217     nbmissing=nbcolumn-length(ind_i);
    2218 
    2219 elseif isequal(mode,'series(Di)')
    2220     %ind0_i=first_i:incr_i:last_i;
    2221     %nbcolumn=length(ind0_i);
    2222     %ind0_j=first_j:incr_j:last_j;
    2223     %nbline=length(ind0_j);
    2224     %dirpair=dir([filebasesub '_*-*_*.nc']);
    2225     for ifile=1:length(dirpair)
    2226         [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name);
    2227         num_i1_r(ifile)=str2num(str_1);
    2228         num_i2_r(ifile)=str2num(str_2);
    2229         num_j(ifile)=str2num(str_a);
    2230     end
    2231     num_i=floor((num_i1_r+num_i2_r)/2); %list of reference indices of the detected files
    2232     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
    2233     ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices
    2234     ind_j=((num_j-first_j)/incr_j)+1;
    2235     ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices
    2236     select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory
    2237     ind_ij=ind_ij(select);%set of selected indices ind_ij
    2238     [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij
    2239     select=select(indsort);
    2240     num_i1_r=num_i1_r(select);
    2241     num_i2_r=num_i2_r(select);
    2242     dirpair=dirpair(select);
    2243     [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ;
    2244     ind_ij(ind_remove)=[];
    2245     num_i1_r(ind_remove)=[];
    2246     num_i2_r(ind_remove)=[];
    2247     num_i1=zeros(1,nbline*nbcolumn);%default
    2248     num_i2=num_i1;
    2249     num_i1(ind_ij)=num_i1_r;
    2250     num_j2(ind_ij)=num_i2_r;
    2251     num_i1=reshape(num_i1,nbline,nbcolumn);
    2252     num_i2=reshape(num_i2,nbline,nbcolumn);
    2253     num_j1=meshgrid(ind0_i,ind0_j);
    2254     num_j2=num_j1;
    2255     nbmissing=nbline*nbcolumn-length(ind_ij);
    2256 elseif isequal(mode,'series(Dj)')
    2257     for ifile=1:length(dirpair)
    2258         [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name);
    2259         num_i(ifile)=str2num(str_1);
    2260         num_a(ifile)=str2num(str_a);
    2261         num_b(ifile)=str2num(str_b);
    2262     end
    2263     num_j=floor((num_a+num_b)/2); %list of reference indices of the detected files
    2264     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
    2265     ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices
    2266     ind_j=((num_j-first_j)/incr_j)+1;
    2267     ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices
    2268     select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory
    2269     ind_ij=ind_ij(select);%set of selected indices ind_ij
    2270     [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij
    2271     select=select(indsort);
    2272     num_i=num_i(select);
    2273     num_a=num_a(select);
    2274     num_b=num_b(select);
    2275     dirpair=dirpair(select);
    2276     [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ;
    2277     ind_ij(ind_remove)=[];
    2278     num_a(ind_remove)=[];
    2279     num_b(ind_remove)=[];
    2280     num_j1=zeros(1,nbline*nbcolumn);%default
    2281     num_j2=num_j1;
    2282     num_j1(ind_ij)=num_a;
    2283     num_j2(ind_ij)=num_b;
    2284     num_j1=reshape(num_j1,nbline,nbcolumn);
    2285     num_j2=reshape(num_j2,nbline,nbcolumn);
    2286     num_i1=meshgrid(ind0_i,ind0_j);
    2287     num_i2=num_i1;
    2288     nbmissing=nbline*nbcolumn-length(ind_ij);
    2289 end
    2290 
    2291 
    2292 
     2342% 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)
     2343% %------------------------------------------------------------------------
     2344% [Path,Name]=fileparts(filebase);
     2345% filebasesub=fullfile(Path,subdir,Name);
     2346% filecell={};%default
     2347% num_i1=[];
     2348% num_i2=[];
     2349% num_j1=[];
     2350% num_j2=[];
     2351% ind0_i=first_i:incr_i:last_i;
     2352% nbcolumn=length(ind0_i);
     2353% ind0_j=first_j:incr_j:last_j;
     2354% nbline=length(ind0_j);
     2355% if isequal(mode,'#_ab')
     2356%     dirpair=dir([filebasesub '*_*.nc']);
     2357% elseif isequal(mode,'bursts')||isequal(mode,'series(Dj)') 
     2358%     dirpair=dir([filebasesub '_*_*-*.nc']);
     2359% elseif isequal(mode,'series(Di)')
     2360%     dirpair=dir([filebasesub '_*-*_*.nc']);
     2361% else
     2362%     msgbox_uvmat('ERROR','option *|* not yet implemented')
     2363%     return
     2364% end
     2365% if isempty(dirpair)
     2366%         msgbox_uvmat('ERROR','no pair detected in the selected range')
     2367%         return
     2368% end
     2369%
     2370% if isequal(mode,'bursts')||isequal(mode,'#_ab')
     2371%     icount=0;
     2372%     for ifile=1:length(dirpair)
     2373%         [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name);
     2374%         num1_r=str2num(str_1);
     2375%         if isequal(RootFile,Name) & ~isempty(num1_r)   
     2376%             num_i1(ifile)=num1_r;
     2377%             num_a(ifile)=stra2num(str_a);
     2378%             num_b(ifile)=stra2num(str_b);
     2379%         end     
     2380%     end
     2381%     test_range= (num_i1 >=first_i)&(num_i1<= last_i);% =1 when both numbers are in the range
     2382%     ind_i=((num_i1-first_i)/incr_i)+1;%indices i in the list of prescribed file indices
     2383%     select=find(test_range &(floor(ind_i)==ind_i));%selected indices of num_i1 in the file directory
     2384%     ind_i=ind_i(select);%set of selected indices ind_i
     2385%     [ind_i,indsort]=sort(ind_i);%sorted list of ind_i
     2386%     select=select(indsort);
     2387%     num_i1=num_i1(select);
     2388%     num_a=num_a(select);
     2389%     num_b=num_b(select);
     2390%     dirpair=dirpair(select);
     2391%     [ind_remove]=find_pairs(dirpair,ind_i,nbcolumn);
     2392%     ind_i(ind_remove)=[];
     2393%     num_a(ind_remove)=[];
     2394%     num_b(ind_remove)=[];
     2395%     num_j1=zeros(1,nbcolumn);%default
     2396%     num_j2=num_j1;
     2397%     num_j1(ind_i)=num_a;
     2398%     num_j2(ind_i)=num_b;
     2399%     num_i1=first_i:incr_i:last_i;
     2400%     num_i2=num_i1;
     2401%     nbmissing=nbcolumn-length(ind_i);
     2402%
     2403% elseif isequal(mode,'series(Di)')
     2404%     %ind0_i=num_first_i:num_incr_i:num_last_i;
     2405%     %nbcolumn=length(ind0_i);
     2406%     %ind0_j=num_first_j:num_incr_j:num_last_j;
     2407%     %nbline=length(ind0_j);
     2408%     %dirpair=dir([filebasesub '_*-*_*.nc']);
     2409%     for ifile=1:length(dirpair)
     2410%         [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name);
     2411%         num_i1_r(ifile)=str2num(str_1);
     2412%         num_i2_r(ifile)=str2num(str_2);
     2413%         num_j(ifile)=str2num(str_a);
     2414%     end
     2415%     num_i=floor((num_i1_r+num_i2_r)/2); %list of reference indices of the detected files
     2416%     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
     2417%     ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices
     2418%     ind_j=((num_j-first_j)/incr_j)+1;
     2419%     ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices
     2420%     select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory
     2421%     ind_ij=ind_ij(select);%set of selected indices ind_ij
     2422%     [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij
     2423%     select=select(indsort);
     2424%     num_i1_r=num_i1_r(select);
     2425%     num_i2_r=num_i2_r(select);
     2426%     dirpair=dirpair(select);
     2427%     [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ;
     2428%     ind_ij(ind_remove)=[];
     2429%     num_i1_r(ind_remove)=[];
     2430%     num_i2_r(ind_remove)=[];
     2431%     num_i1=zeros(1,nbline*nbcolumn);%default
     2432%     num_i2=num_i1;
     2433%     num_i1(ind_ij)=num_i1_r;
     2434%     num_j2(ind_ij)=num_i2_r;
     2435%     num_i1=reshape(num_i1,nbline,nbcolumn);
     2436%     num_i2=reshape(num_i2,nbline,nbcolumn);
     2437%     num_j1=meshgrid(ind0_i,ind0_j);
     2438%     num_j2=num_j1;
     2439%     nbmissing=nbline*nbcolumn-length(ind_ij);
     2440% elseif isequal(mode,'series(Dj)')
     2441%     for ifile=1:length(dirpair)
     2442%         [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name);
     2443%         num_i(ifile)=str2num(str_1);
     2444%         num_a(ifile)=str2num(str_a);
     2445%         num_b(ifile)=str2num(str_b);
     2446%     end
     2447%     num_j=floor((num_a+num_b)/2); %list of reference indices of the detected files
     2448%     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
     2449%     ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices
     2450%     ind_j=((num_j-first_j)/incr_j)+1;
     2451%     ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices
     2452%     select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory
     2453%     ind_ij=ind_ij(select);%set of selected indices ind_ij
     2454%     [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij
     2455%     select=select(indsort);
     2456%     num_i=num_i(select);
     2457%     num_a=num_a(select);
     2458%     num_b=num_b(select);
     2459%     dirpair=dirpair(select);
     2460%     [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ;
     2461%     ind_ij(ind_remove)=[];
     2462%     num_a(ind_remove)=[];
     2463%     num_b(ind_remove)=[];
     2464%     num_j1=zeros(1,nbline*nbcolumn);%default
     2465%     num_j2=num_j1;
     2466%     num_j1(ind_ij)=num_a;
     2467%     num_j2(ind_ij)=num_b;
     2468%     num_j1=reshape(num_j1,nbline,nbcolumn);
     2469%     num_j2=reshape(num_j2,nbline,nbcolumn);
     2470%     num_i1=meshgrid(ind0_i,ind0_j);
     2471%     num_i2=num_i1;
     2472%     nbmissing=nbline*nbcolumn-length(ind_ij);
     2473% end
  • trunk/src/update_waitbar.m

    r19 r339  
    77
    88function update_waitbar(hwaitbar,bar_size,advance_ratio)
    9 waitbarpos(1)=bar_size(1);
    10 waitbarpos(3)=bar_size(3);
    11 waitbarpos(4)=advance_ratio*bar_size(4);
    12 waitbarpos(2)=bar_size(4)+bar_size(2)-waitbarpos(4);
    13 set(hwaitbar,'Position',waitbarpos)
     9% waitbarpos(1)=bar_size(1);
     10% waitbarpos(3)=bar_size(3);
     11% waitbarpos(4)=advance_ratio*bar_size(4);
     12% waitbarpos(2)=bar_size(4)+bar_size(2)-waitbarpos(4);
     13% set(hwaitbar,'Position',waitbarpos)
     14set(hwaitbar,'Units','pixels')
     15pos=get(hwaitbar,'Position');
     16CData=zeros([floor(pos(4)) floor(pos(3)) 3]);
     17set(hwaitbar,'Units','normalized')
     18CData(:,1:floor(advance_ratio*size(CData,2)),1:2)=1;
     19set(hwaitbar,'CData',CData)
    1420drawnow
  • trunk/src/uvmat.m

    r334 r339  
    474474end
    475475% detect root name, nomenclature and indices in the input file name:
    476 [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput);
     476[~,SubDir,~,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput);
    477477% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    478 [i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput);
    479 
     478% [i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput);
     479[RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput);
    480480% open the file or fill the GUI uvmat according to the detected file type
    481481switch FileType
     
    822822
    823823% set default options in menu 'Fields'
    824 
    825824if ~testima
    826825    testcivx=0;
     
    19091908function movie_pair_Callback(hObject, eventdata, handles)
    19101909%------------------------------------------------------------------------
    1911 status=get(handles.movie_pair,'value');
    1912 if isequal(status,0)
     1910
     1911%% stop movie action if the movie_pair button is off
     1912if ~get(handles.movie_pair,'value')
    19131913    set(handles.movie_pair,'BusyAction','Cancel')%stop movie pair if button is 'off'
    19141914    set(handles.i2,'String','')
     
    19181918    set(handles.movie_pair,'BusyAction','queue')
    19191919end
    1920 %initialisation
     1920
     1921%% initialisation
    19211922set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow
    19221923drawnow
     
    19291930    [ff,rr,filebase,xx,Ext,SubDir]=read_file_boxes(handles);
    19301931    NomType=get(handles.NomType,'String');
    1931 %     NomType=get(handles.FileIndex,'UserData');
    19321932else
    19331933    list_fields=get(handles.Fields_1,'String');% list menu fields
     
    19691969end
    19701970
    1971 %read the second image
     1971%% read the second image
    19721972Field.AName='image';
    19731973if test_1
     
    19841984end
    19851985Field_b.CoordUnit='pixel';
    1986 %determine the input file type
     1986
     1987%% determine the input file type
    19871988if (test_1 && isfield(UvData,'MovieObject_1'))||(~test_1 && isfield(UvData,'MovieObject'))
    19881989    FileType='movie';
Note: See TracChangeset for help on using the changeset viewer.