Changeset 236 for trunk/src/uvmat.m
- Timestamp:
- Apr 12, 2011, 12:12:19 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r235 r236 50 50 % .MovieObject_1: idem for a second input series (_1) 51 51 % .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 series52 % .VelType_1: last velocity type (VelType, civ2...) for the second input series 53 53 % .FieldName_1: last field name(velocity, vorticity...) for the second input series 54 54 % .ZMin, .ZMax: range of the z coordinate … … 387 387 end 388 388 end 389 389 390 set_vec_col_bar(handles) %update the display of color code for vectors 390 391 … … 518 519 return 519 520 end 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 521 522 ext_test=''; %default 522 if ~isempty(ext) 523 if ~isempty(ext) % if a file extension is detected 523 524 form=imformats(ext(2:end));%test valid Matlab image formats 524 525 if ~isempty(form) … … 533 534 [RootPath,RootFile]=fileparts(fileinput); %include the indices in the root file 534 535 end 535 elseif isequal(lower(ext),'.avi') 536 elseif isequal(lower(ext),'.avi')%case of avi movie file 536 537 ext_test='.image'; 537 538 i1='1'; % set the frame counter to 1 by default … … 663 664 UvData.TestInputFile=1; 664 665 set(handles.fix_pair,'Value',1) % activate by default the comp_input '-'input window 665 666 set(handles.FixVelType,'Value',0); %desactivate fixed veltype 666 667 [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles); 667 668 if ~exist(FileName,'file') … … 873 874 if ~testima 874 875 testcivx=0; 875 % hget_field=findobj('Name','get_field');876 % if isequal(FileExt,'.nc')||isequal(FileExt,'.cdf')877 876 if isfield(UvData,'FieldsString') && isequal(UvData.FieldsString,{'get_field...'})% field menu defined as input (from get_field) 878 877 set(handles.Fields,'Value',1) … … 880 879 UvData=rmfield(UvData,'FieldsString'); 881 880 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 885 883 FieldList=calc_field; 886 884 set(handles.Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data … … 890 888 testcivx=1; 891 889 end 892 % else893 % 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 input895 % delete(hget_field)896 % end897 % end898 890 if ~testcivx 899 891 set(handles.Fields,'Value',1) % set menu to 'get_field... … … 902 894 end 903 895 set(handles.col_vec,'String',col_vec) 904 % else905 % msgbox_uvmat('ERROR',['invalid input file extension ' FileExt])906 % return907 % end908 896 end 909 897 end … … 1001 989 '*.dat','.dat text files ';... 1002 990 '*.*', 'All Files (*.*)'}, ... 1003 'Pick a file',RootPath);991 'Pick a second file for comparison',RootPath); 1004 992 fileinput_1=[PathName FileName];%complete file name 1005 % testblank=findstr(fileinput_1,' ');%look for blanks1006 % if ~isempty(testblank)1007 % msgbox_uvmat('ERROR',['The input file name ' fileinput_1 ' contains blank character : This is not allowed. Please change name'])1008 % return1009 % end1010 993 sizf=size(fileinput_1); 1011 994 if (~ischar(fileinput_1)||~isequal(sizf(1),1)),return;end … … 1181 1164 1182 1165 % % 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') 1197 1167 set(handles.SubField,'Value',1) 1198 1168 RootPath_1_Callback(hObject,eventdata,handles); … … 1230 1200 msgbox_uvmat('ERROR',['input file ' FileName ' not found']); 1231 1201 end 1202 set(handles.FixVelType,'Value',0); %desactivate fixed veltype 1232 1203 nbfield_1=[];%default 1233 1204 nburst_1=[];%default … … 2134 2105 FieldName= list_fields{index_fields}; % selected field 2135 2106 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 2137 2111 end 2138 2112 if strcmp(FieldName,'velocity') … … 2177 2151 return 2178 2152 end 2153 2179 2154 if isfield(ParamOut,'Npx')&& isfield(ParamOut,'Npy') 2180 2155 set(handles.npx,'String',num2str(ParamOut.Npx));% display image size on the interface … … 2189 2164 end 2190 2165 2191 %% choose a second field if Subfield option is 'on', and if the field has changed2166 %% choose a second field filename_1 if defined 2192 2167 VelType_1=[];%default 2193 2168 FieldName_1=[]; … … 2201 2176 FieldName_1=[];%default 2202 2177 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 2204 2183 NomType_1=get(handles.FileIndex_1,'UserData'); 2205 2184 if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf') … … 2220 2199 end 2221 2200 else 2201 if length(Ext_1)>=2 2222 2202 form=imformats(Ext_1(2:end)); 2223 2203 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab … … 2228 2208 end 2229 2209 end 2210 end 2230 2211 end 2231 2212 if strcmp(FileType_1,'netcdf') … … 2234 2215 FieldName_1= list_fields{index_fields}; % selected field 2235 2216 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 2237 2223 end 2238 2224 if strcmp(VelType_1,'*')% free veltype choice … … 2269 2255 [Field{2},ParamOut_1,errormsg] = read_field(Name,FileType_1,ParamIn,num_i1); 2270 2256 if ~isempty(errormsg) 2271 errormsg=['error in reading ' filename_1 ': ' errormsg];2257 errormsg=['error in reading ' FieldName_1 ' in ' filename_1 ': ' errormsg]; 2272 2258 return 2273 2259 end … … 2286 2272 end 2287 2273 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 2287 test_veltype=0; 2290 2288 if ~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') 2290 else 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]) 2301 2301 end 2302 2302 field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList); … … 2304 2304 set(handles.Fields,'Value',find(field_index,1)) 2305 2305 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 2325 test_veltype_1=0; 2326 if 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 2329 else 2309 2330 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 2342 end 2343 if test_veltype||test_veltype_1 2344 set(handles.FixVelType,'Visible','on') 2345 else 2346 set(handles.FixVelType,'Visible','off') 2347 end 2348 2326 2349 %% introduce w as background image by default for a new series (only for nbdim=2) 2327 2350 if ~isfield(UvData,'NewSeries') … … 2432 2455 NbDim=2; 2433 2456 end 2434 elseif VarType{imax}.coord(NbDim)>0 %structured coordinate2457 elseif numel(VarType)>=imax && numel(VarType{imax}.coord)>=NbDim && VarType{imax}.coord(NbDim)>0 %structured coordinate 2435 2458 XName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim)}; 2436 2459 if NbDim>1 2437 2460 YName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim-1)}; %structured coordinates 2438 2461 end 2462 else 2463 errormsg='input field coordinates not defined'; 2464 return 2439 2465 end 2440 2466 if NbDim==3 … … 2568 2594 2569 2595 % main projection object (uvmat display) 2596 list_object=get(handles.list_object_1,'String'); 2597 if 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') 2603 end 2570 2604 IndexObj(1)=get(handles.list_object_1,'Value');%selected projection object for main view 2571 2605 if IndexObj(1)> numel(UvData.Object) … … 2874 2908 end 2875 2909 test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]); 2876 test_civ1=isequal(get(handles. civ1,'BackgroundColor'),[1 1 0]);2910 test_civ1=isequal(get(handles.VelType,'BackgroundColor'),[1 1 0]); 2877 2911 if ~test_civ2 && ~test_civ1 2878 2912 msgbox_uvmat('ERROR','manual correction only possible for CIV1 or CIV2 velocity fields') … … 2925 2959 %determines the fields to read from the interface 2926 2960 %------------------------------------------------------------------ 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 2961 function VelType=setfield(handles) 2962 VelTypeList=get(handles.VelType,'String'); 2963 index=get(handles.VelType,'Value'); 2964 VelType=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 2969 3006 2970 3007 %------------------------------------------------------------------- … … 2972 3009 %------------------------------------------------------------------ 2973 3010 function 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 3011 VelTypeList=get(handles.VelType_1,'String'); 3012 index=get(handles.VelType_1,'Value'); 3013 VelType=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 2994 3033 2995 3034 … … 2997 3036 % --- Executes on button press in SubField 2998 3037 function SubField_Callback(hObject, eventdata, handles) 2999 huvmat=get(handles.run0,'parent');3000 UvData=get(h uvmat,'UserData');3038 % huvmat=get(handles.run0,'parent'); 3039 UvData=get(handles.uvmat,'UserData'); 3001 3040 if get(handles.SubField,'Value')==0% if the subfield button is desactivated 3002 3041 set(handles.RootPath_1,'String','') … … 3011 3050 set(handles.FileExt_1,'Visible','off'); 3012 3051 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) 3015 3058 if isfield(UvData,'XmlData_1') 3016 3059 UvData=rmfield(UvData,'XmlData_1'); 3017 3060 end 3018 set(h uvmat,'UserData',UvData);3061 set(handles.uvmat,'UserData',UvData); 3019 3062 run0_Callback(hObject, eventdata, handles); %run 3020 3063 else … … 3094 3137 field= list_fields{index_fields(1)}; % selected string 3095 3138 if 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 3098 3144 filename=read_file_boxes(handles); 3099 3145 hget_field=findobj(allchild(0),'name','get_field'); … … 3152 3198 return 3153 3199 % end 3154 % veltype_handles=[handles. civ1handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];3200 % veltype_handles=[handles.VelType handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2]; 3155 3201 % set_veltype_display(veltype_handles,0) % unvisible civ buttons 3156 3202 else … … 3168 3214 % MenuBrowse_Callback(hObject, eventdata, handles) 3169 3215 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 grey3172 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 grey3177 set(handles.civ2,'BackgroundColor',[0.702 0.702 0.702])3178 str=calc_field;%get the list of available scalars by the function calc_scal3179 [ind_answer] = listdlg('PromptString','Select a file:',...3180 'SelectionMode','single',...3181 'ListString',str);3182 % edit the choice in the field and action menu3183 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 type3187 end3216 % 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 3188 3234 end 3189 3235 indices=name_generator('',str2double(str1),str2double(str_a),'',NomTypeNew,1,str2double(str2),str2double(str_b),''); … … 3258 3304 3259 3305 if isequal(field_1,'get_field...') 3260 veltype_handles=[handles. civ1handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];3306 veltype_handles=[handles.VelType handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2]; 3261 3307 set_veltype_display(veltype_handles,0) % unvisible civ buttons 3262 3308 filename=read_file_boxes_1(handles); … … 3276 3322 if isequal(field_1,'image') 3277 3323 % transform netc type to the corresponding image type 3278 % set(handles.FileExt_1,'String','.png');3279 3324 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 3283 3326 if isequal(NomType_1,'_i1-i2_j')||isequal(NomType_1,'_i_j1-j2') 3284 3327 NomTypeNew='_i_j'; … … 3305 3348 display_file_name_1(hObject, eventdata, handles,imagename)%display the image 3306 3349 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 buttons3309 3350 else 3310 3351 set(handles.SubDir_1,'Visible','on') 3311 3352 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 visible3353 % 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 3314 3355 RootPath_1=get(handles.RootPath_1,'String'); 3315 3356 RootFile_1=get(handles.RootFile_1,'String'); 3316 if isempty(RootPath_1)| isequal(RootPath_1,'')3357 if isempty(RootPath_1)||isequal(RootPath_1,'') 3317 3358 set(handles.RootPath_1,'String','"') 3318 3359 end 3319 if isempty(RootFile_1) | isequal(RootFile_1,'')3360 if isempty(RootFile_1) || isequal(RootFile_1,'') 3320 3361 set(handles.RootFile_1,'String','"') 3321 3362 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),'\')) 3323 3364 RootFile_1(1)=[]; 3324 3365 end … … 3357 3398 set(handles.SubDir_1,'String',SubDir_1); 3358 3399 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 grey3400 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 3361 3402 set(handles.civ2_1,'BackgroundColor',[0.702 0.702 0.702]) 3362 3403 set(handles.interp1_1,'BackgroundColor',[0.702 0.702 0.702]) 3363 3404 set(handles.interp2_1,'BackgroundColor',[0.702 0.702 0.702]) 3364 3405 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 grey3406 set(handles.VelType_1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey 3366 3407 set(handles.civ2_1,'BackgroundColor',[0.702 0.702 0.702]) 3367 3408 str=calc_field;%get the list of available scalars by the function calc_scal … … 3384 3425 3385 3426 %common to Fields_Callback 3386 if isequal(field,'image')| isequal(field_1,'image')3427 if isequal(field,'image')||isequal(field_1,'image') 3387 3428 set(handles.npx_title,'Visible','on')% visible npx,pxcm... buttons 3388 3429 set(handles.npy_title,'Visible','on') … … 3397 3438 % set(handles.fix_pair,'Value',1) 3398 3439 end 3399 if isequal(field,'velocity')| isequal(field_1,'velocity');3440 if isequal(field,'velocity')||isequal(field_1,'velocity'); 3400 3441 state_vect='on'; 3401 3442 else 3402 3443 state_vect='off'; 3403 3444 end 3404 if ~isequal(field,'velocity')| (~isequal(field_1,'velocity')&~isequal(field_1,''));3445 if ~isequal(field,'velocity')||(~isequal(field_1,'velocity')&~isequal(field_1,'')); 3405 3446 state_scal='on'; 3406 3447 else … … 3415 3456 %------------------------------------------------------------------------ 3416 3457 % --- 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' 3458 function menu=set_veltype_display(Civ) 3459 %------------------------------------------------------------------------ 3421 3460 if isequal(Civ,0) 3422 3461 imax=0; 3423 % set(handles(1),'Visible','on') % unvisible civ buttons3424 % else3425 % set(handles(1),'String','civ1')3426 % end3427 3462 elseif isequal(Civ,1) || isequal(Civ,2) 3428 3463 imax=1; … … 3434 3469 imax=6; 3435 3470 end 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 3471 menu={'civ1';'interp1';'filter1';'civ2';'interp2';'filter2'}; 3472 menu=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. 3484 function 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 3491 set(handles.FixVelType,'Value',1) 3454 3492 run0_Callback(hObject, eventdata, handles) 3455 3493 3456 %-------------------------------------------------------------------3457 % --- Executes on button press in interp1.3458 function interp1_Callback(hObject, eventdata, handles)3459 %-------------------------------------------------------------------3460 if get(handles.interp1,'Value')==13461 reset_vel_type([handles.civ1 handles.civ2 handles.filter1 handles.interp2 handles.filter2],handles.interp1)3462 else3463 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])3464 end3465 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')==13472 reset_vel_type([handles.civ1 handles.civ2 handles.interp1 handles.interp2 handles.filter2],handles.filter1)3473 else3474 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])3475 end3476 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')==13483 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.interp2 handles.filter2],handles.civ2)3484 else3485 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])3486 end3487 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')==13494 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.filter2],handles.interp2)3495 else3496 reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])3497 end3498 run0_Callback(hObject, eventdata, handles)3499 3494 %--------------------------------------------- 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 3495 function VelType_1_Callback(hObject, eventdata, handles) 3510 3496 %--------------------------------------------- 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 3498 set(handles.FixVelType,'Value',1) 3499 %refresh field with a second filename=first fiel name 3500 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow 3501 drawnow 3502 filename=read_file_boxes(handles); 3503 if get(handles.SubField,'Value') 3504 filename_1=read_file_boxes_1(handles); 3505 else 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 3512 end 3513 num_i1=stra2num(get(handles.i1,'String')); 3514 num_i2=stra2num(get(handles.i2,'String')); 3515 num_j1=stra2num(get(handles.j1,'String')); 3516 num_j2=stra2num(get(handles.j2,'String')); 3517 3518 errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2); 3519 3520 if ~isempty(errormsg) 3521 msgbox_uvmat('ERROR',errormsg); 3522 else 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]) 3529 end 3530 set(handles.run0,'BackgroundColor',[1 0 0]) 3569 3531 3570 3532 %----------------------------------------------- … … 3641 3603 if isequal(get(handles.edit_vect,'Value'),1) 3642 3604 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]); 3644 3606 if ~test_civ2 && ~test_civ1 3645 3607 msgbox_uvmat('ERROR','manual correction only possible for CIV1 or CIV2 velocity fields') … … 4776 4738 param.index_fields_1=param.index_fields_1-1; 4777 4739 end 4778 param.civ1=get(handles. civ1,'Value');4740 param.civ1=get(handles.VelType,'Value'); 4779 4741 param.civ2=get(handles.civ2,'Value'); 4780 4742 param.interp1=get(handles.interp1,'Value'); … … 5073 5035 end 5074 5036 5075 5037 % --- Executes on button press in FixVelType. 5038 function FixVelType_Callback(hObject, eventdata, handles) 5039 val=get(handles.FixVelType,'Value'); 5040 if ~val 5041 run0_Callback(hObject, eventdata, handles) 5042 end 5043 5044
Note: See TracChangeset
for help on using the changeset viewer.