1 | function varargout = resongui(varargin) |
---|
2 | % RESONGUI M-file for resongui.fig |
---|
3 | % RESONGUI, by itself, creates a new RESONGUI or raises the existing |
---|
4 | % singleton*. |
---|
5 | % |
---|
6 | % H = RESONGUI returns the handle to a new RESONGUI or the handle to |
---|
7 | % the existing singleton*. |
---|
8 | % |
---|
9 | % RESONGUI('CALLBACK',hObject,eventData,handles,...) calls the local |
---|
10 | % function named CALLBACK in RESONGUI.M with the given input arguments. |
---|
11 | % |
---|
12 | % RESONGUI('Property','Value',...) creates a new RESONGUI or raises the |
---|
13 | % existing singleton*. Starting from the left, property value pairs are |
---|
14 | % applied to the GUI before resongui_OpeningFunction gets called. An |
---|
15 | % unrecognized property name or invalid value makes property application |
---|
16 | % stop. All inputs are passed to resongui_OpeningFcn via varargin. |
---|
17 | % |
---|
18 | % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one |
---|
19 | % instance to run (singleton)". |
---|
20 | % |
---|
21 | % See also: GUIDE, GUIDATA, GUIHANDLES |
---|
22 | |
---|
23 | % Edit the above text to modify the response to help resongui |
---|
24 | |
---|
25 | % Last Modified by GUIDE v2.5 16-Apr-2011 23:34:51 |
---|
26 | |
---|
27 | % Begin initialization code - DO NOT EDIT |
---|
28 | gui_Singleton = 1; |
---|
29 | gui_State = struct('gui_Name', mfilename, ... |
---|
30 | 'gui_Singleton', gui_Singleton, ... |
---|
31 | 'gui_OpeningFcn', @resongui_OpeningFcn, ... |
---|
32 | 'gui_OutputFcn', @resongui_OutputFcn, ... |
---|
33 | 'gui_LayoutFcn', [] , ... |
---|
34 | 'gui_Callback', []); |
---|
35 | if nargin & isstr(varargin{1}) |
---|
36 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
37 | end |
---|
38 | |
---|
39 | if nargout |
---|
40 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
41 | else |
---|
42 | gui_mainfcn(gui_State, varargin{:}); |
---|
43 | end |
---|
44 | % End initialization code - DO NOT EDIT |
---|
45 | |
---|
46 | |
---|
47 | % --- Executes just before resongui is made visible. |
---|
48 | function resongui_OpeningFcn(hObject, eventdata, handles, varargin) |
---|
49 | % This function has no output args, see OutputFcn. |
---|
50 | % hObject handle to figure |
---|
51 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
52 | % handles structure with handles and user data (see GUIDATA) |
---|
53 | % varargin command line arguments to resongui (see VARARGIN) |
---|
54 | |
---|
55 | % Choose default command line output for resongui |
---|
56 | handles.output = hObject; |
---|
57 | |
---|
58 | %Met la barre d'outil (zoom) |
---|
59 | set(hObject,'ToolBar','figure'); |
---|
60 | |
---|
61 | % Update handles structure |
---|
62 | guidata(hObject, handles); |
---|
63 | |
---|
64 | %% Lit les donnees |
---|
65 | handles.pathname = pwd; %chemin de lancement |
---|
66 | handles.dataname = 'fmap.out'; % carte par defaut |
---|
67 | handles.color='off'; % carte en couleur avec diffusion |
---|
68 | handles.maptype = 'fmap'; %% fmap or fmapdp |
---|
69 | handles.data_inducedamplitude = fullfile(pwd,'induced_amplitude.out'); |
---|
70 | |
---|
71 | loaddata(hObject,handles); %% charge les donnees |
---|
72 | % OBLIGATOIRE car la fonction loaddata a modifie handles et |
---|
73 | % travailler sur une copie de handles |
---|
74 | handles = guidata(hObject); |
---|
75 | handles.str=''; |
---|
76 | |
---|
77 | %% Couleur de depart pour identifiactaion point a point |
---|
78 | handles.couleurs=[1 0 0]; |
---|
79 | %% zoom |
---|
80 | handles.type='shift'; |
---|
81 | set(handles.edit_shift,'String','0.05'); |
---|
82 | handles.shiftaxis = str2double(get(handles.edit_shift,'String')); |
---|
83 | handles.zoomaxis= str2double(get(handles.edit_zoom,'String')); |
---|
84 | |
---|
85 | %%% Variable pour echange avec autres gui |
---|
86 | setappdata(handles.figure1, 'Tab',[]); |
---|
87 | guidata(hObject, handles); |
---|
88 | |
---|
89 | set(handles.edit_color,'BackgroundColor',handles.couleurs); |
---|
90 | %%% Affiche le point de fonctionnement |
---|
91 | print_value(handles,handles.x1(1),handles.x2(1),handles.f1(1),handles.f2(1)); |
---|
92 | %%%% dessine les donnees |
---|
93 | plotdata(handles); |
---|
94 | |
---|
95 | %%% axes par defaut |
---|
96 | %set(handles.fmap,'Xlim',[18.1 18.3],'Ylim',[10.20 10.4]); |
---|
97 | |
---|
98 | % UIWAIT makes resongui wait for user response (see UIRESUME) |
---|
99 | % uiwait(handles.figure1); |
---|
100 | |
---|
101 | |
---|
102 | % --- Outputs from this function are returned to the command line. |
---|
103 | function varargout = resongui_OutputFcn(hObject, eventdata, handles) |
---|
104 | % varargout cell array for returning output args (see VARARGOUT); |
---|
105 | % hObject handle to figure |
---|
106 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
107 | % handles structure with handles and user data (see GUIDATA) |
---|
108 | |
---|
109 | % Get default command line output from handles structure |
---|
110 | varargout{1} = handles.output; |
---|
111 | |
---|
112 | function loaddata(hObject,handles) |
---|
113 | |
---|
114 | fname = fullfile(handles.pathname, handles.dataname) |
---|
115 | try |
---|
116 | [header data]=hdrload(fname); |
---|
117 | return %break; |
---|
118 | catch |
---|
119 | % error('Error while opening filename %s ',fname) |
---|
120 | uiwait(errordlg('No input data found')); |
---|
121 | handles = getdata(handles); |
---|
122 | end |
---|
123 | |
---|
124 | z = data(:,2)*1e3; |
---|
125 | switch handles.maptype |
---|
126 | case 'fmap' |
---|
127 | x = data(:,1)*1e3; %% z in mm |
---|
128 | case 'fmapdp' |
---|
129 | x = data(:,1)*1e2; %% energy in % |
---|
130 | end |
---|
131 | |
---|
132 | fx=18+abs(data(:,3)); |
---|
133 | fz=10+abs(data(:,4)); |
---|
134 | |
---|
135 | if size(data,2) == 6; |
---|
136 | %%% Data for color printing |
---|
137 | nz = sum(x==x(1)); |
---|
138 | nx = size(x,1)/nz; |
---|
139 | dfx=data(:,5); |
---|
140 | dfz=data(:,6); |
---|
141 | |
---|
142 | xgrid = reshape(x,nz,nx); |
---|
143 | zgrid = reshape(z,nz,nx); |
---|
144 | fxgrid = reshape(fx,nz,nx); |
---|
145 | fzgrid = reshape(fz,nz,nx); |
---|
146 | dfxgrid = reshape(dfx,nz,nx); |
---|
147 | dfzgrid = reshape(dfz,nz,nx); |
---|
148 | diffusion = 1; |
---|
149 | diffu = log10(sqrt(dfxgrid.*dfxgrid+dfzgrid.*dfzgrid)); |
---|
150 | %% saturation |
---|
151 | ind = isinf(diffu); |
---|
152 | diffu(ind) = NaN; |
---|
153 | diffumax = -2; diffumin = -10; |
---|
154 | diffu(diffu< diffumin) = diffumin; % very stable |
---|
155 | diffu(diffu> diffumax) = diffumax; %chaotic |
---|
156 | %% pour affichage couleur |
---|
157 | handles.diffu = diffu; |
---|
158 | handles.fxgrid=fxgrid; |
---|
159 | handles.fzgrid=fzgrid; |
---|
160 | handles.xgrid=xgrid; |
---|
161 | handles.zgrid=zgrid; |
---|
162 | end |
---|
163 | %% pour affichage noir et blanc |
---|
164 | indx=(fx~=18.0); |
---|
165 | handles.f1=fx(indx); |
---|
166 | handles.f2=fz(indx); |
---|
167 | handles.x1=x(indx); |
---|
168 | handles.x2=z(indx); |
---|
169 | |
---|
170 | guidata(hObject,handles); |
---|
171 | % select stable particles |
---|
172 | |
---|
173 | |
---|
174 | % --- Executes on button press in pushbutton_replot. |
---|
175 | function pushbutton_replot_Callback(hObject, eventdata, handles) |
---|
176 | % hObject handle to pushbutton_replot (see GCBO) |
---|
177 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
178 | % handles structure with handles and user data (see GUIDATA) |
---|
179 | %Efface figure et redessine les donnees brutes |
---|
180 | children=get(handles.fmap,'Children'); |
---|
181 | %children=findobj(handles.axes,'Children','Type','Line')) |
---|
182 | %child=findobj(handles.axes,'Children','Tag','fmap')) |
---|
183 | %children(children==child)=[]; |
---|
184 | %delete(children mais pas child) |
---|
185 | cla(handles.fmap); |
---|
186 | cla(handles.da); |
---|
187 | plotdata(handles); |
---|
188 | getappdata(handles.figure1,'Tab'); |
---|
189 | |
---|
190 | function plotdata(handles) |
---|
191 | |
---|
192 | switch handles.color |
---|
193 | case 'off' |
---|
194 | axes(handles.fmap); % hold on; |
---|
195 | get(handles.fmap,'Children') |
---|
196 | % if ~isempty(get(handles.fmap,'Children')) |
---|
197 | % delete(findobj(get(handles.fmap,'Children'),'Tag','fspace')); |
---|
198 | % end |
---|
199 | plot(handles.f1,handles.f2,'kd','MarkerSize',0.5,'MarkerFaceColor','k','Tag','fspace'); |
---|
200 | grid on; hold on; |
---|
201 | % xlabel('fx'); ylabel('fz'); |
---|
202 | %axis([18.15 18.27 10.265 10.32]) |
---|
203 | axis([min(handles.f1) max(handles.f1) min(handles.f2) max(handles.f2)]) % modification 8 mars 2010 à cause pb échelle (mat) |
---|
204 | axes(handles.da); hold off; |
---|
205 | %%% Choix des axes |
---|
206 | switch handles.maptype |
---|
207 | case 'fmap' |
---|
208 | strx = 'x(mm)'; |
---|
209 | stry = 'z(mm)'; |
---|
210 | case 'fmapdp' |
---|
211 | strx = 'dp (%)'; |
---|
212 | stry = 'x (mm)'; |
---|
213 | end |
---|
214 | plot(handles.x1,handles.x2,'kd','MarkerSize',2.0,'MarkerFaceColor','k','Tag','cspace'); |
---|
215 | xlabel(strx); ylabel(stry); |
---|
216 | grid on; hold on; |
---|
217 | case 'on' |
---|
218 | axes(handles.fmap); %hold on |
---|
219 | get(handles.fmap,'Children') |
---|
220 | switch handles.color |
---|
221 | case 'off' |
---|
222 | mesh(handles.fxgrid,handles.fzgrid, handles.diffu,'LineStyle','.','MarkerSize',5.0,'FaceColor','none','Tag','fspace'); |
---|
223 | case 'on' |
---|
224 | mesh(handles.fxgrid,handles.fzgrid, handles.diffu,'Marker','.','MarkerSize',5.0,'FaceColor','none','LineStyle','none','Tag','fspace'); |
---|
225 | end |
---|
226 | % if ~isempty(get(handles.fmap,'Children')) |
---|
227 | % delete(findobj(get(handles.fmap,'Children'),'Tag','fspace')); |
---|
228 | % end |
---|
229 | %image(cat(3,handles.diffu,handles.diffu,handles.diffu)/-10,'Tag','fspace'); |
---|
230 | view(2); grid on; hold on |
---|
231 | xlabel('fx'); ylabel('fz') |
---|
232 | axes(handles.da); |
---|
233 | switch handles.color |
---|
234 | case 'off' |
---|
235 | mesh(handles.xgrid,handles.zgrid,handles.diffu,'LineStyle','.','MarkerSize',5.0,'FaceColor','none','Tag','cspace'); |
---|
236 | case 'on' |
---|
237 | mesh(handles.xgrid,handles.zgrid,handles.diffu,'Marker','.','MarkerSize',5.0,'FaceColor','none','LineStyle','none','Tag','fspace'); |
---|
238 | end |
---|
239 | %image(reshape(handles.xgrid,1,prod(size(handles.xgrid))), ... |
---|
240 | % reshape(handles.zgrid,1 ,prod(size(handles.zgrid))), ... |
---|
241 | % cat(3,handles.diffu,handles.diffu,handles.diffu)/-10); |
---|
242 | view(2); grid on; hold on |
---|
243 | end |
---|
244 | |
---|
245 | |
---|
246 | %datalabel on |
---|
247 | |
---|
248 | % hc=uicontextmenu; |
---|
249 | % hm=uimenu('parent',hc); |
---|
250 | % set(h,'UIContextMenu',hc); |
---|
251 | % hha=findobj(get(handles.da,'Children'),'Type','axes'); |
---|
252 | % set(get(handles.da,'Parent'),'WindowButtonDownFcn', ... |
---|
253 | % 'pt=get(gca,''CurrentPoint'' ); disp(pt); disp(hm); set(hm,''Label'',[num2str(pt(1,1)) '', '' num2str(pt(1,2))])' ) |
---|
254 | |
---|
255 | |
---|
256 | %%% Affiche le point de fonctionnement |
---|
257 | print_value(handles,handles.x1(1),handles.x2(1),handles.f1(1),handles.f2(1)); |
---|
258 | |
---|
259 | % --- Executes on button press in bouton_resonid. |
---|
260 | function bouton_resonid_Callback(hObject, eventdata, handles) |
---|
261 | % hObject handle to bouton_resonid (see GCBO) |
---|
262 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
263 | % handles structure with handles and user data (see GUIDATA) |
---|
264 | |
---|
265 | % Loop, picking up the points. |
---|
266 | disp('Left mouse button picks points.') |
---|
267 | disp('Right mouse button picks last point.') |
---|
268 | hold on |
---|
269 | button = 1; |
---|
270 | n=0; |
---|
271 | while button == 1 |
---|
272 | [xi,yi,button] = ginput(1); |
---|
273 | % plot(xi,yi,'o','Color',handles.couleurs,2.0,'MarkerFaceColor',handles.couleurs) |
---|
274 | n = n+1; |
---|
275 | identifier(xi,yi,handles) |
---|
276 | end |
---|
277 | |
---|
278 | function identifier(xi,yi,handles) |
---|
279 | |
---|
280 | %%% cherche le point le plus proche au sens de la norme 2 |
---|
281 | [dp1, i1]=min((handles.f1-xi).^2+(handles.f2-yi).^2); |
---|
282 | [dp2, i2]=min((handles.x1-xi).^2+(handles.x2-yi).^2); |
---|
283 | |
---|
284 | %selectionne la bonne figure sur laquelle on a clique |
---|
285 | if (dp1 < dp2) |
---|
286 | i3 = i1; |
---|
287 | else |
---|
288 | i3 =i2; |
---|
289 | end |
---|
290 | |
---|
291 | %%% affiche le point selectionne |
---|
292 | axes(handles.da); |
---|
293 | plot(handles.x1(i3),handles.x2(i3),'o','Color',handles.couleurs); |
---|
294 | axes(handles.fmap); |
---|
295 | plot(handles.f1(i3),handles.f2(i3),'o','Color',handles.couleurs); |
---|
296 | |
---|
297 | print_value(handles,handles.x1(i3),handles.x2(i3),handles.f1(i3),handles.f2(i3)); |
---|
298 | |
---|
299 | function print_value(handles,x1,x2,f1,f2) |
---|
300 | %%% Met a jour les valeurs selectionnees |
---|
301 | formatda='% 6.4f'; |
---|
302 | formatfmap='% 8.5f'; |
---|
303 | |
---|
304 | switch handles.maptype |
---|
305 | case 'fmap' |
---|
306 | strx ='x ='; |
---|
307 | stry ='z ='; |
---|
308 | case 'fmapdp' |
---|
309 | strx ='dp ='; |
---|
310 | stry ='x ='; |
---|
311 | end |
---|
312 | string=sprintf([strx,formatda],x1); |
---|
313 | set(handles.text_x,'String',string); |
---|
314 | string=sprintf([stry,formatda],x2); |
---|
315 | set(handles.text_z,'String',string); |
---|
316 | string=sprintf(['fx = ',formatfmap],f1); |
---|
317 | set(handles.text_fx,'String',string); |
---|
318 | string=sprintf(['fz = ',formatfmap],f2); |
---|
319 | set(handles.text_fz,'String',string); |
---|
320 | |
---|
321 | % --- Executes during object creation, after setting all properties. |
---|
322 | function edit_color_CreateFcn(hObject, eventdata, handles) |
---|
323 | % hObject handle to edit_color (see GCBO) |
---|
324 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
325 | % handles empty - handles not created until after all CreateFcns called |
---|
326 | |
---|
327 | % Hint: edit controls usually have a white background on Windows. |
---|
328 | % See ISPC and COMPUTER. |
---|
329 | if ispc |
---|
330 | set(hObject,'BackgroundColor','white'); |
---|
331 | else |
---|
332 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
333 | end |
---|
334 | |
---|
335 | function edit_color_Callback(hObject, eventdata, handles) |
---|
336 | % hObject handle to edit_color (see GCBO) |
---|
337 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
338 | % handles structure with handles and user data (see GUIDATA) |
---|
339 | |
---|
340 | % Hints: get(hObject,'String') returns contents of edit_color as text |
---|
341 | % str2double(get(hObject,'String')) returns contents of edit_color as a double |
---|
342 | h = uisetcolor; |
---|
343 | if (size(h,2) ~=1) |
---|
344 | handles.couleurs = h; |
---|
345 | guidata(hObject, handles); |
---|
346 | set(handles.edit_color,'BackgroundColor',handles.couleurs); |
---|
347 | end |
---|
348 | |
---|
349 | |
---|
350 | % --- Executes on button press in increaseV. |
---|
351 | function increaseV_Callback(hObject, eventdata, handles) |
---|
352 | % hObject handle to increaseV (see GCBO) |
---|
353 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
354 | % handles structure with handles and user data (see GUIDATA) |
---|
355 | prop ='Ylim'; |
---|
356 | zoomshift(handles,prop,1); |
---|
357 | |
---|
358 | |
---|
359 | % --- Executes on button press in increaseH. |
---|
360 | function increaseH_Callback(hObject, eventdata, handles) |
---|
361 | % hObject handle to increaseH (see GCBO) |
---|
362 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
363 | % handles structure with handles and user data (see GUIDATA) |
---|
364 | prop ='Xlim'; |
---|
365 | zoomshift(handles,prop,1); |
---|
366 | |
---|
367 | % --- Executes on button press in decreaseV. |
---|
368 | function decreaseV_Callback(hObject, eventdata, handles) |
---|
369 | % hObject handle to decreaseV (see GCBO) |
---|
370 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
371 | % handles structure with handles and user data (see GUIDATA) |
---|
372 | prop ='Ylim'; |
---|
373 | zoomshift(handles,prop,-1); |
---|
374 | |
---|
375 | |
---|
376 | % --- Executes on button press in decreaseH. |
---|
377 | function decreaseH_Callback(hObject, eventdata, handles) |
---|
378 | % hObject handle to decreaseH (see GCBO) |
---|
379 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
380 | % handles structure with handles and user data (see GUIDATA) |
---|
381 | prop ='Xlim'; |
---|
382 | zoomshift(handles,prop,-1); |
---|
383 | |
---|
384 | function zoomshift(handles,prop,fac) |
---|
385 | %% Fonction qui gere zoom et deplacement d'axe |
---|
386 | |
---|
387 | scale = get(handles.fmap,prop); |
---|
388 | |
---|
389 | switch handles.type |
---|
390 | case 'shift' |
---|
391 | set(handles.fmap,prop,scale+fac*handles.shiftaxis); |
---|
392 | case 'zoom' |
---|
393 | w = scale(2)-scale(1); |
---|
394 | mid=scale(1) + w/2; |
---|
395 | if fac ==-1 |
---|
396 | newscale = mid + [-1 1]*0.5*w*handles.zoomaxis; |
---|
397 | else |
---|
398 | newscale = mid + [-1 1]*0.5*w/handles.zoomaxis; |
---|
399 | end |
---|
400 | set(handles.fmap,prop,newscale); |
---|
401 | end |
---|
402 | axes(handles.fmap); |
---|
403 | setappdata(handles.figure1, 'fen',axis); |
---|
404 | |
---|
405 | % --- Executes during object creation, after setting all properties. |
---|
406 | function edit_zoom_CreateFcn(hObject, eventdata, handles) |
---|
407 | % hObject handle to edit_zoom (see GCBO) |
---|
408 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
409 | % handles empty - handles not created until after all CreateFcns called |
---|
410 | |
---|
411 | % Hint: edit controls usually have a white background on Windows. |
---|
412 | % See ISPC and COMPUTER. |
---|
413 | if ispc |
---|
414 | set(hObject,'BackgroundColor','white'); |
---|
415 | else |
---|
416 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
417 | end |
---|
418 | |
---|
419 | function edit_zoom_Callback(hObject, eventdata, handles) |
---|
420 | % hObject handle to edit_zoom (see GCBO) |
---|
421 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
422 | % handles structure with handles and user data (see GUIDATA) |
---|
423 | |
---|
424 | % Hints: get(hObject,'String') returns contents of edit_zoom as text |
---|
425 | % str2double(get(hObject,'String')) returns contents of edit_zoom as a double |
---|
426 | handles.zoomaxis= str2double(get(hObject,'String')); |
---|
427 | guidata(hObject, handles); |
---|
428 | |
---|
429 | |
---|
430 | % --- Executes on button press in radiobutton_zoom. |
---|
431 | function radiobutton_zoom_Callback(hObject, eventdata, handles) |
---|
432 | % hObject handle to radiobutton_zoom (see GCBO) |
---|
433 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
434 | % handles structure with handles and user data (see GUIDATA) |
---|
435 | |
---|
436 | % Hint: get(hObject,'Value') returns toggle state of radiobutton_zoom |
---|
437 | mutual_exclude(handles.radiobutton_shift); |
---|
438 | handles.type='zoom'; |
---|
439 | guidata(hObject, handles); |
---|
440 | |
---|
441 | % --- Executes on button press in radiobutton_shift. |
---|
442 | function radiobutton_shift_Callback(hObject, eventdata, handles) |
---|
443 | % hObject handle to radiobutton_shift (see GCBO) |
---|
444 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
445 | % handles structure with handles and user data (see GUIDATA) |
---|
446 | |
---|
447 | % Hint: get(hObject,'Value') returns toggle state of radiobutton_shift |
---|
448 | mutual_exclude(handles.radiobutton_zoom); |
---|
449 | handles.type='shift'; |
---|
450 | guidata(hObject, handles); |
---|
451 | |
---|
452 | %%% fonction pour faire des radioboutons |
---|
453 | function mutual_exclude(off) |
---|
454 | set(off,'Value',0); |
---|
455 | |
---|
456 | |
---|
457 | % --- Executes during object creation, after setting all properties. |
---|
458 | function edit_shift_CreateFcn(hObject, eventdata, handles) |
---|
459 | % hObject handle to edit_shift (see GCBO) |
---|
460 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
461 | % handles empty - handles not created until after all CreateFcns called |
---|
462 | |
---|
463 | % Hint: edit controls usually have a white background on Windows. |
---|
464 | % See ISPC and COMPUTER. |
---|
465 | if ispc |
---|
466 | set(hObject,'BackgroundColor','white'); |
---|
467 | else |
---|
468 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
469 | end |
---|
470 | |
---|
471 | function edit_shift_Callback(hObject, eventdata, handles) |
---|
472 | % hObject handle to edit_shift (see GCBO) |
---|
473 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
474 | % handles structure with handles and user data (see GUIDATA) |
---|
475 | |
---|
476 | % Hints: get(hObject,'String') returns contents of edit_shift as text |
---|
477 | % str2double(get(hObject,'String')) returns contents of edit_shift as a double |
---|
478 | handles.shiftaxis= str2double(get(hObject,'String')); |
---|
479 | guidata(hObject, handles); |
---|
480 | |
---|
481 | |
---|
482 | % --- Executes on button press in resetfmap. |
---|
483 | function resetfmap_Callback(hObject, eventdata, handles) |
---|
484 | % hObject handle to pushbutton_replot (see GCBO) |
---|
485 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
486 | % handles structure with handles and user data (see GUIDATA) |
---|
487 | set(handles.fmap,'XLimMode','auto','YLimMode','auto'); |
---|
488 | pause(0.1); |
---|
489 | set(handles.fmap,'XLimMode','manual','YLimMode','manual'); |
---|
490 | |
---|
491 | |
---|
492 | % -------------------------------------------------------------------- |
---|
493 | function souris_Callback(hObject, eventdata, handles) |
---|
494 | % hObject handle to souris (see GCBO) |
---|
495 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
496 | % handles structure with handles and user data (see GUIDATA) |
---|
497 | pt=get(gca,'CurrentPoint'); |
---|
498 | tab = getappdata(handles.figure1,'Tab'); |
---|
499 | handles.str = plusprochereson([pt(1,1), pt(1,2)],tab); |
---|
500 | set(handles.resonance,'Label', handles.str); |
---|
501 | guidata(hObject,handles); %% mise a jour donnees |
---|
502 | |
---|
503 | % -------------------------------------------------------------------- |
---|
504 | function Untitled_3_Callback(hObject, eventdata, handles) |
---|
505 | % hObject handle to Untitled_3 (see GCBO) |
---|
506 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
507 | % handles structure with handles and user data (see GUIDATA) |
---|
508 | |
---|
509 | |
---|
510 | % --- Executes on button press in pushbutton_reson. |
---|
511 | function pushbutton_reson_Callback(hObject, eventdata, handles) |
---|
512 | % hObject handle to pushbutton_reson (see GCBO) |
---|
513 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
514 | % handles structure with handles and user data (see GUIDATA) |
---|
515 | setappdata(handles.figure1, 'where2plot',handles.fmap); |
---|
516 | axes(handles.fmap); |
---|
517 | setappdata(handles.figure1, 'fen',axis); |
---|
518 | % if ~isfield(handles,'showreson') |
---|
519 | handles.showreson=showresongui(handles); |
---|
520 | guidata(hObject,handles); |
---|
521 | % end |
---|
522 | % showresongui('where2plot',handles.fmap,'fen',axis); |
---|
523 | |
---|
524 | |
---|
525 | % -------------------------------------------------------------------- |
---|
526 | function resonance_Callback(hObject, eventdata, handles) |
---|
527 | % hObject handle to resonance (see GCBO) |
---|
528 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
529 | % handles structure with handles and user data (see GUIDATA) |
---|
530 | disp(handles.str) |
---|
531 | |
---|
532 | |
---|
533 | % -------------------------------------------------------------------- |
---|
534 | function Untitled_1_Callback(hObject, eventdata, handles) |
---|
535 | % hObject handle to Untitled_1 (see GCBO) |
---|
536 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
537 | % handles structure with handles and user data (see GUIDATA) |
---|
538 | |
---|
539 | |
---|
540 | % -------------------------------------------------------------------- |
---|
541 | function LoadDataFile_Callback(hObject, eventdata, handles) |
---|
542 | % hObject handle to LoadDataFile (see GCBO) |
---|
543 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
544 | % handles structure with handles and user data (see GUIDATA) |
---|
545 | |
---|
546 | handles = getdata(handles); |
---|
547 | guidata(hObject,handles); |
---|
548 | loaddata(hObject, handles); |
---|
549 | handles=guidata(hObject); % mis a jour des modification dans loaddata |
---|
550 | |
---|
551 | |
---|
552 | % -------------------------------------------------------------------- |
---|
553 | function handles = getdata(handles); |
---|
554 | % fonction pour ouvrir un fichier de donnees |
---|
555 | % utilise l'interface graphique |
---|
556 | % ne rend la main que si un fichier a ete correctement choisi! |
---|
557 | |
---|
558 | [filename, pathname] = uigetfile('*.out', 'Pick an data file'); |
---|
559 | |
---|
560 | if isequal(filename,0) | isequal(pathname,0) |
---|
561 | disp('User pressed cancel') |
---|
562 | else |
---|
563 | disp(['User selected ', fullfile(pathname, filename)]) |
---|
564 | handles.dataname = filename; |
---|
565 | handles.pathname = pathname; |
---|
566 | end |
---|
567 | |
---|
568 | % -------------------------------------------------------------------- |
---|
569 | function LoadDataInduced_Callback(hObject, eventdata, handles) |
---|
570 | % hObject handle to LoadDataInduced (see GCBO) |
---|
571 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
572 | % handles structure with handles and user data (see GUIDATA) |
---|
573 | |
---|
574 | |
---|
575 | % --- Executes on button press in toggle_IA. |
---|
576 | function toggle_IA_Callback(hObject, eventdata, handles) |
---|
577 | % hObject handle to toggle_IA (see GCBO) |
---|
578 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
579 | % handles structure with handles and user data (see GUIDATA) |
---|
580 | |
---|
581 | % Hint: get(hObject,'Value') returns toggle state of toggle_IA |
---|
582 | val = get(hObject,'Value') |
---|
583 | switch val |
---|
584 | case 1 |
---|
585 | fname = handles.data_inducedamplitude; |
---|
586 | if exist(fname) |
---|
587 | axes(handles.da); |
---|
588 | [header A] = hdrload(fname); |
---|
589 | plot(A(:,1),A(:,2),'k-.','Tag','IA'); |
---|
590 | else |
---|
591 | warning('Filname %s not found\n',fname); |
---|
592 | set(handles.toggle_IA,'Value',0); |
---|
593 | end |
---|
594 | otherwise |
---|
595 | delete(findobj(get(handles.da,'Children'),'Tag','IA')) |
---|
596 | end |
---|
597 | |
---|
598 | % --- Executes on button press in toogle_color. |
---|
599 | function toogle_color_Callback(hObject, eventdata, handles) |
---|
600 | % hObject handle to toogle_color (see GCBO) |
---|
601 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
602 | % handles structure with handles and user data (see GUIDATA) |
---|
603 | |
---|
604 | % Hint: get(hObject,'Value') returns toggle state of toogle_color |
---|
605 | val = get(hObject,'Value'); |
---|
606 | switch val |
---|
607 | case 0 |
---|
608 | handles.color = 'off'; |
---|
609 | case 1 |
---|
610 | if isfield(handles,'diffu') |
---|
611 | handles.color = 'on'; |
---|
612 | else |
---|
613 | set(hObject,'Value',0); |
---|
614 | end |
---|
615 | end |
---|
616 | guidata(hObject,handles); |
---|
617 | |
---|
618 | |
---|
619 | % --- Executes during object creation, after setting all properties. |
---|
620 | function popupmenu_typemap_CreateFcn(hObject, eventdata, handles) |
---|
621 | % hObject handle to popupmenu_typemap (see GCBO) |
---|
622 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
623 | % handles empty - handles not created until after all CreateFcns called |
---|
624 | |
---|
625 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
626 | % See ISPC and COMPUTER. |
---|
627 | if ispc |
---|
628 | set(hObject,'BackgroundColor','white'); |
---|
629 | else |
---|
630 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
631 | end |
---|
632 | |
---|
633 | |
---|
634 | % --- Executes on selection change in popupmenu_typemap. |
---|
635 | function popupmenu_typemap_Callback(hObject, eventdata, handles) |
---|
636 | % hObject handle to popupmenu_typemap (see GCBO) |
---|
637 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
638 | % handles structure with handles and user data (see GUIDATA) |
---|
639 | |
---|
640 | % Hints: contents = get(hObject,'String') returns popupmenu_typemap contents as cell array |
---|
641 | % contents{get(hObject,'Value')} returns selected item from popupmenu_typemap |
---|
642 | |
---|
643 | contents = get(hObject,'String'); |
---|
644 | val = contents{get(hObject,'Value')}; |
---|
645 | switch val |
---|
646 | case 'fmap' |
---|
647 | handles.maptype = 'fmap'; |
---|
648 | xlabel('x (mm)'); ylabel('z (mm)'); |
---|
649 | case 'fmapdp' |
---|
650 | handles.maptype = 'fmapdp'; |
---|
651 | xlabel('dp (%)'); ylabel('x (mm)'); |
---|
652 | end |
---|
653 | guidata(hObject,handles); |
---|
654 | |
---|
655 | |
---|
656 | % -------------------------------------------------------------------- |
---|
657 | function menu_popup_Callback(hObject, eventdata, handles) |
---|
658 | % hObject handle to menu_popup (see GCBO) |
---|
659 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
660 | % handles structure with handles and user data (see GUIDATA) |
---|
661 | |
---|
662 | |
---|
663 | % -------------------------------------------------------------------- |
---|
664 | function menu_popup1_Callback(hObject, eventdata, handles) |
---|
665 | % hObject handle to menu_popup1 (see GCBO) |
---|
666 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
667 | % handles structure with handles and user data (see GUIDATA) |
---|
668 | a = figure; |
---|
669 | b = copyobj(handles.fmap, a); |
---|
670 | % set(b, 'Position', [0.1300 0.5811 0.7750 0.3439]); |
---|
671 | set(b, 'Position', get(0,'FactoryAxesPosition')); |
---|
672 | % set(b, 'ButtonDownFcn',''); |
---|
673 | |
---|
674 | % -------------------------------------------------------------------- |
---|
675 | function menu_popup2_Callback(hObject, eventdata, handles) |
---|
676 | % hObject handle to menu_popup2 (see GCBO) |
---|
677 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
678 | % handles structure with handles and user data (see GUIDATA) |
---|
679 | a = figure; |
---|
680 | b = copyobj(handles.da, a); |
---|
681 | % set(b, 'Position', [0.1300 0.5811 0.7750 0.3439]); |
---|
682 | set(b, 'Position', get(0,'FactoryAxesPosition')); |
---|
683 | set(b, 'ButtonDownFcn',''); |
---|
684 | |
---|
685 | % -------------------------------------------------------------------- |
---|
686 | function menu_popup12_Callback(hObject, eventdata, handles) |
---|
687 | % hObject handle to menu_popup12 (see GCBO) |
---|
688 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
689 | % handles structure with handles and user data (see GUIDATA) |
---|
690 | |
---|
691 | a = figure; |
---|
692 | b = copyobj(handles.fmap, a); |
---|
693 | set(b, 'Position', [0.1300 0.5811 0.7750 0.3439]); |
---|
694 | set(b, 'ButtonDownFcn',''); |
---|
695 | % if strcmpi(get(handles.('AddPlot1_Lattice'),'Checked'),'On') |
---|
696 | % b = copyobj(handles.('Graph3'), a); |
---|
697 | % set(b, 'Position', [0.1300 0.5811 0.7750 0.3439]); |
---|
698 | % end |
---|
699 | |
---|
700 | b = copyobj(handles.da, a); |
---|
701 | set(b, 'Position', [0.1300 0.1100 0.7750 0.3439]); |
---|
702 | set(b, 'ButtonDownFcn',''); |
---|
703 | % if strcmpi(get(handles.('AddPlot2_Lattice'),'Checked'),'On') |
---|
704 | % b = copyobj(handles.('Graph4'), a); |
---|
705 | % set(b, 'Position', [0.1300 0.1100 0.7750 0.3439]); |
---|
706 | % end |
---|
707 | xlabel('Position [meters]'); |
---|
708 | |
---|
709 | Data = getappdata(gcbf, 'RawY'); |
---|
710 | if isfield(Data, 'TimeStamp') |
---|
711 | addlabel(1,0,datestr(Data.TimeStamp,21)); |
---|
712 | end |
---|
713 | orient tall |
---|