1 | %'view_field': function associated with the GUI 'view_field.fig' for images and data field visualization
|
---|
2 | %------------------------------------------------------------------------
|
---|
3 | % function huvmat=view_field(input)
|
---|
4 | %
|
---|
5 | %OUTPUT
|
---|
6 | % huvmat=current handles of the GUI view_field.fig
|
---|
7 | %%
|
---|
8 | %
|
---|
9 | %INPUT:
|
---|
10 | % input: input file name (if character chain), or input image matrix to
|
---|
11 | % visualize, or Matlab structure representing netcdf fields (with fields
|
---|
12 | % ListVarName....)
|
---|
13 | %
|
---|
14 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
15 | % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, joel.sommeria@legi.grenoble-inp.fr.
|
---|
16 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
17 | % This open is part of the toolbox VIEW_FIELD.
|
---|
18 | %
|
---|
19 | % VIEW_FIELD is free software; you can redistribute it and/or modify
|
---|
20 | % it under the terms of the GNU General Public License as published by
|
---|
21 | % the Free Software Foundation; either version 2 of the License, or
|
---|
22 | % (at your option) any later version.
|
---|
23 | %
|
---|
24 | % VIEW_FIELD is distributed in the hope that it will be useful,
|
---|
25 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
26 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
27 | % GNU General Public License (open VIEW_FIELD/COPYING.txt) for more details.
|
---|
28 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
29 |
|
---|
30 | %-------------------------------------------------------------------
|
---|
31 | % I - MAIN FUNCTION VIEW_FIELD (DO NOT MODIFY)
|
---|
32 | %-------------------------------------------------------------------
|
---|
33 | %-------------------------------------------------------------------
|
---|
34 | function varargout = view_field(varargin)
|
---|
35 |
|
---|
36 | % Begin initialization code - DO NOT EDIT
|
---|
37 | gui_Singleton = 1;
|
---|
38 | gui_State = struct('gui_Name', mfilename, ...
|
---|
39 | 'gui_Singleton', gui_Singleton, ...
|
---|
40 | 'gui_OpeningFcn', @view_field_OpeningFcn, ...
|
---|
41 | 'gui_OutputFcn', @view_field_OutputFcn, ...
|
---|
42 | 'gui_LayoutFcn', [], ...
|
---|
43 | 'gui_Callback', []);
|
---|
44 | if nargin && ischar(varargin{1})
|
---|
45 | gui_State.gui_Callback = str2func(varargin{1});
|
---|
46 | end
|
---|
47 |
|
---|
48 | if nargout
|
---|
49 | varargout{1:nargout} = gui_mainfcn(gui_State, varargin{:});
|
---|
50 | else
|
---|
51 | gui_mainfcn(gui_State, varargin{:});
|
---|
52 | end
|
---|
53 | % End initialization code - DO NOT EDIT
|
---|
54 |
|
---|
55 | %-------------------------------------------------------------------
|
---|
56 | % --- Executes just before view_field is made visible.
|
---|
57 | function view_field_OpeningFcn(hObject, eventdata, handles, Field )
|
---|
58 | %-------------------------------------------------------------------
|
---|
59 |
|
---|
60 | % Choose default command menuline output for view_field
|
---|
61 | handles.output = handles.view_field;
|
---|
62 |
|
---|
63 | % Update handles structure
|
---|
64 | guidata(hObject, handles);
|
---|
65 |
|
---|
66 | %functions for the mouse and keyboard
|
---|
67 | set(hObject,'WindowKeyPressFcn',{'keyboard_callback',handles})%set keyboard action function
|
---|
68 | set(hObject,'WindowButtonMotionFcn',{'mouse_motion',handles})%set mouse action functio
|
---|
69 | set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function
|
---|
70 | set(hObject,'WindowButtonUpFcn',{'mouse_up',handles})
|
---|
71 | set(hObject,'DeleteFcn',{@closefcn})%
|
---|
72 | set(hObject,'ResizeFcn',{@ResizeFcn,handles})%
|
---|
73 | ViewFieldData.PlotAxes=[];%initiates the record of the current field (will be updated by plot_field)
|
---|
74 | set(handles.view_field,'Units','pixels')
|
---|
75 | ViewFieldData.GUISize=get(handles.view_field,'Position');
|
---|
76 | set(handles.view_field,'UserData',ViewFieldData);%store the initial fig size in UserData
|
---|
77 | AxeData.LimEditBox=1; %initialise AxeData, the parent figure sets plot parameters
|
---|
78 | set(handles.PlotAxes,'UserData',AxeData)
|
---|
79 | if exist('Field','var')
|
---|
80 | [PlotType,PlotParamOut]= plot_field(Field,handles.PlotAxes);%,PlotParam,KeepLim,PosColorbar)
|
---|
81 | set(handles.Coordinates,'Visible','on')
|
---|
82 | if isfield(PlotParamOut,'Vectors')
|
---|
83 | set(handles.Vectors,'Visible','on')
|
---|
84 | else
|
---|
85 | set(handles.Vectors,'Visible','off')
|
---|
86 | end
|
---|
87 | if isfield(PlotParamOut,'Scalar')
|
---|
88 | set(handles.Scalar,'Visible','on')
|
---|
89 | else
|
---|
90 | set(handles.Scalar,'Visible','off')
|
---|
91 | end
|
---|
92 |
|
---|
93 | errormsg=fill_GUI(PlotParamOut,hObject);
|
---|
94 | if ~isempty(errormsg)
|
---|
95 | msgbox_uvmat('ERROR',errormsg)
|
---|
96 | return
|
---|
97 | end
|
---|
98 | %write_plot_param(handles,PlotParamOut);% update the display of the plotting parameters
|
---|
99 | end
|
---|
100 |
|
---|
101 | %put the GUI on the lower right of the sceen
|
---|
102 | pos_view_field=get(hObject,'Position');
|
---|
103 | set(0,'Unit','pixel')
|
---|
104 | ScreenSize=get(0,'ScreenSize');
|
---|
105 | pos_view_field(1)=ScreenSize(1)+ScreenSize(3)-pos_view_field(3);
|
---|
106 | pos_view_field(2)=ScreenSize(2);
|
---|
107 | set(hObject,'Position',pos_view_field)
|
---|
108 |
|
---|
109 | %------------------------------------------------------------------------
|
---|
110 | %--- activated when resizing the GUI view_field
|
---|
111 | function ResizeFcn(gcbo,eventdata,handles)
|
---|
112 | %------------------------------------------------------------------------
|
---|
113 | set(handles.view_field,'Units','pixels')
|
---|
114 | size_fig=get(handles.view_field,'Position');
|
---|
115 | Data=get(handles.view_field,'UserData');
|
---|
116 | Data.GUISize=size_fig;
|
---|
117 | set(handles.view_field,'UserData',Data)
|
---|
118 |
|
---|
119 | %% reset position of text_display and TableDisplay
|
---|
120 | % reset position of text_display
|
---|
121 | pos_1=get(handles.text_display,'Position');% [lower x lower y width height] for text_display
|
---|
122 | pos_1(1)=size_fig(3)-pos_1(3); % set text display to the right of the fig
|
---|
123 | pos_1(2)=size_fig(4)-pos_1(4); % set text display to the top of the fig
|
---|
124 | set(handles.text_display,'Position',pos_1)
|
---|
125 | % reset position of TableDisplay
|
---|
126 | % pos_1=get(handles.TableDisplay,'Position');
|
---|
127 | % pos_1(1)=size_fig(3)-pos_1(3);
|
---|
128 | % pos_1(2)=size_fig(4)-pos_1(4);
|
---|
129 | set(handles.TableDisplay,'Position',pos_1)
|
---|
130 | % end
|
---|
131 | % reset position of CheckTable
|
---|
132 | pos_CheckTable=get(handles.CheckTable,'Position');% [lower x lower y width height] for CheckHold
|
---|
133 | pos_CheckTable(1)=pos_1(1)-pos_CheckTable(3); % set 'CheckHold' to the right of the fig
|
---|
134 | pos_CheckTable(2)=size_fig(4)-pos_CheckTable(4); % set 'CheckHold' to the lower edge of text display
|
---|
135 | set(handles.CheckTable,'Position',pos_CheckTable)
|
---|
136 |
|
---|
137 | %% reset position of CheckHold
|
---|
138 | pos_CheckHold=get(handles.CheckHold,'Position');% [lower x lower y width height] for CheckHold
|
---|
139 | pos_CheckHold(1)=size_fig(3)-pos_CheckHold(3); % set 'CheckHold' to the right of the fig
|
---|
140 | pos_CheckHold(2)=pos_1(2)-pos_CheckHold(4); % set 'CheckHold' to the lower edge of text display
|
---|
141 | set(handles.CheckHold,'Position',pos_CheckHold)
|
---|
142 |
|
---|
143 | %% reset position of Coordinates
|
---|
144 | pos_2=get(handles.Coordinates,'Position');% [lower x lower y width height] for frame 'Coordinates'
|
---|
145 | pos_2(1)=size_fig(3)-pos_2(3); % set 'Coordinates' to the right of the fig
|
---|
146 | pos_2(2)=pos_CheckHold(2)-pos_2(4); % set 'Coordinates' to the lower edge of text display, allowing a margin for CheckHold
|
---|
147 | set(handles.Coordinates,'Position',pos_2)
|
---|
148 |
|
---|
149 | %% reset position of Scalar
|
---|
150 | pos_3=get(handles.Scalar,'Position'); % [lower x lower y width height] for frame 'Scalar'
|
---|
151 | pos_3(1)=size_fig(3)-pos_3(3); % set 'Scalar' to the right of the fig
|
---|
152 | if strcmp(get(handles.Scalar,'visible'),'on')
|
---|
153 | pos_3(2)=pos_2(2)-pos_3(4); % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
|
---|
154 | else
|
---|
155 | pos_3(2)=pos_2(2);% set 'Scalar' to the lower edge of frame 'text display' if unvisible
|
---|
156 | end
|
---|
157 | set(handles.Scalar,'Position',pos_3)
|
---|
158 |
|
---|
159 | %% reset position of Vectors
|
---|
160 | pos_4=get(handles.Vectors,'Position');
|
---|
161 | pos_4(1)=size_fig(3)-pos_4(3);
|
---|
162 | if strcmp(get(handles.Vectors,'visible'),'on')
|
---|
163 | pos_4(2)=pos_3(2)-pos_4(4);
|
---|
164 | else
|
---|
165 | pos_4(2)=pos_3(2);
|
---|
166 | end
|
---|
167 | set(handles.Vectors,'Position',pos_4)
|
---|
168 |
|
---|
169 | %% reset position and scale of axis
|
---|
170 | bord=[50 40 30 60]; %bordure left,inf, right,sup
|
---|
171 | pos(1)=bord(1);
|
---|
172 | pos(2)=bord(2);
|
---|
173 | pos(3)=max(1,pos_1(1)-pos(1)-bord(3));
|
---|
174 | pos(4)=max(1,size_fig(4)-bord(4));
|
---|
175 | set(handles.PlotAxes,'Position',pos)
|
---|
176 |
|
---|
177 | %------------------------------------------------------------------------
|
---|
178 | %------------------------------------------------------------------------
|
---|
179 | % --- Outputs from this function are returned to the command menuline.
|
---|
180 | function varargout = view_field_OutputFcn(hObject, eventdata, handles)
|
---|
181 | %------------------------------------------------------------------------
|
---|
182 | varargout{1} = handles.output;% the only output argument is the handle to the GUI figure
|
---|
183 | varargout{2} = strcmp(get(handles.PlotAxes,'Visible'),'on');% check active plot axis
|
---|
184 |
|
---|
185 | %------------------------------------------------------------------------
|
---|
186 | %--- activated when closing the GUI view_field
|
---|
187 | function closefcn(gcbo,eventdata)
|
---|
188 | %------------------------------------------------------------------------
|
---|
189 | huvmat=findobj(allchild(0),'Tag','uvmat');%find the current uvmat interface handle
|
---|
190 | if ~isempty(huvmat)
|
---|
191 | hhuvmat=guidata(huvmat);
|
---|
192 | set(hhuvmat.CheckViewField,'Value',0)
|
---|
193 | %set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree
|
---|
194 | % deselect the object in ListObject when view_field is closed
|
---|
195 | if isempty(findobj(allchild(0),'Tag','set_object'))
|
---|
196 | ObjIndex=get(hhuvmat.ListObject,'Value');
|
---|
197 | ObjIndex=ObjIndex(1);%keep only the first object selected
|
---|
198 | set(hhuvmat.ListObject,'Value',ObjIndex)
|
---|
199 | % draw all object colors in blue (unselected) in uvmat
|
---|
200 | hother=[findobj(hhuvmat.PlotAxes,'Tag','proj_object');findobj(hhuvmat.PlotAxes,'Tag','DeformPoint')];%find all the proj object and deform point representations
|
---|
201 | for iobj=1:length(hother)
|
---|
202 | if isequal(get(hother(iobj),'Type'),'rectangle')||isequal(get(hother(iobj),'Type'),'patch')
|
---|
203 | set(hother(iobj),'EdgeColor','b')
|
---|
204 | if isequal(get(hother(iobj),'FaceColor'),'m')
|
---|
205 | set(hother(iobj),'FaceColor','b')
|
---|
206 | end
|
---|
207 | elseif isequal(get(hother(iobj),'Type'),'image')
|
---|
208 | Acolor=get(hother(iobj),'CData');
|
---|
209 | Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2));
|
---|
210 | set(hother(iobj),'CData',Acolor);
|
---|
211 | else
|
---|
212 | set(hother(iobj),'Color','b')
|
---|
213 | end
|
---|
214 | set(hother(iobj),'Selected','off')
|
---|
215 | end
|
---|
216 | end
|
---|
217 | end
|
---|
218 | hciv=findobj(allchild(0),'Tag','civ');%find the current civ GUI
|
---|
219 | if ~isempty(hciv)
|
---|
220 | hhciv=guidata(hciv);
|
---|
221 | set(hhciv.TestCiv1,'Value',0)% desactivate TestCiv1 if on
|
---|
222 | set(hhciv.TestCiv1,'BackgroundColor',[1 0 0])%
|
---|
223 | end
|
---|
224 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a civ correlation window used with TesCiv1
|
---|
225 | if ~isempty(corrfig)
|
---|
226 | delete(corrfig)
|
---|
227 | end
|
---|
228 |
|
---|
229 | %-------------------------------------------------------------------
|
---|
230 | %-------------------------------------------------------------------
|
---|
231 | % II - FUNCTIONS FOR INTRODUCING THE INPUT FILES
|
---|
232 | % automatically sets the global properties when the rootfile name is introduced
|
---|
233 | % then activate the view-field action if selected
|
---|
234 | % it is activated either by clicking on the RootPath window or by the
|
---|
235 | % browser
|
---|
236 | %------------------------------------------------------------------
|
---|
237 | %------------------------------------------------------------------
|
---|
238 |
|
---|
239 | %-------------------------------------------------------------------
|
---|
240 | function update_mask(handles,num_i1,num_j1)
|
---|
241 | %-------------------------------------------------------------------
|
---|
242 |
|
---|
243 | MaskData=get(handles.mask_test,'UserData');
|
---|
244 | if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
|
---|
245 | uistack(MaskData.maskhandle,'top');
|
---|
246 | end
|
---|
247 | num_i1_mask=mod(num_i1-1,MaskData.NbSlice)+1;
|
---|
248 | [RootPath,RootFile]=fullfile(MaskData.Base);
|
---|
249 | MaskName=fullfile_uvmat(RootPath,'',RootFile,'.png',MaskData.NomType,num_i1_mask,[],num_j1);
|
---|
250 | %[MaskName,mdetect]=name_generator(MaskData.Base,num_i1_mask,num_j1,'.png',MaskData.NomType);
|
---|
251 | huvmat=get(handles.mask_test,'parent');
|
---|
252 | UvData=get(huvmat,'UserData');
|
---|
253 |
|
---|
254 | %update mask image if the mask is new
|
---|
255 | if ~ (isfield(UvData,'MaskName') && isequal(UvData.MaskName,MaskName))
|
---|
256 | UvData.MaskName=MaskName; %update the recorded name on UvData
|
---|
257 | set(huvmat,'UserData',UvData);
|
---|
258 | if mdetect==0
|
---|
259 | if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
|
---|
260 | delete(MaskData.maskhandle)
|
---|
261 | end
|
---|
262 | else
|
---|
263 | %read mask image
|
---|
264 | Mask.AName='image';
|
---|
265 | Mask.A=imread(MaskName);
|
---|
266 | npxy=size(Mask.A);
|
---|
267 | Mask.AX=[0.5 npxy(2)-0.5];
|
---|
268 | Mask.AY=[npxy(1)-0.5 0.5 ];
|
---|
269 | Mask.CoordUnit='pixel';
|
---|
270 | if isequal(get(handles.slices,'Value'),1)
|
---|
271 | NbSlice=str2num(get(handles.nb_slice,'String'));
|
---|
272 | num_i1=str2num(get(handles.i1,'String'));
|
---|
273 | Mask.ZIndex=mod(num_i1-1,NbSlice)+1;
|
---|
274 | end
|
---|
275 | %px to phys or other transform on field
|
---|
276 | menu_transform=get(handles.transform_fct,'String');
|
---|
277 | choice_value=get(handles.transform_fct,'Value');
|
---|
278 | transform_name=menu_transform{choice_value};%name of the transform fct given by the menu 'transform_fct'
|
---|
279 | transform_list=get(handles.transform_fct,'UserData');
|
---|
280 | transform=transform_list{choice_value};
|
---|
281 | if ~isequal(transform_name,'') && ~isequal(transform_name,'px')
|
---|
282 | if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority
|
---|
283 | Calib=UvData.XmlData.GeometryCalib;
|
---|
284 | Mask=transform(Mask,UvData.XmlData);
|
---|
285 | end
|
---|
286 | end
|
---|
287 | flagmask=Mask.A < 200;
|
---|
288 |
|
---|
289 | %make brown color image
|
---|
290 | imflag(:,:,1)=0.9*flagmask;
|
---|
291 | imflag(:,:,2)=0.7*flagmask;
|
---|
292 | imflag(:,:,3)=zeros(size(flagmask));
|
---|
293 |
|
---|
294 | %update mask image
|
---|
295 | hmask=[]; %default
|
---|
296 | if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
|
---|
297 | hmask=MaskData.maskhandle;
|
---|
298 | end
|
---|
299 | if ~isempty(hmask)
|
---|
300 | set(hmask,'CData',imflag)
|
---|
301 | set(hmask,'AlphaData',flagmask*0.6)
|
---|
302 | set(hmask,'XData',Mask.AX);
|
---|
303 | set(hmask,'YData',Mask.AY);
|
---|
304 | % uistack(hmask,'top')
|
---|
305 | else
|
---|
306 | axes(handles.PlotAxes)
|
---|
307 | hold on
|
---|
308 | MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*flagmask);
|
---|
309 | % set(MaskData.maskhandle,'AlphaData',0.6*flagmask)
|
---|
310 | set(handles.mask_test,'UserData',MaskData)
|
---|
311 | end
|
---|
312 | end
|
---|
313 | end
|
---|
314 |
|
---|
315 |
|
---|
316 | %-------------------------------------------------------------------
|
---|
317 | function MenuExportFigure_Callback(hObject, eventdata, handles)
|
---|
318 | %-------------------------------------------------------------------
|
---|
319 | huvmat=get(handles.MenuExport,'parent');
|
---|
320 | UvData=get(huvmat,'UserData');
|
---|
321 | hfig=figure;
|
---|
322 | newaxes=copyobj(handles.PlotAxes,hfig);
|
---|
323 | map=colormap(handles.PlotAxes);
|
---|
324 | colormap(map);%transmit the current colormap to the zoom fig
|
---|
325 | colorbar
|
---|
326 |
|
---|
327 | %-------------------------------------------------------------------
|
---|
328 | %-------------------------------------------------------------------
|
---|
329 | % III - MAIN REFRESH FUNCTIONS : 'FRAME PLOT'
|
---|
330 | %-------------------------------------------------------------------
|
---|
331 | %-------------------------------------------------------------------
|
---|
332 |
|
---|
333 | %Executes on button press in runplus: make one step forward and call
|
---|
334 | %run0. The step forward is along the fields series 1 or 2 depending on
|
---|
335 | %the scan_i and scan_j check box (exclusive each other)
|
---|
336 | %-------------------------------------------------------------------
|
---|
337 | function runplus_Callback(hObject, eventdata, handles)
|
---|
338 | increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
|
---|
339 | runpm(hObject,eventdata,handles,increment)
|
---|
340 |
|
---|
341 | %-------------------------------------------------------------------
|
---|
342 | %Executes on button press in runmin: make one step backward and call
|
---|
343 | %run0. The step backward is along the fields series 1 or 2 depending on
|
---|
344 | %the scan_i and scan_j check box (exclusive each other)
|
---|
345 | %-------------------------------------------------------------------
|
---|
346 | function runmin_Callback(hObject, eventdata, handles)
|
---|
347 | increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d
|
---|
348 | runpm(hObject,eventdata,handles,increment)
|
---|
349 |
|
---|
350 | % %-------------------------------------------------------------------
|
---|
351 | % %Executes on button press in runmin: make one step backward and call
|
---|
352 | % %run0. The step backward is along the fields series 1 or 2 depending on
|
---|
353 | % %the scan_i and scan_j check box (exclusive each other)
|
---|
354 | % %-------------------------------------------------------------------
|
---|
355 | % function RunMovie_Callback(hObject, eventdata, handles)
|
---|
356 | % %------------------------------------------------------------------
|
---|
357 | % set(handles.RunMovie,'BackgroundColor',[1 1 0])%paint the command button in yellow
|
---|
358 | % drawnow
|
---|
359 | % increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
|
---|
360 | % set(handles.STOP,'Visible','on')
|
---|
361 | % set(handles.speed,'Visible','on')
|
---|
362 | % set(handles.speed_txt,'Visible','on')
|
---|
363 | % set(handles.RunMovie,'BusyAction','queue')
|
---|
364 | % testavi=0;
|
---|
365 | % UvData=get(handles.view_field,'UserData');
|
---|
366 | %
|
---|
367 | % while get(handles.speed,'Value')~=0 & isequal(get(handles.RunMovie,'BusyAction'),'queue') % enable STOP command
|
---|
368 | % runpm(hObject,eventdata,handles,increment)
|
---|
369 | % pause(1.02-get(handles.speed,'Value'))% wait for next image
|
---|
370 | % end
|
---|
371 | % if isfield(UvData,'aviobj') && ~isempty( UvData.aviobj),
|
---|
372 | % UvData.aviobj=close(UvData.aviobj);
|
---|
373 | % set(handles.view_field,'UserData',UvData);
|
---|
374 | % end
|
---|
375 | % set(handles.RunMovie,'BackgroundColor',[1 0 0])%paint the command buttonback to red
|
---|
376 |
|
---|
377 | %------------------------------------------------------------------------
|
---|
378 | % --- translate coordinate to matrix index
|
---|
379 | %------------------------------------------------------------------------
|
---|
380 | function [indx,indy]=pos2ind(x0,rangx0,nxy)
|
---|
381 | indx=1+round((nxy(2)-1)*(x0-rangx0(1))/(rangx0(2)-rangx0(1)));% index x of pixel
|
---|
382 | indy=1+round((nxy(1)-1)*(y12-rangy0(1))/(rangy0(2)-rangy0(1)));% index y of pixel
|
---|
383 |
|
---|
384 | %------------------------------------------------------------------------
|
---|
385 | % --- Executes on button press in 'CheckZoom'.
|
---|
386 | %------------------------------------------------------------------------
|
---|
387 | function CheckZoom_Callback(hObject, eventdata, handles)
|
---|
388 |
|
---|
389 | if get(handles.CheckZoom,'Value')
|
---|
390 | set(handles.CheckFixLimits,'Value',1)% propose by default fixed limits for the plotting axes
|
---|
391 | set(handles.CheckZoomFig,'Value',0)%desactivate zoom fig
|
---|
392 | end
|
---|
393 |
|
---|
394 | %------------------------------------------------------------------------
|
---|
395 | % --- Executes on button press in CheckZoomFig.
|
---|
396 | %------------------------------------------------------------------------
|
---|
397 | function CheckZoomFig_Callback(hObject, eventdata, handles)
|
---|
398 |
|
---|
399 | if get(handles.CheckZoomFig,'Value')
|
---|
400 | set(handles.CheckZoom,'value',0)
|
---|
401 | end
|
---|
402 |
|
---|
403 | %-------------------------------------------------------------------
|
---|
404 | % --- Executes on button press in 'FixLimits'.
|
---|
405 | %-------------------------------------------------------------------
|
---|
406 | function CheckFixLimits_Callback(hObject, eventdata, handles)
|
---|
407 | test=get(handles.CheckFixLimits,'Value');
|
---|
408 | % if test
|
---|
409 | % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
410 | % else
|
---|
411 | % set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
|
---|
412 | % end
|
---|
413 | update_plot(handles)
|
---|
414 |
|
---|
415 | %-------------------------------------------------------------------
|
---|
416 | % --- Executes on button press in CheckFixAspectRatio.
|
---|
417 | function CheckFixAspectRatio_Callback(hObject, eventdata, handles)
|
---|
418 | %-------------------------------------------------------------------
|
---|
419 | if get(handles.CheckFixAspectRatio,'Value')
|
---|
420 | update_plot(handles);
|
---|
421 | else
|
---|
422 | update_plot(handles);
|
---|
423 | end
|
---|
424 |
|
---|
425 | %-------------------------------------------------------------------
|
---|
426 | function num_AspectRatio_Callback(hObject, eventdata, handles)
|
---|
427 | %-------------------------------------------------------------------
|
---|
428 | set(handles.CheckFixAspectRatio,'Value',1)% select the fixed aspect ratio button
|
---|
429 | update_plot(handles);
|
---|
430 |
|
---|
431 | %-------------------------------------------------------------------
|
---|
432 |
|
---|
433 | % %-------------------------------------------------------------------
|
---|
434 | % %----Executes on button press in 'record': records the current flags of manual correction.
|
---|
435 | % %-------------------------------------------------------------------
|
---|
436 | % function record_Callback(hObject, eventdata, handles)
|
---|
437 | % % [filebase,num_i1,num_j1,num_i2,num_j2,Ext,NomType,SubDir]=read_input_file(handles);
|
---|
438 | % filename=read_file_boxes(handles);
|
---|
439 | % AxeData=get(gca,'UserData');
|
---|
440 | % [erread,message]=fileattrib(filename);
|
---|
441 | % if ~isempty(message) && ~isequal(message.UserWrite,1)
|
---|
442 | % msgbox_view_field('ERROR',['no writting access to ' filename])
|
---|
443 | % return
|
---|
444 | % end
|
---|
445 | % test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]);
|
---|
446 | % test_civ1=isequal(get(handles.civ1,'BackgroundColor'),[1 1 0]);
|
---|
447 | % if ~test_civ2 && ~test_civ1
|
---|
448 | % msgbox_view_field('ERROR','manual correction only possible for CIV1 or CIV2 velocity fields')
|
---|
449 | % end
|
---|
450 | % if test_civ2
|
---|
451 | % nbname='nb_vectors2';
|
---|
452 | % flagname='vec2_FixFlag';
|
---|
453 | % attrname='fix2';
|
---|
454 | % end
|
---|
455 | % if test_civ1
|
---|
456 | % nbname='nb_vectors';
|
---|
457 | % flagname='vec_FixFlag';
|
---|
458 | % attrname='fix';
|
---|
459 | % end
|
---|
460 | % %write fix flags in the netcdf file
|
---|
461 | % hhh=which('netcdf.open');% look for built-in matlab netcdf library
|
---|
462 | % if ~isequal(hhh,'')% case of new builtin Matlab netcdf library
|
---|
463 | % nc=netcdf.open(filename,'NC_WRITE');
|
---|
464 | % netcdf.reDef(nc)
|
---|
465 | % netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1)
|
---|
466 | % dimid = netcdf.inqDimID(nc,nbname);
|
---|
467 | % try
|
---|
468 | % varid = netcdf.inqVarID(nc,flagname);% look for already existing fixflag variable
|
---|
469 | % catch
|
---|
470 | % varid=netcdf.defVar(nc,flagname,'double',dimid);%create fixflag variable if it does not exist
|
---|
471 | % end
|
---|
472 | % netcdf.endDef(nc)
|
---|
473 | % netcdf.putVar(nc,varid,AxeData.FF);
|
---|
474 | % netcdf.close(nc)
|
---|
475 | % else %old netcdf library
|
---|
476 | % netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)
|
---|
477 | % end
|
---|
478 | %
|
---|
479 | % function netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)
|
---|
480 | % nc=netcdf(filename,'write'); %open netcdf file
|
---|
481 | % result=redef(nc);
|
---|
482 | % eval(['nc.' attrname '=1;']);
|
---|
483 | % theDim=nc(nbname) ;% get the number of velocity vectors
|
---|
484 | % nb_vectors=size(theDim);
|
---|
485 | % var_FixFlag=ncvar(flagname,nc);% var_FixFlag will be written as the netcdf variable vec_FixFlag
|
---|
486 | % var_FixFlag(1:nb_vectors)=AxeData.FF;%
|
---|
487 | % fin=close(nc);
|
---|
488 |
|
---|
489 |
|
---|
490 | %-------------------------------------------------------------------
|
---|
491 | %-------------------------------------------------------------------
|
---|
492 | % - FUNCTIONS FOR SETTING PLOTTING PARAMETERS
|
---|
493 |
|
---|
494 | %------------------------------------------------------------------
|
---|
495 |
|
---|
496 |
|
---|
497 | %------------------------------------------------------------------
|
---|
498 | % --- Executes on selection change in col_vec: choice of the color code.
|
---|
499 | %
|
---|
500 | function col_vec_Callback(hObject, eventdata, handles)
|
---|
501 | %------------------------------------------------------------------
|
---|
502 | % edit the choice for color code
|
---|
503 | list_code=get(handles.col_vec,'String');% list menu fields
|
---|
504 | index_code=get(handles.col_vec,'Value');% selected string index
|
---|
505 | col_code= list_code{index_code(1)}; % selected field
|
---|
506 | if isequal(col_code,'black') | isequal(col_code,'white')
|
---|
507 | set(handles.slider1,'Visible','off')
|
---|
508 | set(handles.slider2,'Visible','off')
|
---|
509 | set(handles.colcode1,'Visible','off')
|
---|
510 | set(handles.colcode2,'Visible','off')
|
---|
511 | set(handles.AutoVecColor,'Visible','off')
|
---|
512 | set_vec_col_bar(handles)
|
---|
513 | else
|
---|
514 | set(handles.slider1,'Visible','on')
|
---|
515 | set(handles.slider2,'Visible','on')
|
---|
516 | set(handles.colcode1,'Visible','on')
|
---|
517 | set(handles.colcode2,'Visible','on')
|
---|
518 | set(handles.AutoVecColor,'Visible','on')
|
---|
519 | if isequal(col_code,'ima_cor')
|
---|
520 | set(handles.AutoVecColor,'Value',0)%fixed scale by default
|
---|
521 | set(handles.vec_col_bar,'Value',0)% 3 colors r,g,b by default
|
---|
522 | set(handles.slider1,'Min',0);
|
---|
523 | set(handles.slider1,'Max',1);
|
---|
524 | set(handles.slider2,'Min',0);
|
---|
525 | set(handles.slider2,'Max',1);
|
---|
526 | % set(handles.min_C_title_vec,'String','0')
|
---|
527 | set(handles.max_vec,'String','1')
|
---|
528 | set(handles.colcode1,'String','0.333')
|
---|
529 | colcode1_Callback(hObject, eventdata, handles)
|
---|
530 | set(handles.colcode2,'String','0.666')
|
---|
531 | colcode2_Callback(hObject, eventdata, handles)
|
---|
532 | else
|
---|
533 | set(handles.AutoVecColor,'Value',1)%auto scale between min,max by default
|
---|
534 | set(handles.vec_col_bar,'Value',1)% colormap 'jet' by default
|
---|
535 | minval=get(handles.slider1,'Min');
|
---|
536 | maxval=get(handles.slider1,'Max');
|
---|
537 | set(handles.slider1,'Value',minval)
|
---|
538 | set(handles.slider2,'Value',maxval)
|
---|
539 | set_vec_col_bar(handles)
|
---|
540 | end
|
---|
541 | % slider_update(handles)
|
---|
542 | end
|
---|
543 | %replot the current graph
|
---|
544 | run0_Callback(hObject, eventdata, handles)
|
---|
545 |
|
---|
546 |
|
---|
547 | %----------------------------------------------------------------
|
---|
548 | % -- Executes on slider movement to set the color code
|
---|
549 | %
|
---|
550 | function slider1_Callback(hObject, eventdata, handles)
|
---|
551 | %------------------------------------------------------------------
|
---|
552 | slider1=get(handles.slider1,'Value');
|
---|
553 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
554 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
555 | col=min_val+(max_val-min_val)*slider1;
|
---|
556 | set(handles.colcode1,'String',num2str(col))
|
---|
557 | if(get(handles.slider2,'Value') < col)%move also the second slider at the same value if needed
|
---|
558 | set(handles.slider2,'Value',col)
|
---|
559 | set(handles.colcode2,'String',num2str(col))
|
---|
560 | end
|
---|
561 | colcode1_Callback(hObject, eventdata, handles)
|
---|
562 |
|
---|
563 | %----------------------------------------------------------------
|
---|
564 | % Executes on slider movement to set the color code
|
---|
565 | %----------------------------------------------------------------
|
---|
566 | function slider2_Callback(hObject, eventdata, handles)
|
---|
567 | slider2=get(handles.slider2,'Value');
|
---|
568 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
569 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
570 | col=min_val+(max_val-min_val)*slider2;
|
---|
571 | set(handles.colcode2,'String',num2str(col))
|
---|
572 | if(get(handles.slider1,'Value') > col)%move also the first slider at the same value if needed
|
---|
573 | set(handles.slider1,'Value',col)
|
---|
574 | set(handles.colcode1,'String',num2str(col))
|
---|
575 | end
|
---|
576 | colcode2_Callback(hObject, eventdata, handles)
|
---|
577 |
|
---|
578 | %----------------------------------------------------------------
|
---|
579 | %execute on return carriage on the edit box corresponding to slider 1
|
---|
580 | %----------------------------------------------------------------
|
---|
581 | function colcode1_Callback(hObject, eventdata, handles)
|
---|
582 | % col=str2num(get(handles.colcode1,'String'));
|
---|
583 | % set(handles.slider1,'Value',col)
|
---|
584 | set_vec_col_bar(handles)
|
---|
585 | update_plot(handles)
|
---|
586 |
|
---|
587 | %----------------------------------------------------------------
|
---|
588 | %execute on return carriage on the edit box corresponding to slider 2
|
---|
589 | %----------------------------------------------------------------
|
---|
590 | function colcode2_Callback(hObject, eventdata, handles)
|
---|
591 | % col=str2num(get(handles.colcode2,'String'));
|
---|
592 | % set(handles.slider2,'Value',col)
|
---|
593 | % slider2_Callback(hObject, eventdata, handles)
|
---|
594 | set_vec_col_bar(handles)
|
---|
595 | update_plot(handles)
|
---|
596 |
|
---|
597 | %-------------------------------------------------------
|
---|
598 | % --- Executes on button press in AutoVecColor.
|
---|
599 | %-------------------------------------------------------
|
---|
600 | function vec_col_bar_Callback(hObject, eventdata, handles)
|
---|
601 | set_vec_col_bar(handles)
|
---|
602 |
|
---|
603 | %------------------------------------------------
|
---|
604 | %CALLBACKS FOR PLOTTING PARAMETERS
|
---|
605 | %-------------------------------------------------
|
---|
606 |
|
---|
607 | %------------------------------------------------------------------------
|
---|
608 | function num_MinX_Callback(hObject, eventdata, handles)
|
---|
609 | %------------------------------------------------------------------------
|
---|
610 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
611 | % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
612 | update_plot(handles);
|
---|
613 |
|
---|
614 | %------------------------------------------------------------------------
|
---|
615 | function num_MaxX_Callback(hObject, eventdata, handles)
|
---|
616 | %------------------------------------------------------------------------
|
---|
617 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
618 | % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
619 | update_plot(handles);
|
---|
620 |
|
---|
621 | %------------------------------------------------------------------------
|
---|
622 | function num_MinY_Callback(hObject, eventdata, handles)
|
---|
623 | %------------------------------------------
|
---|
624 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
625 | % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
626 | update_plot(handles);
|
---|
627 |
|
---|
628 | %------------------------------------------------------------------------
|
---|
629 | function num_MaxY_Callback(hObject, eventdata, handles)
|
---|
630 | %------------------------------------------------------------------------
|
---|
631 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
632 | % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
633 | update_plot(handles);
|
---|
634 |
|
---|
635 | %-----------------------------------------------------------------
|
---|
636 | function num_MinA_Callback(hObject, eventdata, handles)
|
---|
637 | %------------------------------------------
|
---|
638 | set(handles.CheckFixScalar,'Value',1) %suppress auto mode
|
---|
639 | set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
|
---|
640 | update_plot(handles)
|
---|
641 |
|
---|
642 | %-----------------------------------------------------------------
|
---|
643 | function num_MaxA_Callback(hObject, eventdata, handles)
|
---|
644 | %--------------------------------------------
|
---|
645 | set(handles.CheckFixScalar,'Value',1) %suppress auto mode
|
---|
646 | % set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
|
---|
647 | update_plot(handles)
|
---|
648 |
|
---|
649 | %-----------------------------------------------
|
---|
650 | function CheckFixScalar_Callback(hObject, eventdata, handles)
|
---|
651 | %--------------------------------------------
|
---|
652 | test=get(handles.CheckFixScalar,'Value');
|
---|
653 | % if test
|
---|
654 | % set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
|
---|
655 | % else
|
---|
656 | % set(handles.CheckFixScalar,'BackgroundColor',[0.7 0.7 0.7])
|
---|
657 | % update_plot(handles);
|
---|
658 | % % set(handles.MinA,'String',num2str(ScalOut.MinA,3))
|
---|
659 | % % set(handles.MaxA,'String',num2str(ScalOut.MaxA,3))
|
---|
660 | % end
|
---|
661 |
|
---|
662 | %-------------------------------------------------------------------
|
---|
663 | function CheckBW_Callback(hObject, eventdata, handles)
|
---|
664 | %-------------------------------------------------------------------
|
---|
665 | update_plot(handles)
|
---|
666 |
|
---|
667 | %-------------------------------------------------------------------
|
---|
668 | function ListContour_Callback(hObject, eventdata, handles)
|
---|
669 | %-------------------------------------------------------------------
|
---|
670 | val=get(handles.Contours,'Value');
|
---|
671 | if val==2
|
---|
672 | set(handles.interval_txt,'Visible','on')
|
---|
673 | set(handles.IncrA,'Visible','on')
|
---|
674 | else
|
---|
675 | set(handles.interval_txt,'Visible','off')
|
---|
676 | set(handles.IncrA,'Visible','off')
|
---|
677 | end
|
---|
678 | update_plot(handles)
|
---|
679 |
|
---|
680 | %-------------------------------------------------------------------
|
---|
681 | function IncrA_Callback(hObject, eventdata, handles)
|
---|
682 | %-------------------------------------------------------------------
|
---|
683 | update_plot(handles)
|
---|
684 |
|
---|
685 | %-------------------------------------------------------------------
|
---|
686 | function HideWarning_Callback(hObject, eventdata, handles)
|
---|
687 | %-------------------------------------------------------------------
|
---|
688 | update_plot(handles)
|
---|
689 |
|
---|
690 | %-------------------------------------------------------------------
|
---|
691 | function HideFalse_Callback(hObject, eventdata, handles)
|
---|
692 | %-------------------------------------------------------------------
|
---|
693 | update_plot(handles)
|
---|
694 |
|
---|
695 | %-------------------------------------------------------------------
|
---|
696 | function num_VecScale_Callback(hObject, eventdata, handles)
|
---|
697 | %-------------------------------------------------------------------
|
---|
698 | set(handles.CheckFixVectors,'Value',1);
|
---|
699 | update_plot(handles)
|
---|
700 |
|
---|
701 | %-------------------------------------------------------------------
|
---|
702 | function FixVec_Callback(hObject, eventdata, handles)
|
---|
703 | %-------------------------------------------------------------------
|
---|
704 | test=get(handles.FixVec,'Value');
|
---|
705 | if test
|
---|
706 | set(handles.FixVec,'BackgroundColor',[1 1 0])
|
---|
707 | else
|
---|
708 | update_plot(handles);
|
---|
709 | %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3))
|
---|
710 | % set(handles.FixVec,'BackgroundColor',[0.7 0.7 0.7])
|
---|
711 | end
|
---|
712 |
|
---|
713 | %-------------------------------------------------------
|
---|
714 | % --- Executes on selection change in decimate4 (nb_vec/4).
|
---|
715 | %-------------------------------------------------------
|
---|
716 | function CheckDecimate4_Callback(hObject, eventdata, handles)
|
---|
717 | update_plot(handles)
|
---|
718 |
|
---|
719 |
|
---|
720 | %-------------------------------------------------------
|
---|
721 | % --- Executes on selection change in color_code menu
|
---|
722 | %-------------------------------------------------------
|
---|
723 | function color_code_Callback(hObject, eventdata, handles)
|
---|
724 | set_vec_col_bar(handles)
|
---|
725 | update_plot(handles);
|
---|
726 |
|
---|
727 | %-------------------------------------------------------
|
---|
728 | % --- Executes on button press in AutoVecColor.
|
---|
729 | %-------------------------------------------------------
|
---|
730 | function AutoVecColor_Callback(hObject, eventdata, handles)
|
---|
731 | test=get(handles.AutoVecColor,'Value');
|
---|
732 | if test
|
---|
733 | set(handles.AutoVecColor,'BackgroundColor',[1 1 0])
|
---|
734 | else
|
---|
735 | update_plot(handles);
|
---|
736 | %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3))
|
---|
737 | set(handles.AutoVecColor,'BackgroundColor',[0.7 0.7 0.7])
|
---|
738 | end
|
---|
739 | %set_vec_col_bar(handles)
|
---|
740 |
|
---|
741 | %-------------------------------------------------------
|
---|
742 | % --- Executes on selection change in max_vec.
|
---|
743 | %-------------------------------------------------------
|
---|
744 | function min_vec_Callback(hObject, eventdata, handles)
|
---|
745 | max_vec_Callback(hObject, eventdata, handles)
|
---|
746 |
|
---|
747 | % --- Executes on selection change in max_vec.
|
---|
748 | function max_vec_Callback(hObject, eventdata, handles)
|
---|
749 | set(handles.AutoVecColor,'Value',1)
|
---|
750 | AutoVecColor_Callback(hObject, eventdata, handles)
|
---|
751 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
752 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
753 | slider1=get(handles.slider1,'Value');
|
---|
754 | slider2=get(handles.slider2,'Value');
|
---|
755 | colcode1=min_val+(max_val-min_val)*slider1;
|
---|
756 | colcode2=min_val+(max_val-min_val)*slider2;
|
---|
757 | set(handles.colcode1,'String',num2str(colcode1))
|
---|
758 | set(handles.colcode2,'String',num2str(colcode2))
|
---|
759 | update_plot(handles);
|
---|
760 |
|
---|
761 | %-------------------------------------------------------------------
|
---|
762 | %update the display of color code for vectors
|
---|
763 | function set_vec_col_bar(handles)
|
---|
764 | %-------------------------------------------------------------------
|
---|
765 | %get the image of the color display button 'vec_col_bar' in pixels
|
---|
766 | set(handles.vec_col_bar,'Unit','pixel');
|
---|
767 | pos_vert=get(handles.vec_col_bar,'Position');
|
---|
768 | set(handles.vec_col_bar,'Unit','Normalized');
|
---|
769 | width=ceil(pos_vert(3));
|
---|
770 | height=ceil(pos_vert(4));
|
---|
771 |
|
---|
772 | %get slider indications
|
---|
773 | list=get(handles.color_code,'String');
|
---|
774 | ichoice=get(handles.color_code,'Value');
|
---|
775 | colcode.ColorCode=list{ichoice};
|
---|
776 | colcode.MinC=str2num(get(handles.min_vec,'String'));
|
---|
777 | colcode.MaxC=str2num(get(handles.max_vec,'String'));
|
---|
778 | test3color=strcmp(colcode.ColorCode,'rgb') || strcmp(colcode.ColorCode,'bgr');
|
---|
779 | if test3color
|
---|
780 | colcode.colcode1=str2num(get(handles.colcode1,'String'));
|
---|
781 | colcode.colcode2=str2num(get(handles.colcode2,'String'));
|
---|
782 | end
|
---|
783 | colcode.FixedCbounds=0;
|
---|
784 | colcode.FixedCbounds=1;
|
---|
785 | vec_C=colcode.MinC+(colcode.MaxC-colcode.MinC)*[0.5:width-0.5]/width;%sample of vec_C values from min to max
|
---|
786 | [colorlist,col_vec]=set_col_vec(colcode,vec_C);
|
---|
787 | oneheight=ones(1,height);
|
---|
788 | A1=colorlist(col_vec,1)*oneheight;
|
---|
789 | A2=colorlist(col_vec,2)*oneheight;
|
---|
790 | A3=colorlist(col_vec,3)*oneheight;
|
---|
791 | A(:,:,1)=A1';
|
---|
792 | A(:,:,2)=A2';
|
---|
793 | A(:,:,3)=A3';
|
---|
794 | set(handles.vec_col_bar,'Cdata',A)
|
---|
795 |
|
---|
796 | %-------------------------------------------------------------------
|
---|
797 | function update_plot(handles)
|
---|
798 | %-------------------------------------------------------------------
|
---|
799 | Data=get(handles.view_field,'UserData');
|
---|
800 | AxeData=Data.PlotAxes;% retrieve the current plotted data
|
---|
801 | PlotParam=read_GUI(handles.view_field);
|
---|
802 | [PP,PlotParamOut]= plot_field(AxeData,handles.PlotAxes,PlotParam);
|
---|
803 | errormsg=fill_GUI(PlotParamOut,handles.view_field);
|
---|
804 | if ~isempty(errormsg)
|
---|
805 | msgbox_uvmat('ERROR',errormsg)
|
---|
806 | return
|
---|
807 | end
|
---|
808 | %write_plot_param(handles,PlotParamOut); %update the auto plot parameters
|
---|
809 |
|
---|
810 | %------------------------------------------------------------------------
|
---|
811 | % --- Executes on button press in Menu/Export/field in workspace.
|
---|
812 | function MenuExportField_Callback(hObject, eventdata, handles)
|
---|
813 | %------------------------------------------------------------------------
|
---|
814 | global Data_view_field
|
---|
815 | % huvmat=findobj(allchild(0),'Name','uvmat');
|
---|
816 | Data_view_field=get(handles.view_field,'UserData');
|
---|
817 | Data_view_field=Data_view_field.PlotAxes;
|
---|
818 | % Data_view_field=UvData.ProjField_2;
|
---|
819 | evalin('base','global Data_view_field')%make CurData global in the workspace
|
---|
820 | display(['UserData of view_field :'])
|
---|
821 | evalin('base','Data_view_field') %display CurData in the workspace
|
---|
822 | commandwindow;
|
---|
823 |
|
---|
824 | %------------------------------------------------------------------------
|
---|
825 | % --- Executes on button press in Menu/Export/extract figure.
|
---|
826 | function MenuExport_plot_Callback(hObject, eventdata, handles)
|
---|
827 | %------------------------------------------------------------------------
|
---|
828 | huvmat=get(handles.MenuExport_plot,'parent');
|
---|
829 | UvData=get(huvmat,'UserData');
|
---|
830 | hfig=figure;
|
---|
831 | newaxes=copyobj(handles.PlotAxes,hfig);
|
---|
832 | map=colormap(handles.PlotAxes);
|
---|
833 | colormap(map);%transmit the current colormap to the zoom fig
|
---|
834 | colorbar
|
---|
835 |
|
---|
836 |
|
---|
837 | % --- Executes on selection change in ColorCode.
|
---|
838 | function ColorCode_Callback(hObject, eventdata, handles)
|
---|
839 |
|
---|
840 |
|
---|
841 | % --- Executes on selection change in ColorScalar.
|
---|
842 | function ColorScalar_Callback(hObject, eventdata, handles)
|
---|
843 |
|
---|
844 |
|
---|
845 | function num_ColCode2_Callback(hObject, eventdata, handles)
|
---|
846 |
|
---|
847 |
|
---|
848 |
|
---|
849 | % --- Executes on button press in CheckTable.
|
---|
850 | function CheckTable_Callback(hObject, eventdata, handles)
|
---|
851 | if get(handles.CheckTable,'Value')
|
---|
852 | set(handles.TableDisplay,'Visible','on')
|
---|
853 | else
|
---|
854 | set(handles.TableDisplay,'Visible','off')
|
---|
855 | end
|
---|
856 |
|
---|