Changeset 772 for trunk


Ignore:
Timestamp:
May 9, 2014, 8:33:53 PM (7 years ago)
Author:
sommeria
Message:

manip corrections and cleaning

Location:
trunk/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ_matlab.m

    r651 r772  
    6060if isfield (Param,'Civ1')
    6161    par_civ1=Param.Civ1;
    62     if isfield(par_civ1,'reverse_pair')% A REVOIR
    63         if par_civ1.reverse_pair
    64             if ischar(par_civ1.ImageB)
    65                 temp=par_civ1.ImageA;
    66                 par_civ1.ImageA=imread(par_civ1.ImageB);
    67             end
    68             if ischar(temp)
    69                 par_civ1.ImageB=imread(temp);
    70             end
    71         end
    72     else
    73         if isfield(Param.Civ1,'ImageA') && ischar(Param.Civ1.ImageA)
    74              Param.Civ1.ImageA=regexprep(Param.Civ1.ImageA,'''','\');
    75             [par_civ1.ImageA,VideoObject] = read_image(Param.Civ1.ImageA,par_civ1.FileTypeA,[],par_civ1.FrameIndexA);
    76         end
    77         if isfield(Param.Civ1,'ImageB')&& ischar(Param.Civ1.ImageB)
    78              Param.Civ1.ImageB=regexprep(Param.Civ1.ImageB,'''','\');
    79              if strcmp(Param.Civ1.ImageA,Param.Civ1.ImageB)% use the same movie object
    80                  [par_civ1.ImageB,VideoObject] = read_image(Param.Civ1.ImageB,par_civ1.FileTypeB,VideoObject,par_civ1.FrameIndexB);
    81              else
     62    if isfield(Param.Civ1,'ImageA') && ischar(Param.Civ1.ImageA)% the input is a char string, read the corresponding image name (else  Param.Civ1.ImageA is already an image)
     63        Param.Civ1.ImageA=regexprep(Param.Civ1.ImageA,'''','\');
     64        [par_civ1.ImageA,VideoObject] = read_image(Param.Civ1.ImageA,par_civ1.FileTypeA,[],par_civ1.FrameIndexA);
     65    end
     66    if isfield(Param.Civ1,'ImageB')&& ischar(Param.Civ1.ImageB)% the input is a char string, read the corresponding image name (else  Param.Civ1.ImageB is already an image)
     67        Param.Civ1.ImageB=regexprep(Param.Civ1.ImageB,'''','\');
     68        if strcmp(Param.Civ1.ImageA,Param.Civ1.ImageB)% use the same movie object
     69            [par_civ1.ImageB,VideoObject] = read_image(Param.Civ1.ImageB,par_civ1.FileTypeB,VideoObject,par_civ1.FrameIndexB);
     70        else
    8271            [par_civ1.ImageB,VideoObject] = read_image(Param.Civ1.ImageB,par_civ1.FileTypeB,par_civ1.ImageB,par_civ1.FrameIndexB);
    83              end
    84         end
    85     end
    86    
     72        end
     73    end
    8774    list_param=(fieldnames(Param.Civ1))';
    8875    Civ1_param=list_param;%default
     
    142129        CivFile=Param.Patch1.CivFile;
    143130    end
    144     Data=nc2struct(CivFile,'ListGlobalAttribute','absolut_time_T0'); %look for the constant 'absolut_time_T0' to detect old civx data format
    145     if isfield(Data,'Txt')
    146         errormsg=Data.Txt;
     131    [Data,tild,tild,erromsg]=nc2struct(CivFile,'ListGlobalAttribute','absolut_time_T0'); %look for the constant 'absolut_time_T0' to detect old civx data format
     132    if ~isempty(errormsg)
    147133        return
    148134    end
  • trunk/src/fill_GUI.m

    r747 r772  
    2525    end
    2626end
    27 UserData=get(GUI_handle,'UserData');% additional information stored in 'UserData' of the GUI
    2827fields=fieldnames(Param);%list of fields in Param
    2928
  • trunk/src/filter_tps.m

    r651 r772  
    8282            NormDiff=UDiff.*UDiff+VDiff.*VDiff;
    8383            ind_ind_sel=1:numel(ind_sel);%default
    84             if exist('Threshold','var')
     84            if exist('Threshold','var')&&~isempty(Threshold)
    8585                FF(ind_sel)=20*(NormDiff>Threshold);%put FF value to 20 to identify the criterium of elimmination
    8686                ind_ind_sel=find(FF(ind_sel)==0); % select the indices of ind_sel corresponding to the remaining vectors
  • trunk/src/geometry_calib.m

    r757 r772  
    125125set(handles.calib_type,'String',{'rescale';'linear';'3D_linear';'3D_quadr';'3D_extrinsic'})
    126126if exist('inputfile','var')&& ~isempty(inputfile)
    127 %     struct.XmlInputFile=inputfile;
    128127    [RootPath,SubDir,RootFile,tild,tild,tild,tild,FileExt]=fileparts_uvmat(inputfile);
    129128    struct.XmlInputFile=find_imadoc(RootPath,SubDir,RootFile,FileExt);
    130 %     if ~strcmp(FileExt,'.xml')
    131 %         inputfile=fullfile(RootPath,[SubDir '.xml']);%xml file corresponding to the input file
    132 %         if ~exist(inputfile,'file')% case of civ files , removes the extension for subdir
    133 %             inputfile=fullfile(RootPath,[regexprep(SubDir,'\..+$','') '.xml']);
    134 %             if ~exist(inputfile,'file')
    135 %                 inputfile=[fullfile(RootPath,SubDir,RootFile) '.xml'];%old convention
    136 %                 if ~exist(inputfile,'file')
    137 %                     inputfile='';
    138 %                 end
    139 %             end
    140 %         end
    141 %     end
    142129    set(handles.ListCoord,'Data',[])
    143130    if exist(struct.XmlInputFile,'file')
  • trunk/src/series.m

    r771 r772  
    122122series_ResizeFcn(hObject, eventdata, handles)%resize table according to series GUI size
    123123set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display)
    124 set(handles.InputTable,'KeyPressFcn',{@key_press_fcn,handles})%set keyboard action function (allow action on uvmat when set_object is in front)
    125124set(hObject,'DeleteFcn',{@closefcn})%
    126125
     
    236235if isfield(Param,'Coord_x_str') && ischar(Param.Coord_x_str)
    237236        set(handles.Coord_x,'String',Param.Coord_x_str);% list menu fields
    238 %     set(handles.Coord_x,'Value',Param.Coord_x_val);% selected string index
    239237end
    240238if isfield(Param,'Coord_y_str')&& ischar(Param.Coord_y_str)
    241239        set(handles.Coord_y,'String',Param.Coord_y_str);% list menu fields
    242 %     set(handles.Coord_y,'Value',Param.Coord_y_val);% selected string index
    243240end
    244241
     
    483480
    484481
    485 
    486 %------------------------------------------------------------------------
    487 % --- Executes when entered data in editable cell(s) in InputTable.
    488 function InputTable_CellEditCallback(hObject, eventdata, handles)
    489 %------------------------------------------------------------------------
     482% --- Executes when selected cell(s) is changed in InputTable.
     483function InputTable_CellSelectionCallback(hObject, eventdata, handles)
     484iline=[];
     485if ~isempty(eventdata.Indices)
     486    iline=eventdata.Indices(1);
     487end
     488set(handles.InputTable,'UserData',iline);
     489
     490%------------------------------------------------------------------------
     491% --- 'key_press_fcn:' function activated when a key is pressed on the keyboard
     492%------------------------------------------------------------------------
     493function InputTable_KeyPressFcn(hObject, eventdata, handles)
    490494set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed
    491 % set(handles.REFRESH_title,'Visible','on')
    492 iview=eventdata.Indices(1);
    493 view_set=get(handles.REFRESH,'UserData');
    494 if isempty(find(view_set==iview))
    495     set(handles.REFRESH,'UserData',[view_set iview])
    496 end
    497 %% enable other menus and uicontrols
    498 set(handles.MenuOpenCampaign,'Enable','on')
    499 set(handles.MenuCampaign_1,'Enable','on')
    500 set(handles.MenuCampaign_2,'Enable','on')
    501 set(handles.MenuCampaign_3,'Enable','on')
    502 set(handles.MenuCampaign_4,'Enable','on')
    503 set(handles.MenuCampaign_5,'Enable','on')
    504 set(handles.RUN, 'Enable','On')
    505 set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red
    506 
    507 %------------------------------------------------------------------------
    508 % --- 'key_press_fcn:' function activated when a key is pressed on the keyboard
    509 %------------------------------------------------------------------------
    510 function key_press_fcn(hObject,eventdata,handles)
    511 
    512495xx=double(get(handles.series,'CurrentCharacter')); %get the keyboard character
    513 if ismember(xx,[8 127 31])%backspace or delete, or downward
    514     InputTable=get(handles.InputTable,'Data');
    515     iline=get(handles.InputTable,'UserData');
    516             if isequal(xx, 31)
    517                 if isequal(iline,size(InputTable,1))% arrow downward
    518                 InputTable=[InputTable;cell(1,size(InputTable,2))];
    519                 end
    520             else
    521     InputTable(iline,:)=[];% suppress the current line
    522             end
    523     set(handles.InputTable,'Data',InputTable);
     496switch xx
     497    case 31 %downward arrow
     498        InputTable=get(handles.InputTable,'Data');
     499        iline=get(handles.InputTable,'UserData');
     500        if isequal(iline,size(InputTable,1))% arrow downward
     501            InputTable=[InputTable;InputTable(iline,:)];% create a new line as a copy of the last one
     502            set(handles.InputTable,'Data',InputTable);
     503        end
     504    case 127  %key 'Suppress'
     505         InputTable=get(handles.InputTable,'Data');
     506        iline=get(handles.InputTable,'UserData');
     507        if iline>1
     508            InputTable(iline,:)=[];% suppress the current line if not the first
     509            set(handles.InputTable,'Data',InputTable);
     510        end
    524511end
    525512
     
    537524    empty_line(iline)= isempty(cell2mat(InputTable(iline,1:3)));
    538525end
    539 InputTable(empty_line,:)=[];%remove empty lines
    540 set(handles.InputTable,'Data',InputTable)
     526if ~isempty(find(empty_line));
     527    InputTable(empty_line,:)=[];%remove empty lines
     528    set(handles.InputTable,'Data',InputTable)
     529    ListTable={'MinIndex_i','MaxIndex_i','MinIndex_j','MaxIndex_j','PairString','TimeTable'};
     530    for ilist=1:numel(ListTable)
     531        Table=get(handles.(ListTable{ilist}),'Data');
     532        Table(empty_line,:)=[];%remove empty lines
     533        set(handles.(ListTable{ilist}),'Data',Table);
     534    end
     535    set(handles.series,'UserData',[])%refresh the stored info
     536end
    541537for iview=1:size(InputTable,1)
    542538    RootPath=fullfile(InputTable{iview,1},InputTable{iview,2});
     
    558554        end
    559555    else
    560        update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,FileInfo,MovieObject,iview)
     556       update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileInfo,MovieObject,iview)
    561557    end
    562558end
     
    571567% INPUT:
    572568% handles: handles of elements in the GUI
    573 % fileinput: input file name, including path
     569% Param: structure of input parameters, including  input file name and path
    574570% iview: line index in the input table
    575571%       or 'one': refresh the list
     
    639635    iview=size(InputTable,1)+1;% the next line in InputTable becomes the current line
    640636    InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
     637%     SeriesData.ListViewMenu(iview)=zeros(1,nbview)
    641638elseif strcmp(iview,'one') % refresh the list of  input  file series
    642639    iview=1; %the first line in InputTable becomes the current line
     
    648645    set(handles.MinIndex_j,'Data',[])
    649646    set(handles.MaxIndex_j,'Data',[])
    650     set(handles.ListView,'Value',1)
    651     set(handles.ListView,'String',{'1'})
    652647    set(handles.PairString,'Data',{''})
     648    SeriesData.CheckPair=0;%reset the list of input lines with pairs
    653649    SeriesData.i1_series={};
    654650    SeriesData.i2_series={};
     
    659655    SeriesData.Time={};
    660656end
    661 nbview=size(InputTable,1);
    662 set(handles.ListView,'String',mat2cell((1:nbview)',ones(nbview,1)))
    663 set(handles.ListView,'Value',iview)
    664 SeriesData.ListViewValue=iview;
    665 SeriesData.ListViewMenu=mat2cell((1:nbview)',ones(nbview,1));
    666657set(handles.InputTable,'Data',InputTable)
    667658
     
    682673end
    683674ref_j=floor((j1+j2)/2);% reference image number corresponding to the file
    684 % set(handles.num_ref_j,'String',num2str(ref_j));
    685675SeriesData.ref_i=ref_i;
    686676SeriesData.ref_j=ref_j;
     
    737727
    738728%% initiate input file series and refresh the current field view:     
    739 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,FileInfo,MovieObject,iview);
     729update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileInfo,MovieObject,iview);
    740730set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
    741731
     
    743733% --- Update information about a new field series (indices to scan, timing,
    744734%     calibration from an xml file
    745 function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,FileInfo,VideoObject,iview)
     735function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileInfo,VideoObject,iview)
    746736%------------------------------------------------------------------------
    747737InputTable=get(handles.InputTable,'Data');
     
    780770MaxIndex_j_table=get(handles.MaxIndex_j,'Data');%retrieve the min indices in the table MinIndex
    781771if ~isempty(MinIndex_i)&&~isempty(MaxIndex_i)
    782 MinIndex_i_table(iview,1)=MinIndex_i;
    783 MaxIndex_i_table(iview,1)=MaxIndex_i;
     772    MinIndex_i_table(iview,1)=MinIndex_i;
     773    MaxIndex_i_table(iview,1)=MaxIndex_i;
    784774end
    785775if ~isempty(MinIndex_j)&&~isempty(MaxIndex_j)
    786 MinIndex_j_table(iview,1)=MinIndex_j;
    787 MaxIndex_j_table(iview,1)=MaxIndex_j;
     776    MinIndex_j_table(iview,1)=MinIndex_j;
     777    MaxIndex_j_table(iview,1)=MaxIndex_j;
    788778end
    789779set(handles.MinIndex_i,'Data',MinIndex_i_table)%display the min indices in the table MinIndex
     
    791781set(handles.MaxIndex_i,'Data',MaxIndex_i_table)%display the min indices in the table MinIndex
    792782set(handles.MaxIndex_j,'Data',MaxIndex_j_table)%display the max indices in the table MaxIndex
     783SeriesData=get(handles.series,'UserData');
    793784
    794785%% adjust the first and last indices for the selected series, only if requested by the bounds
    795786% i index, compare input to min index i
    796787first_i=str2num(get(handles.num_first_i,'String'));%retrieve previous first i
    797 ref_i=str2num(get(handles.num_ref_i,'String'));%index i given by the input field
     788% ref_i=str2num(get(handles.num_ref_i,'String'));%index i given by the input field
     789ref_i=1;
     790if isfield(SeriesData,'ref_i')
     791ref_i=SeriesData.ref_i;
     792end
    798793if isempty(first_i)
    799794    first_i=ref_i;% first_i updated by the input value
     
    805800% j index,  compare input to min index j
    806801first_j=str2num(get(handles.num_first_j,'String'));
    807 ref_j=str2num(get(handles.num_ref_j,'String'));%index j given by the input field
     802ref_j=1;
     803if isfield(SeriesData,'ref_j')
     804ref_j=SeriesData.ref_j;
     805end
    808806if isempty(first_j)
    809807    first_j=ref_j;% first_j updated by the input value
     
    838836%% number of slices set by default
    839837NbSlice=1;%default
    840 % read  value set by the first series for the checkappend mode (iwiew >1)
     838% read  value set by the first series for the append mode (iwiew >1)
    841839if iview>1 && strcmp(get(handles.num_NbSlice,'Visible'),'on')
    842840    NbSlice=str2num(get(handles.num_NbSlice,'String'));
     
    845843%% default time unit
    846844TimeUnit='';
    847 % read  value set by the first series for the checkappend mode (iwiew >1)
     845% read  value set by the first series for the append mode (iwiew >1)
    848846if iview>1
    849847    TimeUnit=get(handles.TimeUnit,'String');
     
    930928
    931929%% update the series info in 'UserData'
    932 SeriesData=get(handles.series,'UserData');
    933930SeriesData.i1_series{iview}=i1_series;
    934931SeriesData.i2_series{iview}=i2_series;
    935932SeriesData.j1_series{iview}=j1_series;
    936933SeriesData.j2_series{iview}=j2_series;
    937 SeriesData.FileType{iview}=FileType;
     934SeriesData.FileType{iview}=FileInfo.FileType;
    938935SeriesData.FileInfo{iview}=FileInfo;
    939936SeriesData.Time{iview}=Time;
     
    941938    SeriesData.TimeSource=TimeSource;
    942939end
    943 % if ~isempty(TimeUnit)
    944 %     SeriesData.TimeUnit=TimeUnit;
    945 % end
    946940if check_calib
    947941    SeriesData.GeometryCalib{iview}=XmlData.GeometryCalib;
     
    950944
    951945%% update pair menus
    952 ListView=get(handles.ListView,'String');
    953 ListView{iview}=num2str(iview);
    954 set(handles.ListView,'String',ListView);
    955 set(handles.ListView,'Value',iview)
    956 update_mode(handles,i1_series,i2_series,j1_series,j2_series,Time)
    957 
    958 %% enable j index visibility
    959 status_j='on';%default
    960 if isempty(find(~cellfun(@isempty,SeriesData.j1_series), 1)); % case of empty j indices
    961     status_j='off'; % no j index needed
    962 elseif strcmp(get(handles.PairString,'Visible'),'on')
    963     PairString=get(handles.PairString,'Data');
    964     check_burst=cellfun(@isempty,regexp(PairString,'^j'));%=0 for burst case, 1 otherwise
    965     if isempty(find(check_burst, 1))% if all pair string begins by j (burst)
    966         status_j='off'; % no j index needed for bust case
    967     end
    968 end
    969 enable_j(handles,status_j) % no j index needed
     946hset_pair=findobj(allchild(0),'Tag','set_pairs');
     947if ~isempty(hset_pair), delete(hset_pair); end % delete the GUI set_pair if opened
     948CheckPair= ~isempty(i2_series)||~isempty(j2_series); % check whether index pairs need to be defined
     949PairString=get(handles.PairString,'Data');
     950if CheckPair% if pairs need to be display for line iview
     951    [ModeMenu,ModeValue]=update_mode(i1_series,i2_series,j2_series);
     952    Menu=update_listpair(i1_series,i2_series,j1_series,j2_series,ModeMenu{ModeValue},Time,TimeUnit,ref_i,ref_j);
     953    PairString{iview,1}=Menu{1};
     954else
     955    PairString{iview,1}='';%no pair for #iview
     956end
     957set(handles.PairString,'Data',PairString)
     958if isempty(find(cellfun('isempty',get(handles.PairString,'Data'))==0, 1))% if all lines of pairs are empty
     959    set(handles.PairString,'Visible','off')
     960    set(handles.SetPairs,'Visible','off')
     961else
     962    set(handles.PairString,'Visible','on')
     963    set(handles.SetPairs,'Visible','on')
     964end
     965
    970966
    971967%% display the set of existing files as an image
     
    978974MaxIndex_i=ones(1,nbview);%default
    979975MinIndex_i=ones(1,nbview);%default
    980 for iview=1:nbview
    981     pair_max=squeeze(max(SeriesData.i1_series{iview},[],1)); %max on pair index
    982     j_max{iview}=max(pair_max,[],1);%max on j index
    983     if ~isempty(j_max{iview})
    984     MaxIndex_i(iview)=max(find(j_max{iview}))-1;% max ref index i
    985     MinIndex_i(iview)=min(find(j_max{iview}))-1;% min ref index i
     976for iline=1:nbview
     977    pair_max=squeeze(max(SeriesData.i1_series{iline},[],1)); %max on pair index
     978    j_max{iline}=max(pair_max,[],1);%max on j index
     979    if ~isempty(j_max{iline})
     980    MaxIndex_i(iline)=max(find(j_max{iline}))-1;% max ref index i
     981    MinIndex_i(iline)=min(find(j_max{iline}))-1;% min ref index i
    986982    end
    987983end
     
    993989file_indices=MinIndex_i+floor(((0.5:npx-0.5)/npx)*range_index)+1;
    994990CData=zeros(nbview*range_y,npx);% initiate the image representing the existing files
    995 for iview=1:nbview
    996     ind_y=1+(iview-1)*range_y:iview*range_y;
     991for iline=1:nbview
     992    ind_y=1+(iline-1)*range_y:iline*range_y;
    997993    LineData=zeros(size(file_indices));
    998     file_select=file_indices(file_indices<=numel(j_max{iview}));
    999     ind_select=find(file_indices<=numel(j_max{iview}));
    1000     LineData(ind_select)=j_max{iview}(file_select)~=0;
     994    file_select=file_indices(file_indices<=numel(j_max{iline}));
     995    ind_select=find(file_indices<=numel(j_max{iline}));
     996    LineData(ind_select)=j_max{iline}(file_select)~=0;
    1001997    CData(ind_y,:)=ones(size(ind_y'))*LineData;
    1002998end
     
    10041000set(handles.FileStatus,'CData',CData);
    10051001
    1006 %% check for pair display
    1007 check_pairs=0;
    1008 for iview=1:numel(SeriesData.i2_series)
    1009     if ~isempty(SeriesData.i2_series{iview})||~isempty(SeriesData.j2_series{iview})
    1010         check_pairs=1;
    1011     end
    1012 end
    1013 if check_pairs
    1014 %     set(handles.Pairs,'Visible','on')
    1015     set(handles.PairString,'Visible','on')
    1016     set(handles.SetPairs,'Visible','on')
    1017 else
    1018 %     set(handles.Pairs,'Visible','off')
    1019     set(handles.PairString,'Visible','off')
    1020     set(handles.SetPairs,'Visible','off')
    1021 end
    1022 
    1023 
    10241002%% enable field and veltype menus, in accordance with the current action
    10251003ActionName_Callback([],[], handles)
     
    10281006displ_time(handles)
    10291007
    1030 %% set default options in menu 'Fields'
    1031 switch FileType
    1032     case {'civx','civdata'}
    1033         FieldList=[set_field_list('U','V');{'C'}];%standard menu for civx data
    1034 %         set(handles.Coord_x,'Value',1);
    1035         set(handles.Coord_x,'String','X');
    1036 %         set(handles.Coord_y,'Value',1);
    1037         set(handles.Coord_y,'String','Y');
    1038     case 'netcdf'
    1039         ind_x=find(strcmp(get(handles.Coord_x,'String'),FileInfo.ListVarName));
    1040         if isempty(ind_x)
    1041             FieldList={};% new kind of file opened, we need to pick variables with get_field...
    1042             set(handles.Coord_x,'String','')
    1043             set(handles.Coord_y,'String','')
     1008
     1009% look for netcdf data as input
     1010% switch FileType
     1011%     case {'civx','civdata'}
     1012%         FieldList=[set_field_list('U','V');{'C'}];%standard menu for civx data
     1013%         set(handles.Coord_x,'String','X');
     1014%         set(handles.Coord_y,'String','Y');
     1015%     case 'netcdf'
     1016%         ind_x=find(strcmp(get(handles.Coord_x,'String'),FileInfo.ListVarName));
     1017%         if isempty(ind_x)
     1018%             FieldList={};% new kind of file opened, we need to pick variables with get_field...
     1019%             set(handles.Coord_x,'String','')
     1020%             set(handles.Coord_y,'String','')
     1021%         else
     1022%             FileInfo.ListVarName(ind_x)=[];%remove coord-x from the list of variables to display
     1023%             ind_y=find(strcmp(get(handles.Coord_y,'String'),FileInfo.ListVarName));
     1024%             if isempty(ind_y)
     1025%             FieldList={};% new kind of file opened, we need to pick variables with get_field...
     1026%             set(handles.Coord_x,'String','')
     1027%             set(handles.Coord_y,'String','')
     1028%             else
     1029%                 FileInfo.ListVarName(ind_y)=[];%remove coord-y from the list of variables to display
     1030%                 FieldList=(FileInfo.ListVarName)';
     1031%             end
     1032%         end 
     1033%     otherwise
     1034%         set(handles.FieldName,'Value',1) % set menu to 'image'
     1035%         set(handles.FieldName,'String',{'image'})
     1036%         set(handles.Coord_x,'String','AX');
     1037%         set(handles.Coord_y,'String','AY');
     1038% end
     1039% if ismember(FileType,{'civx','civdata','netcdf'})
     1040%     PrevMenu=get(handles.FieldName,'String');
     1041%     PrevValue=get(handles.FieldName,'Value');
     1042%     PrevMenu=PrevMenu(PrevValue(PrevValue<=numel(PrevMenu)));
     1043%     FieldValue=[];
     1044%     for ilist=1:numel(PrevMenu)
     1045%         index_menu=find(strcmp(PrevMenu{ilist},FieldList));
     1046%         if ~isempty(index_menu)
     1047%             FieldValue=[FieldValue index_menu];
     1048%         end
     1049%     end
     1050%     if isempty(FieldValue)
     1051%         FieldValue=1;
     1052%     end
     1053%     set(handles.FieldName,'Value',FieldValue)
     1054%     set(handles.FieldName,'String',[FieldList;{'get_field...'}])
     1055% end
     1056
     1057
     1058%-----------------------------------------------------------guide -------------
     1059%------------------------------------------------------------------------
     1060%  III - FUNCTIONS ASSOCIATED TO THE FRAME IndexRange
     1061%------------------------------------------------------------------------
     1062
     1063
     1064% ---- determine the menu to put in mode and advice a default choice
     1065%------------------------------------------------------------------------
     1066function [ModeMenu,ModeValue]=update_mode(i1_series,i2_series,j2_series)
     1067%------------------------------------------------------------------------   
     1068ModeMenu={''};
     1069if isempty(j2_series)% no j pair
     1070    ModeValue=1;
     1071    if ~isempty(i2_series)
     1072        ModeMenu={'series(Di)'}; % pair menu with only option Di
     1073    end
     1074else %existence of j pairs
     1075    pair_max=squeeze(max(i1_series,[],1)); %max on pair index
     1076    j_max=max(pair_max,[],1);
     1077    MaxIndex_i=find(j_max, 1, 'last' )-1;% max ref index i
     1078    MinIndex_i=find(j_max, 1 )-1;% min ref index i
     1079    i_max=max(pair_max,[],2);
     1080    MaxIndex_j=find(i_max, 1, 'last' )-1;% max ref index i
     1081    MinIndex_j=find(i_max, 1 )-1;% min ref index i
     1082    if MaxIndex_j==MinIndex_j
     1083        ModeValue=1;
     1084        ModeMenu={'bursts'};
     1085    elseif MaxIndex_i==MinIndex_i
     1086        ModeValue=1;
     1087        ModeMenu={'series(Dj)'};
     1088    else
     1089        ModeMenu={'bursts';'series(Dj)'};
     1090        if (MaxIndex_j-MinIndex_j)>10
     1091            ModeValue=2;%set mode to series(Dj) if more than 10 j values
    10441092        else
    1045             FileInfo.ListVarName(ind_x)=[];%remove coord-x from the list of variables to display
    1046             ind_y=find(strcmp(get(handles.Coord_y,'String'),FileInfo.ListVarName));
    1047             if isempty(ind_y)
    1048             FieldList={};% new kind of file opened, we need to pick variables with get_field...
    1049             set(handles.Coord_x,'String','')
    1050             set(handles.Coord_y,'String','')
    1051             else
    1052                 FileInfo.ListVarName(ind_y)=[];%remove coord-y from the list of variables to display
    1053                 FieldList=(FileInfo.ListVarName)';
     1093            ModeValue=1;
     1094        end
     1095    end
     1096end
     1097
     1098
     1099%------------------------------------------------------------------------
     1100function displ_pair=update_listpair(i1_series,i2_series,j1_series,j2_series,mode,time,TimeUnit,ref_i,ref_j)
     1101%------------------------------------------------------------------------
     1102displ_pair={};
     1103if isempty(TimeUnit)
     1104    dtunit='e-03';
     1105else
     1106    dtunit=['m' TimeUnit];
     1107end
     1108switch mode
     1109    case 'series(Di)'
     1110        diff_i=i2_series-i1_series;
     1111        min_diff=min(diff_i(diff_i>0));
     1112        max_diff=max(diff_i(diff_i>0));
     1113        for ipair=min_diff:max_diff
     1114            if numel(diff_i(diff_i==ipair))>0
     1115                pair_string=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ];
     1116                if ~isempty(time)
     1117                    if ref_i<=floor(ipair/2)
     1118                        ref_i=floor(ipair/2)+1;% shift ref_i to get the first pair
     1119                    end
     1120                    Dt=time(ref_i+ceil(ipair/2),ref_j)-time(ref_i-floor(ipair/2),ref_j);
     1121                    pair_string=[pair_string ', Dt=' num2str(Dt) ' ' dtunit];
     1122                end
     1123                displ_pair=[displ_pair;{pair_string}];
    10541124            end
    1055         end 
    1056     otherwise
    1057         set(handles.FieldName,'Value',1) % set menu to 'image'
    1058         set(handles.FieldName,'String',{'image'})
    1059         set(handles.Coord_x,'String','AX');
    1060         set(handles.Coord_y,'String','AY');
    1061 end
    1062 if ismember(FileType,{'civx','civdata','netcdf'})
    1063     PrevMenu=get(handles.FieldName,'String');
    1064     PrevMenu=PrevMenu(get(handles.FieldName,'Value'));
    1065     FieldValue=[];
    1066     for ilist=1:numel(PrevMenu)
    1067         index_menu=find(strcmp(PrevMenu{ilist},FieldList));
    1068         if ~isempty(index_menu)
    1069             FieldValue=[FieldValue index_menu];
    1070         end
    1071     end
    1072     if isempty(FieldValue)
    1073         FieldValue=1;
    1074     end
    1075     set(handles.FieldName,'Value',FieldValue)
    1076     set(handles.FieldName,'String',[FieldList;{'get_field...'}])
    1077 end
    1078 
    1079      
     1125        end
     1126        if ~isempty(displ_pair)
     1127            displ_pair=[displ_pair;{'Di=*|*'}];
     1128        end
     1129    case 'series(Dj)'
     1130        if isempty(j2_series)
     1131            msgbox_uvmat('ERROR','no j1-j2 pair available')
     1132            return
     1133        end
     1134        diff_j=j2_series-j1_series;
     1135        min_diff=min(diff_j(diff_j>0));
     1136        max_diff=max(diff_j(diff_j>0));
     1137        for ipair=min_diff:max_diff
     1138            if numel(diff_j(diff_j==ipair))>0
     1139                pair_string=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ];
     1140                if ~isempty(time)
     1141                    if ref_j<=floor(ipair/2)
     1142                        ref_j=floor(ipair/2)+1;% shift ref_i to get the first pair
     1143                    end
     1144                    Dt=time(ref_i,ref_j+ceil(ipair/2))-time(ref_i,ref_j-floor(ipair/2));
     1145                    pair_string=[pair_string ', Dt=' num2str(Dt) ' ' dtunit];
     1146                end
     1147                displ_pair=[displ_pair;{pair_string}];
     1148            end
     1149        end
     1150        if ~isempty(displ_pair)
     1151            displ_pair=[displ_pair;{'Dj=*|*'}];
     1152        end
     1153    case 'bursts'
     1154        if isempty(j2_series)
     1155            msgbox_uvmat('ERROR','no j1-j2 pair available')
     1156            return
     1157        end
     1158        %diff_j=j2_series-j1_series;
     1159        min_j1=min(j1_series(j1_series>0));
     1160        max_j1=max(j1_series(j1_series>0));
     1161        min_j2=min(j2_series(j2_series>0));
     1162        max_j2=max(j2_series(j2_series>0));
     1163        for pair1=min_j1:min(max_j1,min_j1+20)
     1164            for pair2=min_j2:min(max_j2,min_j2+20)
     1165                if numel(j1_series(j1_series==pair1))>0 && numel(j2_series(j2_series==pair2))>0
     1166                    pair_string=['j= ' num2str(pair1) '-' num2str(pair2)];
     1167                    Dt=time(ref_i,pair2+1)-time(ref_i,pair1+1);
     1168                    pair_string=[pair_string ', Dt=' num2str(Dt) ' ' dtunit];
     1169                    displ_pair=[displ_pair;{pair_string}];
     1170                end
     1171            end
     1172        end
     1173        if ~isempty(displ_pair)
     1174            displ_pair=[displ_pair;{'j=*-*'}];
     1175        end
     1176end
     1177
    10801178%------------------------------------------------------------------------
    10811179function num_first_i_Callback(hObject, eventdata, handles)
     
    11101208end
    11111209displ_time(handles);
    1112 
    11131210
    11141211%------------------------------------------------------------------------
     
    11721269%------------------------------------------------------------------------   
    11731270if numel(eventdata.Indices)>=1
    1174 set(handles.ListView,'Value',eventdata.Indices(1))% detect the selected raw index
    1175 ListView_Callback ([],[],handles) % update the list of available pairs
    1176 end
    1177 
    1178 %------------------------------------------------------------------------
    1179 %------------------------------------------------------------------------
    1180 %  III - FUNCTIONS ASSOCIATED TO THE FRAME SET PAIRS
    1181 %------------------------------------------------------------------------
    1182 %------------------------------------------------------------------------
    1183 % --- Executes on selection change in ListView.
    1184 function ListView_Callback(hObject, eventdata, handles)
    1185 %------------------------------------------------------------------------   
    1186 SeriesData=get(handles.series,'UserData');
    1187 i2_series=[];
    1188 j2_series=[];
    1189 iview=get(handles.ListView,'Value');
    1190 if ~isempty(SeriesData.i2_series{iview})
    1191     i2_series=SeriesData.i2_series{iview};
    1192 end
    1193 if ~isempty(SeriesData.j2_series{iview})
    1194     j2_series=SeriesData.j2_series{iview};
    1195 end
    1196 update_mode(handles,SeriesData.i1_series{iview},SeriesData.i2_series{iview},...
    1197     SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.Time{iview})
    1198 
    1199 %------------------------------------------------------------------------
    1200 % --- Executes on button press in mode.
    1201 function mode_Callback(hObject, eventdata, handles)
    1202 %------------------------------------------------------------------------       
    1203 SeriesData=get(handles.series,'UserData');
    1204 iview=get(handles.ListView,'Value');
    1205 mode_list=get(handles.mode,'String');
    1206 mode=mode_list{get(handles.mode,'Value')};
    1207 if isequal(mode,'bursts')
    1208     enable_i(handles,'On')
    1209     enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice)
    1210 else
    1211     enable_i(handles,'On')
    1212     enable_j(handles,'Off')
    1213 end
    1214 fill_ListPair(handles,SeriesData.i1_series{iview},SeriesData.i2_series{iview},...
    1215     SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.Time{iview})
    1216 ListPairs_Callback([],[],handles)
    1217 
    1218 %-------------------------------------------------------------
    1219 % --- Executes on selection in ListPairs.
    1220 function ListPairs_Callback(hObject,eventdata,handles)
    1221 %------------------------------------------------------------
    1222 list_pair=get(handles.ListPairs,'String');%get the menu of image pairs
    1223 if isempty(list_pair)
    1224     string='';
    1225 else
    1226     string=list_pair{get(handles.ListPairs,'Value')};
    1227     string=regexprep(string,',.*','');%removes time indication (after ',')
    1228 end
    1229 PairString=get(handles.PairString,'Data');
    1230 iview=get(handles.ListView,'Value');
    1231 PairString{iview,1}=string;
    1232 % report the selected pair string to the table PairString
    1233 set(handles.PairString,'Data',PairString)
    1234 
    1235 
    1236 %------------------------------------------------------------------------
    1237 function update_mode(handles,i1_series,i2_series,j1_series,j2_series,time)
    1238 %------------------------------------------------------------------------   
    1239 % check_burst=0;
    1240 ModeMenu={''};
    1241 if isempty(j2_series)% no j pair
    1242     ModeValue=1;
    1243     if isempty(i2_series)
    1244         set(handles.mode,'String',{''})% no pair menu to display
    1245     else   
    1246         set(handles.mode,'Value',1)
    1247         ModeMenu={'series(Di)'}; % pair menu with only option Di
    1248     end
    1249 else %existence of j pairs
    1250     pair_max=squeeze(max(i1_series,[],1)); %max on pair index
    1251     j_max=max(pair_max,[],1);
    1252     MaxIndex_i=max(find(j_max))-1;% max ref index i
    1253     MinIndex_i=min(find(j_max))-1;% min ref index i
    1254     i_max=max(pair_max,[],2);
    1255     MaxIndex_j=max(find(i_max))-1;% max ref index i
    1256     MinIndex_j=min(find(i_max))-1;% min ref index i
    1257     if MaxIndex_j==MinIndex_j
    1258         ModeValue=1;
    1259         ModeMenu={'bursts'};
    1260     elseif MaxIndex_i==MinIndex_i
    1261     ModeValue=1;
    1262     ModeMenu={'series(Dj)'};
    1263     else
    1264         ModeMenu={'bursts';'series(Dj)'};
    1265         if (MaxIndex_j-MinIndex_j)>10
    1266             ModeValue=2;%set mode to series(Dj) if more than 10 j values
    1267         else
    1268             ModeValue=1;
    1269         end
    1270     end
    1271 end
    1272 
    1273 set(handles.mode,'String',ModeMenu)
    1274 set(handles.mode,'Value',ModeValue)
    1275 SeriesData=get(handles.series,'UserData');
    1276 SeriesData.ModeMenu=ModeMenu;
    1277 SeriesData.ModeValue=ModeValue;
    1278 set(handles.series,'UserData',SeriesData)
    1279 fill_ListPair(handles,i1_series,i2_series,j1_series,j2_series,time)
    1280 ListPairs_Callback([],[],handles)
    1281 
    1282 %--------------------------------------------------------------
    1283 % determine the menu for pairstring depending on existing netcdf files
    1284 % with the reference indices num_ref_i and num_ref_j
    1285 %----------------------------------------------------------------
    1286 function fill_ListPair(handles,i1_series,i2_series,j1_series,j2_series,time)
    1287 
    1288 mode_list=get(handles.mode,'String');
    1289 mode=mode_list{get(handles.mode,'Value')};
    1290 ref_i=str2num(get(handles.num_ref_i,'String'));
    1291 if isempty(ref_i)
    1292     ref_i=1;
    1293 end
    1294 if strcmp(get(handles.num_ref_j,'Visible'),'on')
    1295     ref_j=str2num(get(handles.num_ref_j,'String'));
    1296     if isempty(ref_j)
    1297         ref_j=1;
    1298     end
    1299 else
    1300     ref_j=1;
    1301 end
    1302 TimeUnit=get(handles.TimeUnit,'String');
    1303 if length(TimeUnit)>=1
    1304     dtunit=['m' TimeUnit];
    1305 else
    1306     dtunit='e-03';
    1307 end
    1308 
    1309 displ_pair={};
    1310 if strcmp(mode,'series(Di)')
    1311     if isempty(i2_series)
    1312         msgbox_uvmat('ERROR','no i1-i2 pair available')
    1313         return
    1314     end
    1315     diff_i=i2_series-i1_series;
    1316     min_diff=min(diff_i(diff_i>0));
    1317     max_diff=max(diff_i(diff_i>0));
    1318     for ipair=min_diff:max_diff
    1319         if numel(diff_i(diff_i==ipair))>0
    1320             pair_string=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ];
    1321             if ~isempty(time)
    1322                 if ref_i<=floor(ipair/2)
    1323                     ref_i=floor(ipair/2)+1;% shift ref_i to get the first pair
    1324                 end
    1325                 Dt=time(ref_i+ceil(ipair/2),ref_j)-time(ref_i-floor(ipair/2),ref_j);
    1326                 pair_string=[pair_string ', Dt=' num2str(Dt) ' ' dtunit];
    1327             end
    1328             displ_pair=[displ_pair;{pair_string}];
    1329         end
    1330     end
    1331     if ~isempty(displ_pair)
    1332         displ_pair=[displ_pair;{'Di=*|*'}];
    1333     end
    1334 elseif strcmp(mode,'series(Dj)')
    1335     if isempty(j2_series)
    1336         msgbox_uvmat('ERROR','no j1-j2 pair available')
    1337         return
    1338     end
    1339     diff_j=j2_series-j1_series;
    1340     min_diff=min(diff_j(diff_j>0));
    1341     max_diff=max(diff_j(diff_j>0));
    1342     for ipair=min_diff:max_diff
    1343         if numel(diff_j(diff_j==ipair))>0
    1344             pair_string=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ];
    1345             if ~isempty(time)
    1346                 if ref_j<=floor(ipair/2)
    1347                     ref_j=floor(ipair/2)+1;% shift ref_i to get the first pair
    1348                 end
    1349                 Dt=time(ref_i,ref_j+ceil(ipair/2))-time(ref_i,ref_j-floor(ipair/2));
    1350                 pair_string=[pair_string ', Dt=' num2str(Dt) ' ' dtunit];
    1351             end
    1352             displ_pair=[displ_pair;{pair_string}];
    1353         end
    1354     end
    1355     if ~isempty(displ_pair)
    1356         displ_pair=[displ_pair;{'Dj=*|*'}];
    1357     end
    1358 elseif strcmp(mode,'bursts')
    1359     if isempty(j2_series)
    1360         msgbox_uvmat('ERROR','no j1-j2 pair available')
    1361         return
    1362     end
    1363     diff_j=j2_series-j1_series;
    1364     min_j1=min(j1_series(j1_series>0));
    1365     max_j1=max(j1_series(j1_series>0));
    1366     min_j2=min(j2_series(j2_series>0));
    1367     max_j2=max(j2_series(j2_series>0));
    1368     for pair1=min_j1:min(max_j1,min_j1+20)
    1369         for pair2=min_j2:min(max_j2,min_j2+20)
    1370         if numel(j1_series(j1_series==pair1))>0 && numel(j2_series(j2_series==pair2))>0
    1371             displ_pair=[displ_pair;{['j= ' num2str(pair1) '-' num2str(pair2)]}];
    1372         end
    1373         end
    1374     end
    1375     if ~isempty(displ_pair)
    1376         displ_pair=[displ_pair;{'j=*-*'}];
    1377     end
    1378 end
    1379 set(handles.num_ref_i,'String',num2str(ref_i)) % update ref_i and ref_j
    1380 set(handles.num_ref_j,'String',num2str(ref_j))
    1381 
    1382 %% display list of pairstring
    1383 SeriesData=get(handles.series,'UserData');
    1384 displ_pair_list=get(handles.ListPairs,'String');
    1385 NewVal=[];
    1386 if ~isempty(displ_pair_list)
    1387 Val=get(handles.ListPairs,'Value');
    1388 NewVal=find(strcmp(displ_pair_list{Val},displ_pair),1);% look at the previous display in the new menu displ_pï¿œir
    1389 end
    1390 if ~isempty(NewVal)
    1391     set(handles.ListPairs,'Value',NewVal)
    1392     SeriesData.ListPairsValue=NewVal;
    1393 else
    1394     set(handles.ListPairs,'Value',1)
    1395     SeriesData.ListPairsValue=1;
    1396 end
    1397 set(handles.ListPairs,'String',displ_pair)
    1398 SeriesData.ListPairsMenu=displ_pair;
    1399 set(handles.series,'UserData',SeriesData);
     1271    PairString=get(hObject,'Data');
     1272    if ~isempty(PairString{eventdata.Indices(1)})
     1273        SetPairs_Callback(hObject, eventdata.Indices(1), handles)
     1274    end
     1275end
    14001276
    14011277%-------------------------------------
     
    14051281set(handles.num_last_i,'Visible',state)
    14061282set(handles.num_incr_i,'Visible',state)
    1407 set(handles.num_ref_i,'Visible',state)
    1408 set(handles.ref_i_text,'Visible',state)
    14091283
    14101284%-----------------------------------
     
    14141288set(handles.num_last_j,'Visible',state)
    14151289set(handles.num_incr_j,'Visible',state)
    1416 set(handles.num_ref_j,'Visible',state)
    1417 set(handles.ref_j_text,'Visible',state)
    14181290set(handles.MinIndex_j,'Visible',state)
    14191291set(handles.MaxIndex_j,'Visible',state)
     
    20691941end
    20701942
    2071 %% Detect the types of input files
     1943
     1944%% Visibility of VelType and VelType_1 menus asked by ActionName
     1945VelTypeRequest=1;%VelType requested by default
     1946VelTypeRequest_1=1;%VelType requested by default
     1947if isfield(ParamOut,'VelType')
     1948    VelTypeRequest=ismember(ParamOut.VelType,{'on','one','two'});
     1949    VelTypeRequest_1=strcmp( ParamOut.VelType,'two');
     1950end
     1951FieldNameRequest=0;  %hidden by default
     1952FieldNameRequest_1=0;  %hidden by default
     1953if isfield(ParamOut,'FieldName')
     1954    FieldNameRequest=ismember(ParamOut.FieldName,{'on','one','two'});
     1955    FieldNameRequest_1=strcmp( ParamOut.FieldName,'two');
     1956end
     1957
     1958%% Detect the types of input files and set menus and default options in 'VelType'
    20721959SeriesData=get(handles.series,'UserData');% info on the input file series
    2073 iview_civ=[];nb_netcdf=0;
    2074 if ~isempty(SeriesData)&&isfield(SeriesData,'FileType')
    2075     iview_civ=find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType));
    2076     nb_netcdf=numel(find(strcmp('netcdf',SeriesData.FileType)));
    2077 end
    2078 if numel(iview_civ)>=1 && ~isempty(iview_civ(1))
     1960iview_civ=find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType));
     1961iview_netcdf=find(strcmp('netcdf',SeriesData.FileType)|strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType));% all nc files, icluding civ
     1962FieldList=get(handles.FieldName,'String');% previous list as default
     1963FieldList_1=get(handles.FieldName_1,'String');% previous list as default
     1964CheckList=0;% indicate whether FieldName has been updated
     1965CheckList_1=1;% indicate whether FieldName_1 has been updated
     1966handles_coord=[handles.Coord_x handles.Coord_y handles.Coord_z handles.Coord_x_title handles.Coord_y_title handles.Coord_z_title];
     1967if VelTypeRequest && numel(iview_civ)>=1
    20791968    menu=set_veltype_display(SeriesData.FileInfo{iview_civ(1)}.CivStage,SeriesData.FileType{iview_civ(1)});
    20801969    set(handles.VelType,'Value',1)% set first choice by default
    20811970    set(handles.VelType,'String',[{'*'};menu])
    2082     if numel(iview_civ)>=2
     1971    set(handles.VelType,'Visible','on')
     1972    set(handles.VelType_title,'Visible','on')
     1973    FieldList=[set_field_list('U','V');{'C'};{'get_field...'}];%standard menu for civx data
     1974    CheckList=1;
     1975    set(handles.FieldName,'Value',1); %velocity vector choice by default
     1976    if  VelTypeRequest_1 && numel(iview_civ)>=2
    20831977        menu=set_veltype_display(SeriesData.FileInfo{iview_civ(2)}.CivStage,SeriesData.FileType{iview_civ(2)});
    20841978        set(handles.VelType_1,'Value',1)% set first choice by default
    20851979        set(handles.VelType_1,'String',[{'*'};menu])
    2086     end
    2087 end       
     1980        set(handles.VelType_1,'Visible','on')
     1981        set(handles.VelType_title_1,'Visible','on')
     1982        FieldList_1=[set_field_list('U','V');{'C'};{'get_field...'}];%standard menu for civx data
     1983        CheckList_1=1;
     1984        set(handles.FieldName_1,'Value',1); %velocity vector choice by default
     1985    else
     1986        set(handles.VelType_1,'Visible','off')
     1987        set(handles.VelType_title_1,'Visible','off')
     1988    end
     1989else
     1990    set(handles.VelType,'Visible','off')
     1991    set(handles.VelType_title,'Visible','off')
     1992end   
     1993
     1994%% Detect the types of input files and set menus and default options in 'FieldName'
     1995if FieldNameRequest && numel(iview_netcdf)>=1
     1996    set(handles.InputFields,'Visible','on')
     1997%     set(handles.FieldName,'Visible','on')
     1998    if CheckList==0        % not civ input made
     1999        ListVarName=SeriesData.FileInfo{iview_netcdf(1)}.ListVarName;
     2000        ind_var=get(handles.FieldName,'Value');%indices of previously selected variables
     2001        for ilist=1:numel(ind_var)
     2002            if isempty(find(strcmp(FieldList{ind_var(ilist)},ListVarName)))
     2003                FieldList={};% previous choice not consistent with new input field
     2004                set(handles.FieldName,'Value',1)
     2005                break
     2006            end
     2007        end
     2008        if ~isempty(FieldList)
     2009            if isempty(find(strcmp(get(handles.Coord_x,'String'),ListVarName)))||...
     2010                    isempty(find(strcmp(get(handles.Coord_y,'String'),ListVarName)))
     2011                FieldList={};
     2012                set(handles.Coord_x,'String','')
     2013                set(handles.Coord_y,'String','')
     2014            end
     2015            Coord_z=get(handles.Coord_z,'String');
     2016            if ~isempty(Coord_z) && isempty(find(strcmp(Coord_z,ListVarName)))
     2017                FieldList={};
     2018                set(handles.Coord_z,'String','')
     2019            end
     2020        end
     2021        set(handles_coord,'Visible','on')
     2022        FieldList=[FieldList;{'get_field...'}];
     2023        if FieldNameRequest_1 && numel(iview_netcdf)>=2
     2024            set(handles.FieldName_1,'Visible','on')
     2025            if CheckList_1==0        % not civ input made
     2026                ListVarName=SeriesData.FileInfo{iview_netcdf(2)}.ListVarName;
     2027                ind_var=get(handles.FieldName,'Value');%indices of previously selected variables
     2028                for ilist=1:numel(ind_var)
     2029                    if isempty(find(strcmp(FieldList{ind_var(ilist)},ListVarName)))
     2030                        FieldList_1={};% previous choice not consistent with new input field
     2031                        set(handles.FieldName_1,'Value',1)
     2032                        break
     2033                    end
     2034                end
     2035                warn_coord=0;
     2036                if isempty(find(strcmp(get(handles.Coord_x,'String'),ListVarName)))||...
     2037                        isempty(find(strcmp(get(handles.Coord_y,'String'),ListVarName)))
     2038                    warn_coord=1;
     2039                end
     2040                if ~isempty(Coord_z) && isempty(find(strcmp(Coord_z,ListVarName)))
     2041                    FieldList_1={};
     2042                    warn_coord=1;
     2043                end
     2044                if warn_coord
     2045                    msgbox_uvmat('WARNING','coordiante names do not exist in the second netcdf input file')
     2046                end
     2047                set(handles.FieldName,'String',[FieldList;{'get_field...'}])
     2048                set(handles.FieldName_1,'Visible','on')
     2049                set(handles.FieldName_1,'Value',1)
     2050                set(handles.FieldName_1,'String',FieldList_1)
     2051            end
     2052        else
     2053            set(handles.FieldName_1,'Visible','off')
     2054        end
     2055    else
     2056        set(handles_coord,'Visible','off')% no coord display for civ data
     2057    end
     2058    set(handles.FieldName,'String',FieldList)
     2059else
     2060    set(handles.InputFields,'Visible','off')
     2061end
     2062
    20882063
    20892064%% Check whether alphabetical sorting of input Subdir is allowed by the Action fct  (for multiples series entries)
     
    21212096    if isfield(Param.IndexRange,'first_i')
    21222097        first_i=Param.IndexRange.first_i;
    2123        % incr_i=Param.IndexRange.incr_i;
    21242098        last_i=Param.IndexRange.last_i;
    21252099    end
    21262100    if isfield(Param.IndexRange,'first_j')
    21272101        first_j=Param.IndexRange.first_j;
    2128        % incr_j=Param.IndexRange.incr_j;
    21292102        last_j=Param.IndexRange.last_j;
    21302103    end
     
    21332106end
    21342107
    2135 %% desable j index if if set by the civ_input GUI
     2108%% enable or desable j index visibility
     2109status_j='on';%default
    21362110if isfield(ParamOut,'Desable_j_index')&&isequal(ParamOut.Desable_j_index,'on')
    2137     set(handles.num_first_j,'Enable','off')
    2138     set(handles.num_last_j,'Enable','off')
    2139     set(handles.num_incr_j,'Enable','off')
    2140     set(handles.num_incr_j,'String','')
    2141 else
    2142    set(handles.num_first_j,'Enable','on')
    2143     set(handles.num_last_j,'Enable','on')
    2144     set(handles.num_incr_j,'Enable','on')
    2145 end
     2111    status_j='off';
     2112end
     2113if isempty(find(~cellfun(@isempty,SeriesData.j1_series), 1)); % case of empty j indices
     2114    status_j='off'; % no j index needed
     2115elseif strcmp(get(handles.PairString,'Visible'),'on')
     2116    check_burst=cellfun(@isempty,regexp(get(handles.PairString,'Data'),'^j'));%=0 for burst case, 1 otherwise
     2117    if isempty(find(check_burst, 1))% if all pair string begins by j (burst)
     2118        status_j='off'; % no j index needed for bust case
     2119    end
     2120end
     2121enable_j(handles,status_j) % no j index needed
     2122
    21462123
    21472124%% NbSlice visibility
     
    21562133set(handles.NbSlice_title,'Visible',NbSliceVisible)
    21572134
    2158 %% Visibility of VelType and VelType_1 menus
    2159 VelTypeVisible='off';  %hidden by default
    2160 VelType_1Visible='off';
    2161 InputFieldsVisible='off';%visibility of the frame Fields
    2162 if isfield(ParamOut,'VelType')
    2163     if strcmp( ParamOut.VelType,'on')||strcmp(ParamOut.VelType,'one')||strcmp( ParamOut.VelType,'two')
    2164         if numel(iview_civ)>=1
    2165             VelTypeVisible='on';
    2166             InputFieldsVisible='on';
    2167         end
    2168     end
    2169     if strcmp( ParamOut.VelType,'two')
    2170         if numel(iview_civ)>=2
    2171             VelType_1Visible='on';
    2172         end
    2173     end
    2174 end
    2175 set(handles.VelType,'Visible',VelTypeVisible)
    2176 set(handles.VelType_text,'Visible',VelTypeVisible);
    2177 set(handles.VelType_1,'Visible',VelType_1Visible)
    2178 set(handles.VelType_text_1,'Visible',VelType_1Visible);
    2179 
    2180 %% Visibility of FieldName and FieldName_1 menus
    2181 FieldNameVisible='off';  %hidden by default
    2182 FieldName_1Visible='off';  %hidden by default
    2183 if isfield(ParamOut,'FieldName')
    2184     if strcmp( ParamOut.FieldName,'on') || strcmp(ParamOut.FieldName,'one')||strcmp( ParamOut.FieldName,'two')
    2185         if (numel(iview_civ)+nb_netcdf)>=1
    2186             InputFieldsVisible='on';
    2187             FieldNameVisible='on';
    2188         end
    2189     end
    2190     if strcmp( ParamOut.FieldName,'two')
    2191         if (numel(iview_civ)+nb_netcdf)>=1
    2192             FieldName_1Visible='on';
    2193         end
    2194     end
    2195 end
    2196 set(handles.InputFields,'Visible',InputFieldsVisible)
    2197 set(handles.FieldName,'Visible',FieldNameVisible) % test for MenuBorser
    2198 set(handles.FieldName_1,'Visible',FieldName_1Visible)
     2135
    21992136
    22002137%% Visibility of FieldTransform menu
     
    22302167    MaskVisible=ParamOut.Mask;
    22312168end
    2232 %set(handles.Mask,'Visible',MaskVisible)
    22332169set(handles.CheckMask,'Visible',MaskVisible);
    22342170
     
    22722208%% definition of an additional parameter set, determined by an ancillary GUI
    22732209if isfield(ParamOut,'ActionInput')
    2274 %     set(handles.ActionInput,'Visible','on')
    2275 %     set(handles.ActionInput_title,'Visible','on')
    22762210    set(handles.ActionInput,'Visible','on')
    2277  %   set(handles.ActionInput,'Value',0)
    2278 %     set(handles.ActionInput,'String',ActionName)
    22792211    ParamOut.ActionInput.Program=ActionName; % record the program in ActionInput
    22802212    SeriesData.ActionInput=ParamOut.ActionInput;
    22812213else
    2282 %     set(handles.ActionInput,'Visible','off')
    2283 %     set(handles.ActionInput_title,'Visible','off')
    22842214    set(handles.ActionInput,'Visible','off')
    22852215    if isfield(SeriesData,'ActionInput')
    2286     SeriesData=rmfield(SeriesData,'ActionInput');
    2287     end
    2288 end   
     2216        SeriesData=rmfield(SeriesData,'ActionInput');
     2217    end
     2218end
    22892219set(handles.series,'UserData',SeriesData)
    22902220set(handles.ActionName,'BackgroundColor',[1 1 1])
     
    23472277                YName='y';
    23482278                set(handles.VelType,'visible','on')
     2279                set(handles.VelType_title,'visible','on')
    23492280        end
    23502281        set(handles.FieldName,'Value',1)
     
    23532284            set(handles.FieldName,'Value',1:numel(FieldList))%select all input fields by default
    23542285            set(handles.VelType,'visible','off')
     2286            set(handles.VelType_title,'visible','off')
    23552287            XName=GetFieldData.Coordinates.Coord_x;
    23562288            YName=GetFieldData.Coordinates.Coord_y;
     
    27142646function MenuHelp_Callback(hObject, eventdata, handles)
    27152647%-------------------------------------------------------------------
    2716 path_to_uvmat=which ('uvmat');% check the path of uvmat
    2717 pathelp=fileparts(path_to_uvmat);
    2718 helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html');
    2719 if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package')
    2720 else
    2721     addpath (fullfile(pathelp,'uvmat_doc'))
    2722     web([helpfile '#series'])
    2723 end
     2648web('http://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/wiki/UvmatHelp#series')
     2649% path_to_uvmat=which ('uvmat');% check the path of uvmat
     2650% pathelp=fileparts(path_to_uvmat);
     2651% helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html');
     2652% if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package')
     2653% else
     2654%     addpath (fullfile(pathelp,'uvmat_doc'))
     2655%     web([helpfile '#series'])
     2656% end
    27242657
    27252658%-------------------------------------------------------------------
     
    27742707% --- fct activated by the upper bar menu ExportConfig
    27752708%------------------------------------------------------------------------
    2776 function MenuExportConfig_Callback(hObject, eventdata, handles)
     2709function MenuDisplayConfig_Callback(hObject, eventdata, handles)
    27772710
    27782711global Param
     
    27882721%------------------------------------------------------------------------
    27892722function MenuImportConfig_Callback(hObject, eventdata, handles)
    2790 % SeriesData=get(handles.series,'UserData');
    2791 % if isfield(SeriesData,'RefFile')
    2792 %     oldfile=SeriesData.RefFile{1};
    2793 % end
    2794 %% use a strating file name for browserr
     2723
     2724%% use a starting file name for browserr
    27952725InputTable=get(handles.InputTable,'Data');
    27962726oldfile=InputTable{1,1};
     
    28302760        set(handles.ActionInput,'Visible','on')
    28312761        set(handles.ActionInput,'Value',0)
     2762        Param.ActionInput.ConfigSource=filexml;% record the source of config for future info
    28322763        SeriesData.ActionInput=Param.ActionInput;
    28332764    end
     
    31363067
    31373068% --- Executes on button press in SetPairs.
    3138 function SetPairs_Callback(hObject, eventdata, handles)
     3069function SetPairs_Callback(hObject, iview, handles)
     3070
     3071%% delete previous occurrence of 'set_pairs'
     3072hfig=findobj(allchild(0),'Tag','set_pairs');
     3073if ~isempty(hfig)
     3074delete(hfig)
     3075end
    31393076
    31403077%% create the GUI set_pairs
     
    31493086hfig=figure('name','set_pairs','tag','set_pairs','MenuBar','none','NumberTitle','off','Unit','points','Position',[Left,Bottom,Width,Height]);
    31503087BackgroundColor=get(hfig,'Color');
    3151 hh=0.14; % box height (relative)
    3152 ii=0.01; % gap between uicontrols
    3153 
    3154 ww=0.9; % box width (relative)
    31553088SeriesData=get(handles.series,'UserData');
     3089TimeUnit=get(handles.TimeUnit,'String');
     3090PairString=get(handles.PairString,'Data');
     3091ListViewLines=find(cellfun('isempty',PairString)==0);%find list of non empty pairs
     3092ListViewMenu=cell(numel(ListViewLines),1);
     3093for ilist=1:numel(ListViewLines)
     3094    ListViewMenu{ilist}=num2str(ListViewLines(ilist));
     3095end
     3096if isempty(iview)
     3097    ListViewValue=numel(ListViewLines);% we work by default on the pair option for the last line which requires pairs
     3098    iview=ListViewLines(end);
     3099else
     3100    ListViewValue=find(ListViewLines==iview);
     3101end
     3102[ModeMenu,ModeValue]=update_mode(SeriesData.i1_series{iview},SeriesData.i2_series{iview},SeriesData.j2_series{iview});
     3103displ_pair=update_listpair(SeriesData.i1_series{iview},SeriesData.i2_series{iview},SeriesData.j1_series{iview},SeriesData.j2_series{iview},ModeMenu{ModeValue},...
     3104                                                     SeriesData.Time{iview},TimeUnit,SeriesData.ref_i,SeriesData.ref_j);
    31563105% first raw of the GUI
    31573106uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.88 0.5 0.1],'BackgroundColor',BackgroundColor,...
    31583107    'String','row to edit #','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right');%title
    3159 uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.54 0.8 0.3 0.2],'tag','ListView','BackgroundColor',[1 1 1],...
    3160     'String',SeriesData.ListViewMenu,'Value',SeriesData.ListViewValue,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''ListView'':choice of the file series w for pair display');
     3108uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.54 0.8 0.3 0.2],'BackgroundColor',[1 1 1],...
     3109    'Callback',@(hObject,eventdata)ListView_Callback(hObject,eventdata),'String',ListViewMenu,'Value',ListViewValue,'FontUnits','points','FontSize',12,'FontWeight','bold',...
     3110    'Tag','ListView','TooltipString','''ListView'':choice of the file series w for pair display');
    31613111% second raw of the GUI
    31623112uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.79 0.7 0.1],'BackgroundColor',BackgroundColor,...
    31633113    'String','mode of index pairing:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left');%title
    3164 uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.05 0.62 ww 0.2],'tag','Mode','BackgroundColor',[1 1 1],'Callback',@(hObject,eventdata)ModeMenu_Callback(hObject,eventdata),...
    3165     'String',SeriesData.ModeMenu,'Value',SeriesData.ModeValue,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''Mode'': choice of the image pair mode');
     3114uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.05 0.62 0.9 0.2],'BackgroundColor',[1 1 1],...
     3115    'Callback',@(hObject,eventdata)Mode_Callback(hObject,eventdata),'String',ModeMenu,'Value',ModeValue,'FontUnits','points','FontSize',12,'FontWeight','bold',...
     3116    'Tag','Mode','TooltipString','''Mode'': choice of the image pair mode');
    31663117% third raw
    31673118uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.6 0.7 0.1],'BackgroundColor',BackgroundColor,...
    31683119    'String','pair choice:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left');%title
    3169 uicontrol('Style','listbox','Units','normalized', 'Position', [0.05 0.42 ww 0.2],'tag','ListPairs','BackgroundColor',[1 1 1],'Callback',@(hObject,eventdata)ListPairsMenu_Callback(hObject,eventdata),...
    3170     'String',SeriesData.ListPairsMenu,'Value',SeriesData.ListPairsValue,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''ListPairs'': menu for selecting the image pair');
     3120uicontrol('Style','listbox','Units','normalized', 'Position', [0.05 0.42 0.9 0.2],'BackgroundColor',[1 1 1],...
     3121    'Callback',@(hObject,eventdata)ListPair_Callback(hObject,eventdata),'String',displ_pair,'Value',1,'FontUnits','points','FontSize',12,'FontWeight','bold',...
     3122    'Tag','ListPair','TooltipString','''ListPair'': menu for selecting the image pair');
    31713123uicontrol('Style','text','Units','normalized', 'Position', [0.1 0.22 0.8 0.1],'BackgroundColor',BackgroundColor,...
    31723124    'String','ref_i           ref_j','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title
    3173 uicontrol('Style','edit','Units','normalized', 'Position', [0.15 0.17 0.3 0.08],'tag','num_ref_i','BackgroundColor',[1 1 1],'Callback',@(hObject,eventdata)num_ref_i_Callback(hObject,eventdata),...
    3174     'String',num2str(SeriesData.ref_i),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_ref_i'': reference field index i used to display dt in ''list_pair_civ''');
    3175 uicontrol('Style','edit','Units','normalized', 'Position', [0.55 0.17 0.3 0.08],'tag','num_ref_j','BackgroundColor',[1 1 1],'Callback',@(hObject,eventdata)num_ref_j_Callback(hObject,eventdata),...
    3176     'String',num2str(SeriesData.ref_j),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_ref_j'': reference field index i used to display dt in ''list_pair_civ''');
     3125uicontrol('Style','edit','Units','normalized', 'Position', [0.15 0.17 0.3 0.08],'BackgroundColor',[1 1 1],...
     3126    'Callback',@(hObject,eventdata)num_ref_i_Callback(hObject,eventdata),'String',num2str(SeriesData.ref_i),'FontUnits','points','FontSize',12,'FontWeight','bold',...
     3127    'Tag','num_ref_i','TooltipString','''num_ref_i'': reference field index i used to display dt in ''list_pair_civ''');
     3128uicontrol('Style','edit','Units','normalized', 'Position', [0.55 0.17 0.3 0.08],'BackgroundColor',[1 1 1],...
     3129    'Callback',@(hObject,eventdata)num_ref_j_Callback(hObject,eventdata),'String',num2str(SeriesData.ref_j),'FontUnits','points','FontSize',12,'FontWeight','bold',...
     3130    'Tag','num_ref_j','TooltipString','''num_ref_j'': reference field index i used to display dt in ''list_pair_civ''');
    31773131%  last raw  of the GUI: pushbuttons
    3178 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.35 0.01 0.3 0.15],'BackgroundColor',[0 1 0],'String','OK','Callback',@(hObject,eventdata)OK_Callback(hObject,eventdata),...
    3179     'FontWeight','bold','FontUnits','points','FontSize',12,'TooltipString','''OK'': apply the output to the current field series in uvmat');
     3132% uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.35 0.01 0.3 0.15],'BackgroundColor',[0 1 0],'String','OK','Callback',@(hObject,eventdata)OK_Callback(hObject,eventdata),...
     3133%     'FontWeight','bold','FontUnits','points','FontSize',12,'TooltipString','''OK'': apply the output to the current field series in uvmat');
    31803134drawnow
    31813135
    3182 function ModeMenu_Callback(hObject,eventdata)
    3183 hseries=findobj(allchild(0),'tag','series');
    3184 hhseries=guidata(hseries);
     3136%------------------------------------------------------------------------
     3137function ListView_Callback(hObject,eventdata)
     3138Mode_Callback(hObject,eventdata)
     3139
     3140%------------------------------------------------------------------------   
     3141function Mode_Callback(hObject,eventdata)
     3142%% get input info
     3143hseries=findobj(allchild(0),'tag','series');%handles of the GUI series
     3144hhseries=guidata(hseries);%handles of the elements in the GUI series
     3145TimeUnit=get(hhseries.TimeUnit,'String');
    31853146SeriesData=get(hseries,'UserData');
     3147mode_list=get(hObject,'String');
     3148mode=mode_list{get(hObject,'Value')};
    31863149hListView=findobj(get(hObject,'parent'),'Tag','ListView');
    31873150iview=get(hListView,'Value');
    3188 hMode=findobj(get(hObject,'parent'),'Tag','Mode');
    3189 mode_list=get(hMode,'String');
    3190 mode=mode_list{get(hMode,'Value')};
    3191 if isequal(mode,'bursts')
    3192     enable_i(hhseries,'On')
    3193     enable_j(hhseries,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice)
    3194 else
    3195     enable_i(hhseries,'On')
    3196     enable_j(hhseries,'Off')
    3197 end
    3198 fill_ListPair(hhseries,SeriesData.i1_series{iview},SeriesData.i2_series{iview},...
    3199     SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.Time{iview})
    3200 ListPairs_Callback([],[],hhseries)
     3151i1_series=SeriesData.i1_series{iview};
     3152i2_series=SeriesData.i2_series{iview};
     3153j1_series=SeriesData.j1_series{iview};
     3154j2_series=SeriesData.j2_series{iview};
     3155
     3156%% enable j index visibility after the new choice
     3157status_j='on';%default
     3158if isempty(find(~cellfun(@isempty,SeriesData.j1_series), 1)); % case of empty j indices
     3159    status_j='off'; % no j index needed
     3160elseif strcmp(get(handles.PairString,'Visible'),'on')
     3161    check_burst=cellfun(@isempty,regexp(PairString,'^j'));%=0 for burst case, 1 otherwise
     3162    if isempty(find(check_burst, 1))% if all pair string begins by j (burst)
     3163        status_j='off'; % no j index needed for bust case
     3164    end
     3165end
     3166enable_j(handles,status_j) % no j index needed
     3167
     3168%% get the reference indices for the time interval Dt
     3169href_i=findobj(get(hObject,'parent'),'Tag','ref_i');
     3170ref_i=[];ref_j=[];
     3171if strcmp(get(href_i,'Visible'),'on')
     3172    ref_i=str2num(get(href_i,'String'));
     3173end
     3174if isempty(ref_i)
     3175    ref_i=1;
     3176end
     3177if isempty(ref_j)
     3178    ref_j=1;
     3179end
     3180
     3181%% update the menu ListPair
     3182Menu=update_listpair(i1_series,i2_series,j1_series,j2_series,mode,SeriesData.Time{iview},TimeUnit,ref_i,ref_j);
     3183hlist_pairs=findobj(get(hObject,'parent'),'Tag','ListPair');
     3184set(hlist_pairs,'Value',1)% set the first choice by default in ListPair
     3185set(hlist_pairs,'String',Menu)% set the menu in ListPair
     3186ListPair_Callback(hlist_pairs,[])% apply the default choice in ListPair
    32013187
    32023188%-------------------------------------------------------------
    3203 % --- Executes on selection in ListPairs.
    3204 function ListPairsMenu_Callback(hObject,eventdata)
     3189% --- Executes on selection in ListPair.
     3190function ListPair_Callback(hObject,eventdata)
    32053191%------------------------------------------------------------
    32063192list_pair=get(hObject,'String');%get the menu of image pairs
     
    32093195else
    32103196    string=list_pair{get(hObject,'Value')};
    3211     string=regexprep(string,',.*','');%removes time indication (after ',')
     3197   % string=regexprep(string,',.*','');%removes time indication (after ',')
    32123198end
    32133199hseries=findobj(allchild(0),'tag','series');
     
    32203206set(hPairString,'Data',PairString)
    32213207
     3208
    32223209%------------------------------------------------------------------------
    32233210function num_ref_i_Callback(hObject, eventdata)
    32243211%------------------------------------------------------------------------
    3225 hMode=findobj(get(hObject,'parent'),'Tag','Mode');
    3226 mode_list=get(hMode,'String');
    3227 mode=mode_list{get(hMode,'Value')};
    3228 hseries=findobj(allchild(0),'tag','series');
    3229 hhseries=guidata(hseries);
    3230 SeriesData=get(hseries,'UserData');
    3231 hListView=findobj(get(hObject,'parent'),'Tag','ListView');
    3232 iview=get(hListView,'Value');
    3233 fill_ListPair(hhseries,SeriesData.i1_series{iview},SeriesData.i2_series{iview},...
    3234     SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.Time{iview});% update the menu of pairs depending on the available netcdf files
    3235 
    3236 hListPairs=findobj(get(hObject,'parent'),'Tag','ListPairs');
    3237 ListPairsMenu_Callback(hListPairs,eventdata)
     3212Mode_Callback([],[])
    32383213
    32393214%------------------------------------------------------------------------
    32403215function num_ref_j_Callback(hObject, eventdata)
    32413216%------------------------------------------------------------------------
    3242 num_ref_i_Callback(hObject, eventdata)
    3243 
    3244 %-------------------------------------------------------------
    3245 % --- Executes on selection in ListPairs.
    3246 function OK_Callback(hObject,eventdata)
    3247 %------------------------------------------------------------
    3248 delete(get(hObject,'parent'))
     3217Mode_Callback([],[])
     3218
     3219
     3220
     3221function Coord_z_Callback(hObject, eventdata, handles)
     3222% hObject    handle to Coord_z (see GCBO)
     3223% eventdata  reserved - to be defined in a future version of MATLAB
     3224% handles    structure with handles and user data (see GUIDATA)
     3225
     3226% Hints: get(hObject,'String') returns contents of Coord_z as text
     3227%        str2double(get(hObject,'String')) returns contents of Coord_z as a double
     3228
     3229
     3230
     3231% % --- Executes on key press with focus on InputTable and none of its controls.
     3232% function InputTable_KeyPressFcn(hObject, eventdata, handles)
     3233% set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed
     3234% % set(handles.REFRESH_title,'Visible','on')
     3235% iview=eventdata.Indices(1);
     3236% view_set=get(handles.REFRESH,'UserData');
     3237% if isempty(find(view_set==iview))
     3238%     set(handles.REFRESH,'UserData',[view_set iview])
     3239% end
     3240% %% enable other menus and uicontrols
     3241% set(handles.MenuOpenCampaign,'Enable','on')
     3242% set(handles.MenuCampaign_1,'Enable','on')
     3243% set(handles.MenuCampaign_2,'Enable','on')
     3244% set(handles.MenuCampaign_3,'Enable','on')
     3245% set(handles.MenuCampaign_4,'Enable','on')
     3246% set(handles.MenuCampaign_5,'Enable','on')
     3247% set(handles.RUN, 'Enable','On')
     3248% set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red
     3249
     3250
     3251% hObject    handle to InputTable (see GCBO)
     3252% eventdata  structure with the following fields (see UITABLE)
     3253%       Indices: row and column indices of the cell(s) currently selecteds
     3254% handles    structure with handles and user data (see GUIDATA)
  • trunk/src/set_object.m

    r747 r772  
    3636function varargout = set_object(varargin)
    3737
    38 % Last Modified by GUIDE v2.5 13-Apr-2014 19:31:58
     38% Last Modified by GUIDE v2.5 08-May-2014 23:03:29
    3939
    4040% Begin initialization code - DO NOT REFRESH
     
    594594set(handles.num_RangeY_2,'BackgroundColor',[1 1 1])
    595595
    596 % --- Executes on button press in ExportCoord.
    597 function ExportCoord_Callback(hObject, eventdata, handles)
     596% --- Executes on button press in DisplayCoord.
     597function DisplayCoord_Callback(hObject, eventdata, handles)
    598598global Coord
    599599Coord=get(handles.Coord,'Data');
     
    793793    set(handles.Coord,'Data',Coord);
    794794end
    795 
    796 
    797 
    798 
  • trunk/src/uvmat.m

    r771 r772  
    193193AxeData.LimEditBox=1; %initialise AxeData
    194194set(handles.PlotAxes,'UserData',AxeData)
    195 % position of table Coord_y
    196 %set(handles.Coord_y,'Unit','pixel')
    197 % Pos=get(handles.Coord_y,'Position');
    198 % set(handles.Coord_y,'Unit','normalized')
    199 % set(handles.Coord_y,'ColumnWidth',{Pos(3)})
    200 % set(handles.Coord_y,'ColumnFormat',{'char'})
    201 % set(handles.Coord_y,'ColumnEditable',false)
    202 % set(handles.Coord_y,'ColumnName',{''})
    203195
    204196%% set functions for the mouse and keyboard
     
    209201set(hObject,'DeleteFcn',{@closefcn})%
    210202set(hObject,'ResizeFcn',{@ResizeFcn,handles})%
    211 % set(handles.RootPath,'ButtonDownFcn',{'@mouse_down_control'})%set mouse click action function
    212203
    213204%% initialisation
     
    55185509%------------------------------------------------------------------------
    55195510Param=read_param(handles);
     5511Param.HiddenData=get(handles.uvmat,'UserData');
    55205512series(Param); %run the series interface
    55215513
     
    55235515function MenuPIV_Callback(hObject, eventdata, handles)
    55245516    Param=read_param(handles);
    5525 %     Param.ActionName='civ_series';
     5517Param.HiddenData=get(handles.uvmat,'UserData');
    55265518hseries=series(Param);
    55275519hhseries=guidata(hseries);
  • trunk/src/view_field.m

    r752 r772  
    190190    hhuvmat=guidata(huvmat);
    191191    set(hhuvmat.CheckViewField,'Value',0)
    192     %set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree
    193192    % deselect the object in ListObject when view_field is closed
    194193    if isempty(findobj(allchild(0),'Tag','set_object'))
     
    215214    end
    216215end
    217 hciv=findobj(allchild(0),'Tag','civ');%find the current civ GUI
     216hciv=findobj(allchild(0),'Tag','civ_input');%find the current civ GUI
    218217if ~isempty(hciv)
    219218    hhciv=guidata(hciv);
    220219    set(hhciv.TestCiv1,'Value',0)% desactivate  TestCiv1 if on
    221     set(hhciv.TestCiv1,'BackgroundColor',[1 0 0])%
     220    set(hhciv.TestCiv1,'BackgroundColor',[0 1 0])%
    222221end
    223222corrfig=findobj(allchild(0),'tag','corrfig');% look for a civ correlation window used with TesCiv1
  • trunk/src/xml2struct.m

    r697 r772  
    1717errormsg='';
    1818try
    19     t=xmltree(filename);
     19    t=xmltree(filename);% read the file as an xmltree object t
    2020catch ME
    2121    errormsg=ME.message;
     
    4545    end
    4646else
    47     ss=convert(t);
     47    ss=convert(t);%transform the xmltree object into a Matlab structure.
    4848    s=convert_string(ss);
    4949end
     
    6161    case 'char'
    6262        % try to convert to number if the char does not correspond to a function (otherwise str2num calls this function as it uses 'eval')
    63         if ~isempty(regexp(ss,'^(-*\d+\.*\d*\ *)+$')) || ~isempty(regexp(ss,'\d+e(-|+)\d+')) % if the string corresponds to a set of numbers (with possible sign and decimal, or scientific notation) separated by blanks
    64             out=str2num(ss);
     63        if exist(ss,'builtin')||exist(ss,'file')% ss corresponds to the name of a builtin Matlab function or a file
     64            out=ss; %reproduce the input string
    6565        else
    66             sep_ind=regexp(ss,'\s&\s');% check for separator ' & ' which indicates column separation in tables
    67             if ~isempty(sep_ind)
    68                 sep_ind=[-2 sep_ind length(ss)+1];
    69                 out={};
    70                 for icolumn=1:length(sep_ind)-1
    71                     out{1,icolumn}=ss(sep_ind(icolumn)+3:sep_ind(icolumn+1)-1);% get info between separators as a cell array
     66            out=str2num(ss);% convert to number or vector (str2num applied to a fct name executes this fct by 'eval', thus this possibility had to be ruled out above
     67            if isempty(out)
     68                sep_ind=regexp(ss,'\s&\s');% check for separator ' & ' which indicates column separation in tables
     69                if ~isempty(sep_ind)
     70                    sep_ind=[-2 sep_ind length(ss)+1];
     71                    out={};
     72                    for icolumn=1:length(sep_ind)-1
     73                        out{1,icolumn}=ss(sep_ind(icolumn)+3:sep_ind(icolumn+1)-1);% get info between separators as a cell array
     74                    end
     75                else
     76                    out=ss; %reproduce the input string
    7277                end
    73             else
    74                 out=ss; %reproduce the input string
    7578            end
    7679        end
Note: See TracChangeset for help on using the changeset viewer.