- Timestamp:
- Jan 27, 2012, 1:59:18 AM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r378 r379 23 23 %TODO: search range 24 24 25 % Last Modified by GUIDE v2.5 14-Jan-2012 00:46:2925 % Last Modified by GUIDE v2.5 27-Jan-2012 00:32:33 26 26 % Begin initialization code - DO NOT EDIT 27 27 gui_Singleton = 1; … … 4416 4416 4417 4417 function RootFile_Callback(hObject, eventdata, handles) 4418 4419 4420 -
trunk/src/fileparts_uvmat.m
r353 r379 104 104 end 105 105 NomType=[get_type(num2) delim1 get_type(num1)]; 106 RootFile=regexprep(FileName,[num2 delim1 num1 ],'');106 RootFile=regexprep(FileName,[num2 delim1 num1 '$'],''); 107 107 end 108 108 NomType=regexprep(NomType,'-1','-2'); %set 1-2 instead of 1-1 -
trunk/src/fill_GUI.m
r368 r379 3 3 function errormsg=fill_GUI(Param,handles) 4 4 %------------------------------------------------------------------------ 5 6 5 errormsg=''; 7 6 fields=fieldnames(Param); … … 19 18 hh=[]; 20 19 input_data=Param.(fields{ifield}); 20 check_done=0; 21 21 if isfield(handles,fields{ifield}) 22 22 hh=handles.(fields{ifield}); 23 23 if strcmp(get(hh,'Type'),'uitable') 24 set(hh,'Visible','on') 24 25 set(hh,'Data',input_data) 25 break26 check_done=1; 26 27 end 27 28 elseif isnumeric(input_data) && isfield(handles,['num_' fields{ifield}]) 28 29 hh=handles.(['num_' fields{ifield}]); 29 30 end 30 if ~isempty(hh) 31 if ~isempty(hh)&& ~check_done 31 32 set(hh,'Visible','on') 32 33 % input_data 33 switch get(hh,' style')34 switch get(hh,'Style') 34 35 case {'checkbox','radiobutton','togglebutton'} 35 36 if isnumeric(input_data) -
trunk/src/find_file_series.m
r376 r379 54 54 if strcmp( FileType,'multimage')||strcmp( FileType,'video') 55 55 NomType='*'; 56 i1_series=(1:FileInfo.NbFrame)' 56 i1_series=(1:FileInfo.NbFrame)'; 57 57 end 58 58 -
trunk/src/geometry_calib.m
r356 r379 149 149 function APPLY_Callback(hObject, eventdata, handles) 150 150 %------------------------------------------------------------------------ 151 %read the current calibration points 151 %% look for the GUI uvmat and check for an image as input 152 huvmat=findobj(allchild(0),'Name','uvmat'); 153 hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat 154 FileExt=get(hhuvmat.FileExt,'String'); 155 check_input=0; 156 if ~isempty(FileExt) 157 if ~isempty(imformats(FileExt(2:end))) ||strcmpi(FileExt,'.avi') 158 check_input=1; 159 end 160 end 161 if ~check_input 162 msgbox_uvmat('ERROR','open an image with uvmat to perform calibration') 163 return 164 end 165 166 %% read the current calibration points 152 167 Coord_cell=get(handles.ListCoord,'String'); 153 168 Object=read_geometry_calib(Coord_cell); … … 200 215 set(handles.Psi,'String',num2str(GeometryCalib.omc(3),4)) 201 216 202 % store the calibration data, by default in the xml file of the currently displayed image 203 huvmat=findobj(allchild(0),'Name','uvmat'); 217 %% store the calibration data, by default in the xml file of the currently displayed image 204 218 UvData=get(huvmat,'UserData'); 205 219 NbSlice_j=1;%default … … 208 222 volume_scan='n'; 209 223 if isfield(UvData,'XmlData') 210 UvData.XmlData211 224 if isfield(UvData.XmlData,'TranslationMotor') 212 225 NbSlice_j=UvData.XmlData.TranslationMotor.Nbslice; … … 216 229 end 217 230 end 218 hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat219 231 RootPath=''; 220 232 % RootFile=''; -
trunk/src/mouse_down.m
r342 r379 90 90 if xy_fig(1) >=obj_pos(1) & xy_fig(2) >= obj_pos(2)& xy_fig(1) <=obj_pos(1)+obj_pos(3) & xy_fig(2) <= obj_pos(2)+obj_pos(4); 91 91 htype=get(hchild,'Type');%type of object child of the current figure 92 93 92 switch htype 94 93 %if the mouse is over an axis, look at the data … … 169 168 170 169 %% delete the current zoom rectangle 171 if isfield(AxeData,'CurrentRectZoom') & ishandle(AxeData.CurrentRectZoom)170 if isfield(AxeData,'CurrentRectZoom') && ishandle(AxeData.CurrentRectZoom) 172 171 delete(AxeData.CurrentRectZoom) 173 172 AxeData.CurrentRectZoom=[]; … … 294 293 hset_object=findobj(allchild(0),'tag','set_object'); 295 294 if ~isempty(hset_object) 296 sethandles=guidata(hset_object);297 ObjectData=read_ set_object(sethandles); %read object features in the GUI set_object295 %ObjectData=read_set_object(sethandles); %read object features in the GUI set_object 296 ObjectData=read_GUI(hset_object); 298 297 ObjectData.Coord=[]; %reset previous object coordinates 299 298 ObjectData.Coord(1,1)=xy(1,1); 300 299 ObjectData.Coord(1,2)=xy(1,2); 301 ObjectData.Coord(1,3)=0;300 % ObjectData.Coord(1,3)=0; 302 301 if isfield(AxeData,'ObjectCoord') & size(AxeData.ObjectCoord,2)==3 303 302 ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle … … 314 313 set(hhuvmat.ListObject,'Value',[IndexObj_old(1) IndexObj] ); 315 314 UvData.Object{IndexObj}.DisplayHandle_uvmat=AxeData.CurrentObject; 316 object_name=get(sethandles.TITLE,'String'); 317 if isempty(object_name)|| strcmp(object_name,'') 318 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 319 set(sethandles.TITLE,'String',list_str{IndexObj}) 315 object_name=ObjectData.Name; 316 sethandles=guidata(hset_object); 317 if isempty(object_name) 318 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Type]; 319 set(sethandles.Name,'String',list_str{IndexObj}) 320 320 else 321 321 list_str{IndexObj}=object_name; -
trunk/src/mouse_motion.m
r315 r379 42 42 test_zoom_draw=0; % test for zoom drawing 43 43 test_ruler=0;%test for active ruler 44 test_piv=0;% test for PIV correlation display44 % test_piv=0;% test for PIV correlation display 45 45 huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle 46 46 if ~isempty(huvmat) … … 58 58 test_piv=1; 59 59 end 60 % hciv=findobj(allchild(0),'tag','civ');%find the civ interface handle61 % if ~isempty(hciv) && strcmp(get(currentfig,'tag'),'view_field')62 % hhciv=guidata(hciv);63 % test_piv =get(hhciv.TestCiv1,'Value');64 % end65 60 66 61 %find the current axe 'haxes' and display the current mouse position or uicontrol tag … … 327 322 XYData=AxeData.CurrentOrigin; 328 323 if isequal(AxeData.Drawing,'create') && isfield(AxeData,'CurrentOrigin') && ~isempty(AxeData.CurrentOrigin) 329 if strcmp(ObjectData.Style,'line')||strcmp(ObjectData.Style,'polyline')||strcmp(ObjectData.Style,'polygon')||strcmp(ObjectData.Style,'points') 330 xy(1,3)=0; 331 ObjectData.Coord=[ObjectData.Coord ;xy(1,:)]; 324 if strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||strcmp(ObjectData.Type,'polygon')||strcmp(ObjectData.Type,'points') 325 ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)]; 332 326 % ObjectData.Coord(end,:)=xy(1,:); 333 elseif strcmp(ObjectData. Style,'rectangle')||strcmp(ObjectData.Style,'ellipse')||strcmp(ObjectData.Style,'volume')327 elseif strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')||strcmp(ObjectData.Type,'volume') 334 328 ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate 335 329 ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2; 336 330 ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width 337 331 ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height 338 elseif isequal(ObjectData. Style,'plane') %case of 'plane'332 elseif isequal(ObjectData.Type,'plane') %case of 'plane' 339 333 DX=(xy(1,1)-ObjectData.Coord(1,1)); 340 334 DY=(xy(1,2)-ObjectData.Coord(1,2)); -
trunk/src/mouse_up.m
r302 r379 78 78 %creating object 79 79 else 80 if strcmp(ObjectData. Style,'line')||strcmp(ObjectData.Style,'polyline')||...81 strcmp(ObjectData. Style,'polygon')||strcmp(ObjectData.Style,'points')80 if strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||... 81 strcmp(ObjectData.Type,'polygon')||strcmp(ObjectData.Type,'points') 82 82 if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3 83 83 xy(1,3)=AxeData.ObjectCoord(1,3); % z coordinate of the mouse: to generalise ... … … 86 86 end 87 87 if ~isequal(ObjectData.Coord,xy(1,:)) 88 ObjectData.Coord=[ObjectData.Coord ;xy(1, :)];% append the coordiantes marked by the mouse to the eobject89 end 90 elseif isequal(ObjectData. Style,'rectangle')||isequal(ObjectData.Style,'ellipse')||isequal(ObjectData.Style,'volume')88 ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordiantes marked by the mouse to the eobject 89 end 90 elseif isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'ellipse')||isequal(ObjectData.Type,'volume') 91 91 XYData=AxeData.CurrentOrigin; 92 92 ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate … … 94 94 ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width 95 95 ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height 96 elseif isequal(ObjectData. Style,'plane') %case of 'plane'96 elseif isequal(ObjectData.Type,'plane') %case of 'plane' 97 97 DX=(xy(1,1)-ObjectData.Coord(1,1)); 98 98 DY=(xy(1,2)-ObjectData.Coord(1,2)); … … 106 106 end 107 107 end 108 if strcmp(ObjectData. Style,'rectangle')||strcmp(ObjectData.Style,'ellipse')108 if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse') 109 109 NbDefPoint=1; 110 elseif strcmp(ObjectData. Style,'line')|| strcmp(ObjectData.Style,'plane');110 elseif strcmp(ObjectData.Type,'line')|| strcmp(ObjectData.Type,'plane'); 111 111 NbDefPoint=2; 112 112 else … … 117 117 h_set_object=findobj(allchild(0),'Tag','set_object'); 118 118 hh_set_object=guidata(h_set_object); 119 set(hh_set_object.XObject,'String',num2str(ObjectData.Coord(:,1),4)); 120 set(hh_set_object.YObject,'String',num2str(ObjectData.Coord(:,2),4)); 121 set(hh_set_object.ZObject,'String',num2str(ObjectData.Coord(:,3),4)); 122 if strcmp(ObjectData.Style,'rectangle')||strcmp(ObjectData.Style,'ellipse') 119 set(hh_set_object.Coord,'Data',ObjectData.Coord); 120 % set(hh_set_object.XObject,'String',num2str(ObjectData.Coord(:,1),4)); 121 % set(hh_set_object.YObject,'String',num2str(ObjectData.Coord(:,2),4)); 122 % set(hh_set_object.ZObject,'String',num2str(ObjectData.Coord(:,3),4)); 123 if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse') 123 124 set(hh_set_object.XMax,'String',num2str(ObjectData.RangeX,4)); 124 125 set(hh_set_object.YMax,'String',num2str(ObjectData.RangeY,4)); … … 127 128 strcmp(AxeData.Drawing,'translate') || strcmp(AxeData.Drawing,'deform');%stop drawing 128 129 AxeData.CurrentOrigin=[]; %suppress the current origin 129 if isequal(ObjectData. Style,'line') && size(ObjectData.Coord,1)<=1130 if isequal(ObjectData.Type,'line') && size(ObjectData.Coord,1)<=1 130 131 AxeData.Drawing='off'; 131 132 set(currentaxes,'UserData',AxeData); -
trunk/src/plot_field.m
r364 r379 41 41 % default=0, no error. Different non zero values can represent different criteria of elimination. 42 42 % 43 %44 % additional elements characterizing the projection object (should not be necessary)--45 % Data.Style : style of projection object46 % Data.XObject,.YObject: set of coordinates defining the object position;47 % Data.ProjMode=type of projection ;48 % Data.ProjAngle=angle of projection;49 % Data.DX,.DY,.DZ=increments;50 % Data.MaxY,MinY: min and max Y51 52 43 % haxes: handle of the plotting axes to update with the new plot. If this input is absent or not a valid axes handle, a new figure is created. 53 44 % -
trunk/src/plot_object.m
r307 r379 9 9 % 10 10 % ObjectDataIn: structure representing the object properties: 11 % . Style : style of projection object11 % .Type : style of projection object 12 12 % .Coord: set of coordinates defining the object position; 13 13 % .ProjMode=type of projection ; … … 39 39 %% default output 40 40 hh=[];%default output 41 if ~isfield(ObjectDataIn,' Style')|| isequal(ProjObject,ObjectDataIn)% object representation does not appear in its own projection plot41 if ~isfield(ObjectDataIn,'Type')|| isequal(ProjObject,ObjectDataIn)% object representation does not appear in its own projection plot 42 42 return 43 43 end 44 if ~isfield(ProjObject,' Style')44 if ~isfield(ProjObject,'Type') 45 45 ObjectData=ObjectDataIn; 46 elseif isequal(ProjObject. Style,'plane')46 elseif isequal(ProjObject.Type,'plane') 47 47 ObjectData=ObjectDataIn;% TODO: modify take into account rotation of axis 48 48 else 49 49 return % object representation only available in a plane 50 50 end 51 if ~isfield(ObjectData,' Style')||isempty(ObjectData.Style)||~ischar(ObjectData.Style)52 msgbox_uvmat('ERROR','undefined ObjectData. Style in plot_object.m')51 if ~isfield(ObjectData,'Type')||isempty(ObjectData.Type)||~ischar(ObjectData.Type) 52 msgbox_uvmat('ERROR','undefined ObjectData.Type in plot_object.m') 53 53 return 54 54 end 55 if ~isfield(ObjectData,' Style')||isempty(ObjectData.Style)||~ischar(ObjectData.Style)56 msgbox_uvmat('ERROR','undefined ObjectData. Style in plot_object.m')55 if ~isfield(ObjectData,'Type')||isempty(ObjectData.Type)||~ischar(ObjectData.Type) 56 msgbox_uvmat('ERROR','undefined ObjectData.Type in plot_object.m') 57 57 return 58 58 end … … 103 103 ObjectData.Coord=[0 0 0];%default 104 104 end 105 if ~isfield(ObjectData,'Phi')||isempty(ObjectData.Phi) 106 ObjectData.Phi=0;%default 107 end 108 if ~isfield(ObjectData,'Range') 109 ObjectData.Range(1,1)=0; %edfault 110 end 111 if size(ObjectData.Range,2)>=2 112 YMax=ObjectData.Range(1,2);%default 113 end 114 if size(ObjectData.Range,2)>=2 & size(ObjectData.Range,1)>=2 115 YMin=ObjectData.Range(2,2); 116 else 117 YMin=0; 118 end 119 XMax=ObjectData.Range(1,1); 120 if size(ObjectData.Range,1)>=2 121 XMin=ObjectData.Range(2,1); 122 end 123 if isfield(ObjectData,'RangeX') 124 XMax=max(ObjectData.RangeX); 125 XMin=min(ObjectData.RangeX); 126 end 127 if isfield(ObjectData,'RangeY') 128 YMax=max(ObjectData.RangeY); 129 YMin=min(ObjectData.RangeY); 130 end 131 if isfield(ObjectData,'RangeZ') 132 ZMax=max(ObjectData.RangeZ); 133 ZMin=min(ObjectData.RangeZ); 134 end 135 if isequal(ObjectData.Style,'points')&isequal(ObjectData.ProjMode,'projection') 136 YMax=max(XMax,YMax); 137 YMax=max(YMax,ZMax); 138 elseif isequal(ObjectData.Style,'rectangle')||isequal(ObjectData.Style,'ellipse')||isequal(ObjectData.Style,'volume') 139 if isequal(YMax,0) 140 ylim=get(haxes,'YLim'); 141 YMax=(ylim(2)-ylim(1))/100; 142 end 143 if isequal(XMax,0) 144 XMax=YMax;%default 145 end 146 elseif isequal(ObjectData.Style,'plane') 147 if isequal(XMax,0) 148 xlim=get(haxes,'XLim'); 149 XMax=xlim(2); 150 end 151 if isequal(YMax,0) 152 ylim=get(haxes,'YLim'); 153 YMax=ylim(2); 154 end 105 % if ~isfield(ObjectData,'Phi')||isempty(ObjectData.Phi) 106 % ObjectData.Phi=0;%default 107 % end 108 % if ~isfield(ObjectData,'Range') 109 % ObjectData.Range(1,1)=0; %edfault 110 % end 111 % if size(ObjectData.Range,2)>=2 112 % YMax=ObjectData.Range(1,2);%default 113 % end 114 % if size(ObjectData.Range,2)>=2 & size(ObjectData.Range,1)>=2 115 % YMin=ObjectData.Range(2,2); 116 % else 117 % YMin=0; 118 % end 119 if isfield(ObjectData,'RangeX') && ~isempty(ObjectData.RangeX) 120 XMax=max(ObjectData.RangeX); 121 XMin=min(ObjectData.RangeX); 122 end 123 if isfield(ObjectData,'RangeY')&&~isempty(ObjectData.RangeY) 124 YMax=max(ObjectData.RangeY); 125 YMin=min(ObjectData.RangeY); 126 end 127 if isfield(ObjectData,'RangeZ')&&~isempty(ObjectData.RangeZ) 128 ZMax=max(ObjectData.RangeZ); 129 ZMin=min(ObjectData.RangeZ); 130 end 131 switch ObjectData.Type 132 case 'points' 133 if strcmp(ObjectData.ProjMode,'projection') 134 YMax=max(XMax,YMax); 135 YMax=max(YMax,ZMax); 136 end 137 case {'rectangle','ellipse','volume'} 138 if isequal(YMax,0) 139 ylim=get(haxes,'YLim'); 140 YMax=(ylim(2)-ylim(1))/100; 141 end 142 if isequal(XMax,0) 143 XMax=YMax;%default 144 end 145 case 'plane' 146 if isequal(XMax,0) 147 xlim=get(haxes,'XLim'); 148 XMax=xlim(2); 149 end 150 if isequal(YMax,0) 151 ylim=get(haxes,'YLim'); 152 YMax=ylim(2); 153 end 155 154 end 156 155 sizcoord=size(ObjectData.Coord); 157 156 158 157 %% determine the coordinates xline, yline,xsup,xinf, yinf,ysup determining the new object plot 159 test_line= isequal(ObjectData. Style,'points')|isequal(ObjectData.Style,'line')|isequal(ObjectData.Style,'polyline')|...160 isequal(ObjectData. Style,'polygon')| isequal(ObjectData.Style,'plane')| isequal(ObjectData.Style,'volume');161 test_patch=isequal(ObjectData.ProjMode,'inside')||isequal(ObjectData.ProjMode,'outside')||isequal(ObjectData. Style,'volume')...158 test_line= isequal(ObjectData.Type,'points')|isequal(ObjectData.Type,'line')|isequal(ObjectData.Type,'polyline')|... 159 isequal(ObjectData.Type,'polygon')| isequal(ObjectData.Type,'plane')| isequal(ObjectData.Type,'volume'); 160 test_patch=isequal(ObjectData.ProjMode,'inside')||isequal(ObjectData.ProjMode,'outside')||isequal(ObjectData.Type,'volume')... 162 161 ||isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside'); 163 162 if test_line … … 165 164 yline=ObjectData.Coord(:,2); 166 165 nbpoints=numel(xline); 167 if isequal(ObjectData. Style,'polygon')166 if isequal(ObjectData.Type,'polygon') 168 167 xline=[xline; ObjectData.Coord(1,1)];%closing the line 169 168 yline=[yline; ObjectData.Coord(1,2)]; 170 elseif isequal(ObjectData. Style,'plane')|| isequal(ObjectData.Style,'volume')169 elseif isequal(ObjectData.Type,'plane')|| isequal(ObjectData.Type,'volume') 171 170 phi=ObjectData.Phi*pi/180;%angle in radians 172 171 Xend_x=xline(1)+XMax*cos(phi); … … 195 194 end 196 195 end 197 if isequal(ObjectData. Style,'line')||isequal(ObjectData.Style,'polyline')||isequal(ObjectData.Style,'polygon')196 if isequal(ObjectData.Type,'line')||isequal(ObjectData.Type,'polyline')||isequal(ObjectData.Type,'polygon') 198 197 if length(xline)<2 199 198 theta=0; … … 220 219 npMy=512; 221 220 flag=zeros(npMy,npMx); 222 if isequal(ObjectData. Style,'ellipse')221 if isequal(ObjectData.Type,'ellipse') 223 222 XimaMin=ObjectData.Coord(1,1)-XMax; 224 223 XimaMax=ObjectData.Coord(1,1)+XMax; … … 237 236 distY=(Yi-ObjectData.Coord(1,2)); 238 237 flag=(distX.*distX/X2Max+distY.*distY/Y2Max)<1; 239 elseif isequal(ObjectData. Style,'rectangle')||isequal(ObjectData.Style,'volume')238 elseif isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'volume') 240 239 XimaMin=ObjectData.Coord(1,1)-XMax; 241 240 XimaMax=ObjectData.Coord(1,1)+XMax; … … 252 251 distY=abs(Yi-ObjectData.Coord(1,2)); 253 252 flag=distX<XMax & distY< YMax; 254 elseif isequal(ObjectData. Style,'polygon')253 elseif isequal(ObjectData.Type,'polygon') 255 254 XimaMin=min(ObjectData.Coord(:,1)); 256 255 XimaMax=max(ObjectData.Coord(:,1)); … … 286 285 %modify subobjects 287 286 if isfield(PlotData,'SubObject') 288 if length(PlotData.SubObject)==2 && ~isequal(ObjectData. Style,'points')&& ~isequal(ObjectData.Style,'plane');287 if length(PlotData.SubObject)==2 && ~isequal(ObjectData.Type,'points')&& ~isequal(ObjectData.Type,'plane'); 289 288 set(PlotData.SubObject(1),'XData',xinf); 290 289 set(PlotData.SubObject(1),'YData',yinf); 291 290 set(PlotData.SubObject(2),'XData',xsup); 292 291 set(PlotData.SubObject(2),'YData',ysup); 293 elseif isequal(ObjectData. Style,'points')&& ~isequal(YMax,0)292 elseif isequal(ObjectData.Type,'points')&& ~isequal(YMax,0) 294 293 for ipt=1:min(length(PlotData.SubObject),size(ObjectData.Coord,1)) 295 294 set(PlotData.SubObject(ipt),'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax]) … … 321 320 end 322 321 end 323 elseif isequal(ObjectData. Style,'rectangle')||isequal(ObjectData.Style,'ellipse')322 elseif isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'ellipse') 324 323 set(hplot,'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax]) 325 324 end … … 358 357 set(hother,'Color','b'); 359 358 set(hother,'Selected','off') 360 if isequal(ObjectData. Style,'points')359 if isequal(ObjectData.Type,'points') 361 360 hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color',col,'LineStyle','.','Marker','+'); 362 361 for ipt=1:length(xline) … … 370 369 end 371 370 end 372 elseif strcmp(ObjectData. Style,'line')||strcmp(ObjectData.Style,'polyline')||...373 strcmp(ObjectData. Style,'polygon') ||strcmp(ObjectData.Style,'plane')||strcmp(ObjectData.Style,'volume')% (isequal(ObjectData.Style,'polygon') & ~test_patch) |isequal(ObjectData.Style,'plane')371 elseif strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||... 372 strcmp(ObjectData.Type,'polygon') ||strcmp(ObjectData.Type,'plane')||strcmp(ObjectData.Type,'volume')% (isequal(ObjectData.Type,'polygon') & ~test_patch) |isequal(ObjectData.Type,'plane') 374 373 hh=line(xline,yline,'Color',col); 375 if ~strcmp(ObjectData. Style,'plane') && ~strcmp(ObjectData.Style,'volume')374 if ~strcmp(ObjectData.Type,'plane') && ~strcmp(ObjectData.Type,'volume') 376 375 PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines 377 376 PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object'); … … 382 381 end 383 382 384 elseif strcmp(ObjectData. Style,'rectangle')383 elseif strcmp(ObjectData.Type,'rectangle') 385 384 hh=rectangle('Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col); 386 elseif strcmp(ObjectData. Style,'ellipse')385 elseif strcmp(ObjectData.Type,'ellipse') 387 386 hh=rectangle('Curvature',[1 1],'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col); 388 387 else 389 msgbox_uvmat('ERROR','unknown ObjectData. Style in plot_object.m')388 msgbox_uvmat('ERROR','unknown ObjectData.Type in plot_object.m') 390 389 return 391 390 end -
trunk/src/proj_field.m
r372 r379 17 17 %INPUT 18 18 % ObjectData: structure characterizing the projection object 19 % . Style : style of projection object20 % .ProjMode= type of projection ;21 % .Coord Type: 'px' or 'phys' type of coordinates defining the object position19 % .Type : type of projection object 20 % .ProjMode=mode of projection ; 21 % .CoordUnit: 'px', 'cm' units for the coordinates defining the object 22 22 % .Phi angle of rotation (=0 by default) 23 23 % .ProjAngle=angle of projection; … … 88 88 end 89 89 90 %% in the absence of object Style or projection mode, or object coordinaes, the input field is just tranfered without change91 if ~isfield(ObjectData,' Style')||~isfield(ObjectData,'ProjMode')90 %% in the absence of object Type or projection mode, or object coordinaes, the input field is just tranfered without change 91 if ~isfield(ObjectData,'Type')||~isfield(ObjectData,'ProjMode') 92 92 ProjData=FieldData; 93 93 return 94 94 end 95 95 if ~isfield(ObjectData,'Coord') 96 if strcmp(ObjectData. Style,'plane')96 if strcmp(ObjectData.Type,'plane') 97 97 ObjectData.Coord=[0 0 0];%default 98 98 else … … 124 124 125 125 %% apply projection depending on the object style 126 switch ObjectData. Style126 switch ObjectData.Type 127 127 case 'points' 128 128 [ProjData,errormsg]=proj_points(FieldData,ObjectData); … … 480 480 %select the indices in the range of action 481 481 testin=[];%default 482 if isequal(ObjectData. Style,'rectangle')482 if isequal(ObjectData.Type,'rectangle') 483 483 % if ~isfield(ObjectData,'RangeX')|~isfield(ObjectData,'RangeY') 484 484 % errormsg='rectangle half sides RangeX and RangeY needed' … … 494 494 testin=distX<widthx & distY<widthy; 495 495 end 496 elseif isequal(ObjectData. Style,'polygon')496 elseif isequal(ObjectData.Type,'polygon') 497 497 if testX 498 498 testin=inpolygon(coord_x,coord_y,ObjectData.Coord(:,1),ObjectData.Coord(:,2)); … … 502 502 testin=[]; %A REVOIR 503 503 end 504 elseif isequal(ObjectData. Style,'ellipse')504 elseif isequal(ObjectData.Type,'ellipse') 505 505 X2Max=widthx*widthx; 506 506 Y2Max=(widthy)*(widthy); … … 567 567 ProjMode='projection';%direct projection on the line by default 568 568 if isfield(ObjectData,'ProjMode'),ProjMode=ObjectData.ProjMode; end; 569 ProjAngle=90; %90 degrees projection by default570 if isfield(FieldData,'ProjAngle'),ProjAngle=ObjectData.ProjAngle; end;569 % ProjAngle=90; %90 degrees projection by default 570 % if isfield(FieldData,'ProjAngle'),ProjAngle=ObjectData.ProjAngle; end; 571 571 width=0;%default width of the projection band 572 if isfield(ObjectData,'Range')& size(ObjectData.Range,2)>=2572 if isfield(ObjectData,'Range')&&size(ObjectData.Range,2)>=2 573 573 width=abs(ObjectData.Range(1,2)); 574 574 end … … 777 777 %case of structured coordinates 778 778 elseif numel(VarType.coord)>=2 & VarType.coord(1:2) > 0; 779 if ~isequal(ObjectData. Style,'line')% exclude polyline780 errormsg=['no projection available on ' ObjectData. Style 'for structured coordinates']; %779 if ~isequal(ObjectData.Type,'line')% exclude polyline 780 errormsg=['no projection available on ' ObjectData.Type 'for structured coordinates']; % 781 781 else 782 782 test_Amat=1;%image or 2D matrix … … 949 949 testangle=~isequal(PlaneAngle,[0 0 0]);% && ~test90y && ~test90x;%=1 for slanted plane 950 950 951 % Phi=0;%default952 % Theta=0;953 % Psi=0;954 % if isfield(ObjectData,'Phi')&& ~isempty(ObjectData.Phi)955 % Phi=(pi/180)*ObjectData.Phi;%first Euler angle in radian956 % end957 % if isfield(ObjectData,'Theta')&& ~isempty(ObjectData.Theta)958 % Theta=(pi/180)*ObjectData.Theta;%second Euler angle in radian959 % end960 % if isfield(ObjectData,'Psi')&& ~isempty(ObjectData.Psi)961 % Psi=(pi/180)*ObjectData.Psi;%third Euler angle in radian962 % end963 964 %components of the unity vector normal to the projection plane965 % NormVec_X=-sin(Phi)*sin(Theta);966 % NormVec_Y=cos(Phi)*sin(Theta);967 % NormVec_Z=cos(Theta);968 969 951 %mesh sizes DX and DY 970 952 DX=0; 971 953 DY=0; %default 972 if isfield(ObjectData,'DX') &~isempty(ObjectData.DX)954 if isfield(ObjectData,'DX') && ~isempty(ObjectData.DX) 973 955 DX=abs(ObjectData.DX);%mesh of interpolation points 974 956 end 975 if isfield(ObjectData,'DY') &~isempty(ObjectData.DY)957 if isfield(ObjectData,'DY') && ~isempty(ObjectData.DY) 976 958 DY=abs(ObjectData.DY);%mesh of interpolation points 977 959 end … … 2187 2169 %% transfer coordinate unit 2188 2170 if isfield(FieldData,'CoordUnit') 2189 if isfield(ObjectData,'CoordUnit') &~isequal(FieldData.CoordUnit,ObjectData.CoordUnit)2190 errormsg=[ObjectData. Style ' in ' ObjectData.CoordUnit ' coordinates, while field in ' FieldData.CoordUnit ];2171 if isfield(ObjectData,'CoordUnit') && ~strcmp(FieldData.CoordUnit,ObjectData.CoordUnit) 2172 errormsg=[ObjectData.Type ' in ' ObjectData.CoordUnit ' coordinates, while field in ' FieldData.CoordUnit ]; 2191 2173 return 2192 2174 else … … 2196 2178 2197 2179 %% store the properties of the projection object 2198 ListObject={' Style','ProjMode','RangeX','RangeY','RangeZ','Phi','Theta','Psi','Coord'};2180 ListObject={'Type','ProjMode','RangeX','RangeY','RangeZ','Phi','Theta','Psi','Coord'}; 2199 2181 for ilist=1:length(ListObject) 2200 2182 if isfield(ObjectData,ListObject{ilist}) -
trunk/src/read_GUI.m
r363 r379 5 5 struct=[];%default 6 6 hchild=get(handle,'children'); 7 hchild=flipdim(hchild,1);% reverse the order to respect the tab order in the GUI 7 8 for ichild=1:numel(hchild) 8 9 if strcmp(get(hchild(ichild),'Visible'),'on') … … 15 16 object_style=get(hchild(ichild),'Style'); 16 17 check_input=1;%default 18 index=0; 17 19 switch object_style 18 20 case {'checkbox','radiobutton','togglebutton'} 19 21 input=get(hchild(ichild),'Value'); 20 22 case 'edit' 21 separator=regexp(tag,'^num_' );23 separator=regexp(tag,'^num_','once');%look for the prefix 'num_' 22 24 if isempty(separator) 23 25 input=get(hchild(ichild),'String'); 24 else 25 input=str2double(get(hchild(ichild),'String')); 26 else %transform into numeric if the edit box begins by the prefix 'num_' 27 input=str2double(get(hchild(ichild),'String')); 26 28 tag=regexprep(tag,'^num_',''); 29 % detect tag name ending by an index: then interpret the input as array(index) 30 r=regexp(tag,'_(?<index>\d+)$','names');% detect tag name ending by an index 31 if ~isempty(r) 32 tag=regexprep(tag,['_' r.index '$'],''); 33 index=str2double(r.index); 34 end 27 35 %deal with undefined input: retrieve the default value stored as UserData 28 36 if isnan(input) … … 39 47 check_input=0; 40 48 end 41 separator=regexp(tag,'^num_' );49 separator=regexp(tag,'^num_','once'); 42 50 if ~isempty(separator) 43 51 input=str2double(input);% transform to numerical values if the uicontrol tag begins with 'num_' … … 48 56 end 49 57 if check_input 50 struct.(tag)=input; 58 if index==0 59 struct.(tag)=input; 60 else 61 struct.(tag)(index)=input; 62 end 51 63 end 52 64 case 'uitable' -
trunk/src/read_civdata.m
r372 r379 72 72 end 73 73 if vardetect(1)==0 74 errormsg=[ 'requested field not available in ' filename '/' VelType ];74 errormsg=[ 'requested field not available in ' filename '/' VelType ': need to run patch']; 75 75 return 76 76 end -
trunk/src/read_field.m
r354 r379 1 1 2 %'read_field': read input fields in different formats 2 3 %-------------------------------------------------------------------------- … … 61 62 ParamOut.ColorVar='ima_cor'; 62 63 InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 63 [Field,ParamOut.VelType ]=read_civdata(ObjectName,InputField,ParamIn.VelType);64 [Field,ParamOut.VelType,errormsg]=read_civdata(ObjectName,InputField,ParamIn.VelType); 64 65 test_civx=Field.CivStage; 65 66 %case of old civx conventions -
trunk/src/read_set_object.m
r206 r379 15 15 function data=read_set_object(handles) 16 16 %menus 17 if isfield(handles,'ObjectStyle')%case of the set_object interface 18 menu=get(handles.ObjectStyle,'String'); 19 value=get(handles.ObjectStyle,'Value'); 20 data.Style=menu{value}; 21 menu=get(handles.ProjMode,'String'); 22 value=get(handles.ProjMode,'Value'); 23 data.ProjMode=menu{value}; 24 data.CoordUnit=get(handles.CoordUnit,'String'); 25 testcalib=0; 26 else %default 27 data.Style='points'; 28 testcalib=1; 29 end 17 data=read_GUI(handles); 30 18 31 %Euler angles and projection ranges 32 if ~testcalib 33 if isequal(get(handles.Phi,'Visible'),'on') 34 data.Angle(1)=str2double(get(handles.Phi,'String')); 35 end 36 if isequal(get(handles.Theta,'Visible'),'on') 37 data.Angle(2)=str2double(get(handles.Theta,'String')); 38 end 39 if isequal(get(handles.Psi,'Visible'),'on') 40 data.Angle(3)=str2double(get(handles.Psi,'String')); 41 end 42 if isequal(get(handles.DX,'Visible'),'on') 43 data.DX=str2num(get(handles.DX,'String')); 44 end 45 if isequal(get(handles.DY,'Visible'),'on') 46 data.DY=str2num(get(handles.DY,'String')); 47 end 48 if isequal(get(handles.DZ,'Visible'),'on') 49 data.DZ=str2num(get(handles.DZ,'String')); 50 end 51 dimrange=[1 1];%default 52 if isequal(get(handles.ZMin,'Visible'),'on') 53 ZMin=str2num(get(handles.ZMin,'String')); 54 if ~isempty(ZMin) 55 data.RangeZ(1)=ZMin; 56 dimrange=[2 3]; 57 end 58 end 59 if isequal(get(handles.ZMax,'Visible'),'on') 60 ZMax=str2double(get(handles.ZMax,'String')); 61 if isnan(ZMax) 62 if dimrange(1)>1 63 data.RangeZ(1)=ZMax; 64 end 65 else 66 data.RangeZ(2)=ZMax; 67 dimrange=[dimrange(1) 3]; 68 end 69 end 70 if isequal(get(handles.YMin,'Visible'),'on') 71 YMin=str2double(get(handles.YMin,'String')); 72 if ~isnan(YMin) 73 data.RangeY(2)=YMin; 74 dimrange=[2 max(dimrange(2),2)]; 75 end 76 end 77 if isequal(get(handles.YMax,'Visible'),'on') 78 YMax=str2double(get(handles.YMax,'String')); 79 if ~isnan(YMax) 80 data.RangeY(1)=YMax; 81 dimrange=[dimrange(1) max(dimrange(2),2)]; 82 end 83 end 84 if isequal(get(handles.XMin,'Visible'),'on') 85 XMin=str2double(get(handles.XMin,'String')); 86 if ~isnan(XMin) 87 data.RangeX(2)=XMin; 88 end 89 end 90 if isequal(get(handles.XMax,'Visible'),'on') 91 XMax=str2double(get(handles.XMax,'String')); 92 if ~isnan(XMax) 93 data.RangeX(1)=XMax; 94 end 95 end 96 end 97 98 99 %positions x,y,z 100 Xcolumn=get(handles.XObject,'String'); 101 Ycolumn=get(handles.YObject,'String'); 102 if ischar(Xcolumn) 103 sizchar=size(Xcolumn); 104 for icol=1:sizchar(1) 105 Xcolumn_cell{icol}=Xcolumn(icol,:); 106 end 107 Xcolumn=Xcolumn_cell; 108 end 109 if ischar(Ycolumn) 110 sizchar=size(Ycolumn); 111 for icol=1:sizchar(1) 112 Ycolumn_cell{icol}=Ycolumn(icol,:); 113 end 114 Ycolumn=Ycolumn_cell; 115 end 116 Zcolumn={};%default 117 if isequal(get(handles.ZObject,'Visible'),'on') 118 data.NbDim=3; %test 3D object 119 Zcolumn=get(handles.ZObject,'String'); 120 if ischar(Zcolumn) 121 Zcolumn={Zcolumn}; 122 end 123 end 124 nb_points=min(length(Xcolumn),length(Ycolumn));%number of point positions needed to define the object position 125 if isequal (data.Style,'line'); 126 nb_defining_points=2; 127 elseif isequal(data.Style,'plane')|isequal(data.Style,'rectangle')|isequal(data.Style,'ellipse') 128 nb_defining_points=1; 129 else 130 nb_defining_points=nb_points; 131 end 132 data_XObject=[]; 133 data_YObject=[]; 134 data_ZObject=[]; 135 for i=1:nb_points 136 Xnumber=str2num(Xcolumn{i}); 137 Ynumber=str2num(Ycolumn{i}); 138 if isempty(Xnumber)|isempty(Ynumber) 139 break 140 else 141 data_XObject=[data_XObject; Xnumber(1)]; 142 data_YObject=[data_YObject; Ynumber(1)]; 143 end 144 if length(Zcolumn)<i | isempty(str2num(Zcolumn{i})) 145 data_ZObject=[data_ZObject; 0]; 146 else 147 data_ZObject=[data_ZObject; str2num(Zcolumn{i})]; 148 end 149 end 150 if nb_defining_points > nb_points 151 for i=nb_points+1:nb_defining_points 152 data_XObject=[0;data_XObject]; 153 data_YObject=[0;data_YObject]; 154 data_ZObject=[0;data_ZObject]; 155 end 156 end 157 if isempty(data_XObject) 158 data_XObject=0; 159 end 160 if isempty(data_YObject) 161 data_YObject=0; 162 end 163 if isempty(data_ZObject) 164 data_ZObject=0; 165 end 166 data.Coord=[data_XObject data_YObject data_ZObject]; 167 168 set(handles.XObject,'String',mat2cell(data_XObject,length(data_XObject)))%correct the interface display 169 set(handles.YObject,'String',mat2cell(data_YObject,length(data_XObject))) 170 set(handles.ZObject,'String',mat2cell(data_ZObject,length(data_XObject))) 171 172 19 % %Euler angles and projection ranges 20 % if isfield(data,'Angle_x') 21 % data.Angle(1)=data.Angle_x; 22 % data=rmfield(data,'Angle_x'); 23 % end 24 % if isfield(data,'Angle_y') 25 % data.Angle(2)=data.Angle_y; 26 % data=rmfield(data,'Angle_y'); 27 % end 28 % if isfield(data,'Angle_z') 29 % data.Angle(3)=data.Angle_z; 30 % data=rmfield(data,'Angle_z'); 31 % end 32 % % ranges of projection 33 % data.RangeZ=[]; 34 % data.RangeY=[]; 35 % data.RangeX=[]; 36 % if isfield(data,'ZMin')&& ~isempty(data.ZMin) 37 % data.RangeZ=data.ZMin; 38 % data=rmfield(data,'ZMin'); 39 % end 40 % if isfield(data,'ZMax')&& ~isempty(data.ZMax) 41 % data.RangeZ=[data.RangeZ data.ZMax]; 42 % data=rmfield(data,'ZMax'); 43 % end 44 % if isfield(data,'YMin')&& ~isempty(data.YMin) 45 % data.RangeY=data.YMin; 46 % data=rmfield(data,'YMin'); 47 % end 48 % if isfield(data,'YMax')&& ~isempty(data.YMax) 49 % data.RangeY=[data.RangeY data.YMax]; 50 % data=rmfield(data,'YMax'); 51 % end 52 % if isfield(data,'XMin')&& ~isempty(data.XMin) 53 % data.RangeX=data.XMin; 54 % data=rmfield(data,'XMin'); 55 % end 56 % if isfield(data,'XMax')&& ~isempty(data.XMax) 57 % data.RangeX=[data.RangeX data.XMax]; 58 % data=rmfield(data,'XMax'); 59 % end 60 % 61 % 62 % 63 % -
trunk/src/set_object.m
r342 r379 12 12 % .ProjMode 13 13 % .CoordType: 'phys' or 'px' 14 % . DX,.DY,.DZ : mesh along each dirction14 % .num_DX,.num_DY,.num_DZ : mesh along each dirction 15 15 % .RangeX, RangeY 16 16 % .Coord(j,i), i=1, 2, 3, components x, y, z of j=1...n position(s) characterizing the object components … … 36 36 function varargout = set_object(varargin) 37 37 38 % Last Modified by GUIDE v2.5 2 4-Nov-2008 14:29:0638 % Last Modified by GUIDE v2.5 26-Jan-2012 22:00:47 39 39 40 40 % Begin initialization code - DO NOT PLOT … … 65 65 % if=0; no associated object (used for series), the button 'PLOT' is then unvisible 66 66 %'data': read from an existing object selected in the interface 67 % . TITLE: class of object ('POINTS','LINE',....)68 % . DX,DY,DZ; meshes for regular grids67 % .Name : class of object ('POINTS','LINE',....) 68 % .num_DX,num_DY,num_DZ; meshes for regular grids 69 69 % .Coord: object position coordinates 70 70 % .ParentButton: handle of the uicontrol object calling the interface … … 92 92 enable_plot=data.enable_plot;%test to desable button PLOT (display mode) 93 93 end 94 if isfield(data,'Name') 95 set(handles.TITLE,'String',data.Name) 96 end 97 if ~isfield(data,'NbDim')||~isequal(data.NbDim,3)%2D case 98 set(handles.ZObject,'Visible','off') 94 if isfield(data,'Coord') &&size(data.Coord,2)==3 95 set(handles.z_slider,'Visible','on') 96 else 99 97 set(handles.z_slider,'Visible','off') 100 else 101 set(handles.ZObject,'Visible','on') 102 set(handles.z_slider,'Visible','on') 103 if isfield(data,'Coord') && size(data.Coord,2)==3 104 set(handles.ZObject,'String',num2str(data.Coord(1,3),4)) 105 end 106 end 107 if isfield(data,'StyleMenu') 108 set(handles.ObjectStyle,'String',data.StyleMenu); 109 end 110 if isfield(data,'Style') 111 menu=get(handles.ObjectStyle,'String'); 112 for iline=1:length(menu) 113 if isequal(menu{iline},data.Style) 114 set(handles.ObjectStyle,'Value',iline) 115 break 116 end 117 end 118 end 119 ObjectStyle_Callback(hObject, eventdata, handles) 120 if isfield(data,'ProjMenu') 121 set(handles.ProjMode,'String',data.ProjMenu);%overset the standard menu 122 end 123 if isfield(data,'ProjMode') 124 menu=get(handles.ProjMode,'String'); 125 for iline=1:length(menu) 126 if isequal(menu{iline},data.ProjMode) 127 set(handles.ProjMode,'Value',iline) 128 break 129 end 130 end 131 end 132 ProjMode_Callback(hObject, eventdata, handles) 133 if isfield(data,'Coord') 134 if ischar(data.Coord) 135 data.Coord=str2num(data.Coord); 136 elseif iscell(data.Coord) 137 CoordCell=data.Coord; 138 data.Coord=zeros(numel(CoordCell),3); 139 data.Coord(:,3)=zeros(numel(CoordCell),1); % z component set to 0 by default 140 for iline=1:numel(CoordCell) 141 line_vec=str2num(CoordCell{iline}); 142 if numel(line_vec)==2 143 data.Coord(iline,1:2)=str2num(CoordCell{iline}); 144 else 145 data.Coord(iline,:)=str2num(CoordCell{iline}); 146 end 147 end 148 end 149 if size(data.Coord,2)>=2 150 sizcoord=size(data.Coord); 151 for i=1:sizcoord(1) 152 XObject{i}=num2str(data.Coord(i,1),4); 153 YObject{i}=num2str(data.Coord(i,2),4); 154 end 155 set(handles.XObject,'String',XObject) 156 set(handles.YObject,'String',YObject) 157 if sizcoord(2)>3 158 for i=1:sizcoord(1) 159 ZObject{i}=num2str(data.Coord(i,3),4); 160 end 161 set(handles.ZObject,'String',ZObject) 162 end 163 end 164 end 165 if isfield(data,'DX') 166 if ~ischar(handles.DX) 167 data.DX=num2str(data.DX,3); 168 end 169 set(handles.DX,'String',data.DX) 170 end 171 if isfield(data,'DY') 172 if ~ischar(handles.DY) 173 data.DY=num2str(data.DY,3); 174 end 175 set(handles.DY,'String',data.DX) 176 end 98 end 99 errormsg=fill_GUI(data,handles); 100 % if isfield(data,'StyleMenu') 101 % set(handles.Type,'String',data.StyleMenu); 102 % end 103 % if isfield(data,'Type') 104 % menu=get(handles.Type,'String'); 105 % for iline=1:length(menu) 106 % if isequal(menu{iline},data.Style) 107 % set(handles.Type,'Value',iline) 108 % break 109 % end 110 % end 111 % end 112 Type_Callback(hObject, eventdata, handles) 113 % if isfield(data,'ProjMenu') 114 % set(handles.ProjMode,'String',data.ProjMenu);%overset the standard menu 115 % end 116 % if isfield(data,'ProjMode') 117 % menu=get(handles.ProjMode,'String'); 118 % for iline=1:length(menu) 119 % if isequal(menu{iline},data.ProjMode) 120 % set(handles.ProjMode,'Value',iline) 121 % break 122 % end 123 % end 124 % end 125 % ProjMode_Callback(hObject, eventdata, handles) 126 % if isfield(data,'Coord') 127 % if ischar(data.Coord) 128 % data.Coord=str2num(data.Coord); 129 % elseif iscell(data.Coord) 130 % CoordCell=data.Coord; 131 % data.Coord=zeros(numel(CoordCell),3); 132 % data.Coord(:,3)=zeros(numel(CoordCell),1); % z component set to 0 by default 133 % for iline=1:numel(CoordCell) 134 % line_vec=str2num(CoordCell{iline}); 135 % if numel(line_vec)==2 136 % data.Coord(iline,1:2)=str2num(CoordCell{iline}); 137 % else 138 % data.Coord(iline,:)=str2num(CoordCell{iline}); 139 % end 140 % end 141 % end 142 % if size(data.Coord,2)>=2 143 % sizcoord=size(data.Coord); 144 % for i=1:sizcoord(1) 145 % XObject{i}=num2str(data.Coord(i,1),4); 146 % YObject{i}=num2str(data.Coord(i,2),4); 147 % end 148 % % set(handles.XObject,'String',XObject) 149 % % set(handles.YObject,'String',YObject) 150 % if sizcoord(2)>3 151 % for i=1:sizcoord(1) 152 % ZObject{i}=num2str(data.Coord(i,3),4); 153 % end 154 % set(handles.ZObject,'String',ZObject) 155 % end 156 % end 157 % end 158 % if isfield(data,'DX') 159 % if ~ischar(handles.num_DX) 160 % data.DX=num2str(data.DX,3); 161 % end 162 % set(handles.num_DX,'String',data.DX) 163 % end 164 % if isfield(data,'DY') 165 % if ~ischar(handles.num_DY) 166 % data.DY=num2str(data.DY,3); 167 % end 168 % set(handles.num_DY,'String',data.DX) 169 % end 177 170 if isfield(data,'RangeZ') && length(ZBounds) >= 2 178 set(handles. ZMax,'String',num2str(max(data.RangeZ),3))171 set(handles.num_RangeZ_2,'String',num2str(max(data.RangeZ),3)) 179 172 DZ=max(data.RangeZ);%slider step 180 173 if ~isnan(ZBounds(1)) && ZBounds(2)~=ZBounds(1) … … 192 185 data.RangeX=str2num(data.RangeX); 193 186 end 194 set(handles. XMax,'String',num2str(max(data.RangeX),3))195 set(handles. XMin,'String',num2str(min(data.RangeX),3))187 set(handles.num_RangeX_2,'String',num2str(max(data.RangeX),3)) 188 set(handles.num_RangeX_1,'String',num2str(min(data.RangeX),3)) 196 189 end 197 190 if isfield(data,'RangeY') … … 199 192 data.RangeY=str2num(data.RangeY); 200 193 end 201 set(handles. YMax,'String',num2str(max(data.RangeY),3))202 set(handles. YMin,'String',num2str(min(data.RangeY),3))194 set(handles.num_RangeY_2,'String',num2str(max(data.RangeY),3)) 195 set(handles.num_RangeY_1,'String',num2str(min(data.RangeY),3)) 203 196 end 204 197 if isfield(data,'RangeZ') … … 206 199 data.RangeZ=str2num(data.RangeZ); 207 200 end 208 set(handles. ZMax,'String',num2str(max(data.RangeZ),3))201 set(handles.num_RangeZ_2,'String',num2str(max(data.RangeZ),3)) 209 202 if numel(data.RangeZ)>=2 210 set(handles. ZMin,'String',num2str(min(data.RangeZ),3))203 set(handles.num_RangeZ_1,'String',num2str(min(data.RangeZ),3)) 211 204 end 212 205 end 213 206 if isfield(data,'Angle') && isequal(numel(data.Angle),3) 214 set(handles. Phi,'String',num2str(data.Angle(1)))215 set(handles. Theta,'String',num2str(data.Angle(2)))216 set(handles. Psi,'String',num2str(data.Angle(3)))217 end 218 if isfield(data,'DZ')219 if ~ischar(handles.DZ)220 data.DY=num2str(data.DZ,3);221 end222 set(handles.DZ,'String',data.DZ)223 end224 if isfield(data,'CoordUnit')225 set(handles.CoordUnit,'String',data.CoordUnit)226 end207 set(handles.num_Angle_1,'String',num2str(data.Angle(1))) 208 set(handles.num_Angle_2,'String',num2str(data.Angle(2))) 209 set(handles.num_Angle_3,'String',num2str(data.Angle(3))) 210 end 211 % if isfield(data,'DZ') 212 % if ~ischar(handles.num_DZ) 213 % data.DY=num2str(data.DZ,3); 214 % end 215 % set(handles.num_DZ,'String',data.DZ) 216 % end 217 % if isfield(data,'CoordUnit') 218 % set(handles.CoordUnit,'String',data.CoordUnit) 219 % end 227 220 end 228 221 if enable_plot … … 241 234 end 242 235 236 243 237 %------------------------------------------------------------------------ 244 238 % --- Outputs from this function are returned to the command line. … … 250 244 251 245 %------------------------------------------------------------------------ 252 % --- Executes on selection change in ObjectStyle. 253 function ObjectStyle_Callback(hObject, eventdata, handles) 254 %------------------------------------------------------------------------ 255 style_prev=get(handles.ObjectStyle,'UserData');%previous object style 256 str=get(handles.ObjectStyle,'String'); 257 val=get(handles.ObjectStyle,'Value'); 258 style=str{val}; 246 % --- Executes on selection change in Type. 247 function Type_Callback(hObject, eventdata, handles) 248 %------------------------------------------------------------------------ 249 %style_prev=get(handles.Type,'UserData');%previous object style 250 ListType=get(handles.Type,'String'); 251 Type=ListType{get(handles.Type,'Value')}; 259 252 % make correspondance between different object styles 260 Xcolumn=get(handles.XObject,'String'); 261 Ycolumn=get(handles.YObject,'String'); 262 if ischar(Xcolumn) 263 sizchar=size(Xcolumn); 264 for icol=1:sizchar(1) 265 Xcolumn_cell{icol}=Xcolumn(icol,:); 266 end 267 Xcolumn=Xcolumn_cell; 268 end 269 if ischar(Ycolumn) 270 sizchar=size(Ycolumn); 271 for icol=1:sizchar(1) 272 Ycolumn_cell{icol}=Ycolumn(icol,:); 273 end 274 Ycolumn=Ycolumn_cell; 275 end 276 Zcolumn={};%default 277 z_new={}; 278 if isequal(get(handles.ZObject,'Visible'),'on') 279 %data.NbDim=3; %test 3D object 280 Zcolumn=get(handles.ZObject,'String'); 281 if ischar(Zcolumn) 282 Zcolumn={Zcolumn}; 283 end 284 end 285 x_new{1}=Xcolumn{1}; 286 y_new{1}=Ycolumn{1}; 287 if ~isempty(Zcolumn) 288 z_new{1}=Zcolumn{1}; 289 end 290 if isequal(style,'line') 291 if strcmp(style_prev,'rectangle')||strcmp(style_prev,'ellipse') 292 XMax=get(handles.XMax,'String'); 293 YMax=get(handles.YMax,'String'); 294 x_new{2}=num2str(XMax,4); 295 y_new{2}=num2str(YMax,4); 296 set(handles.XObject,'String',x_new) 297 set(handles.YObject,'String',y_new) 298 set(handles.ZObject,'String',z_new) 299 end 300 elseif isequal(style,'polyline') 301 elseif strcmp(style,'rectangle')|| strcmp(style,'ellipse') 302 set(handles.XObject,'String',x_new) 303 set(handles.YObject,'String',y_new) 304 set(handles.ZObject,'String',z_new) 305 end 306 307 switch style 253 Coord=get(handles.Coord,'Data'); 254 % 255 % Xcolumn=get(handles.XObject,'String'); 256 % Ycolumn=get(handles.YObject,'String'); 257 % if ischar(Xcolumn) 258 % sizchar=size(Xcolumn); 259 % for icol=1:sizchar(1) 260 % Xcolumn_cell{icol}=Xcolumn(icol,:); 261 % end 262 % Xcolumn=Xcolumn_cell; 263 % end 264 % if ischar(Ycolumn) 265 % sizchar=size(Ycolumn); 266 % for icol=1:sizchar(1) 267 % Ycolumn_cell{icol}=Ycolumn(icol,:); 268 % end 269 % Ycolumn=Ycolumn_cell; 270 % end 271 % Zcolumn={};%default 272 % z_new={}; 273 % if isequal(get(handles.ZObject,'Visible'),'on') 274 % %data.NbDim=3; %test 3D object 275 % Zcolumn=get(handles.ZObject,'String'); 276 % if ischar(Zcolumn) 277 % Zcolumn={Zcolumn}; 278 % end 279 % end 280 % x_new{1}=Xcolumn{1}; 281 % y_new{1}=Ycolumn{1}; 282 % x_new{1}=Coord(1,1); 283 % y_new{1}=Coord(1,2); 284 % z_new{1}=Coord(1,3); 285 % if ~isempty(Zcolumn) 286 % z_new{1}=Zcolumn{1}; 287 % end 288 % if isequal(style,'line') 289 % if strcmp(style_prev,'rectangle')||strcmp(style_prev,'ellipse') 290 % num_RangeX_2=get(handles.num_RangeX_2,'String'); 291 % num_RangeY_2=get(handles.num_RangeY_2,'String'); 292 % x_new{2}=num2str(num_RangeX_2,4); 293 % y_new{2}=num2str(num_RangeY_2,4); 294 % set(handles.XObject,'String',x_new) 295 % set(handles.YObject,'String',y_new) 296 % set(handles.ZObject,'String',z_new) 297 % end 298 % elseif isequal(style,'polyline') 299 % elseif strcmp(style,'rectangle')|| strcmp(style,'ellipse') 300 % set(handles.XObject,'String',x_new) 301 % set(handles.YObject,'String',y_new) 302 % set(handles.ZObject,'String',z_new) 303 % end 304 305 %% set the number of lines in the Coord table depending on object type 306 switch Type 307 case{'line'} 308 if size(Coord,1)<2 309 if isequal(size(Coord,2),3) 310 Coord=[Coord; 0 0 0];%add a line for edition (3D case) 311 else 312 Coord=[Coord; 0 0]; %add a line for edition (2D case) 313 end 314 else 315 Coord=Coord(1:2,:); 316 end 317 case{'rectangle','ellipse','plane','volume'} 318 Coord=Coord(1,:); 319 end 320 set(handles.Coord,'Data',Coord) 321 322 %% set the projection menu and the corresponding options 323 switch Type 308 324 case {'points','line','polyline','plane'} 309 325 menu_proj={'projection';'interp';'filter';'none'}; … … 312 328 case 'volume' 313 329 menu_proj={'interp';'none'}; 330 otherwise 331 menu_proj={'projection';'interp';'filter';'none'};%default 314 332 end 315 333 proj_index=get(handles.ProjMode,'Value'); … … 319 337 set(handles.ProjMode,'String',menu_proj) 320 338 ProjMode_Callback(hObject, eventdata, handles) 339 321 340 %store the current option 322 str=get(handles.ObjectStyle,'String');323 val=get(handles.ObjectStyle,'Value');324 set(handles.ObjectStyle,'UserData',style)341 % str=get(handles.Type,'String'); 342 % val=get(handles.Type,'Value'); 343 % set(handles.Type,'UserData',style) 325 344 326 345 %------------------------------------------------------------------------ … … 341 360 value=get(handles.ProjMode,'Value'); 342 361 ProjMode=menu{value}; 343 menu=get(handles. ObjectStyle,'String');344 value=get(handles. ObjectStyle,'Value');362 menu=get(handles.Type,'String'); 363 value=get(handles.Type,'Value'); 345 364 ObjectStyle=menu{value}; 346 test3D=isequal(get(handles.ZObject,'Visible'),'on');%3D case 347 365 %%%%%%%%% TODO 366 test3D=0; %TODO: update test3D=isequal(get(handles.ZObject,'Visible'),'on');%3D case 367 %%%%%%%%% 348 368 %default setting 349 set(handles. Phi,'Visible','off')350 set(handles. Theta,'Visible','off')351 set(handles. Psi,'Visible','off')352 set(handles. XMin,'Visible','off')353 set(handles. XMax,'Visible','off')354 set(handles. YMin,'Visible','off')369 set(handles.num_Angle_1,'Visible','off') 370 set(handles.num_Angle_2,'Visible','off') 371 set(handles.num_Angle_3,'Visible','off') 372 set(handles.num_RangeX_1,'Visible','off') 373 set(handles.num_RangeX_2,'Visible','off') 374 set(handles.num_RangeY_1,'Visible','off') 355 375 if isequal(ProjMode,'interp') 356 set(handles. YMax,'Visible','off')357 else 358 set(handles. YMax,'Visible','on')376 set(handles.num_RangeY_2,'Visible','off') 377 else 378 set(handles.num_RangeY_2,'Visible','on') 359 379 end 360 380 if strcmp(ObjectStyle,'rectangle')||strcmp(ObjectStyle,'ellipse') 361 set(handles. XMax,'Visible','on')362 else 363 set(handles. XMax,'Visible','off')364 end 365 set(handles. ZMin,'Visible','off')366 set(handles. ZMax,'Visible','off')367 set(handles. DX,'Visible','off')368 set(handles. DY,'Visible','off')369 set(handles. DZ,'Visible','off')381 set(handles.num_RangeX_2,'Visible','on') 382 else 383 set(handles.num_RangeX_2,'Visible','off') 384 end 385 set(handles.num_RangeZ_1,'Visible','off') 386 set(handles.num_RangeZ_2,'Visible','off') 387 set(handles.num_DX,'Visible','off') 388 set(handles.num_DY,'Visible','off') 389 set(handles.num_DZ,'Visible','off') 370 390 371 391 switch ObjectStyle 372 392 case 'points' 373 set(handles. YMax,'TooltipString','YMax: range of averagingaround each point')374 set(handles.XObject,'TooltipString','XObject: set of x coordinates of the points')375 set(handles.YObject,'TooltipString','YObject: set of y coordinates of the points')376 set(handles.ZObject,'TooltipString','ZObject: set of z coordinates of the points')393 set(handles.num_RangeY_2,'TooltipString','num_YMax: range of projection around each point') 394 % set(handles.XObject,'TooltipString','XObject: set of x coordinates of the points') 395 % set(handles.YObject,'TooltipString','YObject: set of y coordinates of the points') 396 % set(handles.ZObject,'TooltipString','ZObject: set of z coordinates of the points') 377 397 case {'line','polyline','polygon'} 378 set(handles. YMax,'TooltipString','YMax: range of averagingaround the line')379 set(handles.XObject,'TooltipString','XObject: set of xcoordinates defining the line')380 set(handles.YObject,'TooltipString','YObject: set of y coordinates defining the line')381 set(handles.ZObject,'TooltipString','ZObject: set of z coordinates defining the line')398 set(handles.num_RangeY_2,'TooltipString','num_YMax: range of projection around the line') 399 set(handles.Coord,'TooltipString','Coord: table of x,y, z coordinates defining the line') 400 % set(handles.YObject,'TooltipString','YObject: set of y coordinates defining the line') 401 % set(handles.ZObject,'TooltipString','ZObject: set of z coordinates defining the line') 382 402 if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter') 383 set(handles. DX,'Visible','on')384 set(handles. DX,'TooltipString','DX: mesh for the interpolated field along the line')403 set(handles.num_DX,'Visible','on') 404 set(handles.num_DX,'TooltipString','num_DX: mesh for the interpolated field along the line') 385 405 end 386 406 case {'rectangle','ellipse'} 387 set(handles. XMax,'TooltipString',['XMax: half length of the ' ObjectStyle])388 set(handles. YMax,'TooltipString',['YMax: half width of the ' ObjectStyle])389 set(handles.XObject,'TooltipString',['XObject: x coordinate of the ' ObjectStyle ' centre'])390 set(handles.YObject,'TooltipString',['YObject: y coordinate of the ' ObjectStyle ' centre'])407 set(handles.num_RangeX_2,'TooltipString',['num_XMax: half length of the ' ObjectStyle]) 408 set(handles.num_RangeY_2,'TooltipString',['num_YMax: half width of the ' ObjectStyle]) 409 % set(handles.XObject,'TooltipString',['XObject: x coordinate of the ' Type ' centre']) 410 % set(handles.YObject,'TooltipString',['YObject: y coordinate of the ' Type ' centre']) 391 411 case {'plane'} 392 set(handles.Psi,'Visible','on') 393 set(handles.XMin,'Visible','on') 394 set(handles.XMax,'Visible','on') 395 set(handles.YMin,'Visible','on') 396 set(handles.YMax,'Visible','on') 412 set(handles.num_Angle_3,'Visible','on') 413 set(handles.num_RangeX_1,'Visible','on') 414 set(handles.num_RangeX_2,'Visible','on') 415 set(handles.num_RangeY_1,'Visible','on') 416 set(handles.num_RangeY_2,'Visible','on') 417 % set(handles.XObject,'TooltipString',['XObject: x coordinate of the axis origin for the ' Type]) 418 % set(handles.YObject,'TooltipString',['YObject: y coordinate of the axis origin for the ' Type]) 419 set(handles.num_RangeZ_2,'TooltipString','num_ZMax: range of projection normal to the plane') 420 if test3D 421 set(handles.num_Angle_2,'Visible','on') 422 set(handles.num_Angle_1,'Visible','on') 423 set(handles.num_RangeZ_2,'Visible','on') 424 end 425 if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter') 426 set(handles.num_DX,'Visible','on') 427 set(handles.num_DY,'Visible','on') 428 else 429 set(handles.num_DX,'Visible','off') 430 set(handles.num_DY,'Visible','off') 431 end 432 if isequal(ProjMode,'interp') 433 set(handles.num_DZ,'Visible','on') 434 end 435 case {'volume'} 436 set(handles.num_RangeX_1,'Visible','on') 437 set(handles.num_RangeX_2,'Visible','on') 438 set(handles.num_RangeY_1,'Visible','on') 439 set(handles.num_RangeY_2,'Visible','on') 397 440 set(handles.XObject,'TooltipString',['XObject: x coordinate of the axis origin for the ' ObjectStyle]) 398 441 set(handles.YObject,'TooltipString',['YObject: y coordinate of the axis origin for the ' ObjectStyle]) 399 set(handles.ZMax,'TooltipString','ZMax: range of projection normal to the plane') 400 if test3D 401 set(handles.Theta,'Visible','on') 402 set(handles.Phi,'Visible','on') 403 set(handles.ZMax,'Visible','on') 404 end 442 set(handles.num_Angle_1,'Visible','on') 443 set(handles.num_Angle_2,'Visible','on') 444 set(handles.num_Angle_3,'Visible','on') 445 set(handles.num_RangeZ_1,'Visible','on') 446 set(handles.num_RangeZ_2,'Visible','on') 405 447 if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter') 406 set(handles.DX,'Visible','on') 407 set(handles.DY,'Visible','on') 448 set(handles.num_DX,'Visible','on') 449 set(handles.num_DY,'Visible','on') 450 set(handles.num_DZ,'Visible','on') 408 451 else 409 set(handles.DX,'Visible','off') 410 set(handles.DY,'Visible','off') 411 end 412 if isequal(ProjMode,'interp') 413 set(handles.DZ,'Visible','on') 414 end 415 case {'volume'} 416 set(handles.XMin,'Visible','on') 417 set(handles.XMax,'Visible','on') 418 set(handles.YMin,'Visible','on') 419 set(handles.YMax,'Visible','on') 420 set(handles.XObject,'TooltipString',['XObject: x coordinate of the axis origin for the ' ObjectStyle]) 421 set(handles.YObject,'TooltipString',['YObject: y coordinate of the axis origin for the ' ObjectStyle]) 422 set(handles.Phi,'Visible','on') 423 set(handles.Theta,'Visible','on') 424 set(handles.Psi,'Visible','on') 425 set(handles.ZMin,'Visible','on') 426 set(handles.ZMax,'Visible','on') 427 if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter') 428 set(handles.DX,'Visible','on') 429 set(handles.DY,'Visible','on') 430 set(handles.DZ,'Visible','on') 431 else 432 set(handles.DX,'Visible','off') 433 set(handles.DY,'Visible','off') 434 set(handles.DZ,'Visible','off') 435 end 436 end 437 %------------------------------------------------------------------------ 438 439 %------------------------------------------------------------------------ 440 function Phi_Callback(hObject, eventdata, handles) 452 set(handles.num_DX,'Visible','off') 453 set(handles.num_DY,'Visible','off') 454 set(handles.num_DZ,'Visible','off') 455 end 456 end 457 %------------------------------------------------------------------------ 458 459 %------------------------------------------------------------------------ 460 function num_Angle_1_Callback(hObject, eventdata, handles) 441 461 update_slider(hObject, eventdata,handles) 442 462 %------------------------------------------------------------------------ 443 463 %------------------------------------------------------------------------ 444 function Theta_Callback(hObject, eventdata, handles)464 function num_Angle_2_Callback(hObject, eventdata, handles) 445 465 update_slider(hObject, eventdata,handles) 446 466 %------------------------------------------------------------------------ 447 467 function update_slider(hObject, eventdata,handles) 448 468 %rotation angles 449 PlaneAngle(1)=str2num(get(handles. Phi,'String'));%first angle in degrees450 PlaneAngle(2)=str2num(get(handles. Theta,'String'));%second angle in degrees451 PlaneAngle(3)=str2num(get(handles. Psi,'String'));%second angle in degrees469 PlaneAngle(1)=str2num(get(handles.num_Angle_1,'String'));%first angle in degrees 470 PlaneAngle(2)=str2num(get(handles.num_Angle_2,'String'));%second angle in degrees 471 PlaneAngle(3)=str2num(get(handles.num_Angle_3,'String'));%second angle in degrees 452 472 om=norm(PlaneAngle);%norm of rotation angle in radians 453 473 OmAxis=PlaneAngle/om; %unit vector marking the rotation axis … … 468 488 end 469 489 %------------------------------------------------------------------------ 470 function DX_Callback(hObject, eventdata, handles) 471 %------------------------------------------------------------------------ 472 %------------------------------------------------------------------------ 473 function DY_Callback(hObject, eventdata, handles) 474 %------------------------------------------------------------------------ 475 %------------------------------------------------------------------------ 476 function DZ_Callback(hObject, eventdata, handles) 477 %------------------------------------------------------------------------ 478 479 %------------------------------------------------------------------------ 480 %----------------------------------------------------- 481 % --- Executes on button press in OPEN: DESACTIVATED use uvmat browser 482 function OPEN_Callback(hObject, eventdata, handles) 483 %get the object file 484 oldfile=' '; 485 huvmat=findobj('Tag','uvmat'); 486 hchild=get(huvmat,'Children'); 487 hrootpath=findobj(hchild,'Tag','RootPath'); 488 if ~isempty(hrootpath) 489 oldfile=get(hrootpath,'String'); 490 if iscell(oldfile) 491 oldfile=oldfile{1}; 492 end 493 end 494 [FileName, PathName, filterindex] = uigetfile( ... 495 {'*.xml;*.mat', ' (*.xml,*.mat)'; 496 '*.xml', '.xml files '; ... 497 '*.mat', '.mat matlab files '}, ... 498 'Pick a file',oldfile); 499 fileinput=[PathName FileName];%complete file name 500 testblank=findstr(fileinput,' ');%look for blanks 501 if ~isempty(testblank) 502 msgbox_uvmat('ERROR','forbidden input file name: contain blanks') 503 return 504 end 505 sizf=size(fileinput); 506 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end 507 508 %read the file 509 t=xmltree(fileinput); 510 s=convert(t); 511 if ~isfield(s,'Style') 512 s.Style='points'; 513 end 514 if ~isfield(s,'ProjMode') 515 s.ProjMode='none'; 516 end 517 teststyle=0; 518 519 switch s.Style 520 case {'points','line','polyline','plane'} 521 menu_proj={'projection';'interp';'filter';'none'}; 522 case {'polygon','rectangle','ellipse'} 523 menu_proj={'inside';'outside';'mask_inside';'mask_outside'}; 524 case 'volume' 525 menu_proj={'none'}; 526 end 527 set(handles.ObjectStyle,'String',menu_proj) 528 menu=get(handles.ObjectStyle,'String'); 529 for iline=1:length(menu) 530 if isequal(menu{iline},s.Style) 531 set(handles.ObjectStyle,'Value',iline) 532 teststyle=1; 533 break 534 end 535 end 536 testmode=0; 537 %menu=get(handles.ProjMode,'String'); 538 for iline=1:length(menu_proj) 539 if isequal(menu_proj{iline},s.ProjMode) 540 set(handles.ProjMode,'Value',iline) 541 testmode=1; 542 break 543 end 544 end 545 546 ProjMode_Callback(hObject, eventdata, handles);%visualize the appropriate edit boxes 547 if isfield(s,'XMax') 548 set(handles.XMax,'String',s.XMax) 549 end 550 if isfield(s,'XMin') 551 set(handles.XMin,'String',s.XMin) 552 end 553 if isfield(s,'YMax') 554 set(handles.YMax,'String',s.YMax) 555 end 556 if isfield(s,'YMin') 557 set(handles.YMin,'String',s.YMin) 558 end 559 Range=0; 560 if isfield(s,'Range') 561 if ischar(s.Range) 562 Range=str2num(s.Range); 563 else 564 Range(1,:)=str2num(s.Range{1}); 565 Range(2,:)=str2num(s.Range{2}); 566 end 567 end 568 if size(Range,2)>=3 569 if size(Range,1)>=2 570 set(handles.ZMin,'String',num2str(Range(2,3),3)) 571 end 572 if size(Range,1)>=2 573 set(handles.ZMax,'String',num2str(Range(1,3),3)) 574 end 575 end 576 if size(Range,2)>=2 577 if size(Range,1)>=2 578 set(handles.YMin,'String',num2str(Range(2,2),3)) 579 end 580 if size(Range,1)>=2 581 set(handles.YMax,'String',num2str(Range(1,2),3)) 582 end 583 end 584 if size(Range,2)>=1 585 if size(Range,1)>=2 586 set(handles.XMin,'String',num2str(Range(2,1),3)) 587 end 588 if size(Range,1)>=2 589 set(handles.XMax,'String',num2str(Range(1,1),3)) 590 end 591 end 592 if isfield(s,'RangeX') & ischar(s.RangeX) 593 RangeX=str2num(s.RangeX); 594 set(handles.XMax,'String',num2str(max(RangeX),3)) 595 set(handles.XMin,'String',num2str(min(RangeX),3)) 596 end 597 598 if isfield(s,'RangeY') 599 if ischar(s.RangeY) 600 RangeY=str2num(s.RangeY); 601 set(handles.YMax,'String',num2str(max(RangeY),3)) 602 set(handles.YMin,'String',num2str(min(RangeY),3)) 603 end 604 end 605 if isfield(s,'RangeZ') 606 if ischar(s.RangeZ) 607 RangeZ=str2num(s.RangeZ); 608 set(handles.ZMax,'String',num2str(max(RangeZ),3)) 609 set(handles.ZMin,'String',num2str(min(RangeZ),3)) 610 end 611 end 612 if isfield(s,'Phi') 613 set(handles.Psi,'String',s.Phi)%old definition 614 end 615 if isfield(s,'Angle')&& isequal(numel(s.Angle),3) 616 set(handles.Phi,'String',s.Angle(1)) 617 set(handles.Theta,'String',s.Angle(2)) 618 set(handles.Psi,'String',s.Angle(3)) 619 end 620 % if isfield(s,'Psi') 621 % set(handles.Psi,'String',s.Psi) 622 % end 623 624 if isfield(s,'DX') 625 set(handles.DX,'String',s.DX) 626 end 627 if isfield(s,'DY') 628 set(handles.DY,'String',s.DY) 629 end 630 if ~isfield(s,'Coord') 631 XObject='0';%default 632 YObject='0'; 633 elseif ischar(s.Coord) 634 line=str2num(s.Coord); 635 XObject=num2str(line(1),4); 636 YObject=num2str(line(2),4); 637 else 638 for i=1:length(s.Coord) 639 line=str2num(s.Coord{i}); 640 XObject{i}=num2str(line(1),4); 641 YObject{i}=num2str(line(2),4); 642 end 643 end 644 set(handles.XObject,'String',XObject) 645 set(handles.YObject,'String',YObject) 646 647 %METTRA A JOUR ASPECT DE L'INTERFACE (COMME set_object_Opening 490 function num_DX_Callback(hObject, eventdata, handles) 491 %------------------------------------------------------------------------ 492 %------------------------------------------------------------------------ 493 function num_DY_Callback(hObject, eventdata, handles) 494 %------------------------------------------------------------------------ 495 %------------------------------------------------------------------------ 496 function num_DZ_Callback(hObject, eventdata, handles) 497 %------------------------------------------------------------------------ 498 499 %------------------------------------------------------------------------ 648 500 %------------------------------------------------------------------------ 649 501 %---------------------------------------------------- … … 675 527 676 528 %% read the object on the GUI set_object 677 ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object 678 ObjectName=get(handles.TITLE,'String');%name of the current object defiend in set_object 529 %ObjectData=read_set_object(handles.set_object);%read the input parameters defining the object in the GUI set_object 530 ObjectData=read_GUI(handles.set_object);%read the input parameters defining the object in the GUI set_object 531 %ObjectData.Coord=cell2mat(ObjectData.Coord); 532 ObjectName=ObjectData.Name;%name of the current object defiend in set_object 679 533 if isempty(ObjectName) 680 534 if get(hhuvmat.edit_object,'Value')% edit mode 681 535 ObjectName=ListObject{IndexObj(end)};%take the name of the last (second) selected item 682 536 else %new object 683 StyleList=get(handles. ObjectStyle,'String');684 StyleVal=get(handles. ObjectStyle,'Value');537 StyleList=get(handles.Type,'String'); 538 StyleVal=get(handles.Type,'Value'); 685 539 ObjectName=StyleList{StyleVal}; 686 %ObjectName=[num2str(numel(ListObject)+1) '-' StyleList{StyleVal}];% take the object style as default name687 540 end 688 541 end … … 705 558 end 706 559 ObjectName=ObjectNameNew; 707 % ObjectName=[num2str(IndexObj(end)) '-' ObjectData.Style];%default name 708 set(handles.TITLE,'String',ObjectName)% display the default name in set_object 560 set(handles.Name,'String',ObjectName)% display the default name in set_object 709 561 IndexObj(2)=numel(ListObject)+1;% append an object to the list in uvmat 710 562 set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list … … 712 564 UvData.Object{IndexObj(2)}=[];%initiate a new object (empty yet) 713 565 end 714 % IndexObj_1=IndexObj(1);715 % % if isequal(get(hhuvmat.list_object_2,'Visible'),'on')716 % % IndexObj_2=get(hhuvmat.list_object_2,'Value');717 % % List2=get(hhuvmat.list_object_2,'String');718 % if numel(IndexObj)==2719 % IndexObj_2=IndexObj(2);720 % else721 % IndexObj_2=[];722 % end723 566 testnew=0; 724 725 567 if numel(IndexObj)==1 % if only one object is selected, the projection is in uvmat 726 PlotHandles=hhuvmat;568 % PlotHandles=hhuvmat; 727 569 plotaxes=hhuvmat.axes3;%handle of axes3 in view_field 728 570 else % if a second object is selected, the projection is in view_field, and this second object is selected … … 783 625 %------------------------------------------------------------------------ 784 626 %---------------------------------------------------- 785 function YMin_Callback(hObject, eventdata, handles)786 %------------------------------------------------------------------------ 787 788 function ZMin_Callback(hObject, eventdata, handles)789 %------------------------------------------------------------------------ 790 791 function ZMax_Callback(hObject, eventdata, handles)792 DZ=str2num(get(handles. ZMax,'String'));627 function num_RangeY_1_Callback(hObject, eventdata, handles) 628 %------------------------------------------------------------------------ 629 630 function num_RangeZ_1_Callback(hObject, eventdata, handles) 631 %------------------------------------------------------------------------ 632 633 function num_RangeZ_2_Callback(hObject, eventdata, handles) 634 DZ=str2num(get(handles.num_RangeZ_2,'String')); 793 635 ZMin=get(handles.z_slider,'Min'); 794 636 ZMax=get(handles.z_slider,'Max'); … … 799 641 end 800 642 %------------------------------------------------------------------------ 801 function YMax_Callback(hObject, eventdata, handles)802 %------------------------------------------------------------------------ 803 804 function XMin_Callback(hObject, eventdata, handles)805 %------------------------------------------------------------------------ 806 807 function XMax_Callback(hObject, eventdata, handles)643 function num_RangeY_2_Callback(hObject, eventdata, handles) 644 %------------------------------------------------------------------------ 645 646 function num_RangeX_1_Callback(hObject, eventdata, handles) 647 %------------------------------------------------------------------------ 648 649 function num_RangeX_2_Callback(hObject, eventdata, handles) 808 650 %------------------------------------------------------------------------ 809 651 %------------------------------------------------------------------------ 810 652 function SAVE_Callback(hObject, eventdata, handles) 811 653 % ------------------------------------------------------ 812 Object=read_set_object(handles); 654 %Object=read_set_object(handles); 655 Object=read_GUI(handles.set_object); 813 656 huvmat=findobj('Tag','uvmat'); 814 657 % UvData=get(huvmat,'UserData'); … … 828 671 title={'object name'}; 829 672 dir_save=uigetdir(RootPath); 830 ObjectName=get(handles. TITLE,'String');673 ObjectName=get(handles.Name,'String'); 831 674 if ~isempty(ObjectName)&&~strcmp(ObjectName,'') 832 675 def={fullfile(dir_save,[ObjectName '.xml'])}; … … 859 702 sin_om=0; 860 703 861 PlaneAngle(1)=str2double(get(handles. Phi,'String'));%first angle in degrees862 PlaneAngle(2)=str2double(get(handles. Theta,'String'));%second angle in degrees863 PlaneAngle(3)=str2double(get(handles. Psi,'String'));%second angle in degrees704 PlaneAngle(1)=str2double(get(handles.num_Angle_1,'String'));%first angle in degrees 705 PlaneAngle(2)=str2double(get(handles.num_Angle_2,'String'));%second angle in degrees 706 PlaneAngle(3)=str2double(get(handles.num_Angle_3,'String'));%second angle in degrees 864 707 PlaneAngle=(pi/180)*PlaneAngle; 865 708 om=norm(PlaneAngle);%norm of rotation angle in radians … … 878 721 879 722 %set new plane position and update graph 880 set(handles.XObject,'String',num2str(norm_plane(1)*Z_value,4))881 set(handles.YObject,'String',num2str(norm_plane(2)*Z_value,4))882 set(handles.ZObject,'String',num2str(norm_plane(3)*Z_value,4))723 % set(handles.XObject,'String',num2str(norm_plane(1)*Z_value,4)) 724 % set(handles.YObject,'String',num2str(norm_plane(2)*Z_value,4)) 725 % set(handles.ZObject,'String',num2str(norm_plane(3)*Z_value,4)) 883 726 PLOT_Callback(hObject, eventdata, handles) 884 727 … … 897 740 %------------------------------------------------------------------------ 898 741 899 742 function Name_Callback(hObject, eventdata, handles) 743 % hObject handle to Name (see GCBO) 744 % eventdata reserved - to be defined in a future version of MATLAB 745 % handles structure with handles and user data (see GUIDATA) 746 747 % Hints: get(hObject,'String') returns contents of Name as text 748 % str2double(get(hObject,'String')) returns contents of Name as a double 749 750 %------------------------------------------------------------------------ 751 % --- Executes when entered data in editable cell(s) in Coord. 752 function Coord_CellEditCallback(hObject, eventdata, handles) 753 %------------------------------------------------------------------------ 754 ListType=get(handles.Type,'String'); 755 Type=ListType{get(handles.Type,'Value')}; 756 switch Type 757 % add lines if multi line input needed 758 case{'points','polyline','polygon'} 759 Coord=get(handles.Coord,'Data'); 760 if isequal(size(Coord,2),3) 761 Coord=[Coord;{[]} {[]} {[]}];%add a line for edition (3D case) 762 else 763 Coord=[Coord;{[]} {[]}]; %add a line for edition (2D case) 764 end 765 set(handles.Coord,'Data',Coord) 766 end 767 768 769 770 function num_Angle_3_Callback(hObject, eventdata, handles) 771 % hObject handle to num_Angle_3 (see GCBO) 772 % eventdata reserved - to be defined in a future version of MATLAB 773 % handles structure with handles and user data (see GUIDATA) 774 775 % Hints: get(hObject,'String') returns contents of num_Angle_3 as text 776 % str2double(get(hObject,'String')) returns contents of num_Angle_3 as a double -
trunk/src/update_obj.m
r302 r379 30 30 end 31 31 Object_out{iobj}.DisplayHandle_uvmat=plot_object(Object_out{iobj},Object_out{IndexObj_1},hobject,'m');%update the object representation of Object_out{iobj} on Object_out{IndexObj_1} 32 Object_out{iobj}.DisplayHandle_uvmat33 32 end 34 33 % plot view_field -
trunk/src/uvmat.m
r371 r379 155 155 % Properties attached to projection objects (create, menuline, menuplane...): 156 156 % 'Tag'='proj_object': for all projection objects 157 % ObjectData. Style=...: style of projection object:157 % ObjectData.Type=...: style of projection object: 158 158 % .ProjMode 159 159 % .Coord: defines the position of the object … … 815 815 end 816 816 if ~isempty(XmlData.Time) 817 nbfield=size(XmlData.Time,1);818 nbfield_j=size(XmlData.Time,2);817 % nbfield=size(XmlData.Time,1); 818 % nbfield_j=size(XmlData.Time,2); 819 819 %transform .Time to a column vector if it is a line vector the nomenclature uses a single index 820 820 if isequal(nbfield,1) && ~isequal(nbfield_j,1)% .Time is a line vector … … 822 822 if numel(NomType)>=2 &&(strcmp(NomType,'_i')||strcmp(NomType(1:2),'%0')||strcmp(NomType(1:2),'_%')) 823 823 XmlData.Time=(XmlData.Time)'; 824 nbfield=nbfield_j;825 nbfield_j=1;824 % nbfield=nbfield_j; 825 % nbfield_j=1; 826 826 end 827 827 end … … 2104 2104 set(handles.FixVelType,'Visible','on') 2105 2105 menu=set_veltype_display(ParamOut.CivStage); 2106 index_menu=strcmp(ParamOut.VelType,menu); 2107 set(handles.VelType,'Value',find(index_menu,1)) 2106 index_menu=strcmp(ParamOut.VelType,menu);%look for VelType in the menu 2107 index_val=find(index_menu,1); 2108 if isempty(index_val) 2109 index_val=1; 2110 end 2111 set(handles.VelType,'Value',index_val) 2108 2112 if ~get(handles.SubField,'value') 2109 set(handles.VelType,'String',menu)2110 set(handles.VelType_1,'Value',1)2111 set(handles.VelType_1,'String',[{''};menu])2113 set(handles.VelType,'String',menu) 2114 set(handles.VelType_1,'Value',1) 2115 set(handles.VelType_1,'String',[{''};menu]) 2112 2116 end 2113 2117 else … … 2332 2336 if test_set_object% reinitiate the GUI set_object 2333 2337 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 2334 UvData.Object{1}. Style='plane';%main plotting plane2338 UvData.Object{1}.Type='plane';%main plotting plane 2335 2339 UvData.Object{1}.ProjMode='projection';%main plotting plane 2336 2340 UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat … … 3154 3158 edit_vect_Callback(hObject, eventdata, handles) 3155 3159 %initiate set_object GUI 3156 data. TITLE='VOLUME';3160 data.Name='VOLUME'; 3157 3161 if isfield(UvData,'CoordType') 3158 3162 data.CoordType=UvData.CoordType; … … 3240 3244 end 3241 3245 if isfield(ObjectData,'Coord')& isfield(ObjectData,'Style') 3242 if isequal(ObjectData. Style,'polygon')3246 if isequal(ObjectData.Type,'polygon') 3243 3247 X=ObjectData.Coord(:,1); 3244 3248 Y=ObjectData.Coord(:,2); … … 3247 3251 end 3248 3252 flagobj=~inpolygon(Xi,Yi,X',Y');%=0 inside the polygon, 1 outside 3249 elseif isequal(ObjectData. Style,'ellipse')3253 elseif isequal(ObjectData.Type,'ellipse') 3250 3254 if testphys 3251 3255 %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys … … 3258 3262 distY=(Yi-ObjectData.Coord(1,2)); 3259 3263 flagobj=(distX.*distX/X2Max+distY.*distY/Y2Max)>1; 3260 elseif isequal(ObjectData. Style,'rectangle')3264 elseif isequal(ObjectData.Type,'rectangle') 3261 3265 if testphys 3262 3266 %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys … … 4178 4182 end 4179 4183 if isfield(ObjectData,'Coord')&& isfield(ObjectData,'Style') 4180 if isequal(ObjectData. Style,'polygon')4184 if isequal(ObjectData.Type,'polygon') 4181 4185 X=ObjectData.Coord(:,1); 4182 4186 Y=ObjectData.Coord(:,2); … … 4185 4189 end 4186 4190 flagobj=~inpolygon(Xi,Yi,X',Y');%=0 inside the polygon, 1 outside 4187 elseif isequal(ObjectData. Style,'ellipse')4191 elseif isequal(ObjectData.Type,'ellipse') 4188 4192 if testphys 4189 4193 %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys … … 4196 4200 distY=(Yi-ObjectData.Coord(1,2)); 4197 4201 flagobj=(distX.*distX/X2Max+distY.*distY/Y2Max)>1; 4198 elseif isequal(ObjectData. Style,'rectangle')4202 elseif isequal(ObjectData.Type,'rectangle') 4199 4203 if testphys 4200 4204 %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys … … 4350 4354 function Menupoints_Callback(hObject, eventdata, handles) 4351 4355 %------------------------------------------------------------------------ 4352 data. Style='points';4356 data.Type='points'; 4353 4357 data.ProjMode='projection';%default 4354 4358 create_object(data,handles) … … 4357 4361 function Menuline_Callback(hObject, eventdata, handles) 4358 4362 %------------------------------------------------------------------------ 4359 data. Style='line';4363 data.Type='line'; 4360 4364 data.ProjMode='projection';%default 4361 4365 create_object(data,handles) … … 4364 4368 function Menupolyline_Callback(hObject, eventdata, handles) 4365 4369 %------------------------------------------------------------------------ 4366 data. Style='polyline';4370 data.Type='polyline'; 4367 4371 data.ProjMode='projection';%default 4368 4372 create_object(data,handles) … … 4371 4375 function Menupolygon_Callback(hObject, eventdata, handles) 4372 4376 %------------------------------------------------------------------------ 4373 data. Style='polygon';4377 data.Type='polygon'; 4374 4378 data.ProjMode='inside';%default 4375 4379 create_object(data,handles) … … 4378 4382 function Menurectangle_Callback(hObject, eventdata, handles) 4379 4383 %------------------------------------------------------------------------ 4380 data. Style='rectangle';4384 data.Type='rectangle'; 4381 4385 data.ProjMode='inside';%default 4382 4386 create_object(data,handles) … … 4385 4389 function Menuellipse_Callback(hObject, eventdata, handles) 4386 4390 %------------------------------------------------------------------------ 4387 data. Style='ellipse';4391 data.Type='ellipse'; 4388 4392 data.ProjMode='inside';%default 4389 4393 create_object(data,handles) … … 4392 4396 function MenuMaskObject_Callback(hObject, eventdata, handles) 4393 4397 %------------------------------------------------------------------------ 4394 data. Style='polygon';4395 data. StyleMenu={'polygon'};4398 data.Type='polygon'; 4399 data.TypeMenu={'polygon'}; 4396 4400 data.ProjMode='mask_inside';%default 4397 4401 data.ProjMenu={'mask_inside';'mask_outside'}; … … 4401 4405 function Menuplane_Callback(hObject, eventdata, handles) 4402 4406 %------------------------------------------------------------------------ 4403 data. Style='plane';4407 data.Type='plane'; 4404 4408 data.ProjMode='projection';%default 4405 4409 … … 4409 4413 function Menuvolume_Callback(hObject, eventdata, handles) 4410 4414 %------------------------------------------------------------------------ 4411 data. Style='volume';4415 data.Type='volume'; 4412 4416 data.ProjMode='interp';%default 4413 4417 % set(handles.create,'Visible','on') … … 4430 4434 4431 4435 %read the file 4432 t=xmltree(fileinput); 4433 data=convert(t); 4436 % t=xmltree(fileinput); 4437 % data=convert(t); 4438 data=xml2struct(fileinput); 4434 4439 data.enable_plot=1; 4435 4440 [pp,data.Name]=fileparts(FileName); … … 4466 4471 val=get(handles.transform_fct,'Value'); 4467 4472 %data.CoordType=transform_list{val}; 4473 data.Coord=[0 0]; %default 4468 4474 if isfield(UvData,'Field') 4469 4475 Field=UvData.Field; … … 4481 4487 data.DX=max(meshx,meshy); 4482 4488 end 4483 if isfield(Field,'NbDim') 4484 data.NbDim=Field.NbDim;4489 if isfield(Field,'NbDim')&& isequal(Field.NbDim,3) 4490 data.Coord=[0 0 0]; %default 4485 4491 end 4486 4492 if isfield(Field,'CoordUnit') … … 4488 4494 end 4489 4495 end 4490 data.Coord=[0 0 0]; %default 4491 if isfield(data,'Style') && isequal(data.Style,'line') 4492 if isfield(data,'DX') 4493 data.Coord=[[0 0 0];[data.DX 0 0]]; %default 4494 else 4495 data.Coord=[[0 0 0];[1 0 0]]; %default 4496 end 4497 end 4496 % if isfield(data,'Type') && isequal(data.Type,'line') 4497 % if isfield(data,'DX') 4498 % data.Coord=[[0 0 0];[data.DX 0 0]]; %default 4499 % else 4500 % data.Coord=[[0 0 0];[1 0 0]]; %default 4501 % end 4502 % end 4498 4503 if ishandle(handles.UVMAT_title) 4499 4504 delete(handles.UVMAT_title)%delete the initial display of uvmat if no field has been entered -
trunk/src/xml2struct.m
r369 r379 23 23 out.(names{k})=convert_string(s.(names{k})); 24 24 end 25 case 'char' 26 27 if isempty(regexp(s,'^\d+\.*\d*$'))% if the string contains numerical characters and decimal . only 25 case 'char' 26 if isempty(regexp(s,'^(-*\d+\.*\d*\ *)+$'))% if the string contains a set of numbers (with possible sign and decimal) separated by blanks 28 27 out=s; 29 28 else 30 29 out=str2num(s); 30 end 31 case 'cell' 32 for ilist=1:numel(s) 33 out(ilist,:)=str2num(s{ilist}); 31 34 end 32 35 otherwise
Note: See TracChangeset
for help on using the changeset viewer.