Changeset 622 for trunk/src/uvmat.m


Ignore:
Timestamp:
Apr 29, 2013, 11:35:27 AM (11 years ago)
Author:
sommeria
Message:

mouse system for uvmat imrpoved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r620 r622  
    3434%                       .PosGeometryCalib: size of set_object
    3535%                       .NbBuiltin: nbre of functions always displayed in TransformName menu
    36 %          .Object: cell array of structures representing the current projection objects, as produced by 'set_object.m'={[]} by default
     36%          .ProjObject: cell array of structures representing the current projection objects, as produced by 'set_object.m'={[]} by default
    3737%          .NewSeries: =0/1 flag telling whether a new field series has been opened
    3838%          .FileName_1: name of the current second field (used to detect a  constant field during file scanning)
     
    126126%              .Phi, .Theta, .Psi : Euler angles
    127127%              .X,.Y,.U,.V.... : field data projected on the object
    128 %              .IndexObj: index in the list of UvData.Object
     128%              .IndexObj: index in the list of UvData.ProjObject
    129129           %during plotting
    130130%               .plotaxes: handles of the current axes used to plot the  result of field projection on the object
     
    214214set(handles.FieldName,'Value',1)
    215215set(handles.FieldName,'string',{''})
    216 UvData.Object={[]};
     216UvData.ProjObject={[]};
    217217
    218218%% TRANSFORM menu: builtin fcts
     
    18091809function movie_pair_Callback(hObject, eventdata, handles)
    18101810%------------------------------------------------------------------------
     1811
    18111812%% stop movie action if the movie_pair button is off
    18121813if ~get(handles.movie_pair,'value')
     
    20652066check_proj_tps=0;
    20662067if  (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))
    2067     for iobj=1:numel(UvData.Object)
    2068         if isfield(UvData.Object{iobj},'ProjMode')&& strcmp(UvData.Object{iobj}.ProjMode,'interp_tps')
     2068    for iobj=1:numel(UvData.ProjObject)
     2069        if isfield(UvData.ProjObject{iobj},'ProjMode')&& strcmp(UvData.ProjObject{iobj}.ProjMode,'interp_tps')
    20692070            check_proj_tps=1;
    20702071            break
     
    25472548    end
    25482549    % default projection plane
    2549     if isempty(UvData.Object{1})
    2550         UvData.Object{1}.Type='plane';%main plotting plane
    2551         UvData.Object{1}.ProjMode='projection';%main plotting plane
    2552         UvData.Object{1}.DisplayHandle.uvmat=[]; %plane not visible in uvmat
    2553         UvData.Object{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat
     2550    if isempty(UvData.ProjObject{1})
     2551        UvData.ProjObject{1}.Type='plane';%main plotting plane
     2552        UvData.ProjObject{1}.ProjMode='projection';%main plotting plane
     2553        UvData.ProjObject{1}.DisplayHandle.uvmat=[]; %plane not visible in uvmat
     2554        UvData.ProjObject{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat
    25542555    end
    25552556    %% 3D case (menuvolume)
     
    25632564        end
    25642565        if test_set_object% reinitiate the GUI set_object
    2565             delete_object(1);% delete the current projection object in the list UvData.Object, delete its graphic representations and update the list displayed in handles.ListObject and 2
    2566             UvData.Object{1}.NbDim=NbDim;%test for 3D objects
    2567             UvData.Object{1}.RangeZ=UvData.Field.CoordMesh;%main plotting plane
    2568             UvData.Object{1}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
    2569             UvData.Object{1}.Angle=[0 0 0];
    2570             UvData.Object{1}.HandlesDisplay=plot(0,0,'Tag','proj_object');% A REVOIR
    2571             UvData.Object{1}.Name='1-PLANE';
    2572             UvData.Object{1}.enable_plot=1;
    2573             set_object(UvData.Object{1},handles,ZBounds);
     2566            delete_object(1);% delete the current projection object in the list UvData.ProjObject, delete its graphic representations and update the list displayed in handles.ListObject and 2
     2567            UvData.ProjObject{1}.NbDim=NbDim;%test for 3D objects
     2568            UvData.ProjObject{1}.RangeZ=UvData.Field.CoordMesh;%main plotting plane
     2569            UvData.ProjObject{1}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
     2570            UvData.ProjObject{1}.Angle=[0 0 0];
     2571            UvData.ProjObject{1}.HandlesDisplay=plot(0,0,'Tag','proj_object');% A REVOIR
     2572            UvData.ProjObject{1}.Name='1-PLANE';
     2573            UvData.ProjObject{1}.enable_plot=1;
     2574            set_object(UvData.ProjObject{1},handles,ZBounds);
    25742575            set(handles.ListObject,'Value',1);
    25752576            set(handles.ListObject,'String',{'1-PLANE'});
     
    25822583            XmlData=UvData.XmlData{1};
    25832584            if isfield(XmlData,'PlanePos')
    2584                 UvData.Object{1}.Coord=XmlData.PlanePos(UvData.ZIndex,:);
     2585                UvData.ProjObject{1}.Coord=XmlData.PlanePos(UvData.ZIndex,:);
    25852586            end
    25862587            if isfield(XmlData,'PlaneAngle')
    25872588                siz=size(XmlData.PlaneAngle);
    25882589                indangle=min(siz(1),UvData.ZIndex);%take first angle if a single angle is defined (translating scanning)
    2589                 UvData.Object{1}.PlaneAngle=XmlData.PlaneAngle(indangle,:);
     2590                UvData.ProjObject{1}.PlaneAngle=XmlData.PlaneAngle(indangle,:);
    25902591            end
    25912592        elseif isfield(UvData,'ZIndex')
    2592             UvData.Object{1}.ZObject=UvData.ZIndex;
     2593            UvData.ProjObject{1}.ZObject=UvData.ZIndex;
    25932594        end
    25942595    end
     
    26312632        set(handles.ListObject,'Value',1)
    26322633        set(handles.ListObject,'String',{'plane'})
    2633         UvData.Object{1}.Type='plane';%main plotting plane
    2634         UvData.Object{1}.ProjMode='projection';%main plotting plane
    2635         UvData.Object{1}.DisplayHandle.uvmat=[]; %plane not visible in uvmat
    2636         UvData.Object{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat
     2634        UvData.ProjObject{1}.Type='plane';%main plotting plane
     2635        UvData.ProjObject{1}.ProjMode='projection';%main plotting plane
     2636        UvData.ProjObject{1}.DisplayHandle.uvmat=[]; %plane not visible in uvmat
     2637        UvData.ProjObject{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat
    26372638        set(handles.ListObject_1,'Value',1)
    26382639        set(handles.ListObject_1,'String',{'plane'})
    26392640    end
    26402641    IndexObj(1)=get(handles.ListObject_1,'Value');%selected projection object for main view
    2641     if IndexObj(1)> numel(UvData.Object)
     2642    if IndexObj(1)> numel(UvData.ProjObject)
    26422643        IndexObj(1)=1;%select the first object if the selected one does not exist
    26432644        set(handles.ListObject_1,'Value',1)
     
    26822683    for imap=1:numel(IndexObj)
    26832684        iobj=IndexObj(imap);
    2684         if numel(UvData.Object)<iobj
     2685        if numel(UvData.ProjObject)<iobj
    26852686            break
    26862687        end
    2687         [ObjectData,errormsg]=proj_field(UvData.Field,UvData.Object{iobj});% project field on the object
     2688        [ObjectData,errormsg]=proj_field(UvData.Field,UvData.ProjObject{iobj});% project field on the object
    26882689        if ~isempty(errormsg)
    26892690            return
     
    28792880end
    28802881
    2881 %-------------------------------------------------------------------
     2882%------------------------------------------------------------------------
    28822883% --- translate coordinate to matrix index
    2883 %-------------------------------------------------------------------
     2884%------------------------------------------------------------------------
    28842885function [indx,indy]=pos2ind(x0,rangx0,nxy)
    28852886indx=1+round((nxy(2)-1)*(x0-rangx0(1))/(rangx0(2)-rangx0(1)));% index x of pixel 
    28862887indy=1+round((nxy(1)-1)*(y12-rangy0(1))/(rangy0(2)-rangy0(1)));% index y of pixel
    28872888
    2888 
    2889 %-------------------------------------------------------------------
     2889%------------------------------------------------------------------------
    28902890% --- Executes on button press in 'CheckZoom'.
    2891 %-------------------------------------------------------------------
     2891%------------------------------------------------------------------------
    28922892function CheckZoom_Callback(hObject, eventdata, handles)
    28932893
    2894 if (get(handles.CheckZoom,'Value') == 1);
    2895     set(handles.CheckZoom,'BackgroundColor',[1 1 0])
     2894if get(handles.CheckZoom,'Value')
    28962895    set(handles.CheckFixLimits,'Value',1)% propose by default fixed limits for the plotting axes
    2897     set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
    2898 else
    2899     set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
    2900 end
    2901 
    2902 %-------------------------------------------------------------------
     2896    set(handles.CheckZoomFig,'Value',0)%desactivate zoom fig
     2897end
     2898
     2899%------------------------------------------------------------------------
     2900% --- Executes on button press in CheckZoomFig.
     2901%------------------------------------------------------------------------
     2902function CheckZoomFig_Callback(hObject, eventdata, handles)
     2903
     2904if get(handles.CheckZoomFig,'Value')
     2905    set(handles.CheckZoom,'value',0)
     2906end
     2907
     2908%------------------------------------------------------------------------
    29032909% --- Executes on button press in 'CheckFixLimits'.
    2904 %-------------------------------------------------------------------
     2910%------------------------------------------------------------------------
    29052911function CheckFixLimits_Callback(hObject, eventdata, handles)
    2906 test=get(handles.CheckFixLimits,'Value');
    2907 if test
    2908     set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
    2909 else
    2910     set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
     2912
     2913if ~get(handles.CheckFixLimits,'Value')
    29112914    update_plot(handles);
    29122915end
    29132916
    2914 %-------------------------------------------------------------------
     2917%------------------------------------------------------------------------
    29152918% --- Executes on button press in CheckFixAspectRatio.
    29162919function CheckFixAspectRatio_Callback(hObject, eventdata, handles)
    2917 %-------------------------------------------------------------------
     2920%------------------------------------------------------------------------
     2921
    29182922if get(handles.CheckFixAspectRatio,'Value')
    2919 %     set(handles.CheckFixAspectRatio,'BackgroundColor',[1 1 0])
    29202923    update_plot(handles);
    29212924else
    2922 %     set(handles.CheckFixAspectRatio,'BackgroundColor',[0.7 0.7 0.7])
    29232925    update_plot(handles);
    29242926end
    29252927
    2926 %-------------------------------------------------------------------
     2928%------------------------------------------------------------------------
    29272929function num_AspectRatio_Callback(hObject, eventdata, handles)
    2928 %-------------------------------------------------------------------
     2930%------------------------------------------------------------------------
    29292931set(handles.CheckFixAspectRatio,'Value',1)% select the fixed aspect ratio button
    2930 % set(handles.CheckFixAspectRatio,'BackgroundColor',[1 1 0])% mark in yellow
    29312932update_plot(handles);
    2932 %-------------------------------------------------------------------
    2933 
    2934 %-------------------------------------------------------------------
    2935 
    2936 
    2937 
    2938 %-------------------------------------------------------------------
     2933
     2934%------------------------------------------------------------------------
    29392935%----Executes on button press in 'record': records the current flags of manual correction.
    2940 %-------------------------------------------------------------------
     2936%------------------------------------------------------------------------
    29412937function record_Callback(hObject, eventdata, handles)
    2942 % [filebase,num_i1,num_j1,num_i2,num_j2,Ext,NomType,SubDir]=read_input_file(handles);
     2938
    29432939[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    29442940FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    2945 %FileName=read_file_boxes(handles);
    29462941[erread,message]=fileattrib(FileName);
    29472942if ~isempty(message) && ~isequal(message.UserWrite,1)
     
    32333228end
    32343229
    3235 %---------------------------------------------------
     3230%----------------------------------------------------------------
    32363231% --- Executes on menu selection FieldName
    32373232function FieldName_1_Callback(hObject, eventdata, handles)
     
    34523447
    34533448
    3454 %-----------------------------------------------------------------------
     3449%------------------------------------------------------------------------
    34553450% --- reset civ buttons
    34563451function reset_vel_type(handles_civ0,handle1)
    3457 %-----------------------------------------------------------------------
     3452%------------------------------------------------------------------------
    34583453for ibutton=1:length(handles_civ0)
    34593454    set(handles_civ0(ibutton),'BackgroundColor',[0.831 0.816 0.784])
     
    35463541yi=0.5:npy-0.5;
    35473542[Xi,Yi]=meshgrid(xi,yi);
    3548 if isfield(UvData,'Object')
    3549     for iobj=1:length(UvData.Object)
    3550         ObjectData=UvData.Object{iobj};
     3543if isfield(UvData,'ProjObject')
     3544    for iobj=1:length(UvData.ProjObject)
     3545        ObjectData=UvData.ProjObject{iobj};
    35513546        if isfield(ObjectData,'ProjMode') &&(isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside'));
    35523547            flagobj=1;
     
    36183613image(imflag);
    36193614
    3620 %-------------------------------------------------------------------
    3621 %-------------------------------------------------------------------
     3615%------------------------------------------------------------------------
     3616%------------------------------------------------------------------------
    36223617%  - FUNCTIONS FOR SETTING PLOTTING PARAMETERS
    36233618
    3624 %------------------------------------------------------------------
    3625 %-------------------------------------------------------------
     3619%------------------------------------------------------------------------
     3620%------------------------------------------------------------------------
    36263621% --- Executes on selection change in TransformName.
    36273622
    36283623function TransformName_Callback(hObject, eventdata, handles)
    3629 %-------------------------------------------------------------
     3624%------------------------------------------------------------------------
    36303625UvData=get(handles.uvmat,'UserData');
    36313626menu=get(handles.TransformName,'String');refresh
     
    37493744        delete(hhh)
    37503745    end
    3751 %     if isfield(UvData,'Object')
    3752 %         UvData.Object=UvData.Object(1);
    3753 %     end
    37543746    set(handles.ListObject,'Value',1)
    37553747    set(handles.ListObject,'String',{''})
     
    37623754    set(handles.edit_object,'Value',0)
    37633755    edit_object_Callback(hObject, eventdata, handles)
    3764     UvData.Object={[]};
     3756    UvData.ProjObject={[]};
    37653757end
    37663758set(handles.uvmat,'UserData',UvData)
     
    39173909%------------------------------------------------------------------------
    39183910% --- Executes on selection change in CheckDecimate4 (nb_vec/4).
     3911%------------------------------------------------------------------------
    39193912function CheckDecimate4_Callback(hObject, eventdata, handles)
    3920 %------------------------------------------------------------------------
     3913
    39213914if isequal(get(handles.CheckDecimate4,'Value'),1)
    39223915    set(handles.CheckDecimate16,'Value',0)
     
    39263919%------------------------------------------------------------------------
    39273920% --- Executes on selection change in CheckDecimate16 (nb_vec/16).
     3921%------------------------------------------------------------------------
    39283922function CheckDecimate16_Callback(hObject, eventdata, handles)
    3929 %------------------------------------------------------------------------
     3923
    39303924if isequal(get(handles.CheckDecimate16,'Value'),1)
    39313925    set(handles.CheckDecimate4,'Value',0)
     
    41324126list_str=get(handles.ListObject,'String');
    41334127UvData=get(handles.uvmat,'UserData');
    4134 ObjectData=UvData.Object{get(handles.ListObject_1,'Value')};
     4128ObjectData=UvData.ProjObject{get(handles.ListObject_1,'Value')};
    41354129
    41364130%% update the projection plot on uvmat
     
    41394133%replot all the objects within the new projected field
    41404134for IndexObj=1:numel(list_str)
    4141         hobject=UvData.Object{IndexObj}.DisplayHandle.uvmat;
     4135        hobject=UvData.ProjObject{IndexObj}.DisplayHandle.uvmat;
    41424136        if isempty(hobject) || ~ishandle(hobject)
    41434137            hobject=handles.PlotAxes;
     
    41484142            objectcolor='b';
    41494143        end
    4150         UvData.Object{IndexObj}.DisplayHandle.uvmat=plot_object(UvData.Object{IndexObj},ObjectData,hobject,objectcolor);%draw the object in uvmat     
     4144        UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=plot_object(UvData.ProjObject{IndexObj},ObjectData,hobject,objectcolor);%draw the object in uvmat     
    41514145end
    41524146set(handles.uvmat,'UserData',UvData)
     
    41774171%% The object  is displayed in set_object if this GUI is already opened
    41784172UvData=get(handles.uvmat,'UserData');
    4179 ObjectData=UvData.Object{IndexObj};
     4173ObjectData=UvData.ProjObject{IndexObj};
    41804174hset_object=findobj(allchild(0),'tag','set_object');
    41814175if ~isempty(hset_object)
     
    42194213
    42204214%% update the color of the graphic object representation: the selected object in magenta, others in blue
    4221 update_object_color(handles.PlotAxes,hhview_field.PlotAxes,UvData.Object{IndexObj}.DisplayHandle.uvmat)
     4215update_object_color(handles.PlotAxes,hhview_field.PlotAxes,UvData.ProjObject{IndexObj}.DisplayHandle.uvmat)
    42224216
    42234217%------------------------------------------------------------------------
     
    43134307    list_object=get(handles.ListObject,'String');
    43144308    UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    4315     UvData.Object{IndexObj}.Name=list_object{IndexObj};
    4316     if numel(UvData.Object)<IndexObj;% error in UvData
     4309    UvData.ProjObject{IndexObj}.Name=list_object{IndexObj};
     4310    if numel(UvData.ProjObject)<IndexObj;% error in UvData
    43174311        msgbox_uvmat('ERROR','invalid object list')
    43184312        return
     
    43244318    end
    43254319%     set(handles.ListObject_1,'Value',IndexObj);%restore ListObject selection after set_object deletion
    4326     data=UvData.Object{IndexObj};
     4320    data=UvData.ProjObject{IndexObj};
    43274321    if ~isfield(data,'Type')% default plane
    43284322        data.Type='plane';
     
    43744368    IndexObj=get(handles.ListObject,'Value');
    43754369    UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    4376     if numel(UvData.Object)<IndexObj(end);% error in UvData
     4370    if numel(UvData.ProjObject)<IndexObj(end);% error in UvData
    43774371        msgbox_uvmat('ERROR','invalid object list')
    43784372        return
     
    43844378    end
    43854379    set(handles.ListObject,'Value',IndexObj);%restore ListObject selection after set_object deletion
    4386     if ~isfield(UvData.Object{IndexObj(1)},'Type')% default plane
    4387         UvData.Object{IndexObj(1)}.Type='plane';
     4380    if ~isfield(UvData.ProjObject{IndexObj(1)},'Type')% default plane
     4381        UvData.ProjObject{IndexObj(1)}.Type='plane';
    43884382    end
    43894383    list_object=get(handles.ListObject,'String');
    4390     UvData.Object{IndexObj(end)}.Name=list_object{IndexObj(end)};
     4384    UvData.ProjObject{IndexObj(end)}.Name=list_object{IndexObj(end)};
    43914385   
    43924386    %% show the projection of the selected object on view_field
    4393     ProjData= proj_field(UvData.Field,UvData.Object{IndexObj});%project the current field on ObjectData
     4387    ProjData= proj_field(UvData.Field,UvData.ProjObject{IndexObj});%project the current field on ObjectData
    43944388    hview_field=findobj(allchild(0),'tag','view_field');
    43954389    if isempty(hview_field)
     
    44254419%------------------------------------------------------------------------
    44264420% --- Executes on button press in delete_object.
     4421%------------------------------------------------------------------------
    44274422function delete_object_Callback(hObject, eventdata, handles)
    4428 %------------------------------------------------------------------------
     4423
    44294424IndexObj=get(handles.ListObject,'Value');%projection object selected for view_field
    44304425IndexObj_1=get(handles.ListObject_1,'Value');%projection object selected for uvmat plot
    44314426if IndexObj>1 && ~isequal(IndexObj,IndexObj_1) % do not delete the object used for the uvmat plot
    44324427    delete_object(IndexObj)
     4428end
     4429
     4430%'delete_object': delete a projection object, defined by its index in the Uvmat list or by its graphic handle
     4431%------------------------------------------------------------------------
     4432% function delete_object(hObject)
     4433%
     4434% INPUT:
     4435% hObject: object index (if integer) or handle of the graphic object. If
     4436%          hObject is a subobject, the parent object is detected and deleted.
     4437
     4438function delete_object(IndexObj)
     4439
     4440huvmat=findobj('tag','uvmat');%handles of the uvmat interface
     4441UvData=get(huvmat,'UserData');
     4442hlist_object=findobj(huvmat,'Tag','ListObject');%handles of the object list in the uvmat interface
     4443list_str=get(hlist_object,'String');%objet list
     4444% if isequal(floor(hObject),hObject) %case of an index
     4445    if  ~isempty(UvData) && isfield(UvData, 'ProjObject') && length(UvData.ProjObject)>=IndexObj
     4446        if isfield(UvData.ProjObject{IndexObj},'DisplayHandle') && isfield(UvData.ProjObject{IndexObj}.DisplayHandle,'uvmat')
     4447            hdisplay=UvData.ProjObject{IndexObj}.DisplayHandle.uvmat;
     4448            for iview=1:length(hdisplay)
     4449                if ishandle(hdisplay(iview)) && ~isequal(hdisplay(iview),0)
     4450                    ObjectData=get(hdisplay(iview),'UserData');
     4451                    if isfield(ObjectData,'SubObject') & ishandle(ObjectData.SubObject)
     4452                        delete(ObjectData.SubObject);
     4453                    end
     4454                    if isfield(ObjectData,'DeformPoint') & ishandle(ObjectData.DeformPoint)
     4455                        delete(ObjectData.DeformPoint);
     4456                    end
     4457                    delete(hdisplay(iview))
     4458                end
     4459                ishandle(hdisplay(iview))
     4460            end
     4461            for iobj=IndexObj+1:length(UvData.ProjObject)
     4462                hdisplay=UvData.ProjObject{iobj}.DisplayHandle.uvmat;
     4463                for iview=1:length(hdisplay)
     4464                    if ishandle(hdisplay(iview)) && ~isequal(hdisplay(iview),0)
     4465                        PlotData=get(hdisplay(iview),'UserData');
     4466                        PlotData.IndexObj=iobj-1;
     4467                        set(hdisplay(iview),'UserData',PlotData);
     4468                    end
     4469                end
     4470            end
     4471        end
     4472        UvData.ProjObject(IndexObj)=[]; 
     4473        if ~isempty(list_str)
     4474            list_str(IndexObj)=[];
     4475        end
     4476    end
     4477% elseif ishandle(hObject)%object handle
     4478%     userdata=get(hObject,'UserData');
     4479%     if ishandle(userdata)%the selected line depends on a parent line
     4480%         hdisplay=userdata;% the parent object becomes the current one
     4481%     else
     4482%         hdisplay=hObject;% the selected object becomes the current one
     4483%     end
     4484%     PlotData=get(hdisplay,'UserData');
     4485%     if isfield(PlotData,'SubObject') & ishandle(PlotData.SubObject)
     4486%             delete(PlotData.SubObject);
     4487%     end
     4488%     if isfield(PlotData,'DeformPoint') & ishandle(PlotData.DeformPoint)
     4489%            delete(PlotData.DeformPoint);
     4490%     end
     4491%     delete(hdisplay);
     4492%     if isfield(PlotData,'IndexObj')
     4493%         IndexObj=PlotData.IndexObj;
     4494%         if  isequal(round(IndexObj),IndexObj) & IndexObj>=1 & length(list_str) > IndexObj
     4495%             if isfield(UvData,'ProjObject')& length(UvData.ProjObject) > IndexObj
     4496%                UvData.ProjObject(IndexObj)=[];
     4497%             end
     4498%             list_str(IndexObj)=[];
     4499%         end
     4500%     end
     4501% end
     4502set(huvmat,'UserData',UvData);
     4503set(hlist_object,'String',list_str)
     4504set(hlist_object,'Value',length(list_str))
     4505hlist_object_1=findobj(huvmat,'Tag','ListObject_1');%handles of the first object list in the uvmat interface
     4506old_index=get(hlist_object_1,'Value');
     4507set(hlist_object_1,'String',list_str)
     4508if IndexObj<=old_index
     4509    set(hlist_object_1,'Value',old_index-1)
    44334510end
    44344511
     
    45994676aviobj=close(aviobj);
    46004677UvData=rmfield(UvData,'plotaxes');
    4601 %UvData.Object{1}.plotaxes=handles.PlotAxes;
    46024678set(huvmat,'UserData',UvData);
    46034679msgbox_uvmat('CONFIRMATION',{['movie ' aviname ' created '];['with ' num2str(imax) ' frames']})
     
    46884764function create_object(data,handles)
    46894765%------------------------------------------------------------------------
    4690 % desactivate geometric calibration if opened
    4691 hgeometry_calib=findobj(allchild(0),'tag','geometry_calib');
     4766%% desactivate concurrent tools
     4767hgeometry_calib=findobj(allchild(0),'tag','geometry_calib');% search the GUI geometric calibration
    46924768if ishandle(hgeometry_calib)
    46934769    hhgeometry_calib=guidata(hgeometry_calib);
    46944770    set(hhgeometry_calib.edit_append,'Value',0)% desactivate mouse action in geometry_calib
    4695     set(hhgeometry_calib.edit_append,'BackgroundColor',[0.7 0.7 0.7])
    4696 end
    4697 set(handles.edit_object,'Value',0); %suppress the object edit mode
    4698 set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 
     4771end
     4772set(handles.edit_object,'Value',0)  %desactivate the object edit mode
     4773set(handles.CheckZoomFig,'Value',0) %desactivate zoom sub fig
     4774set(handles.CheckZoom,'Value',0)    %desactivate the zoom action
     4775if ishandle(handles.UVMAT_title)
     4776    delete(handles.UVMAT_title)     %delete the initial display of uvmat if no field has been entered yet
     4777end
     4778
     4779%% append a new line to the list of projection objects
    46994780ListObject=get(handles.ListObject,'String');
    47004781if isempty(ListObject)
     
    47084789set(handles.ListObject,'Value',IndexObj)
    47094790UvData=get(handles.uvmat,'UserData');
    4710 UvData.Object{IndexObj}=[]; %create a new empty object
    4711 UvData.Object{IndexObj}.DisplayHandle.uvmat=handles.PlotAxes; % axes for plot_object
    4712 UvData.Object{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
     4791UvData.ProjObject{IndexObj}=[]; %create a new empty object
     4792UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=handles.PlotAxes; % axes for plot_object
     4793UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
     4794set(handles.uvmat,'UserData',UvData)
     4795
     4796%% initiate the new projection object
    47134797data.Name=data.Type;% default name=type
    47144798data.Coord=[0 0]; %default
     
    47244808        data.DX=UvData.Field.CoordMesh;
    47254809        data.DY=UvData.Field.CoordMesh;
     4810        if strcmp(data.Type,'rectangle')||strcmp(data.Type,'ellipse')
     4811            data.RangeX=UvData.Field.CoordMesh;
     4812            data.RangeY=UvData.Field.CoordMesh;
     4813        end
    47264814    end
    47274815    if isfield(Field,'NbDim')&& isequal(Field.NbDim,3)
     
    47324820    end
    47334821end
    4734 if ishandle(handles.UVMAT_title)
    4735     delete(handles.UVMAT_title)%delete the initial display of uvmat if no field has been entered
    4736 end
    4737 hset_object=set_object(data,handles);% call the set_object interface
    4738 hhset_object=guidata(hset_object);
     4822hset_object=set_object(data,handles);% call the GUI set_object
    47394823hchild=get(hset_object,'children');
    47404824set(hchild,'enable','on')
    4741 set(handles.uvmat,'UserData',UvData)
    4742 set(handles.CheckZoom,'Value',0) %desactivate the zoom for object creation by the mouse
    4743 CheckZoom_Callback(handles.uvmat, [], handles)
     4825
     4826
    47444827set(handles.delete_object,'Visible','on')
    47454828
     
    47714854
    47724855UvData=get(handles.uvmat,'UserData');
    4773 UvData.Object{IndexObj}=[]; %create a new empty object
    4774 UvData.Object{IndexObj}.DisplayHandle.uvmat=[]; %no plot handle before plot_field operation
    4775 UvData.Object{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
     4856UvData.ProjObject{IndexObj}=[]; %create a new empty object
     4857UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=[]; %no plot handle before plot_field operation
     4858UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
    47764859set(handles.uvmat,'UserData',UvData)
    47774860set(handles.ListObject,'Value',IndexObj)
     
    48424925
    48434926%% read lines currently drawn
    4844 ListObj=UvData.Object;
     4927ListObj=UvData.ProjObject;
    48454928select=zeros(1,numel(ListObj));
    48464929for iobj=1:numel(ListObj);
     
    48554938else
    48564939    set(handles.ListObject,'Value',val);% show the selected lines on the list
    4857     ObjectData=UvData.Object(val);
     4940    ObjectData=UvData.ProjObject(val);
    48584941    for iobj=1:length(ObjectData)
    48594942%         if isfield(ObjectData{iobj},'Coord')
     
    49625045%------------------------------------------------------------------------
    49635046UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    4964 ListObj=UvData.Object;
     5047ListObj=UvData.ProjObject;
    49655048select=zeros(1,numel(ListObj));
    49665049for iobj=1:numel(ListObj);
     
    49815064    yi=0.5:npy-0.5;
    49825065    [Xi,Yi]=meshgrid(xi,yi);
    4983 %     if isfield(UvData,'Object')
    4984         for iobj=1:length(UvData.Object)
    4985             ObjectData=UvData.Object{iobj};
     5066        for iobj=1:length(UvData.ProjObject)
     5067            ObjectData=UvData.ProjObject{iobj};
    49865068            if isfield(ObjectData,'ProjMode') &&(isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside'));
    49875069                flagobj=1;
     
    53075389
    53085390
    5309 % --- Executes on button press in CheckZoomFig.
    5310 function CheckZoomFig_Callback(hObject, eventdata, handles)
    5311 % hObject    handle to CheckZoomFig (see GCBO)
    5312 % eventdata  reserved - to be defined in a future version of MATLAB
    5313 % handles    structure with handles and user data (see GUIDATA)
    5314 
    5315 % Hint: get(hObject,'Value') returns toggle state of CheckZoomFig
Note: See TracChangeset for help on using the changeset viewer.