Changeset 40


Ignore:
Timestamp:
Mar 9, 2010, 9:00:40 PM (15 years ago)
Author:
sommeria
Message:

-relabel_i_j added to the svn (relabel an image series with two indices)
-Menu projection Object added to uvmat, rationalizes the call of projection objects (to improve yet)
-get_plot_handles: modified in relationwith the Menu projection object
-mouse_down: corrected in relation with previous change in field transforms
-transform_field functions added to the svn
-set_object and keyboard_callback: cleaning

Location:
trunk/src
Files:
10 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_plot_handles.m

    r19 r40  
    5050PlotHandles.min_C_title=handles.min_C_title;
    5151PlotHandles.max_C_title=handles.max_C_title;
    52 PlotHandles.MenuVectors=handles.MenuVectors;
     52%PlotHandles.MenuVectors=handles.MenuVectors;
    5353PlotHandles.MenuEditVectors=handles.MenuEditVectors;
    5454PlotHandles.edit_vect=handles.edit_vect;
  • trunk/src/keyboard_callback.m

    r11 r40  
    2727%     UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
    2828    hlist_object=findobj(huvmat,'Tag','list_object');
    29     ObjIndex=get(hlist_object,'Value');
     29    ObjIndex=get(hlist_object,'Value')
    3030    if ObjIndex>1
    3131        delete_object(ObjIndex)
  • trunk/src/mouse_down.m

    r35 r40  
    3737%test_cal=get(handles.cal,'Value');
    3838test_cal=isequal(MouseAction,'calib');
    39 handles_coord=findobj(huvmat,'Tag','menu_coord');
    40 menu_coord=get(handles_coord,'String');
    41 coord_choice=get(handles_coord,'Value');
     39menu_coord=get(hhuvmat.transform_fct,'String');
     40coord_choice=get(hhuvmat.transform_fct,'Value');
    4241coord_type=menu_coord{coord_choice};
    4342test_edit=isequal(MouseAction,'edit_object');
     
    255254                YCoord=data.Coord(:,2);
    256255            end
    257             hh=findobj('Tag','calib_points')           
     256            hh=findobj('Tag','calib_points');           
    258257            if isempty(hh)
    259258                line(XCoord,YCoord,'Color','m','Tag','calib_points','LineStyle','.','Marker','+');
  • trunk/src/set_object.m

    r2 r40  
    514514oldfile=' ';
    515515huvmat=findobj('Tag','uvmat');
    516 % if isempty(huvmat)
    517 %     huvmat=findobj(allchild(0),'Name','series');
    518 % end
    519516hchild=get(huvmat,'Children');
    520517hrootpath=findobj(hchild,'Tag','RootPath');
     
    525522    end
    526523end
    527 %[FileName,PathName] = uigetfile('*.civ','Select a .civ file',oldfile)
    528524[FileName, PathName, filterindex] = uigetfile( ...
    529525       {'*.xml;*.mat', ' (*.xml,*.mat)';
     
    534530testblank=findstr(fileinput,' ');%look for blanks
    535531if ~isempty(testblank)
    536     errordlg('forbidden input file name: contain blanks')
     532    msgbox_uvmat('ERROR','forbidden input file name: contain blanks')
    537533    return
    538534end
    539535sizf=size(fileinput);
    540 if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end
     536if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
    541537
    542538%read the file
     
    553549if ~isempty(huvmat)
    554550    hhuvmat=guidata(huvmat);
    555 %     set(hhuvmat.POINTS,'Value',0)
    556 %     set(hhuvmat.POINTS,'BackgroundColor',[0 1 0])%put unactivated buttons to green
    557 %     set(hhuvmat.LINE,'Value',0)
    558 %     set(hhuvmat.LINE,'BackgroundColor',[0 1 0])%put unactivated buttons to green
    559 %     set(hhuvmat.PATCH,'Value',0)
    560 %     set(hhuvmat.PATCH,'BackgroundColor',[0 1 0])%put unactivated buttons to green
    561 %     set(hhuvmat.PLANE,'Value',0)
    562 %     set(hhuvmat.PLANE,'BackgroundColor',[0 1 0])%put unactivated buttons to green
    563 %     set(hhuvmat.VOLUME,'Value',0)
    564 %     set(hhuvmat.VOLUME,'BackgroundColor',[0 1 0])%put unactivated buttons to green
    565 %     if ~isequal(title,'MASK')
    566 %         eval(['set(hhuvmat.' title ',''Value'',1)'])
    567 %         eval(['set(hhuvmat.' title ',''BackgroundColor'',[1 1 0])'])
    568 %     end
    569551end
    570552menu=get(handles.TITLE,'String');
  • trunk/src/uvmat.m

    r39 r40  
    202202guidata(hObject, handles);
    203203
    204 dircur=pwd; %current working directory
     204dircur=pwd %current working directory
    205205dir_opening=dircur;
    206206
     
    236236        testexist(ilist)=0;
    237237    end
    238 %     fct_handle{ilist,1}=fullfile(path_uvmat,'transform_field');%path to  the transform functions path_transform;
    239238end
    240239rmpath(fullfile(path_uvmat,'transform_field'))
    241240
    242241%load the list of previously browsed files in menus Open and Open_1
    243  dir_perso=prefdir;
    244  profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     242 dir_perso=prefdir; % path to the directory .matlab for personal data
     243 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmauvmat_perso.mat' in .matlab
    245244 if exist(profil_perso,'file')
    246245      h=load (profil_perso);
     
    297296[errormsg,date_str]=check_functions;%check the path of the functions called by uvmat.m
    298297
    299 %check the path of transform_fct transform
    300 %set(handles.transform_fct,'String',{'';'phys';'px';'more...'})
    301 % path_fct{1}='';
    302 % path_fct{2}=fileparts(path_to_uvmat);
    303 % path_fct{3}=fileparts(path_to_uvmat);
    304 % path_fct{4}=fileparts(path_to_uvmat);
    305 % set(handles.transform_fct,'UserData',path_fct)
    306 
    307298%case of an input argument for uvmat
    308299testinputfield=0;
     
    381372    end
    382373end
    383 
    384 set_vec_col_bar(handles)
     374set_vec_col_bar(handles) %update the display of color code for vectors
    385375
    386376%-------------------------------------------------------------------
     
    33733363    delete(handles.UVMAT_title)
    33743364end
     3365% handles.uvmat
    33753366huvmat=get(handles.create,'parent');
    33763367UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface
    3377 % if (get(handles.LINE,'Value')==1)
    3378     %suppress the other options if MENULINE is chosen
    3379     set(handles.zoom,'Value',0)
    3380     zoom_Callback(hObject, eventdata, handles)
    3381 %     set(handles.create,'Value',0)
    3382 %     set(handles.create,'BackgroundColor',[0 1 0])
    3383 %     set(handles.LINE,'Value',1)
    3384 %     set(handles.LINE,'BackgroundColor',[1 1 0])
    3385 %     set(handles.PATCH,'Value',0)
    3386 %     set(handles.PATCH,'BackgroundColor',[0 1 0])
    3387 %     set(handles.PLANE,'Value',0)
    3388 %     set(handles.PLANE,'BackgroundColor',[0 1 0])%put activated buttons to yellow
    3389 %     set(handles.VOLUME,'Value',0)
    3390 %     set(handles.VOLUME,'BackgroundColor',[0 1 0])
    3391     %et(handles.makemask,'Value',0)
    3392     %makemask_Callback(hObject, eventdata, handles)
    3393     set(handles.edit_vect,'BackgroundColor',[0.7 0.7 0.7])
    3394     set(handles.edit_vect,'Value',0)
    3395     edit_vect_Callback(hObject, eventdata, handles)
    3396     set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
    3397     set(handles.edit,'Value',0)
    3398     set(handles.list_object,'Value',1);
    3399     edit_vect_Callback(hObject, eventdata, handles)
    3400     set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
    3401     set(handles.cal,'Value',0)
    3402     set(handles.cal,'BackgroundColor',[0 1 0])
    3403    % set(handles.grid,'Value',0)
    3404    % set(handles.grid,'BackgroundColor',[0 1 0])
     3368set(handles.zoom,'Value',0)
     3369zoom_Callback(hObject, eventdata, handles)
     3370set(handles.edit_vect,'BackgroundColor',[0.7 0.7 0.7])
     3371set(handles.edit_vect,'Value',0)
     3372edit_vect_Callback(hObject, eventdata, handles)
     3373set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
     3374set(handles.edit,'Value',0)
     3375set(handles.list_object,'Value',1);
     3376edit_vect_Callback(hObject, eventdata, handles)
     3377set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
     3378set(handles.cal,'Value',0)
     3379set(handles.cal,'BackgroundColor',[0 1 0])
    34053380%  initiate the set_object GUI
    3406     data.TITLE='LINE';
    3407     if isfield(UvData,'CoordType')
    3408         data.CoordType=UvData.CoordType;
    3409     end
    3410     if isfield(UvData,'Mesh')&~isempty(UvData.Mesh)
    3411         data.RangeX=UvData.Mesh;
    3412         data.RangeY=UvData.Mesh;
    3413 %         data.YMax=UvData.Mesh;
    3414 %         data.XMax=UvData.Mesh;
    3415         data.DX=UvData.Mesh;
    3416         data.DY=UvData.Mesh;
    3417     elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image
    3418         np=size(UvData.Field.A);
    3419         meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/np(2);
    3420         meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/np(1);
    3421         data.RangeY=max(meshx,meshy);
    3422         data.RangeX=max(meshx,meshy);
    3423 %         data.YMax=max(meshx,meshy);
    3424 %         data.XMax=max(meshx,meshy);
    3425         data.DX=max(meshx,meshy);
    3426     end
    3427     if isfield(data,'DX')
    3428         data.Coord=[[0 0 0];[data.DX 0 0]]; %default
    3429     else
    3430         data.Coord=[[0 0 0];[1 0 0]]; %default
    3431     end
    3432     data.ParentButton=handles.create;
    3433     PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
    3434     [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface with action on haxes,
    3435                                                       % associate the set_edit interface handle to the plotting axes
    3436     pos_uvmat=get(huvmat,'Position');
    3437     if isfield(UvData,'SetObjectOrigin')
    3438         pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
    3439         pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 
    3440         set(hset_object,'Position',pos_set_object)
    3441     end
    3442     list_object=get(handles.list_object,'String');
    3443     if ~isempty(list_object)
    3444         set(handles.list_object,'Value',length(list_object))
    3445     end
    3446      MouseAction='create_object';
    3447 % else
    3448 %     set(handles.LINE,'BackgroundColor',[0 1 0])
    3449 %      MouseAction='none';
    3450 % end
    3451 
     3381data.TITLE='LINE';
     3382if isfield(UvData,'CoordType')
     3383    data.CoordType=UvData.CoordType;
     3384end
     3385if isfield(UvData,'Mesh')&~isempty(UvData.Mesh)
     3386    data.RangeX=UvData.Mesh;
     3387    data.RangeY=UvData.Mesh;
     3388    data.DX=UvData.Mesh;
     3389    data.DY=UvData.Mesh;
     3390elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image
     3391    np=size(UvData.Field.A);
     3392    meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/np(2);
     3393    meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/np(1);
     3394    data.RangeY=max(meshx,meshy);
     3395    data.RangeX=max(meshx,meshy);
     3396    data.DX=max(meshx,meshy);
     3397end
     3398if isfield(data,'DX')
     3399    data.Coord=[[0 0 0];[data.DX 0 0]]; %default
     3400else
     3401    data.Coord=[[0 0 0];[1 0 0]]; %default
     3402end
     3403data.ParentButton=handles.create;
     3404PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     3405[hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface with action on haxes,
     3406                                                  % associate the set_edit interface handle to the plotting axes
     3407pos_uvmat=get(huvmat,'Position');
     3408if isfield(UvData,'SetObjectOrigin')
     3409    pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
     3410    pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 
     3411    set(hset_object,'Position',pos_set_object)
     3412end
     3413list_object=get(handles.list_object,'String');
     3414if ~isempty(list_object)
     3415    set(handles.list_object,'Value',length(list_object))
     3416end
     3417MouseAction='create_object';
    34523418UvData.MouseAction=MouseAction;
    34533419set(huvmat,'UserData',UvData)
     
    40023968coord_option=menu{ind_coord};
    40033969list_transform=get(handles.transform_fct,'UserData');
    4004 ff=functions(list_transform{end}) 
     3970ff=functions(list_transform{end}); 
    40053971if isequal(coord_option,'more...');
    40063972    coord_fct='';
     
    40524018
    40534019%check the current path to the selected function
    4054 func=functions(list_transform{ind_coord});
    4055 set(handles.path_transform,'String',fileparts(func.file)); %show the path to the senlected function
     4020if isa(list_transform{ind_coord},'function_handle')
     4021    func=functions(list_transform{ind_coord});
     4022    set(handles.path_transform,'String',fileparts(func.file)); %show the path to the senlected function
     4023else
     4024    set(handles.path_transform,'String','')
     4025end
    40564026%CurrentPath=fileparts(which(coord_option));
    40574027% if ~isequal(PathName,CurrentPath)
     
    43274297test3color=strcmp(colcode.ColorCode,'rgb') || strcmp(colcode.ColorCode,'bgr');
    43284298if test3color
    4329 %     set(handles.colcode1,'Visible','on')
    4330 %     set(handles.colcode2,'Visible','on')
    4331 %     set(handles.slider1,'Visible','on')
    4332 %     set(handles.slider2,'Visible','on')
    43334299    colcode.colcode1=str2num(get(handles.colcode1,'String'));
    43344300    colcode.colcode2=str2num(get(handles.colcode2,'String'));
    4335 else
    4336 %     set(handles.colcode1,'Visible','off')
    4337 %     set(handles.colcode2,'Visible','off')
    4338 %     set(handles.slider1,'Visible','off')
    4339 %     set(handles.slider2,'Visible','off')
    4340 %     colcode.colcode1=colcode.min;
    4341 %     colcode.colcode2=colcode.max;
    43424301end
    43434302% colcode.option=get(handles.vec_col_bar,'Value');
     
    46524611msgbox_uvmat('CONFIRMATION',{['movie ' aviname ' created '];['with ' num2str(imax) ' frames']})
    46534612
    4654 % --------------------------------------------------------------------
    4655 function MenuPoints_Callback(hObject, eventdata, handles)
    4656 set(handles.create,'Visible','on')
    4657 set(handles.create,'Value',1)
    4658 POINTS_Callback(hObject,eventdata,handles)
    4659 
    4660 % --------------------------------------------------------------------
    4661 function MenuLine_Callback(hObject, eventdata, handles)
    4662 set(handles.create,'Visible','on')
    4663 set(handles.create,'Value',1)
    4664 LINE_Callback(hObject,eventdata,handles)
    4665 
    4666 % ------------------------------------------------------------------
    4667 function MenuPatch_Callback(hObject, eventdata, handles)
    4668 set(handles.create,'Visible','on')
    4669 set(handles.create,'Value',1)
    4670 PATCH_Callback(hObject,eventdata,handles)
    4671 
    4672 % ------------------------------------------------------------------
    4673 function MenuPlane_Callback(hObject, eventdata, handles)
    4674 set(handles.create,'Visible','on')
    4675 set(handles.create,'Value',1)
    4676 PLANE_Callback(hObject,eventdata,handles)
    4677 
    4678 % ------------------------------------------------------------------
    4679 function MenuVolume_Callback(hObject, eventdata, handles)
    4680 set(handles.create,'Visible','on')
    4681 set(handles.create,'Value',1)
    4682 VOLUME_Callback(hObject,eventdata,handles)
    46834613
    46844614% ------------------------------------------------------------------
     
    47704700%----------------------------------------------------------------
    47714701function MenuSeries_Callback(hObject, eventdata, handles)
     4702%-------------------------------------------------------------------
    47724703
    47734704[param.FileName]=read_file_boxes(handles);
     
    48724803set(handles.pycm,'Visible',state)
    48734804
    4874 % --------------------------------------------------------------------
     4805%------------------------------------------------------------------------
    48754806function MenuEditVectors_Callback(hObject, eventdata, handles)
     4807%------------------------------------------------------------------------
    48764808set(handles.edit_vect,'Visible','on')
    48774809set(handles.edit_vect,'Value',1)
    48784810edit_vect_Callback(hObject, eventdata, handles)
    48794811
    4880 
    4881 
    4882 
     4812% --------------------------------------------------------------------
     4813function Menupoints_Callback(hObject, eventdata, handles)
     4814% set(handles.create,'Visible','on')
     4815% set(handles.create,'Value',1)
     4816% POINTS_Callback(hObject,eventdata,handles)
     4817data.Style='points';
     4818data.ProjMode='projection';%default
     4819PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     4820create_object(data,handles.uvmat,PlotHandles)
     4821
     4822% --------------------------------------------------------------------
     4823function Menuline_Callback(hObject, eventdata, handles)
     4824% set(handles.create,'Visible','on')
     4825% set(handles.create,'Value',1)
     4826% LINE_Callback(hObject,eventdata,handles)
     4827data.Style='line';
     4828data.ProjMode='projection';%default
     4829PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     4830create_object(data,handles.uvmat,PlotHandles)
     4831
     4832%------------------------------------------------------------------------
     4833function Menupolyline_Callback(hObject, eventdata, handles)
     4834%------------------------------------------------------------------------
     4835data.Style='polyline';
     4836data.ProjMode='projection';%default
     4837PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     4838create_object(data,handles.uvmat,PlotHandles)
     4839
     4840% ------------------------------------------------------------------
     4841function Menupolygon_Callback(hObject, eventdata, handles)
     4842set(handles.create,'Visible','on')
     4843set(handles.create,'Value',1)
     4844PATCH_Callback(hObject,eventdata,handles)
     4845
     4846%------------------------------------------------------------------------
     4847function Menurectangle_Callback(hObject, eventdata, handles)
     4848%------------------------------------------------------------------------
     4849data.Style='rectangle';
     4850data.ProjMode='inside';%default
     4851PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     4852create_object(data,handles.uvmat,PlotHandles)
     4853
     4854%------------------------------------------------------------------------
     4855function Menuellipse_Callback(hObject, eventdata, handles)
     4856%------------------------------------------------------------------------
     4857data.Style='ellipse';
     4858data.ProjMode='inside';%default
     4859PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     4860create_object(data,handles.uvmat,PlotHandles)
     4861
     4862% ------------------------------------------------------------------
     4863function Menuplane_Callback(hObject, eventdata, handles)
     4864% set(handles.create,'Visible','on')
     4865% set(handles.create,'Value',1)
     4866% PLANE_Callback(hObject,eventdata,handles)
     4867data.Style='plane';
     4868data.ProjMode='projection';%default
     4869PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     4870create_object(data,handles.uvmat,PlotHandles)
     4871
     4872% ------------------------------------------------------------------
     4873function Menuvolume_Callback(hObject, eventdata, handles)
     4874set(handles.create,'Visible','on')
     4875set(handles.create,'Value',1)
     4876VOLUME_Callback(hObject,eventdata,handles)
     4877
     4878%------------------------------------------------------------------------
     4879function MenuBrowseObject_Callback(hObject, eventdata, handles)
     4880%------------------------------------------------------------------------
     4881%get the object file
     4882[FileName, PathName, filterindex] = uigetfile( ...
     4883       {'*.xml;*.mat', ' (*.xml,*.mat)';
     4884       '*.xml',  '.xml files '; ...
     4885        '*.mat',  '.mat matlab files '}, ...
     4886        'Pick a file',get(handles.RootPath,'String'));
     4887fileinput=[PathName FileName];%complete file name
     4888testblank=findstr(fileinput,' ');%look for blanks
     4889if ~isempty(testblank)
     4890    msgbox_uvmat('ERROR','forbidden input file name: contain blanks')
     4891    return
     4892end
     4893sizf=size(fileinput);
     4894if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
     4895
     4896%read the file
     4897 t=xmltree(fileinput);
     4898 data=convert(t);
     4899 if ~isfield(data,'Style')
     4900     data.Style='points';
     4901 end
     4902 if ~isfield(data,'ProjMode')
     4903     data.ProjMode='none';
     4904 end
     4905PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     4906create_object(data,handles.uvmat,PlotHandles)
     4907
     4908%------------------------------------------------------------------------
     4909function create_object(data,huvmat,PlotHandles)
     4910%------------------------------------------------------------------------
     4911hset_object=findobj(allchild(0),'Name','set_object')
     4912if ~isempty(hset_object)
     4913    delete(hset_object)% delete existing version of set_object
     4914end
     4915UvData=get(huvmat,'UserData');
     4916if isfield(UvData,'CoordType')
     4917    data.CoordType=UvData.CoordType;
     4918end
     4919if isfield(UvData,'Mesh')&~isempty(UvData.Mesh)
     4920    data.RangeX=UvData.Mesh;
     4921    data.RangeY=UvData.Mesh;
     4922    data.DX=UvData.Mesh;
     4923    data.DY=UvData.Mesh;
     4924elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image
     4925    np=size(UvData.Field.A);
     4926    meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/np(2);
     4927    meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/np(1);
     4928    data.RangeY=max(meshx,meshy);
     4929    data.RangeX=max(meshx,meshy);
     4930    data.DX=max(meshx,meshy);
     4931end
     4932if isfield(data,'DX')
     4933    data.Coord=[[0 0 0];[data.DX 0 0]]; %default
     4934else
     4935    data.Coord=[[0 0 0];[1 0 0]]; %default
     4936end
     4937%data.ParentButton=handles.create;
     4938
     4939[hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface
     4940UvData.MouseAction='create_object';
     4941set(huvmat,'UserData',UvData)
     4942
     4943
Note: See TracChangeset for help on using the changeset viewer.