1 |
|
---|
2 | %'view_field': function associated with the GUI 'view_field.fig' for images and data field visualization
|
---|
3 | %------------------------------------------------------------------------
|
---|
4 | % function huvmat=view_field(input)
|
---|
5 | %
|
---|
6 | %OUTPUT
|
---|
7 | % huvmat=current handles of the GUI view_field.fig
|
---|
8 | %%
|
---|
9 | %
|
---|
10 | %INPUT:
|
---|
11 | % input: input file name (if character chain), or input image matrix to
|
---|
12 | % visualize, or Matlab structure representing netcdf fields (with fields
|
---|
13 | % ListVarName....)
|
---|
14 | %
|
---|
15 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
16 | % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, joel.sommeria@legi.grenoble-inp.fr.
|
---|
17 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
18 | % This open is part of the toolbox VIEW_FIELD.
|
---|
19 | %
|
---|
20 | % VIEW_FIELD is free software; you can redistribute it and/or modify
|
---|
21 | % it under the terms of the GNU General Public License as published by
|
---|
22 | % the Free Software Foundation; either version 2 of the License, or
|
---|
23 | % (at your option) any later version.
|
---|
24 | %
|
---|
25 | % VIEW_FIELD is distributed in the hope that it will be useful,
|
---|
26 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
27 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
28 | % GNU General Public License (open VIEW_FIELD/COPYING.txt) for more details.
|
---|
29 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
30 |
|
---|
31 | %-------------------------------------------------------------------
|
---|
32 | % I - MAIN FUNCTION VIEW_FIELD (DO NOT MODIFY)
|
---|
33 | %-------------------------------------------------------------------
|
---|
34 | %-------------------------------------------------------------------
|
---|
35 | function varargout = view_field(varargin)
|
---|
36 |
|
---|
37 | % Begin initialization code - DO NOT EDIT
|
---|
38 | gui_Singleton = 1;
|
---|
39 | gui_State = struct('gui_Name', mfilename, ...
|
---|
40 | 'gui_Singleton', gui_Singleton, ...
|
---|
41 | 'gui_OpeningFcn', @view_field_OpeningFcn, ...
|
---|
42 | 'gui_OutputFcn', @view_field_OutputFcn, ...
|
---|
43 | 'gui_LayoutFcn', [], ...
|
---|
44 | 'gui_Callback', []);
|
---|
45 | if nargin && ischar(varargin{1})
|
---|
46 | gui_State.gui_Callback = str2func(varargin{1});
|
---|
47 | end
|
---|
48 |
|
---|
49 | if nargout
|
---|
50 | varargout{1:nargout} = gui_mainfcn(gui_State, varargin{:});
|
---|
51 | else
|
---|
52 | gui_mainfcn(gui_State, varargin{:});
|
---|
53 | end
|
---|
54 | % End initialization code - DO NOT EDIT
|
---|
55 |
|
---|
56 | %-------------------------------------------------------------------
|
---|
57 | % --- Executes just before view_field is made visible.
|
---|
58 | function view_field_OpeningFcn(hObject, eventdata, handles, Field )
|
---|
59 | %-------------------------------------------------------------------
|
---|
60 |
|
---|
61 | % Choose default command menuline output for view_field
|
---|
62 | handles.output = handles.axes3;
|
---|
63 |
|
---|
64 | % Update handles structure
|
---|
65 | guidata(hObject, handles);
|
---|
66 |
|
---|
67 | dircur=pwd; %current working directory
|
---|
68 | dir_opening=dircur;
|
---|
69 |
|
---|
70 | % set the position of colorbar and ancillary GUIs:
|
---|
71 | set(hObject,'Units','Normalized')
|
---|
72 | handles_mouse=handles;
|
---|
73 | huvmat=findobj(allchild(0),'Name','uvmat');
|
---|
74 | hhuvmat=guidata(huvmat);
|
---|
75 | set(hhuvmat.list_object_2,'Visible','on')
|
---|
76 | % handles_mouse.create=hhuvmat.create;
|
---|
77 | handles_mouse.edit=hhuvmat.edit;
|
---|
78 | pos_uvmat=get(huvmat,'Position');
|
---|
79 | pos_view_field(1)=pos_uvmat(1)+pos_uvmat(3)/2;
|
---|
80 | pos_view_field(2)=pos_uvmat(2)-pos_uvmat(3)/4;
|
---|
81 | pos_view_field(3:4)=pos_uvmat(3:4);
|
---|
82 | set(hObject,'Position',pos_view_field)
|
---|
83 |
|
---|
84 |
|
---|
85 |
|
---|
86 | %functions for the mouse and keyboard
|
---|
87 | set(hObject,'KeyPressFcn',{'keyboard_callback',handles_mouse})%set keyboard action function
|
---|
88 | set(hObject,'WindowButtonMotionFcn',{'mouse_motion',handles_mouse})%set mouse action functio
|
---|
89 | set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function
|
---|
90 | set(hObject,'WindowButtonUpFcn',{'mouse_up',handles_mouse})
|
---|
91 | set(hObject,'CloseRequestFcn',{@closefcn})%
|
---|
92 |
|
---|
93 | [PlotType,PlotParamOut,haxes]= plot_field(Field,handles.axes3);%,PlotParam,KeepLim,PosColorbar)
|
---|
94 | set(handles.axes3,'UserData',Field);%store the current field
|
---|
95 | if isfield(PlotParamOut,'Vectors')
|
---|
96 | set(handles.VECT_title,'Visible','on')
|
---|
97 | end
|
---|
98 | write_plot_param(handles,PlotParamOut);% update the display of the plotting parameters
|
---|
99 |
|
---|
100 | %-------------------------------------------------------------------
|
---|
101 | % --- Outputs from this function are returned to the command menuline.
|
---|
102 | function varargout = view_field_OutputFcn(hObject, eventdata, handles)
|
---|
103 | varargout{1} = handles.output;% the only output argument is the handle to the GUI figure
|
---|
104 |
|
---|
105 |
|
---|
106 | %-------------------------------------------------------------------
|
---|
107 | %-------------------------------------------------------------------
|
---|
108 | % II - FUNCTIONS FOR INTRODUCING THE INPUT FILES
|
---|
109 | % automatically sets the global properties when the rootfile name is introduced
|
---|
110 | % then activate the view-field action if selected
|
---|
111 | % it is activated either by clicking on the RootPath window or by the
|
---|
112 | % browser
|
---|
113 | %------------------------------------------------------------------
|
---|
114 | %------------------------------------------------------------------
|
---|
115 |
|
---|
116 | %-------------------------------------------------------------------
|
---|
117 | function update_mask(handles,num_i1,num_j1)
|
---|
118 | %-------------------------------------------------------------------
|
---|
119 |
|
---|
120 | MaskData=get(handles.mask_test,'UserData');
|
---|
121 | if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
|
---|
122 | uistack(MaskData.maskhandle,'top');
|
---|
123 | end
|
---|
124 | num_i1_mask=mod(num_i1-1,MaskData.NbSlice)+1;
|
---|
125 | [MaskName,mdetect]=name_generator(MaskData.Base,num_i1_mask,num_j1,'.png',MaskData.NomType);
|
---|
126 | huvmat=get(handles.mask_test,'parent');
|
---|
127 | UvData=get(huvmat,'UserData');
|
---|
128 |
|
---|
129 | %update mask image if the mask is new
|
---|
130 | if ~ (isfield(UvData,'MaskName') && isequal(UvData.MaskName,MaskName))
|
---|
131 | UvData.MaskName=MaskName; %update the recorded name on UvData
|
---|
132 | set(huvmat,'UserData',UvData);
|
---|
133 | if mdetect==0
|
---|
134 | if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
|
---|
135 | delete(MaskData.maskhandle)
|
---|
136 | end
|
---|
137 | else
|
---|
138 | %read mask image
|
---|
139 | Mask.AName='image';
|
---|
140 | Mask.A=imread(MaskName);
|
---|
141 | npxy=size(Mask.A);
|
---|
142 | Mask.AX=[0.5 npxy(2)-0.5];
|
---|
143 | Mask.AY=[npxy(1)-0.5 0.5 ];
|
---|
144 | Mask.CoordType='px';
|
---|
145 | if isequal(get(handles.slices,'Value'),1)
|
---|
146 | NbSlice=str2num(get(handles.nb_slice,'String'));
|
---|
147 | num_i1=str2num(get(handles.i1,'String'));
|
---|
148 | Mask.ZIndex=mod(num_i1-1,NbSlice)+1;
|
---|
149 | end
|
---|
150 | %px to phys or other transform on field
|
---|
151 | menu_transform=get(handles.transform_fct,'String');
|
---|
152 | choice_value=get(handles.transform_fct,'Value');
|
---|
153 | transform_name=menu_transform{choice_value};%name of the transform fct given by the menu 'transform_fct'
|
---|
154 | transform_list=get(handles.transform_fct,'UserData');
|
---|
155 | transform=transform_list{choice_value};
|
---|
156 | if ~isequal(transform_name,'') && ~isequal(transform_name,'px')
|
---|
157 | if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority
|
---|
158 | Calib=UvData.XmlData.GeometryCalib;
|
---|
159 | Mask=transform(Mask,UvData.XmlData);
|
---|
160 | end
|
---|
161 | end
|
---|
162 | flagmask=Mask.A < 200;
|
---|
163 |
|
---|
164 | %make brown color image
|
---|
165 | imflag(:,:,1)=0.9*flagmask;
|
---|
166 | imflag(:,:,2)=0.7*flagmask;
|
---|
167 | imflag(:,:,3)=zeros(size(flagmask));
|
---|
168 |
|
---|
169 | %update mask image
|
---|
170 | hmask=[]; %default
|
---|
171 | if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
|
---|
172 | hmask=MaskData.maskhandle;
|
---|
173 | end
|
---|
174 | if ~isempty(hmask)
|
---|
175 | set(hmask,'CData',imflag)
|
---|
176 | set(hmask,'AlphaData',flagmask*0.6)
|
---|
177 | set(hmask,'XData',Mask.AX);
|
---|
178 | set(hmask,'YData',Mask.AY);
|
---|
179 | % uistack(hmask,'top')
|
---|
180 | else
|
---|
181 | axes(handles.axes3)
|
---|
182 | hold on
|
---|
183 | MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*flagmask);
|
---|
184 | % set(MaskData.maskhandle,'AlphaData',0.6*flagmask)
|
---|
185 | set(handles.mask_test,'UserData',MaskData)
|
---|
186 | end
|
---|
187 | end
|
---|
188 | end
|
---|
189 |
|
---|
190 |
|
---|
191 | %-------------------------------------------------------------------
|
---|
192 | function MenuExportFigure_Callback(hObject, eventdata, handles)
|
---|
193 | %-------------------------------------------------------------------
|
---|
194 | huvmat=get(handles.MenuExport,'parent');
|
---|
195 | UvData=get(huvmat,'UserData');
|
---|
196 | hfig=figure;
|
---|
197 | newaxes=copyobj(handles.axes3,hfig);
|
---|
198 | map=colormap(handles.axes3);
|
---|
199 | colormap(map);%transmit the current colormap to the zoom fig
|
---|
200 | colorbar
|
---|
201 |
|
---|
202 | %-------------------------------------------------------------------
|
---|
203 | %-------------------------------------------------------------------
|
---|
204 | % III - MAIN REFRESH FUNCTIONS : 'FRAME PLOT'
|
---|
205 | %-------------------------------------------------------------------
|
---|
206 | %-------------------------------------------------------------------
|
---|
207 |
|
---|
208 | %Executes on button press in runplus: make one step forward and call
|
---|
209 | %run0. The step forward is along the fields series 1 or 2 depending on
|
---|
210 | %the scan_i and scan_j check box (exclusive each other)
|
---|
211 | %-------------------------------------------------------------------
|
---|
212 | function runplus_Callback(hObject, eventdata, handles)
|
---|
213 | increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
|
---|
214 | runpm(hObject,eventdata,handles,increment)
|
---|
215 |
|
---|
216 | %-------------------------------------------------------------------
|
---|
217 | %Executes on button press in runmin: make one step backward and call
|
---|
218 | %run0. The step backward is along the fields series 1 or 2 depending on
|
---|
219 | %the scan_i and scan_j check box (exclusive each other)
|
---|
220 | %-------------------------------------------------------------------
|
---|
221 | function runmin_Callback(hObject, eventdata, handles)
|
---|
222 | increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d
|
---|
223 | runpm(hObject,eventdata,handles,increment)
|
---|
224 |
|
---|
225 | %-------------------------------------------------------------------
|
---|
226 | %Executes on button press in runmin: make one step backward and call
|
---|
227 | %run0. The step backward is along the fields series 1 or 2 depending on
|
---|
228 | %the scan_i and scan_j check box (exclusive each other)
|
---|
229 | %-------------------------------------------------------------------
|
---|
230 | function RunMovie_Callback(hObject, eventdata, handles)
|
---|
231 | %------------------------------------------------------------------
|
---|
232 | set(handles.RunMovie,'BackgroundColor',[1 1 0])%paint the command button in yellow
|
---|
233 | drawnow
|
---|
234 | increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
|
---|
235 | set(handles.STOP,'Visible','on')
|
---|
236 | set(handles.speed,'Visible','on')
|
---|
237 | set(handles.speed_txt,'Visible','on')
|
---|
238 | set(handles.RunMovie,'BusyAction','queue')
|
---|
239 | testavi=0;
|
---|
240 | UvData=get(handles.view_field,'UserData');
|
---|
241 |
|
---|
242 | while get(handles.speed,'Value')~=0 & isequal(get(handles.RunMovie,'BusyAction'),'queue') % enable STOP command
|
---|
243 | runpm(hObject,eventdata,handles,increment)
|
---|
244 | pause(1.02-get(handles.speed,'Value'))% wait for next image
|
---|
245 | end
|
---|
246 | if isfield(UvData,'aviobj') && ~isempty( UvData.aviobj),
|
---|
247 | UvData.aviobj=close(UvData.aviobj);
|
---|
248 | set(handles.view_field,'UserData',UvData);
|
---|
249 | end
|
---|
250 | set(handles.RunMovie,'BackgroundColor',[1 0 0])%paint the command buttonback to red
|
---|
251 |
|
---|
252 | %-------------------------------------------------------------------
|
---|
253 | function STOP_Callback(hObject, eventdata, handles)
|
---|
254 | %-------------------------------------------------------------------
|
---|
255 | set(handles.movie_pair,'BusyAction','Cancel')
|
---|
256 | set(handles.movie_pair,'value',0)
|
---|
257 | set(handles.RunMovie,'BusyAction','Cancel')
|
---|
258 | set(handles.MenuExportMovie,'BusyAction','Cancel')
|
---|
259 |
|
---|
260 |
|
---|
261 | %------------------------------------------------------------------
|
---|
262 | function runpm(hObject,eventdata,handles,increment)
|
---|
263 | %------------------------------------------------------------------
|
---|
264 | %check for mùovie pair status
|
---|
265 | movie_status=get(handles.movie_pair,'Value');
|
---|
266 | if isequal(movie_status,1)
|
---|
267 | STOP_Callback(hObject, eventdata, handles)
|
---|
268 | end
|
---|
269 | %read the data on the current input rootfile(s)
|
---|
270 |
|
---|
271 | [FileName,RootPath,filebase,FileIndices,FileExt,subdir]=read_file_boxes(handles);
|
---|
272 | NomType=get(handles.FileIndex,'UserData');
|
---|
273 |
|
---|
274 | num1=stra2num(get(handles.i1,'String'));
|
---|
275 | num2=stra2num(get(handles.i2,'String'));
|
---|
276 | num_a=stra2num(get(handles.j1,'String'));
|
---|
277 | num_b=stra2num(get(handles.j2,'String'));
|
---|
278 |
|
---|
279 | sub_value= get(handles.SubField,'Value');
|
---|
280 | if sub_value ==1
|
---|
281 | [FileName_1,RootPath_1,filebase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
|
---|
282 | end
|
---|
283 |
|
---|
284 | comp_input=get(handles.fix_pair,'Value');
|
---|
285 | if isequal(NomType,'_i1-i2')|isequal(NomType,'_i1-i2_j')
|
---|
286 | comp_input=1; %impose a fixed pair interval
|
---|
287 | set(handles.fix_pair,'Value',1)
|
---|
288 | end
|
---|
289 |
|
---|
290 | %case of scanning along the first direction (rootfile numbers)
|
---|
291 | if get(handles.scan_i,'Value')==1% case of scanning along field numbers
|
---|
292 | num1=num1+increment;
|
---|
293 | num2=num2+increment;
|
---|
294 | if comp_input==0% find a free pair
|
---|
295 | [filename,num_i1_out,num_j1_out,num_i2_out,num_j2_out]=...
|
---|
296 | name_generator(filebase,num1,num_a,FileExt,NomType,0,num2,num_b,subdir);
|
---|
297 | if exist(filename,'file')
|
---|
298 | num_a=num_j1_out;
|
---|
299 | num_b=num_j2_out;
|
---|
300 | end
|
---|
301 | end
|
---|
302 | if sub_value>=2
|
---|
303 | num_i1=num_i1+increment;
|
---|
304 | num_i2=num_i2+increment;
|
---|
305 | end
|
---|
306 | else % case of scanning along the second direction (burst numbers)
|
---|
307 | lastfield_cell=get(handles.last_j,'String'); % get the last field number
|
---|
308 | lastfield=str2num(lastfield_cell{1});
|
---|
309 | num_a=num_a+increment;
|
---|
310 | num_b=num_b+increment;
|
---|
311 | if sub_value >=2
|
---|
312 | num_j1=num_j1+increment;
|
---|
313 | num_j2=num_j2+increment;
|
---|
314 | elseif ~isempty(lastfield) && num_a>lastfield
|
---|
315 | num_a=1;
|
---|
316 | num1=num1+1;
|
---|
317 | num2=num2+1;
|
---|
318 | end
|
---|
319 | end
|
---|
320 |
|
---|
321 | % display the new open numbers
|
---|
322 | set(handles.i1,'String',num2stra(num1,NomType,1));
|
---|
323 | set(handles.i2,'String',num2stra(num2,NomType,1));
|
---|
324 | set(handles.j1,'String',num2stra(num_a,NomType,2));
|
---|
325 | set(handles.j2,'String',num2stra(num_b,NomType,2));
|
---|
326 | [indices]=name_generator('',num1,num_a,'',NomType,1,num2,num_b,'');
|
---|
327 | set(handles.FileIndex,'String',indices);
|
---|
328 | if sub_value ==1
|
---|
329 | NomType_1=get(handles.FileIndex_1,'UserData');
|
---|
330 | [indices]=...
|
---|
331 | name_generator('',num1,num_a,'',NomType_1,1,num2,num_b,'');
|
---|
332 | set(handles.FileIndex_1,'String',indices);
|
---|
333 | end
|
---|
334 |
|
---|
335 | if isequal(movie_status,1)
|
---|
336 | set(handles.movie_pair,'Value',1)
|
---|
337 | movie_pair_Callback(hObject, eventdata, handles); %run
|
---|
338 | else
|
---|
339 | % refresh plots
|
---|
340 | run0_Callback(hObject, eventdata, handles); %run
|
---|
341 | end
|
---|
342 |
|
---|
343 |
|
---|
344 | %-------------------------------------------------------
|
---|
345 | % --- Executes on button press in movie_pair: create an alternating movie with two view
|
---|
346 | %-------------------------------------------------------
|
---|
347 | function movie_pair_Callback(hObject, eventdata, handles)
|
---|
348 | status=get(handles.movie_pair,'value');
|
---|
349 | if isequal(status,0)
|
---|
350 | set(handles.movie_pair,'BusyAction','Cancel')
|
---|
351 | return
|
---|
352 | else
|
---|
353 | set(handles.movie_pair,'BusyAction','queue')
|
---|
354 | end
|
---|
355 | %initialisation
|
---|
356 | set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow
|
---|
357 | drawnow
|
---|
358 | list_fields=get(handles.Fields,'String');% list menu fields
|
---|
359 | index_fields=get(handles.Fields,'Value');% selected string index
|
---|
360 | FieldName=list_fields{index_fields}; % selected field
|
---|
361 | if isequal(FieldName,'image')
|
---|
362 | run0_Callback(hObject, eventdata, handles)%display the first image
|
---|
363 | UvData=get(handles.view_field,'UserData');
|
---|
364 | else
|
---|
365 | msgbox_view_field('ERROR','an image or movie must be first introduced as input')
|
---|
366 | return
|
---|
367 | end
|
---|
368 | [ff,rr,filebase,xx,Ext,SubDir]=read_file_boxes(handles);
|
---|
369 | NomType=get(handles.FileIndex,'UserData');
|
---|
370 | num_i1=stra2num(get(handles.i1,'String'));
|
---|
371 | num_j1=stra2num(get(handles.j1,'String'));
|
---|
372 | num_i2=stra2num(get(handles.i2,'String'));
|
---|
373 | num_j2=stra2num(get(handles.j2,'String'));
|
---|
374 | if isempty(num_j2)
|
---|
375 | if isempty(num_i2)
|
---|
376 | msgbox_view_field('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie')
|
---|
377 | return
|
---|
378 | else
|
---|
379 | num_j2=num_j1;%repeat the index i1 by default
|
---|
380 | end
|
---|
381 | end
|
---|
382 | if isempty(num_i2)
|
---|
383 | num_i2=num_i1;%repeat the index i1 by default
|
---|
384 | end
|
---|
385 | imaname_1=name_generator(filebase,num_i2,num_j2,Ext,NomType);
|
---|
386 | if ~exist(imaname_1,'file')
|
---|
387 | msgbox_view_field('ERROR',['second input open (-) ' imaname_1 ' not found']);
|
---|
388 | return
|
---|
389 | end
|
---|
390 | % set(handles.i2,'String',''); % indicates that the second index i2 is not used
|
---|
391 | % set(handles.j2,'String',''); % indicates that the second index i2 is not used
|
---|
392 |
|
---|
393 | %read the second image
|
---|
394 | Field.AName='image';
|
---|
395 | Field.AX=UvData.Field.AX;
|
---|
396 | Field.AY=UvData.Field.AY;
|
---|
397 | % z index
|
---|
398 | nbslice=str2double(get(handles.nb_slice,'String'));
|
---|
399 | if ~isempty(nbslice)
|
---|
400 | Field.ZIndex=mod(num_i2-1,nbslice)+1;
|
---|
401 | end
|
---|
402 | Field.CoordType='px';
|
---|
403 | %determine the input file type
|
---|
404 | if isfield(UvData,'MovieObject')
|
---|
405 | FileType='movie';
|
---|
406 | elseif isequal(lower(Ext),'.avi')
|
---|
407 | FileType='avi';
|
---|
408 | elseif isequal(lower(Ext),'.vol')
|
---|
409 | FileType='vol';
|
---|
410 | else
|
---|
411 | form=imformats(Ext([2:end]));
|
---|
412 | if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
|
---|
413 | if isequal(NomType,'*');
|
---|
414 | FileType='multimage';
|
---|
415 | else
|
---|
416 | FileType='image';
|
---|
417 | end
|
---|
418 | end
|
---|
419 | end
|
---|
420 | switch FileType
|
---|
421 | case 'movie'
|
---|
422 | Field.A=read(UvData.MovieObject,num_i2);
|
---|
423 | case 'avi'
|
---|
424 | mov=aviread(imaname_1,num_i2);
|
---|
425 | Field.A=frame2im(mov(1));
|
---|
426 | case 'vol'
|
---|
427 | Field.A=imread(imaname_1);
|
---|
428 | case 'multimage'
|
---|
429 | Field.A=imread(imaname_1,num_i2);
|
---|
430 | case 'image'
|
---|
431 | Field.A=imread(imaname_1);
|
---|
432 | end
|
---|
433 |
|
---|
434 | %px to phys or other transform on field
|
---|
435 | menu_transform=get(handles.transform_fct,'String');
|
---|
436 | choice_value=get(handles.transform_fct,'Value');
|
---|
437 | transform_name=menu_transform{choice_value};%name of the transform fct given by the menu 'transform_fct'
|
---|
438 | transform_list=get(handles.transform_fct,'UserData');
|
---|
439 | transform=transform_list{choice_value};
|
---|
440 | if ~isequal(transform_name,'') && ~isequal(transform_name,'px')
|
---|
441 | if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority
|
---|
442 | Field=transform(Field,UvData.XmlData);
|
---|
443 | end
|
---|
444 | end
|
---|
445 |
|
---|
446 | % make movie until movie speed is set to 0 or STOP is activated
|
---|
447 | hima=findobj(handles.axes3,'Tag','ima');% %handles.axes3 =main plotting window (A GENERALISER)
|
---|
448 | set(handles.STOP,'Visible','on')
|
---|
449 | set(handles.speed,'Visible','on')
|
---|
450 | set(handles.speed_txt,'Visible','on')
|
---|
451 | while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue')%isequal(get(handles.run0,'BusyAction'),'queue'); % enable STOP command
|
---|
452 | % read and plot the series of images in non erase mode
|
---|
453 | set(hima,'CData',Field.A);
|
---|
454 | pause(1.02-get(handles.speed,'Value'));% wait for next image
|
---|
455 | set(hima,'CData',UvData.Field.A);
|
---|
456 | pause(1.02-get(handles.speed,'Value'));% wait for next image
|
---|
457 | end
|
---|
458 | set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
|
---|
459 |
|
---|
460 | %-------------------------------------------------------
|
---|
461 | % --- Executes on button press in run0.
|
---|
462 | %-------------------------------------------------
|
---|
463 | function run0_Callback(hObject, eventdata, handles)
|
---|
464 |
|
---|
465 | %initialisation
|
---|
466 | set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow
|
---|
467 | drawnow
|
---|
468 | abstime=[];
|
---|
469 | abstime_1=[];
|
---|
470 | dt=[];
|
---|
471 | Field={};
|
---|
472 | UvData=get(handles.view_field,'UserData');
|
---|
473 | if isfield(UvData,'Txt')
|
---|
474 | UvData=rmfield(UvData,'Txt');%erase previous error message
|
---|
475 | end
|
---|
476 | %set(handles.run0,'BusyAction','queue');
|
---|
477 | if ishandle(handles.VIEW_FIELD_title) %remove title panel on view_field
|
---|
478 | delete(handles.VIEW_FIELD_title)
|
---|
479 | end
|
---|
480 |
|
---|
481 | % determine the main input file information for action
|
---|
482 | TestInputFile=1;%default
|
---|
483 | if isfield(UvData,'TestInputFile')&& isequal(UvData.TestInputFile,0),
|
---|
484 | TestInputFile=0;
|
---|
485 | end
|
---|
486 | num_i1=[];%default
|
---|
487 | FileType=[];%default
|
---|
488 | if TestInputFile
|
---|
489 | [filename,RootPath,filebase,xx,Ext]=read_file_boxes(handles);
|
---|
490 | if ~exist(filename,'file')
|
---|
491 | msgbox_view_field('ERROR',['input file ' filename ' does not exist'])
|
---|
492 | return
|
---|
493 | end
|
---|
494 | num_i1=stra2num(get(handles.i1,'String'));
|
---|
495 | num_i2=stra2num(get(handles.i2,'String'));
|
---|
496 | num_j1=stra2num(get(handles.j1,'String'));
|
---|
497 | num_j2=stra2num(get(handles.j2,'String'));
|
---|
498 | NomType=get(handles.FileIndex,'UserData');
|
---|
499 | %update the z position index
|
---|
500 | nbslice=str2double(get(handles.nb_slice,'String'));
|
---|
501 | if ~isnan(nbslice)
|
---|
502 | z_index=mod(num_i1-1,nbslice)+1;
|
---|
503 | set(handles.z_index,'String',num2str(z_index))
|
---|
504 | % refresh menu for save_mask if relevant
|
---|
505 | masknumber=get(handles.masklevel,'String');
|
---|
506 | if length(masknumber)>=z_index
|
---|
507 | set(handles.masklevel,'Value',z_index)
|
---|
508 | end
|
---|
509 | end
|
---|
510 | % determine the input file type
|
---|
511 | if isequal(Ext,'.nc')||isequal(Ext,'.cdf')
|
---|
512 | FileType='netcdf';
|
---|
513 | elseif isfield(UvData,'MovieObject')
|
---|
514 | FileType='movie';
|
---|
515 | FieldName='image';
|
---|
516 | elseif isequal(lower(Ext),'.avi')
|
---|
517 | FileType='avi';
|
---|
518 | FieldName='image';
|
---|
519 | elseif isequal(lower(Ext),'.vol')
|
---|
520 | FileType='vol';
|
---|
521 | FieldName='image';
|
---|
522 | else
|
---|
523 | form=imformats(Ext([2:end]));
|
---|
524 | if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
|
---|
525 | if isequal(NomType,'*');
|
---|
526 | FileType='multimage';
|
---|
527 | else
|
---|
528 | FileType='image';
|
---|
529 | end
|
---|
530 | FieldName='image';
|
---|
531 | end
|
---|
532 | end
|
---|
533 | else
|
---|
534 | filename=[];
|
---|
535 | FileType='netcdf';
|
---|
536 | FieldName='get_field...';
|
---|
537 | end
|
---|
538 | VelType=[];%default
|
---|
539 | if isequal(FileType,'netcdf')
|
---|
540 | list_fields=get(handles.Fields,'String');% list menu fields
|
---|
541 | index_fields=get(handles.Fields,'Value');% selected string index
|
---|
542 | FieldName= list_fields{index_fields}; % selected field
|
---|
543 | if isequal(FieldName,'get_field...')% read the field names on the interface get_field...
|
---|
544 | VelType=get(handles.Fields,'UserData');
|
---|
545 | Field{1}=get(handles.Fields,'UserData');
|
---|
546 | else
|
---|
547 | VelType=setfield(handles);
|
---|
548 | end
|
---|
549 | end
|
---|
550 |
|
---|
551 | % choose a second field if Subfield option is 'on'
|
---|
552 | filename_1=[];
|
---|
553 | FieldName_1=[];
|
---|
554 | scal_color=[];
|
---|
555 | VelType_1=setfield_1(handles);
|
---|
556 | sub_value=get(handles.SubField,'Value');
|
---|
557 | FileType_1='none';%default
|
---|
558 | if sub_value==1
|
---|
559 | filename_1=read_file_boxes_1(handles);
|
---|
560 | if ~exist(filename_1,'file')
|
---|
561 | msgbox_view_field('ERROR',['second file ' filename_1 ' does not exist'])
|
---|
562 | return
|
---|
563 | end
|
---|
564 | NomType_1=get(handles.FileIndex_1,'UserData');
|
---|
565 | Ext_1=get(handles.FileExt_1,'String');
|
---|
566 | % determine the input file type
|
---|
567 | if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf')
|
---|
568 | FileType_1='netcdf';
|
---|
569 | elseif isfield(UvData,'MovieObject_1')
|
---|
570 | FileType_1='movie';
|
---|
571 | FieldName_1='image';
|
---|
572 | elseif isequal(lower(Ext_1),'.avi')
|
---|
573 | FileType='avi';
|
---|
574 | FieldName_1='image';
|
---|
575 | elseif isequal(lower(Ext_1),'.vol')
|
---|
576 | FileType_1='vol';
|
---|
577 | FieldName_1='image';
|
---|
578 | else
|
---|
579 | form=imformats(Ext([2:end]));
|
---|
580 | if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
|
---|
581 | if isequal(NomType_1,'*');
|
---|
582 | FileType_1='multimage';
|
---|
583 | else
|
---|
584 | FileType_1='image';
|
---|
585 | end
|
---|
586 | FieldName_1='image';
|
---|
587 | end
|
---|
588 | end
|
---|
589 | if ~isequal(FieldName_1,'image')
|
---|
590 | list_fields=get(handles.Fields_1,'String');% list menu fields
|
---|
591 | index_fields=get(handles.Fields_1,'Value');% selected string index
|
---|
592 | FieldName_1= list_fields{index_fields}; % selected field
|
---|
593 | if isequal(VelType_1,'*')% free veltype choice
|
---|
594 | VelType_1=[];
|
---|
595 | elseif isequal(VelType_1,'"')% veltype the same as for the first field
|
---|
596 | if isempty(VelType)
|
---|
597 | VelType_1=[];
|
---|
598 | else
|
---|
599 | VelType_1=VelType;
|
---|
600 | end
|
---|
601 | end
|
---|
602 | end
|
---|
603 | end
|
---|
604 |
|
---|
605 | % test for keeping the previous stored data if the input files are unchanged
|
---|
606 | test_keepdata_1=0;%defautl
|
---|
607 | test_keepdata=0;
|
---|
608 | if sub_value>=2
|
---|
609 | if ~isequal(NomType_1,'*')%in cas of a series of files (not avi movie)
|
---|
610 | if isfield(UvData,'filename_1')&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1')
|
---|
611 | test_keepdata_1= isequal(filename_1,UvData.filename_1)&&...
|
---|
612 | isequal(VelType_1,UvData.filename_1) && isequal(FieldName_1,UvData.FieldName_1);
|
---|
613 |
|
---|
614 | end
|
---|
615 | end
|
---|
616 | end
|
---|
617 |
|
---|
618 | %read the input field(s)
|
---|
619 |
|
---|
620 | %read images
|
---|
621 | if ~isempty(filename) && isequal(FieldName,'image')
|
---|
622 | switch FileType
|
---|
623 | case 'movie'
|
---|
624 | A=read(UvData.MovieObject,num_i1);
|
---|
625 | case 'avi'
|
---|
626 | mov=aviread(filename,num_i1);
|
---|
627 | A=frame2im(mov(1));
|
---|
628 | case 'vol'
|
---|
629 | A=imread(filename);
|
---|
630 | case 'multimage'
|
---|
631 | A=imread(filename,num_i1);
|
---|
632 | case 'image'
|
---|
633 | A=imread(filename);
|
---|
634 | end
|
---|
635 | npxy=size(A);
|
---|
636 | set(handles.npx,'String',num2str(npxy(2)));% display image size on the interface
|
---|
637 | set(handles.npy,'String',num2str(npxy(1)));
|
---|
638 | Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
|
---|
639 | Rangy=[npxy(1)-0.5 0.5]; %
|
---|
640 | Field{1}.AName='image';
|
---|
641 | Field{1}.ListVarName={'AY','AX','A'}; %
|
---|
642 | if size(A,3)==3;%color
|
---|
643 | Field{1}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; %
|
---|
644 | else
|
---|
645 | Field{1}.VarDimName={'AY','AX',{'AY','AX'}}; %
|
---|
646 | end
|
---|
647 | Field{1}.AY=Rangy;
|
---|
648 | Field{1}.AX=Rangx;
|
---|
649 | Field{1}.A=A;
|
---|
650 | Field{1}.CoordType='px'; %used for mouse_motion
|
---|
651 | Field{1}.CoordUnit='pixel'; %used for mouse_motion
|
---|
652 | end
|
---|
653 |
|
---|
654 | %read a second image
|
---|
655 | if ~isfield(UvData,'Txt')&& ~isempty(filename_1) && isequal(FieldName_1,'image')
|
---|
656 | switch FileType_1
|
---|
657 | case 'movie'
|
---|
658 | A=read(UvData.MovieObject_1,num_i1);
|
---|
659 | case 'avi'
|
---|
660 | mov=aviread(filename,num_i1);
|
---|
661 | A=frame2im(mov(1));
|
---|
662 | case 'vol'
|
---|
663 | A=imread(filename);
|
---|
664 | case 'multimage'
|
---|
665 | A=imread(filename,num_i1);
|
---|
666 | case 'image'
|
---|
667 | A=imread(filename);
|
---|
668 | end
|
---|
669 | npxy=size(A);
|
---|
670 | set(handles.npx,'String',num2str(npxy(2)));% display image size on the interface
|
---|
671 | set(handles.npy,'String',num2str(npxy(1)));
|
---|
672 | Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
|
---|
673 | Rangy=[npxy(1)-0.5 0.5]; %
|
---|
674 | Field{2}.AName='image';
|
---|
675 | Field{2}.ListVarName={'AY','AX','A'}; %
|
---|
676 | if size(A,3)==3;%color
|
---|
677 | Field{2}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; %
|
---|
678 | else
|
---|
679 | Field{2}.VarDimName={'AY','AX',{'AY','AX'}}; %
|
---|
680 | end
|
---|
681 | Field{2}.AY=Rangy;
|
---|
682 | Field{2}.AX=Rangx;
|
---|
683 | Field{2}.A=A;
|
---|
684 | Field{2}.CoordType='px'; %used for mouse_motion
|
---|
685 | Field{2}.CoordUnit='px'; %used for move_mou
|
---|
686 | end
|
---|
687 |
|
---|
688 | %read ncfile(s)
|
---|
689 | CivStage_1=0;%default
|
---|
690 | VelType_out_1=[];
|
---|
691 | InputField={FieldName};
|
---|
692 | InputField_1={FieldName_1};
|
---|
693 | if ~isfield(UvData,'Txt') && ((~isempty(filename)&& isequal(FileType,'netcdf')) || (~isempty(filename_1)&& isequal(FileType,'netcdf'))) ;
|
---|
694 | %read the velocity field(s) from netcdf rootfile(s)
|
---|
695 | list_code=get(handles.col_vec,'String');% list menu fields
|
---|
696 | index_code=get(handles.col_vec,'Value');% selected string index
|
---|
697 | scal_color= list_code{index_code(1)}; % selected field
|
---|
698 | if isequal(FieldName,'velocity')&& ~isequal(scal_color,'black') && ~isequal(scal_color,'white')
|
---|
699 | InputField=[InputField scal_color];
|
---|
700 | end
|
---|
701 | if isequal(FieldName_1,'velocity') && ~isequal(scal_color,'black') && ~isequal(scal_color,'white')
|
---|
702 | InputField_1=[InputField_1 scal_color];
|
---|
703 | end
|
---|
704 | if isequal(FileType,'netcdf') %read the first nc field
|
---|
705 | if isequal(FieldName,'get_field...')% read the field names on the interface get_field.
|
---|
706 | VelType=get(handles.Fields,'UserData');
|
---|
707 | hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI
|
---|
708 | if isempty(hget_field)
|
---|
709 | hget_field= get_field(filename);%open the get_field GUI
|
---|
710 | end
|
---|
711 | hhget_field=guidata(hget_field);
|
---|
712 | set(hhget_field.inputfile,'String',filename)% update the list of input fields in get_field
|
---|
713 | set(hhget_field.ACTION,'Value',1)% PLOT option selected
|
---|
714 | set(hhget_field.list_fig,'Value',2)% plotting axes =view_field selected
|
---|
715 | [Field{1},errormsg]=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
|
---|
716 | if ~isempty(errormsg)
|
---|
717 | msgbox_view_field('ERROR',['error in view_field/run0_Callback/read_get_field: ' errormsg])
|
---|
718 | return
|
---|
719 | end
|
---|
720 | CivStage=0;
|
---|
721 | VelType_out=[];
|
---|
722 | else
|
---|
723 | [Field{1},VelType_out]=read_civxdata(filename,InputField,VelType);
|
---|
724 | if isfield(Field{1},'Txt')
|
---|
725 | msgbox_view_field('ERROR',Field{1}.Txt)
|
---|
726 | return
|
---|
727 | end
|
---|
728 | CivStage=Field{1}.CivStage;
|
---|
729 | UvData.NbDim=Field{1}.nb_dim;
|
---|
730 | end
|
---|
731 | end
|
---|
732 | if ~isempty(filename_1) && isequal(FileType_1,'netcdf') %read the second file
|
---|
733 | if isequal(FieldName_1,'get_field...')% read the field names on the interface get_field.
|
---|
734 | hget_field=findobj(allchild(0),'Name','get_field_1');%find the get_field... GUI
|
---|
735 | if isempty(hget_field)
|
---|
736 | hget_field= get_field(filename_1);%open the get_field GUI
|
---|
737 | set(hget_field,'name','get_field_1')
|
---|
738 | % enable_transform(handles,'off')% no field transform (possible transform in the GUI get_field)
|
---|
739 | end
|
---|
740 | hhget_field=guidata(hget_field);%handles of GUI elements in get_field
|
---|
741 | SubField=get_field('read_var_names',hObject,eventdata,hhget_field); %read the names of the variables to plot in the get_field GUI
|
---|
742 | [Field{2},var_detect]=nc2struct(filename_1,SubField.ListVarName); %read the corresponding input data
|
---|
743 | Field{2}.VarAttribute=SubField.VarAttribute;
|
---|
744 | %update the display on get_field
|
---|
745 | set(hhget_field.inputfile,'String',filename_1)
|
---|
746 | set(hhget_field.variables,'Value',1)
|
---|
747 | Tabchar={''};%default
|
---|
748 | Tabcell=[];
|
---|
749 | if isfield(Field{2},'ListGlobalAttribute')& ~isempty(Field{2}.ListGlobalAttribute)
|
---|
750 | for iline=1:length(Field{2}.ListGlobalAttribute)
|
---|
751 | Tabcell{iline,1}=Field{2}.ListGlobalAttribute{iline};
|
---|
752 | if isfield(Field{2}, Field{2}.ListGlobalAttribute{iline})
|
---|
753 | eval(['val=Field{2}.' Field{2}.ListGlobalAttribute{iline} ';'])
|
---|
754 | if ischar(val);
|
---|
755 | Tabcell{iline,2}=val;
|
---|
756 | else
|
---|
757 | Tabcell{iline,2}=num2str(val);
|
---|
758 | end
|
---|
759 | end
|
---|
760 | end
|
---|
761 | if ~isempty(Tabcell)
|
---|
762 | Tabchar=cell2tab(Tabcell,'=');
|
---|
763 | Tabchar=[{''};Tabchar];
|
---|
764 | end
|
---|
765 | end
|
---|
766 | set(hhget_field.attributes,'String',Tabchar);%update list of global attributes in get_field
|
---|
767 | else
|
---|
768 | [Field{2},VelType_out_1]=read_civxdata(filename_1,[],VelType_1);
|
---|
769 | CivStage_1=Field{2}.CivStage;
|
---|
770 | end
|
---|
771 | if ~isequal(FileType,'netcdf')
|
---|
772 | VelType_out=VelType_out_1;
|
---|
773 | end
|
---|
774 | end
|
---|
775 | end
|
---|
776 |
|
---|
777 | %update the display buttons for the first velocity type (first menuline)
|
---|
778 | veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
|
---|
779 | if ~isequal(FileType,'netcdf')
|
---|
780 | reset_vel_type(veltype_handles)
|
---|
781 | elseif isempty(VelType)
|
---|
782 | set_veltype_display(veltype_handles,CivStage)%update the display of available velocity types for the first field
|
---|
783 | if isempty(VelType_out)
|
---|
784 | reset_vel_type(veltype_handles)
|
---|
785 | else
|
---|
786 | handle1=eval(['handles.' VelType_out]);
|
---|
787 | reset_vel_type(veltype_handles,handle1)
|
---|
788 | end
|
---|
789 | end
|
---|
790 |
|
---|
791 | %update the display buttons for the second velocity type (second menuline)
|
---|
792 | veltype_handles_1=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
|
---|
793 | if ~isequal(FileType_1,'netcdf')
|
---|
794 | reset_vel_type(veltype_handles_1)
|
---|
795 | elseif isempty(VelType_1)
|
---|
796 | set_veltype_display(veltype_handles_1,CivStage_1)%update the display of available velocity types for the first field
|
---|
797 | if isempty(VelType_out_1)
|
---|
798 | reset_vel_type(veltype_handles_1)
|
---|
799 | else
|
---|
800 | handle1=eval(['handles.' VelType_out_1 '_1']);
|
---|
801 | reset_vel_type(veltype_handles_1,handle1)
|
---|
802 | end
|
---|
803 | end
|
---|
804 |
|
---|
805 | %introduce w as background image by default for a new series (only for nbdim=2)
|
---|
806 | if ~isfield(UvData,'NewSeries')
|
---|
807 | UvData.NewSeries=1;
|
---|
808 | end
|
---|
809 | %put W as background image by default if NbDim=2:
|
---|
810 | if ~isfield(UvData,'NbDim')||isempty(UvData.NbDim)||~isequal(UvData.NbDim,3)
|
---|
811 | if UvData.NewSeries && isequal(get(handles.SubField,'Value'),0) && isfield(Field{1},'W') && ~isempty(Field{1}.W);
|
---|
812 | set(handles.SubField,'Value',1);
|
---|
813 | %menu=update_menu(handles.Fields_1,'w');%update the menu for the background scalar nd set the choice to 'w'
|
---|
814 | set(handles.RootPath_1,'String','"')
|
---|
815 | set(handles.RootFile_1,'String','"')
|
---|
816 | set(handles.SubDir_1,'String','"');
|
---|
817 | [indices]=name_generator('',num_i1,num_j1,'',NomType,1,num_i2,num_j2,'');
|
---|
818 | set(handles.FileIndex_1,'String',indices)
|
---|
819 | set(handles.FileExt_1,'String','"');
|
---|
820 | set(handles.Fields_1,'Visible','on');
|
---|
821 | set(handles.Fields_1,'Visible','on');
|
---|
822 | set(handles.RootPath_1,'Visible','on')
|
---|
823 | set(handles.RootFile_1,'Visible','on')
|
---|
824 | set(handles.SubDir_1,'Visible','on');
|
---|
825 | set(handles.FileIndex_1,'Visible','on');
|
---|
826 | set(handles.FileExt_1,'Visible','on');
|
---|
827 | set(handles.Fields_1,'Visible','on');
|
---|
828 | Field{1}.AName='w';
|
---|
829 | testscal=1;
|
---|
830 | end
|
---|
831 | end
|
---|
832 |
|
---|
833 | %multislice case
|
---|
834 | if TestInputFile &&(~isfield(UvData,'NbDim') || isequal(UvData.NbDim,2))&&...%2D case
|
---|
835 | isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')&& isfield(UvData.XmlData.GeometryCalib,'SliceCoord')
|
---|
836 | % nbfield2=str2num(get(handles.last_j,'String'));
|
---|
837 | siz=size(UvData.XmlData.GeometryCalib.SliceCoord);
|
---|
838 | if siz(1)>1
|
---|
839 | NbSlice=siz(1);
|
---|
840 | set(handles.slices,'Visible','on')
|
---|
841 | set(handles.slices,'Value',1)
|
---|
842 | else
|
---|
843 | NbSlice=1;
|
---|
844 | end
|
---|
845 | set(handles.nb_slice,'String',num2str(NbSlice))
|
---|
846 | slices_Callback(hObject, eventdata, handles)
|
---|
847 | % Coord=UvData.XmlData.GeometryCalib.SliceCoord;
|
---|
848 | % ZIndex=num_i1-NbSlice*(floor((num_i1-1)/NbSlice));
|
---|
849 | % Field{1}.Z=ZIndex;
|
---|
850 | end
|
---|
851 |
|
---|
852 | %store the current open names, fields and vel types in view_field interface
|
---|
853 | UvData.filename=filename;
|
---|
854 | UvData.filename_1=filename_1;
|
---|
855 | UvData.VelType=VelType;
|
---|
856 | UvData.VelType_1=VelType_1;
|
---|
857 | UvData.FieldName=FieldName;
|
---|
858 | UvData.FieldName_1=FieldName_1;
|
---|
859 | if ~isempty(scal_color)
|
---|
860 | UvData.CName=scal_color;
|
---|
861 | end
|
---|
862 |
|
---|
863 | %coordinate transform or user fct
|
---|
864 | XmlData=[];%default
|
---|
865 | if isfield(UvData,'XmlData')%use geometry calib recorded from the ImaDoc xml file as first priority
|
---|
866 | XmlData=UvData.XmlData;
|
---|
867 | end
|
---|
868 | XmlData_1=[];%default
|
---|
869 | if isfield(UvData,'XmlData_1')
|
---|
870 | XmlData_1=UvData.XmlData_1;
|
---|
871 | end
|
---|
872 | menu_transform=get(handles.transform_fct,'String');
|
---|
873 | choice_value=get(handles.transform_fct,'Value');
|
---|
874 | %transform=menu_transform{choice_value};%name of the transform fct given by the menu 'transform_fct'
|
---|
875 | transform_list=get(handles.transform_fct,'UserData');
|
---|
876 | transform=transform_list{choice_value};%selected function handles
|
---|
877 |
|
---|
878 | % z index
|
---|
879 | if TestInputFile
|
---|
880 | Field{1}.ZIndex=mod(num_i1-1,nbslice)+1;
|
---|
881 | end
|
---|
882 | %px to phys or other transform on field
|
---|
883 | if ~isempty(transform)
|
---|
884 | if length(Field)>=2
|
---|
885 | Field{2}.ZIndex=mod(num_i1-1,nbslice)+1;
|
---|
886 | [Field{1},Field{2}]=transform(Field{1},XmlData,Field{2},XmlData_1);
|
---|
887 | if isempty(Field{2})
|
---|
888 | Field(2)=[];
|
---|
889 | end
|
---|
890 | else
|
---|
891 | Field{1}=transform(Field{1},XmlData);
|
---|
892 | end
|
---|
893 | end
|
---|
894 |
|
---|
895 | %calculate scalar
|
---|
896 | if isequal(FileType,'netcdf') && ~isequal(FieldName,'get_field...')%
|
---|
897 | Field{1}=calc_field(InputField,Field{1});
|
---|
898 | end
|
---|
899 | if length(Field)==2 && isequal(FileType_1,'netcdf') && ~isequal(FieldName_1,'get_field...')
|
---|
900 | Field{2}=calc_field(InputField_1,Field{2});
|
---|
901 | end
|
---|
902 |
|
---|
903 | % combine the two input fields (e.g. substract velocity fields)
|
---|
904 | if numel(Field)==2
|
---|
905 | if ~(isequal(get(handles.movie_pair,'Value'),1) && isequal(FieldName,'image') && isequal(FieldName_1,'image')) %combine fields if not viewing image pairs
|
---|
906 | UvData.Field=sub_field(Field{1},Field{2}); %TO UPDATE FOR MORE GENERAL INPUT
|
---|
907 | end
|
---|
908 | else
|
---|
909 | UvData.Field=Field{1};
|
---|
910 | end
|
---|
911 | UvData.NewSeries=0;% put to 0 the test for a new field series (set by RootPath_callback)
|
---|
912 | % test 3D , default projection menuplane and typical mesh (needed to menuopen set_object)
|
---|
913 | test_x=0;
|
---|
914 | test_z=0;% test for unstructured z coordinate
|
---|
915 | UvData.ZMax=0;
|
---|
916 | UvData.ZMin=0;%default
|
---|
917 | UvData.Mesh=1; %default
|
---|
918 | [UvData.Field,errormsg]=check_field_structure(UvData.Field);
|
---|
919 | if ~isempty(errormsg)
|
---|
920 | msgbox_view_field('ERROR',['error in view_field/run0_Callback/check_field_structure: ' errormsg])
|
---|
921 | return
|
---|
922 | end
|
---|
923 | [CellVarIndex,NbDim,VarType]=find_field_indices(UvData.Field);
|
---|
924 | [NbDim,imax]=max(NbDim);
|
---|
925 | if isempty(imax)
|
---|
926 | % DimVarIndex=0;
|
---|
927 | coord_x=[];
|
---|
928 | else
|
---|
929 | % VarIndex=CellVarIndex{imax};
|
---|
930 | coord_x=VarType{imax}.coord_x;
|
---|
931 | end
|
---|
932 | if isfield(UvData,'NbDim') && ~isempty(UvData.NbDim)
|
---|
933 | NbDim=UvData.NbDim;
|
---|
934 | else
|
---|
935 | UvData.NbDim=NbDim;
|
---|
936 | end
|
---|
937 | if ~isempty(CellVarIndex) && ~isempty(VarType{imax}.coord_x) && ~isempty(VarType{imax}.coord_y) %unstructured coordinate z
|
---|
938 | XName=UvData.Field.ListVarName{VarType{imax}.coord_x};
|
---|
939 | YName=UvData.Field.ListVarName{VarType{imax}.coord_y};
|
---|
940 | test_x=1;
|
---|
941 | elseif isfield(UvData.Field,'X') && isfield(UvData.Field,'Y')
|
---|
942 | XName='X';
|
---|
943 | YName='Y';
|
---|
944 | test_x=1;
|
---|
945 | end
|
---|
946 | if test_x
|
---|
947 | eval(['UvData.XMax=max(UvData.Field.' XName ');'])
|
---|
948 | eval(['UvData.XMin=min(UvData.Field.' XName ');'])
|
---|
949 | eval(['UvData.YMax=max(UvData.Field.' YName ');'])
|
---|
950 | eval(['UvData.YMin=min(UvData.Field.' YName ');'])
|
---|
951 | eval(['nbvec=length(UvData.Field.' XName ');'])
|
---|
952 | if NbDim==3%
|
---|
953 | if ~isempty(CellVarIndex) && ~isempty(VarType{imax}.coord_z)%unstructured coordinate z
|
---|
954 | ZName=UvData.Field.ListVarName{VarType{imax}.coord_z};
|
---|
955 | eval(['UvData.ZMax=max(UvData.Field.' ZName ');'])
|
---|
956 | eval(['UvData.ZMin=min(UvData.Field.' ZName ');'])
|
---|
957 | test_z=1;
|
---|
958 | elseif isfield(UvData,'Z')% usual civ data
|
---|
959 | UvData.ZMax=max(UvData.Z);
|
---|
960 | UvData.ZMin=min(UvData.Z);
|
---|
961 | test_z=1;
|
---|
962 | end
|
---|
963 | end
|
---|
964 | if isequal(UvData.ZMin,UvData.ZMax)%no z dependency
|
---|
965 | NbDim=2;
|
---|
966 | test_z=0;
|
---|
967 | end
|
---|
968 | if test_z
|
---|
969 | UvData.Mesh=((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)*(UvData.ZMax-UvData.ZMin))/nbvec;% volume per vector
|
---|
970 | UvData.Mesh=(UvData.Mesh)^(1/3);
|
---|
971 | else
|
---|
972 | UvData.Mesh=sqrt((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)/nbvec);%2D
|
---|
973 | end
|
---|
974 | end
|
---|
975 | %case of structured coordinates
|
---|
976 | if isfield(UvData.Field,'AX') & isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')
|
---|
977 | UvData.XMax=max(UvData.Field.AX);
|
---|
978 | UvData.XMin=min(UvData.Field.AX);
|
---|
979 | UvData.YMax=max(UvData.Field.AY);
|
---|
980 | UvData.YMin=min(UvData.Field.AY);
|
---|
981 | np_A=size(UvData.Field.A);
|
---|
982 | UvData.Mesh=sqrt((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)/((np_A(1)-1) * (np_A(2)-1))) ;
|
---|
983 | end
|
---|
984 | if isempty(coord_x)&~isempty(CellVarIndex)
|
---|
985 | VarIndex=CellVarIndex{imax}; % list of variable indices
|
---|
986 | DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable
|
---|
987 | if NbDim==3
|
---|
988 | nbpoints=UvData.Field.DimValue(DimIndex(1));
|
---|
989 | %Zvar=DimVarIndex(DimIndex(1));
|
---|
990 | %Zvar=DimVarIndex(1);
|
---|
991 | Zvar=VarType{imax}.coord_3;
|
---|
992 | if Zvar~=0 % z is a dimension variable
|
---|
993 | ZName=UvData.Field.ListVarName{Zvar};
|
---|
994 | eval(['UvData.ZMax=max(UvData.Field.' ZName ');'])
|
---|
995 | eval(['UvData.ZMin=min(UvData.Field.' ZName ');'])
|
---|
996 | else
|
---|
997 | testcoord_z=0;
|
---|
998 | if length(UvData.Field.VarAttribute)>=VarIndex(1)
|
---|
999 | if isfield(UvData.Field.VarAttribute{VarIndex(1)},'Coord_1')%regular grid
|
---|
1000 | Coord_z=UvData.Field.VarAttribute{VarIndex(1)}.Coord_1;
|
---|
1001 | UvData.ZMax=max(Coord_z);
|
---|
1002 | UvData.ZMin=min(Coord_z);
|
---|
1003 | testcoord_z=1;
|
---|
1004 | end
|
---|
1005 | end
|
---|
1006 | if ~testcoord_z
|
---|
1007 | UvData.ZMin=1;
|
---|
1008 | UvData.ZMax=UvData.Field.DimValue(DimIndex(1));
|
---|
1009 | end
|
---|
1010 | end
|
---|
1011 | UvData.Mesh=(UvData.ZMax-UvData.ZMin)/(nbpoints-1);
|
---|
1012 | elseif NbDim==2
|
---|
1013 | nbpoints_y=UvData.Field.DimValue(DimIndex(1));
|
---|
1014 | Yvar=VarType{imax}.coord_y;
|
---|
1015 | if Yvar~=0 % x is a dimension variable
|
---|
1016 | YName=UvData.Field.ListVarName{Yvar};
|
---|
1017 | eval(['UvData.YMax=max(UvData.Field.' YName ');'])
|
---|
1018 | eval(['UvData.YMin=min(UvData.Field.' YName ');'])
|
---|
1019 | else
|
---|
1020 | testcoord_y=0;
|
---|
1021 | if ~testcoord_y
|
---|
1022 | UvData.YMin=1;
|
---|
1023 | UvData.YMax=UvData.Field.DimValue(DimIndex(1));
|
---|
1024 | end
|
---|
1025 | end
|
---|
1026 | DY=(UvData.YMax-UvData.YMin)/(nbpoints_y-1);
|
---|
1027 | nbpoints_x=UvData.Field.DimValue(DimIndex(2));
|
---|
1028 | Xvar=VarType{imax}.coord_x;
|
---|
1029 | if Xvar~=0 % x is a dimension variable
|
---|
1030 | XName=UvData.Field.ListVarName{Xvar};
|
---|
1031 | eval(['UvData.XMax=max(UvData.Field.' XName ');'])
|
---|
1032 | eval(['UvData.XMin=min(UvData.Field.' XName ');'])
|
---|
1033 | else
|
---|
1034 | testcoord_x=0;
|
---|
1035 | if ~testcoord_x
|
---|
1036 | UvData.XMin=1;
|
---|
1037 | UvData.XMax=UvData.Field.DimValue(DimIndex(2));
|
---|
1038 | end
|
---|
1039 | end
|
---|
1040 | DX=(UvData.XMax-UvData.XMin)/(nbpoints_x-1);
|
---|
1041 | UvData.Mesh= sqrt(DX*DY);
|
---|
1042 | end
|
---|
1043 | end
|
---|
1044 |
|
---|
1045 | %create a default projection menuplane
|
---|
1046 | UvData.Object{1}.Style='plane';%main plotting plane
|
---|
1047 | UvData.Object{1}.ProjMode='projection';%main plotting plane
|
---|
1048 | if ~isfield(UvData.Object{1},'plotaxes')
|
---|
1049 | UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
|
---|
1050 | set(handles.list_object,'String',{'1-PLANE';'...'});
|
---|
1051 | set(handles.list_object,'Value',1);
|
---|
1052 | end
|
---|
1053 |
|
---|
1054 | %3D case (menuvolume)
|
---|
1055 | if NbDim==3
|
---|
1056 | UvData.Object{1}.NbDim=UvData.NbDim;%test for 3D objects
|
---|
1057 | UvData.Object{1}.RangeZ=UvData.Mesh;%main plotting plane
|
---|
1058 | UvData.Object{1}.Coord(1,3)=(UvData.ZMin+UvData.ZMax)/2;%section at a middle plane chosen
|
---|
1059 | UvData.Object{1}.Phi=0;
|
---|
1060 | UvData.Object{1}.Theta=0;
|
---|
1061 | UvData.Object{1}.Psi=0;
|
---|
1062 | UvData.Object{1}.HandlesDisplay=plot(0,0,'Tag','proj_object');% A REVOIR
|
---|
1063 | PlotHandles=get_plot_handles(handles);
|
---|
1064 | ZBounds(1)=UvData.ZMin; %minimum for the Z slider
|
---|
1065 | ZBounds(2)=UvData.ZMax;%maximum for the Z slider
|
---|
1066 | set_object(UvData.Object{1},PlotHandles,ZBounds);
|
---|
1067 | set(handles.list_object,'Value',1);
|
---|
1068 | %multilevel case (single menuplane in a 3D space)
|
---|
1069 | elseif isfield(UvData,'Z')
|
---|
1070 | if isfield(UvData,'CoordType')& isequal(UvData.CoordType,'phys') & isfield(UvData,'XmlData')
|
---|
1071 | XmlData=UvData.XmlData;
|
---|
1072 | if isfield(XmlData,'PlanePos')
|
---|
1073 | UvData.Object{1}.Coord=XmlData.PlanePos(UvData.ZIndex,:);
|
---|
1074 | end
|
---|
1075 | if isfield(XmlData,'PlaneAngle')
|
---|
1076 | siz=size(XmlData.PlaneAngle);
|
---|
1077 | indangle=min(siz(1),UvData.ZIndex);%take first angle if a single angle is defined (translating scanning)
|
---|
1078 | UvData.Object{1}.Phi=XmlData.PlaneAngle(indangle,1);
|
---|
1079 | UvData.Object{1}.Theta=XmlData.PlaneAngle(indangle,2);
|
---|
1080 | UvData.Object{1}.Psi=XmlData.PlaneAngle(indangle,3);
|
---|
1081 | end
|
---|
1082 | elseif isfield(UvData,'ZIndex')
|
---|
1083 | UvData.Object{1}.ZObject=UvData.ZIndex;
|
---|
1084 | end
|
---|
1085 | end
|
---|
1086 |
|
---|
1087 | %Plot the projections on all existing projection objects
|
---|
1088 | keeplim=get(handles.FixedLimits,'Value');
|
---|
1089 | %reset the min and max of scalar if only the mask is displayed
|
---|
1090 | if isfield(UvData,'Mask')&~isfield(UvData,'A')
|
---|
1091 | set(handles.MinA,'String','0')
|
---|
1092 | set(handles.MaxA,'String','255')
|
---|
1093 | end
|
---|
1094 |
|
---|
1095 | Object=UvData.Object;
|
---|
1096 | for iobj=1:length(Object)
|
---|
1097 | if ~isempty(Object{iobj})%& isfield(Object{iobj},'plotaxes')& ishandle(Object{iobj}.plotaxes)
|
---|
1098 | %Projeter les champs sur l'objet:*
|
---|
1099 | ObjectData=proj_field(UvData.Field,Object{iobj},iobj);
|
---|
1100 |
|
---|
1101 | %use of mask
|
---|
1102 | if isfield(ObjectData,'NbDim')&isequal(ObjectData.NbDim,2)
|
---|
1103 | if isfield(ObjectData,'Mask') & isfield(ObjectData,'A')
|
---|
1104 | flag_mask=double(ObjectData.Mask>200);%=0 for masked regions
|
---|
1105 | AX=ObjectData.AX;
|
---|
1106 | AY=ObjectData.AY;
|
---|
1107 | MaskX=ObjectData.MaskX;
|
---|
1108 | MaskY=ObjectData.MaskY;
|
---|
1109 | if ~isequal(MaskX,AX)|~isequal(MaskY,AY)
|
---|
1110 | nxy=size(flag_mask);
|
---|
1111 | sizpx=(ObjectData.MaskX(end)-ObjectData.MaskX(1))/(nxy(2)-1);%size of a mask pixel
|
---|
1112 | sizpy=(ObjectData.MaskY(1)-ObjectData.MaskY(end))/(nxy(1)-1);
|
---|
1113 | x_mask=[ObjectData.MaskX(1):sizpx:ObjectData.MaskX(end)]; % pixel x coordinates for image display
|
---|
1114 | y_mask=[ObjectData.MaskY(1):-sizpy:ObjectData.MaskY(end)];% pixel x coordinates for image display
|
---|
1115 | %project on the positions of the scalar
|
---|
1116 | npxy=size(ObjectData.A);
|
---|
1117 | dxy(1)=(ObjectData.AY(end)-ObjectData.AY(1))/(npxy(1)-1);%grid mesh in y
|
---|
1118 | dxy(2)=(ObjectData.AX(end)-ObjectData.AX(1))/(npxy(2)-1);%grid mesh in x
|
---|
1119 | xi=[ObjectData.AX(1):dxy(2):ObjectData.AX(end)];
|
---|
1120 | yi=[ObjectData.AY(1):dxy(1):ObjectData.AY(end)];
|
---|
1121 | [XI,YI]=meshgrid(xi,yi);% creates the matrix of regular coordinates
|
---|
1122 | flag_mask = interp2(x_mask,y_mask,flag_mask,XI,YI);
|
---|
1123 | end
|
---|
1124 | AClass=class(ObjectData.A);
|
---|
1125 | ObjectData.A=flag_mask.*double(ObjectData.A);
|
---|
1126 | ObjectData.A=feval(AClass,ObjectData.A);
|
---|
1127 | ind_off=[];
|
---|
1128 | if isfield(ObjectData,'ListVarName')
|
---|
1129 | for ilist=1:length(ObjectData.ListVarName)
|
---|
1130 | if isequal(ObjectData.ListVarName{ilist},'Mask')|isequal(ObjectData.ListVarName{ilist},'MaskX')|isequal(ObjectData.ListVarName{ilist},'MaskY')
|
---|
1131 | ind_off=[ind_off ilist];
|
---|
1132 | end
|
---|
1133 | end
|
---|
1134 | ObjectData.ListVarName(ind_off)=[];
|
---|
1135 | ObjectData.VarDimIndex(ind_off)=[];
|
---|
1136 | ind_off=[];
|
---|
1137 | for ilist=1:length(ObjectData.ListDimName)
|
---|
1138 | if isequal(ObjectData.ListDimName{ilist},'MaskX')|isequal(ObjectData.ListDimName{ilist},'MaskY')
|
---|
1139 | ind_off=[ind_off ilist];
|
---|
1140 | end
|
---|
1141 | end
|
---|
1142 | ObjectData.ListDimName(ind_off)=[];
|
---|
1143 | ObjectData.DimValue(ind_off)=[];
|
---|
1144 | end
|
---|
1145 | end
|
---|
1146 | end
|
---|
1147 | if ~isempty(ObjectData)
|
---|
1148 | haxes=[];%default
|
---|
1149 | if isfield(Object{iobj},'plotaxes')
|
---|
1150 | haxes=Object{iobj}.plotaxes;%axes used for representing the projection on the object
|
---|
1151 | end
|
---|
1152 | PosColorbar=[];%default: no colorbar
|
---|
1153 | if ishandle(haxes) & isequal(get(haxes,'Tag'),'axes3')& isfield(UvData,'PosColorbar')
|
---|
1154 | PosColorbar=UvData.PosColorbar;%prescribe the colorbar position on the view_field interface
|
---|
1155 | else
|
---|
1156 | PosColorbar='*';%default position
|
---|
1157 | end
|
---|
1158 | PlotParam=read_plot_param(handles);%read plotting parameters on the view_field interface
|
---|
1159 | [PlotType,ScalOut,UvData.Object{iobj}.plotaxes]=plot_field(ObjectData,haxes,PlotParam,keeplim,PosColorbar);
|
---|
1160 | if isequal(PlotType,'none')
|
---|
1161 | hget_field=findobj(allchild(0),'name','get_field');
|
---|
1162 | if isempty(hget_field)
|
---|
1163 | get_field([],ObjectData)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field)
|
---|
1164 | else
|
---|
1165 | msgbox_view_field('ERROR','The field defined by get_field cannot be plotted')
|
---|
1166 | end
|
---|
1167 | end
|
---|
1168 | UvData.Object{iobj}.PlotParam=ScalOut; %record the plotting parameters
|
---|
1169 | end
|
---|
1170 |
|
---|
1171 | end
|
---|
1172 | end
|
---|
1173 |
|
---|
1174 | %display the updated plotting parameters for the base menuplane
|
---|
1175 | write_plot_param(handles,UvData.Object{1}.PlotParam);% update the display of the plotting parameters
|
---|
1176 | set(handles.view_field,'UserData',UvData)
|
---|
1177 |
|
---|
1178 | %update the mask
|
---|
1179 | if isequal(get(handles.mask_test,'Value'),1)%if the mask option is on
|
---|
1180 | update_mask(handles,num_i1,num_i2);
|
---|
1181 | end
|
---|
1182 |
|
---|
1183 | %prepare the menus of histograms (for the whole menuvolume in 3D case)
|
---|
1184 | menu_histo=(UvData.Field.ListVarName)';
|
---|
1185 | ind_bad=[];
|
---|
1186 | nb_histo=1;
|
---|
1187 | for ivar=1:numel(menu_histo)
|
---|
1188 | if isfield(UvData.Field,'VarAttribute') && numel(UvData.Field.VarAttribute)>=ivar && isfield(UvData.Field.VarAttribute{ivar},'Role')
|
---|
1189 | Role=UvData.Field.VarAttribute{ivar}.Role;
|
---|
1190 | switch Role
|
---|
1191 | case {'coord_x','coord_y','coord_z','dimvar'}
|
---|
1192 | ind_bad=[ind_bad ivar];
|
---|
1193 | case {'vector_y'}
|
---|
1194 | nb_histo=nb_histo+1;
|
---|
1195 | end
|
---|
1196 | end
|
---|
1197 | DimCell=UvData.Field.VarDimName{ivar};
|
---|
1198 | DimName='';
|
---|
1199 | if ischar(DimCell)
|
---|
1200 | DimName=DimCell;
|
---|
1201 | elseif iscell(DimCell)&& numel(DimCell)==1
|
---|
1202 | DimName=DimCell{1};
|
---|
1203 | end
|
---|
1204 | if strcmp(DimName,menu_histo{ivar})
|
---|
1205 | ind_bad=[ind_bad ivar];
|
---|
1206 | end
|
---|
1207 | end
|
---|
1208 | menu_histo(ind_bad)=[];
|
---|
1209 | test_v=0;
|
---|
1210 | if ~isempty(menu_histo)
|
---|
1211 | set(handles.histo1_menu,'Value',1)
|
---|
1212 | set(handles.histo1_menu,'String',menu_histo)
|
---|
1213 | histo1_menu_Callback(hObject, eventdata, handles)
|
---|
1214 | if nb_histo > 1
|
---|
1215 | test_v=1;
|
---|
1216 | set(handles.histo2_menu,'Visible','on')
|
---|
1217 | set(handles.histo_v,'Visible','on')
|
---|
1218 | set(handles.histo2_menu,'String',menu_histo)
|
---|
1219 | set(handles.histo2_menu,'Value',2)
|
---|
1220 | histo2_menu_Callback(hObject, eventdata, handles)
|
---|
1221 | end
|
---|
1222 | end
|
---|
1223 | if ~test_v
|
---|
1224 | set(handles.histo2_menu,'Visible','off')
|
---|
1225 | set(handles.histo_v,'Visible','off')
|
---|
1226 | cla(handles.histo_v)
|
---|
1227 | set(handles.histo2_menu,'Value',1)
|
---|
1228 | end
|
---|
1229 |
|
---|
1230 | %display time
|
---|
1231 | testimedoc=0;
|
---|
1232 | if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'Time')
|
---|
1233 | if isempty(num_i2)
|
---|
1234 | num_i2=num_i1;
|
---|
1235 | end
|
---|
1236 | if isempty(num_j1)
|
---|
1237 | num_j1=1;
|
---|
1238 | end
|
---|
1239 | if isempty(num_j2)
|
---|
1240 | num_j2=num_j1;
|
---|
1241 | end
|
---|
1242 | siz=size(UvData.XmlData.Time);
|
---|
1243 | if siz(1)>=max(num_i1,num_i2) & siz(2)>=max(num_j1,num_j2)
|
---|
1244 | abstime=(UvData.XmlData.Time(num_i1,num_j1)+UvData.XmlData.Time(num_i2,num_j2))/2;%overset the time read from files
|
---|
1245 | dt=(UvData.XmlData.Time(num_i2,num_j2)-UvData.XmlData.Time(num_i1,num_j1));
|
---|
1246 | testimedoc=1;
|
---|
1247 | end
|
---|
1248 | end
|
---|
1249 | if isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'Time')
|
---|
1250 | [P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);
|
---|
1251 | num_i2=str2num(str2);
|
---|
1252 | if isempty(num_i2)
|
---|
1253 | num_i2=num_i1;
|
---|
1254 | end
|
---|
1255 | num_j1=str2num(str_a);
|
---|
1256 | if isempty(num_j1)
|
---|
1257 | num_j1=1;
|
---|
1258 | end
|
---|
1259 | num_j2=str2num(str_b);
|
---|
1260 | if isempty(num_j2)
|
---|
1261 | num_j2=num_j1;
|
---|
1262 | end
|
---|
1263 | num_i1=str2num(str1);
|
---|
1264 | siz=size(UvData.XmlData_1.Time);
|
---|
1265 | if siz(1)>=max(num_i1,num_i2) & siz(2)>=max(num_j1,num_j2)
|
---|
1266 | abstime_1=(UvData.XmlData_1.Time(num_i1,num_j1)+UvData.XmlData_1.Time(num_i2,num_j2))/2;%overset the time read from files
|
---|
1267 | end
|
---|
1268 | end
|
---|
1269 | set(handles.abs_time,'String',num2str(abstime,4))
|
---|
1270 | set(handles.abs_time_1,'String',num2str(abstime_1,4))
|
---|
1271 | if testimedoc && isfield(UvData,'dt')
|
---|
1272 | dt=UvData.dt;
|
---|
1273 | end
|
---|
1274 | if isequal(dt,0)
|
---|
1275 | set(handles.Dt_txt,'String','')
|
---|
1276 | else
|
---|
1277 | if ~(isfield(UvData,'TimeUnit') && ~isempty(UvData.TimeUnit))
|
---|
1278 | set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' 10^(-3)'] )
|
---|
1279 | else
|
---|
1280 | set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' m' UvData.TimeUnit] )
|
---|
1281 | end
|
---|
1282 | end
|
---|
1283 | set(handles.run0,'BackgroundColor',[1 0 0])
|
---|
1284 |
|
---|
1285 |
|
---|
1286 |
|
---|
1287 | %-------------------------------------------------------------------
|
---|
1288 | % --- translate coordinate to matrix index
|
---|
1289 | %-------------------------------------------------------------------
|
---|
1290 | function [indx,indy]=pos2ind(x0,rangx0,nxy)
|
---|
1291 | indx=1+round((nxy(2)-1)*(x0-rangx0(1))/(rangx0(2)-rangx0(1)));% index x of pixel
|
---|
1292 | indy=1+round((nxy(1)-1)*(y12-rangy0(1))/(rangy0(2)-rangy0(1)));% index y of pixel
|
---|
1293 |
|
---|
1294 | %-------------------------------------------------------------------
|
---|
1295 | % --- Executes on button press in 'FixedLimits'.
|
---|
1296 | %-------------------------------------------------------------------
|
---|
1297 | function FixedLimits_Callback(hObject, eventdata, handles)
|
---|
1298 | test=get(handles.FixedLimits,'Value');
|
---|
1299 | if test
|
---|
1300 | set(handles.FixedLimits,'BackgroundColor',[1 1 0])
|
---|
1301 | else
|
---|
1302 | set(handles.FixedLimits,'BackgroundColor',[0.7 0.7 0.7])
|
---|
1303 | end
|
---|
1304 |
|
---|
1305 | %-------------------------------------------------------------------
|
---|
1306 | % --- Executes on button press in auto_xy.
|
---|
1307 | function auto_xy_Callback(hObject, eventdata, handles)
|
---|
1308 | test=get(handles.auto_xy,'Value');
|
---|
1309 | if test
|
---|
1310 | set(handles.auto_xy,'BackgroundColor',[1 1 0])
|
---|
1311 | cla(handles.axes3)
|
---|
1312 | update_plot(handles)
|
---|
1313 | else
|
---|
1314 | set(handles.auto_xy,'BackgroundColor',[0.7 0.7 0.7])
|
---|
1315 | update_plot(handles)
|
---|
1316 | % axis(handles.axes3,'image')
|
---|
1317 | end
|
---|
1318 |
|
---|
1319 |
|
---|
1320 | %-------------------------------------------------------------------
|
---|
1321 |
|
---|
1322 | %-------------------------------------------------------------------
|
---|
1323 | % --- Executes on button press in 'zoom'.
|
---|
1324 | %-------------------------------------------------------------------
|
---|
1325 | function zoom_Callback(hObject, eventdata, handles)
|
---|
1326 | if (get(handles.zoom,'Value') == 1);
|
---|
1327 | set(handles.zoom,'BackgroundColor',[1 1 0])
|
---|
1328 | set(handles.FixedLimits,'Value',1)% propose by default fixed limits for the plotting axes
|
---|
1329 | set(handles.FixedLimits,'BackgroundColor',[1 1 0])
|
---|
1330 | else
|
---|
1331 | set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
|
---|
1332 | end
|
---|
1333 |
|
---|
1334 | %-------------------------------------------------------------------
|
---|
1335 | %----Executes on button press in 'record': records the current flags of manual correction.
|
---|
1336 | %-------------------------------------------------------------------
|
---|
1337 | function record_Callback(hObject, eventdata, handles)
|
---|
1338 | % [filebase,num_i1,num_j1,num_i2,num_j2,Ext,NomType,SubDir]=read_input_file(handles);
|
---|
1339 | filename=read_file_boxes(handles);
|
---|
1340 | AxeData=get(gca,'UserData');
|
---|
1341 | [erread,message]=fileattrib(filename);
|
---|
1342 | if ~isempty(message) && ~isequal(message.UserWrite,1)
|
---|
1343 | msgbox_view_field('ERROR',['no writting access to ' filename])
|
---|
1344 | return
|
---|
1345 | end
|
---|
1346 | test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]);
|
---|
1347 | test_civ1=isequal(get(handles.civ1,'BackgroundColor'),[1 1 0]);
|
---|
1348 | if ~test_civ2 && ~test_civ1
|
---|
1349 | msgbox_view_field('ERROR','manual correction only possible for CIV1 or CIV2 velocity fields')
|
---|
1350 | end
|
---|
1351 | if test_civ2
|
---|
1352 | nbname='nb_vectors2';
|
---|
1353 | flagname='vec2_FixFlag';
|
---|
1354 | attrname='fix2';
|
---|
1355 | end
|
---|
1356 | if test_civ1
|
---|
1357 | nbname='nb_vectors';
|
---|
1358 | flagname='vec_FixFlag';
|
---|
1359 | attrname='fix';
|
---|
1360 | end
|
---|
1361 | %write fix flags in the netcdf file
|
---|
1362 | hhh=which('netcdf.open');% look for built-in matlab netcdf library
|
---|
1363 | if ~isequal(hhh,'')% case of new builtin Matlab netcdf library
|
---|
1364 | nc=netcdf.open(filename,'NC_WRITE');
|
---|
1365 | netcdf.reDef(nc)
|
---|
1366 | netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1)
|
---|
1367 | dimid = netcdf.inqDimID(nc,nbname);
|
---|
1368 | try
|
---|
1369 | varid = netcdf.inqVarID(nc,flagname);% look for already existing fixflag variable
|
---|
1370 | catch
|
---|
1371 | varid=netcdf.defVar(nc,flagname,'double',dimid);%create fixflag variable if it does not exist
|
---|
1372 | end
|
---|
1373 | netcdf.endDef(nc)
|
---|
1374 | netcdf.putVar(nc,varid,AxeData.FF);
|
---|
1375 | netcdf.close(nc)
|
---|
1376 | else %old netcdf library
|
---|
1377 | netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)
|
---|
1378 | end
|
---|
1379 |
|
---|
1380 | function netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)
|
---|
1381 | nc=netcdf(filename,'write'); %open netcdf file
|
---|
1382 | result=redef(nc);
|
---|
1383 | eval(['nc.' attrname '=1;']);
|
---|
1384 | theDim=nc(nbname) ;% get the number of velocity vectors
|
---|
1385 | nb_vectors=size(theDim);
|
---|
1386 | var_FixFlag=ncvar(flagname,nc);% var_FixFlag will be written as the netcdf variable vec_FixFlag
|
---|
1387 | var_FixFlag(1:nb_vectors)=AxeData.FF;%
|
---|
1388 | fin=close(nc);
|
---|
1389 |
|
---|
1390 |
|
---|
1391 | %-------------------------------------------------------------------
|
---|
1392 | %determines the fields to read from the interface
|
---|
1393 | %------------------------------------------------------------------
|
---|
1394 | function [VelType,civ]=setfield(handles)
|
---|
1395 |
|
---|
1396 | VelType=[]; %default
|
---|
1397 | if (get(handles.civ1,'Value') == 1);
|
---|
1398 | VelType='civ1';
|
---|
1399 | % interp1
|
---|
1400 | elseif (get(handles.interp1,'Value') == 1);
|
---|
1401 | VelType='interp1';
|
---|
1402 | % filter1
|
---|
1403 | elseif (get(handles.filter1,'Value') == 1);
|
---|
1404 | VelType='filter1';
|
---|
1405 | % CIV2
|
---|
1406 | elseif (get(handles.civ2,'Value') == 1);
|
---|
1407 | VelType='civ2';
|
---|
1408 | % interp2
|
---|
1409 | elseif (get(handles.interp2,'Value') == 1);
|
---|
1410 | VelType='interp2';
|
---|
1411 | % filter2
|
---|
1412 | elseif (get(handles.filter2,'Value') == 1);
|
---|
1413 | VelType='filter2';
|
---|
1414 | end
|
---|
1415 |
|
---|
1416 | if isequal(get(handles.filter2,'Visible'),'on');
|
---|
1417 | civ=6;
|
---|
1418 | % interp1
|
---|
1419 | elseif isequal(get(handles.interp2,'Visible'),'on');
|
---|
1420 | civ=5;
|
---|
1421 | % filter1
|
---|
1422 | elseif isequal(get(handles.civ2,'Visible'),'on');
|
---|
1423 | civ=4;
|
---|
1424 | % CIV2
|
---|
1425 | elseif isequal(get(handles.filter1,'Visible'),'on');
|
---|
1426 | civ=3;
|
---|
1427 | % interp2
|
---|
1428 | elseif isequal(get(handles.interp1,'Visible'),'on');
|
---|
1429 | civ=2;
|
---|
1430 | % filter2
|
---|
1431 | elseif isequal(get(handles.civ1,'Visible'),'on');
|
---|
1432 | civ=1;
|
---|
1433 | else
|
---|
1434 | civ=0;
|
---|
1435 | end
|
---|
1436 |
|
---|
1437 | %-------------------------------------------------------------------
|
---|
1438 | %determines the veltype of the second field to read from the iinterface
|
---|
1439 | %------------------------------------------------------------------
|
---|
1440 | function VelType=setfield_1(handles)
|
---|
1441 |
|
---|
1442 | VelType=[]; %default
|
---|
1443 | if (get(handles.civ1_1,'Value') == 1);
|
---|
1444 | VelType='civ1';
|
---|
1445 | % interp1
|
---|
1446 | elseif (get(handles.interp1_1,'Value') == 1);
|
---|
1447 | VelType='interp1';
|
---|
1448 | % filter1
|
---|
1449 | elseif (get(handles.filter1_1,'Value') == 1);
|
---|
1450 | VelType='filter1';
|
---|
1451 | % CIV2
|
---|
1452 | elseif (get(handles.civ2_1,'Value') == 1);
|
---|
1453 | VelType='civ2';
|
---|
1454 | % interp2
|
---|
1455 | elseif (get(handles.interp2_1,'Value') == 1);
|
---|
1456 | VelType='interp2';
|
---|
1457 | % filter2
|
---|
1458 | elseif (get(handles.filter2_1,'Value') == 1);
|
---|
1459 | VelType='filter2';
|
---|
1460 | end
|
---|
1461 |
|
---|
1462 |
|
---|
1463 | %---------------------------------------------------
|
---|
1464 | % --- Executes on button press in SubField
|
---|
1465 | function SubField_Callback(hObject, eventdata, handles)
|
---|
1466 | huvmat=get(handles.run0,'parent');
|
---|
1467 | UvData=get(huvmat,'UserData');
|
---|
1468 | if get(handles.SubField,'Value')==0% if the subfield button is desactivated
|
---|
1469 | set(handles.RootPath_1,'String','')
|
---|
1470 | set(handles.RootFile_1,'String','')
|
---|
1471 | set(handles.SubDir_1,'String','');
|
---|
1472 | set(handles.FileIndex_1,'String','');
|
---|
1473 | set(handles.FileExt_1,'String','');
|
---|
1474 | set(handles.RootPath_1,'Visible','off')
|
---|
1475 | set(handles.RootFile_1,'Visible','off')
|
---|
1476 | set(handles.SubDir_1,'Visible','off');
|
---|
1477 | set(handles.FileIndex_1,'Visible','off');
|
---|
1478 | set(handles.FileExt_1,'Visible','off');
|
---|
1479 | set(handles.Fields_1,'Value',1);%set to blank state
|
---|
1480 | set_veltype_display([handles.civ1_1 handles.interp1_1 handles.filter1_1 ...
|
---|
1481 | handles.civ2_1 handles.interp2_1 handles.filter2_1],0)
|
---|
1482 | if isfield(UvData,'XmlData_1')
|
---|
1483 | UvData=rmfield(UvData,'XmlData_1');
|
---|
1484 | end
|
---|
1485 | set(huvmat,'UserData',UvData);
|
---|
1486 | run0_Callback(hObject, eventdata, handles); %run
|
---|
1487 | else
|
---|
1488 | MenuBrowse_1_Callback(hObject, eventdata, handles)
|
---|
1489 | end
|
---|
1490 |
|
---|
1491 | % %----------------------------------------------
|
---|
1492 | % %read the data displayed for the input rootfile windows (new)
|
---|
1493 | % %-------------------------------------------------
|
---|
1494 | function [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles)
|
---|
1495 | RootPath=get(handles.RootPath,'String');
|
---|
1496 | FileName=RootPath; %default
|
---|
1497 | SubDir=get(handles.SubDir,'String');
|
---|
1498 | if ~isempty(SubDir) && ~isequal(SubDir,'')
|
---|
1499 | if (isequal(SubDir(1),'/')|| isequal(SubDir(1),'\'))
|
---|
1500 | SubDir(1)=[]; %suppress possible / or \ separator
|
---|
1501 | end
|
---|
1502 | FileName=fullfile(RootPath,SubDir);
|
---|
1503 | end
|
---|
1504 | RootFile=get(handles.RootFile,'String');
|
---|
1505 | if ~isempty(RootFile) && ~isequal(RootFile,'')
|
---|
1506 | if (isequal(RootFile(1),'/')|| isequal(RootFile(1),'\'))
|
---|
1507 | RootFile(1)=[]; %suppress possible / or \ separator
|
---|
1508 | end
|
---|
1509 | FileName=fullfile(FileName,RootFile);
|
---|
1510 | end
|
---|
1511 | FileBase=fullfile(RootPath,RootFile);
|
---|
1512 | FileIndices=get(handles.FileIndex,'String');
|
---|
1513 | FileExt=get(handles.FileExt,'String');
|
---|
1514 | FileName=[FileName FileIndices FileExt];
|
---|
1515 |
|
---|
1516 | %----------------------------------------------
|
---|
1517 | %read the data displayed for the second input rootfile windows
|
---|
1518 | %-------------------------------------------------
|
---|
1519 | function [FileName_1,RootPath_1,FileBase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles)
|
---|
1520 | RootPath_1=get(handles.RootPath_1,'String'); % read the data from the file1_input window
|
---|
1521 | if isequal(RootPath_1,'"'),RootPath_1=get(handles.RootPath,'String'); end;
|
---|
1522 | FileName_1=RootPath_1; %default
|
---|
1523 | SubDir_1=get(handles.SubDir_1,'String');
|
---|
1524 | if isequal(SubDir_1,'"')
|
---|
1525 | SubDir_1=get(handles.SubDir,'String');
|
---|
1526 | end
|
---|
1527 | if ~isempty(SubDir_1) && ~isequal(SubDir_1,'')
|
---|
1528 | if (isequal(SubDir_1(1),'/')|| isequal(SubDir_1(1),'\'))
|
---|
1529 | SubDir_1(1)=[]; %suppress possible / or \ separator
|
---|
1530 | end
|
---|
1531 | FileName_1=fullfile(RootPath_1,SubDir_1);
|
---|
1532 | end
|
---|
1533 | RootFile_1=get(handles.RootFile_1,'String');
|
---|
1534 | if isequal(RootFile_1,'"'),RootFile_1=get(handles.RootFile,'String'); end;
|
---|
1535 | if ~isempty(RootFile_1) && ~isequal(RootFile_1,'')
|
---|
1536 | if ~(isequal(RootFile_1(1),'/')|isequal(RootFile_1(1),'\'))
|
---|
1537 | RootFile_1(1)=[];%suppress possible / or \ separator
|
---|
1538 | end
|
---|
1539 | FileName_1=fullfile(FileName_1,RootFile_1);
|
---|
1540 | end
|
---|
1541 | FileBase_1=fullfile(RootPath_1,RootFile_1);
|
---|
1542 | FileIndices_1=get(handles.FileIndex_1,'String');
|
---|
1543 | FileExt_1=get(handles.FileExt_1,'String');
|
---|
1544 | if isequal(FileExt_1,'"'),FileExt_1=get(handles.FileExt,'String'); end;
|
---|
1545 | FileName_1=[FileName_1 FileIndices_1 FileExt_1];
|
---|
1546 |
|
---|
1547 | %---------------------------------------------------
|
---|
1548 | % --- Executes on menu selection Fields
|
---|
1549 | function Fields_Callback(hObject, eventdata, handles)
|
---|
1550 | %-------------------------------------------------
|
---|
1551 | huvmat=get(handles.Fields,'parent');
|
---|
1552 | list_fields=get(handles.Fields,'String');% list menu fields
|
---|
1553 | index_fields=get(handles.Fields,'Value');% selected string index
|
---|
1554 | field= list_fields{index_fields(1)}; % selected string
|
---|
1555 | if isequal(field,'get_field...')
|
---|
1556 | veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
|
---|
1557 | set_veltype_display(veltype_handles,0) % unvisible civ buttons
|
---|
1558 | filename=read_file_boxes(handles);
|
---|
1559 | hget_field=findobj(allchild(0),'name','get_field');
|
---|
1560 | if ~isempty(hget_field)
|
---|
1561 | delete(hget_field)
|
---|
1562 | end
|
---|
1563 | get_field(filename)
|
---|
1564 | return %no action
|
---|
1565 | end
|
---|
1566 | list_fields=get(handles.Fields_1,'String');% list menu fields
|
---|
1567 | index_fields=get(handles.Fields_1,'Value');% selected string index
|
---|
1568 | field_1= list_fields{index_fields(1)}; % selected string
|
---|
1569 | UvData=get(huvmat,'UserData');
|
---|
1570 |
|
---|
1571 | %read the rootfile input display
|
---|
1572 | FileExt=get(handles.FileExt,'String');
|
---|
1573 | [P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt]);
|
---|
1574 | NomTypeNew=NomType;%default
|
---|
1575 | if isequal(field,'image')
|
---|
1576 | % transform netc type to the corresponding image type
|
---|
1577 | if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')|| isequal(NomType,'#_ab')|| isequal(NomType,'_i1-i2')
|
---|
1578 | UvData.SubDir=get(handles.SubDir,'String'); %preserve the subdir in memory
|
---|
1579 | if ~isempty(UvData.SubDir) && (isequal(UvData.SubDir(1),'/')||isequal(UvData.SubDir(1),'/'))
|
---|
1580 | UvData.SubDir(1)=[];
|
---|
1581 | end
|
---|
1582 | set(handles.SubDir,'String','')
|
---|
1583 | set(handles.FileExt,'String','.png');
|
---|
1584 | if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')
|
---|
1585 | NomTypeNew='_i_j';
|
---|
1586 | elseif isequal(NomType,'#_ab')
|
---|
1587 | NomTypeNew='#a';
|
---|
1588 | elseif isequal(NomType,'_i1-i2')
|
---|
1589 | NomTypeNew='_i';
|
---|
1590 | end
|
---|
1591 | end
|
---|
1592 | veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
|
---|
1593 | set_veltype_display(veltype_handles,0) % unvisible civ buttons
|
---|
1594 | else
|
---|
1595 | ext=get(handles.FileExt,'String');
|
---|
1596 | if ~isequal(ext,'.nc') %find the new NomType if the previous display was not already a netcdf file
|
---|
1597 | MenuBrowse_Callback(hObject, eventdata, handles)
|
---|
1598 | end
|
---|
1599 | if isequal(field,'vort') || isequal(field,'div') || isequal(field,'strain')
|
---|
1600 | set(handles.civ1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey
|
---|
1601 | set(handles.civ2,'BackgroundColor',[0.702 0.702 0.702])
|
---|
1602 | set(handles.interp1,'BackgroundColor',[0.702 0.702 0.702])
|
---|
1603 | set(handles.interp2,'BackgroundColor',[0.702 0.702 0.702])
|
---|
1604 | elseif isequal(field,'more...');
|
---|
1605 | set(handles.civ1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey
|
---|
1606 | set(handles.civ2,'BackgroundColor',[0.702 0.702 0.702])
|
---|
1607 | str=calc_field;%get the list of available scalars by the function calc_scal
|
---|
1608 | [ind_answer] = listdlg('PromptString','Select a file:',...
|
---|
1609 | 'SelectionMode','single',...
|
---|
1610 | 'ListString',str);
|
---|
1611 | % edit the choice in the field and action menu
|
---|
1612 | scalar=cell2mat(str(ind_answer));
|
---|
1613 | menu=update_menu(handles.Fields,scalar);
|
---|
1614 | menu=[{''};menu];
|
---|
1615 | set(handles.Fields_1,'String',menu);% store the selected scalar type
|
---|
1616 | end
|
---|
1617 | end
|
---|
1618 | indices=name_generator('',str2double(str1),str2double(str_a),'',NomTypeNew,1,str2double(str2),str2double(str_b),'');
|
---|
1619 | set(handles.FileIndex,'String',indices)
|
---|
1620 | set(handles.FileIndex,'UserData',NomTypeNew)
|
---|
1621 | %common to Fields_1_Callback
|
---|
1622 | if isequal(field,'image')||isequal(field_1,'image')
|
---|
1623 | set(handles.npx_title,'Visible','on')% visible npx,pxcm... buttons
|
---|
1624 | set(handles.npy_title,'Visible','on')
|
---|
1625 | set(handles.npx,'Visible','on')
|
---|
1626 | set(handles.npy,'Visible','on')
|
---|
1627 | set(handles.fix_pair,'Value',0)
|
---|
1628 | else
|
---|
1629 | set(handles.npx_title,'Visible','off')% visible npx,pxcm... buttons
|
---|
1630 | set(handles.npy_title,'Visible','off')
|
---|
1631 | set(handles.npx,'Visible','off')
|
---|
1632 | set(handles.npy,'Visible','off')
|
---|
1633 | set(handles.fix_pair,'Value',1)
|
---|
1634 | end
|
---|
1635 | % if isequal(field,'velocity')|isequal(field_1,'velocity');
|
---|
1636 | % state_vect='on';
|
---|
1637 | % else
|
---|
1638 | % state_vect='off';
|
---|
1639 | % end
|
---|
1640 | % if ~isequal(field,'velocity')|(~isequal(field_1,'velocity'));
|
---|
1641 | % state_scal='on';
|
---|
1642 | % else
|
---|
1643 | % state_scal='off';
|
---|
1644 | % end
|
---|
1645 | setfield(handles);% update the field structure ('civ1'....)
|
---|
1646 |
|
---|
1647 | if ~isfield(UvData,'NewSeries')||isequal(UvData.NewSeries,0)
|
---|
1648 | run0_Callback(hObject, eventdata, handles)
|
---|
1649 | end
|
---|
1650 |
|
---|
1651 | %---------------------------------------------------
|
---|
1652 | % --- Executes on menu selection Fields
|
---|
1653 | function Fields_1_Callback(hObject, eventdata, handles)
|
---|
1654 | %-------------------------------------------------
|
---|
1655 | huvmat=get(handles.Fields_1,'parent');
|
---|
1656 | list_fields=get(handles.Fields,'String');% list menu fields
|
---|
1657 | index_fields=get(handles.Fields,'Value');% selected string index
|
---|
1658 | field= list_fields{index_fields(1)}; % selected string
|
---|
1659 | list_fields=get(handles.Fields_1,'String');% list menu fields
|
---|
1660 | index_fields=get(handles.Fields_1,'Value');% selected string index
|
---|
1661 | field_1= list_fields{index_fields(1)}; % selected string for the second field
|
---|
1662 | if isequal(field_1,'') %remove second field if 'blank' field is selected
|
---|
1663 | set(handles.SubField,'Value',0)
|
---|
1664 | SubField_Callback(hObject, eventdata, handles)
|
---|
1665 | return
|
---|
1666 | end
|
---|
1667 | UvData=get(huvmat,'UserData');
|
---|
1668 |
|
---|
1669 | %read the rootfile input display
|
---|
1670 | FileExt_prev=get(handles.FileExt_1,'String');
|
---|
1671 | if isempty(FileExt_prev)|isequal(FileExt_prev,'')
|
---|
1672 | FileExt_1=get(handles.FileExt,'String');
|
---|
1673 | else
|
---|
1674 | FileExt_1=FileExt_prev;
|
---|
1675 | end
|
---|
1676 | NomType_1=get(handles.FileIndex_1,'UserData');
|
---|
1677 | if isempty(NomType_1)|isequal(NomType_1,'')
|
---|
1678 | NomType_1=get(handles.FileIndex,'UserData');
|
---|
1679 | end
|
---|
1680 | NomTypeNew=NomType_1;%default
|
---|
1681 |
|
---|
1682 | set(handles.SubField,'Value',1)%introduce second field
|
---|
1683 | if isfield(UvData,'XmlData')
|
---|
1684 | UvData.XmlData_1=UvData.XmlData;
|
---|
1685 | end
|
---|
1686 | set(handles.FileIndex_1,'Visible','on')
|
---|
1687 | set(handles.FileExt_1,'Visible','on')
|
---|
1688 | RootPath_1=get(handles.RootPath_1,'String');
|
---|
1689 | RootFile_1=get(handles.RootFile_1,'String');
|
---|
1690 | if isempty(RootPath_1)|isequal(RootPath_1,'')
|
---|
1691 | set(handles.RootPath_1,'String','"')
|
---|
1692 | end
|
---|
1693 | if isempty(RootFile_1) | isequal(RootFile_1,'')
|
---|
1694 | set(handles.RootFile_1,'String','"')
|
---|
1695 | end
|
---|
1696 | if ~isempty(RootFile_1)&(isequal(RootFile_1(1),'/')|isequal(RootFile_1(1),'\'))
|
---|
1697 | RootFile_1(1)=[];
|
---|
1698 | end
|
---|
1699 |
|
---|
1700 | if isequal(field_1,'get_field...')
|
---|
1701 | veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
|
---|
1702 | set_veltype_display(veltype_handles,0) % unvisible civ buttons
|
---|
1703 | filename=read_file_boxes_1(handles);
|
---|
1704 | hget_field=findobj(allchild(0),'name','get_field_1');
|
---|
1705 | if ~isempty(hget_field)
|
---|
1706 | delete(hget_field)
|
---|
1707 | end
|
---|
1708 | hget_field=get_field(filename);
|
---|
1709 | set(hget_field,'name','get_field_1')
|
---|
1710 | return %no action
|
---|
1711 | end
|
---|
1712 | if isequal(field_1,'image')
|
---|
1713 | % transform netc type to the corresponding image type
|
---|
1714 | set(handles.FileExt_1,'String','.png');
|
---|
1715 | if isequal(NomType_1,'_i1-i2_j')|isequal(NomType_1,'_i_j1-j2')| isequal(NomType_1,'#_ab')| isequal(NomType_1,'_i1-i2')
|
---|
1716 | UvData.SubDir_1=get(handles.SubDir_1,'String'); %preserve the subdir in memory
|
---|
1717 | set(handles.SubDir_1,'String','')
|
---|
1718 | % set(handles.FileExt_1,'String','.png');
|
---|
1719 | if isequal(NomType_1,'_i1-i2_j')|isequal(NomType_1,'_i_j1-j2')
|
---|
1720 | NomTypeNew='_i_j';
|
---|
1721 | elseif isequal(NomType_1,'#_ab')
|
---|
1722 | NomTypeNew='#a';
|
---|
1723 | elseif isequal(NomType_1,'_i1-i2')
|
---|
1724 | NomTypeNew='_i';
|
---|
1725 | end
|
---|
1726 | end
|
---|
1727 | veltype_handles=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
|
---|
1728 | set_veltype_display(veltype_handles,0) % unvisible civ buttons
|
---|
1729 | else
|
---|
1730 | set(handles.SubDir_1,'Visible','on')
|
---|
1731 | if ~isequal(FileExt_prev,'.nc') %find the new NomType if the previous display was not already a netcdf file
|
---|
1732 | veltype_handles=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
|
---|
1733 | set_veltype_display(veltype_handles,6); % make all civ buttons visible
|
---|
1734 | RootPath_1=get(handles.RootPath_1,'String');
|
---|
1735 | RootFile_1=get(handles.RootFile_1,'String');
|
---|
1736 | if isempty(RootPath_1)|isequal(RootPath_1,'')
|
---|
1737 | set(handles.RootPath_1,'String','"')
|
---|
1738 | end
|
---|
1739 | if isempty(RootFile_1) | isequal(RootFile_1,'')
|
---|
1740 | set(handles.RootFile_1,'String','"')
|
---|
1741 | end
|
---|
1742 | if ~isempty(RootFile_1)&(isequal(RootFile_1(1),'/')|isequal(RootFile_1(1),'\'))
|
---|
1743 | RootFile_1(1)=[];
|
---|
1744 | end
|
---|
1745 | filebase_1=fullfile(RootPath_1,RootFile_1);
|
---|
1746 | SubDir_1=get(handles.SubDir,'String');
|
---|
1747 | if isempty(SubDir_1)|isequal(SubDir_1,'')
|
---|
1748 | if isfield(UvData,'SubDir_1')
|
---|
1749 | SubDir_1=UvData.SubDir_1;%retrieve previous subdir
|
---|
1750 | else
|
---|
1751 | SubDir_1='?';
|
---|
1752 | end
|
---|
1753 | end
|
---|
1754 | if isequal(NomType_1,'#_ab')|isequal(NomType_1,'_i1-i2_j')|isequal(NomType_1,'_i_j1-j2')|isequal(NomType_1,'_i1-i2')
|
---|
1755 | NomTypeNew=NomType_1;
|
---|
1756 | elseif isequal(NomType_1,'#a')
|
---|
1757 | [filename,idetect,n1,na,n2,nb,SubDir_1]=name_generator(filebase_1, str2num(str1),str2num(str_a),'.nc','#_ab',0,[],[],SubDir_1);
|
---|
1758 | NomTypeNew='#_ab';
|
---|
1759 | elseif isequal(NomType_1,'_i_j')
|
---|
1760 | [filename,idetect,n1,na,n2,nb,SubDir_1]=name_generator(filebase_1,str2num(str1),str2num(str_a),'.nc','_i1-i2_j',0,str2num(str1),[],SubDir_1);
|
---|
1761 | if idetect==1
|
---|
1762 | NomTypeNew='_i1-i2_j';
|
---|
1763 | else
|
---|
1764 | NomTypeNew='_i_j1-j2';
|
---|
1765 | end
|
---|
1766 | else %for instance avi files or any ima_num series
|
---|
1767 | [filename,idetect,n1,na,n2,nb,SubDir_1]=name_generator(filebase_1,str2num(str1),str2num(str_a),'.nc','_i1-i2',0,str2num(str1),[],SubDir_1);
|
---|
1768 | NomTypeNew='_i1-i2';
|
---|
1769 | end
|
---|
1770 | [Path,Name]=fileparts(filebase_1);
|
---|
1771 | set(handles.FileExt_1,'String','.nc');
|
---|
1772 | if ~isempty(SubDir_1) & ~isequal(SubDir_1,'''')& ~isequal(SubDir_1,'"')
|
---|
1773 | SubDir_1=['/' SubDir_1];
|
---|
1774 | end
|
---|
1775 | set(handles.SubDir_1,'String',SubDir_1);
|
---|
1776 | end
|
---|
1777 | if isequal(field,'vort') | isequal(field,'div') | isequal(field,'strain')
|
---|
1778 | set(handles.civ1_1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey
|
---|
1779 | set(handles.civ2_1,'BackgroundColor',[0.702 0.702 0.702])
|
---|
1780 | set(handles.interp1_1,'BackgroundColor',[0.702 0.702 0.702])
|
---|
1781 | set(handles.interp2_1,'BackgroundColor',[0.702 0.702 0.702])
|
---|
1782 | elseif isequal(field_1,'more...'); %add new item to the menu
|
---|
1783 | set(handles.civ1_1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey
|
---|
1784 | set(handles.civ2_1,'BackgroundColor',[0.702 0.702 0.702])
|
---|
1785 | str=calc_field;%get the list of available scalars by the function calc_scal
|
---|
1786 | [ind_answer,v] = listdlg('PromptString','Select a file:',...
|
---|
1787 | 'SelectionMode','single',...
|
---|
1788 | 'ListString',str);
|
---|
1789 | % edit the choice in the field and action menu
|
---|
1790 | scalar=cell2mat(str(ind_answer));
|
---|
1791 | menu=update_menu(handles.Fields_1,scalar);
|
---|
1792 | set(handles.Fields_1,'String',menu);% store the selected scalar type
|
---|
1793 | end
|
---|
1794 | end
|
---|
1795 | str1=get(handles.i1,'String');
|
---|
1796 | str2=get(handles.i2,'String');
|
---|
1797 | str_a=get(handles.j1,'String');
|
---|
1798 | str_b=get(handles.j2,'String');
|
---|
1799 | indices=name_generator('',str2num(str1),stra2num(str_a),'',NomTypeNew,1,str2num(str2),stra2num(str_b),'');
|
---|
1800 | set(handles.FileIndex_1,'String',indices)
|
---|
1801 | set(handles.FileIndex_1,'UserData',NomTypeNew)
|
---|
1802 |
|
---|
1803 | %common to Fields_Callback
|
---|
1804 | if isequal(field,'image')|isequal(field_1,'image')
|
---|
1805 | set(handles.npx_title,'Visible','on')% visible npx,pxcm... buttons
|
---|
1806 | set(handles.npy_title,'Visible','on')
|
---|
1807 | set(handles.npx,'Visible','on')
|
---|
1808 | set(handles.npy,'Visible','on')
|
---|
1809 | set(handles.fix_pair,'Value',0)
|
---|
1810 | else
|
---|
1811 | set(handles.npx_title,'Visible','off')% visible npx,pxcm... buttons
|
---|
1812 | set(handles.npy_title,'Visible','off')
|
---|
1813 | set(handles.npx,'Visible','off')
|
---|
1814 | set(handles.npy,'Visible','off')
|
---|
1815 | set(handles.fix_pair,'Value',1)
|
---|
1816 | end
|
---|
1817 | if isequal(field,'velocity')|isequal(field_1,'velocity');
|
---|
1818 | state_vect='on';
|
---|
1819 | else
|
---|
1820 | state_vect='off';
|
---|
1821 | end
|
---|
1822 | if ~isequal(field,'velocity')|(~isequal(field_1,'velocity')&~isequal(field_1,''));
|
---|
1823 | state_scal='on';
|
---|
1824 | else
|
---|
1825 | state_scal='off';
|
---|
1826 | end
|
---|
1827 | set(huvmat,'UserData',UvData)
|
---|
1828 | setfield(handles);% update the field structure ('civ1'....)
|
---|
1829 | if ~isfield(UvData,'NewSeries')|isequal(UvData.NewSeries,0)
|
---|
1830 | run0_Callback(hObject, eventdata, handles)
|
---|
1831 | end
|
---|
1832 |
|
---|
1833 | %------------------------------------------------------------------------
|
---|
1834 | % --- set the visibility of relevant velocity type menus:
|
---|
1835 | function set_veltype_display(handles,Civ)
|
---|
1836 | %------------------------------------------------------------------------
|
---|
1837 | %Civ=0; all states 'off'
|
---|
1838 | %Civ=6; all states 'on'
|
---|
1839 | if isequal(Civ,0)
|
---|
1840 | imax=0;
|
---|
1841 | % set(handles(1),'Visible','on') % unvisible civ buttons
|
---|
1842 | % else
|
---|
1843 | % set(handles(1),'String','civ1')
|
---|
1844 | % end
|
---|
1845 | elseif isequal(Civ,1) || isequal(Civ,2)
|
---|
1846 | imax=1;
|
---|
1847 | elseif isequal(Civ,3)
|
---|
1848 | imax=3;
|
---|
1849 | elseif isequal(Civ,4) || isequal(Civ,5)
|
---|
1850 | imax=4;
|
---|
1851 | elseif isequal(Civ,6) %patch2
|
---|
1852 | imax=6;
|
---|
1853 | end
|
---|
1854 | for ibutton=1:imax;
|
---|
1855 | set(handles(ibutton),'Visible','on') % unvisible civ buttons
|
---|
1856 | end
|
---|
1857 | % for ibutton=max(imax+1,2):6;
|
---|
1858 | for ibutton=imax+1:6;
|
---|
1859 | set(handles(ibutton),'Visible','off') % unvisible civ buttons
|
---|
1860 | set(handles(ibutton),'Value',0)%unactivate unvisible buttons
|
---|
1861 | end
|
---|
1862 |
|
---|
1863 | %-------------------------------------------------------------------
|
---|
1864 | % --- Executes on button press in civ1.
|
---|
1865 | function civ1_Callback(hObject, eventdata, handles)
|
---|
1866 | %-------------------------------------------------------------------
|
---|
1867 | if get(handles.civ1,'Value')==1
|
---|
1868 | reset_vel_type([handles.interp1 handles.civ2 handles.filter1 handles.interp1 handles.interp2 handles.filter2],handles.civ1)
|
---|
1869 | else
|
---|
1870 | reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
|
---|
1871 | end
|
---|
1872 | run0_Callback(hObject, eventdata, handles)
|
---|
1873 |
|
---|
1874 | %-------------------------------------------------------------------
|
---|
1875 | % --- Executes on button press in interp1.
|
---|
1876 | function interp1_Callback(hObject, eventdata, handles)
|
---|
1877 | %-------------------------------------------------------------------
|
---|
1878 | if get(handles.interp1,'Value')==1
|
---|
1879 | reset_vel_type([handles.civ1 handles.civ2 handles.filter1 handles.interp2 handles.filter2],handles.interp1)
|
---|
1880 | else
|
---|
1881 | reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
|
---|
1882 | end
|
---|
1883 | run0_Callback(hObject, eventdata, handles)
|
---|
1884 |
|
---|
1885 | %-------------------------------------------------------------------
|
---|
1886 | % --- Executes on button press in filter1.
|
---|
1887 | function filter1_Callback(hObject, eventdata, handles)
|
---|
1888 | %-------------------------------------------------------------------
|
---|
1889 | if get(handles.filter1,'Value')==1
|
---|
1890 | reset_vel_type([handles.civ1 handles.civ2 handles.interp1 handles.interp2 handles.filter2],handles.filter1)
|
---|
1891 | else
|
---|
1892 | reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
|
---|
1893 | end
|
---|
1894 | run0_Callback(hObject, eventdata, handles)
|
---|
1895 |
|
---|
1896 | %-------------------------------------------------------------------
|
---|
1897 | % --- Executes on button press in civ2.
|
---|
1898 | function civ2_Callback(hObject, eventdata, handles)
|
---|
1899 | %-------------------------------------------------------------------
|
---|
1900 | if get(handles.civ2,'Value')==1
|
---|
1901 | reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.interp2 handles.filter2],handles.civ2)
|
---|
1902 | else
|
---|
1903 | reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
|
---|
1904 | end
|
---|
1905 | run0_Callback(hObject, eventdata, handles)
|
---|
1906 |
|
---|
1907 | %-----------------------------------------
|
---|
1908 | % --- Executes on button press in interp2.
|
---|
1909 | %-------------------------------------------
|
---|
1910 | function interp2_Callback(hObject, eventdata, handles)
|
---|
1911 | if get(handles.interp2,'Value')==1
|
---|
1912 | reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.filter2],handles.interp2)
|
---|
1913 | else
|
---|
1914 | reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
|
---|
1915 | end
|
---|
1916 | run0_Callback(hObject, eventdata, handles)
|
---|
1917 | %---------------------------------------------
|
---|
1918 | % --- Executes on button press in filter2.
|
---|
1919 | %-------------------------------------------
|
---|
1920 | function filter2_Callback(hObject, eventdata, handles)
|
---|
1921 | if get(handles.filter2,'Value')==1
|
---|
1922 | reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2],handles.filter2)
|
---|
1923 | else
|
---|
1924 | reset_vel_type([handles.civ1 handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
|
---|
1925 | end
|
---|
1926 | run0_Callback(hObject, eventdata, handles)
|
---|
1927 |
|
---|
1928 | %---------------------------------------------
|
---|
1929 | function civ1_1_Callback(hObject, eventdata, handles)
|
---|
1930 | %---------------------------------------------
|
---|
1931 | if get(handles.civ1_1,'Value')==1
|
---|
1932 | reset_vel_type([handles.interp1_1 handles.civ2_1 handles.filter1_1 handles.interp1_1 handles.interp2_1 handles.filter2_1],handles.civ1_1)
|
---|
1933 | else
|
---|
1934 | reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])
|
---|
1935 | end
|
---|
1936 | run0_Callback(hObject, eventdata, handles)
|
---|
1937 |
|
---|
1938 | %--------------------------------------------
|
---|
1939 | function interp1_1_Callback(hObject, eventdata, handles)
|
---|
1940 | %--------------------------------------------
|
---|
1941 | if get(handles.interp1_1,'Value')==1
|
---|
1942 | reset_vel_type([handles.civ1_1 handles.civ2_1 handles.filter1_1 handles.interp2_1 handles.filter2_1],handles.interp1_1)
|
---|
1943 | else
|
---|
1944 | reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])
|
---|
1945 | end
|
---|
1946 | run0_Callback(hObject, eventdata, handles)
|
---|
1947 |
|
---|
1948 | %--------------------------------------------
|
---|
1949 | function filter1_1_Callback(hObject, eventdata, handles)
|
---|
1950 | %--------------------------------------------
|
---|
1951 | if get(handles.filter1_1,'Value')==1
|
---|
1952 | reset_vel_type([handles.interp1_1 handles.civ2_1 handles.interp1_1 handles.interp2_1 handles.filter2_1],handles.filter1_1)
|
---|
1953 | else
|
---|
1954 | reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])
|
---|
1955 | end
|
---|
1956 | run0_Callback(hObject, eventdata, handles)
|
---|
1957 |
|
---|
1958 | %--------------------------------------------
|
---|
1959 | function civ2_1_Callback(hObject, eventdata, handles)
|
---|
1960 | %--------------------------------------------
|
---|
1961 | if get(handles.civ2_1,'Value')==1
|
---|
1962 | reset_vel_type([handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.interp2_1 handles.filter2_1],handles.civ2_1)
|
---|
1963 | else
|
---|
1964 | reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])
|
---|
1965 | end
|
---|
1966 | run0_Callback(hObject, eventdata, handles)
|
---|
1967 |
|
---|
1968 | %--------------------------------------------
|
---|
1969 | function interp2_1_Callback(hObject, eventdata, handles)
|
---|
1970 | %--------------------------------------------
|
---|
1971 | if get(handles.interp2_1,'Value')==1
|
---|
1972 | reset_vel_type([handles.civ1_1 handles.civ2_1 handles.filter1_1 handles.interp1_1 handles.filter2_1],handles.interp2_1)
|
---|
1973 | else
|
---|
1974 | reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])
|
---|
1975 | end
|
---|
1976 | run0_Callback(hObject, eventdata, handles)
|
---|
1977 |
|
---|
1978 | %--------------------------------------------
|
---|
1979 | function filter2_1_Callback(hObject, eventdata, handles)
|
---|
1980 | %--------------------------------------------
|
---|
1981 | if get(handles.filter2_1,'Value')==1
|
---|
1982 | reset_vel_type([handles.civ1_1 handles.interp1_1 handles.civ2_1 handles.filter1_1 handles.interp1_1 handles.interp2_1],handles.filter2_1)
|
---|
1983 | else
|
---|
1984 | reset_vel_type([handles.civ1_1 handles.filter1_1 handles.interp1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1])
|
---|
1985 | end
|
---|
1986 | run0_Callback(hObject, eventdata, handles)
|
---|
1987 |
|
---|
1988 | %-----------------------------------------------
|
---|
1989 | % --- reset civ buttons
|
---|
1990 | function reset_vel_type(handles_civ0,handle1)
|
---|
1991 | for ibutton=1:length(handles_civ0)
|
---|
1992 | set(handles_civ0(ibutton),'BackgroundColor',[0.831 0.816 0.784])
|
---|
1993 | set(handles_civ0(ibutton),'Value',0)
|
---|
1994 | end
|
---|
1995 | if exist('handle1','var')%handles of selected button
|
---|
1996 | set(handle1,'BackgroundColor',[1 1 0])
|
---|
1997 | end
|
---|
1998 |
|
---|
1999 |
|
---|
2000 | %-------------------------------------------------------------------
|
---|
2001 | %-------------------------------------------------------------------
|
---|
2002 | % - FUNCTIONS FOR SETTING PLOTTING PARAMETERS
|
---|
2003 |
|
---|
2004 | %------------------------------------------------------------------
|
---|
2005 |
|
---|
2006 |
|
---|
2007 |
|
---|
2008 | %------------------------------------------------------------------
|
---|
2009 | % --- Executes on selection change in col_vec: choice of the color code.
|
---|
2010 | %
|
---|
2011 | function col_vec_Callback(hObject, eventdata, handles)
|
---|
2012 | %------------------------------------------------------------------
|
---|
2013 | % edit the choice for color code
|
---|
2014 | list_code=get(handles.col_vec,'String');% list menu fields
|
---|
2015 | index_code=get(handles.col_vec,'Value');% selected string index
|
---|
2016 | col_code= list_code{index_code(1)}; % selected field
|
---|
2017 | if isequal(col_code,'black') | isequal(col_code,'white')
|
---|
2018 | set(handles.slider1,'Visible','off')
|
---|
2019 | set(handles.slider2,'Visible','off')
|
---|
2020 | set(handles.colcode1,'Visible','off')
|
---|
2021 | set(handles.colcode2,'Visible','off')
|
---|
2022 | set(handles.AutoVecColor,'Visible','off')
|
---|
2023 | set_vec_col_bar(handles)
|
---|
2024 | else
|
---|
2025 | set(handles.slider1,'Visible','on')
|
---|
2026 | set(handles.slider2,'Visible','on')
|
---|
2027 | set(handles.colcode1,'Visible','on')
|
---|
2028 | set(handles.colcode2,'Visible','on')
|
---|
2029 | set(handles.AutoVecColor,'Visible','on')
|
---|
2030 | if isequal(col_code,'ima_cor')
|
---|
2031 | set(handles.AutoVecColor,'Value',0)%fixed scale by default
|
---|
2032 | set(handles.vec_col_bar,'Value',0)% 3 colors r,g,b by default
|
---|
2033 | set(handles.slider1,'Min',0);
|
---|
2034 | set(handles.slider1,'Max',1);
|
---|
2035 | set(handles.slider2,'Min',0);
|
---|
2036 | set(handles.slider2,'Max',1);
|
---|
2037 | % set(handles.min_C_title_vec,'String','0')
|
---|
2038 | set(handles.max_vec,'String','1')
|
---|
2039 | set(handles.colcode1,'String','0.333')
|
---|
2040 | colcode1_Callback(hObject, eventdata, handles)
|
---|
2041 | set(handles.colcode2,'String','0.666')
|
---|
2042 | colcode2_Callback(hObject, eventdata, handles)
|
---|
2043 | else
|
---|
2044 | set(handles.AutoVecColor,'Value',1)%auto scale between min,max by default
|
---|
2045 | set(handles.vec_col_bar,'Value',1)% colormap 'jet' by default
|
---|
2046 | minval=get(handles.slider1,'Min');
|
---|
2047 | maxval=get(handles.slider1,'Max');
|
---|
2048 | set(handles.slider1,'Value',minval)
|
---|
2049 | set(handles.slider2,'Value',maxval)
|
---|
2050 | set_vec_col_bar(handles)
|
---|
2051 | end
|
---|
2052 | % slider_update(handles)
|
---|
2053 | end
|
---|
2054 | %replot the current graph
|
---|
2055 | run0_Callback(hObject, eventdata, handles)
|
---|
2056 |
|
---|
2057 |
|
---|
2058 | %----------------------------------------------------------------
|
---|
2059 | % -- Executes on slider movement to set the color code
|
---|
2060 | %
|
---|
2061 | function slider1_Callback(hObject, eventdata, handles)
|
---|
2062 | %------------------------------------------------------------------
|
---|
2063 | slider1=get(handles.slider1,'Value');
|
---|
2064 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
2065 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
2066 | col=min_val+(max_val-min_val)*slider1;
|
---|
2067 | set(handles.colcode1,'String',num2str(col))
|
---|
2068 | if(get(handles.slider2,'Value') < col)%move also the second slider at the same value if needed
|
---|
2069 | set(handles.slider2,'Value',col)
|
---|
2070 | set(handles.colcode2,'String',num2str(col))
|
---|
2071 | end
|
---|
2072 | colcode1_Callback(hObject, eventdata, handles)
|
---|
2073 |
|
---|
2074 | %----------------------------------------------------------------
|
---|
2075 | % Executes on slider movement to set the color code
|
---|
2076 | %----------------------------------------------------------------
|
---|
2077 | function slider2_Callback(hObject, eventdata, handles)
|
---|
2078 | slider2=get(handles.slider2,'Value');
|
---|
2079 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
2080 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
2081 | col=min_val+(max_val-min_val)*slider2;
|
---|
2082 | set(handles.colcode2,'String',num2str(col))
|
---|
2083 | if(get(handles.slider1,'Value') > col)%move also the first slider at the same value if needed
|
---|
2084 | set(handles.slider1,'Value',col)
|
---|
2085 | set(handles.colcode1,'String',num2str(col))
|
---|
2086 | end
|
---|
2087 | colcode2_Callback(hObject, eventdata, handles)
|
---|
2088 |
|
---|
2089 | %----------------------------------------------------------------
|
---|
2090 | %execute on return carriage on the edit box corresponding to slider 1
|
---|
2091 | %----------------------------------------------------------------
|
---|
2092 | function colcode1_Callback(hObject, eventdata, handles)
|
---|
2093 | % col=str2num(get(handles.colcode1,'String'));
|
---|
2094 | % set(handles.slider1,'Value',col)
|
---|
2095 | set_vec_col_bar(handles)
|
---|
2096 | update_plot(handles)
|
---|
2097 |
|
---|
2098 | %----------------------------------------------------------------
|
---|
2099 | %execute on return carriage on the edit box corresponding to slider 2
|
---|
2100 | %----------------------------------------------------------------
|
---|
2101 | function colcode2_Callback(hObject, eventdata, handles)
|
---|
2102 | % col=str2num(get(handles.colcode2,'String'));
|
---|
2103 | % set(handles.slider2,'Value',col)
|
---|
2104 | % slider2_Callback(hObject, eventdata, handles)
|
---|
2105 | set_vec_col_bar(handles)
|
---|
2106 | update_plot(handles)
|
---|
2107 | %------------------------------------------------------------
|
---|
2108 | %update the slider values after displaying vectors
|
---|
2109 | %--------------------------------------------------------
|
---|
2110 | % function slider_update(handles,auto,minC,colcode1,colcode2,maxC)
|
---|
2111 | % set(handles.slider1,'Min',minC)
|
---|
2112 | % set(handles.slider1,'Max',maxC)
|
---|
2113 | % set(handles.slider2,'Min',minC)
|
---|
2114 | % set(handles.slider2,'Max',maxC)
|
---|
2115 | % set(handles.min_C_title_vec,'String',num2str(minC))
|
---|
2116 | % set(handles.max_vec,'String',num2str(maxC))
|
---|
2117 | % if auto
|
---|
2118 | % set(handles.colcode1,'String',num2str(colcode1,3))%update display
|
---|
2119 | % set(handles.colcode2,'String',num2str(colcode2,3))
|
---|
2120 | % end
|
---|
2121 | % set(handles.slider1,'Value',colcode1)%update slider with constant display
|
---|
2122 | % set(handles.slider2,'Value',colcode2)
|
---|
2123 | % set_vec_col_bar(handles)
|
---|
2124 |
|
---|
2125 |
|
---|
2126 | %-------------------------------------------------------
|
---|
2127 | % --- Executes on button press in AutoVecColor.
|
---|
2128 | %-------------------------------------------------------
|
---|
2129 | function vec_col_bar_Callback(hObject, eventdata, handles)
|
---|
2130 | set_vec_col_bar(handles)
|
---|
2131 |
|
---|
2132 | % %--------------------------------------------
|
---|
2133 | % %update the display of color code for vectors
|
---|
2134 | % %--------------------------------------------
|
---|
2135 | % function set_vec_col_bar(handles)
|
---|
2136 | % %get the image of the color display button 'vec_col_bar' in pixels
|
---|
2137 | % uni=get(handles.vec_col_bar,'Unit');
|
---|
2138 | % set(handles.vec_col_bar,'Unit','pixel')
|
---|
2139 | % pos_vert=get(handles.vec_col_bar,'Position');
|
---|
2140 | % set(handles.vec_col_bar,'Unit','Normalized')
|
---|
2141 | % width=ceil(pos_vert(3));
|
---|
2142 | % height=ceil(pos_vert(4));
|
---|
2143 | % %get slider indications
|
---|
2144 | % colcode.min=get(handles.slider1,'Min');
|
---|
2145 | % colcode.max=get(handles.slider1,'Max');
|
---|
2146 | % colcode.colcode1=get(handles.slider1,'Value');
|
---|
2147 | % colcode.colcode2=get(handles.slider2,'Value');
|
---|
2148 | % colcode.option=get(handles.vec_col_bar,'Value');
|
---|
2149 | % colcode.auto=1;
|
---|
2150 | % list_code=get(handles.col_vec,'String');% list menu fields
|
---|
2151 | % index_code=get(handles.col_vec,'Value');% selected string index
|
---|
2152 | % colcode.CName= list_code{index_code(1)}; % selected field used for vector color
|
---|
2153 | % vec_C=colcode.min+(colcode.max-colcode.min)*[0.5:width-0.5]/width;%sample of vec_C values from min to max
|
---|
2154 | % [colorlist,col_vec]=set_col_vec(colcode,vec_C);
|
---|
2155 | % oneheight=ones(1,height);
|
---|
2156 | % A1=colorlist(col_vec,1)*oneheight;
|
---|
2157 | % A2=colorlist(col_vec,2)*oneheight;
|
---|
2158 | % A3=colorlist(col_vec,3)*oneheight;
|
---|
2159 | % A(:,:,1)=A1';
|
---|
2160 | % A(:,:,2)=A2';
|
---|
2161 | % A(:,:,3)=A3';
|
---|
2162 | % set(handles.vec_col_bar,'Cdata',A)
|
---|
2163 |
|
---|
2164 |
|
---|
2165 | %------------------------------------------------
|
---|
2166 | %CALLBACKS FOR PLOTTING PARAMETERS
|
---|
2167 | %-------------------------------------------------
|
---|
2168 |
|
---|
2169 | %-----------------------------------------------------------------
|
---|
2170 | function MinA_Callback(hObject, eventdata, handles)
|
---|
2171 | %------------------------------------------
|
---|
2172 | set(handles.AutoScal,'Value',1) %suppress auto mode
|
---|
2173 | set(handles.AutoScal,'BackgroundColor',[1 1 0])
|
---|
2174 | update_plot(handles)
|
---|
2175 |
|
---|
2176 | %-----------------------------------------------------------------
|
---|
2177 | function MaxA_Callback(hObject, eventdata, handles)
|
---|
2178 | %--------------------------------------------
|
---|
2179 | set(handles.AutoScal,'Value',1) %suppress auto mode
|
---|
2180 | set(handles.AutoScal,'BackgroundColor',[1 1 0])
|
---|
2181 | update_plot(handles)
|
---|
2182 |
|
---|
2183 | %-----------------------------------------------
|
---|
2184 | function AutoScal_Callback(hObject, eventdata, handles)
|
---|
2185 | %--------------------------------------------
|
---|
2186 | test=get(handles.AutoScal,'Value');
|
---|
2187 | if test
|
---|
2188 | set(handles.AutoScal,'BackgroundColor',[1 1 0])
|
---|
2189 | else
|
---|
2190 | set(handles.AutoScal,'BackgroundColor',[0.7 0.7 0.7])
|
---|
2191 | update_plot(handles);
|
---|
2192 | % set(handles.MinA,'String',num2str(ScalOut.MinA,3))
|
---|
2193 | % set(handles.MaxA,'String',num2str(ScalOut.MaxA,3))
|
---|
2194 | end
|
---|
2195 |
|
---|
2196 | %-------------------------------------------------------------------
|
---|
2197 | function BW_Callback(hObject, eventdata, handles)
|
---|
2198 | %-------------------------------------------------------------------
|
---|
2199 | update_plot(handles)
|
---|
2200 |
|
---|
2201 | %-------------------------------------------------------------------
|
---|
2202 | function Contours_Callback(hObject, eventdata, handles)
|
---|
2203 | %-------------------------------------------------------------------
|
---|
2204 | val=get(handles.Contours,'Value');
|
---|
2205 | if val==2
|
---|
2206 | set(handles.interval_txt,'Visible','on')
|
---|
2207 | set(handles.IncrA,'Visible','on')
|
---|
2208 | else
|
---|
2209 | set(handles.interval_txt,'Visible','off')
|
---|
2210 | set(handles.IncrA,'Visible','off')
|
---|
2211 | end
|
---|
2212 | update_plot(handles)
|
---|
2213 |
|
---|
2214 | %-------------------------------------------------------------------
|
---|
2215 | function IncrA_Callback(hObject, eventdata, handles)
|
---|
2216 | %-------------------------------------------------------------------
|
---|
2217 | update_plot(handles)
|
---|
2218 |
|
---|
2219 | %-------------------------------------------------------------------
|
---|
2220 | function HideWarning_Callback(hObject, eventdata, handles)
|
---|
2221 | %-------------------------------------------------------------------
|
---|
2222 | update_plot(handles)
|
---|
2223 |
|
---|
2224 | %-------------------------------------------------------------------
|
---|
2225 | function HideFalse_Callback(hObject, eventdata, handles)
|
---|
2226 | %-------------------------------------------------------------------
|
---|
2227 | update_plot(handles)
|
---|
2228 |
|
---|
2229 | %-------------------------------------------------------------------
|
---|
2230 | function VecScale_Callback(hObject, eventdata, handles)
|
---|
2231 | %-------------------------------------------------------------------
|
---|
2232 | set(handles.AutoVec,'Value',1);
|
---|
2233 | set(handles.AutoVec,'BackgroundColor',[1 1 0])
|
---|
2234 | update_plot(handles)
|
---|
2235 |
|
---|
2236 | %-------------------------------------------------------------------
|
---|
2237 | function AutoVec_Callback(hObject, eventdata, handles)
|
---|
2238 | %-------------------------------------------------------------------
|
---|
2239 | test=get(handles.AutoVec,'Value');
|
---|
2240 | if test
|
---|
2241 | set(handles.AutoVec,'BackgroundColor',[1 1 0])
|
---|
2242 | else
|
---|
2243 | update_plot(handles);
|
---|
2244 | %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3))
|
---|
2245 | set(handles.AutoVec,'BackgroundColor',[0.7 0.7 0.7])
|
---|
2246 | end
|
---|
2247 |
|
---|
2248 | %-------------------------------------------------------
|
---|
2249 | % --- Executes on selection change in decimate4 (nb_vec/4).
|
---|
2250 | %-------------------------------------------------------
|
---|
2251 | function decimate4_Callback(hObject, eventdata, handles)
|
---|
2252 | update_plot(handles)
|
---|
2253 |
|
---|
2254 |
|
---|
2255 | %-------------------------------------------------------
|
---|
2256 | % --- Executes on selection change in color_code menu
|
---|
2257 | %-------------------------------------------------------
|
---|
2258 | function color_code_Callback(hObject, eventdata, handles)
|
---|
2259 | set_vec_col_bar(handles)
|
---|
2260 | update_plot(handles);
|
---|
2261 |
|
---|
2262 | %-------------------------------------------------------
|
---|
2263 | % --- Executes on button press in AutoVecColor.
|
---|
2264 | %-------------------------------------------------------
|
---|
2265 | function AutoVecColor_Callback(hObject, eventdata, handles)
|
---|
2266 | test=get(handles.AutoVecColor,'Value');
|
---|
2267 | if test
|
---|
2268 | set(handles.AutoVecColor,'BackgroundColor',[1 1 0])
|
---|
2269 | else
|
---|
2270 | update_plot(handles);
|
---|
2271 | %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3))
|
---|
2272 | set(handles.AutoVecColor,'BackgroundColor',[0.7 0.7 0.7])
|
---|
2273 | end
|
---|
2274 | %set_vec_col_bar(handles)
|
---|
2275 |
|
---|
2276 | %-------------------------------------------------------
|
---|
2277 | % --- Executes on selection change in max_vec.
|
---|
2278 | %-------------------------------------------------------
|
---|
2279 | function min_vec_Callback(hObject, eventdata, handles)
|
---|
2280 | max_vec_Callback(hObject, eventdata, handles)
|
---|
2281 |
|
---|
2282 | % --- Executes on selection change in max_vec.
|
---|
2283 | function max_vec_Callback(hObject, eventdata, handles)
|
---|
2284 | set(handles.AutoVecColor,'Value',1)
|
---|
2285 | AutoVecColor_Callback(hObject, eventdata, handles)
|
---|
2286 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
2287 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
2288 | slider1=get(handles.slider1,'Value');
|
---|
2289 | slider2=get(handles.slider2,'Value');
|
---|
2290 | colcode1=min_val+(max_val-min_val)*slider1;
|
---|
2291 | colcode2=min_val+(max_val-min_val)*slider2;
|
---|
2292 | set(handles.colcode1,'String',num2str(colcode1))
|
---|
2293 | set(handles.colcode2,'String',num2str(colcode2))
|
---|
2294 | update_plot(handles);
|
---|
2295 |
|
---|
2296 | %-------------------------------------------------------------------
|
---|
2297 | %update the display of color code for vectors
|
---|
2298 | function set_vec_col_bar(handles)
|
---|
2299 | %-------------------------------------------------------------------
|
---|
2300 | %get the image of the color display button 'vec_col_bar' in pixels
|
---|
2301 | set(handles.vec_col_bar,'Unit','pixel');
|
---|
2302 | pos_vert=get(handles.vec_col_bar,'Position');
|
---|
2303 | set(handles.vec_col_bar,'Unit','Normalized');
|
---|
2304 | width=ceil(pos_vert(3));
|
---|
2305 | height=ceil(pos_vert(4));
|
---|
2306 |
|
---|
2307 | %get slider indications
|
---|
2308 | list=get(handles.color_code,'String');
|
---|
2309 | ichoice=get(handles.color_code,'Value');
|
---|
2310 | colcode.ColorCode=list{ichoice};
|
---|
2311 | colcode.MinC=str2num(get(handles.min_vec,'String'));
|
---|
2312 | colcode.MaxC=str2num(get(handles.max_vec,'String'));
|
---|
2313 | test3color=strcmp(colcode.ColorCode,'rgb') || strcmp(colcode.ColorCode,'bgr');
|
---|
2314 | if test3color
|
---|
2315 | colcode.colcode1=str2num(get(handles.colcode1,'String'));
|
---|
2316 | colcode.colcode2=str2num(get(handles.colcode2,'String'));
|
---|
2317 | end
|
---|
2318 | % colcode.option=get(handles.vec_col_bar,'Value');
|
---|
2319 | colcode.FixedCbounds=0;
|
---|
2320 | % list_code=get(handles.col_vec,'String');% list menu fields
|
---|
2321 | % index_code=get(handles.col_vec,'Value');% selected string index
|
---|
2322 | % colcode.CName= list_code{index_code(1)}; % selected field used for vector color
|
---|
2323 | colcode.FixedCbounds=1;
|
---|
2324 | vec_C=colcode.MinC+(colcode.MaxC-colcode.MinC)*[0.5:width-0.5]/width;%sample of vec_C values from min to max
|
---|
2325 | [colorlist,col_vec]=set_col_vec(colcode,vec_C);
|
---|
2326 | oneheight=ones(1,height);
|
---|
2327 | A1=colorlist(col_vec,1)*oneheight;
|
---|
2328 | A2=colorlist(col_vec,2)*oneheight;
|
---|
2329 | A3=colorlist(col_vec,3)*oneheight;
|
---|
2330 | A(:,:,1)=A1';
|
---|
2331 | A(:,:,2)=A2';
|
---|
2332 | A(:,:,3)=A3';
|
---|
2333 | set(handles.vec_col_bar,'Cdata',A)
|
---|
2334 |
|
---|
2335 |
|
---|
2336 | %-------------------------------------------------------------------
|
---|
2337 | function [PlotType,ScalOut]=update_plot(handles)
|
---|
2338 | %-------------------------------------------------------------------
|
---|
2339 | haxes= handles.axes3;
|
---|
2340 | huvmat=findobj(allchild(0),'tag','uvmat');
|
---|
2341 | ProjField=get(haxes,'UserData');
|
---|
2342 | %
|
---|
2343 | % AxeData=get(haxes,'UserData');
|
---|
2344 | PlotParam=read_plot_param(handles);
|
---|
2345 | [PlotType,PlotParamOut]= plot_field(ProjField,haxes,PlotParam,1);
|
---|
2346 | write_plot_param(handles,PlotParamOut); %update the auto plot parameters
|
---|
2347 |
|
---|
2348 | %------------------------------------------------------
|
---|
2349 | % --- Executes on button press in Menu/Export/field in workspace.
|
---|
2350 | %------------------------------------------------------
|
---|
2351 | function MenuExportField_Callback(hObject, eventdata, handles)
|
---|
2352 |
|
---|
2353 | global CurData
|
---|
2354 | huvmat=findobj(allchild(0),'Name','uvmat');
|
---|
2355 | UvData=get(huvmat,'UserData');
|
---|
2356 | CurData=UvData.ProjField_2;
|
---|
2357 | evalin('base','global CurData')%make CurData global in the workspace
|
---|
2358 | display(['UserData of view_field :'])
|
---|
2359 | evalin('base','CurData') %display CurData in the workspace
|
---|
2360 | commandwindow;
|
---|
2361 |
|
---|
2362 | %------------------------------------------------------
|
---|
2363 | % --- Executes on button press in Menu/Export/extract figure.
|
---|
2364 | %------------------------------------------------------
|
---|
2365 | function MenuExport_plot_Callback(hObject, eventdata, handles)
|
---|
2366 | huvmat=get(handles.MenuExport_plot,'parent');
|
---|
2367 | UvData=get(huvmat,'UserData');
|
---|
2368 | hfig=figure;
|
---|
2369 | newaxes=copyobj(handles.axes3,hfig);
|
---|
2370 | map=colormap(handles.axes3);
|
---|
2371 | colormap(map);%transmit the current colormap to the zoom fig
|
---|
2372 | colorbar
|
---|
2373 |
|
---|
2374 |
|
---|
2375 |
|
---|
2376 | function npx_Callback(hObject, eventdata, handles)
|
---|
2377 |
|
---|
2378 |
|
---|
2379 |
|
---|
2380 | function npy_Callback(hObject, eventdata, handles)
|
---|
2381 |
|
---|
2382 |
|
---|
2383 | function edit86_Callback(hObject, eventdata, handles)
|
---|
2384 |
|
---|
2385 |
|
---|
2386 | function edit87_Callback(hObject, eventdata, handles)
|
---|
2387 |
|
---|
2388 |
|
---|
2389 | % --- Executes on button press in auto_sclar.
|
---|
2390 | function auto_sclar_Callback(hObject, eventdata, handles)
|
---|
2391 | % hObject handle to auto_sclar (see GCBO)
|
---|
2392 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2393 | % handles structure with handles and user data (see GUIDATA)
|
---|
2394 |
|
---|
2395 | % Hint: get(hObject,'Value') returns toggle state of auto_sclar
|
---|
2396 |
|
---|
2397 |
|
---|
2398 | function edit88_Callback(hObject, eventdata, handles)
|
---|
2399 |
|
---|
2400 |
|
---|
2401 |
|
---|
2402 | % --- Executes on button press in AutoScal.
|
---|
2403 | function checkbox40_Callback(hObject, eventdata, handles)
|
---|
2404 | % hObject handle to AutoScal (see GCBO)
|
---|
2405 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2406 | % handles structure with handles and user data (see GUIDATA)
|
---|
2407 |
|
---|
2408 | % Hint: get(hObject,'Value') returns toggle state of AutoScal
|
---|
2409 |
|
---|
2410 |
|
---|
2411 |
|
---|
2412 | function edit82_Callback(hObject, eventdata, handles)
|
---|
2413 |
|
---|
2414 |
|
---|
2415 |
|
---|
2416 | function edit83_Callback(hObject, eventdata, handles)
|
---|
2417 | % hObject handle to min_vec (see GCBO)
|
---|
2418 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2419 | % handles structure with handles and user data (see GUIDATA)
|
---|
2420 |
|
---|
2421 | % Hints: get(hObject,'String') returns contents of min_vec as text
|
---|
2422 | % str2double(get(hObject,'String')) returns contents of min_vec as a double
|
---|
2423 |
|
---|
2424 |
|
---|
2425 | % --- Executes on slider movement.
|
---|
2426 | function slider9_Callback(hObject, eventdata, handles)
|
---|
2427 | % hObject handle to slider2 (see GCBO)
|
---|
2428 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2429 | % handles structure with handles and user data (see GUIDATA)
|
---|
2430 |
|
---|
2431 | % Hints: get(hObject,'Value') returns position of slider
|
---|
2432 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
|
---|
2433 |
|
---|
2434 |
|
---|
2435 | % --- Executes on slider movement.
|
---|
2436 | function slider10_Callback(hObject, eventdata, handles)
|
---|
2437 | % hObject handle to slider1 (see GCBO)
|
---|
2438 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2439 | % handles structure with handles and user data (see GUIDATA)
|
---|
2440 |
|
---|
2441 | % Hints: get(hObject,'Value') returns position of slider
|
---|
2442 | % get(hObject,'Min') and get(hObject,'Max') to determine range of
|
---|
2443 | % slider
|
---|
2444 |
|
---|
2445 |
|
---|
2446 | % --- Executes on button press in AutoVecColor.
|
---|
2447 | function checkbox41_Callback(hObject, eventdata, handles)
|
---|
2448 | % hObject handle to AutoVecColor (see GCBO)
|
---|
2449 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2450 | % handles structure with handles and user data (see GUIDATA)
|
---|
2451 |
|
---|
2452 | % Hint: get(hObject,'Value') returns toggle state of AutoVecColor
|
---|
2453 |
|
---|
2454 |
|
---|
2455 | function edit89_Callback(hObject, eventdata, handles)
|
---|
2456 | % hObject handle to max_vec (see GCBO)
|
---|
2457 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2458 | % handles structure with handles and user data (see GUIDATA)
|
---|
2459 |
|
---|
2460 | % Hints: get(hObject,'String') returns contents of max_vec as text
|
---|
2461 | % str2double(get(hObject,'String')) returns contents of max_vec as a double
|
---|
2462 |
|
---|
2463 |
|
---|
2464 | function edit90_Callback(hObject, eventdata, handles)
|
---|
2465 | % hObject handle to colcode2 (see GCBO)
|
---|
2466 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2467 | % handles structure with handles and user data (see GUIDATA)
|
---|
2468 |
|
---|
2469 | % Hints: get(hObject,'String') returns contents of colcode2 as text
|
---|
2470 | % str2double(get(hObject,'String')) returns contents of colcode2 as a double
|
---|
2471 |
|
---|
2472 |
|
---|
2473 |
|
---|
2474 |
|
---|
2475 | function closefcn(hObject, eventdata, handles)
|
---|
2476 | huvmat=findobj(allchild(0),'Name','uvmat');
|
---|
2477 | hhuvmat=guidata(huvmat);
|
---|
2478 | list_object_2=get(hhuvmat.list_object_2,'String');
|
---|
2479 | set(hhuvmat.list_object_2,'Value',numel(list_object_2))%select the last value ('...')
|
---|
2480 | delete(hObject)
|
---|
2481 |
|
---|
2482 |
|
---|
2483 |
|
---|
2484 | % --- Executes on button press in checkbox42.
|
---|
2485 | function checkbox42_Callback(hObject, eventdata, handles)
|
---|
2486 | % hObject handle to checkbox42 (see GCBO)
|
---|
2487 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2488 | % handles structure with handles and user data (see GUIDATA)
|
---|
2489 |
|
---|
2490 | % Hint: get(hObject,'Value') returns toggle state of checkbox42
|
---|
2491 |
|
---|
2492 |
|
---|
2493 | % --- Executes on button press in checkbox43.
|
---|
2494 | function checkbox43_Callback(hObject, eventdata, handles)
|
---|
2495 | % hObject handle to checkbox43 (see GCBO)
|
---|
2496 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2497 | % handles structure with handles and user data (see GUIDATA)
|
---|
2498 |
|
---|
2499 | % Hint: get(hObject,'Value') returns toggle state of checkbox43
|
---|
2500 |
|
---|
2501 |
|
---|
2502 | % --- Executes on button press in checkbox44.
|
---|
2503 | function checkbox44_Callback(hObject, eventdata, handles)
|
---|
2504 | % hObject handle to checkbox44 (see GCBO)
|
---|
2505 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2506 | % handles structure with handles and user data (see GUIDATA)
|
---|
2507 |
|
---|
2508 | % Hint: get(hObject,'Value') returns toggle state of checkbox44
|
---|
2509 |
|
---|
2510 |
|
---|
2511 | % --- Executes on selection change in popupmenu18.
|
---|
2512 | function popupmenu18_Callback(hObject, eventdata, handles)
|
---|
2513 |
|
---|
2514 |
|
---|
2515 | function edit91_Callback(hObject, eventdata, handles)
|
---|
2516 | % hObject handle to edit91 (see GCBO)
|
---|
2517 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2518 | % handles structure with handles and user data (see GUIDATA)
|
---|
2519 |
|
---|
2520 | % Hints: get(hObject,'String') returns contents of edit91 as text
|
---|
2521 | % str2double(get(hObject,'String')) returns contents of edit91 as a double
|
---|
2522 |
|
---|
2523 |
|
---|
2524 | % --- Executes on button press in checkbox45.
|
---|
2525 | function checkbox45_Callback(hObject, eventdata, handles)
|
---|
2526 | % hObject handle to checkbox45 (see GCBO)
|
---|
2527 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2528 | % handles structure with handles and user data (see GUIDATA)
|
---|
2529 |
|
---|
2530 | % Hint: get(hObject,'Value') returns toggle state of checkbox45
|
---|
2531 |
|
---|
2532 |
|
---|
2533 | % --- Executes on selection change in popupmenu19.
|
---|
2534 | function popupmenu19_Callback(hObject, eventdata, handles)
|
---|
2535 | % hObject handle to popupmenu19 (see GCBO)
|
---|
2536 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2537 | % handles structure with handles and user data (see GUIDATA)
|
---|
2538 |
|
---|
2539 | % Hints: contents = get(hObject,'String') returns popupmenu19 contents as cell array
|
---|
2540 | % contents{get(hObject,'Value')} returns selected item from popupmenu19
|
---|
2541 |
|
---|
2542 |
|
---|
2543 |
|
---|
2544 |
|
---|
2545 |
|
---|
2546 |
|
---|
2547 |
|
---|
2548 | function text_display_Callback(hObject, eventdata, handles)
|
---|
2549 | % hObject handle to text_display (see GCBO)
|
---|
2550 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2551 | % handles structure with handles and user data (see GUIDATA)
|
---|
2552 |
|
---|
2553 | % Hints: get(hObject,'String') returns contents of text_display as text
|
---|
2554 | % str2double(get(hObject,'String')) returns contents of text_display as a double
|
---|
2555 |
|
---|
2556 |
|
---|
2557 | % --- Executes during object creation, after setting all properties.
|
---|
2558 | function text_display_CreateFcn(hObject, eventdata, handles)
|
---|
2559 | % hObject handle to text_display (see GCBO)
|
---|
2560 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
2561 | % handles empty - handles not created until after all CreateFcns called
|
---|
2562 |
|
---|
2563 | % Hint: edit controls usually have a white background on Windows.
|
---|
2564 | % See ISPC and COMPUTER.
|
---|
2565 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
2566 | set(hObject,'BackgroundColor','white');
|
---|
2567 | end
|
---|
2568 |
|
---|
2569 |
|
---|