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