Changeset 89 for trunk/src/uvmat.m
- Timestamp:
- May 20, 2010, 1:48:25 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.