Changeset 332


Ignore:
Timestamp:
Dec 13, 2011, 11:20:07 AM (12 years ago)
Author:
sommeria
Message:

NomType? changed from _i1-i2 ... to _1-2 ... (bugs to be expected!)
bug corrected in geometry_calib
series changed by introducing a from FileIndices?, introduction of find_file_series to detect the file series corresponding to an input file

Location:
trunk/src
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r326 r332  
    552552%%  set the menus of image pairs and default selection for civ   %%%%%%%%%%%%%%%%%%%
    553553test_ima_i=numel(nom_type_ima)>1 && isempty(regexp(nom_type_ima(2:end),'\D','once'));%images with single indexing
    554 if test_ima_i || isequal(nom_type_nc,'_i1-i2')||~(exist('nbfield2','var')&&(nbfield2~=1))
     554if test_ima_i || isequal(nom_type_nc,'_1-2')||~(exist('nbfield2','var')&&(nbfield2~=1))
    555555    set(handles.ListPairMode,'Value',1)
    556556    set(handles.ListPairMode,'String',{'series(Di)'})   
     
    16951695end
    16961696if isempty(nom_type_ima2),nom_type_ima2='1';end; %default
    1697 if isempty(nom_type_nc),nom_type_nc='_i1-i2';end; %default
     1697if isempty(nom_type_nc),nom_type_nc='_1-2';end; %default
    16981698[num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=...
    16991699    find_pair_indices(handles,ref_i,ref_j,mode);
     
    30853085    nom_type_ima=browse.nom_type_ima;
    30863086end
    3087 nom_type_nc='_i1-i2';%default
     3087nom_type_nc='_1-2';%default
    30883088if isfield(browse,'nom_type_nc')
    30893089    nom_type_nc=browse.nom_type_nc;
     
    30933093elseif isequal(nom_type_ima,'none')||isequal(nom_type_nc,'none')
    30943094    nom_type_nc='none';
    3095 elseif isequal(nom_type_ima,'avi')||isequal(nom_type_ima,'_i')||isequal(nom_type_ima,'ima_num')||isequal(nom_type_nc,'_i1-i2')
    3096     nom_type_nc='_i1-i2';
     3095elseif isequal(nom_type_ima,'avi')||isequal(nom_type_ima,'_i')||isequal(nom_type_ima,'ima_num')||isequal(nom_type_nc,'_1-2')
     3096    nom_type_nc='_1-2';
    30973097else
    30983098    if  isequal(mode,'series(Di)')%|isequal(mode,'st_series(Di)')
    3099         nom_type_nc='_i1-i2_j'; % PIV in volume
     3099        nom_type_nc='_1-2_1'; % PIV in volume
    31003100    else
    3101         nom_type_nc='_i_j1-j2';
     3101        nom_type_nc='_1_1-2';
    31023102    end
    31033103end
  • trunk/src/geometry_calib.m

    r252 r332  
    275275        delete(hhh);
    276276    end
    277     set(hhuvmat.FixLimits,'Value',0)% put FixedLimits option to 'off'
    278     set(hhuvmat.FixLimits,'BackgroundColor',[0.7 0.7 0.7])
     277    set(hhuvmat.CheckFixLimits,'Value',0)% put FixedLimits option to 'off'
     278    set(hhuvmat.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
    279279    UserData=get(handles.geometry_calib,'UserData');
    280280    UserData.XmlInputFile=outputfile;%save the current xml file name
     
    499499    huvmat=findobj(allchild(0),'Tag','uvmat');
    500500    hhuvmat=guidata(huvmat);
    501     Calib.Cx=str2num(get(hhuvmat.npx,'String'))/2;
    502     Calib.Cx=str2num(get(hhuvmat.npy,'String'))/2;
     501    Calib.Cx=str2num(get(hhuvmat.num_Npx,'String'))/2;
     502    Calib.Cx=str2num(get(hhuvmat.num_Npy,'String'))/2;
    503503end   
    504504%tsai parameters
     
    557557%retrieve the calibration points stored in the files listed in the popup list coord_files
    558558x_1=Coord(:,4:5)';%px coordinates of the ref points
    559 nx=str2num(get(hhuvmat.npx,'String'));
    560 ny=str2num(get(hhuvmat.npy,'String'));
     559nx=str2num(get(hhuvmat.num_Npx,'String'));
     560ny=str2num(get(hhuvmat.num_Npy,'String'));
    561561x_1(2,:)=ny-x_1(2,:);%reverse the y image coordinates
    562562X_1=Coord(:,1:3)';%phys coordinates of the ref points
     
    629629%retrieve the calibration points stored in the files listed in the popup list coord_files
    630630x_1=Coord(:,4:5)';%px coordinates of the ref points
    631 nx=str2num(get(hhuvmat.npx,'String'));
    632 ny=str2num(get(hhuvmat.npy,'String'));
     631nx=str2num(get(hhuvmat.num_Npx,'String'));
     632ny=str2num(get(hhuvmat.num_Npy,'String'));
    633633x_1(2,:)=ny-x_1(2,:);%reverse the y image coordinates
    634634X_1=Coord(:,1:3)';%phys coordinates of the ref points
     
    693693huvmat=findobj(allchild(0),'Tag','uvmat');
    694694hhuvmat=guidata(huvmat);
    695 ny=str2double(get(hhuvmat.npy,'String'));
     695ny=str2double(get(hhuvmat.num_Npy,'String'));
    696696x_1(2,:)=ny-x_1(2,:);%reverse the y image coordinates
    697697n_ima=1;
     
    15961596%     f2=1000;
    15971597%     hhuvmat=guidata(findobj(allchild(0),'Name','uvmat'));
    1598 %     Cx=str2num(get(hhuvmat.npx,'String'))/2;
    1599 %     Cy=str2num(get(hhuvmat.npy,'String'))/2;
     1598%     Cx=str2num(get(hhuvmat.num_Npx,'String'))/2;
     1599%     Cy=str2num(get(hhuvmat.num_Npy,'String'))/2;
    16001600Tabchar={};%default
    16011601val_cal=1;%default
  • trunk/src/mouse_down.m

    r309 r332  
    2424function xy=mouse_down(hObject,eventdata)
    2525
    26 huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle which controls theoption of  mouse action
    27 if isempty(huvmat)
    28     return
    29 end
    30 hhuvmat=guidata(huvmat);%handles of elements in uvmat
    31 UvData=get(huvmat,'UserData');
     26AxeData=[];%default
    3227FigData=get(hObject,'UserData');
    3328if ishandle(FigData)% case of a zoom plot, the handle of the parent rectangle is stored in UserData, its parent is the plotting axes of the rectangle
     
    4136hhcurrentfig=guidata(hcurrentfig);
    4237if isfield(hhcurrentfig,'CheckZoom')
    43 test_zoom=get(hhcurrentfig.CheckZoom,'Value');%test for zoom action, first priority
     38    test_zoom=get(hhcurrentfig.CheckZoom,'Value');%test for zoom action, first priority
    4439else
    4540    test_zoom=0;
    4641end
    47 test_ruler=isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler  action, second priority;
    48 test_edit=get(hhuvmat.edit_object,'Value');%test for object editing, third priority
    49 test_edit_vect=get(hhuvmat.edit_vect,'Value');%test for vector editing,  priority 4
    50 test_create=isequal(get(hhuvmat.MenuObject,'checked'),'on');% test for object creation,  priority 5
    51 if test_create
    52     hset_object=findobj(allchild(0),'tag','set_object');
    53     test_create=~isempty(hset_object)&&~test_edit;
    54 end
    55 test_cal=isequal(get(hhuvmat.MenuCalib,'checked'),'on');% test for calibration
    56 if test_cal% test for calibration popints,  priority 6
    57     h_calib=findobj(allchild(0),'tag','geometry_calib');
    58     if isempty(h_calib)
    59         test_cal=0;
    60         set(hhuvmat.MenuCalib,'checked','off');% test for calibration off
    61     else
    62         hh_calib=guidata(h_calib);
    63         test_cal=get(hh_calib.edit_append,'Value');
    64     end
    65 end
    66 AxeData=[];%default
     42
     43%% look for parameters set by the GUI uvmat
     44test_ruler=0;
     45test_edit=0;
     46test_create=0;
     47huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle which controls theoption of  mouse action
     48if ~isempty(huvmat)
     49    hhuvmat=guidata(huvmat);%handles of elements in uvmat
     50    UvData=get(huvmat,'UserData');
     51    test_ruler=isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler  action, second priority;
     52    test_edit=get(hhuvmat.edit_object,'Value');%test for object editing, third priority
     53    test_edit_vect=get(hhuvmat.edit_vect,'Value');%test for vector editing,  priority 4
     54    test_create=isequal(get(hhuvmat.MenuObject,'checked'),'on');% test for object creation,  priority 5
     55    if test_create
     56        hset_object=findobj(allchild(0),'tag','set_object');
     57        test_create=~isempty(hset_object)&&~test_edit;
     58    end
     59    test_cal=isequal(get(hhuvmat.MenuCalib,'checked'),'on');% test for calibration
     60    if test_cal% test for calibration popints,  priority 6
     61        h_calib=findobj(allchild(0),'tag','geometry_calib');
     62        if isempty(h_calib)
     63            test_cal=0;
     64            set(hhuvmat.MenuCalib,'checked','off');% test for calibration off
     65        else
     66            hh_calib=guidata(h_calib);
     67            test_cal=get(hh_calib.edit_append,'Value');
     68        end
     69    end
     70end
    6771
    6872%% determine the currently selected items
  • trunk/src/name2display.m

    r317 r332  
    1818%   nom_type='_1a','_1A','_01a','_01A',...: idem, with a separator '_' before the index
    1919%   nom_type='_1_1','_01_1',...: matrix of files with two indices i and j separated by '_'(e.g. 'aa_45_2.png')
    20 %   nom_type='_i1-i2': from pairs from a single index (e.g. 'aa_45-47.nc')
    21 %   nom_type='_i_j1-j2': pairs of j indices (e.g. 'aa_45_2-3.nc')
    22 %   nom_type='_i1-i2_j': pairs of i indices (e.g. 'aa_45-46_2.nc')
     20%   nom_type='_1-2': from pairs from a single index (e.g. 'aa_45-47.nc')
     21%   nom_type='_1_1-2': pairs of j indices (e.g. 'aa_45_2-3.nc')
     22%   nom_type='_1-2_j': pairs of i indices (e.g. 'aa_45-46_2.nc')
    2323%   nom_type='_1_ab','1_ab','01_ab'..., from pairs of '#' images (e.g.'aa045bc.nc'), ext='.nc'
    2424%subdir: name of the subdirectory for netcdf files
     
    6969penult=double(RootFile(indcur-1));%ascii code of the penultimate character
    7070testsub=0; %default
    71 % case of an indexed series in a single file
    72 if strcmpi(ext,'.avi')
    73      nom_type='*';
    74 %case of a numerical index follewed by a lower case letter (e.g. a,b,c):
    75 %the penultimate character is a number and the last one a letter (lower case: last >= 97 && last <= 122
    76 %                                                                 capital
    77 %                                                                 letter:  last >= 65 && last <= 90) 
    78 elseif  penult >= 48 && penult <= 57 && ((last >= 65 && last <= 90)||(last >= 97 && last <= 122))
     71% % case of an indexed series in a single file
     72% if strcmpi(ext,'.avi')
     73%      nom_type='*';
     74% %case of a numerical index follewed by a lower case letter (e.g. a,b,c):
     75% %the penultimate character is a number and the last one a letter (lower case: last >= 97 && last <= 122
     76% %                                                                 capital
     77% %                                                                 letter:  last >= 65 && last <= 90) 
     78if  penult >= 48 && penult <= 57 && ((last >= 65 && last <= 90)||(last >= 97 && last <= 122))
    7979    str_a=last_str; %extract appendix a,b,c... or A,B,C... as output.
    8080    ind_end=indcur-1; %current index just before the suffix letter
     
    9898    str_a=num2;
    9999    str_b=num3;
    100     nom_type='_i1-i2_j1-j2';
     100    nom_type='_1-2_1-2';
    101101    testsub=1;
    102102    indcur=separ0-1;
     
    105105    str2=num2;
    106106    str_a=num3;
    107     nom_type='_i1-i2_j';
     107    nom_type='_1-2_1';
    108108    testsub=1;
    109109    indcur=separ1-1;
     
    113113    str_a=num2;
    114114    str_b=num3;
    115     nom_type='_i_j1-j2';
     115    nom_type='_1_1-2';
    116116    testsub=1;
    117117elseif strcmp(filelit(end-1:end),'_-')
     
    120120    str2=num3;
    121121    str_a='';
    122     nom_type='_i1-i2';
     122    nom_type='_1-2';
    123123    testsub=1;
    124124elseif strcmp(filelit(end-1:end),'__')
  • trunk/src/name_generator.m

    r221 r332  
    2626%   nom_type='_1a','_1A','_01a','_01A',...: idem, with a separator '_' before the index
    2727%   nom_type='_1_1','_01_1',...: matrix of files with two indices i and j separated by '_'(e.g. 'aa_45_2.png')
    28 %   nom_type='_i1-i2': from pairs from a single index (e.g. 'aa_45-47.nc')
    29 %   nom_type='_i_j1-j2': pairs of j indices (e.g. 'aa_45_2-3.nc')
    30 %   nom_type='_i1-i2_j': pairs of i indices (e.g. 'aa_45-46_2.nc')
     28%   nom_type='_1-2': from pairs from a single index (e.g. 'aa_45-47.nc')
     29%   nom_type='_1_1-2': pairs of j indices (e.g. 'aa_45_2-3.nc')
     30%   nom_type='_1-2_1': pairs of i indices (e.g. 'aa_45-46_2.nc')
    3131%   nom_type='_1_ab','1_ab','01_ab'..., from pairs of '#' images (e.g.'aa045bc.nc'), ext='.nc'
    3232%'comp_input' (for nom_type involving index pairs (e.g. netc))
     
    7171num_i2_out=num_i2;%default output
    7272num_j2_out=num_j2;%default output
    73 test_pairs=numel(nom_type)>=2 &&(strcmp(nom_type,'_i1-i2_j1-j2')|| strcmp(nom_type(end-1:end),'ab')|| strcmp(nom_type(end-1:end),'AB')||...
    74                 strcmp(nom_type,'_i_j1-j2')|| strcmp(nom_type,'_i1-i2_j')||strcmp(nom_type,'_i1-i2'));
    75 %test_2D= strcmp(nom_type(end-1:end),'ab')|| strcmp(nom_type(end-1:end),'AB') ||strcmp(nom_type,'_i_j1-j2');
    76 %test_3D=strcmp(nom_type,'_i1-i2_j')|| strcmp(nom_type,'_i1-i2');
     73test_pairs=numel(nom_type)>=2 &&(strcmp(nom_type,'_1-2_1-2')|| strcmp(nom_type(end-1:end),'ab')|| strcmp(nom_type(end-1:end),'AB')||...
     74                strcmp(nom_type,'_1_1-2')|| strcmp(nom_type,'_1-2_1')||strcmp(nom_type,'_1-2'));
     75%test_2D= strcmp(nom_type(end-1:end),'ab')|| strcmp(nom_type(end-1:end),'AB') ||strcmp(nom_type,'_1_1-2');
     76%test_3D=strcmp(nom_type,'_1-2_1')|| strcmp(nom_type,'_1-2');
    7777if ~isequal(subdir,'') && ~isequal(subdir,'?')
    7878      [Path,Name]=fileparts(filebase);
     
    144144                filename=[filename num2str(num_i1,numstr) num_j_str ext];
    145145                num_i2_out=num_i1;
    146             elseif isequal(nom_type,'i_j1-j2')
     146            elseif isequal(nom_type,'1_1-2')
    147147                if isequal(num2str(num_j1),num2str(num_j2))% case of displacements at the same time
    148148                    filename=[filename num2str(num_i1) '_' num2str(num_j1) ext];
     
    151151                end
    152152                num_i2_out=num_i1;
    153             elseif  isequal(nom_type,'i1-i2_j')
     153            elseif  isequal(nom_type,'1-2_1')
    154154                if isequal(num2str(num_i1),num2str(num_i2))% case of displacements at the same time
    155155                      filename=[filename num2str(num_i1) '_' num2str(num_j1) ext];
     
    158158                end
    159159                num_j2_out=num_j1;
    160             elseif  isequal(nom_type,'i1-i2')
     160            elseif  isequal(nom_type,'1-2')
    161161                if isequal(num2str(num_i1),num2str(num_i2))% case of displacements at the same time
    162162                     filename=[filename num2str(num_i1) ext];
     
    165165                end
    166166                num_j2_out=num_j1;
    167             elseif isequal(nom_type,'i1-i2_j1-j2')
     167            elseif isequal(nom_type,'1-2_1-2')
    168168                if isequal(num2str(num_i1),num2str(num_i2))% case of displacements at the same time
    169169                    app1= num2str(num_i1);
     
    215215            if isequal(nom_type,'#_ab')
    216216                filename=[filebasesub num2str(num_i1,'%03d') '_' num2stra(num_j1,nom_type) num2stra(num_j2,nom_type) ext];
    217             elseif isequal(nom_type,'_i1_j1-j2')
     217            elseif isequal(nom_type,'_1_1-2')
    218218                filename=[filebasesub '_' num2str(num_i1) '_' num2str(num_j1) '-' num2str(num_i2) ext];
    219             elseif isequal(nom_type,'_i1-i2_j')
     219            elseif isequal(nom_type,'_1-2_1')
    220220                filename=[filebasesub '_' num2str(num_i1) '-' num2str(num_i2) '_' num2str(num_j1) ext];
    221             elseif isequal(nom_type,'_i1-i2')
     221            elseif isequal(nom_type,'_1-2')
    222222                filename=[filebasesub '_' num2str(num_i1) '-' num2str(num_i2) ext];
    223223            end
     
    246246if isequal(nom_type,'#_ab')
    247247    dirpair=dir([filebasesub num2str(num_i1,'%03d') '_*.nc']);
    248 elseif isequal(nom_type,'_i_j1-j2')
     248elseif isequal(nom_type,'_1_1-2')
    249249    dirpair=dir([filebasesub '_' num2str(num_i1) '_*-*.nc']);
    250 elseif isequal(nom_type,'_i1-i2_j')
     250elseif isequal(nom_type,'_1-2_1')
    251251    dirpair=dir([filebasesub '_' num2str(num_i1) '-*_' num2str(num_j1) '.nc']);
    252 elseif isequal(nom_type,'_i1-i2')
     252elseif isequal(nom_type,'_1-2')
    253253    dirpair=dir([filebasesub '_' num2str(num_i1) '-*.nc']);
    254254    if isempty(dirpair)
  • trunk/src/num2stra.m

    r122 r332  
    1313
    1414function str=num2stra(num,nom_type,index)
     15str='';
    1516if ~exist('index','var')
    1617    index=2; %index 1 or 2 of the file indices
     
    1819switch index
    1920    case 1
    20         if length(nom_type)>=4 && isequal(nom_type(1:2),'%0') && isequal(nom_type(4),'d')
    21            str=num2str(num,nom_type(1:4));
    22         else
     21%         if length(nom_type)>=4 && isequal(nom_type(1:2),'%0') && isequal(nom_type(4),'d')
     22%            str=num2str(num,nom_type(1:4));
     23%         else
    2324           str=num2str(num);
    24         end
     25%         end
    2526    case 2
    26         if isempty(nom_type)
    27             nom_type='none';
    28         end
    29         if isequal(nom_type,'png_old') || isequal(nom_type,'netc_old') || isequal(nom_type,'raw_SMD')||...
    30             isequal(nom_type(end),'a')||isequal(nom_type(end),'b')
     27        if isequal(nom_type(end),'a')||isequal(nom_type(end),'b')
    3128            str=char(96+num);
    3229        elseif isequal(nom_type(end),'A')|isequal(nom_type(end),'B')
    3330            str=char(64+num);
    34         elseif isequal(nom_type,'series_i')|isequal(nom_type,'netc_series')...
    35                 |isequal(nom_type,'ima_num')| isequal(nom_type,'avi')| isequal(nom_type,'none')...
    36                 isequal(nom_type,'_i')|isequal(nom_type,'_i1-i2')
    37             str='';
     31%         elseif isequal(nom_type,'series_i')|isequal(nom_type,'netc_series')...
     32%                 |isequal(nom_type,'ima_num')| isequal(nom_type,'avi')| isequal(nom_type,'none')...
     33%                 isequal(nom_type,'_i')|isequal(nom_type,'_i1-i2')
     34%             str='';
    3835        else
    3936            str=num2str(num);
  • trunk/src/series.m

    r329 r332  
    6565% set(0,'Units','pixels')
    6666% screensize=get(0,'ScreenSize'); %screen size in pixels
    67 set(hObject,'Position',[150 100 1000 600] );%position and size in pixels (get adjusted to the screen size in case of excess)
     67set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display)
     68%set(hObject,'Position',[150 100 1000 600] );%position and size in pixels (get adjusted to the screen size in case of excess)
    6869%load the list of previously browsed files in menus Open and Open_1
    6970dir_perso=prefdir;
     
    112113if isfield(param,'FileName')
    113114    if isfield(param,'FileName_1')
    114         update_file(hObject, eventdata, handles,param.FileName_1,0)
    115         update_file(hObject, eventdata, handles,param.FileName,1)
     115        update_file(handles,param.FileName_1,0)
     116        update_file(handles,param.FileName,1)
    116117    else
    117         update_file(hObject, eventdata, handles,param.FileName,0)
     118        update_file(handles,param.FileName,0)
    118119    end
    119120end 
     
    125126    FieldCell{1}=param.list_fields{param.index_fields};
    126127end
    127 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display)
    128128NomType_Callback(hObject, eventdata, handles)
    129129
     
    135135[path_series,name,ext]=fileparts(which('series'));
    136136path_series=fullfile(path_series,'series');%path of the function 'series'
    137 addpath path_series ; %add the path to UVMAT, (useful in case of change of working directory after civ has been s opened in the working directory)
     137addpath (path_series) ; %add the path to UVMAT, (useful in case of change of working directory after civ has been s opened in the working directory)
    138138path_transform=fullfile(path_series,'transform_field');%path to the field transform functions
    139139for ilist=1:length(fct_menu)
     
    256256    warndlg_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer
    257257else
    258     update_file(hObject, eventdata, handles,fileinput,0)
     258    update_file(handles,fileinput,0)
    259259     %update list of recent files in the menubar
    260260    MenuFile_1=fileinput;
     
    293293function MenuFile_1_Callback(hObject, eventdata, handles)
    294294fileinput=get(handles.MenuFile_1,'Label');
    295 update_file(hObject, eventdata, handles,fileinput,0)
     295update_file(handles,fileinput,0)
    296296
    297297% --------------------------------------------------------------------
    298298function MenuFile_2_Callback(hObject, eventdata, handles)
    299299fileinput=get(handles.MenuFile_2,'Label');
    300 update_file(hObject, eventdata, handles,fileinput,0)
     300update_file(handles,fileinput,0)
    301301
    302302% --------------------------------------------------------------------
    303303function MenuFile_3_Callback(hObject, eventdata, handles)
    304304fileinput=get(handles.MenuFile_3,'Label');
    305 update_file(hObject, eventdata, handles,fileinput,0)
     305update_file( handles,fileinput,0)
    306306
    307307% --------------------------------------------------------------------
    308308function MenuFile_4_Callback(hObject, eventdata, handles)
    309309fileinput=get(handles.MenuFile_4,'Label');
    310 update_file(hObject, eventdata, handles,fileinput,0)
     310update_file(handles,fileinput,0)
    311311
    312312% --------------------------------------------------------------------
    313313function MenuFile_5_Callback(hObject, eventdata, handles)
    314314fileinput=get(handles.MenuFile_5,'Label');
    315 update_file(hObject, eventdata, handles,fileinput,0)
     315update_file(handles,fileinput,0)
    316316
    317317% --------------------------------------------------------------------
     
    360360    msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer
    361361else
    362     update_file(hObject, eventdata, handles,fileinput,1)
     362    update_file(handles,fileinput,1)
    363363    %update list of recent files in the menubar
    364364    MenuFile_1=fileinput;
     
    397397function MenuFile_insert_1_Callback(hObject, eventdata, handles)
    398398fileinput=get(handles.MenuFile_insert_1,'Label');
    399 update_file(hObject, eventdata, handles,fileinput,1)
     399update_file(handles,fileinput,1)
    400400
    401401% --------------------------------------------------------------------
    402402function MenuFile_insert_2_Callback(hObject, eventdata, handles)
    403403fileinput=get(handles.MenuFile_insert_2,'Label');
    404 update_file(hObject, eventdata, handles,fileinput,1)
     404update_file(handles,fileinput,1)
    405405
    406406% --------------------------------------------------------------------
    407407function MenuFile_insert_3_Callback(hObject, eventdata, handles)
    408408fileinput=get(handles.MenuFile_insert_3,'Label');
    409 update_file(hObject, eventdata, handles,fileinput,1)
     409update_file( handles,fileinput,1)
    410410
    411411% --------------------------------------------------------------------
    412412function MenuFile_insert_4_Callback(hObject, eventdata, handles)
    413413fileinput=get(handles.MenuFile_insert_4,'Label');
    414 update_file(hObject, eventdata, handles,fileinput,1)
     414update_file( handles,fileinput,1)
    415415
    416416% --------------------------------------------------------------------
    417417function MenuFile_insert_5_Callback(hObject, eventdata, handles)
    418418fileinput=get(handles.MenuFile_insert_5,'Label');
    419 update_file(hObject, eventdata, handles,fileinput,1)
     419update_file(handles,fileinput,1)
    420420
    421421%------------------------------------------------------------------------
    422422% ---  refresh the GUI data after introduction of a new file series
    423 function update_file(hObject, eventdata, handles,fileinput,addtest)
     423% INPUT:
     424% handles:
     425% fileinput: name of the input file
     426% addtest: =0 to refresh the list of file series, =1 to append a new series to the list (from the menu bar option 'Open_insert')
     427function update_file(handles,fileinput,addtest)
    424428%------------------------------------------------------------------------ 
     429
     430%% enable other menus and uicontrols
     431set(handles.MenuOpen_insert,'Enable','on')
     432set(handles.MenuFile_insert_1,'Enable','on')
     433set(handles.MenuFile_insert_2,'Enable','on')
     434set(handles.MenuFile_insert_3,'Enable','on')
     435set(handles.MenuFile_insert_4,'Enable','on')
     436set(handles.MenuFile_insert_5,'Enable','on')
     437set(handles.RUN, 'Enable','On')
     438set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red
     439set(handles.RootPath,'BackgroundColor',[1 1 0]) % set RootPath edit box  to yellow
     440drawnow
     441
     442%% get the input root name, indices, file extension and nomenclature NomType
    425443if ~exist(fileinput,'file')
    426444    msgbox_uvmat('ERROR',['input file ' fileinput  ' does not exist'])
    427445    return
    428446end
    429 
    430 % refresh input root name, indices, file extension and nomenclature
    431 [RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput);
    432 
    433 %check for movie image files
    434 if ~isempty(FileExt)
    435     if ~isempty(imformats(FileExt(2:end)))
    436         imainfo=imfinfo(fileinput);
    437         if length(imainfo) >1 %case of image with multiple frames
    438             NomType='*';
    439             [RootPath,RootFile]=fileparts(fileinput);
    440         end
    441     end
    442 end
    443 NcType='none';%default
    444 if isequal(FileExt,'.nc')
    445    Data=nc2struct(fileinput,[]);
    446    if isfield(Data,'absolut_time_T0')
    447        NcType='civx'; % test for civx velocity fields
    448    end
    449 end
    450 
    451 set(handles.RootPath,'Value',1)
    452 set(handles.SubDir,'Value',1)
    453 set(handles.RootFile,'Value',1)
    454 set(handles.NomType,'Value',1)
    455 set(handles.FileExt,'Value',1)
    456 set(handles.nb_field,'Value',1)
    457 set(handles.nb_field2,'Value',1)
    458 if addtest
    459     SeriesData=get(handles.figure1,'UserData');
    460     SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num];
    461     SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile;
    462     RootPathCell=[{RootPath}; get(handles.RootPath,'String')] ;
    463     SubDirCell=[{SubDir}; get(handles.SubDir,'String')];
    464     RootFileCell=[{RootFile}; get(handles.RootFile,'String')];
    465     NomTypeCell=[{NomType}; SeriesData.NomType];
    466     FileExtCell=[{FileExt}; get(handles.FileExt,'String')];
    467     NcTypeCell=[{NcType};SeriesData.NcType];
    468     set(handles.NomType,'String',[{};get(handles.NomType,'String')])
    469 else
    470     SeriesData=[];%re-initialisation
    471     SeriesData.displ_num=[0 0 0 0];
    472     RootPathCell={RootPath};
    473     SubDirCell={SubDir};
    474     RootFileCell={RootFile};   
    475     NomTypeCell={NomType};
    476     FileExtCell={FileExt};   
    477     NcTypeCell={NcType};
    478 end
    479 
    480 SeriesData.NomType=NomTypeCell;
    481 SeriesData.NcType=NcTypeCell;
    482 SeriesData.CurrentInputFile=fileinput;
    483 set(handles.RootPath,'String',RootPathCell);
    484 set(handles.SubDir,'String',SubDirCell);
    485 set(handles.RootFile,'String',RootFileCell);
    486 set(handles.NomType,'String',NomTypeCell);
    487 set(handles.FileExt,'String',FileExtCell); 
    488 
    489 %determine field indices
     447[RootPath,RootFile,i1,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput);
     448
     449%% 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
     462if isnan(nb_field)
     463    nb_field_str='?';
     464    nb_field_str2='?';
     465else
     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); 
     470end
     471if 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')];
     476else % 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};
     481end
     482set(handles.MinIndex_i,'String',MinIndex_i_cell);
     483set(handles.MinIndex_j,'String',MinIndex_j_cell);
     484set(handles.nb_field,'String',nb_field_cell);
     485set(handles.nb_field2,'String',nb_field2_cell);
     486
     487
     488%% determine reference field indices
    490489ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV
    491 if ~isempty(str2num(field_count))
    492     ref_i=str2num(field_count);
     490if ~isempty(str2num(i1))
     491    ref_i=str2num(i1);
    493492    if ~isempty(str2num(str2))
    494493        ref_i=floor((ref_i+str2num(str2))/2);% reference image number corresponding to the file
    495         SeriesData.browse_Di=str2num(str2)-str2num(field_count);
     494        SeriesData.browse_Di=str2num(str2)-str2num(i1);
    496495    end
    497496end
     
    511510set(handles.last_j,'String',num2str(ref_j));
    512511
    513 %enable other menus and uicontrols
    514 set(handles.MenuOpen_insert,'Enable','on')
    515 set(handles.MenuFile_insert_1,'Enable','on')
    516 set(handles.MenuFile_insert_2,'Enable','on')
    517 set(handles.MenuFile_insert_3,'Enable','on')
    518 set(handles.MenuFile_insert_4,'Enable','on')
    519 set(handles.MenuFile_insert_5,'Enable','on')
    520 set(handles.RUN, 'Enable','On')
    521 set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red
    522 set(handles.RootPath,'BackgroundColor',[1 1 0]) % set RootPath edit box  to yellow
    523 drawnow
    524 
    525512TimeUnit=''; %default
    526513time=[];%default
     
    536523if isequal(lower(FileExt),'.avi') %.avi file
    537524    testima=1;
    538     info=aviinfo([FileBase FileExt]);
    539     time=(0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond)';
    540     nb_field=info.NumFrames;
    541     nb_field2=1;
     525%     info=aviinfo([FileBase FileExt]);
     526%     time=(0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond)';
     527%     nb_field=info.NumFrames;
     528%     nb_field2=1;
    542529elseif ~isempty(imformats(FileExt(2:end)))
    543530    testima=1;
    544     if isequal(NomType,'*')% multi-frame image
    545         imainfo=imfinfo([FileBase FileExt]);     
    546         if length(imainfo) >1 %case of image with multiple frames
    547             nb_field=length(imainfo);
    548             nb_field2=1;
    549         end
    550     end
     531%     if isequal(NomType,'*')% multi-frame image
     532%         imainfo=imfinfo([FileBase FileExt]);     
     533%         if length(imainfo) >1 %case of image with multiple frames
     534%             nb_field=length(imainfo);
     535%             nb_field2=1;
     536%         end
     537%     end
    551538elseif isequal(FileExt,'.vol')
    552539     testima=1;
    553540end
    554541
    555 % enable field and veltype menus
     542
     543%% fill the list of file series
     544% select the first line in the list
     545set(handles.RootPath,'Value',1)
     546set(handles.SubDir,'Value',1)
     547set(handles.RootFile,'Value',1)
     548set(handles.NomType,'Value',1)
     549set(handles.FileExt,'Value',1)
     550set(handles.nb_field,'Value',1)
     551set(handles.nb_field2,'Value',1)
     552% append the current file series to the list
     553if addtest
     554    SeriesData=get(handles.series,'UserData');
     555    SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num];
     556    SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile;
     557    RootPathCell=[{RootPath}; get(handles.RootPath,'String')] ;
     558    SubDirCell=[{SubDir}; get(handles.SubDir,'String')];
     559    RootFileCell=[{RootFile}; get(handles.RootFile,'String')];
     560    NomTypeCell=[{NomType}; SeriesData.NomType];
     561    FileExtCell=[{FileExt}; get(handles.FileExt,'String')];
     562    FileTypeCell=[{FileType};SeriesData.FileType];
     563    set(handles.NomType,'String',[{};get(handles.NomType,'String')])
     564% or re-initialise the list of  input  file series   
     565else
     566    SeriesData=[];%re-initialisation
     567    SeriesData.displ_num=[0 0 0 0];
     568    RootPathCell={RootPath};
     569    SubDirCell={SubDir};
     570    RootFileCell={RootFile};   
     571    NomTypeCell={NomType};
     572    FileExtCell={FileExt};   
     573    FileTypeCell={FileType};
     574end
     575SeriesData.NomType=NomTypeCell;
     576SeriesData.FileType=FileTypeCell;
     577SeriesData.CurrentInputFile=fileinput;
     578set(handles.RootPath,'String',RootPathCell);
     579set(handles.SubDir,'String',SubDirCell);
     580set(handles.RootFile,'String',RootFileCell);
     581set(handles.NomType,'String',NomTypeCell);
     582set(handles.FileExt,'String',FileExtCell);
     583
     584%% enable field and veltype menus
    556585testfield=isequal(get(handles.FieldMenu,'enable'),'on');
    557586testfield_1=isequal(get(handles.FieldMenu_1,'enable'),'on');
     
    568597            testnc=1;
    569598        end
    570         if isequal(NcTypeCell{iview},'civx')
     599        if isequal(FileTypeCell{iview},'civx')
    571600            testcivx=1;
    572601        end
     
    575604    testnc=isequal(FileExtCell{1},'.nc');
    576605    testnc_1=isequal(FileExtCell{2},'.nc');
    577     testcivx=isequal(NcTypeCell{1},'civx');
    578     testcivx_1=isequal(NcTypeCell{2},'civx');
     606    testcivx=isequal(FileTypeCell{1},'civx');
     607    testcivx_1=isequal(FileTypeCell{2},'civx');
    579608end
    580609if testfield && testnc
     
    630659end 
    631660
    632 %%%%%%%%   read image documentation file  if found%%%%%%%%%%%%%%%%%%%%%%%%%%%
    633       %look for the file existence
     661%%  read image documentation file  if found%%%%%%%%%%%%%%%%%%%%%%%%%%%
    634662ext_imadoc='';
    635663if isequal(FileExt,'.xml')||isequal(FileExt,'.civ')
     
    640668    ext_imadoc='.civ';
    641669end
    642       %read the ImaDoc file
     670%read the ImaDoc file
    643671XmlData=[];
    644672NbSlice_calib={};
     
    672700    end 
    673701end 
     702
     703
     704
     705%% display times
    674706if addtest
    675707    SeriesData.Time=[{time} SeriesData.Time];
     
    677709   SeriesData.Time={time};
    678710end
    679 
    680 
    681 % if ~isempty(time)
    682 %     siztime=size(time);
    683 %     nb_field=siztime(1);
    684 %     nb_field2=siztime(2);
    685 % end   
    686711set(handles.TimeUnit,'String',TimeUnit)
    687 %look for max indices
    688 if ~strcmp(NomType,'*')
    689     [num_i1,num_i2,num_j1,num_j2]=find_indexseries(fileinput);
    690     nb_field=max(floor((max(num_i1)+max(num_i2))/2));
    691     nb_field2=max(floor((max(num_j1)+max(num_j2))/2));
    692 end
    693 if isnan(nb_field)
    694     nb_field_str='?';
    695     nb_field_str2='?';
    696 else
    697     nb_field_str=num2str(nb_field);
    698     nb_field_str2=num2str(nb_field2);
    699 end
    700 if addtest
    701     nb_field_cell=[{nb_field_str} ;get(handles.nb_field,'String')];
    702     nb_field2_cell=[{nb_field_str2} ;get(handles.nb_field2,'String')];
    703 else
    704     nb_field_cell={nb_field_str};
    705     nb_field2_cell={nb_field_str2};
    706 end
    707 set(handles.nb_field,'String',nb_field_cell);
    708 set(handles.nb_field2,'String',nb_field2_cell);
    709 set(handles.figure1,'UserData',SeriesData);
    710 
    711 %number of slices
     712set(handles.series,'UserData',SeriesData);
     713
     714%% number of slices
    712715if isfield(XmlData,'GeometryCalib') && isfield(XmlData.GeometryCalib,'SliceCoord')
    713716       siz=size(XmlData.GeometryCalib.SliceCoord);
     
    721724
    722725% set menus of index pairs
    723 NomType_Callback(hObject, eventdata, handles)
     726NomType_Callback([], [], handles)
    724727
    725728%store the root name for future opening of uvmat
     
    739742end
    740743set(handles.RootPath,'BackgroundColor',[1 1 1])
    741 set(handles.PathCampaign,'String',SeriesData.PathCampaign)
    742 last_j_Callback(hObject, eventdata, handles)
    743 last_i_Callback(hObject, eventdata, handles)
     744% set(handles.PathCampaign,'String',SeriesData.PathCampaign)
     745last_j_Callback([], [], handles)
     746last_i_Callback([], [], handles)
    744747
    745748%------------------------------------------------------------------------
     
    819822function NomType_Callback(hObject, eventdata, handles)
    820823%------------------------------------------------------------------------
    821 hseries=get(handles.ProjObject,'Parent');
    822 SeriesData=get(hseries,'UserData');
     824SeriesData=get(handles.series,'UserData');
    823825if isfield(SeriesData,'NomType')
    824826    NomTypeCell=SeriesData.NomType;
     
    853855    NomType=NomTypeCell{Val};
    854856    switch NomType 
    855             case {'_i1-i2_j', '_i1-i2'}
     857            case {'_1-2_1', '_1-2'}
    856858                set(handles.mode,'String',{'series(Di)'})
    857859                set(handles.mode,'Value',1);
     
    862864                set(handles.mode,'Value',1);
    863865                testpair=1;
    864             case '_i_j1-j2'
     866            case '_1_1-2'
    865867                set(handles.mode,'String',{'bursts';'series(Dj)'})%multiple choice
    866868                if ~isempty(nbfield) && ~isempty(nbfield2) && ((nbfield2>10) || (nbfield==1))
     
    873875    end
    874876    switch NomType   
    875             case {'_1_1','_i_j1-j2','_i1-i2_j','1_ab','01_ab'},% two navigation indices
     877            case {'_1_1','_1_1-2','_1-2_1','1_ab','01_ab'},% two navigation indices
    876878                state_j='on';
    877879    end
     
    881883else
    882884    set(handles.NomType,'String',NomTypeCell)
     885    set(handles.j_txt,'Visible',state_j)
     886    set(handles.MinIndex_j,'Visible',state_j)
    883887    set(handles.first_j,'Visible',state_j)
    884888    set(handles.incr_j,'Visible',state_j)
    885889    set(handles.last_j,'Visible',state_j)
    886     set(handles.nb_field2,'Visible',state_j)
     890    set(handles.nb_field2,'Visible',state_j) 
    887891end
    888892
     
    892896%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    893897function mode_Callback(hObject, eventdata, handles)
    894 %hseries=get(handles.mode,'parent');
    895 hseries=handles.figure1;
    896 SeriesData=get(hseries,'UserData');
     898SeriesData=get(handles.series,'UserData');
    897899mode_list=get(handles.mode,'String');
    898900mode_value=get(handles.mode,'Value');
     
    904906    Val=get(handles.NomType,'Value');
    905907    NomType=NomTypeCell{Val};
    906     test_find_pair=isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2')|| isequal(NomType,'#_ab');
     908    test_find_pair=isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2')|| isequal(NomType,'#_ab');
    907909end
    908910time=[];
     
    917919    enable_i(handles,'On')
    918920    enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 
    919 elseif  isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')
     921elseif  isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')
    920922    enable_i(handles,'On')
    921923    enable_j(handles,'On') % allow both i and j index scanning
     
    925927end   
    926928set(handles.list_pair_civ,'Value',indchosen);%set the default choice of image pairs for civ1
    927 set(hseries,'UserData',SeriesData)
     929set(handles.series,'UserData',SeriesData)
    928930
    929931%list pairs if relevant
     
    945947function enable_j(handles,state)
    946948set(handles.j_txt,'Visible',state)
     949set(handles.MinIndex_j,'Visible',state)
    947950set(handles.first_j,'Visible',state)
    948951set(handles.last_j,'Visible',state)
     
    974977%----------------------------------------------------------------
    975978function find_netcpair_civ(hObject, eventdata, handles,Val)
    976 %hseries=get(handles.list_pair_civ,'parent');
    977 SeriesData=get(handles.figure1,'UserData');
     979SeriesData=get(handles.series,'UserData');
    978980% NomTypeCell=get(handles.NomType,'String');
    979981NomTypeCell=SeriesData.NomType;
     
    10801082    for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'bursts' mode
    10811083        for numod_b=(numod_a+1):nbfield2
    1082             [filename]=name_generator(filebase,ref_i,numod_a,'.nc',NomType,1,ref_i,numod_b,subdir);
    1083             select=(exist(filename,'file')==2);
     1084            [filename]=name_generator(filebase,ref_i,numod_a,'.nc',NomType,1,ref_i,numod_b,subdir)
     1085            select=(exist(filename,'file')==2)
    10841086            if select==1
    10851087                ind_exist=ind_exist+1;
     
    11041106                        nom_type_ima='#A';
    11051107                    otherwise
    1106                          nom_type_ima='_i_j';
     1108                         nom_type_ima='_1_1';
    11071109                end
    11081110               displ_pair{ind_exist}=['j= ' num2stra(numod_a,nom_type_ima,2) '-' num2stra(numod_b,nom_type_ima,2) ...
     
    11451147SeriesData.displ_num(iview,:)=(displ_num(:,val))';
    11461148SeriesData.ref_time=ref_time;
    1147 set(handles.figure1,'UserData',SeriesData)
     1149set(handles.series,'UserData',SeriesData)
    11481150list_pair_civ_Callback(hObject, eventdata, handles)
    11491151
     
    11571159Val=get(handles.RootPath,'Value');
    11581160IndexCell=get(handles.NomType,'String');
    1159 %hseries=get(handles.list_pair_civ,'parent');
    1160 SeriesData=get(handles.figure1,'UserData');
     1161SeriesData=get(handles.series,'UserData');
    11611162NomType=SeriesData.NomType{Val};
    11621163list_pair=get(handles.list_pair_civ,'String');%get the menu of image pairs
     
    11841185    end
    11851186    switch NomType
    1186        case {'_i1-i2_j'}
     1187       case {'_1-2_1'}
    11871188           if isequal(num1_str(1),'0')
    11881189               IndexCell{Val}=['_(i-(i+' num2_str ')_j'];
     
    11921193           displ_num(3)=num1;
    11931194           displ_num(4)=num2;
    1194        case {'_i1-i2'}
     1195       case {'_1-2'}
    11951196           if isequal(num1_str(1),'0')
    11961197               IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')'];
     
    12001201           displ_num(3)=num1;
    12011202           displ_num(4)=num2;
    1202        case '_i_j1-j2'
     1203       case '_1_1-2'
    12031204          if test_bursts
    12041205              IndexCell{Val}=['_i_' num1_str '-' num2_str ];
     
    12191220set(handles.NomType,'String',IndexCell)
    12201221SeriesData.displ_num(Val,:)=displ_num;
    1221 set(handles.figure1,'UserData',SeriesData)
     1222set(handles.series,'UserData',SeriesData)
    12221223% set(handles.NomType,'Value',Val)
    12231224
     
    12701271%read root name and field type
    12711272set(handles.RUN,'BusyAction','queue');
    1272 %hseries=get(handles.RUN,'parent');
    1273 set(0,'CurrentFigure',handles.figure1)
     1273set(0,'CurrentFigure',handles.series)
    12741274if isequal(get(handles.GetObject,'Visible'),'on') && isequal(get(handles.GetObject,'Value'),1)
    12751275    Series.GetObject=1;
     
    12781278    Series.GetObject=0;
    12791279end
    1280 SeriesData=get(handles.figure1,'UserData');
     1280SeriesData=get(handles.series,'UserData');
    12811281
    12821282%reinitiate waitbar position
     
    13241324    Series.transform_fct=transform_list{menu_index};% transform function handles
    13251325end
    1326 Series.hseries=handles.figure1; % handles to the series GUI
     1326Series.hseries=handles.series; % handles to the series GUI
    13271327
    13281328%read the set of field numbers
     
    13871387    %case of pairs (.nc files)
    13881388   
    1389     if isequal(NomType{iview},'_i_j1-j2')|| isequal(NomType{iview},'_i1-i2_j')|| isequal(NomType{iview},'_i1-i2')|| isequal(NomType{iview},'#_ab')
     1389    if isequal(NomType{iview},'_1_1-2')|| isequal(NomType{iview},'_1-2_1')|| isequal(NomType{iview},'_1-2')|| isequal(NomType{iview},'#_ab')
    13901390        ind_shift=SeriesData.displ_num(iview,:);
    13911391        if isequal(ind_shift,[0 0 0 0]) % undefined pairs
     
    14901490function last_i_Callback(hObject, eventdata, handles)
    14911491%------------------------------------------------------------------------
    1492 %     hseries=get(handles.last_i,'parent');
    1493 % first_i=str2num(get(handles.first_i,'String'));
    1494 % last_i=str2num(get(handles.last_i,'String'));
    1495 % ref_i=ceil((first_i+last_i)/2);
    1496 % set(handles.ref_i,'String', num2str(ref_i))
    1497 % ref_i_Callback(hObject, eventdata, handles)
    1498 SeriesData=get(handles.figure1,'UserData');
     1492SeriesData=get(handles.series,'UserData');
    14991493if ~isfield(SeriesData,'Time')
    15001494    SeriesData.Time{1}=[];
     
    15151509set(handles.ref_j,'String', num2str(ref_j))
    15161510ref_j_Callback(hObject, eventdata, handles)
    1517 SeriesData=get(handles.figure1,'UserData');
     1511SeriesData=get(handles.series,'UserData');
    15181512if ~isfield(SeriesData,'Time')
    15191513    SeriesData.Time{1}=[];
     
    15281522mode_value=get(handles.mode,'Value');
    15291523mode=mode_list{mode_value};
    1530 %hseries=get(handles.ref_i,'parent');
    1531 SeriesData=get(handles.figure1,'UserData');
     1524SeriesData=get(handles.series,'UserData');
    15321525%NomTypeCell=get(handles.NomType,'String');
    15331526NomTypeCell=SeriesData.NomType;
     
    15361529NomType=NomTypeCell{Val};
    15371530% for ilist=1:length(NomType)
    1538     if isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2')
     1531    if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2')
    15391532        if isequal(mode,'series(Di)')
    15401533            find_netcpair_civ(hObject, eventdata, handles,Val);% update the menu of pairs depending on the available netcdf files
     
    15501543mode_value=get(handles.mode,'Value');
    15511544mode=mode_list{mode_value};
    1552 %hseries=get(handles.ref_i,'parent');
    1553 SeriesData=get(handles.figure1,'UserData');
     1545SeriesData=get(handles.series,'UserData');
    15541546NomTypeCell=SeriesData.NomType;
    15551547if ~isempty(NomTypeCell)
    15561548    Val=get(handles.NomType,'Value');
    15571549    NomType=NomTypeCell{Val};
    1558     if isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2')
     1550    if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2')
    15591551        if isequal(mode,'series(Dj)')
    15601552            find_netcpair_civ(hObject, eventdata, handles,Val);% update the menu of pairs depending on the available netcdf files
     
    18071799         delete(hget_field)%delete opened versions of get_field
    18081800     end
    1809      %hseries=get(handles.FieldMenu,'parent');
    1810      SeriesData=get(handles.figure1,'UserData');
     1801     SeriesData=get(handles.series,'UserData');
    18111802     filename=SeriesData.CurrentInputFile;
    18121803     if exist(filename,'file')
     
    18351826         delete(hget_field)
    18361827     end
    1837      %hseries=get(handles.FieldMenu,'parent');
    1838      SeriesData=get(handles.figure1,'UserData');
     1828     SeriesData=get(handles.series,'UserData');
    18391829     filename=SeriesData.CurrentInputFile_1;
    18401830     if exist(filename,'file')
     
    18881878num_i_out=num_i;
    18891879num_j_out=num_j;
    1890 if isequal (NomType,'_i1-i2_j') || isequal (NomType,'_i1-i2')
     1880if isequal (NomType,'_1-2_1') || isequal (NomType,'_1-2')
    18911881    num_i1_line=num_i+ind_shift(3);% set of first image numbers
    18921882    num_i2_line=num_i+ind_shift(4);
     
    19001890    [xx,num_i1]=meshgrid(num_j,num_i1_line);
    19011891    [xx,num_i2]=meshgrid(num_j,num_i2_line);
    1902 elseif isequal (NomType,'_i_j1-j2') || isequal (NomType,'#_ab')
     1892elseif isequal (NomType,'_1_1-2') || isequal (NomType,'#_ab')
    19031893    if isequal(mode,'bursts') %case of bursts (png_old or png_2D)
    19041894        num_j1=ind_shift(1)*ones(size(num_i));
     
    19211911function displ_time(handles,times)
    19221912%------------------------------------------------------------------------
    1923 hseries=get(handles.last_i,'parent');
    1924 SeriesData=get(hseries,'UserData');%
     1913SeriesData=get(handles.series,'UserData');%
    19251914first_i=str2num(get(handles.first_i,'String'));
    19261915first_j=str2num(get(handles.first_j,'String'));
    19271916last_i=str2num(get(handles.last_i,'String'));
    19281917last_j=str2num(get(handles.last_j,'String'));
    1929 % index_civ=get(handles.list_pair_civ,'Value');
    1930 % NomType=get(handles.NomType,'String');
    19311918NomType=SeriesData.NomType;
    19321919mode_list=get(handles.mode,'String');
    19331920index_mode=get(handles.mode,'Value');
    19341921mode=mode_list{index_mode};
    1935 % ind_shift=0;%default
    19361922
    19371923time_first=[];
     
    19441930    time_last_cell{iview}='?';%default
    19451931    time=SeriesData.Time{iview};
    1946     if isequal(NomType{iview},'_i1-i2_j')|isequal(NomType{iview},'_i_j1-j2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_i1-i2')
     1932    if isequal(NomType{iview},'_1-2_1')|isequal(NomType{iview},'_1_1-2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_1-2')
    19471933        if isfield(SeriesData,'displ_num')& ~isempty(SeriesData.displ_num)
    19481934            ind_shift=SeriesData.displ_num(iview,:);
     
    20212007function GetObject_Callback(hObject, eventdata, handles)
    20222008%------------------------------------------------------------------------
    2023 hseries=get(handles.GetObject,'parent');
    2024 SeriesData=get(hseries,'UserData');
     2009SeriesData=get(handles.series,'UserData');
    20252010value=get(handles.GetObject,'Value');
    20262011if value
     
    20752060%     end
    20762061end
    2077 set(hseries,'UserData',SeriesData)
     2062set(handles.series,'UserData',SeriesData)
    20782063
    20792064%--------------------------------------------------------------
     
    21142099global nb_transform
    21152100
    2116 % huvmat=get(handles.transform_fct,'parent');
    21172101menu=get(handles.transform_fct,'String');
    21182102ind_coord=get(handles.transform_fct,'Value');
     
    23052289end
    23062290
    2307 %------------------------------------------------------------------------
    2308 % --- generates series of file indices corresponding to a file fileinput
    2309 function [num_i1,num_i2,num_j1,num_j2]=find_indexseries(fileinput)
    2310 %------------------------------------------------------------------------
    2311 num_i1=NaN;%default
    2312 num_i2=NaN;%default
    2313 num_j1=NaN;%default
    2314 num_j2=NaN;%default
    2315 % refresh input root name, indices, file extension and nomenclature
    2316 [RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput);
    2317 if strcmp(SubDir,'')
    2318     filebasesub=fullfile(RootPath,RootFile);
    2319 else
    2320     filebasesub=fullfile(RootPath,SubDir,RootFile);
    2321 end
    2322 dirpair=[]; %default
    2323 switch NomType
    2324     case '_1'
    2325         dirpair=dir([filebasesub '_*' FileExt]);
    2326     case '_1_1'
    2327         dirpair=dir([filebasesub '_*_*' FileExt]);
    2328     case '_i1-i2'
    2329         dirpair=dir([filebasesub '_*-*' FileExt]);
    2330     case '1_ab'
    2331         dirpair=dir([filebasesub '*_*' FileExt]);
    2332     case '_i_j1-j2'
    2333         dirpair=dir([filebasesub '*_*-*' FileExt]);   
    2334     case '_i1-i2_j'
    2335         dirpair=dir([filebasesub '*-*_*' FileExt]);   
    2336 end
    2337 for ifile=1:length(dirpair)
    2338     [RootPath,RF,str_1,str_2,str_a,str_b]=name2display(dirpair(ifile).name);
    2339     num_i1(ifile)=str2double(str_1);
    2340     num_i2(ifile)=str2double(str_2);
    2341     if isnan(num_i2(ifile))
    2342         num_i2(ifile)=num_i1(ifile);
    2343     end
    2344     num_j1(ifile)=stra2num(str_a);
    2345     if isnan(num_j1(ifile))
    2346         num_j1(ifile)=1;
    2347     end
    2348     num_j2(ifile)=stra2num(str_b);
    2349     if isnan(num_j2(ifile))
    2350         num_j2(ifile)=num_j1(ifile);
    2351     end
    2352 end
    2353 
     2291
     2292
  • trunk/src/uvmat.m

    r326 r332  
    660660    end
    661661end
    662 if ~strcmp(hhh,'')&& mmreader.isPlatformSupported()% if the function is found (recent version of matlab)
     662if ~strcmp(hhh,'')% if the function mmreader is found (recent version of matlab)
    663663    UvData.MovieObject=mmreader([FileBase FileIndices FileExt]);
    664664elseif isfield(UvData,'MovieObject')
     
    13601360%     NomType=get(handles.FileIndex,'UserData');
    13611361    switch NomType
    1362     case {'_i_j1-j2','#_ab','%3dab'},% pair with j index
     1362    case {'_1_1-2','#_ab','%3dab'},% pair with j index
    13631363        set(handles.fix_pair,'Visible','on')% option fixed pair on/off made visible (choice of avaible pair with buttons + and - if ='off')
    13641364    otherwise
     
    17781778%% read the current input file name(s) and field indices
    17791779InputFile=read_GUI(handles.InputFile);
    1780 InputFile.RootFile=regexprep(InputFile.RootFile,'\<[\\/]|[\\/]\>','');%suppress possible / or \ separator at the beginning or the end of the string
    1781 InputFile.SubDir=regexprep(InputFile.SubDir,'\<[\\/]|[\\/]\>','');%suppress possible / or \ separator at the beginning or the end of the string
     1780InputFile.RootFile=regexprep(InputFile.RootFile,'^[\\/]|[\\/]$','');%suppress possible / or \ separator at the beginning or the end of the string
     1781InputFile.SubDir=regexprep(InputFile.SubDir,'^[\\/]|[\\/]$','');%suppress possible / or \ separator at the beginning or the end of the string
    17821782if isempty(InputFile.RootFile)
    17831783    filebase=InputFile.RootPath;
     
    31493149NomTypeNew=NomType;%default
    31503150if isequal(field,'image')
    3151     if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')
    3152         NomTypeNew='_i_j';
     3151    if isequal(NomType,'_1-2_1')||isequal(NomType,'_1_1-2')
     3152        NomTypeNew='_1_1';
    31533153    elseif isequal(NomType,'#_ab')
    31543154        NomTypeNew='#a';
    3155     elseif isequal(NomType,'_i1-i2')
    3156         NomTypeNew='_i';
     3155    elseif isequal(NomType,'_1-2')
     3156        NomTypeNew='_1';
    31573157    end
    31583158    imagename=name_generator(FileBase,str2double(str1),str2double(str_a),'.png',NomTypeNew,1,str2double(str2),str2double(str_b),'');
     
    32703270if isequal(field_1,'image')
    32713271    % transform netc type to the corresponding image type
    3272     if isequal(NomType_1,'_i1-i2_j')||isequal(NomType_1,'_i_j1-j2')|| isequal(NomType_1,'#_ab')|| isequal(NomType_1,'_i1-i2')
     3272    if isequal(NomType_1,'_1-2_1')||isequal(NomType_1,'_1_1-2')|| isequal(NomType_1,'#_ab')|| isequal(NomType_1,'_1-2')
    32733273        UvData.SubDir_1=get(handles.SubDir_1,'String'); %preserve the InputFile.SubDir in memory   
    3274         if isequal(NomType_1,'_i1-i2_j')||isequal(NomType_1,'_i_j1-j2')
    3275             NomTypeNew='_i_j';
     3274        if isequal(NomType_1,'_1-2_1')||isequal(NomType_1,'_1_1-2')
     3275            NomTypeNew='_1_1';
    32763276        elseif isequal(NomType_1,'#_ab')
    32773277            NomTypeNew='#a';
    3278         elseif isequal(NomType_1,'_i1-i2')
    3279             NomTypeNew='_i';
     3278        elseif isequal(NomType_1,'_1-2')
     3279            NomTypeNew='_1';
    32803280        end 
    32813281    end
     
    33213321        str1=get(handles.i1,'String');
    33223322        str_a=get(handles.j1,'String');
    3323         if isequal(NomType_1,'#_ab')||isequal(NomType_1,'_i1-i2_j')||isequal(NomType_1,'_i_j1-j2')||isequal(NomType_1,'_i1-i2')
     3323        if isequal(NomType_1,'#_ab')||isequal(NomType_1,'_1-2_1')||isequal(NomType_1,'_1_1-2')||isequal(NomType_1,'_1-2')
    33243324            NomTypeNew=NomType_1;
    33253325        elseif isequal(NomType_1,'#a')
    33263326             [filename, n1,na,n2,nb,SubDir_1]=name_generator(filebase_1, str2num(str1),stra2num(str_a),'.nc','#_ab',0,[],[],SubDir_1);
    33273327             NomTypeNew='#_ab';
    3328         elseif isequal(NomType_1,'_i_j')
    3329              [filename,n1,na,n2,nb,SubDir_1]=name_generator(filebase_1,str2num(str1),stra2num(str_a),'.nc','_i1-i2_j',0,str2num(str1),[],SubDir_1);
     3328        elseif isequal(NomType_1,'_1_1')
     3329             [filename,n1,na,n2,nb,SubDir_1]=name_generator(filebase_1,str2num(str1),stra2num(str_a),'.nc','_1-2_1',0,str2num(str1),[],SubDir_1);
    33303330            if idetect==1
    3331                 NomTypeNew='_i1-i2_j';
     3331                NomTypeNew='_1-2_1';
    33323332            else
    3333                 NomTypeNew='_i_j1-j2';
     3333                NomTypeNew='_1_1-2';
    33343334            end
    33353335        else %for instance avi files or any ima_num series
    3336             [filename,n1,na,n2,nb,SubDir_1]=name_generator(filebase_1,str2num(str1),stra2num(str_a),'.nc','_i1-i2',0,str2num(str1),[],SubDir_1);
    3337             NomTypeNew='_i1-i2';
     3336            [filename,n1,na,n2,nb,SubDir_1]=name_generator(filebase_1,str2num(str1),stra2num(str_a),'.nc','_1-2',0,str2num(str1),[],SubDir_1);
     3337            NomTypeNew='_1-2';
    33383338        end           
    33393339        [Path,Name]=fileparts(filebase_1);
Note: See TracChangeset for help on using the changeset viewer.