Home > . > plot_object.m

# plot_object

## PURPOSE

'plot_object': draws a projection object (points, line, plane...)

## SYNOPSIS

function [hh]=plot_object(ObjectDataIn,ProjObject,hplot,col)

## DESCRIPTION

    'plot_object': draws a projection object (points, line, plane...)
    -------------------------------------------------------------------
     function [ObjectData_out,hh]=plot_object(ObjectData,hplot,col)

    OUTPUT
                 hh: handles of the graphic object (core part)

    INPUT:

     ObjectDataIn: structure representing the object properties:
            .Style : style of projection object
            .Coord: set of coordinates defining the object position;
            .ProjMode=type of projection ;
           .ProjAngle=angle of projection;
           .DX,.DY,.DZ=increments;
           .YMax,YMin: min and max Y
     ProjObject: projection object corresponding to the current plot (e. g. plane)
     hplot: handle of the object plot to modify or if it is an axis, the axis
                where the object must be plotted, or if it is a figure the plotting figure
     col: color of the plot, e;g; 'm', 'b' ..;

## CROSS-REFERENCE INFORMATION

This function calls:

- warndlg_uvmat 'warndlg_uvmat': display warning message (error, warning, confirmation) in a given figure

This function is called by:

- mouse_down 'mouse_down': function activated when the mouse button is pressed on a figure (callback for 'WindowButtonDownFcn'
- mouse_motion 'mouse_motion': permanently called by mouse motion over a figure (Callback for 'WindowButtonMotionFcn' of the figure)
- probe_calib 'probe_calib': performs geometric calibration from a set of reference points
- update_obj 'update_obj': update the object graph representation and its projection field, record it in the uvmat interface
- uvmat 'uvmat': function associated with the GUI 'uvmat.fig' for images and data field visualization

## SOURCE CODE

    0001 %'plot_object': draws a projection object (points, line, plane...)
    0002 %-------------------------------------------------------------------
    0003 % function [ObjectData_out,hh]=plot_object(ObjectData,hplot,col)
    0004 %
    0005 %OUTPUT
    0006 %             hh: handles of the graphic object (core part)
    0007 %
    0008 %INPUT:
    0009 %
    0010 % ObjectDataIn: structure representing the object properties:
    0011 %        .Style : style of projection object
    0012 %        .Coord: set of coordinates defining the object position;
    0013 %        .ProjMode=type of projection ;
    0014 %       .ProjAngle=angle of projection;
    0015 %       .DX,.DY,.DZ=increments;
    0016 %       .YMax,YMin: min and max Y
    0017 % ProjObject: projection object corresponding to the current plot (e. g. plane)
    0018 % hplot: handle of the object plot to modify or if it is an axis, the axis
    0019 %            where the object must be plotted, or if it is a figure the plotting figure
    0020 % col: color of the plot, e;g; 'm', 'b' ..;
    0021
    0022 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    0023 %  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
    0024 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    0025 %     This file is part of the toolbox UVMAT.
    0026 %
    0027 %     UVMAT is free software; you can redistribute it and/or modify
    0028 %     it under the terms of the GNU General Public License as published by
    0029 %     the Free Software Foundation; either version 2 of the License, or
    0030 %     (at your option) any later version.
    0031 %
    0032 %     UVMAT is distributed in the hope that it will be useful,
    0033 %     but WITHOUT ANY WARRANTY; without even the implied warranty of
    0034 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0035 %     GNU General Public License (file UVMAT/COPYING.txt) for more details.
    0036 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    0037
    0038 function [hh]=plot_object(ObjectDataIn,ProjObject,hplot,col)
    0039 hh=[];%default output
    0040 if isequal(ProjObject,ObjectDataIn)% object representation does not appear in its own projection plot
    0041     return
    0042 end
    0043 if ~isfield(ProjObject,'Style')
    0044     ObjectData=ObjectDataIn;
    0045 elseif isequal(ProjObject.Style,'plane')
    0046     ObjectData=ObjectDataIn;% TODO: modify take into account rotation of axis
    0047 else
    0048     return % no object representation yet available
    0049 end
    0050 if ~isfield(ObjectData,'Style')|isempty(ObjectData.Style)|~ischar(ObjectData.Style)
    0051     warndlg_uvmat('undefined ObjectData.Style in plot_object.m','ERROR')
    0052     return
    0053 end
    0054 if ~isfield(ObjectData,'Style')|isempty(ObjectData.Style)|~ischar(ObjectData.Style)
    0055     warndlg_uvmat('undefined ObjectData.Style in plot_object.m','ERROR')
    0056     return
    0057 end
    0058 XMin=0;%default
    0059 XMax=0;
    0060 YMin=0;
    0061 YMax=0;
    0062 ZMin=0;
    0063 ZMax=0;
    0064
    0065 %determine the plotting axes (with handle 'haxes')
    0066 test_newobj=1;
    0067 if ishandle(hplot)
    0068     if isequal(get(hplot,'Tag'),'proj_object')
    0069         test_newobj=0;
    0070         haxes=get(hplot,'parent');
    0071     elseif isequal(get(hplot,'Type'),'axes')
    0072         axes(hplot)
    0073         haxes=hplot;
    0074     elseif isequal(get(hplot,'Type'),'figure')
    0075         figure(hplot);%set the input figure as the current one
    0076         haxes=findobj(hplot,'Type','axes');%look for axes in the figure
    0077         haxes=haxes(1);
    0078         axes(haxes); %set the first found axis as the current one
    0079     else
    0080         figure; %create new figure
    0081         hplot=axes;%create new axes
    0082         haxes=hplot;
    0083     end
    0084 else
    0085     figure; %create new figure
    0086     hplot=axes;%create new axes
    0087     haxes=hplot;
    0088 end
    0089
    0090 %default input parameters
    0091 if ~isfield(ObjectData,'ProjMode')|isempty(ObjectData.ProjMode)
    0092      ObjectData.ProjMode='projection';%default
    0093 end
    0094 if ~isfield(ObjectData,'Coord')|isempty(ObjectData.Coord)
    0095      ObjectData.Coord=[0 0 0];%default
    0096 end
    0097 if ~isfield(ObjectData,'Phi')|isempty(ObjectData.Phi)
    0098      ObjectData.Phi=0;%default
    0099 end
    0100 if ~isfield(ObjectData,'Range')
    0101     ObjectData.Range(1,1)=0; %edfault
    0102 end
    0103 if size(ObjectData.Range,2)>=2
    0104     YMax=ObjectData.Range(1,2);%default
    0105 end
    0106 if size(ObjectData.Range,2)>=2 & size(ObjectData.Range,1)>=2
    0107     YMin=ObjectData.Range(2,2);
    0108 else
    0109     YMin=0;
    0110 end
    0111 XMax=ObjectData.Range(1,1);
    0112 if size(ObjectData.Range,1)>=2
    0113     XMin=ObjectData.Range(2,1);
    0114 end
    0115 if isfield(ObjectData,'RangeX')
    0116    XMax=max(ObjectData.RangeX);
    0117    XMin=min(ObjectData.RangeX);
    0118 end
    0119 if isfield(ObjectData,'RangeY')
    0120    YMax=max(ObjectData.RangeY);
    0121    YMin=min(ObjectData.RangeY);
    0122 end
    0123 if isfield(ObjectData,'RangeZ')
    0124    ZMax=max(ObjectData.RangeZ);
    0125    ZMin=min(ObjectData.RangeZ);
    0126 end
    0127 if isequal(ObjectData.Style,'points')&isequal(ObjectData.ProjMode,'projection')
    0128     YMax=max(XMax,YMax);
    0129     YMax=max(YMax,ZMax);
    0130 elseif isequal(ObjectData.Style,'rectangle')|isequal(ObjectData.Style,'ellipse')|isequal(ObjectData.Style,'volume')
    0131     if  isequal(YMax,0)
    0132         ylim=get(haxes,'YLim');
    0133         YMax=(ylim(2)-ylim(1))/100;
    0134     end
    0135     if isequal(XMax,0)
    0136         XMax=YMax;%default
    0137     end
    0138 elseif isequal(ObjectData.Style,'plane')
    0139    if  isequal(XMax,0)
    0140         xlim=get(haxes,'XLim');
    0141         XMax=xlim(2);
    0142    end
    0143    if  isequal(YMax,0)
    0144         ylim=get(haxes,'YLim');
    0145         YMax=ylim(2);
    0146    end
    0147 end
    0148 sizcoord=size(ObjectData.Coord);
    0149
    0150 %determine the coordinates xline, yline,xsup,xinf, yinf,ysup determining the new object plot
    0151 test_line= isequal(ObjectData.Style,'points')|isequal(ObjectData.Style,'line')|isequal(ObjectData.Style,'polyline')|...
    0152     isequal(ObjectData.Style,'polygon')| isequal(ObjectData.Style,'plane')| isequal(ObjectData.Style,'volume');
    0153 test_patch=isequal(ObjectData.ProjMode,'inside')||isequal(ObjectData.ProjMode,'outside')||isequal(ObjectData.Style,'volume')...
    0154     ||isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside');
    0155 if test_line
    0156     xline=ObjectData.Coord(:,1);
    0157     yline=ObjectData.Coord(:,2);
    0158     if isequal(ObjectData.Style,'polygon')
    0159         xline=[xline; ObjectData.Coord(1,1)];%closing the line
    0160         yline=[yline; ObjectData.Coord(1,2)];
    0161     elseif isequal(ObjectData.Style,'plane')| isequal(ObjectData.Style,'volume')
    0162         phi=ObjectData.Phi*pi/180;%angle in radians
    0163         Xend_x=xline(1)+XMax*cos(phi);
    0164         Xend_y=yline(1)+XMax*sin(phi);
    0165         Xbeg_x=xline(1)+XMin*cos(phi);
    0166         Xbeg_y=yline(1)+XMin*sin(phi);
    0167         Yend_x=xline(1)-YMax*sin(phi);
    0168         Yend_y=yline(1)+YMax*cos(phi);
    0169         Ybeg_x=xline(1)-YMin*sin(phi);
    0170         Ybeg_y=yline(1)+YMin*cos(phi);
    0171         xline=[Xbeg_x Xend_x NaN Ybeg_x Yend_x];
    0172         yline=[Xbeg_y Xend_y NaN Ybeg_y Yend_y];
    0173     end
    0174     SubLineStyle='none';%default
    0175     if isfield(ObjectData,'ProjMode')
    0176         if isequal(ObjectData.ProjMode,'projection')
    0177             SubLineStyle='--'; %range of projection marked by dash
    0178             if isfield (ObjectData,'DX')
    0179                rmfield(ObjectData,'DX');
    0180             end
    0181             if isfield (ObjectData,'DY')
    0182                rmfield(ObjectData,'DY');
    0183             end
    0184         elseif isequal(ObjectData.ProjMode,'filter')
    0185             SubLineStyle=':';%range of projection not visible
    0186         end
    0187     end
    0188     if isequal(ObjectData.Style,'line')|isequal(ObjectData.Style,'polyline')|isequal(ObjectData.Style,'polygon')
    0189         if length(xline)<2
    0190             theta=0;
    0191         else
    0192             theta=angle(diff(xline)+i*diff(yline));
    0193             theta(length(xline))=theta(length(xline)-1);
    0194         end
    0195         xsup(1)=xline(1)+YMax*sin(theta(1));
    0196         xinf(1)=xline(1)-YMax*sin(theta(1));
    0197         ysup(1)=yline(1)-YMax*cos(theta(1));
    0198         yinf(1)=yline(1)+YMax*cos(theta(1));
    0199         for ip=2:length(xline)
    0200             xsup(ip)=xline(ip)+YMax*sin((theta(ip)+theta(ip-1))/2)/cos((theta(ip-1)-theta(ip))/2);
    0201             xinf(ip)=xline(ip)-YMax*sin((theta(ip)+theta(ip-1))/2)/cos((theta(ip-1)-theta(ip))/2);
    0202             ysup(ip)=yline(ip)-YMax*cos((theta(ip)+theta(ip-1))/2)/cos((theta(ip-1)-theta(ip))/2);
    0203             yinf(ip)=yline(ip)+YMax*cos((theta(ip)+theta(ip-1))/2)/cos((theta(ip-1)-theta(ip))/2);
    0204         end
    0205     end
    0206 end
    0207
    0208 %shading image
    0209 if test_patch
    0210     npMx=512;
    0211     npMy=512;
    0212     flag=zeros(npMy,npMx);
    0213     if isequal(ObjectData.Style,'ellipse')
    0214         XimaMin=ObjectData.Coord(1,1)-XMax;
    0215         XimaMax=ObjectData.Coord(1,1)+XMax;
    0216         YimaMin=ObjectData.Coord(1,2)-YMax;
    0217         YimaMax=ObjectData.Coord(1,2)+YMax;
    0218         xlim=[1.2*XimaMin-0.2*XimaMax 1.2*XimaMax-0.2*XimaMin];%create an image around the ellipse
    0219         ylim=[1.2*YimaMin-0.2*YimaMax 1.2*YimaMax-0.2*YimaMin];
    0220         scale_x=2*1.4*XMax/npMx;
    0221         scale_y=2*1.4*YMax/npMy;
    0222         xi=[0.5:npMx-0.5]*scale_x+xlim(1);
    0223         yi=[0.5:npMy-0.5]*scale_y+ylim(1);
    0224         [Xi,Yi]=meshgrid(xi,yi);
    0225         X2Max=XMax*XMax;
    0226         Y2Max=YMax*YMax;
    0227         distX=(Xi-ObjectData.Coord(1,1));
    0228         distY=(Yi-ObjectData.Coord(1,2));
    0229         flag=(distX.*distX/X2Max+distY.*distY/Y2Max)<1;
    0230     elseif isequal(ObjectData.Style,'rectangle')|isequal(ObjectData.Style,'volume')
    0231         XimaMin=ObjectData.Coord(1,1)-XMax;
    0232         XimaMax=ObjectData.Coord(1,1)+XMax;
    0233         YimaMin=ObjectData.Coord(1,2)-YMax;
    0234         YimaMax=ObjectData.Coord(1,2)+YMax;
    0235         xlim=[1.2*XimaMin-0.2*XimaMax 1.2*XimaMax-0.2*XimaMin];%create an image around the ellipse
    0236         ylim=[1.2*YimaMin-0.2*YimaMax 1.2*YimaMax-0.2*YimaMin];
    0237         scale_x=2*1.4*XMax/npMx;
    0238         scale_y=2*1.4*YMax/npMy;
    0239         xi=[0.5:npMx-0.5]*scale_x+xlim(1);
    0240         yi=[0.5:npMy-0.5]*scale_y+ylim(1);
    0241         [Xi,Yi]=meshgrid(xi,yi);
    0242         distX=abs(Xi-ObjectData.Coord(1,1));
    0243         distY=abs(Yi-ObjectData.Coord(1,2));
    0244         flag=distX<XMax & distY< YMax;
    0245     elseif isequal(ObjectData.Style,'polygon')
    0246         XimaMin=min(ObjectData.Coord(:,1));
    0247         XimaMax=max(ObjectData.Coord(:,1));
    0248         YimaMin=min(ObjectData.Coord(:,2));
    0249         YimaMax=max(ObjectData.Coord(:,2));
    0250         xlim=[1.2*XimaMin-0.2*XimaMax 1.2*XimaMax-0.2*XimaMin];
    0251         ylim=[1.2*YimaMin-0.2*YimaMax 1.2*YimaMax-0.2*YimaMin];
    0252         [Xlim,Ylim]=meshgrid(linspace(xlim(1),xlim(2),npMx),linspace(ylim(1),ylim(2),npMy));
    0253         %flag=roipoly(xlim,ylim,flag,ObjectData.Coord(:,1),ObjectData.Coord(:,2));%=1 inside the polygon, 0 outsid
    0254         flag=inpolygon(Xlim,Ylim,ObjectData.Coord(:,1),ObjectData.Coord(:,2));%=1 inside the polygon, 0 outsid
    0255     end
    0256     if isequal(ObjectData.ProjMode,'outside')||isequal(ObjectData.ProjMode,'mask_outside')
    0257         flag=~flag;
    0258     end
    0259     imflag=zeros(npMx,npMy,3);
    0260     imflag(:,:,3)=flag; % blue color
    0261     if isequal(col,'m')
    0262          imflag(:,:,1)=flag; % magenta color
    0263     end
    0264     dx=(xlim(2)-xlim(1))/npMx;
    0265     dy=(ylim(2)-ylim(1))/npMy;
    0266 end
    0267
    0268 PlotData=[];%default
    0269 %MODIFY AN EXISTING OBJECT PLOT
    0270 if test_newobj==0;
    0271     hh=hplot;
    0272     PlotData=get(hplot,'UserData');
    0273     if test_line
    0274         set(hplot,'XData',xline)
    0275         set(hplot,'YData',yline)
    0276     %modify subobjects
    0277         if isfield(PlotData,'SubObject')
    0278            if length(PlotData.SubObject)==2 && ~isequal(ObjectData.Style,'points')&& ~isequal(ObjectData.Style,'plane');
    0279                 set(PlotData.SubObject(1),'XData',xinf);
    0280                 set(PlotData.SubObject(1),'YData',yinf);
    0281                 set(PlotData.SubObject(2),'XData',xsup);
    0282                 set(PlotData.SubObject(2),'YData',ysup);
    0283            elseif isequal(ObjectData.Style,'points')&& ~isequal(YMax,0)
    0284                for ipt=1:min(length(PlotData.SubObject),size(ObjectData.Coord,1))
    0285                     set(PlotData.SubObject(ipt),'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax])
    0286                end
    0287                %complement missing points
    0288                if size(ObjectData.Coord,1)>length(PlotData.SubObject)
    0289                    for ipt=length(PlotData.SubObject)+1:size(ObjectData.Coord,1)
    0290                      PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],...
    0291                   'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax],'EdgeColor',col,...
    0292                   'LineStyle',SubLineStyle,'Tag','proj_object');
    0293                    end
    0294                end
    0295            end
    0296         end
    0297         if isfield(PlotData,'DeformPoint')
    0298            for ipt=1:length(PlotData.DeformPoint)
    0299                if ishandle(PlotData.DeformPoint(ipt))
    0300                    if length(xline)>=ipt &   length(yline)>=ipt
    0301                         set(PlotData.DeformPoint(ipt),'XData',xline(ipt),'YData',yline(ipt));
    0302                     end
    0303                end
    0304            end
    0305            if length(xline)>length(PlotData.DeformPoint)
    0306                for ipt=length(PlotData.DeformPoint)+1:length(xline)
    0307                     PlotData.DeformPoint(ipt)=line(xline(ipt),yline(ipt),'Color',col,'LineStyle','.','Tag','DeformPoint',...
    0308                         'SelectionHighlight','off','UserData',hplot);
    0309                end
    0310                set(hplot,'UserData',PlotData)
    0311            end
    0312         end
    0313     elseif isequal(ObjectData.Style,'rectangle')|isequal(ObjectData.Style,'ellipse')
    0314         set(hplot,'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax])
    0315     end
    0316     if test_patch
    0317         for iobj=1:length(PlotData.SubObject)
    0318             objtype=get(PlotData.SubObject(iobj),'Type');
    0319             if isequal(objtype,'image')
    0320                 set(PlotData.SubObject(iobj),'CData',imflag,'AlphaData',(flag)*0.2)
    0321                 set(PlotData.SubObject(iobj),'XData',[xlim(1)+dx/2 xlim(2)-dx/2])
    0322                 set(PlotData.SubObject(iobj),'YData',[ylim(1)+dy/2 ylim(2)-dy/2])
    0323             end
    0324         end
    0325     end
    0326 end
    0327
    0328 %create the object
    0329 if test_newobj
    0330     axes(haxes)
    0331     hother=findobj('Tag','proj_object');%find all the proj objects
    0332     for iobj=1:length(hother)
    0333         if isequal(get(hother(iobj),'Type'),'rectangle')|isequal(get(hother(iobj),'Type'),'patch')
    0334             set(hother(iobj),'EdgeColor','b')
    0335             if isequal(get(hother(iobj),'FaceColor'),'m')
    0336                 set(hother(iobj),'FaceColor','b')
    0337             end
    0338         elseif isequal(get(hother(iobj),'Type'),'image')
    0339                Acolor=get(hother(iobj),'CData');
    0340                Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2));
    0341                set(hother(iobj),'CData',Acolor);
    0342         else
    0343              set(hother(iobj),'Color','b')
    0344         end
    0345         set(hother(iobj),'Selected','off')
    0346     end
    0347     hother=findobj('Tag','DeformPoint');
    0348     set(hother,'Color','b');
    0349     set(hother,'Selected','off')
    0350     if isequal(ObjectData.Style,'points')
    0351         hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color',col,'LineStyle','.','Marker','+');
    0352         for ipt=1:length(xline)
    0353               PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',...
    0354                   col,'LineStyle','.','SelectionHighlight','off','UserData',hh,'Tag','DeformPoint');
    0355               %create circle around each point
    0356               if ~isequal(YMax,0)
    0357                  PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],...
    0358                   'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax],'EdgeColor',col,...
    0359                   'LineStyle',SubLineStyle,'Tag','proj_object');
    0360               end
    0361         end
    0362     elseif  isequal(ObjectData.Style,'line')|isequal(ObjectData.Style,'polyline')|...
    0363           isequal(ObjectData.Style,'polygon') |isequal(ObjectData.Style,'plane')|isequal(ObjectData.Style,'volume')%  (isequal(ObjectData.Style,'polygon') & ~test_patch) |isequal(ObjectData.Style,'plane')
    0364         hh=line(xline,yline,'Color',col);
    0365         if ~isequal(ObjectData.Style,'plane')& ~isequal(ObjectData.Style,'volume')
    0366             for ipt=1:sizcoord(1)
    0367                 PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',...
    0368                       col,'LineStyle','none','Marker','.','Tag','DeformPoint','SelectionHighlight','off','UserData',hh);
    0369             end
    0370             PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines
    0371             PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
    0372         end
    0373
    0374     elseif isequal(ObjectData.Style,'rectangle')
    0375         hh=rectangle('Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col);
    0376     elseif isequal(ObjectData.Style,'ellipse')
    0377         hh=rectangle('Curvature',[1 1],'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col);
    0378     else
    0379         warndlg_uvmat('unknown ObjectData.Style in plot_object.m','ERROR')
    0380         return
    0381     end
    0382     set(hh,'Tag','proj_object')
    0383     %set(hh,'UserData',ObjectData)%
    0384 %         hh=hplot;
    0385 %     set(hh,'DeleteFcn',@deletefcn)
    0386 %     if isequal(ObjectData.ProjMode,'inside')
    0387 %          if isequal(ObjectData.Style,'ellipse')|isequal(ObjectData.Style,'rectangle')
    0388 %             set(hh,'FaceColor',col)
    0389 %             set(hh,'EdgeColor',col)
    0390 %          end
    0391 %     end
    0392     if test_patch
    0393         hold on
    0394         hhh=image([xlim(1)+dx/2 xlim(2)-dx/2],[ylim(1)+dy/2 ylim(2)-dy/2],imflag,'Tag','proj_object','HitTest','off');
    0395         set(hhh,'AlphaData',(flag)*0.2)
    0396         PlotData.SubObject=hhh;
    0397     end
    0398     if isfield(PlotData,'SubObject')
    0399         set(PlotData.SubObject,'UserData',hh)%record the parent handles in the SubObjects
    0400     end
    0401     if isfield(PlotData,'DeformPoint')
    0402         for ipt=1:sizcoord(1)
    0403             set(PlotData.DeformPoint(ipt),'UserData',hh);%record the parent handles in the SubObjects
    0404         end
    0405         set(PlotData.DeformPoint,'UserData',hh)%record the parent handles in the SubObjects
    0406     end
    0407 end
    0408 set(hh,'UserData',PlotData)