Changeset 128 for trunk/src/uvmat.m
- Timestamp:
- Nov 21, 2010, 10:06:11 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r127 r128 181 181 'gui_LayoutFcn', [], ... 182 182 'gui_Callback', []); 183 if nargin && ischar(varargin{1}) 183 if nargin && ischar(varargin{1})&& ~isempty(regexp(varargin{1},'_Callback','once')) 184 184 gui_State.gui_Callback = str2func(varargin{1}); 185 185 end … … 1151 1151 set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'}) 1152 1152 set(handles.Fields_1,'Value',2) % set menu to 'image' 1153 elseif isequal(FileExt_1,'.nc')|isequal(FileExt_1,'.cdf')1153 elseif strcmp(FileExt_1,'.nc')||strcmp(FileExt_1,'.cdf') 1154 1154 Data=nc2struct(fileinput_1,[]); 1155 1155 if isfield(Data,'absolut_time_T0') … … 1621 1621 %------------------------------------------------------------------- 1622 1622 huvmat=get(handles.MenuExport,'parent'); 1623 UvData=get(huvmat,'UserData');1623 %UvData=get(huvmat,'UserData'); 1624 1624 hfig=figure; 1625 newaxes=copyobj(handles.axes3,hfig);1625 copyobj(handles.axes3,hfig); 1626 1626 map=colormap(handles.axes3); 1627 1627 colormap(map);%transmit the current colormap to the zoom fig … … 1641 1641 set(handles.runplus,'BackgroundColor',[1 1 0])%paint the command button in yellow 1642 1642 drawnow 1643 increment=str2num(get(handles.increment_scan,'String')); %get the field increment d 1644 runpm(hObject,eventdata,handles,increment) 1645 set(handles.runplus,'BackgroundColor',[1 0 0])%paint the command button in yellow 1643 %TODO: introduce the option: increment ='*' to move to the next available view 1644 increment=str2double(get(handles.increment_scan,'String')); %get the field increment d 1645 if isnan(increment) 1646 set(handles.increment_scan,'String','1')%default value 1647 increment=1; 1648 end 1649 errormsg=runpm(hObject,eventdata,handles,increment); 1650 if ~isempty(errormsg) 1651 msgbox_uvmat('ERROR',errormsg); 1652 end 1653 set(handles.runplus,'BackgroundColor',[1 0 0])%paint the command button back to red 1646 1654 1647 1655 %------------------------------------------------------------------- … … 1653 1661 set(handles.runmin,'BackgroundColor',[1 1 0])%paint the command button in yellow 1654 1662 drawnow 1655 increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d 1656 runpm(hObject,eventdata,handles,increment) 1657 set(handles.runmin,'BackgroundColor',[1 0 0])%paint the command button in yellow 1663 increment=-str2double(get(handles.increment_scan,'String')); %get the field increment d 1664 if isnan(increment) 1665 set(handles.increment_scan,'String','1')%default value 1666 increment=1; 1667 end 1668 errormsg=runpm(hObject,eventdata,handles,increment); 1669 if ~isempty(errormsg) 1670 msgbox_uvmat('ERROR',errormsg); 1671 end 1672 set(handles.runmin,'BackgroundColor',[1 0 0])%paint the command button back to red 1658 1673 1659 1674 %------------------------------------------------------------------- … … 1663 1678 set(handles.Movie,'BackgroundColor',[1 1 0])%paint the command button in yellow 1664 1679 drawnow 1665 increment=str2num(get(handles.increment_scan,'String')); %get the field increment d 1680 increment=str2double(get(handles.increment_scan,'String')); %get the field increment d 1681 if isnan(increment) 1682 set(handles.increment_scan,'String','1')%default value 1683 increment=1; 1684 end 1666 1685 set(handles.STOP,'Visible','on') 1667 1686 set(handles.speed,'Visible','on') 1668 1687 set(handles.speed_txt,'Visible','on') 1669 1688 set(handles.Movie,'BusyAction','queue') 1670 testavi=0;1671 1689 UvData=get(handles.uvmat,'UserData'); 1672 1690 … … 1674 1692 errormsg=runpm(hObject,eventdata,handles,increment); 1675 1693 if ~isempty(errormsg) 1694 set(handles.Movie,'BackgroundColor',[1 0 0])%paint the command buttonback to red 1676 1695 return 1677 1696 end … … 1690 1709 set(handles.MovieBackward,'BackgroundColor',[1 1 0])%paint the command button in yellow 1691 1710 drawnow 1692 increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d 1711 increment=-str2double(get(handles.increment_scan,'String')); %get the field increment d 1712 if isnan(increment) 1713 set(handles.increment_scan,'String','1')%default value 1714 increment=1; 1715 end 1693 1716 set(handles.STOP,'Visible','on') 1694 1717 set(handles.speed,'Visible','on') 1695 1718 set(handles.speed_txt,'Visible','on') 1696 1719 set(handles.MovieBackward,'BusyAction','queue') 1697 testavi=0;1698 1720 UvData=get(handles.uvmat,'UserData'); 1699 1721 1700 while get(handles.speed,'Value')~=0 & isequal(get(handles.MovieBackward,'BusyAction'),'queue') % enable STOP command1722 while get(handles.speed,'Value')~=0 && isequal(get(handles.MovieBackward,'BusyAction'),'queue') % enable STOP command 1701 1723 errormsg=runpm(hObject,eventdata,handles,increment); 1702 1724 if ~isempty(errormsg) 1725 set(handles.MovieBackward,'BackgroundColor',[1 0 0])%paint the command buttonback to red 1703 1726 return 1704 1727 end … … 1760 1783 num1=num1+increment; 1761 1784 num2=num2+increment; 1762 [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir) 1785 [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir); 1763 1786 if sub_value% set the second field name and indices 1764 1787 num1_1=num1_1+increment; … … 1779 1802 % refresh plots 1780 1803 errormsg=refresh_field(handles,filename,filename_1,num1,num2,num_a,num_b); 1781 1782 1804 if isempty(errormsg) %update the index counters 1783 1805 set(handles.i1,'String',num2stra(num1,NomType,1)); … … 1803 1825 movie_pair_Callback(hObject, eventdata, handles); %reactivate moviepair if it was activated 1804 1826 end 1805 else 1806 msgbox_uvmat('ERROR',errormsg); 1807 end 1808 1827 end 1809 1828 1810 1829 … … 1974 1993 end 1975 1994 set(handles.run0,'BackgroundColor',[1 0 0]) 1995 1976 1996 %------------------------------------------------------------------------ 1977 1997 % --- read the input files and refresh all the plots, including projection. … … 1983 2003 % num_i1,num_i2,num_j1,num_j2; frame indices 1984 2004 % Field: structure describing an optional input field (then replace the input file) 1985 1986 2005 function errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,Field) 1987 2006 %------------------------------------------------------------------------ 1988 2007 1989 2008 %initialisation 1990 1991 errormsg=[]; % default error message 2009 % errormsg=[]; % default error message 1992 2010 abstime=[]; 1993 2011 abstime_1=[]; … … 2012 2030 end 2013 2031 2014 % determine the main input file information for action2032 %% determine the main input file information for action 2015 2033 FileType=[];%default 2016 2034 if ~isempty(filename) … … 2023 2041 %update the z position index 2024 2042 nbslice_str=get(handles.nb_slice,'String'); 2025 z_index=1;%default2043 % z_index=1;%default 2026 2044 if isequal(nbslice_str,'volume') 2027 2045 z_index=num_j1; … … 2074 2092 end 2075 2093 end 2076 2077 % choose a second field if Subfield option is 'on' 2094 %% choose a second field if Subfield option is 'on' 2078 2095 FieldName_1=[]; 2079 2096 scal_color=[]; 2080 2097 VelType_1=setfield_1(handles); 2081 sub_value=get(handles.SubField,'Value');2098 % sub_value=get(handles.SubField,'Value'); 2082 2099 FileType_1='none';%default 2083 2100 if ~isempty(filename_1) … … 2137 2154 end 2138 2155 2139 % read the input field(s)2156 %% read the input field(s) 2140 2157 %read images 2141 2158 if ~isempty(filename) && isequal(FieldName,'image') … … 2241 2258 hget_field= get_field(filename);%open the get_field GUI 2242 2259 set(hget_field,'name','uvmat_field') 2243 elseif UvData.NewSeries 2260 elseif UvData.NewSeries% refresh the fet_field GUI for a new series 2244 2261 delete(hget_field) 2245 2262 hget_field= get_field(filename);%open the get_field GUI 2246 set(hget_field,'name','uvmat_field') 2263 set(hget_field,'name','uvmat_field')%rename get_field GUI for the 'slave' mode 2247 2264 end 2248 2265 hhget_field=guidata(hget_field); 2249 2266 funct_list=get(hhget_field.ACTION,'UserData'); 2250 2267 funct_index=get(hhget_field.ACTION,'Value'); 2251 funct=funct_list{funct_index}; 2252 Field{1}=funct(hget_field); % read the names of the variables to plot in the get_field GUI2268 funct=funct_list{funct_index};%select the current action in get_field, e;g. PLOT 2269 Field{1}=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot 2253 2270 CivStage=0; 2254 2271 VelType_out=[]; … … 2290 2307 end 2291 2308 2292 % update the display buttons for the first velocity type (first menuline)2309 %% update the display buttons for the first velocity type (first menuline) 2293 2310 veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2]; 2294 2311 if ~isequal(FileType,'netcdf') … … 2304 2321 end 2305 2322 2306 % update the display buttons for the second velocity type (second menuline)2323 %% update the display buttons for the second velocity type (second menuline) 2307 2324 veltype_handles_1=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1]; 2308 2325 if ~isequal(FileType_1,'netcdf') … … 2318 2335 end 2319 2336 2320 % introduce w as background image by default for a new series (only for nbdim=2)2337 %% introduce w as background image by default for a new series (only for nbdim=2) 2321 2338 if ~isfield(UvData,'NewSeries') 2322 2339 UvData.NewSeries=1; … … 2342 2359 set(handles.Fields_1,'Visible','on'); 2343 2360 Field{1}.AName='w'; 2344 testscal=1;2361 % testscal=1; 2345 2362 end 2346 2363 end … … 2350 2367 isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')&& isfield(UvData.XmlData.GeometryCalib,'SliceCoord') 2351 2368 siz=size(UvData.XmlData.GeometryCalib.SliceCoord); 2352 if siz(1)>12353 NbSlice=siz(1);2354 else2355 NbSlice=1;2356 end2369 % if siz(1)>1 2370 % NbSlice=siz(1); 2371 % else 2372 % NbSlice=1; 2373 % end 2357 2374 end 2358 2375 … … 2368 2385 end 2369 2386 2370 % coordinate transform or user fct2387 %% coordinate transform or user fct 2371 2388 XmlData=[];%default 2372 2389 if isfield(UvData,'XmlData')%use geometry calib recorded from the ImaDoc xml file as first priority … … 2377 2394 XmlData_1=UvData.XmlData_1; 2378 2395 end 2379 menu_transform=get(handles.transform_fct,'String');2396 % menu_transform=get(handles.transform_fct,'String'); 2380 2397 choice_value=get(handles.transform_fct,'Value'); 2381 2398 transform_list=get(handles.transform_fct,'UserData'); 2382 2399 transform=transform_list{choice_value};%selected function handles 2383 2384 2400 % z index 2385 2401 if ~isempty(filename) 2386 2402 Field{1}.ZIndex=z_index; 2387 2403 end 2388 2389 2404 %px to phys or other transform on field 2390 2405 if ~isempty(transform) … … 2400 2415 end 2401 2416 2402 % calculate scalar2417 %% calculate scalar 2403 2418 if isequal(FileType,'netcdf') && ~isequal(FieldName,'get_field...')% 2404 2419 Field{1}=calc_field(InputField,Field{1}); … … 2407 2422 Field{2}=calc_field(InputField_1,Field{2}); 2408 2423 end 2409 2410 2424 % combine the two input fields (e.g. substract velocity fields) 2411 2425 if numel(Field)==2 … … 2415 2429 end 2416 2430 2417 % test 3D , default projection menuplane and typical mesh (needed to menuopen set_object)2431 %% test 3D , default projection menuplane and typical mesh (needed to menuopen set_object) 2418 2432 test_x=0; 2419 2433 test_z=0;% test for unstructured z coordinate … … 2478 2492 end 2479 2493 end 2494 2480 2495 %case of structured coordinates 2481 2496 if isfield(UvData.Field,'AX') && isfield(UvData.Field,'AY')&& isfield(UvData.Field,'A') … … 2572 2587 %multilevel case (single menuplane in a 3D space) 2573 2588 elseif isfield(UvData,'Z') 2574 if isfield(UvData,'CoordType')& isequal(UvData.CoordType,'phys')& isfield(UvData,'XmlData')2589 if isfield(UvData,'CoordType')&& isequal(UvData.CoordType,'phys') && isfield(UvData,'XmlData') 2575 2590 XmlData=UvData.XmlData; 2576 2591 if isfield(XmlData,'PlanePos') … … 2589 2604 end 2590 2605 2591 %Plot the projections on all existing projection objects 2592 keeplim=get(handles.FixedLimits,'Value'); 2593 %reset the min and max of scalar if only the mask is displayed 2594 if isfield(UvData,'Mask')&~isfield(UvData,'A') 2606 %% reset the min and max of scalar if only the mask is displayed(TODO: check the need) 2607 if isfield(UvData,'Mask')&& ~isfield(UvData,'A') 2595 2608 set(handles.MinA,'String','0') 2596 2609 set(handles.MaxA,'String','255') 2597 2610 end 2598 IndexObj(1)=get(handles.list_object_1,'Value'); 2599 haxes_1=handles.axes3; 2611 2612 %% Plot the projections on the selected projection objects 2613 2614 % main projection object (uvmat display) 2615 IndexObj(1)=get(handles.list_object_1,'Value');%selected projection object for main view 2600 2616 if IndexObj(1)> numel(UvData.Object) 2601 IndexObj(1)=1; 2602 haxes_1=handles.axes3; 2603 end 2604 view_field_handle=[]; 2605 IndexObj_2=get(handles.list_object_2,'Value'); 2606 if isequal(get(handles.list_object_2,'Visible'),'on') && IndexObj_2 <= numel(UvData.Object) 2617 IndexObj(1)=1;%select the first object if the selected one does not exist 2618 set(handles.list_object_1,'Value',1) 2619 end 2620 plot_handles{1}=handles; 2621 haxes(1)=handles.axes3; 2622 PlotParam{1}=read_plot_param(handles);%read plotting parameters on the uvmat interfac 2623 keeplim(1)=get(handles.FixedLimits,'Value');% test for fixed graph limits 2624 PosColorbar{1}=UvData.PosColorbar;%prescribe the colorbar position on the uvmat interface 2625 2626 % second projection object (view_field display) 2627 IndexObj_2=get(handles.list_object_2,'Value');%selected projection object for the second view 2628 if isequal(get(handles.list_object_2,'Visible'),'on') && IndexObj_2 <= numel(UvData.Object)&& ~isempty(UvData.Object{IndexObj_2}) 2607 2629 IndexObj(2)=IndexObj_2; 2608 view_field_handle=findobj(allchild(0),'tag','view_field'); 2609 end 2630 view_field_handle=findobj(allchild(0),'tag','view_field');%handles of the view_field GUI 2631 if ~isempty(view_field_handle) 2632 plot_handles{2}=guidata(view_field_handle); 2633 haxes(2)=plot_handles{2}.axes3; 2634 PlotParam{2}=read_plot_param(plot_handles{2});%read plotting parameters on the uvmat interface 2635 keeplim(2)=get(plot_handles{2}.FixedLimits,'Value'); 2636 PosColorbar{2}='*'; %TODO: deal with colorbar position on view_field 2637 end 2638 end 2639 2640 %loop on the projection objects: one or two 2610 2641 for imap=1:numel(IndexObj) 2611 iobj=IndexObj(imap); 2612 if ~isempty(UvData.Object{iobj})%& isfield(Object{iobj},'plotaxes')& ishandle(Object{iobj}.plotaxes) 2613 %Projeter les champs sur l'objet:* 2614 ObjectData=proj_field(UvData.Field,UvData.Object{iobj},iobj); 2615 %use of mask 2616 if isfield(ObjectData,'NbDim')&isequal(ObjectData.NbDim,2) 2617 if isfield(ObjectData,'Mask') && isfield(ObjectData,'A') 2618 flag_mask=double(ObjectData.Mask>200);%=0 for masked regions 2619 AX=ObjectData.AX; 2620 AY=ObjectData.AY; 2621 MaskX=ObjectData.MaskX; 2622 MaskY=ObjectData.MaskY; 2623 if ~isequal(MaskX,AX)||~isequal(MaskY,AY) 2624 nxy=size(flag_mask); 2625 sizpx=(ObjectData.MaskX(end)-ObjectData.MaskX(1))/(nxy(2)-1);%size of a mask pixel 2626 sizpy=(ObjectData.MaskY(1)-ObjectData.MaskY(end))/(nxy(1)-1); 2627 x_mask=ObjectData.MaskX(1):sizpx:ObjectData.MaskX(end); % pixel x coordinates for image display 2628 y_mask=ObjectData.MaskY(1):-sizpy:ObjectData.MaskY(end);% pixel x coordinates for image display 2629 %project on the positions of the scalar 2630 npxy=size(ObjectData.A); 2631 dxy(1)=(ObjectData.AY(end)-ObjectData.AY(1))/(npxy(1)-1);%grid mesh in y 2632 dxy(2)=(ObjectData.AX(end)-ObjectData.AX(1))/(npxy(2)-1);%grid mesh in x 2633 xi=ObjectData.AX(1):dxy(2):ObjectData.AX(end); 2634 yi=ObjectData.AY(1):dxy(1):ObjectData.AY(end); 2635 [XI,YI]=meshgrid(xi,yi);% creates the matrix of regular coordinates 2636 flag_mask = interp2(x_mask,y_mask,flag_mask,XI,YI); 2637 end 2638 AClass=class(ObjectData.A); 2639 ObjectData.A=flag_mask.*double(ObjectData.A); 2640 ObjectData.A=feval(AClass,ObjectData.A); 2641 ind_off=[]; 2642 if isfield(ObjectData,'ListVarName') 2643 for ilist=1:length(ObjectData.ListVarName) 2644 if isequal(ObjectData.ListVarName{ilist},'Mask')||isequal(ObjectData.ListVarName{ilist},'MaskX')||isequal(ObjectData.ListVarName{ilist},'MaskY') 2645 ind_off=[ind_off ilist]; 2646 end 2647 end 2648 ObjectData.ListVarName(ind_off)=[]; 2649 ObjectData.VarDimIndex(ind_off)=[]; 2650 ind_off=[]; 2651 for ilist=1:length(ObjectData.ListDimName) 2652 if isequal(ObjectData.ListDimName{ilist},'MaskX')|isequal(ObjectData.ListDimName{ilist},'MaskY') 2653 ind_off=[ind_off ilist]; 2654 end 2655 end 2656 ObjectData.ListDimName(ind_off)=[]; 2657 ObjectData.DimValue(ind_off)=[]; 2658 end 2659 end 2660 end 2661 if ~isempty(ObjectData) 2662 % haxes=[];%default 2663 % if isfield(UvData.Object{iobj},'plotaxes') 2664 % haxes=UvData.Object{iobj}.plotaxes;%axes used for representing the projection on the object 2665 % end 2666 PosColorbar=[];%default: no colorbar 2667 if ishandle(haxes_1) & isequal(get(haxes_1,'Tag'),'axes3')& isfield(UvData,'PosColorbar') 2668 PosColorbar=UvData.PosColorbar;%prescribe the colorbar position on the uvmat interface 2642 iobj=IndexObj(imap); 2643 ObjectData=proj_field(UvData.Field,UvData.Object{iobj},iobj);% project field on the object 2644 2645 %use of mask (TODO: check) 2646 if isfield(ObjectData,'NbDim') && isequal(ObjectData.NbDim,2) && isfield(ObjectData,'Mask') && isfield(ObjectData,'A') 2647 flag_mask=double(ObjectData.Mask>200);%=0 for masked regions 2648 AX=ObjectData.AX;%x coordiantes for the scalar field 2649 AY=ObjectData.AY;%y coordinates for the scalar field 2650 MaskX=ObjectData.MaskX;%x coordiantes for the mask 2651 MaskY=ObjectData.MaskY;%y coordiantes for the mask 2652 if ~isequal(MaskX,AX)||~isequal(MaskY,AY) 2653 nxy=size(flag_mask); 2654 sizpx=(ObjectData.MaskX(end)-ObjectData.MaskX(1))/(nxy(2)-1);%size of a mask pixel 2655 sizpy=(ObjectData.MaskY(1)-ObjectData.MaskY(end))/(nxy(1)-1); 2656 x_mask=ObjectData.MaskX(1):sizpx:ObjectData.MaskX(end); % pixel x coordinates for image display 2657 y_mask=ObjectData.MaskY(1):-sizpy:ObjectData.MaskY(end);% pixel x coordinates for image display 2658 %project on the positions of the scalar 2659 npxy=size(ObjectData.A); 2660 dxy(1)=(ObjectData.AY(end)-ObjectData.AY(1))/(npxy(1)-1);%grid mesh in y 2661 dxy(2)=(ObjectData.AX(end)-ObjectData.AX(1))/(npxy(2)-1);%grid mesh in x 2662 xi=ObjectData.AX(1):dxy(2):ObjectData.AX(end); 2663 yi=ObjectData.AY(1):dxy(1):ObjectData.AY(end); 2664 [XI,YI]=meshgrid(xi,yi);% creates the matrix of regular coordinates 2665 flag_mask = interp2(x_mask,y_mask,flag_mask,XI,YI); 2666 end 2667 AClass=class(ObjectData.A); 2668 ObjectData.A=flag_mask.*double(ObjectData.A); 2669 ObjectData.A=feval(AClass,ObjectData.A); 2670 ind_off=[]; 2671 if isfield(ObjectData,'ListVarName') 2672 for ilist=1:length(ObjectData.ListVarName) 2673 if isequal(ObjectData.ListVarName{ilist},'Mask')||isequal(ObjectData.ListVarName{ilist},'MaskX')||isequal(ObjectData.ListVarName{ilist},'MaskY') 2674 ind_off=[ind_off ilist]; 2675 end 2676 end 2677 ObjectData.ListVarName(ind_off)=[]; 2678 ObjectData.VarDimIndex(ind_off)=[]; 2679 ind_off=[]; 2680 for ilist=1:length(ObjectData.ListDimName) 2681 if isequal(ObjectData.ListDimName{ilist},'MaskX') || isequal(ObjectData.ListDimName{ilist},'MaskY') 2682 ind_off=[ind_off ilist]; 2683 end 2684 end 2685 ObjectData.ListDimName(ind_off)=[]; 2686 ObjectData.DimValue(ind_off)=[]; 2687 end 2688 end 2689 2690 if ~isempty(ObjectData) 2691 PlotType='none'; %default 2692 if imap==2 && isempty(view_field_handle) 2693 view_field(ObjectData) 2694 else 2695 [PlotType,PlotParamOut]=plot_field(ObjectData,haxes(imap),PlotParam{imap},keeplim(imap),PosColorbar{imap}); 2696 write_plot_param(plot_handles{imap},PlotParamOut) %update the auto plot parameters 2697 end 2698 if isequal(PlotType,'none') 2699 hget_field=findobj(allchild(0),'name','get_field'); 2700 if isempty(hget_field) 2701 get_field([],ObjectData)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field) 2669 2702 else 2670 PosColorbar='*';%default position 2703 errormsg='The field defined by get_field cannot be plotted'; 2704 return 2671 2705 end 2672 if imap==1 %plot on uvmat 2673 PlotParam=read_plot_param(handles);%read plotting parameters on the uvmat interface 2674 [PlotType,ScalOut,UvData.Object{iobj}.plotaxes]=plot_field(ObjectData,haxes_1,PlotParam,keeplim,PosColorbar); 2675 elseif ~isempty(view_field_handle) 2676 view_field_hh=guidata(view_field_handle); 2677 PlotParam=read_plot_param(view_field_hh);%read plotting parameters on the uvmat interface 2678 [PlotType,ScalOut,UvData.Object{iobj}.plotaxes]=plot_field(ObjectData,view_field_hh.axes3,PlotParam,keeplim,PosColorbar); 2679 else 2680 [pt,so,UvData.Object{iobj}.plotaxes]=view_field(ObjectData); 2681 end 2682 2683 if isequal(PlotType,'none') 2684 hget_field=findobj(allchild(0),'name','get_field'); 2685 if isempty(hget_field) 2686 get_field([],ObjectData)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field) 2687 else 2688 errormsg='The field defined by get_field cannot be plotted'; 2689 return 2690 end 2691 end 2692 UvData.Object{iobj}.PlotParam=ScalOut; %record the plotting parameters 2693 end 2694 end 2695 end 2696 2697 %display the updated plotting parameters for the base menuplane 2698 write_plot_param(handles,UvData.Object{1}.PlotParam);% update the display of the plotting parameters 2706 end 2707 end 2708 end 2709 2710 %write_plot_param(handles,UvData.Object{1}.PlotParam);% update the display of the plotting parameters 2699 2711 UvData.NewSeries=0;% put to 0 the test for a new field series (set by RootPath_callback) 2700 2712 set(handles.uvmat,'UserData',UvData) 2701 2713 2702 % update the mask2714 %% update the mask 2703 2715 if isequal(get(handles.mask_test,'Value'),1)%if the mask option is on 2704 2716 update_mask(handles,num_i1,num_i2); 2705 2717 end 2706 2718 2707 % prepare the menus of histograms (for the whole menuvolume in 3D case)2708 menu_histo=(UvData.Field.ListVarName)'; 2719 %% prepare the menus of histograms and plot them (histogram of the whole volume in 3D case) 2720 menu_histo=(UvData.Field.ListVarName)';%list of field variables to be displayed for the menu of histogram display 2709 2721 ind_bad=[]; 2710 2722 nb_histo=1; 2711 for ivar=1:numel(menu_histo) 2723 2724 % suppress coordinates from the histogram menu 2725 for ivar=1:numel(menu_histo)%l loop on field variables: 2712 2726 if isfield(UvData.Field,'VarAttribute') && numel(UvData.Field.VarAttribute)>=ivar && isfield(UvData.Field.VarAttribute{ivar},'Role') 2713 2727 Role=UvData.Field.VarAttribute{ivar}.Role; … … 2731 2745 end 2732 2746 menu_histo(ind_bad)=[]; 2747 2748 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2749 % display menus and plot histograms 2733 2750 test_v=0; 2734 2751 if ~isempty(menu_histo) 2735 2752 set(handles.histo1_menu,'Value',1) 2736 2753 set(handles.histo1_menu,'String',menu_histo) 2737 histo1_menu_Callback(handles.histo1_menu, [], handles) 2738 if nb_histo > 1 2754 histo1_menu_Callback(handles.histo1_menu, [], handles)% plot first histogram 2755 % case of more than one variables (eg vector components) 2756 if nb_histo > 1 2739 2757 test_v=1; 2740 2758 set(handles.histo2_menu,'Visible','on') … … 2742 2760 set(handles.histo2_menu,'String',menu_histo) 2743 2761 set(handles.histo2_menu,'Value',2) 2744 histo2_menu_Callback(handles.histo2_menu,[], handles) 2762 histo2_menu_Callback(handles.histo2_menu,[], handles)% plot second histogram 2745 2763 end 2746 2764 end … … 2751 2769 set(handles.histo2_menu,'Value',1) 2752 2770 end 2753 2754 %display time 2771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2772 2773 %% display time 2755 2774 testimedoc=0; 2756 2775 if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'Time') … … 2765 2784 end 2766 2785 siz=size(UvData.XmlData.Time); 2767 if siz(1)>=max(num_i1,num_i2) & siz(2)>=max(num_j1,num_j2)2786 if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2) 2768 2787 abstime=(UvData.XmlData.Time(num_i1,num_j1)+UvData.XmlData.Time(num_i2,num_j2))/2;%overset the time read from files 2769 2788 dt=(UvData.XmlData.Time(num_i2,num_j2)-UvData.XmlData.Time(num_i1,num_j1)); … … 2772 2791 end 2773 2792 if isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'Time') 2774 [P,F,str1,str2,str_a,str_b,E ,NomType]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);2775 num_i2=str2 num(str2);2793 [P,F,str1,str2,str_a,str_b,E]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]); 2794 num_i2=str2double(str2); 2776 2795 if isempty(num_i2) 2777 2796 num_i2=num_i1; 2778 2797 end 2779 num_j1=str2 num(str_a);2798 num_j1=str2double(str_a); 2780 2799 if isempty(num_j1) 2781 2800 num_j1=1; 2782 2801 end 2783 num_j2=str2 num(str_b);2802 num_j2=str2double(str_b); 2784 2803 if isempty(num_j2) 2785 2804 num_j2=num_j1; 2786 2805 end 2787 num_i1=str2 num(str1);2806 num_i1=str2double(str1); 2788 2807 siz=size(UvData.XmlData_1.Time); 2789 if siz(1)>=max(num_i1,num_i2) & siz(2)>=max(num_j1,num_j2)2808 if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2) 2790 2809 abstime_1=(UvData.XmlData_1.Time(num_i1,num_j1)+UvData.XmlData_1.Time(num_i2,num_j2))/2;%overset the time read from files 2791 2810 end … … 2805 2824 end 2806 2825 end 2807 %update the input file name in the get_field GUI 2826 2827 %% update the input file name in the get_field GUI 2808 2828 if isequal(FieldName,'get_field...') 2809 2829 set(hhget_field.inputfile,'String',filename) 2810 2830 Tabchar={''};%default 2811 2831 Tabcell=[]; 2812 if isfield(Field{1},'ListGlobalAttribute')& ~isempty(Field{1}.ListGlobalAttribute)2832 if isfield(Field{1},'ListGlobalAttribute')&& ~isempty(Field{1}.ListGlobalAttribute) 2813 2833 for iline=1:length(Field{1}.ListGlobalAttribute) 2814 2834 Tabcell{iline,1}=Field{1}.ListGlobalAttribute{iline}; … … 2852 2872 set(hhget_field_1.attributes,'String',Tabchar);%update list of global attributes in get_field 2853 2873 end 2854 2855 2874 2856 2875 … … 4015 4034 histo_value=get(handles.histo1_menu,'Value'); 4016 4035 FieldName=histo_menu{histo_value}; 4017 UvData=get(huvmat,'UserData');4036 % UvData=get(huvmat,'UserData'); 4018 4037 update_histo(handles.histo_u,huvmat,FieldName) 4019 4038 … … 4026 4045 histo_value=get(handles.histo2_menu,'Value'); 4027 4046 FieldName=histo_menu{histo_value}; 4028 UvData=get(huvmat,'UserData');4047 % UvData=get(huvmat,'UserData'); 4029 4048 update_histo(handles.histo_v,huvmat,FieldName) 4030 4049 … … 4034 4053 function update_histo(haxes,huvmat,FieldName) 4035 4054 UvData=get(huvmat,'UserData'); 4036 4037 4055 if ~isfield(UvData.Field,FieldName) 4038 4056 msgbox_uvmat('ERROR',['no field ' FieldName ' for histogram']) … … 4041 4059 Field=UvData.Field; 4042 4060 FieldHisto=eval(['Field.' FieldName]); 4043 if isfield(Field,'FF') & ~isempty(Field.FF)& isequal(size(Field.FF),size(FieldHisto))4061 if isfield(Field,'FF') && ~isempty(Field.FF) && isequal(size(Field.FF),size(FieldHisto)) 4044 4062 indsel=find(Field.FF==0);%find values marked as false 4045 4063 if ~isempty(indsel) … … 4264 4282 AxeData=get(haxes,'UserData'); 4265 4283 PlotParam=read_plot_param(handles); 4266 PlotParam.Scalar4267 4284 [PlotType,PlotParamOut]= plot_field(AxeData,haxes,PlotParam,1); 4268 4285 write_plot_param(handles,PlotParamOut); %update the auto plot parameters … … 4476 4493 dlg_title = 'select properties of the output avi movie'; 4477 4494 num_lines= 1; 4478 nbfield_cell=get(handles.last_i,'String');4495 % nbfield_cell=get(handles.last_i,'String'); 4479 4496 def = {[FileBase '_out.avi'];'10';'1';'[0.03 0.05 0.95 0.92]';'10'}; 4480 4497 answer = inputdlg(prompt,dlg_title,num_lines,def,'on'); 4481 4498 aviname=answer{1}; 4482 fps=str2 num(answer{2});4499 fps=str2double(answer{2}); 4483 4500 % check for existing file with output name aviname 4484 4501 if exist(aviname,'file') … … 4504 4521 newaxes=copyobj(handles.axes3,newfig);%new plotting axes in the new figure 4505 4522 set(newaxes,'Tag','movieaxes') 4506 nbpix=[512 384]*str2 num(answer{3});4523 nbpix=[512 384]*str2double(answer{3}); 4507 4524 set(gcf,'Position',[1 1 nbpix])% resolution XVGA 4508 4525 set(newaxes,'Position',eval(answer{4})); … … 4513 4530 UvData.Object{1}.plotaxes=newaxes;% the axis in the new figure becomes the current main plotting axes 4514 4531 set(huvmat,'UserData',UvData); 4515 increment=str2num(get(handles.increment_scan,'String')); %get the field increment d 4532 increment=str2double(get(handles.increment_scan,'String')); %get the field increment d 4533 if isnan(increment) 4534 set(handles.increment_scan,'String','1')%default value 4535 increment=1; 4536 end 4516 4537 set(handles.STOP,'Visible','on') 4517 4538 set(handles.speed,'Visible','on') … … 4519 4540 set(handles.Movie,'BusyAction','queue') 4520 4541 4521 imin=str2num(get(handles.i1,'String'));4522 imax=str2 num(answer{5});4542 %imin=str2double(get(handles.i1,'String')); 4543 imax=str2double(answer{5}); 4523 4544 % if isfield(UvData,'Time') 4524 4545 htitle=get(newaxes,'Title'); … … 4530 4551 set(handles.speed,'Value',1) 4531 4552 for i=1:imax 4532 if get(handles.speed,'Value')~=0 & isequal(get(handles.MenuExportMovie,'BusyAction'),'queue') % enable STOP command4533 runpm(hObject,eventdata,handles,increment) 4553 if get(handles.speed,'Value')~=0 && isequal(get(handles.MenuExportMovie,'BusyAction'),'queue') % enable STOP command 4554 runpm(hObject,eventdata,handles,increment)% run plus 4534 4555 drawnow 4535 4556 time_str=get(handles.abs_time,'String'); … … 4541 4562 end 4542 4563 end 4543 aviobj=close(aviobj);4564 close(aviobj); 4544 4565 UvData.Object{1}.plotaxes=handles.axes3; 4545 4566 set(huvmat,'UserData',UvData); … … 4789 4810 end 4790 4811 if isequal(get(handles.scan_i,'Value'),1) 4791 param.incr_i=str2 num(get(handles.increment_scan,'String'));4812 param.incr_i=str2double(get(handles.increment_scan,'String')); 4792 4813 elseif isequal(get(handles.scan_j,'Value'),1) 4793 param.incr_j=str2 num(get(handles.increment_scan,'String'));4814 param.incr_j=str2double(get(handles.increment_scan,'String')); 4794 4815 end 4795 4816 param.list_fields=get(handles.Fields,'String');% list menu fields
Note: See TracChangeset
for help on using the changeset viewer.