1 | %'set_object': GUI to edit a projection object |
---|
2 | %------------------------------------------------------------------------ |
---|
3 | % function hset_object= set_object(data, PlotHandles,ZBounds) |
---|
4 | % associated with the GUI set_object.fig |
---|
5 | % |
---|
6 | % OUTPUT: |
---|
7 | % hset_object: handle of the GUI figure |
---|
8 | % |
---|
9 | % INPUT: |
---|
10 | % data: structure describing the object properties |
---|
11 | % .Style=... |
---|
12 | % .ProjMode |
---|
13 | % .CoordType: 'phys' or 'px' |
---|
14 | % .DX,.DY,.DZ : mesh along each dirction |
---|
15 | % .RangeX, RangeY |
---|
16 | % .Coord(j,i), i=1, 2, 3, components x, y, z of j=1...n position(s) characterizing the object components |
---|
17 | % PlotHandles: handles for projection plots NO MORE USED |
---|
18 | % Zbounds: bounds on Z ( 3D case) |
---|
19 | % |
---|
20 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
21 | % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. |
---|
22 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
23 | % This file is part of the toolbox UVMAT. |
---|
24 | % |
---|
25 | % UVMAT is free software; you can redistribute it and/or modify |
---|
26 | % it under the terms of the GNU General Public License as published by |
---|
27 | % the Free Software Foundation; either version 2 of the License, or |
---|
28 | % (at your option) any later version. |
---|
29 | % |
---|
30 | % UVMAT is distributed in the hope that it will be useful, |
---|
31 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
32 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
33 | % GNU General Public License (file UVMAT/COPYING.txt) for more details. |
---|
34 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
35 | |
---|
36 | function varargout = set_object(varargin) |
---|
37 | |
---|
38 | % Last Modified by GUIDE v2.5 24-Nov-2008 14:29:06 |
---|
39 | |
---|
40 | % Begin initialization code - DO NOT PLOT |
---|
41 | gui_Singleton = 1; |
---|
42 | gui_State = struct('gui_Name', mfilename, ... |
---|
43 | 'gui_Singleton', gui_Singleton, ... |
---|
44 | 'gui_OpeningFcn', @set_object_OpeningFcn, ... |
---|
45 | 'gui_OutputFcn', @set_object_OutputFcn, ... |
---|
46 | 'gui_LayoutFcn', [] , ... |
---|
47 | 'gui_Callback', []); |
---|
48 | if nargin & isstr(varargin{1}) |
---|
49 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
50 | end |
---|
51 | |
---|
52 | if nargout |
---|
53 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
54 | else |
---|
55 | gui_mainfcn(gui_State, varargin{:}); |
---|
56 | end |
---|
57 | % End initialization code - DO NOT PLOT |
---|
58 | |
---|
59 | %------------------------------------------------------------------- |
---|
60 | % --- Executes just before set_object is made visible. |
---|
61 | %INPUT: |
---|
62 | % handles: handles of the set_object interface elements |
---|
63 | %'IndexObj': NON USED ANYMORE (To suppress) index of the object (on the UvData list) that set_object will modify |
---|
64 | % if =[] or absent: index still undefined (create mode in uvmat) |
---|
65 | % if=0; no associated object (used for series), the button 'PLOT' is then unvisible |
---|
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 grids |
---|
69 | % .Coord: object position coordinates |
---|
70 | % .ParentButton: handle of the uicontrol object calling the interface |
---|
71 | % PlotHandles: set of handles of the elements contolling the plotting of the projected field: |
---|
72 | % if =[] or absent, no plot (mask mode in uvmat) |
---|
73 | % parameters on the uvmat interface (obtained by 'get_plot_handle.m') |
---|
74 | function set_object_OpeningFcn(hObject, eventdata, handles, data, PlotHandles,ZBounds) |
---|
75 | %------------------------------------------------------------------- |
---|
76 | % Choose default command line output for set_object |
---|
77 | handles.output = hObject; |
---|
78 | % Update handles structure |
---|
79 | guidata(hObject, handles); |
---|
80 | |
---|
81 | %default |
---|
82 | if ~exist('ZBound','var') |
---|
83 | ZBound=0; %default |
---|
84 | end |
---|
85 | set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function (allow action on uvmat when set_object is in front) |
---|
86 | set(handles.MenuCoord,'ListboxTop',1) |
---|
87 | % if ~exist('PlotHandles','var') |
---|
88 | % PlotHandles=[]; |
---|
89 | % end |
---|
90 | enable_plot=0;%default: does not allow plot of object and projection |
---|
91 | % SetData.PlotHandles=PlotHandles; |
---|
92 | % set(hObject,'UserData',SetData) |
---|
93 | |
---|
94 | % fill the interface as set in the input data: |
---|
95 | if exist('data','var') |
---|
96 | if isfield(data,'enable_plot') |
---|
97 | enable_plot=data.enable_plot;%test to desable button PLOT (display mode) |
---|
98 | end |
---|
99 | if isfield(data,'Name') |
---|
100 | set(handles.TITLE,'String',data.Name) |
---|
101 | % set(hObject,'name',data.Name) |
---|
102 | end |
---|
103 | if ~isfield(data,'NbDim')||~isequal(data.NbDim,3)%2D case |
---|
104 | set(handles.ZObject,'Visible','off') |
---|
105 | set(handles.z_slider,'Visible','off') |
---|
106 | else |
---|
107 | set(handles.ZObject,'Visible','on') |
---|
108 | set(handles.z_slider,'Visible','on') |
---|
109 | if isfield(data,'Coord') && size(data.Coord,2)==3 |
---|
110 | set(handles.ZObject,'String',num2str(data.Coord(1,3),4)) |
---|
111 | end |
---|
112 | end |
---|
113 | if isfield(data,'StyleMenu') |
---|
114 | set(handles.ObjectStyle,'String',data.StyleMenu); |
---|
115 | end |
---|
116 | if isfield(data,'Style') |
---|
117 | menu=get(handles.ObjectStyle,'String'); |
---|
118 | for iline=1:length(menu) |
---|
119 | if isequal(menu{iline},data.Style) |
---|
120 | set(handles.ObjectStyle,'Value',iline) |
---|
121 | break |
---|
122 | end |
---|
123 | end |
---|
124 | end |
---|
125 | ObjectStyle_Callback(hObject, eventdata, handles) |
---|
126 | if isfield(data,'ProjMenu') |
---|
127 | set(handles.ProjMode,'String',data.ProjMenu); |
---|
128 | end |
---|
129 | if isfield(data,'ProjMode') |
---|
130 | menu=get(handles.ProjMode,'String'); |
---|
131 | for iline=1:length(menu) |
---|
132 | if isequal(menu{iline},data.ProjMode) |
---|
133 | set(handles.ProjMode,'Value',iline) |
---|
134 | break |
---|
135 | end |
---|
136 | end |
---|
137 | end |
---|
138 | ProjMode_Callback(hObject, eventdata, handles) |
---|
139 | if isfield(data,'Coord') |
---|
140 | if ischar(data.Coord) |
---|
141 | data.Coord=str2num(data.Coord); |
---|
142 | elseif iscell(data.Coord) |
---|
143 | CoordCell=data.Coord; |
---|
144 | data.Coord=zeros(numel(CoordCell),3); |
---|
145 | data.Coord(:,3)=zeros(numel(CoordCell),1); % z component set to 0 by default |
---|
146 | for iline=1:numel(CoordCell) |
---|
147 | line_vec=str2num(CoordCell{iline}); |
---|
148 | if numel(line_vec)==2 |
---|
149 | data.Coord(iline,1:2)=str2num(CoordCell{iline}); |
---|
150 | else |
---|
151 | data.Coord(iline,:)=str2num(CoordCell{iline}); |
---|
152 | end |
---|
153 | end |
---|
154 | end |
---|
155 | if size(data.Coord,2)>=2 |
---|
156 | sizcoord=size(data.Coord); |
---|
157 | for i=1:sizcoord(1) |
---|
158 | XObject{i}=num2str(data.Coord(i,1),4); |
---|
159 | YObject{i}=num2str(data.Coord(i,2),4); |
---|
160 | end |
---|
161 | set(handles.XObject,'String',XObject) |
---|
162 | set(handles.YObject,'String',YObject) |
---|
163 | if sizcoord(2)>3 |
---|
164 | for i=1:sizcoord(1) |
---|
165 | ZObject{i}=num2str(data.Coord(i,3),4); |
---|
166 | end |
---|
167 | set(handles.ZObject,'String',ZObject) |
---|
168 | end |
---|
169 | end |
---|
170 | end |
---|
171 | if isfield(data,'DX') |
---|
172 | if ~ischar(handles.DX) |
---|
173 | data.DX=num2str(data.DX,3); |
---|
174 | end |
---|
175 | set(handles.DX,'String',data.DX) |
---|
176 | end |
---|
177 | if isfield(data,'DY') |
---|
178 | if ~ischar(handles.DY) |
---|
179 | data.DY=num2str(data.DY,3); |
---|
180 | end |
---|
181 | set(handles.DY,'String',data.DX) |
---|
182 | end |
---|
183 | if isfield(data,'RangeZ') && length(ZBounds) >= 2 |
---|
184 | set(handles.ZMax,'String',num2str(max(data.RangeZ),3)) |
---|
185 | DZ=max(data.RangeZ);%slider step |
---|
186 | if ZBounds(2)~=ZBounds(1) |
---|
187 | rel_step(1)=min(DZ/(ZBounds(2)-ZBounds(1)),0.2);%must be smaller than 1 |
---|
188 | rel_step(2)=0.1; |
---|
189 | set(handles.z_slider,'Visible','on') |
---|
190 | set(handles.z_slider,'Min',ZBounds(1)) |
---|
191 | set(handles.z_slider,'Max',ZBounds(2)) |
---|
192 | set(handles.z_slider,'SliderStep',rel_step) |
---|
193 | set(handles.z_slider,'Value',(ZBounds(1)+ZBounds(2))/2) |
---|
194 | end |
---|
195 | end |
---|
196 | if isfield(data,'RangeX') |
---|
197 | if ischar(data.RangeX) |
---|
198 | data.RangeX=str2num(data.RangeX); |
---|
199 | end |
---|
200 | set(handles.XMax,'String',num2str(max(data.RangeX),3)) |
---|
201 | set(handles.XMin,'String',num2str(min(data.RangeX),3)) |
---|
202 | end |
---|
203 | if isfield(data,'RangeY') |
---|
204 | if ischar(data.RangeY) |
---|
205 | data.RangeY=str2num(data.RangeY); |
---|
206 | end |
---|
207 | set(handles.YMax,'String',num2str(max(data.RangeY),3)) |
---|
208 | set(handles.YMin,'String',num2str(min(data.RangeY),3)) |
---|
209 | end |
---|
210 | if isfield(data,'RangeZ') |
---|
211 | if ischar(data.RangeZ) |
---|
212 | data.RangeZ=str2num(data.RangeZ); |
---|
213 | end |
---|
214 | set(handles.ZMax,'String',num2str(max(data.RangeZ),3)) |
---|
215 | if numel(data.RangeZ)>=2 |
---|
216 | set(handles.ZMin,'String',num2str(min(data.RangeZ),3)) |
---|
217 | end |
---|
218 | end |
---|
219 | if isfield(data,'Phi') |
---|
220 | if ~ischar(handles.Phi) |
---|
221 | data.DY=num2str(data.Phi,3); |
---|
222 | end |
---|
223 | set(handles.Phi,'String',data.Phi) |
---|
224 | end |
---|
225 | if isfield(data,'Theta') |
---|
226 | if ~ischar(handles.Theta) |
---|
227 | data.DY=num2str(data.Theta,3); |
---|
228 | end |
---|
229 | set(handles.Theta,'String',data.Theta) |
---|
230 | end |
---|
231 | if isfield(data,'Psi') |
---|
232 | if ~ischar(handles.Psi) |
---|
233 | data.DY=num2str(data.Psi,3); |
---|
234 | end |
---|
235 | set(handles.Psi,'String',data.Psi) |
---|
236 | end |
---|
237 | if isfield(data,'DZ') |
---|
238 | if ~ischar(handles.DZ) |
---|
239 | data.DY=num2str(data.DZ,3); |
---|
240 | end |
---|
241 | set(handles.DZ,'String',data.DZ) |
---|
242 | end |
---|
243 | if isfield(data,'CoordType')&& isequal(data.CoordType,'px') |
---|
244 | % if isequal(data.CoordType,'phys') |
---|
245 | % set(handles.MenuCoord,'Value',1) |
---|
246 | % elseif isequal(data.CoordType,'px') |
---|
247 | set(handles.MenuCoord,'Value',2) |
---|
248 | % end |
---|
249 | end |
---|
250 | end |
---|
251 | if enable_plot |
---|
252 | set(handles.PLOT,'enable','on') |
---|
253 | else |
---|
254 | set(handles.PLOT,'enable','off') |
---|
255 | end |
---|
256 | huvmat=findobj(allchild(0),'tag','uvmat'); |
---|
257 | UvData=get(huvmat,'UserData'); |
---|
258 | pos_uvmat=get(huvmat,'Position'); |
---|
259 | %position the set_object GUI with respect to uvmat |
---|
260 | if isfield(UvData,'SetObjectOrigin') |
---|
261 | pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2); |
---|
262 | pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); |
---|
263 | set(hObject,'Position',pos_set_object) |
---|
264 | end |
---|
265 | |
---|
266 | % --- Outputs from this function are returned to the command line. |
---|
267 | function varargout = set_object_OutputFcn(hObject, eventdata, handles) |
---|
268 | % varargout cell array for returning output args (see VARARGOUT); |
---|
269 | % hObject handle to figure |
---|
270 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
271 | % handles structure with handles and user data (see GUIDATA) |
---|
272 | |
---|
273 | % Get default command line output from handles structure |
---|
274 | varargout{1} = handles.output; |
---|
275 | varargout{2}=handles; |
---|
276 | |
---|
277 | %----------------------------------------------- |
---|
278 | % --- Executes on selection change in ObjectStyle. |
---|
279 | function ObjectStyle_Callback(hObject, eventdata, handles) |
---|
280 | style_prev=get(handles.ObjectStyle,'UserData');%previous object style |
---|
281 | str=get(handles.ObjectStyle,'String'); |
---|
282 | val=get(handles.ObjectStyle,'Value'); |
---|
283 | style=str{val}; |
---|
284 | % make correspondance between different object styles |
---|
285 | % if ~isequal(str{val},style_prev) |
---|
286 | Xcolumn=get(handles.XObject,'String'); |
---|
287 | Ycolumn=get(handles.YObject,'String'); |
---|
288 | if ischar(Xcolumn) |
---|
289 | sizchar=size(Xcolumn); |
---|
290 | for icol=1:sizchar(1) |
---|
291 | Xcolumn_cell{icol}=Xcolumn(icol,:); |
---|
292 | end |
---|
293 | Xcolumn=Xcolumn_cell; |
---|
294 | end |
---|
295 | if ischar(Ycolumn) |
---|
296 | sizchar=size(Ycolumn); |
---|
297 | for icol=1:sizchar(1) |
---|
298 | Ycolumn_cell{icol}=Ycolumn(icol,:); |
---|
299 | end |
---|
300 | Ycolumn=Ycolumn_cell; |
---|
301 | end |
---|
302 | Zcolumn={};%default |
---|
303 | z_new={}; |
---|
304 | if isequal(get(handles.ZObject,'Visible'),'on') |
---|
305 | data.NbDim=3; %test 3D object |
---|
306 | Zcolumn=get(handles.ZObject,'String'); |
---|
307 | if ischar(Zcolumn) |
---|
308 | Zcolumn={Zcolumn}; |
---|
309 | end |
---|
310 | end |
---|
311 | x_new{1}=Xcolumn{1}; |
---|
312 | y_new{1}=Ycolumn{1}; |
---|
313 | if ~isempty(Zcolumn) |
---|
314 | z_new{1}=Zcolumn{1}; |
---|
315 | end |
---|
316 | if isequal(style,'line') |
---|
317 | if isequal(style_prev,'rectangle')|isequal(style_prev,'ellipse') |
---|
318 | XMax=get(handles.XMax,'String'); |
---|
319 | YMax=get(handles.YMax,'String'); |
---|
320 | x_new{2}=num2str(XMax,4); |
---|
321 | y_new{2}=num2str(YMax,4); |
---|
322 | set(handles.XObject,'String',x_new) |
---|
323 | set(handles.YObject,'String',y_new) |
---|
324 | set(handles.ZObject,'String',z_new) |
---|
325 | end |
---|
326 | elseif isequal(style,'polyline') |
---|
327 | elseif isequal(style,'rectangle')| isequal(style,'ellipse') |
---|
328 | set(handles.XObject,'String',x_new) |
---|
329 | set(handles.YObject,'String',y_new) |
---|
330 | set(handles.ZObject,'String',z_new) |
---|
331 | end |
---|
332 | % end |
---|
333 | switch style |
---|
334 | case {'points','line','polyline','plane'} |
---|
335 | menu_proj={'projection';'interp';'filter';'none'}; |
---|
336 | case {'polygon','rectangle','ellipse'} |
---|
337 | menu_proj={'inside';'outside';'mask_inside';'mask_outside'}; |
---|
338 | case 'volume' |
---|
339 | menu_proj={'interp';'none'}; |
---|
340 | end |
---|
341 | proj_index=get(handles.ProjMode,'Value'); |
---|
342 | if proj_index<numel(menu_proj) |
---|
343 | set(handles.ProjMode,'Value',1);% value index must not exceed the menu length |
---|
344 | end |
---|
345 | set(handles.ProjMode,'String',menu_proj) |
---|
346 | ProjMode_Callback(hObject, eventdata, handles) |
---|
347 | %store the current option |
---|
348 | str=get(handles.ObjectStyle,'String'); |
---|
349 | val=get(handles.ObjectStyle,'Value'); |
---|
350 | set(handles.ObjectStyle,'UserData',style) |
---|
351 | |
---|
352 | %---------------------------------------------- |
---|
353 | function xObject_Callback(hObject, eventdata, handles) |
---|
354 | |
---|
355 | |
---|
356 | function yObject_Callback(hObject, eventdata, handles) |
---|
357 | |
---|
358 | |
---|
359 | % --- Executes on selection change in zObject. |
---|
360 | function zObject_Callback(hObject, eventdata, handles) |
---|
361 | |
---|
362 | |
---|
363 | |
---|
364 | % --- Executes on selection change in ProjMode. |
---|
365 | function ProjMode_Callback(hObject, eventdata, handles) |
---|
366 | menu=get(handles.ProjMode,'String'); |
---|
367 | value=get(handles.ProjMode,'Value'); |
---|
368 | ProjMode=menu{value}; |
---|
369 | menu=get(handles.ObjectStyle,'String'); |
---|
370 | value=get(handles.ObjectStyle,'Value'); |
---|
371 | ObjectStyle=menu{value}; |
---|
372 | test3D=isequal(get(handles.ZObject,'Visible'),'on');%3D case |
---|
373 | |
---|
374 | %default setting |
---|
375 | set(handles.Phi,'Visible','off') |
---|
376 | set(handles.Theta,'Visible','off') |
---|
377 | set(handles.Psi,'Visible','off') |
---|
378 | set(handles.XMin,'Visible','off') |
---|
379 | set(handles.XMax,'Visible','off') |
---|
380 | set(handles.YMin,'Visible','off') |
---|
381 | if isequal(ProjMode,'interp') |
---|
382 | set(handles.YMax,'Visible','off') |
---|
383 | else |
---|
384 | set(handles.YMax,'Visible','on') |
---|
385 | end |
---|
386 | if isequal(ObjectStyle,'rectangle')|isequal(ObjectStyle,'ellipse') |
---|
387 | set(handles.XMax,'Visible','on') |
---|
388 | else |
---|
389 | set(handles.XMax,'Visible','off') |
---|
390 | end |
---|
391 | set(handles.ZMin,'Visible','off') |
---|
392 | set(handles.ZMax,'Visible','off') |
---|
393 | set(handles.DX,'Visible','off') |
---|
394 | set(handles.DY,'Visible','off') |
---|
395 | set(handles.DZ,'Visible','off') |
---|
396 | |
---|
397 | switch ObjectStyle |
---|
398 | case 'points' |
---|
399 | set(handles.YMax,'TooltipString','YMax: range of averaging around each point') |
---|
400 | set(handles.XObject,'TooltipString','XObject: set of x coordinates of the points') |
---|
401 | set(handles.YObject,'TooltipString','YObject: set of y coordinates of the points') |
---|
402 | set(handles.ZObject,'TooltipString','ZObject: set of z coordinates of the points') |
---|
403 | case {'line','polyline','polygon'} |
---|
404 | set(handles.YMax,'TooltipString','YMax: range of averaging around the line') |
---|
405 | set(handles.XObject,'TooltipString','XObject: set of x coordinates defining the line') |
---|
406 | set(handles.YObject,'TooltipString','YObject: set of y coordinates defining the line') |
---|
407 | set(handles.ZObject,'TooltipString','ZObject: set of z coordinates defining the line') |
---|
408 | if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter') |
---|
409 | set(handles.DX,'Visible','on') |
---|
410 | set(handles.DX,'TooltipString','DX: mesh for the interpolated field along the line') |
---|
411 | end |
---|
412 | case {'rectangle','ellipse'} |
---|
413 | set(handles.XMax,'TooltipString',['XMax: half length of the ' ObjectStyle]) |
---|
414 | set(handles.YMax,'TooltipString',['YMax: half width of the ' ObjectStyle]) |
---|
415 | set(handles.XObject,'TooltipString',['XObject: x coordinate of the ' ObjectStyle ' centre']) |
---|
416 | set(handles.YObject,'TooltipString',['YObject: y coordinate of the ' ObjectStyle ' centre']) |
---|
417 | case {'plane'} |
---|
418 | set(handles.Phi,'Visible','on') |
---|
419 | set(handles.XMin,'Visible','on') |
---|
420 | set(handles.XMax,'Visible','on') |
---|
421 | set(handles.YMin,'Visible','on') |
---|
422 | set(handles.YMax,'Visible','on') |
---|
423 | set(handles.XObject,'TooltipString',['XObject: x coordinate of the axis origin for the ' ObjectStyle]) |
---|
424 | set(handles.YObject,'TooltipString',['YObject: y coordinate of the axis origin for the ' ObjectStyle]) |
---|
425 | set(handles.ZMax,'TooltipString',['ZMax: range of projection normal to the plane']) |
---|
426 | if test3D |
---|
427 | set(handles.Theta,'Visible','on') |
---|
428 | set(handles.Psi,'Visible','on') |
---|
429 | set(handles.ZMax,'Visible','on') |
---|
430 | end |
---|
431 | if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter') |
---|
432 | set(handles.DX,'Visible','on') |
---|
433 | set(handles.DY,'Visible','on') |
---|
434 | else |
---|
435 | set(handles.DX,'Visible','off') |
---|
436 | set(handles.DY,'Visible','off') |
---|
437 | end |
---|
438 | if isequal(ObjectStyle,'volume') && isequal(ProjMode,'interp') |
---|
439 | set(handles.DZ,'Visible','on') |
---|
440 | end |
---|
441 | case {'volume'} |
---|
442 | set(handles.Phi,'Visible','on') |
---|
443 | set(handles.XMin,'Visible','on') |
---|
444 | set(handles.XMax,'Visible','on') |
---|
445 | set(handles.YMin,'Visible','on') |
---|
446 | set(handles.YMax,'Visible','on') |
---|
447 | set(handles.XObject,'TooltipString',['XObject: x coordinate of the axis origin for the ' ObjectStyle]) |
---|
448 | set(handles.YObject,'TooltipString',['YObject: y coordinate of the axis origin for the ' ObjectStyle]) |
---|
449 | if test3D |
---|
450 | set(handles.Theta,'Visible','on') |
---|
451 | set(handles.Psi,'Visible','on') |
---|
452 | set(handles.ZMin,'Visible','on') |
---|
453 | set(handles.ZMax,'Visible','on') |
---|
454 | end |
---|
455 | if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter') |
---|
456 | set(handles.DX,'Visible','on') |
---|
457 | set(handles.DY,'Visible','on') |
---|
458 | else |
---|
459 | set(handles.DX,'Visible','off') |
---|
460 | set(handles.DY,'Visible','off') |
---|
461 | end |
---|
462 | if isequal(ObjectStyle,'volume') && isequal(ProjMode,'interp') |
---|
463 | set(handles.DZ,'Visible','on') |
---|
464 | end |
---|
465 | end |
---|
466 | % |
---|
467 | % %--------------------------------------------- |
---|
468 | % % --- Executes on selection change in TITLE. |
---|
469 | % function TITLE_Callback(style, handles) |
---|
470 | % %--------------------------------------------- |
---|
471 | % switch style |
---|
472 | % case {'points','line','polyline','plane'} |
---|
473 | % menu_proj={'projection';'interp';'filter';'none'}; |
---|
474 | % case {'polygon','rectangle','ellipse'} |
---|
475 | % menu_proj={'inside';'outside';'mask_inside';'mask_outside'}; |
---|
476 | % case 'volume' |
---|
477 | % menu_proj={'none'}; |
---|
478 | % end |
---|
479 | % |
---|
480 | % |
---|
481 | % old_menu=get(handles.ObjectStyle,'String'); |
---|
482 | % value=get(handles.ObjectStyle,'Value'); |
---|
483 | % old_style=old_menu{value}; |
---|
484 | % teststyle=0; |
---|
485 | % for iline=1:length(menu_style) |
---|
486 | % if isequal(menu_style{iline},old_style) |
---|
487 | % styleval=iline; |
---|
488 | % teststyle=1; |
---|
489 | % break |
---|
490 | % end |
---|
491 | % end |
---|
492 | % if ~teststyle |
---|
493 | % new_style=[];%default |
---|
494 | % switch old_style |
---|
495 | % case 'polyline' |
---|
496 | % new_style='polygon'; |
---|
497 | % case 'polygon' |
---|
498 | % new_style='polyline'; |
---|
499 | % end |
---|
500 | % if ~isempty(new_style) |
---|
501 | % for iline=1:length(menu_style) |
---|
502 | % if isequal(menu_style{iline},new_style) |
---|
503 | % styleval=iline; |
---|
504 | % teststyle=1; |
---|
505 | % break |
---|
506 | % end |
---|
507 | % end |
---|
508 | % end |
---|
509 | % end |
---|
510 | % if ~teststyle |
---|
511 | % styleval=1; |
---|
512 | % end |
---|
513 | % set(handles.ObjectStyle,'String',menu_style) |
---|
514 | % set(handles.ObjectStyle,'Value',styleval) |
---|
515 | % set(handles.ProjMode,'String',menu_proj) |
---|
516 | % set(handles.ProjMode,'Value',1) |
---|
517 | % ObjectStyle_Callback(hObject, eventdata, handles) |
---|
518 | |
---|
519 | %--------------------------------------------- |
---|
520 | function Phi_Callback(hObject, eventdata, handles) |
---|
521 | update_slider(hObject, eventdata,handles) |
---|
522 | %--------------------------------------------- |
---|
523 | |
---|
524 | function Theta_Callback(hObject, eventdata, handles) |
---|
525 | update_slider(hObject, eventdata,handles) |
---|
526 | |
---|
527 | function update_slider(hObject, eventdata,handles) |
---|
528 | %rotation angles |
---|
529 | Phi=(pi/180)*str2num(get(handles.Phi,'String'));%first Euler angle in radian |
---|
530 | Theta=(pi/180)*str2num(get(handles.Theta,'String'));%second Euler angle in radian |
---|
531 | |
---|
532 | %components of the unitiy vector normal to the projection plane |
---|
533 | NormVec_X=-sin(Phi)*sin(Theta); |
---|
534 | NormVec_Y=cos(Phi)*sin(Theta); |
---|
535 | NormVec_Z=cos(Theta); |
---|
536 | huvmat=findobj('Tag','uvmat');%find the current uvmat interface handle |
---|
537 | UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface |
---|
538 | if isfield(UvData,'X') & isfield(UvData,'Y') & isfield(UvData,'Z') |
---|
539 | Z=NormVec_X *(UvData.X)+NormVec_Y *(UvData.Y)+NormVec_Z *(UvData.Z); |
---|
540 | set(handles.z_slider,'Min',min(Z)) |
---|
541 | set(handles.z_slider,'Max',max(Z)) |
---|
542 | ZMax_Callback(hObject, eventdata, handles) |
---|
543 | end |
---|
544 | |
---|
545 | function DX_Callback(hObject, eventdata, handles) |
---|
546 | |
---|
547 | |
---|
548 | function DY_Callback(hObject, eventdata, handles) |
---|
549 | |
---|
550 | |
---|
551 | function DZ_Callback(hObject, eventdata, handles) |
---|
552 | |
---|
553 | |
---|
554 | |
---|
555 | %----------------------------------------------------- |
---|
556 | % --- Executes on button press in OPEN: DESACTIVATED use uvmat browser |
---|
557 | function OPEN_Callback(hObject, eventdata, handles) |
---|
558 | %get the object file |
---|
559 | oldfile=' '; |
---|
560 | huvmat=findobj('Tag','uvmat'); |
---|
561 | hchild=get(huvmat,'Children'); |
---|
562 | hrootpath=findobj(hchild,'Tag','RootPath'); |
---|
563 | if ~isempty(hrootpath) |
---|
564 | oldfile=get(hrootpath,'String'); |
---|
565 | if iscell(oldfile) |
---|
566 | oldfile=oldfile{1}; |
---|
567 | end |
---|
568 | end |
---|
569 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
570 | {'*.xml;*.mat', ' (*.xml,*.mat)'; |
---|
571 | '*.xml', '.xml files '; ... |
---|
572 | '*.mat', '.mat matlab files '}, ... |
---|
573 | 'Pick a file',oldfile); |
---|
574 | fileinput=[PathName FileName];%complete file name |
---|
575 | testblank=findstr(fileinput,' ');%look for blanks |
---|
576 | if ~isempty(testblank) |
---|
577 | msgbox_uvmat('ERROR','forbidden input file name: contain blanks') |
---|
578 | return |
---|
579 | end |
---|
580 | sizf=size(fileinput); |
---|
581 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end |
---|
582 | |
---|
583 | %read the file |
---|
584 | t=xmltree(fileinput); |
---|
585 | s=convert(t); |
---|
586 | if ~isfield(s,'Style') |
---|
587 | s.Style='points'; |
---|
588 | end |
---|
589 | if ~isfield(s,'ProjMode') |
---|
590 | s.ProjMode='none'; |
---|
591 | end |
---|
592 | %Display title |
---|
593 | % title=set_title(s.Style,s.ProjMode);%update the title |
---|
594 | % if ~isempty(huvmat) |
---|
595 | % hhuvmat=guidata(huvmat); |
---|
596 | % end |
---|
597 | % menu=get(handles.TITLE,'String'); |
---|
598 | % for iline=1:length(menu) |
---|
599 | % if isequal(menu{iline},title) |
---|
600 | % set(handles.TITLE,'Value',iline) |
---|
601 | % break |
---|
602 | % end |
---|
603 | % end |
---|
604 | %TITLE_Callback(hObject, eventdata, handles) |
---|
605 | teststyle=0; |
---|
606 | |
---|
607 | switch s.Style |
---|
608 | case {'points','line','polyline','plane'} |
---|
609 | menu_proj={'projection';'interp';'filter';'none'}; |
---|
610 | case {'polygon','rectangle','ellipse'} |
---|
611 | menu_proj={'inside';'outside';'mask_inside';'mask_outside'}; |
---|
612 | case 'volume' |
---|
613 | menu_proj={'none'}; |
---|
614 | end |
---|
615 | set(handles.ObjectStyle,'String',menu_proj) |
---|
616 | menu=get(handles.ObjectStyle,'String'); |
---|
617 | for iline=1:length(menu) |
---|
618 | if isequal(menu{iline},s.Style) |
---|
619 | set(handles.ObjectStyle,'Value',iline) |
---|
620 | teststyle=1; |
---|
621 | break |
---|
622 | end |
---|
623 | end |
---|
624 | testmode=0; |
---|
625 | %menu=get(handles.ProjMode,'String'); |
---|
626 | for iline=1:length(menu_proj) |
---|
627 | if isequal(menu_proj{iline},s.ProjMode) |
---|
628 | set(handles.ProjMode,'Value',iline) |
---|
629 | testmode=1; |
---|
630 | break |
---|
631 | end |
---|
632 | end |
---|
633 | |
---|
634 | ProjMode_Callback(hObject, eventdata, handles);%visualize the appropriate edit boxes |
---|
635 | if isfield(s,'CoordType') |
---|
636 | if isequal(s.CoordType,'phys') |
---|
637 | set(handles.MenuCoord,'Value',1) |
---|
638 | elseif isequal(s.CoordType,'px') |
---|
639 | set(handles.MenuCoord,'Value',2) |
---|
640 | else |
---|
641 | warndlg('unknown CoordType (px or phys) in set_object.m') |
---|
642 | end |
---|
643 | end |
---|
644 | if isfield(s,'XMax') |
---|
645 | set(handles.XMax,'String',s.XMax) |
---|
646 | end |
---|
647 | if isfield(s,'XMin') |
---|
648 | set(handles.XMin,'String',s.XMin) |
---|
649 | end |
---|
650 | if isfield(s,'YMax') |
---|
651 | set(handles.YMax,'String',s.YMax) |
---|
652 | end |
---|
653 | if isfield(s,'YMin') |
---|
654 | set(handles.YMin,'String',s.YMin) |
---|
655 | end |
---|
656 | Range=0; |
---|
657 | if isfield(s,'Range') |
---|
658 | if ischar(s.Range) |
---|
659 | Range=str2num(s.Range); |
---|
660 | else |
---|
661 | Range(1,:)=str2num(s.Range{1}); |
---|
662 | Range(2,:)=str2num(s.Range{2}); |
---|
663 | end |
---|
664 | end |
---|
665 | if size(Range,2)>=3 |
---|
666 | if size(Range,1)>=2 |
---|
667 | set(handles.ZMin,'String',num2str(Range(2,3),3)) |
---|
668 | end |
---|
669 | if size(Range,1)>=2 |
---|
670 | set(handles.ZMax,'String',num2str(Range(1,3),3)) |
---|
671 | end |
---|
672 | end |
---|
673 | if size(Range,2)>=2 |
---|
674 | if size(Range,1)>=2 |
---|
675 | set(handles.YMin,'String',num2str(Range(2,2),3)) |
---|
676 | end |
---|
677 | if size(Range,1)>=2 |
---|
678 | set(handles.YMax,'String',num2str(Range(1,2),3)) |
---|
679 | end |
---|
680 | end |
---|
681 | if size(Range,2)>=1 |
---|
682 | if size(Range,1)>=2 |
---|
683 | set(handles.XMin,'String',num2str(Range(2,1),3)) |
---|
684 | end |
---|
685 | if size(Range,1)>=2 |
---|
686 | set(handles.XMax,'String',num2str(Range(1,1),3)) |
---|
687 | end |
---|
688 | end |
---|
689 | if isfield(s,'RangeX') & ischar(s.RangeX) |
---|
690 | RangeX=str2num(s.RangeX); |
---|
691 | set(handles.XMax,'String',num2str(max(RangeX),3)) |
---|
692 | set(handles.XMin,'String',num2str(min(RangeX),3)) |
---|
693 | end |
---|
694 | |
---|
695 | if isfield(s,'RangeY') |
---|
696 | if ischar(s.RangeY) |
---|
697 | RangeY=str2num(s.RangeY); |
---|
698 | set(handles.YMax,'String',num2str(max(RangeY),3)) |
---|
699 | set(handles.YMin,'String',num2str(min(RangeY),3)) |
---|
700 | end |
---|
701 | end |
---|
702 | if isfield(s,'RangeZ') |
---|
703 | if ischar(s.RangeZ) |
---|
704 | RangeZ=str2num(s.RangeZ); |
---|
705 | set(handles.ZMax,'String',num2str(max(RangeZ),3)) |
---|
706 | set(handles.ZMin,'String',num2str(min(RangeZ),3)) |
---|
707 | end |
---|
708 | end |
---|
709 | if isfield(s,'Phi') |
---|
710 | set(handles.Phi,'String',s.Phi) |
---|
711 | end |
---|
712 | if isfield(s,'Theta') |
---|
713 | set(handles.Theta,'String',s.Theta) |
---|
714 | end |
---|
715 | if isfield(s,'Psi') |
---|
716 | set(handles.Psi,'String',s.Psi) |
---|
717 | end |
---|
718 | |
---|
719 | if isfield(s,'DX') |
---|
720 | set(handles.DX,'String',s.DX) |
---|
721 | end |
---|
722 | if isfield(s,'DY') |
---|
723 | set(handles.DY,'String',s.DY) |
---|
724 | end |
---|
725 | if ~isfield(s,'Coord') |
---|
726 | XObject='0';%default |
---|
727 | YObject='0'; |
---|
728 | elseif ischar(s.Coord) |
---|
729 | line=str2num(s.Coord); |
---|
730 | XObject=num2str(line(1),4); |
---|
731 | YObject=num2str(line(2),4); |
---|
732 | else |
---|
733 | for i=1:length(s.Coord) |
---|
734 | line=str2num(s.Coord{i}); |
---|
735 | XObject{i}=num2str(line(1),4); |
---|
736 | YObject{i}=num2str(line(2),4); |
---|
737 | end |
---|
738 | end |
---|
739 | set(handles.XObject,'String',XObject) |
---|
740 | set(handles.YObject,'String',YObject) |
---|
741 | %METTRA A JOUR ASPECT DE L'INTERFACE (COMME set_object_Opening |
---|
742 | |
---|
743 | %---------------------------------------------------- |
---|
744 | % executed when closing: set the parent interface button to value 0 |
---|
745 | function closefcn(gcbo,eventdata,parent_button) |
---|
746 | |
---|
747 | huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle |
---|
748 | if ~isempty(huvmat) |
---|
749 | hhuvmat=guidata(huvmat); |
---|
750 | % set(hhuvmat.create,'Value',0) |
---|
751 | % set(hhuvmat.create,'BackgroundColor',[0 1 0])%put unactivated buttons to green |
---|
752 | % set(hhuvmat.LINE,'Value',0) |
---|
753 | % set(hhuvmat.LINE,'BackgroundColor',[0 1 0])%put unactivated buttons to green |
---|
754 | % set(hhuvmat.PATCH,'Value',0) |
---|
755 | % set(hhuvmat.PATCH,'BackgroundColor',[0 1 0])%put unactivated buttons to green |
---|
756 | % set(hhuvmat.PLANE,'Value',0) |
---|
757 | % set(hhuvmat.PLANE,'BackgroundColor',[0 1 0])%put unactivated buttons to green |
---|
758 | % set(hhuvmat.VOLUME,'Value',0) |
---|
759 | % set(hhuvmat.VOLUME,'BackgroundColor',[0 1 0])%put unactivated buttons to green |
---|
760 | set(hhuvmat.edit,'Value',0) |
---|
761 | set(hhuvmat.edit,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree |
---|
762 | end |
---|
763 | hseries=findobj(allchild(0),'Name','series');%find the current series interface handle |
---|
764 | if ~isempty(hseries) |
---|
765 | hhseries=guidata(hseries); |
---|
766 | set(hhseries.GetObject,'Value',0) |
---|
767 | set(hhseries.GetObject,'BackgroundColor',[0 1 0])%put unactivated buttons to green |
---|
768 | end |
---|
769 | |
---|
770 | %----------------------------------------------------------------------- |
---|
771 | % --- Executes on button press in PLOT: PLOT the defined object and its projected field |
---|
772 | function PLOT_Callback(hObject, eventdata, handles) |
---|
773 | |
---|
774 | %SetData=get(handles.set_object,'UserData');%get the hidden interface data |
---|
775 | huvmat=findobj('tag','uvmat');%find the current uvmat interface handle |
---|
776 | UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat |
---|
777 | hhuvmat=guidata(huvmat);%handles in the uvmat GUI |
---|
778 | ObjectName=get(handles.TITLE,'String');%name ome)f the current object (set_object na |
---|
779 | ListObject=get(hhuvmat.list_object_1,'String');%position in the objet list |
---|
780 | IndexObj_1=get(hhuvmat.list_object_1,'Value'); |
---|
781 | IndexObj_2=get(hhuvmat.list_object_2,'Value'); |
---|
782 | |
---|
783 | % set(plotfig,'Name',['Projection on' num2str(IndexObj) '-' ObjectData.Style]); |
---|
784 | ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object |
---|
785 | PlotHandles=[];%default |
---|
786 | testnew=0; |
---|
787 | PlotHandles=get_plot_handles(hhuvmat); |
---|
788 | if strcmp(ListObject{IndexObj_1},ObjectName)% we are editing the object whose projection is viewed in the uvmat frame |
---|
789 | ObjectData.HandlesDisplay=hhuvmat.axes3; |
---|
790 | IndexObj=IndexObj_1; |
---|
791 | elseif IndexObj_2<=numel(ListObject)&& strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field |
---|
792 | hview_field=findobj('tag','view_field'); |
---|
793 | if ~isempty(hview_field) |
---|
794 | PlotHandles=guidata(hview_field); |
---|
795 | ObjectData.HandlesDisplay=PlotHandles.axes3;%handle of axes3 in view_field |
---|
796 | end |
---|
797 | IndexObj=IndexObj_2; |
---|
798 | else %new object |
---|
799 | testnew=1; |
---|
800 | |
---|
801 | IndexObj=numel(ListObject)+1; |
---|
802 | %ObjectName=[num2str(IndexObj) '-' ObjectData.Style]; |
---|
803 | % ListObject=[ListObject;ObjectName]; |
---|
804 | % set(hhuvmat.list_object_2,'String',[ListObject;ObjectName;{'...'}]) |
---|
805 | % set(hhuvmat.list_object_2,'Value',IndexObj) |
---|
806 | end |
---|
807 | % ObjectName=get(handles.TITLE,'String'); |
---|
808 | if length(ObjectName)<1 |
---|
809 | ObjectName=[num2str(IndexObj) '-' ObjectData.Style]; |
---|
810 | else |
---|
811 | for ilist=1:numel(ListObject) |
---|
812 | if strcmp(ListObject{ilist},ObjectName) |
---|
813 | ObjectName=[num2str(IndexObj) '-' ObjectName]; |
---|
814 | break |
---|
815 | end |
---|
816 | end |
---|
817 | end |
---|
818 | ListObject{IndexObj,1}=ObjectName; |
---|
819 | set(hhuvmat.list_object_1,'String',ListObject) |
---|
820 | set(hhuvmat.list_object_2,'String',[ListObject;{'...'}]) |
---|
821 | if testnew |
---|
822 | set(hhuvmat.list_object_2,'Value',IndexObj) |
---|
823 | end |
---|
824 | |
---|
825 | % update the object plot and projection field |
---|
826 | UvData.Object{IndexObj}=update_obj(UvData,IndexObj,ObjectData,PlotHandles); |
---|
827 | set(huvmat,'UserData',UvData)%update the data in the uvmat interface |
---|
828 | |
---|
829 | %set uvmat to object edit mode to allow further object update |
---|
830 | hhuvmat=guidata(huvmat);%handles of elements in the uvmat GUI |
---|
831 | set(hhuvmat.MenuEditObject,'enable','on') |
---|
832 | set(hhuvmat.edit,'Value',1) |
---|
833 | set(hhuvmat.edit,'BackgroundColor',[1 1 0]);% paint the edit text in yellow |
---|
834 | UvData.MouseAction='edit_object'; % set the edit button to 'on' |
---|
835 | set(huvmat,'UserData',UvData) |
---|
836 | |
---|
837 | % --- Executes on button press in MenuCoord. |
---|
838 | function MenuCoord_Callback(hObject, eventdata, handles) |
---|
839 | |
---|
840 | %---------------------------------------------------- |
---|
841 | function YMin_Callback(hObject, eventdata, handles) |
---|
842 | |
---|
843 | |
---|
844 | function ZMin_Callback(hObject, eventdata, handles) |
---|
845 | |
---|
846 | |
---|
847 | function ZMax_Callback(hObject, eventdata, handles) |
---|
848 | DZ=str2num(get(handles.ZMax,'String')); |
---|
849 | ZMin=get(handles.z_slider,'Min'); |
---|
850 | ZMax=get(handles.z_slider,'Max'); |
---|
851 | if ~isequal(ZMax-ZMin,0) |
---|
852 | rel_step(1)=DZ/(ZMax-ZMin); |
---|
853 | rel_step(2)=0.2; |
---|
854 | set(handles.z_slider,'SliderStep',rel_step) |
---|
855 | end |
---|
856 | |
---|
857 | function YMax_Callback(hObject, eventdata, handles) |
---|
858 | |
---|
859 | |
---|
860 | function XMin_Callback(hObject, eventdata, handles) |
---|
861 | |
---|
862 | |
---|
863 | function XMax_Callback(hObject, eventdata, handles) |
---|
864 | |
---|
865 | |
---|
866 | % ------------------------------------------------------ |
---|
867 | function SAVE_Callback(hObject, eventdata, handles) |
---|
868 | % ------------------------------------------------------ |
---|
869 | Object=read_set_object(handles); |
---|
870 | huvmat=findobj('Tag','uvmat'); |
---|
871 | % UvData=get(huvmat,'UserData'); |
---|
872 | if isempty(huvmat) |
---|
873 | huvmat=findobj(allchild(0),'Name','series'); |
---|
874 | end |
---|
875 | hchild=get(huvmat,'Children'); |
---|
876 | hrootpath=findobj(hchild,'Tag','RootPath'); |
---|
877 | if isempty(hrootpath) |
---|
878 | RootPath=''; |
---|
879 | else |
---|
880 | RootPath=get(hrootpath,'String'); |
---|
881 | if iscell(RootPath) |
---|
882 | RootPath=RootPath{1}; |
---|
883 | end |
---|
884 | end |
---|
885 | title={'object name'}; |
---|
886 | dir_save=uigetdir(RootPath); |
---|
887 | ObjectName=get(handles.TITLE,'String'); |
---|
888 | if ~isempty(ObjectName)&&~strcmp(ObjectName,'') |
---|
889 | def={fullfile(dir_save,[ObjectName Object.CoordType '.xml'])}; |
---|
890 | else |
---|
891 | def={fullfile(dir_save,[Object.Style Object.CoordType '.xml'])}; |
---|
892 | end |
---|
893 | options.Resize='on'; |
---|
894 | displ_txt='save object as an .xml file';%default display |
---|
895 | menu=get(handles.ProjMode,'String'); |
---|
896 | value=get(handles.ProjMode,'Value'); |
---|
897 | ProjMode=menu{value}; |
---|
898 | if strcmp(ProjMode,'mask_inside')||strcmp(ProjMode,'mask_outside') |
---|
899 | displ_txt='save mask contour as an .xml file: to create a mask image, use save_mask on the GUI uvmat (lower right)'; |
---|
900 | end |
---|
901 | answer=msgbox_uvmat('INPUT_TXT','save object as an .xml file',def); |
---|
902 | %answer=inputdlg('','save object in a new .xml file',1,def,'on'); |
---|
903 | if ~isempty(answer) |
---|
904 | t=struct2xml(Object); |
---|
905 | save(t,answer{1}) |
---|
906 | end |
---|
907 | msgbox_uvmat('CONFIRMATION',[answer{1} ' saved']) |
---|
908 | |
---|
909 | %--------------------------------------------------------- |
---|
910 | % --- Executes on slider movement. |
---|
911 | function z_slider_Callback(hObject, eventdata, handles) |
---|
912 | %--------------------------------------------------------- |
---|
913 | %A ADAPTER |
---|
914 | Z_value=get(handles.z_slider,'Value'); |
---|
915 | |
---|
916 | %rotation angles |
---|
917 | Phi=(pi/180)*str2num(get(handles.Phi,'String'));%first Euler angle in radian |
---|
918 | Theta=(pi/180)*str2num(get(handles.Theta,'String'));%second Euler angle in radian |
---|
919 | |
---|
920 | %components of the unity vector normal to the projection plane |
---|
921 | NormVec_X=-sin(Phi)*sin(Theta); |
---|
922 | NormVec_Y=cos(Phi)*sin(Theta); |
---|
923 | NormVec_Z=cos(Theta); |
---|
924 | |
---|
925 | %set new plane position and update graph |
---|
926 | set(handles.XObject,'String',num2str(NormVec_X*Z_value,4)) |
---|
927 | set(handles.YObject,'String',num2str(NormVec_Y*Z_value,4)) |
---|
928 | set(handles.ZObject,'String',num2str(NormVec_Z*Z_value,4)) |
---|
929 | PLOT_Callback(hObject, eventdata, handles) |
---|
930 | |
---|
931 | |
---|
932 | % --- Executes on button press in HELP. |
---|
933 | function HELP_Callback(hObject, eventdata, handles) |
---|
934 | path_to_uvmat=which ('uvmat');% check the path of uvmat |
---|
935 | pathelp=fileparts(path_to_uvmat); |
---|
936 | helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html'); |
---|
937 | if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package') |
---|
938 | else |
---|
939 | addpath (fullfile(pathelp,'uvmat_doc')) |
---|
940 | web([helpfile '#set_object']) |
---|
941 | end |
---|
942 | |
---|
943 | |
---|
944 | |
---|