Changeset 41 for trunk/src/set_object.m


Ignore:
Timestamp:
Mar 10, 2010, 11:03:36 AM (11 years ago)
Author:
sommeria
Message:

-relabel_i_j: improve the question dlg box for image transform
-aver_stat,time_series,merge_proj: include modification of field transform and call of set_object.
-series: introduce a browser for set_object
-ima2vol: create volume images (png images of a slice concacened along y) for PIV 3D
-set_object: suppress TITLE, introduce Tooltip helps for parameters
-civ: fixed bug on BATCH sequences

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/set_object.m

    r40 r41  
    6767% parameters on the uvmat interface (obtained by 'get_plot_handle.m')
    6868function set_object_OpeningFcn(hObject, eventdata, handles, data, PlotHandles,ZBounds)
    69 
     69%-------------------------------------------------------------------
    7070% Choose default command line output for set_object
    7171handles.output = hObject;
     
    9494% fill the interface as set in the input data:
    9595if exist('data','var')
    96     if isfield(data,'desable_open')
    97         desable_open=data.desable_open;%test to desable button OPEN (edit or display mode)
    98     end
     96%     if isfield(data,'desable_open')
     97%         desable_open=data.desable_open;%test to desable button OPEN (edit or display mode)
     98%     end
    9999    if isfield(data,'desable_plot')
    100100        desable_plot=data.desable_plot;%test to desable button PLOT (display mode)
     
    110110        end
    111111    end
    112     if isfield(data,'ProjMode') && isfield(data,'Style')
    113         data.TITLE=set_title(data.Style,data.ProjMode);% define TITLE in set_object (POINTS, LINE, PATCH,...)
    114     end
    115     if isfield(data,'TITLE')
    116         menutitle=get(handles.TITLE,'String');
    117         for iline=1:length(menutitle)
    118             strmenu=menutitle{iline};
    119             if isequal(data.TITLE,strmenu)
    120                 set(handles.TITLE,'Value',iline)
    121                 break
    122             end
    123         end
    124         TITLE_Callback(hObject, eventdata, handles)% enable edit boxes depending on TITLE
    125     end
    126     if isfield(data,'fixedtitle')&isequal(data.fixedtitle,1)
    127         set(handles.TITLE,'enable','off')
    128     end
     112%     if isfield(data,'ProjMode') && isfield(data,'Style')
     113%         data.TITLE=set_title(data.Style,data.ProjMode);% define TITLE in set_object (POINTS, LINE, PATCH,...)
     114%     end
     115%     if isfield(data,'TITLE')
     116%         menutitle=get(handles.TITLE,'String');
     117%         for iline=1:length(menutitle)
     118%             strmenu=menutitle{iline};
     119%             if isequal(data.TITLE,strmenu)
     120%                 set(handles.TITLE,'Value',iline)
     121%                 break
     122%             end
     123%         end
     124%         TITLE_Callback(hObject, eventdata, handles)% enable edit boxes depending on TITLE
     125%     end
     126%     if isfield(data,'fixedtitle')&isequal(data.fixedtitle,1)
     127%         set(handles.TITLE,'enable','off')
     128%     end
    129129    if isfield(data,'Style')
    130130        menu=get(handles.ObjectStyle,'String');
     
    136136        end
    137137    end
     138    ObjectStyle_Callback(hObject, eventdata, handles)
    138139    if isfield(data,'ProjMode')
    139140        menu=get(handles.ProjMode,'String');
     
    145146        end
    146147    end
     148    ProjMode_Callback(hObject, eventdata, handles)
    147149    if isfield(data,'Coord') & size(data.Coord,2)>=2
    148150        sizcoord=size(data.Coord);
     
    226228    end
    227229end
    228 if desable_open
    229     set(handles.OPEN,'Visible','off')
    230 else
    231     set(handles.OPEN,'Visible','on')
    232 end
     230% if desable_open
     231%     set(handles.OPEN,'Visible','off')
     232% else
     233%     set(handles.OPEN,'Visible','on')
     234% end
    233235if desable_plot
    234236   set(handles.PLOT,'Visible','off')
     
    252254% --- Executes on selection change in ObjectStyle.
    253255function ObjectStyle_Callback(hObject, eventdata, handles)
    254 style_prev=get(handles.ObjectStyle,'UserData');
     256style_prev=get(handles.ObjectStyle,'UserData');%previous object style
    255257str=get(handles.ObjectStyle,'String');
    256258val=get(handles.ObjectStyle,'Value');
     259style=str{val};
    257260% make correspondance between different object styles
    258261% if ~isequal(str{val},style_prev)
     
    287290    z_new{1}=Zcolumn{1};
    288291end
    289 if isequal(str{val},'line')
     292if isequal(style,'line')
    290293    if isequal(style_prev,'rectangle')|isequal(style_prev,'ellipse')
    291294        XMax=get(handles.XMax,'String');
     
    297300        set(handles.ZObject,'String',z_new)
    298301    end
    299 elseif isequal(str{val},'polyline')
    300 elseif isequal(str{val},'rectangle')| isequal(str{val},'ellipse')
     302elseif isequal(style,'polyline')
     303elseif isequal(style,'rectangle')| isequal(style,'ellipse')
    301304     set(handles.XObject,'String',x_new)
    302305     set(handles.YObject,'String',y_new)
     
    304307end
    305308% end
    306            
    307            
    308 
     309switch style
     310    case {'points','line','polyline','plane'}
     311        menu_proj={'projection';'interp';'filter';'none'};
     312    case {'polygon','rectangle','ellipse'}
     313        menu_proj={'inside';'outside';'mask_inside';'mask_outside'};
     314    case 'volume'
     315        menu_proj={'none'};
     316end   
     317proj_index=get(handles.ProjMode,'Value');
     318if proj_index<numel(menu_proj)
     319    set(handles.ProjMode,'Value',1);% value index must not exceed the menu length
     320end
     321set(handles.ProjMode,'String',menu_proj)
    309322ProjMode_Callback(hObject, eventdata, handles)
    310323%store the current option
    311324str=get(handles.ObjectStyle,'String');
    312325val=get(handles.ObjectStyle,'Value');
    313 set(handles.ObjectStyle,'UserData',str{val})
     326set(handles.ObjectStyle,'UserData',style)
    314327
    315328%----------------------------------------------
     
    334347ObjectStyle=menu{value};
    335348test3D=isequal(get(handles.ZObject,'Visible'),'on');%3D case
    336 if isequal(ObjectStyle,'plane')|isequal(ObjectStyle,'volume')
    337     set(handles.Phi,'Visible','on')
    338     if test3D%3D case
    339         set(handles.Theta,'Visible','on')
    340         set(handles.Psi,'Visible','on')
    341     end
    342     set(handles.XMin,'Visible','on')
     349
     350%default setting
     351set(handles.Phi,'Visible','off')
     352set(handles.Theta,'Visible','off')
     353set(handles.Psi,'Visible','off')
     354set(handles.XMin,'Visible','off')
     355set(handles.XMax,'Visible','off')
     356set(handles.YMin,'Visible','off')
     357if isequal(ProjMode,'interp')
     358    set(handles.YMax,'Visible','off')
     359else
     360    set(handles.YMax,'Visible','on')
     361end
     362if isequal(ObjectStyle,'rectangle')|isequal(ObjectStyle,'ellipse')
    343363    set(handles.XMax,'Visible','on')
    344     set(handles.YMin,'Visible','on')
    345     set(handles.YMax,'Visible','on')
    346     if test3D
    347         set(handles.Theta,'Visible','on')
    348         set(handles.Psi,'Visible','on')
    349         set(handles.ZMin,'Visible','on')
    350         set(handles.ZMax,'Visible','on')
    351     end
    352364else
    353     set(handles.Phi,'Visible','off')
    354     set(handles.Theta,'Visible','off')
    355     set(handles.Psi,'Visible','off')
    356     set(handles.XMin,'Visible','off')
    357     set(handles.XMax,'Visible','off')
    358     set(handles.YMin,'Visible','off')
    359     if isequal(ProjMode,'interp')
    360         set(handles.YMax,'Visible','off')
    361     else
    362         set(handles.YMax,'Visible','on')
    363     end
    364     if isequal(ObjectStyle,'rectangle')|isequal(ObjectStyle,'ellipse')
    365         set(handles.XMax,'Visible','on')
    366     else
    367        set(handles.XMax,'Visible','off')
    368     end
    369     set(handles.ZMin,'Visible','off')
    370     set(handles.ZMax,'Visible','off')
    371 end
    372 TITLE_list=get(handles.TITLE,'String');
    373 val=get(handles.TITLE,'Value');
    374 TITLE=TITLE_list{val};
    375 switch TITLE
    376     case {'POINTS','PATCH','MASK'}
    377         set(handles.DX,'Visible','off')
    378         set(handles.DY,'Visible','off')
    379         set(handles.DZ,'Visible','off')
    380     case {'LINE'}
     365   set(handles.XMax,'Visible','off')
     366end
     367set(handles.ZMin,'Visible','off')
     368set(handles.ZMax,'Visible','off')
     369set(handles.DX,'Visible','off')
     370set(handles.DY,'Visible','off')
     371set(handles.DZ,'Visible','off')
     372
     373switch ObjectStyle
     374    case 'points'
     375        set(handles.YMax,'TooltipString','YMax: range of averaging around each point')
     376        set(handles.XObject,'TooltipString','XObject: set of x coordinates of the points')
     377        set(handles.YObject,'TooltipString','YObject: set of y coordinates of the points')
     378        set(handles.ZObject,'TooltipString','ZObject: set of z coordinates of the points')
     379    case {'line','polyline','polygon'}
     380        set(handles.YMax,'TooltipString','YMax: range of averaging around the line')
     381        set(handles.XObject,'TooltipString','XObject: set of x coordinates defining the line')
     382        set(handles.YObject,'TooltipString','YObject: set of y coordinates defining the line')
     383        set(handles.ZObject,'TooltipString','ZObject: set of z coordinates defining the line')
    381384        if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter')
    382385            set(handles.DX,'Visible','on')
    383         else
    384             set(handles.DX,'Visible','off')
    385         end
    386     case {'PLANE'} 
     386            set(handles.DX,'TooltipString','DX: mesh for the interpolated field along the line')
     387        end       
     388    case {'rectangle','ellipse'}
     389        set(handles.XMax,'TooltipString',['XMax: half length of the ' ObjectStyle])
     390        set(handles.YMax,'TooltipString',['YMax: half width of the ' ObjectStyle])
     391        set(handles.XObject,'TooltipString',['XObject:  x coordinate of the ' ObjectStyle ' centre'])
     392        set(handles.YObject,'TooltipString',['YObject:  y coordinate of the ' ObjectStyle ' centre'])
     393    case {'plane','volume'} 
     394        set(handles.Phi,'Visible','on')
     395        set(handles.XMin,'Visible','on')
     396        set(handles.XMax,'Visible','on')
     397        set(handles.YMin,'Visible','on')
     398        set(handles.YMax,'Visible','on')
     399        set(handles.XObject,'TooltipString',['XObject:  x coordinate of the axis origin for the ' ObjectStyle])
     400        set(handles.YObject,'TooltipString',['YObject:  y coordinate of the axis origin for the ' ObjectStyle])
     401        if test3D
     402            set(handles.Theta,'Visible','on')
     403            set(handles.Psi,'Visible','on')
     404            set(handles.ZMin,'Visible','on')
     405            set(handles.ZMax,'Visible','on')
     406        end
    387407        if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter')
    388408            set(handles.DX,'Visible','on')
     
    392412            set(handles.DY,'Visible','off')
    393413        end
    394     case {'VOLUME'}
    395         if isequal(ProjMode,'interp')
    396             set(handles.DX,'Visible','on')
    397             set(handles.DY,'Visible','on')
    398             set(handles.DZ,'Visible','on')
    399         else
    400             set(handles.DX,'Visible','off')
    401             set(handles.DY,'Visible','off')
    402             set(handles.DZ,'Visible','off')   
    403         end
    404 end
    405 
    406 %---------------------------------------------
    407 % --- Executes on selection change in TITLE.
    408 function TITLE_Callback(hObject, eventdata, handles)
    409 %---------------------------------------------
    410 hsetobject=get(handles.TITLE,'parent');
    411 SetData=get(hsetobject,'UserData');%get the hidden interface data
    412 %      function named CALLBACK in UNTITLED.M with the given input arguments.
    413 menu=get(handles.TITLE,'String');
    414 value=get(handles.TITLE,'Value');
    415 titl=menu{value};
    416 if isequal(titl,'POINTS');
    417      menu_style={'points'};
    418      menu_proj={'projection';'interp';'filter';'none'};
    419 elseif isequal(titl,'LINE')
    420      menu_style={'line';'polyline';'rectangle';'polygon';'ellipse'};%'line' =default
    421      menu_proj={'projection';'interp';'filter';'none'};
    422 elseif isequal(titl,'PATCH')
    423      menu_style={'rectangle';'polygon';'ellipse'};%'line' =default
    424      menu_proj={'inside';'outside'};
    425 elseif isequal(titl,'MASK')
    426      menu_style={'polygon'};%'line' =default
    427      menu_proj={'mask_inside';'mask_outside'};
    428 elseif isequal(titl,'PLANE')
    429      menu_style={'plane'};
    430      menu_proj={'projection';'interp';'filter';'none'};
    431 elseif isequal(titl,'VOLUME')
    432      menu_style={'volume'};
    433      menu_proj={'none'};
    434  
    435 end
    436 old_menu=get(handles.ObjectStyle,'String');
    437 value=get(handles.ObjectStyle,'Value');
    438 old_style=old_menu{value};
    439 teststyle=0;
    440 for iline=1:length(menu_style)
    441     if isequal(menu_style{iline},old_style)
    442         styleval=iline;
    443         teststyle=1;
    444         break
    445     end
    446 end
    447 if ~teststyle
    448     new_style=[];%default
    449     switch old_style
    450         case 'polyline'
    451             new_style='polygon';
    452         case 'polygon'
    453             new_style='polyline';
    454     end
    455     if ~isempty(new_style)
    456         for iline=1:length(menu_style)
    457             if isequal(menu_style{iline},new_style)
    458                 styleval=iline;
    459                 teststyle=1;
    460                 break
    461             end
    462         end
    463     end
    464 end
    465 if ~teststyle
    466     styleval=1;
    467 end
    468 set(handles.ObjectStyle,'String',menu_style)
    469 set(handles.ObjectStyle,'Value',styleval)
    470 set(handles.ProjMode,'String',menu_proj)
    471 set(handles.ProjMode,'Value',1)
    472 ObjectStyle_Callback(hObject, eventdata, handles) 
     414        if isequal(ObjectStyle,'volume') && isequal(ProjMode,'interp')
     415            set(handles.DZ,'Visible','on') 
     416        end
     417end
     418%
     419% %---------------------------------------------
     420% % --- Executes on selection change in TITLE.
     421% function TITLE_Callback(style, handles)
     422% %---------------------------------------------
     423% switch style
     424%     case {'points','line','polyline','plane'}
     425%         menu_proj={'projection';'interp';'filter';'none'};
     426%     case {'polygon','rectangle','ellipse'}
     427%         menu_proj={'inside';'outside';'mask_inside';'mask_outside'};
     428%     case 'volume'
     429%         menu_proj={'none'};
     430% end
     431%
     432%
     433% old_menu=get(handles.ObjectStyle,'String');
     434% value=get(handles.ObjectStyle,'Value');
     435% old_style=old_menu{value};
     436% teststyle=0;
     437% for iline=1:length(menu_style)
     438%     if isequal(menu_style{iline},old_style)
     439%         styleval=iline;
     440%         teststyle=1;
     441%         break
     442%     end
     443% end
     444% if ~teststyle
     445%     new_style=[];%default
     446%     switch old_style
     447%         case 'polyline'
     448%             new_style='polygon';
     449%         case 'polygon'
     450%             new_style='polyline';
     451%     end
     452%     if ~isempty(new_style)
     453%         for iline=1:length(menu_style)
     454%             if isequal(menu_style{iline},new_style)
     455%                 styleval=iline;
     456%                 teststyle=1;
     457%                 break
     458%             end
     459%         end
     460%     end
     461% end
     462% if ~teststyle
     463%     styleval=1;
     464% end
     465% set(handles.ObjectStyle,'String',menu_style)
     466% set(handles.ObjectStyle,'Value',styleval)
     467% set(handles.ProjMode,'String',menu_proj)
     468% set(handles.ProjMode,'Value',1)
     469% ObjectStyle_Callback(hObject, eventdata, handles) 
    473470
    474471%---------------------------------------------
     
    546543 end
    547544%Display title
    548 title=set_title(s.Style,s.ProjMode);%update the title
    549 if ~isempty(huvmat)
    550     hhuvmat=guidata(huvmat);
    551 end
    552 menu=get(handles.TITLE,'String');
    553 for iline=1:length(menu)
    554      if isequal(menu{iline},title)
    555          set(handles.TITLE,'Value',iline)
    556          break
    557      end
    558 end
    559 TITLE_Callback(hObject, eventdata, handles)
     545% title=set_title(s.Style,s.ProjMode);%update the title
     546% if ~isempty(huvmat)
     547%     hhuvmat=guidata(huvmat);
     548% end
     549% menu=get(handles.TITLE,'String');
     550% for iline=1:length(menu)
     551%      if isequal(menu{iline},title)
     552%          set(handles.TITLE,'Value',iline)
     553%          break
     554%      end
     555% end
     556%TITLE_Callback(hObject, eventdata, handles)
    560557teststyle=0;
    561 % if isfield(s,'Style')
     558
     559switch s.Style
     560    case {'points','line','polyline','plane'}
     561        menu_proj={'projection';'interp';'filter';'none'};
     562    case {'polygon','rectangle','ellipse'}
     563        menu_proj={'inside';'outside';'mask_inside';'mask_outside'};
     564    case 'volume'
     565        menu_proj={'none'};
     566end
     567set(handles.ObjectStyle,'String',menu_proj)
    562568menu=get(handles.ObjectStyle,'String');
    563569for iline=1:length(menu)
     
    569575end
    570576testmode=0;
    571 menu=get(handles.ProjMode,'String');
    572 for iline=1:length(menu)
    573     if isequal(menu{iline},s.ProjMode)
     577%menu=get(handles.ProjMode,'String');
     578for iline=1:length(menu_proj)
     579    if isequal(menu_proj{iline},s.ProjMode)
    574580        set(handles.ProjMode,'Value',iline)
    575581        testmode=1;
     
    754760set(huvmat,'UserData',UvData)%update the data in the uvmat interface
    755761list_str=get(hlist_object,'String');
    756 TITLE=set_title(ObjectData.Style,ObjectData.ProjMode);
    757 list_str{IndexObj}=[num2str(IndexObj) '-' TITLE];
     762% TITLE=set_title(ObjectData.Style,ObjectData.ProjMode);
     763% list_str{IndexObj}=[num2str(IndexObj) '-' TITLE];
     764list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style];
    758765if isequal(length(list_str),IndexObj)
    759766    list_str{IndexObj+1}='more...';
     
    849856end
    850857msgbox_uvmat('CONFIRMATION',[answer{1}  ' saved'])
     858
    851859%---------------------------------------------------------
    852860% --- Executes on slider movement.
     
    872880
    873881
    874 
    875 function XObject_Callback(hObject, eventdata, handles)
    876 
    877 
    878 function YObject_Callback(hObject, eventdata, handles)
    879 
    880 
    881 
    882 
    883 function ZObject_Callback(hObject, eventdata, handles)
    884 
    885 
    886882% --- Executes on button press in HELP.
    887883function HELP_Callback(hObject, eventdata, handles)
    888884path_to_uvmat=which ('uvmat');% check the path of uvmat
    889885pathelp=fileparts(path_to_uvmat);
    890 helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html');
    891 if isempty(dir(helpfile)), errordlg('Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC')
     886helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html');
     887if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package')
    892888else
    893     web([helpfile '#set_object'])   
    894 end
    895 
    896 
    897 
    898 
     889    addpath (fullfile(pathelp,'uvmat_doc'))
     890    web([helpfile '#set_object'])
     891end
     892
     893
     894
Note: See TracChangeset for help on using the changeset viewer.