1 | %'series': master function associated to the GUI series.m for analysis field series |
---|
2 | %------------------------------------------------------------------------ |
---|
3 | % function varargout = series(varargin) |
---|
4 | % associated with the GUI series.fig |
---|
5 | % |
---|
6 | %INPUT |
---|
7 | % param: structure with input parameters (link with the GUI uvmat) |
---|
8 | % .menu_coord_str: string for the transform_fct (menu for coordinate transforms) |
---|
9 | % .menu_coord_val: value for transform_fct (menu for coordinate transforms) |
---|
10 | % .FileName: input file name |
---|
11 | % .FileName_1: second input file name |
---|
12 | % .list_field: menu of input fields |
---|
13 | % .index_fields: chosen index |
---|
14 | % .civ1=0 or 1, .interp1, ... : input civ field type |
---|
15 | % |
---|
16 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
17 | % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. |
---|
18 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
19 | % This file is part of the toolbox UVMAT. |
---|
20 | % |
---|
21 | % UVMAT is free software; you can redistribute it and/or modify |
---|
22 | % it under the terms of the GNU General Public License as published by |
---|
23 | % the Free Software Foundation; either version 2 of the License, or |
---|
24 | % (at your option) any later version. |
---|
25 | % |
---|
26 | % UVMAT is distributed in the hope that it will be useful, |
---|
27 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
28 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
29 | % GNU General Public License (file UVMAT/COPYING.txt) for more details. |
---|
30 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
31 | |
---|
32 | function varargout = series(varargin) |
---|
33 | |
---|
34 | % Begin initialization code - DO NOT EDIT |
---|
35 | gui_Singleton = 1; |
---|
36 | gui_State = struct('gui_Name', mfilename, ... |
---|
37 | 'gui_Singleton', gui_Singleton, ... |
---|
38 | 'gui_OpeningFcn', @series_OpeningFcn, ... |
---|
39 | 'gui_OutputFcn', @series_OutputFcn, ... |
---|
40 | 'gui_LayoutFcn', [] , ... |
---|
41 | 'gui_Callback', []); |
---|
42 | if nargin && ischar(varargin{1}) |
---|
43 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
44 | end |
---|
45 | |
---|
46 | if nargout |
---|
47 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
48 | else |
---|
49 | gui_mainfcn(gui_State, varargin{:}); |
---|
50 | end |
---|
51 | % End initialization code - DO NOT EDIT |
---|
52 | |
---|
53 | %-------------------------------------------------------------------------- |
---|
54 | % --- Executes just before series is made visible. |
---|
55 | %-------------------------------------------------------------------------- |
---|
56 | function series_OpeningFcn(hObject, eventdata, handles,param) |
---|
57 | global nb_builtin_ACTION nb_builtin_transform |
---|
58 | % Choose default command line output for series |
---|
59 | handles.output = hObject; |
---|
60 | % Update handles structure |
---|
61 | guidata(hObject, handles); |
---|
62 | %default initial parameters |
---|
63 | drawnow |
---|
64 | set(hObject,'Units','pixels') |
---|
65 | % set(0,'Units','pixels') |
---|
66 | % screensize=get(0,'ScreenSize'); %screen size in pixels |
---|
67 | set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display) |
---|
68 | %set(hObject,'Position',[150 100 1000 600] );%position and size in pixels (get adjusted to the screen size in case of excess) |
---|
69 | %load the list of previously browsed files in menus Open and Open_1 |
---|
70 | dir_perso=prefdir; |
---|
71 | test_profil_perso=0; |
---|
72 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
73 | if exist(profil_perso,'file') |
---|
74 | h=load (profil_perso); |
---|
75 | test_profil_perso=1; |
---|
76 | if isfield(h,'MenuFile_1') |
---|
77 | set(handles.MenuFile_1,'Label',h.MenuFile_1); |
---|
78 | set(handles.MenuFile_insert_1,'Label',h.MenuFile_1); |
---|
79 | end |
---|
80 | if isfield(h,'MenuFile_1') |
---|
81 | set(handles.MenuFile_2,'Label',h.MenuFile_2); |
---|
82 | set(handles.MenuFile_insert_2,'Label',h.MenuFile_2); |
---|
83 | end |
---|
84 | if isfield(h,'MenuFile_1') |
---|
85 | set(handles.MenuFile_3,'Label',h.MenuFile_3); |
---|
86 | set(handles.MenuFile_insert_3,'Label',h.MenuFile_3); |
---|
87 | end |
---|
88 | if isfield(h,'MenuFile_1') |
---|
89 | set(handles.MenuFile_4,'Label',h.MenuFile_4); |
---|
90 | set(handles.MenuFile_insert_4,'Label',h.MenuFile_4); |
---|
91 | end |
---|
92 | if isfield(h,'MenuFile_1') |
---|
93 | set(handles.MenuFile_5,'Label',h.MenuFile_5); |
---|
94 | set(handles.MenuFile_insert_5,'Label',h.MenuFile_5); |
---|
95 | end |
---|
96 | end |
---|
97 | |
---|
98 | %check default input data |
---|
99 | if ~exist('param','var') |
---|
100 | param=[]; %default |
---|
101 | end |
---|
102 | |
---|
103 | %file name and browser initialisation |
---|
104 | if isfield(param,'menu_coord_str') |
---|
105 | set(handles.transform_fct,'String',param.menu_coord_str) |
---|
106 | end |
---|
107 | if isfield(param,'menu_coord_val') |
---|
108 | set(handles.transform_fct,'Value',param.menu_coord_val); |
---|
109 | else |
---|
110 | set(handles.transform_fct,'Value',1);%default |
---|
111 | end |
---|
112 | |
---|
113 | if isfield(param,'FileName') |
---|
114 | if isfield(param,'FileName_1') |
---|
115 | update_rootfile(handles,param.FileName_1,0) |
---|
116 | update_rootfile(handles,param.FileName,1) |
---|
117 | else |
---|
118 | update_rootfile(handles,param.FileName,0) |
---|
119 | end |
---|
120 | end |
---|
121 | |
---|
122 | %fields input initialisation |
---|
123 | if isfield(param,'list_fields')&& isfield(param,'index_fields') &&~isempty(param.list_fields) &&~isempty(param.index_fields) |
---|
124 | set(handles.FieldMenu,'String',param.list_fields);% list menu fields |
---|
125 | set(handles.FieldMenu,'Value',param.index_fields);% selected string index |
---|
126 | FieldCell{1}=param.list_fields{param.index_fields}; |
---|
127 | end |
---|
128 | % NomType_Callback(hObject, eventdata, handles) |
---|
129 | REFRESH_INDICES_Callback(hObject, eventdata, handles) |
---|
130 | %loads the information stored in prefdir to initiate the list of ACTION functions |
---|
131 | fct_menu={'check_data_files';'aver_stat';'time_series';'merge_proj';'clean_civ_cmx'}; |
---|
132 | transform_menu={'';'phys';'px';'phys_polar'}; |
---|
133 | nb_builtin_ACTION=numel(fct_menu); %number of functions |
---|
134 | nb_transform=numel(transform_menu); |
---|
135 | [path_series,name,ext]=fileparts(which('series')); |
---|
136 | path_series=fullfile(path_series,'series');%path of the function 'series' |
---|
137 | addpath (path_series) ; %add the path to UVMAT, (useful in case of change of working directory after civ has been s opened in the working directory) |
---|
138 | path_transform=fullfile(path_series,'transform_field');%path to the field transform functions |
---|
139 | for ilist=1:length(fct_menu) |
---|
140 | fct_path{ilist,1}=path_series;%paths of the fuctions buil-in in 'series.m' |
---|
141 | end |
---|
142 | |
---|
143 | %TRANSFORM menu: loads the information stored in prefdir to initiate the list of field transform functions |
---|
144 | menu_str={'';'phys';'px';'phys_polar'}; |
---|
145 | nb_builtin_transform=numel(menu_str); %number of functions |
---|
146 | [path_uvmat,name,ext]=fileparts(which('uvmat')); |
---|
147 | addpath(fullfile(path_uvmat,'transform_field')) |
---|
148 | fct_handle{1,1}=[]; |
---|
149 | testexist(1)=1; |
---|
150 | for ilist=2:length(menu_str) |
---|
151 | if exist(menu_str{ilist},'file') |
---|
152 | fct_handle{ilist,1}=str2func(menu_str{ilist}); |
---|
153 | testexist(ilist)=1; |
---|
154 | else |
---|
155 | testexist(ilist)=0; |
---|
156 | end |
---|
157 | end |
---|
158 | rmpath(fullfile(path_uvmat,'transform_field')) |
---|
159 | |
---|
160 | % read the list of functions stored in the personal file 'uvmat_perso.mat' in prefdir |
---|
161 | if test_profil_perso |
---|
162 | if isfield(h,'series_fct') && iscell(h.series_fct) |
---|
163 | for ilist=1:length(h.series_fct) |
---|
164 | [path,file]=fileparts(h.series_fct{ilist}); |
---|
165 | fct_path=[fct_path; {path}];%concatene the list of paths |
---|
166 | fct_menu=[fct_menu; {file}]; |
---|
167 | end |
---|
168 | end |
---|
169 | if isfield(h,'transform_fct') && iscell(h.transform_fct) |
---|
170 | for ilist=1:length(h.transform_fct); |
---|
171 | [path,file]=fileparts(h.transform_fct{ilist}); |
---|
172 | addpath(path) |
---|
173 | if exist(file,'file') |
---|
174 | h_func=str2func(file); |
---|
175 | testexist=[testexist 1]; |
---|
176 | else |
---|
177 | h_func=[]; |
---|
178 | testexist=[testexist 0]; |
---|
179 | end |
---|
180 | fct_handle=[fct_handle; {h_func}];%concatene the list of paths |
---|
181 | rmpath(path) |
---|
182 | menu_str=[menu_str; {file}]; |
---|
183 | end |
---|
184 | end |
---|
185 | end |
---|
186 | fct_menu=[fct_menu;{'more...'}]; |
---|
187 | set(handles.ACTION,'String',fct_menu) |
---|
188 | set(handles.ACTION,'UserData',fct_path)% store the list of path in UserData of ACTION |
---|
189 | |
---|
190 | menu_str=menu_str(find(testexist)); |
---|
191 | fct_handle=fct_handle(find(testexist)); |
---|
192 | menu_str=[menu_str;{'more...'}]; |
---|
193 | set(handles.transform_fct,'String',menu_str) |
---|
194 | set(handles.transform_fct,'UserData',fct_handle)% store the list of path in UserData of ACTION |
---|
195 | |
---|
196 | % display the GUI for the default action 'check_data_files' |
---|
197 | ACTION_Callback(hObject, eventdata, handles) |
---|
198 | |
---|
199 | %-------------------------------------------------------------- |
---|
200 | % --- Outputs from this function are returned to the command line. |
---|
201 | %----------------------------------------------------------------- |
---|
202 | function varargout = series_OutputFcn(hObject, eventdata, handles) |
---|
203 | % varargout cell array for returning output args (see VARARGOUT); |
---|
204 | % hObject handle to figure |
---|
205 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
206 | % handles structure with handles and user data (see GUIDATA) |
---|
207 | % Get default command line output from handles structure |
---|
208 | varargout{1} = handles.output; |
---|
209 | |
---|
210 | |
---|
211 | % -------------------------------------------------------------------- |
---|
212 | function MenuBrowse_Callback(hObject, eventdata, handles) |
---|
213 | InputTable=get(handles.InputTable,'Data'); |
---|
214 | RootPathCell=InputTable(:,1); |
---|
215 | SubDirCell=InputTable(:,2); |
---|
216 | RootFileCell=InputTable(:,3); |
---|
217 | %RootPathCell=get(handles.RootPath,'String'); |
---|
218 | %SubDirCell=get(handles.SubDir,'String'); |
---|
219 | %RootFileCell=get(handles.RootFile,'String'); |
---|
220 | oldfile=''; %default |
---|
221 | if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box |
---|
222 | dir_perso=prefdir; |
---|
223 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
224 | if exist(profil_perso,'file') |
---|
225 | h=load (profil_perso); |
---|
226 | if isfield(h,'filebase')&&ischar(h.filebase) |
---|
227 | oldfile=h.filebase; |
---|
228 | end |
---|
229 | if isfield(h,'RootPath')&&ischar(h.RootPath) |
---|
230 | oldfile=h.RootPath; |
---|
231 | end |
---|
232 | end |
---|
233 | else |
---|
234 | oldfile=fullfile(RootPathCell{1},SubDirCell{1},RootFileCell{1}); |
---|
235 | end |
---|
236 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
237 | {'*.xml;*.xls;*.png;*.tif;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png,*.tif, *.avi,*.nc)'; |
---|
238 | '*.xml', '.xml files '; ... |
---|
239 | '*.xls', '.xls files '; ... |
---|
240 | '*.png','.png image files'; ... |
---|
241 | '*.tif','.tif image files'; ... |
---|
242 | '*.avi;*.AVI','.avi movie files'; ... |
---|
243 | '*.nc','.netcdf files'; ... |
---|
244 | '*.*', 'All Files (*.*)'}, ... |
---|
245 | 'Pick a file',oldfile); |
---|
246 | fileinput=[PathName FileName];%complete file name |
---|
247 | %testblank=findstr(fileinput,' ');%look for blanks |
---|
248 | % if ~isempty(testblank) |
---|
249 | % errordlg('forbidden input file name: contain blanks') |
---|
250 | % return |
---|
251 | % end |
---|
252 | sizf=size(fileinput); |
---|
253 | if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end |
---|
254 | [path,name,ext]=fileparts(fileinput); |
---|
255 | SeriesData=[];%dfault |
---|
256 | if isequal(ext,'.xml') |
---|
257 | warndlg_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
258 | elseif isequal(ext,'.xls') |
---|
259 | warndlg_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
260 | else |
---|
261 | update_rootfile(handles,fileinput,0) |
---|
262 | %update list of recent files in the menubar |
---|
263 | MenuFile_1=fileinput; |
---|
264 | MenuFile_2=get(handles.MenuFile_1,'Label'); |
---|
265 | MenuFile_3=get(handles.MenuFile_2,'Label'); |
---|
266 | MenuFile_4=get(handles.MenuFile_3,'Label'); |
---|
267 | MenuFile_5=get(handles.MenuFile_4,'Label'); |
---|
268 | set(handles.MenuFile_1,'Label',MenuFile_1) |
---|
269 | set(handles.MenuFile_2,'Label',MenuFile_2) |
---|
270 | set(handles.MenuFile_3,'Label',MenuFile_3) |
---|
271 | set(handles.MenuFile_4,'Label',MenuFile_4) |
---|
272 | set(handles.MenuFile_5,'Label',MenuFile_5) |
---|
273 | set(handles.MenuFile_insert_1,'Label',MenuFile_1) |
---|
274 | set(handles.MenuFile_insert_2,'Label',MenuFile_2) |
---|
275 | set(handles.MenuFile_insert_3,'Label',MenuFile_3) |
---|
276 | set(handles.MenuFile_insert_4,'Label',MenuFile_4) |
---|
277 | set(handles.MenuFile_insert_5,'Label',MenuFile_5) |
---|
278 | dir_perso=prefdir; |
---|
279 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
280 | if exist(profil_perso,'file') |
---|
281 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat |
---|
282 | else |
---|
283 | txt=ver('MATLAB'); |
---|
284 | Release=txt.Release; |
---|
285 | relnumb=str2num(Release(3:4)); |
---|
286 | if relnumb >= 14 |
---|
287 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat |
---|
288 | else |
---|
289 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat |
---|
290 | end |
---|
291 | end |
---|
292 | end |
---|
293 | |
---|
294 | |
---|
295 | % -------------------------------------------------------------------- |
---|
296 | function MenuFile_1_Callback(hObject, eventdata, handles) |
---|
297 | fileinput=get(handles.MenuFile_1,'Label'); |
---|
298 | update_rootfile(handles,fileinput,0) |
---|
299 | |
---|
300 | % -------------------------------------------------------------------- |
---|
301 | function MenuFile_2_Callback(hObject, eventdata, handles) |
---|
302 | fileinput=get(handles.MenuFile_2,'Label'); |
---|
303 | update_rootfile(handles,fileinput,0) |
---|
304 | |
---|
305 | % -------------------------------------------------------------------- |
---|
306 | function MenuFile_3_Callback(hObject, eventdata, handles) |
---|
307 | fileinput=get(handles.MenuFile_3,'Label'); |
---|
308 | update_rootfile( handles,fileinput,0) |
---|
309 | |
---|
310 | % -------------------------------------------------------------------- |
---|
311 | function MenuFile_4_Callback(hObject, eventdata, handles) |
---|
312 | fileinput=get(handles.MenuFile_4,'Label'); |
---|
313 | update_rootfile(handles,fileinput,0) |
---|
314 | |
---|
315 | % -------------------------------------------------------------------- |
---|
316 | function MenuFile_5_Callback(hObject, eventdata, handles) |
---|
317 | fileinput=get(handles.MenuFile_5,'Label'); |
---|
318 | update_rootfile(handles,fileinput,0) |
---|
319 | |
---|
320 | % -------------------------------------------------------------------- |
---|
321 | function MenuBrowse_insert_Callback(hObject, eventdata, handles) |
---|
322 | InputTable=get(handles.InputTable,'Data'); |
---|
323 | RootPathCell=InputTable(:,1); |
---|
324 | SubDirCell=InputTable(:,3); |
---|
325 | RootFileCell=InputTable(:,2); |
---|
326 | % RootPathCell=get(handles.RootPath,'String'); |
---|
327 | % RootFileCell=get(handles.RootFile,'String'); |
---|
328 | oldfile=''; %default |
---|
329 | if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box |
---|
330 | dir_perso=prefdir; |
---|
331 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
332 | if exist(profil_perso,'file') |
---|
333 | h=load (profil_perso); |
---|
334 | if isfield(h,'filebase')&ischar(h.filebase) |
---|
335 | oldfile=h.filebase; |
---|
336 | end |
---|
337 | if isfield(h,'RootPath')&ischar(h.RootPath) |
---|
338 | oldfile=h.RootPath; |
---|
339 | end |
---|
340 | end |
---|
341 | else |
---|
342 | oldfile=fullfile(RootPathCell{1},RootFileCell{1}); |
---|
343 | end |
---|
344 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
345 | {'*.xml;*.xls;*.png;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png, *.avi,*.nc)'; |
---|
346 | '*.xml', '.xml files '; ... |
---|
347 | '*.xls', '.xls files '; ... |
---|
348 | '*.png','.png image files'; ... |
---|
349 | '*.avi;*.AVI','.avi movie files'; ... |
---|
350 | '*.nc','.netcdf files'; ... |
---|
351 | '*.*', 'All Files (*.*)'}, ... |
---|
352 | 'Pick a file',oldfile); |
---|
353 | fileinput=[PathName FileName];%complete file name |
---|
354 | % testblank=findstr(fileinput,' ');%look for blanks |
---|
355 | % if ~isempty(testblank) |
---|
356 | % errordlg('forbidden input file name: contain blanks') |
---|
357 | % return |
---|
358 | % end |
---|
359 | sizf=size(fileinput); |
---|
360 | if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end |
---|
361 | [path,name,ext]=fileparts(fileinput); |
---|
362 | SeriesData=[];%dfault |
---|
363 | if isequal(ext,'.xml') |
---|
364 | msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
365 | elseif isequal(ext,'.xls') |
---|
366 | msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
367 | else |
---|
368 | update_rootfile(handles,fileinput,1) |
---|
369 | %update list of recent files in the menubar |
---|
370 | MenuFile_1=fileinput; |
---|
371 | MenuFile_2=get(handles.MenuFile_1,'Label'); |
---|
372 | MenuFile_3=get(handles.MenuFile_2,'Label'); |
---|
373 | MenuFile_4=get(handles.MenuFile_3,'Label'); |
---|
374 | MenuFile_5=get(handles.MenuFile_4,'Label'); |
---|
375 | set(handles.MenuFile_1,'Label',MenuFile_1) |
---|
376 | set(handles.MenuFile_2,'Label',MenuFile_2) |
---|
377 | set(handles.MenuFile_3,'Label',MenuFile_3) |
---|
378 | set(handles.MenuFile_4,'Label',MenuFile_4) |
---|
379 | set(handles.MenuFile_5,'Label',MenuFile_5) |
---|
380 | set(handles.MenuFile_insert_1,'Label',MenuFile_1) |
---|
381 | set(handles.MenuFile_insert_2,'Label',MenuFile_2) |
---|
382 | set(handles.MenuFile_insert_3,'Label',MenuFile_3) |
---|
383 | set(handles.MenuFile_insert_4,'Label',MenuFile_4) |
---|
384 | set(handles.MenuFile_insert_5,'Label',MenuFile_5) |
---|
385 | dir_perso=prefdir; |
---|
386 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
387 | if exist(profil_perso,'file') |
---|
388 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat |
---|
389 | else |
---|
390 | txt=ver('MATLAB'); |
---|
391 | Release=txt.Release; |
---|
392 | relnumb=str2num(Release(3:4)); |
---|
393 | if relnumb >= 14 |
---|
394 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat |
---|
395 | else |
---|
396 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat |
---|
397 | end |
---|
398 | end |
---|
399 | end |
---|
400 | %------------------------------------------------ |
---|
401 | |
---|
402 | % -------------------------------------------------------------------- |
---|
403 | function MenuFile_insert_1_Callback(hObject, eventdata, handles) |
---|
404 | fileinput=get(handles.MenuFile_insert_1,'Label'); |
---|
405 | update_rootfile(handles,fileinput,1) |
---|
406 | |
---|
407 | % -------------------------------------------------------------------- |
---|
408 | function MenuFile_insert_2_Callback(hObject, eventdata, handles) |
---|
409 | fileinput=get(handles.MenuFile_insert_2,'Label'); |
---|
410 | update_rootfile(handles,fileinput,1) |
---|
411 | |
---|
412 | % -------------------------------------------------------------------- |
---|
413 | function MenuFile_insert_3_Callback(hObject, eventdata, handles) |
---|
414 | fileinput=get(handles.MenuFile_insert_3,'Label'); |
---|
415 | update_rootfile( handles,fileinput,1) |
---|
416 | |
---|
417 | % -------------------------------------------------------------------- |
---|
418 | function MenuFile_insert_4_Callback(hObject, eventdata, handles) |
---|
419 | fileinput=get(handles.MenuFile_insert_4,'Label'); |
---|
420 | update_rootfile( handles,fileinput,1) |
---|
421 | |
---|
422 | % -------------------------------------------------------------------- |
---|
423 | function MenuFile_insert_5_Callback(hObject, eventdata, handles) |
---|
424 | fileinput=get(handles.MenuFile_insert_5,'Label'); |
---|
425 | update_rootfile(handles,fileinput,1) |
---|
426 | |
---|
427 | %------------------------------------------------------------------------ |
---|
428 | % --- refresh the GUI data after introduction of a new file series |
---|
429 | % INPUT: |
---|
430 | % handles: |
---|
431 | % fileinput: name of the input file |
---|
432 | % addtest: =0 to refresh the list of file series, =1 to append a new series to the list (from the menu bar option 'Open_insert') |
---|
433 | function update_rootfile(handles,fileinput,addtest) |
---|
434 | %------------------------------------------------------------------------ |
---|
435 | |
---|
436 | %% enable other menus and uicontrols |
---|
437 | set(handles.MenuOpen_insert,'Enable','on') |
---|
438 | set(handles.MenuFile_insert_1,'Enable','on') |
---|
439 | set(handles.MenuFile_insert_2,'Enable','on') |
---|
440 | set(handles.MenuFile_insert_3,'Enable','on') |
---|
441 | set(handles.MenuFile_insert_4,'Enable','on') |
---|
442 | set(handles.MenuFile_insert_5,'Enable','on') |
---|
443 | set(handles.RUN, 'Enable','On') |
---|
444 | set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red |
---|
445 | % set(handles.RootPath,'BackgroundColor',[1 1 0]) % set RootPath edit box to yellow |
---|
446 | set(handles.InputTable,'BackgroundColor',[1 1 0]) % set RootPath edit box to yellow |
---|
447 | drawnow |
---|
448 | |
---|
449 | %% get the input root name, indices, file extension and nomenclature NomType |
---|
450 | if ~exist(fileinput,'file') |
---|
451 | msgbox_uvmat('ERROR',['input file ' fileinput ' does not exist']) |
---|
452 | return |
---|
453 | end |
---|
454 | [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomType]=fileparts_uvmat(fileinput); |
---|
455 | |
---|
456 | %% determine reference field indices |
---|
457 | ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV |
---|
458 | if ~isempty(i1) |
---|
459 | ref_i=i1; |
---|
460 | if ~isempty(i2) |
---|
461 | ref_i=floor((ref_i+i2)/2);% reference image number corresponding to the file |
---|
462 | % SeriesData.browse_Di=i2-i1; |
---|
463 | end |
---|
464 | end |
---|
465 | set(handles.ref_i,'String',num2str(ref_i)); |
---|
466 | set(handles.num_first_i,'String',num2str(ref_i)); |
---|
467 | set(handles.num_last_i,'String',num2str(ref_i)); |
---|
468 | ref_j=1; %default ref_j is a reference frame index used to find existing pairs from PIV |
---|
469 | if ~isempty(j1) |
---|
470 | ref_j=j1; |
---|
471 | if ~isempty(j2) |
---|
472 | ref_j=floor((j1+j2)/2); |
---|
473 | % SeriesData.browse_Dj=j2-j1; |
---|
474 | end |
---|
475 | end |
---|
476 | set(handles.ref_j,'String',num2str(ref_j)); |
---|
477 | set(handles.num_first_j,'String',num2str(ref_j)) |
---|
478 | set(handles.num_last_j,'String',num2str(ref_j)); |
---|
479 | TimeUnit=''; %default |
---|
480 | time=[];%default |
---|
481 | |
---|
482 | % read timing and total frame number from the current file (movie files) !! may be overrid by xml file |
---|
483 | FileBase=fullfile(RootPath,RootFile); |
---|
484 | |
---|
485 | testima=0; %test for image input |
---|
486 | if isequal(lower(FileExt),'.avi') %.avi file |
---|
487 | testima=1; |
---|
488 | elseif ~isempty(imformats(FileExt(2:end))) |
---|
489 | testima=1; |
---|
490 | elseif isequal(FileExt,'.vol') |
---|
491 | testima=1; |
---|
492 | end |
---|
493 | |
---|
494 | %% fill the list of file series |
---|
495 | |
---|
496 | % insert the current file series at the head of the list |
---|
497 | InputTable=get(handles.InputTable,'Data'); |
---|
498 | if addtest %insert the new data at the first line of the table |
---|
499 | val=size(InputTable,1)+1; |
---|
500 | InputTable(val,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; |
---|
501 | check_lines=get(handles.REFRESH_INDICES,'UserData'); |
---|
502 | else % or re-initialise the list of input file series |
---|
503 | val=1; |
---|
504 | InputTable=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}] |
---|
505 | set(handles.TimeTable,'Data',[{[]},{[]},{[]},{[]}]) |
---|
506 | set(handles.MinIndex,'Data',[{[]},{[]}]) |
---|
507 | set(handles.MaxIndex,'Data',[{[]},{[]}]) |
---|
508 | end |
---|
509 | set(handles.InputTable,'Data',InputTable) |
---|
510 | check_lines(val)=1; %select the edited line for refresh |
---|
511 | set(handles.REFRESH_INDICES,'UserData',check_lines); |
---|
512 | REFRESH_INDICES_Callback([],[], handles) |
---|
513 | |
---|
514 | %store the root name for future opening of uvmat |
---|
515 | dir_perso=prefdir; |
---|
516 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
517 | if exist(profil_perso,'file') |
---|
518 | save (profil_perso,'RootPath','SubDir','RootFile','NomType', '-append'); %store the root name for future opening of uvmat |
---|
519 | else |
---|
520 | txt=ver('MATLAB'); |
---|
521 | Release=txt.Release; |
---|
522 | relnumb=str2num(Release(3:4)); |
---|
523 | if relnumb >= 14 |
---|
524 | save (profil_perso,'RootPath','SubDir','RootFile','NomType','-V6') %store the root name for future opening of uvmat |
---|
525 | else |
---|
526 | save(profil_perso,'RootPath','SubDir','RootFile','NomType') |
---|
527 | end |
---|
528 | end |
---|
529 | set(handles.InputTable,'BackgroundColor',[1 1 1]) |
---|
530 | % set(handles.PathCampaign,'String',SeriesData.PathCampaign) |
---|
531 | %num_last_j_Callback([], [], handles)% TODO:update |
---|
532 | %num_last_i_Callback([], [], handles) |
---|
533 | |
---|
534 | % %------------------------------------------------------------------------ |
---|
535 | % function RootPath_Callback(hObject, eventdata, handles) |
---|
536 | % %------------------------------------------------------------------------ |
---|
537 | % Val=get(handles.RootPath,'Value'); |
---|
538 | % synchronise_view(handles,Val) |
---|
539 | % NomType_Callback(hObject, eventdata, handles) |
---|
540 | |
---|
541 | % %------------------------------------------------------------------------ |
---|
542 | % function synchronise_view(handles,Val) |
---|
543 | % %------------------------------------------------------------------------ |
---|
544 | % set(handles.RootPath,'Value',Val) |
---|
545 | % set(handles.SubDir,'Value',Val) |
---|
546 | % set(handles.RootFile,'Value',Val) |
---|
547 | % set(handles.NomType,'Value',Val) |
---|
548 | % set(handles.FileExt,'Value',Val) |
---|
549 | % set(handles.num_MaxIndex_i,'Value',Val) |
---|
550 | % set(handles.num_MaxIndex_j,'Value',Val) |
---|
551 | % % set(handles.time_first,'Value',Val) |
---|
552 | % % set(handles.time_last,'Value',Val) |
---|
553 | |
---|
554 | |
---|
555 | % %------------------------------------------------------------------------ |
---|
556 | % % Executes on carriage return on the subdir civ1 edit window |
---|
557 | % function SubDir_Callback(hObject, eventdata, handles) |
---|
558 | % %------------------------------------------------------------------------ |
---|
559 | % Val=get(handles.SubDir,'Value'); |
---|
560 | % synchronise_view(handles,Val) |
---|
561 | % NomType_Callback(hObject, eventdata, handles) |
---|
562 | |
---|
563 | % %------------------------------------------------------------------------ |
---|
564 | % % --- function activated when a new filebase (image series) is introduced |
---|
565 | % function RootFile_Callback(hObject, eventdata, handles) |
---|
566 | % %------------------------------------------------------------------------ |
---|
567 | % Val=get(handles.RootFile,'Value'); |
---|
568 | % synchronise_view(handles,Val) |
---|
569 | % NomType_Callback(hObject, eventdata, handles) |
---|
570 | |
---|
571 | %-------------------------------------------------------------- |
---|
572 | % %function activated when a new filebase (image series) is introduced |
---|
573 | % %------------------------------------------------------------ |
---|
574 | % function FileExt_Callback(hObject, eventdata, handles) |
---|
575 | % Val=get(handles.FileExt,'Value'); |
---|
576 | % synchronise_view(handles,Val) |
---|
577 | |
---|
578 | % %-------------------------------------------------------------- |
---|
579 | % %function activated when a new filebase (image series) is introduced |
---|
580 | % %------------------------------------------------------------ |
---|
581 | % function num_MaxIndex_i_Callback(hObject, eventdata, handles) |
---|
582 | % Val=get(handles.num_MaxIndex_i,'Value'); |
---|
583 | % synchronise_view(handles,Val) |
---|
584 | |
---|
585 | % %-------------------------------------------------------------- |
---|
586 | % %function activated when a new filebase (image series) is introduced |
---|
587 | % %------------------------------------------------------------ |
---|
588 | % function num_MaxIndex_j_Callback(hObject, eventdata, handles) |
---|
589 | % Val=get(handles.num_MaxIndex_j,'Value'); |
---|
590 | % synchronise_view(handles,Val) |
---|
591 | % |
---|
592 | % %-------------------------------------------------------------- |
---|
593 | % %function activated when a new filebase (image series) is introduced |
---|
594 | % %------------------------------------------------------------ |
---|
595 | % function time_first_Callback(hObject, eventdata, handles) |
---|
596 | % Val=get(handles.time_first,'Value'); |
---|
597 | % synchronise_view(handles,Val) |
---|
598 | % |
---|
599 | % %-------------------------------------------------------------- |
---|
600 | % %function activated when a new filebase (image series) is introduced |
---|
601 | % %------------------------------------------------------------ |
---|
602 | % function time_last_Callback(hObject, eventdata, handles) |
---|
603 | % Val=get(handles.time_last,'Value'); |
---|
604 | % synchronise_view(handles,Val) |
---|
605 | % NomType_Callback(hObject, eventdata, handles) |
---|
606 | |
---|
607 | % %------------------------------------------------------------------------ |
---|
608 | % function NomType_Callback(hObject, eventdata, handles) |
---|
609 | % %------------------------------------------------------------------------ |
---|
610 | |
---|
611 | % --- Executes when entered data in editable cell(s) in InputTable. |
---|
612 | function InputTable_CellEditCallback(hObject, eventdata, handles) |
---|
613 | % hObject handle to InputTable (see GCBO) |
---|
614 | % eventdata structure with the following fields (see UITABLE) |
---|
615 | % Indices: row and column indices of the cell(s) edited |
---|
616 | % PreviousData: previous data for the cell(s) edited |
---|
617 | % EditData: string(s) entered by the user |
---|
618 | % NewData: EditData or its converted form set on the Data property. Empty if Data was not changed |
---|
619 | % Error: error string when failed to convert EditData to appropriate value for Data |
---|
620 | % handles structure with handles and user data (see GUIDATA) |
---|
621 | eventdata |
---|
622 | check_lines=get(handles.REFRESH_INDICES,'UserData'); |
---|
623 | check_lines(eventdata.Indices(1))=1; %select the edited line for refresh |
---|
624 | set(handles.REFRESH_INDICES,'UserData',check_lines); |
---|
625 | set(handles.REFRESH_INDICES,'Visible','on') |
---|
626 | |
---|
627 | |
---|
628 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%???????????? |
---|
629 | % --- Executes on button press in mode. |
---|
630 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
631 | function mode_Callback(hObject, eventdata, handles) |
---|
632 | |
---|
633 | SeriesData=get(handles.series,'UserData'); |
---|
634 | mode_list=get(handles.mode,'String'); |
---|
635 | mode_value=get(handles.mode,'Value'); |
---|
636 | mode=mode_list{mode_value}; |
---|
637 | % NomType=[]; |
---|
638 | % test_find_pair=0; |
---|
639 | % if isfield(SeriesData,'NomType') |
---|
640 | % NomTypeCell=SeriesData.NomType; |
---|
641 | % Val=get(handles.NomType,'Value'); |
---|
642 | % NomType=NomTypeCell{Val}; |
---|
643 | % check_pairs=0; |
---|
644 | % for |
---|
645 | % check_pairs=~isempty(SeriesData.i2_series{Val})||~isempty(SeriesData.j2_series{Val}); |
---|
646 | |
---|
647 | time=[]; |
---|
648 | if isfield(SeriesData,'Time') |
---|
649 | time=SeriesData.Time{1}; %get the set of times |
---|
650 | end |
---|
651 | % siztime=size(time); |
---|
652 | % nbfield=siztime(1); |
---|
653 | % nbfield2=siztime(2); |
---|
654 | % indchosen=1; %%first pair selected by default |
---|
655 | if isequal(mode,'bursts') |
---|
656 | enable_i(handles,'On') |
---|
657 | enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) |
---|
658 | % elseif ~isempty(SeriesData.j2_series{Val}) |
---|
659 | % enable_i(handles,'On') |
---|
660 | % enable_j(handles,'On') % allow both i and j index scanning |
---|
661 | else |
---|
662 | enable_i(handles,'On') |
---|
663 | enable_j(handles,'Off') |
---|
664 | end |
---|
665 | % set(handles.list_pair_civ,'Value',indchosen);%set the default choice of image pairs for civ1 |
---|
666 | % set(handles.series,'UserData',SeriesData) |
---|
667 | |
---|
668 | %list pairs if relevant |
---|
669 | % if check_pairs |
---|
670 | find_netcpair_civ(handles) |
---|
671 | % end |
---|
672 | |
---|
673 | %------------------------------------- |
---|
674 | function enable_i(handles,state) |
---|
675 | set(handles.i_txt,'Visible',state) |
---|
676 | set(handles.num_first_i,'Visible',state) |
---|
677 | set(handles.num_last_i,'Visible',state) |
---|
678 | set(handles.num_incr_i,'Visible',state) |
---|
679 | % set(handles.num_MaxIndex_i,'Visible',state) |
---|
680 | set(handles.ref_i,'Visible',state) |
---|
681 | set(handles.ref_i_text,'Visible',state) |
---|
682 | |
---|
683 | %----------------------------------- |
---|
684 | function enable_j(handles,state) |
---|
685 | set(handles.j_txt,'Visible',state) |
---|
686 | % set(handles.num_MinIndex_j,'Visible',state) |
---|
687 | set(handles.num_first_j,'Visible',state) |
---|
688 | set(handles.num_last_j,'Visible',state) |
---|
689 | set(handles.num_incr_j,'Visible',state) |
---|
690 | % set(handles.num_MaxIndex_j,'Visible',state) |
---|
691 | set(handles.ref_j,'Visible',state) |
---|
692 | set(handles.ref_j_text,'Visible',state) |
---|
693 | |
---|
694 | %----------------------------------- |
---|
695 | function view_FieldMenu(handles,state) |
---|
696 | % set(handles.FieldMenu,'Visible',state) |
---|
697 | % set(handles.Field_text,'Visible',state) |
---|
698 | set(handles.InputFields,'Visible',state) |
---|
699 | |
---|
700 | %----------------------------------- |
---|
701 | function view_FieldMenu_1(handles,state) |
---|
702 | set(handles.FieldMenu_1,'Visible',state) |
---|
703 | set(handles.Field_text_1,'Visible',state) |
---|
704 | |
---|
705 | % %----------------------------------- |
---|
706 | % function view_TRANSFORM(handles,state) |
---|
707 | % set(handles.TRANSFORM_frame,'Visible',state) |
---|
708 | % set(handles.transform_fct,'Visible',state); |
---|
709 | % set(handles.TRANSFORM_title,'Visible',state) |
---|
710 | |
---|
711 | %-------------------------------------------------------------- |
---|
712 | % determine the menu for civ1 pairs depending on existing netcdf files |
---|
713 | % with the reference indices ref_i and ref_j |
---|
714 | %---------------------------------------------------------------- |
---|
715 | function find_netcpair_civ(handles) |
---|
716 | SeriesData=get(handles.series,'UserData'); |
---|
717 | % NomTypeCell=get(handles.NomType,'String'); |
---|
718 | % NomTypeCell=SeriesData.NomType; |
---|
719 | % NomType=NomTypeCell{Val}; |
---|
720 | |
---|
721 | set(handles.Pairs,'Visible','on')% makes the panel "Pairs' visible |
---|
722 | %nomenclature types |
---|
723 | % RootPathCell=get(handles.RootPath,'String'); |
---|
724 | % filepath=RootPathCell{Val}; |
---|
725 | % RootFileCell=get(handles.RootFile,'String'); |
---|
726 | % filename=RootFileCell{Val}; |
---|
727 | % filebase=fullfile(filepath,filename); |
---|
728 | % SubDirCell=get(handles.SubDir,'String'); |
---|
729 | % subdir=SubDirCell{Val}; |
---|
730 | % if ~exist(fullfile(filepath,subdir),'dir') |
---|
731 | % msgbox_uvmat('ERROR',['no civ file available: subdirectory ' subdir ' does not exist']) |
---|
732 | % set(handles.list_pair_civ,'String',{''}); |
---|
733 | % return |
---|
734 | % end |
---|
735 | mode_list=get(handles.mode,'String'); |
---|
736 | mode_value=get(handles.mode,'Value'); |
---|
737 | mode=mode_list{mode_value}; |
---|
738 | |
---|
739 | %reads image numbers from the interface |
---|
740 | % ref_i=str2num(get(handles.ref_i,'String')); |
---|
741 | % ref_j=str2num(get(handles.ref_j,'String')); |
---|
742 | % ref_time=0; |
---|
743 | % nbfield=50; |
---|
744 | % nbfield2=50;%default max number of pairs |
---|
745 | |
---|
746 | %look for existing processed pairs involving the field at the middle of the series if civ1 will not |
---|
747 | % be performed, while the result is needed for next steps. |
---|
748 | |
---|
749 | % ind_exist=0; |
---|
750 | TimeUnit=get(handles.TimeUnit,'String'); |
---|
751 | if length(TimeUnit)>=1 |
---|
752 | dtunit=['m' TimeUnit]; |
---|
753 | else |
---|
754 | dtunit='e-03'; |
---|
755 | end |
---|
756 | |
---|
757 | %% NEW |
---|
758 | for Val=1:numel(SeriesData.i1_series) |
---|
759 | |
---|
760 | i1_series=SeriesData.i1_series{Val}; |
---|
761 | i2_series=SeriesData.i2_series{Val}; |
---|
762 | j1_series=SeriesData.j1_series{Val}; |
---|
763 | j2_series=SeriesData.j2_series{Val}; |
---|
764 | displ_pair={}; |
---|
765 | if strcmp(mode,'series(Di)') |
---|
766 | if isempty(i2_series) |
---|
767 | msgbox_uvmat('ERROR','no i1-i2 pair available') |
---|
768 | return |
---|
769 | end |
---|
770 | diff_i=i2_series-i1_series; |
---|
771 | min_diff=min(diff_i(diff_i>0)); |
---|
772 | max_diff=max(diff_i(diff_i>0)); |
---|
773 | for ipair=min_diff:max_diff |
---|
774 | if numel(diff_i(diff_i==ipair))>0 |
---|
775 | displ_pair=[displ_pair;{['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]}]; |
---|
776 | end |
---|
777 | end |
---|
778 | if ~isempty(displ_pair) |
---|
779 | displ_pair=[displ_pair;{'Di=*|*'}]; |
---|
780 | end |
---|
781 | elseif strcmp(mode,'series(Dj)') |
---|
782 | if isempty(j2_series) |
---|
783 | msgbox_uvmat('ERROR','no j1-j2 pair available') |
---|
784 | return |
---|
785 | end |
---|
786 | diff_j=j2_series-j1_series; |
---|
787 | min_diff=min(diff_j(diff_j>0)); |
---|
788 | max_diff=max(diff_j(diff_j>0)); |
---|
789 | for ipair=min_diff:max_diff |
---|
790 | if numel(diff_j(diff_j==ipair))>0 |
---|
791 | displ_pair=[displ_pair;{['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]}]; |
---|
792 | end |
---|
793 | end |
---|
794 | if ~isempty(displ_pair) |
---|
795 | displ_pair=[displ_pair;{'Dj=*|*'}]; |
---|
796 | end |
---|
797 | elseif strcmp(mode,'bursts') |
---|
798 | if isempty(j2_series) |
---|
799 | msgbox_uvmat('ERROR','no j1-j2 pair available') |
---|
800 | return |
---|
801 | end |
---|
802 | diff_j=j2_series-j1_series; |
---|
803 | min_j1=min(j1_series(j1_series>0)); |
---|
804 | max_j1=max(j1_series(j1_series>0)); |
---|
805 | min_j2=min(j2_series(j2_series>0)); |
---|
806 | max_j2=max(j2_series(j2_series>0)); |
---|
807 | for pair1=min_j1:min(max_j1,min_j1+20) |
---|
808 | for pair2=min_j2:min(max_j2,min_j2+20) |
---|
809 | if numel(j1_series(j1_series==pair1))>0 && numel(j2_series(j2_series==pair2))>0 |
---|
810 | displ_pair=[displ_pair;{['j= ' num2str(pair1) '-' num2str(pair2)]}]; |
---|
811 | end |
---|
812 | end |
---|
813 | end |
---|
814 | if ~isempty(displ_pair) |
---|
815 | displ_pair=[displ_pair;{'j=*-*'}]; |
---|
816 | end |
---|
817 | end |
---|
818 | end |
---|
819 | %% display list of pairs |
---|
820 | displ_pair_list=get(handles.list_pair_civ,'String'); |
---|
821 | NewVal=[]; |
---|
822 | if ~isempty(displ_pair_list) |
---|
823 | Val=get(handles.list_pair_civ,'Value'); |
---|
824 | NewVal=find(strcmp(displ_pair_list{Val},displ_pair),1);% look at the previous display in the new menu displ_pâir |
---|
825 | end |
---|
826 | if ~isempty(NewVal) |
---|
827 | set(handles.list_pair_civ,'Value',NewVal) |
---|
828 | else |
---|
829 | set(handles.list_pair_civ,'Value',1) |
---|
830 | end |
---|
831 | set(handles.list_pair_civ,'String',displ_pair) |
---|
832 | displ_pair |
---|
833 | |
---|
834 | % displ_pair{ind_exist}=['Di= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit]; |
---|
835 | % if strcmp(mode,'series(Di)') |
---|
836 | % for index=1:min(nbfield-1,50) |
---|
837 | % filename=name_generator(filebase,ref_i-floor(index/2),ref_j,'.nc',NomType,1,ref_i+ceil(index/2),ref_j,subdir); |
---|
838 | % select=(exist(filename,'file')==2); |
---|
839 | % if select==1 |
---|
840 | % ind_exist=ind_exist+1; |
---|
841 | % displ_num(1,ind_exist)=0; |
---|
842 | % displ_num(2,ind_exist)=0; |
---|
843 | % displ_num(3,ind_exist)=-floor(index/2); |
---|
844 | % displ_num(4,ind_exist)=ceil(index/2); |
---|
845 | % %[cte_detect,vdt,cte_read]=read_netcdf(filename,{'dt','dt2','absolut_time_T0','absolute_time_TO_2'}); |
---|
846 | % [Cte,var_detect,ichoice]=nc2struct(filename,{}); |
---|
847 | % if isfield(Cte,'dt2') |
---|
848 | % dt=Cte.dt2; |
---|
849 | % elseif isfield(Cte,'dt') |
---|
850 | % dt=Cte.dt; |
---|
851 | % end |
---|
852 | % if isfield(Cte,'absolut_time_TO_2') |
---|
853 | % ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority |
---|
854 | % elseif isfield(Cte,'absolut_time_TO') |
---|
855 | % ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit |
---|
856 | % elseif isfield(Cte,'Time') |
---|
857 | % ref_time(ind_exist)=Cte.Time; |
---|
858 | % end |
---|
859 | % displ_pair{ind_exist}=['Di= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit]; |
---|
860 | % end |
---|
861 | % end |
---|
862 | % set(handles.list_pair_civ,'String',[displ_pair';{'Di=*|*'}]); |
---|
863 | % elseif isequal(mode,'series(Dj)')% series on the j index |
---|
864 | % for index=1:min(nbfield2-1,50) |
---|
865 | % filename=name_generator(filebase,ref_i,ref_j-floor(index/2),'.nc',NomType,1,ref_i,ref_j+ceil(index/2),subdir); |
---|
866 | % select=(exist(filename,'file')==2); |
---|
867 | % if select==1 |
---|
868 | % ind_exist=ind_exist+1; |
---|
869 | % displ_num(1,ind_exist)=-floor(index/2); |
---|
870 | % displ_num(2,ind_exist)=ceil(index/2); |
---|
871 | % displ_num(3,ind_exist)=0; |
---|
872 | % displ_num(4,ind_exist)=0; |
---|
873 | % [Cte,var_detect,ichoice]=nc2struct(filename,{}); |
---|
874 | % if isfield(Cte,'dt2') |
---|
875 | % dt=Cte.dt2; |
---|
876 | % elseif isfield(Cte,'dt') |
---|
877 | % dt=Cte.dt; |
---|
878 | % end |
---|
879 | % if isfield(Cte,'absolut_time_TO_2') |
---|
880 | % ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority |
---|
881 | % elseif isfield(Cte,'absolut_time_TO') |
---|
882 | % ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit |
---|
883 | % elseif isfield(Cte,'Time') |
---|
884 | % ref_time(ind_exist)=Cte.Time; |
---|
885 | % end |
---|
886 | % displ_pair{ind_exist}=['Dj= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit]; |
---|
887 | % end |
---|
888 | % end |
---|
889 | % set(handles.list_pair_civ,'String',[displ_pair';{'Dj=*|*'}]); |
---|
890 | % elseif isequal(mode,'bursts') %case of bursts |
---|
891 | % for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'bursts' mode |
---|
892 | % for numod_b=(numod_a+1):nbfield2 |
---|
893 | % [filename]=name_generator(filebase,ref_i,numod_a,'.nc',NomType,1,ref_i,numod_b,subdir) |
---|
894 | % select=(exist(filename,'file')==2) |
---|
895 | % if select==1 |
---|
896 | % ind_exist=ind_exist+1; |
---|
897 | % numlist_a(ind_exist)=numod_a; |
---|
898 | % numlist_b(ind_exist)=numod_b; |
---|
899 | % Attr=nc2struct(filename,[]); |
---|
900 | % isfield(Attr,'absolut_time_T0_2') |
---|
901 | % if isfield(Attr,'dt2') |
---|
902 | % dt(ind_exist)=Attr.dt2; |
---|
903 | % ref_time(ind_exist)=Attr.absolut_time_T0_2; |
---|
904 | % elseif isfield(Attr,'dt')& isfield(Attr,'absolut_time_T0') |
---|
905 | % dt(ind_exist)=Attr.dt; |
---|
906 | % ref_time(ind_exist)=Attr.absolut_time_T0; |
---|
907 | % else |
---|
908 | % dt(ind_exist)=NaN;%no information on dt |
---|
909 | % end |
---|
910 | % %determine nom_type_ima for pair display (used in num2stra.m) |
---|
911 | % switch NomType |
---|
912 | % case {'#ab'} |
---|
913 | % nom_type_ima='#a'; |
---|
914 | % case {'#AB'} |
---|
915 | % nom_type_ima='#A'; |
---|
916 | % otherwise |
---|
917 | % nom_type_ima='_1_1'; |
---|
918 | % end |
---|
919 | % displ_pair{ind_exist}=['j= ' num2stra(numod_a,nom_type_ima,2) '-' num2stra(numod_b,nom_type_ima,2) ... |
---|
920 | % ' :dt= ' num2str(dt(ind_exist)*1000)]; |
---|
921 | % end |
---|
922 | % end |
---|
923 | % set(handles.list_pair_civ,'String',[displ_pair';{'j=*-*'}]); |
---|
924 | % end |
---|
925 | % if exist('dt','var') & ~isempty(dt) |
---|
926 | % [dtsort,indsort]=sort(dt); |
---|
927 | % displ_num(1,:)=numlist_a(indsort); |
---|
928 | % displ_num(2,:)=numlist_b(indsort); |
---|
929 | % displ_num(3,:)=0; |
---|
930 | % displ_num(4,:)=0; |
---|
931 | % displ_pair=displ_pair(indsort); |
---|
932 | % ref_time=ref_time(indsort); |
---|
933 | % end |
---|
934 | % end |
---|
935 | if isempty(displ_pair) |
---|
936 | msgbox_uvmat('ERROR',['no file available for the selected subdirectory ' subdir]) |
---|
937 | end |
---|
938 | return |
---|
939 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%END FUNCTION |
---|
940 | |
---|
941 | |
---|
942 | if ind_exist==0 |
---|
943 | if isequal(mode,'series(Dj)') | isequal(mode,'st_series(Dj)') |
---|
944 | msgbox_uvmat('ERROR',['no .nc file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir]) |
---|
945 | else |
---|
946 | msgbox_uvmat('ERROR',['no .nc file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir]) |
---|
947 | end |
---|
948 | if isequal(mode,'bursts') %case of bursts |
---|
949 | set(handles.list_pair_civ,'String',{'j=*-*'}); |
---|
950 | elseif isequal(mode,'series(Di)') %case of bursts |
---|
951 | set(handles.list_pair_civ,'String',{'Di=*|*'}); |
---|
952 | elseif isequal(mode,'series(Dj)') %case of bursts |
---|
953 | set(handles.list_pair_civ,'String',{'Dj=*|*'}); |
---|
954 | end |
---|
955 | end |
---|
956 | return |
---|
957 | %TO update |
---|
958 | val=get(handles.list_pair_civ,'Value'); |
---|
959 | if val > length(displ_pair) |
---|
960 | set(handles.list_pair_civ,'Value',1);% first pair proposed by default in the menu |
---|
961 | val=1; |
---|
962 | end |
---|
963 | iview=get(handles.NomType,'Value'); |
---|
964 | SeriesData.displ_num(iview,:)=(displ_num(:,val))'; |
---|
965 | SeriesData.ref_time=ref_time; |
---|
966 | set(handles.series,'UserData',SeriesData) |
---|
967 | list_pair_civ_Callback([],[],handles) |
---|
968 | |
---|
969 | %------------------------------------------------------------- |
---|
970 | % --- Executes on selection in list_pair_civ. |
---|
971 | function list_pair_civ_Callback(hObject,eventdata,handles) |
---|
972 | %------------------------------------------------------------ |
---|
973 | return |
---|
974 | %%%%%%%% |
---|
975 | %update num_first_i and num_last_i according to the chosen image pairs |
---|
976 | testupdate=0; |
---|
977 | Val=get(handles.RootPath,'Value'); |
---|
978 | IndexCell=get(handles.NomType,'String'); |
---|
979 | SeriesData=get(handles.series,'UserData'); |
---|
980 | NomType=SeriesData.NomType{Val}; |
---|
981 | list_pair=get(handles.list_pair_civ,'String');%get the menu of image pairs |
---|
982 | index_pair=get(handles.list_pair_civ,'Value'); |
---|
983 | str_pair=list_pair{index_pair}; |
---|
984 | ind_equ=strfind(str_pair,'=');%find '=' |
---|
985 | ind_sep=strfind(str_pair,'|');%find pair separator '|' |
---|
986 | ind_com=strfind(str_pair,':');%find ':' |
---|
987 | test_bursts=0; |
---|
988 | if isempty(ind_sep) |
---|
989 | ind_sep=strfind(str_pair,'-');%find pair separator if it is not '|' |
---|
990 | test_bursts=1;% we are in the case of bursts |
---|
991 | end |
---|
992 | displ_num=[0 0 0 0]; %default |
---|
993 | if ~isempty(ind_sep)&& ~strcmp(str_pair(ind_sep-1),'*')% if there is a pair separator ('|' or '-') |
---|
994 | num1_str=str_pair(ind_equ(1)+1:ind_sep-1); |
---|
995 | num2_str=str_pair(ind_sep+1:ind_com-1); |
---|
996 | num1=str2double(num1_str); |
---|
997 | num2=str2double(num2_str); |
---|
998 | if isequal(num1_str(1),' ') |
---|
999 | num1_str(1)=[]; |
---|
1000 | end |
---|
1001 | if isequal(num2_str(end),' ') |
---|
1002 | num2_str(end)=[]; |
---|
1003 | end |
---|
1004 | switch NomType |
---|
1005 | case {'_1-2_1'} |
---|
1006 | if isequal(num1_str(1),'0') |
---|
1007 | IndexCell{Val}=['_(i-(i+' num2_str ')_j']; |
---|
1008 | else |
---|
1009 | IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')_j']; |
---|
1010 | end |
---|
1011 | displ_num(3)=num1; |
---|
1012 | displ_num(4)=num2; |
---|
1013 | case {'_1-2'} |
---|
1014 | if isequal(num1_str(1),'0') |
---|
1015 | IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')']; |
---|
1016 | else |
---|
1017 | IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')']; |
---|
1018 | end |
---|
1019 | displ_num(3)=num1; |
---|
1020 | displ_num(4)=num2; |
---|
1021 | case '_1_1-2' |
---|
1022 | if test_bursts |
---|
1023 | IndexCell{Val}=['_i_' num1_str '-' num2_str ]; |
---|
1024 | else |
---|
1025 | if isequal(num1_str(1),'0') |
---|
1026 | IndexCell{Val}=['_i_j-(j+' num2_str ')']; |
---|
1027 | else |
---|
1028 | IndexCell{Val}=['_i_(j' num1_str ')-(j+' num2_str ')']; |
---|
1029 | end |
---|
1030 | end |
---|
1031 | displ_num(1)=num1; |
---|
1032 | displ_num(2)=num2; |
---|
1033 | case {'#_ab'} %TO COMPLETE |
---|
1034 | IndexCell{Val}=['_i_' num1_str '-' num2_str ]; |
---|
1035 | |
---|
1036 | end |
---|
1037 | end |
---|
1038 | set(handles.NomType,'String',IndexCell) |
---|
1039 | SeriesData.displ_num(Val,:)=displ_num; |
---|
1040 | set(handles.series,'UserData',SeriesData) |
---|
1041 | % set(handles.NomType,'Value',Val) |
---|
1042 | |
---|
1043 | if ~isequal(str_pair,'Dj=*|*')&~isequal(str_pair,'Di=*|*') |
---|
1044 | mode_list=get(handles.mode,'String'); |
---|
1045 | mode_value=get(handles.mode,'Value'); |
---|
1046 | mode=mode_list{mode_value}; |
---|
1047 | if isequal(mode,'series(Di)') |
---|
1048 | first_i=str2num(get(handles.num_first_i,'String')); |
---|
1049 | last_i=str2num(get(handles.num_last_i,'String')); |
---|
1050 | incr_i=str2num(get(handles.num_incr_i,'String')); |
---|
1051 | num1=first_i:incr_i:last_i; |
---|
1052 | lastfieldCell=get(handles.num_MaxIndex_i,'String'); |
---|
1053 | lastfield=str2num(lastfieldCell{1}); |
---|
1054 | if ~isempty(lastfield) |
---|
1055 | ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield)); |
---|
1056 | num1=num1(ind); |
---|
1057 | end |
---|
1058 | if ~isempty(num1) |
---|
1059 | set(handles.num_first_i,'String',num2str(num1(1))); |
---|
1060 | set(handles.num_last_i,'String',num2str(num1(end))); |
---|
1061 | end |
---|
1062 | testupdate=1; |
---|
1063 | elseif isequal(mode,'series(Dj)') |
---|
1064 | first_j=str2num(get(handles.num_first_j,'String')); |
---|
1065 | last_j=str2num(get(handles.num_last_j,'String')); |
---|
1066 | incr_j=str2num(get(handles.num_incr_j,'String')); |
---|
1067 | num_j=first_j:incr_j:last_j; |
---|
1068 | lastfieldCell=get(handles.num_MaxIndex_j,'String'); |
---|
1069 | if ~isempty(lastfieldCell) |
---|
1070 | lastfield2=lastfieldCell{1}; |
---|
1071 | ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... |
---|
1072 | (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2)); |
---|
1073 | end |
---|
1074 | testupdate=1; |
---|
1075 | end |
---|
1076 | |
---|
1077 | %update the first and last times of the series |
---|
1078 | if testupdate && isfield(SeriesData,'Time') |
---|
1079 | if ~isempty(SeriesData.Time{1}) |
---|
1080 | displ_time(handles); |
---|
1081 | end |
---|
1082 | end |
---|
1083 | end |
---|
1084 | |
---|
1085 | %------------------------------------------------------------------------ |
---|
1086 | % --- Executes on button press in RUN. |
---|
1087 | function RUN_Callback(hObject, eventdata, handles) |
---|
1088 | %------------------------------------------------------------------------ |
---|
1089 | %% Read parameters from series |
---|
1090 | Series=read_GUI(handles.series)%TODO: extend to all input param |
---|
1091 | Series.hseries=handles.series; % handles to the series GUI |
---|
1092 | |
---|
1093 | %% read root name and field type |
---|
1094 | set(handles.RUN,'BusyAction','queue'); |
---|
1095 | set(0,'CurrentFigure',handles.series) |
---|
1096 | if isequal(get(handles.GetObject,'Visible'),'on') && isequal(get(handles.GetObject,'Value'),1) |
---|
1097 | Series.GetObject=1; |
---|
1098 | GetObject_Callback(hObject, eventdata, handles) |
---|
1099 | else |
---|
1100 | Series.GetObject=0; |
---|
1101 | end |
---|
1102 | % SeriesData=get(handles.series,'UserData'); |
---|
1103 | |
---|
1104 | % Series.hseries=handles.series; % handles to the series GUI |
---|
1105 | first_i=1; |
---|
1106 | last_i=1; |
---|
1107 | incr_i=1; |
---|
1108 | first_j=1; |
---|
1109 | last_j=1; |
---|
1110 | incr_j=1; |
---|
1111 | if isfield(Series.IndexRange,'first_i') |
---|
1112 | first_i=Series.IndexRange.first_i; |
---|
1113 | incr_i=Series.IndexRange.incr_i; |
---|
1114 | last_i=Series.IndexRange.last_i; |
---|
1115 | end |
---|
1116 | if isfield(Series.IndexRange,'first_j') |
---|
1117 | first_j=Series.IndexRange.first_j; |
---|
1118 | incr_j=Series.IndexRange.incr_j; |
---|
1119 | last_j=Series.IndexRange.last_j; |
---|
1120 | end |
---|
1121 | |
---|
1122 | %% read input file parameters and set menus |
---|
1123 | Series.PathProject=get(handles.PathCampaign,'String'); |
---|
1124 | % InputTable=get(handles.InputTable,'Data'); |
---|
1125 | RootPath=Series.InputTable(:,1); |
---|
1126 | SubDir=Series.InputTable(:,2); |
---|
1127 | RootFile=Series.InputTable(:,3); |
---|
1128 | NomType=Series.InputTable(:,4); |
---|
1129 | FileExt=Series.InputTable(:,5); |
---|
1130 | % if isempty(SeriesData) |
---|
1131 | % msgbox_uvmat('ERROR','no input file series') |
---|
1132 | % return |
---|
1133 | % end |
---|
1134 | % NomType=SeriesData.NomType; |
---|
1135 | % if length(RootPath)==1 %string character input for user fct |
---|
1136 | % Series.RootPath=RootPath{1}; |
---|
1137 | % Series.RootFile=RootFile{1}; |
---|
1138 | % Series.SubDir=SubDir{1}; |
---|
1139 | % Series.FileExt=FileExt{1}; |
---|
1140 | % Series.NomType=NomType{1}; |
---|
1141 | % else %cell input for user fct |
---|
1142 | % Series.RootPath=RootPath; |
---|
1143 | % Series.RootFile=RootFile; |
---|
1144 | % Series.SubDir=SubDir; |
---|
1145 | % Series.FileExt=FileExt; |
---|
1146 | % Series.NomType=NomType; |
---|
1147 | % end |
---|
1148 | % if isequal(get(handles.FieldMenu,'Visible'),'on') |
---|
1149 | % FieldMenu=get(handles.FieldMenu,'String'); |
---|
1150 | % FieldValue=get(handles.FieldMenu,'Value'); |
---|
1151 | % Series.Field=FieldMenu(FieldValue); |
---|
1152 | % end |
---|
1153 | menu_coord_state=get(handles.transform_fct,'Visible'); |
---|
1154 | Series.CoordType='';%default |
---|
1155 | if isequal(menu_coord_state,'on') |
---|
1156 | % menu_coord=get(handles.transform_fct,'String'); |
---|
1157 | menu_index=get(handles.transform_fct,'Value'); |
---|
1158 | transform_list=get(handles.transform_fct,'UserData'); |
---|
1159 | Series.transform_fct=transform_list{menu_index};% transform function handles |
---|
1160 | end |
---|
1161 | |
---|
1162 | %reinitiate waitbar position |
---|
1163 | Series.WaitbarPos=get(handles.waitbar_frame,'Position');%TO SUPPRESS |
---|
1164 | waitbarpos=Series.WaitbarPos; |
---|
1165 | waitbarpos(4)=0.005;%reinitialize waitbar to zero height |
---|
1166 | waitbarpos(2)=Series.WaitbarPos(2)+Series.WaitbarPos(4)-0.005; |
---|
1167 | % set(handles.waitbar,'Position',waitbarpos) |
---|
1168 | |
---|
1169 | if isfield(Series.IndexRange,'NbSlice') |
---|
1170 | Series.NbSlice=Series.IndexRange.NbSlice; |
---|
1171 | end |
---|
1172 | if last_i < first_i | last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... |
---|
1173 | set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; |
---|
1174 | num_i=first_i:incr_i:last_i; |
---|
1175 | num_j=first_j:incr_j:last_j; |
---|
1176 | % nbfield_cell=get(handles.num_MaxIndex_i,'String'); |
---|
1177 | nbfield=cell2mat(Series.IndexRange.MaxIndex); |
---|
1178 | nb=min(nbfield,1); |
---|
1179 | nbfield=nb(1); |
---|
1180 | nbfield2=nb(2); |
---|
1181 | |
---|
1182 | %get complementary information from the 'series' interface |
---|
1183 | list_action=get(handles.ACTION,'String');% list menu action |
---|
1184 | index_action=get(handles.ACTION,'Value');% selected string index |
---|
1185 | action= list_action{index_action}; % selected string |
---|
1186 | mode_list=get(handles.mode,'String'); |
---|
1187 | index_mode=get(handles.mode,'Value'); |
---|
1188 | mode=mode_list{index_mode}; |
---|
1189 | ind_shift=0;%default |
---|
1190 | |
---|
1191 | %determine the list of input file names |
---|
1192 | nbmissing=0; |
---|
1193 | % for iview=1:length(RootPath) |
---|
1194 | % %case of pairs (.nc files) |
---|
1195 | % fileinput=name_generator(fullfile(RootPath{iview},RootFile{iview}),first_i,first_j,FileExt{iview},NomType{iview},1,first_i+1,first_j+1,SubDir{iview}); |
---|
1196 | % if strcmp(get(handles.Pairs,'Visible'),'on') |
---|
1197 | % pair_list=get(handles.list_pair_civ,'String'); |
---|
1198 | % val=get(handles.list_pair_civ,'Value'); |
---|
1199 | % pair_string=pair_list{val}; |
---|
1200 | % r=regexp(pair_string,'.*\D(?<num1>[\d+|*])(?<delim>[-||])(?<num2>[\d+|*])','names'); |
---|
1201 | % if ~isempty(r) |
---|
1202 | % if strcmp(r.num1,'*')%free pairs |
---|
1203 | % [tild,RootFile,i1_series,i2_series,j1_series,j2_series,tild,tild,Object]=find_file_series(fileinput);% TODO: choice pair when multiple choice |
---|
1204 | % |
---|
1205 | % if isempty(i2_series) %j pairs |
---|
1206 | % ind_sel=i1_series>=i1_series>=first_i & i1_series<=last_i & j1_series>first_j & j2_series<last_j; |
---|
1207 | % j2_series=j2_series(ind_sel); |
---|
1208 | % else%i pairs |
---|
1209 | % if isempty(j1_series) %j pairs |
---|
1210 | % ind_sel=i1_series>=first_i & i2_series<=last_i ; |
---|
1211 | % else |
---|
1212 | % ind_sel=i1_series>=first_i & i2_series<=last_i& j1_series>first_j & j1_series<last_j; |
---|
1213 | % j1_series=j1_series(ind_sel); |
---|
1214 | % i2_series=i2_series(ind_sel); |
---|
1215 | % end |
---|
1216 | % end |
---|
1217 | % i1_series=i1_series(ind_sel); |
---|
1218 | % else |
---|
1219 | % if strcmp(r.delim,'-') |
---|
1220 | % ind_shift(1)=str2num(r.num1); |
---|
1221 | % ind_shift(2)=str2num(r.num2); |
---|
1222 | % else |
---|
1223 | % ind_shift(1)=-str2num(r.num1); |
---|
1224 | % ind_shift(2)=str2num(r.num2); |
---|
1225 | % end |
---|
1226 | % [i1_series,i2_series,j1_series,j2_series,nbmissing]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode); |
---|
1227 | % end |
---|
1228 | % end |
---|
1229 | % if isempty(i1_series) |
---|
1230 | % msgbox_uvmat('ERROR','no file in the considered range') |
---|
1231 | % return |
---|
1232 | % end |
---|
1233 | % if isempty(i2_series) |
---|
1234 | % i2_series=i1_series; |
---|
1235 | % end |
---|
1236 | % if isempty(j2_series) |
---|
1237 | % j2_series=j1_series; |
---|
1238 | % end |
---|
1239 | % else%case of images |
---|
1240 | % [i1_series,j1_series]=meshgrid(num_i,num_j); |
---|
1241 | % i2_series=i1_series; |
---|
1242 | % j2_series=j1_series; |
---|
1243 | % end |
---|
1244 | % if length(RootPath)>1 |
---|
1245 | % i1_series_cell{iview}=i1_series; |
---|
1246 | % i2_series_cell{iview}=i2_series; |
---|
1247 | % j1_series_cell{iview}=j1_series; |
---|
1248 | % j2_series_cell{iview}=j2_series; |
---|
1249 | % end |
---|
1250 | % end |
---|
1251 | |
---|
1252 | %% defining the ACTION function handle |
---|
1253 | path_series=which('series'); |
---|
1254 | list_path=get(handles.ACTION,'UserData'); |
---|
1255 | index=get(handles.ACTION,'Value'); |
---|
1256 | fct_path=list_path{index}; %path stored for the function ACTION |
---|
1257 | if ~isequal(fct_path,path_series) |
---|
1258 | eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION |
---|
1259 | if ~exist(fct_path,'dir') |
---|
1260 | msgbox_uvmat('ERROR',['The prescibed function path ' fct_path ' does not exist']) |
---|
1261 | return |
---|
1262 | end |
---|
1263 | if ~isequal(spath,fct_path) |
---|
1264 | addpath(fct_path)% add the prescribed path if not the current one |
---|
1265 | end |
---|
1266 | end |
---|
1267 | eval(['h_fun=@' action ';'])%create a function handle for ACTION |
---|
1268 | if ~isequal(fct_path,path_series) |
---|
1269 | rmpath(fct_path)% add the prescribed path if not the current one |
---|
1270 | end |
---|
1271 | |
---|
1272 | %% RUN ACTION |
---|
1273 | Series.Action=action;%name of the processing programme |
---|
1274 | Series |
---|
1275 | set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) |
---|
1276 | h_fun(Series); |
---|
1277 | % if length(RootPath)>1 |
---|
1278 | % h_fun(i1_series_cell,i2_series_cell,j1_series_cell,j2_series_cell,Series); |
---|
1279 | % else |
---|
1280 | % h_fun(i1_series,i2_series,j1_series,j2_series,Series); |
---|
1281 | % end |
---|
1282 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
1283 | |
---|
1284 | % %save the current interface setting as figure namefig, append .0 to the name if it already exists |
---|
1285 | % detect=1; |
---|
1286 | % while detect==1 |
---|
1287 | % namefigfull=[namedoc '.fig']; |
---|
1288 | % hh=dir(namefigfull); |
---|
1289 | % if ~isempty(hh) |
---|
1290 | % detect=1; |
---|
1291 | % namedoc=[namedoc '.0']; |
---|
1292 | % else |
---|
1293 | % detect=0; |
---|
1294 | % end |
---|
1295 | % end |
---|
1296 | % saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) |
---|
1297 | |
---|
1298 | %------------------------------------------------------------------------ |
---|
1299 | function STOP_Callback(hObject, eventdata, handles) |
---|
1300 | %------------------------------------------------------------------------ |
---|
1301 | set(handles.RUN, 'BusyAction','cancel') |
---|
1302 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
1303 | |
---|
1304 | |
---|
1305 | %------------------------------------------------------------------------ |
---|
1306 | function num_first_i_Callback(hObject, eventdata, handles) |
---|
1307 | %------------------------------------------------------------------------ |
---|
1308 | num_last_i_Callback(hObject, eventdata, handles) |
---|
1309 | |
---|
1310 | %------------------------------------------------------------------------ |
---|
1311 | function num_last_i_Callback(hObject, eventdata, handles) |
---|
1312 | %------------------------------------------------------------------------ |
---|
1313 | SeriesData=get(handles.series,'UserData'); |
---|
1314 | if ~isfield(SeriesData,'Time') |
---|
1315 | SeriesData.Time{1}=[]; |
---|
1316 | end |
---|
1317 | displ_time(handles); |
---|
1318 | |
---|
1319 | %------------------------------------------------------------------------ |
---|
1320 | function num_first_j_Callback(hObject, eventdata, handles) |
---|
1321 | %------------------------------------------------------------------------ |
---|
1322 | num_last_j_Callback(hObject, eventdata, handles) |
---|
1323 | |
---|
1324 | %------------------------------------------------------------------------ |
---|
1325 | function num_last_j_Callback(hObject, eventdata, handles) |
---|
1326 | %------------------------------------------------------------------------ |
---|
1327 | first_j=str2num(get(handles.num_first_j,'String')); |
---|
1328 | last_j=str2num(get(handles.num_last_j,'String')); |
---|
1329 | ref_j=ceil((first_j+last_j)/2); |
---|
1330 | set(handles.ref_j,'String', num2str(ref_j)) |
---|
1331 | ref_j_Callback(hObject, eventdata, handles) |
---|
1332 | SeriesData=get(handles.series,'UserData'); |
---|
1333 | if ~isfield(SeriesData,'Time') |
---|
1334 | SeriesData.Time{1}=[]; |
---|
1335 | end |
---|
1336 | displ_time(handles); |
---|
1337 | |
---|
1338 | |
---|
1339 | %------------------------------------------------------------------------ |
---|
1340 | function ref_i_Callback(hObject, eventdata, handles) |
---|
1341 | %------------------------------------------------------------------------ |
---|
1342 | mode_list=get(handles.mode,'String'); |
---|
1343 | mode_value=get(handles.mode,'Value'); |
---|
1344 | mode=mode_list{mode_value}; |
---|
1345 | SeriesData=get(handles.series,'UserData'); |
---|
1346 | %NomTypeCell=get(handles.NomType,'String'); |
---|
1347 | NomTypeCell=SeriesData.NomType; |
---|
1348 | if ~isempty(NomTypeCell) |
---|
1349 | Val=get(handles.NomType,'Value'); |
---|
1350 | NomType=NomTypeCell{Val}; |
---|
1351 | % for ilist=1:length(NomType) |
---|
1352 | if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2') |
---|
1353 | if isequal(mode,'series(Di)') |
---|
1354 | find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files |
---|
1355 | % break |
---|
1356 | end |
---|
1357 | end |
---|
1358 | end |
---|
1359 | |
---|
1360 | %------------------------------------------------------------------------ |
---|
1361 | function ref_j_Callback(hObject, eventdata, handles) |
---|
1362 | %------------------------------------------------------------------------ |
---|
1363 | mode_list=get(handles.mode,'String'); |
---|
1364 | mode_value=get(handles.mode,'Value'); |
---|
1365 | mode=mode_list{mode_value}; |
---|
1366 | SeriesData=get(handles.series,'UserData'); |
---|
1367 | NomTypeCell=SeriesData.NomType; |
---|
1368 | if ~isempty(NomTypeCell) |
---|
1369 | Val=get(handles.NomType,'Value'); |
---|
1370 | NomType=NomTypeCell{Val}; |
---|
1371 | if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2') |
---|
1372 | if isequal(mode,'series(Dj)') |
---|
1373 | find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files |
---|
1374 | end |
---|
1375 | end |
---|
1376 | end |
---|
1377 | |
---|
1378 | %------------------------------------------------------------------------ |
---|
1379 | % --- Executes on selection change in ACTION. |
---|
1380 | function ACTION_Callback(hObject, eventdata, handles) |
---|
1381 | %------------------------------------------------------------------------ |
---|
1382 | global nb_builtin_ACTION |
---|
1383 | list_ACTION=get(handles.ACTION,'String');% list menu fields |
---|
1384 | index_ACTION=get(handles.ACTION,'Value');% selected string index |
---|
1385 | ACTION= list_ACTION{index_ACTION}; % selected function name |
---|
1386 | path_series=which('series');%path to series.m |
---|
1387 | list_path=get(handles.ACTION,'UserData');%list of recorded paths to functions of the list ACTION |
---|
1388 | default_file=fullfile(list_path{end},ACTION); |
---|
1389 | % add a new function to the menu if the selected item is 'more...' |
---|
1390 | if isequal(ACTION,'more...') |
---|
1391 | pathfct=fileparts(path_series); |
---|
1392 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
1393 | {'*.m', ' (*.m)'; |
---|
1394 | '*.m', '.m files '; ... |
---|
1395 | '*.*', 'All Files (*.*)'}, ... |
---|
1396 | 'Pick a file',default_file); |
---|
1397 | if length(FileName)<2 |
---|
1398 | return |
---|
1399 | end |
---|
1400 | [pp,ACTION,ext_fct]=fileparts(FileName);%(end-1:end); |
---|
1401 | if ~isequal(ext_fct,'.m') |
---|
1402 | msgbox_uvmat('ERROR','a Matlab function .m must be introduced'); |
---|
1403 | return |
---|
1404 | end |
---|
1405 | |
---|
1406 | % insert the choice in the action menu |
---|
1407 | menu_str=update_menu(handles.ACTION,ACTION);%new action menu in which the new item has been appended if needed |
---|
1408 | index_ACTION=get(handles.ACTION,'Value');% currently selected index in the list |
---|
1409 | list_path{index_ACTION}=PathName; |
---|
1410 | if length(menu_str)>nb_builtin_ACTION+5; %nb_builtin=nbre of functions always remaining in the initial menu |
---|
1411 | nbremove=length(menu_str)-nb_builtin_ACTION-5; |
---|
1412 | menu_str(nb_builtin_ACTION+1:end-5)=[]; |
---|
1413 | list_path(nb_builtin_ACTION+1:end-4)=[]; |
---|
1414 | index_ACTION=index_ACTION-nbremove; |
---|
1415 | set(handles.ACTION,'Value',index_ACTION) |
---|
1416 | set(handles.ACTION,'String',menu_str) |
---|
1417 | end |
---|
1418 | list_path{index_ACTION}=PathName; |
---|
1419 | set(handles.ACTION,'UserData',list_path); |
---|
1420 | set(handles.path,'enable','inactive')% indicate that the current path is accessible (not 'off') |
---|
1421 | |
---|
1422 | %record the current menu in personal file profil_perso |
---|
1423 | dir_perso=prefdir; |
---|
1424 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
1425 | for ilist=nb_builtin_ACTION+1:length(menu_str)-1 |
---|
1426 | series_fct{ilist-nb_builtin_ACTION}=fullfile(list_path{ilist},[menu_str{ilist} '.m']); |
---|
1427 | end |
---|
1428 | if nb_builtin_ACTION+1<=length(menu_str)-1 |
---|
1429 | if exist(profil_perso,'file')% && nb_builtin_ACTION+1>=length(menu_str)-1 |
---|
1430 | save(profil_perso,'series_fct','-append') |
---|
1431 | else |
---|
1432 | txt=ver('MATLAB'); |
---|
1433 | Release=txt.Release; |
---|
1434 | relnumb=str2num(Release(3:4)); |
---|
1435 | if relnumb >= 14%recent relaese of Matlab |
---|
1436 | save(profil_perso,'series_fct','-V6') |
---|
1437 | else |
---|
1438 | save(profil_perso, 'series_fct') |
---|
1439 | end |
---|
1440 | end |
---|
1441 | end |
---|
1442 | end |
---|
1443 | |
---|
1444 | %check the current path to the selected function |
---|
1445 | PathName=list_path{index_ACTION};%current recorded path |
---|
1446 | set(handles.path,'String',PathName); %show the path to the senlected function |
---|
1447 | |
---|
1448 | %default setting for the visibility of the GUI elements |
---|
1449 | % set(handles.RootPath,'UserData','many') |
---|
1450 | % set(handles.SubDir,'Visible','on') |
---|
1451 | % set(handles.RootFile,'Visible','on') |
---|
1452 | % set(handles.NomType,'Visible','on') |
---|
1453 | % set(handles.FileExt,'Visible','on') |
---|
1454 | set(handles.num_NbSlice,'Visible','off') |
---|
1455 | set(handles.NbSlice_title,'Visible','off') |
---|
1456 | set(handles.VelTypeMenu,'Visible','off'); |
---|
1457 | set(handles.VelType_text,'Visible','off'); |
---|
1458 | set(handles.VelTypeMenu_1,'Visible','off'); |
---|
1459 | set(handles.VelType_text_1,'Visible','off'); |
---|
1460 | view_FieldMenu(handles,'off') |
---|
1461 | view_FieldMenu_1(handles,'off') |
---|
1462 | set(handles.FieldTransform,'Visible','off') |
---|
1463 | % view_TRANSFORM(handles,'off')Visible','off') |
---|
1464 | set(handles.Objects,'Visible','off'); |
---|
1465 | set(handles.GetMask,'Visible','off') |
---|
1466 | set(handles.Mask,'Visible','off') |
---|
1467 | % set(handles.GetObject,'Visible','off'); |
---|
1468 | set(handles.OutputDir,'Visible','off'); |
---|
1469 | % set(handles.PARAMETERS_frame,'Visible','off'); |
---|
1470 | % set(handles.PARAMETERS_title,'Visible','off'); |
---|
1471 | set(handles.ParamKey,'Visible','off') |
---|
1472 | set(handles.ParamVal,'Visible','off') |
---|
1473 | ParamKey={}; |
---|
1474 | set(handles.FieldMenu,'Enable','off') |
---|
1475 | set(handles.VelTypeMenu,'Enable','off') |
---|
1476 | set(handles.FieldMenu_1,'Enable','off') |
---|
1477 | set(handles.VelTypeMenu_1,'Enable','off') |
---|
1478 | set(handles.transform_fct,'Enable','off') |
---|
1479 | %set the displayed GUI item needed for input parameters |
---|
1480 | if ~isequal(path_series,PathName) |
---|
1481 | addpath(PathName) |
---|
1482 | end |
---|
1483 | eval(['h_function=@' ACTION ';']); |
---|
1484 | try |
---|
1485 | [fid,errormsg] =fopen([ACTION '.m']); |
---|
1486 | InputText=textscan(fid,'%s',1,'delimiter','\n'); |
---|
1487 | fclose(fid) |
---|
1488 | set(handles.ACTION,'ToolTipString',InputText{1}{1}) |
---|
1489 | end |
---|
1490 | if ~isequal(path_series,PathName) |
---|
1491 | rmpath(PathName) |
---|
1492 | end |
---|
1493 | varargout=h_function(); |
---|
1494 | Param_list={}; |
---|
1495 | |
---|
1496 | %nb_series=length(RootFile); |
---|
1497 | % FileExt=get(handles.FileExt,'String'); |
---|
1498 | % nb_series=length(FileExt); |
---|
1499 | InputFiles=get(handles.InputTable,'Data') |
---|
1500 | FileExt=InputFiles(:,5); |
---|
1501 | checkcell=find(cellfun('isempty',FileExt)~=0); |
---|
1502 | nb_series=0; |
---|
1503 | if ~isempty(checkcell) |
---|
1504 | nb_series=checkcell(end); |
---|
1505 | end |
---|
1506 | % nb_series=size(InputFiles,1) |
---|
1507 | testima_series=1; %test for a list of images only |
---|
1508 | testima=1; |
---|
1509 | testima_1=1; |
---|
1510 | testciv_series=1; |
---|
1511 | for iview=1:nb_series |
---|
1512 | ext=FileExt{iview}; |
---|
1513 | if length(ext)<2 |
---|
1514 | ext='.none'; |
---|
1515 | end |
---|
1516 | testimaview=~isempty(imformats(ext(2:end))) || isequal(lower(ext),'.avi'); |
---|
1517 | if ~testimaview |
---|
1518 | if iview==1 |
---|
1519 | testima=0; |
---|
1520 | end |
---|
1521 | if iview==2 |
---|
1522 | testima_1=0; |
---|
1523 | end |
---|
1524 | testima_series=0; |
---|
1525 | end |
---|
1526 | end |
---|
1527 | for ilist=1:length(varargout)-1 |
---|
1528 | switch varargout{ilist} |
---|
1529 | %RootFile always visible |
---|
1530 | % case 'RootPath' %visible by default |
---|
1531 | % value=lower(varargout{ilist+1}); |
---|
1532 | % if isequal(value,'one')||isequal(value,'two')||isequal(value,'many') |
---|
1533 | % set(handles.RootFile,'UserData',value)% for use in menu Open_insert |
---|
1534 | % end |
---|
1535 | % case 'SubDir' %visible by default |
---|
1536 | % if isequal(lower(varargout{ilist+1}),'off') |
---|
1537 | % set(handles.SubDir,'Visible','off') |
---|
1538 | % end |
---|
1539 | % case 'RootFile' %visible by default |
---|
1540 | % value=lower(varargout{ilist+1}); |
---|
1541 | % if isequal(value,'off') |
---|
1542 | % set(handles.RootFile,'Visible','off') |
---|
1543 | % elseif isequal(value,'one')||isequal(value,'two')||isequal(value,'many') |
---|
1544 | % set(handles.RootFile,'Visible','on') |
---|
1545 | % set(handles.RootFile,'UserData',value)% for use in menu Open_insert |
---|
1546 | % end |
---|
1547 | % case 'NomType' %visible by default |
---|
1548 | % if isequal(lower(varargout{ilist+1}),'off') |
---|
1549 | % set(handles.NomType,'Visible','off') |
---|
1550 | % end |
---|
1551 | % case 'FileExt' %visible by default |
---|
1552 | % if isequal(lower(varargout{ilist+1}),'off') |
---|
1553 | % set(handles.FileExt,'Visible','off') |
---|
1554 | % end |
---|
1555 | case 'NbSlice' %hidden by default |
---|
1556 | if isequal(lower(varargout{ilist+1}),'on') |
---|
1557 | set(handles.num_NbSlice,'Visible','on') |
---|
1558 | set(handles.NbSlice_title,'Visible','on') |
---|
1559 | end |
---|
1560 | case 'VelTypeMenu' %hidden by default |
---|
1561 | if isequal(lower(varargout{ilist+1}),'one') || isequal(lower(varargout{ilist+1}),'two') |
---|
1562 | set(handles.VelTypeMenu,'Enable','on') |
---|
1563 | if nb_series >=1 && ~testima_series |
---|
1564 | set(handles.VelTypeMenu,'Visible','on') |
---|
1565 | set(handles.VelType_text,'Visible','on'); |
---|
1566 | set(handles.Field_frame,'Visible','on') |
---|
1567 | end |
---|
1568 | end |
---|
1569 | if isequal(lower(varargout{ilist+1}),'two') |
---|
1570 | set(handles.VelTypeMenu_1,'Enable','on') |
---|
1571 | if nb_series >=2 && ~testima_series |
---|
1572 | set(handles.VelTypeMenu_1,'Visible','on') |
---|
1573 | set(handles.VelType_text_1,'Visible','on'); |
---|
1574 | end |
---|
1575 | end |
---|
1576 | case 'FieldMenu' %hidden by default |
---|
1577 | if isequal(lower(varargout{ilist+1}),'one')||isequal(lower(varargout{ilist+1}),'two') |
---|
1578 | set(handles.FieldMenu,'Enable','on') % test for MenuBorser |
---|
1579 | if nb_series >=1 && ~testima_series |
---|
1580 | view_FieldMenu(handles,'on') |
---|
1581 | end |
---|
1582 | end |
---|
1583 | if isequal(lower(varargout{ilist+1}),'two') |
---|
1584 | set(handles.FieldMenu_1,'Enable','on') |
---|
1585 | if nb_series >=2 && ~testima_1 |
---|
1586 | view_FieldMenu_1(handles,'on') |
---|
1587 | end |
---|
1588 | end |
---|
1589 | case 'CoordType' %hidden by default |
---|
1590 | if isequal(lower(varargout{ilist+1}),'on') |
---|
1591 | set(handles.transform_fct,'Enable','on') |
---|
1592 | set(handles.FieldTransform,'Visible','on') |
---|
1593 | % view_TRANSFORM(handles,'on') |
---|
1594 | end |
---|
1595 | case 'GetObject' %hidden by default |
---|
1596 | if isequal(lower(varargout{ilist+1}),'on') |
---|
1597 | set(handles.Objects,'Visible','on') |
---|
1598 | % set(handles.GetObject,'Visible','on'); |
---|
1599 | end |
---|
1600 | case 'Mask' %hidden by default |
---|
1601 | if isequal(lower(varargout{ilist+1}),'on') |
---|
1602 | set(handles.Objects,'Visible','on') |
---|
1603 | % set(handles.GetMask,'Visible','on'); |
---|
1604 | end |
---|
1605 | case 'PARAMETER' |
---|
1606 | set(handles.PARAMETERS_frame,'Visible','on') |
---|
1607 | set(handles.PARAMETERS_title,'Visible','on') |
---|
1608 | set(handles.ParamKey,'Visible','on') |
---|
1609 | %set(handles.ParamVal,'Visible','on') |
---|
1610 | Param_str=varargout{ilist+1}; |
---|
1611 | Param_list=[Param_list; {Param_str}]; |
---|
1612 | end |
---|
1613 | end |
---|
1614 | if ~isempty(Param_list) |
---|
1615 | set(handles.ParamKey,'String',Param_list) |
---|
1616 | set(handles.ParamVal,'Visible','on') |
---|
1617 | end |
---|
1618 | |
---|
1619 | %------------------------------------------------------------------------ |
---|
1620 | % --- Executes on selection change in FieldMenu. |
---|
1621 | function FieldMenu_Callback(hObject, eventdata, handles) |
---|
1622 | %------------------------------------------------------------------------ |
---|
1623 | field_str=get(handles.FieldMenu,'String'); |
---|
1624 | field_index=get(handles.FieldMenu,'Value'); |
---|
1625 | field=field_str{field_index(1)}; |
---|
1626 | if isequal(field,'get_field...') |
---|
1627 | hget_field=findobj(allchild(0),'name','get_field'); |
---|
1628 | if ~isempty(hget_field) |
---|
1629 | delete(hget_field)%delete opened versions of get_field |
---|
1630 | end |
---|
1631 | SeriesData=get(handles.series,'UserData'); |
---|
1632 | filename=SeriesData.CurrentInputFile; |
---|
1633 | if exist(filename,'file') |
---|
1634 | get_field(filename) |
---|
1635 | end |
---|
1636 | elseif isequal(field,'more...') |
---|
1637 | str=calc_field; |
---|
1638 | [ind_answer,v] = listdlg('PromptString','Select a file:',... |
---|
1639 | 'SelectionMode','single',... |
---|
1640 | 'ListString',str); |
---|
1641 | % edit the choice in the fields and action menu |
---|
1642 | scalar=cell2mat(str(ind_answer)); |
---|
1643 | update_menu(handles.FieldMenu,scalar) |
---|
1644 | end |
---|
1645 | |
---|
1646 | %------------------------------------------------------------------------ |
---|
1647 | % --- Executes on selection change in FieldMenu_1. |
---|
1648 | function FieldMenu_1_Callback(hObject, eventdata, handles) |
---|
1649 | %------------------------------------------------------------------------ |
---|
1650 | field_str=get(handles.FieldMenu_1,'String'); |
---|
1651 | field_index=get(handles.FieldMenu_1,'Value'); |
---|
1652 | field=field_str{field_index}; |
---|
1653 | if isequal(field,'get_field...') |
---|
1654 | hget_field=findobj(allchild(0),'name','get_field_1'); |
---|
1655 | if ~isempty(hget_field) |
---|
1656 | delete(hget_field) |
---|
1657 | end |
---|
1658 | SeriesData=get(handles.series,'UserData'); |
---|
1659 | filename=SeriesData.CurrentInputFile_1; |
---|
1660 | if exist(filename,'file') |
---|
1661 | hget_field=get_field(filename); |
---|
1662 | set(hget_field,'name','get_field_1') |
---|
1663 | end |
---|
1664 | elseif isequal(field,'more...') |
---|
1665 | str=calc_field; |
---|
1666 | [ind_answer,v] = listdlg('PromptString','Select a file:',... |
---|
1667 | 'SelectionMode','single',... |
---|
1668 | 'ListString',str); |
---|
1669 | % edit the choice in the fields and action menu |
---|
1670 | scalar=cell2mat(str(ind_answer)); |
---|
1671 | update_menu(handles.FieldMenu_1,scalar) |
---|
1672 | end |
---|
1673 | |
---|
1674 | |
---|
1675 | %%%%%%%%%%%%% |
---|
1676 | function [ind_remove]=find_pairs(dirpair,ind_i,last_i) |
---|
1677 | indsel=ind_i; |
---|
1678 | indiff=diff(ind_i); %test index increment to detect multiplets (several pairs with the same index ind_i) and holes in the series |
---|
1679 | indiff=[1 indiff last_i-ind_i(end)+1];%for testing gaps with the imposed bounds |
---|
1680 | if ~isempty(indiff) |
---|
1681 | indiff2=diff(indiff); |
---|
1682 | indiffp=[indiff2 1]; |
---|
1683 | indiffm=[1 indiff2]; |
---|
1684 | ind_multi_m=find((indiff==0)&(indiffm<0))-1;%indices of first members of multiplets |
---|
1685 | ind_multi_p=find((indiff==0)&(indiffp>0));%indices of last members of multiplets |
---|
1686 | %for each multiplet, select the most recent file |
---|
1687 | ind_remove=[]; |
---|
1688 | for i=1:length(ind_multi_m) |
---|
1689 | ind_pairs=ind_multi_m(i):ind_multi_p(i); |
---|
1690 | for imulti=1:length(ind_pairs) |
---|
1691 | datepair(imulti)=datenum(dirpair(ind_pairs(imulti)).date);%dates of creation |
---|
1692 | end |
---|
1693 | [datenew,indsort2]=sort(datepair); %sort the multiplet by creation date |
---|
1694 | ind_s=indsort2(1:end-1);% |
---|
1695 | ind_remove=[ind_remove ind_pairs(ind_s)];%remove these indices, leave the last one |
---|
1696 | end |
---|
1697 | end |
---|
1698 | |
---|
1699 | %------------------------------------------------------------------------ |
---|
1700 | % --- determine the list of index pairs of processing file |
---|
1701 | function [num_i1,num_i2,num_j1,num_j2,num_i_out,num_j_out]=find_file_indices(num_i,num_j,ind_shift,NomType,mode) |
---|
1702 | %------------------------------------------------------------------------ |
---|
1703 | num_i1=num_i;% set of first image numbers by default |
---|
1704 | num_i2=num_i; |
---|
1705 | num_j1=num_j; |
---|
1706 | num_j2=num_j; |
---|
1707 | num_i_out=num_i; |
---|
1708 | num_j_out=num_j; |
---|
1709 | % if isequal (NomType,'_1-2_1') || isequal (NomType,'_1-2') |
---|
1710 | if isequal(mode,'series(Di)') |
---|
1711 | num_i1_line=num_i+ind_shift(3);% set of first image numbers |
---|
1712 | num_i2_line=num_i+ind_shift(4); |
---|
1713 | % adjust the first and last field number |
---|
1714 | indsel=find(num_i1_line >= 1); |
---|
1715 | num_i_out=num_i(indsel); |
---|
1716 | num_i1_line=num_i1_line(indsel); |
---|
1717 | num_i2_line=num_i2_line(indsel); |
---|
1718 | num_j1=meshgrid(num_j,ones(size(num_i1_line))); |
---|
1719 | num_j2=meshgrid(num_j,ones(size(num_i1_line))); |
---|
1720 | [xx,num_i1]=meshgrid(num_j,num_i1_line); |
---|
1721 | [xx,num_i2]=meshgrid(num_j,num_i2_line); |
---|
1722 | elseif isequal (mode,'series(Dj)')||isequal (mode,'bursts') |
---|
1723 | if isequal(mode,'bursts') %case of bursts (png_old or png_2D) |
---|
1724 | num_j1=ind_shift(1)*ones(size(num_i)); |
---|
1725 | num_j2=ind_shift(2)*ones(size(num_i)); |
---|
1726 | else |
---|
1727 | num_j1_col=num_j+ind_shift(1);% set of first image numbers |
---|
1728 | num_j2_col=num_j+ind_shift(2); |
---|
1729 | % adjust the first field number |
---|
1730 | indsel=find((num_j1_col >= 1)); |
---|
1731 | num_j_out=num_j(indsel); |
---|
1732 | num_j1_col=num_j1_col(indsel); |
---|
1733 | num_j2_col=num_j2_col(indsel); |
---|
1734 | [num_i1,num_j1]=meshgrid(num_i,num_j1_col); |
---|
1735 | [num_i2,num_j2]=meshgrid(num_i,num_j2_col); |
---|
1736 | end |
---|
1737 | end |
---|
1738 | |
---|
1739 | %------------------------------------------------------------------------ |
---|
1740 | % ---- find the times corresponding to the first and last indices of a series |
---|
1741 | function displ_time(handles) |
---|
1742 | %------------------------------------------------------------------------ |
---|
1743 | SeriesData=get(handles.series,'UserData');% |
---|
1744 | first_i=str2num(get(handles.num_first_i,'String')); |
---|
1745 | first_j=str2num(get(handles.num_first_j,'String')); |
---|
1746 | last_i=str2num(get(handles.num_last_i,'String')); |
---|
1747 | last_j=str2num(get(handles.num_last_j,'String')); |
---|
1748 | InputTable=get(handles.InputTable,'Data'); |
---|
1749 | NomType=InputTable(:,4); |
---|
1750 | % NomType=SeriesData.NomType; |
---|
1751 | mode_list=get(handles.mode,'String'); |
---|
1752 | index_mode=get(handles.mode,'Value'); |
---|
1753 | mode=mode_list{index_mode}; |
---|
1754 | |
---|
1755 | time_first=[]; |
---|
1756 | time_last=[]; |
---|
1757 | if ~isfield(SeriesData,'Time') |
---|
1758 | SeriesData.Time{1}=[]; |
---|
1759 | end |
---|
1760 | for iview=1:length(NomType) |
---|
1761 | time_first_cell{iview}='?'; |
---|
1762 | time_last_cell{iview}='?';%default |
---|
1763 | time=SeriesData.Time{iview}; |
---|
1764 | if isequal(NomType{iview},'_1-2_1')|isequal(NomType{iview},'_1_1-2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_1-2') |
---|
1765 | if isfield(SeriesData,'displ_num')& ~isempty(SeriesData.displ_num) |
---|
1766 | ind_shift=SeriesData.displ_num(iview,:); |
---|
1767 | if isequal(mode,'bursts') |
---|
1768 | first_j=0; |
---|
1769 | last_j=0; |
---|
1770 | end |
---|
1771 | first_i1=first_i +ind_shift(3); |
---|
1772 | first_i2 =first_i +ind_shift(4); |
---|
1773 | first_j1 =first_j +ind_shift(1); |
---|
1774 | first_j2 =first_j +ind_shift(2); |
---|
1775 | last_i1=last_i +ind_shift(3); |
---|
1776 | last_i2 =last_i +ind_shift(4); |
---|
1777 | last_j1 =last_j +ind_shift(1); |
---|
1778 | last_j2 =last_j +ind_shift(2); |
---|
1779 | siz=size(SeriesData.Time{1}); |
---|
1780 | if first_i1>=1 && first_j1>=1 && siz(1)>=last_i2 && siz(2)>=last_j2 |
---|
1781 | time_first=(time(first_i1,first_j1)+time(first_i2,first_j2))/2; |
---|
1782 | time_last=(time(last_i1,last_j1)+time(last_i2,last_j2))/2; |
---|
1783 | else%read the time in the nc files |
---|
1784 | RootPath=get(handles.RootPath,'String'); |
---|
1785 | RootFile=get(handles.RootFile,'String'); |
---|
1786 | SubDir=get(handles.SubDir,'String'); |
---|
1787 | %VelType=get(handles.VelType,'String'); |
---|
1788 | VelType_str=get(handles.VelTypeMenu,'String'); |
---|
1789 | VelType_val=get(handles.VelTypeMenu,'Value'); |
---|
1790 | VelType=VelType_str{VelType_val}; |
---|
1791 | filebase=fullfile(RootPath{1},RootFile{1}); |
---|
1792 | [filefirst]=name_generator(filebase,first_i1,first_j1,'.nc',NomType{iview},1,first_i2,first_j2,SubDir{iview}); |
---|
1793 | if exist(filefirst,'file') |
---|
1794 | Attrib=nc2struct(filefirst,[]); |
---|
1795 | if isfield(Attrib,'Time') |
---|
1796 | time_first=Attrib.Time; |
---|
1797 | else |
---|
1798 | if isfield(Attrib,'absolut_time_T0') |
---|
1799 | time_first=Attrib.absolut_time_T0; |
---|
1800 | end |
---|
1801 | if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) |
---|
1802 | time_first=Attrib.absolut_time_T0_2; |
---|
1803 | end |
---|
1804 | end |
---|
1805 | end |
---|
1806 | [filelast]=name_generator(filebase,last_i1,last_j1,'.nc',NomType{iview},1,last_i2,last_j2,SubDir{iview}); |
---|
1807 | if exist(filelast,'file') |
---|
1808 | Attrib=nc2struct(filelast,[]); |
---|
1809 | if isfield(Attrib,'Time') |
---|
1810 | time_last=Attrib.Time; |
---|
1811 | else |
---|
1812 | if isfield(Attrib,'absolut_time_T0') |
---|
1813 | time_last=Attrib.absolut_time_T0; |
---|
1814 | end |
---|
1815 | if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) |
---|
1816 | time_last=Attrib.absolut_time_T0_2; |
---|
1817 | end |
---|
1818 | end |
---|
1819 | end |
---|
1820 | end |
---|
1821 | end |
---|
1822 | else |
---|
1823 | siz=size(time); |
---|
1824 | if siz(1)>=last_i && siz(2)>=last_j && first_i>=1 && first_j>=1 |
---|
1825 | time_first=times(first_i,first_j); |
---|
1826 | time_last=times(last_i,last_j); |
---|
1827 | end |
---|
1828 | end |
---|
1829 | time_first_cell{iview}=num2str(time_first,4); |
---|
1830 | time_last_cell{iview}=num2str(time_last,4); |
---|
1831 | end |
---|
1832 | % set(handles.time_first,'Value',1) |
---|
1833 | % set(handles.time_last,'Value',1) |
---|
1834 | % set(handles.time_first,'String',time_first_cell); |
---|
1835 | % set(handles.time_last,'String',time_last_cell); |
---|
1836 | |
---|
1837 | %------------------------------------------------------------------------ |
---|
1838 | % --- Executes on button press in GetObject. |
---|
1839 | function GetObject_Callback(hObject, eventdata, handles) |
---|
1840 | %------------------------------------------------------------------------ |
---|
1841 | SeriesData=get(handles.series,'UserData'); |
---|
1842 | value=get(handles.GetObject,'Value'); |
---|
1843 | if value |
---|
1844 | set(handles.GetObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow |
---|
1845 | % DataInit.ParentButton=handles.GetObject; |
---|
1846 | hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle |
---|
1847 | if ishandle(hset_object) |
---|
1848 | uistack(hset_object,'top') |
---|
1849 | %[SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface |
---|
1850 | else |
---|
1851 | %get the object file |
---|
1852 | defaultname=get(handles.RootPath,'String'); |
---|
1853 | if isempty(defaultname) |
---|
1854 | defaultname={''}; |
---|
1855 | end |
---|
1856 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
1857 | {'*.xml;*.mat', ' (*.xml,*.mat)'; |
---|
1858 | '*.xml', '.xml files '; ... |
---|
1859 | '*.mat', '.mat matlab files '}, ... |
---|
1860 | 'Pick an xml object file (or use uvmat to create it)',defaultname{1}); |
---|
1861 | fileinput=[PathName FileName];%complete file name |
---|
1862 | testblank=findstr(fileinput,' ');%look for blanks |
---|
1863 | if ~isempty(testblank) |
---|
1864 | msgbox_uvmat('ERROR','forbidden input file name: contain blanks') |
---|
1865 | return |
---|
1866 | end |
---|
1867 | sizf=size(fileinput); |
---|
1868 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end |
---|
1869 | %read the file |
---|
1870 | t=xmltree(fileinput); |
---|
1871 | data=convert(t); |
---|
1872 | if ~isfield(data,'Style') |
---|
1873 | data.Style='points'; |
---|
1874 | end |
---|
1875 | if ~isfield(data,'ProjMode') |
---|
1876 | data.ProjMode='projection'; |
---|
1877 | end |
---|
1878 | transform_menu=get(handles.transform_fct,'String'); |
---|
1879 | ichoice=get(handles.transform_fct,'Value'); |
---|
1880 | % if isequal(transform_menu{ichoice},'px'); |
---|
1881 | % data.CoordType='px'; |
---|
1882 | % else |
---|
1883 | % data.CoordType='phys'; |
---|
1884 | % end |
---|
1885 | data.desable_plot=1; |
---|
1886 | [SeriesData.hset_object,SeriesData.sethandles]=set_object(data);% call the set_object interface |
---|
1887 | end |
---|
1888 | else |
---|
1889 | set(handles.GetObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green |
---|
1890 | % if isfield(SeriesData,'hset_object')&& ishandle(SeriesData.hset_object) |
---|
1891 | % close(SeriesData.hset_object) |
---|
1892 | % end |
---|
1893 | end |
---|
1894 | set(handles.series,'UserData',SeriesData) |
---|
1895 | |
---|
1896 | %-------------------------------------------------------------- |
---|
1897 | function GetMask_Callback(hObject, eventdata, handles) |
---|
1898 | value=get(handles.GetMask,'Value'); |
---|
1899 | if value |
---|
1900 | msgbox_uvmat('ERROR','not implemented yet') |
---|
1901 | end |
---|
1902 | %-------------------------------------------------------------- |
---|
1903 | |
---|
1904 | %------------------------------------------------------------------- |
---|
1905 | %'uv_ncbrowser': interactively calls the netcdf file browser 'get_field.m' |
---|
1906 | function ncbrowser_uvmat(hObject, eventdata) |
---|
1907 | %------------------------------------------------------------------- |
---|
1908 | bla=get(gcbo,'String'); |
---|
1909 | ind=get(gcbo,'Value'); |
---|
1910 | filename=cell2mat(bla(ind)); |
---|
1911 | blank=find(filename==' '); |
---|
1912 | filename=filename(1:blank-1); |
---|
1913 | get_field(filename) |
---|
1914 | |
---|
1915 | % ------------------------------------------------------------------ |
---|
1916 | function MenuHelp_Callback(hObject, eventdata, handles) |
---|
1917 | %------------------------------------------------------------------- |
---|
1918 | path_to_uvmat=which ('uvmat');% check the path of uvmat |
---|
1919 | pathelp=fileparts(path_to_uvmat); |
---|
1920 | helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html'); |
---|
1921 | if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package') |
---|
1922 | else |
---|
1923 | addpath (fullfile(pathelp,'uvmat_doc')) |
---|
1924 | web([helpfile '#series']) |
---|
1925 | end |
---|
1926 | |
---|
1927 | %------------------------------------------------------------------- |
---|
1928 | % --- Executes on selection change in transform_fct. |
---|
1929 | function transform_fct_Callback(hObject, eventdata, handles) |
---|
1930 | %------------------------------------------------------------------- |
---|
1931 | global nb_transform |
---|
1932 | |
---|
1933 | menu=get(handles.transform_fct,'String'); |
---|
1934 | ind_coord=get(handles.transform_fct,'Value'); |
---|
1935 | coord_option=menu{ind_coord}; |
---|
1936 | list_transform=get(handles.transform_fct,'UserData'); |
---|
1937 | ff=functions(list_transform{end}); |
---|
1938 | if isequal(coord_option,'more...'); |
---|
1939 | coord_fct=''; |
---|
1940 | prompt = {'Enter the name of the transform function'}; |
---|
1941 | dlg_title = 'user defined transform'; |
---|
1942 | num_lines= 1; |
---|
1943 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
1944 | {'*.m', ' (*.m)'; |
---|
1945 | '*.m', '.m files '; ... |
---|
1946 | '*.*', 'All Files (*.*)'}, ... |
---|
1947 | 'Pick a file', ff.file); |
---|
1948 | if isequal(PathName(end),'/')||isequal(PathName(end),'\') |
---|
1949 | PathName(end)=[]; |
---|
1950 | end |
---|
1951 | transform_selected =fullfile(PathName,FileName); |
---|
1952 | if ~exist(transform_selected,'file') |
---|
1953 | return |
---|
1954 | end |
---|
1955 | [ppp,transform,xt_fct]=fileparts(FileName);% removes extension .m |
---|
1956 | if ~isequal(ext_fct,'.m') |
---|
1957 | msgbox_uvmat('ERROR','a Matlab function .m must be introduced'); |
---|
1958 | return |
---|
1959 | end |
---|
1960 | menu=update_menu(handles.transform_fct,transform);%add the selected fct to the menu |
---|
1961 | ind_coord=get(handles.transform_fct,'Value'); |
---|
1962 | addpath(PathName) |
---|
1963 | list_transform{ind_coord}=str2func(transform);% create the function handle corresponding to the newly seleced function |
---|
1964 | set(handles.transform_fct,'UserData',list_transform) |
---|
1965 | rmpath(PathName) |
---|
1966 | % save the new menu in the personal file 'uvmat_perso.mat' |
---|
1967 | dir_perso=prefdir;%personal Matalb directory |
---|
1968 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
1969 | if exist(profil_perso,'file') |
---|
1970 | for ilist=nb_transform+1:numel(list_transform) |
---|
1971 | ff=functions(list_transform{ilist}); |
---|
1972 | transform_fct{ilist-nb_transform}=ff.file; |
---|
1973 | end |
---|
1974 | save (profil_perso,'transform_fct','-append'); %store the root name for future opening of uvmat |
---|
1975 | end |
---|
1976 | end |
---|
1977 | |
---|
1978 | %check the current path to the selected function |
---|
1979 | if ~isempty(list_transform{ind_coord}) |
---|
1980 | func=functions(list_transform{ind_coord}); |
---|
1981 | set(handles.path_transform,'String',fileparts(func.file)); %show the path to the senlected function |
---|
1982 | else |
---|
1983 | set(handles.path_transform,'String',''); %show the path to the senlected function |
---|
1984 | end |
---|
1985 | %------------------------------------------------------------------------ |
---|
1986 | % --- generates a series of file names with reference numbers between range1 and |
---|
1987 | % --- range2 with increment incr. The reference number num_ref is the image number at the middle of the |
---|
1988 | % --- image pair. The set of first numbers num1 of the image pairs is also |
---|
1989 | % --- given as output |
---|
1990 | % function [num_i1,num_i2,num_j1,num_j2,nbmissing]=netseries_generator(filebase,subdir,mode,first_i,incr_i,last_i,first_j,incr_j,last_j) |
---|
1991 | % %------------------------------------------------------------------------ |
---|
1992 | % [Path,Name]=fileparts(filebase); |
---|
1993 | % filebasesub=fullfile(Path,subdir,Name); |
---|
1994 | % filecell={};%default |
---|
1995 | % num_i1=[]; |
---|
1996 | % num_i2=[]; |
---|
1997 | % num_j1=[]; |
---|
1998 | % num_j2=[]; |
---|
1999 | % ind0_i=first_i:incr_i:last_i; |
---|
2000 | % nbcolumn=length(ind0_i); |
---|
2001 | % ind0_j=first_j:incr_j:last_j; |
---|
2002 | % nbline=length(ind0_j); |
---|
2003 | % if isequal(mode,'#_ab') |
---|
2004 | % dirpair=dir([filebasesub '*_*.nc']); |
---|
2005 | % elseif isequal(mode,'bursts')||isequal(mode,'series(Dj)') |
---|
2006 | % dirpair=dir([filebasesub '_*_*-*.nc']); |
---|
2007 | % elseif isequal(mode,'series(Di)') |
---|
2008 | % dirpair=dir([filebasesub '_*-*_*.nc']); |
---|
2009 | % else |
---|
2010 | % msgbox_uvmat('ERROR','option *|* not yet implemented') |
---|
2011 | % return |
---|
2012 | % end |
---|
2013 | % if isempty(dirpair) |
---|
2014 | % msgbox_uvmat('ERROR','no pair detected in the selected range') |
---|
2015 | % return |
---|
2016 | % end |
---|
2017 | % |
---|
2018 | % if isequal(mode,'bursts')||isequal(mode,'#_ab') |
---|
2019 | % icount=0; |
---|
2020 | % for ifile=1:length(dirpair) |
---|
2021 | % [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); |
---|
2022 | % num1_r=str2num(str_1); |
---|
2023 | % if isequal(RootFile,Name) & ~isempty(num1_r) |
---|
2024 | % num_i1(ifile)=num1_r; |
---|
2025 | % num_a(ifile)=stra2num(str_a); |
---|
2026 | % num_b(ifile)=stra2num(str_b); |
---|
2027 | % end |
---|
2028 | % end |
---|
2029 | % test_range= (num_i1 >=first_i)&(num_i1<= last_i);% =1 when both numbers are in the range |
---|
2030 | % ind_i=((num_i1-first_i)/incr_i)+1;%indices i in the list of prescribed file indices |
---|
2031 | % select=find(test_range &(floor(ind_i)==ind_i));%selected indices of num_i1 in the file directory |
---|
2032 | % ind_i=ind_i(select);%set of selected indices ind_i |
---|
2033 | % [ind_i,indsort]=sort(ind_i);%sorted list of ind_i |
---|
2034 | % select=select(indsort); |
---|
2035 | % num_i1=num_i1(select); |
---|
2036 | % num_a=num_a(select); |
---|
2037 | % num_b=num_b(select); |
---|
2038 | % dirpair=dirpair(select); |
---|
2039 | % [ind_remove]=find_pairs(dirpair,ind_i,nbcolumn); |
---|
2040 | % ind_i(ind_remove)=[]; |
---|
2041 | % num_a(ind_remove)=[]; |
---|
2042 | % num_b(ind_remove)=[]; |
---|
2043 | % num_j1=zeros(1,nbcolumn);%default |
---|
2044 | % num_j2=num_j1; |
---|
2045 | % num_j1(ind_i)=num_a; |
---|
2046 | % num_j2(ind_i)=num_b; |
---|
2047 | % num_i1=first_i:incr_i:last_i; |
---|
2048 | % num_i2=num_i1; |
---|
2049 | % nbmissing=nbcolumn-length(ind_i); |
---|
2050 | % |
---|
2051 | % elseif isequal(mode,'series(Di)') |
---|
2052 | % %ind0_i=num_first_i:num_incr_i:num_last_i; |
---|
2053 | % %nbcolumn=length(ind0_i); |
---|
2054 | % %ind0_j=num_first_j:num_incr_j:num_last_j; |
---|
2055 | % %nbline=length(ind0_j); |
---|
2056 | % %dirpair=dir([filebasesub '_*-*_*.nc']); |
---|
2057 | % for ifile=1:length(dirpair) |
---|
2058 | % [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); |
---|
2059 | % num_i1_r(ifile)=str2num(str_1); |
---|
2060 | % num_i2_r(ifile)=str2num(str_2); |
---|
2061 | % num_j(ifile)=str2num(str_a); |
---|
2062 | % end |
---|
2063 | % num_i=floor((num_i1_r+num_i2_r)/2); %list of reference indices of the detected files |
---|
2064 | % test_range= (num_i >=first_i)&(num_i<= last_i)&(num_j >=first_j)&(num_j<= last_j);% =1 when both numbers are in the range |
---|
2065 | % ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices |
---|
2066 | % ind_j=((num_j-first_j)/incr_j)+1; |
---|
2067 | % ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices |
---|
2068 | % select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory |
---|
2069 | % ind_ij=ind_ij(select);%set of selected indices ind_ij |
---|
2070 | % [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij |
---|
2071 | % select=select(indsort); |
---|
2072 | % num_i1_r=num_i1_r(select); |
---|
2073 | % num_i2_r=num_i2_r(select); |
---|
2074 | % dirpair=dirpair(select); |
---|
2075 | % [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ; |
---|
2076 | % ind_ij(ind_remove)=[]; |
---|
2077 | % num_i1_r(ind_remove)=[]; |
---|
2078 | % num_i2_r(ind_remove)=[]; |
---|
2079 | % num_i1=zeros(1,nbline*nbcolumn);%default |
---|
2080 | % num_i2=num_i1; |
---|
2081 | % num_i1(ind_ij)=num_i1_r; |
---|
2082 | % num_j2(ind_ij)=num_i2_r; |
---|
2083 | % num_i1=reshape(num_i1,nbline,nbcolumn); |
---|
2084 | % num_i2=reshape(num_i2,nbline,nbcolumn); |
---|
2085 | % num_j1=meshgrid(ind0_i,ind0_j); |
---|
2086 | % num_j2=num_j1; |
---|
2087 | % nbmissing=nbline*nbcolumn-length(ind_ij); |
---|
2088 | % elseif isequal(mode,'series(Dj)') |
---|
2089 | % for ifile=1:length(dirpair) |
---|
2090 | % [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); |
---|
2091 | % num_i(ifile)=str2num(str_1); |
---|
2092 | % num_a(ifile)=str2num(str_a); |
---|
2093 | % num_b(ifile)=str2num(str_b); |
---|
2094 | % end |
---|
2095 | % num_j=floor((num_a+num_b)/2); %list of reference indices of the detected files |
---|
2096 | % test_range= (num_i >=first_i)&(num_i<= last_i)&(num_j >=first_j)&(num_j<= last_j);% =1 when both numbers are in the range |
---|
2097 | % ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices |
---|
2098 | % ind_j=((num_j-first_j)/incr_j)+1; |
---|
2099 | % ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices |
---|
2100 | % select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory |
---|
2101 | % ind_ij=ind_ij(select);%set of selected indices ind_ij |
---|
2102 | % [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij |
---|
2103 | % select=select(indsort); |
---|
2104 | % num_i=num_i(select); |
---|
2105 | % num_a=num_a(select); |
---|
2106 | % num_b=num_b(select); |
---|
2107 | % dirpair=dirpair(select); |
---|
2108 | % [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ; |
---|
2109 | % ind_ij(ind_remove)=[]; |
---|
2110 | % num_a(ind_remove)=[]; |
---|
2111 | % num_b(ind_remove)=[]; |
---|
2112 | % num_j1=zeros(1,nbline*nbcolumn);%default |
---|
2113 | % num_j2=num_j1; |
---|
2114 | % num_j1(ind_ij)=num_a; |
---|
2115 | % num_j2(ind_ij)=num_b; |
---|
2116 | % num_j1=reshape(num_j1,nbline,nbcolumn); |
---|
2117 | % num_j2=reshape(num_j2,nbline,nbcolumn); |
---|
2118 | % num_i1=meshgrid(ind0_i,ind0_j); |
---|
2119 | % num_i2=num_i1; |
---|
2120 | % nbmissing=nbline*nbcolumn-length(ind_ij); |
---|
2121 | % end |
---|
2122 | |
---|
2123 | |
---|
2124 | % --- Executes on button press in REFRESH_INDICES. |
---|
2125 | |
---|
2126 | |
---|
2127 | function REFRESH_INDICES_Callback(hObject, eventdata, handles) |
---|
2128 | % hObject handle to REFRESH_INDICES (see GCBO) |
---|
2129 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2130 | % handles structure with handles and user data (see GUIDATA) |
---|
2131 | set(handles.REFRESH_INDICES,'BackgroundColor',[0.7 0.7 0.7]) |
---|
2132 | InputTable=get(handles.InputTable,'Data'); |
---|
2133 | check_lines=get(handles.REFRESH_INDICES,'UserData'); |
---|
2134 | |
---|
2135 | %% check the indices and FileTypes for each series (limited to the new ones to save time) |
---|
2136 | for ind_list=1:length(check_lines) |
---|
2137 | if check_lines(ind_list) |
---|
2138 | InputLine=InputTable(ind_list,:); |
---|
2139 | detect_idem=strcmp('"',InputLine);% look for '" (repeat of previous data) |
---|
2140 | detect_idem=detect_idem(detect_idem>0); |
---|
2141 | if ~isempty (detect_idem) |
---|
2142 | InputLine(detect_idem)=InputTable(ind_list-1,detect_idem); |
---|
2143 | set(handles.InputTable,'Data',InputTable) |
---|
2144 | end |
---|
2145 | fileinput=fullfile_uvmat(InputLine{1},InputLine{2},InputLine{3},InputLine{5},InputLine{4},1,2,1,2); |
---|
2146 | %fileinput=name_generator(fullfile(InputLine{1},InputLine{3}),1,1,InputLine{5},InputLine{4},1,2,2,InputLine{2}) |
---|
2147 | %update file series defined by the selected line |
---|
2148 | [InputTable{ind_list,1},InputTable{ind_list,3},InputTable{(ind_list),4},errormsg]=update_indices(handles,fileinput,ind_list); |
---|
2149 | if ~isempty(errormsg) |
---|
2150 | msgbox_uvmat('ERROR',errormsg) |
---|
2151 | return |
---|
2152 | end |
---|
2153 | end |
---|
2154 | end |
---|
2155 | set(handles.InputTable,'Data',InputTable) |
---|
2156 | SeriesData=get(handles.series,'UserData'); |
---|
2157 | |
---|
2158 | state_j='off'; |
---|
2159 | state_Pairs='off'; |
---|
2160 | state_InputFields='off'; |
---|
2161 | val=get(handles.ListView,'Value'); |
---|
2162 | ListViewString={''}; |
---|
2163 | if ~isempty(SeriesData) |
---|
2164 | % ListViewString={}; |
---|
2165 | for ilist=1:size(InputTable,1) |
---|
2166 | if ~isempty(SeriesData.j1_series{ilist}) |
---|
2167 | state_j='on'; |
---|
2168 | end |
---|
2169 | if ~isempty(SeriesData.i2_series{ilist})||~isempty(SeriesData.j2_series{ilist}) |
---|
2170 | state_Pairs='on'; |
---|
2171 | ListViewString{ilist}=num2str(ilist); |
---|
2172 | if check_lines(ilist) |
---|
2173 | val=ilist;%select the last pair if it is a new entry |
---|
2174 | end |
---|
2175 | end |
---|
2176 | if strcmp(SeriesData.FileType,'civx')||strcmp(SeriesData.FileType,'civdata') |
---|
2177 | state_InputFields='on'; |
---|
2178 | end |
---|
2179 | end |
---|
2180 | end |
---|
2181 | set(handles.ListView,'Value',val) |
---|
2182 | set(handles.ListView,'String',ListViewString) |
---|
2183 | if strcmp(state_Pairs,'on') |
---|
2184 | ListView_Callback(hObject,eventdata,handles) |
---|
2185 | end |
---|
2186 | set(handles.Pairs,'Visible',state_InputFields) |
---|
2187 | enable_j(handles,state_j) |
---|
2188 | set(handles.REFRESH_INDICES,'BackgroundColor',[1 0 0]) |
---|
2189 | set(handles.REFRESH_INDICES,'visible','off') |
---|
2190 | |
---|
2191 | % update min and max indices for a series |
---|
2192 | function [RootPath,RootFile,NomType,errormsg]=update_indices(handles,fileinput,iview) |
---|
2193 | |
---|
2194 | %% look for min and max indices existing in the file series and update SeriesData |
---|
2195 | errormsg=''; |
---|
2196 | [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(fileinput); |
---|
2197 | if isempty(RootFile)&&isempty(i1_series) |
---|
2198 | errormsg='no input file in the series'; |
---|
2199 | return |
---|
2200 | end |
---|
2201 | [tild,tild,FileExt]=fileparts(fileinput); |
---|
2202 | |
---|
2203 | MinIndex=get(handles.MinIndex,'Data'); |
---|
2204 | MaxIndex=get(handles.MaxIndex,'Data'); |
---|
2205 | MinIndex_i=min(i1_series(i1_series>0)); |
---|
2206 | if ~isempty(i2_series) |
---|
2207 | MaxIndex_i=max(i2_series(i2_series>0)); |
---|
2208 | else |
---|
2209 | MaxIndex_i=max(i1_series(i1_series>0)); |
---|
2210 | end |
---|
2211 | MinIndex_j=min(j1_series(j1_series>0)); |
---|
2212 | if ~isempty(j2_series) |
---|
2213 | MaxIndex_j=max(j2_series(j2_series>0)); |
---|
2214 | else |
---|
2215 | MaxIndex_j=max(j1_series(j1_series>0)); |
---|
2216 | end |
---|
2217 | MinIndex{iview,1}=MinIndex_i; |
---|
2218 | MinIndex{iview,2}=MinIndex_j; |
---|
2219 | MaxIndex{iview,1}=MaxIndex_i; |
---|
2220 | MaxIndex{iview,2}=MaxIndex_j; |
---|
2221 | set(handles.MinIndex,'Data',MinIndex) |
---|
2222 | set(handles.MaxIndex,'Data',MaxIndex) |
---|
2223 | SeriesData=get(handles.series,'UserData'); |
---|
2224 | SeriesData.i1_series{iview}=i1_series; |
---|
2225 | SeriesData.i2_series{iview}=i2_series; |
---|
2226 | SeriesData.j1_series{iview}=j1_series; |
---|
2227 | SeriesData.j2_series{iview}=j2_series; |
---|
2228 | SeriesData.FileType{iview}=FileType; |
---|
2229 | |
---|
2230 | %% represents the set of existing files as an image |
---|
2231 | set(handles.waitbar_frame,'Units','pixels') |
---|
2232 | pos=get(handles.waitbar_frame,'Position'); |
---|
2233 | xima=0.5:pos(3)-0.5;% pixel positions on the image representing the existing file indices |
---|
2234 | yima=0.5:pos(4)-0.5; |
---|
2235 | [XIma,YIma]=meshgrid(xima,yima); |
---|
2236 | nb_i=size(i1_series,1); |
---|
2237 | nb_j=size(i1_series,2); |
---|
2238 | ind_i=(0.5:nb_i-0.5)*pos(3)/nb_i; |
---|
2239 | ind_j=(0.5:nb_j-0.5)*pos(4)/nb_j; |
---|
2240 | [Ind_i,Ind_j]=meshgrid(ind_i,ind_j); |
---|
2241 | CData=zeros([size(XIma) 3]); |
---|
2242 | file_ima=double((i1_series(:,:,1)>0)'); |
---|
2243 | if numel(file_ima)>=2 |
---|
2244 | if size(file_ima,1)==1 |
---|
2245 | CLine=interp1(ind_i,file_ima,xima,'nearest'); |
---|
2246 | CData(:,:,2)=ones(size(yima'))*CLine; |
---|
2247 | else |
---|
2248 | CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest'); |
---|
2249 | end |
---|
2250 | set(handles.waitbar_frame,'CData',CData) |
---|
2251 | end |
---|
2252 | set(handles.waitbar_frame,'Units','normalized') |
---|
2253 | |
---|
2254 | %% enable field and veltype menus |
---|
2255 | testfield=isequal(get(handles.FieldMenu,'enable'),'on'); |
---|
2256 | testfield_1=isequal(get(handles.FieldMenu_1,'enable'),'on'); |
---|
2257 | testveltype=isequal(get(handles.VelTypeMenu,'enable'),'on'); |
---|
2258 | testveltype_1=isequal(get(handles.VelTypeMenu_1,'enable'),'on'); |
---|
2259 | testtransform=isequal(get(handles.transform_fct,'Enable'),'on'); |
---|
2260 | testnc=0; |
---|
2261 | testnc_1=0; |
---|
2262 | testcivx=0; |
---|
2263 | testcivx_1=0; |
---|
2264 | %TODO: update |
---|
2265 | % if length(FileExtCell)==1 || length(FileExtCell)>2 |
---|
2266 | % for iview=1:length(FileExtCell) |
---|
2267 | % if isequal(FileExtCell{iview},'.nc') |
---|
2268 | % testnc=1; |
---|
2269 | % end |
---|
2270 | % if isequal(FileTypeCell{iview},'civx') |
---|
2271 | % testcivx=1; |
---|
2272 | % end |
---|
2273 | % end |
---|
2274 | % elseif length(FileExtCell)==2 |
---|
2275 | % testnc=isequal(FileExtCell{1},'.nc'); |
---|
2276 | % testnc_1=isequal(FileExtCell{2},'.nc'); |
---|
2277 | % testcivx=isequal(FileTypeCell{1},'civx'); |
---|
2278 | % testcivx_1=isequal(FileTypeCell{2},'civx'); |
---|
2279 | % end |
---|
2280 | if testfield && testnc |
---|
2281 | view_FieldMenu(handles,'on') |
---|
2282 | if testcivx |
---|
2283 | menustr=get(handles.FieldMenu,'String'); |
---|
2284 | if isequal(menustr,{'get_field...'}) |
---|
2285 | set(handles.FieldMenu,'String',{'get_field...';'velocity';'vort';'div';'more...'}) |
---|
2286 | end |
---|
2287 | else |
---|
2288 | set(handles.FieldMenu,'Value',1) |
---|
2289 | set(handles.FieldMenu,'String',{'get_field...'}) |
---|
2290 | end |
---|
2291 | else |
---|
2292 | view_FieldMenu(handles,'off') |
---|
2293 | end |
---|
2294 | if testfield_1 && testnc_1 |
---|
2295 | view_FieldMenu_1(handles,'on') |
---|
2296 | if testcivx_1 |
---|
2297 | menustr=get(handles.FieldMenu_1,'String'); |
---|
2298 | if isequal(menustr,{'get_field...'}) |
---|
2299 | set(handles.FieldMenu_1,'String',{'get_field...';'velocity';'vort';'div';'more...'}) |
---|
2300 | end |
---|
2301 | else |
---|
2302 | set(handles.FieldMenu_1,'Value',1) |
---|
2303 | set(handles.FieldMenu_1,'String',{'get_field...'}) |
---|
2304 | end |
---|
2305 | else |
---|
2306 | view_FieldMenu_1(handles,'off') |
---|
2307 | end |
---|
2308 | if testveltype && testcivx |
---|
2309 | set(handles.VelTypeMenu,'Visible','on') |
---|
2310 | set(handles.VelType_text,'Visible','on'); |
---|
2311 | else |
---|
2312 | set(handles.VelTypeMenu,'Visible','off') |
---|
2313 | set(handles.VelType_text,'Visible','off'); |
---|
2314 | end |
---|
2315 | if testveltype_1 && testcivx_1 |
---|
2316 | set(handles.VelTypeMenu_1,'Visible','on') |
---|
2317 | set(handles.VelType_text_1,'Visible','on'); |
---|
2318 | else |
---|
2319 | set(handles.VelTypeMenu_1,'Visible','off') |
---|
2320 | set(handles.VelType_text_1,'Visible','off'); |
---|
2321 | end |
---|
2322 | if testtransform && (testcivx || testima) |
---|
2323 | set(handles.FieldTransform,'Visible','on') |
---|
2324 | % view_TRANSFORM(handles,'on') |
---|
2325 | else |
---|
2326 | set(handles.FieldTransform,'Visible','off') |
---|
2327 | % view_TRANSFORM(handles,'off') |
---|
2328 | end |
---|
2329 | %TODO:update |
---|
2330 | % if ~isequal(FileExt,'.nc') && ~isequal(FileExt,'.cdf') && ~testima |
---|
2331 | % msgbox_uvmat('ERROR',['invalid input file extension ' FileExt]) |
---|
2332 | % return |
---|
2333 | % end |
---|
2334 | |
---|
2335 | %% read image documentation file if found%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
2336 | ext_imadoc=''; |
---|
2337 | FileBase=fullfile(RootPath,RootFile); |
---|
2338 | if isequal(FileExt,'.xml')||isequal(FileExt,'.civ') |
---|
2339 | ext_imadoc=FileExt; |
---|
2340 | elseif exist([FileBase '.xml'],'file') |
---|
2341 | ext_imadoc='.xml'; |
---|
2342 | elseif exist([FileBase '.civ'],'file') |
---|
2343 | ext_imadoc='.civ'; |
---|
2344 | end |
---|
2345 | %read the ImaDoc file |
---|
2346 | XmlData=[]; |
---|
2347 | NbSlice_calib={}; |
---|
2348 | if isequal(ext_imadoc,'.xml') |
---|
2349 | [XmlData,warntext]=imadoc2struct([FileBase '.xml']); |
---|
2350 | if isfield(XmlData,'Heading') && isfield(XmlData.Heading,'ImageName') && ischar(XmlData.Heading.ImageName) |
---|
2351 | [PP,FF,ext_ima_read]=fileparts(XmlData.Heading.ImageName); |
---|
2352 | end |
---|
2353 | if isfield(XmlData,'Time') |
---|
2354 | time=XmlData.Time; |
---|
2355 | end |
---|
2356 | if isfield(XmlData,'Camera') |
---|
2357 | if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice) |
---|
2358 | NbSlice_calib{iview}=XmlData.Camera.NbSlice;% Nbre of slices for Zindex in phys transform |
---|
2359 | if ~isequal(NbSlice_calib{iview},NbSlice_calib{1}) |
---|
2360 | msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series'); |
---|
2361 | end |
---|
2362 | end |
---|
2363 | if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit) |
---|
2364 | TimeUnit=XmlData.Camera.TimeUnit; |
---|
2365 | end |
---|
2366 | end |
---|
2367 | if ~isempty(warntext) |
---|
2368 | msgbox_uvmat('WARNING',warntext) |
---|
2369 | end |
---|
2370 | elseif isequal(ext_imadoc,'.civ') |
---|
2371 | [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']); |
---|
2372 | time=XmlData.Time; |
---|
2373 | if error==2, warntext=['no file ' FileBase '.civ']; |
---|
2374 | elseif error==1, warntext='inconsistent number of fields in the .civ file'; |
---|
2375 | end |
---|
2376 | end |
---|
2377 | |
---|
2378 | |
---|
2379 | %% number of slices |
---|
2380 | if isfield(XmlData,'GeometryCalib') && isfield(XmlData.GeometryCalib,'SliceCoord') |
---|
2381 | siz=size(XmlData.GeometryCalib.SliceCoord); |
---|
2382 | if siz(1)>1 |
---|
2383 | NbSlice=siz(1); |
---|
2384 | else |
---|
2385 | NbSlice=1; |
---|
2386 | end |
---|
2387 | set(handles.num_NbSlice,'String',num2str(NbSlice)) |
---|
2388 | end |
---|
2389 | % set(handles.mode,'Visible','off') % do not show index pairs by default |
---|
2390 | set(handles.Pairs,'Visible','off') |
---|
2391 | % set(handles.ref_i,'Visible','off') |
---|
2392 | % set(handles.ref_i_text,'Visible','off') |
---|
2393 | testpair=0; |
---|
2394 | %set the menus of image pairs and default selection for series |
---|
2395 | %list pairs if relevant |
---|
2396 | % Val=get(handles.NomType,'Value'); |
---|
2397 | % synchronise_view(handles,Val) |
---|
2398 | |
---|
2399 | % if ~isfield(SeriesData,'j1_series')||isempty(SeriesData.j1_series{index}) |
---|
2400 | % state_j='off'; %no need for j index |
---|
2401 | % else |
---|
2402 | % state_j='on'; %case of j index |
---|
2403 | % end |
---|
2404 | % show index pairs if files exist |
---|
2405 | set(handles.series,'UserData',SeriesData) |
---|
2406 | |
---|
2407 | |
---|
2408 | |
---|
2409 | % --- Executes on button press in BATCH. |
---|
2410 | function BATCH_Callback(hObject, eventdata, handles) |
---|
2411 | % hObject handle to BATCH (see GCBO) |
---|
2412 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2413 | % handles structure with handles and user data (see GUIDATA) |
---|
2414 | Series=read_GUI(handles.series); |
---|
2415 | t=struct2xml(Series); |
---|
2416 | save(t); %TODO: determine a xml file name |
---|
2417 | |
---|
2418 | % list_action=get(handles.ACTION,'String');% list menu action |
---|
2419 | % index_action=get(handles.ACTION,'Value');% selected string index |
---|
2420 | % action= list_action{index_action}; % selected string |
---|
2421 | |
---|
2422 | %% defining the ACTION function handle |
---|
2423 | path_series=which('series'); |
---|
2424 | list_path=get(handles.ACTION,'UserData'); |
---|
2425 | index=get(handles.ACTION,'Value'); |
---|
2426 | fct_path=list_path{index}; %path stored for the function ACTION |
---|
2427 | if ~isequal(fct_path,path_series) |
---|
2428 | eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION |
---|
2429 | if ~exist(fct_path,'dir') |
---|
2430 | msgbox_uvmat('ERROR',['The prescibed function path ' fct_path ' does not exist']) |
---|
2431 | return |
---|
2432 | end |
---|
2433 | if ~isequal(spath,fct_path) |
---|
2434 | addpath(fct_path)% add the prescribed path if not the current one |
---|
2435 | end |
---|
2436 | end |
---|
2437 | eval(['h_fun=@' action ';'])%create a function handle for ACTION |
---|
2438 | if ~isequal(fct_path,path_series) |
---|
2439 | rmpath(fct_path)% add the prescribed path if not the current one |
---|
2440 | end |
---|
2441 | |
---|
2442 | h_fun('BATCH');% TODO modify the called function to read the xml file as input parameter |
---|
2443 | |
---|
2444 | |
---|
2445 | % --- Executes on selection change in txt_Pairs |
---|
2446 | function txt_Pairs_Callback(hObject, eventdata, handles) |
---|
2447 | |
---|
2448 | %------------------------------------------------------------------------ |
---|
2449 | % --- Executes on selection change in ListView. |
---|
2450 | function ListView_Callback(hObject, eventdata, handles) |
---|
2451 | %------------------------------------------------------------------------ |
---|
2452 | ListViewString=get(handles.ListView,'String'); |
---|
2453 | if isempty(ListViewString) |
---|
2454 | ListViewString={''}; |
---|
2455 | end |
---|
2456 | ListViewValue=get(handles.ListView,'Value'); |
---|
2457 | View=str2double(ListViewString{ListViewValue}); |
---|
2458 | if isnan(View) |
---|
2459 | set(handles.Pairs,'Visible','off') |
---|
2460 | else |
---|
2461 | set(handles.Pairs,'Visible','on') |
---|
2462 | SeriesData=get(handles.series,'UserData'); |
---|
2463 | if isfield(SeriesData,'j1_series')&&(~isempty(SeriesData.i2_series{View})||~isempty(SeriesData.j2_series{View})) |
---|
2464 | if ~isempty(SeriesData.i2_series{View}) %pairs with i View |
---|
2465 | set(handles.mode,'Value',1) |
---|
2466 | set(handles.mode,'String',{'series(Di)'}) |
---|
2467 | else %pairs with j View |
---|
2468 | nbfield=size(SeriesData.j2_series{View},1); |
---|
2469 | nbfield2=size(SeriesData.j2_series{View},2); |
---|
2470 | set(handles.mode,'Value',1) |
---|
2471 | set(handles.mode,'String',{'bursts';'series(Dj)'}) |
---|
2472 | if nbfield2>10 || nbfield==1 |
---|
2473 | set(handles.mode,'Value',2); |
---|
2474 | else |
---|
2475 | set(handles.mode,'Value',1); |
---|
2476 | end |
---|
2477 | end |
---|
2478 | end |
---|
2479 | mode_Callback([],[], handles) |
---|
2480 | end |
---|
2481 | |
---|
2482 | |
---|