[112] | 1 | %'civ': function associated with the interface 'civ.fig' for PIV, spline interpolation and stereo PIV (patch) |
---|
[2] | 2 | %------------------------------------------------------------------------ |
---|
| 3 | % provides an interface for the software CIVx |
---|
| 4 | % function varargout = civ(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 |
---|
[112] | 10 | % This file is part of the toolbox UVMAT. |
---|
| 11 | % |
---|
[2] | 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. |
---|
[112] | 16 | % |
---|
[2] | 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(varargin) |
---|
[273] | 23 | %TODO: search range |
---|
[2] | 24 | |
---|
[276] | 25 | % Last Modified by GUIDE v2.5 18-Nov-2011 10:14:23 |
---|
[2] | 26 | % Begin initialization code - DO NOT EDIT |
---|
| 27 | gui_Singleton = 1; |
---|
| 28 | gui_State = struct('gui_Name', mfilename, ... |
---|
[112] | 29 | 'gui_Singleton', gui_Singleton, ... |
---|
| 30 | 'gui_OpeningFcn', @civ_OpeningFcn, ... |
---|
| 31 | 'gui_OutputFcn', @civ_OutputFcn, ... |
---|
| 32 | 'gui_LayoutFcn', [] , ... |
---|
| 33 | 'gui_Callback', []); |
---|
[2] | 34 | if nargin && ischar(varargin{1}) |
---|
| 35 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
| 36 | end |
---|
| 37 | |
---|
| 38 | if nargout |
---|
| 39 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
| 40 | else |
---|
| 41 | gui_mainfcn(gui_State, varargin{:}); |
---|
| 42 | end |
---|
| 43 | % End initialization code - DO NOT EDIT |
---|
| 44 | |
---|
[12] | 45 | %------------------------------------------------------------------------ |
---|
[2] | 46 | % --- Executes just before civ is made visible. |
---|
[71] | 47 | function civ_OpeningFcn(hObject, eventdata, handles, param) |
---|
[12] | 48 | %------------------------------------------------------------------------ |
---|
[2] | 49 | % This function has no output args, see OutputFcn. |
---|
[112] | 50 | %filebase: root name |
---|
[2] | 51 | %nom_type: nomencalture used ('png_old','_i_j'...) |
---|
| 52 | %list of field numbers to process |
---|
[112] | 53 | %subdir: subdirectory of the opened netcdf file |
---|
[2] | 54 | %ind_opening: operation number advised for beginning (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2), |
---|
| 55 | %ind_a_opening ind_b_opening chosen pair from the opened netcdf file |
---|
| 56 | % Choose default command line output for civ |
---|
| 57 | handles.output = hObject; |
---|
| 58 | % Update handles structure |
---|
| 59 | guidata(hObject, handles); |
---|
[252] | 60 | set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display) |
---|
[2] | 61 | %default initial parameters |
---|
| 62 | filebase=''; % root file name ('filebase'.civ) |
---|
| 63 | ext=[]; |
---|
[252] | 64 | |
---|
[273] | 65 | %% read names of the .exe file to adjust the interface according to available binaries |
---|
[276] | 66 | %path_uvmat=which('uvmat');% check the path detected for source file uvmat |
---|
| 67 | path_civ=fileparts(which('civ')); %path to civ |
---|
| 68 | addpath (path_civ) ; %add the path to UVMAT, (useful in case of change of working directory after civ has been s opened in the working directory) |
---|
[273] | 69 | errormsg=[];%default error message |
---|
| 70 | xmlfile='PARAM.xml'; |
---|
| 71 | if exist(xmlfile,'file') |
---|
| 72 | try |
---|
| 73 | t=xmltree(xmlfile); |
---|
| 74 | sparam=convert(t); |
---|
| 75 | catch |
---|
| 76 | errormsg={' Unable to read the file PARAM.xml defining the civx binaries:'; lasterr}; |
---|
| 77 | return |
---|
| 78 | end |
---|
| 79 | else |
---|
| 80 | errormsg=[xmlfile ' not found: path to civx binaries undefined']; |
---|
| 81 | return |
---|
| 82 | end |
---|
| 83 | if ~isempty(errormsg) |
---|
| 84 | msgbox_uvmat('ERROR',errormsg); |
---|
| 85 | end |
---|
| 86 | |
---|
| 87 | test_batch=0;%default: ,no batch mode available |
---|
| 88 | if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode') |
---|
| 89 | test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod |
---|
| 90 | end |
---|
| 91 | if test_batch==0 |
---|
| 92 | set(handles.BATCH,'Enable','off')% put the BATCH button in grey (unactivated) |
---|
| 93 | set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated) |
---|
| 94 | end |
---|
| 95 | if isfield(sparam.RunParam,'CivBin') |
---|
| 96 | if ~exist(sparam.RunParam.CivBin,'file') |
---|
[276] | 97 | sparam.RunParam.CivBin=fullfile(path_civ,sparam.RunParam.CivBin); |
---|
[273] | 98 | end |
---|
| 99 | else |
---|
| 100 | sparam.RunParam.CivBin=''; |
---|
| 101 | end |
---|
| 102 | |
---|
| 103 | %% load the list of previously browsed files in menu Open |
---|
| 104 | dir_perso=prefdir; % path to the directory .matlab for personal data |
---|
| 105 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmauvmat_perso.mat' in .matlab |
---|
| 106 | if exist(profil_perso,'file') |
---|
| 107 | h=load (profil_perso); |
---|
| 108 | if isfield(h,'MenuFile') |
---|
| 109 | set(handles.MenuFile_1,'Label',h.MenuFile{1}) |
---|
| 110 | %set(handles.MenuFile_1,'Label',h.MenuFile_1); |
---|
| 111 | end |
---|
| 112 | % if isfield(h,'MenuFile_2') |
---|
| 113 | % set(handles.MenuFile_2,'Label',h.MenuFile_2); |
---|
| 114 | % end |
---|
| 115 | % if isfield(h,'MenuFile_3') |
---|
| 116 | % set(handles.MenuFile_3,'Label',h.MenuFile_3); |
---|
| 117 | % end |
---|
| 118 | % if isfield(h,'MenuFile_4') |
---|
| 119 | % set(handles.MenuFile_4,'Label',h.MenuFile_4); |
---|
| 120 | % end |
---|
| 121 | % if isfield(h,'MenuFile_5') |
---|
| 122 | % set(handles.MenuFile_5,'Label',h.MenuFile_5); |
---|
| 123 | % end |
---|
| 124 | end |
---|
| 125 | |
---|
[71] | 126 | %default input parameters: |
---|
[153] | 127 | num_i1=1; % set of field i numbers |
---|
| 128 | num_i2=1; % set of field i numbers |
---|
| 129 | num_j1=1; % set of field j numbers (fields a) |
---|
| 130 | num_j2=1; % second set of field j numbers (fields b) |
---|
[273] | 131 | %subdir='A'; % subdir for the netcdf result files |
---|
| 132 | ind_opening=0; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2) |
---|
[112] | 133 | %load the initial parameters if the interface is started from uvmat |
---|
[71] | 134 | if exist('param','var')&&isstruct(param)% the interface is opened from uvmat |
---|
| 135 | filebase=param.RootName; |
---|
| 136 | nom_type_read=param.NomType; |
---|
[153] | 137 | num_i1=param.num1; |
---|
| 138 | if isnan(num_i1),num_i1=1;end |
---|
| 139 | num_i2=param.num2; |
---|
| 140 | if isnan(num_i2),num_i2=num_i1;end |
---|
| 141 | num_j1=param.num_a; |
---|
| 142 | if isnan(num_j1),num_j1=1;end |
---|
| 143 | num_j2=param.num_b; |
---|
| 144 | if isnan(num_j2),num_j2=num_j1;end |
---|
[71] | 145 | subdir=param.SubDir; |
---|
| 146 | ind_opening=param.IndOpening; |
---|
| 147 | ext=param.ImaExt; |
---|
[2] | 148 | end |
---|
[153] | 149 | browse.num_i1=num_i1; |
---|
| 150 | browse.num_i2=num_i2; |
---|
| 151 | browse.num_j1=num_j1; |
---|
| 152 | browse.num_j2=num_j2; |
---|
[122] | 153 | if ~isempty(ext) && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat |
---|
[112] | 154 | set(handles.ImaExt,'String',ext) |
---|
[128] | 155 | browse.ext_ima=ext; |
---|
[112] | 156 | if exist('nom_type_read','var') |
---|
| 157 | browse.nom_type_ima=nom_type_read; % the image nomenclature is stored |
---|
| 158 | end |
---|
[2] | 159 | elseif isequal(ext,'.nc') |
---|
| 160 | if exist('nom_type_read','var') |
---|
| 161 | browse.nom_type_nc=nom_type_read;% the netcdf nomenclature is stored |
---|
| 162 | end |
---|
| 163 | end |
---|
[71] | 164 | set(handles.RootName,'String',filebase); |
---|
[2] | 165 | set(handles.ImaDoc,'String',ext) |
---|
| 166 | |
---|
| 167 | %initiate advised operations |
---|
[273] | 168 | enable_civ1(handles,0) |
---|
| 169 | enable_civ2(handles,0) |
---|
| 170 | %enable_pair1(handles,'on') |
---|
| 171 | enable_fix1(handles,0) |
---|
| 172 | enable_patch1(handles,0) |
---|
| 173 | enable_fix2(handles,0) |
---|
| 174 | enable_patch2(handles,0) |
---|
[112] | 175 | set(handles.CIV1,'Value',0) |
---|
| 176 | set(handles.FIX1,'Value',0) |
---|
| 177 | set(handles.PATCH1,'Value',0) |
---|
| 178 | set(handles.CIV2,'Value',0) |
---|
| 179 | set(handles.FIX2,'Value',0) |
---|
| 180 | set(handles.PATCH2,'Value',0) |
---|
[273] | 181 | %set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
[2] | 182 | if isequal(ind_opening,1) |
---|
| 183 | set(handles.CIV1,'Value',1) |
---|
[273] | 184 | enable_civ1(handles,1) |
---|
[2] | 185 | elseif isequal(ind_opening,2) |
---|
| 186 | set(handles.FIX1,'Value',1) |
---|
[273] | 187 | enable_fix1(handles,1) |
---|
[2] | 188 | elseif isequal(ind_opening,3) |
---|
| 189 | set(handles.PATCH1,'Value',1) |
---|
[273] | 190 | enable_patch1(handles,1) |
---|
[2] | 191 | elseif isequal(ind_opening,4) |
---|
| 192 | set(handles.CIV2,'Value',1) |
---|
[273] | 193 | enable_civ2(handles,1) |
---|
[2] | 194 | elseif isequal(ind_opening,5) |
---|
| 195 | set(handles.FIX2,'Value',1) |
---|
[273] | 196 | enable_fix2(handles,1) |
---|
[112] | 197 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 198 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 199 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 200 | enable_pair1(handles,'off') |
---|
[2] | 201 | elseif isequal(ind_opening,6) |
---|
| 202 | set(handles.PATCH2,'Value',1) |
---|
[273] | 203 | enable_patch2(handles,1) |
---|
[2] | 204 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 205 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 206 | enable_pair1(handles,'off') |
---|
| 207 | end |
---|
| 208 | |
---|
| 209 | % set the range of fields (1:1 by default) and selected pair |
---|
[153] | 210 | if isequal(num_i2,num_i1) |
---|
| 211 | num_ref_i=num_i1; |
---|
[2] | 212 | else |
---|
[153] | 213 | num_ref_i=floor((num_i1+num_i2)/2); |
---|
| 214 | browse.incr_pair(1)=num_i2-num_i1; |
---|
[2] | 215 | browse.incr_pair(2)=0; |
---|
| 216 | end |
---|
[153] | 217 | if isequal(num_j1,num_j2) |
---|
| 218 | if isnan(num_j1) |
---|
[2] | 219 | num_ref_j=1; |
---|
| 220 | else |
---|
[153] | 221 | num_ref_j=num_j1; |
---|
[2] | 222 | end |
---|
| 223 | else |
---|
[153] | 224 | num_ref_j=floor((num_j1+num_j2)/2); |
---|
| 225 | browse.incr_pair(2)=num_j2-num_j1; |
---|
[2] | 226 | end |
---|
| 227 | set(handles.first_i,'String',num2str(num_ref_i)); |
---|
| 228 | set(handles.last_i,'String',num2str(num_ref_i)); |
---|
| 229 | set(handles.first_j,'String',num2str(num_ref_j)); |
---|
| 230 | set(handles.last_j,'String',num2str(num_ref_j)); |
---|
| 231 | set(handles.ref_i,'String',num2str(num_ref_i)); |
---|
| 232 | set(handles.ref_j,'String',num2str(num_ref_j)); |
---|
[273] | 233 | % set(handles.ref_i_civ2,'String',num2str(num_ref_i)); |
---|
| 234 | % set(handles.ref_j_civ2,'String',num2str(num_ref_j)); |
---|
| 235 | set(handles.RootName,'UserData',browse); |
---|
[220] | 236 | if exist('param','var') && isfield(param,'RootName') && ~isempty(param.RootName)%varargin the interface is opened from uvmat |
---|
[112] | 237 | RootName_Callback(hObject, eventdata, handles); |
---|
[2] | 238 | end |
---|
| 239 | |
---|
[12] | 240 | %------------------------------------------------------------------------ |
---|
[2] | 241 | % --- Outputs from this function are returned to the command line. |
---|
| 242 | function varargout = civ_OutputFcn(hObject, eventdata, handles) |
---|
[12] | 243 | %------------------------------------------------------------------------ |
---|
[2] | 244 | % varargout cell array for returning output args (see VARARGOUT); |
---|
| 245 | % hObject handle to figure |
---|
| 246 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 247 | % handles structure with handles and user data (see GUIDATA) |
---|
| 248 | % Get default command line output from handles structure |
---|
| 249 | varargout{1} = handles.output; |
---|
| 250 | |
---|
[273] | 251 | % -------------------------------------------------------------------- |
---|
| 252 | function MenuBrowse_Callback(hObject, eventdata, handles) |
---|
| 253 | |
---|
[2] | 254 | %get the input file properties |
---|
[71] | 255 | filebase=get(handles.RootName,'String'); |
---|
[2] | 256 | oldfile=''; %default |
---|
[39] | 257 | if isempty(filebase)|| isequal(filebase,'')%loads the previously stored file name and set it as default in the file_input box |
---|
[112] | 258 | dir_perso=prefdir; |
---|
| 259 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
| 260 | if exist(profil_perso,'file') |
---|
| 261 | h=load (profil_perso); |
---|
| 262 | if isfield(h,'filebase')&& ischar(h.filebase) |
---|
| 263 | oldfile=h.filebase; |
---|
| 264 | end |
---|
| 265 | if isfield(h,'RootPath') && ischar(h.RootPath) |
---|
| 266 | oldfile=h.RootPath; |
---|
| 267 | end |
---|
| 268 | end |
---|
| 269 | else |
---|
| 270 | oldfile=filebase; |
---|
| 271 | end |
---|
[2] | 272 | ind_opening=1;%default |
---|
| 273 | browse.incr_pair=[0 0]; %default |
---|
[238] | 274 | menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)'; |
---|
[174] | 275 | '*.xml', '.xml files '; ... |
---|
| 276 | '*.civ', '.civ files '; ... |
---|
| 277 | '*.png','.png image files'; ... |
---|
| 278 | '*.jpg',' jpeg image files'; ... |
---|
| 279 | '*.tif','.tif image files'; ... |
---|
| 280 | '*.avi;*.AVI','.avi movie files'; ... |
---|
| 281 | '*.nc','.netcdf files'; ... |
---|
| 282 | '*.*', 'All Files (*.*)'}; |
---|
[2] | 283 | [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile); |
---|
[112] | 284 | fileinput=[PathName FileName];%complete file name |
---|
[2] | 285 | sizf=size(fileinput); |
---|
| 286 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
| 287 | [path,name,ext]=fileparts(fileinput); |
---|
| 288 | testeditxml=0; |
---|
| 289 | if isequal(ext,'.xml') |
---|
| 290 | testeditxml=1; |
---|
| 291 | t_browse=xmltree(fileinput); |
---|
| 292 | head_element=get(t_browse,1); |
---|
[45] | 293 | if isfield(head_element,'name')&& isequal(head_element.name,'ImaDoc') |
---|
[2] | 294 | testeditxml=0; |
---|
| 295 | end |
---|
| 296 | end |
---|
[45] | 297 | if testeditxml==1 || isequal(ext,'.xls') |
---|
[112] | 298 | heditxml=editxml({fileinput}); |
---|
| 299 | set(heditxml,'Tag','browser') |
---|
| 300 | waitfor(heditxml,'Tag','idle') |
---|
| 301 | if ~ishandle(heditxml) |
---|
| 302 | return |
---|
| 303 | end |
---|
| 304 | attr=findobj(get(heditxml,'children'),'Tag','CurrentAttributes'); |
---|
| 305 | set(handles.browse,'UserData',fileinput)% store for future opening with browser |
---|
| 306 | fileinput=get(attr,'UserData'); |
---|
| 307 | if ~exist(fileinput,'file') |
---|
| 308 | return |
---|
| 309 | end |
---|
[2] | 310 | end |
---|
[82] | 311 | [RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput); |
---|
[2] | 312 | filebase=fullfile(RootPath,RootFile); |
---|
[89] | 313 | num_i1=str2double(str1); |
---|
| 314 | if isnan(num_i1),num_i1=1;end |
---|
| 315 | num_i2=str2double(str2); |
---|
| 316 | if isnan(num_i2),num_i2=num_i1;end |
---|
[54] | 317 | num_j1=stra2num(str_a); |
---|
[89] | 318 | if isnan(num_j1),num_j1=1;end |
---|
[54] | 319 | num_j2=stra2num(str_b); |
---|
[112] | 320 | if isnan(num_j2),num_j2=num_j1;end |
---|
[2] | 321 | if isequal(get(handles.compare,'Value'),1) |
---|
| 322 | browse=[];%initialisation |
---|
| 323 | else |
---|
[273] | 324 | browse=get(handlesRootName,'UserData'); |
---|
[2] | 325 | end |
---|
[122] | 326 | browse.num_i1=num_i1; |
---|
| 327 | browse.num_i2=num_i2; |
---|
| 328 | browse.num_j1=num_j1; |
---|
| 329 | browse.num_j2=num_j2; |
---|
| 330 | if length(ext)>1 && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat |
---|
[2] | 331 | browse.nom_type_ima=nom_type; |
---|
[122] | 332 | browse.ext_ima=ext; |
---|
[177] | 333 | set(handles.ImaExt,'String',ext) |
---|
[2] | 334 | end |
---|
| 335 | set(handles.ImaDoc,'String',ext); |
---|
| 336 | |
---|
| 337 | %%%%% read the state of the selected netcdf file to advise default operation |
---|
| 338 | if isequal(ext,'.nc') |
---|
| 339 | browse.nom_type_nc=nom_type; |
---|
[112] | 340 | ind_opening=2;% propose 'fix' as the default option |
---|
[246] | 341 | Data=nc2struct(fileinput,'ListGlobalAttribute','CivStage','absolut_time_T0','fix','patch','civ2','fix2'); |
---|
| 342 | if ~isempty(Data.CivStage)%test for civ files |
---|
| 343 | ind_opening=Data.CivStage; |
---|
[257] | 344 | set(handles.CivMode,'Value',3) |
---|
[246] | 345 | end |
---|
| 346 | if ~isempty(Data.absolut_time_T0)%test for civx files |
---|
[257] | 347 | set(handles.CivMode,'Value',1) |
---|
[2] | 348 | if isfield(Data,'fix') && isequal(Data.fix,1) |
---|
| 349 | ind_opening=3; |
---|
| 350 | end |
---|
[246] | 351 | if isequal(Data.patch,1) |
---|
[2] | 352 | ind_opening=4; |
---|
| 353 | end |
---|
[246] | 354 | if isequal(Data.civ2,1) |
---|
[2] | 355 | ind_opening=5; |
---|
| 356 | end |
---|
[246] | 357 | if isequal(Data.fix2,1) |
---|
[2] | 358 | ind_opening=6; |
---|
| 359 | end |
---|
| 360 | testciv=1; %TO SUPPRESS WITH NEW VERSION OF CIVX |
---|
| 361 | else |
---|
[112] | 362 | ind_opening=3; %GUI used only for patch |
---|
[2] | 363 | testciv=0; |
---|
| 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 |
---|
[71] | 370 | set(handles.RootName,'String',filebase); |
---|
[2] | 371 | set(handles.ImaDoc,'String',ext); |
---|
[45] | 372 | if ~isempty(num_i1) |
---|
[82] | 373 | ref_i=num_i1; |
---|
[45] | 374 | if ~isempty(num_i2) |
---|
| 375 | ref_i=floor((ref_i+num_i2)/2);% reference image number corresponding to the file |
---|
| 376 | browse.incr_pair(1)=num_i2-num_i1; |
---|
[2] | 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)); |
---|
[71] | 381 | set(handles.ref_i,'String',num2str(ref_i)); |
---|
[273] | 382 | % set(handles.ref_i_civ2,'String',num2str(ref_i)) |
---|
[2] | 383 | end |
---|
[45] | 384 | if isempty(num_j1) |
---|
[2] | 385 | set(handles.ref_j,'String','1'); |
---|
[71] | 386 | set(handles.ref_j_civ2,'String','1'); |
---|
[2] | 387 | else |
---|
[45] | 388 | ref_j=num_j1; |
---|
| 389 | if ~isempty(num_j2) |
---|
| 390 | ref_j=floor((num_j1+num_j2)/2); |
---|
[112] | 391 | browse.incr_pair(2)=num_j2-num_j1; |
---|
[2] | 392 | end |
---|
| 393 | set(handles.first_j,'String',num2str(ref_j)); |
---|
| 394 | set(handles.last_j,'String',num2str(ref_j)); |
---|
[112] | 395 | set(handles.ref_j,'String',num2str(ref_j)); |
---|
[273] | 396 | % set(handles.ref_j_civ2,'String',num2str(ref_j)); |
---|
[2] | 397 | end |
---|
| 398 | |
---|
| 399 | % set default operation options |
---|
[273] | 400 | enable_civ1(handles,0) |
---|
| 401 | enable_civ2(handles,0') |
---|
[2] | 402 | enable_pair1(handles,'on') |
---|
[273] | 403 | enable_fix1(handles,0) |
---|
| 404 | enable_patch1(handles,0) |
---|
| 405 | enable_fix2(handles,0) |
---|
| 406 | enable_patch2(handles,0) |
---|
[2] | 407 | set(handles.CIV1,'Value',0) |
---|
| 408 | set(handles.FIX1,'Value',0) |
---|
| 409 | set(handles.PATCH1,'Value',0) |
---|
| 410 | set(handles.CIV2,'Value',0) |
---|
| 411 | set(handles.FIX2,'Value',0) |
---|
| 412 | set(handles.PATCH2,'Value',0) |
---|
[273] | 413 | % set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
[2] | 414 | if isequal(ind_opening,1) |
---|
| 415 | set(handles.CIV1,'Value',1) |
---|
| 416 | enable_civ1(handles,'on') |
---|
| 417 | elseif isequal(ind_opening,2) |
---|
| 418 | set(handles.FIX1,'Value',1) |
---|
| 419 | enable_fix1(handles,'on') |
---|
| 420 | elseif isequal(ind_opening,3) |
---|
| 421 | set(handles.PATCH1,'Value',1) |
---|
| 422 | enable_patch1(handles) |
---|
| 423 | elseif isequal(ind_opening,4) |
---|
| 424 | set(handles.CIV2,'Value',1) |
---|
[224] | 425 | enable_civ2(handles,'on') |
---|
[2] | 426 | elseif isequal(ind_opening,5) |
---|
| 427 | enable_pair1(handles,'off') |
---|
| 428 | set(handles.FIX2,'Value',1) |
---|
| 429 | enable_fix2(handles) |
---|
[112] | 430 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 431 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 432 | set(handles.list_pair_civ2,'Enable','On') |
---|
[2] | 433 | elseif isequal(ind_opening,6) |
---|
| 434 | enable_pair1(handles,'off') |
---|
| 435 | set(handles.PATCH2,'Value',1) |
---|
| 436 | enable_patch2(handles) |
---|
| 437 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 438 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 439 | end |
---|
[273] | 440 | set(handles.RootName,'UserData',browse);% store information from browser |
---|
[71] | 441 | RootName_Callback(hObject, eventdata, handles); |
---|
[2] | 442 | |
---|
[273] | 443 | |
---|
| 444 | % ----------------------------------------------------------------------- |
---|
| 445 | % --- Open again the file whose name has been recorded in MenuFile_1 |
---|
| 446 | function MenuFile_1_Callback(hObject, eventdata, handles) |
---|
[12] | 447 | %------------------------------------------------------------------------ |
---|
[273] | 448 | fileinput=get(handles.MenuFile_1,'Label'); |
---|
| 449 | display_file_name(hObject, eventdata, handles,fileinput) |
---|
| 450 | |
---|
| 451 | % ----------------------------------------------------------------------- |
---|
| 452 | % --- Open again the file whose name has been recorded in MenuFile_2 |
---|
| 453 | function MenuFile_2_Callback(hObject, eventdata, handles) |
---|
| 454 | %------------------------------------------------------------------------ |
---|
| 455 | fileinput=get(handles.MenuFile_2,'Label'); |
---|
| 456 | display_file_name(hObject, eventdata, handles,fileinput) |
---|
| 457 | |
---|
| 458 | % ----------------------------------------------------------------------- |
---|
| 459 | % --- Open again the file whose name has been recorded in MenuFile_3 |
---|
| 460 | function MenuFile_3_Callback(hObject, eventdata, handles) |
---|
| 461 | %------------------------------------------------------------------------ |
---|
| 462 | fileinput=get(handles.MenuFile_3,'Label'); |
---|
| 463 | display_file_name(hObject, eventdata, handles,fileinput) |
---|
| 464 | |
---|
| 465 | % ----------------------------------------------------------------------- |
---|
| 466 | % --- Open again the file whose name has been recorded in MenuFile_4 |
---|
| 467 | function MenuFile_4_Callback(hObject, eventdata, handles) |
---|
| 468 | %------------------------------------------------------------------------ |
---|
| 469 | fileinput=get(handles.MenuFile_4,'Label'); |
---|
| 470 | display_file_name(hObject, eventdata, handles,fileinput) |
---|
| 471 | |
---|
| 472 | % ----------------------------------------------------------------------- |
---|
| 473 | % --- Open again the file whose name has been recorded in MenuFile_5 |
---|
| 474 | function MenuFile_5_Callback(hObject, eventdata, handles) |
---|
| 475 | %------------------------------------------------------------------------ |
---|
| 476 | fileinput=get(handles.MenuFile_5,'Label'); |
---|
| 477 | display_file_name(hObject, eventdata, handles,fileinput) |
---|
| 478 | |
---|
| 479 | %------------------------------------------------------------------------ |
---|
[2] | 480 | function ImaDoc_Callback(hObject, eventdata, handles) |
---|
[12] | 481 | %------------------------------------------------------------------------ |
---|
[71] | 482 | RootName_Callback(hObject, eventdata, handles) |
---|
[2] | 483 | |
---|
[12] | 484 | %------------------------------------------------------------------------ |
---|
[54] | 485 | % --- function activated when a new filebase (image series) is introduced |
---|
[71] | 486 | function RootName_Callback(hObject, eventdata, handles) |
---|
[12] | 487 | %------------------------------------------------------------------------ |
---|
[273] | 488 | filebase=get(handles.RootName,'String'); |
---|
| 489 | display_file_name(hObject, eventdata, handles,filebase) |
---|
| 490 | |
---|
| 491 | %------------------------------------------------------------------------ |
---|
| 492 | function display_file_name(hObject, eventdata, handles,filebase) |
---|
| 493 | %------------------------------------------------------------------------ |
---|
[2] | 494 | set(handles.compare,'Visible','on') |
---|
[122] | 495 | ext_ima='';%default |
---|
[2] | 496 | nom_type_ima=[];%default |
---|
| 497 | field_count=1;%default |
---|
| 498 | nom_type_nc=[]; |
---|
| 499 | time=[]; |
---|
[71] | 500 | TimeUnit='frame'; %default |
---|
| 501 | CoordUnit='px';%default |
---|
[2] | 502 | pxcmx_search=[];%default |
---|
| 503 | pxcmy_search=[];%default |
---|
[273] | 504 | |
---|
[128] | 505 | ext_imadoc=get(handles.ImaDoc,'String'); |
---|
[273] | 506 | browse=get(handles.RootName,'UserData');%default |
---|
[122] | 507 | if isfield(browse,'nom_type_ima') |
---|
| 508 | nom_type_ima=browse.nom_type_ima;% get an image nomenclature type already determined by an input image name |
---|
[133] | 509 | end |
---|
| 510 | if isfield(browse,'ext_ima') |
---|
[122] | 511 | ext_ima=browse.ext_ima; |
---|
[2] | 512 | end |
---|
[122] | 513 | if isfield(browse,'nom_type_nc') |
---|
| 514 | nom_type_nc=browse.nom_type_nc;% get an image nomenclature type already determined by an input image name |
---|
| 515 | end |
---|
| 516 | if isfield(browse,'num_i1') |
---|
| 517 | field_count=browse.num_i1;% get an image index type already determined by an input file |
---|
| 518 | end |
---|
[252] | 519 | set(handles.civ,'UserData',[]); %refresh list of previous civ files (for STATUS) |
---|
[2] | 520 | |
---|
| 521 | %default first_i and j and increments |
---|
[137] | 522 | first_i=str2double(get(handles.first_i,'String'));%value possibly set by uvmat_Opening |
---|
| 523 | if isnan(first_i)|| first_i < 1 |
---|
[2] | 524 | first_i=1; %default first_i |
---|
| 525 | end |
---|
[137] | 526 | last_i=str2double(get(handles.last_i,'String')); |
---|
| 527 | if isnan(last_i)|| last_i < first_i |
---|
[2] | 528 | last_i=first_i; %default last_i |
---|
| 529 | end |
---|
[137] | 530 | first_j=str2double(get(handles.first_j,'String')); |
---|
| 531 | if isnan(first_j)|| first_j < 1 |
---|
[2] | 532 | first_j=1; %default first_j |
---|
| 533 | end |
---|
[137] | 534 | last_j=str2double(get(handles.last_j,'String')); |
---|
| 535 | if isnan(last_j)|| last_j < first_j |
---|
[2] | 536 | last_j=first_j; %default last_j |
---|
| 537 | end |
---|
[137] | 538 | incr_i=str2double(get(handles.incr_i,'String')); |
---|
| 539 | if isnan(incr_i) || incr_i < 1; |
---|
[2] | 540 | set(handles.incr_i,'String','1') %default incr_i |
---|
| 541 | end |
---|
[137] | 542 | incr_j=str2double(get(handles.incr_j,'String')); |
---|
| 543 | if isnan(incr_j) || incr_j < 1; |
---|
[2] | 544 | set(handles.incr_j,'String','1') %default incr_j |
---|
| 545 | end |
---|
| 546 | dt=[];%default |
---|
| 547 | testmode=0;%default |
---|
| 548 | nbfield=[]; %default |
---|
| 549 | nburst=[];%default |
---|
| 550 | pxcmx=1; |
---|
[112] | 551 | pxcmy=1; |
---|
[2] | 552 | |
---|
[112] | 553 | %look for an image documentation file |
---|
[128] | 554 | if ~strcmp(ext_imadoc,'.xml') && ~strcmp(ext_imadoc,'.civ')&& ~strcmpi(ext_imadoc,'.avi') |
---|
[2] | 555 | if exist([filebase '.xml'],'file') |
---|
[128] | 556 | ext_imadoc='.xml'; |
---|
[2] | 557 | elseif exist([filebase '.civxml'],'file') |
---|
[128] | 558 | ext_imadoc='.civxml'; |
---|
[2] | 559 | elseif exist([filebase '.civ'],'file') |
---|
[128] | 560 | ext_imadoc='.civ'; |
---|
[112] | 561 | elseif exist([filebase '.avi'],'file') |
---|
[128] | 562 | ext_imadoc='.avi'; |
---|
[2] | 563 | elseif exist([filebase '.AVI'],'file') |
---|
[128] | 564 | ext_imadoc='.AVI'; |
---|
[2] | 565 | end |
---|
[128] | 566 | set(handles.ImaDoc,'String',ext_imadoc) |
---|
[2] | 567 | end |
---|
| 568 | |
---|
| 569 | %%%%%%%% read image documentation file %%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
[84] | 570 | mode=''; %default |
---|
| 571 | set(handles.ImaDoc,'BackgroundColor',[1 1 0]) |
---|
| 572 | drawnow |
---|
[128] | 573 | if isequal(ext_imadoc,'.civxml') || isequal(ext_imadoc,'.xml')|| isequal(ext_imadoc,'.civ') |
---|
[2] | 574 | set(handles.ref_i,'Visible','On')%use a reference index |
---|
| 575 | set(handles.ref_j,'Visible','On') |
---|
[128] | 576 | elseif isequal(ext_imadoc,'.avi') || isequal(ext_imadoc,'.AVI') |
---|
[2] | 577 | set(handles.ref_j,'Visible','Off') |
---|
| 578 | else |
---|
| 579 | set(handles.ref_i,'Visible','Off') |
---|
| 580 | set(handles.ref_j,'Visible','Off') |
---|
| 581 | end |
---|
[12] | 582 | testima_xml=0; |
---|
[128] | 583 | if isequal(ext_imadoc,'.civxml')%TO ABANDON |
---|
[122] | 584 | [nbfield,nbfield2,time]=read_civxml([filebase '.civxml']); |
---|
[2] | 585 | mode='pair j1-j2'; |
---|
| 586 | if isempty(nom_type_ima)% dtermine types by default if not already selected by browser or uvmat |
---|
[112] | 587 | nom_type_ima='_i_j'; |
---|
[2] | 588 | end |
---|
[128] | 589 | elseif isequal(ext_imadoc,'.xml') |
---|
[73] | 590 | [XmlData,warntext]=imadoc2struct([filebase '.xml']); |
---|
[2] | 591 | ext_ima_read=[]; |
---|
| 592 | nom_type_read=[]; |
---|
[12] | 593 | if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file |
---|
[2] | 594 | [PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName); |
---|
[112] | 595 | fullname=fullfile(fileparts(filebase),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file, |
---|
[45] | 596 | if ~exist(fullname,'file') |
---|
[12] | 597 | msgbox_uvmat('WARNING',['FirstImage ' fullname ' defined in the xml file does not exist']) |
---|
| 598 | end |
---|
[2] | 599 | end |
---|
[84] | 600 | if isfield(XmlData,'Time') |
---|
[85] | 601 | time=XmlData.Time; |
---|
[84] | 602 | nbfield=size(time,1); |
---|
[122] | 603 | nbfield2=size(time,2); |
---|
[127] | 604 | %transform .Time to a column vector if it is a line vector thenomenclature uses a single index: correct possible bug in xml |
---|
[122] | 605 | if isequal(nbfield,1) && ~isequal(nbfield2,1)% .Time is a line vector |
---|
[127] | 606 | if numel(nom_type_read)>=2 && isempty(regexp(nom_type_read(2:end),'\D')) |
---|
[84] | 607 | time=time'; |
---|
[122] | 608 | nbfield=nbfield2; |
---|
| 609 | nbfield2=1; |
---|
[84] | 610 | end |
---|
| 611 | end |
---|
| 612 | end |
---|
[71] | 613 | if isfield(XmlData,'TimeUnit') |
---|
| 614 | TimeUnit=XmlData.TimeUnit; |
---|
[2] | 615 | end |
---|
[71] | 616 | if isfield(XmlData,'Npx') |
---|
| 617 | npx=XmlData.Npx; |
---|
| 618 | npy=XmlData.Npy; |
---|
| 619 | end |
---|
[2] | 620 | pxcmx_search=1; |
---|
| 621 | pxcmy_search=1; |
---|
| 622 | if isfield(XmlData,'GeometryCalib') |
---|
| 623 | tsai=XmlData.GeometryCalib; |
---|
[112] | 624 | if isfield(tsai,'f') && isfield(tsai,'Tz') && isfield(tsai,'dpx') && isfield(tsai,'dpy')&& isfield(tsai,'R') |
---|
| 625 | rot2D=tsai.R(1:2,[1,2]); |
---|
| 626 | pxcmx_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpx); |
---|
| 627 | pxcmy_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpy); |
---|
[2] | 628 | end |
---|
[112] | 629 | if isfield(tsai,'CoordUnit') |
---|
| 630 | CoordUnit=tsai.CoordUnit; |
---|
[2] | 631 | end |
---|
[112] | 632 | end |
---|
[128] | 633 | elseif strcmp(ext_imadoc,'.civ')% case of .civ image documentation file |
---|
[112] | 634 | [error,time,TimeUnit,mode,npx,npy]=read_imatext([filebase '.civ']); |
---|
| 635 | if error==2, msgbox_uvmat('WARNING',['no file ' filebase '.civ']); |
---|
| 636 | elseif error==1, msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file'); |
---|
| 637 | end |
---|
[128] | 638 | nom_type_ima='001a'; |
---|
| 639 | elseif strcmpi(ext_imadoc,'.avi') |
---|
[112] | 640 | nom_type_ima='*'; |
---|
[128] | 641 | ext_ima=ext_imadoc; |
---|
[273] | 642 | set(handles.CivMode,'Value',1); |
---|
| 643 | set(handles.CivMode,'String',{'series(Di)'}) |
---|
[112] | 644 | dt=0.04;%default |
---|
[128] | 645 | if exist([filebase ext_imadoc],'file')==2 |
---|
| 646 | info=aviinfo([filebase ext_imadoc]);%read infos on the avi movie |
---|
[112] | 647 | dt=1/info.FramesPerSecond;%time interval between successive frames |
---|
| 648 | nbfield=info.NumFrames;%number of frames |
---|
| 649 | end |
---|
| 650 | time=(dt*(0:nbfield-1))';%list of image times |
---|
[2] | 651 | end |
---|
| 652 | if isempty(time) |
---|
| 653 | set(handles.ImaDoc,'String',''); %xml file not used for timing |
---|
| 654 | end |
---|
| 655 | set(handles.ImaDoc,'BackgroundColor',[1 1 1]) |
---|
| 656 | |
---|
[122] | 657 | %get the imabe nomenclature type if not defined by the input file nor by the xml file |
---|
| 658 | dirima=[];%default |
---|
[12] | 659 | if isempty(nom_type_ima) |
---|
| 660 | %look for double image series '_i_j' |
---|
| 661 | dirima=dir([filebase '_' num2str(first_i) '_' num2str(first_j) '.*']); |
---|
| 662 | if isempty(dirima) |
---|
[112] | 663 | % look for images series with sub marker '_' |
---|
| 664 | dirima=dir([filebase '_*' num2str(first_i) '.*']); |
---|
| 665 | if isempty(dirima) |
---|
| 666 | % look for other images series |
---|
| 667 | dirima=dir([filebase '*' num2str(first_i) '.*']); |
---|
[122] | 668 | if isempty(dirima) |
---|
| 669 | % look for other images series witth letter appendix |
---|
| 670 | appendix=char(96+first_j); |
---|
| 671 | dirima=dir([filebase '*' num2str(first_i) appendix '.*']); |
---|
[112] | 672 | end |
---|
| 673 | end |
---|
[12] | 674 | end |
---|
[112] | 675 | end |
---|
[122] | 676 | for ilist=1:numel(dirima) |
---|
| 677 | [pp,ff,fc,str2,str_a,str_b,ext_list,nom_type_list]=name2display(dirima(ilist).name); |
---|
| 678 | form=imformats(ext_list(2:end)); |
---|
| 679 | if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab |
---|
| 680 | ext_ima=ext_list; |
---|
| 681 | nom_type_ima=nom_type_list; |
---|
| 682 | break |
---|
| 683 | end |
---|
| 684 | end |
---|
| 685 | % no image documentation file found: look for a series of existing files,images by priority or .nc files |
---|
| 686 | if isempty(nom_type_ima) |
---|
[128] | 687 | ext_search=ext_imadoc; |
---|
[122] | 688 | nom_type_search=nom_type_nc; |
---|
| 689 | else |
---|
| 690 | ext_search=ext_ima; |
---|
| 691 | nom_type_search=nom_type_ima; |
---|
| 692 | end |
---|
| 693 | if isempty(time) && ~strcmp(nom_type_search,'none') && ~strcmp(nom_type_search,'') && ~strcmp(nom_type_search,'*') |
---|
[12] | 694 | subdir=get(handles.subdir_civ1,'String'); |
---|
| 695 | incr_pair=[0 0];%default |
---|
| 696 | if isfield(browse,'incr_pair') |
---|
[112] | 697 | incr_pair=browse.incr_pair; |
---|
[12] | 698 | end |
---|
[112] | 699 | % nbdetect=0;%test of detected images |
---|
[122] | 700 | field_i=browse.num_i2; |
---|
[153] | 701 | imagename=name_generator(filebase,field_i,1,ext_search,nom_type_search); |
---|
| 702 | imagename_plus=''; |
---|
[12] | 703 | idetect=1; |
---|
[153] | 704 | while idetect %look for the maximum file number in the series |
---|
| 705 | imagename_plus=name_generator(filebase,field_i+1,1,ext_search,nom_type_search); |
---|
| 706 | idetect=(exist(imagename_plus,'file')==2)&& ~strcmp(imagename,imagename_plus); |
---|
[81] | 707 | if idetect |
---|
[12] | 708 | field_i=field_i+1; |
---|
[81] | 709 | end |
---|
[112] | 710 | %SEE CASE OF NETCDF FILES |
---|
| 711 | % nbdetect=nbdetect+(exist(imagename,'file')==2); |
---|
[12] | 712 | end |
---|
[122] | 713 | nbfield=field_i;% last detected field number |
---|
| 714 | field_i=browse.num_i1;%look for the minimum file number in the series |
---|
[153] | 715 | imagename_min=''; |
---|
[12] | 716 | idetect=1; |
---|
[112] | 717 | while idetect==1 |
---|
[153] | 718 | imagename_min=name_generator(filebase,field_i-1,1,ext_search,nom_type_search); |
---|
| 719 | idetect=(exist(imagename_min,'file')==2)&& ~strcmp(imagename,imagename_min); |
---|
[81] | 720 | if idetect |
---|
[112] | 721 | field_i=field_i-1; |
---|
[81] | 722 | end |
---|
[12] | 723 | end |
---|
[122] | 724 | first_i=max(field_i,1); |
---|
| 725 | if numel(regexp(nom_type_search,'\D'))>=1%two indices i and j |
---|
| 726 | field_i=browse.num_i1; |
---|
| 727 | field_j=browse.num_j2; |
---|
[177] | 728 | imagename=name_generator(filebase,field_i,field_j,ext_search,nom_type_search); |
---|
[153] | 729 | imagename_plus=''; |
---|
[89] | 730 | jdetect=1; |
---|
| 731 | while jdetect==1 %look for the maximum file number in the series |
---|
[153] | 732 | imagename_plus=name_generator(filebase,field_i,field_j+1,ext_search,nom_type_search); |
---|
| 733 | jdetect=(exist(imagename_plus,'file')==2)&& ~strcmp(imagename,imagename_plus); |
---|
[89] | 734 | if jdetect |
---|
| 735 | field_j=field_j+1; |
---|
| 736 | end |
---|
| 737 | %SEE CASE OF NETCDF FILES |
---|
| 738 | % nbdetect=nbdetect+(exist(imagename,'file')==2); |
---|
| 739 | end |
---|
[122] | 740 | nbfield2=field_j;% last detected field number |
---|
[120] | 741 | end |
---|
[122] | 742 | |
---|
[89] | 743 | %determine the set of times and possible intervals for CIV |
---|
[137] | 744 | % dt=(1/1000)*str2double(get(handles.dt,'String')); |
---|
[122] | 745 | time=(0:nbfield-1)';% time=file index -1 by default |
---|
| 746 | if numel(regexp(nom_type_search,'\D'))>=1%two indices i and j |
---|
| 747 | [x,y]=meshgrid(0:nbfield2-1,0:nbfield-1); |
---|
[120] | 748 | time=x+y; |
---|
[89] | 749 | end |
---|
[2] | 750 | end |
---|
[120] | 751 | |
---|
[2] | 752 | if exist('time','var') |
---|
| 753 | if size(time,1)+size(time,2)>=3 % if there are at least two time values to define dt |
---|
| 754 | nbfield=size(time,1); |
---|
| 755 | nbfield2=size(time,2); |
---|
[273] | 756 | set(handles.ImaDoc,'UserData',time); %store the set of times |
---|
[71] | 757 | set(handles.dt_unit,'String',['dt in m' TimeUnit]); |
---|
[273] | 758 | % set(handles.dt_unit_civ2,'String',['dt in m' TimeUnit]); |
---|
[71] | 759 | set(handles.TimeUnit,'String',TimeUnit); |
---|
[2] | 760 | set(handles.nb_field,'String',num2str(nbfield)); |
---|
| 761 | set(handles.nb_field2,'String',num2str(nbfield2)); |
---|
| 762 | end |
---|
| 763 | end |
---|
[71] | 764 | set(handles.CoordUnit,'String',CoordUnit) |
---|
[273] | 765 | set(handles.SearchRange,'UserData',[pxcmx_search pxcmy_search]); |
---|
[2] | 766 | % npxy=[npy npx]; |
---|
[71] | 767 | set(handles.ImaExt,'String',ext_ima) |
---|
[2] | 768 | set(handles.first_i,'String',num2str(first_i)); |
---|
| 769 | set(handles.last_i,'String',num2str(last_i));% |
---|
| 770 | set(handles.first_j,'String',num2str(first_j)); |
---|
| 771 | set(handles.last_j,'String',num2str(last_j));% |
---|
| 772 | browse.nom_type_ima=nom_type_ima; |
---|
[273] | 773 | set(handles.RootName,'UserData',browse)% store the nomenclature type |
---|
[2] | 774 | |
---|
[273] | 775 | %% set the menus of image pairs and default selection for civ %%%%%%%%%%%%%%%%%%% |
---|
[177] | 776 | test_ima_i=numel(nom_type_ima)>1 && isempty(regexp(nom_type_ima(2:end),'\D','once'));%images with single indexing |
---|
[122] | 777 | if test_ima_i || isequal(nom_type_nc,'_i1-i2')||~(exist('nbfield2','var')&&(nbfield2~=1)) |
---|
[273] | 778 | set(handles.CivMode,'Value',1) |
---|
| 779 | set(handles.CivMode,'String',{'series(Di)'}) |
---|
[2] | 780 | elseif (nbfield==1)% simple series in j |
---|
[273] | 781 | set(handles.CivMode,'Value',1) |
---|
| 782 | set(handles.CivMode,'String',{'series(Dj)'}) |
---|
[2] | 783 | else |
---|
[273] | 784 | set(handles.CivMode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice |
---|
[122] | 785 | if nbfield2 <= 10 |
---|
[273] | 786 | set(handles.CivMode,'Value',1)% advice 'pair j1-j2' for small burst |
---|
[2] | 787 | end |
---|
| 788 | end |
---|
| 789 | |
---|
| 790 | |
---|
[177] | 791 | %% desable status and RUN button |
---|
[2] | 792 | set(handles.RUN, 'Enable','On') |
---|
| 793 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
[122] | 794 | set(handles.BATCH,'Enable','On') |
---|
| 795 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
[178] | 796 | if isfield(handles,'status') |
---|
[177] | 797 | set(handles.status,'Value',0);%suppress status display |
---|
| 798 | status_Callback(hObject, eventdata, handles) |
---|
[178] | 799 | end |
---|
[112] | 800 | |
---|
[177] | 801 | %% store the root input filename for future opening |
---|
[2] | 802 | dir_perso=prefdir; |
---|
| 803 | profil_perso=fullfile(prefdir,'uvmat_perso.mat'); |
---|
| 804 | RootPath=fileparts(filebase); |
---|
| 805 | if exist(profil_perso,'file') |
---|
| 806 | save (profil_perso,'RootPath','-append'); %store the root name for future opening of uvmat |
---|
| 807 | else |
---|
[147] | 808 | txt=ver('MATLAB'); |
---|
| 809 | Release=txt.Release; |
---|
[137] | 810 | relnumb=str2double(Release(3:4)); |
---|
[2] | 811 | if relnumb >= 14 |
---|
[112] | 812 | save (profil_perso,'RootPath','-V6'); %store the root name for future opening of uvmat |
---|
[2] | 813 | else |
---|
| 814 | save (profil_perso,'RootPath'); %store the root name for future opening of uvmat |
---|
| 815 | end |
---|
| 816 | end |
---|
| 817 | |
---|
[273] | 818 | %% update the subdir |
---|
| 819 | pathdir=fileparts(filebase);%path to the current xml file |
---|
| 820 | listot=dir(pathdir); |
---|
| 821 | idir=0; |
---|
| 822 | listdir={''};%default |
---|
| 823 | for ilist=1:length(listot) |
---|
| 824 | if listot(ilist).isdir |
---|
| 825 | name=listot(ilist).name; |
---|
| 826 | if ~isequal(name,'.') && ~isequal(name,'..') |
---|
| 827 | idir=idir+1; |
---|
| 828 | listdir{idir,1}=listot(ilist).name; |
---|
| 829 | end |
---|
| 830 | end |
---|
| 831 | end |
---|
| 832 | set(handles.list_subdir_civ1,'Value',1) |
---|
| 833 | set(handles.list_subdir_civ2,'Value',1) |
---|
| 834 | set(handles.list_subdir_civ1,'String',[listdir;'new...']) |
---|
| 835 | set(handles.list_subdir_civ2,'String',[listdir;'new...']) |
---|
| 836 | if isempty(listdir) |
---|
| 837 | dirname=listdir{1}; |
---|
| 838 | else |
---|
| 839 | dirname='CIV'; %default civ directory name |
---|
| 840 | end |
---|
| 841 | set(handles.subdir_civ1,'String',dirname) |
---|
| 842 | set(handles.subdir_civ2,'String',dirname) |
---|
| 843 | %check wether the current subdir exists: |
---|
| 844 | % subdir_civ1=get(handles.subdir_civ1,'String'); |
---|
| 845 | % subdir_civ2=get(handles.subdir_civ2,'String'); |
---|
| 846 | |
---|
| 847 | CivMode_Callback(hObject, eventdata, handles) |
---|
| 848 | |
---|
[12] | 849 | %------------------------------------------------------------------------ |
---|
[273] | 850 | % --- Executes on button press in CivMode. |
---|
| 851 | function CivMode_Callback(hObject, eventdata, handles) |
---|
[12] | 852 | %------------------------------------------------------------------------ |
---|
[273] | 853 | browse=get(handles.RootName,'UserData'); |
---|
[2] | 854 | compare_list=get(handles.compare,'String'); |
---|
| 855 | val=get(handles.compare,'Value'); |
---|
| 856 | compare=compare_list{val}; |
---|
| 857 | if strcmp(compare,'displacement') |
---|
| 858 | mode='displacement'; |
---|
| 859 | else |
---|
[273] | 860 | mode_list=get(handles.CivMode,'String'); |
---|
[236] | 861 | if ischar(mode_list) |
---|
| 862 | mode_list={mode_list}; |
---|
| 863 | end |
---|
[273] | 864 | mode_value=get(handles.CivMode,'Value'); |
---|
[2] | 865 | mode=mode_list{mode_value}; |
---|
| 866 | end |
---|
| 867 | displ_num=[];%default |
---|
[137] | 868 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
[2] | 869 | % last_i=str2num(get(handles.last_i,'String')); |
---|
[273] | 870 | time=get(handles.ImaDoc,'UserData'); %get the set of times |
---|
[2] | 871 | siztime=size(time); |
---|
| 872 | nbfield=siztime(1); |
---|
| 873 | nbfield2=siztime(2); |
---|
| 874 | indchosen=1; %%first pair selected by default |
---|
| 875 | if isequal(mode,'pair j1-j2')%| isequal(mode,'st_pair j1-j2') |
---|
| 876 | dt=1; |
---|
| 877 | displ=''; |
---|
| 878 | index=0; |
---|
| 879 | numlist_a=[]; |
---|
| 880 | numlist_B=[]; |
---|
| 881 | %get all the time intervals in bursts |
---|
| 882 | displ_dt=1;%default |
---|
| 883 | nbfield2=min(nbfield2,10);%limitate the number of pairs to 10x10 |
---|
| 884 | for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'pair j1-j2' mode |
---|
| 885 | for numod_b=(numod_a+1):nbfield2 |
---|
[112] | 886 | index=index+1; |
---|
| 887 | numlist_a(index)=numod_a; |
---|
| 888 | numlist_b(index)=numod_b; |
---|
| 889 | if ~isempty(time) |
---|
[54] | 890 | dt(numod_a,numod_b)=time(ref_i,numod_b)-time(ref_i,numod_a);%first time interval dt |
---|
[2] | 891 | displ_dt(index)=dt(numod_a,numod_b); |
---|
[112] | 892 | else |
---|
| 893 | displ_dt(index)=1; |
---|
| 894 | end |
---|
| 895 | end |
---|
| 896 | end |
---|
| 897 | [dtsort,indsort]=sort(displ_dt); |
---|
| 898 | if ~isempty(numlist_a) |
---|
| 899 | displ_num(1,:)=numlist_a(indsort); |
---|
| 900 | displ_num(2,:)=numlist_b(indsort); |
---|
| 901 | end |
---|
| 902 | displ_num(3,:)=0; |
---|
| 903 | displ_num(4,:)=0; |
---|
| 904 | set(handles.jtext,'Visible','Off') |
---|
[2] | 905 | set(handles.first_j,'Visible','Off') |
---|
| 906 | set(handles.last_j,'Visible','Off') |
---|
| 907 | set(handles.incr_j,'Visible','Off') |
---|
| 908 | set(handles.nb_field2,'Visible','Off') |
---|
| 909 | set(handles.ref_j,'Visible','Off') |
---|
| 910 | elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') |
---|
[112] | 911 | for index=1:min(nbfield2-1,200) |
---|
| 912 | displ_num(1,index)=-floor(index/2); |
---|
| 913 | displ_num(2,index)=ceil(index/2); |
---|
| 914 | displ_num(3,index)=0; |
---|
| 915 | displ_num(4,index)=0; |
---|
| 916 | end |
---|
| 917 | set(handles.jtext,'Visible','On') |
---|
| 918 | set(handles.first_j,'Visible','On') |
---|
| 919 | set(handles.last_j,'Visible','On') |
---|
| 920 | set(handles.incr_j,'Visible','On') |
---|
| 921 | set(handles.nb_field2,'Visible','On') |
---|
| 922 | set(handles.ref_j,'Visible','On') |
---|
| 923 | if nbfield > 1 |
---|
[2] | 924 | set(handles.itext,'Visible','On') |
---|
| 925 | set(handles.first_i,'Visible','On') |
---|
| 926 | set(handles.last_i,'Visible','On') |
---|
| 927 | set(handles.incr_i,'Visible','On') |
---|
| 928 | set(handles.nb_field,'Visible','On') |
---|
| 929 | set(handles.ref_i,'Visible','On') |
---|
| 930 | else |
---|
| 931 | set(handles.itext,'Visible','Off') |
---|
| 932 | set(handles.first_i,'Visible','Off') |
---|
| 933 | set(handles.last_i,'Visible','Off') |
---|
| 934 | set(handles.incr_i,'Visible','Off') |
---|
| 935 | set(handles.nb_field,'Visible','Off') |
---|
| 936 | set(handles.ref_i,'Visible','Off') |
---|
| 937 | end |
---|
[112] | 938 | elseif isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') |
---|
| 939 | for index=1:200%min(nbfield-1,200) |
---|
| 940 | displ_num(1,index)=0; |
---|
| 941 | displ_num(2,index)=0; |
---|
| 942 | displ_num(3,index)=-floor(index/2); |
---|
| 943 | displ_num(4,index)=ceil(index/2); |
---|
| 944 | end |
---|
| 945 | set(handles.itext,'Visible','On') |
---|
| 946 | set(handles.first_i,'Visible','On') |
---|
| 947 | set(handles.last_i,'Visible','On') |
---|
| 948 | set(handles.incr_i,'Visible','On') |
---|
| 949 | set(handles.nb_field,'Visible','On') |
---|
| 950 | set(handles.ref_i,'Visible','On') |
---|
| 951 | if nbfield2 > 1 |
---|
[2] | 952 | set(handles.jtext,'Visible','On') |
---|
| 953 | set(handles.first_j,'Visible','On') |
---|
| 954 | set(handles.last_j,'Visible','On') |
---|
| 955 | set(handles.incr_j,'Visible','On') |
---|
| 956 | set(handles.nb_field2,'Visible','On') |
---|
| 957 | set(handles.ref_j,'Visible','On') |
---|
[112] | 958 | else |
---|
[2] | 959 | set(handles.jtext,'Visible','Off') |
---|
| 960 | set(handles.first_j,'Visible','Off') |
---|
| 961 | set(handles.last_j,'Visible','Off') |
---|
| 962 | set(handles.incr_j,'Visible','Off') |
---|
| 963 | set(handles.nb_field2,'Visible','Off') |
---|
| 964 | set(handles.ref_j,'Visible','Off') |
---|
| 965 | end |
---|
| 966 | elseif isequal(mode,'displacement')%the pairs have the same indices |
---|
[112] | 967 | displ_num(1,1)=0; |
---|
| 968 | displ_num(2,1)=0; |
---|
| 969 | displ_num(3,1)=0; |
---|
| 970 | displ_num(4,1)=0; |
---|
| 971 | if nbfield > 1 |
---|
[2] | 972 | set(handles.itext,'Visible','On') |
---|
| 973 | set(handles.first_i,'Visible','On') |
---|
| 974 | set(handles.last_i,'Visible','On') |
---|
| 975 | set(handles.incr_i,'Visible','On') |
---|
| 976 | set(handles.nb_field,'Visible','On') |
---|
| 977 | set(handles.ref_i,'Visible','On') |
---|
| 978 | else |
---|
| 979 | set(handles.itext,'Visible','Off') |
---|
| 980 | set(handles.first_i,'Visible','Off') |
---|
| 981 | set(handles.last_i,'Visible','Off') |
---|
| 982 | set(handles.incr_i,'Visible','Off') |
---|
| 983 | set(handles.nb_field,'Visible','Off') |
---|
| 984 | set(handles.ref_i,'Visible','Off') |
---|
| 985 | end |
---|
| 986 | if nbfield2 > 1 |
---|
[112] | 987 | set(handles.jtext,'Visible','On') |
---|
| 988 | set(handles.first_j,'Visible','On') |
---|
| 989 | set(handles.last_j,'Visible','On') |
---|
| 990 | set(handles.incr_j,'Visible','On') |
---|
| 991 | set(handles.nb_field2,'Visible','On') |
---|
| 992 | set(handles.ref_j,'Visible','On') |
---|
[2] | 993 | else |
---|
| 994 | set(handles.jtext,'Visible','Off') |
---|
| 995 | set(handles.first_j,'Visible','Off') |
---|
| 996 | set(handles.last_j,'Visible','Off') |
---|
| 997 | set(handles.incr_j,'Visible','Off') |
---|
| 998 | set(handles.nb_field2,'Visible','Off') |
---|
| 999 | set(handles.ref_j,'Visible','Off') |
---|
| 1000 | end |
---|
[112] | 1001 | end |
---|
[2] | 1002 | set(handles.list_pair_civ1,'UserData',displ_num); |
---|
| 1003 | find_netcpair_civ1(hObject, eventdata, handles) |
---|
| 1004 | find_netcpair_civ2(hObject, eventdata, handles) |
---|
| 1005 | |
---|
[12] | 1006 | %------------------------------------------------------------------------ |
---|
[2] | 1007 | % determine the menu for civ1 pairs depending on existing netcdf file at the middle of |
---|
| 1008 | % the field series set by first_i, incr, last_i |
---|
| 1009 | function find_netcpair_civ1(hObject, eventdata, handles) |
---|
[12] | 1010 | %------------------------------------------------------------------------ |
---|
[2] | 1011 | set(gcf,'Pointer','watch') |
---|
| 1012 | %nomenclature types |
---|
[71] | 1013 | filebase=get(handles.RootName,'String'); |
---|
[2] | 1014 | [filepath,Nme,ext_dir]=fileparts(filebase); |
---|
[273] | 1015 | browse=get(handles.RootName,'UserData'); |
---|
[2] | 1016 | compare_list=get(handles.compare,'String'); |
---|
| 1017 | val=get(handles.compare,'Value'); |
---|
| 1018 | compare=compare_list{val}; |
---|
| 1019 | if strcmp(compare,'displacement') |
---|
| 1020 | mode='displacement'; |
---|
| 1021 | else |
---|
[273] | 1022 | mode_list=get(handles.CivMode,'String'); |
---|
| 1023 | mode_value=get(handles.CivMode,'Value'); |
---|
| 1024 | if isempty(mode_list) |
---|
| 1025 | return |
---|
| 1026 | end |
---|
[2] | 1027 | mode=mode_list{mode_value}; |
---|
| 1028 | end |
---|
| 1029 | |
---|
| 1030 | % nomenclature type of the .nc files |
---|
| 1031 | nom_type_ima=[];%default |
---|
| 1032 | if isfield(browse,'nom_type_ima') |
---|
| 1033 | nom_type_ima=browse.nom_type_ima; |
---|
| 1034 | end |
---|
| 1035 | |
---|
[112] | 1036 | %determine nom_type_nc: |
---|
[2] | 1037 | nom_type_nc=[];%default |
---|
| 1038 | if isfield(browse,'nom_type_nc') |
---|
| 1039 | nom_type_nc=browse.nom_type_nc; |
---|
| 1040 | end |
---|
| 1041 | if isempty(nom_type_nc) |
---|
[112] | 1042 | [nom_type_nc]=nomtype2pair(nom_type_ima,isequal(mode,'series(Di)'),isequal(mode,'series(Dj)')); |
---|
[2] | 1043 | end |
---|
| 1044 | browse.nom_type_nc=nom_type_nc; |
---|
[273] | 1045 | set(handles.RootName,'UserData',browse) |
---|
[2] | 1046 | |
---|
| 1047 | %reads .nc subdirectoy and image numbers from the interface |
---|
| 1048 | subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf data |
---|
[45] | 1049 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
[2] | 1050 | if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') |
---|
| 1051 | ref_j=0; |
---|
| 1052 | else |
---|
[45] | 1053 | ref_j=str2double(get(handles.ref_j,'String')); |
---|
[2] | 1054 | end |
---|
[273] | 1055 | time=get(handles.ImaDoc,'UserData');%get the set of times |
---|
[2] | 1056 | if isempty(time) |
---|
| 1057 | time=[0 1]; |
---|
[112] | 1058 | end |
---|
[71] | 1059 | dt_unit=1000;%default |
---|
[2] | 1060 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
| 1061 | |
---|
[112] | 1062 | %eliminate the first pairs inconsistent with the position |
---|
| 1063 | if isempty(displ_num) |
---|
| 1064 | nbpair=0; |
---|
| 1065 | else |
---|
[2] | 1066 | nbpair=length(displ_num(1,:));%nbre of displayed pairs |
---|
| 1067 | if isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') |
---|
| 1068 | nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index |
---|
| 1069 | elseif isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') |
---|
| 1070 | nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index |
---|
| 1071 | end |
---|
[112] | 1072 | end |
---|
[2] | 1073 | nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 |
---|
| 1074 | |
---|
[112] | 1075 | %look for existing processed pairs involving the field at the middle of the series if civ1 will not |
---|
[2] | 1076 | % be performed, while the result is needed for next steps. |
---|
| 1077 | displ_pair={''}; |
---|
[273] | 1078 | select=ones(size(1:nbpair));%flag for displayed pairs =1 for display |
---|
[2] | 1079 | testpair=0; |
---|
[273] | 1080 | % case with no civ1 operation, netcdf files need to exist for reading |
---|
[2] | 1081 | if get(handles.CIV1,'Value')==0 % |
---|
[112] | 1082 | if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir') |
---|
| 1083 | msgbox_uvmat('ERROR',['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist']); |
---|
| 1084 | set(handles.list_pair_civ1,'String',{}); |
---|
| 1085 | return |
---|
[2] | 1086 | end |
---|
[112] | 1087 | for ipair=1:nbpair |
---|
[2] | 1088 | filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... |
---|
[112] | 1089 | ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); |
---|
[273] | 1090 | select(ipair)=exist(filename,'file')==2;% put flag to 0 if the file does not exist |
---|
| 1091 | end |
---|
| 1092 | % case of no displayed pair |
---|
| 1093 | if isequal(select,zeros(size(1:nbpair))) |
---|
| 1094 | if isfield(browse,'incr_pair') && ~isequal(browse.incr_pair,[0 0]) |
---|
[2] | 1095 | num_i1=ref_i-floor(browse.incr_pair(1)/2); |
---|
| 1096 | num_i2=ref_i+ceil(browse.incr_pair(1)/2); |
---|
| 1097 | num_j1=ref_j-floor(browse.incr_pair(2)/2); |
---|
| 1098 | num_j2=ref_j+ceil(browse.incr_pair(2)/2); |
---|
| 1099 | filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ1); |
---|
| 1100 | select(1)=exist(filename,'file')==2; |
---|
| 1101 | testpair=1; |
---|
| 1102 | else |
---|
[112] | 1103 | if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') |
---|
[2] | 1104 | msgbox_uvmat('ERROR',['no civ1 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ1]); |
---|
| 1105 | else |
---|
| 1106 | msgbox_uvmat('ERROR',['no civ1 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ1]); |
---|
| 1107 | end |
---|
[112] | 1108 | set(handles.list_pair_civ1,'String',{''}); |
---|
| 1109 | %COMPLETER CAS STEREO |
---|
[2] | 1110 | return |
---|
| 1111 | end |
---|
| 1112 | end |
---|
| 1113 | end |
---|
| 1114 | if isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') |
---|
| 1115 | if testpair |
---|
[73] | 1116 | displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; |
---|
[2] | 1117 | else |
---|
[73] | 1118 | for ipair=1:nbpair |
---|
| 1119 | if select(ipair) |
---|
| 1120 | if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
| 1121 | 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 |
---|
| 1122 | displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
| 1123 | else |
---|
| 1124 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1125 | end |
---|
| 1126 | end |
---|
| 1127 | end |
---|
[2] | 1128 | end |
---|
| 1129 | elseif isequal(mode,'series(Dj)')%|isequal(mode,'st_series(Dj)')% series on the j index |
---|
| 1130 | if testpair |
---|
[112] | 1131 | displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; |
---|
[2] | 1132 | else |
---|
[112] | 1133 | for ipair=1:nbpair |
---|
| 1134 | if select(ipair) |
---|
| 1135 | if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
| 1136 | 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 |
---|
| 1137 | displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
| 1138 | end |
---|
| 1139 | elseif testpair |
---|
| 1140 | displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(2)/2)) '|' num2str(ceil(browse.incr_pair(2)/2))]; |
---|
| 1141 | else |
---|
| 1142 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1143 | end |
---|
| 1144 | end |
---|
| 1145 | end |
---|
[2] | 1146 | elseif isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')%case of pairs |
---|
| 1147 | for ipair=1:nbpair |
---|
| 1148 | if select(ipair) |
---|
[112] | 1149 | 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 |
---|
| 1150 | displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair),nom_type_ima) '-' num2stra(displ_num(2,ipair),nom_type_ima) ... |
---|
| 1151 | ' :dt= ' num2str(dt*1000)]; |
---|
| 1152 | else |
---|
| 1153 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1154 | end |
---|
| 1155 | end |
---|
[2] | 1156 | elseif isequal(mode,'displacement') |
---|
[112] | 1157 | displ_pair={'Di=Dj=0'}; |
---|
| 1158 | end |
---|
[2] | 1159 | set(handles.list_pair_civ1,'String',displ_pair'); |
---|
[229] | 1160 | ichoice=find(select,1); |
---|
[45] | 1161 | if (isempty(ichoice) || ichoice < 1); ichoice=1; end; |
---|
| 1162 | initial=get(handles.list_pair_civ1,'Value');%initial choice of pair |
---|
[112] | 1163 | if initial>nbpair |
---|
| 1164 | set(handles.list_pair_civ1,'Value',ichoice);% first valid pair proposed by default in the menu |
---|
[45] | 1165 | end |
---|
| 1166 | if numel(select)>=initial && ~isequal(select(initial),1) |
---|
[2] | 1167 | set(handles.list_pair_civ1,'Value',ichoice);% first valid pair proposed by default in the menu |
---|
| 1168 | end |
---|
[45] | 1169 | |
---|
[2] | 1170 | %set(handles.list_pair_civ2,'String',displ_pair'); |
---|
| 1171 | initial=get(handles.list_pair_civ2,'Value'); |
---|
| 1172 | if initial>length(displ_pair')%|~isequal(select(initial),1) |
---|
| 1173 | if ichoice <= length(displ_pair') |
---|
| 1174 | set(handles.list_pair_civ2,'Value',ichoice);% same pair proposed by default for civ2 |
---|
| 1175 | else |
---|
| 1176 | set(handles.list_pair_civ2,'Value',1);% same pair proposed by default for civ2 |
---|
| 1177 | end |
---|
| 1178 | end |
---|
| 1179 | set(handles.list_pair_civ2,'String',displ_pair'); |
---|
| 1180 | set(gcf,'Pointer','arrow') |
---|
[12] | 1181 | |
---|
| 1182 | %------------------------------------------------------------------------ |
---|
[112] | 1183 | % determine the menu for civ2 pairs depending on the existing netcdf file at the |
---|
| 1184 | %middle of the series set by first_i, incr, last_i |
---|
[2] | 1185 | function find_netcpair_civ2(hObject, eventdata, handles) |
---|
[12] | 1186 | %------------------------------------------------------------------------ |
---|
[2] | 1187 | set(gcf,'Pointer','watch') |
---|
| 1188 | %nomenclature types |
---|
[71] | 1189 | filebase=get(handles.RootName,'String'); |
---|
[2] | 1190 | [filepath,Nme,ext_dir]=fileparts(filebase); |
---|
[273] | 1191 | browse=get(handles.RootName,'UserData'); |
---|
[2] | 1192 | compare_list=get(handles.compare,'String'); |
---|
| 1193 | val=get(handles.compare,'Value'); |
---|
| 1194 | compare=compare_list{val}; |
---|
| 1195 | if strcmp(compare,'displacement') |
---|
| 1196 | mode='displacement'; |
---|
| 1197 | else |
---|
[275] | 1198 | mode_list=get(handles.CivMode,'String'); |
---|
[270] | 1199 | if isempty(mode_list) |
---|
| 1200 | msgbox_uvmat('ERROR','please enter an input image or netcdf file') |
---|
| 1201 | return |
---|
| 1202 | end |
---|
[275] | 1203 | mode_value=get(handles.CivMode,'Value'); |
---|
[2] | 1204 | mode=mode_list{mode_value}; |
---|
| 1205 | end |
---|
| 1206 | |
---|
| 1207 | % nomenclature type of the .nc files |
---|
| 1208 | nom_type_ima='ima_num';%default |
---|
| 1209 | if isfield(browse,'nom_type_ima') |
---|
| 1210 | nom_type_ima=browse.nom_type_ima; |
---|
| 1211 | end |
---|
| 1212 | nom_type_nc='_i1-i2';%default |
---|
| 1213 | if isfield(browse,'nom_type_nc') |
---|
| 1214 | nom_type_nc=browse.nom_type_nc; |
---|
| 1215 | end |
---|
[94] | 1216 | 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') |
---|
[2] | 1217 | nom_type_nc='netc_old';%nom_type for the netcdf files |
---|
[94] | 1218 | elseif isequal(nom_type_ima,'none')||isequal(nom_type_nc,'none') |
---|
[2] | 1219 | nom_type_nc='none'; |
---|
[94] | 1220 | elseif isequal(nom_type_ima,'avi')||isequal(nom_type_ima,'_i')||isequal(nom_type_ima,'ima_num')||isequal(nom_type_nc,'_i1-i2') |
---|
[112] | 1221 | nom_type_nc='_i1-i2'; |
---|
[2] | 1222 | else |
---|
| 1223 | if isequal(mode,'series(Di)')%|isequal(mode,'st_series(Di)') |
---|
| 1224 | nom_type_nc='_i1-i2_j'; % PIV in volume |
---|
| 1225 | else |
---|
| 1226 | nom_type_nc='_i_j1-j2'; |
---|
[112] | 1227 | end |
---|
[2] | 1228 | end |
---|
| 1229 | browse.nom_type_nc=nom_type_nc; |
---|
[273] | 1230 | set(handles.RootName,'UserData',browse) |
---|
[2] | 1231 | |
---|
| 1232 | %reads .nc subdirectory and image numbers from the interface |
---|
| 1233 | subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf data |
---|
| 1234 | subdir_civ2=get(handles.subdir_civ2,'String');%subdirectory subdir_civ2 for the netcdf data |
---|
[45] | 1235 | % first_i=str2num(get(handles.first_i,'String')); |
---|
| 1236 | % last_i=str2num(get(handles.last_i,'String')); |
---|
| 1237 | % incr=str2num(get(handles.incr_i,'String')); |
---|
| 1238 | % num1=first_i:incr:last_i; |
---|
| 1239 | % if isempty(num1) |
---|
| 1240 | % set(handles.list_pair_civ2,'Value',1); |
---|
| 1241 | % set(handles.list_pair_civ2,'String',{''}); |
---|
| 1242 | % return |
---|
| 1243 | % end |
---|
[273] | 1244 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
[2] | 1245 | if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') |
---|
| 1246 | ref_j=0; |
---|
| 1247 | else |
---|
[273] | 1248 | ref_j=str2double(get(handles.ref_j,'String')); |
---|
[2] | 1249 | end |
---|
[273] | 1250 | time=get(handles.ImaDoc,'UserData'); %get the set of times |
---|
[2] | 1251 | if isempty(time) |
---|
| 1252 | time=[0 1];%default |
---|
| 1253 | end |
---|
[71] | 1254 | %dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file |
---|
[73] | 1255 | %dt_unit=1000; |
---|
[2] | 1256 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
| 1257 | |
---|
| 1258 | |
---|
[112] | 1259 | %eliminate the first pairs inconsistent with the position |
---|
[2] | 1260 | if isempty(displ_num) |
---|
| 1261 | nbpair=0; |
---|
| 1262 | else |
---|
| 1263 | nbpair=length(displ_num(1,:));%nbre of displayed pairs |
---|
[112] | 1264 | if isequal(mode,'series(Di)')% | isequal(mode,'st_series(Di)') |
---|
[2] | 1265 | nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index |
---|
[112] | 1266 | elseif isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') |
---|
[2] | 1267 | nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index |
---|
| 1268 | end |
---|
| 1269 | end |
---|
| 1270 | nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 |
---|
| 1271 | |
---|
[112] | 1272 | %look for existing processed pairs involving the field at the middle of the series if civ1 will not |
---|
[2] | 1273 | % be performed, while the result is needed for next steps. |
---|
| 1274 | displ_pair={''}; %default |
---|
| 1275 | select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs |
---|
| 1276 | if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0%&... |
---|
[112] | 1277 | if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir') |
---|
| 1278 | errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist']) |
---|
| 1279 | set(handles.list_pair_civ2,'Value',1); |
---|
| 1280 | set(handles.list_pair_civ2,'String',{''}); |
---|
| 1281 | return |
---|
[2] | 1282 | end |
---|
[112] | 1283 | for ipair=1:nbpair |
---|
[2] | 1284 | filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... |
---|
[112] | 1285 | ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); |
---|
[2] | 1286 | select(ipair)=exist(filename,'file')==2; |
---|
| 1287 | end |
---|
| 1288 | if isequal(select,zeros(size(1:nbpair))) |
---|
[112] | 1289 | if isfield(browse,'incr_pair') |
---|
[2] | 1290 | num_i1=ref_i-floor(browse.incr_pair(1)/2); |
---|
| 1291 | num_i2=ref_i+floor((browse.incr_pair(1)+1)/2); |
---|
| 1292 | num_j1=ref_j-floor(browse.incr_pair(2)/2); |
---|
| 1293 | num_j2=ref_j+floor((browse.incr_pair(2)+1)/2); |
---|
| 1294 | filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ2); |
---|
| 1295 | select(1)=exist(filename,'file')==2; |
---|
| 1296 | else |
---|
[112] | 1297 | if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') |
---|
[2] | 1298 | errordlg(['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2]) |
---|
| 1299 | else |
---|
| 1300 | errordlg(['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2]) |
---|
| 1301 | end |
---|
[112] | 1302 | set(handles.list_pair_civ2,'Value',1); |
---|
| 1303 | set(handles.list_pair_civ2,'String',{''}); |
---|
[2] | 1304 | return |
---|
| 1305 | end |
---|
| 1306 | end |
---|
| 1307 | end |
---|
[112] | 1308 | if isequal(mode,'series(Di)') % | isequal(mode,'st_series(Di)') |
---|
| 1309 | for ipair=1:nbpair |
---|
| 1310 | if select(ipair) |
---|
| 1311 | if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
[2] | 1312 | 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 |
---|
| 1313 | displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
[112] | 1314 | end |
---|
| 1315 | else |
---|
| 1316 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1317 | end |
---|
| 1318 | end |
---|
[2] | 1319 | elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') % series on the j index |
---|
[112] | 1320 | for ipair=1:nbpair |
---|
| 1321 | if select(ipair) |
---|
| 1322 | if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
| 1323 | 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 |
---|
| 1324 | displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
| 1325 | end |
---|
| 1326 | else |
---|
| 1327 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1328 | end |
---|
| 1329 | end |
---|
[2] | 1330 | elseif isequal(mode,'pair j1-j2')% | isequal(mode,'st_pair j1-j2') %case of pairs |
---|
| 1331 | for ipair=1:nbpair |
---|
| 1332 | if select(ipair) |
---|
[112] | 1333 | 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 |
---|
| 1334 | displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair),nom_type_ima) '-' num2stra(displ_num(2,ipair),nom_type_ima) ... |
---|
| 1335 | ' :dt= ' num2str(dt*1000)]; |
---|
| 1336 | else |
---|
| 1337 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1338 | end |
---|
| 1339 | end |
---|
[2] | 1340 | elseif isequal(mode,'displacement') |
---|
[112] | 1341 | displ_pair={'Di=Dj=0'}; |
---|
| 1342 | end |
---|
[2] | 1343 | val=get(handles.list_pair_civ2,'Value'); |
---|
[229] | 1344 | ichoice=find(select,1); |
---|
[137] | 1345 | if (isempty(ichoice) || ichoice < 1); ichoice=1; end; |
---|
| 1346 | if get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0 |
---|
[2] | 1347 | val=ichoice;% first valid pair proposed by default in the menu |
---|
| 1348 | end |
---|
| 1349 | if val>length(displ_pair') |
---|
| 1350 | set(handles.list_pair_civ2,'Value',1);% first valid pair proposed by default in the menu |
---|
| 1351 | else |
---|
| 1352 | set(handles.list_pair_civ2,'Value',val); |
---|
| 1353 | end |
---|
| 1354 | set(handles.list_pair_civ2,'String',displ_pair'); |
---|
[12] | 1355 | set(gcf,'Pointer','arrow') |
---|
[2] | 1356 | |
---|
| 1357 | |
---|
[41] | 1358 | |
---|
[227] | 1359 | |
---|
[12] | 1360 | %------------------------------------------------------------------------ |
---|
[2] | 1361 | % --- Executes on selection change in list_pair_civ1. |
---|
| 1362 | function list_pair_civ1_Callback(hObject, eventdata, handles) |
---|
[12] | 1363 | %------------------------------------------------------------------------ |
---|
[2] | 1364 | %reproduce by default the chosen pair in the civ2 menu |
---|
| 1365 | list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs |
---|
| 1366 | index_pair=get(handles.list_pair_civ1,'Value'); |
---|
| 1367 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
[137] | 1368 | % num_a=displ_num(1,index_pair); |
---|
| 1369 | % num_b=displ_num(2,index_pair); |
---|
[2] | 1370 | list_pair2=get(handles.list_pair_civ2,'String');%get the menu of image pairs |
---|
| 1371 | if index_pair<=length(list_pair2) |
---|
| 1372 | set(handles.list_pair_civ2,'Value',index_pair); |
---|
| 1373 | end |
---|
| 1374 | |
---|
[112] | 1375 | %update first_i and last_i according to the chosen image pairs |
---|
[273] | 1376 | mode_list=get(handles.CivMode,'String'); |
---|
| 1377 | mode_value=get(handles.CivMode,'Value'); |
---|
[2] | 1378 | mode=mode_list{mode_value}; |
---|
| 1379 | if isequal(mode,'series(Di)') |
---|
[137] | 1380 | first_i=str2double(get(handles.first_i,'String')); |
---|
| 1381 | last_i=str2double(get(handles.last_i,'String')); |
---|
| 1382 | incr_i=str2double(get(handles.incr_i,'String')); |
---|
[2] | 1383 | num1=first_i:incr_i:last_i; |
---|
[137] | 1384 | lastfield=str2double(get(handles.nb_field,'String')); |
---|
| 1385 | if ~isnan(lastfield) |
---|
[229] | 1386 | test_find=(num1-floor(index_pair/2)*ones(size(num1))>0)& ... |
---|
| 1387 | (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield); |
---|
| 1388 | num1=num1(test_find); |
---|
[2] | 1389 | end |
---|
| 1390 | set(handles.first_i,'String',num2str(num1(1))); |
---|
| 1391 | set(handles.last_i,'String',num2str(num1(end))); |
---|
| 1392 | elseif isequal(mode,'series(Dj)') |
---|
[137] | 1393 | first_j=str2double(get(handles.first_j,'String')); |
---|
| 1394 | last_j=str2double(get(handles.last_j,'String')); |
---|
| 1395 | incr_j=str2double(get(handles.incr_j,'String')); |
---|
[2] | 1396 | num_j=first_j:incr_j:last_j; |
---|
[137] | 1397 | lastfield2=str2double(get(handles.nb_field2,'String')); |
---|
| 1398 | if ~isnan(lastfield2) |
---|
[229] | 1399 | test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... |
---|
| 1400 | (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2); |
---|
| 1401 | num1=num_j(test_find); |
---|
[2] | 1402 | end |
---|
| 1403 | set(handles.first_j,'String',num2str(num1(1))); |
---|
| 1404 | set(handles.last_j,'String',num2str(num1(end))); |
---|
[112] | 1405 | end |
---|
[2] | 1406 | |
---|
[12] | 1407 | %------------------------------------------------------------------------ |
---|
[2] | 1408 | % --- Executes on selection change in list_pair_civ2. |
---|
| 1409 | function list_pair_civ2_Callback(hObject, eventdata, handles) |
---|
[12] | 1410 | %------------------------------------------------------------------------ |
---|
[112] | 1411 | index_pair=get(handles.list_pair_civ2,'Value');%get the selected position index in the menu |
---|
[2] | 1412 | |
---|
[112] | 1413 | %update first_i and last_i according to the chosen image pairs |
---|
[273] | 1414 | mode_list=get(handles.CivMode,'String'); |
---|
| 1415 | mode_value=get(handles.CivMode,'Value'); |
---|
[2] | 1416 | mode=mode_list{mode_value}; |
---|
| 1417 | if isequal(mode,'series(Di)') |
---|
[137] | 1418 | first_i=str2double(get(handles.first_i,'String')); |
---|
| 1419 | last_i=str2double(get(handles.last_i,'String')); |
---|
| 1420 | incr_i=str2double(get(handles.incr_i,'String')); |
---|
[2] | 1421 | num1=first_i:incr_i:last_i; |
---|
[137] | 1422 | lastfield=str2double(get(handles.nb_field,'String')); |
---|
| 1423 | if ~isnan(lastfield) |
---|
[229] | 1424 | test_find=(num1-floor(index_pair/2)*ones(size(num1))>0)& ... |
---|
| 1425 | (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield); |
---|
| 1426 | num1=num1(test_find); |
---|
[2] | 1427 | end |
---|
| 1428 | set(handles.first_i,'String',num2str(num1(1))); |
---|
| 1429 | set(handles.last_i,'String',num2str(num1(end))); |
---|
| 1430 | elseif isequal(mode,'series(Dj)') |
---|
[137] | 1431 | first_j=str2double(get(handles.first_j,'String')); |
---|
| 1432 | last_j=str2double(get(handles.last_j,'String')); |
---|
| 1433 | incr_j=str2double(get(handles.incr_j,'String')); |
---|
[2] | 1434 | num_j=first_j:incr_j:last_j; |
---|
[137] | 1435 | lastfield2=str2double(get(handles.nb_field2,'String')); |
---|
| 1436 | if ~isnan(lastfield2) |
---|
[229] | 1437 | test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... |
---|
| 1438 | (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2); |
---|
| 1439 | num1=num_j(test_find); |
---|
[2] | 1440 | end |
---|
| 1441 | set(handles.first_j,'String',num2str(num1(1))); |
---|
| 1442 | set(handles.last_j,'String',num2str(num1(end))); |
---|
[112] | 1443 | end |
---|
[2] | 1444 | |
---|
[177] | 1445 | %------------------------------------------------------------------------ |
---|
| 1446 | % --- Executes on button press in RUN: processing on local computer |
---|
[67] | 1447 | function RUN_Callback(hObject, eventdata, handles) |
---|
| 1448 | %------------------------------------------------------------------------ |
---|
[73] | 1449 | set(handles.RUN, 'Enable','Off') |
---|
| 1450 | set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) |
---|
[67] | 1451 | batch=0; |
---|
[229] | 1452 | errormsg=launch_jobs(hObject, eventdata, handles,batch); |
---|
[73] | 1453 | set(handles.RUN, 'Enable','On') |
---|
| 1454 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
[36] | 1455 | |
---|
[177] | 1456 | % start status callback to visualise results |
---|
[229] | 1457 | if ~isempty(errormsg) |
---|
| 1458 | display(errormsg) |
---|
| 1459 | msgbox_uvmat('ERROR',errormsg) |
---|
[257] | 1460 | elseif isfield(handles,'status') %&& ~isequal(get(handles.CivMode,'Value'),3) |
---|
[225] | 1461 | set(handles.status,'Value',1);%suppress status display |
---|
| 1462 | status_Callback(hObject, eventdata, handles) |
---|
[178] | 1463 | end |
---|
[177] | 1464 | |
---|
[12] | 1465 | %------------------------------------------------------------------------ |
---|
[2] | 1466 | % --- Executes on button press in BATCH: remote processing |
---|
| 1467 | function BATCH_Callback(hObject, eventdata, handles) |
---|
[177] | 1468 | % ----------------------------------------------------------------------- |
---|
[73] | 1469 | set(handles.BATCH, 'Enable','Off') |
---|
| 1470 | set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784]) |
---|
[67] | 1471 | batch=1; |
---|
[229] | 1472 | errormsg=launch_jobs(hObject, eventdata, handles, batch); |
---|
[73] | 1473 | set(handles.BATCH, 'Enable','On') |
---|
| 1474 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
[67] | 1475 | |
---|
[177] | 1476 | % start status callback to visualise results |
---|
[229] | 1477 | if ~isempty(errormsg) |
---|
| 1478 | display(errormsg) |
---|
| 1479 | msgbox_uvmat('ERROR',errormsg) |
---|
| 1480 | elseif isfield(handles,'status') |
---|
| 1481 | set(handles.status,'Value',1);%suppress status display |
---|
| 1482 | status_Callback(hObject, eventdata, handles) |
---|
[178] | 1483 | end |
---|
[227] | 1484 | |
---|
[67] | 1485 | %------------------------------------------------------------------------ |
---|
[133] | 1486 | % --- Lauch command called by RUN and BATCH: remote processing |
---|
[229] | 1487 | function errormsg=launch_jobs(hObject, eventdata, handles, batch) |
---|
[67] | 1488 | %----------------------------------------------------------------------- |
---|
[229] | 1489 | errormsg='';%default |
---|
[272] | 1490 | |
---|
| 1491 | |
---|
[133] | 1492 | %% check the selected list of operations: |
---|
[2] | 1493 | operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'}; |
---|
| 1494 | box_test(1)=get(handles.CIV1,'Value'); |
---|
| 1495 | box_test(2)=get(handles.FIX1,'Value'); |
---|
| 1496 | box_test(3)=get(handles.PATCH1,'Value'); |
---|
| 1497 | box_test(4)=get(handles.CIV2,'Value'); |
---|
| 1498 | box_test(5)=get(handles.FIX2,'Value'); |
---|
| 1499 | box_test(6)=get(handles.PATCH2,'Value'); |
---|
[180] | 1500 | index_first=find(box_test==1,1); |
---|
| 1501 | if isempty(index_first) |
---|
[229] | 1502 | errormsg='no selected operation'; |
---|
[2] | 1503 | return |
---|
| 1504 | end |
---|
[180] | 1505 | index_last=find(box_test==1,1,'last'); |
---|
[159] | 1506 | box_used=box_test(index_first : index_last); |
---|
[2] | 1507 | [box_missing,ind_missing]=min(box_used); |
---|
[180] | 1508 | if isequal(box_missing,0); %there is a missing step in the sequence of operations |
---|
[229] | 1509 | errormsg=['missing' cell2mat(operations(ind_missing))]; |
---|
[2] | 1510 | return |
---|
| 1511 | end |
---|
| 1512 | |
---|
[272] | 1513 | %% check mask if selecetd |
---|
| 1514 | %could be included in get_mask callback ? |
---|
[276] | 1515 | if isequal(get(handles.check_Mask,'Value'),1) |
---|
| 1516 | maskname=get(handles.txt_MaskName,'String'); |
---|
[12] | 1517 | if ~exist(maskname,'file') |
---|
| 1518 | get_mask_civ1_Callback(hObject, eventdata, handles); |
---|
| 1519 | end |
---|
[2] | 1520 | end |
---|
| 1521 | if isequal(get(handles.get_mask_fix1,'Value'),1) |
---|
[12] | 1522 | maskname=get(handles.mask_fix1,'String'); |
---|
| 1523 | if ~exist(maskname,'file') |
---|
| 1524 | get_mask_fix1_Callback(hObject, eventdata, handles); |
---|
| 1525 | end |
---|
[2] | 1526 | end |
---|
[276] | 1527 | if isequal(get(handles.check_Mask,'Value'),1) |
---|
| 1528 | maskname=get(handles.txt_Mask,'String'); |
---|
[12] | 1529 | if ~exist(maskname,'file') |
---|
[112] | 1530 | get_mask_civ2_Callback(hObject, eventdata, handles); |
---|
[12] | 1531 | end |
---|
[2] | 1532 | end |
---|
| 1533 | if isequal(get(handles.get_mask_fix2,'Value'),1) |
---|
[12] | 1534 | maskname=get(handles.mask_fix2,'String'); |
---|
| 1535 | if ~exist(maskname,'file') |
---|
[112] | 1536 | get_mask_fix2_Callback(hObject, eventdata, handles); |
---|
[12] | 1537 | end |
---|
[2] | 1538 | end |
---|
| 1539 | |
---|
[177] | 1540 | %% reinitialise status callback |
---|
[178] | 1541 | if isfield(handles,'status') |
---|
[180] | 1542 | set(handles.status,'Value',0);%suppress status display |
---|
| 1543 | status_Callback(hObject, eventdata, handles) |
---|
[178] | 1544 | end |
---|
[133] | 1545 | |
---|
| 1546 | %% set the list of files and check them |
---|
| 1547 | display('checking the files...') |
---|
[227] | 1548 | [ref_i,ref_j,errormsg]=find_ref_indices(handles); |
---|
| 1549 | if ~isempty(errormsg) |
---|
| 1550 | return |
---|
| 1551 | end |
---|
[263] | 1552 | [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,xx,yy,compare]=... |
---|
[273] | 1553 | set_civ_filenames(handles,ref_i,ref_j,box_test); |
---|
[274] | 1554 | % ADDED |
---|
| 1555 | [Rootbat,Filebat]=fileparts(filecell.nc.civ1{1,1});%output netcdf file (without extention) |
---|
| 1556 | %ADDED |
---|
[177] | 1557 | set(handles.civ,'UserData',filecell);%store for futur use of status callback |
---|
[137] | 1558 | if isempty(filecell)% (error message displayed in fct set_civ_filenames) |
---|
[133] | 1559 | return |
---|
| 1560 | end |
---|
| 1561 | nbfield=numel(num1_civ1); |
---|
| 1562 | nbslice=numel(num_a_civ1); |
---|
| 1563 | |
---|
[272] | 1564 | %% read the PARAM.xml file to get the binaries (and batch_mode if batch) |
---|
[276] | 1565 | path_civ=fileparts(which('civ')); %path to the source directory of uvmat |
---|
[112] | 1566 | xmlfile='PARAM.xml'; |
---|
[133] | 1567 | if exist(xmlfile,'file')% search parameter xml file in the whole matlab path |
---|
[54] | 1568 | t=xmltree(xmlfile); |
---|
[67] | 1569 | s=convert(t); |
---|
[272] | 1570 | else |
---|
| 1571 | errormsg=['no file ' xmlfile]; |
---|
| 1572 | return |
---|
[2] | 1573 | end |
---|
[272] | 1574 | |
---|
| 1575 | test_interp=0; %eviter les variables test_ (LG) |
---|
| 1576 | |
---|
[127] | 1577 | if batch |
---|
[67] | 1578 | if isfield(s,'BatchParam') |
---|
[272] | 1579 | param.global=s.BatchParam; |
---|
| 1580 | if isfield(param.global,'BatchMode') |
---|
| 1581 | batch_mode=param.global.BatchMode; |
---|
[257] | 1582 | if ~ismember(batch_mode,{'sge','oar'}) |
---|
| 1583 | errormsg=['batch mode ' batch_mode ' not supported by UVMAT']; |
---|
| 1584 | return |
---|
| 1585 | end |
---|
[67] | 1586 | end |
---|
| 1587 | else |
---|
[229] | 1588 | errormsg='no batch civ binaries defined in PARAM.xml'; |
---|
[67] | 1589 | return |
---|
| 1590 | end |
---|
[257] | 1591 | else % run |
---|
[67] | 1592 | if isfield(s,'RunParam') |
---|
[272] | 1593 | param.global=s.RunParam; |
---|
[67] | 1594 | else |
---|
[225] | 1595 | msgbox_uvmat('ERROR','no run civ binaries defined in PARAM.xml') |
---|
[67] | 1596 | return |
---|
| 1597 | end |
---|
[225] | 1598 | end |
---|
[238] | 1599 | |
---|
[272] | 1600 | %% check batch mode supported |
---|
| 1601 | if batch |
---|
| 1602 | switch batch_mode |
---|
| 1603 | case 'sge' |
---|
| 1604 | test_command='qstat'; |
---|
| 1605 | case 'oar' |
---|
| 1606 | test_command='oartat'; |
---|
| 1607 | end |
---|
| 1608 | [s,w]=system(test_command); |
---|
| 1609 | if ~isequal(s,0) |
---|
| 1610 | msgbox_uvmat('ERROR',[batch_mode ' batch system not available']) |
---|
| 1611 | return |
---|
| 1612 | end |
---|
| 1613 | end |
---|
| 1614 | |
---|
| 1615 | %% check if the binaries exist |
---|
[273] | 1616 | if isequal(get(handles.Matlab,'checked'),'on') |
---|
| 1617 | CivMode='Matlab'; |
---|
| 1618 | else |
---|
| 1619 | CivMode='CivX'; |
---|
| 1620 | end |
---|
[280] | 1621 | binary_list={}; |
---|
[257] | 1622 | switch CivMode |
---|
[280] | 1623 | case 'CivX' |
---|
| 1624 | binary_list={'Civ1Bin','Civ2Bin','PatchBin','FixBin'}; |
---|
| 1625 | case 'CivAll' |
---|
| 1626 | binary_list={'Civ'} |
---|
[257] | 1627 | case 'Matlab' |
---|
| 1628 | if batch |
---|
[272] | 1629 | % vérifier Matlab installé sur le cluster |
---|
| 1630 | % difficile a faire a priori |
---|
[257] | 1631 | end |
---|
[225] | 1632 | end |
---|
[280] | 1633 | for bin_name=binary_list |
---|
| 1634 | if isfield(param.global,bin_name{1}) |
---|
| 1635 | if ~exist(param.global.(bin_name{1}),'file')%look for the full path if the file name has been defined with a relative path in PARAM.xml |
---|
| 1636 | fullname=fullfile(path_civ,param.global.(bin_name{1})); |
---|
| 1637 | if exist(fullname,'file') |
---|
| 1638 | param.global.(bin_name{1})=fullname; |
---|
| 1639 | else |
---|
| 1640 | msgbox_uvmat('ERROR',['Binary ' param.global.(bin_name{1}) ' defined in PARAM.xml does not exist']) |
---|
| 1641 | return |
---|
| 1642 | end |
---|
| 1643 | else |
---|
| 1644 | [path,name,ext]=fileparts(param.global.(bin_name{1})); |
---|
| 1645 | currentdir=pwd; |
---|
| 1646 | cd(path); |
---|
| 1647 | binpath=pwd;%path of the binary |
---|
| 1648 | param.global.(bin_name{1})=fullfile(binpath,[name ext]); |
---|
| 1649 | % display(param.global.(bin_name{1})); |
---|
| 1650 | cd(currentdir); |
---|
| 1651 | end |
---|
| 1652 | |
---|
| 1653 | end |
---|
| 1654 | end |
---|
[2] | 1655 | |
---|
[272] | 1656 | display('files OK, processing...') |
---|
[2] | 1657 | |
---|
[272] | 1658 | %% get civ1 parameters |
---|
| 1659 | if box_test(1) |
---|
| 1660 | param.civ1=read_param_civ1(handles,filecell); |
---|
[112] | 1661 | end |
---|
[2] | 1662 | |
---|
[272] | 1663 | %% get fix1 parameters |
---|
| 1664 | if box_test(2) |
---|
[275] | 1665 | param.fix1=read_param_fix1(handles,filecell); |
---|
[2] | 1666 | end |
---|
[112] | 1667 | |
---|
[274] | 1668 | %% get patch1 parameters |
---|
[272] | 1669 | if box_test(3) |
---|
[274] | 1670 | param.Patch1=read_panel(handles.panel_Patch1); |
---|
| 1671 | %param.patch1=read_param_patch1(handles) |
---|
[112] | 1672 | end |
---|
| 1673 | |
---|
[133] | 1674 | %% get civ2 parameters: |
---|
[272] | 1675 | if box_test(4) |
---|
| 1676 | param.civ2=read_param_civ2(handles,cell2mat(filecell.ima1.civ2(1,1))); |
---|
[2] | 1677 | end |
---|
| 1678 | |
---|
[133] | 1679 | %% get fix2 parameters |
---|
[272] | 1680 | if box_test(5) |
---|
[2] | 1681 | flagindex2(1)=get(handles.vec_Fmin2_2, 'Value'); |
---|
| 1682 | flagindex2(2)=get(handles.vec_F3_2, 'Value'); |
---|
| 1683 | flagindex2(3)=get(handles.vec_F4, 'Value'); |
---|
[127] | 1684 | thresh_vec2C=str2double(get(handles.thresh_vec2C,'String'));%threshold on image correlation vec_C |
---|
| 1685 | thresh_vel2=str2double(get(handles.thresh_vel2,'String'));%threshold on velocity modulus |
---|
[2] | 1686 | test_mask=get(handles.get_mask_fix2,'Value'); |
---|
| 1687 | nbslice_mask=get(handles.mask_fix2,'UserData'); % get the number of slices (= number of masks) |
---|
[112] | 1688 | %%%%%%%%%%%%%COMPLETER LE PROGRAMME FIX AVEC REF FILE ET OPTION inf_sup=2 |
---|
| 1689 | % inf_sup=get(handles.inf_sup2,'Value'); |
---|
| 1690 | % ref=get(handles.ref_fix2,'UserData'); |
---|
| 1691 | |
---|
[2] | 1692 | %%%%%%%%%%%%%%%%%%% |
---|
| 1693 | end |
---|
| 1694 | |
---|
[133] | 1695 | %% get patch2 parameters |
---|
[2] | 1696 | if box_test(6)==1 |
---|
[274] | 1697 | param.Patch2=read_panel(handles.panel_Patch1); |
---|
[2] | 1698 | end |
---|
| 1699 | |
---|
[272] | 1700 | %% |
---|
| 1701 | |
---|
| 1702 | |
---|
[133] | 1703 | %% MAIN LOOP |
---|
[273] | 1704 | time=get(handles.ImaDoc,'UserData'); %get the set of times |
---|
[265] | 1705 | |
---|
[134] | 1706 | super_cmd=[]; |
---|
[269] | 1707 | batch_file_list=[]; |
---|
[265] | 1708 | |
---|
[2] | 1709 | for ifile=1:nbfield |
---|
| 1710 | for j=1:nbslice |
---|
[257] | 1711 | % initiate system command |
---|
| 1712 | switch CivMode |
---|
| 1713 | case 'CivX' |
---|
| 1714 | if isunix % check: necessaire aussi en RUN? |
---|
[272] | 1715 | cmd=['#!/bin/bash \n '... |
---|
| 1716 | '#$ -cwd \n '... |
---|
| 1717 | 'hostname && date \n '... |
---|
| 1718 | 'umask 002 \n'];%allow writting access to created files for user group |
---|
| 1719 | else |
---|
| 1720 | cmd=[]; |
---|
[257] | 1721 | end |
---|
| 1722 | case 'CivAll' |
---|
| 1723 | % if CivAll |
---|
| 1724 | CivAllxml=xmltree;% xml contents, all parameters |
---|
| 1725 | CivAllCmd=''; |
---|
| 1726 | CivAllxml=set(CivAllxml,1,'name','CivDoc'); |
---|
[2] | 1727 | end |
---|
[272] | 1728 | |
---|
| 1729 | |
---|
| 1730 | % define output file name |
---|
| 1731 | if box_test(4)==1 || box_test(5)==1 || box_test(6)==1 |
---|
| 1732 | OutputFile=filecell.nc.civ2{ifile,j}; |
---|
| 1733 | else |
---|
| 1734 | OutputFile=filecell.nc.civ1{ifile,j}; |
---|
| 1735 | end |
---|
| 1736 | OutputFile=regexprep(OutputFile,'.nc',''); |
---|
[269] | 1737 | |
---|
[2] | 1738 | |
---|
[112] | 1739 | %CIV1 |
---|
[272] | 1740 | if box_test(1) |
---|
| 1741 | % read image-dependent parameters |
---|
| 1742 | param.civ1.filename_ima_a=filecell.ima1.civ1{ifile,j}; |
---|
| 1743 | param.civ1.filename_ima_b=filecell.ima2.civ1{ifile,j}; |
---|
| 1744 | param.civ1.Dt=num2str(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j))); |
---|
| 1745 | param.civ1.T0=num2str((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2); |
---|
| 1746 | param.civ1.term_a=num2stra(num_a_civ1(j),nom_type_nc);%UTILITE? |
---|
| 1747 | param.civ1.term_b=num2stra(num_b_civ1(j),nom_type_nc);% |
---|
| 1748 | |
---|
| 1749 | % read mask parameters |
---|
[280] | 1750 | dummy=get(handles.check_Mask,'Value'); |
---|
| 1751 | if dummy{1} |
---|
[276] | 1752 | maskdispl=get(handles.txt_MaskName,'String'); |
---|
[12] | 1753 | if exist(maskdispl,'file') |
---|
[272] | 1754 | param.civ1.maskname=maskdispl; |
---|
| 1755 | param.civ1.maskflag='y'; |
---|
[2] | 1756 | else |
---|
[136] | 1757 | maskbase=[filecell.filebase '_' maskdispl]; % |
---|
[137] | 1758 | nbslice_mask=str2double(maskdispl(1:end-4)); % |
---|
[12] | 1759 | num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; |
---|
[272] | 1760 | param.civ1.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
| 1761 | if exist(param.civ1.maskname,'file') |
---|
| 1762 | param.civ1.maskflag='y'; |
---|
[12] | 1763 | else |
---|
[272] | 1764 | param.civ1.maskname='noFile use default'; |
---|
| 1765 | param.civ1.maskflag='n'; |
---|
[12] | 1766 | end |
---|
[2] | 1767 | end |
---|
[272] | 1768 | else |
---|
| 1769 | param.civ1.maskname='noFile use default'; |
---|
| 1770 | param.civ1.maskflag='n'; |
---|
[2] | 1771 | end |
---|
[272] | 1772 | |
---|
| 1773 | % read grid parameters |
---|
[280] | 1774 | dummy=get(handles.check_Grid,'Value'); |
---|
| 1775 | if dummy{1} |
---|
[272] | 1776 | param.civ1.gridflag='y'; |
---|
[276] | 1777 | gridname=get(handles.txt_GridName,'String'); |
---|
[2] | 1778 | if isequal(gridname(end-3:end),'grid') |
---|
[137] | 1779 | nbslice_grid=str2double(gridname(1:end-4)); % |
---|
| 1780 | if ~isnan(nbslice_grid) |
---|
[2] | 1781 | num1_grid=mod(num1_civ1(ifile)-1,nbslice_grid)+1; |
---|
[272] | 1782 | param.civ1.gridname=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
| 1783 | if ~exist(param.civ1.gridname,'file') |
---|
[112] | 1784 | msgbox_uvmat('ERROR','grid file absent for civ1') |
---|
[2] | 1785 | end |
---|
| 1786 | elseif exist(gridname,'file') |
---|
[272] | 1787 | param.civ1.gridname=gridname; |
---|
[2] | 1788 | else |
---|
| 1789 | msgbox_uvmat('ERROR','grid file absent for civ1') |
---|
| 1790 | end |
---|
| 1791 | end |
---|
| 1792 | else |
---|
[272] | 1793 | param.civ1.gridname='noFile use default'; |
---|
| 1794 | param.civ1.gridflag='n'; |
---|
[2] | 1795 | end |
---|
[257] | 1796 | |
---|
| 1797 | switch CivMode |
---|
| 1798 | case 'CivX' |
---|
[272] | 1799 | civ1_exe=CIV1_CMD(filecell.nc.civ1{ifile,j},param);%create the parameter file .civ1.cmx and set the execution string civ1_exe |
---|
[257] | 1800 | cmd=[cmd civ1_exe '\n']; |
---|
| 1801 | case 'CivAll' |
---|
| 1802 | CivAllCmd=[CivAllCmd ' civ1 ']; |
---|
[272] | 1803 | str=CIV1_CMD_Unified(filecell.nc.civ1{ifile,j},'',param.civ1); |
---|
[257] | 1804 | fieldnames=fields(str); |
---|
| 1805 | [CivAllxml,uid_civ1]=add(CivAllxml,1,'element','civ1'); |
---|
| 1806 | for ilist=1:length(fieldnames) |
---|
| 1807 | val=eval(['str.' fieldnames{ilist}]); |
---|
| 1808 | if ischar(val) |
---|
| 1809 | [CivAllxml,uid_t]=add(CivAllxml,uid_civ1,'element',fieldnames{ilist}); |
---|
| 1810 | [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val); |
---|
| 1811 | end |
---|
[112] | 1812 | end |
---|
[2] | 1813 | end |
---|
| 1814 | end |
---|
| 1815 | |
---|
[112] | 1816 | % FIX1 |
---|
[272] | 1817 | if box_test(2) |
---|
| 1818 | switch CivMode |
---|
[257] | 1819 | case 'CivX' |
---|
| 1820 | if isunix %unix system |
---|
[272] | 1821 | cmd_FIX=[param.global.FixBin ' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(param.fix1.flagindex1(1)) ... |
---|
| 1822 | ' -fi2 ' num2str(param.fix1.flagindex1(2)) ' -fi3 ' num2str(param.fix1.flagindex1(3)) ... |
---|
| 1823 | ' -threshC ' num2str(param.fix1.thresh_vecC1) ' -threshV ' num2str(param.fix1.thresh_vel1) ' -maskName ' param.fix1.maskname]; |
---|
[257] | 1824 | else %windows system |
---|
[272] | 1825 | cmd_FIX=['"' param.global.FixBin '" -f "' filecell.nc.civ1{ifile,j} '" -fi1 ' num2str(param.fix1.flagindex1(1)) ... |
---|
| 1826 | ' -fi2 ' num2str(param.fix1.flagindex1(2)) ' -fi3 ' num2str(param.fix1.flagindex1(3)) ... |
---|
| 1827 | ' -threshC ' num2str(param.fix1.thresh_vecC1) ' -threshV ' num2str(param.fix1.thresh_vel1) ' -maskName "' param.fix1.maskname '"']; |
---|
[257] | 1828 | cmd_FIX=regexprep(cmd_FIX,'\\','\\\\'); |
---|
[112] | 1829 | end |
---|
[257] | 1830 | cmd=[cmd cmd_FIX '\n']; |
---|
| 1831 | case 'CivAll' |
---|
| 1832 | fix1.inputFileName=filecell.nc.civ1{ifile,j} ; |
---|
[272] | 1833 | fix1.fi1=num2str(param.fix1.flagindex1(1)); |
---|
| 1834 | fix1.fi2=num2str(param.fix1.flagindex1(2)); |
---|
| 1835 | fix1.fi3=num2str(param.fix1.flagindex1(3)); |
---|
| 1836 | fix1.threshC=num2str(param.fix1.thresh_vecC1); |
---|
| 1837 | fix1.threshV=num2str(param.fix1.thresh_vel1); |
---|
[257] | 1838 | fieldnames=fields(fix1); |
---|
| 1839 | [CivAllxml,uid_fix1]=add(CivAllxml,1,'element','fix1'); |
---|
| 1840 | for ilist=1:length(fieldnames) |
---|
| 1841 | val=eval(['fix1.' fieldnames{ilist}]); |
---|
| 1842 | if ischar(val) |
---|
| 1843 | [CivAllxml,uid_t]=add(CivAllxml,uid_fix1,'element',fieldnames{ilist}); |
---|
| 1844 | [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val); |
---|
| 1845 | end |
---|
| 1846 | end |
---|
| 1847 | CivAllCmd=[CivAllCmd ' fix1 ']; |
---|
[112] | 1848 | end |
---|
| 1849 | end |
---|
| 1850 | |
---|
| 1851 | %PATCH1 |
---|
| 1852 | if box_test(3)==1 |
---|
[257] | 1853 | switch CivMode |
---|
| 1854 | case 'CivX' |
---|
[274] | 1855 | cmd_PATCH=cmd_patch(filecell.nc.civ1{ifile,j},param.Patch1,param.global.PatchBin); |
---|
[257] | 1856 | cmd=[cmd cmd_PATCH '\n']; |
---|
| 1857 | case 'CivAll' |
---|
| 1858 | patch1.inputFileName=filecell.nc.civ1{ifile,j} ; |
---|
| 1859 | patch1.nopt=subdomain_patch1; |
---|
| 1860 | patch1.maxdiff=thresh_patch1; |
---|
| 1861 | patch1.ro=rho_patch1; |
---|
| 1862 | test_grid=get(handles.get_gridpatch1,'Value'); |
---|
| 1863 | if test_grid |
---|
| 1864 | patch1.gridflag='y'; |
---|
| 1865 | gridname=get(handles.grid_patch1,'String'); |
---|
| 1866 | if isequal(gridname(end-3:end),'grid') |
---|
| 1867 | nbslice_grid=str2double(gridname(1:end-4)); % |
---|
| 1868 | if ~isnan(nbslice_grid) |
---|
| 1869 | num1_grid=mod(num1_civ1(ifile)-1,nbslice_grid)+1; |
---|
| 1870 | patch1.gridPatch=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
| 1871 | if ~exist(patch1.gridPatch,'file') |
---|
| 1872 | msgbox_uvmat('ERROR','grid file absent for patch1') |
---|
| 1873 | end |
---|
| 1874 | elseif exist(gridname,'file') |
---|
| 1875 | patch1.gridPatch=gridname; |
---|
| 1876 | else |
---|
[112] | 1877 | msgbox_uvmat('ERROR','grid file absent for patch1') |
---|
| 1878 | end |
---|
[2] | 1879 | end |
---|
[257] | 1880 | else |
---|
| 1881 | patch1.gridPatch='none'; |
---|
| 1882 | patch1.gridflag='n'; |
---|
| 1883 | patch1.m=nx_patch1; |
---|
| 1884 | patch1.n=ny_patch1; |
---|
[2] | 1885 | end |
---|
[257] | 1886 | patch1.convectFlow='n'; |
---|
| 1887 | fieldnames=fields(patch1); |
---|
| 1888 | [CivAllxml,uid_patch1]=add(CivAllxml,1,'element','patch1'); |
---|
| 1889 | for ilist=1:length(fieldnames) |
---|
| 1890 | val=eval(['patch1.' fieldnames{ilist}]); |
---|
| 1891 | if ischar(val) |
---|
| 1892 | [CivAllxml,uid_t]=add(CivAllxml,uid_patch1,'element',fieldnames{ilist}); |
---|
| 1893 | [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val); |
---|
| 1894 | end |
---|
[112] | 1895 | end |
---|
[257] | 1896 | CivAllCmd=[CivAllCmd ' patch1 ']; |
---|
[112] | 1897 | end |
---|
[2] | 1898 | end |
---|
[112] | 1899 | if box_test(4)==1 |
---|
[272] | 1900 | param.civ2.filename_ima_a=filecell.ima1.civ2{ifile,j}; |
---|
| 1901 | param.civ2.filename_ima_b=filecell.ima2.civ2{ifile,j}; |
---|
| 1902 | param.civ2.Dt=num2str(time(num2_civ2(ifile),num_b_civ2(j))-time(num1_civ2(ifile),num_a_civ2(j))); |
---|
| 1903 | param.civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2); |
---|
| 1904 | param.civ2.term_a=num2stra(num_a_civ2(j),nom_type_nc); |
---|
| 1905 | param.civ2.term_b=num2stra(num_b_civ2(j),nom_type_nc); |
---|
| 1906 | param.civ2.filename_nc1=filecell.nc.civ1{ifile,j}; |
---|
| 1907 | param.civ2.filename_nc1(end-2:end)=[]; % remove '.nc' |
---|
[276] | 1908 | test_mask=get(handles.check_Mask,'Value'); |
---|
[112] | 1909 | if test_mask==0 |
---|
[272] | 1910 | param.civ2.maskname='noFile use default'; |
---|
| 1911 | param.civ2.maskflag='n'; |
---|
[2] | 1912 | else |
---|
[276] | 1913 | maskdispl=get(handles.txt_Mask,'String'); |
---|
[12] | 1914 | if exist(maskdispl,'file') |
---|
[272] | 1915 | param.civ2.maskname=maskdispl; |
---|
| 1916 | param.civ2.maskflag='y'; |
---|
[2] | 1917 | else |
---|
[136] | 1918 | maskbase=[filecell.filebase '_' maskdispl]; % |
---|
[137] | 1919 | nbslice_mask=str2double(maskdispl(1:end-4)); % |
---|
[12] | 1920 | num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; |
---|
[272] | 1921 | param.civ2.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
| 1922 | if exist(param.civ2.maskname,'file') |
---|
| 1923 | param.civ2.maskflag='y'; |
---|
[12] | 1924 | else |
---|
[272] | 1925 | param.civ2.maskname='noFile use default'; |
---|
| 1926 | param.civ2.maskflag='n'; |
---|
[12] | 1927 | end |
---|
[2] | 1928 | end |
---|
| 1929 | end |
---|
[276] | 1930 | gridname=get(handles.txt_GridName,'String'); |
---|
[2] | 1931 | if numel(gridname)>=4 && isequal(gridname(end-3:end),'grid') |
---|
[137] | 1932 | nbslice_grid=str2double(gridname(1:end-4)); % |
---|
| 1933 | if ~isnan(nbslice_grid) |
---|
[272] | 1934 | param.civ2.gridflag='y'; |
---|
[2] | 1935 | num1_grid=mod(num1_civ2(ifile)-1,nbslice_grid)+1; |
---|
[272] | 1936 | param.civ2.gridname=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
| 1937 | if exist(param.civ2.gridname,'file') |
---|
| 1938 | param.civ2.gridflag='y'; |
---|
[2] | 1939 | else |
---|
[272] | 1940 | param.civ2.gridname='noFile use default'; |
---|
| 1941 | param.civ2.gridflag='n'; |
---|
[2] | 1942 | end |
---|
| 1943 | elseif exist(gridname,'file') |
---|
[272] | 1944 | param.civ2.gridflag='y'; |
---|
[2] | 1945 | else |
---|
[272] | 1946 | param.civ2.gridname='noFile use default'; |
---|
| 1947 | param.civ2.gridflag='n'; |
---|
[2] | 1948 | end |
---|
| 1949 | end |
---|
[257] | 1950 | switch CivMode |
---|
| 1951 | case 'CivX' |
---|
[275] | 1952 | cmd_CIV2=CIV2_CMD(filecell.nc.civ2{ifile,j},param);%creates the cmx file [fullfile(Rootbat,Filebat) '.civ2.cmx] |
---|
[257] | 1953 | cmd=[cmd cmd_CIV2 '\n']; |
---|
| 1954 | case 'CivAll' |
---|
| 1955 | CivAllCmd=[CivAllCmd ' civ2 ']; |
---|
[272] | 1956 | str=CIV2_CMD_Unified(filecell.nc.civ2{ifile,j},'',param.civ2); |
---|
[257] | 1957 | fieldnames=fields(str); |
---|
| 1958 | [CivAllxml,uid_civ2]=add(CivAllxml,1,'element','civ2'); |
---|
| 1959 | for ilist=1:length(fieldnames) |
---|
| 1960 | val=eval(['str.' fieldnames{ilist}]); |
---|
| 1961 | if ischar(val) |
---|
| 1962 | [CivAllxml,uid_t]=add(CivAllxml,uid_civ2,'element',fieldnames{ilist}); |
---|
| 1963 | [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val); |
---|
| 1964 | end |
---|
[2] | 1965 | end |
---|
| 1966 | end |
---|
[112] | 1967 | end |
---|
| 1968 | |
---|
| 1969 | % FIX2 |
---|
| 1970 | if box_test(5)==1 |
---|
| 1971 | test_mask=get(handles.get_mask_fix2,'Value'); |
---|
| 1972 | if test_mask==0 |
---|
| 1973 | maskname=''; %no mask used |
---|
[2] | 1974 | else |
---|
| 1975 | maskdispl=get(handles.mask_fix2,'String'); |
---|
[136] | 1976 | maskbase=[filecell.filebase '_' maskdispl]; % |
---|
[137] | 1977 | nbslice_mask=str2double(maskdispl(1:end-4)); % |
---|
[2] | 1978 | num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; |
---|
| 1979 | maskname =name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
[112] | 1980 | end |
---|
[257] | 1981 | switch CivMode |
---|
| 1982 | case 'CivX' |
---|
| 1983 | if isunix |
---|
[272] | 1984 | cmd_FIX=[param.global.FixBin ' -f ' filecell.nc.civ2{ifile,j} ' -fi1 ' num2str(flagindex2(1)) ... |
---|
[257] | 1985 | ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ... |
---|
| 1986 | ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname]; |
---|
| 1987 | else |
---|
[272] | 1988 | cmd_FIX=['"' param.global.FixBin '" -f "' filecell.nc.civ2{ifile,j} '" -fi1 ' num2str(flagindex2(1)) ... |
---|
[257] | 1989 | ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ... |
---|
| 1990 | ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName "' maskname '"']; |
---|
| 1991 | cmd_FIX=regexprep(cmd_FIX,'\\','\\\\'); |
---|
[112] | 1992 | end |
---|
[257] | 1993 | cmd=[cmd cmd_FIX '\n']; |
---|
| 1994 | case 'CivAll' |
---|
| 1995 | fix2.inputFileName=filecell.nc.civ2{ifile,j} ; |
---|
| 1996 | fix2.fi1=num2str(flagindex2(1)); |
---|
| 1997 | fix2.fi2=num2str(flagindex2(2)); |
---|
| 1998 | fix2.fi3=num2str(flagindex2(3)); |
---|
| 1999 | fix2.threshC=num2str(thresh_vec2C); |
---|
| 2000 | fix2.threshV=num2str(thresh_vel2); |
---|
| 2001 | fieldnames=fields(fix2); |
---|
| 2002 | [CivAllxml,uid_fix2]=add(CivAllxml,1,'element','fix2'); |
---|
| 2003 | for ilist=1:length(fieldnames) |
---|
| 2004 | val=eval(['fix2.' fieldnames{ilist}]); |
---|
| 2005 | if ischar(val) |
---|
| 2006 | [CivAllxml,uid_t]=add(CivAllxml,uid_fix2,'element',fieldnames{ilist}); |
---|
| 2007 | [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val); |
---|
| 2008 | end |
---|
| 2009 | end |
---|
| 2010 | CivAllCmd=[CivAllCmd ' fix2 ']; |
---|
[112] | 2011 | end |
---|
| 2012 | end |
---|
| 2013 | |
---|
| 2014 | %PATCH2 |
---|
| 2015 | if box_test(6)==1 |
---|
[257] | 2016 | switch CivMode |
---|
| 2017 | case 'CivX' |
---|
[275] | 2018 | cmd_PATCH=cmd_patch(filecell.nc.civ2{ifile,j},param.Patch2,param.global.PatchBin); |
---|
[257] | 2019 | cmd=[cmd cmd_PATCH '\n']; |
---|
| 2020 | case 'CivAll' |
---|
| 2021 | patch2.inputFileName=filecell.nc.civ1{ifile,j} ; |
---|
| 2022 | patch2.nopt=subdomain_patch2; |
---|
| 2023 | patch2.maxdiff=thresh_patch2; |
---|
| 2024 | patch2.ro=rho_patch2; |
---|
| 2025 | test_grid=get(handles.get_gridpatch2,'Value'); |
---|
| 2026 | if test_grid |
---|
| 2027 | patch2.gridflag='y'; |
---|
| 2028 | gridname=get(handles.grid_patch2,'String'); |
---|
| 2029 | if isequal(gridname(end-3:end),'grid') |
---|
| 2030 | nbslice_grid=str2double(gridname(1:end-4)); % |
---|
| 2031 | if ~isnan(nbslice_grid) |
---|
| 2032 | num1_grid=mod(num1_civ2(ifile)-1,nbslice_grid)+1; |
---|
| 2033 | patch2.gridPatch=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
| 2034 | if ~exist(patch2.gridPatch,'file') |
---|
| 2035 | msgbox_uvmat('ERROR','grid file absent for patch2') |
---|
| 2036 | end |
---|
| 2037 | elseif exist(gridname,'file') |
---|
| 2038 | patch2.gridPatch=gridname; |
---|
| 2039 | else |
---|
[112] | 2040 | msgbox_uvmat('ERROR','grid file absent for patch2') |
---|
[12] | 2041 | end |
---|
[2] | 2042 | end |
---|
[257] | 2043 | else |
---|
| 2044 | patch2.gridPatch='none'; |
---|
| 2045 | patch2.gridflag='n'; |
---|
| 2046 | patch2.m=nx_patch2; |
---|
| 2047 | patch2.n=ny_patch2; |
---|
[2] | 2048 | end |
---|
[257] | 2049 | patch2.convectFlow='n'; |
---|
| 2050 | fieldnames=fields(patch2); |
---|
| 2051 | [CivAllxml,uid_patch2]=add(CivAllxml,1,'element','patch2'); |
---|
| 2052 | for ilist=1:length(fieldnames) |
---|
| 2053 | val=eval(['patch2.' fieldnames{ilist}]); |
---|
| 2054 | if ischar(val) |
---|
| 2055 | [CivAllxml,uid_t]=add(CivAllxml,uid_patch2,'element',fieldnames{ilist}); |
---|
| 2056 | [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val); |
---|
| 2057 | end |
---|
[112] | 2058 | end |
---|
[257] | 2059 | CivAllCmd=[CivAllCmd ' patch2 ']; |
---|
[112] | 2060 | end |
---|
[12] | 2061 | end |
---|
[257] | 2062 | |
---|
| 2063 | switch CivMode |
---|
| 2064 | case {'CivX','CivAll'} |
---|
| 2065 | if isequal(CivMode,'CivAll') |
---|
[272] | 2066 | save(CivAllxml,[OutputFile '.xml']); |
---|
| 2067 | cmd=[cmd sparam.CivBin ' -f ' OutputFile '.xml ' CivAllCmd ' >' OutputFile '.log' '\n']; |
---|
[238] | 2068 | end |
---|
[272] | 2069 | |
---|
| 2070 | % create the .bat file used in run or batch |
---|
| 2071 | filename_bat=[OutputFile '.bat']; |
---|
[257] | 2072 | [fid,message]=fopen(filename_bat,'w'); |
---|
| 2073 | if isequal(fid,-1) |
---|
| 2074 | msgbox_uvmat('ERROR', ['creation of .bat file: ' message]) |
---|
| 2075 | return |
---|
[238] | 2076 | end |
---|
[257] | 2077 | fprintf(fid,cmd); |
---|
| 2078 | fclose(fid); |
---|
[269] | 2079 | |
---|
[279] | 2080 | if isunix |
---|
| 2081 | system(['chmod +x ' filename_bat]); |
---|
| 2082 | end |
---|
| 2083 | |
---|
[269] | 2084 | batch_file_list{length(batch_file_list)+1}=filename_bat; |
---|
| 2085 | |
---|
| 2086 | % if batch |
---|
| 2087 | % switch batch_mode |
---|
| 2088 | % case 'sge' |
---|
| 2089 | % display(['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]); |
---|
| 2090 | % eval( ['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]); |
---|
| 2091 | % case 'oar' |
---|
| 2092 | % % eval( ['!chmod +x ' filename_bat]); |
---|
| 2093 | % % %eval( ['!oarsub -n CIVX -l /core=1,walltime=00:10:00 ' filename_bat]); |
---|
| 2094 | % % eval( ['!oarsub -n CIVX -l "/core=1+{type = ''smalljob''}/licence=1,walltime=00:10:00" ' filename_bat]); |
---|
| 2095 | % |
---|
| 2096 | % cmd_str=['sh ' filename_bat]; |
---|
| 2097 | % super_cmd{length(super_cmd)+1}=cmd_str; |
---|
| 2098 | % |
---|
| 2099 | % end |
---|
| 2100 | % else |
---|
| 2101 | % %% to lauch the jobs locally : |
---|
| 2102 | % if(isunix) |
---|
| 2103 | % cmd_str=['. ' filename_bat]; |
---|
| 2104 | % else %case of Windows |
---|
| 2105 | % cmd_str=['@call "' regexprep(filename_bat,'\\','\\\\') '"']; |
---|
| 2106 | % end |
---|
| 2107 | % super_cmd=[super_cmd cmd_str '\n']; |
---|
| 2108 | % disp(cmd_str); |
---|
| 2109 | % end |
---|
[257] | 2110 | case 'Matlab' |
---|
| 2111 | drawnow |
---|
| 2112 | if box_test(1)==1 |
---|
[272] | 2113 | Param.Civ1=param.civ1; |
---|
[252] | 2114 | end |
---|
[257] | 2115 | if box_test(2)==1 |
---|
| 2116 | fix1.WarnFlags=[]; |
---|
| 2117 | if get(handles.vec_Fmin2,'Value') |
---|
| 2118 | fix1.WarnFlags=[fix1.WarnFlags -2]; |
---|
| 2119 | end |
---|
| 2120 | if get(handles.vec_F3,'Value') |
---|
| 2121 | fix1.WarnFlags=[fix1.WarnFlags 3]; |
---|
| 2122 | end |
---|
| 2123 | fix1.LowerBoundCorr=thresh_vecC1; |
---|
| 2124 | if get(handles.inf_sup1,'Value') |
---|
| 2125 | fix1.UppperBoundVel=thresh_vel1; |
---|
| 2126 | else |
---|
| 2127 | fix1.LowerBoundVel=thresh_vel1; |
---|
| 2128 | end |
---|
| 2129 | if get(handles.get_mask_fix1,'Value') |
---|
| 2130 | fix1.MaskName=maskname; |
---|
| 2131 | end |
---|
| 2132 | Param.Fix1=fix1; |
---|
[252] | 2133 | end |
---|
[257] | 2134 | if box_test(3)==1 |
---|
[263] | 2135 | if strcmp(compare,'stereo PIV') |
---|
| 2136 | filebase_A=filecell.filebase; |
---|
| 2137 | [pp,ff]=fileparts(filebase_A); |
---|
| 2138 | filebase_B=fullfile(pp,get(handles.RootName_1,'String')); |
---|
| 2139 | RUN_STLIN(filecell.ncA.civ1{ifile,j},filecell.nc.civ1{ifile,j},'civ1',filecell.st{ifile,j},... |
---|
| 2140 | str2num(nx_patch1),str2num(ny_patch1),str2num(thresh_patch1),[filebase_A '.xml'],[filebase_B '.xml']) |
---|
| 2141 | else |
---|
| 2142 | Param.Patch1.Rho=rho_patch1; |
---|
| 2143 | Param.Patch1.Threshold=thresh_patch1; |
---|
| 2144 | Param.Patch1.SubDomain=subdomain_patch1; |
---|
| 2145 | end |
---|
[257] | 2146 | end |
---|
| 2147 | if box_test(4)==1 |
---|
[272] | 2148 | Param.Civ2=param.civ2; |
---|
[257] | 2149 | end |
---|
| 2150 | if box_test(5)==1 |
---|
| 2151 | fix2.WarnFlags=[]; |
---|
| 2152 | if get(handles.vec_Fmin2_2,'Value') |
---|
| 2153 | fix2.WarnFlags=[fix2.WarnFlags -2]; |
---|
| 2154 | end |
---|
| 2155 | if get(handles.vec_F4,'Value') |
---|
| 2156 | fix2.WarnFlags=[fix2.WarnFlags 4]; |
---|
| 2157 | end |
---|
| 2158 | if get(handles.vec_F3_2,'Value') |
---|
| 2159 | fix2.WarnFlags=[fix2.WarnFlags 3]; |
---|
| 2160 | end |
---|
| 2161 | fix2.LowerBoundCorr=thresh_vec2C; |
---|
| 2162 | if get(handles.inf_sup2,'Value') |
---|
| 2163 | fix2.UppperBoundVel=thresh_vel2; |
---|
| 2164 | else |
---|
| 2165 | fix2.LowerBoundVel=thresh_vel2; |
---|
| 2166 | end |
---|
| 2167 | if get(handles.get_mask_fix2,'Value') |
---|
| 2168 | fix2.MaskName=maskname; |
---|
| 2169 | end |
---|
| 2170 | Param.Fix2=fix2; |
---|
| 2171 | end |
---|
[263] | 2172 | if box_test(6)==1 |
---|
| 2173 | if strcmp(compare,'stereo PIV') |
---|
| 2174 | filebase_A=filecell.filebase; |
---|
| 2175 | [pp,ff]=fileparts(filebase_A); |
---|
| 2176 | filebase_B=fullfile(pp,get(handles.RootName_1,'String')); |
---|
| 2177 | RUN_STLIN(filecell.ncA.civ2{ifile,j},filecell.nc.civ2{ifile,j},'civ2',filecell.st{ifile,j},... |
---|
| 2178 | str2num(nx_patch2),str2num(ny_patch2),str2num(thresh_patch2),[filebase_A '.xml'],[filebase_B '.xml']) |
---|
[270] | 2179 | else |
---|
| 2180 | Param.Patch2.Rho=rho_patch2; |
---|
| 2181 | Param.Patch2.Threshold=thresh_patch2; |
---|
| 2182 | Param.Patch2.SubDomain=subdomain_patch2; |
---|
[263] | 2183 | end |
---|
[257] | 2184 | end |
---|
[263] | 2185 | if ~strcmp(compare,'stereo PIV') |
---|
| 2186 | [Data,erromsg]=civ_uvmat(Param,filecell.nc.civ1{ifile,j}); |
---|
| 2187 | if isempty(errormsg) |
---|
| 2188 | display([filecell.nc.civ1{ifile,j} ' written']) |
---|
| 2189 | else |
---|
| 2190 | msgbox_uvmat('ERROR',errormsg) |
---|
| 2191 | end |
---|
[270] | 2192 | |
---|
[263] | 2193 | end |
---|
[257] | 2194 | end |
---|
[112] | 2195 | end |
---|
[2] | 2196 | end |
---|
[134] | 2197 | |
---|
[265] | 2198 | if batch |
---|
[269] | 2199 | switch batch_mode |
---|
| 2200 | case 'sge' |
---|
| 2201 | for p=1:length(batch_file_list) |
---|
| 2202 | cmd=['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' batch_file_list{p}]; |
---|
| 2203 | display(cmd);eval(cmd); |
---|
| 2204 | end |
---|
[279] | 2205 | case 'oar_old' |
---|
| 2206 | for p=1:length(batch_file_list) |
---|
| 2207 | oar_command=['!oarsub -n CIVX -q nicejob '... |
---|
| 2208 | '-E ' regexprep(batch_file_list{p},'.bat','.errors') ' -O ' regexprep(batch_file_list{p},'.bat','.log ')... |
---|
| 2209 | '-l "/core=1+{type = ''smalljob''}/licence=1,walltime=00:60:00" ' batch_file_list{p}]; |
---|
| 2210 | display(oar_command);eval(oar_command); |
---|
[265] | 2211 | end |
---|
[279] | 2212 | |
---|
| 2213 | |
---|
| 2214 | case 'oar_perl' |
---|
| 2215 | filename_joblist=fullfile(Rootbat,'job_list.txt'); |
---|
| 2216 | fid=fopen(filename_joblist,'w'); |
---|
| 2217 | |
---|
| 2218 | for p=1:length(batch_file_list) |
---|
| 2219 | oar_command=['oarsub -n CIVX '... |
---|
| 2220 | '-l "/core=1,walltime=00:10:00" ' batch_file_list{p}]; |
---|
| 2221 | fprintf(fid,[oar_command '\n']); |
---|
[265] | 2222 | end |
---|
[279] | 2223 | fclose(fid) |
---|
| 2224 | oar_command=['oarsub -t container -n civx-container -l /core=24,walltime=00:35:00 "/fsnet/data/legi/calcul9/home/gostiaux/Documents/MATLAB/uvmat_dev/oar-dispatch -f '... |
---|
| 2225 | filename_joblist '"']; |
---|
| 2226 | filename_oarcommand=fullfile(Rootbat,'oar_command'); |
---|
| 2227 | fid=fopen(filename_oarcommand,'w'); |
---|
| 2228 | fprintf(fid,[oar_command '\n']); |
---|
| 2229 | fclose(fid); |
---|
| 2230 | % display(oar_command); |
---|
| 2231 | eval(['! . ' filename_oarcommand]); |
---|
| 2232 | |
---|
| 2233 | case 'oar'%'oar_mpi' |
---|
| 2234 | filename_joblist=fullfile(Rootbat,'job_list.txt'); |
---|
| 2235 | fid=fopen(filename_joblist,'w'); |
---|
| 2236 | |
---|
| 2237 | for p=1:length(batch_file_list) |
---|
| 2238 | fprintf(fid,[batch_file_list{p} '\n']); |
---|
[265] | 2239 | end |
---|
[279] | 2240 | fclose(fid) |
---|
| 2241 | |
---|
| 2242 | |
---|
| 2243 | % oarsub -S ./oar.sub |
---|
| 2244 | |
---|
| 2245 | |
---|
| 2246 | |
---|
| 2247 | |
---|
| 2248 | |
---|
| 2249 | % for p=0:floor(length(batch_file_list)/6); |
---|
| 2250 | % filename_batch_group=fullfile(Rootbat,['job_list_' num2str(p) '.bat']); |
---|
| 2251 | % fid=fopen(filename_batch_group,'w'); |
---|
| 2252 | % if fid==-1 |
---|
| 2253 | % msgbox_uvmat('ERROR',['cannot create the command file ' filename_superbat]) |
---|
| 2254 | % return |
---|
| 2255 | % end |
---|
| 2256 | % if p==floor(length(batch_file_list)/6) |
---|
| 2257 | % kmax=mod(length(batch_file_list),6); |
---|
| 2258 | % else |
---|
| 2259 | % kmax=6; |
---|
| 2260 | % end |
---|
| 2261 | % for k=1:kmax |
---|
| 2262 | % fprintf(fid,['sh ' batch_file_list{p*6+k} '\n']); |
---|
| 2263 | % end |
---|
| 2264 | % fclose(fid); |
---|
| 2265 | % system(['chmod +x ' filename_batch_group]); |
---|
| 2266 | % eval( ['!oarsub -n CIVX -q nicejob '... |
---|
| 2267 | % '-E ' flname '.errors -O ' flname '.log '... |
---|
| 2268 | % '-l "/core=1+{type = ''smalljob''}/licence=1,walltime=00:60:00" ' filename_batch_group]); |
---|
| 2269 | % end |
---|
[269] | 2270 | case 'oar_new' % to be develloped with Patrick Begou |
---|
| 2271 | filename_joblist=fullfile(Rootbat,'job_list.txt'); |
---|
| 2272 | fid=fopen(filename_superbat,'w'); |
---|
| 2273 | if fid==-1 |
---|
| 2274 | msgbox_uvmat('ERROR',['cannot create the command file ' filename_superbat]) |
---|
| 2275 | return |
---|
[265] | 2276 | end |
---|
[269] | 2277 | for p=1:length(batch_file_list) |
---|
| 2278 | fprintf(fid,[batch_file_list{p} '\n']); |
---|
| 2279 | end |
---|
| 2280 | fclose(fid); |
---|
| 2281 | walltime=datestr(length(super_cmd)*10/24/60,13); |
---|
| 2282 | eval( ['!oarsub -n CIVX -q nicejob -l "/core=1+{type = ''smalljob''}/licence=1,walltime=' walltime '" ' filename_superbat]); |
---|
| 2283 | end |
---|
| 2284 | else |
---|
| 2285 | if ~isequal(CivMode,'Matlab') |
---|
| 2286 | filename_superbat=fullfile(Rootbat,'job_list.bat'); |
---|
| 2287 | fid=fopen(filename_superbat,'w'); |
---|
| 2288 | if fid==-1 |
---|
| 2289 | msgbox_uvmat('ERROR',['cannot create the command file ' filename_superbat]) |
---|
| 2290 | return |
---|
| 2291 | end |
---|
| 2292 | for p=1:length(batch_file_list) |
---|
| 2293 | if isunix |
---|
| 2294 | fprintf(fid,['sh ' batch_file_list{p} '\n']); |
---|
| 2295 | else |
---|
| 2296 | fprintf(fid,['@call "' regexprep(filename_bat,'\\','\\\\') '"' '\n']); |
---|
[265] | 2297 | end |
---|
[269] | 2298 | end |
---|
| 2299 | fclose(fid); |
---|
| 2300 | if(isunix) |
---|
| 2301 | system(['chmod +x ' filename_superbat]); |
---|
| 2302 | end |
---|
| 2303 | system([filename_superbat ' &']);% execute main commmand |
---|
[265] | 2304 | end |
---|
[269] | 2305 | |
---|
[265] | 2306 | end |
---|
| 2307 | |
---|
[2] | 2308 | |
---|
[137] | 2309 | %% save interface state |
---|
[2] | 2310 | if isfield(filecell,'nc') |
---|
| 2311 | if isfield(filecell.nc,'civ2') |
---|
| 2312 | fileresu=filecell.nc.civ2{1,1}; |
---|
| 2313 | else |
---|
| 2314 | fileresu=filecell.nc.civ1{1,1}; |
---|
| 2315 | end |
---|
| 2316 | end |
---|
| 2317 | [RootPath,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileresu); |
---|
| 2318 | namedoc=fullfile(RootPath,subdir,RootFile); |
---|
[112] | 2319 | detect=1; |
---|
[2] | 2320 | while detect==1 |
---|
| 2321 | namefigfull=[namedoc '.fig']; |
---|
| 2322 | hh=dir(namefigfull); |
---|
| 2323 | if ~isempty(hh) |
---|
| 2324 | detect=1; |
---|
| 2325 | namedoc=[namedoc '.0']; |
---|
| 2326 | else |
---|
| 2327 | detect=0; |
---|
| 2328 | end |
---|
| 2329 | end |
---|
| 2330 | saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) |
---|
| 2331 | |
---|
[273] | 2332 | %Save info in personal profile (initiate browser next time) TODO |
---|
| 2333 | MenuFile={}; |
---|
| 2334 | dir_perso=prefdir; |
---|
| 2335 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
| 2336 | if exist(profil_perso,'file') |
---|
| 2337 | hh=load (profil_perso); |
---|
| 2338 | if isfield(hh,'MenuFile') |
---|
| 2339 | MenuFile=hh.MenuFile; |
---|
| 2340 | end |
---|
| 2341 | MenuFile=[filecell.ima1.civ1(1,1); MenuFile]; |
---|
| 2342 | save (profil_perso,'MenuFile','-append'); %store the file names for future opening of uvmat |
---|
| 2343 | else |
---|
| 2344 | MenuFile=filecell.ima1.civ1(1,1); |
---|
| 2345 | save (profil_perso,'MenuFile') |
---|
| 2346 | end |
---|
| 2347 | |
---|
| 2348 | |
---|
[227] | 2349 | %------------------------------------------------------------------------ |
---|
| 2350 | % --- determine the list of reference indices of processing file |
---|
| 2351 | function [ref_i,ref_j,errormsg]=find_ref_indices(handles) |
---|
| 2352 | %------------------------------------------------------------------------ |
---|
| 2353 | errormsg=''; %default error message |
---|
| 2354 | first_i=str2double(get(handles.first_i,'String'));%first index i |
---|
| 2355 | last_i=str2double(get(handles.last_i,'String'));%last index i |
---|
| 2356 | incr_i=str2double(get(handles.incr_i,'String'));% increment |
---|
| 2357 | if isequal(get(handles.first_j,'Visible'),'on') |
---|
| 2358 | first_j=str2double(get(handles.first_j,'String'));%first index j |
---|
| 2359 | last_j=str2double(get(handles.last_j,'String'));%last index j |
---|
| 2360 | incr_j=str2double(get(handles.incr_j,'String'));% increment |
---|
| 2361 | else |
---|
| 2362 | first_j=1; |
---|
| 2363 | last_j=1; |
---|
| 2364 | incr_j=1; |
---|
| 2365 | end |
---|
| 2366 | ref_i=first_i:incr_i:last_i;% list of i indices (reference values for each pair) |
---|
| 2367 | ref_j=first_j:incr_j:last_j;% list of j indices (reference values for each pair) |
---|
| 2368 | if isnan(first_i)||isnan(first_j) |
---|
| 2369 | errormsg='first field number not defined'; |
---|
| 2370 | elseif isnan(last_i)||isnan(last_j) |
---|
| 2371 | errormsg='last field number not defined'; |
---|
| 2372 | elseif isnan(incr_i)||isnan(incr_j) |
---|
| 2373 | errormsg='increment in field number not defined'; |
---|
| 2374 | elseif last_i < first_i || last_j < first_j |
---|
| 2375 | errormsg='last field number must be larger than the first one'; |
---|
| 2376 | end |
---|
[134] | 2377 | |
---|
[227] | 2378 | %------------------------------------------------------------------------ |
---|
| 2379 | % --- determine the list of filenames and indices needed for launch_job |
---|
[263] | 2380 | function [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2,compare]=... |
---|
[227] | 2381 | set_civ_filenames(handles,ref_i,ref_j,box_test) |
---|
[12] | 2382 | %------------------------------------------------------------------------ |
---|
[85] | 2383 | filecell=[];%default |
---|
[136] | 2384 | |
---|
| 2385 | %% get the root names nomenclature and numbers |
---|
[71] | 2386 | filebase=get(handles.RootName,'String'); |
---|
[136] | 2387 | |
---|
| 2388 | if isempty(filebase)||isequal(filebase,'') |
---|
| 2389 | msgbox_uvmat('ERROR','no input files') |
---|
| 2390 | return |
---|
| 2391 | end |
---|
| 2392 | |
---|
[137] | 2393 | %filebase=regexprep(filebase,'\.fsnet','fsnet');% temporary fix for cluster Coriolis |
---|
[136] | 2394 | filecell.filebase=filebase; |
---|
| 2395 | |
---|
[273] | 2396 | browse=get(handles.RootName,'UserData'); |
---|
[2] | 2397 | compare_list=get(handles.compare,'String'); |
---|
| 2398 | val=get(handles.compare,'Value'); |
---|
| 2399 | compare=compare_list{val}; |
---|
| 2400 | if strcmp(compare,'displacement') |
---|
| 2401 | mode='displacement'; |
---|
| 2402 | else |
---|
[273] | 2403 | mode_list=get(handles.CivMode,'String'); |
---|
| 2404 | mode_value=get(handles.CivMode,'Value'); |
---|
[2] | 2405 | mode=mode_list{mode_value}; |
---|
| 2406 | end |
---|
[137] | 2407 | %time=get(handles.RootName,'UserData'); %get the set of times |
---|
[71] | 2408 | ext_ima=get(handles.ImaExt,'String'); |
---|
[2] | 2409 | nom_type_nc=browse.nom_type_nc; |
---|
[122] | 2410 | if isfield(browse,'nom_type_ima') |
---|
| 2411 | nom_type_ima2=browse.nom_type_ima; |
---|
| 2412 | end |
---|
| 2413 | if isempty(nom_type_ima2),nom_type_ima2='1';end; %default |
---|
| 2414 | if isempty(nom_type_nc),nom_type_nc='_i1-i2';end; %default |
---|
[2] | 2415 | [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... |
---|
[227] | 2416 | find_pair_indices(handles,ref_i,ref_j,mode); |
---|
[273] | 2417 | %determine the new filebase for 'displacement' CivMode (comparison of two series) |
---|
[2] | 2418 | filebase_B=filebase;% root name of the second field series for stereo |
---|
| 2419 | if strcmp(compare,'displacement') || strcmp(compare,'stereo PIV') |
---|
[127] | 2420 | % test_disp=1; |
---|
[2] | 2421 | nom_type_ima1=browse.nom_type_ima_1; %nomenclature type of the second file series |
---|
| 2422 | [Path2,Name2]=fileparts(filebase_B); |
---|
| 2423 | Path1=Path2; |
---|
[71] | 2424 | Name1=get(handles.RootName_1,'String');% root name of the first field series for stereo |
---|
[2] | 2425 | filebase_A=fullfile(Path1,Name1); |
---|
| 2426 | if length(Name1)>6 |
---|
| 2427 | Name1=Name1(end-5:end); |
---|
| 2428 | end |
---|
| 2429 | if length(Name2)>6 |
---|
| 2430 | Name2=Name2(end-5:end); |
---|
| 2431 | end |
---|
| 2432 | filebase_AB=fullfile(Path2,[Name2 '-' Name1]); |
---|
| 2433 | else |
---|
[127] | 2434 | % test_disp=0; |
---|
[2] | 2435 | filebase_A=filebase; |
---|
| 2436 | nom_type_ima1=nom_type_ima2; |
---|
| 2437 | filebase_AB=filebase; |
---|
| 2438 | end |
---|
| 2439 | if strcmp(compare,'displacement') |
---|
[112] | 2440 | filebase_ima1=filebase_A; |
---|
| 2441 | filebase_ima2=filebase_B; |
---|
| 2442 | filebase_nc=filebase_AB; %root name for the result of civ2 |
---|
[2] | 2443 | else |
---|
[112] | 2444 | filebase_ima1=filebase_B; |
---|
| 2445 | filebase_ima2=filebase_B; |
---|
| 2446 | filebase_nc=filebase_B; |
---|
| 2447 | end |
---|
[2] | 2448 | |
---|
| 2449 | %determine reference files for fix: |
---|
| 2450 | file_ref_fix1={};%default |
---|
| 2451 | file_ref_fix2={}; |
---|
| 2452 | nbfield=length(num1_civ1); |
---|
| 2453 | nbslice=length(num_a_civ1); |
---|
| 2454 | if box_test(2)==1% fix1 performed |
---|
| 2455 | ref=get(handles.ref_fix1,'UserData');%read data on the ref file stored by get_ref_fix1_Callback |
---|
| 2456 | if ~isempty(ref) |
---|
[137] | 2457 | first_i=str2double(get(handles.first_i,'String')); |
---|
| 2458 | last_i=str2double(get(handles.last_i,'String')); |
---|
| 2459 | incr_i=str2double(get(handles.incr_i,'String')); |
---|
| 2460 | first_j=str2double(get(handles.first_j,'String')); |
---|
| 2461 | last_j=str2double(get(handles.last_j,'String')); |
---|
| 2462 | incr_j=str2double(get(handles.incr_j,'String')); |
---|
[127] | 2463 | num_i_ref=first_i:incr_i:last_i; |
---|
| 2464 | num_j_ref=first_j:incr_j:last_j; |
---|
[2] | 2465 | if isequal(mode,'displacement') |
---|
| 2466 | num_i1=num_i_ref; |
---|
| 2467 | num_i2=num_i_ref; |
---|
| 2468 | num_j1=num_j_ref; |
---|
| 2469 | num_j2=num_j_ref; |
---|
| 2470 | elseif isequal(mode,'pair j1-j2')% isequal(mode,'st_pair j1-j2') |
---|
| 2471 | num_i1=num_i_ref; |
---|
| 2472 | num_i2=num_i1; |
---|
| 2473 | num_j1=ref.num_a*ones(size(num_i_ref)); |
---|
| 2474 | num_j2=ref.num_b*ones(size(num_i_ref)); |
---|
| 2475 | elseif isequal(mode,'series(Di)') % isequal(mode,'st_series(Di)') |
---|
| 2476 | delta1=floor((ref.num2-ref.num1)/2); |
---|
| 2477 | delta2=ceil((ref.num2-ref.num1)/2); |
---|
| 2478 | num_i1=num_i_ref-delta1*ones(size(num_i_ref)); |
---|
| 2479 | num_i2=num_i_ref+delta2*ones(size(num_i_ref)); |
---|
| 2480 | if isempty(ref.num_a) |
---|
| 2481 | ref.num_a=1; |
---|
| 2482 | end |
---|
| 2483 | num_j1=ref.num_a*ones(size(num_i1)); |
---|
| 2484 | num_j2=num_j1; |
---|
| 2485 | elseif isequal(mode,'series(Dj)')%| isequal(mode,'st_series(Dj)') |
---|
| 2486 | delta1=floor((ref.num_b-ref.num_a)/2); |
---|
| 2487 | delta2=ceil((ref.num_b-ref.num_a)/2); |
---|
| 2488 | num_i1=ref.num1*ones(size(num_i_ref)); |
---|
| 2489 | num_i2=num_i1; |
---|
| 2490 | num_j1=num_j_ref-delta1*ones(size(num_j_ref)); |
---|
| 2491 | num_j2=num_j_ref+delta2*ones(size(num_j_ref)); |
---|
| 2492 | end |
---|
| 2493 | for ifile=1:nbfield |
---|
| 2494 | for j=1:nbslice |
---|
| 2495 | file_ref=name_generator(ref.filebase,num_i1(ifile),num_j1(j),'.nc',ref.nom_type,1,num_i2(ifile),num_j2(j),ref.subdir);% |
---|
| 2496 | file_ref_fix1(ifile,j)={file_ref}; |
---|
| 2497 | if ~exist(file_ref,'file') |
---|
| 2498 | msgbox_uvmat('ERROR',['reference file ' file_ref ' not found for fix1']) |
---|
[12] | 2499 | filecell=[]; |
---|
[2] | 2500 | return |
---|
| 2501 | end |
---|
| 2502 | end |
---|
| 2503 | end |
---|
| 2504 | end |
---|
| 2505 | end |
---|
| 2506 | |
---|
| 2507 | %determine reference files for fix2: |
---|
| 2508 | if box_test(5)==1% fix2 performed |
---|
| 2509 | ref=get(handles.ref_fix2,'UserData'); |
---|
| 2510 | if ~isempty(ref) |
---|
[127] | 2511 | first_i=str2double(get(handles.first_i,'String')); |
---|
| 2512 | last_i=str2double(get(handles.last_i,'String')); |
---|
| 2513 | incr_i=str2double(get(handles.incr_i,'String')); |
---|
| 2514 | first_j=str2double(get(handles.first_j,'String')); |
---|
| 2515 | last_j=str2double(get(handles.last_j,'String')); |
---|
| 2516 | incr_j=str2double(get(handles.incr_j,'String')); |
---|
[229] | 2517 | num_i_ref=first_i:incr_i:last_i; |
---|
| 2518 | num_j_ref=first_j:incr_j:last_j; |
---|
[2] | 2519 | if isequal(mode,'displacement') |
---|
| 2520 | num_i1=num_i_ref; |
---|
| 2521 | num_i2=num_i_ref; |
---|
| 2522 | num_j1=num_j_ref; |
---|
| 2523 | num_j2=num_j_ref; |
---|
| 2524 | elseif isequal(mode,'pair j1-j2') |
---|
| 2525 | num_i1=num_i_ref; |
---|
| 2526 | num_i2=num_i1; |
---|
| 2527 | num_j1=ref.num_a; |
---|
| 2528 | num_j2=ref.num_b; |
---|
| 2529 | elseif isequal(mode,'series(Di)') |
---|
| 2530 | delta1=floor((ref.num2-ref.num1)/2); |
---|
| 2531 | delta2=ceil((ref.num2-ref.num1)/2); |
---|
| 2532 | num_i1=num_i_ref-delta1*ones(size(num_i_ref)); |
---|
| 2533 | num_i2=num_i_ref+delta2*ones(size(num_i_ref)); |
---|
| 2534 | num_j1=ref.num_a*ones(size(num_i1)); |
---|
| 2535 | num_j2=num_j1; |
---|
| 2536 | elseif isequal(mode,'series(Dj)') |
---|
| 2537 | delta1=floor((ref.num_b-ref.num_a)/2); |
---|
| 2538 | delta2=ceil((ref.num_b-ref.num_a)/2); |
---|
| 2539 | num_i1=ref.num1*ones(size(num_i_ref)); |
---|
| 2540 | num_i2=num_i1; |
---|
| 2541 | num_j1=num_j_ref-delta1*ones(size(num_j_ref)); |
---|
| 2542 | num_j2=num_j_ref+delta2*ones(size(num_j_ref)); |
---|
| 2543 | end |
---|
| 2544 | for ifile=1:nbfield |
---|
| 2545 | for j=1:nbslice |
---|
| 2546 | file_ref=name_generator(ref.filebase,num_i1(ifile),num_j1(j),'.nc',ref.nom_type,1,num_i2(ifile),num_j2(j),ref.subdir);% |
---|
| 2547 | file_ref_fix2(ifile,j)={file_ref}; |
---|
| 2548 | if ~exist(file_ref,'file') |
---|
| 2549 | msgbox_uvmat('ERROR',['reference file ' file_ref ' not found for fix2']) |
---|
[122] | 2550 | filecell={}; |
---|
[2] | 2551 | return |
---|
| 2552 | end |
---|
| 2553 | end |
---|
| 2554 | end |
---|
| 2555 | end |
---|
| 2556 | end |
---|
| 2557 | |
---|
| 2558 | %check dir |
---|
| 2559 | subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf output data |
---|
| 2560 | subdir_civ2=get(handles.subdir_civ2,'String'); |
---|
[174] | 2561 | if isequal(subdir_civ1,''),subdir_civ1='CIV'; end% put default subdir |
---|
[2] | 2562 | if isequal(subdir_civ2,''),subdir_civ2=subdir_civ1; end% put default subdir |
---|
[266] | 2563 | % currentdir=pwd;%store the current working directory |
---|
[2] | 2564 | [Path_ima,Name]=fileparts(filebase);%Path of the image files (.civ) |
---|
| 2565 | if ~exist(Path_ima,'dir') |
---|
[12] | 2566 | msgbox_uvmat('ERROR',['path to images ' Path_ima ' not found']) |
---|
[122] | 2567 | filecell={}; |
---|
[2] | 2568 | return |
---|
| 2569 | end |
---|
[127] | 2570 | [xx,message]=fileattrib(Path_ima); |
---|
[122] | 2571 | if ~isempty(message) && ~isequal(message.UserWrite,1) |
---|
[112] | 2572 | msgbox_uvmat('ERROR',['No writting access to ' Path_ima]) |
---|
[122] | 2573 | filecell={}; |
---|
[266] | 2574 | % cd(currentdir); |
---|
[112] | 2575 | return |
---|
[2] | 2576 | end |
---|
| 2577 | |
---|
| 2578 | %check the existence of the netcdf and image files involved |
---|
| 2579 | % %%%%%%%%%%%% case CIV1 activated %%%%%%%%%%%%% |
---|
| 2580 | if box_test(1)==1; |
---|
[112] | 2581 | detect=1; |
---|
[127] | 2582 | vers=0; |
---|
| 2583 | subdir_civ1_new=subdir_civ1; |
---|
[153] | 2584 | while detect==1 %create a new subdir if the netcdf files already exist |
---|
[122] | 2585 | for ifile=1:nbfield |
---|
[112] | 2586 | for j=1:nbslice |
---|
[122] | 2587 | filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1_new); |
---|
[112] | 2588 | detect=exist(filename,'file')==2; |
---|
| 2589 | if detect% if a netcdf file already exists |
---|
[137] | 2590 | indstr=regexp(subdir_civ1_new,'\D'); |
---|
| 2591 | if indstr(end)<length(subdir_civ1_new) %subdir_civ1 ends by a number |
---|
| 2592 | vers=str2double(subdir_civ1_new(indstr(end)+1:end))+1; |
---|
| 2593 | subdir_civ1_new=[subdir_civ1_new(1:indstr(end)) num2str(vers)]; |
---|
[127] | 2594 | else |
---|
| 2595 | vers=vers+1; |
---|
[137] | 2596 | subdir_civ1_new=[subdir_civ1_new(1:indstr(end)) '_' num2str(vers)]; |
---|
[127] | 2597 | end |
---|
[137] | 2598 | subdir_civ2=subdir_civ1_new; |
---|
[112] | 2599 | break |
---|
| 2600 | end |
---|
| 2601 | filecell.nc.civ1(ifile,j)={filename}; |
---|
| 2602 | end |
---|
| 2603 | if detect% if a netcdf file already exists |
---|
| 2604 | break |
---|
| 2605 | end |
---|
| 2606 | end |
---|
[134] | 2607 | |
---|
[112] | 2608 | %create the new subdir_civ1 |
---|
[127] | 2609 | if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir') |
---|
[263] | 2610 | % cd(Path_ima); |
---|
| 2611 | [xx,msg1]=mkdir(fullfile(Path_ima,subdir_civ1_new)); |
---|
[134] | 2612 | |
---|
[128] | 2613 | if ~strcmp(msg1,'') |
---|
| 2614 | msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1])%error message for directory creation |
---|
[122] | 2615 | filecell={}; |
---|
| 2616 | return |
---|
[163] | 2617 | elseif isunix |
---|
[266] | 2618 | [xx,msg2] = fileattrib(fullfile(Path_ima,subdir_civ1_new),'+w','g'); %yield writing access (+w) to user group (g) |
---|
[128] | 2619 | if ~strcmp(msg2,'') |
---|
[266] | 2620 | msgbox_uvmat('ERROR',['pb of permission for ' fullfile(Path_ima,subdir_civ1_new) ': ' msg2])%error message for directory creation |
---|
[128] | 2621 | filecell={}; |
---|
| 2622 | return |
---|
| 2623 | end |
---|
[112] | 2624 | end |
---|
[263] | 2625 | % cd(currentdir); |
---|
[112] | 2626 | end |
---|
| 2627 | if strcmp(compare,'stereo PIV')&&(strcmp(mode,'pair j1-j2')||strcmp(mode,'series(Dj)')||strcmp(mode,'series(Di)'))%check second nc series |
---|
| 2628 | for ifile=1:nbfield |
---|
| 2629 | for j=1:nbslice |
---|
[122] | 2630 | filename=name_generator(filebase_A,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1_new);% |
---|
[112] | 2631 | detect=exist(filename,'file')==2; |
---|
[2] | 2632 | if detect% if a netcdf file already exists |
---|
[137] | 2633 | indstr=regexp(subdir_civ1_new,'\D'); |
---|
| 2634 | if indstr(end)<length(subdir_civ1_new) %subdir_civ1 ends by a number |
---|
| 2635 | vers=str2double(subdir_civ1_new(indstr(end)+1:end))+1; |
---|
| 2636 | subdir_civ1_new=[subdir_civ1_new(1:indstr(end)) num2str(vers)]; |
---|
[127] | 2637 | else |
---|
| 2638 | vers=vers+1; |
---|
[137] | 2639 | subdir_civ1_new=[subdir_civ1_new '_' num2str(vers)]; |
---|
[127] | 2640 | end |
---|
| 2641 | subdir_civ2=subdir_civ1; |
---|
| 2642 | break |
---|
[2] | 2643 | end |
---|
[112] | 2644 | filecell.ncA.civ1(ifile,j)={filename}; |
---|
| 2645 | end |
---|
| 2646 | if detect% if a netcdf file already exists |
---|
| 2647 | break |
---|
| 2648 | end |
---|
| 2649 | end |
---|
| 2650 | %create the new subdir_civ1 |
---|
[263] | 2651 | if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir') |
---|
| 2652 | % cd(Path_ima); |
---|
| 2653 | [xx,msg1]=mkdir(fullfile(Path_ima,subdir_civ1_new)); |
---|
| 2654 | % cd(currentdir); |
---|
[252] | 2655 | if ~strcmp(msg1,'') |
---|
[128] | 2656 | msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1]) |
---|
[263] | 2657 | % cd(currentdir) |
---|
[122] | 2658 | filecell={}; |
---|
| 2659 | return |
---|
[128] | 2660 | else |
---|
[266] | 2661 | [xx,msg2] = fileattrib(fullfile(Path_ima,subdir_civ1_new),'+w','g'); %yield writing access (+w) to user group (g) |
---|
[128] | 2662 | if ~strcmp(msg2,'') |
---|
| 2663 | msgbox_uvmat('ERROR',['pb of permission for ' subdir_civ1_new ': ' msg2])%error message for directory creation |
---|
[263] | 2664 | % cd(currentdir) |
---|
[128] | 2665 | filecell={}; |
---|
| 2666 | return |
---|
| 2667 | end |
---|
[112] | 2668 | end |
---|
| 2669 | end |
---|
| 2670 | end |
---|
| 2671 | end |
---|
[127] | 2672 | subdir_civ1=subdir_civ1_new; |
---|
[2] | 2673 | % get image names |
---|
| 2674 | for ifile=1:nbfield |
---|
[112] | 2675 | for j=1:nbslice |
---|
[2] | 2676 | filename=name_generator(filebase_ima1, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); |
---|
| 2677 | idetect(j)=exist(filename,'file')==2; |
---|
| 2678 | filecell.ima1.civ1(ifile,j)={filename}; %first image |
---|
| 2679 | filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); |
---|
| 2680 | idetect_1(j)=exist(filename,'file')==2; |
---|
| 2681 | filecell.ima2.civ1(ifile,j)={filename};%second image |
---|
[112] | 2682 | end |
---|
| 2683 | [idetectmin,indexj]=min(idetect); |
---|
| 2684 | if idetectmin==0, |
---|
| 2685 | msgbox_uvmat('ERROR',[filecell.ima1.civ1{ifile,indexj} ' not found']) |
---|
[122] | 2686 | filecell={}; |
---|
[266] | 2687 | % cd(currentdir) |
---|
[112] | 2688 | return |
---|
| 2689 | end |
---|
| 2690 | [idetectmin,indexj]=min(idetect_1); |
---|
| 2691 | if idetectmin==0, |
---|
| 2692 | msgbox_uvmat('ERROR',[filecell.ima2.civ1{ifile,indexj} ' not found']) |
---|
[122] | 2693 | filecell={}; |
---|
[266] | 2694 | %cd(currentdir) |
---|
[112] | 2695 | return |
---|
| 2696 | end |
---|
| 2697 | end |
---|
| 2698 | if strcmp(compare,'stereo PIV') && (strcmp(mode,'pair j1-j2') || strcmp(mode,'series(Dj)') || strcmp(mode,'series(Di)')) |
---|
| 2699 | for ifile=1:nbfield |
---|
| 2700 | for j=1:nbslice |
---|
| 2701 | filename=name_generator(filebase_A, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); |
---|
| 2702 | idetect(j)=exist(filename,'file')==2; |
---|
| 2703 | filecell.imaA1.civ1(ifile,j)={filename} ;%first image |
---|
| 2704 | filename=name_generator(filebase_A, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); |
---|
| 2705 | idetect_1(j)=exist(filename,'file')==2; |
---|
| 2706 | filecell.imaA2.civ1(ifile,j)={filename};%second image |
---|
| 2707 | end |
---|
[2] | 2708 | [idetectmin,indexj]=min(idetect); |
---|
[112] | 2709 | if idetectmin==0, |
---|
| 2710 | msgbox_uvmat('ERROR',[filecell.imaA1.civ1{ifile,indexj} ' not found']) |
---|
[122] | 2711 | filecell={}; |
---|
[266] | 2712 | % cd(currentdir) |
---|
[2] | 2713 | return |
---|
[112] | 2714 | end |
---|
[2] | 2715 | [idetectmin,indexj]=min(idetect_1); |
---|
[112] | 2716 | if idetectmin==0, |
---|
| 2717 | msgbox_uvmat('ERROR',[filecell.imaA2.civ1{ifile,indexj} ' not found']) |
---|
[122] | 2718 | filecell={}; |
---|
[266] | 2719 | % cd(currentdir) |
---|
[2] | 2720 | return |
---|
[112] | 2721 | end |
---|
| 2722 | end |
---|
[2] | 2723 | end |
---|
[112] | 2724 | |
---|
| 2725 | %%%%%%%%%%%%% fix1 or patch1 activated but no civ1 %%%%%%%%%%%%% |
---|
| 2726 | elseif (box_test(2)==1 || box_test(3)==1); |
---|
[2] | 2727 | for ifile=1:nbfield |
---|
| 2728 | for j=1:nbslice |
---|
| 2729 | filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',... |
---|
[112] | 2730 | nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% |
---|
| 2731 | detect=exist(filename,'file')==2; |
---|
[122] | 2732 | if detect==0 |
---|
| 2733 | msgbox_uvmat('ERROR',[filename ' not found']) |
---|
| 2734 | filecell={}; |
---|
[266] | 2735 | % cd(currentdir) |
---|
[122] | 2736 | return |
---|
| 2737 | end |
---|
[2] | 2738 | filecell.nc.civ1(ifile,j)={filename}; |
---|
| 2739 | end |
---|
| 2740 | end |
---|
| 2741 | if strcmp(compare,'stereo PIV') |
---|
[112] | 2742 | for ifile=1:nbfield |
---|
| 2743 | for j=1:nbslice |
---|
| 2744 | filename=name_generator(filebase_A,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% |
---|
| 2745 | filecell.ncA.civ1(ifile,j)={filename}; |
---|
| 2746 | if ~exist(filename,'file') |
---|
| 2747 | msgbox_uvmat('ERROR',['input file ' filename ' not found']) |
---|
| 2748 | set(handles.RUN, 'Enable','On') |
---|
| 2749 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
[122] | 2750 | filecell={}; |
---|
[266] | 2751 | %cd(currentdir) |
---|
[112] | 2752 | return |
---|
[2] | 2753 | end |
---|
| 2754 | end |
---|
[112] | 2755 | end |
---|
[2] | 2756 | end |
---|
| 2757 | end |
---|
| 2758 | |
---|
| 2759 | %%%%%%%%%%%%% if civ2 performed with pairs different than civ1 %%%%%%%%%%%%% |
---|
| 2760 | testdiff=0; |
---|
| 2761 | if (box_test(4)==1)&&... |
---|
[127] | 2762 | ((get(handles.list_pair_civ1,'Value')~=get(handles.list_pair_civ2,'Value'))||~strcmp(subdir_civ2,subdir_civ1)) |
---|
[2] | 2763 | testdiff=1; |
---|
[112] | 2764 | detect=1; |
---|
[127] | 2765 | vers=0; |
---|
| 2766 | subdir_civ2_new=subdir_civ2; |
---|
[2] | 2767 | while detect==1 %create a new subdir if the netcdf files already exist |
---|
[112] | 2768 | for ifile=1:nbfield |
---|
| 2769 | for j=1:nbslice |
---|
[127] | 2770 | filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2_new);% |
---|
[112] | 2771 | detect=exist(filename,'file')==2; |
---|
| 2772 | if detect% if a netcdf file already exists |
---|
[127] | 2773 | indstr=regexp(subdir_civ2,'\D'); |
---|
| 2774 | if indstr(end)<length(subdir_civ2) %subdir_civ1 ends by a number |
---|
| 2775 | vers=str2double(subdir_civ2(indstr(end)+1:end))+1; |
---|
| 2776 | subdir_civ2_new=[subdir_civ2(1:indstr(end)) num2str(vers)]; |
---|
| 2777 | else |
---|
| 2778 | vers=vers+1; |
---|
| 2779 | subdir_civ2_new=[subdir_civ1 '_' num2str(vers)]; |
---|
| 2780 | end |
---|
[112] | 2781 | break |
---|
| 2782 | end |
---|
| 2783 | filecell.nc.civ2(ifile,j)={filename}; |
---|
| 2784 | end |
---|
| 2785 | if detect% if a netcdf file already exists |
---|
| 2786 | break |
---|
| 2787 | end |
---|
| 2788 | end |
---|
[128] | 2789 | %create the new subdir_civ2_new |
---|
| 2790 | if ~exist(fullfile(Path_ima,subdir_civ2_new),'dir') |
---|
[174] | 2791 | [xx,m2]=mkdir(fullfile(Path_ima,subdir_civ2_new)); |
---|
[266] | 2792 | [xx,msg2] = fileattrib(fullfile(Path_ima,subdir_civ2_new),'+w','g'); %yield writing access (+w) to user group (g) |
---|
[112] | 2793 | if ~isequal(m2,'') |
---|
[266] | 2794 | msgbox_uvmat('ERROR',['cannot create ' fullfile(Path_ima,subdir_civ2_new) ': ' m2]) |
---|
[122] | 2795 | filecell={}; |
---|
[266] | 2796 | % cd(currentdir) |
---|
[122] | 2797 | return |
---|
[112] | 2798 | end |
---|
| 2799 | end |
---|
| 2800 | if strcmp(compare,'stereo PIV')%check second nc series |
---|
| 2801 | for ifile=1:nbfield |
---|
| 2802 | for j=1:nbslice |
---|
| 2803 | filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
[122] | 2804 | nom_type_nc,1,num2_civ2(ifile),num_b_civ1(j),subdir_civ2_new);% |
---|
[112] | 2805 | detect=exist(filename,'file')==2; |
---|
[2] | 2806 | if detect% if a netcdf file already exists |
---|
[127] | 2807 | indstr=regexp(subdir_civ2,'\D'); |
---|
| 2808 | if indstr(end)<length(subdir_civ2) %subdir_civ1 ends by a number |
---|
| 2809 | vers=str2double(subdir_civ2(indstr(end)+1:end))+1; |
---|
| 2810 | subdir_civ2_new=[subdir_civ2(1:indstr(end)) num2str(vers)]; |
---|
| 2811 | else |
---|
| 2812 | vers=vers+1; |
---|
| 2813 | subdir_civ2_new=[subdir_civ1 '_' num2str(vers)]; |
---|
| 2814 | end |
---|
[112] | 2815 | break |
---|
[2] | 2816 | end |
---|
[112] | 2817 | filecell.ncA.civ2(ifile,j)={filename}; |
---|
| 2818 | end |
---|
| 2819 | if detect% if a netcdf file already exists |
---|
| 2820 | break |
---|
| 2821 | end |
---|
| 2822 | end |
---|
[122] | 2823 | subdir_civ2=subdir_civ2_new; |
---|
[112] | 2824 | %create the new subdir_civ1 |
---|
[127] | 2825 | if ~exist(fullfile(Path_ima,subdir_civ2_new),'dir') |
---|
| 2826 | [xx,m2]=mkdir(subdir_civ2_new); |
---|
[266] | 2827 | [xx,msg2] = fileattrib(fullfile(Path_ima,subdir_civ2_new),'+w','g'); %yield writing access (+w) to user group (g) |
---|
[112] | 2828 | if ~isequal(m2,'') |
---|
[266] | 2829 | msgbox_uvmat('ERROR', ['cannot create ' fullfile(Path_ima,subdir_civ2_new) ': ' m2])%error message for directory creation |
---|
| 2830 | % cd(currentdir) |
---|
[122] | 2831 | filecell={}; |
---|
| 2832 | return |
---|
[112] | 2833 | end |
---|
| 2834 | end |
---|
| 2835 | end |
---|
| 2836 | end |
---|
[127] | 2837 | subdir_civ2=subdir_civ2_new; |
---|
[2] | 2838 | end |
---|
[266] | 2839 | %cd(currentdir);%come back to the current working directory |
---|
[2] | 2840 | |
---|
| 2841 | %%%%%%%%%%%%% if civ2 results are obtained or used %%%%%%%%%%%%% |
---|
| 2842 | if box_test(4)==1 || box_test(5)==1 || box_test(6)==1 %civ2 |
---|
| 2843 | %check source netcdf file of civ1 estimates |
---|
| 2844 | if box_test(1)==0; %no civ1 performed |
---|
| 2845 | for ifile=1:nbfield |
---|
| 2846 | for j=1:nbslice |
---|
| 2847 | filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',... |
---|
| 2848 | nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% |
---|
| 2849 | filecell.nc.civ1(ifile,j)={filename};% name of the civ1 file |
---|
| 2850 | if ~exist(filename,'file') |
---|
| 2851 | msgbox_uvmat('ERROR',['input file ' filename ' not found']) |
---|
[122] | 2852 | filecell={}; |
---|
[2] | 2853 | return |
---|
| 2854 | end |
---|
| 2855 | if ~testdiff % civ2 or patch2 are written in the same file as civ1 |
---|
| 2856 | if box_test(4)==0 ; %check the existence of civ2 if it is not calculated |
---|
[248] | 2857 | Data=nc2struct(filename,'ListGlobalAttribute','CivStage','civ2'); |
---|
| 2858 | if ~isempty(Data.CivStage) && Data.CivStage<4 %test for civ files |
---|
[2] | 2859 | msgbox_uvmat('ERROR',['no civ2 data in ' filename]) |
---|
[12] | 2860 | filecell=[]; |
---|
[2] | 2861 | return |
---|
[248] | 2862 | elseif isempty(Data.civ2)||isequal(Data.civ2,0) |
---|
| 2863 | msgbox_uvmat('ERROR',['no civ2 data in ' filename]) |
---|
| 2864 | filecell=[]; |
---|
| 2865 | return |
---|
[112] | 2866 | end |
---|
[2] | 2867 | elseif box_test(3)==0; %check the existence of patch if it is not calculated |
---|
[275] | 2868 | Data=nc2struct(filename,'ListGlobalAttribute','CivStage','patch'); |
---|
[248] | 2869 | if ~isempty(Data.CivStage) |
---|
| 2870 | if Data.CivStage<3 %test for civ files |
---|
| 2871 | msgbox_uvmat('ERROR',['no patch data in ' filename]) |
---|
| 2872 | filecell=[]; |
---|
| 2873 | return |
---|
| 2874 | end |
---|
| 2875 | elseif isempty(Data.patch)||isequal(Data.patch,0) |
---|
[2] | 2876 | msgbox_uvmat('ERROR',['no patch data in ' filename]) |
---|
[12] | 2877 | filecell=[]; |
---|
[2] | 2878 | return |
---|
| 2879 | end |
---|
[112] | 2880 | end |
---|
[2] | 2881 | end |
---|
| 2882 | end |
---|
| 2883 | end |
---|
| 2884 | if strcmp(compare,'stereo PIV') |
---|
| 2885 | for ifile=1:nbfield |
---|
| 2886 | for j=1:nbslice |
---|
| 2887 | filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
| 2888 | nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% |
---|
| 2889 | filecell.ncA.civ2(ifile,j)={filename}; |
---|
| 2890 | if ~exist(filename,'file') |
---|
| 2891 | msgbox_uvmat('ERROR',['input file ' filename ' not found']) |
---|
| 2892 | set(handles.RUN, 'Enable','On') |
---|
| 2893 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
| 2894 | return |
---|
| 2895 | end |
---|
| 2896 | end |
---|
| 2897 | end |
---|
| 2898 | end |
---|
| 2899 | end |
---|
[112] | 2900 | |
---|
| 2901 | detect=1; |
---|
| 2902 | % while detect==1%creates a new subdir if the netcdf files already contain civ2 data |
---|
| 2903 | for ifile=1:nbfield |
---|
| 2904 | for j=1:nbslice |
---|
| 2905 | filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
[2] | 2906 | nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2); |
---|
[112] | 2907 | detect=exist(filename,'file')==2; |
---|
| 2908 | filecell.nc.civ2(ifile,j)={filename}; |
---|
[2] | 2909 | end |
---|
[112] | 2910 | end |
---|
[2] | 2911 | %get first image names for civ2 |
---|
| 2912 | if box_test(1)==1 & isequal(num1_civ1,num1_civ2) & isequal(num_a_civ1,num_a_civ2) |
---|
| 2913 | filecell.ima1.civ2=filecell.ima1.civ1; |
---|
| 2914 | elseif box_test(4)==1 |
---|
| 2915 | for ifile=1:nbfield |
---|
| 2916 | for j=1:nbslice |
---|
| 2917 | filename=name_generator(filebase_ima1, num1_civ2(ifile),num_a_civ2(j),ext_ima,nom_type_ima1); |
---|
| 2918 | idetect_2(j)=exist(filename,'file')==2; |
---|
| 2919 | filecell.ima1.civ2(ifile,j)={filename};%first image |
---|
| 2920 | end |
---|
[112] | 2921 | [idetectmin,indexj]=min(idetect_2); |
---|
[2] | 2922 | if idetectmin==0, |
---|
[112] | 2923 | msgbox_uvmat('ERROR',['input image ' filecell.ima1.civ2{ifile,indexj} ' not found']) |
---|
| 2924 | filecell=[]; |
---|
| 2925 | return |
---|
[2] | 2926 | end |
---|
| 2927 | end |
---|
| 2928 | end |
---|
| 2929 | |
---|
| 2930 | %get second image names for civ2 |
---|
| 2931 | if box_test(1)==1 & isequal(num2_civ1,num2_civ2) & isequal(num_b_civ1,num_b_civ2) |
---|
| 2932 | filecell.ima2.civ2=filecell.ima2.civ1; |
---|
| 2933 | elseif box_test(4)==1 |
---|
| 2934 | for ifile=1:nbfield |
---|
| 2935 | for j=1:nbslice |
---|
| 2936 | filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),ext_ima,nom_type_ima2); |
---|
| 2937 | idetect_3(j)=exist(filename,'file')==2; |
---|
| 2938 | filecell.ima2.civ2(ifile,j)={filename};%first image |
---|
| 2939 | end |
---|
[112] | 2940 | [idetectmin,indexj]=min(idetect_3); |
---|
[2] | 2941 | if idetectmin==0, |
---|
[112] | 2942 | msgbox_uvmat('ERROR',['input image ' filecell.ima2.civ2{ifile,indexj} ' not found']) |
---|
| 2943 | filecell=[]; |
---|
| 2944 | return |
---|
[2] | 2945 | end |
---|
| 2946 | end |
---|
| 2947 | end |
---|
| 2948 | end |
---|
| 2949 | if (box_test(5)==1 || box_test(6)==1 ) && box_test(4)==0 % need to read an existing netcdf civ2 file |
---|
| 2950 | if ~testdiff |
---|
| 2951 | filecell.nc.civ2=filecell.nc.civ1;% file already checked |
---|
[112] | 2952 | else % check the civ2 files |
---|
[2] | 2953 | for ifile=1:nbfield |
---|
| 2954 | for j=1:nbslice |
---|
| 2955 | filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
[112] | 2956 | nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% |
---|
[2] | 2957 | filecell.nc.civ2(ifile,j)={filename}; |
---|
| 2958 | if ~exist(filename,'file') |
---|
| 2959 | msgbox_uvmat('ERROR',['input file ' filename ' not found']) |
---|
[12] | 2960 | filecell=[]; |
---|
[2] | 2961 | return |
---|
| 2962 | else |
---|
[248] | 2963 | Data=nc2struct(filename,'ListGlobalAttribute','CivStage','civ2'); |
---|
| 2964 | if ~isempty(Data.CivStage) && Data.CivStage<4 %test for civ files |
---|
| 2965 | msgbox_uvmat('ERROR',['no civ2 data in ' filename]) |
---|
| 2966 | filecell=[]; |
---|
| 2967 | return |
---|
| 2968 | elseif isempty(Data.civ2)||isequal(Data.civ2,0) |
---|
[2] | 2969 | msgbox_uvmat('ERROR',['no civ2 data in ' filename]) |
---|
[12] | 2970 | filecell=[]; |
---|
[2] | 2971 | return |
---|
| 2972 | end |
---|
| 2973 | end |
---|
| 2974 | end |
---|
| 2975 | end |
---|
| 2976 | end |
---|
| 2977 | end |
---|
| 2978 | |
---|
| 2979 | %%%%%%%%%%%%% if stereo fields are calculated by PATCH %%%%%%%%%%%%% |
---|
| 2980 | if strcmp(compare,'stereo PIV') |
---|
[127] | 2981 | if box_test(3)==1 && isequal(get(handles.test_stereo1,'Value'),1) |
---|
[2] | 2982 | for ifile=1:nbfield |
---|
| 2983 | for j=1:nbslice |
---|
| 2984 | filename=name_generator(filebase_AB,num1_civ1(ifile),num_a_civ1(j),'.nc',... |
---|
| 2985 | nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% |
---|
| 2986 | filecell.st(ifile,j)={filename}; |
---|
| 2987 | end |
---|
| 2988 | end |
---|
| 2989 | end |
---|
[274] | 2990 | if box_test(6)==1 && isequal(get(handles.check_Stereo,'Value'),1) |
---|
[2] | 2991 | for ifile=1:nbfield |
---|
| 2992 | for j=1:nbslice |
---|
| 2993 | filename=name_generator(filebase_AB,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
| 2994 | nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% |
---|
| 2995 | filecell.st(ifile,j)={filename}; |
---|
| 2996 | end |
---|
| 2997 | end |
---|
[112] | 2998 | end |
---|
[2] | 2999 | end |
---|
| 3000 | set(handles.subdir_civ1,'String',subdir_civ1);%update the edit box |
---|
| 3001 | set(handles.subdir_civ2,'String',subdir_civ2);%update the edit box |
---|
| 3002 | browse.nom_type_nc=nom_type_nc; |
---|
[273] | 3003 | set(handles.RootName,'UserData',browse); %update the nomenclature type for uvmat |
---|
[2] | 3004 | |
---|
| 3005 | |
---|
| 3006 | %COPY IMAGES TO THE FORMAT .png IF NEEDED |
---|
[45] | 3007 | if isequal(nom_type_ima1,'*')%case of movie files |
---|
| 3008 | nom_type_imanew1='_i'; |
---|
[2] | 3009 | else |
---|
| 3010 | nom_type_imanew1=nom_type_ima1; |
---|
| 3011 | end |
---|
[45] | 3012 | if isequal(nom_type_ima2,'*')%case of movie files |
---|
| 3013 | nom_type_imanew2='_i'; |
---|
[2] | 3014 | else |
---|
| 3015 | nom_type_imanew2=nom_type_ima2; |
---|
| 3016 | end |
---|
| 3017 | if ~isequal(ext_ima,'.png') |
---|
[45] | 3018 | %%type of image file |
---|
| 3019 | type_ima1='none';%default |
---|
| 3020 | movieobject1=[];%default |
---|
[133] | 3021 | if strcmpi(ext_ima,'.avi') |
---|
[45] | 3022 | hhh=which('mmreader'); |
---|
| 3023 | if ~isequal(hhh,'')&& mmreader.isPlatformSupported()% if the mmreader function is found (recent version of matlab) |
---|
| 3024 | type_ima1='movie'; |
---|
| 3025 | movieobject1=mmreader([filebase_ima2 ext_ima]); |
---|
| 3026 | else |
---|
| 3027 | type_ima1='avi'; |
---|
| 3028 | end |
---|
[133] | 3029 | elseif ischar(ext_ima) && ~isempty(ext_ima(2:end)) |
---|
[112] | 3030 | form=imformats(ext_ima(2:end)); |
---|
| 3031 | if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab |
---|
| 3032 | if isequal(nom_type_ima1,'*'); |
---|
| 3033 | type_ima1='multimage';%image series in a single image file |
---|
| 3034 | else |
---|
| 3035 | type_ima1='image'; |
---|
| 3036 | end |
---|
| 3037 | end |
---|
[45] | 3038 | end |
---|
| 3039 | type_ima2='none';%default |
---|
| 3040 | movieobject2=[]; |
---|
[133] | 3041 | if strcmpi(ext_ima,'.avi') |
---|
[45] | 3042 | hhh=which('mmreader'); |
---|
| 3043 | if ~isequal(hhh,'')&& mmreader.isPlatformSupported()% if the mmreader function is found (recent version of matlab) |
---|
| 3044 | type_ima2='movie'; |
---|
| 3045 | movieobject2=mmreader([filebase_ima2 ext_ima]); |
---|
| 3046 | else |
---|
| 3047 | type_ima2='avi'; |
---|
| 3048 | end |
---|
[133] | 3049 | elseif ischar(ext_ima) && ~isempty(ext_ima(2:end)) |
---|
[112] | 3050 | form=imformats(ext_ima(2:end)); |
---|
| 3051 | if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab |
---|
| 3052 | if isequal(nom_type_ima1,'*'); |
---|
| 3053 | type_ima2='multimage';%image series in a single image file |
---|
| 3054 | else |
---|
| 3055 | type_ima2='image'; |
---|
| 3056 | end |
---|
| 3057 | end |
---|
[45] | 3058 | end |
---|
[71] | 3059 | %npxy=get(handles.ImaExt,'UserData'); |
---|
[112] | 3060 | % % if numel(npxy)<2 |
---|
| 3061 | % |
---|
| 3062 | % filename=name_generator(filebase_ima1,num1_civ1(1),num_a_civ1(1),ImaExt,nom_type_ima1); |
---|
| 3063 | % A=imread(filename); |
---|
| 3064 | % npxy=size(A); |
---|
| 3065 | % % end |
---|
| 3066 | % npy=npxy(1); |
---|
| 3067 | % npx=npxy(2); |
---|
[2] | 3068 | if box_test(1)==1 %if civ1 is performed |
---|
[224] | 3069 | h = waitbar(0,'copy images to the .png format for civ1');% display a wait bar |
---|
[112] | 3070 | for ifile=1:nbfield |
---|
[2] | 3071 | waitbar(ifile/nbfield); |
---|
| 3072 | for j=1:nbslice |
---|
[112] | 3073 | filename=name_generator(filebase_ima1,num1_civ1(ifile),num_a_civ1(j),'.png',nom_type_imanew1); |
---|
| 3074 | if ~exist(filename,'file') |
---|
| 3075 | A=read_image(filecell.ima1.civ1{ifile,j},type_ima1,num1_civ1(ifile),movieobject1); |
---|
| 3076 | imwrite(A,filename,'BitDepth',16); |
---|
| 3077 | end |
---|
| 3078 | filecell.ima1.civ1(ifile,j)={filename}; |
---|
| 3079 | filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),'.png',nom_type_imanew2); |
---|
| 3080 | if ~exist(filename,'file') |
---|
| 3081 | A=read_image(filecell.ima2.civ1{ifile,j},type_ima2,num2_civ1(ifile),movieobject2); |
---|
| 3082 | imwrite(A,filename,'BitDepth',16); |
---|
| 3083 | end |
---|
| 3084 | filecell.ima2.civ1(ifile,j)={filename}; |
---|
[2] | 3085 | end |
---|
| 3086 | end |
---|
| 3087 | close(h) |
---|
| 3088 | end |
---|
| 3089 | if box_test(4)==1 %if civ2 is performed |
---|
[229] | 3090 | h = waitbar(0,'copy images to the .png format for civ2');% display a wait bar |
---|
[2] | 3091 | for ifile=1:nbfield |
---|
| 3092 | waitbar(ifile/nbfield); |
---|
| 3093 | for j=1:nbslice |
---|
[112] | 3094 | filename=name_generator(filebase_ima1,num1_civ2(ifile),num_a_civ2(j),'.png',nom_type_imanew1); |
---|
| 3095 | if ~exist(filename,'file') |
---|
| 3096 | A=read_image(cell2mat(filecell.ima1.civ2(ifile,j)),type_ima2,num1_civ2(ifile)); |
---|
| 3097 | imwrite(A,filename,'BitDepth',16); |
---|
| 3098 | end |
---|
| 3099 | filecell.ima1.civ2(ifile,j)={filename}; |
---|
| 3100 | filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),'.png',nom_type_imanew2); |
---|
| 3101 | if ~exist(filename,'file') |
---|
| 3102 | A=read_image(cell2mat(filecell.ima2.civ2(ifile,j)),type_ima2,num2_civ2(ifile)); |
---|
| 3103 | imwrite(A,filename,'BitDepth',16); |
---|
| 3104 | end |
---|
| 3105 | filecell.ima2.civ2(ifile,j)={filename}; |
---|
[2] | 3106 | end |
---|
| 3107 | end |
---|
| 3108 | close(h); |
---|
| 3109 | end |
---|
| 3110 | end |
---|
| 3111 | |
---|
[12] | 3112 | %------------------------------------------------------------------------ |
---|
[227] | 3113 | % --- determine the list of index pairs of processing file |
---|
| 3114 | function [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... |
---|
| 3115 | find_pair_indices(handles,ref_i,ref_j,mode) |
---|
| 3116 | %------------------------------------------------------------------------ |
---|
| 3117 | |
---|
| 3118 | list_civ1=get(handles.list_pair_civ1,'String'); |
---|
| 3119 | index_civ1=get(handles.list_pair_civ1,'Value'); |
---|
| 3120 | str_civ1=list_civ1{index_civ1};%string defining the image pairs for civ1 |
---|
| 3121 | if isempty(str_civ1)||isequal(str_civ1,'') |
---|
| 3122 | msgbox_uvmat('ERROR','no image pair selected for civ1') |
---|
| 3123 | return |
---|
| 3124 | end |
---|
| 3125 | list_civ2=get(handles.list_pair_civ2,'String'); |
---|
| 3126 | index_civ2=get(handles.list_pair_civ2,'Value'); |
---|
| 3127 | if index_civ2>length(list_civ2) |
---|
| 3128 | list_civ2=list_civ1; |
---|
| 3129 | index_civ2=index_civ1; |
---|
| 3130 | end |
---|
| 3131 | str_civ2=list_civ2{index_civ2};%string defining the image pairs for civ2 |
---|
| 3132 | |
---|
| 3133 | if isequal (mode,'series(Di)') |
---|
| 3134 | lastfield=str2double(get(handles.nb_field,'String')); |
---|
| 3135 | num1_civ1=ref_i-floor(index_civ1/2)*ones(size(ref_i));% set of first image numbers |
---|
| 3136 | num2_civ1=ref_i+ceil(index_civ1/2)*ones(size(ref_i)); |
---|
| 3137 | num_a_civ1=ref_j; |
---|
| 3138 | num_b_civ1=ref_j; |
---|
[229] | 3139 | num1_civ2=ref_i-floor(index_civ2/2)*ones(size(ref_i)); |
---|
[227] | 3140 | num2_civ2=ref_i+ceil(index_civ2/2)*ones(size(ref_i)); |
---|
| 3141 | num_a_civ2=ref_j; |
---|
| 3142 | num_b_civ2=ref_j; |
---|
| 3143 | |
---|
| 3144 | % adjust the first and last field number |
---|
| 3145 | lastfield=str2double(get(handles.nb_field,'String')); |
---|
| 3146 | if isnan(lastfield) |
---|
| 3147 | indsel=find((num1_civ1 >= 1)&(num1_civ2 >= 1)); |
---|
| 3148 | else |
---|
| 3149 | indsel=find((num2_civ1 <= lastfield)&(num2_civ2 <= lastfield)&(num1_civ1 >= 1)&(num1_civ2 >= 1)); |
---|
| 3150 | end |
---|
| 3151 | if length(indsel)>=1 |
---|
| 3152 | firstind=indsel(1); |
---|
| 3153 | lastind=indsel(end); |
---|
| 3154 | set(handles.first_i,'String',num2str(ref_i(firstind)))%update the display of first and last fields |
---|
| 3155 | set(handles.last_i,'String',num2str(ref_i(lastind))) |
---|
| 3156 | ref_i=ref_i(indsel); |
---|
| 3157 | num1_civ1=num1_civ1(indsel); |
---|
| 3158 | num1_civ2=num1_civ2(indsel); |
---|
| 3159 | num2_civ1=num2_civ1(indsel); |
---|
| 3160 | num2_civ2=num2_civ2(indsel); |
---|
| 3161 | end |
---|
| 3162 | elseif isequal (mode,'series(Dj)') |
---|
| 3163 | lastfield_j=str2double(get(handles.nb_field2,'String')); |
---|
| 3164 | num1_civ1=ref_i;% set of first image numbers |
---|
| 3165 | num2_civ1=ref_i; |
---|
| 3166 | num_a_civ1=ref_j-floor(index_civ1/2)*ones(size(ref_j)); |
---|
| 3167 | num_b_civ1=ref_j+ceil(index_civ1/2)*ones(size(ref_j)); |
---|
| 3168 | num1_civ2=ref_i; |
---|
| 3169 | num2_civ2=ref_i; |
---|
| 3170 | num_a_civ2=ref_j-floor(index_civ2/2)*ones(size(ref_j)); |
---|
| 3171 | num_b_civ2=ref_j+ceil(index_civ2/2)*ones(size(ref_j)); |
---|
| 3172 | % adjust the first and last field number |
---|
| 3173 | if isnan(lastfield_j) |
---|
| 3174 | indsel=find((num_a_civ1 >= 1)&(num_a_civ2 >= 1)); |
---|
| 3175 | else |
---|
| 3176 | indsel=find((num_b_civ1 <= lastfield_j)&(num_b_civ2 <= lastfield_j)&(num_a_civ1 >= 1)&(num_a_civ2 >= 1)); |
---|
| 3177 | end |
---|
| 3178 | if length(indsel)>=1 |
---|
| 3179 | firstind=indsel(1); |
---|
| 3180 | lastind=indsel(end); |
---|
| 3181 | set(handles.first_j,'String',num2str(ref_j(firstind)))%update the display of first and last fields |
---|
| 3182 | set(handles.last_j,'String',num2str(ref_j(lastind))) |
---|
| 3183 | ref_j=ref_j(indsel); |
---|
| 3184 | num_a_civ1=num_a_civ1(indsel); |
---|
| 3185 | num_b_civ1=num_b_civ1(indsel); |
---|
| 3186 | num_a_civ2=num_a_civ2(indsel); |
---|
| 3187 | num_b_civ2=num_b_civ2(indsel); |
---|
| 3188 | end |
---|
| 3189 | elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) |
---|
| 3190 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
| 3191 | num1_civ1=ref_i; |
---|
| 3192 | num2_civ1=ref_i; |
---|
| 3193 | num_a_civ1=displ_num(1,index_civ1); |
---|
| 3194 | num_b_civ1=displ_num(2,index_civ1); |
---|
| 3195 | num1_civ2=ref_i; |
---|
| 3196 | num2_civ2=ref_i; |
---|
| 3197 | num_a_civ2=displ_num(1,index_civ2); |
---|
| 3198 | num_b_civ2=displ_num(2,index_civ2); |
---|
| 3199 | elseif isequal(mode,'displacement') |
---|
| 3200 | num1_civ1=ref_i; |
---|
| 3201 | num2_civ1=ref_i; |
---|
| 3202 | num_a_civ1=ref_j; |
---|
| 3203 | num_b_civ1=ref_j; |
---|
| 3204 | num1_civ2=ref_i; |
---|
| 3205 | num2_civ2=ref_i; |
---|
| 3206 | num_a_civ2=ref_j; |
---|
| 3207 | num_b_civ2=ref_j; |
---|
| 3208 | end |
---|
| 3209 | |
---|
| 3210 | |
---|
| 3211 | %------------------------------------------------------------------------ |
---|
[12] | 3212 | % --- PATCH |
---|
[274] | 3213 | function cmd=cmd_patch(filename_nc,Param,PatchBin) |
---|
[12] | 3214 | %------------------------------------------------------------------------ |
---|
[224] | 3215 | namelog=[filename_nc(1:end-3) '_patch.log']; |
---|
[274] | 3216 | |
---|
[272] | 3217 | % if test_interp==0 |
---|
[163] | 3218 | if isunix |
---|
[274] | 3219 | cmd=[PatchBin... |
---|
| 3220 | ' -f ' filename_nc ' -m ' num2str(Param.Nx)... |
---|
| 3221 | ' -n ' num2str(Param.Ny) ' -ro ' num2str(Param.SmoothingParam)... |
---|
| 3222 | ' -nopt ' num2str(Param.SubdomainSize) ... |
---|
[275] | 3223 | ' > ' namelog ' 2>&1']; % redirect standard output to the log file |
---|
[163] | 3224 | else |
---|
[272] | 3225 | cmd=['"' param.global.PatchBin... |
---|
[274] | 3226 | '" -f "' filename_nc '" -m ' param.Patch1.Nx... |
---|
| 3227 | ' -n ' param.Patch1.Ny ' -ro ' param.Patch1.SmoothParam... |
---|
| 3228 | ' -nopt ' Param.Patch1.SubdomainSize ... |
---|
[163] | 3229 | ' > "' namelog '" 2>&1']; % redirect standard output to the log file |
---|
| 3230 | end |
---|
[272] | 3231 | % else %nouveau programme patch |
---|
| 3232 | % cmd=[PatchBin ' -f ' filename_nc ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ... |
---|
| 3233 | % ' -max ' thresh_value ' -nopt ' subdomain_patch ' > ' namelog ' 2>&1']; % redirect standard output to the log file |
---|
| 3234 | % end |
---|
| 3235 | cmd=regexprep(cmd,'\\','\\\\'); |
---|
[274] | 3236 | |
---|
[12] | 3237 | %------------------------------------------------------------------------ |
---|
| 3238 | % --- STEREO Interp |
---|
[67] | 3239 | function cmd=RUN_STINTERP(stinterpBin,filename_A_nc,filename_B_nc,filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,xmlA,xmlB) |
---|
[12] | 3240 | %------------------------------------------------------------------------ |
---|
[224] | 3241 | namelog=[filename_nc(1:end-3) '_stinterp.log']; |
---|
[67] | 3242 | cmd=[stinterpBin ' -f1 ' filename_A_nc ' -f2 ' filename_B_nc ' -f ' filename_nc ... |
---|
[2] | 3243 | ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ' -c1 ' xmlA ' -c2 ' xmlB ' -xy x -Nfy 1024 > ' namelog ' 2>&1']; % redirect standard output to the log file |
---|
| 3244 | |
---|
[12] | 3245 | %------------------------------------------------------------------------ |
---|
[2] | 3246 | % --- Executes on button press in CIV1. |
---|
| 3247 | function CIV1_Callback(hObject, eventdata, handles) |
---|
[12] | 3248 | %------------------------------------------------------------------------ |
---|
[273] | 3249 | state=get(handles.CIV1,'Value'); |
---|
| 3250 | enable_civ1(handles,state) |
---|
| 3251 | if state |
---|
[2] | 3252 | enable_pair1(handles,'on') |
---|
| 3253 | end |
---|
| 3254 | find_netcpair_civ1(hObject, eventdata, handles); |
---|
| 3255 | |
---|
[12] | 3256 | %------------------------------------------------------------------------ |
---|
[2] | 3257 | % --- Executes on button press in FIX1. |
---|
| 3258 | function FIX1_Callback(hObject, eventdata, handles) |
---|
[12] | 3259 | %------------------------------------------------------------------------ |
---|
[2] | 3260 | enable_fix1(handles,get(handles.FIX1,'Value')) |
---|
| 3261 | |
---|
[12] | 3262 | %------------------------------------------------------------------------ |
---|
[2] | 3263 | % --- Executes on button press in PATCH1. |
---|
| 3264 | function PATCH1_Callback(hObject, eventdata, handles) |
---|
[12] | 3265 | %------------------------------------------------------------------------ |
---|
[273] | 3266 | enable_patch1(handles,get(handles.PATCH1,'Value')) |
---|
[2] | 3267 | |
---|
[12] | 3268 | %------------------------------------------------------------------------ |
---|
[2] | 3269 | % --- Executes on button press in CIV2. |
---|
| 3270 | function CIV2_Callback(hObject, eventdata, handles) |
---|
[12] | 3271 | %------------------------------------------------------------------------ |
---|
[2] | 3272 | state=get(handles.CIV2,'Value'); |
---|
| 3273 | enable_civ2(handles,state) |
---|
| 3274 | if state |
---|
| 3275 | find_netcpair_civ2(hObject, eventdata, handles) |
---|
| 3276 | enable_pair1(handles,'on') |
---|
| 3277 | end |
---|
| 3278 | |
---|
[12] | 3279 | %------------------------------------------------------------------------ |
---|
[2] | 3280 | % --- Executes on button press in FIX2. |
---|
| 3281 | function FIX2_Callback(hObject, eventdata, handles) |
---|
[12] | 3282 | %------------------------------------------------------------------------ |
---|
[273] | 3283 | state=get(handles.FIX2,'Value'); |
---|
| 3284 | enable_fix2(handles,state) |
---|
| 3285 | if state |
---|
| 3286 | find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files |
---|
[2] | 3287 | end |
---|
| 3288 | |
---|
[12] | 3289 | %------------------------------------------------------------------------ |
---|
[2] | 3290 | % --- Executes on button press in PATCH2. |
---|
| 3291 | function PATCH2_Callback(hObject, eventdata, handles) |
---|
[12] | 3292 | %------------------------------------------------------------------------ |
---|
[273] | 3293 | state=get(handles.PATCH2,'Value'); |
---|
| 3294 | enable_patch2(handles,state) |
---|
| 3295 | if state |
---|
| 3296 | find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files |
---|
[2] | 3297 | end |
---|
| 3298 | |
---|
[12] | 3299 | %------------------------------------------------------------------------ |
---|
| 3300 | function first_i_Callback(hObject, eventdata, handles) |
---|
| 3301 | %------------------------------------------------------------------------ |
---|
| 3302 | % last_i_Callback(hObject, eventdata, handles) |
---|
[137] | 3303 | first_i=str2double(get(handles.first_i,'String')); |
---|
[12] | 3304 | % last_i=str2num(get(handles.last_i,'String')); |
---|
| 3305 | % ref_i=ceil((first_i+last_i)/2); |
---|
| 3306 | set(handles.ref_i,'String', num2str(first_i))% reference index for pair dt = first index |
---|
[273] | 3307 | %set(handles.ref_i_civ2,'String', num2str(first_i))% reference index for pair dt = first index |
---|
[12] | 3308 | ref_i_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) |
---|
[2] | 3309 | |
---|
[12] | 3310 | %------------------------------------------------------------------------ |
---|
| 3311 | function first_j_Callback(hObject, eventdata, handles) |
---|
| 3312 | %------------------------------------------------------------------------ |
---|
| 3313 | first_j=str2num(get(handles.first_j,'String')); |
---|
| 3314 | set(handles.ref_j,'String', num2str(first_j))% reference index for pair dt = first index |
---|
| 3315 | ref_j_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) |
---|
[2] | 3316 | |
---|
[12] | 3317 | %------------------------------------------------------------------------ |
---|
[273] | 3318 | % --- Executes on button press in SearchRange: determine the search range isx,isy |
---|
| 3319 | function SearchRange_Callback(hObject, eventdata, handles) |
---|
[12] | 3320 | %------------------------------------------------------------------------ |
---|
[2] | 3321 | %determine pair numbers |
---|
[273] | 3322 | if strcmp(get(handles.umin,'Visible'),'off') |
---|
| 3323 | set(handles.u_title,'Visible','on') |
---|
| 3324 | set(handles.v_title,'Visible','on') |
---|
| 3325 | set(handles.umin,'Visible','on') |
---|
| 3326 | set(handles.umax,'Visible','on') |
---|
| 3327 | set(handles.vmin,'Visible','on') |
---|
| 3328 | set(handles.vmax,'Visible','on') |
---|
| 3329 | set(handles.CoordUnit,'Visible','on') |
---|
| 3330 | set(handles.TimeUnit,'Visible','on') |
---|
| 3331 | set(handles.slash_title,'Visible','on') |
---|
| 3332 | set(handles.min_title,'Visible','on') |
---|
| 3333 | set(handles.max_title,'Visible','on') |
---|
| 3334 | set(handles.unit_title,'Visible','on') |
---|
| 3335 | else |
---|
| 3336 | get_search_range(hObject, eventdata, handles) |
---|
[2] | 3337 | end |
---|
| 3338 | |
---|
[12] | 3339 | %------------------------------------------------------------------------ |
---|
[273] | 3340 | % --- determine the search range isx,isy and shift |
---|
| 3341 | function get_search_range(hObject, eventdata, handles) |
---|
| 3342 | umin=str2double(get(handles.umin,'String')); |
---|
| 3343 | umax=str2double(get(handles.umax,'String')); |
---|
| 3344 | vmin=str2double(get(handles.umin,'String')); |
---|
| 3345 | vmax=str2double(get(handles.vmax,'String')); |
---|
| 3346 | %switch min_title and max_title in case of error |
---|
| 3347 | if umax<=umin |
---|
| 3348 | umin_old=umin; |
---|
| 3349 | umin=umax; |
---|
| 3350 | umax=umin_old; |
---|
| 3351 | set(handles.umin,'String', num2str(umin)) |
---|
| 3352 | set(handles.umax,'String', num2str(umax)) |
---|
| 3353 | end |
---|
| 3354 | if vmax<=vmin |
---|
| 3355 | vmin_old=vmin; |
---|
| 3356 | vmin=vmax; |
---|
| 3357 | vmax=vmin_old; |
---|
| 3358 | set(handles.vmin,'String', num2str(vmin)) |
---|
| 3359 | set(handles.vmax,'String', num2str(vmax)) |
---|
| 3360 | end |
---|
| 3361 | if ~(isnan(umin)||isnan(umax)||isnan(vmin)||isnan(vmax)) |
---|
| 3362 | list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs |
---|
| 3363 | index=get(handles.list_pair_civ1,'Value'); |
---|
| 3364 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
| 3365 | time=get(handles.ImaDoc,'UserData'); %get the set of times |
---|
| 3366 | pxcm_xy=get(handles.SearchRange,'UserData'); |
---|
| 3367 | pxcmx=pxcm_xy(1); |
---|
| 3368 | pxcmy=pxcm_xy(2); |
---|
| 3369 | mode_list=get(handles.CivMode,'String'); |
---|
| 3370 | mode_value=get(handles.CivMode,'Value'); |
---|
| 3371 | mode=mode_list{mode_value}; |
---|
| 3372 | if isequal (mode, 'series(Di)' ) |
---|
| 3373 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
| 3374 | num1=ref_i-floor(index/2);% first image numbers |
---|
| 3375 | num2=ref_i+ceil(index/2); |
---|
| 3376 | num_a=1; |
---|
| 3377 | num_b=1; |
---|
| 3378 | elseif isequal (mode, 'series(Dj)') |
---|
| 3379 | num1=1; |
---|
| 3380 | num2=1; |
---|
| 3381 | ref_j=str2double(get(handles.ref_j,'String')); |
---|
| 3382 | num_a=ref_j-floor(index/2);% first image numbers |
---|
| 3383 | num_b=ref_j+ceil(index/2); |
---|
| 3384 | elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) |
---|
| 3385 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
| 3386 | num1=ref_i; |
---|
| 3387 | num2=ref_i; |
---|
| 3388 | num_a=displ_num(1,index); |
---|
| 3389 | num_b=displ_num(2,index); |
---|
| 3390 | end |
---|
| 3391 | dt=time(num2,num_b)-time(num1,num_a); |
---|
| 3392 | ibx=str2double(get(handles.ibx,'String')); |
---|
| 3393 | iby=str2double(get(handles.iby,'String')); |
---|
| 3394 | umin=dt*pxcmx*umin; |
---|
| 3395 | umax=dt*pxcmx*umax; |
---|
| 3396 | vmin=dt*pxcmy*vmin; |
---|
| 3397 | vmax=dt*pxcmy*vmax; |
---|
| 3398 | shiftx=round((umin+umax)/2); |
---|
| 3399 | shifty=round((vmin+vmax)/2); |
---|
| 3400 | isx=(umax+2-shiftx)*2+ibx; |
---|
| 3401 | isx=2*ceil(isx/2)+1; |
---|
| 3402 | isy=(vmax+2-shifty)*2+iby; |
---|
| 3403 | isy=2*ceil(isy/2)+1; |
---|
| 3404 | set(handles.shiftx,'String',num2str(shiftx)); |
---|
| 3405 | set(handles.shifty,'String',num2str(shifty)); |
---|
| 3406 | set(handles.isx,'String',num2str(isx)); |
---|
| 3407 | set(handles.isy,'String',num2str(isy)); |
---|
| 3408 | end |
---|
| 3409 | |
---|
| 3410 | %------------------------------------------------------------------------ |
---|
[12] | 3411 | % --- Executes on carriage return on the subdir civ1 edit window |
---|
[2] | 3412 | function subdir_civ1_Callback(hObject, eventdata, handles) |
---|
[12] | 3413 | %------------------------------------------------------------------------ |
---|
[2] | 3414 | subdir=get(handles.subdir_civ1,'String'); |
---|
[273] | 3415 | set(handles.subdir_civ2,'String',subdir);% set civ2 directory the same as civ1 by default |
---|
| 3416 | menu_str=get(handles.list_subdir_civ1,'String');% read the list of subdirectories for update |
---|
| 3417 | ichoice=find(strcmp(subdir,menu_str),1); |
---|
| 3418 | if isempty(ichoice) |
---|
| 3419 | ilist=numel(menu_str); %select 'new...' in the menu |
---|
| 3420 | else |
---|
| 3421 | ilist=ichoice; |
---|
| 3422 | end |
---|
| 3423 | set(handles.list_subdir_civ1,'Value',ilist)% select the selected subdir in the menu |
---|
[112] | 3424 | if get(handles.CIV1,'Value')==0 |
---|
[2] | 3425 | find_netcpair_civ1(hObject, eventdata, handles); %update the list of available pairs from netcdf files in the new directory |
---|
| 3426 | end |
---|
| 3427 | |
---|
[12] | 3428 | %------------------------------------------------------------------------ |
---|
| 3429 | % --- Executes on carriage return on the subdir civ1 edit window |
---|
[2] | 3430 | function subdir_civ2_Callback(hObject, eventdata, handles) |
---|
[12] | 3431 | %------------------------------------------------------------------------ |
---|
[273] | 3432 | subdir=get(handles.subdir_civ1,'String'); |
---|
| 3433 | menu_str=get(handles.list_subdir_civ2,'String');% read the list of subdirectories for update |
---|
| 3434 | ichoice=find(strcmp(subdir,menu_str),1); |
---|
| 3435 | if isempty(ichoice) |
---|
| 3436 | ilist=numel(menu_str); %select 'new...' in the menu |
---|
| 3437 | else |
---|
| 3438 | ilist=ichoice; |
---|
| 3439 | end |
---|
| 3440 | set(handles.list_subdir_civ2,'Value',ilist)% select the selected subdir in the menu |
---|
[2] | 3441 | %update the list of available pairs from netcdf files in the new directory |
---|
[273] | 3442 | if ~get(handles.CIV2,'Value') && ~get(handles.CIV1,'Value') && ~get(handles.FIX1,'Value') && ~get(handles.PATCH1,'Value') |
---|
[2] | 3443 | find_netcpair_civ2(hObject, eventdata, handles); |
---|
| 3444 | end |
---|
| 3445 | |
---|
[276] | 3446 | % %------------------------------------------------------------------------ |
---|
| 3447 | % % --- Executes on button press in check_Mask: select box for mask option |
---|
| 3448 | % function check_Mask_Callback(hObject, eventdata, handles) |
---|
| 3449 | % %------------------------------------------------------------------------ |
---|
| 3450 | % maskval=get(handles.check_Mask,'Value'); |
---|
| 3451 | % if isequal(maskval,0) |
---|
| 3452 | % set(handles.txt_MaskName,'Visible','off') |
---|
| 3453 | % % set(handles.txt_MaskName,'String','') |
---|
| 3454 | % else |
---|
| 3455 | % mask_displ='no mask'; %default |
---|
| 3456 | % filebase=get(handles.RootName,'String'); |
---|
| 3457 | % [ nbslice_mask, flag_mask]=get_mask(filebase,handles); |
---|
| 3458 | % if isequal(flag_mask,1) |
---|
| 3459 | % mask_displ=[num2str(nbslice_mask) 'mask']; |
---|
| 3460 | % elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
| 3461 | % common_path=fileparts(filebase); |
---|
| 3462 | % filebase_a=fullfile(common_path,get(handles.RootName_1,'String')); |
---|
| 3463 | % [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
| 3464 | % if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice_mask) |
---|
| 3465 | % mask_displ='no mask'; |
---|
| 3466 | % end |
---|
| 3467 | % end |
---|
| 3468 | % if isequal(mask_displ,'no mask') |
---|
| 3469 | % [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 3470 | % {'*.png', ' (*.png)'; |
---|
| 3471 | % '*.png', '.png files '; ... |
---|
| 3472 | % '*.*', 'All Files (*.*)'}, ... |
---|
| 3473 | % 'Pick a mask file *.png',filebase); |
---|
| 3474 | % mask_displ=fullfile(PathName,FileName); |
---|
| 3475 | % if exist(mask_displ,'file') |
---|
| 3476 | % set(handles.txt_MaskName,'Visible','on') |
---|
| 3477 | % set(handles.txt_MaskName,'String',mask_displ) |
---|
| 3478 | % % mask_displ='no mask'; |
---|
| 3479 | % end |
---|
| 3480 | % end |
---|
| 3481 | % if isequal(mask_displ,'no mask') |
---|
| 3482 | % set(handles.check_Mask,'Value',0) |
---|
| 3483 | % set(handles.get_mask_fix1,'Value',0) |
---|
| 3484 | % set(handles.check_Mask,'Value',0) |
---|
| 3485 | % set(handles.get_mask_fix2,'Value',0) |
---|
| 3486 | % else |
---|
| 3487 | % set(handles.get_mask_fix1,'Value',1) |
---|
| 3488 | % set(handles.get_mask_fix2,'Value',1) |
---|
| 3489 | % end |
---|
| 3490 | % set(handles.txt_MaskName,'String',mask_displ) |
---|
| 3491 | % set(handles.mask_fix1,'String',mask_displ) |
---|
| 3492 | % set(handles.txt_Mask,'String',mask_displ) |
---|
| 3493 | % set(handles.mask_fix2,'String',mask_displ) |
---|
| 3494 | % end |
---|
| 3495 | % set(handles.check_Mask,'Value',maskval)%update the civ2 mask with the same option as civ1 |
---|
[2] | 3496 | |
---|
[12] | 3497 | %------------------------------------------------------------------------ |
---|
[2] | 3498 | % --- Executes on button press in get_mask_fix1. |
---|
| 3499 | function get_mask_fix1_Callback(hObject, eventdata, handles) |
---|
[12] | 3500 | %------------------------------------------------------------------------ |
---|
[2] | 3501 | maskval=get(handles.get_mask_fix1,'Value'); |
---|
| 3502 | if isequal(maskval,0) |
---|
| 3503 | set(handles.mask_fix1,'String','') |
---|
| 3504 | else |
---|
[112] | 3505 | mask_displ='no mask'; %default |
---|
| 3506 | filebase=get(handles.RootName,'String'); |
---|
| 3507 | [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
| 3508 | if isequal(flag_mask,1) |
---|
| 3509 | mask_displ=[num2str(nbslice) 'mask']; |
---|
| 3510 | elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
[71] | 3511 | filebase_a=get(handles.RootName_1,'String'); |
---|
[2] | 3512 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
[229] | 3513 | if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) |
---|
[2] | 3514 | mask_displ='no mask'; |
---|
| 3515 | end |
---|
[112] | 3516 | end |
---|
| 3517 | if isequal(mask_displ,'no mask') |
---|
| 3518 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 3519 | {'*.png', ' (*.png)'; |
---|
[12] | 3520 | '*.png', '.png files '; ... |
---|
| 3521 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3522 | 'Pick a mask file *.png',filebase); |
---|
[112] | 3523 | mask_displ=fullfile(PathName,FileName); |
---|
| 3524 | if ~exist(mask_displ,'file') |
---|
| 3525 | mask_displ='no mask'; |
---|
| 3526 | end |
---|
[12] | 3527 | end |
---|
[112] | 3528 | if isequal(mask_displ,'no mask') |
---|
| 3529 | set(handles.get_mask_fix1,'Value',0) |
---|
[276] | 3530 | set(handles.check_Mask,'Value',0) |
---|
[112] | 3531 | set(handles.get_mask_fix2,'Value',0) |
---|
| 3532 | else |
---|
[276] | 3533 | %set(handles.check_Mask,'Value',1) |
---|
[112] | 3534 | set(handles.get_mask_fix2,'Value',1) |
---|
| 3535 | end |
---|
| 3536 | set(handles.mask_fix1,'String',mask_displ) |
---|
[276] | 3537 | set(handles.txt_Mask,'String',mask_displ) |
---|
[112] | 3538 | set(handles.mask_fix2,'String',mask_displ) |
---|
[12] | 3539 | end |
---|
| 3540 | |
---|
| 3541 | %------------------------------------------------------------------------ |
---|
[276] | 3542 | % --- Executes on button press in check_Mask: select box for mask option |
---|
[2] | 3543 | function get_mask_civ2_Callback(hObject, eventdata, handles) |
---|
[12] | 3544 | %------------------------------------------------------------------------ |
---|
[276] | 3545 | maskval=get(handles.check_Mask,'Value'); |
---|
[2] | 3546 | if isequal(maskval,0) |
---|
[276] | 3547 | set(handles.txt_Mask,'String','') |
---|
[2] | 3548 | else |
---|
[112] | 3549 | mask_displ='no mask'; %default |
---|
| 3550 | filebase=get(handles.RootName,'String'); |
---|
| 3551 | [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
| 3552 | if isequal(flag_mask,1) |
---|
| 3553 | mask_displ=[num2str(nbslice) 'mask']; |
---|
| 3554 | elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
[71] | 3555 | filebase_a=get(handles.RootName_1,'String'); |
---|
[2] | 3556 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
[229] | 3557 | if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) |
---|
[2] | 3558 | mask_displ='no mask'; |
---|
| 3559 | end |
---|
[112] | 3560 | end |
---|
| 3561 | if isequal(mask_displ,'no mask') |
---|
| 3562 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 3563 | {'*.png', ' (*.png)'; |
---|
[12] | 3564 | '*.png', '.png files '; ... |
---|
| 3565 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3566 | 'Pick a mask file *.png',filebase); |
---|
[112] | 3567 | mask_displ=fullfile(PathName,FileName); |
---|
| 3568 | if ~exist(mask_displ,'file') |
---|
| 3569 | mask_displ='no mask'; |
---|
| 3570 | end |
---|
[12] | 3571 | end |
---|
[112] | 3572 | if isequal(mask_displ,'no mask') |
---|
[276] | 3573 | set(handles.check_Mask,'Value',0) |
---|
[112] | 3574 | set(handles.get_mask_fix2,'Value',0) |
---|
| 3575 | else |
---|
| 3576 | set(handles.get_mask_fix2,'Value',1) |
---|
| 3577 | end |
---|
[276] | 3578 | set(handles.txt_Mask,'String',mask_displ) |
---|
[112] | 3579 | set(handles.mask_fix2,'String',mask_displ) |
---|
[12] | 3580 | end |
---|
| 3581 | |
---|
| 3582 | %------------------------------------------------------------------------ |
---|
[2] | 3583 | % --- Executes on button press in get_mask_fix2. |
---|
| 3584 | function get_mask_fix2_Callback(hObject, eventdata, handles) |
---|
[12] | 3585 | %------------------------------------------------------------------------ |
---|
[2] | 3586 | maskval=get(handles.get_mask_fix2,'Value'); |
---|
| 3587 | if isequal(maskval,0) |
---|
| 3588 | set(handles.mask_fix2,'String','') |
---|
| 3589 | else |
---|
[12] | 3590 | mask_displ='no mask'; %default |
---|
[71] | 3591 | filebase=get(handles.RootName,'String'); |
---|
[12] | 3592 | [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
| 3593 | if isequal(flag_mask,1) |
---|
[112] | 3594 | mask_displ=[num2str(nbslice) 'mask']; |
---|
[12] | 3595 | elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
[112] | 3596 | filebase_a=get(handles.RootName_1,'String'); |
---|
| 3597 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
[229] | 3598 | if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) |
---|
[112] | 3599 | mask_displ='no mask'; |
---|
| 3600 | end |
---|
[12] | 3601 | end |
---|
| 3602 | if isequal(mask_displ,'no mask') |
---|
| 3603 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 3604 | {'*.png', ' (*.png)'; |
---|
| 3605 | '*.png', '.png files '; ... |
---|
| 3606 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3607 | 'Pick a mask file *.png',filebase); |
---|
| 3608 | mask_displ=fullfile(PathName,FileName); |
---|
[12] | 3609 | if ~exist(mask_displ,'file') |
---|
[2] | 3610 | mask_displ='no mask'; |
---|
| 3611 | end |
---|
[12] | 3612 | end |
---|
| 3613 | if isequal(mask_displ,'no mask') |
---|
| 3614 | set(handles.get_mask_fix2,'Value',0) |
---|
[112] | 3615 | end |
---|
[12] | 3616 | set(handles.mask_fix2,'String',mask_displ) |
---|
[2] | 3617 | end |
---|
| 3618 | |
---|
[12] | 3619 | %------------------------------------------------------------------------ |
---|
| 3620 | % --- function called to look for mask files |
---|
[2] | 3621 | function [nbslice, flag_mask]=get_mask(filebase,handles) |
---|
[12] | 3622 | %------------------------------------------------------------------------ |
---|
[112] | 3623 | %detect mask files, images with appropriate file base |
---|
[2] | 3624 | %[filebase '_' xx 'mask'], xx=nbslice |
---|
| 3625 | %flag_mask=1 indicates detection |
---|
| 3626 | |
---|
| 3627 | flag_mask=0;%default |
---|
| 3628 | nbslice=1; |
---|
| 3629 | |
---|
| 3630 | % subdir=get(handles.subdir_civ1,'String'); |
---|
| 3631 | [Path,Name]=fileparts(filebase); |
---|
[12] | 3632 | if ~isdir(Path) |
---|
| 3633 | msgbox_uvmat('ERROR','no path for input files') |
---|
| 3634 | return |
---|
| 3635 | end |
---|
[272] | 3636 | % currentdir=pwd; |
---|
| 3637 | % cd(Path);%move in the dir of the root name filebase |
---|
| 3638 | maskfiles=dir(fullfile(Path,[Name '_*mask_*.png']));%look for mask files |
---|
| 3639 | % cd(currentdir);%come back to the current working directory |
---|
[12] | 3640 | if ~isempty(maskfiles) |
---|
[112] | 3641 | % msgbox_uvmat('ERROR','no mask available, to create it use Tools/Make mask in the upper menu bar of uvmat') |
---|
| 3642 | % else |
---|
[2] | 3643 | flag_mask=1; |
---|
| 3644 | maskname=maskfiles(1).name;% take the first mask file in the list |
---|
| 3645 | [Path2,Name,ext]=fileparts(maskname); |
---|
| 3646 | Namedouble=double(Name); |
---|
| 3647 | val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters |
---|
| 3648 | ind_mask=findstr('mask',Name); |
---|
| 3649 | i=ind_mask-1; |
---|
[137] | 3650 | while val(i)==0 && i>0 |
---|
[112] | 3651 | i=i-1; |
---|
[2] | 3652 | end |
---|
[137] | 3653 | nbslice=str2double(Name(i+1:ind_mask-1)); |
---|
| 3654 | if ~isnan(nbslice) && Name(i)=='_' |
---|
[112] | 3655 | flag_mask=1; |
---|
[2] | 3656 | else |
---|
[112] | 3657 | msgbox_uvmat('ERROR',['bad mask file ' Name ext ' found in ' Path2]) |
---|
| 3658 | return |
---|
| 3659 | nbslice=1; |
---|
[2] | 3660 | end |
---|
[112] | 3661 | end |
---|
[2] | 3662 | |
---|
[12] | 3663 | %------------------------------------------------------------------------ |
---|
| 3664 | % --- function called to look for grid files |
---|
[2] | 3665 | function [nbslice, flag_mask]=get_grid(filebase,handles) |
---|
[12] | 3666 | %------------------------------------------------------------------------ |
---|
[2] | 3667 | flag_mask=0;%default |
---|
| 3668 | nbslice=1; |
---|
| 3669 | [Path,Name]=fileparts(filebase); |
---|
| 3670 | currentdir=pwd; |
---|
| 3671 | cd(Path);%move in the dir of the root name filebase |
---|
| 3672 | maskfiles=dir([Name '_*grid_*.grid']);%look for mask files |
---|
| 3673 | cd(currentdir);%come back to the current working directory |
---|
| 3674 | if ~isempty(maskfiles) |
---|
| 3675 | flag_mask=1; |
---|
| 3676 | maskname=maskfiles(1).name;% take the first mask file in the list |
---|
| 3677 | [Path2,Name,ext]=fileparts(maskname); |
---|
| 3678 | Namedouble=double(Name); |
---|
| 3679 | val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters |
---|
| 3680 | ind_mask=findstr('grid',Name); |
---|
| 3681 | i=ind_mask-1; |
---|
[137] | 3682 | while val(i)==0 && i>0 |
---|
[112] | 3683 | i=i-1; |
---|
[2] | 3684 | end |
---|
[137] | 3685 | nbslice=str2double(Name(i+1:ind_mask-1)); |
---|
| 3686 | if ~isnan(nbslice) && Name(i)=='_' |
---|
[112] | 3687 | flag_mask=1; |
---|
[2] | 3688 | else |
---|
[112] | 3689 | msgbox_uvmat('ERROR',['bad grid file ' Name ext ' found in ' Path2]) |
---|
| 3690 | return |
---|
| 3691 | nbslice=1; |
---|
[2] | 3692 | end |
---|
[12] | 3693 | end |
---|
[2] | 3694 | |
---|
[12] | 3695 | %------------------------------------------------------------------------ |
---|
| 3696 | % --- transform numbers to letters |
---|
[122] | 3697 | function str=num2stra(num,nom_type) |
---|
[12] | 3698 | %------------------------------------------------------------------------ |
---|
[122] | 3699 | if isempty(nom_type) |
---|
| 3700 | str=''; |
---|
| 3701 | elseif strcmp(nom_type(end),'a') |
---|
[2] | 3702 | str=char(96+num); |
---|
[122] | 3703 | elseif strcmp(nom_type(end),'A') |
---|
| 3704 | str=char(96+num); |
---|
| 3705 | elseif isempty(nom_type(2:end))%a single index |
---|
[2] | 3706 | str=''; |
---|
| 3707 | else |
---|
| 3708 | str=num2str(num); |
---|
| 3709 | end |
---|
[12] | 3710 | |
---|
| 3711 | %------------------------------------------------------------------------ |
---|
[2] | 3712 | % --- Executes on button press in list_subdir_civ1. |
---|
| 3713 | function list_subdir_civ1_Callback(hObject, eventdata, handles) |
---|
[12] | 3714 | %------------------------------------------------------------------------ |
---|
[2] | 3715 | list_subdir_civ1=get(handles.list_subdir_civ1,'String'); |
---|
| 3716 | val=get(handles.list_subdir_civ1,'Value'); |
---|
[273] | 3717 | subdir=list_subdir_civ1{val}; |
---|
| 3718 | if strcmp(subdir,'new...') |
---|
| 3719 | subdir='CIV'; %default subdirectory |
---|
[2] | 3720 | end |
---|
[273] | 3721 | set(handles.subdir_civ1,'String',subdir); |
---|
| 3722 | find_netcpair_civ1(hObject, eventdata, handles) |
---|
| 3723 | % end |
---|
[2] | 3724 | |
---|
[12] | 3725 | %------------------------------------------------------------------------ |
---|
[2] | 3726 | % --- Executes on button press in list_subdir_civ2. |
---|
| 3727 | function list_subdir_civ2_Callback(hObject, eventdata, handles) |
---|
[12] | 3728 | %------------------------------------------------------------------------ |
---|
[2] | 3729 | list_subdir_civ2=get(handles.list_subdir_civ2,'String'); |
---|
| 3730 | val=get(handles.list_subdir_civ2,'Value'); |
---|
[273] | 3731 | subdir=list_subdir_civ2{val}; |
---|
| 3732 | if strcmp(subdir,'new...') |
---|
| 3733 | subdir='CIV'; %default subdirectory |
---|
[2] | 3734 | end |
---|
[273] | 3735 | set(handles.subdir_civ2,'String',subdir); |
---|
| 3736 | % set(handles.list_subdir_civ2,'Value',1); |
---|
[2] | 3737 | |
---|
[273] | 3738 | |
---|
[12] | 3739 | %------------------------------------------------------------------------ |
---|
[276] | 3740 | % --- Executes on button press in check_Grid. |
---|
| 3741 | function check_Grid_Callback(hObject, eventdata, handles) |
---|
[12] | 3742 | %------------------------------------------------------------------------ |
---|
[276] | 3743 | value=get(hObject,'Value'); |
---|
| 3744 | hparent=get(hObject,'parent'); |
---|
| 3745 | hchildren=get(hparent,'children'); |
---|
| 3746 | handle_txtbox=findobj(hchildren,'tag','txt_GridName'); |
---|
| 3747 | handle_dx=findobj(hchildren,'tag','num_Dx'); |
---|
| 3748 | handle_dy=findobj(hchildren,'tag','num_Dy'); |
---|
[2] | 3749 | testgrid=0; |
---|
[276] | 3750 | filegrid=''; |
---|
[2] | 3751 | if value |
---|
[112] | 3752 | filebase=get(handles.RootName,'String'); |
---|
[276] | 3753 | [nbslice, flag_grid]=get_grid(filebase,handles);% look for a grid with appropriate name |
---|
[2] | 3754 | if isequal(flag_grid,1) |
---|
[112] | 3755 | filegrid=[num2str(nbslice) 'grid']; |
---|
| 3756 | testgrid=1; |
---|
[276] | 3757 | else % browse for a grid |
---|
| 3758 | filegrid=get(hObject,'UserData');%look for previous grid name stored as UserData |
---|
| 3759 | if exist(filegrid,'file') |
---|
| 3760 | filebase=filegrid; |
---|
| 3761 | end |
---|
[2] | 3762 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 3763 | {'*.grid', ' (*.grid)'; |
---|
| 3764 | '*.grid', '.grid files '; ... |
---|
| 3765 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3766 | 'Pick a file',filebase); |
---|
[2] | 3767 | filegrid=fullfile(PathName,FileName); |
---|
[276] | 3768 | set(hObject,'UserData',filegrid);%store for future use |
---|
[2] | 3769 | if ~(isempty(FileName)||isempty(PathName)||isequal(FileName,0)||~exist(filegrid,'file')) |
---|
| 3770 | testgrid=1; |
---|
| 3771 | end |
---|
[112] | 3772 | end |
---|
[2] | 3773 | end |
---|
| 3774 | if testgrid |
---|
[276] | 3775 | set(handle_dx,'Visible','off'); |
---|
| 3776 | set(handle_dy,'Visible','off'); |
---|
| 3777 | set(handle_txtbox,'Visible','on') |
---|
| 3778 | set(handle_txtbox,'String',filegrid) |
---|
[112] | 3779 | else |
---|
[276] | 3780 | set(hObject,'Value',0); |
---|
| 3781 | set(handle_dx,'Visible','on'); |
---|
| 3782 | set(handle_dy,'Visible','on'); |
---|
| 3783 | set(handle_txtbox,'Visible','off') |
---|
[2] | 3784 | end |
---|
| 3785 | |
---|
[276] | 3786 | %% if hObject is on the civ1 frame, duplicate action for civ2 frame |
---|
| 3787 | PanelName=get(hparent,'tag'); |
---|
| 3788 | if strcmp(PanelName,'panel_Civ1') |
---|
| 3789 | hchildren=get(handles.panel_Civ2,'children'); |
---|
| 3790 | handle_checkbox=findobj(hchildren,'tag','check_Grid'); |
---|
| 3791 | handle_txtbox=findobj(hchildren,'tag','txt_GridName'); |
---|
| 3792 | handle_dx=findobj(hchildren,'tag','num_Dx'); |
---|
| 3793 | handle_dy=findobj(hchildren,'tag','num_Dy'); |
---|
| 3794 | set(handle_checkbox,'UserData',filegrid);%store for future use |
---|
| 3795 | if testgrid |
---|
| 3796 | set(handle_checkbox,'Value',1); |
---|
| 3797 | set(handle_dx,'Visible','off'); |
---|
| 3798 | set(handle_dy,'Visible','off'); |
---|
| 3799 | set(handle_txtbox,'Visible','on') |
---|
| 3800 | set(handle_txtbox,'String',filegrid) |
---|
| 3801 | else |
---|
| 3802 | set(handle_checkbox,'Value',0); |
---|
| 3803 | set(handles.check_Grid,'Value',0); |
---|
| 3804 | set(handle_dx,'Visible','on'); |
---|
| 3805 | set(handle_dy,'Visible','on'); |
---|
| 3806 | set(handle_txtbox,'Visible','off') |
---|
| 3807 | end |
---|
| 3808 | end |
---|
[12] | 3809 | %------------------------------------------------------------------------ |
---|
[276] | 3810 | % --- Executes on button press in check_Mask. |
---|
| 3811 | function check_Mask_Callback(hObject, eventdata, handles) |
---|
| 3812 | %------------------------------------------------------------------------ |
---|
| 3813 | value=get(hObject,'Value'); |
---|
| 3814 | testmask=0; |
---|
| 3815 | if value |
---|
| 3816 | filebase=get(handles.RootName,'String'); |
---|
| 3817 | [nbslice, flag_mask]=get_mask(filebase,handles);% look for a mask with appropriate name |
---|
| 3818 | if isequal(flag_mask,1) |
---|
| 3819 | filemask=[num2str(nbslice) 'mask']; |
---|
| 3820 | testmask=1; |
---|
| 3821 | else % browse for a mask |
---|
| 3822 | filemask=get(handles.check_Mask,'UserData');%look for previous mask name stored as UserData |
---|
| 3823 | if exist(filemask,'file') |
---|
| 3824 | filebase=filemask; |
---|
| 3825 | end |
---|
| 3826 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 3827 | {'*.png', ' (*.png)'; |
---|
| 3828 | '*.png', '.png files '; ... |
---|
| 3829 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3830 | 'Pick a mask file *.png',filebase); |
---|
| 3831 | filemask=fullfile(PathName,FileName); |
---|
| 3832 | set(handles.check_Mask,'UserData',filemask);%store for future use |
---|
| 3833 | if ~(isempty(FileName)||isempty(PathName)||isequal(FileName,0)||~exist(filemask,'file')) |
---|
| 3834 | testmask=1; |
---|
| 3835 | end |
---|
| 3836 | end |
---|
| 3837 | end |
---|
| 3838 | if testmask |
---|
| 3839 | set(handles.num_Dx,'Visible','off'); |
---|
| 3840 | set(handles.num_Dy,'Visible','off'); |
---|
| 3841 | set(handles.num_Dx,'Visible','off'); |
---|
| 3842 | set(handles.num_Dy,'Visible','off'); |
---|
| 3843 | set(handles.txt_MaskName,'Visible','on') |
---|
| 3844 | set(handles.txt_MaskName,'String',filemask) |
---|
| 3845 | else |
---|
| 3846 | set(handles.check_Mask,'Value',0); |
---|
| 3847 | set(handles.check_Grid,'Value',0); |
---|
| 3848 | set(handles.num_Dx,'Visible','on'); |
---|
| 3849 | set(handles.num_Dy,'Visible','on'); |
---|
| 3850 | set(handles.num_Dx,'Visible','on'); |
---|
| 3851 | set(handles.num_Dy,'Visible','on'); |
---|
| 3852 | set(handles.txt_MaskName,'Visible','off') |
---|
| 3853 | end |
---|
| 3854 | |
---|
| 3855 | %------------------------------------------------------------------------ |
---|
| 3856 | % --- Executes on button press in check_Grid. |
---|
[2] | 3857 | function browse_gridciv2_Callback(hObject, eventdata, handles) |
---|
[12] | 3858 | %------------------------------------------------------------------------ |
---|
[276] | 3859 | value=get(handles.check_Grid,'Value'); |
---|
[2] | 3860 | if value |
---|
[112] | 3861 | filebase=get(handles.RootName,'String'); |
---|
[39] | 3862 | [nbslice, flag_grid]=get_grid(filebase,handles); |
---|
[2] | 3863 | if isequal(flag_grid,1) |
---|
| 3864 | mask_displ=[num2str(nbslice) 'grid']; |
---|
[276] | 3865 | set(handles.txt_GridName,'String',mask_displ) |
---|
| 3866 | set(handles.num_Dx,'Visible','off'); |
---|
| 3867 | set(handles.num_Dy,'Visible','off'); |
---|
[112] | 3868 | else |
---|
[2] | 3869 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 3870 | {'*.grid', ' (*.grid)'; |
---|
| 3871 | '*.grid', '.grid files '; ... |
---|
| 3872 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3873 | 'Pick a file',filebase); |
---|
[2] | 3874 | filegrid=fullfile(PathName,FileName); |
---|
[229] | 3875 | if isempty(FileName)||isempty(PathName)||isequal(FileName,0)||~exist(filegrid,'file') |
---|
[276] | 3876 | set(handles.check_Grid,'Value',0); |
---|
| 3877 | set(handles.txt_GridName,'string',''); |
---|
| 3878 | set(handles.num_Dx,'Visible','on'); |
---|
| 3879 | set(handles.num_Dy,'Visible','on'); |
---|
| 3880 | set(handles.txt_GridName,'string',''); |
---|
[2] | 3881 | else |
---|
[276] | 3882 | set(handles.txt_GridName,'string',filegrid); |
---|
| 3883 | set(handles.num_Dx,'Visible','off'); |
---|
| 3884 | set(handles.num_Dy,'Visible','off'); |
---|
| 3885 | set(handles.txt_GridName,'string',filegrid); |
---|
[2] | 3886 | end |
---|
| 3887 | end |
---|
| 3888 | else |
---|
[276] | 3889 | set(handles.txt_GridName,'string',''); |
---|
| 3890 | set(handles.num_Dx,'Visible','on'); |
---|
| 3891 | set(handles.num_Dy,'Visible','on'); |
---|
| 3892 | set(handles.txt_GridName,'string',''); |
---|
[2] | 3893 | end |
---|
| 3894 | |
---|
[276] | 3895 | % % --- Executes on button press in check_Grid. |
---|
[2] | 3896 | % function browse_gridciv2_Callback(hObject, eventdata, handles) |
---|
[112] | 3897 | % |
---|
[71] | 3898 | % filebase=get(handles.RootName,'String'); |
---|
[2] | 3899 | % [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 3900 | % {'*.grid', ' (*.grid)'; |
---|
| 3901 | % '*.grid', '.grid files '; ... |
---|
| 3902 | % '*.*', 'All Files (*.*)'}, ... |
---|
| 3903 | % 'Pick a file',filebase); |
---|
| 3904 | % filegrid=fullfile(PathName,FileName); |
---|
[276] | 3905 | % set(handles.txt_GridName,'string',filegrid); |
---|
| 3906 | % set(handles.num_Dx,'String',' '); |
---|
| 3907 | % set(handles.num_Dy,'String',' '); |
---|
[2] | 3908 | % % set(handles.grid_patch2,'string',filegrid); |
---|
| 3909 | |
---|
| 3910 | % --- Executes on button press in get_gridpatch1. |
---|
| 3911 | function get_gridpatch1_Callback(hObject, eventdata, handles) |
---|
| 3912 | % hObject handle to get_gridpatch1 (see GCBO) |
---|
| 3913 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 3914 | % handles structure with handles and user data (see GUIDATA) |
---|
| 3915 | |
---|
[71] | 3916 | filebase=get(handles.RootName,'String'); |
---|
[2] | 3917 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 3918 | {'*.grid', ' (*.grid)'; |
---|
| 3919 | '*.grid', '.grid files '; ... |
---|
| 3920 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3921 | 'Pick a file',filebase); |
---|
[2] | 3922 | filegrid=fullfile(PathName,FileName); |
---|
| 3923 | set(handles.grid_patch1,'string',filegrid); |
---|
| 3924 | % set(handles.grid_patch2,'string',filegrid |
---|
| 3925 | |
---|
[12] | 3926 | %------------------------------------------------------------------------ |
---|
[2] | 3927 | % --- Executes on button press in get_gridpatch2. |
---|
| 3928 | function get_gridpatch2_Callback(hObject, eventdata, handles) |
---|
[12] | 3929 | %------------------------------------------------------------------------ |
---|
[2] | 3930 | |
---|
[12] | 3931 | %------------------------------------------------------------------------ |
---|
[2] | 3932 | function enable_civ1(handles,state) |
---|
[12] | 3933 | %------------------------------------------------------------------------ |
---|
[273] | 3934 | if state |
---|
| 3935 | RootName=get(handles.RootName,'String'); |
---|
| 3936 | if isempty(RootName) |
---|
| 3937 | msgbox_uvmat('ERROR','No input file') |
---|
| 3938 | return |
---|
| 3939 | end |
---|
[274] | 3940 | set(handles.panel_Civ1,'Visible','on') |
---|
| 3941 | set(handles.panel_PairIndices,'Visible','on') |
---|
[273] | 3942 | % set(handles.frame_civ1,'BackgroundColor',[1 1 0]) |
---|
| 3943 | % set(handles.frame_para_civ1,'BackgroundColor',[1 1 0]) |
---|
| 3944 | % set(handles.frame_grid_civ1,'BackgroundColor',[1 1 0]) |
---|
[2] | 3945 | else |
---|
[274] | 3946 | set(handles.panel_Civ1,'Visible','off') |
---|
[273] | 3947 | % set(handles.frame_civ1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 3948 | % set(handles.frame_para_civ1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 3949 | % set(handles.frame_grid_civ1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
[2] | 3950 | end |
---|
[273] | 3951 | return |
---|
[2] | 3952 | set(handles.ibx,'Visible',state) |
---|
| 3953 | set(handles.iby,'Visible',state) |
---|
| 3954 | set(handles.isx,'Visible',state) |
---|
| 3955 | set(handles.isy,'Visible',state) |
---|
| 3956 | set(handles.shiftx,'Visible',state) |
---|
| 3957 | set(handles.shifty,'Visible',state) |
---|
| 3958 | set(handles.rho,'Visible',state) |
---|
[276] | 3959 | set(handles.num_Dx,'Visible',state) |
---|
| 3960 | set(handles.num_Dy,'Visible',state) |
---|
[273] | 3961 | set(handles.SearchRange,'Visible',state) |
---|
| 3962 | set(handles.u_title,'Visible',state) |
---|
| 3963 | set(handles.v_title,'Visible',state) |
---|
| 3964 | set(handles.min_title,'Visible',state) |
---|
| 3965 | set(handles.max_title,'Visible',state) |
---|
[2] | 3966 | set(handles.umin,'Visible',state) |
---|
| 3967 | set(handles.umax,'Visible',state) |
---|
| 3968 | set(handles.vmin,'Visible',state) |
---|
| 3969 | set(handles.vmax,'Visible',state) |
---|
[276] | 3970 | set(handles.txt_GridName,'Visible',state) |
---|
| 3971 | set(handles.txt_MaskName,'Visible',state) |
---|
| 3972 | set(handles.check_Grid,'Visible',state) |
---|
| 3973 | set(handles.check_Mask,'Visible',state) |
---|
[2] | 3974 | set(handles.parameters,'Visible',state) |
---|
| 3975 | set(handles.grid,'Visible',state) |
---|
[276] | 3976 | set(handles.num_Dx,'Visible',state) |
---|
| 3977 | set(handles.num_Dy,'Visible',state) |
---|
| 3978 | set(handles.check_Threshold,'Visible',state) |
---|
[2] | 3979 | if isequal(state,'off') |
---|
| 3980 | set(handles.MinIma,'Visible','off') |
---|
| 3981 | set(handles.MaxIma,'Visible','off') |
---|
[276] | 3982 | set(handles.check_Threshold,'Value',0) |
---|
[2] | 3983 | end |
---|
| 3984 | set(handles.dx_civ1_title,'Visible',state) |
---|
| 3985 | set(handles.dy_civ1_title,'Visible',state) |
---|
| 3986 | set(handles.ImaThreshold_title,'Visible',state) |
---|
| 3987 | set(handles.ib_title,'Visible',state) |
---|
| 3988 | set(handles.is_title,'Visible',state) |
---|
| 3989 | set(handles.shift_title,'Visible',state) |
---|
| 3990 | set(handles.rho_title,'Visible',state) |
---|
[224] | 3991 | set(handles.TestCiv1,'Visible',state) |
---|
[257] | 3992 | %set(handles.CivMode,'Visible',state) |
---|
[2] | 3993 | |
---|
[12] | 3994 | %------------------------------------------------------------------------ |
---|
[2] | 3995 | function enable_fix1(handles,state) |
---|
[12] | 3996 | %------------------------------------------------------------------------ |
---|
[273] | 3997 | |
---|
[2] | 3998 | if isequal(state,0) |
---|
| 3999 | state='off'; |
---|
| 4000 | end |
---|
| 4001 | if isequal(state,1) |
---|
| 4002 | state='on'; |
---|
[273] | 4003 | RootName=get(handles.RootName,'String'); |
---|
| 4004 | if isempty(RootName) |
---|
| 4005 | msgbox_uvmat('ERROR','No input file') |
---|
| 4006 | return |
---|
| 4007 | end |
---|
[2] | 4008 | end |
---|
| 4009 | if isequal(state,'on') |
---|
[274] | 4010 | set(handles.panel_Fix1,'Visible','on') |
---|
[273] | 4011 | % set(handles.frame_fix1,'BackgroundColor',[1 1 0]) |
---|
[2] | 4012 | else |
---|
[274] | 4013 | set(handles.panel_Fix1,'Visible','off') |
---|
[273] | 4014 | %set(handles.frame_fix1,'BackgroundColor',[0.7 0.7 0.7]) |
---|
[2] | 4015 | end |
---|
[273] | 4016 | % set(handles.REMOVE,'Visible',state) |
---|
[2] | 4017 | set(handles.vec_Fmin2,'Visible',state) |
---|
| 4018 | set(handles.vec_F2,'Visible',state) |
---|
| 4019 | set(handles.vec_F3,'Visible',state) |
---|
| 4020 | set(handles.thresh_vecC,'Visible',state) |
---|
| 4021 | set(handles.thresh_vecC_title,'Visible',state) |
---|
| 4022 | set(handles.thresh_vel,'Visible',state) |
---|
| 4023 | set(handles.thresh_vel_text,'Visible',state) |
---|
| 4024 | set(handles.mask_fix1,'Visible',state) |
---|
| 4025 | set(handles.get_mask_fix1,'Visible',state) |
---|
| 4026 | set(handles.get_ref_fix1,'Visible',state) |
---|
| 4027 | set(handles.ref_fix1,'Visible',state) |
---|
| 4028 | set(handles.inf_sup1,'Visible',state) |
---|
| 4029 | set(handles.field_ref1,'Visible',state) |
---|
| 4030 | |
---|
[12] | 4031 | %------------------------------------------------------------------------ |
---|
[273] | 4032 | function enable_patch1(handles,state) |
---|
[12] | 4033 | %------------------------------------------------------------------------ |
---|
[273] | 4034 | if state |
---|
| 4035 | RootName=get(handles.RootName,'String'); |
---|
| 4036 | if isempty(RootName) |
---|
| 4037 | msgbox_uvmat('ERROR','No input file') |
---|
| 4038 | return |
---|
| 4039 | end |
---|
[274] | 4040 | set(handles.panel_Patch1,'Visible','on') |
---|
[273] | 4041 | else |
---|
[274] | 4042 | set(handles.panel_Patch1,'Visible','off') |
---|
[273] | 4043 | end |
---|
| 4044 | return |
---|
[2] | 4045 | set(handles.frame_patch1,'BackgroundColor',[1 1 0]) |
---|
| 4046 | set(handles.rho_patch1,'Visible','on') |
---|
| 4047 | set(handles.rho_text1,'Visible','on') |
---|
[257] | 4048 | if get(handles.CivMode,'Value')==2 |
---|
[224] | 4049 | set(handles.thresh_patch1,'Visible','on') |
---|
| 4050 | set(handles.thresh_text1,'Visible','on') |
---|
| 4051 | end |
---|
[2] | 4052 | set(handles.subdomain_patch1,'Visible','on') |
---|
| 4053 | set(handles.subdomain_text1,'Visible','on') |
---|
| 4054 | set(handles.nx_patch1,'Visible','on') |
---|
[274] | 4055 | set(handles.num_Ny,'Visible','on') |
---|
[2] | 4056 | set(handles.nx_patch1_title,'Visible','on') |
---|
| 4057 | set(handles.ny_patch1_title,'Visible','on') |
---|
[112] | 4058 | % if ~isempty(patch_newBin) |
---|
[224] | 4059 | set(handles.test_interp,'Visible','off'); |
---|
[252] | 4060 | stereo_test=get(handles.compare,'Value'); |
---|
| 4061 | if stereo_test==3 |
---|
| 4062 | set(handles.test_stereo1,'Visible','on') |
---|
| 4063 | end |
---|
[100] | 4064 | % end |
---|
[252] | 4065 | %set(handles.get_gridpatch1,'Visible','on') |
---|
| 4066 | %set(handles.grid_patch1,'string','none'); |
---|
| 4067 | %set(handles.grid_patch1,'Visible','on') |
---|
[2] | 4068 | |
---|
[273] | 4069 | % %------------------------------------------------------------------------ |
---|
| 4070 | % function desable_patch1(handles) |
---|
| 4071 | % %------------------------------------------------------------------------ |
---|
| 4072 | % return |
---|
| 4073 | % set(handles.frame_patch1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 4074 | % set(handles.rho_patch1,'Visible','off') |
---|
| 4075 | % set(handles.rho_text1,'Visible','off') |
---|
| 4076 | % set(handles.thresh_patch1,'Visible','off') |
---|
| 4077 | % set(handles.thresh_text1,'Visible','off') |
---|
| 4078 | % set(handles.subdomain_patch1,'Visible','off') |
---|
| 4079 | % set(handles.subdomain_text1,'Visible','off') |
---|
| 4080 | % set(handles.nx_patch1,'Visible','off') |
---|
[274] | 4081 | % set(handles.num_Ny,'Visible','off') |
---|
[273] | 4082 | % set(handles.nx_patch1_title,'Visible','off') |
---|
| 4083 | % set(handles.ny_patch1_title,'Visible','off') |
---|
| 4084 | % set(handles.test_stereo1,'Visible','off') |
---|
| 4085 | % %set(handles.test_interp,'Visible','off') |
---|
| 4086 | % %set(handles.get_gridpatch1,'Visible','off') |
---|
| 4087 | % %set(handles.grid_patch1,'Visible','off') |
---|
[2] | 4088 | |
---|
[12] | 4089 | %------------------------------------------------------------------------ |
---|
[2] | 4090 | function enable_civ2(handles,state) |
---|
[12] | 4091 | %------------------------------------------------------------------------ |
---|
[273] | 4092 | if state |
---|
| 4093 | RootName=get(handles.RootName,'String'); |
---|
| 4094 | if isempty(RootName) |
---|
| 4095 | msgbox_uvmat('ERROR','No input file') |
---|
| 4096 | return |
---|
| 4097 | end |
---|
[274] | 4098 | set(handles.panel_Civ2,'Visible','on') |
---|
[2] | 4099 | else |
---|
[274] | 4100 | set(handles.panel_Civ2,'Visible','off') |
---|
[2] | 4101 | end |
---|
[273] | 4102 | return |
---|
| 4103 | |
---|
[2] | 4104 | set(handles.ibx_civ2,'Visible',state) |
---|
| 4105 | set(handles.iby_civ2,'Visible',state) |
---|
| 4106 | set(handles.decimal,'Visible',state) |
---|
| 4107 | set(handles.deformation,'Visible',state) |
---|
| 4108 | set(handles.rho_civ2,'Visible',state) |
---|
[276] | 4109 | set(handles.num_Dx,'Visible',state) |
---|
| 4110 | set(handles.num_Dy,'Visible',state) |
---|
| 4111 | set(handles.check_Grid,'Visible',state) |
---|
| 4112 | set(handles.check_Mask,'Visible',state) |
---|
[2] | 4113 | set(handles.parameters,'Visible',state) |
---|
| 4114 | set(handles.grid,'Visible',state) |
---|
| 4115 | set(handles.parameters_text,'Visible',state) |
---|
| 4116 | set(handles.grid_text,'Visible',state) |
---|
[276] | 4117 | set(handles.txt_GridName,'Visible',state) |
---|
| 4118 | set(handles.txt_Mask,'Visible',state) |
---|
[2] | 4119 | set(handles.dx_civ2_title,'Visible',state) |
---|
| 4120 | set(handles.dy_civ2_title,'Visible',state) |
---|
| 4121 | set(handles.ibx_civ2_text,'Visible',state) |
---|
| 4122 | set(handles.rho_civ2_title,'Visible',state) |
---|
| 4123 | set(handles.ImaThreshold2,'Visible',state) |
---|
| 4124 | set(handles.ImaThreshold_title2,'Visible',state) |
---|
| 4125 | if isequal(state,'off') |
---|
| 4126 | set(handles.MinIma2,'Visible','off') |
---|
| 4127 | set(handles.MaxIma2,'Visible','off') |
---|
| 4128 | set(handles.ImaThreshold2,'Value',0) |
---|
[112] | 4129 | if isequal(get(handles.FIX2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) |
---|
[2] | 4130 | set(handles.list_pair_civ2,'Visible','off') |
---|
| 4131 | set(handles.subdir_civ2,'Visible','off') |
---|
| 4132 | set(handles.subdir_civ2_text,'Visible','off') |
---|
[71] | 4133 | set(handles.dt_unit_civ2,'Visible','off') |
---|
[273] | 4134 | %set(handles.ref_i_civ2,'Visible','off') |
---|
[71] | 4135 | set(handles.i_ref_civ2_title,'Visible','off') |
---|
| 4136 | set(handles.j_ref_civ2_title,'Visible','off') |
---|
| 4137 | set(handles.ref_j_civ2,'Visible','off') |
---|
[2] | 4138 | end |
---|
| 4139 | else |
---|
| 4140 | set(handles.list_pair_civ2,'Visible','on') |
---|
| 4141 | set(handles.subdir_civ2,'Visible','on') |
---|
| 4142 | set(handles.subdir_civ2_text,'Visible','on') |
---|
[71] | 4143 | set(handles.dt_unit_civ2,'Visible','on') |
---|
[273] | 4144 | % set(handles.ref_i_civ2,'Visible','on') |
---|
[71] | 4145 | set(handles.i_ref_civ2_title,'Visible','on') |
---|
| 4146 | set(handles.j_ref_civ2_title,'Visible','on') |
---|
| 4147 | set(handles.ref_j_civ2,'Visible','on') |
---|
[2] | 4148 | end |
---|
[71] | 4149 | set(handles.rho_civ2_title,'Visible',state) |
---|
[2] | 4150 | |
---|
[12] | 4151 | %------------------------------------------------------------------------ |
---|
[273] | 4152 | function enable_fix2(handles,state) |
---|
[12] | 4153 | %------------------------------------------------------------------------ |
---|
[273] | 4154 | % if isequal(state,'on') |
---|
[274] | 4155 | % set(handles.panel_Fix2,'Visible','on') |
---|
[273] | 4156 | % |
---|
| 4157 | % % set(handles.frame_civ2,'BackgroundColor',[1 1 0]) |
---|
| 4158 | % % set(handles.frame_para_civ2,'BackgroundColor',[1 1 0]) |
---|
| 4159 | % % set(handles.frame_grid_civ2,'BackgroundColor',[1 1 0]) |
---|
| 4160 | % % set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 4161 | % else |
---|
| 4162 | if state |
---|
| 4163 | RootName=get(handles.RootName,'String'); |
---|
| 4164 | if isempty(RootName) |
---|
| 4165 | msgbox_uvmat('ERROR','No input file') |
---|
| 4166 | return |
---|
| 4167 | end |
---|
[274] | 4168 | set(handles.panel_Fix2,'Visible','on') |
---|
[273] | 4169 | else |
---|
[274] | 4170 | set(handles.panel_Fix2,'Visible','off') |
---|
[273] | 4171 | end |
---|
| 4172 | return |
---|
[2] | 4173 | set(handles.frame_fix2,'BackgroundColor',[1 1 0]) |
---|
| 4174 | set(handles.REMOVE2,'Visible','on') |
---|
| 4175 | set(handles.vec_Fmin2_2,'Visible','on') |
---|
| 4176 | set(handles.vec_F4,'Visible','on') |
---|
| 4177 | set(handles.vec_F3_2,'Visible','on') |
---|
| 4178 | set(handles.thresh_vec2C,'Visible','on') |
---|
| 4179 | set(handles.thresh_vec2C_text,'Visible','on') |
---|
| 4180 | set(handles.thresh_vel2,'Visible','on') |
---|
| 4181 | set(handles.thresh_vel2_text,'Visible','on') |
---|
| 4182 | set(handles.mask_fix2,'Visible','on') |
---|
| 4183 | set(handles.get_mask_fix2,'Visible','on') |
---|
| 4184 | set(handles.list_pair_civ2,'Visible','on') |
---|
| 4185 | set(handles.subdir_civ2,'Visible','on') |
---|
| 4186 | set(handles.subdir_civ2_text,'Visible','on') |
---|
| 4187 | set(handles.get_ref_fix2,'Visible','on') |
---|
| 4188 | set(handles.ref_fix2,'Visible','on') |
---|
| 4189 | set(handles.inf_sup2,'Visible','on') |
---|
| 4190 | set(handles.field_ref2,'Visible','on') |
---|
| 4191 | |
---|
[273] | 4192 | % %------------------------------------------------------------------------ |
---|
| 4193 | % function desable_fix2(handles) |
---|
| 4194 | % %------------------------------------------------------------------------ |
---|
| 4195 | % set(handles.frame_fix2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 4196 | % set(handles.REMOVE2,'Visible','off') |
---|
| 4197 | % set(handles.vec_Fmin2_2,'Visible','off') |
---|
| 4198 | % set(handles.vec_F4,'Visible','off') |
---|
| 4199 | % set(handles.vec_F3_2,'Visible','off') |
---|
| 4200 | % set(handles.thresh_vec2C,'Visible','off') |
---|
| 4201 | % set(handles.thresh_vec2C_text,'Visible','off') |
---|
| 4202 | % set(handles.thresh_vel2,'Visible','off') |
---|
| 4203 | % set(handles.thresh_vel2_text,'Visible','off') |
---|
| 4204 | % set(handles.mask_fix2,'Visible','off') |
---|
| 4205 | % set(handles.get_mask_fix2,'Visible','off') |
---|
| 4206 | % set(handles.get_ref_fix2,'Visible','off') |
---|
| 4207 | % set(handles.ref_fix2,'Visible','off') |
---|
| 4208 | % set(handles.inf_sup2,'Visible','off') |
---|
| 4209 | % set(handles.field_ref2,'Visible','off') |
---|
| 4210 | % if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) |
---|
| 4211 | % set(handles.list_pair_civ2,'Visible','off') |
---|
| 4212 | % set(handles.subdir_civ2,'Visible','off') |
---|
| 4213 | % set(handles.subdir_civ2_text,'Visible','off') |
---|
| 4214 | % end |
---|
[2] | 4215 | |
---|
[12] | 4216 | %------------------------------------------------------------------------ |
---|
[273] | 4217 | function enable_patch2(handles,state) |
---|
[12] | 4218 | %------------------------------------------------------------------------ |
---|
[273] | 4219 | if state |
---|
| 4220 | RootName=get(handles.RootName,'String'); |
---|
| 4221 | if isempty(RootName) |
---|
| 4222 | msgbox_uvmat('ERROR','No input file') |
---|
| 4223 | return |
---|
| 4224 | end |
---|
[274] | 4225 | set(handles.panel_Patch2,'Visible','on') |
---|
[273] | 4226 | else |
---|
[274] | 4227 | set(handles.panel_Patch2,'Visible','off') |
---|
[252] | 4228 | end |
---|
[273] | 4229 | % set(handles.frame_patch2,'BackgroundColor',[1 1 0]) |
---|
[274] | 4230 | % set(handles.num_SmoothParam,'Visible','on') |
---|
| 4231 | % set(handles.num_SmoothingParam,'Visible','on') |
---|
| 4232 | % set(handles.num_MaxDiff,'Visible','on') |
---|
[273] | 4233 | % set(handles.thresh_text2,'Visible','on') |
---|
[274] | 4234 | % set(handles.num_SubdomainSize,'Visible','on') |
---|
[273] | 4235 | % set(handles.subdomain_text2,'Visible','on') |
---|
[274] | 4236 | % set(handles.num_Nx,'Visible','on') |
---|
| 4237 | % set(handles.num_Ny,'Visible','on') |
---|
[273] | 4238 | % set(handles.nx_patch2_title,'Visible','on') |
---|
| 4239 | % set(handles.ny_patch2_title,'Visible','on') |
---|
| 4240 | % % set(handles.get_gridpatch2,'Visible','on') |
---|
| 4241 | % % set(handles.grid_patch2,'Visible','on') |
---|
| 4242 | % set(handles.list_pair_civ2,'Visible','on') |
---|
| 4243 | % set(handles.subdir_civ2,'Visible','on') |
---|
| 4244 | % set(handles.subdir_civ2_text,'Visible','on') |
---|
| 4245 | % stereo_test=get(handles.compare,'Value'); |
---|
| 4246 | % if stereo_test==3 |
---|
[274] | 4247 | % set(handles.check_Stereo,'Visible','on') |
---|
[273] | 4248 | % end |
---|
[2] | 4249 | |
---|
[273] | 4250 | % %------------------------------------------------------------------------ |
---|
| 4251 | % function desable_patch2(handles) |
---|
| 4252 | % %------------------------------------------------------------------------ |
---|
[274] | 4253 | % %set(handles.panel_Patch2,'Visible','off') |
---|
[273] | 4254 | % return |
---|
| 4255 | % set(handles.frame_patch2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
[274] | 4256 | % set(handles.num_SmoothParam,'Visible','off') |
---|
| 4257 | % set(handles.num_SmoothingParam,'Visible','off') |
---|
| 4258 | % set(handles.num_MaxDiff,'Visible','off') |
---|
[273] | 4259 | % set(handles.thresh_text2,'Visible','off') |
---|
[274] | 4260 | % set(handles.num_SubdomainSize,'Visible','off') |
---|
[273] | 4261 | % set(handles.subdomain_text2,'Visible','off') |
---|
[274] | 4262 | % set(handles.num_Nx,'Visible','off') |
---|
| 4263 | % set(handles.num_Ny,'Visible','off') |
---|
[273] | 4264 | % set(handles.nx_patch2_title,'Visible','off') |
---|
| 4265 | % set(handles.ny_patch2_title,'Visible','off') |
---|
| 4266 | % % set(handles.get_gridpatch2,'Visible','off') |
---|
| 4267 | % % set(handles.grid_patch2,'Visible','off') |
---|
| 4268 | % if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0) |
---|
| 4269 | % set(handles.list_pair_civ2,'Visible','off') |
---|
| 4270 | % set(handles.subdir_civ2,'Visible','off') |
---|
| 4271 | % set(handles.subdir_civ2_text,'Visible','off') |
---|
| 4272 | % end |
---|
[274] | 4273 | % set(handles.check_Stereo,'Visible','off') |
---|
[12] | 4274 | %------------------------------------------------------------------------ |
---|
[2] | 4275 | function enable_pair1(handles,state) |
---|
[12] | 4276 | %------------------------------------------------------------------------ |
---|
[2] | 4277 | set(handles.subdir_civ1,'Visible',state) |
---|
| 4278 | set(handles.list_subdir_civ1,'Visible',state) |
---|
| 4279 | set(handles.SUBDIR_CIV1_txt,'Visible',state) |
---|
[273] | 4280 | %set(handles.frame_subdirciv1,'Visible',state) |
---|
[2] | 4281 | set(handles.list_pair_civ1,'Visible',state) |
---|
[273] | 4282 | set(handles.PairCiv1_title,'Visible',state) |
---|
[71] | 4283 | %set(handles.dt_unit,'Visible',state) |
---|
[273] | 4284 | %set(handles.PAIR_frame,'Visible',state) |
---|
[2] | 4285 | |
---|
[12] | 4286 | %------------------------------------------------------------------------ |
---|
| 4287 | % --- Read the parameters for civ1 on the interface |
---|
[272] | 4288 | function par=read_param_civ1(handles,filecell) |
---|
[12] | 4289 | %------------------------------------------------------------------------ |
---|
[127] | 4290 | ibx_val=str2double(get(handles.ibx,'String')); |
---|
[2] | 4291 | par.ibx=num2str(ibx_val); |
---|
[127] | 4292 | iby_val=str2double(get(handles.iby,'String')); |
---|
[2] | 4293 | par.iby=num2str(iby_val); |
---|
| 4294 | isx=get(handles.isx,'String'); |
---|
[127] | 4295 | if isnan(str2double(isx)), isx='41'; set(handles.isx,'String','41'), end; %default |
---|
| 4296 | if str2double(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.isx,'String',num2str(ibx_val+8)); end |
---|
[2] | 4297 | isy=get(handles.isy,'String'); |
---|
[127] | 4298 | if isnan(str2double(isy)), isy='41'; set(handles.isy,'String','41'), end;%default |
---|
| 4299 | if str2double(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.isy,'String',num2str(iby_val+8)); end |
---|
[2] | 4300 | par.isx=get(handles.isx,'String'); |
---|
| 4301 | par.isy=get(handles.isy,'String'); |
---|
| 4302 | par.shiftx=get(handles.shiftx,'String'); |
---|
| 4303 | par.shifty=get(handles.shifty,'String'); |
---|
[127] | 4304 | if isnan(str2double(par.isx)) |
---|
[112] | 4305 | par.isx='41';%default |
---|
| 4306 | set(handles.isx,'String','41'); |
---|
[2] | 4307 | end |
---|
[127] | 4308 | if isnan(str2double(par.isy)) |
---|
[112] | 4309 | par.isy='41'; %default |
---|
| 4310 | set(handles.isy,'String','41'); |
---|
[12] | 4311 | end |
---|
[127] | 4312 | if isnan(str2double(par.shiftx)) |
---|
[112] | 4313 | par.shiftx='0';%default |
---|
| 4314 | set(handles.shiftx,'String','0'); |
---|
| 4315 | end |
---|
[127] | 4316 | if isnan(str2double(par.shifty)) |
---|
[112] | 4317 | par.shifty='0'; %default |
---|
| 4318 | set(handles.shifty,'String','0'); |
---|
[12] | 4319 | end |
---|
[112] | 4320 | par.rho=get(handles.rho,'String'); |
---|
[238] | 4321 | if isequal(get(handles.rho,'Style'),'popupmenu') |
---|
| 4322 | index=get(handles.rho,'Value'); |
---|
| 4323 | par.rho=par.rho{index}; |
---|
| 4324 | end |
---|
[280] | 4325 | dummy=get(handles.num_Dx,'String'); |
---|
| 4326 | par.dx=dummy{1}; |
---|
| 4327 | dummy=get(handles.num_Dy,'String'); |
---|
| 4328 | par.dy=dummy{1}; |
---|
[127] | 4329 | if isnan(str2double(par.dx)) |
---|
[276] | 4330 | if isempty(get(handles.txt_GridName,'String')); |
---|
[112] | 4331 | par.dx='0'; %just read by civ program, not used |
---|
| 4332 | else |
---|
[12] | 4333 | par.dx='20';%default |
---|
[276] | 4334 | set(handles.num_Dx,'String','20'); |
---|
[112] | 4335 | end |
---|
| 4336 | end |
---|
[127] | 4337 | if isnan(str2double(par.dy)) |
---|
[276] | 4338 | if isempty(get(handles.txt_GridName,'String')); |
---|
[112] | 4339 | par.dy='0';%just read by civ program, not used |
---|
| 4340 | else |
---|
[12] | 4341 | par.dy='20';%default |
---|
| 4342 | set(handles.dy_civ1_title,'String','20'); |
---|
[112] | 4343 | end |
---|
| 4344 | end |
---|
| 4345 | par.pxcmx='1'; %velocities are expressed in pixel dispalcement |
---|
| 4346 | par.pxcmy='1'; |
---|
[272] | 4347 | % if exist('file_ima','var') |
---|
| 4348 | A=imread(filecell.ima1.civ1{1,1});%read the first image to get the size |
---|
[112] | 4349 | sizim=size(A); |
---|
| 4350 | par.npx=num2str(sizim(2)); |
---|
| 4351 | par.npy=num2str(sizim(1)); |
---|
[272] | 4352 | %TODO : civ should not need npx and npy |
---|
| 4353 | |
---|
| 4354 | |
---|
| 4355 | % end |
---|
[127] | 4356 | %time=get(handles.RootName,'UserData'); %get the set of times |
---|
[280] | 4357 | dummy=get(handles.txt_GridName,'String'); |
---|
| 4358 | par.gridname=dummy{1}; |
---|
[112] | 4359 | par.gridflag='y'; |
---|
[127] | 4360 | if strcmp(par.gridname,'')|| isempty(par.gridname) |
---|
[112] | 4361 | par.gridname='nogrid'; |
---|
| 4362 | par.gridflag='n'; |
---|
| 4363 | end |
---|
[12] | 4364 | |
---|
| 4365 | %------------------------------------------------------------------------ |
---|
[272] | 4366 | function par=read_param_fix1(handles,filecell) |
---|
| 4367 | %------------------------------------------------------------------------ |
---|
| 4368 | par.flagindex1(1)=get(handles.vec_Fmin2, 'Value'); |
---|
| 4369 | par.flagindex1(2)=get(handles.vec_F3, 'Value'); |
---|
| 4370 | par.flagindex1(3)=get(handles.vec_F2, 'Value'); |
---|
| 4371 | par.thresh_vecC1=str2double(get(handles.thresh_vecC,'String'));%threshold on image correlation vec_C |
---|
| 4372 | par.thresh_vel1=str2double(get(handles.thresh_vel,'String'));%threshold on velocity modulus |
---|
| 4373 | par.test_mask=get(handles.get_mask_fix1,'Value'); |
---|
| 4374 | par.nbslice_mask=get(handles.mask_fix1,'UserData'); % get the number of slices (= number of masks) |
---|
| 4375 | %%%%%%%%%%%%%COMPLETER LE PROGRAMME FIX |
---|
| 4376 | % inf_sup=get(handles.inf_sup1,'Value');80 |
---|
| 4377 | % fileref=get(handles.ref_fix1,'String'); |
---|
| 4378 | % refpath=get(handles.ref_fix1,'UserData'); |
---|
| 4379 | % fileref=fullfile(refpath,fileref); |
---|
| 4380 | par.menu=get(handles.field_ref1,'String'); |
---|
| 4381 | par.index=get(handles.field_ref1,'Value'); |
---|
| 4382 | if isempty(par.menu) |
---|
| 4383 | par.fieldchoice=''; |
---|
| 4384 | else |
---|
| 4385 | par.fieldchoice=menu{index}; |
---|
| 4386 | msgbox_uvmat('WARNING','reference field is not used presently with batch, use RUN option') |
---|
| 4387 | end |
---|
| 4388 | if par.test_mask==0 |
---|
| 4389 | par.maskname=''; |
---|
| 4390 | else |
---|
| 4391 | maskdispl=get(handles.mask_fix1,'String'); |
---|
| 4392 | nbslice_mask=str2double(maskdispl(1:end-4)); % |
---|
| 4393 | num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; |
---|
| 4394 | maskbase=[filecell.filebase '_' maskdispl]; |
---|
| 4395 | par.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
| 4396 | end |
---|
| 4397 | |
---|
| 4398 | %------------------------------------------------------------------------ |
---|
| 4399 | function par=read_param_patch1(handles) |
---|
| 4400 | %------------------------------------------------------------------------ |
---|
| 4401 | |
---|
| 4402 | par.rho_patch=str2double(get(handles.rho_patch1,'String')); |
---|
| 4403 | if isnan(par.rho_patch) |
---|
| 4404 | par.rho_patch='1000'; |
---|
| 4405 | set(handles.rho_patch1,'String','1') |
---|
| 4406 | else |
---|
| 4407 | par.rho_patch=num2str(1000*par.rho_patch); |
---|
| 4408 | end |
---|
| 4409 | par.nx_patch=get(handles.nx_patch1,'String'); |
---|
| 4410 | par.ny_patch=get(handles.ny_patch1,'String'); |
---|
| 4411 | if isnan(str2double(par.nx_patch)) |
---|
| 4412 | par.nx_patch='50' ;%default |
---|
| 4413 | set(handles.nx_patch1,'String','50'); |
---|
| 4414 | end |
---|
| 4415 | if isnan(str2double(par.ny_patch)) |
---|
| 4416 | par.ny_patch='50' ;%default |
---|
| 4417 | set(handles.ny_patch1,'String','50'); |
---|
| 4418 | end |
---|
| 4419 | par.subdomain_patch=get(handles.subdomain_patch1,'String'); |
---|
| 4420 | par.thresh_patch=get(handles.thresh_patch1,'String'); |
---|
| 4421 | |
---|
| 4422 | |
---|
| 4423 | %------------------------------------------------------------------------ |
---|
[2] | 4424 | function par=read_param_civ2(handles,file_ima) |
---|
[12] | 4425 | %------------------------------------------------------------------------ |
---|
| 4426 | par.ibx=get(handles.ibx_civ2,'String'); |
---|
| 4427 | par.iby=get(handles.iby_civ2,'String'); |
---|
| 4428 | par.rho=get(handles.rho_civ2,'String'); |
---|
| 4429 | par.decimal=int2str(get(handles.decimal,'Value')); |
---|
| 4430 | par.deformation=int2str(get(handles.deformation,'Value')); |
---|
[276] | 4431 | par.dx=get(handles.num_Dx,'String'); |
---|
| 4432 | par.dy=get(handles.num_Dy,'String'); |
---|
[127] | 4433 | if isnan(str2double(par.dx)) |
---|
[276] | 4434 | if isempty(get(handles.txt_GridName,'String')); |
---|
[112] | 4435 | par.dx='0'; %just read by civ program, not used |
---|
| 4436 | else |
---|
[12] | 4437 | par.dx='20';%default |
---|
[276] | 4438 | set(handles.num_Dx,'String','20'); |
---|
[112] | 4439 | end |
---|
| 4440 | end |
---|
[127] | 4441 | if isnan(str2double(par.dy)) |
---|
[276] | 4442 | if isempty(get(handles.txt_GridName,'String')); |
---|
[112] | 4443 | par.dy='0';%just read by civ program, not used |
---|
| 4444 | else |
---|
[12] | 4445 | par.dy='20';%default |
---|
[276] | 4446 | set(handles.num_Dy,'String','20'); |
---|
[112] | 4447 | end |
---|
| 4448 | end |
---|
| 4449 | par.pxcmx='1'; |
---|
| 4450 | par.pxcmy='1'; |
---|
[12] | 4451 | A=imread(file_ima);%read the first image to get the size |
---|
| 4452 | sizim=size(A); |
---|
| 4453 | par.npx=num2str(sizim(2)); |
---|
| 4454 | par.npy=num2str(sizim(1)); |
---|
[127] | 4455 | %time=get(handles.RootName,'UserData'); %get the set of times |
---|
[276] | 4456 | par.gridname=get(handles.txt_GridName,'String'); |
---|
[12] | 4457 | par.gridflag='y'; |
---|
[127] | 4458 | if strcmp(par.gridname,'')|| isempty(par.gridname) |
---|
[12] | 4459 | par.gridname='nogrid'; |
---|
| 4460 | par.gridflag='n'; |
---|
| 4461 | end |
---|
[2] | 4462 | |
---|
[272] | 4463 | function cmd_CIV1=CIV1_CMD(filename,param) |
---|
| 4464 | %TODO : include filename in par_civ1 |
---|
[12] | 4465 | %------------------------------------------------------------------------ |
---|
[2] | 4466 | %pixels per cm and matrix of the image times, read from the .civ file by uvmat |
---|
| 4467 | |
---|
| 4468 | %changes : filename_cmx -> filename ( no extension ) |
---|
[272] | 4469 | |
---|
[275] | 4470 | filename=regexprep(filename,'.nc',''); |
---|
[272] | 4471 | |
---|
| 4472 | if isequal(param.civ1.Dt,'0') |
---|
| 4473 | param.civ1.Dt='1' ;%case of 'displacement' mode |
---|
[112] | 4474 | end |
---|
[272] | 4475 | param.civ1.filename_ima_a=regexprep(param.civ1.filename_ima_a,'.png',''); |
---|
| 4476 | param.civ1.filename_ima_b=regexprep(param.civ1.filename_ima_b,'.png',''); |
---|
[230] | 4477 | fid=fopen([filename '.civ1.cmx'],'w'); |
---|
[12] | 4478 | fprintf(fid,['############## CMX file' '\n' ]); |
---|
[272] | 4479 | fprintf(fid, ['FirstImage ' regexprep(param.civ1.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
| 4480 | fprintf(fid, ['LastImage ' regexprep(param.civ1.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
[112] | 4481 | fprintf(fid, ['XX' '\n' ]); |
---|
[272] | 4482 | fprintf(fid, ['Mask ' param.civ1.maskflag '\n' ]); |
---|
| 4483 | fprintf(fid, ['MaskName ' regexprep(param.civ1.maskname,'\\','\\\\') '\n' ]); |
---|
| 4484 | fprintf(fid, ['ImageSize ' param.civ1.npx ' ' param.civ1.npy '\n' ]); %VERIFIER CAS GENERAL ? |
---|
| 4485 | fprintf(fid, ['CorrelationBoxesSize ' param.civ1.ibx ' ' param.civ1.iby '\n' ]); |
---|
| 4486 | fprintf(fid, ['SearchBoxeSize ' param.civ1.isx ' ' param.civ1.isy '\n' ]); |
---|
| 4487 | fprintf(fid, ['RO ' param.civ1.rho '\n' ]); |
---|
| 4488 | fprintf(fid, ['GridSpacing ' param.civ1.dx ' ' param.civ1.dy '\n' ]); |
---|
[112] | 4489 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
[272] | 4490 | fprintf(fid, ['Dt_TO ' param.civ1.Dt ' ' param.civ1.T0 '\n' ]); |
---|
| 4491 | fprintf(fid, ['PixCmXY ' param.civ1.pxcmx ' ' param.civ1.pxcmy '\n' ]); |
---|
[112] | 4492 | fprintf(fid, ['XX 1' '\n' ]); |
---|
[272] | 4493 | fprintf(fid, ['ShiftXY ' param.civ1.shiftx ' ' param.civ1.shifty '\n' ]); |
---|
| 4494 | fprintf(fid, ['Grid ' param.civ1.gridflag '\n' ]); |
---|
| 4495 | fprintf(fid, ['GridName ' regexprep(param.civ1.gridname,'\\','\\\\') '\n' ]); |
---|
[112] | 4496 | fprintf(fid, ['XX 85' '\n' ]); |
---|
| 4497 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 4498 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 4499 | fprintf(fid, ['Hart 1' '\n' ]); |
---|
| 4500 | fprintf(fid, [ 'DecimalShift 0' '\n' ]); |
---|
| 4501 | fprintf(fid, ['Deformation 0' '\n' ]); |
---|
| 4502 | fprintf(fid, ['CorrelationMin 0' '\n' ]); |
---|
| 4503 | fprintf(fid, ['IntensityMin 0' '\n' ]); |
---|
| 4504 | fprintf(fid, ['SeuilImage n' '\n' ]); |
---|
| 4505 | fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); |
---|
[272] | 4506 | fprintf(fid, ['ImageToUse ' param.civ1.term_a ' ' param.civ1.term_b '\n' ]); % VERIFIER ? |
---|
[112] | 4507 | fprintf(fid, ['ImageUsedBefore null null' '\n' ]); |
---|
[12] | 4508 | fclose(fid); |
---|
[112] | 4509 | |
---|
[163] | 4510 | % cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file |
---|
| 4511 | % cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\'); |
---|
| 4512 | % namelog=regexprep(namelog,'\\','\\\\'); |
---|
[12] | 4513 | if(isunix) |
---|
[272] | 4514 | cmd_CIV1=['cp -f ' filename '.civ1.cmx ' filename '.cmx']; |
---|
| 4515 | cmd_CIV1=[cmd_CIV1 '\n'... |
---|
| 4516 | param.global.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx |
---|
[219] | 4517 | cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.log' ' ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.nc'];%rename .log as .civ1.log and set the netcdf result file for group user writting |
---|
[230] | 4518 | % cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.civ1.cmx' '\n'];%rename .cmx as .civ1.cmx |
---|
[163] | 4519 | else %Windows system |
---|
[269] | 4520 | % flname=regexprep(flname,'\\','\\\\'); |
---|
[230] | 4521 | % cmd=[cmd 'copy /Y "' flname '.civ1.cmx" "' flname '.cmx"\n']; |
---|
[269] | 4522 | % filename=regexprep(filename,'\\','\\\\'); |
---|
[272] | 4523 | cmd_CIV1=['copy /Y "' filename '.civ1.cmx" "' filename '.cmx"'];% copy the .civ1.cmx parameter file to .cmx |
---|
| 4524 | cmd_CIV1=[cmd_CIV1 '\n "' regexprep(param.global.Civ1Bin,'\\','\\\\') '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file |
---|
| 4525 | % namelog=regexprep(namelog,'\\','\\\\'); |
---|
| 4526 | cmd_CIV1=[cmd_CIV1 '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ1.log"']; %preserve the log file as .civ1.log |
---|
| 4527 | |
---|
| 4528 | % cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.civ1.cmx"']; |
---|
[12] | 4529 | end |
---|
[2] | 4530 | |
---|
[12] | 4531 | %------------------------------------------------------------------------ |
---|
| 4532 | % --- CIV1 Unified |
---|
[94] | 4533 | function xml_civ1_parameters=CIV1_CMD_Unified(filename,namelog,par) |
---|
[12] | 4534 | %------------------------------------------------------------------------ |
---|
[2] | 4535 | %pixels per cm and matrix of the image times, read from the .civ file by uvmat |
---|
[73] | 4536 | %global CivBin%name of the executable for civ1 calculation |
---|
[2] | 4537 | |
---|
[112] | 4538 | civ1.image1=par.filename_ima_a; |
---|
| 4539 | civ1.image2=par.filename_ima_b; |
---|
| 4540 | civ1.imageSize_X=par.npx; |
---|
| 4541 | civ1.imageSize_Y=par.npy; |
---|
| 4542 | civ1.outputFileName=[filename '.nc']; |
---|
| 4543 | civ1.correlationBoxesSize_X=par.ibx; |
---|
| 4544 | civ1.correlationBoxesSize_Y=par.iby; |
---|
| 4545 | civ1.searchBoxesSize_X=par.isx; |
---|
| 4546 | civ1.searchBoxesSize_Y=par.isy; |
---|
| 4547 | civ1.globalShift_X=par.shiftx; |
---|
| 4548 | civ1.globalShift_Y=par.shifty; |
---|
| 4549 | civ1.ro=par.rho; |
---|
| 4550 | civ1.hart='y'; |
---|
| 4551 | if isequal(par.gridflag,'y') |
---|
| 4552 | civ1.grid=par.gridname; |
---|
| 4553 | else |
---|
| 4554 | civ1.grid='n'; |
---|
| 4555 | civ1.gridSpacing_X=par.dx; |
---|
| 4556 | civ1.gridSpacing_Y=par.dy; |
---|
| 4557 | end |
---|
| 4558 | if isequal(par.maskflag,'y') |
---|
| 4559 | civ1.mask=par.maskname; |
---|
| 4560 | end |
---|
[229] | 4561 | civ1.dt=par.Dt; |
---|
[112] | 4562 | civ1.unit='pixel'; |
---|
| 4563 | civ1.absolut_time_T0=par.T0; |
---|
| 4564 | civ1.pixcmx=par.pxcmx; |
---|
| 4565 | civ1.pixcmy=par.pxcmy; |
---|
| 4566 | civ1.convectFlow='n'; |
---|
[12] | 4567 | |
---|
[112] | 4568 | xml_civ1_parameters=civ1; |
---|
| 4569 | |
---|
[12] | 4570 | %------------------------------------------------------------------------ |
---|
| 4571 | % --- CIV2 Unified |
---|
[94] | 4572 | function civ2=CIV2_CMD_Unified(filename,namelog,par) |
---|
[12] | 4573 | %------------------------------------------------------------------------ |
---|
[2] | 4574 | %pixels per cm and matrix of the image times, read from the .civ file by uvmat |
---|
[73] | 4575 | %global CivBin%name of the executable for civ1 calculation |
---|
[275] | 4576 | |
---|
[272] | 4577 | filename=regexprep(filename,'.nc',''); |
---|
[2] | 4578 | |
---|
| 4579 | civ2.image1=par.filename_ima_a; |
---|
| 4580 | civ2.image2=par.filename_ima_b; |
---|
[112] | 4581 | civ2.imageSize_X=par.npx; |
---|
[2] | 4582 | civ2.imageSize_Y=par.npy; |
---|
| 4583 | civ2.inputFileName=[par.filename_nc1 '.nc']; |
---|
| 4584 | civ2.outputFileName=[filename '.nc']; |
---|
| 4585 | civ2.correlationBoxesSize_X=par.ibx; |
---|
| 4586 | civ2.correlationBoxesSize_Y=par.iby; |
---|
| 4587 | civ2.ro=par.rho; |
---|
| 4588 | %civ2.decimalShift=par.decimal; |
---|
| 4589 | %civ2.deformation=par.deformation; |
---|
| 4590 | if isequal(par.decimal,'1') |
---|
| 4591 | civ2.decimalShift='y'; |
---|
| 4592 | else |
---|
| 4593 | civ2.decimalShift='n'; |
---|
| 4594 | end |
---|
| 4595 | if isequal(par.deformation,'1') |
---|
| 4596 | civ2.deformation='y'; |
---|
| 4597 | else |
---|
| 4598 | civ2.deformation='n'; |
---|
| 4599 | end |
---|
| 4600 | if isequal(par.gridflag,'y') |
---|
| 4601 | civ2.grid=par.gridname; |
---|
| 4602 | else |
---|
| 4603 | civ2.grid='n'; |
---|
| 4604 | civ2.gridSpacing_X=par.dx; |
---|
| 4605 | civ2.gridSpacing_Y=par.dy; |
---|
| 4606 | end |
---|
| 4607 | civ2.gridSpacing_X='10'; |
---|
| 4608 | civ2.gridSpacing_Y='10';%NOTE: faut mettre gridSpacing pourque ca tourne, meme si c'est la grille qui est utilisee |
---|
| 4609 | if isequal(par.maskflag,'y') |
---|
| 4610 | civ2.mask=par.maskname; |
---|
| 4611 | else |
---|
| 4612 | civ2.mask='n'; |
---|
| 4613 | end |
---|
| 4614 | civ2.dt=par.Dt; |
---|
| 4615 | civ2.unit='pixel'; |
---|
| 4616 | civ2.absolut_time_T0=par.T0; |
---|
| 4617 | civ2.pixcmx=par.pxcmx; |
---|
| 4618 | civ2.pixcmy=par.pxcmy; |
---|
| 4619 | civ2.convectFlow='n'; |
---|
| 4620 | civ2.pixcmx=par.pxcmx; |
---|
| 4621 | civ2.pixcmy=par.pxcmy; |
---|
| 4622 | civ2.convectFlow='n'; |
---|
| 4623 | |
---|
[12] | 4624 | %------------------------------------------------------------------------ |
---|
| 4625 | % --- CIV2 CIV2 CIV2 CIV2 |
---|
[272] | 4626 | function cmd_CIV2=CIV2_CMD(filename,param) |
---|
[12] | 4627 | %------------------------------------------------------------------------ |
---|
[2] | 4628 | %pixels per cm and matrix of the image times, read from the .civ file by uvmat |
---|
[67] | 4629 | % global civ2Bin sge%name of the executable for civ1 calculation |
---|
[275] | 4630 | filename=regexprep(filename,'.nc',''); |
---|
| 4631 | if isequal(param.civ2.Dt,'0') |
---|
[272] | 4632 | param.civ2.Dt='1' ;%case of 'displacement' mode |
---|
[112] | 4633 | end |
---|
[272] | 4634 | param.civ2.filename_ima_a=regexprep(param.civ2.filename_ima_a,'.png',''); |
---|
| 4635 | param.civ2.filename_ima_b=regexprep(param.civ2.filename_ima_b,'.png','');% bug : .png appears two times ? |
---|
[174] | 4636 | [fid,errormsg]=fopen([filename '.civ2.cmx'],'w'); |
---|
| 4637 | if isequal(fid,-1) |
---|
| 4638 | msgbox_uvmat('ERROR',errormsg) |
---|
| 4639 | cmd_CIV2=''; |
---|
| 4640 | return |
---|
| 4641 | end |
---|
[94] | 4642 | fprintf(fid,['############## CMX file' '\n' ]); |
---|
[272] | 4643 | fprintf(fid, ['FirstImage ' regexprep(param.civ2.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
| 4644 | fprintf(fid, ['LastImage ' regexprep(param.civ2.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
[94] | 4645 | fprintf(fid, ['XX' '\n' ]); |
---|
[272] | 4646 | fprintf(fid, ['Mask ' param.civ2.maskflag '\n' ]); |
---|
| 4647 | fprintf(fid, ['MaskName ' regexprep(param.civ2.maskname,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
| 4648 | fprintf(fid, ['ImageSize ' param.civ2.npx ' ' param.civ2.npy '\n' ]); %VERIFIER CAS GENERAL ? |
---|
| 4649 | fprintf(fid, ['CorrelationBoxesSize ' param.civ2.ibx ' ' param.civ2.iby '\n' ]); |
---|
| 4650 | fprintf(fid, ['SearchBoxeSize ' param.civ2.ibx ' ' param.civ2.iby '\n']); |
---|
| 4651 | fprintf(fid, ['RO ' param.civ2.rho '\n']); |
---|
| 4652 | fprintf(fid, ['GridSpacing ' param.civ2.dx ' ' param.civ2.dy '\n']); |
---|
[94] | 4653 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
[272] | 4654 | fprintf(fid, ['Dt_TO ' param.civ2.Dt ' ' param.civ2.T0 '\n' ]); |
---|
| 4655 | fprintf(fid, ['PixCmXY ' param.civ2.pxcmx ' ' param.civ2.pxcmy '\n' ]); |
---|
[94] | 4656 | fprintf(fid, ['XX 1' '\n' ]); |
---|
[122] | 4657 | fprintf(fid, 'ShiftXY 0 0\n'); |
---|
[272] | 4658 | fprintf(fid, ['Grid ' param.civ2.gridflag '\n' ]); |
---|
| 4659 | fprintf(fid, ['GridName ' regexprep(param.civ2.gridname,'\\','\\\\') '\n']); |
---|
[94] | 4660 | fprintf(fid, ['XX 85' '\n' ]); |
---|
| 4661 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 4662 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 4663 | fprintf(fid, ['Hart 1' '\n' ]); |
---|
[272] | 4664 | fprintf(fid, ['DecimalShift ' param.civ2.decimal '\n']); |
---|
| 4665 | fprintf(fid, ['Deformation ' param.civ2.deformation '\n']); |
---|
[94] | 4666 | fprintf(fid, ['CorrelationMin 0' '\n' ]); |
---|
| 4667 | fprintf(fid, ['IntensityMin 0' '\n' ]); |
---|
| 4668 | fprintf(fid, ['SeuilImage n' '\n' ]); |
---|
| 4669 | fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); |
---|
[272] | 4670 | fprintf(fid, ['ImageToUse ' param.civ2.term_a ' ' param.civ2.term_b '\n' ]); % VERIFIER ? |
---|
| 4671 | fprintf(fid, ['ImageUsedBefore ' regexprep(param.civ2.filename_nc1,'\\','\\\\') '\n']); |
---|
[94] | 4672 | fclose(fid); |
---|
| 4673 | |
---|
[134] | 4674 | if(isunix) |
---|
[230] | 4675 | cmd_CIV2=['cp -f ' filename '.civ2.cmx ' filename '.cmx\n']; |
---|
[272] | 4676 | cmd_CIV2=[cmd_CIV2 param.global.Civ2Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx |
---|
[230] | 4677 | cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.log' ' ' filename '.civ2.log' '\n' 'chmod g+w ' filename '.nc'];%preserve the log file as .civ2.log |
---|
| 4678 | % cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.cmx' ' ' filename '.civ2.cmx' '\n'];%rename .cmx as .civ2.cmx, the result file is named [filename '.nc'] by CIVx |
---|
| 4679 | |
---|
[163] | 4680 | else |
---|
[174] | 4681 | filename=regexprep(filename,'\\','\\\\'); |
---|
[272] | 4682 | cmd_CIV2=['copy /Y "' filename '.civ2.cmx" "' filename '.cmx"']; |
---|
| 4683 | cmd_CIV2=[cmd_CIV2 '\n "' regexprep(param.global.Civ2Bin,'\\','\\\\') '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file |
---|
| 4684 | cmd_CIV2=[cmd_CIV2 '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ2.log"']; |
---|
[230] | 4685 | % cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.civ2.cmx"']; |
---|
[134] | 4686 | end |
---|
| 4687 | |
---|
| 4688 | |
---|
[12] | 4689 | %------------------------------------------------------------------------ |
---|
[2] | 4690 | %--read images and convert them to the uint16 format used for PIV |
---|
[45] | 4691 | function A=read_image(filename,type_ima,num,movieobject) |
---|
[12] | 4692 | %------------------------------------------------------------------------ |
---|
[2] | 4693 | %num is the view number needed for an avi movie |
---|
[45] | 4694 | switch type_ima |
---|
| 4695 | case 'movie' |
---|
| 4696 | A=read(movieobject,num); |
---|
| 4697 | case 'avi' |
---|
[112] | 4698 | mov=aviread(filename,num); |
---|
| 4699 | A=frame2im(mov(1)); |
---|
[45] | 4700 | case 'multimage' |
---|
| 4701 | A=imread(filename,num); |
---|
[112] | 4702 | case 'image' |
---|
[45] | 4703 | A=imread(filename); |
---|
| 4704 | end |
---|
| 4705 | siz=size(A); |
---|
| 4706 | if length(siz)==3;%color images |
---|
[2] | 4707 | A=sum(double(A),3); |
---|
| 4708 | A=uint16(A); |
---|
| 4709 | end |
---|
| 4710 | |
---|
[12] | 4711 | %------------------------------------------------------------------------ |
---|
[2] | 4712 | function ref_i_Callback(hObject, eventdata, handles) |
---|
[12] | 4713 | %------------------------------------------------------------------------ |
---|
[273] | 4714 | mode_list=get(handles.CivMode,'String'); |
---|
| 4715 | mode_value=get(handles.CivMode,'Value'); |
---|
[2] | 4716 | mode=mode_list{mode_value}; |
---|
[45] | 4717 | find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
[12] | 4718 | if isequal(mode,'series(Di)') || ...% we do patch2 only |
---|
[112] | 4719 | (get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0) |
---|
[2] | 4720 | find_netcpair_civ2(hObject, eventdata, handles); |
---|
| 4721 | end |
---|
| 4722 | |
---|
[12] | 4723 | %------------------------------------------------------------------------ |
---|
[2] | 4724 | function ref_j_Callback(hObject, eventdata, handles) |
---|
[12] | 4725 | %------------------------------------------------------------------------ |
---|
[273] | 4726 | mode_list=get(handles.CivMode,'String'); |
---|
| 4727 | mode_value=get(handles.CivMode,'Value'); |
---|
[2] | 4728 | mode=mode_list{mode_value}; |
---|
[112] | 4729 | if isequal(get(handles.CIV1,'Value'),0)|| isequal(mode,'series(Dj)') |
---|
[2] | 4730 | find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
| 4731 | end |
---|
[45] | 4732 | if isequal(mode,'series(Dj)') || ... |
---|
[112] | 4733 | (get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0) |
---|
[2] | 4734 | find_netcpair_civ2(hObject, eventdata, handles); |
---|
| 4735 | end |
---|
[12] | 4736 | |
---|
| 4737 | %------------------------------------------------------------------------ |
---|
[71] | 4738 | function ref_i_civ2_Callback(hObject, eventdata, handles) |
---|
| 4739 | %------------------------------------------------------------------------ |
---|
[273] | 4740 | mode_list=get(handles.CivMode,'String'); |
---|
| 4741 | mode_value=get(handles.CivMode,'Value'); |
---|
[71] | 4742 | mode=mode_list{mode_value}; |
---|
| 4743 | find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
| 4744 | |
---|
| 4745 | %------------------------------------------------------------------------ |
---|
| 4746 | function ref_j_civ2_Callback(hObject, eventdata, handles) |
---|
| 4747 | %------------------------------------------------------------------------ |
---|
[273] | 4748 | mode_list=get(handles.CivMode,'String'); |
---|
| 4749 | mode_value=get(handles.CivMode,'Value'); |
---|
[71] | 4750 | mode=mode_list{mode_value}; |
---|
[112] | 4751 | if isequal(mode,'series(Dj)') |
---|
[71] | 4752 | find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
| 4753 | end |
---|
| 4754 | |
---|
| 4755 | %------------------------------------------------------------------------ |
---|
[2] | 4756 | % --- Executes on button press in compare. |
---|
| 4757 | function compare_Callback(hObject, eventdata, handles) |
---|
[12] | 4758 | %------------------------------------------------------------------------ |
---|
[2] | 4759 | test=get(handles.compare,'Value'); |
---|
[263] | 4760 | if test==2 || test==3 % case 'dispalcemen' or 'stereo PIV' |
---|
[71] | 4761 | filebase=get(handles.RootName,'String'); |
---|
[273] | 4762 | browse=get(handlesRootName,'Userdata'); |
---|
[2] | 4763 | browse.nom_type_ima1=browse.nom_type_ima; |
---|
[273] | 4764 | set(handlesRootName,'UserData',browse); |
---|
[2] | 4765 | set(handles.sub_txt,'Visible','on') |
---|
[112] | 4766 | set(handles.RootName_1,'Visible','On');%mkes the second file input window visible |
---|
[273] | 4767 | mode_store=get(handles.CivMode,'String');%get the present 'mode' |
---|
[112] | 4768 | set(handles.compare,'UserData',mode_store);%store the mode display |
---|
[273] | 4769 | set(handles.CivMode,'Visible','off') |
---|
[2] | 4770 | if test==2 |
---|
[273] | 4771 | set(handles.CivMode,'Visible','off') |
---|
[263] | 4772 | set(handles.CivMode,'Value',1) % mode 'civX' selected by default |
---|
[2] | 4773 | else |
---|
[273] | 4774 | set(handles.CivMode,'Visible','on') |
---|
[263] | 4775 | set(handles.CivMode,'Value',3) % mode 'Matlab' selected for stereo |
---|
[2] | 4776 | end |
---|
| 4777 | |
---|
[273] | 4778 | %% menuopen an image file with the browser |
---|
[2] | 4779 | ind_opening=1;%default |
---|
| 4780 | browse.incr_pair=[0 0]; %default |
---|
[71] | 4781 | oldfile=get(handles.RootName,'String'); |
---|
[229] | 4782 | menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)'; |
---|
| 4783 | '*.xml', '.xml files '; ... |
---|
| 4784 | '*.civ', '.civ files '; ... |
---|
| 4785 | '*.png','.png image files'; ... |
---|
| 4786 | '*.jpg',' jpeg image files'; ... |
---|
| 4787 | '*.tif','.tif image files'; ... |
---|
| 4788 | '*.avi;*.AVI','.avi movie files'; ... |
---|
| 4789 | '*.nc','.netcdf files'; ... |
---|
| 4790 | '*.*', 'All Files (*.*)'}; |
---|
| 4791 | [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file of the second series',oldfile); |
---|
[112] | 4792 | fileinput=[PathName FileName];%complete file name |
---|
[2] | 4793 | sizf=size(fileinput); |
---|
[229] | 4794 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
[275] | 4795 | [path,name,ext]=fileparts(fileinput); |
---|
[2] | 4796 | [path1]=fileparts(filebase); |
---|
[263] | 4797 | if isunix |
---|
| 4798 | [status,path]=system(['readlink ' path]) |
---|
| 4799 | [status,path1]=system(['readlink ' path1])% look for the true path in case of symbolic paths |
---|
| 4800 | end |
---|
[2] | 4801 | if ~strcmp(path1,path) |
---|
[263] | 4802 | msgbox_uvmat('ERROR','The second image series must be in the same directory as the first one') |
---|
[2] | 4803 | return |
---|
[263] | 4804 | end |
---|
| 4805 | % set(handles.RootName_1,'String',name); |
---|
[2] | 4806 | [RootPath,RootFile,field_count,str2,str_a,str_b,xx,nom_type,subdir]=name2display(name); |
---|
[263] | 4807 | set(handles.RootName_1,'String',RootFile); |
---|
[273] | 4808 | browse=get(handlesRootName,'UserData'); |
---|
[2] | 4809 | browse.nom_type_ima_1=nom_type; |
---|
[273] | 4810 | set(handlesRootName,'UserData',browse) |
---|
[2] | 4811 | |
---|
| 4812 | %check image extension |
---|
[71] | 4813 | if ~strcmp(ext,get(handles.ImaExt,'String')) |
---|
[263] | 4814 | msgbox_uvmat('ERROR','The second image series must have the same extension name as the first one') |
---|
[2] | 4815 | return |
---|
| 4816 | end |
---|
| 4817 | |
---|
[229] | 4818 | %% check coincidence of image sizes |
---|
[263] | 4819 | % ref_i=get(handles.ref_i,'string'); |
---|
| 4820 | % ref_j=get(handles.ref_j,'string'); |
---|
| 4821 | % [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc]=set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]); |
---|
| 4822 | % A=imread(filecell.ima1.civ1{1}); |
---|
| 4823 | % A_1=imread(fileinput); |
---|
| 4824 | % npxy=size(A); |
---|
| 4825 | % npxy_1=size(A_1); |
---|
| 4826 | % if ~isequal(size(A),size(A_1)) |
---|
| 4827 | % msgbox_uvmat('ERROR','The two input image series do not have the same size') |
---|
| 4828 | % return |
---|
| 4829 | % end |
---|
[2] | 4830 | else |
---|
[273] | 4831 | set(handles.CivMode,'Visible','on') |
---|
[71] | 4832 | set(handles.RootName_1,'Visible','Off'); |
---|
[2] | 4833 | set(handles.sub_txt,'Visible','off') |
---|
[71] | 4834 | set(handles.RootName_1,'String',[]); |
---|
[2] | 4835 | mode_store=get(handles.compare,'UserData'); |
---|
[273] | 4836 | set(handles.CivMode,'Value',1) |
---|
| 4837 | set(handles.CivMode,'String',mode_store) |
---|
[2] | 4838 | set(handles.test_stereo1,'Value',0) |
---|
[274] | 4839 | set(handles.check_Stereo,'Value',0) |
---|
[263] | 4840 | set(handles.CivMode,'Value',1) % mode 'civX' selected by default |
---|
[2] | 4841 | end |
---|
[252] | 4842 | if test==3 && get(handles.PATCH1,'Value') |
---|
[263] | 4843 | set(handles.test_stereo1,'Visible','on') |
---|
[252] | 4844 | else |
---|
[263] | 4845 | set(handles.test_stereo1,'Visible','off') |
---|
[252] | 4846 | end |
---|
| 4847 | if test==3 && get(handles.PATCH2,'Value') |
---|
[274] | 4848 | set(handles.check_Stereo,'Visible','on') |
---|
[252] | 4849 | else |
---|
[274] | 4850 | set(handles.check_Stereo,'Visible','off') |
---|
[252] | 4851 | end |
---|
[2] | 4852 | mode_Callback(hObject, eventdata, handles) |
---|
| 4853 | |
---|
[12] | 4854 | %------------------------------------------------------------------------ |
---|
[2] | 4855 | % --- Executes on button press in get_ref_fix1. |
---|
| 4856 | function get_ref_fix1_Callback(hObject, eventdata, handles) |
---|
[12] | 4857 | %------------------------------------------------------------------------ |
---|
[71] | 4858 | filebase=get(handles.RootName,'String'); |
---|
[2] | 4859 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 4860 | {'*.nc', ' (*.nc)'; |
---|
| 4861 | '*.nc', 'netcdf files '; ... |
---|
| 4862 | '*.*', 'All Files (*.*)'}, ... |
---|
| 4863 | 'Pick a file',filebase); |
---|
| 4864 | |
---|
[2] | 4865 | fileinput=[PathName FileName]; |
---|
| 4866 | sizf=size(fileinput); |
---|
[122] | 4867 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
[2] | 4868 | [Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
| 4869 | ref.filebase=fullfile(Path,File); |
---|
| 4870 | ref.num_a=stra2num(str_a); |
---|
| 4871 | ref.num_b=stra2num(str_b); |
---|
[89] | 4872 | ref.num1=str2double(field_count); |
---|
| 4873 | ref.num2=str2double(str2); |
---|
[2] | 4874 | browse=[];%initialisation |
---|
| 4875 | if ~isequal(ref.ext,'.nc') |
---|
| 4876 | msgbox_uvmat('ERROR','the reference file must be in netcdf format (*.nc)') |
---|
| 4877 | return |
---|
| 4878 | end |
---|
| 4879 | set(handles.ref_fix1,'String',[fullfile(ref.subdir,File) '....nc']); |
---|
| 4880 | set(handles.ref_fix1,'UserData',ref) |
---|
| 4881 | menu_field{1}='civ1'; |
---|
| 4882 | Data=nc2struct(fileinput,[]); |
---|
[45] | 4883 | if isfield(Data,'patch') && isequal(Data.patch,1) |
---|
[2] | 4884 | menu_field{2}='filter1'; |
---|
| 4885 | end |
---|
[45] | 4886 | if isfield(Data,'civ2') && isequal(Data.civ2,1) |
---|
[2] | 4887 | menu_field{3}='civ2'; |
---|
| 4888 | end |
---|
[45] | 4889 | if isfield(Data,'patch2') && isequal(Data.patch2,1) |
---|
[2] | 4890 | menu_field{4}='filter2'; |
---|
| 4891 | end |
---|
| 4892 | set(handles.field_ref1,'String',menu_field); |
---|
| 4893 | set(handles.field_ref1,'Value',length(menu_field)); |
---|
| 4894 | set(handles.inf_sup1,'Value',2); |
---|
| 4895 | set(handles.thresh_vel,'String','1');%default threshold |
---|
| 4896 | set(handles.ref_fix1,'Enable','on') |
---|
[12] | 4897 | |
---|
| 4898 | %------------------------------------------------------------------------ |
---|
[2] | 4899 | % --- Executes on button press in get_ref_fix2. |
---|
| 4900 | function get_ref_fix2_Callback(hObject, eventdata, handles) |
---|
[12] | 4901 | %------------------------------------------------------------------------ |
---|
[2] | 4902 | if isequal(get(handles.get_ref_fix2,'Value'),1) |
---|
[71] | 4903 | filebase=get(handles.RootName,'String'); |
---|
[2] | 4904 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 4905 | {'*.nc', ' (*.nc)'; |
---|
| 4906 | '*.nc', 'netcdf files '; ... |
---|
| 4907 | '*.*', 'All Files (*.*)'}, ... |
---|
| 4908 | 'Pick a file',filebase); |
---|
[2] | 4909 | fileinput=[PathName FileName]; |
---|
| 4910 | sizf=size(fileinput); |
---|
[45] | 4911 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
[2] | 4912 | [Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
| 4913 | ref.filebase=fullfile(Path,File); |
---|
| 4914 | ref.num_a=stra2num(str_a); |
---|
| 4915 | ref.num_b=stra2num(str_b); |
---|
| 4916 | ref.num1=str2num(field_count); |
---|
| 4917 | ref.num2=str2num(str2); |
---|
| 4918 | browse=[];%initialisation |
---|
| 4919 | if ~isequal(ref.ext,'.nc') |
---|
| 4920 | msgbox_uvmat('ERROR','the reference file must be in netcdf format (*.nc)') |
---|
| 4921 | return |
---|
| 4922 | end |
---|
| 4923 | set(handles.ref_fix2,'String',[fullfile(ref.subdir,File) '....nc']); |
---|
[112] | 4924 | set(handles.ref_fix2,'UserData',ref) |
---|
[2] | 4925 | menu_field{1}='civ1'; |
---|
| 4926 | Data=nc2struct(fileinput,[]); |
---|
| 4927 | if isfield(Data,'patch') & isequal(Data.patch,1) |
---|
| 4928 | menu_field{2}='filter1'; |
---|
| 4929 | end |
---|
| 4930 | if isfield(Data,'civ2') & isequal(Data.civ2,1) |
---|
| 4931 | menu_field{3}='civ2'; |
---|
| 4932 | end |
---|
| 4933 | if isfield(Data,'patch2') & isequal(Data.patch2,1) |
---|
| 4934 | menu_field{4}='filter2'; |
---|
| 4935 | end |
---|
| 4936 | set(handles.field_ref2,'String',menu_field); |
---|
| 4937 | set(handles.field_ref2,'Value',length(menu_field)); |
---|
| 4938 | set(handles.inf_sup2,'Value',2); |
---|
| 4939 | set(handles.thresh_vel2,'String','1');%default threshold |
---|
| 4940 | set(handles.ref_fix2,'Enable','on') |
---|
| 4941 | set(handles.ref_fix2,'Visible','on') |
---|
| 4942 | set(handles.field_ref2,'Visible','on') |
---|
| 4943 | else |
---|
| 4944 | set(handles.ref_fix2,'Visible','off') |
---|
| 4945 | set(handles.field_ref2,'Visible','off') |
---|
| 4946 | end |
---|
| 4947 | |
---|
[12] | 4948 | %------------------------------------------------------------------------ |
---|
[2] | 4949 | function ref_fix1_Callback(hObject, eventdata, handles) |
---|
[12] | 4950 | %------------------------------------------------------------------------ |
---|
| 4951 | set(handles.inf_sup1,'Value',1); |
---|
| 4952 | set(handles.field_ref1,'Value',1) |
---|
| 4953 | set(handles.field_ref1,'String',{' '}) |
---|
| 4954 | set(handles.ref_fix1,'UserData',[]); |
---|
| 4955 | set(handles.ref_fix1,'String',''); |
---|
| 4956 | set(handles.thresh_vel1,'String','0'); |
---|
[112] | 4957 | |
---|
[12] | 4958 | %------------------------------------------------------------------------ |
---|
[2] | 4959 | function ref_fix2_Callback(hObject, eventdata, handles) |
---|
[12] | 4960 | %------------------------------------------------------------------------ |
---|
| 4961 | set(handles.inf_sup2,'Value',1); |
---|
| 4962 | set(handles.field_ref2,'Value',1) |
---|
| 4963 | set(handles.field_ref2,'String',{' '}) |
---|
| 4964 | set(handles.ref_fix2,'UserData',[]); |
---|
| 4965 | set(handles.ref_fix2,'String',''); |
---|
| 4966 | set(handles.thresh_vel2,'String','0'); |
---|
[2] | 4967 | |
---|
[12] | 4968 | %------------------------------------------------------------------------ |
---|
[2] | 4969 | % --- Executes on button press in test_stereo1. |
---|
| 4970 | function test_stereo1_Callback(hObject, eventdata, handles) |
---|
[12] | 4971 | %------------------------------------------------------------------------ |
---|
[2] | 4972 | if isequal(get(handles.test_stereo1,'Value'),0) |
---|
| 4973 | set(handles.subdomain_patch1,'Visible','on') |
---|
| 4974 | set(handles.rho_patch1,'Visible','on') |
---|
| 4975 | else |
---|
| 4976 | set(handles.subdomain_patch1,'Visible','off') |
---|
| 4977 | set(handles.rho_patch1,'Visible','off') |
---|
| 4978 | end |
---|
| 4979 | |
---|
[12] | 4980 | %------------------------------------------------------------------------ |
---|
[274] | 4981 | % --- Executes on button press in check_Stereo. |
---|
[273] | 4982 | function StereoCheck_Callback(hObject, eventdata, handles) |
---|
[12] | 4983 | %------------------------------------------------------------------------ |
---|
[274] | 4984 | if isequal(get(handles.check_Stereo,'Value'),0) |
---|
| 4985 | set(handles.num_SubdomainSize,'Visible','on') |
---|
| 4986 | set(handles.num_SmoothParam,'Visible','on') |
---|
[2] | 4987 | else |
---|
[274] | 4988 | set(handles.num_SubdomainSize,'Visible','off') |
---|
| 4989 | set(handles.num_SmoothParam,'Visible','off') |
---|
[2] | 4990 | end |
---|
| 4991 | |
---|
[12] | 4992 | %------------------------------------------------------------------------ |
---|
[276] | 4993 | % --- Executes on button press in check_Threshold. |
---|
[2] | 4994 | function ImaThreshold_Callback(hObject, eventdata, handles) |
---|
[12] | 4995 | %------------------------------------------------------------------------ |
---|
[276] | 4996 | if isequal(get(handles.check_Threshold,'Value'),1) |
---|
[2] | 4997 | set(handles.MinIma,'Visible','on') |
---|
| 4998 | set(handles.MaxIma,'Visible','on') |
---|
| 4999 | else |
---|
| 5000 | set(handles.MinIma,'Visible','off') |
---|
| 5001 | set(handles.MaxIma,'Visible','off') |
---|
| 5002 | end |
---|
| 5003 | |
---|
[12] | 5004 | %------------------------------------------------------------------------ |
---|
[2] | 5005 | % --- Executes on button press in ImaThreshold2. |
---|
| 5006 | function ImaThreshold2_Callback(hObject, eventdata, handles) |
---|
[12] | 5007 | %------------------------------------------------------------------------ |
---|
[2] | 5008 | if isequal(get(handles.ImaThreshold2,'Value'),1) |
---|
| 5009 | set(handles.MinIma2,'Visible','on') |
---|
| 5010 | set(handles.MaxIma2,'Visible','on') |
---|
| 5011 | else |
---|
| 5012 | set(handles.MinIma2,'Visible','off') |
---|
| 5013 | set(handles.MaxIma2,'Visible','off') |
---|
| 5014 | end |
---|
| 5015 | |
---|
[224] | 5016 | %------------------------------------------------------------------------ |
---|
[225] | 5017 | % --- Executes on button press in TestCiv1: display image correlation function |
---|
[150] | 5018 | function TestCiv1_Callback(hObject, eventdata, handles) |
---|
[224] | 5019 | %------------------------------------------------------------------------ |
---|
[233] | 5020 | set(handles.TestCiv1,'BackgroundColor',[1 1 0]) |
---|
| 5021 | drawnow |
---|
[150] | 5022 | test_civ1=get(handles.TestCiv1,'Value'); |
---|
| 5023 | if test_civ1 |
---|
[227] | 5024 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
| 5025 | if strcmp(get(handles.ref_j,'Visible'),'on') |
---|
| 5026 | ref_j=str2double(get(handles.ref_j,'String')); |
---|
| 5027 | else |
---|
| 5028 | ref_j=1;%default |
---|
| 5029 | end |
---|
[224] | 5030 | [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=... |
---|
[273] | 5031 | set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]); |
---|
[224] | 5032 | Data.ListVarName={'ny','nx','A'}; |
---|
| 5033 | Data.VarDimName={'ny','nx',{'ny','nx'}}; |
---|
| 5034 | Data.A=imread(filecell.ima1.civ1{1}); |
---|
| 5035 | Data.ny=[size(Data.A,1) 1]; |
---|
| 5036 | Data.nx=[1 size(Data.A,2)]; |
---|
[227] | 5037 | par_civ1=read_param_civ1(handles,filecell.ima1.civ1{1}); |
---|
[231] | 5038 | par_civ1.filename_ima_a=filecell.ima1.civ1{1}; |
---|
| 5039 | par_civ1.filename_ima_b=filecell.ima2.civ1{1}; |
---|
| 5040 | par_civ1.T0=0; |
---|
| 5041 | par_civ1.Dt=1; |
---|
[246] | 5042 | Param.Civ1=par_civ1; |
---|
| 5043 | Data=civ_uvmat(Param); |
---|
[231] | 5044 | Data.ListVarName=[Data.ListVarName {'ny','nx','A'}]; |
---|
| 5045 | Data.VarDimName=[Data.VarDimName {'ny','nx',{'ny','nx'}}]; |
---|
| 5046 | Data.A=imread(filecell.ima1.civ1{1}); |
---|
| 5047 | Data.ny=[size(Data.A,1) 1]; |
---|
| 5048 | Data.nx=[1 size(Data.A,2)]; |
---|
| 5049 | hview_field=view_field(Data); |
---|
| 5050 | set(0,'CurrentFigure',hview_field) |
---|
| 5051 | hhview_field=guihandles(hview_field); |
---|
| 5052 | set(hview_field,'CurrentAxes',hhview_field.axes3) |
---|
| 5053 | ViewData=get(hview_field,'UserData'); |
---|
| 5054 | ViewData.CivHandle=handles.civ;% indicate the handle of the civ GUI in view_field |
---|
[224] | 5055 | ViewData.axes3.B=imread(filecell.ima2.civ1{1});%store the second image in the UserData of the GUI view_field |
---|
[236] | 5056 | ViewData.axes3.X=Data.Civ1_X; %keep the set of points in memeory |
---|
| 5057 | ViewData.axes3.Y=Data.Civ1_Y; |
---|
[231] | 5058 | set(hview_field,'UserData',ViewData) |
---|
[224] | 5059 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display |
---|
| 5060 | if isempty(corrfig) |
---|
| 5061 | corrfig=figure; |
---|
| 5062 | set(corrfig,'tag','corrfig') |
---|
| 5063 | set(corrfig,'name','image correlation') |
---|
| 5064 | set(corrfig,'DeleteFcn',{@closeview_field})% |
---|
| 5065 | end |
---|
[233] | 5066 | set(handles.TestCiv1,'BackgroundColor',[1 0 0]) |
---|
[224] | 5067 | else |
---|
| 5068 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display |
---|
| 5069 | if ~isempty(corrfig) |
---|
| 5070 | delete(corrfig) |
---|
| 5071 | end |
---|
| 5072 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
| 5073 | if ~isempty(hview_field) |
---|
| 5074 | delete(hview_field) |
---|
| 5075 | end |
---|
[150] | 5076 | end |
---|
[71] | 5077 | |
---|
[224] | 5078 | function closeview_field(gcbo,eventdata) |
---|
| 5079 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
| 5080 | if ~isempty(hview_field) |
---|
| 5081 | delete(hview_field) |
---|
| 5082 | end |
---|
[177] | 5083 | %------------------------------------------------------------------- |
---|
| 5084 | % --- Executes on button press in status. |
---|
| 5085 | function status_Callback(hObject, eventdata, handles) |
---|
| 5086 | %------------------------------------------------------------------- |
---|
| 5087 | val=get(handles.status,'Value'); |
---|
| 5088 | if val==0 |
---|
[252] | 5089 | set(handles.status,'BackgroundColor',[0 1 0]) |
---|
[177] | 5090 | hfig=findobj(allchild(0),'name','civ_status'); |
---|
| 5091 | if ~isempty(hfig) |
---|
| 5092 | delete(hfig) |
---|
| 5093 | end |
---|
| 5094 | return |
---|
| 5095 | end |
---|
[252] | 5096 | set(handles.status,'BackgroundColor',[1 1 0]) |
---|
| 5097 | drawnow |
---|
[177] | 5098 | listtype={'civ1','fix1','patch1','civ2','fix2','patch2'}; |
---|
| 5099 | box_test(1)=get(handles.CIV1,'Value'); |
---|
| 5100 | box_test(2)=get(handles.FIX1,'Value'); |
---|
| 5101 | box_test(3)=get(handles.PATCH1,'Value'); |
---|
| 5102 | box_test(4)=get(handles.CIV2,'Value'); |
---|
| 5103 | box_test(5)=get(handles.FIX2,'Value'); |
---|
[180] | 5104 | box_test(6)=get(handles.PATCH2,'Value'); |
---|
| 5105 | option_civ=find(box_test,1,'last');%last selected option (non-zero index of box_test) |
---|
[252] | 5106 | filecell=get(handles.civ,'UserData');%retrieve the list of output files expected for PIV |
---|
| 5107 | test_new=0; |
---|
[177] | 5108 | if ~isfield(filecell,'nc') |
---|
[252] | 5109 | test_new=1; |
---|
[227] | 5110 | [ref_i,ref_j,errormsg]=find_ref_indices(handles); |
---|
| 5111 | if ~isempty(errormsg) |
---|
| 5112 | msgbox_uvmat('ERROR',errormsg) |
---|
| 5113 | return |
---|
| 5114 | end |
---|
[252] | 5115 | filecell=set_civ_filenames(handles,ref_i,ref_j,box_test);%determine the output file expected from the GUI status |
---|
[177] | 5116 | end |
---|
| 5117 | if ~isequal(box_test(4:6),[0 0 0]) |
---|
[252] | 5118 | civ_files=filecell.nc.civ2;%case of civ2 operations |
---|
[177] | 5119 | else |
---|
| 5120 | civ_files=filecell.nc.civ1; |
---|
| 5121 | end |
---|
| 5122 | [root,filename,ext]=fileparts(civ_files{1}); |
---|
| 5123 | [rootroot,subdir,extdir]=fileparts(root); |
---|
| 5124 | hfig=findobj(allchild(0),'name','civ_status'); |
---|
| 5125 | if isempty(hfig) |
---|
[252] | 5126 | hfig=figure('DeleteFcn',@stop_status); |
---|
[177] | 5127 | set(hfig,'name','civ_status') |
---|
[182] | 5128 | hlist=uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @open_view_field,'tag','list'); |
---|
[252] | 5129 | uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox','Max',2,'String','checking files...'); |
---|
[177] | 5130 | uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); |
---|
[182] | 5131 | uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','OK','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@close_GUI); |
---|
[177] | 5132 | BarPosition=[0.05 0.81 0.01 0.05]; |
---|
| 5133 | hwaitbar=uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar'); |
---|
[252] | 5134 | drawnow |
---|
[177] | 5135 | end |
---|
[188] | 5136 | % datnum=[]; |
---|
[177] | 5137 | Tabchar={}; |
---|
| 5138 | nbfiles=numel(civ_files); |
---|
| 5139 | count=0; |
---|
[188] | 5140 | testrecent=0; |
---|
[177] | 5141 | while count<nbfiles |
---|
| 5142 | count=0; |
---|
[188] | 5143 | datnum=zeros(1,nbfiles); |
---|
[177] | 5144 | for ifile=1:nbfiles |
---|
| 5145 | detect=exist(civ_files{ifile},'file'); % check the existence of the file |
---|
[179] | 5146 | option=0; |
---|
[177] | 5147 | if detect==0 |
---|
[179] | 5148 | option_str='not created'; |
---|
[177] | 5149 | else |
---|
[219] | 5150 | datfile=dir(civ_files{ifile}); |
---|
[188] | 5151 | if isfield(datfile,'datenum') |
---|
| 5152 | datnum(ifile)=datfile.datenum;%only available in recent matlab versions |
---|
| 5153 | testrecent=1; |
---|
| 5154 | end |
---|
[177] | 5155 | filefound(ifile)={datfile.name}; |
---|
| 5156 | lastfield=''; |
---|
| 5157 | % check the content netcdf file |
---|
| 5158 | Data=nc2struct(civ_files{ifile},'ListGlobalAttribute','patch2','fix2','civ2','patch','fix'); |
---|
| 5159 | if ~isempty(Data.patch2) && isequal(Data.patch2,1) |
---|
[179] | 5160 | option=6; |
---|
| 5161 | option_str='patch2'; |
---|
[177] | 5162 | elseif ~isempty(Data.fix2) && isequal(Data.fix2,1) |
---|
[179] | 5163 | option=5; |
---|
| 5164 | option_str='fix2'; |
---|
[177] | 5165 | elseif ~isempty(Data.civ2) && isequal(Data.civ2,1); |
---|
[179] | 5166 | option=4; |
---|
| 5167 | option_str='civ2'; |
---|
[177] | 5168 | elseif ~isempty(Data.patch) && isequal(Data.patch,1); |
---|
[179] | 5169 | option=3; |
---|
| 5170 | option_str='patch1'; |
---|
[177] | 5171 | elseif ~isempty(Data.fix) && isequal(Data.fix,1); |
---|
[179] | 5172 | option=2; |
---|
| 5173 | option_str='fix1'; |
---|
[177] | 5174 | else |
---|
[179] | 5175 | option=1; |
---|
| 5176 | option_str='civ1'; |
---|
[177] | 5177 | end |
---|
| 5178 | end |
---|
[179] | 5179 | if option >= option_civ |
---|
[177] | 5180 | count=count+1; |
---|
| 5181 | end |
---|
| 5182 | [rr,filename,ext]=fileparts(civ_files{ifile}); |
---|
[179] | 5183 | Tabchar{ifile,1}=[fullfile([subdir extdir],filename) ext '...' option_str]; |
---|
[177] | 5184 | end |
---|
[219] | 5185 | datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files |
---|
[188] | 5186 | if isempty(datnum) |
---|
| 5187 | if testrecent |
---|
| 5188 | message='no civ result created yet'; |
---|
| 5189 | else |
---|
| 5190 | message=''; |
---|
| 5191 | end |
---|
[177] | 5192 | else |
---|
[219] | 5193 | datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files |
---|
[177] | 5194 | [first,ind]=min(datnum); |
---|
| 5195 | [last,indlast]=max(datnum); |
---|
[252] | 5196 | if test_new |
---|
| 5197 | message='existing file status, no processing launched yet'; |
---|
| 5198 | else |
---|
[177] | 5199 | message={[num2str(count) ' file(s) done over ' num2str(nbfiles)] ;['oldest modification: ' cell2mat(filefound(ind)) ' : ' datestr(first)];... |
---|
| 5200 | ['latest modification: ' cell2mat(filefound(indlast)) ' : ' datestr(last)]}; |
---|
[252] | 5201 | end |
---|
[177] | 5202 | end |
---|
| 5203 | hfig=findobj(allchild(0),'name','civ_status'); |
---|
[252] | 5204 | if isempty(hfig)% the status list has been deleted |
---|
[177] | 5205 | return |
---|
| 5206 | else |
---|
| 5207 | hlist=findobj(hfig,'tag','list'); |
---|
| 5208 | hmsgbox=findobj(hfig,'tag','msgbox'); |
---|
| 5209 | hwaitbar=findobj(hfig,'tag','waitbar'); |
---|
| 5210 | set(hlist,'String',Tabchar) |
---|
| 5211 | set(hmsgbox,'String', message) |
---|
[252] | 5212 | if count>0 && ~test_new |
---|
[177] | 5213 | BarPosition(3)=0.9*count/nbfiles; |
---|
| 5214 | set(hwaitbar,'Position',BarPosition) |
---|
| 5215 | end |
---|
| 5216 | end |
---|
| 5217 | set(hlist,'UserData',rootroot) |
---|
[252] | 5218 | pause(10)% wait 10 seconds for next check |
---|
[177] | 5219 | end |
---|
[150] | 5220 | |
---|
[177] | 5221 | |
---|
[252] | 5222 | %------------------------------------------------------------------------ |
---|
| 5223 | % call 'view_field.fig' to display the field selected in the list of 'status' |
---|
[177] | 5224 | function open_view_field(hObject, eventdata) |
---|
[252] | 5225 | %------------------------------------------------------------------------ |
---|
| 5226 | list=get(hObject,'String'); |
---|
| 5227 | index=get(hObject,'Value'); |
---|
| 5228 | rootroot=get(hObject,'UserData'); |
---|
| 5229 | filename=list{index}; |
---|
| 5230 | ind_dot=findstr(filename,'...'); |
---|
| 5231 | filename=filename(1:ind_dot-1); |
---|
| 5232 | filename=fullfile(rootroot,filename); |
---|
| 5233 | delete(get(hObject,'parent'))%delete the display figure to stop the check process |
---|
| 5234 | if exist(filename,'file')%visualise the vel field if it exists |
---|
| 5235 | uvmat(filename) |
---|
| 5236 | set(gcbo,'Value',1) |
---|
| 5237 | end |
---|
[150] | 5238 | |
---|
[252] | 5239 | %------------------------------------------------------------------------ |
---|
| 5240 | % launched by pressing OK on the status figure |
---|
[182] | 5241 | function close_GUI(hObject, eventdata) |
---|
[252] | 5242 | %------------------------------------------------------------------------ |
---|
| 5243 | delete(gcbf) |
---|
| 5244 | |
---|
| 5245 | %------------------------------------------------------------------------ |
---|
| 5246 | % launched by deleting the status figure |
---|
| 5247 | function stop_status(hObject, eventdata) |
---|
| 5248 | %------------------------------------------------------------------------ |
---|
| 5249 | hciv=findobj(allchild(0),'tag','civ'); |
---|
| 5250 | hhciv=guidata(hciv); |
---|
| 5251 | set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ |
---|
| 5252 | set(hhciv.status,'BackgroundColor',[0 1 0]) |
---|
[220] | 5253 | |
---|
[252] | 5254 | %------------------------------------------------------------------------ |
---|
[273] | 5255 | % % --- Executes on button press in CivMode. |
---|
| 5256 | % function CivMode_Callback(hObject, eventdata, handles) |
---|
| 5257 | % %------------------------------------------------------------------------ |
---|
| 5258 | % Listprog=get(handles.CivMode,'String'); |
---|
| 5259 | % index=get(handles.CivMode,'Value'); |
---|
| 5260 | % prog=Listprog{index}; |
---|
| 5261 | % switch prog |
---|
| 5262 | % case 'CivX' |
---|
| 5263 | % set(handles.thresh_patch1,'Visible','off') |
---|
| 5264 | % set(handles.thresh_text1,'Visible','off') |
---|
[274] | 5265 | % set(handles.num_MaxDiff,'Visible','off') |
---|
[273] | 5266 | % set(handles.thresh_text2,'Visible','off') |
---|
| 5267 | % set(handles.rho,'Style','edit') |
---|
| 5268 | % set(handles.rho,'String','1') |
---|
| 5269 | % set(handles.BATCH,'Enable','on') |
---|
| 5270 | % case 'CivAll' |
---|
| 5271 | % if get(handles.PATCH1,'Value') |
---|
| 5272 | % set(handles.thresh_patch1,'Visible','on') |
---|
| 5273 | % set(handles.thresh_text1,'Visible','on') |
---|
| 5274 | % end |
---|
| 5275 | % set(handles.rho,'Style','edit') |
---|
| 5276 | % set(handles.rho,'String','1') |
---|
| 5277 | % set(handles.BATCH,'Enable','on') |
---|
| 5278 | % case 'CivUvmat' |
---|
| 5279 | % |
---|
| 5280 | % end |
---|
| 5281 | |
---|
| 5282 | |
---|
[274] | 5283 | % --- Executes on button press in check_Stereo. |
---|
| 5284 | function check_Stereo_Callback(hObject, eventdata, handles) |
---|
| 5285 | % hObject handle to check_Stereo (see GCBO) |
---|
[273] | 5286 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 5287 | % handles structure with handles and user data (see GUIDATA) |
---|
| 5288 | |
---|
[274] | 5289 | % Hint: get(hObject,'Value') returns toggle state of check_Stereo |
---|
[273] | 5290 | |
---|
| 5291 | |
---|
| 5292 | |
---|
[274] | 5293 | function num_SubdomainSize_Callback(hObject, eventdata, handles) |
---|
| 5294 | % hObject handle to num_SubdomainSize (see GCBO) |
---|
[273] | 5295 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 5296 | % handles structure with handles and user data (see GUIDATA) |
---|
| 5297 | |
---|
[274] | 5298 | % Hints: get(hObject,'String') returns contents of num_SubdomainSize as text |
---|
| 5299 | % str2double(get(hObject,'String')) returns contents of num_SubdomainSize as a double |
---|
[273] | 5300 | |
---|
| 5301 | |
---|
| 5302 | |
---|
[274] | 5303 | function num_SmoothingParam_Callback(hObject, eventdata, handles) |
---|
| 5304 | % hObject handle to num_SmoothingParam (see GCBO) |
---|
[273] | 5305 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 5306 | % handles structure with handles and user data (see GUIDATA) |
---|
| 5307 | |
---|
[274] | 5308 | % Hints: get(hObject,'String') returns contents of num_SmoothingParam as text |
---|
| 5309 | % str2double(get(hObject,'String')) returns contents of num_SmoothingParam as a double |
---|
[273] | 5310 | |
---|
| 5311 | |
---|
| 5312 | |
---|
[274] | 5313 | function num_MaxDiff_Callback(hObject, eventdata, handles) |
---|
| 5314 | % hObject handle to num_MaxDiff (see GCBO) |
---|
[273] | 5315 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 5316 | % handles structure with handles and user data (see GUIDATA) |
---|
| 5317 | |
---|
[274] | 5318 | % Hints: get(hObject,'String') returns contents of num_MaxDiff as text |
---|
| 5319 | % str2double(get(hObject,'String')) returns contents of num_MaxDiff as a double |
---|
[273] | 5320 | |
---|
| 5321 | |
---|
[274] | 5322 | function num_Nx_Callback(hObject, eventdata, handles) |
---|
| 5323 | % hObject handle to num_Nx (see GCBO) |
---|
[273] | 5324 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 5325 | % handles structure with handles and user data (see GUIDATA) |
---|
| 5326 | |
---|
[274] | 5327 | % Hints: get(hObject,'String') returns contents of num_Nx as text |
---|
| 5328 | % str2double(get(hObject,'String')) returns contents of num_Nx as a double |
---|
[273] | 5329 | |
---|
| 5330 | |
---|
[274] | 5331 | function num_Ny_Callback(hObject, eventdata, handles) |
---|
| 5332 | % hObject handle to num_Ny (see GCBO) |
---|
[273] | 5333 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 5334 | % handles structure with handles and user data (see GUIDATA) |
---|
| 5335 | |
---|
[274] | 5336 | % Hints: get(hObject,'String') returns contents of num_Ny as text |
---|
| 5337 | % str2double(get(hObject,'String')) returns contents of num_Ny as a double |
---|
[273] | 5338 | |
---|
| 5339 | |
---|
| 5340 | % -------------------------------------------------------------------- |
---|
| 5341 | function MenuHelp_Callback(hObject, eventdata, handles) |
---|
[276] | 5342 | path_civ=fileparts(which ('civ')); |
---|
| 5343 | helpfile=fullfile(path_civ,'uvmat_doc','uvmat_doc.html'); |
---|
| 5344 | if isempty(dir(helpfile)) |
---|
| 5345 | msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package') |
---|
[273] | 5346 | else |
---|
[276] | 5347 | addpath (fullfile(path_civ,'uvmat_doc')) |
---|
[273] | 5348 | web([helpfile '#civ']) |
---|
[224] | 5349 | end |
---|
[273] | 5350 | |
---|
| 5351 | % -------------------------------------------------------------------- |
---|
| 5352 | function CivX_Callback(hObject, eventdata, handles) |
---|
| 5353 | %set(handles.thresh_patch1,'Visible','off') |
---|
| 5354 | set(handles.thresh_text1,'Visible','off') |
---|
[274] | 5355 | set(handles.num_MaxDiff,'Visible','off') |
---|
[273] | 5356 | set(handles.thresh_text2,'Visible','off') |
---|
| 5357 | set(handles.rho,'Style','edit') |
---|
| 5358 | set(handles.rho,'String','1') |
---|
| 5359 | set(handles.BATCH,'Enable','on') |
---|
| 5360 | |
---|
| 5361 | % -------------------------------------------------------------------- |
---|
| 5362 | function Matlab_Callback(hObject, eventdata, handles) |
---|
| 5363 | set(handles.Matlab,'checked','on') |
---|
| 5364 | set(handles.CivX,'checked','off') |
---|
| 5365 | if get(handles.PATCH1,'Value') |
---|
| 5366 | set(handles.thresh_patch1,'Visible','on') |
---|
| 5367 | set(handles.thresh_text1,'Visible','on') |
---|
| 5368 | end |
---|
| 5369 | if get(handles.PATCH2,'Value') |
---|
[274] | 5370 | set(handles.num_MaxDiff,'Visible','on') |
---|
[273] | 5371 | set(handles.thresh_text2,'Visible','on') |
---|
| 5372 | end |
---|
| 5373 | set(handles.rho,'Style','popupmenu') |
---|
| 5374 | set(handles.rho,'Value',1) |
---|
| 5375 | set(handles.rho,'String',{'1';'2'}) |
---|
| 5376 | set(handles.BATCH,'Enable','off') |
---|
| 5377 | |
---|
| 5378 | % -------------------------------------------------------------------- |
---|
| 5379 | % --- read a panel with handle 'handle' producing a structure 'struct' |
---|
| 5380 | function struct=read_panel(handle) |
---|
| 5381 | hchild=get(handle,'children'); |
---|
| 5382 | for ichild=1:numel(hchild) |
---|
| 5383 | object_style=get(hchild(ichild),'Style'); |
---|
[274] | 5384 | tag=get(hchild(ichild),'tag'); |
---|
[273] | 5385 | check_input=1;%default |
---|
| 5386 | switch object_style |
---|
| 5387 | case 'edit' |
---|
[274] | 5388 | switch(tag(1:4)) |
---|
| 5389 | case 'num_' |
---|
| 5390 | input=str2double(get(hchild(ichild),'String')); |
---|
| 5391 | %deal with undefined input: retrieve the default value stored as UserData |
---|
| 5392 | if isnan(input) |
---|
| 5393 | input=get(hchild(ichild),'UserData'); |
---|
| 5394 | set(hchild(ichild),'String',num2str(input)) |
---|
| 5395 | end |
---|
| 5396 | case 'txt_' |
---|
| 5397 | input=get(hchild(ichild),'String'); |
---|
[273] | 5398 | end |
---|
[274] | 5399 | key=tag(5:end); |
---|
[273] | 5400 | case 'checkbox' |
---|
[274] | 5401 | input=get(hchild(ichild),'Value'); |
---|
| 5402 | key=tag(7:end); |
---|
[273] | 5403 | otherwise |
---|
[274] | 5404 | check_input=0; |
---|
[273] | 5405 | end |
---|
| 5406 | if check_input |
---|
[274] | 5407 | eval(['struct.' key '=input;']) |
---|
[273] | 5408 | end |
---|
| 5409 | end |
---|