- Timestamp:
- May 20, 2010, 1:48:25 AM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field.m
r19 r89 1 1 %'calc_field': defines fields (velocity, vort, div...) from civx data and calculate them 2 2 %--------------------------------------------------------------------- 3 4 3 % 5 4 % OUTPUT: 6 5 % Scal: matlab vector representing the scalar values (length nbvec defined by var_read) 7 %if no input , Scal=list of programmed scalar names (to put in menus)8 %if only the sclar name is put as input, vec_A=type of scalar, which can be:6 % if no input , Scal=list of programmed scalar names (to put in menus) 7 % if only the sclar name is put as input, vec_A=type of scalar, which can be: 9 8 % 'vel': scalar calculated solely from velocity components 10 9 % 'der': needs spatial derivatives 11 10 % 'var': the scalar name directly corresponds to a field name in the netcdf files 12 11 % error: error flag 13 % error = 0; OK 14 % error = 1; the prescribed scalar cannot be read or calculated from available fields 12 % error = 0; OK 13 % error = 1; the prescribed scalar cannot be read or calculated from available fields 14 % 15 15 % INPUT: 16 16 % ScalName: string representing the name of the scalar 17 17 % DataIn: structure representing the field, as defined in check_field_srtructure.m 18 18 % 19 19 % FUNCTION related 20 20 % varname_generator.m: determines the field names to read in the netcdf file, depending on the scalar -
trunk/src/cell2tab.m
r19 r89 1 1 %'cell2tab': transform a Matlab cell in a character array suitable for display in a table 2 %------------------------------------------------------------------------ 3 % function Tabchar=cell2tab(Tabcell,separator) 4 % 5 % OUTPUT: 6 % Tabchar: character array suitable for table display 7 % 2 8 % INPUT: 3 % Tabcell: (nx,ny) cell table, for nx lines 4 % separator: character used for separating displayed columns 9 % Tabcell: (nx,ny) cell table, for nx lines separator: character used for separating displayed columns 10 5 11 function Tabchar=cell2tab(Tabcell,separator) 6 12 Tabchar={};%default -
trunk/src/check_field_structure.m
r38 r89 1 1 %'check_field_structure': check the validity of the field struture representation consistant with the netcdf format 2 %---------------------------------------------------------------------- 2 %------------------------------------------------------------------------ 3 3 % function [DataOut,errormsg]=check_field_structure(Data) 4 4 % 5 5 % OUTPUT: 6 % Data: structure reproducing the input structure Data, with the additional elements:6 % DataOut: structure reproducing the input structure Data, with the additional elements: 7 7 % with fields: 8 8 % … … 13 13 % errormsg: error message which is not empty when the input structure does not have the right form 14 14 % 15 % INPUT:15 % INPUT: 16 16 % Data: structure containing 17 17 % (optional) .ListGlobalAttribute: cell listing the names of the global attributes -
trunk/src/check_functions.m
r42 r89 1 1 %'check_functions': check the path and modification date for all the 2 % function in the toolbox UVMAT. Called at the opening of uvmat .fig2 % function in the toolbox UVMAT. Called at the opening of uvmat 3 3 %---------------------------------------------------------------------- 4 4 % function [errormsg,date_str]=check_functions … … 7 7 % errormsg: error message listing functions whose paths are not in the directory of uvmat.m 8 8 % date_str: date of the most recent modification of a file in the toolbox 9 % 9 10 10 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 11 11 % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. -
trunk/src/civ.m
r87 r89 181 181 182 182 % set the range of fields (1:1 by default) and selected pair 183 if is empty(num2)||isequal(num2,num1)183 if isnan(num2)||isequal(num2,num1) 184 184 num_ref_i=num1; 185 185 else … … 188 188 browse.incr_pair(2)=0; 189 189 end 190 if is empty(num_b)||isequal(num_a,num_b)191 if is empty(num_a)190 if isnan(num_b)||isequal(num_a,num_b) 191 if isnan(num_a) 192 192 num_ref_j=1; 193 193 else … … 291 291 [RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput); 292 292 filebase=fullfile(RootPath,RootFile); 293 num_i1=str a2num(str1);294 if is empty(num_i1),num_i1=1;end295 num_i2=str a2num(str2);296 if is empty(num_i2),num_i2=num_i1;end293 num_i1=str2double(str1); 294 if isnan(num_i1),num_i1=1;end 295 num_i2=str2double(str2); 296 if isnan(num_i2),num_i2=num_i1;end 297 297 num_j1=stra2num(str_a); 298 if is empty(num_j1),num_j1=1;end298 if isnan(num_j1),num_j1=1;end 299 299 num_j2=stra2num(str_b); 300 if is empty(num_j2),num_j2=num_j1;end300 if isnan(num_j2),num_j2=num_j1;end 301 301 if isequal(get(handles.compare,'Value'),1) 302 302 browse=[];%initialisation … … 615 615 end 616 616 end 617 618 617 % no image documentation file found: look for a series of existing images or .nc files 619 618 if isempty(time) && ~isequal(ext,'.nc') && ~strcmp(nom_type_ima,'none') && ~strcmp(nom_type_ima,'') && ~strcmp(nom_type_ima,'*') … … 646 645 end 647 646 first_i=max(field_i,1); 648 %determine the set of times and possible intervals for CIV 647 648 if strcmp(nom_type_ima,'_i_j') 649 field_i=field_count; 650 field_j=1; 651 jdetect=1; 652 while jdetect==1 %look for the maximum file number in the series 653 imagename=name_generator(filebase,field_i,field_j,ext_ima,nom_type_ima); 654 jdetect=(exist(imagename,'file')==2); 655 if jdetect 656 field_j=field_j+1; 657 end 658 %SEE CASE OF NETCDF FILES 659 % nbdetect=nbdetect+(exist(imagename,'file')==2); 660 end 661 nb_field_j=field_j-1;% last detected field number 662 end 663 664 665 %determine the set of times and possible intervals for CIV 649 666 % dt=(1/1000)*str2num(get(handles.dt,'String')); 650 667 time=[0:nb_field-1]';% time=file index -1 by default 668 if strcmp(nom_type_ima,'_i_j') 669 % time=[0:nb_field-1]'*ones(1,nb_field_j);% time=file index -1 by default 670 time=[0:nb_field-1]'*[0:nb_field_j-1];% time=file index -1 by default 671 end 672 673 651 674 set(handles.mode,'String',{'series(Di)'}) 652 675 end … … 2662 2685 filename_bat(end-2:end)='bat'; 2663 2686 fid=fopen(filename_bat,'w'); 2687 2664 2688 fprintf(fid,cmd); 2665 2689 fclose(fid); … … 5152 5176 ref.num_a=stra2num(str_a); 5153 5177 ref.num_b=stra2num(str_b); 5154 ref.num1=str2 num(field_count);5155 ref.num2=str2 num(str2);5178 ref.num1=str2double(field_count); 5179 ref.num2=str2double(str2); 5156 5180 browse=[];%initialisation 5157 5181 if ~isequal(ref.ext,'.nc') … … 5248 5272 set(handles.thresh_vel2,'String','0'); 5249 5273 5250 % ------------------------------------------------------------------------5251 % transform letters to numbers5252 function numres=stra2num(str)5253 % ------------------------------------------------------------------------5254 numres=double(str)-96;5255 if double(str) >= 48 & double(str) <= 57 % = 1 for numbers5256 numres=str2num(str);5257 end5274 % %------------------------------------------------------------------------ 5275 % % transform letters to numbers 5276 % function numres=stra2num(str) 5277 % %------------------------------------------------------------------------ 5278 % numres=double(str)-96; 5279 % if double(str) >= 48 & double(str) <= 57 % = 1 for numbers 5280 % numres=str2num(str); 5281 % end 5258 5282 5259 5283 %------------------------------------------------------------------------ -
trunk/src/create_grid.m
r88 r89 1 1 %'create_grid': called by the GUI geometry_calib to create a physical grid 2 %------------------------------------------------------------------------ 2 3 % coord=create_grid(input_grid) 3 4 % … … 5 6 % coord: matrix (nbpoint, 3) of coordinates for grid points, with columns x,y,z 6 7 % 7 % INPUT:8 % INPUT: 8 9 % input_grid (optional): structure to initiate the GUI with fields .x_0,.Dx,.x_1 9 10 % (defining x coordinates), .y_0,.Dy,.y_1 (defining y coordinates) -
trunk/src/dataview.m
r42 r89 3 3 % function varargout = series(varargin) 4 4 % associated with the GUI dataview.fig 5 % 5 6 6 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 7 7 % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. -
trunk/src/delete_object.m
r75 r89 1 1 %'delete_object': delete a projection object, defined by its index in the Uvmat list or by its graphic handle 2 %------------------------------------------------------------------------ 3 % function delete_object(hObject) 2 4 % 3 % INPUT:5 % INPUT: 4 6 % hObject: object index (if integer) or handle of the graphic object. If 5 % hObject is a subobject, the parent object is detected and deleted.7 % hObject is a subobject, the parent object is detected and deleted. 6 8 7 9 function delete_object(hObject) -
trunk/src/editxml.m
r55 r89 6 6 % 7 7 %INPUT: inputfile: name of an xml file 8 % 8 9 9 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 10 10 % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. -
trunk/src/find_field_indices.m
r85 r89 1 1 %'find_file_indices': test field structure for input in proj_field and plot_field 2 % group the variables into 'fields' with common dimensions3 %---------------------------------------------------------------------- 2 % group the variables into 'fields' with common dimensions 3 %------------------------------------------------------------------------ 4 4 % function [DimVarIndex,CellVarIndex,NbDim,VarType]=find_field_indices(Data) 5 5 % 6 % OUTPUT:6 % OUTPUT: 7 7 % CellVaxIndex: cell whose elements are arrays of indices in the list data.ListVarName 8 8 % CellvarIndex{i} represents a set of variables with the same dimensions … … 18 18 % .discrete: like scalar, but set of data points without continuity, represented as dots in a usual plot, instead of continuous lines otherwise 19 19 % .scalar: scalar field (default) 20 % 20 % .coord: vector of indices of coordinate variables corresponding to matrix dimensions 21 21 % 22 % INPUT:22 % INPUT: 23 23 % Data: structure representing fields, output of check_field_structure 24 24 % .ListDimName: cell listing the names of the array dimensions … … 153 153 return 154 154 end 155 NbDim(icell)=0;% nbre of space dimensions 156 if numel(VarIndex)>1 155 %NbDim(icell)=0;% nbre of space dimensions 156 NbDim(icell)=numel(DimCell); 157 test_coord=0; 158 if numel(VarIndex)>1 157 159 if ~isempty(ivar_coord_z) 158 160 NbDim(icell)=3; 161 test_coord=1; 159 162 elseif ~isempty(ivar_coord_y) 160 163 NbDim(icell)=2; 164 test_coord=1; 161 165 elseif ~isempty(ivar_coord_x) 162 166 NbDim(icell)=1; 167 test_coord=1; 163 168 end 164 169 end 165 170 % look at coordinates variables 166 171 coord=zeros(1,numel(DimCell));%default 167 if NbDim(icell)==0 && ~isempty(VarDimName)% no unstructured coordinate found 172 % if NbDim(icell)==0 && ~isempty(VarDimName)% no unstructured coordinate found 173 if ~test_coord && ~isempty(VarDimName) 168 174 for idim=1:numel(DimCell) %loop on the dimensions of the variables in cell #icell 169 175 for ivardim=1:numel(VarDimName) -
trunk/src/get_field.m
r59 r89 55 55 % Update handles structure 56 56 guidata(hObject, handles); 57 %pathuvmat=fileparts(which('uvmat')); 58 %addpath(fullfile(pathuvmat,'FIELD_FCT')) 59 %loads the information stored in prefdir to initiate the browser and the list of functions 57 58 %ACTION menu: builtin fcts 60 59 menu_str={'PLOT';'FFT';'filter_band';'histogram'}; %list of functions included in 'get_field.m' 61 nb_builtin=numel(menu_str)-1; 62 %menu_str(end)=[];%remove from the list the last option 'more...' 63 path_get_field=fileparts(which('get_field'));%path of the function 'get_field' 60 nb_builtin=numel(menu_str); 61 path_uvmat=fileparts(which('uvmat'));%path of the function 'uvmat' 62 addpath(fullfile(path_uvmat,'get_field')) 63 testexist=zeros(size(menu_str'));%default 64 64 for ilist=1:length(menu_str) 65 fct_path{ilist,1}=fullfile(path_get_field,'get_field');%paths of the fuctions buil-in in 'get_field.m' 66 end 65 if exist(menu_str{ilist},'file') 66 fct_handle{ilist,1}=str2func(menu_str{ilist}); 67 testexist(ilist)=1; 68 else 69 fct_handle{ilist,1}=[]; 70 testexist(ilist)=0; 71 end 72 end 73 rmpath(fullfile(path_uvmat,'get_field')) 74 67 75 dir_perso=prefdir; 68 76 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); … … 73 81 for ilist=1:length(h.get_field_fct) 74 82 [path,file]=fileparts(h.get_field_fct{ilist}); 75 fct_path=[fct_path; {path}];%concatene the list of paths 76 menu_str=[menu_str; {file}]; 83 addpath(path) 84 if exist(file,'file') 85 h_func=str2func(file); 86 testexist=[testexist 1]; 87 else 88 h_func=[]; 89 testexist=[testexist 0]; 90 end 91 fct_handle=[fct_handle; {h_func}]; %concatene the list of paths 92 rmpath(path) 93 menu_str=[menu_str; {file}]; 77 94 end 78 95 end 79 96 end 97 menu_str=menu_str(testexist==1);%=menu_str(testexist~=0) 98 fct_handle=fct_handle(testexist==1); 80 99 menu_str=[menu_str;{'more...'}]; 81 100 set(handles.ACTION,'String',menu_str) 82 set(handles.ACTION,'UserData',fct_path)% store the list of path in UserData of ACTION 83 ACTION_Callback(hObject, eventdata, handles) 101 set(handles.ACTION,'UserData',fct_handle)% store the list of path in UserData of ACTION 102 set(handles.path_action,'String',fullfile(path_uvmat,'get_field')) 103 set(handles.ACTION,'Value',1)% PLOT option selected 84 104 set(hObject,'WindowButtonUpFcn',{@mouse_up_gui,handles})%set mouse click action function 85 105 if exist('filename','var')& ischar(filename) 86 set(handles.inputfile,'String',filename) 106 set(handles.inputfile,'String',filename)% prefill the input file name 107 set(handles.inputfile,'Enable','off')% desactivate the input file edit box 108 set(handles.list_fig,'Value',2)% plotting axes =uvmat selected 109 set(handles.list_fig,'Visible','off')% 110 set(handles.RUN,'Visible','off')% RUN button not visible (passive mode, get_field used to define the field for uvamt) 111 set(handles.MenuOpen,'Visible','off') 112 set(handles.MenuExport,'Visible','off') 113 set(handles.MenuHelp,'Visible','off') 87 114 inputfile_Callback(hObject, eventdata, handles) 88 115 else 89 116 set(handles.inputfile,'String','') 90 117 end 118 %ACTION_Callback(hObject, eventdata, handles) 91 119 if exist('Field','var') & isstruct(Field) 92 120 Field_input(eventdata,handles,Field) … … 194 222 if ~isempty(VarType{imax}.vector_x) && ~isempty(VarType{imax}.vector_y) 195 223 set(handles.check_vector,'Value',1) 224 set(handles.check_scalar,'Value',0) 196 225 set(handles.vector_x,'Value',VarType{imax}.vector_x) 197 226 set(handles.vector_y,'Value',VarType{imax}.vector_y) 198 set(handles.check_scalar,'Value',0) 227 if ~isempty(VarType{imax}.coord_x) && ~isempty(VarType{imax}.coord_y) 228 set(handles.coord_x_vectors,'Value',VarType{imax}.coord_x+1) 229 set(handles.coord_y_vectors,'Value',VarType{imax}.coord_y+1) 230 end 231 if ~isempty(VarType{imax}.coord) 232 set(handles.coord_y_vectors,'Value',VarType{imax}.coord(1)+1) 233 if numel(VarType{imax}.coord)>=2 234 set(handles.coord_x_vectors,'Value',VarType{imax}.coord(2)+1) 235 end 236 end 199 237 else 200 238 set(handles.check_scalar,'Value',1) … … 202 240 if isfield(VarType{imax},'scalar') && length(VarType{imax}.scalar)>=1 203 241 set(handles.scalar,'Value',VarType{imax}.scalar(1)) 242 if ~isempty(VarType{imax}.coord_x) && ~isempty(VarType{imax}.coord_y) 243 set(handles.coord_x_scalar,'Value',VarType{imax}.coord_x+1) 244 set(handles.coord_y_scalar,'Value',VarType{imax}.coord_y+1) 245 end 246 if ~isempty(VarType{imax}.coord) 247 set(handles.coord_y_scalar,'Value',VarType{imax}.coord(1)+1) 248 if numel(VarType{imax}.coord)>=2 249 set(handles.coord_x_scalar,'Value',VarType{imax}.coord(2)+1) 250 end 251 end 204 252 end 205 253 end … … 284 332 % update_UserData(handles) 285 333 286 %------------------------------------------------------- 334 %------------------------------------------------------------------------ 287 335 % --- Executes on selection change in scalar menu. 288 336 function scalar_Callback(hObject, eventdata, handles) 289 %------------------------------------------------------- 337 %------------------------------------------------------------------------ 290 338 Aindex=get(handles.scalar,'Value'); 291 339 Astring=get(handles.scalar,'String'); … … 293 341 update_field(hObject, eventdata, handles,VarName) 294 342 295 %------------------------------------------------------- 343 %------------------------------------------------------------------------ 296 344 % --- Executes on selection change in coord_x_scalar. 297 345 function coord_x_scalar_Callback(hObject, eventdata, handles) 298 %------------------------------------------------------- 346 %------------------------------------------------------------------------ 299 347 index=get(handles.coord_x_scalar,'Value'); 300 348 string=get(handles.coord_x_scalar,'String'); … … 302 350 update_field(hObject, eventdata, handles,VarName) 303 351 304 %------------------------------------------------------- 352 %------------------------------------------------------------------------ 305 353 % --- Executes on selection change in coord_y_scalar. 306 354 function coord_y_scalar_Callback(hObject, eventdata, handles) 307 %------------------------------------------------------- 355 %------------------------------------------------------------------------ 308 356 index=get(handles.coord_y_scalar,'Value'); 309 357 string=get(handles.coord_y_scalar,'String'); … … 311 359 update_field(hObject, eventdata, handles,VarName) 312 360 313 %------------------------------------------------------- 361 %------------------------------------------------------------------------ 314 362 % --- Executes on selection change in coord_z_scalar. 315 363 function coord_z_scalar_Callback(hObject, eventdata, handles) 316 %------------------------------------------------------- 364 %------------------------------------------------------------------------ 317 365 index=get(handles.coord_z_scalar,'Value'); 318 366 string=get(handles.coord_z_scalar,'String'); … … 320 368 update_field(hObject, eventdata, handles,VarName) 321 369 322 %------------------------------------------------------- 370 %------------------------------------------------------------------------ 323 371 % --- Executes on selection change in vector_x. 324 372 function vector_x_Callback(hObject, eventdata, handles) 325 %------------------------------------------------------- 373 %------------------------------------------------------------------------ 326 374 index=get(handles.vector_x,'Value'); 327 375 string=get(handles.vector_x,'String'); … … 329 377 update_field(hObject, eventdata, handles,VarName) 330 378 331 %------------------------------------------------------- 379 %------------------------------------------------------------------------ 332 380 % --- Executes on selection change in vector_y. 333 381 function vector_y_Callback(hObject, eventdata, handles) 334 %------------------------------------------------------- 382 %------------------------------------------------------------------------ 335 383 index=get(handles.vector_y,'Value'); 336 384 string=get(handles.vector_y,'String'); … … 338 386 update_field(hObject, eventdata, handles,VarName) 339 387 340 %------------------------------------------------------- 388 %------------------------------------------------------------------------ 341 389 % --- Executes on selection change in vector_z. 342 390 function vector_z_Callback(hObject, eventdata, handles) 343 %------------------------------------------------------- 391 %------------------------------------------------------------------------ 344 392 index=get(handles.vector_z,'Value'); 345 393 string=get(handles.vector_z,'String'); … … 347 395 update_field(hObject, eventdata, handles,VarName) 348 396 349 %------------------------------------------------------- 397 %------------------------------------------------------------------------ 350 398 % --- Executes on selection change in coord_x_vectors. 351 399 function coord_x_vectors_Callback(hObject, eventdata, handles) 352 %------------------------------------------------------- 400 %------------------------------------------------------------------------ 353 401 index=get(handles.coord_x_vectors,'Value'); 354 402 string=get(handles.coord_x_vectors,'String'); … … 736 784 function RUN_Callback(hObject, eventdata, handles) 737 785 %--------------------------------------------------------- 738 path_get_field=fileparts(which('get_field'));739 list=get(handles.ACTION,'String');786 %path_get_field=fileparts(which('get_field')); 787 %list=get(handles.ACTION,'String'); 740 788 index=get(handles.ACTION,'Value'); 741 ACTION=list{index}; 742 list_path=get(handles.ACTION,'UserData'); 743 %hselect_field=get(handles.inputfile,'parent');%handle of the get_field interface 744 fct_path=list_path{index}; %path stored for the function ACTION 745 if ~isequal(fct_path,path_get_field) 746 % eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION 747 % if ~isequal(spath,fct_path)& exist(fct_path,'dir') 748 addpath(fct_path)% add the prescribed path if not the current one 749 % end 750 end 751 % fct_path 752 eval(['h_fun=@' ACTION ';']) 753 if ~isequal(fct_path,path_get_field) 754 rmpath(fct_path)% add the prescribed path if not the current one 755 end 756 789 % ACTION=list{index}; 790 list_func=get(handles.ACTION,'UserData'); 791 h_fun=list_func{index}; 792 % %hselect_field=get(handles.inputfile,'parent');%handle of the get_field interface 793 % fct_path=list_path{index}; %path stored for the function ACTION 794 % if ~isequal(fct_path,path_get_field) 795 % addpath(fct_path)% add the prescribed path if not the current one 796 % end 797 % eval(['h_fun=@' ACTION ';']) 798 % if ~isequal(fct_path,path_get_field) 799 % rmpath(fct_path)% add the prescribed path if not the current one 800 % end 757 801 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 758 802 drawnow 759 h_fun(handles.figure1);%handles.figure1 =handles of the GUI get_field 803 SubField=h_fun(handles.figure1);%handles.figure1 =handles of the GUI get_field 804 if ~isempty(SubField) 805 plot_get_field(SubField,handles) 806 end 760 807 browse_fig(handles.list_fig); %update the list of new existing figures 761 808 809 %------------------------------------------------------------------------ 810 function plot_get_field(SubField,handles) 811 %------------------------------------------------------------------------ 812 list_fig=get(handles.list_fig,'String'); 813 val=get(handles.list_fig,'Value'); 814 if strcmp(list_fig{val},'uvmat') 815 set(handles.figure1,'Name','uvmat_field') 816 set(handles.inputfile,'Enable','off')% desactivate the input file edit box 817 % set(handles.list_fig,'Visible','off')% 818 set(handles.RUN,'Visible','off')% RUN button not visible (passive mode, get_field used to define the field for uvamt) 819 set(handles.MenuOpen,'Visible','off') 820 set(handles.MenuExport,'Visible','off') 821 uvmat(get(handles.inputfile,'String')) 822 else 823 hfig=str2num(list_fig{val});% chosen figure number from tyhe GUI 824 if isempty(hfig) 825 hfig=figure; 826 list_fig=[list_fig;num2str(hfig)]; 827 set(handles.list_fig,'String',list_fig); 828 haxes=axes; 829 else 830 figure(hfig); 831 end 832 haxes=findobj(hfig,'Type','axes'); 833 plot_field(SubField,haxes) 834 end 762 835 763 836 %------------------------------------------------ … … 1038 1111 if isequal(val,0) 1039 1112 set(handles.PanelScalar,'Visible','off') 1040 % set(handles.scalar,'Visible','off')1041 % set(handles.ordinate,'Max',2.0)%allow multiple ordinate input option1042 % if isequal(get(handles.check_vector,'Value'),0);1043 % set(handles.coord_z_vectors_scalar,'Visible','off')1044 % end1045 1113 else 1046 1114 set(handles.PanelScalar,'Visible','on') 1047 % set(handles.scalar,'Visible','on')1048 % val=get(handles.ordinate,'Value');1049 % val=val(1);1050 % set(handles.ordinate,'Value',val);%suppress multiple ordinates1051 % set(handles.ordinate,'Max',1.0);%suppress multiple ordinate input option1052 % set(handles.coord_z_vectors_scalar,'Visible','on')1053 1115 end 1054 1116 … … 1062 1124 set(handles.PanelVectors,'Visible','on') 1063 1125 end 1064 1065 1066 1126 1067 1127 %----------------------------- … … 1088 1148 index_ACTION=get(handles.ACTION,'Value');% selected string index 1089 1149 ACTION= list_ACTION{index_ACTION}; % selected string 1090 path_get_field=which('get_field');%path to series.m 1091 list_path=get(handles.ACTION,'UserData'); 1092 1093 % nb_builtin=0; 1094 % if iscell(list_path) 1095 % for ilist=1:length(list_path) 1096 % if isequal(list_path{ilist},path_get_field) 1097 % nb_builtin=nb_builtin+1; 1098 % else 1099 % break 1100 % end 1101 % end 1102 % end 1103 % if nb_builtin==0% the path to get_field has been changed, reinitialize 1104 % get_field_OpeningFcn(hObject, eventdata, handles) 1105 % return 1106 % end 1107 1150 list_func_handles=get(handles.ACTION,'UserData');% get list of function handles (full address of the function, including name and path) 1151 ff=functions(list_func_handles{end}); 1108 1152 % add a new function to the menu 1109 1153 if isequal(ACTION,'more...') 1110 pathfct=fileparts(path_get_field);1111 browse_name=fullfile(path_get_field,'FIELD_FCT');1112 if length(list_path)>nb_builtin1113 browse_name=list_path{end};% initialize browser with the path of the last introduced function1114 end1154 % pathfct=fileparts(path_get_field); 1155 % browse_name=fullfile(path_get_field,'FIELD_FCT'); 1156 % if length(list_path)>nb_builtin 1157 % browse_name=list_path{end};% initialize browser with the path of the last introduced function 1158 % end 1115 1159 [FileName, PathName] = uigetfile( ... 1116 1160 {'*.m', ' (*.m)'; 1117 1161 '*.m', '.m files '; ... 1118 1162 '*.*', 'All Files (*.*)'}, ... 1119 'Pick a file', browse_name);1163 'Pick a file',ff.file); 1120 1164 if length(FileName)<2 1121 1165 return … … 1126 1170 return 1127 1171 end 1128 % ACTION=FileName(1:end-2);% ACTION choice updated by the selected item 1172 1129 1173 % insert the choice in the action menu 1130 1174 menu_str=update_menu(handles.ACTION,ACTION);%new action menu in which the new item has been appended if needed 1131 1175 index_ACTION=get(handles.ACTION,'Value');% currently selected index in the list 1132 list_path{index_ACTION}=PathName; 1176 addpath(PathName) 1177 list_func_handles{index_ACTION}=str2func(ACTION);% create the function handle corresponding to the newly seleced function 1178 set(handles.ACTION,'UserData',list_func_handles) 1179 set(handles.path_action,'enable','inactive')% indicate that the current path is accessible (not 'off') 1180 %list_path{index_ACTION}=PathName; 1133 1181 if length(menu_str)>nb_builtin+5; 1134 1182 nbremove=length(menu_str)-nb_builtin-5; 1135 1183 menu_str(nb_builtin+1:end-5)=[]; 1136 list_ path(nb_builtin+1:end-4)=[];1184 list_func_handles(nb_builtin+1:end-4)=[]; 1137 1185 index_ACTION=index_ACTION-nbremove; 1138 1186 set(handles.ACTION,'Value',index_ACTION) 1139 1187 set(handles.ACTION,'String',menu_str) 1140 end 1141 list_path{index_ACTION}=PathName; 1142 set(handles.ACTION,'UserData',list_path); 1143 set(handles.path_action,'enable','inactive')% indicate that the current path is accessible (not 'off') 1144 1188 end 1145 1189 %record the current menu in personal file profil_perso 1146 1190 dir_perso=prefdir; 1147 1191 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 1148 1192 for ilist=nb_builtin+1:length(menu_str)-1 1149 get_field_fct{ilist-nb_builtin}=fullfile(list_path{ilist},[menu_str{ilist} '.m']); 1193 ff=functions(list_func_handles{ilist}); 1194 get_field_fct{ilist-nb_builtin}=ff.file; 1150 1195 end 1151 1196 if exist(profil_perso,'file') … … 1163 1208 end 1164 1209 1165 %check the current path to the selected function 1166 PathName=list_path{index_ACTION};%current recorded path 1167 % if ~isequal(path_get_field,PathName) 1168 % CurrentPath=fileparts(which(ACTION)); 1169 % if ~isequal(CurrentPath,PathName)%&&~isequal(CurrentPath,fullfile(PathName,'private')) 1170 % addpath(PathName) 1171 % errormsg=check_functions; 1172 % msgbox_uvmat('CONFIRMATION',[['path ' PathName ' added to the current Matlab pathes'];errormsg]) 1173 % end 1174 % end 1175 set(handles.path_action,'String',PathName); %show the path to the senlected function 1176 1177 1178 % fct_name=fullfile(PathName, FileName); 1179 % if ~exist(fct_name,'file') 1180 % msgbox_uvmat('ERROR',['procesing fct ' fct_name ' not found']) 1181 % else 1182 % ACTION=FileName(1:end-2);% 1183 % menu=update_menu(handles.ACTION,ACTION);%add the selected fct to the menu 1184 % index_ACTION=get(handles.ACTION,'Value');% selected string index 1185 % list_path{index_ACTION}=PathName; 1186 % set(handles.ACTION,'UserData',list_path) 1187 % if exist(profil_perso,'file') 1188 % save (profil_perso,'coord_fct','-append'); %store the root name for future opening of uvmat 1189 % end 1190 % end 1191 % 1192 % 1193 % fileinput=FileName;%complete file name 1194 % eval(['spath=which(''' FileName ''');'])% current path to the function FileName 1195 % if ~isequal(spath,PathName) 1196 % addpath(PathName) 1197 % end 1198 % FileName([end-1:end])=[]; 1199 % 1200 % % insert the choice in the action menu 1201 % nbACTION=length(list_ACTION); 1202 % index=0; 1203 % for ilist=1:nbACTION 1204 % if isequal(FileName,list_ACTION{ilist})%look for the selected scalar in the fields_input menu 1205 % index=ilist;% 1206 % end 1207 % end 1208 % if index==0 1209 % list_ACTION{nbACTION}=FileName; %put the chosen fct at the penultimate place in the fields_input menu 1210 % list_path{nbACTION}=PathName; 1211 % index=nbACTION; 1212 % list_ACTION{nbACTION+1}='more...'; 1213 % set(handles.ACTION,'String',list_ACTION) 1214 % end 1215 % set(handles.ACTION,'Value',index);% store the selected scalar type 1216 % set(handles.ACTION,'UserData',list_path); 1217 % usr_defined_fct=fct_name; 1218 % nbmenu=length(list_ACTION); 1219 % nbadd=nbmenu-5; 1220 % ilist=0; 1221 % for imenu=nbmenu-min(4,nbadd):nbmenu-1 1222 % ilist=ilist+1; 1223 % fct_get_field{ilist,1}=list_ACTION{imenu}; 1224 % fct_path_get_field{ilist}=list_path{imenu}; 1225 % end 1226 % if exist(profil_perso,'file') 1227 % save(profil_perso,'usr_defined_fct','fct_get_field','fct_path_get_field','-append') 1228 % else 1229 % save(profil_perso,'usr_defined_fct','fct_get_field','fct_path_get_field','-V6') 1230 % end 1231 % end 1232 1233 % %check the current path to the selected function 1234 % list_path 1235 % PathName=list_path{index_ACTION} 1236 % CurrentPath=fileparts(which(ACTION)) 1237 % if ~isequal(PathName,CurrentPath) 1238 % addpath(PathName) 1239 % errormsg=check_functions; 1240 % msgbox_uvmat('WARNING',[['path ' PathName ' added to the current Matlab pathes'];errormsg]) 1241 % end 1242 % set(handles.path_action,'String',fullfile(PathName,' ')); %show the path to the senlected function 1243 1244 %default setting for the visibility of the GUI elements* 1245 if ~isequal(ACTION,'PLOT') 1246 varargout=feval(ACTION);% input list asked by the selected function 1247 test_1Dplot=[]; 1248 test_scalar=[]; 1249 test_vector=[]; 1250 for ilist=1:length(varargout) 1251 switch varargout{ilist,1} 1210 %check the current path to the selected function 1211 h_fun=list_func_handles{index_ACTION}; 1212 if isa(h_fun,'function_handle') 1213 func=functions(h_fun); 1214 set(handles.path_action,'String',fileparts(func.file)); %show the path to the senlected function 1215 GUI_input=h_fun();%handles.figure1 =handles of the GUI get_field 1216 else 1217 set(handles.path_action,'String','') 1218 msgbox_uvmat('ERROR','unknown path to ACTION function, reload it') 1219 return 1220 end 1221 1222 %prepare the GUI options for the selected ACTION 1223 test_1Dplot=0; 1224 test_scalar=0; 1225 test_vector=0; 1226 if iscell(GUI_input) 1227 for ilist=1:length(GUI_input) 1228 switch GUI_input{ilist} 1252 1229 %RootFile always visible 1253 1230 case 'check_1Dplot' 1254 test_1Dplot= isequal(lower(varargout{ilist,2}),'y');1231 test_1Dplot=1; 1255 1232 case 'check_scalar' 1256 test_scalar= isequal(lower(varargout{ilist,2}),'y');1233 test_scalar=1; 1257 1234 case 'check_vector' 1258 test_vector= isequal(lower(varargout{ilist,2}),'y');1235 test_vector=1; 1259 1236 end 1260 1237 end 1261 if test_1Dplot==0 1262 set(handles.check_1Dplot,'Value',0); 1263 end 1264 if test_1Dplot==1 1265 set(handles.check_1Dplot,'Value',1); 1266 end 1267 if test_scalar==0 1268 set(handles.check_scalar,'Value',0); 1269 end 1270 if test_scalar==1 1271 set(handles.check_scalar,'Value',1); 1272 end 1273 if test_vector==0 1274 set(handles.check_vector,'Value',0); 1275 end 1276 if test_vector==1 1277 set(handles.check_vector,'Value',1); 1278 end 1279 check_1Dplot_Callback(hObject, eventdata, handles) 1280 check_scalar_Callback(hObject, eventdata, handles) 1281 check_vector_Callback(hObject, eventdata, handles) 1282 end 1238 end 1239 set(handles.check_1Dplot,'Value',test_1Dplot); 1240 set(handles.check_scalar,'Value',test_scalar); 1241 set(handles.check_vector,'Value',test_vector); 1242 check_1Dplot_Callback(hObject, eventdata, handles) 1243 check_scalar_Callback(hObject, eventdata, handles) 1244 check_vector_Callback(hObject, eventdata, handles) 1245 1283 1246 1284 1247 %----------------------------------------------------- … … 1463 1426 end 1464 1427 1465 % %store input file in personal file uvmat_perso.mat1466 % dir_perso=prefdir;1467 % profil_perso=fullfile(dir_perso,'uvmat_perso.mat');1468 % if exist(profil_perso,'file')1469 % save (profil_perso,'RootPath','SubDir','RootFile','NomType', 'ext','-append'); %store the root name for future opening of uvmat1470 % else1471 % save (profil_perso,'RootPath','SubDir','RootFile','NomType', 'ext'); %store the root name for future opening of uvmat1472 % end1473 1474 1475 1428 % -------------------------------------------------------------------- 1476 1429 function MenuFile_1_Callback(hObject, eventdata, handles) -
trunk/src/get_field/FFT.m
r36 r89 3 3 %requests for the visibility of input windows in the GUI series (activated directly by the selection in the menu ACTION) 4 4 if ~exist('hget_field','var') 5 GUI_input={'check_1Dplot','y';...% 6 'check_scalar','n';... % 7 'check_vector','n'... % 8 }; 5 GUI_input={'check_1Dplot'}; 9 6 return %exit the function 10 7 end -
trunk/src/get_field/PLOT.m
r80 r89 1 1 %--------------------------------------------------------- 2 2 % --- Executes on button press in RUN. 3 function PLOT(hget_field)3 function SubField=PLOT(hget_field) 4 4 %--------------------------------------------------------- 5 SubField=[]; %default 6 if ~exist('hget_field','var') 7 return 8 end 5 9 [SubField,errormsg]=read_get_field(hget_field); 6 10 if ~isempty(errormsg) 7 11 msgbox_uvmat('ERROR',['error in read_get_field/PLOT input:' errormsg]) 8 return9 12 end 10 handles=guidata(hget_field);11 list_fig=get(handles.list_fig,'String');12 val=get(handles.list_fig,'Value');13 if strcmp(list_fig{val},'uvmat')14 uvmat(SubField)15 else16 hfig=str2num(list_fig{val});% chosen figure number from tyhe GUI17 if isempty(hfig)18 hfig=figure;19 list_fig=[list_fig;num2str(hfig)];20 set(handles.list_fig,'String',list_fig);21 haxes=axes;22 else23 figure(hfig);24 end25 haxes=findobj(hfig,'Type','axes');26 plot_field(SubField,haxes)27 end -
trunk/src/imadoc2struct.m
r81 r89 1 1 %'imadoc2struct': reads the xml file for image documentation 2 %------------------------------------------------------------------------ 3 % function [s,errormsg]=imadoc2struct(ImaDoc) 2 4 % 3 %function [s,errormsg]=imadoc2struct(ImaDoc)4 %--------------------------------------------------------5 5 % OUTPUT: 6 6 % s: structure representing ImaDoc … … 13 13 % INPUT: 14 14 % ImaDoc: full name of the xml input file with head key ImaDoc 15 %function [s,error,Heading,nom_type_ima,ext_ima,abs_time,TimeUnit,mode,NbSlice]=imadoc2struct(ImaDoc) 15 16 16 function [s,errormsg]=imadoc2struct(ImaDoc) 17 17 -
trunk/src/mouse_up.m
r82 r89 1 1 %'mouse_up': function activated when the mouse button is released 2 %---------------------------------------------------------------- 2 %------------------------------------------------------------------------ 3 3 % function mouse_up(hObject,eventdata,handles) 4 4 % activated by the command: 5 5 % set(hObject,'WindowButtonUpFcn',{'mouse_up'}), 6 6 % where hObject is the handle of the figure 7 % 8 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 7 8 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 9 9 % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. 10 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 10 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 11 11 % This file is part of the toolbox UVMAT. 12 12 % … … 20 20 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 21 % GNU General Public License (file UVMAT/COPYING.txt) for more details. 22 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 22 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 23 23 24 24 function mouse_up(hObject,eventdata,handles) … … 344 344 end 345 345 if ((nbselect==0) && isequal(get(currentobj,'Type'),'axes')) || isequal(currentobj,huvmat) 346 global CurData347 CurData=get(currentobj,'UserData');346 global Data_uvmat 347 Data_uvmat=get(currentobj,'UserData'); 348 348 %plot_text(CurData) 349 349 %get_field([],CurData); 350 evalin('base','global CurData')%make CurData global in the workspace350 evalin('base','global Data_uvmat')%make CurData global in the workspace 351 351 objtype=get(currentobj,'Type'); 352 352 display(['UserData of ' objtype ':']) 353 evalin('base',' CurData') %display CurData in the workspace353 evalin('base','Data_uvmat') %display CurData in the workspace 354 354 commandwindow %brings the Matlab command window to the front 355 355 end -
trunk/src/name_generator.m
r85 r89 1 1 %'name_generator': creates a file name from a root name and indices. 2 %--------------------------------------------------------------------- 2 %------------------------------------------------------------------------ 3 3 % [filename,idetect,num_i1_out,num_j1_out,num_i2_out,num_j2_out,subdir_out]=... 4 4 % name_generator(filebase,num_i1,num_j1,ext,nom_type,comp_input,num_i2,num_j2,subdir); 5 %--------------------------------------------------------------------- 5 %------------------------------------------------------------------------ 6 6 % This function detects the existence the constructed file name and it can 7 7 % find indices according to file existence if they are not specified 8 8 % rmq: this function is related to the reverse functions display2name and name2diplay 9 %--------------------------------------------------------------------- 9 %------------------------------------------------------------------------ 10 10 % OUTPUT: 11 11 % filename: string representing the file name (including path) … … 13 13 % num_i1_out,num_j1_out,num_i2_out,num_j2_out,subdir_out: index numbers and subdirectory detected 14 14 % for free input (= to the corresponding input indices when comp_input=1) 15 %--------------------------------------------------------------------- 15 %------------------------------------------------------------------------ 16 16 % INPUT: 17 17 % 'filebase': the root name, … … 22 22 % nom_type='': constant name [filebase ext] (default output if 'nom_type' is undefined) 23 23 % nom_type='*': the same file [filebase ext] contains successive fields (ex avi movies) 24 % nom_type='%03d' or '%04d', series of indexed images with numbers completed with zeros to 3 or 4 digits, e.g.'aa045.tif' 24 25 % nom_type='_i': series of files with a single index i preceded by '_'(e.g. 'aa_45.png'). 26 % nom_type='_%03d', '_%04d', or '_%05d', series of indexed images with _ and numbers completed with zeros to 3, 4 or 5 digits, e.g.'aa_045.tif' 25 27 % nom_type='#' series of indexed images wich is not series_i [filebase index ext], e.g. 'aa045.jpg' or 'aa45.tif' 26 28 % nom_type='_i_j' matrix of files with two indices i and j separated by '_'(e.g. 'aa_45_2.png') … … 28 30 % nom_type='_i_j1-j2'pairs of j indices (e.g. 'aa_45_2-3.nc') 29 31 % nom_type='_i1-i2_j' pairs of i indices (e.g. 'aa_45-46_2.nc') 32 % nom_type='%3da','%3dA' with a numerical index and an index letter(e.g.'aa045b.png'), 30 33 % nom_type='#a','#A' with a numerical index and an index letter(e.g.'aa045b.png'), OBSOLETE (replaced by 'series_i_j') 31 % nom_type='%03d' or '%04d', series of indexed images with numbers completed with zeros to 3 or 4 digits, e.g.'aa045.tif' 32 % nom_type='_%03d', '_%04d', or '_%05d', series of indexed images with _ and numbers completed with zeros to 3, 4 or 5 digits, e.g.'aa_045.tif' 33 % nom_type='raw_SMD', same as '#a' but with no extension ext='', OBSOLETE 34 % nom_type='#_ab' from pairs of '#a' images (e.g. 'aa045bc.nc'), ext='.nc', OBSOLETE (replaced by 'netc_2D') 35 % nom_type='%3dab' from pairs of '%3da' images (e.g. 'aa045bc.nc'), ext='.nc', OBSOLETE (replaced by 'netc_2D') 34 % nom_type='#_ab' from pairs of '#a' images (e.g. 'aa045bc.nc'), 35 % nom_type='%3d_ab' from pairs of '%3da' images (e.g. 'aa045bc.nc') 36 36 %'comp_input' (for nom_type involving index pairs (e.g. netc)) 37 37 % comp_input=1: the index pair is imposed, … … 48 48 sizf=size(filebase); 49 49 if (~ischar(filebase)||~isequal(sizf(1),1)),filebase='';end 50 if ~exist('ext','var') 51 ext=''; 52 end 53 if ~exist('nom_type','var') 54 nom_type=''; 55 end 50 56 if ~ischar(ext),ext='';end 51 % filename=[filebase ext];%default52 57 idetect=0; 53 if ~exist('num_i1','var') || ise qual(num_i1,[])58 if ~exist('num_i1','var') || isempty(num_i1) || isnan(num_i1) 54 59 num_i1=1; %default 55 60 end 56 if ~exist('num_j1','var') || isequal(num_j1,[])61 if ~exist('num_j1','var') || isempty(num_j1) || isnan(num_j1) 57 62 num_j1=1; %default 58 63 end 59 if ~exist('num_i2','var') || isequal(num_i2,[])64 if ~exist('num_i2','var') || isempty(num_i2) || isnan(num_i2) 60 65 num_i2=num_i1; %default 61 66 end 62 if ~exist('num_j2','var') || ise qual(num_i2,[])67 if ~exist('num_j2','var') || isempty(num_j2) || isnan(num_j2) 63 68 num_j2=num_j1; %default 64 69 end … … 71 76 num_j2_out=num_j2;%default output 72 77 73 test_pairs= isequal(nom_type,'netc_old')| isequal(nom_type,'netc_2D') | isequal(nom_type,'netc_3D')| isequal(nom_type,'_i1-i2_j1-j2')| ...74 isequal(nom_type,'netc_series')| isequal(nom_type,'#_ab')| isequal(nom_type,'_i_j1-j2')| isequal(nom_type,'_i1-i2_j')| isequal(nom_type,'_i1-i2');75 test_2D= isequal(nom_type,'netc_old') |isequal(nom_type,'netc_2D')|isequal(nom_type,'#_ab') |isequal(nom_type,'_i_j1-j2');76 test_3D= isequal(nom_type,'netc_3D') |isequal(nom_type,'netc_series')| isequal(nom_type,'_i1-i2_j')| isequal(nom_type,'_i1-i2');77 if isequal(nom_type,'series_i')| isequal(nom_type,'_i');78 test_pairs=strcmp(nom_type,'netc_old')| strcmp(nom_type,'netc_2D') | strcmp(nom_type,'netc_3D')| strcmp(nom_type,'_i1-i2_j1-j2')| ... 79 strcmp(nom_type,'netc_series')| strcmp(nom_type,'#_ab')| strcmp(nom_type,'_i_j1-j2')| strcmp(nom_type,'_i1-i2_j')| strcmp(nom_type,'_i1-i2'); 80 test_2D= strcmp(nom_type,'netc_old') |strcmp(nom_type,'netc_2D')|strcmp(nom_type,'#_ab') |strcmp(nom_type,'_i_j1-j2'); 81 test_3D=strcmp(nom_type,'netc_3D') |strcmp(nom_type,'netc_series')| strcmp(nom_type,'_i1-i2_j')| strcmp(nom_type,'_i1-i2'); 82 if strcmp(nom_type,'series_i')| strcmp(nom_type,'_i'); 78 83 filename=[filebase '_' num2str(num_i1) ext]; 79 84 num_i2_out=num_i1; 80 85 num_j1_out=[]; 81 86 num_j2_out=[]; 82 elseif length(nom_type)==5 && isequal(nom_type(1:3),'_%0')&& isequal(nom_type(5),'d');87 elseif length(nom_type)==5 && strcmp(nom_type(1:3),'_%0')&& strcmp(nom_type(5),'d'); 83 88 filename=[filebase '_' num2str(num_i1,nom_type(2:5)) ext]; 84 89 num_i2_out=num_i1; 85 90 num_j2_out=num_j1; 86 elseif isequal(nom_type,'series_i_j')| isequal(nom_type,'_i_j')91 elseif strcmp(nom_type,'series_i_j')| strcmp(nom_type,'_i_j') 87 92 filename=[filebase '_' num2str(num_i1) '_' num2str(num_j1) ext]; 88 93 num_i2_out=num_i1; 89 94 num_j2_out=num_j1; 90 elseif isequal(nom_type,'png_old')| isequal(nom_type,'#a')| isequal(nom_type,'#A')95 elseif strcmp(nom_type,'png_old')| strcmp(nom_type,'#a')| strcmp(nom_type,'#A') 91 96 filename=[filebase num2str(num_i1,'%03d') num2stra(num_j1,nom_type) ext]; 92 97 num_i2_out=num_i1; 93 98 num_j2_out=num_j1; 94 elseif length(nom_type)>=5 & isequal(nom_type(2:3),'%0') & isequal(nom_type(5),'d') %isequal(nom_type,'_%04dA') %camera PCO Toulouse99 elseif length(nom_type)>=5 & strcmp(nom_type(2:3),'%0') & strcmp(nom_type(5),'d') %strcmp(nom_type,'_%04dA') %camera PCO Toulouse 95 100 filename=[filebase nom_type(1) num2str(num_i1,nom_type(2:4)) num2stra(num_j1,nom_type) ext]; 96 101 num_i2_out=num_i1; 97 102 num_j2_out=num_j1; 98 elseif isequal(nom_type,'raw_SMD') %suffix a, b, c without extension103 elseif strcmp(nom_type,'raw_SMD') %suffix a, b, c without extension 99 104 filename=[filebase num2str(num_i1,'%03d') num2stra(num_j1,nom_type)]; 100 105 num_i2_out=num_i1; 101 106 num_j2_out=num_j1; 102 elseif isequal(nom_type,'ima_num')| isequal(nom_type,'#')107 elseif strcmp(nom_type,'ima_num')| strcmp(nom_type,'#') 103 108 filename=[filebase num2str(num_i1) ext]; 104 109 num_i2_out=num_i1; 105 110 num_j1_out=[]; 106 111 num_j2_out=[]; 107 elseif length(nom_type)>=4 & isequal(nom_type(1:2),'%0') & isequal(nom_type(end),'d')112 elseif length(nom_type)>=4 & strcmp(nom_type(1:2),'%0') & strcmp(nom_type(end),'d') 108 113 filename=[filebase num2str(num_i1,nom_type) ext]; %test number with a 0 before 109 114 num_i2_out=num_i1; … … 115 120 filebasesub=filebase; 116 121 % get the root name filebasesub for the netcdf files 117 if ~ isequal(subdir,'') && ~isequal(subdir,'?')122 if ~strcmp(subdir,'') && ~strcmp(subdir,'?') 118 123 [Path,Name]=fileparts(filebase); 119 124 filebasesub=fullfile(Path,subdir,Name); 120 125 end 121 126 %inexistant pair if num_i2=0 or num_j2=0 122 % if isequal(num_i2,0)127 % if strcmp(num_i2,0) 123 128 % filename=[filebasesub '*-*_' num2str(num_i1) ext]; 124 129 % return 125 130 % end 126 % if isequal(num_j2,0)131 % if strcmp(num_j2,0) 127 132 % filename=[filebasesub '_' num2str(num_i1) '_*-*' ext]; 128 133 % return … … 232 237 if ~isequal(subdir,'?'), subdir_out=subdir; else, subdir_out='';end; 233 238 234 %--------------------------------------------------------------- 235 % search the appropriate image pair (netcdf file) corresponding to a given 236 % image number 237 %------------------------------------------------------------------- 239 %------------------------------------------------------------------------ 240 % --- search the appropriate image pair (netcdf file) corresponding to a given image number 238 241 function [filename,num_i1,num_j1,num_i2,num_j2,idetect]=search_pair(filebasesub,num_i1,num_j1,num_i2,nom_type) 242 %------------------------------------------------------------------------ 239 243 % for nom_type=netc_2D or netc_old, it searches all the pairs corresponding 240 244 % to num_i1, and chooses the most recent file. -
trunk/src/nc2struct.m
r56 r89 16 16 % .DimValue= vlalues of dimensions (added information, not requested for field description) 17 17 % .VarDimIndex= list of dimension indices (added information, 18 18 % 19 19 %INPUT: 20 20 % nc: name of a netcdf file (char string) or netcdf object -
trunk/src/plot_field.m
r88 r89 31 31 % The only variable attribute used for plotting purpose is .Role which can take 32 32 % the values 33 34 35 36 37 38 39 40 41 42 43 33 % Role = 'scalar': (default) represents a scalar field 34 % = 'coord_x', 'coord_y', 'coord_z': represents a separate set of 35 % unstructured coordinate x, y or z 36 % = 'vector': represents a vector field whose number of components 37 % is given by the last dimension (called 'nb_dim') 38 % = 'vector_x', 'vector_y', 'vector_z' :represents the x, y or z component of a vector 39 % = 'warnflag' : provides a warning flag about the quality of data in a 'Field', default=0, no warning 40 % = 'errorflag': provides an error flag marking false data, 41 % default=0, no error. Different non zero values can represent different criteria of elimination. 42 % 43 % 44 44 % additional elements characterizing the projection object (should not be necessary)-- 45 45 % Data.Style : style of projection object … … 84 84 % PosColorbar: if not empty, display a colorbar for B&W images 85 85 % imposed position of the colorbar (ex [0.821 0.471 0.019 0.445]) 86 % 86 87 87 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 88 88 % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. … … 141 141 if testnewfig% create a new figure and axes if the plotting axes does not exist 142 142 hfig=figure; 143 if isfield(Data,'IndexObj') &isfield(Data,'Style')&isfield(Data,'ProjMode')143 if isfield(Data,'IndexObj') && isfield(Data,'Style') && isfield(Data,'ProjMode') 144 144 figname=[num2str(Data.IndexObj) '-' Data.Style]; 145 145 set(hfig,'Name',figname) 146 146 end 147 testhandle=0;148 if isfield(PlotParam,'text_display_1') & ishandle(PlotParam.text_display_1)147 % testhandle=0; 148 if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1) 149 149 set(hfig,'UserData',PlotParam) 150 testhandle=1;150 % testhandle=1; 151 151 end 152 152 set(hfig,'Units','normalized') … … 160 160 hstack=findobj(allchild(0),'Type','figure');%current stack order of figures in matlab 161 161 end 162 if isfield(PlotParam,'text_display_1') & ishandle(PlotParam.text_display_1)162 if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1) 163 163 PlotParam=read_plot_param(PlotParam); 164 164 end … … 171 171 172 172 % check the cells of fields : 173 testnbdim=1;173 % testnbdim=1; 174 174 [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Data); 175 175 … … 180 180 end 181 181 if ~isfield(Data,'NbDim') %& ~isfield(Data,'Style')%determine the space dimensionb if not defined: choose the kind of plot 182 [Data.NbDim ,imax]=max(NbDim);182 [Data.NbDim]=max(NbDim); 183 183 end 184 184 if isequal(Data.NbDim,0) … … 207 207 msgbox_uvmat('ERROR','volume plot not implemented yet') 208 208 return 209 else210 testnbdim=0;209 % else 210 % testnbdim=0; 211 211 end 212 212 … … 239 239 function hdisplay=plot_text(FieldData,hdisplay_in) 240 240 %------------------------------------------------------------------- 241 if exist('hdisplay_in','var') & ishandle(hdisplay_in)& isequal(get(hdisplay_in,'Type'),'uicontrol')241 if exist('hdisplay_in','var') && ishandle(hdisplay_in) && isequal(get(hdisplay_in,'Type'),'uicontrol') 242 242 hdisplay=hdisplay_in; 243 243 else … … 254 254 sizss=size(ss); 255 255 if isnumeric(ss) 256 if sizss(1)<=1 & length(ss)<5256 if sizss(1)<=1 && length(ss)<5 257 257 displ{icell}=num2str(ss); 258 258 else … … 263 263 elseif iscell(ss) 264 264 sizcell=size(ss); 265 if sizcell(1)==1 & length(sizcell)==2 %line cell265 if sizcell(1)==1 && length(sizcell)==2 %line cell 266 266 ssline='{'''; 267 267 for icolumn=1:sizcell(2) 268 268 if isnumeric(ss{icolumn}) 269 if size(ss{icolumn},1)<=1 & length(ss{icolumn})<5269 if size(ss{icolumn},1)<=1 && length(ss{icolumn})<5 270 270 sscolumn=num2str(ss{icolumn});%line vector 271 271 else … … 321 321 plotstr='hhh=plot('; 322 322 textmean={}; 323 abscissa_name='';323 % abscissa_name=''; 324 324 coord_x_index=[]; 325 325 test_newplot=1; 326 326 hh=findobj(haxes,'tag','plot_line'); 327 num_curve=numel(hh);327 % num_curve=numel(hh); 328 328 icurve=0; 329 329 for icell=1:length(CellVarIndex) … … 351 351 testcoordvar=0; 352 352 charplot_0='''-''';%default 353 if isfield(data,'ObjectProjMode')& isequal(data.ObjectProjMode,'projection')353 if isfield(data,'ObjectProjMode')&& isequal(data.ObjectProjMode,'projection') 354 354 charplot_0='+'; 355 355 end … … 374 374 VarAttribute=data.VarAttribute; 375 375 for ivar=1:length(VarIndex) 376 if length(VarAttribute)>=VarIndex(ivar) & isfield(VarAttribute{VarIndex(ivar)},'long_name')376 if length(VarAttribute)>=VarIndex(ivar) && isfield(VarAttribute{VarIndex(ivar)},'long_name') 377 377 plotname{VarIndex(ivar)}=VarAttribute{VarIndex(ivar)}.long_name; 378 378 else … … 461 461 else 462 462 legend_old=get(hlegend,'String'); 463 if isequal(size(legend_old,1),size(legend_str,1))& ~isequal(legend_old,legend_str)463 if isequal(size(legend_old,1),size(legend_str,1))&&~isequal(legend_old,legend_str) 464 464 set(hlegend,'String',[legend_old legend_str]); 465 465 end … … 537 537 y_units=''; 538 538 for icell=1:length(CellVarIndex) % length(CellVarIndex) =1 or 2 (from the calling function) 539 % VarIndex=CellVarIndex{icell};540 539 VarType=VarTypeCell{icell}; 541 540 ivar_X=VarType.coord_x; % defines (unique) index for the variable representing unstructured x coordinate (default =[]) … … 564 563 eval(['vec_U=Data.' Data.ListVarName{ivar_U} ';']) 565 564 eval(['vec_V=Data.' Data.ListVarName{ivar_V} ';']) 565 'TESTplot' 566 VarType.coord 566 567 if ~isempty(ivar_X) && ~isempty(ivar_Y)% 2D field (with unstructured coordinates or structured ones (then ivar_X and ivar_Y empty) 567 568 eval(['vec_X=Data.' Data.ListVarName{ivar_X} ';']) … … 614 615 [A,AX,AY]=proj_grid(AX',AY',A',[],[],'np>256'); % interpolate on a grid 615 616 if isfield(Data,'VarAttribute') 616 if numel(Data.VarAttribute)>=ivar_X & isfield(Data.VarAttribute{ivar_X},'units')617 if numel(Data.VarAttribute)>=ivar_X && isfield(Data.VarAttribute{ivar_X},'units') 617 618 x_units=['(' Data.VarAttribute{ivar_X}.units ')']; 618 619 end 619 if numel(Data.VarAttribute)>=ivar_Y & isfield(Data.VarAttribute{ivar_Y},'units')620 if numel(Data.VarAttribute)>=ivar_Y && isfield(Data.VarAttribute{ivar_Y},'units') 620 621 y_units=['(' Data.VarAttribute{ivar_Y}.units ')']; 621 622 end … … 629 630 test_interp_Y=0; %default, regularly meshed Y coordinate 630 631 if isfield(Data,'VarAttribute') 631 if numel(Data.VarAttribute)>=VarType.coord(2) & isfield(Data.VarAttribute{VarType.coord(2)},'units')632 if numel(Data.VarAttribute)>=VarType.coord(2) && isfield(Data.VarAttribute{VarType.coord(2)},'units') 632 633 x_units=['(' Data.VarAttribute{VarType.coord(2)}.units ')']; 633 634 end … … 714 715 end 715 716 %set the color map 717 if isfield(PlotParam.Scalar,'BW') 718 BW=PlotParam.Scalar.BW; %test for BW gray scale images 719 else 720 BW=(siz==2) && (isa(A,'uint8')|| isa(A,'uint16'));% non color images represented in gray scale by default 721 end 716 722 if siz==2 %for black and white images 717 723 if ~isfield(PlotParam.Scalar,'AutoScal') … … 729 735 MinA=PlotParam.Scalar.MinA; 730 736 end; 731 if isequal(PlotParam.Scalar.AutoScal,0)| isempty(PlotParam.Scalar.MaxA)|~isa(PlotParam.Scalar.MaxA,'double') %correct if there is no numerical data in edit box737 if isequal(PlotParam.Scalar.AutoScal,0)||isempty(PlotParam.Scalar.MaxA)||~isa(PlotParam.Scalar.MaxA,'double') %correct if there is no numerical data in edit box 732 738 MaxA=double(max(max(A))); 733 739 else … … 756 762 contmin=intercont*floor(min(min(B))/intercont); 757 763 contmax=intercont*ceil(max(max(B))/intercont); 758 cont_pos_plus= [0:intercont:contmax];759 cont_pos_min= [double(contmin):intercont:-intercont];764 cont_pos_plus=0:intercont:contmax; 765 cont_pos_min=double(contmin):intercont:-intercont; 760 766 cont_pos=[cont_pos_min cont_pos_plus]; 761 767 sizpx=(AX(end)-AX(1))/(np(2)-1); 762 768 sizpy=(AY(1)-AY(end))/(np(1)-1); 763 769 x_cont=[AX(1):sizpx:AX(end)]; % pixel x coordinates for image display 764 y_cont= [AY(1):-sizpy:AY(end)]; % pixel x coordinates for image display770 y_cont=AY(1):-sizpy:AY(end); % pixel x coordinates for image display 765 771 txt=ver;%version of Matlab 766 772 Release=txt(1).Release; … … 783 789 colormap(map); 784 790 end 785 if ~isequal(PlotParam.Scalar.Contours,1) 791 if ~isequal(PlotParam.Scalar.Contours,1) 786 792 % rescale the grey levels with min and max, put a grey scale colorbar 787 if (isfield(PlotParam.Scalar,'BW')& (isequal(PlotParam.Scalar.BW,1))|isa(A,'uint8')| isa(A,'uint16'))%images793 if BW 788 794 B=A; 789 795 vec=linspace(0,1,255);%define a linear greyscale colormap … … 797 803 else %color images 798 804 axes(haxes) 799 B=uint8(A); 805 if BW 806 B=uint16(sum(A,3)); 807 else 808 B=uint8(A); 809 end 800 810 MinA=0; 801 811 MaxA=255; … … 846 856 test_ima=1; 847 857 %display the colorbar code for B/W images if Poscolorbar not empty 848 if siz==2 & exist('PosColorbar','var')& ~isempty(PosColorbar)858 if siz==2 && exist('PosColorbar','var')&& ~isempty(PosColorbar) 849 859 if isempty(hcol)|~ishandle(hcol) 850 860 hcol=colorbar;%create new colorbar … … 966 976 dy_thresh=max(abs(diffy))/2; 967 977 ind_jump=find(abs(diffy) > dy_thresh); %indices with diff(vec_Y)> max/2, detect change of line 968 ind_sel= [1:ind_jump(1)];%select the first line978 ind_sel=1:ind_jump(1);%select the first line 969 979 for i=2:2:length(ind_jump)-1 970 980 ind_sel=[ind_sel [ind_jump(i)+1:ind_jump(i+1)]];% select the odd lines … … 1191 1201 siz=size(ind); 1192 1202 if siz(2)<4%if there are less than 4 selected values (4 levels) 1193 values= [-9:0.5*div:9];1203 values=-9:0.5*div:9; 1194 1204 ind=find((ord*values-MaxA)<0 & (ord*values-MinA)>0); 1195 1205 end -
trunk/src/read_get_field.m
r81 r89 666 666 end 667 667 end 668 if empty_coord_vec_x 669 coord_x_name=DimCell{2}; 670 SubField.ListVarName=[{coord_x_name} SubField.ListVarName]; 671 SubField.VarDimName=[{coord_x_name} SubField.VarDimName]; 672 if testold 673 eval(['SubField.' coord_x_name '=linspace(Coord_2(1),Coord_2(end),npxy(2));']) 674 else 675 eval(['SubField.' coord_x_name '=[0.5 npxy(2)-0.5];']) 676 end 668 if empty_coord_vec_x 669 if numel(DimCell)<2 670 errormsg='undefined x coordinate'; 671 return 672 end 673 coord_x_name=DimCell{2}; 674 SubField.ListVarName=[{coord_x_name} SubField.ListVarName]; 675 SubField.VarDimName=[{coord_x_name} SubField.VarDimName]; 676 if testold 677 eval(['SubField.' coord_x_name '=linspace(Coord_2(1),Coord_2(end),npxy(2));']) 678 else 679 eval(['SubField.' coord_x_name '=[0.5 npxy(2)-0.5];']) 680 end 677 681 678 682 if ~testold -
trunk/src/series.m
r76 r89 430 430 update_file(hObject, eventdata, handles,fileinput,1) 431 431 432 % 433 % refresh the GUI data after introduction of a new file series432 %------------------------------------------------------------------------ 433 % --- refresh the GUI data after introduction of a new file series 434 434 function update_file(hObject, eventdata, handles,fileinput,addtest) 435 % hseries=get(handles.RootPath,'parent');435 %------------------------------------------------------------------------ 436 436 if ~exist(fileinput,'file') 437 437 msgbox_uvmat('ERROR',['input file ' fileinput ' does not exist']) 438 438 return 439 439 end 440 hseries=handles.figure1; 440 441 441 % refresh input root name, indices, file extension and nomenclature 442 442 [RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput); 443 443 444 %check for movie image files 444 445 if ~isempty(FileExt) 445 if ~isempty(imformats(FileExt(2:end)))446 imainfo=imfinfo(fileinput);447 if length(imainfo) >1 %case of image with multiple frames448 NomType='*';449 [RootPath,RootFile]=fileparts(fileinput);450 end451 end446 if ~isempty(imformats(FileExt(2:end))) 447 imainfo=imfinfo(fileinput); 448 if length(imainfo) >1 %case of image with multiple frames 449 NomType='*'; 450 [RootPath,RootFile]=fileparts(fileinput); 451 end 452 end 452 453 end 453 454 NcType='none';%default … … 467 468 set(handles.nb_field2,'Value',1) 468 469 if addtest 469 SeriesData=get(h series,'UserData');470 SeriesData=get(handles.figure1,'UserData'); 470 471 SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num]; 471 472 SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile; … … 520 521 set(handles.first_j,'String',num2str(ref_j)) 521 522 set(handles.last_j,'String',num2str(ref_j)); 522 %set(hseries,'UserData',SeriesData);523 523 524 524 %enable other menus and uicontrols … … 544 544 FileBase=fullfile(RootPath,RootFile); 545 545 546 % nb_field{icell,1}='?';%default547 % nb_field2{icell,1}='?';%default548 546 testima=0; %test for image input 549 547 if isequal(lower(FileExt),'.avi') %.avi file … … 681 679 [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']); 682 680 time=XmlData.Time; 683 size(time)684 GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0];685 GeometryCalib.Tx=0;686 GeometryCalib.Ty=0;687 GeometryCalib.Tz=1;688 GeometryCalib.dpx=1;689 GeometryCalib.dpy=1;690 GeometryCalib.sx=1;691 GeometryCalib.Cx=0;692 GeometryCalib.Cy=0;693 GeometryCalib.f=1;694 GeometryCalib.kappa1=0;695 GeometryCalib.CoordUnit='cm';696 XmlData.GeometryCalib=GeometryCalib;697 681 if error==2, warntext=['no file ' FileBase '.civ']; 698 682 elseif error==1, warntext='inconsistent number of fields in the .civ file'; … … 705 689 end 706 690 707 if ~isempty(time) 708 siztime=size(time); 709 nb_field=siztime(1); 710 nb_field2=siztime(2); 711 end 691 692 % if ~isempty(time) 693 % siztime=size(time); 694 % nb_field=siztime(1); 695 % nb_field2=siztime(2); 696 % end 712 697 set(handles.TimeUnit,'String',TimeUnit) 698 %look for max indices 699 if ~strcmp(NomType,'*') 700 [num_i1,num_i2,num_j1,num_j2]=find_indexseries(fileinput); 701 nb_field=max(floor((max(num_i1)+max(num_i2))/2)); 702 nb_field2=max(floor((max(num_j1)+max(num_j2))/2)); 703 end 713 704 if isempty(nb_field) 714 705 nb_field_str='?'; … … 727 718 set(handles.nb_field,'String',nb_field_cell); 728 719 set(handles.nb_field2,'String',nb_field2_cell); 729 set(h series,'UserData',SeriesData);720 set(handles.figure1,'UserData',SeriesData); 730 721 731 722 %number of slices … … 743 734 NomType_Callback(hObject, eventdata, handles) 744 735 736 %store the root name for future opening of uvmat 745 737 dir_perso=prefdir; 746 738 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 747 % save(profil_perso, 'FileBase'); %store the root name for future opening of uvmat748 739 if exist(profil_perso,'file') 749 740 save (profil_perso,'RootPath','SubDir','RootFile','NomType', '-append'); %store the root name for future opening of uvmat … … 839 830 NomType_Callback(hObject, eventdata, handles) 840 831 832 %------------------------------------------------------------------------ 841 833 function NomType_Callback(hObject, eventdata, handles) 834 %------------------------------------------------------------------------ 842 835 hseries=get(handles.ProjObject,'Parent'); 843 836 SeriesData=get(hseries,'UserData'); … … 897 890 state_j='on'; 898 891 end 899 end 892 end 900 893 if testpair 901 894 mode_Callback(hObject, eventdata, handles) 902 895 else 903 896 set(handles.NomType,'String',NomTypeCell) 904 end 905 set(handles.first_j,'Visible',state_j) 906 set(handles.incr_j,'Visible',state_j) 907 set(handles.last_j,'Visible',state_j) 908 set(handles.nb_field2,'Visible',state_j) 897 set(handles.first_j,'Visible',state_j) 898 set(handles.incr_j,'Visible',state_j) 899 set(handles.last_j,'Visible',state_j) 900 set(handles.nb_field2,'Visible',state_j) 901 end 902 909 903 910 904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%???????????? … … 926 920 test_find_pair=isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2')|| isequal(NomType,'#_ab'); 927 921 end 928 % displ_num=[];%default929 % first_i=str2num(get(handles.first_i,'String'));930 % last_i=str2num(get(handles.last_i,'String'));931 922 time=[]; 932 923 if isfield(SeriesData,'Time') … … 939 930 if isequal(mode,'bursts') 940 931 enable_i(handles,'On') 941 enable_j(handles,'Off') 932 enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 942 933 elseif isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j') 943 934 enable_i(handles,'On') 944 enable_j(handles,'On') 935 enable_j(handles,'On') % allow both i and j index scanning 945 936 else 946 937 enable_i(handles,'On') … … 993 984 994 985 %-------------------------------------------------------------- 995 % determine the menu for civ1 pairs depending on existing netcdf file at the middle of996 % the field series set by first_i, incr, last_i986 % determine the menu for civ1 pairs depending on existing netcdf files 987 % with the reference indices ref_i and ref_j 997 988 %---------------------------------------------------------------- 998 989 function find_netcpair_civ(hObject, eventdata, handles,Val) … … 1087 1078 displ_num(4,ind_exist)=0; 1088 1079 %[cte_detect,vdt,cte_read]=read_netcdf(filename,{'dt','dt2','absolut_time_T0','absolute_time_TO_2'}); 1089 [Cte,var_detect,ichoice]=nc2struct( nc,{});1080 [Cte,var_detect,ichoice]=nc2struct(filename,{}); 1090 1081 if isfield(Cte,'dt2') 1091 1082 dt=Cte.dt2; … … 1357 1348 end 1358 1349 Series.hseries=handles.figure1; % handles to the series GUI 1359 % if isequal(get(handles.ParamVal,'Visible'),'on')1360 % ParamKey=get(handles.ParamKey,'String');1361 % if ischar(ParamKey)1362 % ParamKey{1}=ParamKey;1363 % end1364 % ParamString=get(handles.ParamVal,'String');1365 % if ischar(ParamString)1366 % for ilist=1:size(ParamString,1)1367 % ParamVal{ilist}=ParamString(ilist,:);1368 % end1369 % else1370 % ParamVal=ParamString;1371 % end1372 % end1373 1350 1374 1351 %read the set of field numbers … … 1433 1410 %case of pairs (.nc files) 1434 1411 1435 if isequal(NomType{iview},'_i_j1-j2')| isequal(NomType{iview},'_i1-i2_j')| isequal(NomType{iview},'_i1-i2')| isequal(NomType{iview},'#_ab')1412 if isequal(NomType{iview},'_i_j1-j2')|| isequal(NomType{iview},'_i1-i2_j')|| isequal(NomType{iview},'_i1-i2')|| isequal(NomType{iview},'#_ab') 1436 1413 ind_shift=SeriesData.displ_num(iview,:); 1437 1414 if isequal(ind_shift,[0 0 0 0]) % undefined pairs … … 1928 1905 end 1929 1906 1930 %---------------------------------------------------- 1931 % determine the list of index pairs of processing file 1932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1907 %------------------------------------------------------------------------ 1908 % --- determine the list of index pairs of processing file 1933 1909 function [num_i1,num_i2,num_j1,num_j2,num_i_out,num_j_out]=find_file_indices(num_i,num_j,ind_shift,NomType,mode) 1910 %------------------------------------------------------------------------ 1934 1911 num_i1=num_i;% set of first image numbers by default 1935 1912 num_i2=num_i; … … 1938 1915 num_i_out=num_i; 1939 1916 num_j_out=num_j; 1940 if isequal (NomType,'_i1-i2_j') | isequal (NomType,'_i1-i2')1917 if isequal (NomType,'_i1-i2_j') || isequal (NomType,'_i1-i2') 1941 1918 num_i1_line=num_i+ind_shift(3);% set of first image numbers 1942 1919 num_i2_line=num_i+ind_shift(4); … … 2211 2188 set(handles.path_transform,'String',fileparts(func.file)); %show the path to the senlected function 2212 2189 2213 %------------------------------------------------------------- 2214 %generates a series of file names with reference numbers between range1 and 2215 %range2 with increment incr. The reference number num_ref is the image number at the middle of the 2216 %image pair. The set of first numbers num1 of the image pairs is also 2217 %given as output 2218 %------------------------------------------------------ 2190 %------------------------------------------------------------------------ 2191 % --- generates a series of file names with reference numbers between range1 and 2192 % --- range2 with increment incr. The reference number num_ref is the image number at the middle of the 2193 % --- image pair. The set of first numbers num1 of the image pairs is also 2194 % --- given as output 2219 2195 function [num_i1,num_i2,num_j1,num_j2,nbmissing]=netseries_generator(filebase,subdir,mode,first_i,incr_i,last_i,first_j,incr_j,last_j) 2196 %------------------------------------------------------------------------ 2220 2197 [Path,Name]=fileparts(filebase); 2221 2198 filebasesub=fullfile(Path,subdir,Name); … … 2236 2213 dirpair=dir([filebasesub '_*-*_*.nc']); 2237 2214 else 2238 errordlg('option *|* not yet implemented')2215 msgbox_uvmat('ERROR','option *|* not yet implemented') 2239 2216 return 2240 2217 end 2241 2218 if isempty(dirpair) 2242 errordlg('no pair detected in the selected range')2219 msgbox_uvmat('ERROR','no pair detected in the selected range') 2243 2220 return 2244 2221 end 2245 %ind0_i=first_i:incr_i:last_i; 2246 %nbcolumn=length(ind0_i); 2247 %dirpair=dir([filebasesub '_*_*-*.nc']); 2248 if isequal(mode,'bursts')|isequal(mode,'#_ab') 2222 2223 if isequal(mode,'bursts')||isequal(mode,'#_ab') 2249 2224 icount=0; 2250 2225 for ifile=1:length(dirpair) 2251 2226 [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); 2252 2253 % if isempty(str2num(str_1))2254 % dirpair(ifile).name2255 % end2256 2227 num1_r=str2num(str_1); 2257 2228 if isequal(RootFile,Name) & ~isempty(num1_r) … … 2259 2230 num_a(ifile)=stra2num(str_a); 2260 2231 num_b(ifile)=stra2num(str_b); 2261 % icount=icount+1;2262 2232 end 2263 2233 end 2264 length(dirpair)2265 % num_j=floor((num_a+num_b)/2); %list of reference indices of the detected files2266 2234 test_range= (num_i1 >=first_i)&(num_i1<= last_i);% =1 when both numbers are in the range 2267 2235 ind_i=((num_i1-first_i)/incr_i)+1;%indices i in the list of prescribed file indices … … 2309 2277 num_i1_r=num_i1_r(select); 2310 2278 num_i2_r=num_i2_r(select); 2311 % num_j=num_j(select);2312 2279 dirpair=dirpair(select); 2313 2280 [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ; … … 2325 2292 nbmissing=nbline*nbcolumn-length(ind_ij); 2326 2293 elseif isequal(mode,'series(Dj)') 2327 % ind0_i=first_i:incr_i:last_i;2328 % nbcolumn=length(ind0_i);2329 % ind0_j=first_j:incr_j:last_j;2330 % nbline=length(ind0_j);2331 % dirpair=dir([filebasesub '_*_*-*.nc']);2332 2294 for ifile=1:length(dirpair) 2333 2295 [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); … … 2362 2324 num_i2=num_i1; 2363 2325 nbmissing=nbline*nbcolumn-length(ind_ij); 2364 % for i=1:length(indsel);%A SUPPRIMER ULTERIEUREMENT 2365 % if indsel(i)==0 2366 % filecell{i}=''; 2367 % else 2368 % Name=dirpair(indsel(i)).name; 2369 % filecell{i}=fullfile(Path,subdir,Name); 2370 % end 2371 % end 2372 %else 2373 % errordlg('option *|* not yet implemented') 2374 % return 2375 end 2376 2377 function path_transform_Callback(hObject, eventdata, handles) 2378 % hObject handle to path_transform (see GCBO) 2379 % eventdata reserved - to be defined in a future version of MATLAB 2380 % handles structure with handles and user data (see GUIDATA) 2381 2382 % Hints: get(hObject,'String') returns contents of path_transform as text 2383 % str2double(get(hObject,'String')) returns contents of path_transform as a double 2384 2385 2386 % --- Executes during object creation, after setting all properties. 2387 function path_transform_CreateFcn(hObject, eventdata, handles) 2388 % hObject handle to path_transform (see GCBO) 2389 % eventdata reserved - to be defined in a future version of MATLAB 2390 % handles empty - handles not created until after all CreateFcns called 2391 2392 % Hint: edit controls usually have a white background on Windows. 2393 % See ISPC and COMPUTER. 2394 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2395 set(hObject,'BackgroundColor','white'); 2396 end 2397 2398 2326 end 2327 2328 %------------------------------------------------------------------------ 2329 % --- generates series of file indices corresponding to a file fileinput 2330 function [num_i1,num_i2,num_j1,num_j2]=find_indexseries(fileinput) 2331 %------------------------------------------------------------------------ 2332 num_i1=NaN;%default 2333 num_i2=NaN;%default 2334 num_j1=NaN;%default 2335 num_j2=NaN;%default 2336 % refresh input root name, indices, file extension and nomenclature 2337 [RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput); 2338 if strcmp(SubDir,'') 2339 filebasesub=fullfile(RootPath,RootFile); 2340 else 2341 filebasesub=fullfile(RootPath,SubDir,RootFile); 2342 end 2343 dirpair=[]; %default 2344 switch NomType 2345 case '_i' 2346 dirpair=dir([filebasesub '_*' FileExt]); 2347 case '_i_j' 2348 dirpair=dir([filebasesub '_*_*' FileExt]); 2349 case '_i1-i2' 2350 dirpair=dir([filebasesub '_*-*' FileExt]); 2351 case '#_ab' 2352 dirpair=dir([filebasesub '*_*' FileExt]); 2353 case '_i_j1-j2' 2354 dirpair=dir([filebasesub '*_*-*' FileExt]); 2355 case '_i1-i2_j' 2356 dirpair=dir([filebasesub '*-*_*' FileExt]); 2357 end 2358 % nom_type='#' series of indexed images wich is not series_i 2359 % [filebase index ext], e.g. 'aa045.jpg' or 'aa45.tif' 2360 % nom_type='#a','#A' with a numerical index and an index letter(e.g.'aa045b.png'), OBSOLETE (replaced by 'series_i_j') 2361 % nom_type='%03d' or '%04d', series of indexed images with numbers completed with zeros to 3 or 4 digits, e.g.'aa045.tif' 2362 % nom_type='_%03d', '_%04d', or '_%05d', series of indexed images with _ and numbers completed with zeros to 3, 4 or 5 digits, e.g.'aa_045.tif' 2363 % nom_type='raw_SMD', same as '#a' but with no extension ext='', OBSOLETE 2364 % nom_type='#_ab' from pairs of '#a' images (e.g. 'aa045bc.nc'), ext='.nc', OBSOLETE (replaced by 'netc_2D') 2365 % nom_type='%3dab' from pairs of '%3da' images (e.g. 'aa045bc.nc'), ext='.nc', OBSOLETE (replaced by 'netc_2D') 2366 for ifile=1:length(dirpair) 2367 [RootPath,RF,str_1,str_2,str_a,str_b]=name2display(dirpair(ifile).name); 2368 num_i1(ifile)=str2double(str_1); 2369 num_i2(ifile)=str2double(str_2); 2370 if isnan(num_i2(ifile)) 2371 num_i2(ifile)=num_i1(ifile); 2372 end 2373 num_j1(ifile)=stra2num(str_a); 2374 if isnan(num_j1(ifile)) 2375 num_j1(ifile)=1; 2376 end 2377 num_j2(ifile)=stra2num(str_b); 2378 if isnan(num_j2(ifile)) 2379 num_j2(ifile)=num_j1(ifile); 2380 end 2381 end 2382 -
trunk/src/series/merge_proj.m
r78 r89 1 function GUI_input=merge_proj(num_i1,num_i2,num_j1,num_j2,Series) ;1 function GUI_input=merge_proj(num_i1,num_i2,num_j1,num_j2,Series) 2 2 3 3 %requests for the visibility of input windows in the GUI series (activated directly by the selection in the menu ACTION) … … 65 65 if ~isequal(hhh,'')&& mmreader.isPlatformSupported() 66 66 if isequal(lower(FileExt{iview}),'.avi') 67 MovieObject{iview}=mmreader(fullfile( RootPath{iview},[RootFile{iview}FileExt{iview}]));67 MovieObject{iview}=mmreader(fullfile(Series.RootPath{iview},[Series.RootFile{iview} Series.FileExt{iview}])); 68 68 test_movie(iview)=1; 69 69 end … … 117 117 %check coincidence in time 118 118 multitime=0; 119 if length(timecell)==0119 if isempty(timecell) 120 120 time=[]; 121 121 elseif length(timecell)==1 … … 160 160 if isequal(FieldName,'get_field...') 161 161 hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI 162 % hhget_field=guidata(hget_field);%handles of GUI elements in get_field163 162 SubField=get_field('read_get_field',hObject,eventdata,hget_field); %read the names of the variables to plot in the get_field GUI 164 % if isequal(get(hhget_field.menu_coord,'Visible'),'on')165 % list_transform=get(hhget_field.menu_coord,'String');166 % val_list=get(hhget_field.menu_coord,'Value');167 % transform=list_transform{val_list};168 % end169 163 end 170 164 %detect whether all the files are 'images' or 'netcdf' … … 176 170 for iview=1:nbview 177 171 ext=FileExt{iview}; 178 form=imformats(ext( [2:end]));172 form=imformats(ext(2:end)); 179 173 if isequal(lower(ext),'.vol') 180 174 testvol=testvol+1; … … 286 280 Field{iview}=transform_fct(Field{iview},XmlData{iview});%transform to phys if requested 287 281 end 282 min(Field{iview}.X) 288 283 if testcivx 289 284 Field{iview}=calc_field(FieldName,Field{iview}); 290 285 end 286 min(Field{iview}.X) 291 287 292 288 %projection on object (gridded plane) … … 386 382 error=1; 387 383 end 388 % if ~isequal(MergeData.VarDimIndex,Data{iview}.VarDimIndex)389 % error=1;390 % end391 384 end 392 385 if error … … 394 387 return 395 388 end 389 390 %group the variables (fields of 'FieldData') in cells of variables with the same dimensions 391 [CellVarIndex,NbDim,VarTypeCell]=find_field_indices(Data{1}); 392 %LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS 393 % CellVarIndex=cells of variable index arrays 394 ivar_new=0; % index of the current variable in the projected field 395 icoord=0; 396 for icell=1:length(CellVarIndex) 397 if NbDim(icell)==1 398 continue 399 end 400 VarIndex=CellVarIndex{icell};% indices of the selected variables in the list FieldData.ListVarName 401 VarType=VarTypeCell{icell}; 402 ivar_X=VarType.coord_x; 403 ivar_Y=VarType.coord_y; 404 ivar_FF=VarType.errorflag; 405 if isempty(ivar_X) 406 test_grid=1;%test for input data on regular grid (e.g. image)coordinates 407 else 408 if length(ivar_Y)~=1 409 msgbox_uvmat('ERROR','y coordinate missing in proj_field.m') 410 return 411 end 412 test_grid=0; 413 end 414 % DimIndices=Data{1}.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell) 415 %case of input fields with unstructured coordinates 416 if ~test_grid 417 for ivar=VarIndex 418 VarName=MergeData.ListVarName{ivar}; 419 for iview=1:nbview 420 eval(['MergeData.' VarName '=[MergeData.' VarName '; Data{iview}.' VarName '];']) 421 end 422 end 423 %case of fields defined on a structured grid 424 else 425 % DimValue=MergeData.DimValue(DimIndices);%set of dimension values 426 testFF=0; 427 for iview=2:nbview 428 % if ~isequal(DimValue,Data{iview}.DimValue(DimIndices)) 429 % MergeData.Txt='ERROR: attempt at merging structured fields with different sizes'; 430 % return 431 % end 432 for ivar=VarIndex 433 VarName=MergeData.ListVarName{ivar}; 434 if isfield(MergeData,'VarAttribute') 435 if length(MergeData.VarAttribute)>=ivar && isfield(MergeData.VarAttribute{ivar},'Role') && isequal(MergeData.VarAttribute{ivar}.Role,'errorflag') 436 testFF=1; 437 end 438 end 439 eval(['MergeData.' VarName '=MergeData.' VarName '+ Data{iview}.' VarName ';']) 440 end 441 end 442 if testFF 443 nbaver=nbview-MergeData.FF; 444 indgood=find(nbaver>0); 445 for ivar=VarIndex 446 VarName=MergeData.ListVarName{ivar}; 447 eval(['MergeData.' VarName '(indgood)=double(MergeData.' VarName '(indgood))./nbaver(indgood);']) 448 end 449 else 450 for ivar=VarIndex 451 VarName=MergeData.ListVarName{ivar}; 452 eval(['MergeData.' VarName '=double(MergeData.' VarName ')./nbview;']) 453 end 454 end 455 end 456 end 457 -
trunk/src/series/sub_background.m
r54 r89 65 65 FileType=[];%default 66 66 MovieObject=[]; 67 FileExt=Series.FileExt; 68 67 69 if isequal(lower(FileExt),'.avi') 68 70 hhh=which('mmreader'); … … 78 80 form=imformats(FileExt(2:end)); 79 81 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 80 if isequal( NomType,'*');82 if isequal(Series.NomType,'*'); 81 83 FileType='multimage'; 82 84 else … … 237 239 ifile=indselect(ifield); 238 240 filename=name_generator(filebase,num_i1(ifile),num_j1(ifile),Series.FileExt,Series.NomType); 239 Aread=read_image(filename,FileType,num_i1(ifile), movieobject);241 Aread=read_image(filename,FileType,num_i1(ifile),MovieObject); 240 242 Ak(:,:,ifield)=Aread; 241 243 end … … 272 274 ifile=indselect(ifield+step*floor(nbaver/2)+iburst-1); 273 275 filename=name_generator(filebase,num_i1(ifile),num_j1(ifile),Series.FileExt,Series.NomType); 274 Aread=read_image(filename,FileType,num_i1(ifile), movieobject);276 Aread=read_image(filename,FileType,num_i1(ifile),MovieObject); 275 277 Ak(:,:,nbaver_ima-step+iburst)=Aread; 276 278 end … … 316 318 %------------------------------------------------------------------------ 317 319 %--read images and convert them to the uint16 format used for PIV 318 function A=read_image(filename,type_ima,num, movieobject)320 function A=read_image(filename,type_ima,num,MovieObject) 319 321 %------------------------------------------------------------------------ 320 322 %num is the view number needed for an avi movie 321 323 switch type_ima 322 324 case 'movie' 323 A=read( movieobject,num);325 A=read(MovieObject,num); 324 326 case 'avi' 325 327 mov=aviread(filename,num); -
trunk/src/stra2num.m
r19 r89 12 12 13 13 function numres=stra2num(str) 14 numres= []; %default14 numres=NaN; %default 15 15 if double(str) >= 48 & double(str) <= 57 % = test for number strings 16 numres=str2 num(str);16 numres=str2double(str); 17 17 elseif double(str) >= 65 & double(str) <= 90 % test on ascii code for capital letters 18 18 numres=double(str)-64; %change capital letters to corresponding number in the alphabet -
trunk/src/sub_field.m
r86 r89 202 202 V_1 =interp2(X_1,Y_1,V_1,x,y'); 203 203 end 204 val(['SubData.' UName '=Field.' UName '-U_1;'])205 val(['SubData.' VName '=Field.' VName '-V_1;'])204 eval(['SubData.' UName '=Field.' UName '-U_1;']) 205 eval(['SubData.' VName '=Field.' VName '-V_1;']) 206 206 else 207 207 AName=Field.ListVarName{ivar_C}; -
trunk/src/uvmat.m
r88 r89 165 165 % Object{iobj}.plotaxes and nbobj representation graphs Object{iobj}.plothandles(:) (where nbobj is the 166 166 % nbre of current objects opened in uvmat. Note that Object{iobj}.plothandles(iobj)=[] : an object is not represented in its own projection field; 167 %------------------------------------------------------------------- 168 %------------------------------------------------------------------- 167 168 %------------------------------------------------------------------------ 169 %------------------------------------------------------------------------ 169 170 % I - MAIN FUNCTION UVMAT (DO NOT MODIFY) 170 %------------------------------------------------------------------- 171 %------------------------------------------------------------------- 171 %------------------------------------------------------------------------ 172 %------------------------------------------------------------------------ 172 173 function varargout = uvmat(varargin) 173 174 … … 191 192 % End initialization code - DO NOT EDIT 192 193 193 %------------------------------------------------------------------- 194 %------------------------------------------------------------------------ 194 195 % --- Executes just before uvmat is made visible. 195 196 function uvmat_OpeningFcn(hObject, eventdata, handles, input ) 196 %------------------------------------------------------------------- 197 %------------------------------------------------------------------------ 197 198 global nb_builtin 198 199 … … 221 222 set(hObject,'DeleteFcn',{@closefcn})% 222 223 223 %TRANSFORM menu: loads the information stored in prefdir to initiate the browser and the list of functions 224 %refresh projection plane 225 UvData.Object{1}.Style='plane';%main plotting plane 226 UvData.Object{1}.ProjMode='projection';%main plotting plane 227 if ~isfield(UvData.Object{1},'plotaxes') 228 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis 229 set(handles.list_object_1,'Value',1); 230 set(handles.list_object_1,'String',{'1-PLANE'}); 231 end 232 233 %TRANSFORM menu: builtin fcts 224 234 menu_str={'';'phys';'px';'phys_polar'}; 225 235 nb_builtin=numel(menu_str); %number of functions … … 238 248 end 239 249 rmpath(fullfile(path_uvmat,'transform_field')) 240 241 %refresh projection plane242 UvData.Object{1}.Style='plane';%main plotting plane243 UvData.Object{1}.ProjMode='projection';%main plotting plane244 if ~isfield(UvData.Object{1},'plotaxes')245 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis246 set(handles.list_object_1,'Value',1);247 set(handles.list_object_1,'String',{'1-PLANE'});248 end249 250 250 251 %load the list of previously browsed files in menus Open and Open_1 … … 279 280 if exist(file,'file') 280 281 h_func=str2func(file); 281 testexist=[testexist 1]; %#ok<AGROW>282 testexist=[testexist 1]; 282 283 else 283 284 h_func=[]; 284 testexist=[testexist 0]; %#ok<AGROW>285 testexist=[testexist 0]; 285 286 end 286 fct_handle=[fct_handle; {h_func}]; %#ok<AGROW>%concatene the list of paths287 fct_handle=[fct_handle; {h_func}]; %concatene the list of paths 287 288 rmpath(path) 288 menu_str=[menu_str; {file}]; %#ok<AGROW>289 menu_str=[menu_str; {file}]; 289 290 end 290 291 end … … 344 345 set(handles.Fields,'Value',1) 345 346 set(handles.Fields,'String',{'get_field...'}) 346 % set(handles.Fields,'UserData',Field)347 347 testinputfield=1; 348 348 … … 577 577 [ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles); 578 578 NomType_1=get(handles.FileIndex_1,'UserData'); 579 FileName_1=name_generator(FileBase_1,str a2num(i1),stra2num(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1);579 FileName_1=name_generator(FileBase_1,str2double(i1),str2double(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1); 580 580 if exist(FileName_1,'file') 581 FileIndex_1=name_generator('',str a2num(i1),stra2num(i2),'',NomType_1,1,stra2num(str_a),stra2num(str_b),'');581 FileIndex_1=name_generator('',str2double(i1),str2double(i2),'',NomType_1,1,stra2num(str_a),stra2num(str_b),''); 582 582 set(handles.FileIndex_1,'String',FileIndex_1) 583 583 else … … 608 608 end 609 609 610 %------------------------------------------------------------------- 610 %------------------------------------------------------------------------ 611 611 function RootPath_Callback(hObject,eventdata,handles) 612 %------------------------------------------------------------------------ 612 613 update_rootinfo(hObject,eventdata,handles); 613 614 614 %------------------------------------------------------------------- 615 %------------------------------------------------------------------------ 615 616 %-- called by action in RootFile edit box 616 %-------------------------------------------------------------------617 617 function SubDir_Callback(hObject, eventdata, handles) 618 %------------------------------------------------------------------------ 618 619 %refresh the menu of input fields 619 620 Fields_Callback(hObject, eventdata, handles); … … 621 622 run0_Callback(hObject, eventdata, handles); 622 623 623 624 %------------------------------------------------------------------- 625 %-- called by action in RootFile edit box 626 %------------------------------------------------------------------- 624 %------------------------------------------------------------------------ 625 % --- called by action in RootFile edit box 627 626 function RootFile_Callback(hObject, eventdata, handles) 627 %------------------------------------------------------------------------ 628 628 update_rootinfo(hObject,eventdata,handles) 629 629 630 %------------------------------------------------------------------- 631 %-- called by action in FileIndex edit box 632 %------------------------------------------------------------------- 630 %------------------------------------------------------------------------ 631 % --- called by action in FileIndex edit box 633 632 function FileIndex_Callback(hObject, eventdata, handles) 633 %------------------------------------------------------------------------ 634 634 FileIndices=get(handles.FileIndex,'String'); 635 635 if isempty(str2num(FileIndices)) … … 647 647 run0_Callback(hObject, eventdata, handles) 648 648 649 %------------------------------------------------------------------- 650 %-- called by action in FileIndex_1 edit box 651 %------------------------------------------------------------------- 649 %------------------------------------------------------------------------ 650 % --- called by action in FileIndex_1 edit box 652 651 function FileIndex_1_Callback(hObject, eventdata, handles) 653 % FileIndices=get(handles.FileIndex_1,'String'); 654 % if isempty(str2num(FileIndices)) 655 % [pp,ff,str1,str2,str_a,str_b]=name2display(FileIndices) 656 % else 657 % str1=FileIndices; 658 % str2=''; 659 % str_a=''; 660 % str_b=''; 661 % end 662 % set(handles.i1,'String',str1); 663 % set(handles.i2,'String',str2); 664 % set(handles.j1,'String',str_a); 665 % set(handles.j2,'String',str_b); 652 %------------------------------------------------------------------------ 666 653 run0_Callback(hObject, eventdata, handles) 667 654 668 %------------------------------------------------------------------- 669 % -- update information about a new field series (indices to scan, timing, calibration from an xml file, then refresh current plots 670 %------------------------------------------------------------------- 655 %------------------------------------------------------------------------ 656 % --- update information about a new field series (indices to scan, timing, calibration from an xml file, then refresh current plots 671 657 function update_rootinfo(hObject,eventdata,handles) 672 658 %------------------------------------------------------------------------ 673 659 set(handles.RootPath,'BackgroundColor',[1 1 0]) 674 660 drawnow … … 678 664 UvData.TestInputFile=1; 679 665 set(handles.fix_pair,'Value',1) % activate by default the comp_input '-'input window 680 %FileIndex_Callback(hObject, eventdata, handles)% update field counters681 666 682 667 [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles); … … 693 678 TimeUnit=[];%default 694 679 testima=0; %test for image input 680 imainfo=[]; 681 ColorType='falsecolor'; %default 682 hhh=''; 695 683 if isequal(lower(FileExt),'.avi') %.avi file 696 684 testima=1; 697 i nfo=aviinfo([FileBase FileIndices FileExt]);698 nbfield=i nfo.NumFrames;685 imainfo=aviinfo([FileBase FileIndices FileExt]); 686 nbfield=imainfo.NumFrames; 699 687 nburst=1; 700 set(handles.Dt_txt,'String',['Dt=' num2str(1000/i nfo.FramesPerSecond) 'ms']);%display the elementary time interval in millisec701 XmlData.Time=(0:1/i nfo.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond)';688 set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FramesPerSecond) 'ms']);%display the elementary time interval in millisec 689 XmlData.Time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)'; 702 690 TimeUnit='s'; 703 set(handles.npx,'String',num2str(info.Width));%fills nbre of pixels x box704 set(handles.npy,'String',num2str(info.Height));%fills nbre of pixels y box705 691 hhh=which('mmreader'); 706 if ~isequal(hhh,'')&& mmreader.isPlatformSupported()% if the function is found (recent version of matlab) 707 UvData.MovieObject=mmreader([FileBase FileIndices FileExt]); 708 end 692 ColorType=imainfo.ImageType;%='truecolor' for color images 709 693 elseif ~isempty(imformats(FileExt(2:end))) || isequal(FileExt,'.vol')%&& isequal(NomType,'*')% multi-frame image 710 694 testima=1; … … 715 699 imainfo=imfinfo([FileBase FileIndices FileExt]); 716 700 end 701 ColorType=imainfo.ColorType;%='truecolor' for color images 717 702 if length(imainfo) >1 %case of image with multiple frames 718 703 nbfield=length(imainfo); 719 704 nburst=1; 720 705 end 721 if isfield(UvData,'MovieObject') 722 UvData=rmfield(UvData,'MovieObject'); 723 end 724 else 725 %set(handles.last_i,'String','');%fills last_field box 706 end 707 if ~strcmp(hhh,'')&& mmreader.isPlatformSupported()% if the function is found (recent version of matlab) 708 UvData.MovieObject=mmreader([FileBase FileIndices FileExt]); 709 elseif isfield(UvData,'MovieObject') 710 UvData=rmfield(UvData,'MovieObject'); 711 end 712 if isfield(imainfo,'Width') && isfield(imainfo,'Height') 713 set(handles.npx,'String',num2str(imainfo.Width));%fills nbre of pixels x box 714 set(handles.npy,'String',num2str(imainfo.Height));%fills nbre of pixels x box 715 else 726 716 set(handles.npx,'String','');%fills nbre of pixels x box 727 set(handles.npy,'String','');%fills nbre of pixels y box 728 if isfield(UvData,'MovieObject') 729 UvData=rmfield(UvData,'MovieObject'); 730 end 731 end 717 set(handles.npy,'String','');%fills nbre of pixels x box 718 end 719 set(handles.BW,'Value',strcmp(ColorType,'grayscale'))% select handles.BW if grayscale image 732 720 733 721 % read parameters (time, geometric calibration..) from a documentation file (.xml advised) … … 821 809 set(handles.transform_fct,'Value',1); % no transform by default 822 810 else 823 if (isfield(GeometryCalib,'R')& ~isequal(GeometryCalib.R(2,1),0)& ~isequal(GeometryCalib.R(1,2),0)) |...824 (isfield(GeometryCalib,'kappa1')& ~isequal(GeometryCalib.kappa1,0))811 if (isfield(GeometryCalib,'R')&& ~isequal(GeometryCalib.R(2,1),0) && ~isequal(GeometryCalib.R(1,2),0)) |... 812 (isfield(GeometryCalib,'kappa1')&& ~isequal(GeometryCalib.kappa1,0)) 825 813 set(handles.pxcm,'String','var') 826 814 set(handles.pycm,'String','var') … … 835 823 end 836 824 if isfield(GeometryCalib,'SliceCoord') 825 837 826 siz=size(GeometryCalib.SliceCoord); 838 827 if siz(1)>1 … … 847 836 end 848 837 slices_Callback(hObject, eventdata, handles) 849 % Coord=UvData.XmlData.GeometryCalib.SliceCoord; 850 % ZIndex=num_i1-NbSlice*(floor((num_i1-1)/NbSlice)); 851 end 852 853 838 end 854 839 end 855 840 end 856 841 857 842 %update the data attached to the uvmat interface 858 % set(handles.nb_slice,'String',num2str(NbSlice))859 843 if ~isempty(TimeUnit) 860 844 set(handles.time_txt,'String',['time (' TimeUnit ')']) 861 845 end 862 %set(handles.DtUnit,'String',['10^(-3)' TimeUnit])863 846 UvData.TimeUnit=TimeUnit; 864 847 UvData.XmlData=XmlData; … … 986 969 end 987 970 sizf=size(fileinput_1); 988 if (~ischar(fileinput_1)| ~isequal(sizf(1),1)),return;end971 if (~ischar(fileinput_1)||~isequal(sizf(1),1)),return;end 989 972 990 973 % refresh the current displayed field … … 1197 1180 end 1198 1181 TimeUnit_1=[]; 1199 % testima=0; %test for image input 1182 hhh='';%default, test for movie reading with mmreader 1183 imainfo=[]; 1200 1184 if isequal(lower(FileExt),'.avi') %.avi file 1201 % testima=1; 1202 info=aviinfo([FileBase FileIndices FileExt]); 1203 nbfield_1=info.NumFrames; 1185 imainfo=aviinfo([FileBase FileIndices FileExt]); 1186 nbfield_1=imainfo.NumFrames; 1204 1187 nburst_1=1; 1205 %set(handles.last_i,'String',num2str(info.NumFrames));%fills last_field box1206 1188 set(handles.Dt_txt,'String',['Dt=' num2str(1000/info.FramesPerSecond) 'ms']);%display the elementary time interval in millisec 1207 % set(handles.dt,'UserData',info.FramesPerSecond); 1208 time=[0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond]'; 1209 npx=get(handles.npx,'String'); 1210 npy=get(handles.npy,'String'); 1211 if isequal(npx,'') || isequal(npy,'') 1212 set(handles.npx,'String',num2str(info.Width));%fills nbre of pixels x box 1213 set(handles.npy,'String',num2str(info.Height));%fills nbre of pixels y box 1214 end 1215 elseif ~isempty(imformats(FileExt(2:end))) %&& isequal(NomType,'*')% multi-frame image 1189 time=[0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond]'; 1190 ColorType=imainfo.ImageType;%='truecolor' for color images 1191 hhh=which('mmreader'); 1192 elseif ~isempty(imformats(FileExt(2:end)))|| isequal(FileExt,'.vol') 1216 1193 testima=1; 1217 imainfo=imfinfo([FileBase FileIndices FileExt]); 1194 if ~isequal(SubDir,'') 1195 RootFile=get(handles.RootFile,'String'); 1196 imainfo=imfinfo([fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]); 1197 else 1198 imainfo=imfinfo([FileBase FileIndices FileExt]); 1199 end 1200 ColorType=imainfo.ColorType;%='truecolor' for color images 1218 1201 if length(imainfo) >1 %case of image with multiple frames 1219 1202 nbfield_1=length(imainfo); 1220 1203 nburst_1=1; 1221 %set(handles.last_i,'String',num2str(length(imainfo)));%fills last_field box 1222 end 1223 else 1224 %set(handles.last_i,'String','');%fills last_field box 1225 set(handles.npx,'String','');%fills nbre of pixels x box 1226 set(handles.npy,'String','');%fills nbre of pixels y box 1204 end 1205 end 1206 if ~strcmp(hhh,'')&& mmreader.isPlatformSupported()% if the function is found (recent version of matlab) 1207 UvData.MovieObject_1=mmreader([FileBase FileIndices FileExt]); 1208 elseif isfield(UvData,'MovieObject_1') 1209 UvData=rmfield(UvData,'MovieObject_1'); 1210 end 1211 if strcmp(get(handles.npx,'String'),'') || strcmp(get(handles.npy,'String'),'')%update npx and npy if it is not already filled by the first input field 1212 if isfield(imainfo,'Width') && isfield(imainfo,'Height') 1213 set(handles.npx,'String',num2str(imainfo.Width));%fills nbre of pixels x box 1214 set(handles.npy,'String',num2str(imainfo.Height));%fills nbre of pixels x box 1215 else 1216 set(handles.npx,'String','');%fills nbre of pixels x box 1217 set(handles.npy,'String','');%fills nbre of pixels x box 1218 end 1219 set(handles.BW,'Value',strcmp(ColorType,'grayscale'))% select handles.BW if grayscale image 1227 1220 end 1228 1221 … … 1849 1842 end 1850 1843 1851 num_i1=str a2num(get(handles.i1,'String'));1844 num_i1=str2double(get(handles.i1,'String')); 1852 1845 num_j1=stra2num(get(handles.j1,'String')); 1853 num_i2=str a2num(get(handles.i2,'String'));1846 num_i2=str2double(get(handles.i2,'String')); 1854 1847 num_j2=stra2num(get(handles.j2,'String')); 1855 if is empty(num_j2)1848 if isnan(num_j2) 1856 1849 if isempty(num_i2) 1857 1850 msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie') … … 1862 1855 end 1863 1856 end 1864 if is empty(num_i2)1857 if isnan(num_i2) 1865 1858 num_i2=num_i1;%repeat the index i1 by default 1866 1859 end … … 2238 2231 if isequal(FileType,'netcdf') %read the first nc field 2239 2232 if isequal(FieldName,'get_field...')% read the field names on the interface get_field. 2240 %VelType=get(handles.Fields,'UserData'); 2241 hget_field=findobj(allchild(0),'Name','get_field')%find the get_field... GUI 2233 hget_field=findobj(allchild(0),'Name','uvmat_field');%find the get_field... GUI 2242 2234 if isempty(hget_field) 2243 hget_field= get_field(filename);%open the get_field GUI 2244 end 2245 if numel(hget_field)>1%case of several get_field GUI 2246 hget_field=hget_field(1); 2235 hget_field= get_field(filename);%open the get_field GUI 2236 set(hget_field,'name','uvmat_field') 2237 elseif UvData.NewSeries 2238 delete(hget_field) 2239 hget_field= get_field(filename);%open the get_field GUI 2240 set(hget_field,'name','uvmat_field') 2247 2241 end 2248 2242 hhget_field=guidata(hget_field); 2249 set(hhget_field.inputfile,'String',filename)% update the list of input fields in get_field 2250 set(hhget_field.ACTION,'Value',1)% PLOT option selected 2251 set(hhget_field.list_fig,'Value',2)% plotting axes =uvmat selected 2252 [Field{1},errormsg]=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI 2253 if ~isempty(errormsg) 2254 errormsg=['error in uvmat/run0_Callback/read_get_field: ' errormsg]; 2255 return 2256 end 2243 funct_list=get(hhget_field.ACTION,'UserData'); 2244 funct_index=get(hhget_field.ACTION,'Value'); 2245 funct=funct_list{funct_index}; 2246 Field{1}=funct(hget_field); %read the names of the variables to plot in the get_field GUI 2257 2247 CivStage=0; 2258 VelType_out=[]; 2248 VelType_out=[]; 2259 2249 else 2260 2250 [Field{1},VelType_out]=read_civxdata(filename,InputField,VelType); … … 2269 2259 if ~isempty(filename_1) && ~test_keepdata_1 && isequal(FileType_1,'netcdf') %read the second file 2270 2260 if isequal(FieldName_1,'get_field...')% read the field names on the interface get_field. 2271 hget_field=findobj(allchild(0),'Name','get_field_1');%find the get_field... GUI 2272 if isempty(hget_field) 2273 hget_field= get_field(filename_1);%open the get_field GUI 2274 set(hget_field,'name','get_field_1') 2275 % enable_transform(handles,'off')% no field transform (possible transform in the GUI get_field) 2276 end 2277 hhget_field=guidata(hget_field);%handles of GUI elements in get_field 2278 SubField=get_field('read_var_names',hObject,eventdata,hhget_field); %read the names of the variables to plot in the get_field GUI 2279 [Field{2},var_detect]=nc2struct(filename_1,SubField.ListVarName); %read the corresponding input data 2280 Field{2}.VarAttribute=SubField.VarAttribute; 2281 %update the display on get_field 2282 set(hhget_field.inputfile,'String',filename_1) 2283 set(hhget_field.variables,'Value',1) 2284 Tabchar={''};%default 2285 Tabcell=[]; 2286 if isfield(Field{2},'ListGlobalAttribute')& ~isempty(Field{2}.ListGlobalAttribute) 2287 for iline=1:length(Field{2}.ListGlobalAttribute) 2288 Tabcell{iline,1}=Field{2}.ListGlobalAttribute{iline}; 2289 if isfield(Field{2}, Field{2}.ListGlobalAttribute{iline}) 2290 eval(['val=Field{2}.' Field{2}.ListGlobalAttribute{iline} ';']) 2291 if ischar(val); 2292 Tabcell{iline,2}=val; 2293 else 2294 Tabcell{iline,2}=num2str(val); 2295 end 2296 end 2297 end 2298 if ~isempty(Tabcell) 2299 Tabchar=cell2tab(Tabcell,'='); 2300 Tabchar=[{''};Tabchar]; 2301 end 2261 hget_field_1=findobj(allchild(0),'Name','uvmat_field_1');%find the get_field... GUI 2262 if isempty(hget_field_1) 2263 hget_field_1= get_field(filename_1);%open the get_field GUI 2264 set(hget_field_1,'name','uvmat_field_1') 2302 2265 end 2303 set(hhget_field.attributes,'String',Tabchar);%update list of global attributes in get_field 2266 hhget_field_1=guidata(hget_field_1);%handles of GUI elements in get_field 2267 funct_list=get(hhget_field_1.ACTION,'UserData'); 2268 funct_index=get(hhget_field_1.ACTION,'Value'); 2269 funct=funct_list{funct_index}; 2270 Field{2}=funct(hget_field_1); %read the names of the variables to plot in the get_field GUI 2304 2271 else 2305 2272 [Field{2},VelType_out_1]=read_civxdata(filename_1,InputField_1,VelType_1); … … 2379 2346 if siz(1)>1 2380 2347 NbSlice=siz(1); 2381 % set(handles.slices,'Visible','on')2382 % set(handles.slices,'Value',1)2383 2348 else 2384 2349 NbSlice=1; 2385 2350 end 2386 %set(handles.nb_slice,'String',num2str(NbSlice))2387 % slices_Callback(handles.uvmat, [], handles)2388 2351 end 2389 2352 … … 2510 2473 end 2511 2474 %case of structured coordinates 2512 if isfield(UvData.Field,'AX') & isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')2475 if isfield(UvData.Field,'AX') && isfield(UvData.Field,'AY')&& isfield(UvData.Field,'A') 2513 2476 UvData.XMax=max(UvData.Field.AX); 2514 2477 UvData.XMin=min(UvData.Field.AX); … … 2518 2481 UvData.Mesh=sqrt((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)/((np_A(1)-1) * (np_A(2)-1))) ; 2519 2482 end 2520 if isempty(coord_x) &~isempty(CellVarIndex)2483 if isempty(coord_x) && ~isempty(CellVarIndex) 2521 2484 VarIndex=CellVarIndex{imax}; % list of variable indices 2522 2485 DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable … … 2640 2603 %Projeter les champs sur l'objet:* 2641 2604 ObjectData=proj_field(UvData.Field,UvData.Object{iobj},iobj); 2642 % if imap==22643 % UvData.ProjField_2=ObjectData;%store the projection field on uvmat: ***** WILL REPLACE THE FIELD SORED ON THE AXES: AxeData *****2644 % else2645 % UvData.ProjField_1=ObjectData;%store the projection field on view_field2646 % end2647 2605 %use of mask 2648 2606 if isfield(ObjectData,'NbDim')&isequal(ObjectData.NbDim,2) … … 2778 2736 testimedoc=0; 2779 2737 if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'Time') 2780 if isempty(num_i2) 2738 if isempty(num_i2)||isnan(num_i2) 2781 2739 num_i2=num_i1; 2782 2740 end 2783 if isempty(num_j1) 2741 if isempty(num_j1)||isnan(num_j1) 2784 2742 num_j1=1; 2785 2743 end 2786 if isempty(num_j2) 2744 if isempty(num_j2)||isnan(num_j2) 2787 2745 num_j2=num_j1; 2788 2746 end … … 2828 2786 end 2829 2787 end 2830 2788 %update the input file name in the get_field GUI 2789 if isequal(FieldName,'get_field...') 2790 set(hhget_field.inputfile,'String',filename) 2791 Tabchar={''};%default 2792 Tabcell=[]; 2793 if isfield(Field{1},'ListGlobalAttribute')& ~isempty(Field{1}.ListGlobalAttribute) 2794 for iline=1:length(Field{1}.ListGlobalAttribute) 2795 Tabcell{iline,1}=Field{1}.ListGlobalAttribute{iline}; 2796 if isfield(Field{1}, Field{1}.ListGlobalAttribute{iline}) 2797 eval(['val=Field{1}.' Field{1}.ListGlobalAttribute{iline} ';']) 2798 if ischar(val); 2799 Tabcell{iline,2}=val; 2800 else 2801 Tabcell{iline,2}=num2str(val); 2802 end 2803 end 2804 end 2805 if ~isempty(Tabcell) 2806 Tabchar=cell2tab(Tabcell,'='); 2807 Tabchar=[{''};Tabchar]; 2808 end 2809 end 2810 set(hhget_field.attributes,'String',Tabchar);%update list of global attributes in get_field 2811 end 2812 if isequal(FieldName_1,'get_field...') 2813 set(hhget_field_1.inputfile,'String',filename_1) 2814 Tabchar={''};%default 2815 Tabcell=[]; 2816 if isfield(Field{2},'ListGlobalAttribute')& ~isempty(Field{2}.ListGlobalAttribute) 2817 for iline=1:length(Field{2}.ListGlobalAttribute) 2818 Tabcell{iline,1}=Field{2}.ListGlobalAttribute{iline}; 2819 if isfield(Field{2}, Field{2}.ListGlobalAttribute{iline}) 2820 eval(['val=Field{2}.' Field{2}.ListGlobalAttribute{iline} ';']) 2821 if ischar(val); 2822 Tabcell{iline,2}=val; 2823 else 2824 Tabcell{iline,2}=num2str(val); 2825 end 2826 end 2827 end 2828 if ~isempty(Tabcell) 2829 Tabchar=cell2tab(Tabcell,'='); 2830 Tabchar=[{''};Tabchar]; 2831 end 2832 end 2833 set(hhget_field_1.attributes,'String',Tabchar);%update list of global attributes in get_field 2834 end 2831 2835 2832 2836 … … 2858 2862 set(handles.auto_xy,'BackgroundColor',[1 1 0]) 2859 2863 cla(handles.axes3) 2860 update_plot(handles) 2864 update_plot(handles); 2861 2865 else 2862 2866 set(handles.auto_xy,'BackgroundColor',[0.7 0.7 0.7]) 2863 update_plot(handles) 2867 update_plot(handles); 2864 2868 % axis(handles.axes3,'image') 2865 2869 end … … 3039 3043 end 3040 3044 3041 % %---------------------------------------------- 3042 % %read the data displayed for the input rootfile windows (new) 3043 % %------------------------------------------------- 3045 %------------------------------------------------------------------------ 3046 % --- read the data displayed for the input rootfile windows (new) 3044 3047 function [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles) 3048 %------------------------------------------------------------------------ 3045 3049 RootPath=get(handles.RootPath,'String'); 3046 3050 FileName=RootPath; %default … … 3114 3118 set_veltype_display(veltype_handles,0) % unvisible civ buttons 3115 3119 filename=read_file_boxes(handles); 3116 hget_field=findobj(allchild(0),'name','get_field'); 3117 if ~isempty(hget_field) 3118 delete(hget_field) 3120 hget_field=findobj(allchild(0),'name','uvmat_field'); 3121 if isempty(hget_field) 3122 hget_field=get_field(filename); 3123 set(hget_field,'Name','uvmat_field') 3119 3124 end 3120 get_field(filename)3121 3125 return %no action 3122 3126 end … … 3849 3853 % set(handles.slider1,'Value',col) 3850 3854 set_vec_col_bar(handles) 3851 update_plot(handles) 3855 update_plot(handles); 3852 3856 3853 3857 %---------------------------------------------------------------- … … 3859 3863 % slider2_Callback(hObject, eventdata, handles) 3860 3864 set_vec_col_bar(handles) 3861 update_plot(handles) 3865 update_plot(handles); 3862 3866 %------------------------------------------------------------ 3863 3867 %update the slider values after displaying vectors … … 3885 3889 set_vec_col_bar(handles) 3886 3890 3887 % %--------------------------------------------3888 % %update the display of color code for vectors3889 % %--------------------------------------------3890 % function set_vec_col_bar(handles)3891 % %get the image of the color display button 'vec_col_bar' in pixels3892 % uni=get(handles.vec_col_bar,'Unit');3893 % set(handles.vec_col_bar,'Unit','pixel')3894 % pos_vert=get(handles.vec_col_bar,'Position');3895 % set(handles.vec_col_bar,'Unit','Normalized')3896 % width=ceil(pos_vert(3));3897 % height=ceil(pos_vert(4));3898 % %get slider indications3899 % colcode.min=get(handles.slider1,'Min');3900 % colcode.max=get(handles.slider1,'Max');3901 % colcode.colcode1=get(handles.slider1,'Value');3902 % colcode.colcode2=get(handles.slider2,'Value');3903 % colcode.option=get(handles.vec_col_bar,'Value');3904 % colcode.auto=1;3905 % list_code=get(handles.col_vec,'String');% list menu fields3906 % index_code=get(handles.col_vec,'Value');% selected string index3907 % colcode.CName= list_code{index_code(1)}; % selected field used for vector color3908 % vec_C=colcode.min+(colcode.max-colcode.min)*[0.5:width-0.5]/width;%sample of vec_C values from min to max3909 % [colorlist,col_vec]=set_col_vec(colcode,vec_C);3910 % oneheight=ones(1,height);3911 % A1=colorlist(col_vec,1)*oneheight;3912 % A2=colorlist(col_vec,2)*oneheight;3913 % A3=colorlist(col_vec,3)*oneheight;3914 % A(:,:,1)=A1';3915 % A(:,:,2)=A2';3916 % A(:,:,3)=A3';3917 % set(handles.vec_col_bar,'Cdata',A)3918 3919 %--------------------------------------------------------3920 % --- Executes on button press in cal.3921 function cal_Callback(hObject, eventdata, handles)3922 3923 3924 3925 3891 %------------------------------------------------------------- 3926 3892 % --- Executes on selection change in transform_fct. … … 3940 3906 dlg_title = 'user defined transform'; 3941 3907 num_lines= 1; 3942 [FileName, PathName , filterindex] = uigetfile( ...3908 [FileName, PathName] = uigetfile( ... 3943 3909 {'*.m', ' (*.m)'; 3944 3910 '*.m', '.m files '; ... … … 4015 3981 list_object_2_Callback(hObject, eventdata, handles) 4016 3982 4017 4018 4019 3983 %delete mask if it is displayed 4020 3984 if isequal(get(handles.mask_test,'Value'),1)%if the mask option is on … … 4115 4079 set(handles.AutoScal,'Value',1) %suppress auto mode 4116 4080 set(handles.AutoScal,'BackgroundColor',[1 1 0]) 4117 update_plot(handles) 4081 update_plot(handles); 4118 4082 4119 4083 %----------------------------------------------------------------- … … 4122 4086 set(handles.AutoScal,'Value',1) %suppress auto mode 4123 4087 set(handles.AutoScal,'BackgroundColor',[1 1 0]) 4124 update_plot(handles) 4088 update_plot(handles); 4125 4089 4126 4090 %----------------------------------------------- … … 4133 4097 set(handles.AutoScal,'BackgroundColor',[0.7 0.7 0.7]) 4134 4098 update_plot(handles); 4135 % set(handles.MinA,'String',num2str(ScalOut.MinA,3))4136 % set(handles.MaxA,'String',num2str(ScalOut.MaxA,3))4137 4099 end 4138 4100 … … 4140 4102 function BW_Callback(hObject, eventdata, handles) 4141 4103 %------------------------------------------------------------------- 4142 update_plot(handles) 4104 update_plot(handles); 4143 4105 4144 4106 %------------------------------------------------------------------- … … 4153 4115 set(handles.IncrA,'Visible','off') 4154 4116 end 4155 update_plot(handles) 4117 update_plot(handles); 4156 4118 4157 4119 %------------------------------------------------------------------- 4158 4120 function IncrA_Callback(hObject, eventdata, handles) 4159 4121 %------------------------------------------------------------------- 4160 update_plot(handles) 4122 update_plot(handles); 4161 4123 4162 4124 %------------------------------------------------------------------- 4163 4125 function HideWarning_Callback(hObject, eventdata, handles) 4164 4126 %------------------------------------------------------------------- 4165 update_plot(handles) 4127 update_plot(handles); 4166 4128 4167 4129 %------------------------------------------------------------------- 4168 4130 function HideFalse_Callback(hObject, eventdata, handles) 4169 4131 %------------------------------------------------------------------- 4170 update_plot(handles) 4132 update_plot(handles); 4171 4133 4172 4134 %------------------------------------------------------------------- … … 4175 4137 set(handles.AutoVec,'Value',1); 4176 4138 set(handles.AutoVec,'BackgroundColor',[1 1 0]) 4177 update_plot(handles) 4139 update_plot(handles); 4178 4140 4179 4141 %------------------------------------------------------------------- … … 4189 4151 end 4190 4152 4191 %------------------------------------------------------- 4153 %------------------------------------------------------------------------ 4192 4154 % --- Executes on selection change in decimate4 (nb_vec/4). 4193 %-------------------------------------------------------4194 4155 function decimate4_Callback(hObject, eventdata, handles) 4195 update_plot(handles) 4196 4197 4198 %------------------------------------------------------- 4156 %------------------------------------------------------------------------ 4157 update_plot(handles); 4158 4159 %------------------------------------------------------------------------ 4199 4160 % --- Executes on selection change in color_code menu 4200 %-------------------------------------------------------4201 4161 function color_code_Callback(hObject, eventdata, handles) 4162 %------------------------------------------------------------------------ 4202 4163 set_vec_col_bar(handles) 4203 4164 update_plot(handles); 4204 4165 4205 %------------------------------------------------------- 4166 %------------------------------------------------------------------------ 4206 4167 % --- Executes on button press in AutoVecColor. 4207 %-------------------------------------------------------4208 4168 function AutoVecColor_Callback(hObject, eventdata, handles) 4169 %------------------------------------------------------------------------ 4209 4170 test=get(handles.AutoVecColor,'Value'); 4210 4171 if test … … 4215 4176 set(handles.AutoVecColor,'BackgroundColor',[0.7 0.7 0.7]) 4216 4177 end 4217 %set_vec_col_bar(handles) 4218 4219 %------------------------------------------------------- 4178 4179 %------------------------------------------------------------------------ 4220 4180 % --- Executes on selection change in max_vec. 4221 %-------------------------------------------------------4222 4181 function min_vec_Callback(hObject, eventdata, handles) 4182 %------------------------------------------------------------------------ 4223 4183 max_vec_Callback(hObject, eventdata, handles) 4224 4184 4185 %------------------------------------------------------------------------ 4225 4186 % --- Executes on selection change in max_vec. 4226 4187 function max_vec_Callback(hObject, eventdata, handles) 4188 %------------------------------------------------------------------------ 4227 4189 set(handles.AutoVecColor,'Value',1) 4228 4190 AutoVecColor_Callback(hObject, eventdata, handles) … … 4237 4199 update_plot(handles); 4238 4200 4239 %------------------------------------------------------------------- 4240 % update the display of color code for vectors4201 %------------------------------------------------------------------------ 4202 % --- update the display of color code for vectors 4241 4203 function set_vec_col_bar(handles) 4242 %------------------------------------------------------------------- 4204 %------------------------------------------------------------------------ 4243 4205 %get the image of the color display button 'vec_col_bar' in pixels 4244 4206 set(handles.vec_col_bar,'Unit','pixel'); … … 4283 4245 AxeData=get(haxes,'UserData'); 4284 4246 PlotParam=read_plot_param(handles); 4247 PlotParam.Scalar 4285 4248 [PlotType,PlotParamOut]= plot_field(AxeData,haxes,PlotParam,1); 4286 4249 write_plot_param(handles,PlotParamOut); %update the auto plot parameters … … 4446 4409 %------------------------------------------------------ 4447 4410 function MenuExportField_Callback(hObject, eventdata, handles) 4448 global CurData4449 CurData=get(handles.uvmat,'UserData');4450 evalin('base','global CurData')%make CurData global in the workspace4411 global Data_uvmat 4412 Data_uvmat=get(handles.uvmat,'UserData'); 4413 evalin('base','global Data_uvmat')%make CurData global in the workspace 4451 4414 display(['current field :']) 4452 evalin('base',' CurData') %display CurData in the workspace4415 evalin('base','Data_uvmat') %display CurData in the workspace 4453 4416 commandwindow; %brings the Matlab command window to the front 4454 4417 … … 4976 4939 '*.xml', '.xml files '; ... 4977 4940 '*.mat', '.mat matlab files '}, ... 4978 'Pick a file',get(handles.RootPath,'String'));4941 'Pick an xml Object file',get(handles.RootPath,'String')); 4979 4942 fileinput=[PathName FileName];%complete file name 4980 4943 testblank=findstr(fileinput,' ');%look for blanks
Note: See TracChangeset
for help on using the changeset viewer.