Changeset 236 for trunk/src/uvmat.m


Ignore:
Timestamp:
Apr 12, 2011, 12:12:19 AM (13 years ago)
Author:
sommeria
Message:

correct Matlab PIV, remove call to image tool box. Improve menu of uvmat VelType? (replacement of buttons)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r235 r236  
    5050%          .MovieObject_1: idem for a second input series (_1)
    5151%          .filename_1 : last second input file name (to deal with a constant second input without reading again the file)
    52 %          .VelType_1: last velocity type (civ1, civ2...) for the second input series
     52%          .VelType_1: last velocity type (VelType, civ2...) for the second input series
    5353%          .FieldName_1: last field name(velocity, vorticity...) for the second input series
    5454%          .ZMin, .ZMax: range of the z coordinate
     
    387387    end
    388388end
     389
    389390set_vec_col_bar(handles) %update the display of color code for vectors
    390391
     
    518519    return
    519520end
    520 [RootPath,RootFile,i1,i2,str_a,str_b,ext,NomType,SubDir]=name2display(fileinput);
     521[RootPath,RootFile,i1,i2,str_a,str_b,ext,NomType,SubDir]=name2display(fileinput);%extract information from the file name
    521522ext_test=''; %default
    522 if ~isempty(ext)
     523if ~isempty(ext) % if a file extension is detected
    523524    form=imformats(ext(2:end));%test valid Matlab image formats
    524525    if ~isempty(form)
     
    533534            [RootPath,RootFile]=fileparts(fileinput); %include the indices in the root file
    534535        end
    535     elseif isequal(lower(ext),'.avi')
     536    elseif isequal(lower(ext),'.avi')%case of avi movie file
    536537        ext_test='.image';
    537538        i1='1'; % set the frame counter to 1 by default
     
    663664UvData.TestInputFile=1;
    664665set(handles.fix_pair,'Value',1) % activate by default the comp_input '-'input window
    665 
     666set(handles.FixVelType,'Value',0); %desactivate fixed veltype
    666667[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles);
    667668if ~exist(FileName,'file')
     
    873874if ~testima
    874875    testcivx=0;
    875     % hget_field=findobj('Name','get_field');
    876     %     if isequal(FileExt,'.nc')||isequal(FileExt,'.cdf')
    877876    if isfield(UvData,'FieldsString') && isequal(UvData.FieldsString,{'get_field...'})% field menu defined as input (from get_field)
    878877        set(handles.Fields,'Value',1)
     
    880879        UvData=rmfield(UvData,'FieldsString');
    881880    else
    882         %if isempty(hget_field)
    883         Data=nc2struct(FileName,'ListGlobalAttribute','absolut_time_T0','civ');
    884         if ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)%if the new input is Civx
     881        Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ');
     882        if strcmp(Data.Conventions,'uvmat/civdata') ||( ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0))%if the new input is Civx
    885883            FieldList=calc_field;
    886884            set(handles.Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data
     
    890888            testcivx=1;
    891889        end
    892         %     else
    893         %          hhget_field=guidata(hget_field);
    894         %         if ~strcmp(get(hhget_field.inputfile,'String'),FileName)%delete any existing get_field GUI with file name different than the input
    895         %             delete(hget_field)
    896         %         end
    897         %     end
    898890        if ~testcivx
    899891            set(handles.Fields,'Value',1) % set menu to 'get_field...
     
    902894        end
    903895        set(handles.col_vec,'String',col_vec)
    904         %     else
    905         %         msgbox_uvmat('ERROR',['invalid input file extension ' FileExt])
    906         %         return
    907         %     end
    908896    end
    909897end
     
    1001989        '*.dat','.dat text files ';...
    1002990        '*.*',  'All Files (*.*)'}, ...
    1003         'Pick a file',RootPath);
     991        'Pick a second file for comparison',RootPath);
    1004992fileinput_1=[PathName FileName];%complete file name
    1005 % testblank=findstr(fileinput_1,' ');%look for blanks
    1006 % if ~isempty(testblank)
    1007 %     msgbox_uvmat('ERROR',['The input file name ' fileinput_1 ' contains blank character : This is not allowed. Please change name'])
    1008 %     return
    1009 % end
    1010993sizf=size(fileinput_1);
    1011994if (~ischar(fileinput_1)||~isequal(sizf(1),1)),return;end
     
    11811164
    11821165% % default choice of fields
    1183 % if isequal(ext_test,'.image')
    1184 % %    set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})
    1185 % %    set(handles.Fields_1,'Value',2) % set menu to 'image'
    1186 % elseif strcmp(FileExt_1,'.nc')||strcmp(FileExt_1,'.cdf')
    1187 %    Data=nc2struct(fileinput_1,[]);
    1188 % %    if isfield(Data,'absolut_time_T0')
    1189 % %        set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})
    1190 % %        set(handles.Fields_1,'Value',4) % set menu to 'velocity'
    1191 % %    else   
    1192 % %        set(handles.Fields_1,'Value',2) % set menu to 'get_field...'
    1193 % %        set(handles.Fields_1,'String',{'';'get_field...'});
    1194 % %    end
    1195 % end 
    1196 set(handles.SubField,'Visible','on')
     1166%set(handles.SubField,'Visible','on')
    11971167set(handles.SubField,'Value',1)
    11981168RootPath_1_Callback(hObject,eventdata,handles); 
     
    12301200    msgbox_uvmat('ERROR',['input file ' FileName ' not found']);
    12311201end
     1202set(handles.FixVelType,'Value',0); %desactivate fixed veltype
    12321203nbfield_1=[];%default
    12331204nburst_1=[];%default
     
    21342105        FieldName= list_fields{index_fields}; % selected field
    21352106        if ~strcmp(FieldName,'get_field...')
    2136            VelType=setfield(handles);% read the velocity type.
     2107           TestVelType=get(handles.FixVelType,'Value');
     2108           if TestVelType
     2109               VelType=setfield(handles);% read the velocity type.
     2110           end
    21372111        end
    21382112        if strcmp(FieldName,'velocity')
     
    21772151        return
    21782152    end
     2153       
    21792154    if isfield(ParamOut,'Npx')&& isfield(ParamOut,'Npy')
    21802155        set(handles.npx,'String',num2str(ParamOut.Npx));% display image size on the interface
     
    21892164end
    21902165
    2191 %% choose a second field if Subfield option is 'on', and if the field has changed
     2166%% choose a second field filename_1 if defined
    21922167VelType_1=[];%default
    21932168FieldName_1=[];
     
    22012176        FieldName_1=[];%default
    22022177        VelType_1=[];%default
    2203         Ext_1=get(handles.FileExt_1,'String');
     2178        if strcmp(get(handles.FileExt_1,'Visible'),'on')
     2179            Ext_1=get(handles.FileExt_1,'String');
     2180        else
     2181            Ext_1=get(handles.FileExt,'String');%read the file extension for the first series (case of veltype comparison within a single file)
     2182        end
    22042183        NomType_1=get(handles.FileIndex_1,'UserData');
    22052184        if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf')
     
    22202199            end
    22212200        else
     2201           if length(Ext_1)>=2
    22222202           form=imformats(Ext_1(2:end));
    22232203           if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
     
    22282208               end
    22292209           end
     2210           end
    22302211        end
    22312212        if strcmp(FileType_1,'netcdf')
     
    22342215            FieldName_1= list_fields{index_fields}; % selected field
    22352216            if ~isequal(FieldName_1,'get_field...')% read the field names on the interface get_field...
    2236                 VelType_1=setfield_1(handles);
     2217                VelType_1='';
     2218                if get(handles.FixVelType,'Value')
     2219                    VelTypeList=get(handles.VelType_1,'String');
     2220                    index=get(handles.VelType_1,'Value');
     2221                    VelType_1=VelTypeList{index};
     2222                end
    22372223            end
    22382224            if strcmp(VelType_1,'*')% free veltype choice
     
    22692255            [Field{2},ParamOut_1,errormsg] = read_field(Name,FileType_1,ParamIn,num_i1);
    22702256            if ~isempty(errormsg)
    2271                 errormsg=['error in reading ' filename_1 ': ' errormsg];
     2257                errormsg=['error in reading ' FieldName_1 ' in ' filename_1 ': ' errormsg];
    22722258                return
    22732259            end
     
    22862272end
    22872273
    2288 %% update the display buttons for the first velocity type (first menuline)
    2289 veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
     2274%% update the display menu for the first velocity type (first menuline)
     2275% veltype_handles=[handles.VelType handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
     2276% if ~isequal(FileType,'netcdf')|| isequal(FieldName,'get_field...')
     2277%     set(veltype_handles,'Visible','off')
     2278% else% if isempty(ParamOut.VelType) && ~isequal(FieldName,'get_field...')
     2279%     set_veltype_display(veltype_handles,ParamOut.CivStage)%update the display of available velocity types for the first field
     2280%     if isempty(ParamOut.VelType)
     2281%         reset_vel_type(veltype_handles)
     2282%     else
     2283%         handle1=eval(['handles.' ParamOut.VelType]);
     2284%         reset_vel_type(veltype_handles,handle1)
     2285%     end
     2286% end
     2287test_veltype=0;
    22902288if ~isequal(FileType,'netcdf')|| isequal(FieldName,'get_field...')
    2291 %     reset_vel_type(veltype_handles)
    2292     set(veltype_handles,'Visible','off')
    2293 else% if isempty(ParamOut.VelType) && ~isequal(FieldName,'get_field...')
    2294     set_veltype_display(veltype_handles,ParamOut.CivStage)%update the display of available velocity types for the first field
    2295     if isempty(ParamOut.VelType)
    2296         reset_vel_type(veltype_handles)
    2297     else
    2298         handle1=eval(['handles.' ParamOut.VelType]);
    2299         reset_vel_type(veltype_handles,handle1)
    2300     end
     2289    set(handles.VelType,'Visible','off')
     2290else
     2291    test_veltype=1;
     2292    set(handles.VelType,'Visible','on')
     2293    set(handles.VelType_1,'Visible','on')
     2294    set(handles.FixVelType,'Visible','on')
     2295    menu=set_veltype_display(ParamOut.CivStage);
     2296    index_menu=strcmp(ParamOut.VelType,menu);
     2297    set(handles.VelType,'Value',find(index_menu,1))
     2298    set(handles.VelType,'String',menu)
     2299%     set(handles.VelType_1,'Value',1)
     2300%     set(handles.VelType_1,'String',[{''};menu])
    23012301end
    23022302field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList);
     
    23042304set(handles.Fields,'Value',find(field_index,1))
    23052305
    2306 %% update the display buttons for the second velocity type (second menuline)
    2307 if ~isempty(filename_1)
    2308     veltype_handles_1=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
     2306%% update the display menu for the second velocity type (second menuline)
     2307% if ~isempty(filename_1)
     2308%     veltype_handles_1=[handles.VelType_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
     2309%     if ~isequal(FileType_1,'netcdf')|| isequal(FieldName_1,'get_field...')
     2310%         set(veltype_handles_1,'Visible','off')
     2311%         %reset_vel_type(veltype_handles_1)
     2312%     else %if isempty(VelType_1) && ~isequal(FieldName_1,'get_field...')
     2313%         set_veltype_display(veltype_handles_1,ParamOut_1.CivStage)%update the display of available velocity types for the first field
     2314%         if isempty(ParamOut_1.VelType)
     2315%             reset_vel_type(veltype_handles_1)
     2316%         else
     2317%             handle1=eval(['handles.' ParamOut_1.VelType '_1']);
     2318%             reset_vel_type(veltype_handles_1,handle1)
     2319%         end
     2320%     end
     2321%     field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList);
     2322%     set(handles.Fields_1,'String',ParamOut_1.FieldList); %update the field menu
     2323%     set(handles.Fields_1,'Value',find(field_index,1))
     2324% end
     2325test_veltype_1=0;
     2326if isempty(filename_1)
     2327    set(handles.Fields_1,'Value',1); %update the field menu
     2328    set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu
     2329else
    23092330    if ~isequal(FileType_1,'netcdf')|| isequal(FieldName_1,'get_field...')
    2310         set(veltype_handles_1,'Visible','off')
    2311         %reset_vel_type(veltype_handles_1)
    2312     else %if isempty(VelType_1) && ~isequal(FieldName_1,'get_field...')
    2313         set_veltype_display(veltype_handles_1,ParamOut_1.CivStage)%update the display of available velocity types for the first field
    2314         if isempty(ParamOut_1.VelType)
    2315             reset_vel_type(veltype_handles_1)
    2316         else
    2317             handle1=eval(['handles.' ParamOut_1.VelType '_1']);
    2318             reset_vel_type(veltype_handles_1,handle1)
    2319         end
    2320     end
    2321     field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList);
    2322     set(handles.Fields_1,'String',ParamOut_1.FieldList); %update the field menu
    2323     set(handles.Fields_1,'Value',find(field_index,1))
    2324 end
    2325 
     2331        set(handles.VelType_1,'Visible','off')
     2332    else
     2333        test_veltype_1=1;
     2334        set(handles.VelType_1,'Visible','on')
     2335        if ~get(handles.FixVelType,'Value')
     2336            menu=set_veltype_display(ParamOut_1.CivStage);
     2337            index_menu=strcmp(ParamOut_1.VelType,menu);
     2338            set(handles.VelType_1,'Value',1+find(index_menu,1))
     2339            set(handles.VelType_1,'String',[{''};menu])
     2340        end
     2341    end
     2342end
     2343if test_veltype||test_veltype_1
     2344     set(handles.FixVelType,'Visible','on')
     2345else
     2346     set(handles.FixVelType,'Visible','off')
     2347end
     2348   
    23262349%% introduce w as background image by default for a new series (only for nbdim=2)
    23272350if ~isfield(UvData,'NewSeries')
     
    24322455       NbDim=2;
    24332456    end
    2434 elseif VarType{imax}.coord(NbDim)>0 %structured coordinate 
     2457elseif numel(VarType)>=imax && numel(VarType{imax}.coord)>=NbDim && VarType{imax}.coord(NbDim)>0 %structured coordinate 
    24352458    XName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim)};
    24362459    if NbDim>1
    24372460        YName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim-1)}; %structured coordinates
    24382461    end
     2462else
     2463    errormsg='input field coordinates not defined';
     2464    return
    24392465end
    24402466if NbDim==3
     
    25682594
    25692595% main projection object (uvmat display)
     2596list_object=get(handles.list_object_1,'String');
     2597if isequal(list_object,{''})%refresh list of objects if the menu is empty
     2598    UvData.Object={[]};
     2599    set(handles.list_object_1,'Value',1)
     2600    set(handles.list_object_2,'Value',1)
     2601    set(handles.list_object_2,'String',{''})
     2602    set(handles.list_object_2,'Visible','off')
     2603end
    25702604IndexObj(1)=get(handles.list_object_1,'Value');%selected projection object for main view
    25712605if IndexObj(1)> numel(UvData.Object)
     
    28742908end
    28752909test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]);
    2876 test_civ1=isequal(get(handles.civ1,'BackgroundColor'),[1 1 0]);
     2910test_civ1=isequal(get(handles.VelType,'BackgroundColor'),[1 1 0]);
    28772911if ~test_civ2 && ~test_civ1
    28782912    msgbox_uvmat('ERROR','manual correction only possible for CIV1 or CIV2 velocity fields')
     
    29252959%determines the fields to read from the interface
    29262960%------------------------------------------------------------------
    2927 function [VelType,civ]=setfield(handles)
    2928 
    2929 VelType=[]; %default
    2930 if (get(handles.civ1,'Value') == 1);
    2931         VelType='civ1';
    2932 % interp1   
    2933 elseif (get(handles.interp1,'Value') == 1);
    2934     VelType='interp1';
    2935 % filter1   
    2936 elseif (get(handles.filter1,'Value') == 1);
    2937     VelType='filter1'; 
    2938 % CIV2
    2939 elseif (get(handles.civ2,'Value') == 1);
    2940     VelType='civ2';
    2941 % interp2   
    2942 elseif (get(handles.interp2,'Value') == 1);
    2943     VelType='interp2';
    2944 % filter2   
    2945 elseif (get(handles.filter2,'Value') == 1); 
    2946     VelType='filter2';
    2947 end
    2948 
    2949 if isequal(get(handles.filter2,'Visible'),'on');
    2950     civ=6;
    2951 % interp1   
    2952 elseif isequal(get(handles.interp2,'Visible'),'on');
    2953     civ=5;
    2954 % filter1   
    2955 elseif isequal(get(handles.civ2,'Visible'),'on');
    2956     civ=4; 
    2957 % CIV2
    2958 elseif isequal(get(handles.filter1,'Visible'),'on');
    2959    civ=3;
    2960 % interp2   
    2961 elseif isequal(get(handles.interp1,'Visible'),'on');
    2962     civ=2;
    2963 % filter2   
    2964 elseif isequal(get(handles.civ1,'Visible'),'on'); 
    2965     civ=1;
    2966 else
    2967     civ=0;
    2968 end
     2961function VelType=setfield(handles)
     2962VelTypeList=get(handles.VelType,'String');
     2963index=get(handles.VelType,'Value');
     2964VelType=VelTypeList{index};
     2965
     2966% VelType=[]; %default
     2967% if (get(handles.VelType,'Value') == 1);
     2968%         VelType='civ1';
     2969% % interp1   
     2970% elseif (get(handles.interp1,'Value') == 1);
     2971%     VelType='interp1';
     2972% % filter1   
     2973% elseif (get(handles.filter1,'Value') == 1);
     2974%     VelType='filter1'; 
     2975% % CIV2
     2976% elseif (get(handles.civ2,'Value') == 1);
     2977%     VelType='civ2';
     2978% % interp2   
     2979% elseif (get(handles.interp2,'Value') == 1);
     2980%     VelType='interp2';
     2981% % filter2   
     2982% elseif (get(handles.filter2,'Value') == 1); 
     2983%     VelType='filter2';
     2984% end
     2985%
     2986% if isequal(get(handles.filter2,'Visible'),'on');
     2987%     civ=6;
     2988% % interp1   
     2989% elseif isequal(get(handles.interp2,'Visible'),'on');
     2990%     civ=5;
     2991% % filter1   
     2992% elseif isequal(get(handles.civ2,'Visible'),'on');
     2993%     civ=4; 
     2994% % CIV2
     2995% elseif isequal(get(handles.filter1,'Visible'),'on');
     2996%    civ=3;
     2997% % interp2   
     2998% elseif isequal(get(handles.interp1,'Visible'),'on');
     2999%     civ=2;
     3000% % filter2   
     3001% elseif isequal(get(handles.VelType,'Visible'),'on'); 
     3002%     civ=1;
     3003% else
     3004%     civ=0;
     3005% end
    29693006
    29703007%-------------------------------------------------------------------
     
    29723009%------------------------------------------------------------------
    29733010function VelType=setfield_1(handles)
    2974 
    2975 VelType=[]; %default
    2976 if (get(handles.civ1_1,'Value') == 1);
    2977     VelType='civ1';
    2978 % interp1   
    2979 elseif (get(handles.interp1_1,'Value') == 1);
    2980     VelType='interp1';
    2981 % filter1   
    2982 elseif (get(handles.filter1_1,'Value') == 1);
    2983     VelType='filter1'; 
    2984 % CIV2
    2985 elseif (get(handles.civ2_1,'Value') == 1);
    2986     VelType='civ2';
    2987 % interp2   
    2988 elseif (get(handles.interp2_1,'Value') == 1);
    2989     VelType='interp2';
    2990 % filter2   
    2991 elseif (get(handles.filter2_1,'Value') == 1); 
    2992     VelType='filter2';
    2993 end
     3011VelTypeList=get(handles.VelType_1,'String');
     3012index=get(handles.VelType_1,'Value');
     3013VelType=VelTypeList{index};
     3014% VelType=[]; %default
     3015% if (get(handles.VelType_1,'Value') == 1);
     3016%     VelType='civ1';
     3017% % interp1   
     3018% elseif (get(handles.interp1_1,'Value') == 1);
     3019%     VelType='interp1';
     3020% % filter1   
     3021% elseif (get(handles.filter1_1,'Value') == 1);
     3022%     VelType='filter1'; 
     3023% % CIV2
     3024% elseif (get(handles.civ2_1,'Value') == 1);
     3025%     VelType='civ2';
     3026% % interp2   
     3027% elseif (get(handles.interp2_1,'Value') == 1);
     3028%     VelType='interp2';
     3029% % filter2   
     3030% elseif (get(handles.filter2_1,'Value') == 1); 
     3031%     VelType='filter2';
     3032% end
    29943033
    29953034
     
    29973036% --- Executes on button press in SubField
    29983037function SubField_Callback(hObject, eventdata, handles)
    2999 huvmat=get(handles.run0,'parent');
    3000 UvData=get(huvmat,'UserData');
     3038% huvmat=get(handles.run0,'parent');
     3039UvData=get(handles.uvmat,'UserData');
    30013040if get(handles.SubField,'Value')==0% if the subfield button is desactivated   
    30023041    set(handles.RootPath_1,'String','')
     
    30113050    set(handles.FileExt_1,'Visible','off');
    30123051    set(handles.Fields_1,'Value',1);%set to blank state
    3013     set_veltype_display([handles.civ1_1 handles.interp1_1 handles.filter1_1 ...
    3014             handles.civ2_1 handles.interp2_1 handles.filter2_1],0)
     3052    set(handles.VelType_1,'Value',1);%set to blank state
     3053    if ~strcmp(get(handles.VelType,'Visible'),'on')
     3054        set(handles.VelType_1,'Visible','off')
     3055    end
     3056%     set_veltype_display([handles.VelType_1 handles.interp1_1 handles.filter1_1 ...
     3057%             handles.civ2_1 handles.interp2_1 handles.filter2_1],0)
    30153058    if isfield(UvData,'XmlData_1')
    30163059        UvData=rmfield(UvData,'XmlData_1');
    30173060    end
    3018     set(huvmat,'UserData',UvData);
     3061    set(handles.uvmat,'UserData',UvData);
    30193062    run0_Callback(hObject, eventdata, handles); %run
    30203063else
     
    30943137field= list_fields{index_fields(1)}; % selected string
    30953138if isequal(field,'get_field...')
    3096      veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
    3097      set_veltype_display(veltype_handles,0) % unvisible civ buttons
     3139     set(handles.FixVelType,'visible','off')
     3140      set(handles.VelType,'visible','off')
     3141       set(handles.VelType_1,'visible','off')
     3142%      veltype_handles=[handles.VelType handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
     3143%      set_veltype_display(veltype_handles,0) % unvisible civ buttons
    30983144     filename=read_file_boxes(handles);
    30993145     hget_field=findobj(allchild(0),'name','get_field');
     
    31523198        return
    31533199%     end
    3154 %     veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
     3200%     veltype_handles=[handles.VelType handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
    31553201%     set_veltype_display(veltype_handles,0) % unvisible civ buttons
    31563202else
     
    31683214       %  MenuBrowse_Callback(hObject, eventdata, handles)
    31693215    end
    3170     if isequal(field,'vort') || isequal(field,'div') || isequal(field,'strain')
    3171         set(handles.civ1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey
    3172         set(handles.civ2,'BackgroundColor',[0.702 0.702 0.702])
    3173         set(handles.interp1,'BackgroundColor',[0.702 0.702 0.702])
    3174         set(handles.interp2,'BackgroundColor',[0.702 0.702 0.702])
    3175     elseif isequal(field,'more...');
    3176         set(handles.civ1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey
    3177         set(handles.civ2,'BackgroundColor',[0.702 0.702 0.702])
    3178         str=calc_field;%get the list of available scalars by the function calc_scal
    3179         [ind_answer] = listdlg('PromptString','Select a file:',...
    3180                 'SelectionMode','single',...
    3181                 'ListString',str);
    3182        % edit the choice in the field and action menu
    3183         scalar=cell2mat(str(ind_answer));
    3184         menu=update_menu(handles.Fields,scalar);
    3185         menu=[{''};menu];
    3186         set(handles.Fields_1,'String',menu);% store the selected scalar type
    3187     end
     3216%     if isequal(field,'vort') || isequal(field,'div') || isequal(field,'strain')
     3217% %         set(handles.VelType,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey
     3218% %         set(handles.civ2,'BackgroundColor',[0.702 0.702 0.702])
     3219% %         set(handles.interp1,'BackgroundColor',[0.702 0.702 0.702])
     3220% %         set(handles.interp2,'BackgroundColor',[0.702 0.702 0.702])
     3221%     elseif isequal(field,'more...');
     3222%         set(handles.VelType,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey
     3223%         set(handles.civ2,'BackgroundColor',[0.702 0.702 0.702])
     3224%         str=calc_field;%get the list of available scalars by the function calc_scal
     3225%         [ind_answer] = listdlg('PromptString','Select a file:',...
     3226%                 'SelectionMode','single',...
     3227%                 'ListString',str);
     3228%        % edit the choice in the field and action menu
     3229%         scalar=cell2mat(str(ind_answer));
     3230%         menu=update_menu(handles.Fields,scalar);
     3231%         menu=[{''};menu];
     3232%         set(handles.Fields_1,'String',menu);% store the selected scalar type
     3233%     end
    31883234end
    31893235indices=name_generator('',str2double(str1),str2double(str_a),'',NomTypeNew,1,str2double(str2),str2double(str_b),'');
     
    32583304
    32593305if isequal(field_1,'get_field...')
    3260      veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
     3306     veltype_handles=[handles.VelType handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
    32613307     set_veltype_display(veltype_handles,0) % unvisible civ buttons
    32623308     filename=read_file_boxes_1(handles);
     
    32763322if isequal(field_1,'image')
    32773323    % transform netc type to the corresponding image type
    3278 %     set(handles.FileExt_1,'String','.png');
    32793324    if isequal(NomType_1,'_i1-i2_j')||isequal(NomType_1,'_i_j1-j2')|| isequal(NomType_1,'#_ab')|| isequal(NomType_1,'_i1-i2')
    3280         UvData.SubDir_1=get(handles.SubDir_1,'String'); %preserve the subdir in memory
    3281 %         set(handles.SubDir_1,'String','')
    3282 %         set(handles.FileExt_1,'String','.png');       
     3325        UvData.SubDir_1=get(handles.SubDir_1,'String'); %preserve the subdir in memory   
    32833326        if isequal(NomType_1,'_i1-i2_j')||isequal(NomType_1,'_i_j1-j2')
    32843327            NomTypeNew='_i_j';
     
    33053348    display_file_name_1(hObject, eventdata, handles,imagename)%display the image
    33063349    return
    3307 %     veltype_handles=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
    3308 %     set_veltype_display(veltype_handles,0) % unvisible civ buttons
    33093350else
    33103351    set(handles.SubDir_1,'Visible','on')
    33113352    if ~isequal(FileExt_prev,'.nc') %find the new NomType if the previous display was not already a netcdf file
    3312         veltype_handles=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
    3313         set_veltype_display(veltype_handles,6); % make all civ buttons visible
     3353%         veltype_handles=[handles.VelType_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
     3354%         set_veltype_display(veltype_handles,6); % make all civ buttons visible
    33143355        RootPath_1=get(handles.RootPath_1,'String');
    33153356        RootFile_1=get(handles.RootFile_1,'String');
    3316         if isempty(RootPath_1)|isequal(RootPath_1,'')
     3357        if isempty(RootPath_1)||isequal(RootPath_1,'')
    33173358            set(handles.RootPath_1,'String','"')
    33183359        end
    3319         if isempty(RootFile_1) | isequal(RootFile_1,'')
     3360        if isempty(RootFile_1) || isequal(RootFile_1,'')
    33203361            set(handles.RootFile_1,'String','"')
    33213362        end
    3322         if ~isempty(RootFile_1)&(isequal(RootFile_1(1),'/')|isequal(RootFile_1(1),'\'))
     3363        if ~isempty(RootFile_1)&&(isequal(RootFile_1(1),'/')||isequal(RootFile_1(1),'\'))
    33233364            RootFile_1(1)=[];
    33243365        end
     
    33573398        set(handles.SubDir_1,'String',SubDir_1);
    33583399    end
    3359     if isequal(field,'vort') | isequal(field,'div') | isequal(field,'strain')
    3360         set(handles.civ1_1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey
     3400    if isequal(field,'vort') || isequal(field,'div') || isequal(field,'strain')
     3401        set(handles.VelType_1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey
    33613402        set(handles.civ2_1,'BackgroundColor',[0.702 0.702 0.702])
    33623403        set(handles.interp1_1,'BackgroundColor',[0.702 0.702 0.702])
    33633404        set(handles.interp2_1,'BackgroundColor',[0.702 0.702 0.702])
    33643405    elseif isequal(field_1,'more...'); %add new item to the menu
    3365         set(handles.civ1_1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey
     3406        set(handles.VelType_1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey
    33663407        set(handles.civ2_1,'BackgroundColor',[0.702 0.702 0.702])
    33673408        str=calc_field;%get the list of available scalars by the function calc_scal
     
    33843425
    33853426%common to Fields_Callback
    3386 if isequal(field,'image')|isequal(field_1,'image')
     3427if isequal(field,'image')||isequal(field_1,'image')
    33873428    set(handles.npx_title,'Visible','on')% visible npx,pxcm... buttons
    33883429    set(handles.npy_title,'Visible','on')
     
    33973438%     set(handles.fix_pair,'Value',1)
    33983439end
    3399 if isequal(field,'velocity')|isequal(field_1,'velocity');
     3440if isequal(field,'velocity')||isequal(field_1,'velocity');
    34003441    state_vect='on';
    34013442else
    34023443    state_vect='off';
    34033444end
    3404 if ~isequal(field,'velocity')|(~isequal(field_1,'velocity')&~isequal(field_1,''));
     3445if ~isequal(field,'velocity')||(~isequal(field_1,'velocity')&~isequal(field_1,''));
    34053446    state_scal='on';
    34063447else
     
    34153456%------------------------------------------------------------------------
    34163457% --- set the visibility of relevant velocity type menus:
    3417 function set_veltype_display(handles,Civ)
    3418 %------------------------------------------------------------------------
    3419 %Civ=0; all states 'off'
    3420 %Civ=6; all states 'on'
     3458function menu=set_veltype_display(Civ)
     3459%------------------------------------------------------------------------
    34213460if isequal(Civ,0)
    34223461    imax=0;
    3423 %    set(handles(1),'Visible','on')  % unvisible civ buttons
    3424 % else
    3425 %    set(handles(1),'String','civ1')
    3426 % end
    34273462elseif isequal(Civ,1) || isequal(Civ,2)
    34283463   imax=1;
     
    34343469    imax=6;
    34353470end
    3436 for ibutton=1:imax;
    3437     set(handles(ibutton),'Visible','on')  % unvisible civ buttons
    3438 end
    3439 % for ibutton=max(imax+1,2):6;
    3440 for ibutton=imax+1:6;
    3441     set(handles(ibutton),'Visible','off')  % unvisible civ buttons
    3442     set(handles(ibutton),'Value',0)%unactivate unvisible buttons
    3443 end
    3444 
    3445 %-------------------------------------------------------------------
    3446 % --- Executes on button press in civ1.
    3447 function civ1_Callback(hObject, eventdata, handles)
    3448 %-------------------------------------------------------------------
    3449 if get(handles.civ1,'Value')==1
    3450     reset_vel_type([handles.interp1 handles.civ2 handles.filter1 handles.interp1 handles.interp2 handles.filter2],handles.civ1)
    3451 else
    3452     reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
    3453 end
     3471menu={'civ1';'interp1';'filter1';'civ2';'interp2';'filter2'};
     3472menu=menu(1:imax);
     3473% for ibutton=1:imax;
     3474%     set(handles(ibutton),'Visible','on')  % unvisible civ buttons
     3475% end
     3476% % for ibutton=max(imax+1,2):6;
     3477% for ibutton=imax+1:6;
     3478%     set(handles(ibutton),'Visible','off')  % unvisible civ buttons
     3479%     set(handles(ibutton),'Value',0)%unactivate unvisible buttons
     3480% end
     3481
     3482%-------------------------------------------------------------------
     3483% --- Executes on button press in VelType.
     3484function VelType_Callback(hObject, eventdata, handles)
     3485%-------------------------------------------------------------------
     3486% if get(handles.VelType,'Value')==1
     3487%     reset_vel_type([handles.interp1 handles.civ2 handles.filter1 handles.interp1 handles.interp2 handles.filter2],handles.VelType)
     3488% else
     3489%     reset_vel_type([handles.VelType handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
     3490% end
     3491set(handles.FixVelType,'Value',1)
    34543492run0_Callback(hObject, eventdata, handles)
    34553493
    3456 %-------------------------------------------------------------------
    3457 % --- Executes on button press in interp1.
    3458 function interp1_Callback(hObject, eventdata, handles)
    3459 %-------------------------------------------------------------------
    3460 if get(handles.interp1,'Value')==1
    3461     reset_vel_type([handles.civ1 handles.civ2 handles.filter1 handles.interp2 handles.filter2],handles.interp1)
    3462 else
    3463      reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
    3464 end
    3465 run0_Callback(hObject, eventdata, handles)
    3466 
    3467 %-------------------------------------------------------------------
    3468 % --- Executes on button press in filter1.
    3469 function filter1_Callback(hObject, eventdata, handles)
    3470 %-------------------------------------------------------------------
    3471 if get(handles.filter1,'Value')==1
    3472     reset_vel_type([handles.civ1 handles.civ2 handles.interp1 handles.interp2 handles.filter2],handles.filter1)
    3473 else
    3474      reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
    3475 end
    3476 run0_Callback(hObject, eventdata, handles)
    3477 
    3478 %-------------------------------------------------------------------
    3479 % --- Executes on button press in civ2.
    3480 function civ2_Callback(hObject, eventdata, handles)
    3481 %-------------------------------------------------------------------
    3482 if get(handles.civ2,'Value')==1
    3483     reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.interp2 handles.filter2],handles.civ2)
    3484 else
    3485      reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
    3486 end
    3487 run0_Callback(hObject, eventdata, handles)
    3488 
    3489 %-----------------------------------------
    3490 % --- Executes on button press in interp2.
    3491 %-------------------------------------------
    3492 function interp2_Callback(hObject, eventdata, handles)
    3493 if get(handles.interp2,'Value')==1
    3494     reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.filter2],handles.interp2)
    3495 else
    3496      reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
    3497 end
    3498 run0_Callback(hObject, eventdata, handles)
    34993494%---------------------------------------------
    3500 % --- Executes on button press in filter2.
    3501 %-------------------------------------------
    3502 function filter2_Callback(hObject, eventdata, handles)
    3503 if get(handles.filter2,'Value')==1
    3504     reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2],handles.filter2)
    3505 else
    3506      reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
    3507 end
    3508 run0_Callback(hObject, eventdata, handles)
    3509 
     3495function VelType_1_Callback(hObject, eventdata, handles)
    35103496%---------------------------------------------
    3511 function civ1_1_Callback(hObject, eventdata, handles)
    3512 %---------------------------------------------
    3513 if get(handles.civ1_1,'Value')==1
    3514     reset_vel_type([handles.interp1_1 handles.civ2_1 handles.filter1_1 handles.interp1_1 handles.interp2_1 handles.filter2_1],handles.civ1_1)
    3515 else
    3516      reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])
    3517 end
    3518 run0_Callback(hObject, eventdata, handles)
    3519 
    3520 %--------------------------------------------
    3521 function interp1_1_Callback(hObject, eventdata, handles)
    3522 %--------------------------------------------
    3523 if get(handles.interp1_1,'Value')==1
    3524     reset_vel_type([handles.civ1_1 handles.civ2_1 handles.filter1_1 handles.interp2_1 handles.filter2_1],handles.interp1_1)
    3525 else
    3526     reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])
    3527 end
    3528 run0_Callback(hObject, eventdata, handles)
    3529 
    3530 %--------------------------------------------
    3531 function filter1_1_Callback(hObject, eventdata, handles)
    3532 %--------------------------------------------
    3533 if get(handles.filter1_1,'Value')==1
    3534     reset_vel_type([handles.interp1_1 handles.civ2_1 handles.interp1_1 handles.interp2_1 handles.filter2_1],handles.filter1_1)
    3535 else
    3536     reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])
    3537 end
    3538 run0_Callback(hObject, eventdata, handles)
    3539 
    3540 %--------------------------------------------
    3541 function civ2_1_Callback(hObject, eventdata, handles)
    3542 %--------------------------------------------
    3543 if get(handles.civ2_1,'Value')==1
    3544     reset_vel_type([handles.civ1_1 handles.interp1_1  handles.filter1_1 handles.interp2_1 handles.filter2_1],handles.civ2_1)
    3545 else
    3546     reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])
    3547 end
    3548 run0_Callback(hObject, eventdata, handles)
    3549 
    3550 %--------------------------------------------
    3551 function interp2_1_Callback(hObject, eventdata, handles)
    3552 %--------------------------------------------
    3553 if get(handles.interp2_1,'Value')==1
    3554     reset_vel_type([handles.civ1_1 handles.civ2_1 handles.filter1_1 handles.interp1_1 handles.filter2_1],handles.interp2_1)
    3555 else
    3556     reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])
    3557 end
    3558 run0_Callback(hObject, eventdata, handles)
    3559 
    3560 %--------------------------------------------
    3561 function filter2_1_Callback(hObject, eventdata, handles)
    3562 %--------------------------------------------
    3563 if get(handles.filter2_1,'Value')==1
    3564     reset_vel_type([handles.civ1_1 handles.interp1_1 handles.civ2_1 handles.filter1_1 handles.interp1_1 handles.interp2_1],handles.filter2_1)
    3565 else
    3566     reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])
    3567 end
    3568 run0_Callback(hObject, eventdata, handles)
     3497 
     3498set(handles.FixVelType,'Value',1)
     3499%refresh field with a second filename=first fiel name
     3500set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow
     3501drawnow
     3502filename=read_file_boxes(handles);
     3503if get(handles.SubField,'Value')
     3504    filename_1=read_file_boxes_1(handles);
     3505else
     3506    index=get(handles.VelType_1,'Value');
     3507    if index==1
     3508        filename_1='';% we plot the current field without the second field
     3509    else
     3510        filename_1=filename;
     3511    end
     3512end
     3513num_i1=stra2num(get(handles.i1,'String'));
     3514num_i2=stra2num(get(handles.i2,'String'));
     3515num_j1=stra2num(get(handles.j1,'String'));
     3516num_j2=stra2num(get(handles.j2,'String'));
     3517
     3518errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2);
     3519
     3520if ~isempty(errormsg)
     3521    msgbox_uvmat('ERROR',errormsg);
     3522else
     3523    set(handles.i1,'BackgroundColor',[1 1 1])
     3524    set(handles.i2,'BackgroundColor',[1 1 1])
     3525    set(handles.j1,'BackgroundColor',[1 1 1])
     3526    set(handles.j2,'BackgroundColor',[1 1 1])
     3527    set(handles.FileIndex,'BackgroundColor',[1 1 1])
     3528    set(handles.FileIndex_1,'BackgroundColor',[1 1 1])
     3529end
     3530set(handles.run0,'BackgroundColor',[1 0 0])
    35693531
    35703532%-----------------------------------------------
     
    36413603if isequal(get(handles.edit_vect,'Value'),1)
    36423604    test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]);
    3643     test_civ1=isequal(get(handles.civ1,'BackgroundColor'),[1 1 0]);
     3605    test_civ1=isequal(get(handles.VelType,'BackgroundColor'),[1 1 0]);
    36443606    if ~test_civ2 && ~test_civ1
    36453607        msgbox_uvmat('ERROR','manual correction only possible for CIV1 or CIV2 velocity fields')
     
    47764738    param.index_fields_1=param.index_fields_1-1;
    47774739end
    4778 param.civ1=get(handles.civ1,'Value');
     4740param.civ1=get(handles.VelType,'Value');
    47794741param.civ2=get(handles.civ2,'Value');
    47804742param.interp1=get(handles.interp1,'Value');
     
    50735035end
    50745036
    5075 
     5037% --- Executes on button press in FixVelType.
     5038function FixVelType_Callback(hObject, eventdata, handles)
     5039val=get(handles.FixVelType,'Value');
     5040if ~val
     5041    run0_Callback(hObject, eventdata, handles)
     5042end
     5043
     5044
Note: See TracChangeset for help on using the changeset viewer.