Changeset 193 for trunk/src/uvmat.m
- Timestamp:
- Feb 20, 2011, 10:42:19 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r192 r193 201 201 function uvmat_OpeningFcn(hObject, eventdata, handles, input ) 202 202 %------------------------------------------------------------------------ 203 global nb_builtin 204 205 % Choose default command menuline output for uvmat 203 204 %% Choose default command menuline output for uvmat (standard GUI) 206 205 handles.output = hObject; 207 206 208 % Update handles structure207 %% Update handles structure (standard GUI) 209 208 guidata(hObject, handles); 210 209 211 % set the position of colorbar and ancillary GUIs:210 %% set the position of colorbar and ancillary GUIs: 212 211 set(hObject,'Units','Normalized') 213 212 movegui(hObject,'center') … … 223 222 set(handles.axes3,'UserData',AxeData) 224 223 225 % functions for the mouse and keyboard224 %% set functions for the mouse and keyboard 226 225 set(handles.histo_u,'NextPlot','replacechildren'); 227 226 set(handles.histo_v,'NextPlot','replacechildren'); … … 232 231 set(hObject,'DeleteFcn',{@closefcn})% 233 232 234 % refresh projection plane235 UvData.Object{1}.Style='plane';%main plotting plane233 %% refresh projection plane 234 %UvData.Object{1}.Style='plane';%main plotting plane 236 235 UvData.Object{1}.ProjMode='projection';%main plotting plane 237 236 if ~isfield(UvData.Object{1},'plotaxes') 238 237 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis 239 238 set(handles.list_object_1,'Value',1); 240 set(handles.list_object_1,'String',{'1-PLANE'}); 239 % set(handles.list_object_1,'String',{'1-PLANE'}); 240 set(handles.list_object_1,'String',{''}); 241 241 end 242 242 set(handles.Fields,'Value',1) 243 set(handles.Fields,'string',{''}) %TODO: PUT IN THE GUI244 245 % TRANSFORM menu: builtin fcts243 set(handles.Fields,'string',{''}) 244 245 %% TRANSFORM menu: builtin fcts 246 246 menu_str={'';'phys';'px';'phys_polar'}; 247 nb_builtin=numel(menu_str); %number of functions247 UvData.OpenParam.NbBuiltin=numel(menu_str); %number of functions 248 248 path_uvmat=fileparts(which('uvmat')); 249 249 addpath(fullfile(path_uvmat,'transform_field')) … … 261 261 rmpath(fullfile(path_uvmat,'transform_field')) 262 262 263 % load the list of previously browsed files in menus Open and Open_1263 %% load the list of previously browsed files in menus Open and Open_1 264 264 dir_perso=prefdir; % path to the directory .matlab for personal data 265 265 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmauvmat_perso.mat' in .matlab … … 291 291 [path,file]=fileparts(h.transform_fct{ilist}); 292 292 addpath(path) 293 % if exist(file,'file')294 293 h_func=str2func(file); 295 294 rmpath(path) … … 311 310 set(handles.transform_fct,'UserData',fct_handle)% store the list of path in UserData of ACTION 312 311 set(handles.uvmat,'UserData',UvData) 313 %set(handles.FixEqual,'Value',1)% by default: axes free to adapt in aspect ratio 314 %set(handles.FixEqual,'BackgroundColor',[1 1 0]) 315 316 %check the path and date of modification of all functions in uvmat 312 313 %% check the path and date of modification of all functions in uvmat 317 314 path_to_uvmat=which ('uvmat');% check the path detected for source file uvmat 318 315 [errormsg,date_str]=check_functions;%check the path of the functions called by uvmat.m 319 316 date_str=['last modification: ' date_str]; 320 %case of an input argument for uvmat 317 318 %% case of an input argument for uvmat 321 319 testinputfield=0; 322 320 inputfile=[]; … … 349 347 end 350 348 if ~isempty(inputfile) 349 %%%%% display the indput field %%%%%%% 351 350 display_file_name(hObject, eventdata, handles,inputfile) 351 %%%%%%% 352 352 testinputfield=1; 353 353 end … … 366 366 end 367 367 end 368 % UvData.NewSeries=1; 369 set(handles.uvmat,'UserData',UvData) 368 % set(handles.uvmat,'UserData',UvData) 369 370 %% plot input field if exists 370 371 if testinputfield 371 372 %delete drawn objects … … 604 605 set(handles.list_object_1,'Visible','on') 605 606 set(handles.frame_object,'Visible','on') 606 % initiate input file:607 %%%%%% initiate input file: 607 608 update_rootinfo(hObject,eventdata,handles); 608 609 otherwise … … 743 744 XmlData.GeometryCalib 744 745 if isfield(XmlData.GeometryCalib,'VolumeScan') && isequal(XmlData.GeometryCalib.VolumeScan,'y') 745 'TESTvol'746 746 set (handles.nb_slice,'String','volume') 747 747 end … … 872 872 873 873 if testima 874 % set(handles.Fields,'Value',1) % set menu to 'image'875 % set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'})876 874 elseif isequal(FileExt,'.nc')||isequal(FileExt,'.cdf') 877 875 Data=nc2struct(FileName,'ListGlobalAttribute','absolut_time_T0','civ'); … … 901 899 end 902 900 903 % set index navigation options and refresh plots901 %% set index navigation options and refresh plots 904 902 set(handles.RootPath,'BackgroundColor',[1 1 1]) 905 903 drawnow … … 923 921 NomTypeRaw=regexprep(NomType(2:end), '-', ''); 924 922 if numel(regexp(NomTypeRaw,'\D'))>=1 925 % case {'_i_j','_i_j1-j2','_i1-i2_j','#_ab','#A','%01dA','%02dA','%03dA','%04dA'},% two navigation indices926 923 state_j='on'; 927 924 if isequal(nbfield,1) … … 932 929 NomTypeRaw=regexprep(NomType_1(2:end), '-', ''); 933 930 if numel(regexp(NomTypeRaw,'\D'))>=1 934 % switch NomType_1935 % case {'_i_j','_i_j1-j2','_i1-i2_j','#_ab'},% two navigation indices936 931 state_j='on'; 937 932 if isequal(nbfield,1) … … 954 949 set(handles.j_text,'Visible',state_j); 955 950 956 % view the field951 %% view the field 957 952 run0_Callback(hObject, eventdata, handles); %view field 958 953 mask_test=get(handles.mask_test,'value'); … … 1169 1164 set(handles.FileExt_1,'String',FileExt_1); 1170 1165 1171 % default choice of fields1172 if isequal(ext_test,'.image')1173 % set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})1174 % set(handles.Fields_1,'Value',2) % set menu to 'image'1175 elseif strcmp(FileExt_1,'.nc')||strcmp(FileExt_1,'.cdf')1176 Data=nc2struct(fileinput_1,[]);1177 % if isfield(Data,'absolut_time_T0')1178 % set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})1179 % set(handles.Fields_1,'Value',4) % set menu to 'velocity'1180 % else1181 % set(handles.Fields_1,'Value',2) % set menu to 'get_field...'1182 % set(handles.Fields_1,'String',{'';'get_field...'});1183 % end1184 end1166 % % default choice of fields 1167 % if isequal(ext_test,'.image') 1168 % % set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'}) 1169 % % set(handles.Fields_1,'Value',2) % set menu to 'image' 1170 % elseif strcmp(FileExt_1,'.nc')||strcmp(FileExt_1,'.cdf') 1171 % Data=nc2struct(fileinput_1,[]); 1172 % % if isfield(Data,'absolut_time_T0') 1173 % % set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'}) 1174 % % set(handles.Fields_1,'Value',4) % set menu to 'velocity' 1175 % % else 1176 % % set(handles.Fields_1,'Value',2) % set menu to 'get_field...' 1177 % % set(handles.Fields_1,'String',{'';'get_field...'}); 1178 % % end 1179 % end 1185 1180 set(handles.SubField,'Visible','on') 1186 1181 set(handles.SubField,'Value',1) … … 2405 2400 eval(['nbvec=length(UvData.Field.' XName ');'])%nbre of measurement points (e.g. vectors) 2406 2401 test_x=1;%test for unstructured coordinates 2407 else %structured coordinate 2408 YName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim-1)}; %structured coordinates 2402 elseif VarType{imax}.coord(NbDim)>0 %structured coordinate 2409 2403 XName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim)}; 2404 if NbDim>1 2405 YName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim-1)}; %structured coordinates 2406 end 2410 2407 end 2411 2408 if NbDim==3 … … 2419 2416 end 2420 2417 end 2418 if exist('XName','var') 2421 2419 eval(['XMax=max(UvData.Field.' XName ');']) 2422 2420 eval(['XMin=min(UvData.Field.' XName ');']) 2423 eval(['YMax=max(UvData.Field.' YName ');']) 2424 eval(['YMin=min(UvData.Field.' YName ');']) 2421 UvData.Field.NbDim=NbDim; 2422 UvData.Field.XMax=XMax; 2423 UvData.Field.XMin=XMin; 2424 if NbDim >1 2425 eval(['YMax=max(UvData.Field.' YName ');']) 2426 eval(['YMin=min(UvData.Field.' YName ');']) 2427 UvData.Field.YMax=YMax; 2428 UvData.Field.YMin=YMin; 2429 end 2425 2430 eval(['nbvec=length(UvData.Field.' XName ');']) 2426 2431 if test_x %unstructured coordinates … … 2434 2439 VarIndex=CellVarIndex{imax}; % list of variable indices 2435 2440 DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable 2436 nbpoints_y=UvData.Field.DimValue(DimIndex(NbDim-1));2437 2441 nbpoints_x=UvData.Field.DimValue(DimIndex(NbDim)); 2438 2442 DX=(XMax-XMin)/(nbpoints_x-1); 2439 DY=(YMax-YMin)/(nbpoints_y-1); 2443 if NbDim >1 2444 nbpoints_y=UvData.Field.DimValue(DimIndex(NbDim-1)); 2445 DY=(YMax-YMin)/(nbpoints_y-1); 2446 end 2440 2447 if NbDim==3 2441 2448 nbpoints_z=UvData.Field.DimValue(DimIndex(1)); … … 2448 2455 end 2449 2456 end 2450 UvData.Field.NbDim=NbDim; 2451 UvData.Field.XMax=XMax; 2452 UvData.Field.XMin=XMin; 2453 UvData.Field.YMax=YMax; 2454 UvData.Field.YMin=YMin; 2455 2457 end 2456 2458 2457 2459 %% 3D case (menuvolume) … … 2511 2513 else 2512 2514 % create a default projection menuplane 2513 UvData.Object{1}.Style='plane';%main plotting plane2515 %UvData.Object{1}.Style='none';%main plotting plane 2514 2516 UvData.Object{1}.ProjMode='projection';%main plotting plane 2515 2517 UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat 2516 2518 set(handles.list_object_1,'Value',1); 2517 set(handles.list_object_1,'String',{' 1-PLANE'});2519 set(handles.list_object_1,'String',{''}); 2518 2520 end 2519 2521 if ~isfield(UvData.Object{1},'plotaxes') … … 2553 2555 haxes(2)=plot_handles{2}.axes3; 2554 2556 PlotParam{2}=read_plot_param(plot_handles{2});%read plotting parameters on the uvmat interface 2555 keeplim(2)=get(plot_handles{2}.Fix edLimits,'Value');2557 keeplim(2)=get(plot_handles{2}.FixLimits,'Value'); 2556 2558 PosColorbar{2}='*'; %TODO: deal with colorbar position on view_field 2557 2559 end … … 2829 2831 if ~isequal(hhh,'')% case of new builtin Matlab netcdf library 2830 2832 nc=netcdf.open(filename,'NC_WRITE'); 2831 netcdf.reDef(nc) 2832 netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1) 2833 netcdf.reDef(nc); 2834 netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1); 2833 2835 dimid = netcdf.inqDimID(nc,nbname); 2834 2836 try … … 2837 2839 varid=netcdf.defVar(nc,flagname,'double',dimid);%create fixflag variable if it does not exist 2838 2840 end 2839 netcdf.endDef(nc) 2841 netcdf.endDef(nc); 2840 2842 netcdf.putVar(nc,varid,UvData.axes3.FF); 2841 netcdf.close(nc) 2843 netcdf.close(nc); 2842 2844 else %old netcdf library 2843 2845 netcdf_toolbox(filename,AxeData,attrname,nbname,flagname) … … 3819 3821 function transform_fct_Callback(hObject, eventdata, handles) 3820 3822 %------------------------------------------------------------- 3821 global nb_builtin 3822 3823 huvmat=get(handles.transform_fct,'parent'); 3823 3824 UvData=get(handles.uvmat,'UserData'); 3824 3825 menu=get(handles.transform_fct,'String'); 3825 3826 ind_coord=get(handles.transform_fct,'Value'); … … 3859 3860 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 3860 3861 if exist(profil_perso,'file') 3862 nb_builtin=UvData.OpenParam.NbBuiltin; 3861 3863 for ilist=nb_builtin+1:numel(list_transform) 3862 3864 ff=functions(list_transform{ilist}); … … 3877 3879 set(handles.FixLimits,'Value',0) 3878 3880 set(handles.FixLimits,'BackgroundColor',[0.7 0.7 0.7]) 3879 3880 UvData=get(huvmat,'UserData');3881 3881 3882 3882 %delete drawn objects … … 3911 3911 UvData=rmfield(UvData,'MaskName'); %will impose mask refresh 3912 3912 end 3913 set(h uvmat,'UserData',UvData)3913 set(handles.uvmat,'UserData',UvData) 3914 3914 run0_Callback(hObject, eventdata, handles) 3915 3915 … … 4179 4179 colcode.colcode2=str2num(get(handles.colcode2,'String')); 4180 4180 end 4181 % colcode.option=get(handles.vec_col_bar,'Value');4182 4181 colcode.FixedCbounds=0; 4183 % list_code=get(handles.col_vec,'String');% list menu fields4184 % index_code=get(handles.col_vec,'Value');% selected string index4185 % colcode.CName= list_code{index_code(1)}; % selected field used for vector color4186 4182 colcode.FixedCbounds=1; 4187 4183 vec_C=colcode.MinC+(colcode.MaxC-colcode.MinC)*(0.5:width-0.5)/width;%sample of vec_C values from min to max … … 4203 4199 UvData=get(handles.uvmat,'UserData'); 4204 4200 AxeData=UvData.axes3; 4205 'TESTupdateplot' 4206 PlotParam=read_plot_param(handles) 4207 PlotParam.Vectors 4201 PlotParam=read_plot_param(handles); 4208 4202 [PP,PlotParamOut]= plot_field(AxeData,haxes,PlotParam); 4209 'TESTOUT'4210 PlotParamOut4211 4203 write_plot_param(handles,PlotParamOut); %update the auto plot parameters 4212 4204 … … 4214 4206 % --- Executes on button press in grid. 4215 4207 function grid_Callback(hObject, eventdata, handles) 4216 4217 4208 4218 4209
Note: See TracChangeset
for help on using the changeset viewer.