1 | %'civ_3D': function associated with the interface 'civ_3D.fig' for PIV in volume |
---|
2 | %------------------------------------------------------------------------ |
---|
3 | % provides an interface for the software CIVx |
---|
4 | % function varargout = civ_3D(varargin) |
---|
5 | % provides an interface for the software CIVx |
---|
6 | % |
---|
7 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
8 | % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. |
---|
9 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
10 | % This file is part of the toolbox UVMAT. |
---|
11 | % |
---|
12 | % UVMAT is free software; you can redistribute it and/or modify |
---|
13 | % it under the terms of the GNU General Public License as published by |
---|
14 | % the Free Software Foundation; either version 2 of the License, or |
---|
15 | % (at your option) any later version. |
---|
16 | % |
---|
17 | % UVMAT is distributed in the hope that it will be useful, |
---|
18 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
19 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
20 | % GNU General Public License (file UVMAT/COPYING.txt) for more details. |
---|
21 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
22 | function varargout = civ_3D(varargin) |
---|
23 | |
---|
24 | % Last Modified by GUIDE v2.5 25-Feb-2009 23:14:16 |
---|
25 | % Begin initialization code - DO NOT EDIT |
---|
26 | gui_Singleton = 1; |
---|
27 | gui_State = struct('gui_Name', mfilename, ... |
---|
28 | 'gui_Singleton', gui_Singleton, ... |
---|
29 | 'gui_OpeningFcn', @civ_3D_OpeningFcn, ... |
---|
30 | 'gui_OutputFcn', @civ_3D_OutputFcn, ... |
---|
31 | 'gui_LayoutFcn', [] , ... |
---|
32 | 'gui_Callback', []); |
---|
33 | if nargin & isstr(varargin{1}) |
---|
34 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
35 | end |
---|
36 | |
---|
37 | if nargout |
---|
38 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
39 | else |
---|
40 | gui_mainfcn(gui_State, varargin{:}); |
---|
41 | end |
---|
42 | % End initialization code - DO NOT EDIT |
---|
43 | |
---|
44 | %-------------------------------------------------------------------------- |
---|
45 | % --- Executes just before civ_3D is made visible. |
---|
46 | %-------------------------------------------------------------------------- |
---|
47 | function civ_3D_OpeningFcn(hObject, eventdata, handles, varargin) |
---|
48 | % This function has no output args, see OutputFcn. |
---|
49 | % hObject handle to figure |
---|
50 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
51 | % handles structure with handles and user data (see GUIDATA) |
---|
52 | % varargin command line arguments to civ_3D (see VARARGIN) |
---|
53 | global test_batch patch_new_exe%=1 if patch processing available |
---|
54 | %filebase: root name |
---|
55 | %nom_type: nomencalture used ('png_old','_i_j'...) |
---|
56 | %list of field numbers to process |
---|
57 | %subdir: subdirectory of the opened netcdf file |
---|
58 | %ind_opening: operation number advised for beginning (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2), |
---|
59 | %ind_a_opening ind_b_opening chosen pair from the opened netcdf file |
---|
60 | % Choose default command line output for civ_3D |
---|
61 | handles.output = hObject; |
---|
62 | % Update handles structure |
---|
63 | guidata(hObject, handles); |
---|
64 | |
---|
65 | %default initial parameters |
---|
66 | filebase=''; % root file name ('filebase'.civ_3D) |
---|
67 | nom_type=[]; % nomenclature type |
---|
68 | ext=[]; |
---|
69 | testall=0; |
---|
70 | browse=[]; |
---|
71 | |
---|
72 | %load the initial parameters if the interface is started from uvmat |
---|
73 | if ~isempty(varargin)% the interface is opened from uvmat |
---|
74 | varcell=varargin{1}; |
---|
75 | filebase=varcell{1}; |
---|
76 | nom_type_read=varcell{2}; |
---|
77 | num1=varcell{3}; |
---|
78 | num2=varcell{4}; |
---|
79 | num_a=varcell{5}; |
---|
80 | num_b=varcell{6}; |
---|
81 | subdir=varcell{7}; |
---|
82 | ind_opening=varcell{8}; |
---|
83 | ind_a_opening=varcell{9}; |
---|
84 | ind_b_opening=varcell{10}; |
---|
85 | ext=varcell{11}; |
---|
86 | else |
---|
87 | num1=1; % set of field i numbers |
---|
88 | num2=2; % set of field i numbers |
---|
89 | num_a=1; % set of field j numbers (fields a) |
---|
90 | num_b=1; % second set of field j numbers (fields b) |
---|
91 | subdir='A'; % subdir for the netcdf result files |
---|
92 | ind_opening=1; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2) |
---|
93 | ind_a_opening=1; % proposed index in the menu of fields a |
---|
94 | ind_b_opening=2; % proposed index in the menu of fields b |
---|
95 | end |
---|
96 | |
---|
97 | if exist('ext','var') & length(ext)>1 & (~isempty(imformats(ext([2:end])))|... |
---|
98 | isequal(ext,'.avi')|isequal(ext,'.AVI'));%if an image file has been opened by uvmat |
---|
99 | browse.ext_ima=ext; |
---|
100 | if exist('nom_type_read','var') |
---|
101 | browse.nom_type_ima=nom_type_read; % the image nomenclature is stored |
---|
102 | end |
---|
103 | elseif isequal(ext,'.nc') |
---|
104 | if exist('nom_type_read','var') |
---|
105 | browse.nom_type_nc=nom_type_read;% the netcdf nomenclature is stored |
---|
106 | end |
---|
107 | end |
---|
108 | set(handles.displ_filebase,'String',filebase); |
---|
109 | set(handles.ImaDoc,'UserData',testall); |
---|
110 | set(handles.browse_root,'UserData',browse) |
---|
111 | set(handles.ImaDoc,'String',ext) |
---|
112 | |
---|
113 | |
---|
114 | % set(handles.ImaDoc,'String',ext) |
---|
115 | |
---|
116 | %read names of the .exe file to adjust the interface according to |
---|
117 | %available prog |
---|
118 | %read names of the .exe file |
---|
119 | path_uvmat=which('uvmat');% check the path detected for source file uvmat |
---|
120 | path_UVMAT=fileparts(path_uvmat); %path to UVMAT |
---|
121 | if isunix |
---|
122 | syst='LINUX' |
---|
123 | %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ_3D binary names |
---|
124 | xmlfile=fullfile(path_UVMAT,'PARAM_LINUX.xml') |
---|
125 | if exist(xmlfile,'file') |
---|
126 | t=xmltree(xmlfile); |
---|
127 | sparam=convert(t); |
---|
128 | end |
---|
129 | else |
---|
130 | syst='WIN' |
---|
131 | %fid = fopen(fullfile(path_UVMAT,'PARAM_WIN.txt'),'r');%open the file with civ_3D binary names |
---|
132 | xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml'); |
---|
133 | if exist(xmlfile,'file') |
---|
134 | t=xmltree(xmlfile); |
---|
135 | sparam=convert(t); |
---|
136 | end |
---|
137 | end |
---|
138 | |
---|
139 | patch_new_exe=''; |
---|
140 | todo_patch=''; |
---|
141 | sge=0; |
---|
142 | |
---|
143 | if isfield(sparam,'PatchNew_exe') |
---|
144 | patch_new_exe=sparam.PatchNew_exe; |
---|
145 | end |
---|
146 | if isfield(sparam,'Todo_path') |
---|
147 | todo_path=sparam.Todo_path |
---|
148 | end |
---|
149 | if isfield(sparam,'SGE') |
---|
150 | sge=str2num(sparam.SGE); |
---|
151 | end |
---|
152 | name_todo=fullfile(todo_path,'TODO.txt') |
---|
153 | test_batch=1; |
---|
154 | if ~sge |
---|
155 | if isequal(todo_path,'') |isequal(todo_path,[]) |
---|
156 | ['no batch distributed processing available:file path TODO.txt not defined in UVMAT/PARAM_' syst] |
---|
157 | test_batch=0; |
---|
158 | end |
---|
159 | if exist(name_todo,'file')~=2 |
---|
160 | hwarn=warndlg(['no batch distributed processing available, queue file ' name_todo ' absent']); |
---|
161 | % test_batch=0; % Problems to detect file on linux/nfs filesystems |
---|
162 | end |
---|
163 | end |
---|
164 | |
---|
165 | |
---|
166 | if test_batch==0 |
---|
167 | set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated) |
---|
168 | end |
---|
169 | |
---|
170 | set(handles.subdir_civ1,'String',subdir)%default subdir on which uvmat was working |
---|
171 | set(handles.subdir_civ2,'String',subdir)%default subdir on which uvmat was working |
---|
172 | |
---|
173 | %initiate advised operations |
---|
174 | if isequal(ind_opening,[]) |
---|
175 | ind_opening=1; % default |
---|
176 | end |
---|
177 | % set default operation options |
---|
178 | enable_civ1(handles,'off') |
---|
179 | enable_civ2(handles,'off') |
---|
180 | desable_fix1(handles) |
---|
181 | desable_patch1(handles) |
---|
182 | desable_fix2(handles) |
---|
183 | desable_patch2(handles) |
---|
184 | set(handles.CIV1,'Value',0) |
---|
185 | set(handles.FIX1,'Value',0) |
---|
186 | set(handles.PATCH1,'Value',0) |
---|
187 | set(handles.CIV2,'Value',0) |
---|
188 | set(handles.FIX2,'Value',0) |
---|
189 | set(handles.PATCH2,'Value',0) |
---|
190 | set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
191 | if isequal(ind_opening,1) |
---|
192 | set(handles.CIV1,'Value',1) |
---|
193 | enable_civ1(handles,'on') |
---|
194 | elseif isequal(ind_opening,2) |
---|
195 | set(handles.FIX1,'Value',1) |
---|
196 | enable_fix1(handles) |
---|
197 | elseif isequal(ind_opening,3) |
---|
198 | set(handles.PATCH1,'Value',1) |
---|
199 | enable_patch1(handles) |
---|
200 | elseif isequal(ind_opening,4) |
---|
201 | set(handles.CIV2,'Value',1) |
---|
202 | enable_civ2(handles,1) |
---|
203 | elseif isequal(ind_opening,5) |
---|
204 | set(handles.FIX2,'Value',1) |
---|
205 | enable_fix2(handles) |
---|
206 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
207 | set(handles.list_pair_civ2,'Enable','On') |
---|
208 | set(handles.list_pair_civ2,'Enable','On') |
---|
209 | elseif isequal(ind_opening,6) |
---|
210 | set(handles.PATCH2,'Value',1) |
---|
211 | enable_patch2(handles) |
---|
212 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
213 | set(handles.list_pair_civ2,'Enable','On') |
---|
214 | end |
---|
215 | |
---|
216 | % set the range of fields (1:1 by default) and selected pair |
---|
217 | if isempty(num2)|isequal(num2,num1) |
---|
218 | num_ref_i=num1; |
---|
219 | else |
---|
220 | num_ref_i=floor((num1+num2)/2); |
---|
221 | browse.incr_pair(1)=num2-num1; |
---|
222 | browse.incr_pair(2)=0; |
---|
223 | end |
---|
224 | if isempty(num_b)|isequal(num_a,num_b) |
---|
225 | if isempty(num_a) |
---|
226 | num_ref_j=1; |
---|
227 | else |
---|
228 | num_ref_j=num_a; |
---|
229 | end |
---|
230 | else |
---|
231 | num_ref_j=floor((num_a+num_b)/2); |
---|
232 | browse.incr_pair(2)=num_b-num_a; |
---|
233 | end |
---|
234 | set(handles.first_i,'String',num2str(num_ref_i)); |
---|
235 | set(handles.last_i,'String',num2str(num_ref_i)); |
---|
236 | set(handles.first_j,'String',num2str(num_ref_j)); |
---|
237 | set(handles.last_j,'String',num2str(num_ref_j)); |
---|
238 | set(handles.ref_i,'String',num2str(num_ref_i)); |
---|
239 | set(handles.ref_j,'String',num2str(num_ref_j)); |
---|
240 | set(handles.browse_root,'UserData',browse); |
---|
241 | if ~isempty(varargin)% the interface is opened from uvmat |
---|
242 | displ_filebase_Callback(hObject, eventdata, handles); |
---|
243 | end |
---|
244 | |
---|
245 | set(handles.waitbar_1,'Position',[0.946 0.877 0.03 0.001]) |
---|
246 | set(handles.waitbar_patch1,'Position',[0.946 0.626 0.03 0.001]) |
---|
247 | set(handles.waitbar_civ2,'Position',[0.946 0.406 0.03 0.001]) |
---|
248 | set(handles.waitbar_patch2,'Position',[0.946 0.187 0.03 0.001]) |
---|
249 | |
---|
250 | |
---|
251 | %-------------------------------------------------------------- |
---|
252 | % --- Outputs from this function are returned to the command line. |
---|
253 | %----------------------------------------------------------------- |
---|
254 | function varargout = civ_3D_OutputFcn(hObject, eventdata, handles) |
---|
255 | % varargout cell array for returning output args (see VARARGOUT); |
---|
256 | % hObject handle to figure |
---|
257 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
258 | % handles structure with handles and user data (see GUIDATA) |
---|
259 | % Get default command line output from handles structure |
---|
260 | varargout{1} = handles.output; |
---|
261 | |
---|
262 | %------------------------------------------------------------------ |
---|
263 | % --- Executes on button press in browse_root. |
---|
264 | function browse_root_Callback(hObject, eventdata, handles) |
---|
265 | %get the input file properties |
---|
266 | filebase=get(handles.displ_filebase,'String'); |
---|
267 | oldfile=''; %default |
---|
268 | if isempty(filebase)|isequal(filebase,'')%loads the previously stored file name and set it as default in the file_input box |
---|
269 | dir_perso=prefdir; |
---|
270 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat') |
---|
271 | if exist(profil_perso,'file') |
---|
272 | h=load (profil_perso); |
---|
273 | if isfield(h,'filebase')&ischar(h.filebase) |
---|
274 | oldfile=h.filebase; |
---|
275 | end |
---|
276 | if isfield(h,'RootPath')&ischar(h.RootPath) |
---|
277 | % oldfile=h.filebase{1} |
---|
278 | oldfile=h.RootPath; |
---|
279 | end |
---|
280 | end |
---|
281 | else |
---|
282 | oldfile=filebase; |
---|
283 | end |
---|
284 | testall=get(handles.ImaDoc,'UserData'); |
---|
285 | ind_opening=1;%default |
---|
286 | browse.incr_pair=[0 0]; %default |
---|
287 | |
---|
288 | menu={'*.*', 'All Files (*.*)'; '*.xml;*.vol; *.avi;*.AVI','(*.xml,*.civ,*.avi,*.vol)'; ... |
---|
289 | '*.xml', '.xml files';'*.civ', '.civ files';... |
---|
290 | '*.avi;*.AVI', '.avi files';'*.vol', '.vol files'}; |
---|
291 | |
---|
292 | [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile); |
---|
293 | fileinput=[PathName FileName];%complete file name |
---|
294 | sizf=size(fileinput); |
---|
295 | if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
296 | [path,name,ext]=fileparts(fileinput); |
---|
297 | testeditxml=0; |
---|
298 | if isequal(ext,'.xml') |
---|
299 | testeditxml=1; |
---|
300 | t_browse=xmltree(fileinput); |
---|
301 | head_element=get(t_browse,1); |
---|
302 | if isfield(head_element,'name')& isequal(head_element.name,'ImaDoc') |
---|
303 | testeditxml=0; |
---|
304 | end |
---|
305 | end |
---|
306 | if testeditxml==1 | isequal(ext,'.xls') |
---|
307 | heditxml=editxml({fileinput}); |
---|
308 | set(heditxml,'Tag','browser') |
---|
309 | waitfor(heditxml,'Tag','idle') |
---|
310 | if ~ishandle(heditxml) |
---|
311 | return |
---|
312 | end |
---|
313 | attr=findobj(get(heditxml,'children'),'Tag','CurrentAttributes'); |
---|
314 | set(handles.browse,'UserData',fileinput)% store for future opening with browser |
---|
315 | fileinput=get(attr,'UserData'); |
---|
316 | if ~exist(fileinput,'file') |
---|
317 | return |
---|
318 | end |
---|
319 | end |
---|
320 | [RootPath,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput); |
---|
321 | filebase=fullfile(RootPath,RootFile); |
---|
322 | if isequal(get(handles.compare,'Value'),1) |
---|
323 | browse=get(handles.browse_root,'UserData'); |
---|
324 | else |
---|
325 | browse=[];%initialisation |
---|
326 | end |
---|
327 | if length(ext)>1 & (~isempty(imformats(ext([2:end])))||... |
---|
328 | isequal(lower(ext),'.avi')||isequal(ext,'.vol'));%if an image file has been opened by uvmat |
---|
329 | browse.ext_ima=ext; |
---|
330 | browse.nom_type_ima=nom_type; |
---|
331 | browse.field_count=str2num(field_count); |
---|
332 | end |
---|
333 | set(handles.ImaDoc,'String',ext); |
---|
334 | %%%%% read the state of the selected netcdf file to advise default operation |
---|
335 | if isequal(ext,'.nc') |
---|
336 | browse.nom_type_nc=nom_type; |
---|
337 | ind_opening=2;% propose 'fix' as the default option |
---|
338 | Data=nc2struct(fileinput,[]); |
---|
339 | if isfield(Data,'fix') & isequal(Data.fix,1) |
---|
340 | ind_opening=3; |
---|
341 | end |
---|
342 | if isfield(Data,'patch') & isequal(Data.patch,1) |
---|
343 | ind_opening=4; |
---|
344 | end |
---|
345 | if isfield(Data,'civ2') & isequal(Data.civ2,1) |
---|
346 | ind_opening=5; |
---|
347 | end |
---|
348 | if isfield(Data,'fix2') & isequal(Data.fix2,1) |
---|
349 | ind_opening=6; |
---|
350 | end |
---|
351 | if isfield(Data,'pixcmx') & isequal(Data,'pixcmy') |
---|
352 | browse.pxcmx=Data.pixcmx; |
---|
353 | browse.pxcmy=Data.pixcmy; |
---|
354 | end |
---|
355 | testciv=1; %TO SUPPRESS WITH NEW VERSION OF CIVX |
---|
356 | subdir='';%default |
---|
357 | if testciv |
---|
358 | [Pathbase,Namebase]=fileparts(filebase) |
---|
359 | [Pathprev,subdir,extdir]=fileparts(Pathbase) |
---|
360 | subdir=[subdir extdir] |
---|
361 | % if isequal (subdir,subdir_obs) |
---|
362 | filebase=fullfile(Pathprev,Namebase)% move upward to get the base name (corresponding to the .civ_3D file and images) |
---|
363 | % end |
---|
364 | end |
---|
365 | set(handles.subdir_civ1,'String',subdir);%set the default subdir directories for installing the .nc results |
---|
366 | set(handles.subdir_civ2,'String',subdir); |
---|
367 | browse.testciv=testciv; |
---|
368 | browse.ind_opening=ind_opening; |
---|
369 | end |
---|
370 | set(handles.displ_filebase,'String',filebase); |
---|
371 | set(handles.ImaDoc,'String',ext); |
---|
372 | if ~isempty(str2num(field_count)) |
---|
373 | ref_i=str2num(field_count); |
---|
374 | if ~isempty(str2num(str2)) |
---|
375 | ref_i=floor((ref_i+str2num(str2))/2);% reference image number corresponding to the file |
---|
376 | browse.incr_pair(1)=str2num(str2)-str2num(field_count); |
---|
377 | browse.incr_pair(2)=0; |
---|
378 | end |
---|
379 | set(handles.first_i,'String',num2str(ref_i)); |
---|
380 | set(handles.last_i,'String',num2str(ref_i)); |
---|
381 | set(handles.ref_i,'String',num2str(ref_i)); |
---|
382 | end |
---|
383 | if isempty(str2num(str_a)) |
---|
384 | set(handles.ref_j,'String','1'); |
---|
385 | else |
---|
386 | ref_j=str2num(str_a); |
---|
387 | if ~isempty(str2num(str_b)) |
---|
388 | ref_j=floor((str2num(str_a)+str2num(str_b))/2); |
---|
389 | browse.incr_pair(2)=str2num(str_b)-str2num(str_a); |
---|
390 | end |
---|
391 | set(handles.first_j,'String',num2str(ref_j)); |
---|
392 | set(handles.last_j,'String',num2str(ref_j)); |
---|
393 | set(handles.ref_j,'String',num2str(ref_j)); |
---|
394 | end; |
---|
395 | if isequal(ind_opening,1) |
---|
396 | set(handles.CIV1,'Value',1) |
---|
397 | enable_civ1(handles,'on') |
---|
398 | elseif isequal(ind_opening,2) |
---|
399 | set(handles.FIX1,'Value',1) |
---|
400 | enable_fix1(handles) |
---|
401 | elseif isequal(ind_opening,3) |
---|
402 | set(handles.PATCH1,'Value',1) |
---|
403 | enable_patch1(handles) |
---|
404 | elseif isequal(ind_opening,4) |
---|
405 | set(handles.CIV2,'Value',1) |
---|
406 | enable_civ2(handles,1) |
---|
407 | elseif isequal(ind_opening,5) |
---|
408 | set(handles.FIX2,'Value',1) |
---|
409 | enable_fix2(handles) |
---|
410 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
411 | set(handles.list_pair_civ2,'Enable','On') |
---|
412 | set(handles.list_pair_civ2,'Enable','On') |
---|
413 | elseif isequal(ind_opening,6) |
---|
414 | set(handles.PATCH2,'Value',1) |
---|
415 | enable_patch2(handles) |
---|
416 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
417 | set(handles.list_pair_civ2,'Enable','On') |
---|
418 | end |
---|
419 | set(handles.browse_root,'UserData',browse);% store information from browser |
---|
420 | testall=isequal(menu(filtindex,1),{'*.*'}); |
---|
421 | set(handles.ImaDoc,'UserData',testall); |
---|
422 | |
---|
423 | displ_filebase_Callback(hObject, eventdata, handles); |
---|
424 | |
---|
425 | %------------------------------------------------ |
---|
426 | |
---|
427 | function ImaDoc_Callback(hObject, eventdata, handles) |
---|
428 | displ_filebase_Callback(hObject, eventdata, handles) |
---|
429 | |
---|
430 | %-------------------------------------------------------------- |
---|
431 | %function activated when a new filebase (image series) is introduced |
---|
432 | %------------------------------------------------------------ |
---|
433 | function displ_filebase_Callback(hObject, eventdata, handles) |
---|
434 | |
---|
435 | global test_batch |
---|
436 | set(gcf,'Pointer','watch') |
---|
437 | ext_ima=[]; %default |
---|
438 | nom_type_ima=[];%default |
---|
439 | field_count=1;%default |
---|
440 | nom_type_nc=[]; |
---|
441 | npx=[];%default |
---|
442 | npy=[]; |
---|
443 | TimeUnit='s'; %default |
---|
444 | CoordUnit='cm';%default |
---|
445 | pxcmx_search=[];%default |
---|
446 | pxcmy_search=[];%default |
---|
447 | filebase=get(handles.displ_filebase,'String'); |
---|
448 | |
---|
449 | ext=get(handles.ImaDoc,'String'); |
---|
450 | browse=get(handles.browse_root,'UserData');%default |
---|
451 | if ~isempty(browse) |
---|
452 | if isfield(browse,'ext_ima') |
---|
453 | ext_ima=browse.ext_ima; |
---|
454 | end |
---|
455 | if isfield(browse,'nom_type_ima') |
---|
456 | nom_type_ima=browse.nom_type_ima; |
---|
457 | end |
---|
458 | if isfield(browse,'field_count') |
---|
459 | field_count=browse.field_count; |
---|
460 | end |
---|
461 | end |
---|
462 | |
---|
463 | %default first_i and j and increments |
---|
464 | first_i=str2num(get(handles.first_i,'String'));%value possibly set by uvmat_Opening |
---|
465 | if isempty(first_i)| first_i < 1 |
---|
466 | first_i=1; %default first_i |
---|
467 | end |
---|
468 | last_i=str2num(get(handles.last_i,'String')); |
---|
469 | if isempty(last_i)| last_i < first_i |
---|
470 | last_i=first_i; %default last_i |
---|
471 | end |
---|
472 | first_j=str2num(get(handles.first_j,'String')); |
---|
473 | if isempty(first_j)| first_j < 1 |
---|
474 | first_j=1; %default first_j |
---|
475 | end |
---|
476 | last_j=str2num(get(handles.last_j,'String')); |
---|
477 | if isempty(last_j)| last_j < first_j |
---|
478 | last_j=first_j; %default last_j |
---|
479 | end |
---|
480 | incr_i=str2num(get(handles.incr_i,'String')); |
---|
481 | if isempty(incr_i) | incr_i < 1; |
---|
482 | set(handles.incr_i,'String','1') %default incr_i |
---|
483 | end |
---|
484 | incr_j=str2num(get(handles.incr_j,'String')); |
---|
485 | if isempty(incr_j) | incr_j < 1; |
---|
486 | set(handles.incr_j,'String','1') %default incr_j |
---|
487 | end |
---|
488 | dt=[];%default |
---|
489 | testmode=0;%default |
---|
490 | nbfield=1; %default |
---|
491 | if isfield(browse,'pxcmx') & isfield(browse,'pxcmy') |
---|
492 | pxcmx=num2str(browse.pxcmx); |
---|
493 | pxcmy=num2str(browse.pxcmy); |
---|
494 | else |
---|
495 | pxcmx=1;%default |
---|
496 | pxcmy=1; |
---|
497 | end |
---|
498 | %look for an image documentation file |
---|
499 | if ~isequal(ext,'.xml') & ~ isequal(ext,'.avi')& ~ isequal(ext,'.AVI') |
---|
500 | if exist([filebase '.xml'],'file') |
---|
501 | ext='.xml'; |
---|
502 | set(handles.ImaDoc,'String','.xml') |
---|
503 | elseif exist([filebase '.civ_3D'],'file') |
---|
504 | ext='.civ_3D'; |
---|
505 | set(handles.ImaDoc,'String','.civ_3D') |
---|
506 | elseif exist([filebase '.avi'],'file') |
---|
507 | ext='.avi'; |
---|
508 | set(handles.ImaDoc,'String','.avi') |
---|
509 | elseif exist([filebase '.AVI'],'file') |
---|
510 | ext='.AVI'; |
---|
511 | set(handles.ImaDoc,'String','.AVI') |
---|
512 | end |
---|
513 | end |
---|
514 | %%%%%%%% read image documentation file %%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
515 | mode=''; %default |
---|
516 | %read the image documentation file if found |
---|
517 | if isequal(ext,'.xml') |
---|
518 | set(handles.ref_i,'Visible','On')%use a reference index |
---|
519 | set(handles.ref_j,'Visible','On') |
---|
520 | set(handles.dt,'Visible','Off') |
---|
521 | set(handles.dt_text,'String','ref. ind.') |
---|
522 | elseif isequal(ext,'.avi') | isequal(ext,'.AVI') |
---|
523 | set(handles.ref_j,'Visible','Off') |
---|
524 | set(handles.dt,'Visible','Off') |
---|
525 | set(handles.dt_text,'String','ref. ind.') |
---|
526 | else |
---|
527 | set(handles.ref_i,'Visible','Off') |
---|
528 | set(handles.ref_j,'Visible','Off') |
---|
529 | set(handles.dt,'Visible','On') |
---|
530 | set(handles.dt_text,'String','dt(ms)=') |
---|
531 | end |
---|
532 | |
---|
533 | if isequal(ext,'.xml') |
---|
534 | [XmlData,warntext]=imadoc2struct([filebase '.xml']); |
---|
535 | if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName') |
---|
536 | [PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName); |
---|
537 | end |
---|
538 | if isfield(XmlData,'Camera') |
---|
539 | if isfield(XmlData.Camera,'TimeUnit') |
---|
540 | TimeUnit=XmlData.Camera.TimeUnit; |
---|
541 | end |
---|
542 | if isfield(XmlData.Camera,'ImageSize') |
---|
543 | ImageSize=XmlData.Camera.ImageSize; |
---|
544 | if ~isempty(ImageSize)&& ~isempty(ImageSize) |
---|
545 | xindex=findstr(ImageSize,'x'); |
---|
546 | if length(xindex)>=2 |
---|
547 | npx=str2num(ImageSize(1:xindex(1)-1)); |
---|
548 | npy=str2num(ImageSize(xindex(1)+1:xindex(2)-1)); |
---|
549 | end |
---|
550 | end |
---|
551 | end |
---|
552 | end |
---|
553 | pxcmx_search=1; |
---|
554 | pxcmy_search=1; |
---|
555 | if isfield(XmlData,'GeometryCalib') |
---|
556 | tsai=XmlData.GeometryCalib; |
---|
557 | if isfield(tsai,'f') & isfield(tsai,'Tz') & isfield(tsai,'dpx') & isfield(tsai,'dpy')& isfield(tsai,'R') |
---|
558 | rot2D=tsai.R([1:2],[1,2]); |
---|
559 | pxcmx_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpx); |
---|
560 | pxcmy_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpy); |
---|
561 | end |
---|
562 | if isfield(tsai,'CoordUnit') |
---|
563 | CoordUnit=tsai.CoordUnit; |
---|
564 | end |
---|
565 | end |
---|
566 | if isempty(ext_ima_read) |
---|
567 | ext_ima='.png';%default |
---|
568 | else |
---|
569 | ext_ima=ext_ima_read; |
---|
570 | end |
---|
571 | if isempty(nom_type_read) |
---|
572 | nom_type_ima='_i_j'; |
---|
573 | warndlg_uvmat('no ImageName defined in ImaDoc/Heading, take _i_j indexing by default','WARNING') |
---|
574 | else |
---|
575 | nom_type_ima=nom_type_read; |
---|
576 | end |
---|
577 | |
---|
578 | elseif isequal(ext,'.avi')|isequal(ext,'.AVI') |
---|
579 | nom_type_ima='avi'; |
---|
580 | ext_ima=ext; |
---|
581 | set(handles.mode,'String',{'series(Di)'}) |
---|
582 | dt=0.04;%default |
---|
583 | if exist([filebase ext],'file')==2 |
---|
584 | info=aviinfo([filebase ext]);%read infos on the avi movie |
---|
585 | dt=1/info.FramesPerSecond;%time interval between successive frames |
---|
586 | nbfield=info.NumFrames;%number of frames |
---|
587 | end |
---|
588 | time=(dt*[0:nbfield-1])';%list of image times |
---|
589 | set(handles.dt,'String',num2str(dt*1000));%store the time interval between successive images |
---|
590 | |
---|
591 | % no image documentation file found: look for a series of existing images or .nc files |
---|
592 | elseif ~isequal(ext,'.nc') |
---|
593 | subdir=get(handles.subdir_civ1,'String'); |
---|
594 | incr_pair=[0 0];%default |
---|
595 | if isfield(browse,'incr_pair') |
---|
596 | incr_pair=browse.incr_pair; |
---|
597 | end |
---|
598 | nbdetect=0;%test of detected images |
---|
599 | field_i=field_count; |
---|
600 | idetect=1; |
---|
601 | % imagename='';%default |
---|
602 | while idetect==1 %look for the maximum file number in the series |
---|
603 | field_i=field_i+1; |
---|
604 | % imagename_last=imagename; |
---|
605 | [imagename,idetect]=name_generator(filebase,field_i,1,ext_ima,nom_type_ima); |
---|
606 | if isequal(nom_type_ima,'none') |
---|
607 | idetect=0; %stop if the same image is repeated (if nom_type='none') |
---|
608 | nbdetect=1; |
---|
609 | end |
---|
610 | %SEE CASE OF NETCDF FILES |
---|
611 | nbdetect=nbdetect+idetect; |
---|
612 | end |
---|
613 | % nb_field=field_i-1;% last detected field number |
---|
614 | nb_field=field_i;% last detected field number |
---|
615 | field_i=field_count;%look for the minimum file number in the series |
---|
616 | idetect=1; |
---|
617 | while idetect==1 |
---|
618 | field_i=field_i-1; |
---|
619 | [imagename,idetect]=name_generator(filebase,field_i,1,ext_ima,nom_type_ima); |
---|
620 | if isequal(nom_type_ima,'none') |
---|
621 | idetect=0; %stop if the same image is repeted (if nom_type='none') |
---|
622 | nbdetect=1; |
---|
623 | end |
---|
624 | nbdetect=nbdetect+idetect; |
---|
625 | end |
---|
626 | first_i=max(field_i+1,1); |
---|
627 | %determine the set of times and possible intervals for CIV_3D |
---|
628 | dt=(1/1000)*str2num(get(handles.dt,'String')); |
---|
629 | time=(dt*[0:nb_field-1])'; |
---|
630 | % set(handles.incr_i,'UserData',dt);%store the time interval |
---|
631 | % between successive images |
---|
632 | %displ_num:list of possible time intervals for civ_3D calculations |
---|
633 | set(handles.mode,'String',{'series(Di)'}) |
---|
634 | end |
---|
635 | if isequal(nom_type_ima,'none')% no file numbering used |
---|
636 | first_i=1; |
---|
637 | last_i=1; |
---|
638 | first_j=1; |
---|
639 | last_j=1; |
---|
640 | end |
---|
641 | if exist('time','var') |
---|
642 | siztime=size(time); |
---|
643 | nbfield=siztime(1); |
---|
644 | nbfield2=siztime(2); |
---|
645 | set(handles.displ_filebase,'UserData',time); %store the set of times |
---|
646 | set(handles.dt_unit,'String',['m' TimeUnit]); |
---|
647 | set(handles.TimeUnit,'String',TimeUnit); |
---|
648 | set(handles.nb_field,'String',num2str(nbfield)); |
---|
649 | set(handles.nb_field2,'String',num2str(nbfield2)); |
---|
650 | end |
---|
651 | set(handles.CoordUnit,'String',[CoordUnit '/']) |
---|
652 | set(handles.pxcmx,'String',num2str(pxcmx)); |
---|
653 | set(handles.pxcmy,'String',num2str(pxcmy)); |
---|
654 | if isempty(pxcmx_search) |
---|
655 | set(handles.calcul_search,'UserData',[pxcmx pxcmy]); |
---|
656 | else |
---|
657 | set(handles.calcul_search,'UserData',[pxcmx_search pxcmy_search]); |
---|
658 | end |
---|
659 | set(handles.pxcmx,'UserData',npx); |
---|
660 | set(handles.pxcmy,'UserData',npy); |
---|
661 | set(handles.first_i,'String',num2str(first_i)); |
---|
662 | set(handles.last_i,'String',num2str(last_i));% |
---|
663 | set(handles.first_j,'String',num2str(first_j)); |
---|
664 | set(handles.last_j,'String',num2str(last_j));% |
---|
665 | browse.ext_ima=ext_ima; |
---|
666 | browse.nom_type_ima=nom_type_ima; |
---|
667 | set(handles.browse_root,'UserData',browse)% store the nomenclature type |
---|
668 | |
---|
669 | %%%%%%%%%%% set the menus of image pairs and default selection for civ_3D %%%%%%%%%%%%%%%%%%% |
---|
670 | if isequal(get(handles.compare,'Value'),1) |
---|
671 | if isequal(nom_type_ima,'_i')| isequal(nom_type_nc,'_i1-i2')|~exist('nbfield2','var')|(nbfield2==1) |
---|
672 | set(handles.mode,'String',{'st_series(Di)';'displacement'}) |
---|
673 | set(handles.mode,'Value',1) |
---|
674 | elseif (nbfield==1)% simple series in j |
---|
675 | set(handles.mode,'String',{'st_series(Dj)';'displacement'}) |
---|
676 | set(handles.mode,'Value',1) |
---|
677 | else |
---|
678 | set(handles.mode,'String',{'st_pair j1-j2';'st_series(Dj)';'st_series(Di)';'displacement'})%multiple choice |
---|
679 | if isequal(mode,'volume') |
---|
680 | set(handles.mode,'Value',3) |
---|
681 | elseif nbfield2 <= 5 |
---|
682 | set(handles.mode,'Value',1)% advice 'pair j1-j2' for small bursts |
---|
683 | end |
---|
684 | end |
---|
685 | else |
---|
686 | if isequal(nom_type_ima,'_i')| isequal(nom_type_nc,'_i1-i2')|~exist('nbfield2','var')|(nbfield2==1) |
---|
687 | set(handles.mode,'String',{'series(Di)'}) |
---|
688 | set(handles.mode,'Value',1) |
---|
689 | elseif isequal(nom_type_ima,'png_old')|isequal(nom_type_nc,'netc_old') |
---|
690 | set(handles.mode,'String',{'pair j1-j2'}) |
---|
691 | set(handles.mode,'Value',1) |
---|
692 | elseif (nbfield==1)% simple series in j |
---|
693 | set(handles.mode,'String',{'series(Dj)'}) |
---|
694 | set(handles.mode,'Value',1) |
---|
695 | else |
---|
696 | set(handles.mode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice |
---|
697 | if isequal(mode,'volume') |
---|
698 | set(handles.mode,'Value',3) |
---|
699 | elseif nbfield2 <= 5 |
---|
700 | set(handles.mode,'Value',1)% advice 'pair j1-j2' for small bursts |
---|
701 | else |
---|
702 | set(handles.mode,'Value',2)% advice series Dj for long bursts, not volume |
---|
703 | end |
---|
704 | end |
---|
705 | end |
---|
706 | mode_Callback(hObject, eventdata, handles) |
---|
707 | |
---|
708 | %%%%%% initialize waitbars and RUN button |
---|
709 | set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001]) |
---|
710 | set(handles.waitbar_patch1,'Position',[0.946 0.439 0.03 0.001]) |
---|
711 | set(handles.waitbar_civ2,'Position',[0.946 0.219 0.03 0.001]) |
---|
712 | set(handles.waitbar_patch2,'Position',[0.946 0.0 0.03 0.001]) |
---|
713 | set(handles.RUN, 'Enable','On') |
---|
714 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
715 | if isequal(test_batch,1)%if batch installation is available |
---|
716 | set(handles.BATCH, 'Enable','On') |
---|
717 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
718 | end |
---|
719 | |
---|
720 | %%%%% store the root input filename for future opening |
---|
721 | dir_perso=prefdir; |
---|
722 | profil_perso=fullfile(prefdir,'uvmat_perso.mat'); |
---|
723 | RootPath=fileparts(filebase); |
---|
724 | if exist(profil_perso,'file') |
---|
725 | save (profil_perso,'RootPath','-append'); %store the root name for future opening of uvmat |
---|
726 | else |
---|
727 | txt=ver; |
---|
728 | Release=txt(1).Release; |
---|
729 | relnumb=str2num(Release(3:4)); |
---|
730 | if relnumb >= 14 |
---|
731 | save (profil_perso,'RootPath','-V6'); %store the root name for future opening of uvmat |
---|
732 | else |
---|
733 | save (profil_perso,'RootPath'); %store the root name for future opening of uvmat |
---|
734 | end |
---|
735 | end |
---|
736 | % save(profil_perso, 'filebase'); %store the root name for future opening of uvmat |
---|
737 | set(gcf,'Pointer','arrow') |
---|
738 | |
---|
739 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%???????????? |
---|
740 | % --- Executes on button press in mode. |
---|
741 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
742 | function mode_Callback(hObject, eventdata, handles) |
---|
743 | browse=get(handles.browse_root,'UserData'); |
---|
744 | mode_list=get(handles.mode,'String'); |
---|
745 | mode_value=get(handles.mode,'Value'); |
---|
746 | mode=mode_list{mode_value}; |
---|
747 | displ_num=[];%default |
---|
748 | first_i=str2num(get(handles.first_i,'String')); |
---|
749 | % last_i=str2num(get(handles.last_i,'String')); |
---|
750 | time=get(handles.displ_filebase,'UserData'); %get the set of times |
---|
751 | siztime=size(time); |
---|
752 | nbfield=siztime(1); |
---|
753 | nbfield2=siztime(2); |
---|
754 | indchosen=1; %%first pair selected by default |
---|
755 | if isequal(mode,'pair j1-j2')| isequal(mode,'st_pair j1-j2') |
---|
756 | dt=1; |
---|
757 | displ=''; |
---|
758 | index=0; |
---|
759 | %get all the time intervals in bursts |
---|
760 | displ_dt=1;%default |
---|
761 | nbfield2=min(nbfield2,10),%limitate the number of pairs to 10x10 |
---|
762 | % if nbfield2<2 |
---|
763 | % nbfield2=2, |
---|
764 | % end |
---|
765 | for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'pair j1-j2' mode |
---|
766 | for numod_b=(numod_a+1):nbfield2 |
---|
767 | index=index+1; |
---|
768 | numlist_a(index)=numod_a; |
---|
769 | numlist_b(index)=numod_b; |
---|
770 | if ~isempty(time) |
---|
771 | dt(numod_a,numod_b)=time(first_i,numod_b)-time(first_i,numod_a);%first time interval dt |
---|
772 | displ_dt(index)=dt(numod_a,numod_b); |
---|
773 | else |
---|
774 | displ_dt(index)=1 |
---|
775 | end |
---|
776 | end |
---|
777 | end |
---|
778 | [dtsort,indsort]=sort(displ_dt); |
---|
779 | displ_num(1,:)=numlist_a(indsort); |
---|
780 | displ_num(2,:)=numlist_b(indsort); |
---|
781 | displ_num(3,:)=0; |
---|
782 | displ_num(4,:)=0; |
---|
783 | set(handles.jtext,'Visible','Off') |
---|
784 | set(handles.first_j,'Visible','Off') |
---|
785 | set(handles.last_j,'Visible','Off') |
---|
786 | set(handles.incr_j,'Visible','Off') |
---|
787 | set(handles.nb_field2,'Visible','Off') |
---|
788 | set(handles.ref_j,'Visible','Off') |
---|
789 | elseif isequal(mode,'series(Dj)') | isequal(mode,'st_series(Dj)') |
---|
790 | for index=1:min(nbfield2-1,200) |
---|
791 | displ_num(1,index)=-floor(index/2); |
---|
792 | displ_num(2,index)=ceil(index/2); |
---|
793 | displ_num(3,index)=0; |
---|
794 | displ_num(4,index)=0; |
---|
795 | end |
---|
796 | set(handles.jtext,'Visible','On') |
---|
797 | set(handles.first_j,'Visible','On') |
---|
798 | set(handles.last_j,'Visible','On') |
---|
799 | set(handles.incr_j,'Visible','On') |
---|
800 | set(handles.nb_field2,'Visible','On') |
---|
801 | set(handles.ref_j,'Visible','On') |
---|
802 | if nbfield > 1 |
---|
803 | set(handles.itext,'Visible','On') |
---|
804 | set(handles.first_i,'Visible','On') |
---|
805 | set(handles.last_i,'Visible','On') |
---|
806 | set(handles.incr_i,'Visible','On') |
---|
807 | set(handles.nb_field,'Visible','On') |
---|
808 | set(handles.ref_i,'Visible','On') |
---|
809 | else |
---|
810 | set(handles.itext,'Visible','Off') |
---|
811 | set(handles.first_i,'Visible','Off') |
---|
812 | set(handles.last_i,'Visible','Off') |
---|
813 | set(handles.incr_i,'Visible','Off') |
---|
814 | set(handles.nb_field,'Visible','Off') |
---|
815 | set(handles.ref_i,'Visible','Off') |
---|
816 | end |
---|
817 | elseif isequal(mode,'series(Di)') | isequal(mode,'st_series(Di)') |
---|
818 | for index=1:min(nbfield-1,200) |
---|
819 | displ_num(1,index)=0; |
---|
820 | displ_num(2,index)=0; |
---|
821 | displ_num(3,index)=-floor(index/2); |
---|
822 | displ_num(4,index)=ceil(index/2); |
---|
823 | end |
---|
824 | set(handles.itext,'Visible','On') |
---|
825 | set(handles.first_i,'Visible','On') |
---|
826 | set(handles.last_i,'Visible','On') |
---|
827 | set(handles.incr_i,'Visible','On') |
---|
828 | set(handles.nb_field,'Visible','On') |
---|
829 | set(handles.ref_i,'Visible','On') |
---|
830 | if nbfield2 > 1 |
---|
831 | set(handles.jtext,'Visible','On') |
---|
832 | set(handles.first_j,'Visible','On') |
---|
833 | set(handles.last_j,'Visible','On') |
---|
834 | set(handles.incr_j,'Visible','On') |
---|
835 | set(handles.nb_field2,'Visible','On') |
---|
836 | set(handles.ref_j,'Visible','On') |
---|
837 | else |
---|
838 | set(handles.jtext,'Visible','Off') |
---|
839 | set(handles.first_j,'Visible','Off') |
---|
840 | set(handles.last_j,'Visible','Off') |
---|
841 | set(handles.incr_j,'Visible','Off') |
---|
842 | set(handles.nb_field2,'Visible','Off') |
---|
843 | set(handles.ref_j,'Visible','Off') |
---|
844 | end |
---|
845 | elseif isequal(mode,'displacement')%the pairs have the same indices |
---|
846 | displ_num(1,1)=0; |
---|
847 | displ_num(2,1)=0; |
---|
848 | displ_num(3,1)=0; |
---|
849 | displ_num(4,1)=0; |
---|
850 | if nbfield > 1 |
---|
851 | set(handles.itext,'Visible','On') |
---|
852 | set(handles.first_i,'Visible','On') |
---|
853 | set(handles.last_i,'Visible','On') |
---|
854 | set(handles.incr_i,'Visible','On') |
---|
855 | set(handles.nb_field,'Visible','On') |
---|
856 | set(handles.ref_i,'Visible','On') |
---|
857 | else |
---|
858 | set(handles.itext,'Visible','Off') |
---|
859 | set(handles.first_i,'Visible','Off') |
---|
860 | set(handles.last_i,'Visible','Off') |
---|
861 | set(handles.incr_i,'Visible','Off') |
---|
862 | set(handles.nb_field,'Visible','Off') |
---|
863 | set(handles.ref_i,'Visible','Off') |
---|
864 | end |
---|
865 | if nbfield2 > 1 |
---|
866 | set(handles.jtext,'Visible','On') |
---|
867 | set(handles.first_j,'Visible','On') |
---|
868 | set(handles.last_j,'Visible','On') |
---|
869 | set(handles.incr_j,'Visible','On') |
---|
870 | set(handles.nb_field2,'Visible','On') |
---|
871 | set(handles.ref_j,'Visible','On') |
---|
872 | else |
---|
873 | set(handles.jtext,'Visible','Off') |
---|
874 | set(handles.first_j,'Visible','Off') |
---|
875 | set(handles.last_j,'Visible','Off') |
---|
876 | set(handles.incr_j,'Visible','Off') |
---|
877 | set(handles.nb_field2,'Visible','Off') |
---|
878 | set(handles.ref_j,'Visible','Off') |
---|
879 | end |
---|
880 | end |
---|
881 | set(handles.list_pair_civ1,'UserData',displ_num); |
---|
882 | find_netcpair_civ1(hObject, eventdata, handles) |
---|
883 | find_netcpair_civ2(hObject, eventdata, handles) |
---|
884 | |
---|
885 | %-------------------------------------------------------------- |
---|
886 | % determine the menu for civ1 pairs depending on existing netcdf file at the middle of |
---|
887 | % the field series set by first_i, incr, last_i |
---|
888 | %---------------------------------------------------------------- |
---|
889 | function find_netcpair_civ1(hObject, eventdata, handles) |
---|
890 | set(gcf,'Pointer','watch') |
---|
891 | %nomenclature types |
---|
892 | filebase=get(handles.displ_filebase,'String'); |
---|
893 | [filepath,Nme,ext_dir]=fileparts(filebase); |
---|
894 | browse=get(handles.browse_root,'UserData'); |
---|
895 | mode_list=get(handles.mode,'String'); |
---|
896 | mode_value=get(handles.mode,'Value'); |
---|
897 | mode=mode_list{mode_value}; |
---|
898 | % nomenclature type of the .nc files |
---|
899 | nom_type_ima=[];%default |
---|
900 | if isfield(browse,'nom_type_ima') |
---|
901 | nom_type_ima=browse.nom_type_ima; |
---|
902 | end |
---|
903 | |
---|
904 | %determine nom_type_nc: |
---|
905 | nom_type_nc=[];%default |
---|
906 | if isfield(browse,'nom_type_nc') |
---|
907 | nom_type_nc=browse.nom_type_nc; |
---|
908 | end |
---|
909 | if isequal(nom_type_ima,'png_old') | isequal(nom_type_nc,'netc_old')| isequal(nom_type_ima,'raw_SMD') |
---|
910 | nom_type_nc='netc_old';%nom_type for the netcdf files |
---|
911 | elseif isequal(nom_type_ima,'none')|isequal(nom_type_nc,'none') |
---|
912 | nom_type_nc='none'; |
---|
913 | elseif isequal(nom_type_ima,'avi')|isequal(nom_type_ima,'_i')|isequal(nom_type_ima,'ima_num')|... |
---|
914 | isequal(nom_type_nc,'_i1-i2') |
---|
915 | nom_type_nc='_i1-i2'; |
---|
916 | elseif isequal(nom_type_ima,'_i_j1-j2')||isequal(nom_type_nc,'_i1-i2_j1-j2') |
---|
917 | nom_type_nc='_i1-i2_j1-j2'; |
---|
918 | else |
---|
919 | if isequal(mode,'series(Di)')|isequal(mode,'st_series(Di)') |
---|
920 | nom_type_nc='_i1-i2_j'; % PIV in volume |
---|
921 | else |
---|
922 | nom_type_nc='_i_j1-j2'; |
---|
923 | end |
---|
924 | end |
---|
925 | browse.nom_type_nc=nom_type_nc; |
---|
926 | set(handles.browse_root,'UserData',browse) |
---|
927 | |
---|
928 | %reads .nc subdirectoy and image numbers from the interface |
---|
929 | subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf data |
---|
930 | first_i=str2num(get(handles.first_i,'String')); |
---|
931 | last_i=str2num(get(handles.last_i,'String')); |
---|
932 | incr=str2num(get(handles.incr_i,'String')); |
---|
933 | num1=first_i:incr:last_i; |
---|
934 | if isempty(num1) |
---|
935 | set(handles.list_pair_civ1,'String',{''}); |
---|
936 | return |
---|
937 | end |
---|
938 | ref_i=str2num(get(handles.ref_i,'String')); |
---|
939 | if isequal(mode,'pair j1-j2')|isequal(mode,'st_pair j1-j2') |
---|
940 | ref_j=0; |
---|
941 | else |
---|
942 | ref_j=str2num(get(handles.ref_j,'String')); |
---|
943 | end |
---|
944 | if isequal(get(handles.dt_text,'String'),'dt(ms)=')%simple series(Di) with equal interval |
---|
945 | ref_i=floor((first_i+last_i)/2); |
---|
946 | ref_j=1; |
---|
947 | end |
---|
948 | time=get(handles.displ_filebase,'UserData');%get the set of times |
---|
949 | if isempty(time) |
---|
950 | time=[0 1]; |
---|
951 | end |
---|
952 | dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file |
---|
953 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
954 | |
---|
955 | %eliminate the first pairs inconsistent with the position |
---|
956 | if isempty(displ_num) |
---|
957 | nbpair=0; |
---|
958 | else |
---|
959 | nbpair=length(displ_num(1,:));%nbre of displayed pairs |
---|
960 | if isequal(mode,'series(Di)') | isequal(mode,'st_series(Di)') |
---|
961 | nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index |
---|
962 | elseif isequal(mode,'series(Dj)') | isequal(mode,'st_series(Dj)') |
---|
963 | nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index |
---|
964 | end |
---|
965 | end |
---|
966 | nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 |
---|
967 | |
---|
968 | %look for existing processed pairs involving the field at the middle of the series if civ1 will not |
---|
969 | % be performed, while the result is needed for next steps. |
---|
970 | displ_pair={''}; |
---|
971 | select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs |
---|
972 | testpair=0; |
---|
973 | if get(handles.CIV1,'Value')==0 % |
---|
974 | dirname=fullfile(filepath,subdir_civ1,ext_dir); |
---|
975 | if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir') |
---|
976 | hwarn=warndlg_uvmat(['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist'],'ERROR'); |
---|
977 | set(handles.list_pair_civ1,'String',{}); |
---|
978 | return |
---|
979 | end |
---|
980 | for ipair=1:nbpair |
---|
981 | [filename,select(ipair)]=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... |
---|
982 | ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); |
---|
983 | end |
---|
984 | if ~exist('select','var') | isequal(select,zeros(size(1:nbpair))) |
---|
985 | if isfield(browse,'incr_pair') |
---|
986 | num_i1=ref_i-floor(browse.incr_pair(1)/2); |
---|
987 | num_i2=ref_i+ceil(browse.incr_pair(1)/2); |
---|
988 | num_j1=ref_j-floor(browse.incr_pair(2)/2); |
---|
989 | num_j2=ref_j+ceil(browse.incr_pair(2)/2); |
---|
990 | [filename,select(1)]=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ1); |
---|
991 | testpair=1; |
---|
992 | else |
---|
993 | if isequal(mode,'series(Dj)') | isequal(mode,'st_series(Dj)') |
---|
994 | hwarn=warndlg_uvmat(['no civ1 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ1],'ERROR'); |
---|
995 | set(hwarn,'WindowStyle','modal'); |
---|
996 | else |
---|
997 | hwarn=warndlg_uvmat(['no civ1 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ1],'ERROR'); |
---|
998 | set(hwarn,'WindowStyle','modal'); |
---|
999 | end |
---|
1000 | set(handles.list_pair_civ1,'String',{''}); |
---|
1001 | %COMPLETER CAS STEREO |
---|
1002 | return |
---|
1003 | end |
---|
1004 | end |
---|
1005 | end |
---|
1006 | if isequal(mode,'series(Di)') | isequal(mode,'st_series(Di)') |
---|
1007 | if testpair |
---|
1008 | displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; |
---|
1009 | elseif ~isequal(get(handles.dt_text,'String'),'dt(ms)=') |
---|
1010 | for ipair=1:nbpair |
---|
1011 | if select(ipair) |
---|
1012 | dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt |
---|
1013 | displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
1014 | else |
---|
1015 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
1016 | end |
---|
1017 | end |
---|
1018 | else |
---|
1019 | for ipair=1:nbpair |
---|
1020 | if select(ipair) |
---|
1021 | displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt_unit*ipair)]; |
---|
1022 | else |
---|
1023 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
1024 | end |
---|
1025 | end |
---|
1026 | end |
---|
1027 | elseif isequal(mode,'series(Dj)')|isequal(mode,'st_series(Dj)')% series on the j index |
---|
1028 | if testpair |
---|
1029 | displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; |
---|
1030 | else |
---|
1031 | for ipair=1:nbpair |
---|
1032 | if select(ipair) |
---|
1033 | dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt |
---|
1034 | displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
1035 | elseif testpair |
---|
1036 | displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(2)/2)) '|' num2str(ceil(browse.incr_pair(2)/2))]; |
---|
1037 | else |
---|
1038 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
1039 | end |
---|
1040 | end |
---|
1041 | end |
---|
1042 | elseif isequal(mode,'pair j1-j2')|isequal(mode,'st_pair j1-j2')%case of pairs |
---|
1043 | for ipair=1:nbpair |
---|
1044 | if select(ipair) |
---|
1045 | dt=time(ref_i+displ_num(4,ipair),displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),displ_num(1,ipair));%time interval dt |
---|
1046 | displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair),nom_type_ima) '-' num2stra(displ_num(2,ipair),nom_type_ima) ... |
---|
1047 | ' :dt= ' num2str(dt*1000)]; |
---|
1048 | else |
---|
1049 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
1050 | end |
---|
1051 | end |
---|
1052 | elseif isequal(mode,'displacement') |
---|
1053 | displ_pair={'Di=Dj=0'}; |
---|
1054 | end |
---|
1055 | set(handles.list_pair_civ1,'String',displ_pair'); |
---|
1056 | ichoice=min(find(select)); |
---|
1057 | if (isempty(ichoice) | ichoice < 1); ichoice=1; end; |
---|
1058 | initial=get(handles.list_pair_civ1,'Value'); |
---|
1059 | if initial>nbpair |~isequal(select(initial),1) |
---|
1060 | set(handles.list_pair_civ1,'Value',ichoice);% first valid pair proposed by default in the menu |
---|
1061 | end |
---|
1062 | set(handles.list_pair_civ2,'String',displ_pair'); |
---|
1063 | initial=get(handles.list_pair_civ2,'Value'); |
---|
1064 | if initial>nbpair |~isequal(select(initial),1) |
---|
1065 | set(handles.list_pair_civ2,'Value',ichoice);% same pair proposed by default for civ2 |
---|
1066 | end |
---|
1067 | set(gcf,'Pointer','arrow') |
---|
1068 | %-------------------------------------------------------------- |
---|
1069 | % determine the menu for civ2 pairs depending on the existing netcdf file at the |
---|
1070 | %middle of the series set by first_i, incr, last_i |
---|
1071 | %-------------------------------------------------------------- |
---|
1072 | function find_netcpair_civ2(hObject, eventdata, handles) |
---|
1073 | set(gcf,'Pointer','watch') |
---|
1074 | %nomenclature types |
---|
1075 | filebase=get(handles.displ_filebase,'String'); |
---|
1076 | [filepath,Nme,ext_dir]=fileparts(filebase); |
---|
1077 | browse=get(handles.browse_root,'UserData'); |
---|
1078 | mode_list=get(handles.mode,'String'); |
---|
1079 | mode_value=get(handles.mode,'Value'); |
---|
1080 | mode=mode_list{mode_value}; |
---|
1081 | |
---|
1082 | % nomenclature type of the .nc files |
---|
1083 | nom_type_ima='ima_num';%default |
---|
1084 | if isfield(browse,'nom_type_ima') |
---|
1085 | nom_type_ima=browse.nom_type_ima; |
---|
1086 | end |
---|
1087 | nom_type_nc='_i1-i2';%default |
---|
1088 | if isfield(browse,'nom_type_nc') |
---|
1089 | nom_type_nc=browse.nom_type_nc; |
---|
1090 | end |
---|
1091 | if isequal(nom_type_ima,'png_old') | isequal(nom_type_ima,'netc_old')| isequal(nom_type_ima,'raw_SMD')| isequal(nom_type_nc,'netc_old') |
---|
1092 | nom_type_nc='netc_old';%nom_type for the netcdf files |
---|
1093 | elseif isequal(nom_type_ima,'none')|isequal(nom_type_nc,'none') |
---|
1094 | nom_type_nc='none'; |
---|
1095 | elseif isequal(nom_type_ima,'avi')|isequal(nom_type_ima,'_i')|isequal(nom_type_ima,'ima_num')|isequal(nom_type_nc,'_i1-i2') |
---|
1096 | nom_type_nc='_i1-i2'; |
---|
1097 | else |
---|
1098 | if isequal(mode,'series(Di)')|isequal(mode,'st_series(Di)') |
---|
1099 | nom_type_nc='_i1-i2_j'; % PIV in volume |
---|
1100 | else |
---|
1101 | nom_type_nc='_i_j1-j2'; |
---|
1102 | end |
---|
1103 | end |
---|
1104 | browse.nom_type_nc=nom_type_nc; |
---|
1105 | set(handles.browse_root,'UserData',browse) |
---|
1106 | |
---|
1107 | %reads .nc subdirectory and image numbers from the interface |
---|
1108 | subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf data |
---|
1109 | subdir_civ2=get(handles.subdir_civ2,'String');%subdirectory subdir_civ2 for the netcdf data |
---|
1110 | first_i=str2num(get(handles.first_i,'String')); |
---|
1111 | last_i=str2num(get(handles.last_i,'String')); |
---|
1112 | incr=str2num(get(handles.incr_i,'String')); |
---|
1113 | num1=first_i:incr:last_i; |
---|
1114 | if isempty(num1) |
---|
1115 | set(handles.list_pair_civ2,'String',{}); |
---|
1116 | return |
---|
1117 | end |
---|
1118 | ref_i=str2num(get(handles.ref_i,'String')); |
---|
1119 | if isequal(mode,'pair j1-j2')|isequal(mode,'st_pair j1-j2') |
---|
1120 | ref_j=0; |
---|
1121 | else |
---|
1122 | ref_j=str2num(get(handles.ref_j,'String')); |
---|
1123 | end |
---|
1124 | if isequal(get(handles.dt_text,'String'),'dt(ms)=')%simple series(Di) with equal interval |
---|
1125 | ref_i=ceil((first_i+last_i)/2); |
---|
1126 | ref_j=1; |
---|
1127 | end |
---|
1128 | % ref_i=browse.num_ref;%field number initially selected by the browser |
---|
1129 | time=get(handles.displ_filebase,'UserData'); %get the set of times |
---|
1130 | if isempty(time) |
---|
1131 | time=[0 1];%default |
---|
1132 | end |
---|
1133 | dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file |
---|
1134 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
1135 | |
---|
1136 | |
---|
1137 | %eliminate the first pairs inconsistent with the position |
---|
1138 | if isempty(displ_num) |
---|
1139 | nbpair=0; |
---|
1140 | else |
---|
1141 | nbpair=length(displ_num(1,:));%nbre of displayed pairs |
---|
1142 | if isequal(mode,'series(Di)') | isequal(mode,'st_series(Di)') |
---|
1143 | nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index |
---|
1144 | elseif isequal(mode,'series(Dj)') | isequal(mode,'st_series(Dj)') |
---|
1145 | nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index |
---|
1146 | end |
---|
1147 | end |
---|
1148 | nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 |
---|
1149 | |
---|
1150 | %look for existing processed pairs involving the field at the middle of the series if civ1 will not |
---|
1151 | % be performed, while the result is needed for next steps. |
---|
1152 | displ_pair={''}; %default |
---|
1153 | select=ones(size(1:nbpair));%default =1 for nubers of displayed pairs |
---|
1154 | if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0%&... |
---|
1155 | if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir') |
---|
1156 | errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist']) |
---|
1157 | set(handles.list_pair_civ2,'String',{}); |
---|
1158 | return |
---|
1159 | end |
---|
1160 | for ipair=1:nbpair |
---|
1161 | [filename,select(ipair)]=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... |
---|
1162 | ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); |
---|
1163 | end |
---|
1164 | if isequal(select,zeros(size(1:nbpair))) |
---|
1165 | if isfield(browse,'incr_pair') |
---|
1166 | num_i1=ref_i-floor(browse.incr_pair(1)/2); |
---|
1167 | num_i2=ref_i+floor((browse.incr_pair(1)+1)/2); |
---|
1168 | num_j1=ref_j-floor(browse.incr_pair(2)/2); |
---|
1169 | num_j2=ref_j+floor((browse.incr_pair(2)+1)/2); |
---|
1170 | [filename,select(1)]=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ2); |
---|
1171 | else |
---|
1172 | if isequal(mode,'series(Dj)') | isequal(mode,'st_series(Dj)') |
---|
1173 | errordlg(['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2]) |
---|
1174 | else |
---|
1175 | errordlg(['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2]) |
---|
1176 | end |
---|
1177 | set(handles.list_pair_civ2,'String',{}); |
---|
1178 | return |
---|
1179 | end |
---|
1180 | end |
---|
1181 | end |
---|
1182 | if isequal(mode,'series(Di)') | isequal(mode,'st_series(Di)') |
---|
1183 | if ~isequal(get(handles.dt_text,'String'),'dt(ms)=') |
---|
1184 | for ipair=1:nbpair |
---|
1185 | if select(ipair) |
---|
1186 | dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt |
---|
1187 | displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
1188 | else |
---|
1189 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
1190 | end |
---|
1191 | end |
---|
1192 | else |
---|
1193 | for ipair=1:nbpair |
---|
1194 | if select(ipair) |
---|
1195 | displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt_unit*ipair)]; |
---|
1196 | else |
---|
1197 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
1198 | end |
---|
1199 | end |
---|
1200 | end |
---|
1201 | elseif isequal(mode,'series(Dj)') | isequal(mode,'st_series(Dj)') % series on the j index |
---|
1202 | for ipair=1:nbpair |
---|
1203 | if select(ipair) |
---|
1204 | dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt |
---|
1205 | displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
1206 | else |
---|
1207 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
1208 | end |
---|
1209 | end |
---|
1210 | elseif isequal(mode,'pair j1-j2') | isequal(mode,'st_pair j1-j2') %case of pairs |
---|
1211 | for ipair=1:nbpair |
---|
1212 | if select(ipair) |
---|
1213 | dt=time(ref_i+displ_num(4,ipair),displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),displ_num(1,ipair));%time interval dt |
---|
1214 | displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair),nom_type_ima) '-' num2stra(displ_num(2,ipair),nom_type_ima) ... |
---|
1215 | ' :dt= ' num2str(dt*1000)]; |
---|
1216 | else |
---|
1217 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
1218 | end |
---|
1219 | end |
---|
1220 | elseif isequal(mode,'displacement') |
---|
1221 | displ_pair={'Di=Dj=0'}; |
---|
1222 | end |
---|
1223 | set(handles.list_pair_civ2,'String',displ_pair'); |
---|
1224 | ichoice=min(find(select)); |
---|
1225 | if (isempty(ichoice) | ichoice < 1); ichoice=1; end; |
---|
1226 | if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0 |
---|
1227 | set(handles.list_pair_civ2,'Value',ichoice);% first valid pair proposed by default in the menu |
---|
1228 | end |
---|
1229 | set(gcf,'Pointer','arrow') |
---|
1230 | %---------------------------------------------------- |
---|
1231 | % determine the list of index pairs of processing file |
---|
1232 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1233 | function [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... |
---|
1234 | find_pair_indices(handles,mode) |
---|
1235 | first_i=str2num(get(handles.first_i,'String')); |
---|
1236 | last_i=str2num(get(handles.last_i,'String')); |
---|
1237 | incr=str2num(get(handles.incr_i,'String')); |
---|
1238 | first_j=str2num(get(handles.first_j,'String')); |
---|
1239 | last_j=str2num(get(handles.last_j,'String')); |
---|
1240 | incr_j=str2num(get(handles.incr_j,'String')); |
---|
1241 | list_civ1=get(handles.list_pair_civ1,'String'); |
---|
1242 | index_civ1=get(handles.list_pair_civ1,'Value'); |
---|
1243 | str_civ1=list_civ1{index_civ1}; |
---|
1244 | list_civ2=get(handles.list_pair_civ2,'String'); |
---|
1245 | index_civ2=get(handles.list_pair_civ2,'Value'); |
---|
1246 | str_civ2=list_civ2{index_civ2}; |
---|
1247 | if isequal(first_i,[])|isequal(first_j,[]), errordlg('first field number not defined'),... |
---|
1248 | set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; |
---|
1249 | if isequal(last_i,[])| isequal(last_j,[]),errordlg('last field number not defined'),... |
---|
1250 | set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; |
---|
1251 | if isequal(incr,[])| isequal(incr_j,[]),errordlg('increment in field number not defined'),... |
---|
1252 | set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; |
---|
1253 | if last_i < first_i | last_j < first_j , errordlg('last field number must be larger than the first one'),... |
---|
1254 | set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; |
---|
1255 | num1=[first_i:incr:last_i]; |
---|
1256 | num_j=[first_j:incr_j:last_j]; |
---|
1257 | if isequal (mode,'series(Di)') |isequal(mode,'st_series(Di)') |
---|
1258 | %recognize the pair civ1 from the display |
---|
1259 | indsel=find((double(str_civ1)<48)|(double(str_civ1)>57));% character indices of non numerical characters |
---|
1260 | str_raw=str_civ1(indsel); |
---|
1261 | indsepar=find(str_raw=='|'); %character index of the separator |
---|
1262 | d1=str2num(str_civ1([indsel(indsepar-1)+1:indsel(indsepar)-1])); |
---|
1263 | if indsepar==length(str_raw) |
---|
1264 | d2=str2num(str_civ1([indsel(indsepar)+1:end])); |
---|
1265 | else |
---|
1266 | d2=str2num(str_civ1([indsel(indsepar)+1:indsel(indsepar+1)-1])); |
---|
1267 | end |
---|
1268 | %recognize the pair civ2 from the display |
---|
1269 | num1_civ1=num1-d1;% set of first image numbers |
---|
1270 | num2_civ1=num1+d2; |
---|
1271 | num_a_civ1=num_j; |
---|
1272 | num_b_civ1=num_j; |
---|
1273 | num1_civ2=num1-floor(index_civ2/2)*ones(size(num1));% set of first image numbers |
---|
1274 | num2_civ2=num1+ceil(index_civ2/2)*ones(size(num1)); |
---|
1275 | num1_civ2=num1-d1;% set of first image numbers |
---|
1276 | num2_civ2=num1+d2; |
---|
1277 | num_a_civ2=num_j; |
---|
1278 | num_b_civ2=num_j; |
---|
1279 | % adjust the first and last field number |
---|
1280 | lastfield=str2num(get(handles.nb_field,'String')); |
---|
1281 | if isequal(lastfield,[]) |
---|
1282 | indsel=find((num1_civ1 >= 1)&(num1_civ2 >= 1)); |
---|
1283 | else |
---|
1284 | indsel=find((num2_civ1 <= lastfield)&(num2_civ2 <= lastfield)&(num1_civ1 >= 1)&(num1_civ2 >= 1)); |
---|
1285 | end |
---|
1286 | if length(indsel)>=1 |
---|
1287 | firstind=indsel(1); |
---|
1288 | lastind=indsel(end); |
---|
1289 | set(handles.first_i,'String',num2str(num1(firstind)))%update the display of first and last fields |
---|
1290 | set(handles.last_i,'String',num2str(num1(lastind))) |
---|
1291 | num1=num1(indsel); |
---|
1292 | num1_civ1=num1_civ1(indsel); |
---|
1293 | num1_civ2=num1_civ2(indsel); |
---|
1294 | num2_civ1=num2_civ1(indsel); |
---|
1295 | num2_civ2=num2_civ2(indsel); |
---|
1296 | end |
---|
1297 | elseif isequal (mode,'series(Dj)')|isequal (mode,'st_series(Dj)') |
---|
1298 | lastfield_j=str2num(get(handles.nb_field2,'String')); |
---|
1299 | num1_civ1=num1;% set of first image numbers |
---|
1300 | num2_civ1=num1; |
---|
1301 | num_a_civ1=num_j-floor(index_civ1/2)*ones(size(num_j)); |
---|
1302 | num_b_civ1=num_j+ceil(index_civ1/2)*ones(size(num_j)); |
---|
1303 | num1_civ2=num1; |
---|
1304 | num2_civ2=num1; |
---|
1305 | num_a_civ2=num_j-floor(index_civ2/2)*ones(size(num_j)); |
---|
1306 | num_b_civ2=num_j+ceil(index_civ2/2)*ones(size(num_j)); |
---|
1307 | % adjust the first and last field number |
---|
1308 | if isequal(lastfield_j,[]) |
---|
1309 | indsel=find((num_a_civ1 >= 1)&(num_a_civ2 >= 1)); |
---|
1310 | else |
---|
1311 | indsel=find((num_b_civ1 <= lastfield_j)&(num_b_civ2 <= lastfield_j)&(num_a_civ1 >= 1)&(num_a_civ2 >= 1)); |
---|
1312 | end |
---|
1313 | if length(indsel)>=1 |
---|
1314 | firstind=indsel(1); |
---|
1315 | lastind=indsel(end); |
---|
1316 | set(handles.first_j,'String',num2str(num_j(firstind)))%update the display of first and last fields |
---|
1317 | set(handles.last_j,'String',num2str(num_j(lastind))) |
---|
1318 | num_j=num_j(indsel); |
---|
1319 | num_a_civ1=num_a_civ1(indsel); |
---|
1320 | num_a_civ2=num_a_civ2(indsel); |
---|
1321 | num_b_civ1=num_b_civ1(indsel); |
---|
1322 | num_b_civ2=num_b_civ2(indsel); |
---|
1323 | end |
---|
1324 | elseif isequal(mode,'pair j1-j2') | isequal(mode,'st_pair j1-j2') %case of bursts (png_old or png_2D) |
---|
1325 | num1_civ1=num1; |
---|
1326 | num1_civ2=num1; |
---|
1327 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
1328 | num2_civ1=num1; |
---|
1329 | num_a_civ1=displ_num(1,index_civ1); |
---|
1330 | num_b_civ1=displ_num(2,index_civ1); |
---|
1331 | num2_civ2=num1; |
---|
1332 | num_a_civ2=displ_num(1,index_civ2); |
---|
1333 | num_b_civ2=displ_num(2,index_civ2); |
---|
1334 | elseif isequal(mode,'displacement') |
---|
1335 | num1_civ1=num1; |
---|
1336 | num2_civ1=num1; |
---|
1337 | num_a_civ1=num_j; |
---|
1338 | num_b_civ1=num_j; |
---|
1339 | num1_civ2=num1; |
---|
1340 | num2_civ2=num1; |
---|
1341 | num_a_civ2=num_j; |
---|
1342 | num_b_civ2=num_j; |
---|
1343 | end |
---|
1344 | |
---|
1345 | |
---|
1346 | %------------------------------------------------------------- |
---|
1347 | % --- Executes on selection change in list_pair_civ1. |
---|
1348 | function list_pair_civ1_Callback(hObject, eventdata, handles) |
---|
1349 | %------------------------------------------------------------ |
---|
1350 | %reproduce by default the chosen pair in the civ2 menu |
---|
1351 | list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs |
---|
1352 | index_pair=get(handles.list_pair_civ1,'Value'); |
---|
1353 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
1354 | num_a=displ_num(1,index_pair); |
---|
1355 | num_b=displ_num(2,index_pair); |
---|
1356 | set(handles.list_pair_civ2,'Value',index_pair); |
---|
1357 | |
---|
1358 | %update first_i and last_i according to the chosen image pairs |
---|
1359 | mode_list=get(handles.mode,'String'); |
---|
1360 | mode_value=get(handles.mode,'Value'); |
---|
1361 | mode=mode_list{mode_value}; |
---|
1362 | if isequal(mode,'series(Di)') |
---|
1363 | first_i=str2num(get(handles.first_i,'String')); |
---|
1364 | last_i=str2num(get(handles.last_i,'String')); |
---|
1365 | incr_i=str2num(get(handles.incr_i,'String')); |
---|
1366 | num1=first_i:incr_i:last_i; |
---|
1367 | lastfield=str2num(get(handles.nb_field,'String')); |
---|
1368 | if ~isequal(lastfield,[]) |
---|
1369 | ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& ... |
---|
1370 | (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield)); |
---|
1371 | num1=num1(ind); |
---|
1372 | end |
---|
1373 | set(handles.first_i,'String',num2str(num1(1))); |
---|
1374 | set(handles.last_i,'String',num2str(num1(end))); |
---|
1375 | elseif isequal(mode,'series(Dj)') |
---|
1376 | first_j=str2num(get(handles.first_j,'String')); |
---|
1377 | last_j=str2num(get(handles.last_j,'String')); |
---|
1378 | incr_j=str2num(get(handles.incr_j,'String')); |
---|
1379 | num_j=first_j:incr_j:last_j; |
---|
1380 | lastfield2=str2num(get(handles.nb_field2,'String')); |
---|
1381 | if ~isequal(lastfield2,[]) |
---|
1382 | ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... |
---|
1383 | (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2)); |
---|
1384 | num1=num_j(ind); |
---|
1385 | end |
---|
1386 | set(handles.first_j,'String',num2str(num1(1))); |
---|
1387 | set(handles.last_j,'String',num2str(num1(end))); |
---|
1388 | end |
---|
1389 | |
---|
1390 | %------------------------------------------------------------------ |
---|
1391 | % --- Executes on selection change in list_pair_civ2. |
---|
1392 | function list_pair_civ2_Callback(hObject, eventdata, handles) |
---|
1393 | |
---|
1394 | index_pair=get(handles.list_pair_civ2,'Value');%get the selected position index in the menu |
---|
1395 | |
---|
1396 | %update first_i and last_i according to the chosen image pairs |
---|
1397 | mode_list=get(handles.mode,'String'); |
---|
1398 | mode_value=get(handles.mode,'Value'); |
---|
1399 | mode=mode_list{mode_value}; |
---|
1400 | if isequal(mode,'series(Di)') |
---|
1401 | first_i=str2num(get(handles.first_i,'String')); |
---|
1402 | last_i=str2num(get(handles.last_i,'String')); |
---|
1403 | incr_i=str2num(get(handles.incr_i,'String')); |
---|
1404 | num1=first_i:incr_i:last_i; |
---|
1405 | lastfield=str2num(get(handles.nb_field,'String')); |
---|
1406 | if ~isequal(lastfield,[]) |
---|
1407 | ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& ... |
---|
1408 | (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield)); |
---|
1409 | num1=num1(ind); |
---|
1410 | end |
---|
1411 | set(handles.first_i,'String',num2str(num1(1))); |
---|
1412 | set(handles.last_i,'String',num2str(num1(end))); |
---|
1413 | elseif isequal(mode,'series(Dj)') |
---|
1414 | first_j=str2num(get(handles.first_j,'String')); |
---|
1415 | last_j=str2num(get(handles.last_j,'String')); |
---|
1416 | incr_j=str2num(get(handles.incr_j,'String')); |
---|
1417 | num_j=first_j:incr_j:last_j; |
---|
1418 | lastfield2=str2num(get(handles.nb_field2,'String')); |
---|
1419 | if ~isequal(lastfield2,[]) |
---|
1420 | ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... |
---|
1421 | (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield)); |
---|
1422 | num1=num_j(ind); |
---|
1423 | end |
---|
1424 | set(handles.first_j,'String',num2str(num1(1))); |
---|
1425 | set(handles.last_j,'String',num2str(num1(end))); |
---|
1426 | end |
---|
1427 | |
---|
1428 | |
---|
1429 | |
---|
1430 | |
---|
1431 | %----------------------------------------------------------- |
---|
1432 | % --- Executes on button press in BATCH: remote processing |
---|
1433 | %----------------------------------------------------------- |
---|
1434 | function BATCH_Callback(hObject, eventdata, handles) |
---|
1435 | global civ1_exe civ2_exe patch_exe patch_new_exe fix_exe todo_path sge Civ_exe |
---|
1436 | |
---|
1437 | pxcmx=get(handles.pxcmx,'String'); |
---|
1438 | pxcmy=get(handles.pxcmy,'String'); |
---|
1439 | npx=get(handles.pxcmx,'UserData'); |
---|
1440 | npy=get(handles.pxcmy,'UserData'); |
---|
1441 | |
---|
1442 | %check the list of operations: |
---|
1443 | operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'}; |
---|
1444 | run_flag=1; |
---|
1445 | box_test(1)=get(handles.CIV1,'Value'); |
---|
1446 | box_test(2)=get(handles.FIX1,'Value'); |
---|
1447 | box_test(3)=get(handles.PATCH1,'Value'); |
---|
1448 | box_test(4)=get(handles.CIV2,'Value'); |
---|
1449 | box_test(5)=get(handles.FIX2,'Value'); |
---|
1450 | box_test(6)=get(handles.PATCH2,'Value'); |
---|
1451 | index=find(box_test==1); |
---|
1452 | if isempty(index) |
---|
1453 | errordlg('no selected operation') |
---|
1454 | set(handles.BATCH, 'Enable','On') |
---|
1455 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
1456 | return |
---|
1457 | end |
---|
1458 | index_first=min(index); |
---|
1459 | index_last=max(index); |
---|
1460 | box_used=box_test([index_first : index_last]); |
---|
1461 | [box_missing,ind_missing]=min(box_used); |
---|
1462 | if isequal(box_missing,0) |
---|
1463 | errordlg(['missing' cell2mat(operations(ind_missing))]); |
---|
1464 | set(handles.BATCH, 'Enable','On') |
---|
1465 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
1466 | return |
---|
1467 | end |
---|
1468 | |
---|
1469 | %check mask if selecetd |
---|
1470 | if isequal(get(handles.get_mask_civ1,'Value'),1) |
---|
1471 | get_mask_civ1_Callback(hObject, eventdata, handles); |
---|
1472 | end |
---|
1473 | if isequal(get(handles.get_mask_fix1,'Value'),1) |
---|
1474 | get_mask_fix1_Callback(hObject, eventdata, handles); |
---|
1475 | end |
---|
1476 | if isequal(get(handles.get_mask_civ2,'Value'),1) |
---|
1477 | get_mask_civ2_Callback(hObject, eventdata, handles); |
---|
1478 | end |
---|
1479 | if isequal(get(handles.get_mask_fix2,'Value'),1) |
---|
1480 | get_mask_fix2_Callback(hObject, eventdata, handles); |
---|
1481 | end |
---|
1482 | |
---|
1483 | |
---|
1484 | %read names of the .exe file |
---|
1485 | path_uvmat=which('uvmat');% check the path detected for source file uvmat |
---|
1486 | path_UVMAT=fileparts(path_uvmat); %path to UVMAT |
---|
1487 | if isunix |
---|
1488 | %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ_3D binary names |
---|
1489 | xmlfile=fullfile(path_UVMAT,'PARAM_LINUX.xml'); |
---|
1490 | if exist(xmlfile,'file') |
---|
1491 | t=xmltree(xmlfile); |
---|
1492 | sparam=convert(t); |
---|
1493 | end |
---|
1494 | else |
---|
1495 | %fid = fopen(fullfile(path_UVMAT,'PARAM_WIN.txt'),'r');%open the file with civ_3D binary names |
---|
1496 | xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml'); |
---|
1497 | if exist(xmlfile,'file') |
---|
1498 | t=xmltree(xmlfile); |
---|
1499 | sparam=convert(t); |
---|
1500 | end |
---|
1501 | end |
---|
1502 | sge=0; |
---|
1503 | if isfield(sparam,'Civ_exe') |
---|
1504 | Civ_exe=sparam.Civ_exe |
---|
1505 | end |
---|
1506 | if isfield(sparam,'Civ1_exe') |
---|
1507 | civ1_exe=sparam.Civ1_exe |
---|
1508 | end |
---|
1509 | if isfield(sparam,'Civ2_exe') |
---|
1510 | civ2_exe=sparam.Civ2_exe |
---|
1511 | end |
---|
1512 | if isfield(sparam,'Patch_exe') |
---|
1513 | patch_exe=sparam.Patch_exe |
---|
1514 | end |
---|
1515 | if isfield(sparam,'PatchNew_exe') |
---|
1516 | patch_new_exe=sparam.PatchNew_exe |
---|
1517 | end |
---|
1518 | if isfield(sparam,'Fix_exe') |
---|
1519 | fix_exe=sparam.Fix_exe |
---|
1520 | end |
---|
1521 | if isfield(sparam,'Todo_path') |
---|
1522 | todo_path=sparam.Todo_path |
---|
1523 | end |
---|
1524 | if isfield(sparam,'SGE') |
---|
1525 | sge=str2num(sparam.SGE) |
---|
1526 | end |
---|
1527 | %choice of batch priority |
---|
1528 | ind_answer=2; |
---|
1529 | if sge |
---|
1530 | [s,w]=unix('qstat -q civ_3D.q|grep job_| wc -l'); %check the waiting list (command unix) |
---|
1531 | if isequal(s,0) |
---|
1532 | w(end)=[]; |
---|
1533 | str_displ={[w ' jobs in the waiting list'];'Select a priority:'}; |
---|
1534 | str={'urgent';'normal';'low'}; |
---|
1535 | [ind_answer,v] = listdlg('PromptString',str_displ,... |
---|
1536 | 'SelectionMode','single',... |
---|
1537 | 'ListString',str,'ListSize',[200 200],'Name','job priority','InitialValue',3); |
---|
1538 | if isequal(v,0) % to handle Cancel button and figure close, |
---|
1539 | return % a better way should be create |
---|
1540 | end |
---|
1541 | else |
---|
1542 | warndlg_uvmat('batch system not available','ERROR') |
---|
1543 | return |
---|
1544 | end |
---|
1545 | end |
---|
1546 | %initialize the waitbars |
---|
1547 | set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001]) |
---|
1548 | set(handles.waitbar_patch1,'Position',[0.946 0.439 0.03 0.001]) |
---|
1549 | set(handles.waitbar_civ2,'Position',[0.946 0.219 0.03 0.001]) |
---|
1550 | set(handles.waitbar_patch2,'Position',[0.946 0.0 0.03 0.001]) |
---|
1551 | set(handles.BATCH, 'Enable','Off') |
---|
1552 | set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784]) |
---|
1553 | |
---|
1554 | %get the filename root, nomenclature and numbers |
---|
1555 | filebase=get(handles.displ_filebase,'String'); |
---|
1556 | % for Windows system find the UBC path name if needed |
---|
1557 | if ~isunix & isequal(todo_path(1:2),'\\') & isequal(filebase(2:3),':\') |
---|
1558 | cur_dir=pwd; |
---|
1559 | if ~isequal(cur_dir(2:3),':\') |
---|
1560 | cd(matlabroot); %move to the Matlab root directory if the current Matlab dir does not allow the dos command or is M: |
---|
1561 | end |
---|
1562 | [ss,ww]=dos(['net use ' filebase(1:2)]); |
---|
1563 | if isequal(ss,0) |
---|
1564 | rankpath=findstr(ww,'\\'); |
---|
1565 | if ~isempty(rankpath) |
---|
1566 | wwrest=ww(rankpath:end); |
---|
1567 | rankend=min(find(double(wwrest)==10))-1; |
---|
1568 | filebase=[wwrest(1:rankend) filebase(3:end)]; |
---|
1569 | set(handles.displ_filebase,'String',filebase); |
---|
1570 | end |
---|
1571 | else |
---|
1572 | warndlg_uvmat('for BATCH option, UBC file names, beginning by \\, are needed','ERROR'); |
---|
1573 | set(handles.BATCH, 'Enable','On') |
---|
1574 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
1575 | return |
---|
1576 | end |
---|
1577 | end |
---|
1578 | browse=get(handles.browse_root,'UserData') |
---|
1579 | ext_ima=browse.ext_ima; |
---|
1580 | nom_type_nc='_i1-i2'; |
---|
1581 | nom_type_ima=browse.nom_type_ima; |
---|
1582 | % nom_type_nc=browse.nom_type_nc; |
---|
1583 | % if isequal(nom_type_ima2,[]),nom_type_ima2='ima_num';end; %default |
---|
1584 | % if isequal(nom_type_nc,[]),nom_type_nc='_i1-i2';end; %default |
---|
1585 | mode_list=get(handles.mode,'String'); |
---|
1586 | mode_value=get(handles.mode,'Value'); |
---|
1587 | mode=mode_list{mode_value}; |
---|
1588 | time=get(handles.displ_filebase,'UserData'); %get the set of times |
---|
1589 | |
---|
1590 | [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... |
---|
1591 | find_pair_indices(handles,mode); %determine the pairs of processing file |
---|
1592 | |
---|
1593 | %check dir |
---|
1594 | subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf output data |
---|
1595 | subdir_civ2=get(handles.subdir_civ2,'String'); |
---|
1596 | if isequal(subdir_civ1,''),subdir_civ1='A'; end% put default subdir |
---|
1597 | if isequal(subdir_civ2,''),subdir_civ2=subdir_civ1; end% put default subdir |
---|
1598 | currentdir=pwd;%store the current working directory |
---|
1599 | [Path_ima,Name]=fileparts(filebase);%Path of the image files (.civ_3D) |
---|
1600 | if ~exist(Path_ima,'dir') |
---|
1601 | warndlg_uvmat(['path to images ' Path_ima ' not found'],'ERROR') |
---|
1602 | return |
---|
1603 | end |
---|
1604 | cd(Path_ima);%move to the directory of the images |
---|
1605 | dircur=pwd; %current working directory |
---|
1606 | m2=''; |
---|
1607 | [erread,message]=fileattrib(Path_ima); |
---|
1608 | if ~isempty(message) & ~isequal(message.UserWrite,1) |
---|
1609 | errordlg(['No writting access to ' Path_ima]) |
---|
1610 | cd(currentdir) |
---|
1611 | return |
---|
1612 | end |
---|
1613 | |
---|
1614 | %test for reference file in fix |
---|
1615 | ref_fix1=get(handles.ref_fix1,'UserData'); |
---|
1616 | ref_fix2=get(handles.ref_fix2,'UserData'); |
---|
1617 | if (~isempty(ref_fix1) & box_test(2)==1)|(~isempty(ref_fix2) & box_test(5)==1) |
---|
1618 | errordlg('reference file not implemented in BATCH mode, use RUN') |
---|
1619 | set(handles.BATCH, 'Enable','On') |
---|
1620 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
1621 | return |
---|
1622 | end |
---|
1623 | nbfield=length(num1_civ1); |
---|
1624 | nbslice=length(num_a_civ1); |
---|
1625 | |
---|
1626 | %check the existence of the netcdf and image files involved |
---|
1627 | % if box_test(1)==1;%CIV1 activated |
---|
1628 | detect=1; |
---|
1629 | while detect==1 %name a new subdir if one of the netcdf files already exists |
---|
1630 | for ifile=1:nbfield |
---|
1631 | % for j=1:nbslice |
---|
1632 | [filename,detect]=name_generator(filebase,num1_civ1(ifile),[],'.nc',... |
---|
1633 | nom_type_nc,1,num2_civ1(ifile),[],subdir_civ1);% |
---|
1634 | if detect==1% if a netcdf file already exists |
---|
1635 | subdir_civ1=[subdir_civ1 '.0']; |
---|
1636 | subdir_civ2=subdir_civ1; |
---|
1637 | break |
---|
1638 | end |
---|
1639 | filecell_nc1(ifile)={filename}; |
---|
1640 | if detect==1% if a netcdf file already exists |
---|
1641 | break |
---|
1642 | end |
---|
1643 | end |
---|
1644 | %create the new subdir_civ1 if it does not exist |
---|
1645 | if ~exist(fullfile(Path_ima,subdir_civ1),'dir') |
---|
1646 | [m1,m2,m3]=mkdir(subdir_civ1) |
---|
1647 | if ~isequal(m2,'') |
---|
1648 | msgbox(m2);%error message for directory creation |
---|
1649 | end |
---|
1650 | end |
---|
1651 | end |
---|
1652 | %get image names |
---|
1653 | for ifile=1:nbfield |
---|
1654 | [filecell_ima1_civ1{ifile},idetect]=name_generator(filebase, num1_civ1(ifile),[],ext_ima,nom_type_ima);%first image |
---|
1655 | [filecell_ima2_civ1{ifile},idetect_1]=name_generator(filebase, num2_civ1(ifile),[],ext_ima,nom_type_ima); %second image |
---|
1656 | if idetect==0 |
---|
1657 | warndlg_uvmat([filecell_ima1_civ1{ifile} ' not found'],'ERROR') |
---|
1658 | set(handles.BATCH, 'Enable','On') |
---|
1659 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
1660 | cd(currentdir) |
---|
1661 | return |
---|
1662 | end |
---|
1663 | if idetect_1==0, |
---|
1664 | errordlg([filecell_ima2_civ1{ifile} ' not found']) |
---|
1665 | set(handles.BATCH, 'Enable','On') |
---|
1666 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
1667 | cd(currentdir) |
---|
1668 | return |
---|
1669 | end |
---|
1670 | end |
---|
1671 | |
---|
1672 | cd(currentdir);%come back to the initial working directory |
---|
1673 | % if ~isequal(m2,'') |
---|
1674 | % msgbox(m2);%error message for directory creation |
---|
1675 | % end |
---|
1676 | set(handles.subdir_civ1,'String',subdir_civ1);%update the edit box |
---|
1677 | set(handles.subdir_civ2,'String',subdir_civ2);%update the edit box |
---|
1678 | browse.nom_type_nc=nom_type_nc; |
---|
1679 | set(handles.browse_root,'UserData',browse);%update the nomenclature type for uvmat |
---|
1680 | |
---|
1681 | %COPY IMAGES TO THE FORMAT .vol IF NEEDED |
---|
1682 | if isequal(nom_type_ima,'avi') |
---|
1683 | nom_type_imanew='_i'; |
---|
1684 | else |
---|
1685 | nom_type_imanew=nom_type_ima; |
---|
1686 | end |
---|
1687 | |
---|
1688 | if ~isequal(ext_ima,'.vol') |
---|
1689 | if box_test(1)==1 %if civ1 is performed |
---|
1690 | h = waitbar(0,['copy images to the .png format for civ1']);% display a wait bar |
---|
1691 | for ifile=1:nbfield |
---|
1692 | waitbar(ifile/nbfield); |
---|
1693 | Atot=[]; |
---|
1694 | [filename_A,idetect_cur]=name_generator(filebase,num1_civ1(ifile),1,'.png','_i');%A VOIR |
---|
1695 | for j=1:nbslice |
---|
1696 | if idetect_cur==0 |
---|
1697 | A=read_image(cell2mat(filecell_ima1_civ1(ifile,j)),nom_type_ima2,npx,npy,num1_civ1(ifile)); |
---|
1698 | Atot=[Atot;A]; |
---|
1699 | %imwrite(A,filename,'BitDepth',16); |
---|
1700 | end |
---|
1701 | end |
---|
1702 | imwrite(Atot,filename_A,'BitDepth',16); |
---|
1703 | %filecell_ima1_civ1(ifile,j)={filename}; |
---|
1704 | Atot=[]; |
---|
1705 | [filename_B,idetect_cur]=name_generator(filebase, num2_civ1(ifile),1,'.png','_i'); |
---|
1706 | for j=1:nbslice |
---|
1707 | if idetect_cur==0 |
---|
1708 | A=read_image(cell2mat(filecell_ima2_civ1(ifile,j)),nom_type_ima2,npx,npy,num2_civ1(ifile)); |
---|
1709 | Atot=[Atot;A]; |
---|
1710 | % imwrite(A,filename,'BitDepth',16); |
---|
1711 | end |
---|
1712 | %filecell_ima2_civ1(ifile,j)={filename}; |
---|
1713 | end |
---|
1714 | imwrite(Atot,filename_B,'BitDepth',16); |
---|
1715 | end |
---|
1716 | close(h) |
---|
1717 | end |
---|
1718 | end |
---|
1719 | |
---|
1720 | if ~sge |
---|
1721 | %OPEN THE WAIT LIST FOR BATCH PROCESSES |
---|
1722 | name_lock=fullfile(todo_path,'lock'); %lock file |
---|
1723 | iwait=0; |
---|
1724 | while(exist(name_lock) & iwait<15) |
---|
1725 | pause(1); %wait 1 second |
---|
1726 | iwait=iwait+1; |
---|
1727 | end |
---|
1728 | if iwait==15 |
---|
1729 | errordlg(['I''m tired to wait for the lock file, please delete it then click again on BATCH' name_lock ]) |
---|
1730 | set(handles.BATCH, 'Enable','On') |
---|
1731 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
1732 | return |
---|
1733 | end |
---|
1734 | p0=fopen(name_lock,'w'); %create the file name_lock: prevents other users to interfere |
---|
1735 | name_todo=fullfile(todo_path,'TODO.txt'); |
---|
1736 | p1=fopen(name_todo,'a'); |
---|
1737 | if (p1<0) |
---|
1738 | errordlg(['error in opening ' name_todo]) |
---|
1739 | set(handles.BATCH, 'Enable','On') |
---|
1740 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
1741 | return; |
---|
1742 | end |
---|
1743 | end |
---|
1744 | |
---|
1745 | for ifile=1:nbfield |
---|
1746 | i_cmd=0; |
---|
1747 | cmd=''; |
---|
1748 | if sge |
---|
1749 | cmd='#!/bin/bash'; |
---|
1750 | cmd=char({cmd;'#$ -cwd'}); |
---|
1751 | cmd=char({cmd;'hostname && date'}); |
---|
1752 | end |
---|
1753 | filename_cmx=cell2mat(filecell_nc1(ifile));%output netcdf file |
---|
1754 | filename_cmx([end-1:end])='cm';%name of cmx file |
---|
1755 | filename_cmx=[filename_cmx 'x']; |
---|
1756 | |
---|
1757 | %CIV1 |
---|
1758 | if box_test(1)==1 |
---|
1759 | %GET civ_3D PARAMETERS: |
---|
1760 | par_civ1=read_param_civ1(handles,cell2mat(filecell_ima1_civ1(1,1))); |
---|
1761 | p1text=[]; |
---|
1762 | [par_civ1.path,resu_file,resu_ext]=fileparts(filecell_nc1{ifile}); |
---|
1763 | par_civ1.volume1=filecell_ima1_civ1{ifile}; |
---|
1764 | par_civ1.volume2=filecell_ima2_civ1{ifile} |
---|
1765 | par_civ1.nx=1024; |
---|
1766 | par_civ1.ny=1024; |
---|
1767 | par_civ1.nz=par_civ1.gridLimits_Zmax - par_civ1.gridLimits_Zmin; |
---|
1768 | 'TEST' |
---|
1769 | par_civ1 |
---|
1770 | % civAll=get(handles.Experimental,'Value'); % Boolean for new civ excution method |
---|
1771 | % if isequal(civAll,1) |
---|
1772 | civAllxml=struct2xml(par_civ1);% xml contents, all parameters |
---|
1773 | civAllxml=set(civAllxml,1,'name','civ3d3c'); |
---|
1774 | % save(civAllxml) |
---|
1775 | par_civ1_3d_xml=fullfile(par_civ1.path,[resu_file '.xml']);%[par_civ1.path '/test_to_change.xml']; |
---|
1776 | pvalue=num2str((1-ind_answer)*500); |
---|
1777 | save(civAllxml,par_civ1_3d_xml); |
---|
1778 | if(isunix && sge) |
---|
1779 | ['echo /CIVX/bin/MPI/lam-7.1.3_g95/bin/mpirun C /CIVX/bin/civ3d3c -p ' par_civ1_3d_xml '|qsub -p ' pvalue ' -q lam.q -pe lam_loose 16 -e ' par_civ1_3d_xml '.errors -o ' par_civ1_3d_xml '.log' ] |
---|
1780 | eval ( ['!echo /CIVX/bin/MPI/lam-7.1.3_g95/bin/mpirun C /CIVX/bin/civ3d3c -p ' par_civ1_3d_xml '|qsub -p ' pvalue ' -q lam.q -pe lam_loose 16 -e ' par_civ1_3d_xml '.errors -o ' par_civ1_3d_xml '.log' ]) |
---|
1781 | else |
---|
1782 | '3D mode is NOT supported without sge' |
---|
1783 | end |
---|
1784 | return |
---|
1785 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1786 | % fichier xml produit |
---|
1787 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1788 | % A CONTINUER |
---|
1789 | %civAllxml |
---|
1790 | civAllCmd=[]; |
---|
1791 | civAllxml=set(civAllxml,1,'name','civ3d3c'); |
---|
1792 | namelog=[filename_cmx([1:end-3]) 'log']; |
---|
1793 | %par_civ1.Dt=num2str(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(1))); |
---|
1794 | %par_civ1.T0=num2str((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(1)))/2); |
---|
1795 | % test_mask=get(handles.get_mask_civ1,'Value'); |
---|
1796 | i_cmd=i_cmd+1; |
---|
1797 | % if isequal(civAll,0) |
---|
1798 | % cmd=char({cmd;BATCH_CIV1(filename_cmx([1:end-4]),namelog,par_civ1,handles)}); |
---|
1799 | % else |
---|
1800 | civAllCmd=[civAllCmd ' civ1 ']; |
---|
1801 | str=BATCH_CIV1_Unified(filename_cmx([1:end-4]),namelog,par_civ1,handles); |
---|
1802 | fieldnames=fields(str); |
---|
1803 | [civAllxml,uid_civ1]=add(civAllxml,1,'element','civ1'); |
---|
1804 | for ilist=1:length(fieldnames) |
---|
1805 | val=eval(['str.' fieldnames{ilist}]); |
---|
1806 | if ischar(val) |
---|
1807 | [civAllxml,uid_t]=add(civAllxml,uid_civ1,'element',fieldnames{ilist}); |
---|
1808 | [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); |
---|
1809 | end |
---|
1810 | end |
---|
1811 | % end |
---|
1812 | end |
---|
1813 | if(isunix) |
---|
1814 | cmd=char({cmd ; ['cp -f ' filename_cmx '2 ' filename_cmx]; cmd_CIV2}); |
---|
1815 | else |
---|
1816 | cmd=char({cmd ; ['copy /Y ' filename_cmx '2 ' filename_cmx]; cmd_CIV2}); |
---|
1817 | end |
---|
1818 | end |
---|
1819 | |
---|
1820 | % if isequal(civAll,1) |
---|
1821 | save(civAllxml,[filename_cmx([1:end-4]) '.xml']); |
---|
1822 | cmd=char({cmd;[Civ_exe ' -f ' [filename_cmx([1:end-4]) '.xml'] ' ' civAllCmd]}); |
---|
1823 | |
---|
1824 | %save(civAllxml,'/tmp/test.xml'); |
---|
1825 | % end |
---|
1826 | |
---|
1827 | |
---|
1828 | % create the .bat file: |
---|
1829 | if sge |
---|
1830 | [Rootbat,Filebat,extbat]=fileparts(filename_cmx); |
---|
1831 | filename_bat=fullfile(Rootbat,['job_' Filebat extbat]); |
---|
1832 | else |
---|
1833 | filename_bat=filename_cmx; |
---|
1834 | end |
---|
1835 | filename_bat(end-2:end)='bat'; |
---|
1836 | |
---|
1837 | % pbat=fopen(filename_bat,'w'); %create the file filename_bat |
---|
1838 | dlmwrite(filename_bat,cmd,'');%write commands in filename_bat |
---|
1839 | if sge |
---|
1840 | pvalue=num2str((1-ind_answer)*500); |
---|
1841 | namelog=[filename_bat '.patch.log']; |
---|
1842 | ['!qsub -p ' pvalue ' -q civ_3D.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]; |
---|
1843 | eval( ['!qsub -p ' pvalue ' -q civ_3D.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]); |
---|
1844 | else |
---|
1845 | if(isunix) |
---|
1846 | cmdtodo=['. ' filename_bat ];%removed for Mathieu tests %' && rm -f ' filename_bat] ; |
---|
1847 | else |
---|
1848 | % cmdtodo=[filename_bat ' && del /F /Q ' filename_bat]; |
---|
1849 | cmdtodo=[filename_bat];%removed for Mathieu tests %' && del /F /Q ' filename_bat' ; |
---|
1850 | end |
---|
1851 | count= fprintf(p1,'%s\n', cmdtodo); |
---|
1852 | end |
---|
1853 | if ~sge |
---|
1854 | fclose(p1); |
---|
1855 | fclose(p0); |
---|
1856 | delete(name_lock); |
---|
1857 | end |
---|
1858 | set(handles.BATCH, 'Enable','On') |
---|
1859 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
1860 | %save interface state |
---|
1861 | [Path,Name]=fileparts(filebase); |
---|
1862 | namefig=fullfile(Path,subdir_civ2,Name); |
---|
1863 | detect=1; |
---|
1864 | while detect==1 |
---|
1865 | namefigfull=[namefig '.fig']; |
---|
1866 | hh=dir(namefigfull); |
---|
1867 | if ~isempty(hh) |
---|
1868 | detect=1; |
---|
1869 | namefig=[namefig '.0']; |
---|
1870 | else |
---|
1871 | detect=0; |
---|
1872 | end |
---|
1873 | end |
---|
1874 | saveas(gcbf,namefigfull);%save the interface with name namefigfull |
---|
1875 | |
---|
1876 | |
---|
1877 | %---------------------------------------- |
---|
1878 | %PATCH |
---|
1879 | %--------------------------------------- |
---|
1880 | function cmd_PATCH=RUN_PATCH(filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,test_interp) |
---|
1881 | global patch_exe patch_new_exe |
---|
1882 | namelog=[filename_nc([1:end-3]) '_patch.log']; |
---|
1883 | if test_interp==0 |
---|
1884 | cmd_PATCH=[patch_exe ' -f ' filename_nc ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ... |
---|
1885 | ' > ' namelog ' 2>&1'] % redirect standard output to the log file |
---|
1886 | else %nouveau programme patch |
---|
1887 | cmd_PATCH=[patch_new_exe ' -f ' filename_nc ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ... |
---|
1888 | ' -max ' thresh_value ' -nopt ' subdomain_patch ' > ' namelog ' 2>&1']; % redirect standard output to the log file |
---|
1889 | end |
---|
1890 | |
---|
1891 | |
---|
1892 | %---------------------------------------------------- |
---|
1893 | function first_j_Callback(hObject, eventdata, handles) |
---|
1894 | last_j_Callback(hObject, eventdata, handles) |
---|
1895 | |
---|
1896 | %--------------------------------------------------------- |
---|
1897 | % --- Executes on button press in CIV1. |
---|
1898 | function CIV1_Callback(hObject, eventdata, handles) |
---|
1899 | enable_civ1(handles,get(handles.CIV1,'Value')) |
---|
1900 | find_netcpair_civ1(hObject, eventdata, handles); |
---|
1901 | |
---|
1902 | %------------------------------------------------------ |
---|
1903 | % --- Executes on button press in FIX1. |
---|
1904 | function FIX1_Callback(hObject, eventdata, handles) |
---|
1905 | |
---|
1906 | if get(handles.FIX1,'Value')==1 |
---|
1907 | enable_fix1(handles) |
---|
1908 | else |
---|
1909 | desable_fix1(handles) |
---|
1910 | end |
---|
1911 | |
---|
1912 | %---------------------------------------------------------------- |
---|
1913 | % --- Executes on button press in PATCH1. |
---|
1914 | function PATCH1_Callback(hObject, eventdata, handles) |
---|
1915 | |
---|
1916 | if get(handles.PATCH1,'Value')==1 |
---|
1917 | enable_patch1(handles) |
---|
1918 | else |
---|
1919 | desable_patch1(handles) |
---|
1920 | end |
---|
1921 | |
---|
1922 | %---------------------------------------------------------- |
---|
1923 | % --- Executes on button press in CIV2. |
---|
1924 | function CIV2_Callback(hObject, eventdata, handles) |
---|
1925 | state=get(handles.CIV2,'Value'); |
---|
1926 | enable_civ2(handles,state) |
---|
1927 | if state |
---|
1928 | find_netcpair_civ2(hObject, eventdata, handles) |
---|
1929 | end |
---|
1930 | |
---|
1931 | %--------------------------------------------------- |
---|
1932 | % --- Executes on button press in FIX2. |
---|
1933 | function FIX2_Callback(hObject, eventdata, handles) |
---|
1934 | if get(handles.FIX2,'Value')==1 |
---|
1935 | enable_fix2(handles) |
---|
1936 | if get(handles.CIV2,'Value')==0 |
---|
1937 | find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files |
---|
1938 | end |
---|
1939 | else |
---|
1940 | desable_fix2(handles) |
---|
1941 | end |
---|
1942 | |
---|
1943 | |
---|
1944 | %------------------------------------------------------- |
---|
1945 | % --- Executes on button press in PATCH2. |
---|
1946 | function PATCH2_Callback(hObject, eventdata, handles) |
---|
1947 | %-------------------------------------------------------- |
---|
1948 | if get(handles.PATCH2,'Value')==1 |
---|
1949 | enable_patch2(handles) |
---|
1950 | if get(handles.CIV2,'Value')==0 |
---|
1951 | find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files |
---|
1952 | end |
---|
1953 | else |
---|
1954 | desable_patch2(handles) |
---|
1955 | end |
---|
1956 | |
---|
1957 | |
---|
1958 | |
---|
1959 | %----------------------------------------------------------- |
---|
1960 | function first_i_Callback(hObject, eventdata, handles) |
---|
1961 | %------------------------------------------------------ |
---|
1962 | last_i_Callback(hObject, eventdata, handles) |
---|
1963 | |
---|
1964 | %----------------------------------------------------------- |
---|
1965 | % --- Executes on button press in calcul_search: determine the search range isx,isy |
---|
1966 | %-------------------------------------------------------- |
---|
1967 | function calcul_search_Callback(hObject, eventdata, handles) |
---|
1968 | |
---|
1969 | %determine pair numbers |
---|
1970 | list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs |
---|
1971 | index=get(handles.list_pair_civ1,'Value'); |
---|
1972 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
1973 | time=get(handles.displ_filebase,'UserData'); %get the set of times |
---|
1974 | pxcm_xy=get(handles.calcul_search,'UserData') |
---|
1975 | pxcmx=pxcm_xy(1); |
---|
1976 | pxcmy=pxcm_xy(2); |
---|
1977 | mode_list=get(handles.mode,'String'); |
---|
1978 | mode_value=get(handles.mode,'Value'); |
---|
1979 | mode=mode_list{mode_value}; |
---|
1980 | if isequal (mode, 'series(Di)' ) |
---|
1981 | ref_i=str2num(get(handles.ref_i,'String')); |
---|
1982 | num1=ref_i-floor(index/2);% first image numbers |
---|
1983 | num2=ref_i+ceil(index/2); |
---|
1984 | num_a=1; |
---|
1985 | num_b=1; |
---|
1986 | elseif isequal (mode, 'series(Dj)') |
---|
1987 | num1=1; |
---|
1988 | num2=1; |
---|
1989 | ref_j=str2num(get(handles.ref_j,'String')); |
---|
1990 | num_a=ref_j-floor(index/2);% first image numbers |
---|
1991 | num_b=ref_j+ceil(index/2); |
---|
1992 | elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) |
---|
1993 | ref_i=str2num(get(handles.ref_i,'String')); |
---|
1994 | num1=ref_i; |
---|
1995 | num2=ref_i; |
---|
1996 | num_a=displ_num(1,index); |
---|
1997 | num_b=displ_num(2,index); |
---|
1998 | end |
---|
1999 | dt=time(num2,num_b)-time(num1,num_a); |
---|
2000 | ibx=str2num(get(handles.ibx,'String')); |
---|
2001 | iby=str2num(get(handles.iby,'String')); |
---|
2002 | umin=dt*pxcmx*str2num(get(handles.umin,'String')); |
---|
2003 | umax=dt*pxcmx*str2num(get(handles.umax,'String')); |
---|
2004 | vmin=dt*pxcmy*str2num(get(handles.vmin,'String')); |
---|
2005 | vmax=dt*pxcmy*str2num(get(handles.vmax,'String')); |
---|
2006 | shiftx=round((umin+umax)/2); |
---|
2007 | shifty=round((vmin+vmax)/2); |
---|
2008 | isx=(umax+2-shiftx)*2+ibx; |
---|
2009 | isx=2*ceil(isx/2)+1; |
---|
2010 | isy=(vmax+2-shifty)*2+iby; |
---|
2011 | isy=2*ceil(isy/2)+1; |
---|
2012 | set(handles.shiftx,'String',num2str(shiftx)); |
---|
2013 | set(handles.shifty,'String',num2str(shifty)); |
---|
2014 | set(handles.isx,'String',num2str(isx)); |
---|
2015 | set(handles.isy,'String',num2str(isy)); |
---|
2016 | |
---|
2017 | |
---|
2018 | %--------------------------------------------------------- |
---|
2019 | % Executes on carriage return on the subdir civ1 edit window |
---|
2020 | %-------------------------------------------------------- |
---|
2021 | function subdir_civ1_Callback(hObject, eventdata, handles) |
---|
2022 | subdir=get(handles.subdir_civ1,'String'); |
---|
2023 | set(handles.subdir_civ2,'String',subdir); |
---|
2024 | if get(handles.CIV1,'Value')==0 |
---|
2025 | find_netcpair_civ1(hObject, eventdata, handles); %update the list of available pairs from netcdf files in the new directory |
---|
2026 | end |
---|
2027 | |
---|
2028 | %--------------------------------------------------------- |
---|
2029 | % Executes on carriage return on the subdir civ1 edit window |
---|
2030 | %--------------------------------------------------------- |
---|
2031 | function subdir_civ2_Callback(hObject, eventdata, handles) |
---|
2032 | %update the list of available pairs from netcdf files in the new directory |
---|
2033 | if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0 |
---|
2034 | find_netcpair_civ2(hObject, eventdata, handles); |
---|
2035 | end |
---|
2036 | |
---|
2037 | %------------------------------------------------------ |
---|
2038 | % --- Executes on button press in get_mask_civ1. |
---|
2039 | %------------------------------------------------------ |
---|
2040 | function get_mask_civ1_Callback(hObject, eventdata, handles) |
---|
2041 | maskval=get(handles.get_mask_civ1,'Value') |
---|
2042 | if isequal(maskval,0) |
---|
2043 | set(handles.mask_civ1,'String','') |
---|
2044 | else |
---|
2045 | mask_displ='no mask'; %default |
---|
2046 | filebase=get(handles.displ_filebase,'String'); |
---|
2047 | [ nbslice, flag_mask]=get_mask(filebase,handles) |
---|
2048 | if isequal(flag_mask,1) |
---|
2049 | mask_displ=[num2str(nbslice) 'mask']; |
---|
2050 | end |
---|
2051 | if get(handles.compare,'Value')==1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
2052 | filebase_a=get(handles.displ_filebase2,'String'); |
---|
2053 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles) |
---|
2054 | if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice) |
---|
2055 | mask_displ='no mask'; |
---|
2056 | end |
---|
2057 | end |
---|
2058 | if isequal(mask_displ,'no mask') |
---|
2059 | set(handles.get_mask_civ1,'Value',0) |
---|
2060 | set(handles.get_mask_fix1,'Value',0) |
---|
2061 | set(handles.get_mask_civ2,'Value',0) |
---|
2062 | set(handles.get_mask_fix2,'Value',0) |
---|
2063 | else |
---|
2064 | set(handles.get_mask_fix1,'Value',1) |
---|
2065 | set(handles.get_mask_civ2,'Value',1) |
---|
2066 | set(handles.get_mask_fix2,'Value',1) |
---|
2067 | end |
---|
2068 | set(handles.mask_civ1,'String',mask_displ) |
---|
2069 | set(handles.mask_fix1,'String',mask_displ) |
---|
2070 | set(handles.mask_civ2,'String',mask_displ) |
---|
2071 | set(handles.mask_fix2,'String',mask_displ) |
---|
2072 | end |
---|
2073 | %-------------------------------------------------------------- |
---|
2074 | % --- Executes on button press in get_mask_fix1. |
---|
2075 | function get_mask_fix1_Callback(hObject, eventdata, handles) |
---|
2076 | maskval=get(handles.get_mask_fix1,'Value') |
---|
2077 | if isequal(maskval,0) |
---|
2078 | set(handles.mask_fix1,'String','') |
---|
2079 | else |
---|
2080 | mask_displ='no mask'; %default |
---|
2081 | filebase=get(handles.displ_filebase,'String'); |
---|
2082 | [nbslice, flag_mask]=get_mask(filebase,handles) |
---|
2083 | if isequal(flag_mask,1) |
---|
2084 | mask_displ=[num2str(nbslice) 'mask']; |
---|
2085 | end |
---|
2086 | if get(handles.compare,'Value')==1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
2087 | filebase_a=get(handles.displ_filebase2,'String'); |
---|
2088 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles) |
---|
2089 | if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice) |
---|
2090 | mask_displ='no mask'; |
---|
2091 | end |
---|
2092 | end |
---|
2093 | if isequal(mask_displ,'no mask') |
---|
2094 | set(handles.get_mask_fix1,'Value',0) |
---|
2095 | set(handles.get_mask_civ2,'Value',0) |
---|
2096 | set(handles.get_mask_fix2,'Value',0) |
---|
2097 | else |
---|
2098 | set(handles.get_mask_civ2,'Value',1) |
---|
2099 | set(handles.get_mask_fix2,'Value',1) |
---|
2100 | end |
---|
2101 | set(handles.mask_fix1,'String',mask_displ) |
---|
2102 | set(handles.mask_civ2,'String',mask_displ) |
---|
2103 | set(handles.mask_fix2,'String',mask_displ) |
---|
2104 | end |
---|
2105 | %----------------------------------------- |
---|
2106 | % --- Executes on button press in get_mask_civ2. |
---|
2107 | function get_mask_civ2_Callback(hObject, eventdata, handles) |
---|
2108 | maskval=get(handles.get_mask_civ2,'Value') |
---|
2109 | if isequal(maskval,0) |
---|
2110 | set(handles.mask_civ2,'String','') |
---|
2111 | else |
---|
2112 | mask_displ='no mask'; %default |
---|
2113 | filebase=get(handles.displ_filebase,'String'); |
---|
2114 | [nbslice, flag_mask]=get_mask(filebase,handles) |
---|
2115 | if isequal(flag_mask,1) |
---|
2116 | mask_displ=[num2str(nbslice) 'mask']; |
---|
2117 | end |
---|
2118 | if get(handles.compare,'Value')==1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
2119 | filebase_a=get(handles.displ_filebase2,'String'); |
---|
2120 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles) |
---|
2121 | if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice) |
---|
2122 | mask_displ='no mask'; |
---|
2123 | end |
---|
2124 | end |
---|
2125 | if isequal(mask_displ,'no mask') |
---|
2126 | set(handles.get_mask_civ2,'Value',0) |
---|
2127 | set(handles.get_mask_fix2,'Value',0) |
---|
2128 | else |
---|
2129 | set(handles.get_mask_fix2,'Value',1) |
---|
2130 | end |
---|
2131 | set(handles.mask_civ2,'String',mask_displ) |
---|
2132 | set(handles.mask_fix2,'String',mask_displ) |
---|
2133 | end |
---|
2134 | %------------------------------------- |
---|
2135 | % --- Executes on button press in get_mask_fix2. |
---|
2136 | function get_mask_fix2_Callback(hObject, eventdata, handles) |
---|
2137 | maskval=get(handles.get_mask_fix2,'Value') |
---|
2138 | if isequal(maskval,0) |
---|
2139 | set(handles.mask_fix2,'String','') |
---|
2140 | else |
---|
2141 | mask_displ='no mask'; %default |
---|
2142 | filebase=get(handles.displ_filebase,'String'); |
---|
2143 | [nbslice, flag_mask]=get_mask(filebase,handles) |
---|
2144 | if isequal(flag_mask,1) |
---|
2145 | mask_displ=[num2str(nbslice) 'mask']; |
---|
2146 | end |
---|
2147 | if get(handles.compare,'Value')==1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
2148 | filebase_a=get(handles.displ_filebase2,'String'); |
---|
2149 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles) |
---|
2150 | if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice) |
---|
2151 | mask_displ='no mask'; |
---|
2152 | end |
---|
2153 | end |
---|
2154 | if isequal(mask_displ,'no mask') |
---|
2155 | set(handles.get_mask_fix2,'Value',0) |
---|
2156 | end |
---|
2157 | set(handles.mask_fix2,'String',mask_displ) |
---|
2158 | end |
---|
2159 | |
---|
2160 | %--------------------------------------- |
---|
2161 | function [nbslice, flag_mask]=get_mask(filebase,handles) |
---|
2162 | %detect mask files, images with appropriate file base |
---|
2163 | %[filebase '_' xx 'mask'], xx=nbslice |
---|
2164 | %flag_mask=1 indicates detection |
---|
2165 | |
---|
2166 | flag_mask=0;%default |
---|
2167 | nbslice=1; |
---|
2168 | |
---|
2169 | % subdir=get(handles.subdir_civ1,'String'); |
---|
2170 | [Path,Name]=fileparts(filebase) |
---|
2171 | currentdir=pwd; |
---|
2172 | cd(Path);%move in the dir of the root name filebase |
---|
2173 | maskfiles=dir([Name '_*mask_*.png'])%look for mask files |
---|
2174 | cd(currentdir);%come back to the current working directory |
---|
2175 | if isempty(maskfiles) |
---|
2176 | browse=get(handles.browse_root,'UserData'); |
---|
2177 | varargin{1}=''; |
---|
2178 | [image_name,idetect]=name_generator(filebase,1,1,browse.ext_ima,browse.nom_type_ima);%name of an image |
---|
2179 | if idetect==1 |
---|
2180 | varargin{1}=image_name; |
---|
2181 | end |
---|
2182 | warndlg_uvmat('no mask available, use TOOL menu in the uvmat interface to create it','ERROR') |
---|
2183 | % makemask(varargin); %open the makemask interface |
---|
2184 | else |
---|
2185 | maskname=maskfiles(1).name;% take the first mask file in the list |
---|
2186 | [Path2,Name,ext]=fileparts(maskname); |
---|
2187 | Namedouble=double(Name); |
---|
2188 | val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters |
---|
2189 | ind_mask=findstr('mask',Name); |
---|
2190 | i=ind_mask-1; |
---|
2191 | while val(i)==0 & i>0 |
---|
2192 | i=i-1; |
---|
2193 | end |
---|
2194 | nbslice=str2num(Name(i+1:ind_mask-1)); |
---|
2195 | if ~isequal(nbslice,[]) & Name(i)=='_' |
---|
2196 | flag_mask=1; |
---|
2197 | else |
---|
2198 | errordlg(['bad mask file ' Name ext ' found in ' Path2]) |
---|
2199 | return |
---|
2200 | nbslice=1; |
---|
2201 | end |
---|
2202 | end |
---|
2203 | %------------------------------ |
---|
2204 | |
---|
2205 | |
---|
2206 | function grid_civ1_Callback(hObject, eventdata, handles) |
---|
2207 | % hObject handle to grid_civ1 (see GCBO) |
---|
2208 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2209 | % handles structure with handles and user data (see GUIDATA) |
---|
2210 | |
---|
2211 | % Hints: get(hObject,'String') returns contents of grid_civ1 as text |
---|
2212 | % str2double(get(hObject,'String')) returns contents of grid_civ1 as a double |
---|
2213 | |
---|
2214 | |
---|
2215 | %----------------------------------------------------------- |
---|
2216 | % transform numbers to letters |
---|
2217 | %-------------------------------------------- |
---|
2218 | function str=num2stra(num,nom_type); |
---|
2219 | if isequal(nom_type,'png_old') | isequal(nom_type,'netc_old') |isequal(nom_type,'raw_SMD') |
---|
2220 | str=char(96+num); |
---|
2221 | elseif isequal(nom_type,'_i')|isequal(nom_type,'_i1-i2')... |
---|
2222 | |isequal(nom_type,'ima_num')| isequal(nom_type,'avi')| isequal(nom_type,'none') |
---|
2223 | str=''; |
---|
2224 | else |
---|
2225 | str=num2str(num); |
---|
2226 | end |
---|
2227 | %--------------------------------------------------- |
---|
2228 | function mask_civ1_Callback(hObject, eventdata, handles) |
---|
2229 | set(handles.mask_civ1,'UserData',[]) |
---|
2230 | set(handles.mask_civ1,'String','') |
---|
2231 | %---------------------------------------------------- |
---|
2232 | function mask_civ2_Callback(hObject, eventdata, handles) |
---|
2233 | set(handles.mask_civ2,'UserData',[]) |
---|
2234 | set(handles.mask_civ2,'String','') |
---|
2235 | %---------------------------------------------------- |
---|
2236 | function mask_fix1_Callback(hObject, eventdata, handles) |
---|
2237 | set(handles.mask_fix1,'UserData',[]) |
---|
2238 | set(handles.mask_fix1,'String','') |
---|
2239 | %---------------------------------------------------- |
---|
2240 | function mask_fix2_Callback(hObject, eventdata, handles) |
---|
2241 | set(handles.mask_fix2,'UserData',[]) |
---|
2242 | set(handles.mask_fix2,'String','') |
---|
2243 | |
---|
2244 | %-------------------------------------------------------------------------- |
---|
2245 | % --- Executes on button press in list_subdir_civ1. |
---|
2246 | function list_subdir_civ1_Callback(hObject, eventdata, handles) |
---|
2247 | |
---|
2248 | filebase=get(handles.displ_filebase,'String'); |
---|
2249 | dirinput = uigetdir(filebase) |
---|
2250 | set(handles.subdir_civ1,'String',dirinput) |
---|
2251 | set(handles.subdir_civ2,'String',dirinput) |
---|
2252 | |
---|
2253 | displ_filebase_Callback(hObject, eventdata, handles); |
---|
2254 | |
---|
2255 | |
---|
2256 | function rho_civ2_Callback(hObject, eventdata, handles) |
---|
2257 | % hObject handle to rho_civ2 (see GCBO) |
---|
2258 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2259 | % handles structure with handles and user data (see GUIDATA) |
---|
2260 | |
---|
2261 | % Hints: get(hObject,'String') returns contents of rho_civ2 as text |
---|
2262 | % str2double(get(hObject,'String')) returns contents of rho_civ2 as a double |
---|
2263 | |
---|
2264 | %---------------------------------------------- |
---|
2265 | function last_i_Callback(hObject, eventdata, handles) |
---|
2266 | first_i=str2num(get(handles.first_i,'String')); |
---|
2267 | last_i=str2num(get(handles.last_i,'String')); |
---|
2268 | ref_i=ceil((first_i+last_i)/2); |
---|
2269 | set(handles.ref_i,'String', num2str(ref_i)) |
---|
2270 | ref_i_Callback(hObject, eventdata, handles) |
---|
2271 | |
---|
2272 | %------------------------------------------------------- |
---|
2273 | function last_j_Callback(hObject, eventdata, handles) |
---|
2274 | first_j=str2num(get(handles.first_j,'String')); |
---|
2275 | last_j=str2num(get(handles.last_j,'String')); |
---|
2276 | ref_j=ceil((first_j+last_j)/2); |
---|
2277 | set(handles.ref_j,'String', num2str(ref_j)) |
---|
2278 | ref_j_Callback(hObject, eventdata, handles) |
---|
2279 | |
---|
2280 | %-------------------------------------------------------------------------- |
---|
2281 | % --- Executes on button press in browse_gridciv1. |
---|
2282 | function browse_gridciv1_Callback(hObject, eventdata, handles) |
---|
2283 | value=get(handles.browse_gridciv1,'Value'); |
---|
2284 | if value |
---|
2285 | filebase=get(handles.displ_filebase,'String'); |
---|
2286 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
2287 | {'*.grid', ' (*.grid)'; |
---|
2288 | '*.grid', '.grid files '; ... |
---|
2289 | '*.*', 'All Files (*.*)'}, ... |
---|
2290 | 'Pick a file',filebase); |
---|
2291 | filegrid=fullfile(PathName,FileName); |
---|
2292 | if isempty(FileName)|isempty(PathName)|isequal(FileName,0)|~exist(filegrid,'file') |
---|
2293 | set(handles.browse_gridciv1,'Value',0); |
---|
2294 | set(handles.grid_civ1,'string',''); |
---|
2295 | set(handles.dx_civ1,'Visible','on'); |
---|
2296 | set(handles.dy_civ1,'Visible','on'); |
---|
2297 | set(handles.grid_civ2,'string',''); |
---|
2298 | if get(handles.CIV2,'Value') |
---|
2299 | set(handles.dx_civ2,'Visible','on'); |
---|
2300 | set(handles.dy_civ2,'Visible','on'); |
---|
2301 | end |
---|
2302 | else |
---|
2303 | set(handles.grid_civ1,'string',filegrid); |
---|
2304 | set(handles.dx_civ1,'Visible','off'); |
---|
2305 | set(handles.dy_civ1,'Visible','off'); |
---|
2306 | set(handles.grid_civ2,'string',filegrid); |
---|
2307 | set(handles.dx_civ2,'Visible','off'); |
---|
2308 | set(handles.dy_civ2,'Visible','off'); |
---|
2309 | % set(handles.grid_patch1,'string',filegrid); |
---|
2310 | % set(handles.grid_patch2,'string',filegrid); |
---|
2311 | end |
---|
2312 | else |
---|
2313 | set(handles.grid_civ1,'string',''); |
---|
2314 | set(handles.dx_civ1,'Visible','on'); |
---|
2315 | set(handles.dy_civ1,'Visible','on'); |
---|
2316 | set(handles.grid_civ2,'string',''); |
---|
2317 | if get(handles.CIV2,'Value') |
---|
2318 | set(handles.dx_civ2,'Visible','on'); |
---|
2319 | set(handles.dy_civ2,'Visible','on'); |
---|
2320 | end |
---|
2321 | end |
---|
2322 | |
---|
2323 | |
---|
2324 | |
---|
2325 | function pxcmx_Callback(hObject, eventdata, handles) |
---|
2326 | % hObject handle to pxcmx (see GCBO) |
---|
2327 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2328 | % handles structure with handles and user data (see GUIDATA) |
---|
2329 | |
---|
2330 | % Hints: get(hObject,'String') returns contents of pxcmx as text |
---|
2331 | % str2double(get(hObject,'String')) returns contents of pxcmx as a double |
---|
2332 | |
---|
2333 | |
---|
2334 | |
---|
2335 | function pxcmy_Callback(hObject, eventdata, handles) |
---|
2336 | % hObject handle to pxcmy (see GCBO) |
---|
2337 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2338 | % handles structure with handles and user data (see GUIDATA) |
---|
2339 | |
---|
2340 | % Hints: get(hObject,'String') returns contents of pxcmy as text |
---|
2341 | % str2double(get(hObject,'String')) returns contents of pxcmy as a double |
---|
2342 | |
---|
2343 | |
---|
2344 | % --- Executes on button press in browse_gridciv2. |
---|
2345 | function browse_gridciv2_Callback(hObject, eventdata, handles) |
---|
2346 | |
---|
2347 | filebase=get(handles.displ_filebase,'String'); |
---|
2348 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
2349 | {'*.grid', ' (*.grid)'; |
---|
2350 | '*.grid', '.grid files '; ... |
---|
2351 | '*.*', 'All Files (*.*)'}, ... |
---|
2352 | 'Pick a file',filebase); |
---|
2353 | filegrid=fullfile(PathName,FileName); |
---|
2354 | set(handles.grid_civ2,'string',filegrid); |
---|
2355 | set(handles.dx_civ2,'String',' '); |
---|
2356 | set(handles.dy_civ2,'String',' '); |
---|
2357 | % set(handles.grid_patch2,'string',filegrid); |
---|
2358 | |
---|
2359 | % --- Executes on button press in get_gridpatch1. |
---|
2360 | function get_gridpatch1_Callback(hObject, eventdata, handles) |
---|
2361 | % hObject handle to get_gridpatch1 (see GCBO) |
---|
2362 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2363 | % handles structure with handles and user data (see GUIDATA) |
---|
2364 | |
---|
2365 | filebase=get(handles.displ_filebase,'String'); |
---|
2366 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
2367 | {'*.grid', ' (*.grid)'; |
---|
2368 | '*.grid', '.grid files '; ... |
---|
2369 | '*.*', 'All Files (*.*)'}, ... |
---|
2370 | 'Pick a file',filebase); |
---|
2371 | filegrid=fullfile(PathName,FileName); |
---|
2372 | set(handles.grid_patch1,'string',filegrid); |
---|
2373 | % set(handles.grid_patch2,'string',filegrid |
---|
2374 | |
---|
2375 | %----------------------------------------------------------------- |
---|
2376 | % --- Executes on button press in get_gridpatch2. |
---|
2377 | function get_gridpatch2_Callback(hObject, eventdata, handles) |
---|
2378 | % hObject handle to get_gridpatch2 (see GCBO) |
---|
2379 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2380 | % handles structure with handles and user data (see GUIDATA) |
---|
2381 | |
---|
2382 | |
---|
2383 | %---------------------------------------------------------- |
---|
2384 | function enable_civ1(handles,state) |
---|
2385 | if isequal(state,0) |
---|
2386 | state='off'; |
---|
2387 | end |
---|
2388 | if isequal(state,1) |
---|
2389 | state='on'; |
---|
2390 | end |
---|
2391 | if isequal(state,'on') |
---|
2392 | set(handles.frame_civ1,'BackgroundColor',[1 1 0]) |
---|
2393 | set(handles.frame_para_civ1,'BackgroundColor',[1 1 0]) |
---|
2394 | set(handles.frame_grid_civ1,'BackgroundColor',[1 1 0]) |
---|
2395 | else |
---|
2396 | set(handles.frame_civ1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2397 | set(handles.frame_para_civ1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2398 | set(handles.frame_grid_civ1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2399 | end |
---|
2400 | set(handles.ibx,'Visible',state) |
---|
2401 | set(handles.iby,'Visible',state) |
---|
2402 | set(handles.isx,'Visible',state) |
---|
2403 | set(handles.isy,'Visible',state) |
---|
2404 | set(handles.shiftx,'Visible',state) |
---|
2405 | set(handles.shifty,'Visible',state) |
---|
2406 | set(handles.rho,'Visible',state) |
---|
2407 | set(handles.dx_civ1,'Visible',state) |
---|
2408 | set(handles.dy_civ1,'Visible',state) |
---|
2409 | set(handles.calcul_search,'Visible',state) |
---|
2410 | set(handles.u_text,'Visible',state) |
---|
2411 | set(handles.v_text,'Visible',state) |
---|
2412 | set(handles.min,'Visible',state) |
---|
2413 | set(handles.max,'Visible',state) |
---|
2414 | set(handles.umin,'Visible',state) |
---|
2415 | set(handles.umax,'Visible',state) |
---|
2416 | set(handles.vmin,'Visible',state) |
---|
2417 | set(handles.vmax,'Visible',state) |
---|
2418 | set(handles.grid_civ1,'Visible',state) |
---|
2419 | set(handles.mask_civ1,'Visible',state) |
---|
2420 | set(handles.browse_gridciv1,'Visible',state) |
---|
2421 | set(handles.get_mask_civ1,'Visible',state) |
---|
2422 | set(handles.parameters,'Visible',state) |
---|
2423 | set(handles.grid,'Visible',state) |
---|
2424 | set(handles.dx_civ1,'Visible',state) |
---|
2425 | set(handles.dy_civ1,'Visible',state) |
---|
2426 | set(handles.ImaThreshold,'Visible',state) |
---|
2427 | if isequal(state,'off') |
---|
2428 | set(handles.MinIma,'Visible','off') |
---|
2429 | set(handles.MaxIma,'Visible','off') |
---|
2430 | set(handles.ImaThreshold,'Value',0) |
---|
2431 | end |
---|
2432 | set(handles.dx_civ1_title,'Visible',state) |
---|
2433 | set(handles.dy_civ1_title,'Visible',state) |
---|
2434 | set(handles.ImaThreshold_title,'Visible',state) |
---|
2435 | set(handles.ib_title,'Visible',state) |
---|
2436 | set(handles.is_title,'Visible',state) |
---|
2437 | set(handles.shift_title,'Visible',state) |
---|
2438 | set(handles.rho_title,'Visible',state) |
---|
2439 | |
---|
2440 | %---------------------------------------------------------- |
---|
2441 | function enable_fix1(handles) |
---|
2442 | set(handles.frame_fix1,'BackgroundColor',[1 1 0]) |
---|
2443 | set(handles.REMOVE,'Visible','on') |
---|
2444 | set(handles.vec_Fmin2,'Visible','on') |
---|
2445 | set(handles.vec_F2,'Visible','on') |
---|
2446 | set(handles.vec_F3,'Visible','on') |
---|
2447 | set(handles.thresh_vecC,'Visible','on') |
---|
2448 | set(handles.thresh_vecC_title,'Visible','on') |
---|
2449 | set(handles.thresh_vel,'Visible','on') |
---|
2450 | set(handles.thresh_vel_text,'Visible','on') |
---|
2451 | set(handles.mask_fix1,'Visible','on') |
---|
2452 | set(handles.get_mask_fix1,'Visible','on') |
---|
2453 | set(handles.get_ref_fix1,'Visible','on') |
---|
2454 | set(handles.ref_fix1,'Visible','on') |
---|
2455 | set(handles.inf_sup1,'Visible','on') |
---|
2456 | set(handles.field_ref1,'Visible','on') |
---|
2457 | |
---|
2458 | %---------------------------------------------------------- |
---|
2459 | function desable_fix1(handles) |
---|
2460 | set(handles.frame_fix1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2461 | set(handles.REMOVE,'Visible','off') |
---|
2462 | set(handles.vec_Fmin2,'Visible','off') |
---|
2463 | set(handles.vec_F2,'Visible','off') |
---|
2464 | set(handles.vec_F3,'Visible','off') |
---|
2465 | set(handles.thresh_vecC,'Visible','off') |
---|
2466 | set(handles.thresh_vecC_title,'Visible','off') |
---|
2467 | set(handles.thresh_vel,'Visible','off') |
---|
2468 | set(handles.thresh_vel_text,'Visible','off') |
---|
2469 | set(handles.mask_fix1,'Visible','off') |
---|
2470 | set(handles.get_mask_fix1,'Visible','off') |
---|
2471 | set(handles.get_ref_fix1,'Visible','off') |
---|
2472 | set(handles.ref_fix1,'Visible','off') |
---|
2473 | set(handles.inf_sup1,'Visible','off') |
---|
2474 | set(handles.field_ref1,'Visible','off') |
---|
2475 | |
---|
2476 | %-------------------------------------------------------------- |
---|
2477 | function enable_patch1(handles) |
---|
2478 | global patch_new_exe |
---|
2479 | set(handles.frame_patch1,'BackgroundColor',[1 1 0]) |
---|
2480 | set(handles.rho_patch1,'Visible','on') |
---|
2481 | set(handles.rho_text1,'Visible','on') |
---|
2482 | set(handles.thresh_patch1,'Visible','on') |
---|
2483 | set(handles.thresh_text1,'Visible','on') |
---|
2484 | set(handles.subdomain_patch1,'Visible','on') |
---|
2485 | set(handles.subdomain_text1,'Visible','on') |
---|
2486 | set(handles.nx_patch1,'Visible','on') |
---|
2487 | set(handles.ny_patch1,'Visible','on') |
---|
2488 | set(handles.nx_patch1_title,'Visible','on') |
---|
2489 | set(handles.ny_patch1_title,'Visible','on') |
---|
2490 | if (~isequal(patch_new_exe,[]) & ~isequal(patch_new_exe,[])) |
---|
2491 | set(handles.test_interp,'Visible','on'); |
---|
2492 | end |
---|
2493 | set(handles.get_gridpatch1,'Visible','on') |
---|
2494 | set(handles.grid_patch1,'string','none'); |
---|
2495 | set(handles.grid_patch1,'Visible','on') |
---|
2496 | |
---|
2497 | %-------------------------------------------------------------- |
---|
2498 | function desable_patch1(handles) |
---|
2499 | set(handles.frame_patch1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2500 | set(handles.rho_patch1,'Visible','off') |
---|
2501 | set(handles.rho_text1,'Visible','off') |
---|
2502 | set(handles.thresh_patch1,'Visible','off') |
---|
2503 | set(handles.thresh_text1,'Visible','off') |
---|
2504 | set(handles.subdomain_patch1,'Visible','off') |
---|
2505 | set(handles.subdomain_text1,'Visible','off') |
---|
2506 | set(handles.nx_patch1,'Visible','off') |
---|
2507 | set(handles.ny_patch1,'Visible','off') |
---|
2508 | set(handles.nx_patch1_title,'Visible','off') |
---|
2509 | set(handles.ny_patch1_title,'Visible','off') |
---|
2510 | set(handles.test_interp,'Visible','off') |
---|
2511 | set(handles.get_gridpatch1,'Visible','off') |
---|
2512 | set(handles.grid_patch1,'Visible','off') |
---|
2513 | |
---|
2514 | %---------------------------------------------------------- |
---|
2515 | function enable_civ2(handles,state) |
---|
2516 | if isequal(state,0) |
---|
2517 | state='off'; |
---|
2518 | end |
---|
2519 | if isequal(state,1) |
---|
2520 | state='on'; |
---|
2521 | end |
---|
2522 | if isequal(state,'on') |
---|
2523 | set(handles.frame_civ2,'BackgroundColor',[1 1 0]) |
---|
2524 | set(handles.frame_para_civ2,'BackgroundColor',[1 1 0]) |
---|
2525 | set(handles.frame_grid_civ2,'BackgroundColor',[1 1 0]) |
---|
2526 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
2527 | else |
---|
2528 | set(handles.frame_civ2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2529 | set(handles.frame_para_civ2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2530 | set(handles.frame_grid_civ2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2531 | set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2532 | end |
---|
2533 | set(handles.ibx_civ2,'Visible',state) |
---|
2534 | set(handles.iby_civ2,'Visible',state) |
---|
2535 | set(handles.decimal,'Visible',state) |
---|
2536 | set(handles.deformation,'Visible',state) |
---|
2537 | set(handles.rho_civ2,'Visible',state) |
---|
2538 | set(handles.dx_civ2,'Visible',state) |
---|
2539 | set(handles.dy_civ2,'Visible',state) |
---|
2540 | set(handles.browse_gridciv2,'Visible',state) |
---|
2541 | set(handles.get_mask_civ2,'Visible',state) |
---|
2542 | set(handles.parameters,'Visible',state) |
---|
2543 | set(handles.grid,'Visible',state) |
---|
2544 | set(handles.parameters_text,'Visible',state) |
---|
2545 | set(handles.grid_text,'Visible',state) |
---|
2546 | set(handles.grid_civ2,'Visible',state) |
---|
2547 | set(handles.mask_civ2,'Visible',state) |
---|
2548 | set(handles.dx_civ2_title,'Visible',state) |
---|
2549 | set(handles.dy_civ2_title,'Visible',state) |
---|
2550 | set(handles.ibx_civ2_text,'Visible',state) |
---|
2551 | set(handles.rho_civ2_title,'Visible',state) |
---|
2552 | set(handles.ImaThreshold2,'Visible',state) |
---|
2553 | set(handles.ImaThreshold_title2,'Visible',state) |
---|
2554 | if isequal(state,'off') |
---|
2555 | set(handles.MinIma2,'Visible','off') |
---|
2556 | set(handles.MaxIma2,'Visible','off') |
---|
2557 | set(handles.ImaThreshold2,'Value',0) |
---|
2558 | if isequal(get(handles.FIX2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) |
---|
2559 | set(handles.list_pair_civ2,'Visible','off') |
---|
2560 | set(handles.subdir_civ2,'Visible','off') |
---|
2561 | set(handles.subdir_civ2_text,'Visible','off') |
---|
2562 | end |
---|
2563 | else |
---|
2564 | set(handles.list_pair_civ2,'Visible','on') |
---|
2565 | set(handles.subdir_civ2,'Visible','on') |
---|
2566 | set(handles.subdir_civ2_text,'Visible','on') |
---|
2567 | end |
---|
2568 | |
---|
2569 | %---------------------------------------------------------- |
---|
2570 | % function desable_civ2(handles) |
---|
2571 | % set(handles.frame_civ2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2572 | % set(handles.frame_para_civ2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2573 | % set(handles.frame_grid_civ2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2574 | % set(handles.ibx_civ2,'Visible','off') |
---|
2575 | % set(handles.iby_civ2,'Visible','off') |
---|
2576 | % set(handles.decimal,'Visible','off') |
---|
2577 | % set(handles.deformation,'Visible','off') |
---|
2578 | % set(handles.rho_civ2,'Visible','off') |
---|
2579 | % set(handles.dx_civ2,'Visible','off') |
---|
2580 | % set(handles.dy_civ2,'Visible','off') |
---|
2581 | % set(handles.browse_gridciv2,'Visible','off') |
---|
2582 | % set(handles.get_mask_civ2,'Visible','off') |
---|
2583 | % set(handles.parameters,'Visible','off') |
---|
2584 | % set(handles.grid,'Visible','off') |
---|
2585 | % set(handles.grid,'Visible','on') |
---|
2586 | % set(handles.parameters_text,'Visible','off') |
---|
2587 | % set(handles.grid_text,'Visible','off') |
---|
2588 | % set(handles.grid_civ2,'Visible','off') |
---|
2589 | % set(handles.mask_civ2,'Visible','off') |
---|
2590 | % set(handles.dx_civ2_title,'Visible','off') |
---|
2591 | % set(handles.dy_civ2_title,'Visible','off') |
---|
2592 | % set(handles.ibx_civ2_text,'Visible','off') |
---|
2593 | % set(handles.rho_civ2_title,'Visible','off') |
---|
2594 | % set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2595 | % if isequal(get(handles.FIX2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) |
---|
2596 | % set(handles.list_pair_civ2,'Visible','off') |
---|
2597 | % set(handles.subdir_civ2,'Visible','off') |
---|
2598 | % set(handles.subdir_civ2_text,'Visible','off') |
---|
2599 | % end |
---|
2600 | |
---|
2601 | %---------------------------------------------------------- |
---|
2602 | function enable_fix2(handles) |
---|
2603 | set(handles.frame_fix2,'BackgroundColor',[1 1 0]) |
---|
2604 | set(handles.REMOVE2,'Visible','on') |
---|
2605 | set(handles.vec_Fmin2_2,'Visible','on') |
---|
2606 | set(handles.vec_F4,'Visible','on') |
---|
2607 | set(handles.vec_F3_2,'Visible','on') |
---|
2608 | set(handles.thresh_vec2C,'Visible','on') |
---|
2609 | set(handles.thresh_vec2C_text,'Visible','on') |
---|
2610 | set(handles.thresh_vel2,'Visible','on') |
---|
2611 | set(handles.thresh_vel2_text,'Visible','on') |
---|
2612 | set(handles.mask_fix2,'Visible','on') |
---|
2613 | set(handles.get_mask_fix2,'Visible','on') |
---|
2614 | set(handles.list_pair_civ2,'Visible','on') |
---|
2615 | set(handles.subdir_civ2,'Visible','on') |
---|
2616 | set(handles.subdir_civ2_text,'Visible','on') |
---|
2617 | set(handles.get_ref_fix2,'Visible','on') |
---|
2618 | set(handles.ref_fix2,'Visible','on') |
---|
2619 | set(handles.inf_sup2,'Visible','on') |
---|
2620 | set(handles.field_ref2,'Visible','on') |
---|
2621 | |
---|
2622 | %---------------------------------------------------------- |
---|
2623 | function desable_fix2(handles) |
---|
2624 | set(handles.frame_fix2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2625 | set(handles.REMOVE2,'Visible','off') |
---|
2626 | set(handles.vec_Fmin2_2,'Visible','off') |
---|
2627 | set(handles.vec_F4,'Visible','off') |
---|
2628 | set(handles.vec_F3_2,'Visible','off') |
---|
2629 | set(handles.thresh_vec2C,'Visible','off') |
---|
2630 | set(handles.thresh_vec2C_text,'Visible','off') |
---|
2631 | set(handles.thresh_vel2,'Visible','off') |
---|
2632 | set(handles.thresh_vel2_text,'Visible','off') |
---|
2633 | set(handles.mask_fix2,'Visible','off') |
---|
2634 | set(handles.get_mask_fix2,'Visible','off') |
---|
2635 | set(handles.get_ref_fix2,'Visible','off') |
---|
2636 | set(handles.ref_fix2,'Visible','off') |
---|
2637 | set(handles.inf_sup2,'Visible','off') |
---|
2638 | set(handles.field_ref2,'Visible','off') |
---|
2639 | if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) |
---|
2640 | set(handles.list_pair_civ2,'Visible','off') |
---|
2641 | set(handles.subdir_civ2,'Visible','off') |
---|
2642 | set(handles.subdir_civ2_text,'Visible','off') |
---|
2643 | end |
---|
2644 | |
---|
2645 | %-------------------------------------------------------------- |
---|
2646 | function enable_patch2(handles) |
---|
2647 | set(handles.frame_patch2,'BackgroundColor',[1 1 0]) |
---|
2648 | set(handles.rho_patch2,'Visible','on') |
---|
2649 | set(handles.rho_text2,'Visible','on') |
---|
2650 | set(handles.thresh_patch2,'Visible','on') |
---|
2651 | set(handles.thresh_text2,'Visible','on') |
---|
2652 | set(handles.subdomain_patch2,'Visible','on') |
---|
2653 | set(handles.subdomain_text2,'Visible','on') |
---|
2654 | set(handles.nx_patch2,'Visible','on') |
---|
2655 | set(handles.ny_patch2,'Visible','on') |
---|
2656 | set(handles.nx_patch2_title,'Visible','on') |
---|
2657 | set(handles.ny_patch2_title,'Visible','on') |
---|
2658 | set(handles.get_gridpatch2,'Visible','on') |
---|
2659 | set(handles.grid_patch2,'Visible','on') |
---|
2660 | set(handles.list_pair_civ2,'Visible','on') |
---|
2661 | set(handles.subdir_civ2,'Visible','on') |
---|
2662 | set(handles.subdir_civ2_text,'Visible','on') |
---|
2663 | |
---|
2664 | %-------------------------------------------------------------- |
---|
2665 | function desable_patch2(handles) |
---|
2666 | set(handles.frame_patch2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
2667 | set(handles.rho_patch2,'Visible','off') |
---|
2668 | set(handles.rho_text2,'Visible','off') |
---|
2669 | set(handles.thresh_patch2,'Visible','off') |
---|
2670 | set(handles.thresh_text2,'Visible','off') |
---|
2671 | set(handles.subdomain_patch2,'Visible','off') |
---|
2672 | set(handles.subdomain_text2,'Visible','off') |
---|
2673 | set(handles.nx_patch2,'Visible','off') |
---|
2674 | set(handles.ny_patch2,'Visible','off') |
---|
2675 | set(handles.nx_patch2_title,'Visible','off') |
---|
2676 | set(handles.ny_patch2_title,'Visible','off') |
---|
2677 | set(handles.get_gridpatch2,'Visible','off') |
---|
2678 | set(handles.grid_patch2,'Visible','off') |
---|
2679 | if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0) |
---|
2680 | set(handles.list_pair_civ2,'Visible','off') |
---|
2681 | set(handles.subdir_civ2,'Visible','off') |
---|
2682 | set(handles.subdir_civ2_text,'Visible','off') |
---|
2683 | end |
---|
2684 | |
---|
2685 | % --- Executes on button press in test_interp. |
---|
2686 | function test_interp_Callback(hObject, eventdata, handles) |
---|
2687 | |
---|
2688 | |
---|
2689 | %------------------------------------------------ |
---|
2690 | %Read the parameters for civ1 on the interface |
---|
2691 | %-------------------------------------------------- |
---|
2692 | function par=read_param_civ1(handles,file_ima) |
---|
2693 | |
---|
2694 | ibx_val=str2num(get(handles.ibx,'String')); |
---|
2695 | par.correlationBoxesSize_X=num2str(ibx_val); |
---|
2696 | iby_val=str2num(get(handles.iby,'String')); |
---|
2697 | par.correlationBoxesSize_Y=num2str(iby_val); |
---|
2698 | ibz_val=str2num(get(handles.ibz,'String')); |
---|
2699 | par.correlationBoxesSize_Z=num2str(ibz_val); |
---|
2700 | isx=get(handles.isx,'String'); |
---|
2701 | if isempty(str2num(isx)), isx='41'; set(handles.isx,'String','41'), end; %default |
---|
2702 | maxDisplacement_X=floor((str2num(isx)-ibx_val)/2); |
---|
2703 | par.maxDisplacement_X=num2str(maxDisplacement_X); |
---|
2704 | isy=get(handles.isy,'String'); |
---|
2705 | if isempty(str2num(isy)), isy='41'; set(handles.isy,'String','41'), end; %default |
---|
2706 | maxDisplacement_Y=floor((str2num(isy)-iby_val)/2); |
---|
2707 | par.maxDisplacement_Y=num2str(maxDisplacement_Y); |
---|
2708 | isz=get(handles.isz,'String'); |
---|
2709 | if isempty(str2num(isz)), isz='41'; set(handles.isz,'String','41'), end; %default |
---|
2710 | maxDisplacement_Z=floor((str2num(isz)-ibz_val)/2); |
---|
2711 | par.maxDisplacement_Z=num2str(maxDisplacement_Z); |
---|
2712 | % par.rho=get(handles.rho,'String'); |
---|
2713 | par.gridSpacing_X=get(handles.dx_civ1,'String'); |
---|
2714 | par.gridSpacing_Y=get(handles.dy_civ1,'String'); |
---|
2715 | par.gridSpacing_Z=get(handles.dz_civ1,'String'); |
---|
2716 | % Zmin=str2num(get(handles.first_j,'String'))-1; |
---|
2717 | Zmax=str2num(get(handles.nb_field2,'String')); |
---|
2718 | par.gridLimits_Xmin=0; |
---|
2719 | par.gridLimits_Ymin=0; |
---|
2720 | par.gridLimits_Zmin=0; |
---|
2721 | % A=imread(file_ima);%read the first image to get the size |
---|
2722 | %sizim=size(A); |
---|
2723 | par.gridLimits_Xmax=1024;%num2str(sizim(2)); |
---|
2724 | par.gridLimits_Ymax=1024;%num2str(sizim(1)); |
---|
2725 | par.gridLimits_Zmax=Zmax; |
---|
2726 | par.grid='grille'; |
---|
2727 | par.grid_division=4; |
---|
2728 | par.hart=0; |
---|
2729 | par.ratioHoverZ=1; |
---|
2730 | |
---|
2731 | % |
---|
2732 | % %---------------------------------------------------------------- |
---|
2733 | % function par=read_param_civ2(handles,file_ima) |
---|
2734 | % par.ibx=get(handles.ibx_civ2,'String'); |
---|
2735 | % par.iby=get(handles.iby_civ2,'String'); |
---|
2736 | % par.rho=get(handles.rho_civ2,'String'); |
---|
2737 | % par.decimal=int2str(get(handles.decimal,'Value')); |
---|
2738 | % par.deformation=int2str(get(handles.deformation,'Value')); |
---|
2739 | % par.dx=get(handles.dx_civ2,'String'); |
---|
2740 | % par.dy=get(handles.dy_civ2,'String'); |
---|
2741 | % if isequal(str2num(par.dx),[]) |
---|
2742 | % if isempty(get(handles.grid_civ2,'String')); |
---|
2743 | % par.dx='0'; %just read by civ_3D program, not used |
---|
2744 | % else |
---|
2745 | % par.dx='20';%default |
---|
2746 | % set(handles.dx_civ2,'String','20'); |
---|
2747 | % end |
---|
2748 | % end |
---|
2749 | % if isequal(str2num(par.dy),[]) |
---|
2750 | % if isempty(get(handles.grid_civ2,'String')); |
---|
2751 | % par.dy='0';%just read by civ_3D program, not used |
---|
2752 | % else |
---|
2753 | % par.dy='20';%default |
---|
2754 | % set(handles.dy_civ2,'String','20'); |
---|
2755 | % end |
---|
2756 | % end |
---|
2757 | % par.pxcmx=get(handles.pxcmx,'String'); |
---|
2758 | % par.pxcmy=get(handles.pxcmy,'String'); |
---|
2759 | % if isempty(str2num(par.pxcmx)) |isempty(str2num(par.pxcmy)) |
---|
2760 | % par.pxcmx='1'; |
---|
2761 | % par.pxcmy='1'; |
---|
2762 | % end |
---|
2763 | % % par.npx=get(handles.pxcmx,'UserData'); |
---|
2764 | % % par.npy=get(handles.pxcmy,'UserData'); |
---|
2765 | % A=imread(file_ima);%read the first image to get the size |
---|
2766 | % sizim=size(A); |
---|
2767 | % par.npx=num2str(sizim(2)); |
---|
2768 | % par.npy=num2str(sizim(1)); |
---|
2769 | % time=get(handles.displ_filebase,'UserData'); %get the set of times |
---|
2770 | % par.gridname=get(handles.grid_civ2,'String'); |
---|
2771 | % par.gridflag='y'; |
---|
2772 | % if isequal(par.gridname,'')| isempty(par.gridname) |
---|
2773 | % par.gridname='nogrid'; |
---|
2774 | % par.gridflag='n'; |
---|
2775 | % end |
---|
2776 | |
---|
2777 | |
---|
2778 | %--------------------------------------------------------- |
---|
2779 | %CIV1 CIV1 CIV1 CIV1 |
---|
2780 | %---------------------------------------------------------- |
---|
2781 | function cmd_CIV1=BATCH_CIV1(filename,namelog,par,handles) |
---|
2782 | %pixels per cm and matrix of the image times, read from the .civ_3D file by uvmat |
---|
2783 | global civ1_exe Civ_exe sge%name of the executable for civ1 calculation |
---|
2784 | |
---|
2785 | %changes : filename_cmx -> filename ( no extension ) |
---|
2786 | |
---|
2787 | if isequal(par.Dt,'0') |
---|
2788 | par.Dt='1' ;%case of 'displacement' mode |
---|
2789 | end |
---|
2790 | |
---|
2791 | textcmx={'############## CMX file';... |
---|
2792 | ['FirstImage ' par.filename_ima_a];... |
---|
2793 | ['LastImage ' par.filename_ima_b];... |
---|
2794 | 'XX' ;... |
---|
2795 | ['Mask ' par.maskflag] ;... |
---|
2796 | ['MaskName ' par.maskname];... |
---|
2797 | ['ImageSize ' par.npx ' ' par.npy];... %VERIFIER CAS GENERAL ? |
---|
2798 | ['CorrelationBoxesSize ' par.ibx ' ' par.iby];... |
---|
2799 | ['SearchBoxeSize ' par.isx ' ' par.isy];... |
---|
2800 | ['RO ' par.rho];... |
---|
2801 | ['GridSpacing ' par.dx ' ' par.dy];... |
---|
2802 | 'XX 1.0';... |
---|
2803 | ['Dt_TO ' par.Dt ' ' par.T0];... |
---|
2804 | ['PixCmXY ' par.pxcmx ' ' par.pxcmy];... |
---|
2805 | 'XX 1';... |
---|
2806 | ['ShiftXY ' par.shiftx ' ' par.shifty];... |
---|
2807 | ['Grid ' par.gridflag];... |
---|
2808 | ['GridName ' par.gridname] ;... |
---|
2809 | 'XX 85';... |
---|
2810 | 'XX 1.0';... |
---|
2811 | 'XX 1.0';... |
---|
2812 | 'Hart 1';... |
---|
2813 | 'DecimalShift 0';... |
---|
2814 | 'Deformation 0';... |
---|
2815 | 'CorrelationMin 0';... |
---|
2816 | 'IntensityMin 0';... |
---|
2817 | 'SeuilImage n';... |
---|
2818 | 'SeuilImageValues 0 4096';... |
---|
2819 | ['ImageToUse ' par.term_a ' ' par.term_b];... % VERIFIER ? |
---|
2820 | 'ImageUsedBefore null null'}; |
---|
2821 | |
---|
2822 | textout=char(textcmx); |
---|
2823 | % timeL1=clock; |
---|
2824 | dlmwrite([filename '.cmx'],textout,''); |
---|
2825 | % timeL2=clock; |
---|
2826 | % timciv1=etime(timeL2,timeL1) |
---|
2827 | if sge |
---|
2828 | cmd_CIV1=[civ1_exe ' -f ' filename '.cmx' ]; % redirect standard output to the log file |
---|
2829 | else |
---|
2830 | cmd_CIV1=[civ1_exe ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file |
---|
2831 | end |
---|
2832 | if(isunix) |
---|
2833 | [Rootbat,Filebat,extbat]=fileparts(namelog); |
---|
2834 | ncName=fullfile(Rootbat,[ Filebat '.nc']); |
---|
2835 | cmd_CIV1=char({cmd_CIV1 ; ['mv ' namelog ' ' namelog '.civ1.log'];['chmod g+w ' ncName]}); |
---|
2836 | else |
---|
2837 | cmd_CIV1=char({cmd_CIV1 ; ['copy /Y ' namelog ' ' namelog '.civ1.log']}); |
---|
2838 | end |
---|
2839 | |
---|
2840 | %--------------------------------------------------------- |
---|
2841 | %CIV1 Unified |
---|
2842 | %---------------------------------------------------------- |
---|
2843 | function xml_civ1_parameters=BATCH_CIV1_Unified(filename,namelog,par,handles) |
---|
2844 | %pixels per cm and matrix of the image times, read from the .civ_3D file by uvmat |
---|
2845 | global civ1_exe Civ_exe%name of the executable for civ1 calculation |
---|
2846 | |
---|
2847 | civ1.image1=par.filename_ima_a; |
---|
2848 | civ1.image2=par.filename_ima_b; |
---|
2849 | civ1.imageSize_X=par.npx; |
---|
2850 | civ1.imageSize_Y=par.npy; |
---|
2851 | civ1.outputFileName=[filename '.nc']; |
---|
2852 | civ1.correlationBoxesSize_X=par.ibx; |
---|
2853 | civ1.correlationBoxesSize_Y=par.iby; |
---|
2854 | civ1.searchBoxesSize_X=par.isx; |
---|
2855 | civ1.searchBoxesSize_Y=par.isy; |
---|
2856 | civ1.globalShift_X=par.shiftx; |
---|
2857 | civ1.globalShift_Y=par.shifty; |
---|
2858 | civ1.ro=par.rho; |
---|
2859 | civ1.hart='y'; |
---|
2860 | if isequal(par.gridflag,'y') |
---|
2861 | civ1.grid=par.gridname; |
---|
2862 | end |
---|
2863 | civ1.gridSpacing_X=par.dx; |
---|
2864 | civ1.gridSpacing_Y=par.dy; |
---|
2865 | if isequal(par.maskflag,'y') |
---|
2866 | civ1.mask=par.maskname; |
---|
2867 | end |
---|
2868 | civ1.dt=par.Dt; |
---|
2869 | civ1.unit='pixel'; |
---|
2870 | civ1.absolut_time_T0=par.T0; |
---|
2871 | civ1.pixcmx=par.pxcmx; |
---|
2872 | civ1.pixcmy=par.pxcmy; |
---|
2873 | civ1.convectFlow='n'; |
---|
2874 | |
---|
2875 | xml_civ1_parameters=civ1; |
---|
2876 | |
---|
2877 | %--------------------------------------------------------- |
---|
2878 | %CIV2 CIV2 CIV2 CIV2 |
---|
2879 | %---------------------------------------------------------- |
---|
2880 | function cmd_CIV2=BATCH_CIV2(filename_cmx,namelog,par) |
---|
2881 | %pixels per cm and matrix of the image times, read from the .civ_3D file by uvmat |
---|
2882 | global civ2_exe sge%name of the executable for civ1 calculation |
---|
2883 | if isequal(par.Dt,'0') |
---|
2884 | par.Dt='1' ;%case of 'displacement' mode |
---|
2885 | end |
---|
2886 | textcmx={'############## CMX file';... |
---|
2887 | ['FirstImage ' par.filename_ima_a];... |
---|
2888 | ['LastImage ' par.filename_ima_b];... |
---|
2889 | 'XX' ;... |
---|
2890 | ['Mask ' par.maskflag];... |
---|
2891 | ['MaskName ' par.maskname];... |
---|
2892 | ['ImageSize ' par.npx ' ' par.npy];... |
---|
2893 | ['CorrelationBoxesSize ' par.ibx ' ' par.iby];... |
---|
2894 | ['SearchBoxeSize ' par.ibx ' ' par.iby];... |
---|
2895 | ['RO ' par.rho];... |
---|
2896 | ['GridSpacing ' par.dx ' ' par.dy];... |
---|
2897 | 'XX 1.0';... |
---|
2898 | ['Dt_TO ' par.Dt ' ' par.T0];... |
---|
2899 | ['PixCmXY ' par.pxcmx ' ' par.pxcmy];... |
---|
2900 | 'XX 1';... |
---|
2901 | ['ShiftXY 0 0'];... |
---|
2902 | ['Grid ' par.gridflag];... |
---|
2903 | ['GridName ' par.gridname];... |
---|
2904 | 'XX 85';... |
---|
2905 | 'XX 1.0';... |
---|
2906 | 'XX 1.0';... |
---|
2907 | 'Hart 1';... |
---|
2908 | ['DecimalShift ' par.decimal];... |
---|
2909 | ['Deformation ' par.deformation];... |
---|
2910 | 'CorrelationMin 0';... |
---|
2911 | 'IntensityMin 0';... |
---|
2912 | 'SeuilImage n';... |
---|
2913 | 'SeuilImageValues 0 4096';... |
---|
2914 | ['ImageToUse ' par.term_a ' ' par.term_b];... % VERIFIER ? |
---|
2915 | ['ImageUsedBefore ' par.filename_nc1]}; |
---|
2916 | textout=char(textcmx); |
---|
2917 | dlmwrite([filename_cmx '2'] ,textout,''); |
---|
2918 | if sge |
---|
2919 | cmd_CIV2=[civ2_exe ' -f ' filename_cmx ]; % redirect standard output to the log file |
---|
2920 | else |
---|
2921 | cmd_CIV2=[civ2_exe ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file |
---|
2922 | end |
---|
2923 | |
---|
2924 | |
---|
2925 | % --- Executes on button press in HELP. |
---|
2926 | function HELP_Callback(hObject, eventdata, handles) |
---|
2927 | path_to_uvmat=which ('uvmat');% check the path of uvmat |
---|
2928 | pathelp=fileparts(path_to_uvmat); |
---|
2929 | helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html'); |
---|
2930 | if isempty(dir(helpfile)), errordlg('Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC') |
---|
2931 | else |
---|
2932 | web([helpfile '#civ_3D']) |
---|
2933 | end |
---|
2934 | |
---|
2935 | |
---|
2936 | %---------------------------------------------------------- |
---|
2937 | %--read images and convert them to the uint16 format used for PIV |
---|
2938 | function A=read_image(filename,nom_type,npx,npy,num); |
---|
2939 | %npx, npy are the dimensions needed for the raw SMD images |
---|
2940 | %num is the view number needed for an avi movie |
---|
2941 | if isequal(nom_type,'avi') |
---|
2942 | mov=aviread(filename,num); |
---|
2943 | A=frame2im(mov(1)); |
---|
2944 | A=sum(double(A),3); |
---|
2945 | A=uint16(A); |
---|
2946 | elseif isequal(nom_type,'raw_SMD') |
---|
2947 | [fid,message]=fopen(filename,'r'); |
---|
2948 | B=fread(fid,Inf,'int16',0,'ieee-le');%read 16 bit binary file |
---|
2949 | A=(reshape(B,npx,npy))'; %remplissage ligne par ligne avec une matrice colonne ? transposer(uB) pour avoir une matrice ligne |
---|
2950 | A=uint16(A); |
---|
2951 | fclose(fid); |
---|
2952 | else |
---|
2953 | A=imread(filename); |
---|
2954 | siz=size(A); |
---|
2955 | if length(siz)==3;%color images |
---|
2956 | A=sum(double(A),3); |
---|
2957 | end |
---|
2958 | A=uint16(A); |
---|
2959 | end |
---|
2960 | |
---|
2961 | %---------------------------------------------------------------- |
---|
2962 | %Executes on carriage return on the time interval dt |
---|
2963 | %---------------------------------------------------------------- |
---|
2964 | function dt_Callback(hObject, eventdata, handles) |
---|
2965 | %determine the set of times and possible intervals for CIV_3D |
---|
2966 | % answer=inputdlg('time interval between images?'); |
---|
2967 | dt=(1/1000)*str2num(get(handles.dt,'String')); |
---|
2968 | nbfield=str2num(get(handles.nb_field,'String')); %last image number selected in the processing series |
---|
2969 | time=(dt*[0:nbfield-1])'; |
---|
2970 | % set(handles.incr_i,'UserData',dt);%store the time interval between successive images |
---|
2971 | set(handles.displ_filebase,'UserData',time); %store the set of times |
---|
2972 | for index=1:min(nbfield-1,200) |
---|
2973 | displ_num(1,index)=1; |
---|
2974 | displ_num(2,index)=1; |
---|
2975 | displ_num(3,index)=-floor(index/2); |
---|
2976 | displ_num(4,index)=ceil(index/2); |
---|
2977 | end |
---|
2978 | set(handles.list_pair_civ1,'Value',1); |
---|
2979 | set(handles.list_pair_civ1,'UserData',displ_num); |
---|
2980 | set(handles.list_pair_civ2,'Value',1); |
---|
2981 | %update the list of time intervals |
---|
2982 | find_netcpair_civ1(hObject, eventdata, handles) |
---|
2983 | find_netcpair_civ2(hObject, eventdata, handles) |
---|
2984 | |
---|
2985 | %------------------------------------------------------- |
---|
2986 | function ref_i_Callback(hObject, eventdata, handles) |
---|
2987 | mode_list=get(handles.mode,'String'); |
---|
2988 | mode_value=get(handles.mode,'Value'); |
---|
2989 | mode=mode_list{mode_value}; |
---|
2990 | if isequal(get(handles.CIV1,'Value'),0)| isequal(mode,'series(Di)') |
---|
2991 | find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
2992 | end |
---|
2993 | if isequal(mode,'series(Di)') | ...% we do patch2 only |
---|
2994 | (get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0) |
---|
2995 | find_netcpair_civ2(hObject, eventdata, handles); |
---|
2996 | end |
---|
2997 | |
---|
2998 | %---------------------------------------------------- |
---|
2999 | function ref_j_Callback(hObject, eventdata, handles) |
---|
3000 | mode_list=get(handles.mode,'String'); |
---|
3001 | mode_value=get(handles.mode,'Value'); |
---|
3002 | mode=mode_list{mode_value}; |
---|
3003 | if isequal(get(handles.CIV1,'Value'),0)| isequal(mode,'series(Dj)') |
---|
3004 | find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
3005 | end |
---|
3006 | if isequal(mode,'series(Dj)') | ... |
---|
3007 | (get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0) |
---|
3008 | find_netcpair_civ2(hObject, eventdata, handles); |
---|
3009 | end |
---|
3010 | %---------------------------------------------------- |
---|
3011 | % --- Executes on button press in compare. |
---|
3012 | function compare_Callback(hObject, eventdata, handles) |
---|
3013 | test=get(handles.compare,'Value'); |
---|
3014 | if test |
---|
3015 | filebase=get(handles.displ_filebase,'String'); |
---|
3016 | browse=get(handles.browse_root,'Userdata'); |
---|
3017 | browse.nom_type_ima1=browse.nom_type_ima; |
---|
3018 | set(handles.browse_root,'UserData',browse); |
---|
3019 | set(handles.displ_filebase2,'Visible','On');%mkes the second file input window visible |
---|
3020 | set(handles.displ_filebase2,'String',filebase); |
---|
3021 | mode_store=get(handles.mode,'String');%get the present 'mode' |
---|
3022 | set(handles.compare,'UserData',mode_store);%store the mode display |
---|
3023 | set(handles.mode,'Value',1) |
---|
3024 | set(handles.mode,'String',{'displacement';'st_pair j1-j2'}) |
---|
3025 | else |
---|
3026 | set(handles.displ_filebase2,'Visible','Off'); |
---|
3027 | set(handles.displ_filebase2,'String',[]); |
---|
3028 | mode_store=get(handles.compare,'UserData'); |
---|
3029 | set(handles.mode,'String',mode_store) |
---|
3030 | set(handles.test_stereo1,'Value',0) |
---|
3031 | set(handles.test_stereo2,'Value',0) |
---|
3032 | end |
---|
3033 | mode_Callback(hObject, eventdata, handles) |
---|
3034 | |
---|
3035 | %----------------------------------------------------------- |
---|
3036 | % --- Executes on button press in get_ref_fix1. |
---|
3037 | function get_ref_fix1_Callback(hObject, eventdata, handles) |
---|
3038 | filebase=get(handles.displ_filebase,'String'); |
---|
3039 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
3040 | {'*.nc', ' (*.nc)'; |
---|
3041 | '*.nc', 'netcdf files '; ... |
---|
3042 | '*.*', 'All Files (*.*)'}, ... |
---|
3043 | 'Pick a file',filebase); |
---|
3044 | |
---|
3045 | fileinput=[PathName FileName]; |
---|
3046 | sizf=size(fileinput); |
---|
3047 | if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
3048 | %[filebasesub,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
3049 | [Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
3050 | %filebase=fullfile(RootPath,RootFile); |
---|
3051 | % [Pth,FileN]=fileparts(filebasesub); |
---|
3052 | % Pth=fileparts(Pth); |
---|
3053 | ref.filebase=fullfile(Path,File); |
---|
3054 | ref.num_a=stra2num(str_a); |
---|
3055 | ref.num_b=stra2num(str_b); |
---|
3056 | ref.num1=str2num(field_count); |
---|
3057 | ref.num2=str2num(str2); |
---|
3058 | browse=[];%initialisation |
---|
3059 | if ~isequal(ref.ext,'.nc') |
---|
3060 | errordlg('the reference file must be in netcdf format (*.nc)') |
---|
3061 | return |
---|
3062 | end |
---|
3063 | % [path,name]=fileparts(ref.filebase); |
---|
3064 | set(handles.ref_fix1,'String',[fullfile(ref.subdir,File) '....nc']); |
---|
3065 | set(handles.ref_fix1,'UserData',ref) |
---|
3066 | menu_field{1}='civ1'; |
---|
3067 | Data=nc2struct(fileinput,[]); |
---|
3068 | if isfield(Data,'patch') & isequal(Data.patch,1) |
---|
3069 | menu_field{2}='filter1'; |
---|
3070 | end |
---|
3071 | if isfield(Data,'civ2') & isequal(Data.civ2,1) |
---|
3072 | menu_field{3}='civ2'; |
---|
3073 | end |
---|
3074 | if isfield(Data,'patch2') & isequal(Data.patch2,1) |
---|
3075 | menu_field{4}='filter2'; |
---|
3076 | end |
---|
3077 | % [cte_detect,vdt,cte_read]=read_netcdf(fileinput,{'patch','civ2','patch2'}); |
---|
3078 | % if isequal(cte_detect(1),1) & isequal(cte_read(1),1) |
---|
3079 | % menu_field{2}='filter1'; |
---|
3080 | % end |
---|
3081 | % if isequal(cte_detect(2),1) & isequal(cte_read(2),1) |
---|
3082 | % menu_field{3}='civ2'; |
---|
3083 | % end |
---|
3084 | % if isequal(cte_detect(3),1) & isequal(cte_read(3),1) |
---|
3085 | % menu_field{4}='filter2'; |
---|
3086 | % end |
---|
3087 | set(handles.field_ref1,'String',menu_field); |
---|
3088 | set(handles.field_ref1,'Value',length(menu_field)); |
---|
3089 | set(handles.inf_sup1,'Value',2); |
---|
3090 | set(handles.thresh_vel,'String','1');%default threshold |
---|
3091 | set(handles.ref_fix1,'Enable','on') |
---|
3092 | |
---|
3093 | %--------------------------------------------------------------- |
---|
3094 | % --- Executes on button press in get_ref_fix2. |
---|
3095 | function get_ref_fix2_Callback(hObject, eventdata, handles) |
---|
3096 | if isequal(get(handles.get_ref_fix2,'Value'),1) |
---|
3097 | filebase=get(handles.displ_filebase,'String'); |
---|
3098 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
3099 | {'*.nc', ' (*.nc)'; |
---|
3100 | '*.nc', 'netcdf files '; ... |
---|
3101 | '*.*', 'All Files (*.*)'}, ... |
---|
3102 | 'Pick a file',filebase); |
---|
3103 | fileinput=[PathName FileName]; |
---|
3104 | sizf=size(fileinput); |
---|
3105 | if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
3106 | %[filebasesub,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
3107 | [Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
3108 | % [Pth,FileN]=fileparts(filebasesub); |
---|
3109 | % Pth=fileparts(Pth); |
---|
3110 | ref.filebase=fullfile(Path,File) |
---|
3111 | ref.num_a=stra2num(str_a); |
---|
3112 | ref.num_b=stra2num(str_b); |
---|
3113 | ref.num1=str2num(field_count); |
---|
3114 | ref.num2=str2num(str2); |
---|
3115 | browse=[];%initialisation |
---|
3116 | if ~isequal(ref.ext,'.nc') |
---|
3117 | errordlg('the reference file must be in netcdf format (*.nc)') |
---|
3118 | return |
---|
3119 | end |
---|
3120 | % [path,name]=fileparts(ref.filebase); |
---|
3121 | set(handles.ref_fix2,'String',[fullfile(ref.subdir,File) '....nc']); |
---|
3122 | set(handles.ref_fix2,'UserData',ref) |
---|
3123 | menu_field{1}='civ1'; |
---|
3124 | % [cte_detect,vdt,cte_read]=read_netcdf(fileinput,{'patch','civ2','patch2'}); |
---|
3125 | Data=nc2struct(fileinput,[]); |
---|
3126 | if isfield(Data,'patch') & isequal(Data.patch,1) |
---|
3127 | menu_field{2}='filter1'; |
---|
3128 | end |
---|
3129 | if isfield(Data,'civ2') & isequal(Data.civ2,1) |
---|
3130 | menu_field{3}='civ2'; |
---|
3131 | end |
---|
3132 | if isfield(Data,'patch2') & isequal(Data.patch2,1) |
---|
3133 | menu_field{4}='filter2'; |
---|
3134 | end |
---|
3135 | |
---|
3136 | % if isequal(cte_detect(1),1) & isequal(cte_read(1),1) |
---|
3137 | % menu_field{2}='filter1'; |
---|
3138 | % end |
---|
3139 | % if isequal(cte_detect(2),1) & isequal(cte_read(2),1) |
---|
3140 | % menu_field{3}='civ2'; |
---|
3141 | % end |
---|
3142 | % if isequal(cte_detect(3),1) & isequal(cte_read(3),1) |
---|
3143 | % menu_field{4}='filter2'; |
---|
3144 | % end |
---|
3145 | set(handles.field_ref2,'String',menu_field); |
---|
3146 | set(handles.field_ref2,'Value',length(menu_field)); |
---|
3147 | set(handles.inf_sup2,'Value',2); |
---|
3148 | set(handles.thresh_vel2,'String','1');%default threshold |
---|
3149 | set(handles.ref_fix2,'Enable','on') |
---|
3150 | set(handles.ref_fix2,'Visible','on') |
---|
3151 | set(handles.field_ref2,'Visible','on') |
---|
3152 | else |
---|
3153 | set(handles.ref_fix2,'Visible','off') |
---|
3154 | set(handles.field_ref2,'Visible','off') |
---|
3155 | end |
---|
3156 | %------------------------------------------------------- |
---|
3157 | |
---|
3158 | function ref_fix1_Callback(hObject, eventdata, handles) |
---|
3159 | set(handles.inf_sup1,'Value',1); |
---|
3160 | set(handles.field_ref1,'Value',1) |
---|
3161 | set(handles.field_ref1,'String',{' '}) |
---|
3162 | set(handles.ref_fix1,'UserData',[]); |
---|
3163 | set(handles.ref_fix1,'String',''); |
---|
3164 | set(handles.thresh_vel1,'String','0'); |
---|
3165 | |
---|
3166 | |
---|
3167 | %------------------------------------------------------ |
---|
3168 | |
---|
3169 | function ref_fix2_Callback(hObject, eventdata, handles) |
---|
3170 | set(handles.inf_sup2,'Value',1); |
---|
3171 | set(handles.field_ref2,'Value',1) |
---|
3172 | set(handles.field_ref2,'String',{' '}) |
---|
3173 | set(handles.ref_fix2,'UserData',[]); |
---|
3174 | set(handles.ref_fix2,'String',''); |
---|
3175 | set(handles.thresh_vel2,'String','0'); |
---|
3176 | |
---|
3177 | %-------------------------------------------------------- |
---|
3178 | % --- Executes on selection change in inf_sup1. |
---|
3179 | function inf_sup1_Callback(hObject, eventdata, handles) |
---|
3180 | |
---|
3181 | %-------------------------------------------------------------------------- |
---|
3182 | |
---|
3183 | |
---|
3184 | % --- Executes on selection change in field_ref. |
---|
3185 | function field_ref_Callback(hObject, eventdata, handles) |
---|
3186 | |
---|
3187 | %------------------------------------------------------------------------- |
---|
3188 | |
---|
3189 | % --- Executes on selection change in field_ref2. |
---|
3190 | function field_ref2_Callback(hObject, eventdata, handles) |
---|
3191 | |
---|
3192 | % ----------------------------------------------------------- |
---|
3193 | % transform letters to numbers |
---|
3194 | %-------------------------------------------- |
---|
3195 | function numres=stra2num(str) |
---|
3196 | numres=double(str)-96; |
---|
3197 | if double(str) >= 48 & double(str) <= 57 % = 1 for numbers |
---|
3198 | numres=str2num(str); |
---|
3199 | end |
---|
3200 | |
---|
3201 | |
---|
3202 | % --- Executes on button press in test_stereo1. |
---|
3203 | function test_stereo1_Callback(hObject, eventdata, handles) |
---|
3204 | if isequal(get(handles.test_stereo1,'Value'),0) |
---|
3205 | set(handles.subdomain_patch1,'Visible','on') |
---|
3206 | set(handles.rho_patch1,'Visible','on') |
---|
3207 | else |
---|
3208 | set(handles.subdomain_patch1,'Visible','off') |
---|
3209 | set(handles.rho_patch1,'Visible','off') |
---|
3210 | end |
---|
3211 | |
---|
3212 | % --- Executes on button press in test_stereo2. |
---|
3213 | function test_stereo2_Callback(hObject, eventdata, handles) |
---|
3214 | if isequal(get(handles.test_stereo2,'Value'),0) |
---|
3215 | set(handles.subdomain_patch2,'Visible','on') |
---|
3216 | set(handles.rho_patch2,'Visible','on') |
---|
3217 | else |
---|
3218 | set(handles.subdomain_patch2,'Visible','off') |
---|
3219 | set(handles.rho_patch2,'Visible','off') |
---|
3220 | end |
---|
3221 | |
---|
3222 | % --- Executes on button press in ImaThreshold. |
---|
3223 | function ImaThreshold_Callback(hObject, eventdata, handles) |
---|
3224 | if isequal(get(handles.ImaThreshold,'Value'),1) |
---|
3225 | set(handles.MinIma,'Visible','on') |
---|
3226 | set(handles.MaxIma,'Visible','on') |
---|
3227 | else |
---|
3228 | set(handles.MinIma,'Visible','off') |
---|
3229 | set(handles.MaxIma,'Visible','off') |
---|
3230 | end |
---|
3231 | |
---|
3232 | |
---|
3233 | % --- Executes on button press in ImaThreshold2. |
---|
3234 | function ImaThreshold2_Callback(hObject, eventdata, handles) |
---|
3235 | if isequal(get(handles.ImaThreshold2,'Value'),1) |
---|
3236 | set(handles.MinIma2,'Visible','on') |
---|
3237 | set(handles.MaxIma2,'Visible','on') |
---|
3238 | else |
---|
3239 | set(handles.MinIma2,'Visible','off') |
---|
3240 | set(handles.MaxIma2,'Visible','off') |
---|
3241 | end |
---|
3242 | |
---|
3243 | |
---|
3244 | |
---|
3245 | % --- Executes on button press in Experimental. |
---|
3246 | function Experimental_Callback(hObject, eventdata, handles) |
---|
3247 | |
---|
3248 | |
---|
3249 | |
---|
3250 | function ibz_Callback(hObject, eventdata, handles) |
---|
3251 | % hObject handle to ibz (see GCBO) |
---|
3252 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3253 | % handles structure with handles and user data (see GUIDATA) |
---|
3254 | |
---|
3255 | % Hints: get(hObject,'String') returns contents of ibz as text |
---|
3256 | % str2double(get(hObject,'String')) returns contents of ibz as a double |
---|
3257 | |
---|
3258 | |
---|
3259 | % --- Executes during object creation, after setting all properties. |
---|
3260 | function ibz_CreateFcn(hObject, eventdata, handles) |
---|
3261 | % hObject handle to ibz (see GCBO) |
---|
3262 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3263 | % handles empty - handles not created until after all CreateFcns called |
---|
3264 | |
---|
3265 | % Hint: edit controls usually have a white background on Windows. |
---|
3266 | % See ISPC and COMPUTER. |
---|
3267 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
3268 | set(hObject,'BackgroundColor','white'); |
---|
3269 | end |
---|
3270 | |
---|
3271 | |
---|
3272 | |
---|
3273 | function edit74_Callback(hObject, eventdata, handles) |
---|
3274 | % hObject handle to edit74 (see GCBO) |
---|
3275 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3276 | % handles structure with handles and user data (see GUIDATA) |
---|
3277 | |
---|
3278 | % Hints: get(hObject,'String') returns contents of edit74 as text |
---|
3279 | % str2double(get(hObject,'String')) returns contents of edit74 as a double |
---|
3280 | |
---|
3281 | |
---|
3282 | % --- Executes during object creation, after setting all properties. |
---|
3283 | function edit74_CreateFcn(hObject, eventdata, handles) |
---|
3284 | % hObject handle to edit74 (see GCBO) |
---|
3285 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3286 | % handles empty - handles not created until after all CreateFcns called |
---|
3287 | |
---|
3288 | % Hint: edit controls usually have a white background on Windows. |
---|
3289 | % See ISPC and COMPUTER. |
---|
3290 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
3291 | set(hObject,'BackgroundColor','white'); |
---|
3292 | end |
---|
3293 | |
---|
3294 | |
---|
3295 | |
---|
3296 | function edit75_Callback(hObject, eventdata, handles) |
---|
3297 | % hObject handle to edit75 (see GCBO) |
---|
3298 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3299 | % handles structure with handles and user data (see GUIDATA) |
---|
3300 | |
---|
3301 | % Hints: get(hObject,'String') returns contents of edit75 as text |
---|
3302 | % str2double(get(hObject,'String')) returns contents of edit75 as a double |
---|
3303 | |
---|
3304 | |
---|
3305 | % --- Executes during object creation, after setting all properties. |
---|
3306 | function edit75_CreateFcn(hObject, eventdata, handles) |
---|
3307 | % hObject handle to edit75 (see GCBO) |
---|
3308 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3309 | % handles empty - handles not created until after all CreateFcns called |
---|
3310 | |
---|
3311 | % Hint: edit controls usually have a white background on Windows. |
---|
3312 | % See ISPC and COMPUTER. |
---|
3313 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
3314 | set(hObject,'BackgroundColor','white'); |
---|
3315 | end |
---|
3316 | |
---|
3317 | |
---|
3318 | |
---|
3319 | function dz_civ1_Callback(hObject, eventdata, handles) |
---|
3320 | % hObject handle to dz_civ1 (see GCBO) |
---|
3321 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3322 | % handles structure with handles and user data (see GUIDATA) |
---|
3323 | |
---|
3324 | % Hints: get(hObject,'String') returns contents of dz_civ1 as text |
---|
3325 | % str2double(get(hObject,'String')) returns contents of dz_civ1 as a double |
---|
3326 | |
---|
3327 | |
---|
3328 | % --- Executes during object creation, after setting all properties. |
---|
3329 | function dz_civ1_CreateFcn(hObject, eventdata, handles) |
---|
3330 | % hObject handle to dz_civ1 (see GCBO) |
---|
3331 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
3332 | % handles empty - handles not created until after all CreateFcns called |
---|
3333 | |
---|
3334 | % Hint: edit controls usually have a white background on Windows. |
---|
3335 | % See ISPC and COMPUTER. |
---|
3336 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
3337 | set(hObject,'BackgroundColor','white'); |
---|
3338 | end |
---|
3339 | |
---|
3340 | |
---|