[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) |
---|
| 23 | |
---|
[257] | 24 | % Last Modified by GUIDE v2.5 27-May-2011 17:55:50 |
---|
[2] | 25 | % Begin initialization code - DO NOT EDIT |
---|
| 26 | gui_Singleton = 1; |
---|
| 27 | gui_State = struct('gui_Name', mfilename, ... |
---|
[112] | 28 | 'gui_Singleton', gui_Singleton, ... |
---|
| 29 | 'gui_OpeningFcn', @civ_OpeningFcn, ... |
---|
| 30 | 'gui_OutputFcn', @civ_OutputFcn, ... |
---|
| 31 | 'gui_LayoutFcn', [] , ... |
---|
| 32 | 'gui_Callback', []); |
---|
[2] | 33 | if nargin && ischar(varargin{1}) |
---|
| 34 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
| 35 | end |
---|
| 36 | |
---|
| 37 | if nargout |
---|
| 38 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
| 39 | else |
---|
| 40 | gui_mainfcn(gui_State, varargin{:}); |
---|
| 41 | end |
---|
| 42 | % End initialization code - DO NOT EDIT |
---|
| 43 | |
---|
[12] | 44 | %------------------------------------------------------------------------ |
---|
[2] | 45 | % --- Executes just before civ is made visible. |
---|
[71] | 46 | function civ_OpeningFcn(hObject, eventdata, handles, param) |
---|
[12] | 47 | %------------------------------------------------------------------------ |
---|
[2] | 48 | % This function has no output args, see OutputFcn. |
---|
| 49 | % hObject handle to figure |
---|
| 50 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 51 | % handles structure with handles and user data (see GUIDATA) |
---|
| 52 | % varargin command line arguments to civ (see VARARGIN) |
---|
[84] | 53 | global patch_newBin %=1 if new patch processing available |
---|
[112] | 54 | %filebase: root name |
---|
[2] | 55 | %nom_type: nomencalture used ('png_old','_i_j'...) |
---|
| 56 | %list of field numbers to process |
---|
[112] | 57 | %subdir: subdirectory of the opened netcdf file |
---|
[2] | 58 | %ind_opening: operation number advised for beginning (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2), |
---|
| 59 | %ind_a_opening ind_b_opening chosen pair from the opened netcdf file |
---|
| 60 | % Choose default command line output for civ |
---|
| 61 | handles.output = hObject; |
---|
| 62 | % Update handles structure |
---|
| 63 | guidata(hObject, handles); |
---|
[252] | 64 | set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display) |
---|
[2] | 65 | %default initial parameters |
---|
| 66 | filebase=''; % root file name ('filebase'.civ) |
---|
| 67 | ext=[]; |
---|
[252] | 68 | |
---|
[71] | 69 | %default input parameters: |
---|
[153] | 70 | num_i1=1; % set of field i numbers |
---|
| 71 | num_i2=1; % set of field i numbers |
---|
| 72 | num_j1=1; % set of field j numbers (fields a) |
---|
| 73 | num_j2=1; % second set of field j numbers (fields b) |
---|
[71] | 74 | subdir='A'; % subdir for the netcdf result files |
---|
[112] | 75 | ind_opening=1; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2) |
---|
| 76 | %load the initial parameters if the interface is started from uvmat |
---|
[71] | 77 | if exist('param','var')&&isstruct(param)% the interface is opened from uvmat |
---|
| 78 | filebase=param.RootName; |
---|
| 79 | nom_type_read=param.NomType; |
---|
[153] | 80 | num_i1=param.num1; |
---|
| 81 | if isnan(num_i1),num_i1=1;end |
---|
| 82 | num_i2=param.num2; |
---|
| 83 | if isnan(num_i2),num_i2=num_i1;end |
---|
| 84 | num_j1=param.num_a; |
---|
| 85 | if isnan(num_j1),num_j1=1;end |
---|
| 86 | num_j2=param.num_b; |
---|
| 87 | if isnan(num_j2),num_j2=num_j1;end |
---|
[71] | 88 | subdir=param.SubDir; |
---|
| 89 | ind_opening=param.IndOpening; |
---|
| 90 | ext=param.ImaExt; |
---|
[2] | 91 | end |
---|
[153] | 92 | browse.num_i1=num_i1; |
---|
| 93 | browse.num_i2=num_i2; |
---|
| 94 | browse.num_j1=num_j1; |
---|
| 95 | browse.num_j2=num_j2; |
---|
[122] | 96 | if ~isempty(ext) && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat |
---|
[112] | 97 | set(handles.ImaExt,'String',ext) |
---|
[128] | 98 | browse.ext_ima=ext; |
---|
[112] | 99 | if exist('nom_type_read','var') |
---|
| 100 | browse.nom_type_ima=nom_type_read; % the image nomenclature is stored |
---|
| 101 | end |
---|
[2] | 102 | elseif isequal(ext,'.nc') |
---|
| 103 | if exist('nom_type_read','var') |
---|
| 104 | browse.nom_type_nc=nom_type_read;% the netcdf nomenclature is stored |
---|
| 105 | end |
---|
| 106 | end |
---|
[71] | 107 | set(handles.RootName,'String',filebase); |
---|
[2] | 108 | set(handles.ImaDoc,'String',ext) |
---|
| 109 | |
---|
[122] | 110 | %read names of the .exe file to adjust the interface according to available binaries |
---|
[2] | 111 | path_uvmat=which('uvmat');% check the path detected for source file uvmat |
---|
| 112 | path_UVMAT=fileparts(path_uvmat); %path to UVMAT |
---|
[45] | 113 | errormsg=[];%default error message |
---|
[112] | 114 | xmlfile='PARAM.xml'; |
---|
[54] | 115 | if exist(xmlfile,'file') |
---|
| 116 | try |
---|
[112] | 117 | t=xmltree(xmlfile); |
---|
| 118 | sparam=convert(t); |
---|
[54] | 119 | catch |
---|
[112] | 120 | errormsg={' Unable to read the file PARAM.xml defining the civx binaries:'; lasterr}; |
---|
[227] | 121 | return |
---|
[2] | 122 | end |
---|
[54] | 123 | else |
---|
| 124 | errormsg=[xmlfile ' not found: path to civx binaries undefined']; |
---|
[227] | 125 | return |
---|
[2] | 126 | end |
---|
[71] | 127 | |
---|
[110] | 128 | |
---|
[45] | 129 | if ~isempty(errormsg) |
---|
[112] | 130 | msgbox_uvmat('ERROR',errormsg); |
---|
[45] | 131 | end |
---|
[71] | 132 | % patch_newBin=''; |
---|
| 133 | test_batch=0;%default: ,no batch mode available |
---|
| 134 | if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode') |
---|
| 135 | test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod |
---|
[2] | 136 | end |
---|
| 137 | if test_batch==0 |
---|
[84] | 138 | set(handles.BATCH,'Enable','off')% put the BATCH button in grey (unactivated) |
---|
[2] | 139 | set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated) |
---|
| 140 | end |
---|
[94] | 141 | if isfield(sparam.RunParam,'CivBin') |
---|
| 142 | if ~exist(sparam.RunParam.CivBin,'file') |
---|
[112] | 143 | sparam.RunParam.CivBin=fullfile(path_UVMAT,sparam.RunParam.CivBin); |
---|
[94] | 144 | end |
---|
[97] | 145 | else |
---|
| 146 | sparam.RunParam.CivBin=''; |
---|
[94] | 147 | end |
---|
[96] | 148 | patch_newBin=exist(sparam.RunParam.CivBin,'file'); |
---|
[2] | 149 | set(handles.subdir_civ1,'String',subdir)%default subdir on which uvmat was working |
---|
| 150 | set(handles.subdir_civ2,'String',subdir)%default subdir on which uvmat was working |
---|
| 151 | |
---|
| 152 | %initiate advised operations |
---|
| 153 | if isequal(ind_opening,[]) |
---|
| 154 | ind_opening=1; % default |
---|
| 155 | end |
---|
| 156 | % set default operation options |
---|
[112] | 157 | enable_civ1(handles,'off') |
---|
| 158 | enable_civ2(handles,'off') |
---|
| 159 | enable_pair1(handles,'on') |
---|
| 160 | enable_fix1(handles,'off') |
---|
| 161 | desable_patch1(handles) |
---|
| 162 | desable_fix2(handles) |
---|
| 163 | desable_patch2(handles) |
---|
| 164 | set(handles.CIV1,'Value',0) |
---|
| 165 | set(handles.FIX1,'Value',0) |
---|
| 166 | set(handles.PATCH1,'Value',0) |
---|
| 167 | set(handles.CIV2,'Value',0) |
---|
| 168 | set(handles.FIX2,'Value',0) |
---|
| 169 | set(handles.PATCH2,'Value',0) |
---|
| 170 | set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
[2] | 171 | if isequal(ind_opening,1) |
---|
| 172 | set(handles.CIV1,'Value',1) |
---|
| 173 | enable_civ1(handles,'on') |
---|
| 174 | elseif isequal(ind_opening,2) |
---|
| 175 | set(handles.FIX1,'Value',1) |
---|
| 176 | enable_fix1(handles,'on') |
---|
| 177 | elseif isequal(ind_opening,3) |
---|
| 178 | set(handles.PATCH1,'Value',1) |
---|
| 179 | enable_patch1(handles) |
---|
| 180 | elseif isequal(ind_opening,4) |
---|
| 181 | set(handles.CIV2,'Value',1) |
---|
[224] | 182 | enable_civ2(handles,'on') |
---|
[2] | 183 | elseif isequal(ind_opening,5) |
---|
| 184 | set(handles.FIX2,'Value',1) |
---|
| 185 | enable_fix2(handles) |
---|
[112] | 186 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 187 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 188 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 189 | enable_pair1(handles,'off') |
---|
[2] | 190 | elseif isequal(ind_opening,6) |
---|
| 191 | set(handles.PATCH2,'Value',1) |
---|
| 192 | enable_patch2(handles) |
---|
| 193 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 194 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 195 | enable_pair1(handles,'off') |
---|
| 196 | end |
---|
| 197 | |
---|
| 198 | % set the range of fields (1:1 by default) and selected pair |
---|
[153] | 199 | if isequal(num_i2,num_i1) |
---|
| 200 | num_ref_i=num_i1; |
---|
[2] | 201 | else |
---|
[153] | 202 | num_ref_i=floor((num_i1+num_i2)/2); |
---|
| 203 | browse.incr_pair(1)=num_i2-num_i1; |
---|
[2] | 204 | browse.incr_pair(2)=0; |
---|
| 205 | end |
---|
[153] | 206 | if isequal(num_j1,num_j2) |
---|
| 207 | if isnan(num_j1) |
---|
[2] | 208 | num_ref_j=1; |
---|
| 209 | else |
---|
[153] | 210 | num_ref_j=num_j1; |
---|
[2] | 211 | end |
---|
| 212 | else |
---|
[153] | 213 | num_ref_j=floor((num_j1+num_j2)/2); |
---|
| 214 | browse.incr_pair(2)=num_j2-num_j1; |
---|
[2] | 215 | end |
---|
| 216 | set(handles.first_i,'String',num2str(num_ref_i)); |
---|
| 217 | set(handles.last_i,'String',num2str(num_ref_i)); |
---|
| 218 | set(handles.first_j,'String',num2str(num_ref_j)); |
---|
| 219 | set(handles.last_j,'String',num2str(num_ref_j)); |
---|
| 220 | set(handles.ref_i,'String',num2str(num_ref_i)); |
---|
| 221 | set(handles.ref_j,'String',num2str(num_ref_j)); |
---|
[71] | 222 | set(handles.ref_i_civ2,'String',num2str(num_ref_i)); |
---|
| 223 | set(handles.ref_j_civ2,'String',num2str(num_ref_j)); |
---|
[2] | 224 | set(handles.browse_root,'UserData',browse); |
---|
[220] | 225 | if exist('param','var') && isfield(param,'RootName') && ~isempty(param.RootName)%varargin the interface is opened from uvmat |
---|
[112] | 226 | RootName_Callback(hObject, eventdata, handles); |
---|
[2] | 227 | end |
---|
| 228 | |
---|
[150] | 229 | % set(handles.waitbar_1,'Position',[0.946 0.877 0.03 0.001]) |
---|
| 230 | % set(handles.waitbar_patch1,'Position',[0.946 0.626 0.03 0.001]) |
---|
| 231 | % set(handles.waitbar_civ2,'Position',[0.946 0.406 0.03 0.001]) |
---|
| 232 | % set(handles.waitbar_patch2,'Position',[0.946 0.187 0.03 0.001]) |
---|
[2] | 233 | |
---|
[12] | 234 | %------------------------------------------------------------------------ |
---|
[2] | 235 | % --- Outputs from this function are returned to the command line. |
---|
| 236 | function varargout = civ_OutputFcn(hObject, eventdata, handles) |
---|
[12] | 237 | %------------------------------------------------------------------------ |
---|
[2] | 238 | % varargout cell array for returning output args (see VARARGOUT); |
---|
| 239 | % hObject handle to figure |
---|
| 240 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 241 | % handles structure with handles and user data (see GUIDATA) |
---|
| 242 | % Get default command line output from handles structure |
---|
| 243 | varargout{1} = handles.output; |
---|
| 244 | |
---|
[12] | 245 | %------------------------------------------------------------------------ |
---|
[2] | 246 | % --- Executes on button press in browse_root. |
---|
| 247 | function browse_root_Callback(hObject, eventdata, handles) |
---|
[12] | 248 | %------------------------------------------------------------------------ |
---|
[2] | 249 | %get the input file properties |
---|
[71] | 250 | filebase=get(handles.RootName,'String'); |
---|
[2] | 251 | oldfile=''; %default |
---|
[39] | 252 | if isempty(filebase)|| isequal(filebase,'')%loads the previously stored file name and set it as default in the file_input box |
---|
[112] | 253 | dir_perso=prefdir; |
---|
| 254 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
| 255 | if exist(profil_perso,'file') |
---|
| 256 | h=load (profil_perso); |
---|
| 257 | if isfield(h,'filebase')&& ischar(h.filebase) |
---|
| 258 | oldfile=h.filebase; |
---|
| 259 | end |
---|
| 260 | if isfield(h,'RootPath') && ischar(h.RootPath) |
---|
| 261 | oldfile=h.RootPath; |
---|
| 262 | end |
---|
| 263 | end |
---|
| 264 | else |
---|
| 265 | oldfile=filebase; |
---|
| 266 | end |
---|
[2] | 267 | ind_opening=1;%default |
---|
| 268 | browse.incr_pair=[0 0]; %default |
---|
[238] | 269 | menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)'; |
---|
[174] | 270 | '*.xml', '.xml files '; ... |
---|
| 271 | '*.civ', '.civ files '; ... |
---|
| 272 | '*.png','.png image files'; ... |
---|
| 273 | '*.jpg',' jpeg image files'; ... |
---|
| 274 | '*.tif','.tif image files'; ... |
---|
| 275 | '*.avi;*.AVI','.avi movie files'; ... |
---|
| 276 | '*.nc','.netcdf files'; ... |
---|
| 277 | '*.*', 'All Files (*.*)'}; |
---|
[2] | 278 | [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile); |
---|
[112] | 279 | fileinput=[PathName FileName];%complete file name |
---|
[2] | 280 | sizf=size(fileinput); |
---|
| 281 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
| 282 | [path,name,ext]=fileparts(fileinput); |
---|
| 283 | testeditxml=0; |
---|
| 284 | if isequal(ext,'.xml') |
---|
| 285 | testeditxml=1; |
---|
| 286 | t_browse=xmltree(fileinput); |
---|
| 287 | head_element=get(t_browse,1); |
---|
[45] | 288 | if isfield(head_element,'name')&& isequal(head_element.name,'ImaDoc') |
---|
[2] | 289 | testeditxml=0; |
---|
| 290 | end |
---|
| 291 | end |
---|
[45] | 292 | if testeditxml==1 || isequal(ext,'.xls') |
---|
[112] | 293 | heditxml=editxml({fileinput}); |
---|
| 294 | set(heditxml,'Tag','browser') |
---|
| 295 | waitfor(heditxml,'Tag','idle') |
---|
| 296 | if ~ishandle(heditxml) |
---|
| 297 | return |
---|
| 298 | end |
---|
| 299 | attr=findobj(get(heditxml,'children'),'Tag','CurrentAttributes'); |
---|
| 300 | set(handles.browse,'UserData',fileinput)% store for future opening with browser |
---|
| 301 | fileinput=get(attr,'UserData'); |
---|
| 302 | if ~exist(fileinput,'file') |
---|
| 303 | return |
---|
| 304 | end |
---|
[2] | 305 | end |
---|
[82] | 306 | [RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput); |
---|
[2] | 307 | filebase=fullfile(RootPath,RootFile); |
---|
[89] | 308 | num_i1=str2double(str1); |
---|
| 309 | if isnan(num_i1),num_i1=1;end |
---|
| 310 | num_i2=str2double(str2); |
---|
| 311 | if isnan(num_i2),num_i2=num_i1;end |
---|
[54] | 312 | num_j1=stra2num(str_a); |
---|
[89] | 313 | if isnan(num_j1),num_j1=1;end |
---|
[54] | 314 | num_j2=stra2num(str_b); |
---|
[112] | 315 | if isnan(num_j2),num_j2=num_j1;end |
---|
[2] | 316 | if isequal(get(handles.compare,'Value'),1) |
---|
| 317 | browse=[];%initialisation |
---|
| 318 | else |
---|
| 319 | browse=get(handles.browse_root,'UserData'); |
---|
| 320 | end |
---|
[122] | 321 | browse.num_i1=num_i1; |
---|
| 322 | browse.num_i2=num_i2; |
---|
| 323 | browse.num_j1=num_j1; |
---|
| 324 | browse.num_j2=num_j2; |
---|
| 325 | if length(ext)>1 && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat |
---|
[2] | 326 | browse.nom_type_ima=nom_type; |
---|
[122] | 327 | browse.ext_ima=ext; |
---|
[177] | 328 | set(handles.ImaExt,'String',ext) |
---|
[2] | 329 | end |
---|
| 330 | set(handles.ImaDoc,'String',ext); |
---|
| 331 | |
---|
| 332 | %%%%% read the state of the selected netcdf file to advise default operation |
---|
| 333 | if isequal(ext,'.nc') |
---|
| 334 | browse.nom_type_nc=nom_type; |
---|
[112] | 335 | ind_opening=2;% propose 'fix' as the default option |
---|
[246] | 336 | Data=nc2struct(fileinput,'ListGlobalAttribute','CivStage','absolut_time_T0','fix','patch','civ2','fix2'); |
---|
| 337 | if ~isempty(Data.CivStage)%test for civ files |
---|
| 338 | ind_opening=Data.CivStage; |
---|
[257] | 339 | set(handles.CivMode,'Value',3) |
---|
[246] | 340 | end |
---|
| 341 | if ~isempty(Data.absolut_time_T0)%test for civx files |
---|
[257] | 342 | set(handles.CivMode,'Value',1) |
---|
[2] | 343 | if isfield(Data,'fix') && isequal(Data.fix,1) |
---|
| 344 | ind_opening=3; |
---|
| 345 | end |
---|
[246] | 346 | if isequal(Data.patch,1) |
---|
[2] | 347 | ind_opening=4; |
---|
| 348 | end |
---|
[246] | 349 | if isequal(Data.civ2,1) |
---|
[2] | 350 | ind_opening=5; |
---|
| 351 | end |
---|
[246] | 352 | if isequal(Data.fix2,1) |
---|
[2] | 353 | ind_opening=6; |
---|
| 354 | end |
---|
| 355 | testciv=1; %TO SUPPRESS WITH NEW VERSION OF CIVX |
---|
| 356 | else |
---|
[112] | 357 | ind_opening=3; %GUI used only for patch |
---|
[2] | 358 | testciv=0; |
---|
| 359 | end |
---|
| 360 | set(handles.subdir_civ1,'String',subdir);%set the default subdir directories for installing the .nc results |
---|
| 361 | set(handles.subdir_civ2,'String',subdir); |
---|
| 362 | browse.testciv=testciv; |
---|
| 363 | browse.ind_opening=ind_opening; |
---|
| 364 | end |
---|
[71] | 365 | set(handles.RootName,'String',filebase); |
---|
[2] | 366 | set(handles.ImaDoc,'String',ext); |
---|
[45] | 367 | if ~isempty(num_i1) |
---|
[82] | 368 | ref_i=num_i1; |
---|
[45] | 369 | if ~isempty(num_i2) |
---|
| 370 | ref_i=floor((ref_i+num_i2)/2);% reference image number corresponding to the file |
---|
| 371 | browse.incr_pair(1)=num_i2-num_i1; |
---|
[2] | 372 | browse.incr_pair(2)=0; |
---|
| 373 | end |
---|
| 374 | set(handles.first_i,'String',num2str(ref_i)); |
---|
| 375 | set(handles.last_i,'String',num2str(ref_i)); |
---|
[71] | 376 | set(handles.ref_i,'String',num2str(ref_i)); |
---|
| 377 | set(handles.ref_i_civ2,'String',num2str(ref_i)) |
---|
[2] | 378 | end |
---|
[45] | 379 | if isempty(num_j1) |
---|
[2] | 380 | set(handles.ref_j,'String','1'); |
---|
[71] | 381 | set(handles.ref_j_civ2,'String','1'); |
---|
[2] | 382 | else |
---|
[45] | 383 | ref_j=num_j1; |
---|
| 384 | if ~isempty(num_j2) |
---|
| 385 | ref_j=floor((num_j1+num_j2)/2); |
---|
[112] | 386 | browse.incr_pair(2)=num_j2-num_j1; |
---|
[2] | 387 | end |
---|
| 388 | set(handles.first_j,'String',num2str(ref_j)); |
---|
| 389 | set(handles.last_j,'String',num2str(ref_j)); |
---|
[112] | 390 | set(handles.ref_j,'String',num2str(ref_j)); |
---|
[71] | 391 | set(handles.ref_j_civ2,'String',num2str(ref_j)); |
---|
[2] | 392 | end |
---|
| 393 | |
---|
| 394 | % set default operation options |
---|
| 395 | enable_civ1(handles,'off') |
---|
| 396 | enable_civ2(handles,'off') |
---|
| 397 | enable_pair1(handles,'on') |
---|
| 398 | enable_fix1(handles,'off') |
---|
| 399 | desable_patch1(handles) |
---|
| 400 | desable_fix2(handles) |
---|
| 401 | desable_patch2(handles) |
---|
| 402 | set(handles.CIV1,'Value',0) |
---|
| 403 | set(handles.FIX1,'Value',0) |
---|
| 404 | set(handles.PATCH1,'Value',0) |
---|
| 405 | set(handles.CIV2,'Value',0) |
---|
| 406 | set(handles.FIX2,'Value',0) |
---|
| 407 | set(handles.PATCH2,'Value',0) |
---|
| 408 | set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 409 | if isequal(ind_opening,1) |
---|
| 410 | set(handles.CIV1,'Value',1) |
---|
| 411 | enable_civ1(handles,'on') |
---|
| 412 | elseif isequal(ind_opening,2) |
---|
| 413 | set(handles.FIX1,'Value',1) |
---|
| 414 | enable_fix1(handles,'on') |
---|
| 415 | elseif isequal(ind_opening,3) |
---|
| 416 | set(handles.PATCH1,'Value',1) |
---|
| 417 | enable_patch1(handles) |
---|
| 418 | elseif isequal(ind_opening,4) |
---|
| 419 | set(handles.CIV2,'Value',1) |
---|
[224] | 420 | enable_civ2(handles,'on') |
---|
[2] | 421 | elseif isequal(ind_opening,5) |
---|
| 422 | enable_pair1(handles,'off') |
---|
| 423 | set(handles.FIX2,'Value',1) |
---|
| 424 | enable_fix2(handles) |
---|
[112] | 425 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 426 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 427 | set(handles.list_pair_civ2,'Enable','On') |
---|
[2] | 428 | elseif isequal(ind_opening,6) |
---|
| 429 | enable_pair1(handles,'off') |
---|
| 430 | set(handles.PATCH2,'Value',1) |
---|
| 431 | enable_patch2(handles) |
---|
| 432 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 433 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 434 | end |
---|
| 435 | set(handles.browse_root,'UserData',browse);% store information from browser |
---|
| 436 | |
---|
[71] | 437 | RootName_Callback(hObject, eventdata, handles); |
---|
[2] | 438 | |
---|
[12] | 439 | %------------------------------------------------------------------------ |
---|
[2] | 440 | function ImaDoc_Callback(hObject, eventdata, handles) |
---|
[12] | 441 | %------------------------------------------------------------------------ |
---|
[71] | 442 | RootName_Callback(hObject, eventdata, handles) |
---|
[2] | 443 | |
---|
[12] | 444 | %------------------------------------------------------------------------ |
---|
[54] | 445 | % --- function activated when a new filebase (image series) is introduced |
---|
[71] | 446 | function RootName_Callback(hObject, eventdata, handles) |
---|
[12] | 447 | %------------------------------------------------------------------------ |
---|
[2] | 448 | set(handles.compare,'Visible','on') |
---|
[122] | 449 | ext_ima='';%default |
---|
[2] | 450 | nom_type_ima=[];%default |
---|
| 451 | field_count=1;%default |
---|
| 452 | nom_type_nc=[]; |
---|
| 453 | time=[]; |
---|
[71] | 454 | TimeUnit='frame'; %default |
---|
| 455 | CoordUnit='px';%default |
---|
[2] | 456 | pxcmx_search=[];%default |
---|
| 457 | pxcmy_search=[];%default |
---|
[71] | 458 | filebase=get(handles.RootName,'String'); |
---|
[128] | 459 | ext_imadoc=get(handles.ImaDoc,'String'); |
---|
[135] | 460 | browse=get(handles.browse_root,'UserData');%default |
---|
[122] | 461 | if isfield(browse,'nom_type_ima') |
---|
| 462 | nom_type_ima=browse.nom_type_ima;% get an image nomenclature type already determined by an input image name |
---|
[133] | 463 | end |
---|
| 464 | if isfield(browse,'ext_ima') |
---|
[122] | 465 | ext_ima=browse.ext_ima; |
---|
[2] | 466 | end |
---|
[122] | 467 | if isfield(browse,'nom_type_nc') |
---|
| 468 | nom_type_nc=browse.nom_type_nc;% get an image nomenclature type already determined by an input image name |
---|
| 469 | end |
---|
| 470 | if isfield(browse,'num_i1') |
---|
| 471 | field_count=browse.num_i1;% get an image index type already determined by an input file |
---|
| 472 | end |
---|
[252] | 473 | set(handles.civ,'UserData',[]); %refresh list of previous civ files (for STATUS) |
---|
[2] | 474 | |
---|
| 475 | %default first_i and j and increments |
---|
[137] | 476 | first_i=str2double(get(handles.first_i,'String'));%value possibly set by uvmat_Opening |
---|
| 477 | if isnan(first_i)|| first_i < 1 |
---|
[2] | 478 | first_i=1; %default first_i |
---|
| 479 | end |
---|
[137] | 480 | last_i=str2double(get(handles.last_i,'String')); |
---|
| 481 | if isnan(last_i)|| last_i < first_i |
---|
[2] | 482 | last_i=first_i; %default last_i |
---|
| 483 | end |
---|
[137] | 484 | first_j=str2double(get(handles.first_j,'String')); |
---|
| 485 | if isnan(first_j)|| first_j < 1 |
---|
[2] | 486 | first_j=1; %default first_j |
---|
| 487 | end |
---|
[137] | 488 | last_j=str2double(get(handles.last_j,'String')); |
---|
| 489 | if isnan(last_j)|| last_j < first_j |
---|
[2] | 490 | last_j=first_j; %default last_j |
---|
| 491 | end |
---|
[137] | 492 | incr_i=str2double(get(handles.incr_i,'String')); |
---|
| 493 | if isnan(incr_i) || incr_i < 1; |
---|
[2] | 494 | set(handles.incr_i,'String','1') %default incr_i |
---|
| 495 | end |
---|
[137] | 496 | incr_j=str2double(get(handles.incr_j,'String')); |
---|
| 497 | if isnan(incr_j) || incr_j < 1; |
---|
[2] | 498 | set(handles.incr_j,'String','1') %default incr_j |
---|
| 499 | end |
---|
| 500 | dt=[];%default |
---|
| 501 | testmode=0;%default |
---|
| 502 | nbfield=[]; %default |
---|
| 503 | nburst=[];%default |
---|
| 504 | pxcmx=1; |
---|
[112] | 505 | pxcmy=1; |
---|
[2] | 506 | |
---|
[112] | 507 | %look for an image documentation file |
---|
[128] | 508 | if ~strcmp(ext_imadoc,'.xml') && ~strcmp(ext_imadoc,'.civ')&& ~strcmpi(ext_imadoc,'.avi') |
---|
[2] | 509 | if exist([filebase '.xml'],'file') |
---|
[128] | 510 | ext_imadoc='.xml'; |
---|
[2] | 511 | elseif exist([filebase '.civxml'],'file') |
---|
[128] | 512 | ext_imadoc='.civxml'; |
---|
[2] | 513 | elseif exist([filebase '.civ'],'file') |
---|
[128] | 514 | ext_imadoc='.civ'; |
---|
[112] | 515 | elseif exist([filebase '.avi'],'file') |
---|
[128] | 516 | ext_imadoc='.avi'; |
---|
[2] | 517 | elseif exist([filebase '.AVI'],'file') |
---|
[128] | 518 | ext_imadoc='.AVI'; |
---|
[2] | 519 | end |
---|
[128] | 520 | set(handles.ImaDoc,'String',ext_imadoc) |
---|
[2] | 521 | end |
---|
| 522 | |
---|
| 523 | %%%%%%%% read image documentation file %%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
[84] | 524 | mode=''; %default |
---|
| 525 | set(handles.ImaDoc,'BackgroundColor',[1 1 0]) |
---|
| 526 | drawnow |
---|
[128] | 527 | if isequal(ext_imadoc,'.civxml') || isequal(ext_imadoc,'.xml')|| isequal(ext_imadoc,'.civ') |
---|
[2] | 528 | set(handles.ref_i,'Visible','On')%use a reference index |
---|
| 529 | set(handles.ref_j,'Visible','On') |
---|
[128] | 530 | elseif isequal(ext_imadoc,'.avi') || isequal(ext_imadoc,'.AVI') |
---|
[2] | 531 | set(handles.ref_j,'Visible','Off') |
---|
| 532 | else |
---|
| 533 | set(handles.ref_i,'Visible','Off') |
---|
| 534 | set(handles.ref_j,'Visible','Off') |
---|
| 535 | end |
---|
[12] | 536 | testima_xml=0; |
---|
[128] | 537 | if isequal(ext_imadoc,'.civxml')%TO ABANDON |
---|
[122] | 538 | [nbfield,nbfield2,time]=read_civxml([filebase '.civxml']); |
---|
[2] | 539 | mode='pair j1-j2'; |
---|
| 540 | if isempty(nom_type_ima)% dtermine types by default if not already selected by browser or uvmat |
---|
[112] | 541 | nom_type_ima='_i_j'; |
---|
[2] | 542 | end |
---|
[128] | 543 | elseif isequal(ext_imadoc,'.xml') |
---|
[73] | 544 | [XmlData,warntext]=imadoc2struct([filebase '.xml']); |
---|
[2] | 545 | ext_ima_read=[]; |
---|
| 546 | nom_type_read=[]; |
---|
[12] | 547 | if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file |
---|
[2] | 548 | [PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName); |
---|
[112] | 549 | fullname=fullfile(fileparts(filebase),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file, |
---|
[45] | 550 | if ~exist(fullname,'file') |
---|
[12] | 551 | msgbox_uvmat('WARNING',['FirstImage ' fullname ' defined in the xml file does not exist']) |
---|
| 552 | end |
---|
[2] | 553 | end |
---|
[84] | 554 | if isfield(XmlData,'Time') |
---|
[85] | 555 | time=XmlData.Time; |
---|
[84] | 556 | nbfield=size(time,1); |
---|
[122] | 557 | nbfield2=size(time,2); |
---|
[127] | 558 | %transform .Time to a column vector if it is a line vector thenomenclature uses a single index: correct possible bug in xml |
---|
[122] | 559 | if isequal(nbfield,1) && ~isequal(nbfield2,1)% .Time is a line vector |
---|
[127] | 560 | if numel(nom_type_read)>=2 && isempty(regexp(nom_type_read(2:end),'\D')) |
---|
[84] | 561 | time=time'; |
---|
[122] | 562 | nbfield=nbfield2; |
---|
| 563 | nbfield2=1; |
---|
[84] | 564 | end |
---|
| 565 | end |
---|
| 566 | end |
---|
[71] | 567 | if isfield(XmlData,'TimeUnit') |
---|
| 568 | TimeUnit=XmlData.TimeUnit; |
---|
[2] | 569 | end |
---|
[71] | 570 | if isfield(XmlData,'Npx') |
---|
| 571 | npx=XmlData.Npx; |
---|
| 572 | npy=XmlData.Npy; |
---|
| 573 | end |
---|
[2] | 574 | pxcmx_search=1; |
---|
| 575 | pxcmy_search=1; |
---|
| 576 | if isfield(XmlData,'GeometryCalib') |
---|
| 577 | tsai=XmlData.GeometryCalib; |
---|
[112] | 578 | if isfield(tsai,'f') && isfield(tsai,'Tz') && isfield(tsai,'dpx') && isfield(tsai,'dpy')&& isfield(tsai,'R') |
---|
| 579 | rot2D=tsai.R(1:2,[1,2]); |
---|
| 580 | pxcmx_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpx); |
---|
| 581 | pxcmy_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpy); |
---|
[2] | 582 | end |
---|
[112] | 583 | if isfield(tsai,'CoordUnit') |
---|
| 584 | CoordUnit=tsai.CoordUnit; |
---|
[2] | 585 | end |
---|
[112] | 586 | end |
---|
[128] | 587 | elseif strcmp(ext_imadoc,'.civ')% case of .civ image documentation file |
---|
[112] | 588 | [error,time,TimeUnit,mode,npx,npy]=read_imatext([filebase '.civ']); |
---|
| 589 | if error==2, msgbox_uvmat('WARNING',['no file ' filebase '.civ']); |
---|
| 590 | elseif error==1, msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file'); |
---|
| 591 | end |
---|
[128] | 592 | nom_type_ima='001a'; |
---|
| 593 | elseif strcmpi(ext_imadoc,'.avi') |
---|
[112] | 594 | nom_type_ima='*'; |
---|
[128] | 595 | ext_ima=ext_imadoc; |
---|
[177] | 596 | set(handles.mode,'Value',1); |
---|
[112] | 597 | set(handles.mode,'String',{'series(Di)'}) |
---|
| 598 | dt=0.04;%default |
---|
[128] | 599 | if exist([filebase ext_imadoc],'file')==2 |
---|
| 600 | info=aviinfo([filebase ext_imadoc]);%read infos on the avi movie |
---|
[112] | 601 | dt=1/info.FramesPerSecond;%time interval between successive frames |
---|
| 602 | nbfield=info.NumFrames;%number of frames |
---|
| 603 | end |
---|
| 604 | time=(dt*(0:nbfield-1))';%list of image times |
---|
[2] | 605 | end |
---|
| 606 | if isempty(time) |
---|
| 607 | set(handles.ImaDoc,'String',''); %xml file not used for timing |
---|
| 608 | end |
---|
| 609 | set(handles.ImaDoc,'BackgroundColor',[1 1 1]) |
---|
| 610 | |
---|
[122] | 611 | %get the imabe nomenclature type if not defined by the input file nor by the xml file |
---|
| 612 | dirima=[];%default |
---|
[12] | 613 | if isempty(nom_type_ima) |
---|
| 614 | %look for double image series '_i_j' |
---|
| 615 | dirima=dir([filebase '_' num2str(first_i) '_' num2str(first_j) '.*']); |
---|
| 616 | if isempty(dirima) |
---|
[112] | 617 | % look for images series with sub marker '_' |
---|
| 618 | dirima=dir([filebase '_*' num2str(first_i) '.*']); |
---|
| 619 | if isempty(dirima) |
---|
| 620 | % look for other images series |
---|
| 621 | dirima=dir([filebase '*' num2str(first_i) '.*']); |
---|
[122] | 622 | if isempty(dirima) |
---|
| 623 | % look for other images series witth letter appendix |
---|
| 624 | appendix=char(96+first_j); |
---|
| 625 | dirima=dir([filebase '*' num2str(first_i) appendix '.*']); |
---|
[112] | 626 | end |
---|
| 627 | end |
---|
[12] | 628 | end |
---|
[112] | 629 | end |
---|
[122] | 630 | for ilist=1:numel(dirima) |
---|
| 631 | [pp,ff,fc,str2,str_a,str_b,ext_list,nom_type_list]=name2display(dirima(ilist).name); |
---|
| 632 | form=imformats(ext_list(2:end)); |
---|
| 633 | if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab |
---|
| 634 | ext_ima=ext_list; |
---|
| 635 | nom_type_ima=nom_type_list; |
---|
| 636 | break |
---|
| 637 | end |
---|
| 638 | end |
---|
| 639 | % no image documentation file found: look for a series of existing files,images by priority or .nc files |
---|
| 640 | if isempty(nom_type_ima) |
---|
[128] | 641 | ext_search=ext_imadoc; |
---|
[122] | 642 | nom_type_search=nom_type_nc; |
---|
| 643 | else |
---|
| 644 | ext_search=ext_ima; |
---|
| 645 | nom_type_search=nom_type_ima; |
---|
| 646 | end |
---|
| 647 | if isempty(time) && ~strcmp(nom_type_search,'none') && ~strcmp(nom_type_search,'') && ~strcmp(nom_type_search,'*') |
---|
[12] | 648 | subdir=get(handles.subdir_civ1,'String'); |
---|
| 649 | incr_pair=[0 0];%default |
---|
| 650 | if isfield(browse,'incr_pair') |
---|
[112] | 651 | incr_pair=browse.incr_pair; |
---|
[12] | 652 | end |
---|
[112] | 653 | % nbdetect=0;%test of detected images |
---|
[122] | 654 | field_i=browse.num_i2; |
---|
[153] | 655 | imagename=name_generator(filebase,field_i,1,ext_search,nom_type_search); |
---|
| 656 | imagename_plus=''; |
---|
[12] | 657 | idetect=1; |
---|
[153] | 658 | while idetect %look for the maximum file number in the series |
---|
| 659 | imagename_plus=name_generator(filebase,field_i+1,1,ext_search,nom_type_search); |
---|
| 660 | idetect=(exist(imagename_plus,'file')==2)&& ~strcmp(imagename,imagename_plus); |
---|
[81] | 661 | if idetect |
---|
[12] | 662 | field_i=field_i+1; |
---|
[81] | 663 | end |
---|
[112] | 664 | %SEE CASE OF NETCDF FILES |
---|
| 665 | % nbdetect=nbdetect+(exist(imagename,'file')==2); |
---|
[12] | 666 | end |
---|
[122] | 667 | nbfield=field_i;% last detected field number |
---|
| 668 | field_i=browse.num_i1;%look for the minimum file number in the series |
---|
[153] | 669 | imagename_min=''; |
---|
[12] | 670 | idetect=1; |
---|
[112] | 671 | while idetect==1 |
---|
[153] | 672 | imagename_min=name_generator(filebase,field_i-1,1,ext_search,nom_type_search); |
---|
| 673 | idetect=(exist(imagename_min,'file')==2)&& ~strcmp(imagename,imagename_min); |
---|
[81] | 674 | if idetect |
---|
[112] | 675 | field_i=field_i-1; |
---|
[81] | 676 | end |
---|
[12] | 677 | end |
---|
[122] | 678 | first_i=max(field_i,1); |
---|
| 679 | if numel(regexp(nom_type_search,'\D'))>=1%two indices i and j |
---|
| 680 | field_i=browse.num_i1; |
---|
| 681 | field_j=browse.num_j2; |
---|
[177] | 682 | imagename=name_generator(filebase,field_i,field_j,ext_search,nom_type_search); |
---|
[153] | 683 | imagename_plus=''; |
---|
[89] | 684 | jdetect=1; |
---|
| 685 | while jdetect==1 %look for the maximum file number in the series |
---|
[153] | 686 | imagename_plus=name_generator(filebase,field_i,field_j+1,ext_search,nom_type_search); |
---|
| 687 | jdetect=(exist(imagename_plus,'file')==2)&& ~strcmp(imagename,imagename_plus); |
---|
[89] | 688 | if jdetect |
---|
| 689 | field_j=field_j+1; |
---|
| 690 | end |
---|
| 691 | %SEE CASE OF NETCDF FILES |
---|
| 692 | % nbdetect=nbdetect+(exist(imagename,'file')==2); |
---|
| 693 | end |
---|
[122] | 694 | nbfield2=field_j;% last detected field number |
---|
[120] | 695 | end |
---|
[122] | 696 | |
---|
[89] | 697 | %determine the set of times and possible intervals for CIV |
---|
[137] | 698 | % dt=(1/1000)*str2double(get(handles.dt,'String')); |
---|
[122] | 699 | time=(0:nbfield-1)';% time=file index -1 by default |
---|
| 700 | if numel(regexp(nom_type_search,'\D'))>=1%two indices i and j |
---|
| 701 | [x,y]=meshgrid(0:nbfield2-1,0:nbfield-1); |
---|
[120] | 702 | time=x+y; |
---|
[89] | 703 | end |
---|
[2] | 704 | end |
---|
[120] | 705 | |
---|
[2] | 706 | if exist('time','var') |
---|
| 707 | if size(time,1)+size(time,2)>=3 % if there are at least two time values to define dt |
---|
| 708 | nbfield=size(time,1); |
---|
| 709 | nbfield2=size(time,2); |
---|
[71] | 710 | set(handles.RootName,'UserData',time); %store the set of times |
---|
| 711 | set(handles.dt_unit,'String',['dt in m' TimeUnit]); |
---|
| 712 | set(handles.dt_unit_civ2,'String',['dt in m' TimeUnit]); |
---|
| 713 | set(handles.TimeUnit,'String',TimeUnit); |
---|
[2] | 714 | set(handles.nb_field,'String',num2str(nbfield)); |
---|
| 715 | set(handles.nb_field2,'String',num2str(nbfield2)); |
---|
| 716 | end |
---|
| 717 | end |
---|
[71] | 718 | set(handles.CoordUnit,'String',CoordUnit) |
---|
[2] | 719 | set(handles.calcul_search,'UserData',[pxcmx_search pxcmy_search]); |
---|
| 720 | % npxy=[npy npx]; |
---|
[71] | 721 | set(handles.ImaExt,'String',ext_ima) |
---|
[2] | 722 | set(handles.first_i,'String',num2str(first_i)); |
---|
| 723 | set(handles.last_i,'String',num2str(last_i));% |
---|
| 724 | set(handles.first_j,'String',num2str(first_j)); |
---|
| 725 | set(handles.last_j,'String',num2str(last_j));% |
---|
| 726 | browse.nom_type_ima=nom_type_ima; |
---|
| 727 | set(handles.browse_root,'UserData',browse)% store the nomenclature type |
---|
| 728 | |
---|
[112] | 729 | %%%%%%%%%%% set the menus of image pairs and default selection for civ %%%%%%%%%%%%%%%%%%% |
---|
[177] | 730 | test_ima_i=numel(nom_type_ima)>1 && isempty(regexp(nom_type_ima(2:end),'\D','once'));%images with single indexing |
---|
[122] | 731 | if test_ima_i || isequal(nom_type_nc,'_i1-i2')||~(exist('nbfield2','var')&&(nbfield2~=1)) |
---|
[2] | 732 | set(handles.mode,'Value',1) |
---|
[177] | 733 | set(handles.mode,'String',{'series(Di)'}) |
---|
[2] | 734 | elseif (nbfield==1)% simple series in j |
---|
[177] | 735 | set(handles.mode,'Value',1) |
---|
[2] | 736 | set(handles.mode,'String',{'series(Dj)'}) |
---|
| 737 | else |
---|
| 738 | set(handles.mode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice |
---|
[122] | 739 | if nbfield2 <= 10 |
---|
[112] | 740 | set(handles.mode,'Value',1)% advice 'pair j1-j2' for small burst |
---|
[2] | 741 | end |
---|
| 742 | end |
---|
| 743 | |
---|
[112] | 744 | %update the subdir |
---|
[2] | 745 | pathdir=fileparts(filebase);%path to the current xml file |
---|
| 746 | listot=dir(pathdir); |
---|
| 747 | idir=0; |
---|
| 748 | listdir={''};%default |
---|
| 749 | for ilist=1:length(listot) |
---|
| 750 | if listot(ilist).isdir |
---|
| 751 | name=listot(ilist).name; |
---|
| 752 | if ~isequal(name,'.') && ~isequal(name,'..') |
---|
| 753 | idir=idir+1; |
---|
| 754 | listdir{idir,1}=listot(ilist).name; |
---|
| 755 | end |
---|
| 756 | end |
---|
| 757 | end |
---|
[112] | 758 | set(handles.list_subdir_civ1,'Value',1) |
---|
[2] | 759 | set(handles.list_subdir_civ2,'Value',1) |
---|
[107] | 760 | set(handles.list_subdir_civ1,'String',[{'browse...'};listdir]) |
---|
| 761 | set(handles.list_subdir_civ2,'String',[{'browse...'};listdir]) |
---|
[2] | 762 | %check wether the current subdir exists: |
---|
| 763 | subdir_civ1=get(handles.subdir_civ1,'String'); |
---|
| 764 | subdir_civ2=get(handles.subdir_civ2,'String'); |
---|
| 765 | |
---|
[112] | 766 | mode_Callback(hObject, eventdata, handles) |
---|
[2] | 767 | |
---|
[177] | 768 | %% desable status and RUN button |
---|
[150] | 769 | % set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001]) |
---|
| 770 | % set(handles.waitbar_patch1,'Position',[0.946 0.439 0.03 0.001]) |
---|
| 771 | % set(handles.waitbar_civ2,'Position',[0.946 0.219 0.03 0.001]) |
---|
| 772 | % set(handles.waitbar_patch2,'Position',[0.946 0.0 0.03 0.001]) |
---|
[2] | 773 | set(handles.RUN, 'Enable','On') |
---|
| 774 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
[122] | 775 | set(handles.BATCH,'Enable','On') |
---|
| 776 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
[178] | 777 | if isfield(handles,'status') |
---|
[177] | 778 | set(handles.status,'Value',0);%suppress status display |
---|
| 779 | status_Callback(hObject, eventdata, handles) |
---|
[178] | 780 | end |
---|
[112] | 781 | |
---|
[177] | 782 | %% store the root input filename for future opening |
---|
[2] | 783 | dir_perso=prefdir; |
---|
| 784 | profil_perso=fullfile(prefdir,'uvmat_perso.mat'); |
---|
| 785 | RootPath=fileparts(filebase); |
---|
| 786 | if exist(profil_perso,'file') |
---|
| 787 | save (profil_perso,'RootPath','-append'); %store the root name for future opening of uvmat |
---|
| 788 | else |
---|
[147] | 789 | txt=ver('MATLAB'); |
---|
| 790 | Release=txt.Release; |
---|
[137] | 791 | relnumb=str2double(Release(3:4)); |
---|
[2] | 792 | if relnumb >= 14 |
---|
[112] | 793 | save (profil_perso,'RootPath','-V6'); %store the root name for future opening of uvmat |
---|
[2] | 794 | else |
---|
| 795 | save (profil_perso,'RootPath'); %store the root name for future opening of uvmat |
---|
| 796 | end |
---|
| 797 | end |
---|
| 798 | |
---|
[12] | 799 | %------------------------------------------------------------------------ |
---|
[2] | 800 | % --- Executes on button press in mode. |
---|
| 801 | function mode_Callback(hObject, eventdata, handles) |
---|
[12] | 802 | %------------------------------------------------------------------------ |
---|
[2] | 803 | browse=get(handles.browse_root,'UserData'); |
---|
| 804 | compare_list=get(handles.compare,'String'); |
---|
| 805 | val=get(handles.compare,'Value'); |
---|
| 806 | compare=compare_list{val}; |
---|
| 807 | if strcmp(compare,'displacement') |
---|
| 808 | mode='displacement'; |
---|
| 809 | else |
---|
| 810 | mode_list=get(handles.mode,'String'); |
---|
[236] | 811 | if ischar(mode_list) |
---|
| 812 | mode_list={mode_list}; |
---|
| 813 | end |
---|
[2] | 814 | mode_value=get(handles.mode,'Value'); |
---|
| 815 | mode=mode_list{mode_value}; |
---|
| 816 | end |
---|
| 817 | displ_num=[];%default |
---|
[137] | 818 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
[2] | 819 | % last_i=str2num(get(handles.last_i,'String')); |
---|
[71] | 820 | time=get(handles.RootName,'UserData'); %get the set of times |
---|
[2] | 821 | siztime=size(time); |
---|
| 822 | nbfield=siztime(1); |
---|
| 823 | nbfield2=siztime(2); |
---|
| 824 | indchosen=1; %%first pair selected by default |
---|
| 825 | if isequal(mode,'pair j1-j2')%| isequal(mode,'st_pair j1-j2') |
---|
| 826 | dt=1; |
---|
| 827 | displ=''; |
---|
| 828 | index=0; |
---|
| 829 | numlist_a=[]; |
---|
| 830 | numlist_B=[]; |
---|
| 831 | %get all the time intervals in bursts |
---|
| 832 | displ_dt=1;%default |
---|
| 833 | nbfield2=min(nbfield2,10);%limitate the number of pairs to 10x10 |
---|
| 834 | for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'pair j1-j2' mode |
---|
| 835 | for numod_b=(numod_a+1):nbfield2 |
---|
[112] | 836 | index=index+1; |
---|
| 837 | numlist_a(index)=numod_a; |
---|
| 838 | numlist_b(index)=numod_b; |
---|
| 839 | if ~isempty(time) |
---|
[54] | 840 | dt(numod_a,numod_b)=time(ref_i,numod_b)-time(ref_i,numod_a);%first time interval dt |
---|
[2] | 841 | displ_dt(index)=dt(numod_a,numod_b); |
---|
[112] | 842 | else |
---|
| 843 | displ_dt(index)=1; |
---|
| 844 | end |
---|
| 845 | end |
---|
| 846 | end |
---|
| 847 | [dtsort,indsort]=sort(displ_dt); |
---|
| 848 | if ~isempty(numlist_a) |
---|
| 849 | displ_num(1,:)=numlist_a(indsort); |
---|
| 850 | displ_num(2,:)=numlist_b(indsort); |
---|
| 851 | end |
---|
| 852 | displ_num(3,:)=0; |
---|
| 853 | displ_num(4,:)=0; |
---|
| 854 | set(handles.jtext,'Visible','Off') |
---|
[2] | 855 | set(handles.first_j,'Visible','Off') |
---|
| 856 | set(handles.last_j,'Visible','Off') |
---|
| 857 | set(handles.incr_j,'Visible','Off') |
---|
| 858 | set(handles.nb_field2,'Visible','Off') |
---|
| 859 | set(handles.ref_j,'Visible','Off') |
---|
| 860 | elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') |
---|
[112] | 861 | for index=1:min(nbfield2-1,200) |
---|
| 862 | displ_num(1,index)=-floor(index/2); |
---|
| 863 | displ_num(2,index)=ceil(index/2); |
---|
| 864 | displ_num(3,index)=0; |
---|
| 865 | displ_num(4,index)=0; |
---|
| 866 | end |
---|
| 867 | set(handles.jtext,'Visible','On') |
---|
| 868 | set(handles.first_j,'Visible','On') |
---|
| 869 | set(handles.last_j,'Visible','On') |
---|
| 870 | set(handles.incr_j,'Visible','On') |
---|
| 871 | set(handles.nb_field2,'Visible','On') |
---|
| 872 | set(handles.ref_j,'Visible','On') |
---|
| 873 | if nbfield > 1 |
---|
[2] | 874 | set(handles.itext,'Visible','On') |
---|
| 875 | set(handles.first_i,'Visible','On') |
---|
| 876 | set(handles.last_i,'Visible','On') |
---|
| 877 | set(handles.incr_i,'Visible','On') |
---|
| 878 | set(handles.nb_field,'Visible','On') |
---|
| 879 | set(handles.ref_i,'Visible','On') |
---|
| 880 | else |
---|
| 881 | set(handles.itext,'Visible','Off') |
---|
| 882 | set(handles.first_i,'Visible','Off') |
---|
| 883 | set(handles.last_i,'Visible','Off') |
---|
| 884 | set(handles.incr_i,'Visible','Off') |
---|
| 885 | set(handles.nb_field,'Visible','Off') |
---|
| 886 | set(handles.ref_i,'Visible','Off') |
---|
| 887 | end |
---|
[112] | 888 | elseif isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') |
---|
| 889 | for index=1:200%min(nbfield-1,200) |
---|
| 890 | displ_num(1,index)=0; |
---|
| 891 | displ_num(2,index)=0; |
---|
| 892 | displ_num(3,index)=-floor(index/2); |
---|
| 893 | displ_num(4,index)=ceil(index/2); |
---|
| 894 | end |
---|
| 895 | set(handles.itext,'Visible','On') |
---|
| 896 | set(handles.first_i,'Visible','On') |
---|
| 897 | set(handles.last_i,'Visible','On') |
---|
| 898 | set(handles.incr_i,'Visible','On') |
---|
| 899 | set(handles.nb_field,'Visible','On') |
---|
| 900 | set(handles.ref_i,'Visible','On') |
---|
| 901 | if nbfield2 > 1 |
---|
[2] | 902 | set(handles.jtext,'Visible','On') |
---|
| 903 | set(handles.first_j,'Visible','On') |
---|
| 904 | set(handles.last_j,'Visible','On') |
---|
| 905 | set(handles.incr_j,'Visible','On') |
---|
| 906 | set(handles.nb_field2,'Visible','On') |
---|
| 907 | set(handles.ref_j,'Visible','On') |
---|
[112] | 908 | else |
---|
[2] | 909 | set(handles.jtext,'Visible','Off') |
---|
| 910 | set(handles.first_j,'Visible','Off') |
---|
| 911 | set(handles.last_j,'Visible','Off') |
---|
| 912 | set(handles.incr_j,'Visible','Off') |
---|
| 913 | set(handles.nb_field2,'Visible','Off') |
---|
| 914 | set(handles.ref_j,'Visible','Off') |
---|
| 915 | end |
---|
| 916 | elseif isequal(mode,'displacement')%the pairs have the same indices |
---|
[112] | 917 | displ_num(1,1)=0; |
---|
| 918 | displ_num(2,1)=0; |
---|
| 919 | displ_num(3,1)=0; |
---|
| 920 | displ_num(4,1)=0; |
---|
| 921 | if nbfield > 1 |
---|
[2] | 922 | set(handles.itext,'Visible','On') |
---|
| 923 | set(handles.first_i,'Visible','On') |
---|
| 924 | set(handles.last_i,'Visible','On') |
---|
| 925 | set(handles.incr_i,'Visible','On') |
---|
| 926 | set(handles.nb_field,'Visible','On') |
---|
| 927 | set(handles.ref_i,'Visible','On') |
---|
| 928 | else |
---|
| 929 | set(handles.itext,'Visible','Off') |
---|
| 930 | set(handles.first_i,'Visible','Off') |
---|
| 931 | set(handles.last_i,'Visible','Off') |
---|
| 932 | set(handles.incr_i,'Visible','Off') |
---|
| 933 | set(handles.nb_field,'Visible','Off') |
---|
| 934 | set(handles.ref_i,'Visible','Off') |
---|
| 935 | end |
---|
| 936 | if nbfield2 > 1 |
---|
[112] | 937 | set(handles.jtext,'Visible','On') |
---|
| 938 | set(handles.first_j,'Visible','On') |
---|
| 939 | set(handles.last_j,'Visible','On') |
---|
| 940 | set(handles.incr_j,'Visible','On') |
---|
| 941 | set(handles.nb_field2,'Visible','On') |
---|
| 942 | set(handles.ref_j,'Visible','On') |
---|
[2] | 943 | else |
---|
| 944 | set(handles.jtext,'Visible','Off') |
---|
| 945 | set(handles.first_j,'Visible','Off') |
---|
| 946 | set(handles.last_j,'Visible','Off') |
---|
| 947 | set(handles.incr_j,'Visible','Off') |
---|
| 948 | set(handles.nb_field2,'Visible','Off') |
---|
| 949 | set(handles.ref_j,'Visible','Off') |
---|
| 950 | end |
---|
[112] | 951 | end |
---|
[2] | 952 | set(handles.list_pair_civ1,'UserData',displ_num); |
---|
| 953 | find_netcpair_civ1(hObject, eventdata, handles) |
---|
| 954 | find_netcpair_civ2(hObject, eventdata, handles) |
---|
| 955 | |
---|
[12] | 956 | %------------------------------------------------------------------------ |
---|
[2] | 957 | % determine the menu for civ1 pairs depending on existing netcdf file at the middle of |
---|
| 958 | % the field series set by first_i, incr, last_i |
---|
| 959 | function find_netcpair_civ1(hObject, eventdata, handles) |
---|
[12] | 960 | %------------------------------------------------------------------------ |
---|
[2] | 961 | set(gcf,'Pointer','watch') |
---|
| 962 | %nomenclature types |
---|
[71] | 963 | filebase=get(handles.RootName,'String'); |
---|
[2] | 964 | [filepath,Nme,ext_dir]=fileparts(filebase); |
---|
| 965 | browse=get(handles.browse_root,'UserData'); |
---|
| 966 | compare_list=get(handles.compare,'String'); |
---|
| 967 | val=get(handles.compare,'Value'); |
---|
| 968 | compare=compare_list{val}; |
---|
| 969 | if strcmp(compare,'displacement') |
---|
| 970 | mode='displacement'; |
---|
| 971 | else |
---|
| 972 | mode_list=get(handles.mode,'String'); |
---|
| 973 | mode_value=get(handles.mode,'Value'); |
---|
| 974 | mode=mode_list{mode_value}; |
---|
| 975 | end |
---|
| 976 | |
---|
| 977 | % nomenclature type of the .nc files |
---|
| 978 | nom_type_ima=[];%default |
---|
| 979 | if isfield(browse,'nom_type_ima') |
---|
| 980 | nom_type_ima=browse.nom_type_ima; |
---|
| 981 | end |
---|
| 982 | |
---|
[112] | 983 | %determine nom_type_nc: |
---|
[2] | 984 | nom_type_nc=[];%default |
---|
| 985 | if isfield(browse,'nom_type_nc') |
---|
| 986 | nom_type_nc=browse.nom_type_nc; |
---|
| 987 | end |
---|
| 988 | if isempty(nom_type_nc) |
---|
[112] | 989 | [nom_type_nc]=nomtype2pair(nom_type_ima,isequal(mode,'series(Di)'),isequal(mode,'series(Dj)')); |
---|
[2] | 990 | end |
---|
| 991 | browse.nom_type_nc=nom_type_nc; |
---|
| 992 | set(handles.browse_root,'UserData',browse) |
---|
| 993 | |
---|
| 994 | %reads .nc subdirectoy and image numbers from the interface |
---|
| 995 | subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf data |
---|
[45] | 996 | % first_i=str2num(get(handles.first_i,'String')); |
---|
| 997 | % last_i=str2num(get(handles.last_i,'String')); |
---|
| 998 | % incr=str2num(get(handles.incr_i,'String')); |
---|
| 999 | % num1=first_i:incr:last_i; |
---|
| 1000 | % if isempty(num1) |
---|
| 1001 | % set(handles.list_pair_civ1,'String',{''}); |
---|
| 1002 | % return |
---|
| 1003 | % end |
---|
| 1004 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
[2] | 1005 | if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') |
---|
| 1006 | ref_j=0; |
---|
| 1007 | else |
---|
[45] | 1008 | ref_j=str2double(get(handles.ref_j,'String')); |
---|
[2] | 1009 | end |
---|
[71] | 1010 | time=get(handles.RootName,'UserData');%get the set of times |
---|
[2] | 1011 | if isempty(time) |
---|
| 1012 | time=[0 1]; |
---|
[112] | 1013 | end |
---|
[71] | 1014 | %dt_unit=str2double(get(handles.dt,'String'));% used when there is no image documentation file |
---|
| 1015 | dt_unit=1000;%default |
---|
[2] | 1016 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
| 1017 | |
---|
[112] | 1018 | %eliminate the first pairs inconsistent with the position |
---|
| 1019 | if isempty(displ_num) |
---|
| 1020 | nbpair=0; |
---|
| 1021 | else |
---|
[2] | 1022 | nbpair=length(displ_num(1,:));%nbre of displayed pairs |
---|
| 1023 | if isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') |
---|
| 1024 | nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index |
---|
| 1025 | elseif isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') |
---|
| 1026 | nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index |
---|
| 1027 | end |
---|
[112] | 1028 | end |
---|
[2] | 1029 | nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 |
---|
| 1030 | |
---|
[112] | 1031 | %look for existing processed pairs involving the field at the middle of the series if civ1 will not |
---|
[2] | 1032 | % be performed, while the result is needed for next steps. |
---|
| 1033 | displ_pair={''}; |
---|
| 1034 | select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs |
---|
| 1035 | testpair=0; |
---|
| 1036 | if get(handles.CIV1,'Value')==0 % |
---|
[112] | 1037 | if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir') |
---|
| 1038 | msgbox_uvmat('ERROR',['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist']); |
---|
| 1039 | set(handles.list_pair_civ1,'String',{}); |
---|
| 1040 | return |
---|
[2] | 1041 | end |
---|
[112] | 1042 | for ipair=1:nbpair |
---|
[2] | 1043 | filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... |
---|
[112] | 1044 | ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); |
---|
[2] | 1045 | select(ipair)=exist(filename,'file')==2; |
---|
| 1046 | end |
---|
| 1047 | if ~exist('select','var') || isequal(select,zeros(size(1:nbpair))) |
---|
[112] | 1048 | if isfield(browse,'incr_pair') |
---|
[2] | 1049 | num_i1=ref_i-floor(browse.incr_pair(1)/2); |
---|
| 1050 | num_i2=ref_i+ceil(browse.incr_pair(1)/2); |
---|
| 1051 | num_j1=ref_j-floor(browse.incr_pair(2)/2); |
---|
| 1052 | num_j2=ref_j+ceil(browse.incr_pair(2)/2); |
---|
| 1053 | filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ1); |
---|
| 1054 | select(1)=exist(filename,'file')==2; |
---|
| 1055 | testpair=1; |
---|
| 1056 | else |
---|
[112] | 1057 | if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') |
---|
[2] | 1058 | msgbox_uvmat('ERROR',['no civ1 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ1]); |
---|
| 1059 | else |
---|
| 1060 | msgbox_uvmat('ERROR',['no civ1 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ1]); |
---|
| 1061 | end |
---|
[112] | 1062 | set(handles.list_pair_civ1,'String',{''}); |
---|
| 1063 | %COMPLETER CAS STEREO |
---|
[2] | 1064 | return |
---|
| 1065 | end |
---|
| 1066 | end |
---|
| 1067 | end |
---|
| 1068 | if isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') |
---|
| 1069 | if testpair |
---|
[73] | 1070 | displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; |
---|
| 1071 | % elseif ~isequal(get(handles.root_txt,'String'),'dt(ms)=') |
---|
| 1072 | % for ipair=1:nbpair |
---|
| 1073 | % if select(ipair) |
---|
| 1074 | % if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
| 1075 | % 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 |
---|
| 1076 | % displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
| 1077 | % end |
---|
| 1078 | % else |
---|
| 1079 | % displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1080 | % end |
---|
| 1081 | % end |
---|
[2] | 1082 | else |
---|
[73] | 1083 | for ipair=1:nbpair |
---|
| 1084 | if select(ipair) |
---|
| 1085 | if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
| 1086 | 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 |
---|
| 1087 | displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
| 1088 | else |
---|
| 1089 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1090 | end |
---|
| 1091 | end |
---|
| 1092 | end |
---|
[2] | 1093 | end |
---|
| 1094 | elseif isequal(mode,'series(Dj)')%|isequal(mode,'st_series(Dj)')% series on the j index |
---|
| 1095 | if testpair |
---|
[112] | 1096 | displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; |
---|
[2] | 1097 | else |
---|
[112] | 1098 | for ipair=1:nbpair |
---|
| 1099 | if select(ipair) |
---|
| 1100 | if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
| 1101 | 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 |
---|
| 1102 | displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
| 1103 | end |
---|
| 1104 | elseif testpair |
---|
| 1105 | displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(2)/2)) '|' num2str(ceil(browse.incr_pair(2)/2))]; |
---|
| 1106 | else |
---|
| 1107 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1108 | end |
---|
| 1109 | end |
---|
| 1110 | end |
---|
[2] | 1111 | elseif isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')%case of pairs |
---|
| 1112 | for ipair=1:nbpair |
---|
| 1113 | if select(ipair) |
---|
[112] | 1114 | 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 |
---|
| 1115 | displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair),nom_type_ima) '-' num2stra(displ_num(2,ipair),nom_type_ima) ... |
---|
| 1116 | ' :dt= ' num2str(dt*1000)]; |
---|
| 1117 | else |
---|
| 1118 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1119 | end |
---|
| 1120 | end |
---|
[2] | 1121 | elseif isequal(mode,'displacement') |
---|
[112] | 1122 | displ_pair={'Di=Dj=0'}; |
---|
| 1123 | end |
---|
[2] | 1124 | set(handles.list_pair_civ1,'String',displ_pair'); |
---|
[229] | 1125 | ichoice=find(select,1); |
---|
[45] | 1126 | if (isempty(ichoice) || ichoice < 1); ichoice=1; end; |
---|
| 1127 | initial=get(handles.list_pair_civ1,'Value');%initial choice of pair |
---|
[112] | 1128 | if initial>nbpair |
---|
| 1129 | set(handles.list_pair_civ1,'Value',ichoice);% first valid pair proposed by default in the menu |
---|
[45] | 1130 | end |
---|
| 1131 | if numel(select)>=initial && ~isequal(select(initial),1) |
---|
[2] | 1132 | set(handles.list_pair_civ1,'Value',ichoice);% first valid pair proposed by default in the menu |
---|
| 1133 | end |
---|
[45] | 1134 | |
---|
[2] | 1135 | %set(handles.list_pair_civ2,'String',displ_pair'); |
---|
| 1136 | initial=get(handles.list_pair_civ2,'Value'); |
---|
| 1137 | if initial>length(displ_pair')%|~isequal(select(initial),1) |
---|
| 1138 | if ichoice <= length(displ_pair') |
---|
| 1139 | set(handles.list_pair_civ2,'Value',ichoice);% same pair proposed by default for civ2 |
---|
| 1140 | else |
---|
| 1141 | set(handles.list_pair_civ2,'Value',1);% same pair proposed by default for civ2 |
---|
| 1142 | end |
---|
| 1143 | end |
---|
| 1144 | set(handles.list_pair_civ2,'String',displ_pair'); |
---|
| 1145 | set(gcf,'Pointer','arrow') |
---|
[12] | 1146 | |
---|
| 1147 | %------------------------------------------------------------------------ |
---|
[112] | 1148 | % determine the menu for civ2 pairs depending on the existing netcdf file at the |
---|
| 1149 | %middle of the series set by first_i, incr, last_i |
---|
[2] | 1150 | function find_netcpair_civ2(hObject, eventdata, handles) |
---|
[12] | 1151 | %------------------------------------------------------------------------ |
---|
[2] | 1152 | set(gcf,'Pointer','watch') |
---|
| 1153 | %nomenclature types |
---|
[71] | 1154 | filebase=get(handles.RootName,'String'); |
---|
[2] | 1155 | [filepath,Nme,ext_dir]=fileparts(filebase); |
---|
| 1156 | browse=get(handles.browse_root,'UserData'); |
---|
| 1157 | compare_list=get(handles.compare,'String'); |
---|
| 1158 | val=get(handles.compare,'Value'); |
---|
| 1159 | compare=compare_list{val}; |
---|
| 1160 | if strcmp(compare,'displacement') |
---|
| 1161 | mode='displacement'; |
---|
| 1162 | else |
---|
[252] | 1163 | mode_list=get(handles.mode,'String') |
---|
| 1164 | mode_value=get(handles.mode,'Value') |
---|
[2] | 1165 | mode=mode_list{mode_value}; |
---|
| 1166 | end |
---|
| 1167 | |
---|
| 1168 | % nomenclature type of the .nc files |
---|
| 1169 | nom_type_ima='ima_num';%default |
---|
| 1170 | if isfield(browse,'nom_type_ima') |
---|
| 1171 | nom_type_ima=browse.nom_type_ima; |
---|
| 1172 | end |
---|
| 1173 | nom_type_nc='_i1-i2';%default |
---|
| 1174 | if isfield(browse,'nom_type_nc') |
---|
| 1175 | nom_type_nc=browse.nom_type_nc; |
---|
| 1176 | end |
---|
[94] | 1177 | 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] | 1178 | nom_type_nc='netc_old';%nom_type for the netcdf files |
---|
[94] | 1179 | elseif isequal(nom_type_ima,'none')||isequal(nom_type_nc,'none') |
---|
[2] | 1180 | nom_type_nc='none'; |
---|
[94] | 1181 | elseif isequal(nom_type_ima,'avi')||isequal(nom_type_ima,'_i')||isequal(nom_type_ima,'ima_num')||isequal(nom_type_nc,'_i1-i2') |
---|
[112] | 1182 | nom_type_nc='_i1-i2'; |
---|
[2] | 1183 | else |
---|
| 1184 | if isequal(mode,'series(Di)')%|isequal(mode,'st_series(Di)') |
---|
| 1185 | nom_type_nc='_i1-i2_j'; % PIV in volume |
---|
| 1186 | else |
---|
| 1187 | nom_type_nc='_i_j1-j2'; |
---|
[112] | 1188 | end |
---|
[2] | 1189 | end |
---|
| 1190 | browse.nom_type_nc=nom_type_nc; |
---|
| 1191 | set(handles.browse_root,'UserData',browse) |
---|
| 1192 | |
---|
| 1193 | %reads .nc subdirectory and image numbers from the interface |
---|
| 1194 | subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf data |
---|
| 1195 | subdir_civ2=get(handles.subdir_civ2,'String');%subdirectory subdir_civ2 for the netcdf data |
---|
[45] | 1196 | % first_i=str2num(get(handles.first_i,'String')); |
---|
| 1197 | % last_i=str2num(get(handles.last_i,'String')); |
---|
| 1198 | % incr=str2num(get(handles.incr_i,'String')); |
---|
| 1199 | % num1=first_i:incr:last_i; |
---|
| 1200 | % if isempty(num1) |
---|
| 1201 | % set(handles.list_pair_civ2,'Value',1); |
---|
| 1202 | % set(handles.list_pair_civ2,'String',{''}); |
---|
| 1203 | % return |
---|
| 1204 | % end |
---|
[137] | 1205 | ref_i=str2double(get(handles.ref_i_civ2,'String')); |
---|
[2] | 1206 | if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') |
---|
| 1207 | ref_j=0; |
---|
| 1208 | else |
---|
[137] | 1209 | ref_j=str2double(get(handles.ref_j_civ2,'String')); |
---|
[2] | 1210 | end |
---|
[71] | 1211 | time=get(handles.RootName,'UserData'); %get the set of times |
---|
[2] | 1212 | if isempty(time) |
---|
| 1213 | time=[0 1];%default |
---|
| 1214 | end |
---|
[71] | 1215 | %dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file |
---|
[73] | 1216 | %dt_unit=1000; |
---|
[2] | 1217 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
| 1218 | |
---|
| 1219 | |
---|
[112] | 1220 | %eliminate the first pairs inconsistent with the position |
---|
[2] | 1221 | if isempty(displ_num) |
---|
| 1222 | nbpair=0; |
---|
| 1223 | else |
---|
| 1224 | nbpair=length(displ_num(1,:));%nbre of displayed pairs |
---|
[112] | 1225 | if isequal(mode,'series(Di)')% | isequal(mode,'st_series(Di)') |
---|
[2] | 1226 | nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index |
---|
[112] | 1227 | elseif isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') |
---|
[2] | 1228 | nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index |
---|
| 1229 | end |
---|
| 1230 | end |
---|
| 1231 | nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 |
---|
| 1232 | |
---|
[112] | 1233 | %look for existing processed pairs involving the field at the middle of the series if civ1 will not |
---|
[2] | 1234 | % be performed, while the result is needed for next steps. |
---|
| 1235 | displ_pair={''}; %default |
---|
| 1236 | select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs |
---|
| 1237 | if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0%&... |
---|
[112] | 1238 | if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir') |
---|
| 1239 | errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist']) |
---|
| 1240 | set(handles.list_pair_civ2,'Value',1); |
---|
| 1241 | set(handles.list_pair_civ2,'String',{''}); |
---|
| 1242 | return |
---|
[2] | 1243 | end |
---|
[112] | 1244 | for ipair=1:nbpair |
---|
[2] | 1245 | filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... |
---|
[112] | 1246 | ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); |
---|
[2] | 1247 | select(ipair)=exist(filename,'file')==2; |
---|
| 1248 | end |
---|
| 1249 | if isequal(select,zeros(size(1:nbpair))) |
---|
[112] | 1250 | if isfield(browse,'incr_pair') |
---|
[2] | 1251 | num_i1=ref_i-floor(browse.incr_pair(1)/2); |
---|
| 1252 | num_i2=ref_i+floor((browse.incr_pair(1)+1)/2); |
---|
| 1253 | num_j1=ref_j-floor(browse.incr_pair(2)/2); |
---|
| 1254 | num_j2=ref_j+floor((browse.incr_pair(2)+1)/2); |
---|
| 1255 | filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ2); |
---|
| 1256 | select(1)=exist(filename,'file')==2; |
---|
| 1257 | else |
---|
[112] | 1258 | if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') |
---|
[2] | 1259 | errordlg(['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2]) |
---|
| 1260 | else |
---|
| 1261 | errordlg(['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2]) |
---|
| 1262 | end |
---|
[112] | 1263 | set(handles.list_pair_civ2,'Value',1); |
---|
| 1264 | set(handles.list_pair_civ2,'String',{''}); |
---|
[2] | 1265 | return |
---|
| 1266 | end |
---|
| 1267 | end |
---|
| 1268 | end |
---|
[112] | 1269 | if isequal(mode,'series(Di)') % | isequal(mode,'st_series(Di)') |
---|
| 1270 | for ipair=1:nbpair |
---|
| 1271 | if select(ipair) |
---|
| 1272 | if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
[2] | 1273 | 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 |
---|
| 1274 | displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
[112] | 1275 | end |
---|
| 1276 | else |
---|
| 1277 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1278 | end |
---|
| 1279 | end |
---|
[2] | 1280 | elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') % series on the j index |
---|
[112] | 1281 | for ipair=1:nbpair |
---|
| 1282 | if select(ipair) |
---|
| 1283 | if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
| 1284 | 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 |
---|
| 1285 | displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
| 1286 | end |
---|
| 1287 | else |
---|
| 1288 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1289 | end |
---|
| 1290 | end |
---|
[2] | 1291 | elseif isequal(mode,'pair j1-j2')% | isequal(mode,'st_pair j1-j2') %case of pairs |
---|
| 1292 | for ipair=1:nbpair |
---|
| 1293 | if select(ipair) |
---|
[112] | 1294 | 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 |
---|
| 1295 | displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair),nom_type_ima) '-' num2stra(displ_num(2,ipair),nom_type_ima) ... |
---|
| 1296 | ' :dt= ' num2str(dt*1000)]; |
---|
| 1297 | else |
---|
| 1298 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1299 | end |
---|
| 1300 | end |
---|
[2] | 1301 | elseif isequal(mode,'displacement') |
---|
[112] | 1302 | displ_pair={'Di=Dj=0'}; |
---|
| 1303 | end |
---|
[2] | 1304 | val=get(handles.list_pair_civ2,'Value'); |
---|
[229] | 1305 | ichoice=find(select,1); |
---|
[137] | 1306 | if (isempty(ichoice) || ichoice < 1); ichoice=1; end; |
---|
| 1307 | if get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0 |
---|
[2] | 1308 | val=ichoice;% first valid pair proposed by default in the menu |
---|
| 1309 | end |
---|
| 1310 | if val>length(displ_pair') |
---|
| 1311 | set(handles.list_pair_civ2,'Value',1);% first valid pair proposed by default in the menu |
---|
| 1312 | else |
---|
| 1313 | set(handles.list_pair_civ2,'Value',val); |
---|
| 1314 | end |
---|
| 1315 | set(handles.list_pair_civ2,'String',displ_pair'); |
---|
[12] | 1316 | set(gcf,'Pointer','arrow') |
---|
[2] | 1317 | |
---|
| 1318 | |
---|
[41] | 1319 | |
---|
[227] | 1320 | |
---|
[12] | 1321 | %------------------------------------------------------------------------ |
---|
[2] | 1322 | % --- Executes on selection change in list_pair_civ1. |
---|
| 1323 | function list_pair_civ1_Callback(hObject, eventdata, handles) |
---|
[12] | 1324 | %------------------------------------------------------------------------ |
---|
[2] | 1325 | %reproduce by default the chosen pair in the civ2 menu |
---|
| 1326 | list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs |
---|
| 1327 | index_pair=get(handles.list_pair_civ1,'Value'); |
---|
| 1328 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
[137] | 1329 | % num_a=displ_num(1,index_pair); |
---|
| 1330 | % num_b=displ_num(2,index_pair); |
---|
[2] | 1331 | list_pair2=get(handles.list_pair_civ2,'String');%get the menu of image pairs |
---|
| 1332 | if index_pair<=length(list_pair2) |
---|
| 1333 | set(handles.list_pair_civ2,'Value',index_pair); |
---|
| 1334 | end |
---|
| 1335 | |
---|
[112] | 1336 | %update first_i and last_i according to the chosen image pairs |
---|
[2] | 1337 | mode_list=get(handles.mode,'String'); |
---|
| 1338 | mode_value=get(handles.mode,'Value'); |
---|
| 1339 | mode=mode_list{mode_value}; |
---|
| 1340 | if isequal(mode,'series(Di)') |
---|
[137] | 1341 | first_i=str2double(get(handles.first_i,'String')); |
---|
| 1342 | last_i=str2double(get(handles.last_i,'String')); |
---|
| 1343 | incr_i=str2double(get(handles.incr_i,'String')); |
---|
[2] | 1344 | num1=first_i:incr_i:last_i; |
---|
[137] | 1345 | lastfield=str2double(get(handles.nb_field,'String')); |
---|
| 1346 | if ~isnan(lastfield) |
---|
[229] | 1347 | test_find=(num1-floor(index_pair/2)*ones(size(num1))>0)& ... |
---|
| 1348 | (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield); |
---|
| 1349 | num1=num1(test_find); |
---|
[2] | 1350 | end |
---|
| 1351 | set(handles.first_i,'String',num2str(num1(1))); |
---|
| 1352 | set(handles.last_i,'String',num2str(num1(end))); |
---|
| 1353 | elseif isequal(mode,'series(Dj)') |
---|
[137] | 1354 | first_j=str2double(get(handles.first_j,'String')); |
---|
| 1355 | last_j=str2double(get(handles.last_j,'String')); |
---|
| 1356 | incr_j=str2double(get(handles.incr_j,'String')); |
---|
[2] | 1357 | num_j=first_j:incr_j:last_j; |
---|
[137] | 1358 | lastfield2=str2double(get(handles.nb_field2,'String')); |
---|
| 1359 | if ~isnan(lastfield2) |
---|
[229] | 1360 | test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... |
---|
| 1361 | (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2); |
---|
| 1362 | num1=num_j(test_find); |
---|
[2] | 1363 | end |
---|
| 1364 | set(handles.first_j,'String',num2str(num1(1))); |
---|
| 1365 | set(handles.last_j,'String',num2str(num1(end))); |
---|
[112] | 1366 | end |
---|
[2] | 1367 | |
---|
[12] | 1368 | %------------------------------------------------------------------------ |
---|
[2] | 1369 | % --- Executes on selection change in list_pair_civ2. |
---|
| 1370 | function list_pair_civ2_Callback(hObject, eventdata, handles) |
---|
[12] | 1371 | %------------------------------------------------------------------------ |
---|
[112] | 1372 | index_pair=get(handles.list_pair_civ2,'Value');%get the selected position index in the menu |
---|
[2] | 1373 | |
---|
[112] | 1374 | %update first_i and last_i according to the chosen image pairs |
---|
[2] | 1375 | mode_list=get(handles.mode,'String'); |
---|
| 1376 | mode_value=get(handles.mode,'Value'); |
---|
| 1377 | mode=mode_list{mode_value}; |
---|
| 1378 | if isequal(mode,'series(Di)') |
---|
[137] | 1379 | first_i=str2double(get(handles.first_i,'String')); |
---|
| 1380 | last_i=str2double(get(handles.last_i,'String')); |
---|
| 1381 | incr_i=str2double(get(handles.incr_i,'String')); |
---|
[2] | 1382 | num1=first_i:incr_i:last_i; |
---|
[137] | 1383 | lastfield=str2double(get(handles.nb_field,'String')); |
---|
| 1384 | if ~isnan(lastfield) |
---|
[229] | 1385 | test_find=(num1-floor(index_pair/2)*ones(size(num1))>0)& ... |
---|
| 1386 | (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield); |
---|
| 1387 | num1=num1(test_find); |
---|
[2] | 1388 | end |
---|
| 1389 | set(handles.first_i,'String',num2str(num1(1))); |
---|
| 1390 | set(handles.last_i,'String',num2str(num1(end))); |
---|
| 1391 | elseif isequal(mode,'series(Dj)') |
---|
[137] | 1392 | first_j=str2double(get(handles.first_j,'String')); |
---|
| 1393 | last_j=str2double(get(handles.last_j,'String')); |
---|
| 1394 | incr_j=str2double(get(handles.incr_j,'String')); |
---|
[2] | 1395 | num_j=first_j:incr_j:last_j; |
---|
[137] | 1396 | lastfield2=str2double(get(handles.nb_field2,'String')); |
---|
| 1397 | if ~isnan(lastfield2) |
---|
[229] | 1398 | test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... |
---|
| 1399 | (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2); |
---|
| 1400 | num1=num_j(test_find); |
---|
[2] | 1401 | end |
---|
| 1402 | set(handles.first_j,'String',num2str(num1(1))); |
---|
| 1403 | set(handles.last_j,'String',num2str(num1(end))); |
---|
[112] | 1404 | end |
---|
[2] | 1405 | |
---|
[177] | 1406 | %------------------------------------------------------------------------ |
---|
| 1407 | % --- Executes on button press in RUN: processing on local computer |
---|
[67] | 1408 | function RUN_Callback(hObject, eventdata, handles) |
---|
| 1409 | %------------------------------------------------------------------------ |
---|
[73] | 1410 | set(handles.RUN, 'Enable','Off') |
---|
| 1411 | set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) |
---|
[67] | 1412 | batch=0; |
---|
[229] | 1413 | errormsg=launch_jobs(hObject, eventdata, handles,batch); |
---|
[73] | 1414 | set(handles.RUN, 'Enable','On') |
---|
| 1415 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
[36] | 1416 | |
---|
[177] | 1417 | % start status callback to visualise results |
---|
[229] | 1418 | if ~isempty(errormsg) |
---|
| 1419 | display(errormsg) |
---|
| 1420 | msgbox_uvmat('ERROR',errormsg) |
---|
[257] | 1421 | elseif isfield(handles,'status') %&& ~isequal(get(handles.CivMode,'Value'),3) |
---|
[225] | 1422 | set(handles.status,'Value',1);%suppress status display |
---|
| 1423 | status_Callback(hObject, eventdata, handles) |
---|
[178] | 1424 | end |
---|
[177] | 1425 | |
---|
[12] | 1426 | %------------------------------------------------------------------------ |
---|
[2] | 1427 | % --- Executes on button press in BATCH: remote processing |
---|
| 1428 | function BATCH_Callback(hObject, eventdata, handles) |
---|
[177] | 1429 | % ----------------------------------------------------------------------- |
---|
[73] | 1430 | set(handles.BATCH, 'Enable','Off') |
---|
| 1431 | set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784]) |
---|
[67] | 1432 | batch=1; |
---|
[229] | 1433 | errormsg=launch_jobs(hObject, eventdata, handles, batch); |
---|
[73] | 1434 | set(handles.BATCH, 'Enable','On') |
---|
| 1435 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
[67] | 1436 | |
---|
[177] | 1437 | % start status callback to visualise results |
---|
[229] | 1438 | if ~isempty(errormsg) |
---|
| 1439 | display(errormsg) |
---|
| 1440 | msgbox_uvmat('ERROR',errormsg) |
---|
| 1441 | elseif isfield(handles,'status') |
---|
| 1442 | set(handles.status,'Value',1);%suppress status display |
---|
| 1443 | status_Callback(hObject, eventdata, handles) |
---|
[178] | 1444 | end |
---|
[227] | 1445 | |
---|
[67] | 1446 | %------------------------------------------------------------------------ |
---|
[133] | 1447 | % --- Lauch command called by RUN and BATCH: remote processing |
---|
[229] | 1448 | function errormsg=launch_jobs(hObject, eventdata, handles, batch) |
---|
[67] | 1449 | %----------------------------------------------------------------------- |
---|
[229] | 1450 | errormsg='';%default |
---|
[133] | 1451 | %% check the selected list of operations: |
---|
[2] | 1452 | operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'}; |
---|
| 1453 | box_test(1)=get(handles.CIV1,'Value'); |
---|
| 1454 | box_test(2)=get(handles.FIX1,'Value'); |
---|
| 1455 | box_test(3)=get(handles.PATCH1,'Value'); |
---|
| 1456 | box_test(4)=get(handles.CIV2,'Value'); |
---|
| 1457 | box_test(5)=get(handles.FIX2,'Value'); |
---|
| 1458 | box_test(6)=get(handles.PATCH2,'Value'); |
---|
[180] | 1459 | index_first=find(box_test==1,1); |
---|
| 1460 | if isempty(index_first) |
---|
[229] | 1461 | errormsg='no selected operation'; |
---|
[2] | 1462 | return |
---|
| 1463 | end |
---|
[180] | 1464 | index_last=find(box_test==1,1,'last'); |
---|
[159] | 1465 | box_used=box_test(index_first : index_last); |
---|
[2] | 1466 | [box_missing,ind_missing]=min(box_used); |
---|
[180] | 1467 | if isequal(box_missing,0); %there is a missing step in the sequence of operations |
---|
[229] | 1468 | errormsg=['missing' cell2mat(operations(ind_missing))]; |
---|
[2] | 1469 | return |
---|
| 1470 | end |
---|
| 1471 | |
---|
[177] | 1472 | %% check mask if selecetd |
---|
[2] | 1473 | if isequal(get(handles.get_mask_civ1,'Value'),1) |
---|
[12] | 1474 | maskname=get(handles.mask_civ1,'String'); |
---|
| 1475 | if ~exist(maskname,'file') |
---|
| 1476 | get_mask_civ1_Callback(hObject, eventdata, handles); |
---|
| 1477 | end |
---|
[2] | 1478 | end |
---|
| 1479 | if isequal(get(handles.get_mask_fix1,'Value'),1) |
---|
[12] | 1480 | maskname=get(handles.mask_fix1,'String'); |
---|
| 1481 | if ~exist(maskname,'file') |
---|
| 1482 | get_mask_fix1_Callback(hObject, eventdata, handles); |
---|
| 1483 | end |
---|
[2] | 1484 | end |
---|
| 1485 | if isequal(get(handles.get_mask_civ2,'Value'),1) |
---|
[12] | 1486 | maskname=get(handles.mask_civ2,'String'); |
---|
| 1487 | if ~exist(maskname,'file') |
---|
[112] | 1488 | get_mask_civ2_Callback(hObject, eventdata, handles); |
---|
[12] | 1489 | end |
---|
[2] | 1490 | end |
---|
| 1491 | if isequal(get(handles.get_mask_fix2,'Value'),1) |
---|
[12] | 1492 | maskname=get(handles.mask_fix2,'String'); |
---|
| 1493 | if ~exist(maskname,'file') |
---|
[112] | 1494 | get_mask_fix2_Callback(hObject, eventdata, handles); |
---|
[12] | 1495 | end |
---|
[2] | 1496 | end |
---|
| 1497 | |
---|
[177] | 1498 | %% reinitialise status callback |
---|
[178] | 1499 | if isfield(handles,'status') |
---|
[180] | 1500 | set(handles.status,'Value',0);%suppress status display |
---|
| 1501 | status_Callback(hObject, eventdata, handles) |
---|
[178] | 1502 | end |
---|
[133] | 1503 | |
---|
| 1504 | %% set the list of files and check them |
---|
| 1505 | display('checking the files...') |
---|
[227] | 1506 | [ref_i,ref_j,errormsg]=find_ref_indices(handles); |
---|
| 1507 | if ~isempty(errormsg) |
---|
| 1508 | return |
---|
| 1509 | end |
---|
[133] | 1510 | [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc]=... |
---|
[227] | 1511 | set_civ_filenames(handles,ref_i,ref_j,box_test); |
---|
[177] | 1512 | set(handles.civ,'UserData',filecell);%store for futur use of status callback |
---|
[137] | 1513 | if isempty(filecell)% (error message displayed in fct set_civ_filenames) |
---|
[133] | 1514 | return |
---|
| 1515 | end |
---|
| 1516 | nbfield=numel(num1_civ1); |
---|
| 1517 | nbslice=numel(num_a_civ1); |
---|
| 1518 | |
---|
[257] | 1519 | %% choose the batch or run mode |
---|
[133] | 1520 | path_UVMAT=fileparts(which('uvmat')); %path to the source directory of uvmat |
---|
[112] | 1521 | xmlfile='PARAM.xml'; |
---|
[133] | 1522 | if exist(xmlfile,'file')% search parameter xml file in the whole matlab path |
---|
[54] | 1523 | t=xmltree(xmlfile); |
---|
[67] | 1524 | s=convert(t); |
---|
[2] | 1525 | end |
---|
[127] | 1526 | test_interp=0; |
---|
| 1527 | if batch |
---|
[67] | 1528 | if isfield(s,'BatchParam') |
---|
| 1529 | sparam=s.BatchParam; |
---|
[257] | 1530 | if isfield(sparam,'BatchMode') |
---|
| 1531 | batch_mode=sparam.BatchMode; |
---|
| 1532 | if ~ismember(batch_mode,{'sge','oar'}) |
---|
| 1533 | errormsg=['batch mode ' batch_mode ' not supported by UVMAT']; |
---|
| 1534 | return |
---|
| 1535 | end |
---|
[67] | 1536 | end |
---|
| 1537 | else |
---|
[229] | 1538 | errormsg='no batch civ binaries defined in PARAM.xml'; |
---|
[67] | 1539 | return |
---|
| 1540 | end |
---|
[257] | 1541 | |
---|
| 1542 | switch batch_mode |
---|
| 1543 | case 'sge' |
---|
| 1544 | % choice of batch priority: |
---|
| 1545 | ind_answer=2; |
---|
| 1546 | [s,w]=unix('qstat -q civ.q|grep job_| wc -l'); %check the waiting list (command unix) |
---|
| 1547 | if isequal(s,0) |
---|
| 1548 | w(end)=[]; |
---|
| 1549 | str_displ={[w ' jobs in the waiting list'];... |
---|
| 1550 | '***********************';... |
---|
| 1551 | 'JOBS PRIORITY POLICY';... |
---|
| 1552 | '- urgent = less than 100 images pairs';... |
---|
| 1553 | '- normal = during the experiments';... |
---|
| 1554 | '- low = post processing';... |
---|
| 1555 | '***********************';... |
---|
| 1556 | 'Select a priority:'}; |
---|
| 1557 | ' ';... |
---|
| 1558 | str={'urgent';'normal';'low'}; |
---|
| 1559 | [ind_answer,v] = listdlg('PromptString',str_displ,... |
---|
| 1560 | 'SelectionMode','single',... |
---|
| 1561 | 'ListString',str,'ListSize',[200 100],'Name','job priority','InitialValue',3); |
---|
| 1562 | if isequal(v,0) % to handle Cancel button and figure close, |
---|
| 1563 | errormsg='job cancelled'; |
---|
| 1564 | return % a better way should be create |
---|
| 1565 | end |
---|
| 1566 | else |
---|
| 1567 | msgbox_uvmat('ERROR','sge batch system not available') |
---|
| 1568 | return |
---|
| 1569 | end |
---|
[225] | 1570 | end |
---|
[257] | 1571 | else % run |
---|
[67] | 1572 | if isfield(s,'RunParam') |
---|
| 1573 | sparam=s.RunParam; |
---|
| 1574 | else |
---|
[225] | 1575 | msgbox_uvmat('ERROR','no run civ binaries defined in PARAM.xml') |
---|
[67] | 1576 | return |
---|
| 1577 | end |
---|
[225] | 1578 | end |
---|
[238] | 1579 | |
---|
| 1580 | %% choose the civ program |
---|
[257] | 1581 | ProgList=get(handles.CivMode,'String'); |
---|
| 1582 | index=get(handles.CivMode,'Value'); |
---|
| 1583 | % CivX=isequal(ProgList{index},'CivX'); |
---|
| 1584 | % CivAll=isequal(ProgList{index},'CivAll'); |
---|
| 1585 | % CivUvmat=isequal(ProgList{index},'CivUvmat'); |
---|
| 1586 | CivMode=ProgList{index}; |
---|
| 1587 | %CivMode=isequal(get(handles.CivMode,'Value'),2); % Boolean for new civ programs |
---|
| 1588 | |
---|
| 1589 | switch CivMode |
---|
| 1590 | case 'CivAll' |
---|
| 1591 | if isfield(sparam,'CivBin') |
---|
| 1592 | CivBin=sparam.CivBin; |
---|
[260] | 1593 | if ~exist(CivBin,'file') || isempty(which(CivBin))% if path defined as relative to uvmat |
---|
[257] | 1594 | sparam.CivBin=fullfile(path_UVMAT,CivBin); |
---|
| 1595 | if ~exist(sparam.CivBin,'file') |
---|
| 1596 | msgbox_uvmat('ERROR',['CIVx binary ' CivBin ' defined in PARAM.xm does not exist']) |
---|
| 1597 | return |
---|
| 1598 | end |
---|
| 1599 | end |
---|
[112] | 1600 | end |
---|
[257] | 1601 | case 'CivX' |
---|
| 1602 | if isfield(sparam,'Civ1Bin') |
---|
| 1603 | Civ1Bin=sparam.Civ1Bin; |
---|
[260] | 1604 | if ~exist(Civ1Bin,'file')||isempty(which(Civ1Bin))% if path defined as relative to uvmat |
---|
[257] | 1605 | sparam.Civ1Bin=fullfile(path_UVMAT,Civ1Bin); |
---|
| 1606 | if ~exist(sparam.Civ1Bin,'file') |
---|
| 1607 | msgbox_uvmat('ERROR',['civ1 binary ' Civ1Bin ' defined in PARAM.xm does not exist']) |
---|
| 1608 | return |
---|
| 1609 | end |
---|
| 1610 | end |
---|
[112] | 1611 | end |
---|
[257] | 1612 | if isfield(sparam,'Civ2Bin') |
---|
| 1613 | Civ2Bin=sparam.Civ2Bin; |
---|
[260] | 1614 | if ~exist(Civ2Bin,'file')||isempty(which(Civ2Bin))% if path defined as relative to uvmat |
---|
[257] | 1615 | sparam.Civ2Bin=fullfile(path_UVMAT,Civ2Bin); |
---|
| 1616 | if ~exist(sparam.Civ2Bin,'file') |
---|
| 1617 | msgbox_uvmat('ERROR',['civ2 binary ' Civ2Bin ' defined in PARAM.xm does not exist']) |
---|
| 1618 | return |
---|
| 1619 | end |
---|
| 1620 | end |
---|
[112] | 1621 | end |
---|
[257] | 1622 | if isfield(sparam,'PatchBin') |
---|
[260] | 1623 | if ~exist(sparam.PatchBin,'file')||isempty(which(sparam.PatchBin))% if path defined as relative to uvmat |
---|
[257] | 1624 | sparam.PatchBin=fullfile(path_UVMAT,sparam.PatchBin); |
---|
| 1625 | end |
---|
| 1626 | end |
---|
| 1627 | if isfield(sparam,'FixBin') |
---|
[260] | 1628 | if ~exist(sparam.FixBin,'file')||isempty(which(sparam.FixBin))% if path defined as relative to uvmat |
---|
[257] | 1629 | sparam.FixBin=fullfile(path_UVMAT,sparam.FixBin); |
---|
| 1630 | end |
---|
| 1631 | end |
---|
| 1632 | case 'Matlab' |
---|
| 1633 | if batch |
---|
| 1634 | %% vérifier Mtlab installé sur le cluster |
---|
| 1635 | end |
---|
[225] | 1636 | end |
---|
[2] | 1637 | |
---|
| 1638 | |
---|
[225] | 1639 | |
---|
[133] | 1640 | %% get civ1 parameters: |
---|
[112] | 1641 | display('files OK, processing...') |
---|
[2] | 1642 | if box_test(1)==1 |
---|
| 1643 | par_civ1=read_param_civ1(handles,filecell.ima1.civ1{1,1}); |
---|
[112] | 1644 | end |
---|
[2] | 1645 | |
---|
[257] | 1646 | %% get fix1 parameters TODO : par_fix1=read_param_fix1(handles); |
---|
[112] | 1647 | if box_test(2)==1 |
---|
[2] | 1648 | flagindex1(1)=get(handles.vec_Fmin2, 'Value'); |
---|
| 1649 | flagindex1(2)=get(handles.vec_F3, 'Value'); |
---|
| 1650 | flagindex1(3)=get(handles.vec_F2, 'Value'); |
---|
[127] | 1651 | thresh_vecC1=str2double(get(handles.thresh_vecC,'String'));%threshold on image correlation vec_C |
---|
| 1652 | thresh_vel1=str2double(get(handles.thresh_vel,'String'));%threshold on velocity modulus |
---|
[2] | 1653 | test_mask=get(handles.get_mask_fix1,'Value'); |
---|
| 1654 | nbslice_mask=get(handles.mask_fix1,'UserData'); % get the number of slices (= number of masks) |
---|
| 1655 | %%%%%%%%%%%%%COMPLETER LE PROGRAMME FIX |
---|
[112] | 1656 | % inf_sup=get(handles.inf_sup1,'Value');80 |
---|
| 1657 | % fileref=get(handles.ref_fix1,'String'); |
---|
| 1658 | % refpath=get(handles.ref_fix1,'UserData'); |
---|
| 1659 | % fileref=fullfile(refpath,fileref); |
---|
[2] | 1660 | menu=get(handles.field_ref1,'String'); |
---|
| 1661 | index=get(handles.field_ref1,'Value'); |
---|
| 1662 | if isempty(menu) |
---|
| 1663 | fieldchoice=''; |
---|
| 1664 | else |
---|
| 1665 | fieldchoice=menu{index}; |
---|
[112] | 1666 | msgbox_uvmat('WARNING','reference field is not used presently with batch, use RUN option') |
---|
| 1667 | end |
---|
[2] | 1668 | end |
---|
[112] | 1669 | |
---|
[133] | 1670 | %% get patch1 parameters |
---|
[67] | 1671 | if box_test(3)==1 |
---|
[127] | 1672 | rho_patch1=str2double(get(handles.rho_patch1,'String')); |
---|
| 1673 | if isnan(rho_patch1) |
---|
[112] | 1674 | rho_patch1='1000'; |
---|
| 1675 | set(handles.rho_patch1,'String','1') |
---|
| 1676 | else |
---|
| 1677 | rho_patch1=num2str(1000*rho_patch1); |
---|
| 1678 | end |
---|
| 1679 | nx_patch1=get(handles.nx_patch1,'String'); |
---|
| 1680 | ny_patch1=get(handles.ny_patch1,'String'); |
---|
[127] | 1681 | if isnan(str2double(nx_patch1)) |
---|
[112] | 1682 | nx_patch1='50' ;%default |
---|
| 1683 | set(handles.nx_patch1,'String','50'); |
---|
| 1684 | end |
---|
[127] | 1685 | if isnan(str2double(ny_patch1)) |
---|
[112] | 1686 | ny_patch1='50' ;%default |
---|
| 1687 | set(handles.ny_patch1,'String','50'); |
---|
| 1688 | end |
---|
| 1689 | subdomain_patch1=get(handles.subdomain_patch1,'String'); |
---|
| 1690 | thresh_patch1=get(handles.thresh_patch1,'String'); |
---|
| 1691 | end |
---|
| 1692 | |
---|
[133] | 1693 | %% get civ2 parameters: |
---|
[2] | 1694 | if box_test(4)==1 |
---|
| 1695 | par_civ2=read_param_civ2(handles,cell2mat(filecell.ima1.civ2(1,1))); |
---|
| 1696 | end |
---|
| 1697 | |
---|
[133] | 1698 | %% get fix2 parameters |
---|
[112] | 1699 | if box_test(5)==1 |
---|
[2] | 1700 | flagindex2(1)=get(handles.vec_Fmin2_2, 'Value'); |
---|
| 1701 | flagindex2(2)=get(handles.vec_F3_2, 'Value'); |
---|
| 1702 | flagindex2(3)=get(handles.vec_F4, 'Value'); |
---|
[127] | 1703 | thresh_vec2C=str2double(get(handles.thresh_vec2C,'String'));%threshold on image correlation vec_C |
---|
| 1704 | thresh_vel2=str2double(get(handles.thresh_vel2,'String'));%threshold on velocity modulus |
---|
[2] | 1705 | test_mask=get(handles.get_mask_fix2,'Value'); |
---|
| 1706 | nbslice_mask=get(handles.mask_fix2,'UserData'); % get the number of slices (= number of masks) |
---|
[112] | 1707 | %%%%%%%%%%%%%COMPLETER LE PROGRAMME FIX AVEC REF FILE ET OPTION inf_sup=2 |
---|
| 1708 | % inf_sup=get(handles.inf_sup2,'Value'); |
---|
| 1709 | % ref=get(handles.ref_fix2,'UserData'); |
---|
| 1710 | |
---|
[2] | 1711 | %%%%%%%%%%%%%%%%%%% |
---|
| 1712 | end |
---|
| 1713 | |
---|
[133] | 1714 | %% get patch2 parameters |
---|
[2] | 1715 | if box_test(6)==1 |
---|
[127] | 1716 | rho_patch2=str2double(get(handles.rho_patch2,'String')); |
---|
| 1717 | if isnan(rho_patch2) |
---|
[2] | 1718 | rho_patch2='1000'; |
---|
| 1719 | set(handles.rho_patch2,'String','1') |
---|
| 1720 | else |
---|
| 1721 | rho_patch2=num2str(1000*rho_patch2); |
---|
| 1722 | end |
---|
| 1723 | nx_patch2=get(handles.nx_patch2,'String'); |
---|
| 1724 | ny_patch2=get(handles.ny_patch2,'String'); |
---|
[127] | 1725 | if isnan(str2double(nx_patch2)) |
---|
[2] | 1726 | nx_patch2='50' ;%default |
---|
| 1727 | set(handles.nx_patch2,'String','50'); |
---|
| 1728 | end |
---|
[127] | 1729 | if isnan(str2double(ny_patch2)) |
---|
[2] | 1730 | ny_patch2='50' ;%default |
---|
| 1731 | set(handles.ny_patch2,'String','50'); |
---|
| 1732 | end |
---|
| 1733 | subdomain_patch2=get(handles.subdomain_patch2,'String'); |
---|
| 1734 | thresh_patch2=get(handles.thresh_patch2,'String'); |
---|
| 1735 | end |
---|
| 1736 | |
---|
[133] | 1737 | %% MAIN LOOP |
---|
[71] | 1738 | time=get(handles.RootName,'UserData'); %get the set of times |
---|
[134] | 1739 | super_cmd=[]; |
---|
| 1740 | |
---|
[2] | 1741 | for ifile=1:nbfield |
---|
| 1742 | for j=1:nbslice |
---|
[257] | 1743 | % initiate system command |
---|
[112] | 1744 | i_cmd=0; |
---|
[257] | 1745 | switch CivMode |
---|
| 1746 | case 'CivX' |
---|
| 1747 | cmd=''; |
---|
| 1748 | if isunix % check: necessaire aussi en RUN? |
---|
| 1749 | cmd='#!/bin/bash \n'; |
---|
| 1750 | cmd=[cmd '#$ -cwd \n']; |
---|
| 1751 | cmd=[cmd 'hostname && date \n']; |
---|
| 1752 | cmd=[cmd 'umask 002 \n'];%allow writting access to created files for user group |
---|
| 1753 | end |
---|
| 1754 | case 'CivAll' |
---|
| 1755 | % if CivAll |
---|
| 1756 | CivAllxml=xmltree;% xml contents, all parameters |
---|
| 1757 | CivAllCmd=''; |
---|
| 1758 | CivAllxml=set(CivAllxml,1,'name','CivDoc'); |
---|
[2] | 1759 | end |
---|
[174] | 1760 | [Rootbat,Filebat]=fileparts(filecell.nc.civ1{ifile,j});%output netcdf file (without extention) |
---|
[177] | 1761 | flname=fullfile(Rootbat,Filebat); |
---|
[159] | 1762 | if batch |
---|
[174] | 1763 | filename_bat=fullfile(Rootbat,['job_' Filebat]); |
---|
[257] | 1764 | else |
---|
[177] | 1765 | filename_bat=flname; |
---|
[159] | 1766 | end |
---|
[174] | 1767 | filename_bat=[filename_bat '.bat']; |
---|
[2] | 1768 | |
---|
[112] | 1769 | %CIV1 |
---|
[2] | 1770 | if box_test(1)==1 |
---|
[41] | 1771 | par_civ1.filename_ima_a=filecell.ima1.civ1{ifile,j}; |
---|
[112] | 1772 | par_civ1.filename_ima_b=filecell.ima2.civ1{ifile,j}; |
---|
[2] | 1773 | par_civ1.Dt=num2str(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j))); |
---|
[112] | 1774 | par_civ1.T0=num2str((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2); |
---|
[2] | 1775 | par_civ1.term_a=num2stra(num_a_civ1(j),nom_type_nc);%UTILITE? |
---|
[112] | 1776 | par_civ1.term_b=num2stra(num_b_civ1(j),nom_type_nc);% |
---|
[2] | 1777 | test_mask=get(handles.get_mask_civ1,'Value'); |
---|
[112] | 1778 | if test_mask==0 |
---|
[2] | 1779 | par_civ1.maskname='noFile use default'; |
---|
| 1780 | par_civ1.maskflag='n'; |
---|
| 1781 | else |
---|
| 1782 | maskdispl=get(handles.mask_civ1,'String'); |
---|
[12] | 1783 | if exist(maskdispl,'file') |
---|
| 1784 | par_civ1.maskname=maskdispl; |
---|
[112] | 1785 | par_civ1.maskflag='y'; |
---|
[2] | 1786 | else |
---|
[136] | 1787 | maskbase=[filecell.filebase '_' maskdispl]; % |
---|
[137] | 1788 | nbslice_mask=str2double(maskdispl(1:end-4)); % |
---|
[12] | 1789 | num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; |
---|
| 1790 | par_civ1.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
| 1791 | if exist(par_civ1.maskname,'file') |
---|
[82] | 1792 | par_civ1.maskflag='y'; |
---|
[12] | 1793 | else |
---|
| 1794 | par_civ1.maskname='noFile use default'; |
---|
[112] | 1795 | par_civ1.maskflag='n'; |
---|
[12] | 1796 | end |
---|
[2] | 1797 | end |
---|
| 1798 | end |
---|
| 1799 | test_grid=get(handles.browse_gridciv1,'Value'); |
---|
| 1800 | if test_grid |
---|
| 1801 | par_civ1.gridflag='y'; |
---|
| 1802 | gridname=get(handles.grid_civ1,'String'); |
---|
| 1803 | if isequal(gridname(end-3:end),'grid') |
---|
[137] | 1804 | nbslice_grid=str2double(gridname(1:end-4)); % |
---|
| 1805 | if ~isnan(nbslice_grid) |
---|
[2] | 1806 | num1_grid=mod(num1_civ1(ifile)-1,nbslice_grid)+1; |
---|
[136] | 1807 | par_civ1.gridname=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
[2] | 1808 | if ~exist(par_civ1.gridname,'file') |
---|
[112] | 1809 | msgbox_uvmat('ERROR','grid file absent for civ1') |
---|
[2] | 1810 | end |
---|
| 1811 | elseif exist(gridname,'file') |
---|
[112] | 1812 | par_civ1.gridname=gridname; |
---|
[2] | 1813 | else |
---|
| 1814 | msgbox_uvmat('ERROR','grid file absent for civ1') |
---|
| 1815 | end |
---|
| 1816 | end |
---|
| 1817 | else |
---|
[112] | 1818 | par_civ1.gridname='noFile use default'; |
---|
| 1819 | par_civ1.gridflag='n'; |
---|
[2] | 1820 | end |
---|
[257] | 1821 | |
---|
[2] | 1822 | i_cmd=i_cmd+1; |
---|
[257] | 1823 | switch CivMode |
---|
| 1824 | case 'CivX' |
---|
| 1825 | civ1_exe=CIV1_CMD(fullfile(Rootbat,Filebat),'',par_civ1,handles,sparam);%create the parameter file .civ1.cmx and set the execution string civ1_exe |
---|
| 1826 | cmd=[cmd civ1_exe '\n']; |
---|
| 1827 | case 'CivAll' |
---|
| 1828 | CivAllCmd=[CivAllCmd ' civ1 ']; |
---|
| 1829 | str=CIV1_CMD_Unified(fullfile(Rootbat,Filebat),'',par_civ1); |
---|
| 1830 | fieldnames=fields(str); |
---|
| 1831 | [CivAllxml,uid_civ1]=add(CivAllxml,1,'element','civ1'); |
---|
| 1832 | for ilist=1:length(fieldnames) |
---|
| 1833 | val=eval(['str.' fieldnames{ilist}]); |
---|
| 1834 | if ischar(val) |
---|
| 1835 | [CivAllxml,uid_t]=add(CivAllxml,uid_civ1,'element',fieldnames{ilist}); |
---|
| 1836 | [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val); |
---|
| 1837 | end |
---|
[112] | 1838 | end |
---|
[2] | 1839 | end |
---|
| 1840 | end |
---|
| 1841 | |
---|
[112] | 1842 | % FIX1 |
---|
| 1843 | if box_test(2)==1 |
---|
| 1844 | test_mask=get(handles.get_mask_fix1,'Value'); |
---|
| 1845 | if test_mask==0 |
---|
[2] | 1846 | maskname=''; |
---|
[112] | 1847 | else |
---|
[2] | 1848 | maskdispl=get(handles.mask_fix1,'String'); |
---|
[137] | 1849 | nbslice_mask=str2double(maskdispl(1:end-4)); % |
---|
[2] | 1850 | num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; |
---|
[136] | 1851 | maskbase=[filecell.filebase '_' maskdispl]; |
---|
[2] | 1852 | maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
[112] | 1853 | end |
---|
[257] | 1854 | switch CivMode |
---|
| 1855 | % if CivX |
---|
| 1856 | case 'CivX' |
---|
| 1857 | if isunix %unix system |
---|
| 1858 | cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(flagindex1(1)) ... |
---|
| 1859 | ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ... |
---|
| 1860 | ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName ' maskname]; |
---|
| 1861 | else %windows system |
---|
| 1862 | cmd_FIX=['"' sparam.FixBin '" -f "' filecell.nc.civ1{ifile,j} '" -fi1 ' num2str(flagindex1(1)) ... |
---|
| 1863 | ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ... |
---|
| 1864 | ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName "' maskname '"']; |
---|
| 1865 | cmd_FIX=regexprep(cmd_FIX,'\\','\\\\'); |
---|
[112] | 1866 | end |
---|
[257] | 1867 | cmd=[cmd cmd_FIX '\n']; |
---|
| 1868 | case 'CivAll' |
---|
| 1869 | fix1.inputFileName=filecell.nc.civ1{ifile,j} ; |
---|
| 1870 | fix1.fi1=num2str(flagindex1(1)); |
---|
| 1871 | fix1.fi2=num2str(flagindex1(2)); |
---|
| 1872 | fix1.fi3=num2str(flagindex1(3)); |
---|
| 1873 | fix1.threshC=num2str(thresh_vecC1); |
---|
| 1874 | fix1.threshV=num2str(thresh_vel1); |
---|
| 1875 | fieldnames=fields(fix1); |
---|
| 1876 | [CivAllxml,uid_fix1]=add(CivAllxml,1,'element','fix1'); |
---|
| 1877 | for ilist=1:length(fieldnames) |
---|
| 1878 | val=eval(['fix1.' fieldnames{ilist}]); |
---|
| 1879 | if ischar(val) |
---|
| 1880 | [CivAllxml,uid_t]=add(CivAllxml,uid_fix1,'element',fieldnames{ilist}); |
---|
| 1881 | [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val); |
---|
| 1882 | end |
---|
| 1883 | end |
---|
| 1884 | CivAllCmd=[CivAllCmd ' fix1 ']; |
---|
[112] | 1885 | end |
---|
| 1886 | end |
---|
| 1887 | |
---|
| 1888 | %PATCH1 |
---|
| 1889 | if box_test(3)==1 |
---|
[257] | 1890 | switch CivMode |
---|
| 1891 | case 'CivX' |
---|
| 1892 | cmd_PATCH=PATCH_CMD(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp,sparam.PatchBin); |
---|
| 1893 | cmd=[cmd cmd_PATCH '\n']; |
---|
| 1894 | case 'CivAll' |
---|
| 1895 | patch1.inputFileName=filecell.nc.civ1{ifile,j} ; |
---|
| 1896 | patch1.nopt=subdomain_patch1; |
---|
| 1897 | patch1.maxdiff=thresh_patch1; |
---|
| 1898 | patch1.ro=rho_patch1; |
---|
| 1899 | test_grid=get(handles.get_gridpatch1,'Value'); |
---|
| 1900 | if test_grid |
---|
| 1901 | patch1.gridflag='y'; |
---|
| 1902 | gridname=get(handles.grid_patch1,'String'); |
---|
| 1903 | if isequal(gridname(end-3:end),'grid') |
---|
| 1904 | nbslice_grid=str2double(gridname(1:end-4)); % |
---|
| 1905 | if ~isnan(nbslice_grid) |
---|
| 1906 | num1_grid=mod(num1_civ1(ifile)-1,nbslice_grid)+1; |
---|
| 1907 | patch1.gridPatch=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
| 1908 | if ~exist(patch1.gridPatch,'file') |
---|
| 1909 | msgbox_uvmat('ERROR','grid file absent for patch1') |
---|
| 1910 | end |
---|
| 1911 | elseif exist(gridname,'file') |
---|
| 1912 | patch1.gridPatch=gridname; |
---|
| 1913 | else |
---|
[112] | 1914 | msgbox_uvmat('ERROR','grid file absent for patch1') |
---|
| 1915 | end |
---|
[2] | 1916 | end |
---|
[257] | 1917 | else |
---|
| 1918 | patch1.gridPatch='none'; |
---|
| 1919 | patch1.gridflag='n'; |
---|
| 1920 | patch1.m=nx_patch1; |
---|
| 1921 | patch1.n=ny_patch1; |
---|
[2] | 1922 | end |
---|
[257] | 1923 | patch1.convectFlow='n'; |
---|
| 1924 | fieldnames=fields(patch1); |
---|
| 1925 | [CivAllxml,uid_patch1]=add(CivAllxml,1,'element','patch1'); |
---|
| 1926 | for ilist=1:length(fieldnames) |
---|
| 1927 | val=eval(['patch1.' fieldnames{ilist}]); |
---|
| 1928 | if ischar(val) |
---|
| 1929 | [CivAllxml,uid_t]=add(CivAllxml,uid_patch1,'element',fieldnames{ilist}); |
---|
| 1930 | [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val); |
---|
| 1931 | end |
---|
[112] | 1932 | end |
---|
[257] | 1933 | CivAllCmd=[CivAllCmd ' patch1 ']; |
---|
[112] | 1934 | end |
---|
[2] | 1935 | end |
---|
[127] | 1936 | if box_test(4)==1 || box_test(5)==1 || box_test(6)==1 |
---|
[112] | 1937 | filename_cmx=filecell.nc.civ2{ifile,j};%output netcdf file |
---|
[229] | 1938 | filename_cmx(end-1:end+1)='cmx';%name of cmx file |
---|
[112] | 1939 | end |
---|
| 1940 | if box_test(4)==1 |
---|
[2] | 1941 | par_civ2.filename_ima_a=filecell.ima1.civ2{ifile,j}; |
---|
| 1942 | par_civ2.filename_ima_b=filecell.ima2.civ2{ifile,j}; |
---|
[174] | 1943 | [Rootbat,Filebat]=fileparts(filecell.nc.civ2{ifile,j});%output netcdf file (without extention) |
---|
[2] | 1944 | par_civ2.Dt=num2str(time(num2_civ2(ifile),num_b_civ2(j))-time(num1_civ2(ifile),num_a_civ2(j))); |
---|
[112] | 1945 | par_civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2); |
---|
[2] | 1946 | par_civ2.term_a=num2stra(num_a_civ2(j),nom_type_nc); |
---|
[112] | 1947 | par_civ2.term_b=num2stra(num_b_civ2(j),nom_type_nc); |
---|
[2] | 1948 | par_civ2.filename_nc1=filecell.nc.civ1{ifile,j}; |
---|
[229] | 1949 | par_civ2.filename_nc1(end-2:end)=[]; % remove '.nc' |
---|
[2] | 1950 | test_mask=get(handles.get_mask_civ2,'Value'); |
---|
[112] | 1951 | if test_mask==0 |
---|
[2] | 1952 | par_civ2.maskname='noFile use default'; |
---|
| 1953 | par_civ2.maskflag='n'; |
---|
| 1954 | else |
---|
| 1955 | maskdispl=get(handles.mask_civ2,'String'); |
---|
[12] | 1956 | if exist(maskdispl,'file') |
---|
| 1957 | par_civ2.maskname=maskdispl; |
---|
| 1958 | par_civ2.maskflag='y'; |
---|
[2] | 1959 | else |
---|
[136] | 1960 | maskbase=[filecell.filebase '_' maskdispl]; % |
---|
[137] | 1961 | nbslice_mask=str2double(maskdispl(1:end-4)); % |
---|
[12] | 1962 | num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; |
---|
| 1963 | par_civ2.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
| 1964 | if exist(par_civ2.maskname,'file') |
---|
[112] | 1965 | par_civ2.maskflag='y'; |
---|
[12] | 1966 | else |
---|
| 1967 | par_civ2.maskname='noFile use default'; |
---|
[112] | 1968 | par_civ2.maskflag='n'; |
---|
[12] | 1969 | end |
---|
[2] | 1970 | end |
---|
| 1971 | end |
---|
| 1972 | gridname=get(handles.grid_civ2,'String'); |
---|
| 1973 | if numel(gridname)>=4 && isequal(gridname(end-3:end),'grid') |
---|
[137] | 1974 | nbslice_grid=str2double(gridname(1:end-4)); % |
---|
| 1975 | if ~isnan(nbslice_grid) |
---|
[2] | 1976 | par_civ2.gridflag='y'; |
---|
| 1977 | num1_grid=mod(num1_civ2(ifile)-1,nbslice_grid)+1; |
---|
[136] | 1978 | par_civ2.gridname=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
[2] | 1979 | if exist(par_civ2.gridname,'file') |
---|
[112] | 1980 | par_civ2.gridflag='y'; |
---|
[2] | 1981 | else |
---|
| 1982 | par_civ2.gridname='noFile use default'; |
---|
[112] | 1983 | par_civ2.gridflag='n'; |
---|
[2] | 1984 | end |
---|
| 1985 | elseif exist(gridname,'file') |
---|
[112] | 1986 | par_civ2.gridflag='y'; |
---|
[2] | 1987 | else |
---|
| 1988 | par_civ2.gridname='noFile use default'; |
---|
[112] | 1989 | par_civ2.gridflag='n'; |
---|
[2] | 1990 | end |
---|
| 1991 | end |
---|
| 1992 | i_cmd=i_cmd+1; |
---|
[177] | 1993 | flname=fullfile(Rootbat,Filebat); |
---|
[257] | 1994 | switch CivMode |
---|
| 1995 | case 'CivX' |
---|
| 1996 | cmd_CIV2=CIV2_CMD(flname,[],par_civ2,sparam);%creates the cmx file [fullfile(Rootbat,Filebat) '.civ2.cmx] |
---|
| 1997 | cmd=[cmd cmd_CIV2 '\n']; |
---|
| 1998 | case 'CivAll' |
---|
| 1999 | CivAllCmd=[CivAllCmd ' civ2 ']; |
---|
| 2000 | str=CIV2_CMD_Unified(flname,'',par_civ2); |
---|
| 2001 | fieldnames=fields(str); |
---|
| 2002 | [CivAllxml,uid_civ2]=add(CivAllxml,1,'element','civ2'); |
---|
| 2003 | for ilist=1:length(fieldnames) |
---|
| 2004 | val=eval(['str.' fieldnames{ilist}]); |
---|
| 2005 | if ischar(val) |
---|
| 2006 | [CivAllxml,uid_t]=add(CivAllxml,uid_civ2,'element',fieldnames{ilist}); |
---|
| 2007 | [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val); |
---|
| 2008 | end |
---|
[2] | 2009 | end |
---|
| 2010 | end |
---|
[112] | 2011 | end |
---|
| 2012 | |
---|
| 2013 | % FIX2 |
---|
| 2014 | if box_test(5)==1 |
---|
| 2015 | test_mask=get(handles.get_mask_fix2,'Value'); |
---|
| 2016 | if test_mask==0 |
---|
| 2017 | maskname=''; %no mask used |
---|
[2] | 2018 | else |
---|
| 2019 | maskdispl=get(handles.mask_fix2,'String'); |
---|
[136] | 2020 | maskbase=[filecell.filebase '_' maskdispl]; % |
---|
[137] | 2021 | nbslice_mask=str2double(maskdispl(1:end-4)); % |
---|
[2] | 2022 | num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; |
---|
| 2023 | maskname =name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
[112] | 2024 | end |
---|
[257] | 2025 | switch CivMode |
---|
| 2026 | case 'CivX' |
---|
| 2027 | if isunix |
---|
| 2028 | cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ2{ifile,j} ' -fi1 ' num2str(flagindex2(1)) ... |
---|
| 2029 | ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ... |
---|
| 2030 | ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname]; |
---|
| 2031 | else |
---|
| 2032 | cmd_FIX=['"' sparam.FixBin '" -f "' filecell.nc.civ2{ifile,j} '" -fi1 ' num2str(flagindex2(1)) ... |
---|
| 2033 | ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ... |
---|
| 2034 | ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName "' maskname '"']; |
---|
| 2035 | cmd_FIX=regexprep(cmd_FIX,'\\','\\\\'); |
---|
[112] | 2036 | end |
---|
[257] | 2037 | cmd=[cmd cmd_FIX '\n']; |
---|
| 2038 | case 'CivAll' |
---|
| 2039 | fix2.inputFileName=filecell.nc.civ2{ifile,j} ; |
---|
| 2040 | fix2.fi1=num2str(flagindex2(1)); |
---|
| 2041 | fix2.fi2=num2str(flagindex2(2)); |
---|
| 2042 | fix2.fi3=num2str(flagindex2(3)); |
---|
| 2043 | fix2.threshC=num2str(thresh_vec2C); |
---|
| 2044 | fix2.threshV=num2str(thresh_vel2); |
---|
| 2045 | fieldnames=fields(fix2); |
---|
| 2046 | [CivAllxml,uid_fix2]=add(CivAllxml,1,'element','fix2'); |
---|
| 2047 | for ilist=1:length(fieldnames) |
---|
| 2048 | val=eval(['fix2.' fieldnames{ilist}]); |
---|
| 2049 | if ischar(val) |
---|
| 2050 | [CivAllxml,uid_t]=add(CivAllxml,uid_fix2,'element',fieldnames{ilist}); |
---|
| 2051 | [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val); |
---|
| 2052 | end |
---|
| 2053 | end |
---|
| 2054 | CivAllCmd=[CivAllCmd ' fix2 ']; |
---|
[112] | 2055 | end |
---|
| 2056 | end |
---|
| 2057 | |
---|
| 2058 | %PATCH2 |
---|
| 2059 | if box_test(6)==1 |
---|
[257] | 2060 | switch CivMode |
---|
| 2061 | case 'CivX' |
---|
| 2062 | cmd_PATCH=PATCH_CMD(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp,sparam.PatchBin); |
---|
| 2063 | cmd=[cmd cmd_PATCH '\n']; |
---|
| 2064 | case 'CivAll' |
---|
| 2065 | patch2.inputFileName=filecell.nc.civ1{ifile,j} ; |
---|
| 2066 | patch2.nopt=subdomain_patch2; |
---|
| 2067 | patch2.maxdiff=thresh_patch2; |
---|
| 2068 | patch2.ro=rho_patch2; |
---|
| 2069 | test_grid=get(handles.get_gridpatch2,'Value'); |
---|
| 2070 | if test_grid |
---|
| 2071 | patch2.gridflag='y'; |
---|
| 2072 | gridname=get(handles.grid_patch2,'String'); |
---|
| 2073 | if isequal(gridname(end-3:end),'grid') |
---|
| 2074 | nbslice_grid=str2double(gridname(1:end-4)); % |
---|
| 2075 | if ~isnan(nbslice_grid) |
---|
| 2076 | num1_grid=mod(num1_civ2(ifile)-1,nbslice_grid)+1; |
---|
| 2077 | patch2.gridPatch=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
| 2078 | if ~exist(patch2.gridPatch,'file') |
---|
| 2079 | msgbox_uvmat('ERROR','grid file absent for patch2') |
---|
| 2080 | end |
---|
| 2081 | elseif exist(gridname,'file') |
---|
| 2082 | patch2.gridPatch=gridname; |
---|
| 2083 | else |
---|
[112] | 2084 | msgbox_uvmat('ERROR','grid file absent for patch2') |
---|
[12] | 2085 | end |
---|
[2] | 2086 | end |
---|
[257] | 2087 | else |
---|
| 2088 | patch2.gridPatch='none'; |
---|
| 2089 | patch2.gridflag='n'; |
---|
| 2090 | patch2.m=nx_patch2; |
---|
| 2091 | patch2.n=ny_patch2; |
---|
[2] | 2092 | end |
---|
[257] | 2093 | patch2.convectFlow='n'; |
---|
| 2094 | fieldnames=fields(patch2); |
---|
| 2095 | [CivAllxml,uid_patch2]=add(CivAllxml,1,'element','patch2'); |
---|
| 2096 | for ilist=1:length(fieldnames) |
---|
| 2097 | val=eval(['patch2.' fieldnames{ilist}]); |
---|
| 2098 | if ischar(val) |
---|
| 2099 | [CivAllxml,uid_t]=add(CivAllxml,uid_patch2,'element',fieldnames{ilist}); |
---|
| 2100 | [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val); |
---|
| 2101 | end |
---|
[112] | 2102 | end |
---|
[257] | 2103 | CivAllCmd=[CivAllCmd ' patch2 ']; |
---|
[112] | 2104 | end |
---|
[12] | 2105 | end |
---|
[257] | 2106 | |
---|
| 2107 | switch CivMode |
---|
| 2108 | case {'CivX','CivAll'} |
---|
| 2109 | if isequal(CivMode,'CivAll') |
---|
| 2110 | save(CivAllxml,[flname '.xml']); |
---|
| 2111 | cmd=[cmd sparam.CivBin ' -f ' flname '.xml ' CivAllCmd ' >' flname '.log' '\n']; |
---|
[238] | 2112 | end |
---|
[257] | 2113 | % create the .bat file: |
---|
| 2114 | [fid,message]=fopen(filename_bat,'w'); |
---|
| 2115 | if isequal(fid,-1) |
---|
| 2116 | msgbox_uvmat('ERROR', ['creation of .bat file: ' message]) |
---|
| 2117 | return |
---|
[238] | 2118 | end |
---|
[257] | 2119 | fprintf(fid,cmd); |
---|
| 2120 | fclose(fid); |
---|
| 2121 | if batch |
---|
| 2122 | switch batch_mode |
---|
| 2123 | case 'sge' |
---|
| 2124 | pvalue=num2str((1-ind_answer)*500); |
---|
| 2125 | display(['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]); |
---|
| 2126 | eval( ['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]); |
---|
| 2127 | case 'oar' |
---|
| 2128 | eval( ['!chmod +x ' filename_bat]); |
---|
[261] | 2129 | eval( ['!oarsub -n CIVX -l /nodes=1/cpu=1,walltime=00:10:00 ' filename_bat]); |
---|
[257] | 2130 | end |
---|
[238] | 2131 | else |
---|
[257] | 2132 | %% to lauch the jobs locally : |
---|
| 2133 | if(isunix) |
---|
| 2134 | cmd_str=['. ' filename_bat]; |
---|
| 2135 | else %case of Windows |
---|
| 2136 | cmd_str=['@call "' regexprep(filename_bat,'\\','\\\\') '"']; |
---|
| 2137 | end |
---|
| 2138 | super_cmd=[super_cmd cmd_str '\n']; |
---|
| 2139 | disp(cmd_str); |
---|
[252] | 2140 | end |
---|
[257] | 2141 | case 'Matlab' |
---|
| 2142 | drawnow |
---|
| 2143 | if box_test(1)==1 |
---|
| 2144 | Param.Civ1=par_civ1; |
---|
[252] | 2145 | end |
---|
[257] | 2146 | if box_test(2)==1 |
---|
| 2147 | fix1.WarnFlags=[]; |
---|
| 2148 | if get(handles.vec_Fmin2,'Value') |
---|
| 2149 | fix1.WarnFlags=[fix1.WarnFlags -2]; |
---|
| 2150 | end |
---|
| 2151 | if get(handles.vec_F3,'Value') |
---|
| 2152 | fix1.WarnFlags=[fix1.WarnFlags 3]; |
---|
| 2153 | end |
---|
| 2154 | fix1.LowerBoundCorr=thresh_vecC1; |
---|
| 2155 | if get(handles.inf_sup1,'Value') |
---|
| 2156 | fix1.UppperBoundVel=thresh_vel1; |
---|
| 2157 | else |
---|
| 2158 | fix1.LowerBoundVel=thresh_vel1; |
---|
| 2159 | end |
---|
| 2160 | if get(handles.get_mask_fix1,'Value') |
---|
| 2161 | fix1.MaskName=maskname; |
---|
| 2162 | end |
---|
| 2163 | Param.Fix1=fix1; |
---|
[252] | 2164 | end |
---|
[257] | 2165 | if box_test(3)==1 |
---|
| 2166 | Param.Patch1.Rho=rho_patch1; |
---|
| 2167 | Param.Patch1.Threshold=thresh_patch1; |
---|
| 2168 | Param.Patch1.SubDomain=subdomain_patch1; |
---|
| 2169 | end |
---|
| 2170 | if box_test(4)==1 |
---|
| 2171 | Param.Civ2=par_civ2; |
---|
| 2172 | end |
---|
| 2173 | if box_test(5)==1 |
---|
| 2174 | fix2.WarnFlags=[]; |
---|
| 2175 | if get(handles.vec_Fmin2_2,'Value') |
---|
| 2176 | fix2.WarnFlags=[fix2.WarnFlags -2]; |
---|
| 2177 | end |
---|
| 2178 | if get(handles.vec_F4,'Value') |
---|
| 2179 | fix2.WarnFlags=[fix2.WarnFlags 4]; |
---|
| 2180 | end |
---|
| 2181 | if get(handles.vec_F3_2,'Value') |
---|
| 2182 | fix2.WarnFlags=[fix2.WarnFlags 3]; |
---|
| 2183 | end |
---|
| 2184 | fix2.LowerBoundCorr=thresh_vec2C; |
---|
| 2185 | if get(handles.inf_sup2,'Value') |
---|
| 2186 | fix2.UppperBoundVel=thresh_vel2; |
---|
| 2187 | else |
---|
| 2188 | fix2.LowerBoundVel=thresh_vel2; |
---|
| 2189 | end |
---|
| 2190 | if get(handles.get_mask_fix2,'Value') |
---|
| 2191 | fix2.MaskName=maskname; |
---|
| 2192 | end |
---|
| 2193 | Param.Fix2=fix2; |
---|
| 2194 | end |
---|
| 2195 | [Data,erromsg]=civ_uvmat(Param,filecell.nc.civ1{ifile,j}); |
---|
| 2196 | if isempty(errormsg) |
---|
| 2197 | display([filecell.nc.civ1{ifile,j} ' written']) |
---|
[252] | 2198 | else |
---|
[257] | 2199 | msgbox_uvmat('ERROR',errormsg) |
---|
| 2200 | end |
---|
| 2201 | end |
---|
[112] | 2202 | end |
---|
[2] | 2203 | end |
---|
[134] | 2204 | |
---|
[257] | 2205 | if ~batch && ~isequal(CivMode,'Matlab') |
---|
[159] | 2206 | [Rootbat,Filebat,extbat]=fileparts(filename_bat); |
---|
[229] | 2207 | filename_superbat=fullfile(Rootbat,'job_list.bat'); |
---|
[134] | 2208 | fid=fopen(filename_superbat,'w'); |
---|
[257] | 2209 | if fid==-1 |
---|
| 2210 | msgbox_uvmat('ERROR',['cannot create the command file ' filename_superbat]) |
---|
| 2211 | return |
---|
| 2212 | end |
---|
[134] | 2213 | fprintf(fid,super_cmd'); |
---|
| 2214 | fclose(fid); |
---|
[257] | 2215 | if(isunix) |
---|
[219] | 2216 | system(['chmod +x ' filename_superbat]) |
---|
[257] | 2217 | end |
---|
| 2218 | system([filename_superbat ' &'])% execute main commmand |
---|
[133] | 2219 | end |
---|
[2] | 2220 | |
---|
[137] | 2221 | %% save interface state |
---|
[2] | 2222 | if isfield(filecell,'nc') |
---|
| 2223 | if isfield(filecell.nc,'civ2') |
---|
| 2224 | fileresu=filecell.nc.civ2{1,1}; |
---|
| 2225 | else |
---|
| 2226 | fileresu=filecell.nc.civ1{1,1}; |
---|
| 2227 | end |
---|
| 2228 | end |
---|
| 2229 | [RootPath,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileresu); |
---|
| 2230 | namedoc=fullfile(RootPath,subdir,RootFile); |
---|
[112] | 2231 | detect=1; |
---|
[2] | 2232 | while detect==1 |
---|
| 2233 | namefigfull=[namedoc '.fig']; |
---|
| 2234 | hh=dir(namefigfull); |
---|
| 2235 | if ~isempty(hh) |
---|
| 2236 | detect=1; |
---|
| 2237 | namedoc=[namedoc '.0']; |
---|
| 2238 | else |
---|
| 2239 | detect=0; |
---|
| 2240 | end |
---|
| 2241 | end |
---|
| 2242 | saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) |
---|
| 2243 | |
---|
[227] | 2244 | %------------------------------------------------------------------------ |
---|
| 2245 | % --- determine the list of reference indices of processing file |
---|
| 2246 | function [ref_i,ref_j,errormsg]=find_ref_indices(handles) |
---|
| 2247 | %------------------------------------------------------------------------ |
---|
| 2248 | errormsg=''; %default error message |
---|
| 2249 | first_i=str2double(get(handles.first_i,'String'));%first index i |
---|
| 2250 | last_i=str2double(get(handles.last_i,'String'));%last index i |
---|
| 2251 | incr_i=str2double(get(handles.incr_i,'String'));% increment |
---|
| 2252 | if isequal(get(handles.first_j,'Visible'),'on') |
---|
| 2253 | first_j=str2double(get(handles.first_j,'String'));%first index j |
---|
| 2254 | last_j=str2double(get(handles.last_j,'String'));%last index j |
---|
| 2255 | incr_j=str2double(get(handles.incr_j,'String'));% increment |
---|
| 2256 | else |
---|
| 2257 | first_j=1; |
---|
| 2258 | last_j=1; |
---|
| 2259 | incr_j=1; |
---|
| 2260 | end |
---|
| 2261 | ref_i=first_i:incr_i:last_i;% list of i indices (reference values for each pair) |
---|
| 2262 | ref_j=first_j:incr_j:last_j;% list of j indices (reference values for each pair) |
---|
| 2263 | if isnan(first_i)||isnan(first_j) |
---|
| 2264 | errormsg='first field number not defined'; |
---|
| 2265 | elseif isnan(last_i)||isnan(last_j) |
---|
| 2266 | errormsg='last field number not defined'; |
---|
| 2267 | elseif isnan(incr_i)||isnan(incr_j) |
---|
| 2268 | errormsg='increment in field number not defined'; |
---|
| 2269 | elseif last_i < first_i || last_j < first_j |
---|
| 2270 | errormsg='last field number must be larger than the first one'; |
---|
| 2271 | end |
---|
[134] | 2272 | |
---|
[227] | 2273 | %------------------------------------------------------------------------ |
---|
| 2274 | % --- determine the list of filenames and indices needed for launch_job |
---|
[2] | 2275 | 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]=... |
---|
[227] | 2276 | set_civ_filenames(handles,ref_i,ref_j,box_test) |
---|
[12] | 2277 | %------------------------------------------------------------------------ |
---|
[85] | 2278 | filecell=[];%default |
---|
[136] | 2279 | |
---|
| 2280 | %% get the root names nomenclature and numbers |
---|
[71] | 2281 | filebase=get(handles.RootName,'String'); |
---|
[136] | 2282 | |
---|
| 2283 | if isempty(filebase)||isequal(filebase,'') |
---|
| 2284 | msgbox_uvmat('ERROR','no input files') |
---|
| 2285 | return |
---|
| 2286 | end |
---|
| 2287 | |
---|
[137] | 2288 | %filebase=regexprep(filebase,'\.fsnet','fsnet');% temporary fix for cluster Coriolis |
---|
[136] | 2289 | filecell.filebase=filebase; |
---|
| 2290 | |
---|
[2] | 2291 | browse=get(handles.browse_root,'UserData'); |
---|
| 2292 | compare_list=get(handles.compare,'String'); |
---|
| 2293 | val=get(handles.compare,'Value'); |
---|
| 2294 | compare=compare_list{val}; |
---|
| 2295 | if strcmp(compare,'displacement') |
---|
| 2296 | mode='displacement'; |
---|
| 2297 | else |
---|
| 2298 | mode_list=get(handles.mode,'String'); |
---|
| 2299 | mode_value=get(handles.mode,'Value'); |
---|
| 2300 | mode=mode_list{mode_value}; |
---|
| 2301 | end |
---|
[137] | 2302 | %time=get(handles.RootName,'UserData'); %get the set of times |
---|
[71] | 2303 | ext_ima=get(handles.ImaExt,'String'); |
---|
[2] | 2304 | nom_type_nc=browse.nom_type_nc; |
---|
[122] | 2305 | if isfield(browse,'nom_type_ima') |
---|
| 2306 | nom_type_ima2=browse.nom_type_ima; |
---|
| 2307 | end |
---|
| 2308 | if isempty(nom_type_ima2),nom_type_ima2='1';end; %default |
---|
| 2309 | if isempty(nom_type_nc),nom_type_nc='_i1-i2';end; %default |
---|
[2] | 2310 | [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... |
---|
[227] | 2311 | find_pair_indices(handles,ref_i,ref_j,mode); |
---|
[2] | 2312 | %determine the new filebase for 'displacement' mode (comparison of two series) |
---|
| 2313 | filebase_B=filebase;% root name of the second field series for stereo |
---|
| 2314 | if strcmp(compare,'displacement') || strcmp(compare,'stereo PIV') |
---|
[127] | 2315 | % test_disp=1; |
---|
[2] | 2316 | nom_type_ima1=browse.nom_type_ima_1; %nomenclature type of the second file series |
---|
| 2317 | [Path2,Name2]=fileparts(filebase_B); |
---|
| 2318 | Path1=Path2; |
---|
[71] | 2319 | Name1=get(handles.RootName_1,'String');% root name of the first field series for stereo |
---|
[2] | 2320 | filebase_A=fullfile(Path1,Name1); |
---|
| 2321 | if length(Name1)>6 |
---|
| 2322 | Name1=Name1(end-5:end); |
---|
| 2323 | end |
---|
| 2324 | if length(Name2)>6 |
---|
| 2325 | Name2=Name2(end-5:end); |
---|
| 2326 | end |
---|
| 2327 | filebase_AB=fullfile(Path2,[Name2 '-' Name1]); |
---|
| 2328 | else |
---|
[127] | 2329 | % test_disp=0; |
---|
[2] | 2330 | filebase_A=filebase; |
---|
| 2331 | nom_type_ima1=nom_type_ima2; |
---|
| 2332 | filebase_AB=filebase; |
---|
| 2333 | end |
---|
| 2334 | if strcmp(compare,'displacement') |
---|
[112] | 2335 | filebase_ima1=filebase_A; |
---|
| 2336 | filebase_ima2=filebase_B; |
---|
| 2337 | filebase_nc=filebase_AB; %root name for the result of civ2 |
---|
[2] | 2338 | else |
---|
[112] | 2339 | filebase_ima1=filebase_B; |
---|
| 2340 | filebase_ima2=filebase_B; |
---|
| 2341 | filebase_nc=filebase_B; |
---|
| 2342 | end |
---|
[2] | 2343 | |
---|
| 2344 | %determine reference files for fix: |
---|
| 2345 | file_ref_fix1={};%default |
---|
| 2346 | file_ref_fix2={}; |
---|
| 2347 | nbfield=length(num1_civ1); |
---|
| 2348 | nbslice=length(num_a_civ1); |
---|
| 2349 | if box_test(2)==1% fix1 performed |
---|
| 2350 | ref=get(handles.ref_fix1,'UserData');%read data on the ref file stored by get_ref_fix1_Callback |
---|
| 2351 | if ~isempty(ref) |
---|
[137] | 2352 | first_i=str2double(get(handles.first_i,'String')); |
---|
| 2353 | last_i=str2double(get(handles.last_i,'String')); |
---|
| 2354 | incr_i=str2double(get(handles.incr_i,'String')); |
---|
| 2355 | first_j=str2double(get(handles.first_j,'String')); |
---|
| 2356 | last_j=str2double(get(handles.last_j,'String')); |
---|
| 2357 | incr_j=str2double(get(handles.incr_j,'String')); |
---|
[127] | 2358 | num_i_ref=first_i:incr_i:last_i; |
---|
| 2359 | num_j_ref=first_j:incr_j:last_j; |
---|
[2] | 2360 | if isequal(mode,'displacement') |
---|
| 2361 | num_i1=num_i_ref; |
---|
| 2362 | num_i2=num_i_ref; |
---|
| 2363 | num_j1=num_j_ref; |
---|
| 2364 | num_j2=num_j_ref; |
---|
| 2365 | elseif isequal(mode,'pair j1-j2')% isequal(mode,'st_pair j1-j2') |
---|
| 2366 | num_i1=num_i_ref; |
---|
| 2367 | num_i2=num_i1; |
---|
| 2368 | num_j1=ref.num_a*ones(size(num_i_ref)); |
---|
| 2369 | num_j2=ref.num_b*ones(size(num_i_ref)); |
---|
| 2370 | elseif isequal(mode,'series(Di)') % isequal(mode,'st_series(Di)') |
---|
| 2371 | delta1=floor((ref.num2-ref.num1)/2); |
---|
| 2372 | delta2=ceil((ref.num2-ref.num1)/2); |
---|
| 2373 | num_i1=num_i_ref-delta1*ones(size(num_i_ref)); |
---|
| 2374 | num_i2=num_i_ref+delta2*ones(size(num_i_ref)); |
---|
| 2375 | if isempty(ref.num_a) |
---|
| 2376 | ref.num_a=1; |
---|
| 2377 | end |
---|
| 2378 | num_j1=ref.num_a*ones(size(num_i1)); |
---|
| 2379 | num_j2=num_j1; |
---|
| 2380 | elseif isequal(mode,'series(Dj)')%| isequal(mode,'st_series(Dj)') |
---|
| 2381 | delta1=floor((ref.num_b-ref.num_a)/2); |
---|
| 2382 | delta2=ceil((ref.num_b-ref.num_a)/2); |
---|
| 2383 | num_i1=ref.num1*ones(size(num_i_ref)); |
---|
| 2384 | num_i2=num_i1; |
---|
| 2385 | num_j1=num_j_ref-delta1*ones(size(num_j_ref)); |
---|
| 2386 | num_j2=num_j_ref+delta2*ones(size(num_j_ref)); |
---|
| 2387 | end |
---|
| 2388 | for ifile=1:nbfield |
---|
| 2389 | for j=1:nbslice |
---|
| 2390 | 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);% |
---|
| 2391 | file_ref_fix1(ifile,j)={file_ref}; |
---|
| 2392 | if ~exist(file_ref,'file') |
---|
| 2393 | msgbox_uvmat('ERROR',['reference file ' file_ref ' not found for fix1']) |
---|
[12] | 2394 | filecell=[]; |
---|
[2] | 2395 | return |
---|
| 2396 | end |
---|
| 2397 | end |
---|
| 2398 | end |
---|
| 2399 | end |
---|
| 2400 | end |
---|
| 2401 | |
---|
| 2402 | %determine reference files for fix2: |
---|
| 2403 | if box_test(5)==1% fix2 performed |
---|
| 2404 | ref=get(handles.ref_fix2,'UserData'); |
---|
| 2405 | if ~isempty(ref) |
---|
[127] | 2406 | first_i=str2double(get(handles.first_i,'String')); |
---|
| 2407 | last_i=str2double(get(handles.last_i,'String')); |
---|
| 2408 | incr_i=str2double(get(handles.incr_i,'String')); |
---|
| 2409 | first_j=str2double(get(handles.first_j,'String')); |
---|
| 2410 | last_j=str2double(get(handles.last_j,'String')); |
---|
| 2411 | incr_j=str2double(get(handles.incr_j,'String')); |
---|
[229] | 2412 | num_i_ref=first_i:incr_i:last_i; |
---|
| 2413 | num_j_ref=first_j:incr_j:last_j; |
---|
[2] | 2414 | if isequal(mode,'displacement') |
---|
| 2415 | num_i1=num_i_ref; |
---|
| 2416 | num_i2=num_i_ref; |
---|
| 2417 | num_j1=num_j_ref; |
---|
| 2418 | num_j2=num_j_ref; |
---|
| 2419 | elseif isequal(mode,'pair j1-j2') |
---|
| 2420 | num_i1=num_i_ref; |
---|
| 2421 | num_i2=num_i1; |
---|
| 2422 | num_j1=ref.num_a; |
---|
| 2423 | num_j2=ref.num_b; |
---|
| 2424 | elseif isequal(mode,'series(Di)') |
---|
| 2425 | delta1=floor((ref.num2-ref.num1)/2); |
---|
| 2426 | delta2=ceil((ref.num2-ref.num1)/2); |
---|
| 2427 | num_i1=num_i_ref-delta1*ones(size(num_i_ref)); |
---|
| 2428 | num_i2=num_i_ref+delta2*ones(size(num_i_ref)); |
---|
| 2429 | num_j1=ref.num_a*ones(size(num_i1)); |
---|
| 2430 | num_j2=num_j1; |
---|
| 2431 | elseif isequal(mode,'series(Dj)') |
---|
| 2432 | delta1=floor((ref.num_b-ref.num_a)/2); |
---|
| 2433 | delta2=ceil((ref.num_b-ref.num_a)/2); |
---|
| 2434 | num_i1=ref.num1*ones(size(num_i_ref)); |
---|
| 2435 | num_i2=num_i1; |
---|
| 2436 | num_j1=num_j_ref-delta1*ones(size(num_j_ref)); |
---|
| 2437 | num_j2=num_j_ref+delta2*ones(size(num_j_ref)); |
---|
| 2438 | end |
---|
| 2439 | for ifile=1:nbfield |
---|
| 2440 | for j=1:nbslice |
---|
| 2441 | 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);% |
---|
| 2442 | file_ref_fix2(ifile,j)={file_ref}; |
---|
| 2443 | if ~exist(file_ref,'file') |
---|
| 2444 | msgbox_uvmat('ERROR',['reference file ' file_ref ' not found for fix2']) |
---|
[122] | 2445 | filecell={}; |
---|
[2] | 2446 | return |
---|
| 2447 | end |
---|
| 2448 | end |
---|
| 2449 | end |
---|
| 2450 | end |
---|
| 2451 | end |
---|
| 2452 | |
---|
| 2453 | %check dir |
---|
| 2454 | subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf output data |
---|
| 2455 | subdir_civ2=get(handles.subdir_civ2,'String'); |
---|
[174] | 2456 | if isequal(subdir_civ1,''),subdir_civ1='CIV'; end% put default subdir |
---|
[2] | 2457 | if isequal(subdir_civ2,''),subdir_civ2=subdir_civ1; end% put default subdir |
---|
[135] | 2458 | currentdir=pwd;%store the current working directory |
---|
[2] | 2459 | [Path_ima,Name]=fileparts(filebase);%Path of the image files (.civ) |
---|
| 2460 | if ~exist(Path_ima,'dir') |
---|
[12] | 2461 | msgbox_uvmat('ERROR',['path to images ' Path_ima ' not found']) |
---|
[122] | 2462 | filecell={}; |
---|
[2] | 2463 | return |
---|
| 2464 | end |
---|
[127] | 2465 | [xx,message]=fileattrib(Path_ima); |
---|
[122] | 2466 | if ~isempty(message) && ~isequal(message.UserWrite,1) |
---|
[112] | 2467 | msgbox_uvmat('ERROR',['No writting access to ' Path_ima]) |
---|
[122] | 2468 | filecell={}; |
---|
[112] | 2469 | cd(currentdir); |
---|
| 2470 | return |
---|
[2] | 2471 | end |
---|
| 2472 | |
---|
| 2473 | %check the existence of the netcdf and image files involved |
---|
| 2474 | % %%%%%%%%%%%% case CIV1 activated %%%%%%%%%%%%% |
---|
| 2475 | if box_test(1)==1; |
---|
[112] | 2476 | detect=1; |
---|
[127] | 2477 | vers=0; |
---|
| 2478 | subdir_civ1_new=subdir_civ1; |
---|
[153] | 2479 | while detect==1 %create a new subdir if the netcdf files already exist |
---|
[122] | 2480 | for ifile=1:nbfield |
---|
[112] | 2481 | for j=1:nbslice |
---|
[122] | 2482 | 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] | 2483 | detect=exist(filename,'file')==2; |
---|
| 2484 | if detect% if a netcdf file already exists |
---|
[137] | 2485 | indstr=regexp(subdir_civ1_new,'\D'); |
---|
| 2486 | if indstr(end)<length(subdir_civ1_new) %subdir_civ1 ends by a number |
---|
| 2487 | vers=str2double(subdir_civ1_new(indstr(end)+1:end))+1; |
---|
| 2488 | subdir_civ1_new=[subdir_civ1_new(1:indstr(end)) num2str(vers)]; |
---|
[127] | 2489 | else |
---|
| 2490 | vers=vers+1; |
---|
[137] | 2491 | subdir_civ1_new=[subdir_civ1_new(1:indstr(end)) '_' num2str(vers)]; |
---|
[127] | 2492 | end |
---|
[137] | 2493 | subdir_civ2=subdir_civ1_new; |
---|
[112] | 2494 | break |
---|
| 2495 | end |
---|
| 2496 | filecell.nc.civ1(ifile,j)={filename}; |
---|
| 2497 | end |
---|
| 2498 | if detect% if a netcdf file already exists |
---|
| 2499 | break |
---|
| 2500 | end |
---|
| 2501 | end |
---|
[134] | 2502 | |
---|
[112] | 2503 | %create the new subdir_civ1 |
---|
[127] | 2504 | if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir') |
---|
[134] | 2505 | cd(Path_ima); |
---|
[128] | 2506 | [xx,msg1]=mkdir(subdir_civ1_new); |
---|
[134] | 2507 | |
---|
[128] | 2508 | if ~strcmp(msg1,'') |
---|
| 2509 | msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1])%error message for directory creation |
---|
[122] | 2510 | filecell={}; |
---|
| 2511 | return |
---|
[163] | 2512 | elseif isunix |
---|
[128] | 2513 | [xx,msg2] = fileattrib(subdir_civ1_new,'+w','g'); %yield writing access (+w) to user group (g) |
---|
| 2514 | if ~strcmp(msg2,'') |
---|
[134] | 2515 | msgbox_uvmat('ERROR',['pb of permission for ' subdir_civ1_new ': ' msg2])%error message for directory creation |
---|
[128] | 2516 | filecell={}; |
---|
| 2517 | return |
---|
| 2518 | end |
---|
[112] | 2519 | end |
---|
[134] | 2520 | cd(currentdir); |
---|
[112] | 2521 | end |
---|
| 2522 | if strcmp(compare,'stereo PIV')&&(strcmp(mode,'pair j1-j2')||strcmp(mode,'series(Dj)')||strcmp(mode,'series(Di)'))%check second nc series |
---|
| 2523 | for ifile=1:nbfield |
---|
| 2524 | for j=1:nbslice |
---|
[122] | 2525 | 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] | 2526 | detect=exist(filename,'file')==2; |
---|
[2] | 2527 | if detect% if a netcdf file already exists |
---|
[137] | 2528 | indstr=regexp(subdir_civ1_new,'\D'); |
---|
| 2529 | if indstr(end)<length(subdir_civ1_new) %subdir_civ1 ends by a number |
---|
| 2530 | vers=str2double(subdir_civ1_new(indstr(end)+1:end))+1; |
---|
| 2531 | subdir_civ1_new=[subdir_civ1_new(1:indstr(end)) num2str(vers)]; |
---|
[127] | 2532 | else |
---|
| 2533 | vers=vers+1; |
---|
[137] | 2534 | subdir_civ1_new=[subdir_civ1_new '_' num2str(vers)]; |
---|
[127] | 2535 | end |
---|
| 2536 | subdir_civ2=subdir_civ1; |
---|
| 2537 | break |
---|
[2] | 2538 | end |
---|
[112] | 2539 | filecell.ncA.civ1(ifile,j)={filename}; |
---|
| 2540 | end |
---|
| 2541 | if detect% if a netcdf file already exists |
---|
| 2542 | break |
---|
| 2543 | end |
---|
| 2544 | end |
---|
| 2545 | %create the new subdir_civ1 |
---|
[134] | 2546 | if exist(fullfile(Path_ima,subdir_civ1_new),'dir') |
---|
| 2547 | cd(Path_ima); |
---|
[128] | 2548 | [xx,msg1]=mkdir(subdir_civ1_new); |
---|
[134] | 2549 | cd(currentdir); |
---|
[252] | 2550 | if ~strcmp(msg1,'') |
---|
[128] | 2551 | msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1]) |
---|
[122] | 2552 | cd(currentdir) |
---|
| 2553 | filecell={}; |
---|
| 2554 | return |
---|
[128] | 2555 | else |
---|
| 2556 | [xx,msg2] = fileattrib(subdir_civ1_new,'+w','g'); %yield writing access (+w) to user group (g) |
---|
| 2557 | if ~strcmp(msg2,'') |
---|
| 2558 | msgbox_uvmat('ERROR',['pb of permission for ' subdir_civ1_new ': ' msg2])%error message for directory creation |
---|
| 2559 | cd(currentdir) |
---|
| 2560 | filecell={}; |
---|
| 2561 | return |
---|
| 2562 | end |
---|
[112] | 2563 | end |
---|
| 2564 | end |
---|
| 2565 | end |
---|
| 2566 | end |
---|
[127] | 2567 | subdir_civ1=subdir_civ1_new; |
---|
[2] | 2568 | % get image names |
---|
| 2569 | for ifile=1:nbfield |
---|
[112] | 2570 | for j=1:nbslice |
---|
[2] | 2571 | filename=name_generator(filebase_ima1, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); |
---|
| 2572 | idetect(j)=exist(filename,'file')==2; |
---|
| 2573 | filecell.ima1.civ1(ifile,j)={filename}; %first image |
---|
| 2574 | filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); |
---|
| 2575 | idetect_1(j)=exist(filename,'file')==2; |
---|
| 2576 | filecell.ima2.civ1(ifile,j)={filename};%second image |
---|
[112] | 2577 | end |
---|
| 2578 | [idetectmin,indexj]=min(idetect); |
---|
| 2579 | if idetectmin==0, |
---|
| 2580 | msgbox_uvmat('ERROR',[filecell.ima1.civ1{ifile,indexj} ' not found']) |
---|
[122] | 2581 | filecell={}; |
---|
| 2582 | cd(currentdir) |
---|
[112] | 2583 | return |
---|
| 2584 | end |
---|
| 2585 | [idetectmin,indexj]=min(idetect_1); |
---|
| 2586 | if idetectmin==0, |
---|
| 2587 | msgbox_uvmat('ERROR',[filecell.ima2.civ1{ifile,indexj} ' not found']) |
---|
[122] | 2588 | filecell={}; |
---|
[112] | 2589 | cd(currentdir) |
---|
| 2590 | return |
---|
| 2591 | end |
---|
| 2592 | end |
---|
| 2593 | if strcmp(compare,'stereo PIV') && (strcmp(mode,'pair j1-j2') || strcmp(mode,'series(Dj)') || strcmp(mode,'series(Di)')) |
---|
| 2594 | for ifile=1:nbfield |
---|
| 2595 | for j=1:nbslice |
---|
| 2596 | filename=name_generator(filebase_A, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); |
---|
| 2597 | idetect(j)=exist(filename,'file')==2; |
---|
| 2598 | filecell.imaA1.civ1(ifile,j)={filename} ;%first image |
---|
| 2599 | filename=name_generator(filebase_A, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); |
---|
| 2600 | idetect_1(j)=exist(filename,'file')==2; |
---|
| 2601 | filecell.imaA2.civ1(ifile,j)={filename};%second image |
---|
| 2602 | end |
---|
[2] | 2603 | [idetectmin,indexj]=min(idetect); |
---|
[112] | 2604 | if idetectmin==0, |
---|
| 2605 | msgbox_uvmat('ERROR',[filecell.imaA1.civ1{ifile,indexj} ' not found']) |
---|
[122] | 2606 | filecell={}; |
---|
[112] | 2607 | cd(currentdir) |
---|
[2] | 2608 | return |
---|
[112] | 2609 | end |
---|
[2] | 2610 | [idetectmin,indexj]=min(idetect_1); |
---|
[112] | 2611 | if idetectmin==0, |
---|
| 2612 | msgbox_uvmat('ERROR',[filecell.imaA2.civ1{ifile,indexj} ' not found']) |
---|
[122] | 2613 | filecell={}; |
---|
[2] | 2614 | cd(currentdir) |
---|
| 2615 | return |
---|
[112] | 2616 | end |
---|
| 2617 | end |
---|
[2] | 2618 | end |
---|
[112] | 2619 | |
---|
| 2620 | %%%%%%%%%%%%% fix1 or patch1 activated but no civ1 %%%%%%%%%%%%% |
---|
| 2621 | elseif (box_test(2)==1 || box_test(3)==1); |
---|
[2] | 2622 | for ifile=1:nbfield |
---|
| 2623 | for j=1:nbslice |
---|
| 2624 | filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',... |
---|
[112] | 2625 | nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% |
---|
| 2626 | detect=exist(filename,'file')==2; |
---|
[122] | 2627 | if detect==0 |
---|
| 2628 | msgbox_uvmat('ERROR',[filename ' not found']) |
---|
| 2629 | filecell={}; |
---|
| 2630 | cd(currentdir) |
---|
| 2631 | return |
---|
| 2632 | end |
---|
[2] | 2633 | filecell.nc.civ1(ifile,j)={filename}; |
---|
| 2634 | end |
---|
| 2635 | end |
---|
| 2636 | if strcmp(compare,'stereo PIV') |
---|
[112] | 2637 | for ifile=1:nbfield |
---|
| 2638 | for j=1:nbslice |
---|
| 2639 | 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);% |
---|
| 2640 | filecell.ncA.civ1(ifile,j)={filename}; |
---|
| 2641 | if ~exist(filename,'file') |
---|
| 2642 | msgbox_uvmat('ERROR',['input file ' filename ' not found']) |
---|
| 2643 | set(handles.RUN, 'Enable','On') |
---|
| 2644 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
[122] | 2645 | filecell={}; |
---|
[112] | 2646 | cd(currentdir) |
---|
| 2647 | return |
---|
[2] | 2648 | end |
---|
| 2649 | end |
---|
[112] | 2650 | end |
---|
[2] | 2651 | end |
---|
| 2652 | end |
---|
| 2653 | |
---|
| 2654 | %%%%%%%%%%%%% if civ2 performed with pairs different than civ1 %%%%%%%%%%%%% |
---|
| 2655 | testdiff=0; |
---|
| 2656 | if (box_test(4)==1)&&... |
---|
[127] | 2657 | ((get(handles.list_pair_civ1,'Value')~=get(handles.list_pair_civ2,'Value'))||~strcmp(subdir_civ2,subdir_civ1)) |
---|
[2] | 2658 | testdiff=1; |
---|
[112] | 2659 | detect=1; |
---|
[127] | 2660 | vers=0; |
---|
| 2661 | subdir_civ2_new=subdir_civ2; |
---|
[2] | 2662 | while detect==1 %create a new subdir if the netcdf files already exist |
---|
[112] | 2663 | for ifile=1:nbfield |
---|
| 2664 | for j=1:nbslice |
---|
[127] | 2665 | 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] | 2666 | detect=exist(filename,'file')==2; |
---|
| 2667 | if detect% if a netcdf file already exists |
---|
[127] | 2668 | indstr=regexp(subdir_civ2,'\D'); |
---|
| 2669 | if indstr(end)<length(subdir_civ2) %subdir_civ1 ends by a number |
---|
| 2670 | vers=str2double(subdir_civ2(indstr(end)+1:end))+1; |
---|
| 2671 | subdir_civ2_new=[subdir_civ2(1:indstr(end)) num2str(vers)]; |
---|
| 2672 | else |
---|
| 2673 | vers=vers+1; |
---|
| 2674 | subdir_civ2_new=[subdir_civ1 '_' num2str(vers)]; |
---|
| 2675 | end |
---|
[112] | 2676 | break |
---|
| 2677 | end |
---|
| 2678 | filecell.nc.civ2(ifile,j)={filename}; |
---|
| 2679 | end |
---|
| 2680 | if detect% if a netcdf file already exists |
---|
| 2681 | break |
---|
| 2682 | end |
---|
| 2683 | end |
---|
[128] | 2684 | %create the new subdir_civ2_new |
---|
| 2685 | if ~exist(fullfile(Path_ima,subdir_civ2_new),'dir') |
---|
[174] | 2686 | [xx,m2]=mkdir(fullfile(Path_ima,subdir_civ2_new)); |
---|
[128] | 2687 | [xx,msg2] = fileattrib(subdir_civ2_new,'+w','g'); %yield writing access (+w) to user group (g) |
---|
[112] | 2688 | if ~isequal(m2,'') |
---|
[128] | 2689 | msgbox_uvmat('ERROR',['cannot create ' subdir_civ2_new ': ' m2]) |
---|
[122] | 2690 | filecell={}; |
---|
| 2691 | cd(currentdir) |
---|
| 2692 | return |
---|
[112] | 2693 | end |
---|
| 2694 | end |
---|
| 2695 | if strcmp(compare,'stereo PIV')%check second nc series |
---|
| 2696 | for ifile=1:nbfield |
---|
| 2697 | for j=1:nbslice |
---|
| 2698 | filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
[122] | 2699 | nom_type_nc,1,num2_civ2(ifile),num_b_civ1(j),subdir_civ2_new);% |
---|
[112] | 2700 | detect=exist(filename,'file')==2; |
---|
[2] | 2701 | if detect% if a netcdf file already exists |
---|
[127] | 2702 | indstr=regexp(subdir_civ2,'\D'); |
---|
| 2703 | if indstr(end)<length(subdir_civ2) %subdir_civ1 ends by a number |
---|
| 2704 | vers=str2double(subdir_civ2(indstr(end)+1:end))+1; |
---|
| 2705 | subdir_civ2_new=[subdir_civ2(1:indstr(end)) num2str(vers)]; |
---|
| 2706 | else |
---|
| 2707 | vers=vers+1; |
---|
| 2708 | subdir_civ2_new=[subdir_civ1 '_' num2str(vers)]; |
---|
| 2709 | end |
---|
[112] | 2710 | break |
---|
[2] | 2711 | end |
---|
[112] | 2712 | filecell.ncA.civ2(ifile,j)={filename}; |
---|
| 2713 | end |
---|
| 2714 | if detect% if a netcdf file already exists |
---|
| 2715 | break |
---|
| 2716 | end |
---|
| 2717 | end |
---|
[122] | 2718 | subdir_civ2=subdir_civ2_new; |
---|
[112] | 2719 | %create the new subdir_civ1 |
---|
[127] | 2720 | if ~exist(fullfile(Path_ima,subdir_civ2_new),'dir') |
---|
| 2721 | [xx,m2]=mkdir(subdir_civ2_new); |
---|
[128] | 2722 | [xx,msg2] = fileattrib(subdir_civ2_new,'+w','g'); %yield writing access (+w) to user group (g) |
---|
[112] | 2723 | if ~isequal(m2,'') |
---|
[128] | 2724 | msgbox_uvmat('ERROR', ['cannot create ' subdir_civ2_new ': ' m2])%error message for directory creation |
---|
[122] | 2725 | cd(currentdir) |
---|
| 2726 | filecell={}; |
---|
| 2727 | return |
---|
[112] | 2728 | end |
---|
| 2729 | end |
---|
| 2730 | end |
---|
| 2731 | end |
---|
[127] | 2732 | subdir_civ2=subdir_civ2_new; |
---|
[2] | 2733 | end |
---|
| 2734 | cd(currentdir);%come back to the current working directory |
---|
| 2735 | |
---|
| 2736 | %%%%%%%%%%%%% if civ2 results are obtained or used %%%%%%%%%%%%% |
---|
| 2737 | if box_test(4)==1 || box_test(5)==1 || box_test(6)==1 %civ2 |
---|
| 2738 | %check source netcdf file of civ1 estimates |
---|
| 2739 | if box_test(1)==0; %no civ1 performed |
---|
| 2740 | for ifile=1:nbfield |
---|
| 2741 | for j=1:nbslice |
---|
| 2742 | filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',... |
---|
| 2743 | nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% |
---|
| 2744 | filecell.nc.civ1(ifile,j)={filename};% name of the civ1 file |
---|
| 2745 | if ~exist(filename,'file') |
---|
| 2746 | msgbox_uvmat('ERROR',['input file ' filename ' not found']) |
---|
[122] | 2747 | filecell={}; |
---|
[2] | 2748 | return |
---|
| 2749 | end |
---|
| 2750 | if ~testdiff % civ2 or patch2 are written in the same file as civ1 |
---|
| 2751 | if box_test(4)==0 ; %check the existence of civ2 if it is not calculated |
---|
[248] | 2752 | Data=nc2struct(filename,'ListGlobalAttribute','CivStage','civ2'); |
---|
| 2753 | if ~isempty(Data.CivStage) && Data.CivStage<4 %test for civ files |
---|
[2] | 2754 | msgbox_uvmat('ERROR',['no civ2 data in ' filename]) |
---|
[12] | 2755 | filecell=[]; |
---|
[2] | 2756 | return |
---|
[248] | 2757 | elseif isempty(Data.civ2)||isequal(Data.civ2,0) |
---|
| 2758 | msgbox_uvmat('ERROR',['no civ2 data in ' filename]) |
---|
| 2759 | filecell=[]; |
---|
| 2760 | return |
---|
[112] | 2761 | end |
---|
[2] | 2762 | elseif box_test(3)==0; %check the existence of patch if it is not calculated |
---|
[248] | 2763 | Data=nc2struct(filename,'ListGlobalAttribute','CivStage','patch') |
---|
| 2764 | if ~isempty(Data.CivStage) |
---|
| 2765 | if Data.CivStage<3 %test for civ files |
---|
| 2766 | msgbox_uvmat('ERROR',['no patch data in ' filename]) |
---|
| 2767 | filecell=[]; |
---|
| 2768 | return |
---|
| 2769 | end |
---|
| 2770 | elseif isempty(Data.patch)||isequal(Data.patch,0) |
---|
[2] | 2771 | msgbox_uvmat('ERROR',['no patch data in ' filename]) |
---|
[12] | 2772 | filecell=[]; |
---|
[2] | 2773 | return |
---|
| 2774 | end |
---|
[112] | 2775 | end |
---|
[2] | 2776 | end |
---|
| 2777 | end |
---|
| 2778 | end |
---|
| 2779 | if strcmp(compare,'stereo PIV') |
---|
| 2780 | for ifile=1:nbfield |
---|
| 2781 | for j=1:nbslice |
---|
| 2782 | filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
| 2783 | nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% |
---|
| 2784 | filecell.ncA.civ2(ifile,j)={filename}; |
---|
| 2785 | if ~exist(filename,'file') |
---|
| 2786 | msgbox_uvmat('ERROR',['input file ' filename ' not found']) |
---|
| 2787 | set(handles.RUN, 'Enable','On') |
---|
| 2788 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
| 2789 | return |
---|
| 2790 | end |
---|
| 2791 | end |
---|
| 2792 | end |
---|
| 2793 | end |
---|
| 2794 | end |
---|
[112] | 2795 | |
---|
| 2796 | detect=1; |
---|
| 2797 | % while detect==1%creates a new subdir if the netcdf files already contain civ2 data |
---|
| 2798 | for ifile=1:nbfield |
---|
| 2799 | for j=1:nbslice |
---|
| 2800 | filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
[2] | 2801 | nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2); |
---|
[112] | 2802 | detect=exist(filename,'file')==2; |
---|
| 2803 | filecell.nc.civ2(ifile,j)={filename}; |
---|
[2] | 2804 | end |
---|
[112] | 2805 | end |
---|
[2] | 2806 | %get first image names for civ2 |
---|
| 2807 | if box_test(1)==1 & isequal(num1_civ1,num1_civ2) & isequal(num_a_civ1,num_a_civ2) |
---|
| 2808 | filecell.ima1.civ2=filecell.ima1.civ1; |
---|
| 2809 | elseif box_test(4)==1 |
---|
| 2810 | for ifile=1:nbfield |
---|
| 2811 | for j=1:nbslice |
---|
| 2812 | filename=name_generator(filebase_ima1, num1_civ2(ifile),num_a_civ2(j),ext_ima,nom_type_ima1); |
---|
| 2813 | idetect_2(j)=exist(filename,'file')==2; |
---|
| 2814 | filecell.ima1.civ2(ifile,j)={filename};%first image |
---|
| 2815 | end |
---|
[112] | 2816 | [idetectmin,indexj]=min(idetect_2); |
---|
[2] | 2817 | if idetectmin==0, |
---|
[112] | 2818 | msgbox_uvmat('ERROR',['input image ' filecell.ima1.civ2{ifile,indexj} ' not found']) |
---|
| 2819 | filecell=[]; |
---|
| 2820 | return |
---|
[2] | 2821 | end |
---|
| 2822 | end |
---|
| 2823 | end |
---|
| 2824 | |
---|
| 2825 | %get second image names for civ2 |
---|
| 2826 | if box_test(1)==1 & isequal(num2_civ1,num2_civ2) & isequal(num_b_civ1,num_b_civ2) |
---|
| 2827 | filecell.ima2.civ2=filecell.ima2.civ1; |
---|
| 2828 | elseif box_test(4)==1 |
---|
| 2829 | for ifile=1:nbfield |
---|
| 2830 | for j=1:nbslice |
---|
| 2831 | filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),ext_ima,nom_type_ima2); |
---|
| 2832 | idetect_3(j)=exist(filename,'file')==2; |
---|
| 2833 | filecell.ima2.civ2(ifile,j)={filename};%first image |
---|
| 2834 | end |
---|
[112] | 2835 | [idetectmin,indexj]=min(idetect_3); |
---|
[2] | 2836 | if idetectmin==0, |
---|
[112] | 2837 | msgbox_uvmat('ERROR',['input image ' filecell.ima2.civ2{ifile,indexj} ' not found']) |
---|
| 2838 | filecell=[]; |
---|
| 2839 | return |
---|
[2] | 2840 | end |
---|
| 2841 | end |
---|
| 2842 | end |
---|
| 2843 | end |
---|
| 2844 | if (box_test(5)==1 || box_test(6)==1 ) && box_test(4)==0 % need to read an existing netcdf civ2 file |
---|
| 2845 | if ~testdiff |
---|
| 2846 | filecell.nc.civ2=filecell.nc.civ1;% file already checked |
---|
[112] | 2847 | else % check the civ2 files |
---|
[2] | 2848 | for ifile=1:nbfield |
---|
| 2849 | for j=1:nbslice |
---|
| 2850 | filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
[112] | 2851 | nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% |
---|
[2] | 2852 | filecell.nc.civ2(ifile,j)={filename}; |
---|
| 2853 | if ~exist(filename,'file') |
---|
| 2854 | msgbox_uvmat('ERROR',['input file ' filename ' not found']) |
---|
[12] | 2855 | filecell=[]; |
---|
[2] | 2856 | return |
---|
| 2857 | else |
---|
[248] | 2858 | Data=nc2struct(filename,'ListGlobalAttribute','CivStage','civ2'); |
---|
| 2859 | if ~isempty(Data.CivStage) && Data.CivStage<4 %test for civ files |
---|
| 2860 | msgbox_uvmat('ERROR',['no civ2 data in ' filename]) |
---|
| 2861 | filecell=[]; |
---|
| 2862 | return |
---|
| 2863 | elseif isempty(Data.civ2)||isequal(Data.civ2,0) |
---|
[2] | 2864 | msgbox_uvmat('ERROR',['no civ2 data in ' filename]) |
---|
[12] | 2865 | filecell=[]; |
---|
[2] | 2866 | return |
---|
| 2867 | end |
---|
| 2868 | end |
---|
| 2869 | end |
---|
| 2870 | end |
---|
| 2871 | end |
---|
| 2872 | end |
---|
| 2873 | |
---|
| 2874 | %%%%%%%%%%%%% if stereo fields are calculated by PATCH %%%%%%%%%%%%% |
---|
| 2875 | if strcmp(compare,'stereo PIV') |
---|
[127] | 2876 | if box_test(3)==1 && isequal(get(handles.test_stereo1,'Value'),1) |
---|
[2] | 2877 | for ifile=1:nbfield |
---|
| 2878 | for j=1:nbslice |
---|
| 2879 | filename=name_generator(filebase_AB,num1_civ1(ifile),num_a_civ1(j),'.nc',... |
---|
| 2880 | nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% |
---|
| 2881 | filecell.st(ifile,j)={filename}; |
---|
| 2882 | end |
---|
| 2883 | end |
---|
| 2884 | end |
---|
[127] | 2885 | if box_test(6)==1 && isequal(get(handles.test_stereo2,'Value'),1) |
---|
[2] | 2886 | for ifile=1:nbfield |
---|
| 2887 | for j=1:nbslice |
---|
| 2888 | filename=name_generator(filebase_AB,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
| 2889 | nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% |
---|
| 2890 | filecell.st(ifile,j)={filename}; |
---|
| 2891 | end |
---|
| 2892 | end |
---|
[112] | 2893 | end |
---|
[2] | 2894 | end |
---|
| 2895 | set(handles.subdir_civ1,'String',subdir_civ1);%update the edit box |
---|
| 2896 | set(handles.subdir_civ2,'String',subdir_civ2);%update the edit box |
---|
| 2897 | browse.nom_type_nc=nom_type_nc; |
---|
| 2898 | set(handles.browse_root,'UserData',browse); %update the nomenclature type for uvmat |
---|
| 2899 | |
---|
| 2900 | |
---|
| 2901 | %COPY IMAGES TO THE FORMAT .png IF NEEDED |
---|
[45] | 2902 | if isequal(nom_type_ima1,'*')%case of movie files |
---|
| 2903 | nom_type_imanew1='_i'; |
---|
[2] | 2904 | else |
---|
| 2905 | nom_type_imanew1=nom_type_ima1; |
---|
| 2906 | end |
---|
[45] | 2907 | if isequal(nom_type_ima2,'*')%case of movie files |
---|
| 2908 | nom_type_imanew2='_i'; |
---|
[2] | 2909 | else |
---|
| 2910 | nom_type_imanew2=nom_type_ima2; |
---|
| 2911 | end |
---|
| 2912 | if ~isequal(ext_ima,'.png') |
---|
[45] | 2913 | %%type of image file |
---|
| 2914 | type_ima1='none';%default |
---|
| 2915 | movieobject1=[];%default |
---|
[133] | 2916 | if strcmpi(ext_ima,'.avi') |
---|
[45] | 2917 | hhh=which('mmreader'); |
---|
| 2918 | if ~isequal(hhh,'')&& mmreader.isPlatformSupported()% if the mmreader function is found (recent version of matlab) |
---|
| 2919 | type_ima1='movie'; |
---|
| 2920 | movieobject1=mmreader([filebase_ima2 ext_ima]); |
---|
| 2921 | else |
---|
| 2922 | type_ima1='avi'; |
---|
| 2923 | end |
---|
[133] | 2924 | elseif ischar(ext_ima) && ~isempty(ext_ima(2:end)) |
---|
[112] | 2925 | form=imformats(ext_ima(2:end)); |
---|
| 2926 | if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab |
---|
| 2927 | if isequal(nom_type_ima1,'*'); |
---|
| 2928 | type_ima1='multimage';%image series in a single image file |
---|
| 2929 | else |
---|
| 2930 | type_ima1='image'; |
---|
| 2931 | end |
---|
| 2932 | end |
---|
[45] | 2933 | end |
---|
| 2934 | type_ima2='none';%default |
---|
| 2935 | movieobject2=[]; |
---|
[133] | 2936 | if strcmpi(ext_ima,'.avi') |
---|
[45] | 2937 | hhh=which('mmreader'); |
---|
| 2938 | if ~isequal(hhh,'')&& mmreader.isPlatformSupported()% if the mmreader function is found (recent version of matlab) |
---|
| 2939 | type_ima2='movie'; |
---|
| 2940 | movieobject2=mmreader([filebase_ima2 ext_ima]); |
---|
| 2941 | else |
---|
| 2942 | type_ima2='avi'; |
---|
| 2943 | end |
---|
[133] | 2944 | elseif ischar(ext_ima) && ~isempty(ext_ima(2:end)) |
---|
[112] | 2945 | form=imformats(ext_ima(2:end)); |
---|
| 2946 | if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab |
---|
| 2947 | if isequal(nom_type_ima1,'*'); |
---|
| 2948 | type_ima2='multimage';%image series in a single image file |
---|
| 2949 | else |
---|
| 2950 | type_ima2='image'; |
---|
| 2951 | end |
---|
| 2952 | end |
---|
[45] | 2953 | end |
---|
[71] | 2954 | %npxy=get(handles.ImaExt,'UserData'); |
---|
[112] | 2955 | % % if numel(npxy)<2 |
---|
| 2956 | % |
---|
| 2957 | % filename=name_generator(filebase_ima1,num1_civ1(1),num_a_civ1(1),ImaExt,nom_type_ima1); |
---|
| 2958 | % A=imread(filename); |
---|
| 2959 | % npxy=size(A); |
---|
| 2960 | % % end |
---|
| 2961 | % npy=npxy(1); |
---|
| 2962 | % npx=npxy(2); |
---|
[2] | 2963 | if box_test(1)==1 %if civ1 is performed |
---|
[224] | 2964 | h = waitbar(0,'copy images to the .png format for civ1');% display a wait bar |
---|
[112] | 2965 | for ifile=1:nbfield |
---|
[2] | 2966 | waitbar(ifile/nbfield); |
---|
| 2967 | for j=1:nbslice |
---|
[112] | 2968 | filename=name_generator(filebase_ima1,num1_civ1(ifile),num_a_civ1(j),'.png',nom_type_imanew1); |
---|
| 2969 | if ~exist(filename,'file') |
---|
| 2970 | A=read_image(filecell.ima1.civ1{ifile,j},type_ima1,num1_civ1(ifile),movieobject1); |
---|
| 2971 | imwrite(A,filename,'BitDepth',16); |
---|
| 2972 | end |
---|
| 2973 | filecell.ima1.civ1(ifile,j)={filename}; |
---|
| 2974 | filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),'.png',nom_type_imanew2); |
---|
| 2975 | if ~exist(filename,'file') |
---|
| 2976 | A=read_image(filecell.ima2.civ1{ifile,j},type_ima2,num2_civ1(ifile),movieobject2); |
---|
| 2977 | imwrite(A,filename,'BitDepth',16); |
---|
| 2978 | end |
---|
| 2979 | filecell.ima2.civ1(ifile,j)={filename}; |
---|
[2] | 2980 | end |
---|
| 2981 | end |
---|
| 2982 | close(h) |
---|
| 2983 | end |
---|
| 2984 | if box_test(4)==1 %if civ2 is performed |
---|
[229] | 2985 | h = waitbar(0,'copy images to the .png format for civ2');% display a wait bar |
---|
[2] | 2986 | for ifile=1:nbfield |
---|
| 2987 | waitbar(ifile/nbfield); |
---|
| 2988 | for j=1:nbslice |
---|
[112] | 2989 | filename=name_generator(filebase_ima1,num1_civ2(ifile),num_a_civ2(j),'.png',nom_type_imanew1); |
---|
| 2990 | if ~exist(filename,'file') |
---|
| 2991 | A=read_image(cell2mat(filecell.ima1.civ2(ifile,j)),type_ima2,num1_civ2(ifile)); |
---|
| 2992 | imwrite(A,filename,'BitDepth',16); |
---|
| 2993 | end |
---|
| 2994 | filecell.ima1.civ2(ifile,j)={filename}; |
---|
| 2995 | filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),'.png',nom_type_imanew2); |
---|
| 2996 | if ~exist(filename,'file') |
---|
| 2997 | A=read_image(cell2mat(filecell.ima2.civ2(ifile,j)),type_ima2,num2_civ2(ifile)); |
---|
| 2998 | imwrite(A,filename,'BitDepth',16); |
---|
| 2999 | end |
---|
| 3000 | filecell.ima2.civ2(ifile,j)={filename}; |
---|
[2] | 3001 | end |
---|
| 3002 | end |
---|
| 3003 | close(h); |
---|
| 3004 | end |
---|
| 3005 | end |
---|
| 3006 | |
---|
[12] | 3007 | %------------------------------------------------------------------------ |
---|
[227] | 3008 | % --- determine the list of index pairs of processing file |
---|
| 3009 | function [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... |
---|
| 3010 | find_pair_indices(handles,ref_i,ref_j,mode) |
---|
| 3011 | %------------------------------------------------------------------------ |
---|
| 3012 | |
---|
| 3013 | list_civ1=get(handles.list_pair_civ1,'String'); |
---|
| 3014 | index_civ1=get(handles.list_pair_civ1,'Value'); |
---|
| 3015 | str_civ1=list_civ1{index_civ1};%string defining the image pairs for civ1 |
---|
| 3016 | if isempty(str_civ1)||isequal(str_civ1,'') |
---|
| 3017 | msgbox_uvmat('ERROR','no image pair selected for civ1') |
---|
| 3018 | return |
---|
| 3019 | end |
---|
| 3020 | list_civ2=get(handles.list_pair_civ2,'String'); |
---|
| 3021 | index_civ2=get(handles.list_pair_civ2,'Value'); |
---|
| 3022 | if index_civ2>length(list_civ2) |
---|
| 3023 | list_civ2=list_civ1; |
---|
| 3024 | index_civ2=index_civ1; |
---|
| 3025 | end |
---|
| 3026 | str_civ2=list_civ2{index_civ2};%string defining the image pairs for civ2 |
---|
| 3027 | |
---|
| 3028 | if isequal (mode,'series(Di)') |
---|
| 3029 | lastfield=str2double(get(handles.nb_field,'String')); |
---|
| 3030 | num1_civ1=ref_i-floor(index_civ1/2)*ones(size(ref_i));% set of first image numbers |
---|
| 3031 | num2_civ1=ref_i+ceil(index_civ1/2)*ones(size(ref_i)); |
---|
| 3032 | num_a_civ1=ref_j; |
---|
| 3033 | num_b_civ1=ref_j; |
---|
[229] | 3034 | num1_civ2=ref_i-floor(index_civ2/2)*ones(size(ref_i)); |
---|
[227] | 3035 | num2_civ2=ref_i+ceil(index_civ2/2)*ones(size(ref_i)); |
---|
| 3036 | num_a_civ2=ref_j; |
---|
| 3037 | num_b_civ2=ref_j; |
---|
| 3038 | |
---|
| 3039 | % adjust the first and last field number |
---|
| 3040 | lastfield=str2double(get(handles.nb_field,'String')); |
---|
| 3041 | if isnan(lastfield) |
---|
| 3042 | indsel=find((num1_civ1 >= 1)&(num1_civ2 >= 1)); |
---|
| 3043 | else |
---|
| 3044 | indsel=find((num2_civ1 <= lastfield)&(num2_civ2 <= lastfield)&(num1_civ1 >= 1)&(num1_civ2 >= 1)); |
---|
| 3045 | end |
---|
| 3046 | if length(indsel)>=1 |
---|
| 3047 | firstind=indsel(1); |
---|
| 3048 | lastind=indsel(end); |
---|
| 3049 | set(handles.first_i,'String',num2str(ref_i(firstind)))%update the display of first and last fields |
---|
| 3050 | set(handles.last_i,'String',num2str(ref_i(lastind))) |
---|
| 3051 | ref_i=ref_i(indsel); |
---|
| 3052 | num1_civ1=num1_civ1(indsel); |
---|
| 3053 | num1_civ2=num1_civ2(indsel); |
---|
| 3054 | num2_civ1=num2_civ1(indsel); |
---|
| 3055 | num2_civ2=num2_civ2(indsel); |
---|
| 3056 | end |
---|
| 3057 | elseif isequal (mode,'series(Dj)') |
---|
| 3058 | lastfield_j=str2double(get(handles.nb_field2,'String')); |
---|
| 3059 | num1_civ1=ref_i;% set of first image numbers |
---|
| 3060 | num2_civ1=ref_i; |
---|
| 3061 | num_a_civ1=ref_j-floor(index_civ1/2)*ones(size(ref_j)); |
---|
| 3062 | num_b_civ1=ref_j+ceil(index_civ1/2)*ones(size(ref_j)); |
---|
| 3063 | num1_civ2=ref_i; |
---|
| 3064 | num2_civ2=ref_i; |
---|
| 3065 | num_a_civ2=ref_j-floor(index_civ2/2)*ones(size(ref_j)); |
---|
| 3066 | num_b_civ2=ref_j+ceil(index_civ2/2)*ones(size(ref_j)); |
---|
| 3067 | % adjust the first and last field number |
---|
| 3068 | if isnan(lastfield_j) |
---|
| 3069 | indsel=find((num_a_civ1 >= 1)&(num_a_civ2 >= 1)); |
---|
| 3070 | else |
---|
| 3071 | indsel=find((num_b_civ1 <= lastfield_j)&(num_b_civ2 <= lastfield_j)&(num_a_civ1 >= 1)&(num_a_civ2 >= 1)); |
---|
| 3072 | end |
---|
| 3073 | if length(indsel)>=1 |
---|
| 3074 | firstind=indsel(1); |
---|
| 3075 | lastind=indsel(end); |
---|
| 3076 | set(handles.first_j,'String',num2str(ref_j(firstind)))%update the display of first and last fields |
---|
| 3077 | set(handles.last_j,'String',num2str(ref_j(lastind))) |
---|
| 3078 | ref_j=ref_j(indsel); |
---|
| 3079 | num_a_civ1=num_a_civ1(indsel); |
---|
| 3080 | num_b_civ1=num_b_civ1(indsel); |
---|
| 3081 | num_a_civ2=num_a_civ2(indsel); |
---|
| 3082 | num_b_civ2=num_b_civ2(indsel); |
---|
| 3083 | end |
---|
| 3084 | elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) |
---|
| 3085 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
| 3086 | num1_civ1=ref_i; |
---|
| 3087 | num2_civ1=ref_i; |
---|
| 3088 | num_a_civ1=displ_num(1,index_civ1); |
---|
| 3089 | num_b_civ1=displ_num(2,index_civ1); |
---|
| 3090 | num1_civ2=ref_i; |
---|
| 3091 | num2_civ2=ref_i; |
---|
| 3092 | num_a_civ2=displ_num(1,index_civ2); |
---|
| 3093 | num_b_civ2=displ_num(2,index_civ2); |
---|
| 3094 | elseif isequal(mode,'displacement') |
---|
| 3095 | num1_civ1=ref_i; |
---|
| 3096 | num2_civ1=ref_i; |
---|
| 3097 | num_a_civ1=ref_j; |
---|
| 3098 | num_b_civ1=ref_j; |
---|
| 3099 | num1_civ2=ref_i; |
---|
| 3100 | num2_civ2=ref_i; |
---|
| 3101 | num_a_civ2=ref_j; |
---|
| 3102 | num_b_civ2=ref_j; |
---|
| 3103 | end |
---|
| 3104 | |
---|
| 3105 | |
---|
| 3106 | %------------------------------------------------------------------------ |
---|
[12] | 3107 | % --- PATCH |
---|
[94] | 3108 | function cmd_PATCH=PATCH_CMD(filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,test_interp,PatchBin) |
---|
[12] | 3109 | %------------------------------------------------------------------------ |
---|
[224] | 3110 | namelog=[filename_nc(1:end-3) '_patch.log']; |
---|
[112] | 3111 | if test_interp==0 |
---|
[163] | 3112 | if isunix |
---|
[112] | 3113 | cmd_PATCH=[PatchBin ' -f ' filename_nc ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ... |
---|
| 3114 | ' > ' namelog ' 2>&1']; % redirect standard output to the log file |
---|
[163] | 3115 | else |
---|
| 3116 | cmd_PATCH=['"' PatchBin '" -f "' filename_nc '" -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ... |
---|
| 3117 | ' > "' namelog '" 2>&1']; % redirect standard output to the log file |
---|
| 3118 | end |
---|
[112] | 3119 | else %nouveau programme patch |
---|
| 3120 | cmd_PATCH=[PatchBin ' -f ' filename_nc ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ... |
---|
| 3121 | ' -max ' thresh_value ' -nopt ' subdomain_patch ' > ' namelog ' 2>&1']; % redirect standard output to the log file |
---|
| 3122 | end |
---|
[163] | 3123 | cmd_PATCH=regexprep(cmd_PATCH,'\\','\\\\'); |
---|
[12] | 3124 | %------------------------------------------------------------------------ |
---|
| 3125 | % --- STEREO Interp |
---|
[67] | 3126 | 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] | 3127 | %------------------------------------------------------------------------ |
---|
[224] | 3128 | namelog=[filename_nc(1:end-3) '_stinterp.log']; |
---|
[67] | 3129 | cmd=[stinterpBin ' -f1 ' filename_A_nc ' -f2 ' filename_B_nc ' -f ' filename_nc ... |
---|
[2] | 3130 | ' -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 |
---|
| 3131 | |
---|
[12] | 3132 | %------------------------------------------------------------------------ |
---|
[2] | 3133 | % --- Executes on button press in CIV1. |
---|
| 3134 | function CIV1_Callback(hObject, eventdata, handles) |
---|
[12] | 3135 | %------------------------------------------------------------------------ |
---|
[2] | 3136 | val=get(handles.CIV1,'Value'); |
---|
| 3137 | if isequal(val,1) |
---|
| 3138 | enable_civ1(handles,'on') |
---|
| 3139 | enable_pair1(handles,'on') |
---|
| 3140 | else |
---|
| 3141 | enable_civ1(handles,'off') |
---|
| 3142 | end |
---|
| 3143 | find_netcpair_civ1(hObject, eventdata, handles); |
---|
| 3144 | |
---|
[12] | 3145 | %------------------------------------------------------------------------ |
---|
[2] | 3146 | % --- Executes on button press in FIX1. |
---|
| 3147 | function FIX1_Callback(hObject, eventdata, handles) |
---|
[12] | 3148 | %------------------------------------------------------------------------ |
---|
[2] | 3149 | enable_fix1(handles,get(handles.FIX1,'Value')) |
---|
| 3150 | |
---|
[12] | 3151 | %------------------------------------------------------------------------ |
---|
[2] | 3152 | % --- Executes on button press in PATCH1. |
---|
| 3153 | function PATCH1_Callback(hObject, eventdata, handles) |
---|
[12] | 3154 | %------------------------------------------------------------------------ |
---|
[2] | 3155 | if get(handles.PATCH1,'Value')==1 |
---|
[12] | 3156 | enable_patch1(handles) |
---|
[2] | 3157 | else |
---|
[12] | 3158 | desable_patch1(handles) |
---|
[2] | 3159 | end |
---|
| 3160 | |
---|
[12] | 3161 | %------------------------------------------------------------------------ |
---|
[2] | 3162 | % --- Executes on button press in CIV2. |
---|
| 3163 | function CIV2_Callback(hObject, eventdata, handles) |
---|
[12] | 3164 | %------------------------------------------------------------------------ |
---|
[2] | 3165 | state=get(handles.CIV2,'Value'); |
---|
| 3166 | enable_civ2(handles,state) |
---|
| 3167 | if state |
---|
| 3168 | find_netcpair_civ2(hObject, eventdata, handles) |
---|
| 3169 | enable_pair1(handles,'on') |
---|
| 3170 | end |
---|
| 3171 | |
---|
[12] | 3172 | %------------------------------------------------------------------------ |
---|
[2] | 3173 | % --- Executes on button press in FIX2. |
---|
| 3174 | function FIX2_Callback(hObject, eventdata, handles) |
---|
[12] | 3175 | %------------------------------------------------------------------------ |
---|
[2] | 3176 | if get(handles.FIX2,'Value')==1 |
---|
| 3177 | enable_fix2(handles) |
---|
| 3178 | if get(handles.CIV2,'Value')==0 |
---|
| 3179 | find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files |
---|
| 3180 | end |
---|
| 3181 | else |
---|
| 3182 | desable_fix2(handles) |
---|
| 3183 | end |
---|
| 3184 | |
---|
[12] | 3185 | %------------------------------------------------------------------------ |
---|
[2] | 3186 | % --- Executes on button press in PATCH2. |
---|
| 3187 | function PATCH2_Callback(hObject, eventdata, handles) |
---|
[12] | 3188 | %------------------------------------------------------------------------ |
---|
[2] | 3189 | if get(handles.PATCH2,'Value')==1 |
---|
| 3190 | enable_patch2(handles) |
---|
| 3191 | if get(handles.CIV2,'Value')==0 |
---|
| 3192 | find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files |
---|
| 3193 | end |
---|
| 3194 | else |
---|
| 3195 | desable_patch2(handles) |
---|
| 3196 | end |
---|
| 3197 | |
---|
[12] | 3198 | %------------------------------------------------------------------------ |
---|
| 3199 | function first_i_Callback(hObject, eventdata, handles) |
---|
| 3200 | %------------------------------------------------------------------------ |
---|
| 3201 | % last_i_Callback(hObject, eventdata, handles) |
---|
[137] | 3202 | first_i=str2double(get(handles.first_i,'String')); |
---|
[12] | 3203 | % last_i=str2num(get(handles.last_i,'String')); |
---|
| 3204 | % ref_i=ceil((first_i+last_i)/2); |
---|
| 3205 | set(handles.ref_i,'String', num2str(first_i))% reference index for pair dt = first index |
---|
[71] | 3206 | set(handles.ref_i_civ2,'String', num2str(first_i))% reference index for pair dt = first index |
---|
[12] | 3207 | ref_i_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) |
---|
[2] | 3208 | |
---|
[12] | 3209 | %------------------------------------------------------------------------ |
---|
| 3210 | function first_j_Callback(hObject, eventdata, handles) |
---|
| 3211 | %------------------------------------------------------------------------ |
---|
| 3212 | first_j=str2num(get(handles.first_j,'String')); |
---|
| 3213 | set(handles.ref_j,'String', num2str(first_j))% reference index for pair dt = first index |
---|
| 3214 | ref_j_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) |
---|
[2] | 3215 | |
---|
[12] | 3216 | %------------------------------------------------------------------------ |
---|
[2] | 3217 | % --- Executes on button press in calcul_search: determine the search range isx,isy |
---|
| 3218 | function calcul_search_Callback(hObject, eventdata, handles) |
---|
[12] | 3219 | %------------------------------------------------------------------------ |
---|
[2] | 3220 | %determine pair numbers |
---|
| 3221 | list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs |
---|
| 3222 | index=get(handles.list_pair_civ1,'Value'); |
---|
| 3223 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
[71] | 3224 | time=get(handles.RootName,'UserData'); %get the set of times |
---|
[2] | 3225 | pxcm_xy=get(handles.calcul_search,'UserData'); |
---|
| 3226 | pxcmx=pxcm_xy(1); |
---|
| 3227 | pxcmy=pxcm_xy(2); |
---|
| 3228 | mode_list=get(handles.mode,'String'); |
---|
| 3229 | mode_value=get(handles.mode,'Value'); |
---|
| 3230 | mode=mode_list{mode_value}; |
---|
| 3231 | if isequal (mode, 'series(Di)' ) |
---|
[137] | 3232 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
[2] | 3233 | num1=ref_i-floor(index/2);% first image numbers |
---|
| 3234 | num2=ref_i+ceil(index/2); |
---|
| 3235 | num_a=1; |
---|
| 3236 | num_b=1; |
---|
[112] | 3237 | elseif isequal (mode, 'series(Dj)') |
---|
[2] | 3238 | num1=1; |
---|
| 3239 | num2=1; |
---|
[137] | 3240 | ref_j=str2double(get(handles.ref_j,'String')); |
---|
[2] | 3241 | num_a=ref_j-floor(index/2);% first image numbers |
---|
| 3242 | num_b=ref_j+ceil(index/2); |
---|
| 3243 | elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) |
---|
[137] | 3244 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
[2] | 3245 | num1=ref_i; |
---|
| 3246 | num2=ref_i; |
---|
| 3247 | num_a=displ_num(1,index); |
---|
| 3248 | num_b=displ_num(2,index); |
---|
| 3249 | end |
---|
| 3250 | dt=time(num2,num_b)-time(num1,num_a); |
---|
[137] | 3251 | ibx=str2double(get(handles.ibx,'String')); |
---|
| 3252 | iby=str2double(get(handles.iby,'String')); |
---|
| 3253 | umin=dt*pxcmx*str2double(get(handles.umin,'String')); |
---|
| 3254 | umax=dt*pxcmx*str2double(get(handles.umax,'String')); |
---|
| 3255 | vmin=dt*pxcmy*str2double(get(handles.vmin,'String')); |
---|
| 3256 | vmax=dt*pxcmy*str2double(get(handles.vmax,'String')); |
---|
[2] | 3257 | shiftx=round((umin+umax)/2); |
---|
| 3258 | shifty=round((vmin+vmax)/2); |
---|
| 3259 | isx=(umax+2-shiftx)*2+ibx; |
---|
| 3260 | isx=2*ceil(isx/2)+1; |
---|
| 3261 | isy=(vmax+2-shifty)*2+iby; |
---|
| 3262 | isy=2*ceil(isy/2)+1; |
---|
| 3263 | set(handles.shiftx,'String',num2str(shiftx)); |
---|
| 3264 | set(handles.shifty,'String',num2str(shifty)); |
---|
| 3265 | set(handles.isx,'String',num2str(isx)); |
---|
| 3266 | set(handles.isy,'String',num2str(isy)); |
---|
| 3267 | |
---|
[12] | 3268 | %------------------------------------------------------------------------ |
---|
| 3269 | % --- Executes on carriage return on the subdir civ1 edit window |
---|
[2] | 3270 | function subdir_civ1_Callback(hObject, eventdata, handles) |
---|
[12] | 3271 | %------------------------------------------------------------------------ |
---|
[2] | 3272 | subdir=get(handles.subdir_civ1,'String'); |
---|
| 3273 | set(handles.subdir_civ2,'String',subdir); |
---|
[112] | 3274 | if get(handles.CIV1,'Value')==0 |
---|
[2] | 3275 | find_netcpair_civ1(hObject, eventdata, handles); %update the list of available pairs from netcdf files in the new directory |
---|
| 3276 | end |
---|
| 3277 | |
---|
[12] | 3278 | %------------------------------------------------------------------------ |
---|
| 3279 | % --- Executes on carriage return on the subdir civ1 edit window |
---|
[2] | 3280 | function subdir_civ2_Callback(hObject, eventdata, handles) |
---|
[12] | 3281 | %------------------------------------------------------------------------ |
---|
[2] | 3282 | %update the list of available pairs from netcdf files in the new directory |
---|
| 3283 | if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0 |
---|
| 3284 | find_netcpair_civ2(hObject, eventdata, handles); |
---|
| 3285 | end |
---|
| 3286 | |
---|
[12] | 3287 | %------------------------------------------------------------------------ |
---|
[133] | 3288 | % --- Executes on button press in get_mask_civ1: select box for mask option |
---|
[2] | 3289 | function get_mask_civ1_Callback(hObject, eventdata, handles) |
---|
[12] | 3290 | %------------------------------------------------------------------------ |
---|
[252] | 3291 | maskval=get(handles.get_mask_civ1,'Value') |
---|
[2] | 3292 | if isequal(maskval,0) |
---|
| 3293 | set(handles.mask_civ1,'String','') |
---|
| 3294 | else |
---|
| 3295 | mask_displ='no mask'; %default |
---|
[71] | 3296 | filebase=get(handles.RootName,'String'); |
---|
[2] | 3297 | [ nbslice_mask, flag_mask]=get_mask(filebase,handles); |
---|
| 3298 | if isequal(flag_mask,1) |
---|
[112] | 3299 | mask_displ=[num2str(nbslice_mask) 'mask']; |
---|
[2] | 3300 | elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
[112] | 3301 | common_path=fileparts(filebase); |
---|
| 3302 | filebase_a=fullfile(common_path,get(handles.RootName_1,'String')); |
---|
| 3303 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
| 3304 | if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice_mask) |
---|
| 3305 | mask_displ='no mask'; |
---|
| 3306 | end |
---|
[2] | 3307 | end |
---|
| 3308 | if isequal(mask_displ,'no mask') |
---|
[12] | 3309 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 3310 | {'*.png', ' (*.png)'; |
---|
| 3311 | '*.png', '.png files '; ... |
---|
| 3312 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3313 | 'Pick a mask file *.png',filebase); |
---|
| 3314 | mask_displ=fullfile(PathName,FileName); |
---|
[12] | 3315 | if ~exist(mask_displ,'file') |
---|
| 3316 | mask_displ='no mask'; |
---|
| 3317 | end |
---|
| 3318 | end |
---|
| 3319 | if isequal(mask_displ,'no mask') |
---|
[2] | 3320 | set(handles.get_mask_civ1,'Value',0) |
---|
| 3321 | set(handles.get_mask_fix1,'Value',0) |
---|
| 3322 | set(handles.get_mask_civ2,'Value',0) |
---|
| 3323 | set(handles.get_mask_fix2,'Value',0) |
---|
| 3324 | else |
---|
| 3325 | set(handles.get_mask_fix1,'Value',1) |
---|
| 3326 | set(handles.get_mask_fix2,'Value',1) |
---|
| 3327 | end |
---|
| 3328 | set(handles.mask_civ1,'String',mask_displ) |
---|
| 3329 | set(handles.mask_fix1,'String',mask_displ) |
---|
| 3330 | set(handles.mask_civ2,'String',mask_displ) |
---|
| 3331 | set(handles.mask_fix2,'String',mask_displ) |
---|
| 3332 | end |
---|
[133] | 3333 | set(handles.get_mask_civ2,'Value',maskval)%update the civ2 mask with the same option as civ1 |
---|
[2] | 3334 | |
---|
[12] | 3335 | %------------------------------------------------------------------------ |
---|
[2] | 3336 | % --- Executes on button press in get_mask_fix1. |
---|
| 3337 | function get_mask_fix1_Callback(hObject, eventdata, handles) |
---|
[12] | 3338 | %------------------------------------------------------------------------ |
---|
[2] | 3339 | maskval=get(handles.get_mask_fix1,'Value'); |
---|
| 3340 | if isequal(maskval,0) |
---|
| 3341 | set(handles.mask_fix1,'String','') |
---|
| 3342 | else |
---|
[112] | 3343 | mask_displ='no mask'; %default |
---|
| 3344 | filebase=get(handles.RootName,'String'); |
---|
| 3345 | [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
| 3346 | if isequal(flag_mask,1) |
---|
| 3347 | mask_displ=[num2str(nbslice) 'mask']; |
---|
| 3348 | elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
[71] | 3349 | filebase_a=get(handles.RootName_1,'String'); |
---|
[2] | 3350 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
[229] | 3351 | if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) |
---|
[2] | 3352 | mask_displ='no mask'; |
---|
| 3353 | end |
---|
[112] | 3354 | end |
---|
| 3355 | if isequal(mask_displ,'no mask') |
---|
| 3356 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 3357 | {'*.png', ' (*.png)'; |
---|
[12] | 3358 | '*.png', '.png files '; ... |
---|
| 3359 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3360 | 'Pick a mask file *.png',filebase); |
---|
[112] | 3361 | mask_displ=fullfile(PathName,FileName); |
---|
| 3362 | if ~exist(mask_displ,'file') |
---|
| 3363 | mask_displ='no mask'; |
---|
| 3364 | end |
---|
[12] | 3365 | end |
---|
[112] | 3366 | if isequal(mask_displ,'no mask') |
---|
| 3367 | set(handles.get_mask_fix1,'Value',0) |
---|
| 3368 | set(handles.get_mask_civ2,'Value',0) |
---|
| 3369 | set(handles.get_mask_fix2,'Value',0) |
---|
| 3370 | else |
---|
| 3371 | %set(handles.get_mask_civ2,'Value',1) |
---|
| 3372 | set(handles.get_mask_fix2,'Value',1) |
---|
| 3373 | end |
---|
| 3374 | set(handles.mask_fix1,'String',mask_displ) |
---|
| 3375 | set(handles.mask_civ2,'String',mask_displ) |
---|
| 3376 | set(handles.mask_fix2,'String',mask_displ) |
---|
[12] | 3377 | end |
---|
| 3378 | |
---|
| 3379 | %------------------------------------------------------------------------ |
---|
[133] | 3380 | % --- Executes on button press in get_mask_civ2: select box for mask option |
---|
[2] | 3381 | function get_mask_civ2_Callback(hObject, eventdata, handles) |
---|
[12] | 3382 | %------------------------------------------------------------------------ |
---|
[2] | 3383 | maskval=get(handles.get_mask_civ2,'Value'); |
---|
| 3384 | if isequal(maskval,0) |
---|
| 3385 | set(handles.mask_civ2,'String','') |
---|
| 3386 | else |
---|
[112] | 3387 | mask_displ='no mask'; %default |
---|
| 3388 | filebase=get(handles.RootName,'String'); |
---|
| 3389 | [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
| 3390 | if isequal(flag_mask,1) |
---|
| 3391 | mask_displ=[num2str(nbslice) 'mask']; |
---|
| 3392 | elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
[71] | 3393 | filebase_a=get(handles.RootName_1,'String'); |
---|
[2] | 3394 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
[229] | 3395 | if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) |
---|
[2] | 3396 | mask_displ='no mask'; |
---|
| 3397 | end |
---|
[112] | 3398 | end |
---|
| 3399 | if isequal(mask_displ,'no mask') |
---|
| 3400 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 3401 | {'*.png', ' (*.png)'; |
---|
[12] | 3402 | '*.png', '.png files '; ... |
---|
| 3403 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3404 | 'Pick a mask file *.png',filebase); |
---|
[112] | 3405 | mask_displ=fullfile(PathName,FileName); |
---|
| 3406 | if ~exist(mask_displ,'file') |
---|
| 3407 | mask_displ='no mask'; |
---|
| 3408 | end |
---|
[12] | 3409 | end |
---|
[112] | 3410 | if isequal(mask_displ,'no mask') |
---|
| 3411 | set(handles.get_mask_civ2,'Value',0) |
---|
| 3412 | set(handles.get_mask_fix2,'Value',0) |
---|
| 3413 | else |
---|
| 3414 | set(handles.get_mask_fix2,'Value',1) |
---|
| 3415 | end |
---|
| 3416 | set(handles.mask_civ2,'String',mask_displ) |
---|
| 3417 | set(handles.mask_fix2,'String',mask_displ) |
---|
[12] | 3418 | end |
---|
| 3419 | |
---|
| 3420 | %------------------------------------------------------------------------ |
---|
[2] | 3421 | % --- Executes on button press in get_mask_fix2. |
---|
| 3422 | function get_mask_fix2_Callback(hObject, eventdata, handles) |
---|
[12] | 3423 | %------------------------------------------------------------------------ |
---|
[2] | 3424 | maskval=get(handles.get_mask_fix2,'Value'); |
---|
| 3425 | if isequal(maskval,0) |
---|
| 3426 | set(handles.mask_fix2,'String','') |
---|
| 3427 | else |
---|
[12] | 3428 | mask_displ='no mask'; %default |
---|
[71] | 3429 | filebase=get(handles.RootName,'String'); |
---|
[12] | 3430 | [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
| 3431 | if isequal(flag_mask,1) |
---|
[112] | 3432 | mask_displ=[num2str(nbslice) 'mask']; |
---|
[12] | 3433 | elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
[112] | 3434 | filebase_a=get(handles.RootName_1,'String'); |
---|
| 3435 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
[229] | 3436 | if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) |
---|
[112] | 3437 | mask_displ='no mask'; |
---|
| 3438 | end |
---|
[12] | 3439 | end |
---|
| 3440 | if isequal(mask_displ,'no mask') |
---|
| 3441 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 3442 | {'*.png', ' (*.png)'; |
---|
| 3443 | '*.png', '.png files '; ... |
---|
| 3444 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3445 | 'Pick a mask file *.png',filebase); |
---|
| 3446 | mask_displ=fullfile(PathName,FileName); |
---|
[12] | 3447 | if ~exist(mask_displ,'file') |
---|
[2] | 3448 | mask_displ='no mask'; |
---|
| 3449 | end |
---|
[12] | 3450 | end |
---|
| 3451 | if isequal(mask_displ,'no mask') |
---|
| 3452 | set(handles.get_mask_fix2,'Value',0) |
---|
[112] | 3453 | end |
---|
[12] | 3454 | set(handles.mask_fix2,'String',mask_displ) |
---|
[2] | 3455 | end |
---|
| 3456 | |
---|
[12] | 3457 | %------------------------------------------------------------------------ |
---|
| 3458 | % --- function called to look for mask files |
---|
[2] | 3459 | function [nbslice, flag_mask]=get_mask(filebase,handles) |
---|
[12] | 3460 | %------------------------------------------------------------------------ |
---|
[112] | 3461 | %detect mask files, images with appropriate file base |
---|
[2] | 3462 | %[filebase '_' xx 'mask'], xx=nbslice |
---|
| 3463 | %flag_mask=1 indicates detection |
---|
| 3464 | |
---|
| 3465 | flag_mask=0;%default |
---|
| 3466 | nbslice=1; |
---|
| 3467 | |
---|
| 3468 | % subdir=get(handles.subdir_civ1,'String'); |
---|
| 3469 | [Path,Name]=fileparts(filebase); |
---|
[12] | 3470 | if ~isdir(Path) |
---|
| 3471 | msgbox_uvmat('ERROR','no path for input files') |
---|
| 3472 | return |
---|
| 3473 | end |
---|
[2] | 3474 | currentdir=pwd; |
---|
| 3475 | cd(Path);%move in the dir of the root name filebase |
---|
| 3476 | maskfiles=dir([Name '_*mask_*.png']);%look for mask files |
---|
| 3477 | cd(currentdir);%come back to the current working directory |
---|
[12] | 3478 | if ~isempty(maskfiles) |
---|
[112] | 3479 | % msgbox_uvmat('ERROR','no mask available, to create it use Tools/Make mask in the upper menu bar of uvmat') |
---|
| 3480 | % else |
---|
[2] | 3481 | flag_mask=1; |
---|
| 3482 | maskname=maskfiles(1).name;% take the first mask file in the list |
---|
| 3483 | [Path2,Name,ext]=fileparts(maskname); |
---|
| 3484 | Namedouble=double(Name); |
---|
| 3485 | val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters |
---|
| 3486 | ind_mask=findstr('mask',Name); |
---|
| 3487 | i=ind_mask-1; |
---|
[137] | 3488 | while val(i)==0 && i>0 |
---|
[112] | 3489 | i=i-1; |
---|
[2] | 3490 | end |
---|
[137] | 3491 | nbslice=str2double(Name(i+1:ind_mask-1)); |
---|
| 3492 | if ~isnan(nbslice) && Name(i)=='_' |
---|
[112] | 3493 | flag_mask=1; |
---|
[2] | 3494 | else |
---|
[112] | 3495 | msgbox_uvmat('ERROR',['bad mask file ' Name ext ' found in ' Path2]) |
---|
| 3496 | return |
---|
| 3497 | nbslice=1; |
---|
[2] | 3498 | end |
---|
[112] | 3499 | end |
---|
[2] | 3500 | |
---|
[12] | 3501 | %------------------------------------------------------------------------ |
---|
| 3502 | % --- function called to look for grid files |
---|
[2] | 3503 | function [nbslice, flag_mask]=get_grid(filebase,handles) |
---|
[12] | 3504 | %------------------------------------------------------------------------ |
---|
[2] | 3505 | flag_mask=0;%default |
---|
| 3506 | nbslice=1; |
---|
| 3507 | [Path,Name]=fileparts(filebase); |
---|
| 3508 | currentdir=pwd; |
---|
| 3509 | cd(Path);%move in the dir of the root name filebase |
---|
| 3510 | maskfiles=dir([Name '_*grid_*.grid']);%look for mask files |
---|
| 3511 | cd(currentdir);%come back to the current working directory |
---|
| 3512 | if ~isempty(maskfiles) |
---|
| 3513 | flag_mask=1; |
---|
| 3514 | maskname=maskfiles(1).name;% take the first mask file in the list |
---|
| 3515 | [Path2,Name,ext]=fileparts(maskname); |
---|
| 3516 | Namedouble=double(Name); |
---|
| 3517 | val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters |
---|
| 3518 | ind_mask=findstr('grid',Name); |
---|
| 3519 | i=ind_mask-1; |
---|
[137] | 3520 | while val(i)==0 && i>0 |
---|
[112] | 3521 | i=i-1; |
---|
[2] | 3522 | end |
---|
[137] | 3523 | nbslice=str2double(Name(i+1:ind_mask-1)); |
---|
| 3524 | if ~isnan(nbslice) && Name(i)=='_' |
---|
[112] | 3525 | flag_mask=1; |
---|
[2] | 3526 | else |
---|
[112] | 3527 | msgbox_uvmat('ERROR',['bad grid file ' Name ext ' found in ' Path2]) |
---|
| 3528 | return |
---|
| 3529 | nbslice=1; |
---|
[2] | 3530 | end |
---|
[12] | 3531 | end |
---|
[2] | 3532 | |
---|
[12] | 3533 | %------------------------------------------------------------------------ |
---|
| 3534 | % --- transform numbers to letters |
---|
[122] | 3535 | function str=num2stra(num,nom_type) |
---|
[12] | 3536 | %------------------------------------------------------------------------ |
---|
[122] | 3537 | if isempty(nom_type) |
---|
| 3538 | str=''; |
---|
| 3539 | elseif strcmp(nom_type(end),'a') |
---|
[2] | 3540 | str=char(96+num); |
---|
[122] | 3541 | elseif strcmp(nom_type(end),'A') |
---|
| 3542 | str=char(96+num); |
---|
| 3543 | elseif isempty(nom_type(2:end))%a single index |
---|
[2] | 3544 | str=''; |
---|
| 3545 | else |
---|
| 3546 | str=num2str(num); |
---|
| 3547 | end |
---|
[12] | 3548 | |
---|
| 3549 | %------------------------------------------------------------------------ |
---|
[2] | 3550 | % --- Executes on button press in list_subdir_civ1. |
---|
| 3551 | function list_subdir_civ1_Callback(hObject, eventdata, handles) |
---|
[12] | 3552 | %------------------------------------------------------------------------ |
---|
[2] | 3553 | list_subdir_civ1=get(handles.list_subdir_civ1,'String'); |
---|
| 3554 | val=get(handles.list_subdir_civ1,'Value'); |
---|
| 3555 | if val>1 |
---|
| 3556 | subdir=list_subdir_civ1{val}; |
---|
| 3557 | set(handles.subdir_civ1,'String',subdir); |
---|
| 3558 | set(handles.list_subdir_civ1,'Value',1); |
---|
| 3559 | end |
---|
| 3560 | |
---|
[12] | 3561 | %------------------------------------------------------------------------ |
---|
[2] | 3562 | % --- Executes on button press in list_subdir_civ2. |
---|
| 3563 | function list_subdir_civ2_Callback(hObject, eventdata, handles) |
---|
[12] | 3564 | %------------------------------------------------------------------------ |
---|
[2] | 3565 | list_subdir_civ2=get(handles.list_subdir_civ2,'String'); |
---|
| 3566 | val=get(handles.list_subdir_civ2,'Value'); |
---|
| 3567 | if val>1 |
---|
| 3568 | subdir=list_subdir_civ2{val}; |
---|
| 3569 | set(handles.subdir_civ2,'String',subdir); |
---|
| 3570 | set(handles.list_subdir_civ2,'Value',1); |
---|
| 3571 | end |
---|
| 3572 | |
---|
[12] | 3573 | %------------------------------------------------------------------------ |
---|
[2] | 3574 | % --- Executes on button press in browse_gridciv1. |
---|
| 3575 | function browse_gridciv1_Callback(hObject, eventdata, handles) |
---|
[12] | 3576 | %------------------------------------------------------------------------ |
---|
[2] | 3577 | value=get(handles.browse_gridciv1,'Value'); |
---|
| 3578 | testgrid=0; |
---|
| 3579 | if value |
---|
[112] | 3580 | filebase=get(handles.RootName,'String'); |
---|
[39] | 3581 | [nbslice, flag_grid]=get_grid(filebase,handles); |
---|
[2] | 3582 | if isequal(flag_grid,1) |
---|
[112] | 3583 | filegrid=[num2str(nbslice) 'grid']; |
---|
| 3584 | testgrid=1; |
---|
| 3585 | else |
---|
[2] | 3586 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 3587 | {'*.grid', ' (*.grid)'; |
---|
| 3588 | '*.grid', '.grid files '; ... |
---|
| 3589 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3590 | 'Pick a file',filebase); |
---|
[2] | 3591 | filegrid=fullfile(PathName,FileName); |
---|
| 3592 | if ~(isempty(FileName)||isempty(PathName)||isequal(FileName,0)||~exist(filegrid,'file')) |
---|
| 3593 | testgrid=1; |
---|
| 3594 | end |
---|
[112] | 3595 | end |
---|
[2] | 3596 | end |
---|
| 3597 | if testgrid |
---|
[112] | 3598 | set(handles.browse_gridciv2,'Value',1) |
---|
| 3599 | set(handles.get_gridpatch1,'Value',1) |
---|
| 3600 | set(handles.get_gridpatch2,'Value',1) |
---|
| 3601 | set(handles.dx_civ1,'Visible','off'); |
---|
| 3602 | set(handles.dy_civ1,'Visible','off'); |
---|
| 3603 | set(handles.dx_civ2,'Visible','off'); |
---|
| 3604 | set(handles.dy_civ2,'Visible','off'); |
---|
| 3605 | set(handles.grid_civ1,'String',filegrid) |
---|
| 3606 | set(handles.grid_patch1,'String',filegrid) |
---|
| 3607 | set(handles.grid_civ2,'String',filegrid) |
---|
| 3608 | set(handles.grid_patch2,'String',filegrid) |
---|
| 3609 | else |
---|
| 3610 | set(handles.browse_gridciv1,'Value',0); |
---|
| 3611 | set(handles.browse_gridciv2,'Value',0); |
---|
| 3612 | set(handles.get_gridpatch1,'Value',0) |
---|
| 3613 | set(handles.get_gridpatch2,'Value',0) |
---|
| 3614 | set(handles.dx_civ1,'Visible','on'); |
---|
| 3615 | set(handles.dy_civ1,'Visible','on'); |
---|
| 3616 | set(handles.dx_civ2,'Visible','on'); |
---|
| 3617 | set(handles.dy_civ2,'Visible','on'); |
---|
| 3618 | set(handles.grid_civ1,'String','') |
---|
| 3619 | set(handles.grid_patch1,'String','') |
---|
| 3620 | set(handles.grid_civ2,'String','') |
---|
| 3621 | set(handles.grid_patch2,'String','') |
---|
[2] | 3622 | end |
---|
| 3623 | |
---|
[12] | 3624 | %------------------------------------------------------------------------ |
---|
[2] | 3625 | % --- Executes on button press in browse_gridciv1. |
---|
| 3626 | function browse_gridciv2_Callback(hObject, eventdata, handles) |
---|
[12] | 3627 | %------------------------------------------------------------------------ |
---|
[2] | 3628 | value=get(handles.browse_gridciv2,'Value'); |
---|
| 3629 | if value |
---|
[112] | 3630 | filebase=get(handles.RootName,'String'); |
---|
[39] | 3631 | [nbslice, flag_grid]=get_grid(filebase,handles); |
---|
[2] | 3632 | if isequal(flag_grid,1) |
---|
| 3633 | mask_displ=[num2str(nbslice) 'grid']; |
---|
| 3634 | set(handles.grid_civ2,'String',mask_displ) |
---|
| 3635 | set(handles.dx_civ2,'Visible','off'); |
---|
| 3636 | set(handles.dy_civ2,'Visible','off'); |
---|
[112] | 3637 | else |
---|
[2] | 3638 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 3639 | {'*.grid', ' (*.grid)'; |
---|
| 3640 | '*.grid', '.grid files '; ... |
---|
| 3641 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3642 | 'Pick a file',filebase); |
---|
[2] | 3643 | filegrid=fullfile(PathName,FileName); |
---|
[229] | 3644 | if isempty(FileName)||isempty(PathName)||isequal(FileName,0)||~exist(filegrid,'file') |
---|
[2] | 3645 | set(handles.browse_gridciv2,'Value',0); |
---|
| 3646 | set(handles.grid_civ2,'string',''); |
---|
| 3647 | set(handles.dx_civ2,'Visible','on'); |
---|
| 3648 | set(handles.dy_civ2,'Visible','on'); |
---|
| 3649 | set(handles.grid_civ2,'string',''); |
---|
| 3650 | else |
---|
| 3651 | set(handles.grid_civ2,'string',filegrid); |
---|
| 3652 | set(handles.dx_civ2,'Visible','off'); |
---|
| 3653 | set(handles.dy_civ2,'Visible','off'); |
---|
| 3654 | set(handles.grid_civ2,'string',filegrid); |
---|
| 3655 | end |
---|
| 3656 | end |
---|
| 3657 | else |
---|
| 3658 | set(handles.grid_civ2,'string',''); |
---|
[112] | 3659 | set(handles.dx_civ2,'Visible','on'); |
---|
| 3660 | set(handles.dy_civ2,'Visible','on'); |
---|
| 3661 | set(handles.grid_civ2,'string',''); |
---|
[2] | 3662 | end |
---|
| 3663 | |
---|
| 3664 | % % --- Executes on button press in browse_gridciv2. |
---|
| 3665 | % function browse_gridciv2_Callback(hObject, eventdata, handles) |
---|
[112] | 3666 | % |
---|
[71] | 3667 | % filebase=get(handles.RootName,'String'); |
---|
[2] | 3668 | % [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 3669 | % {'*.grid', ' (*.grid)'; |
---|
| 3670 | % '*.grid', '.grid files '; ... |
---|
| 3671 | % '*.*', 'All Files (*.*)'}, ... |
---|
| 3672 | % 'Pick a file',filebase); |
---|
| 3673 | % filegrid=fullfile(PathName,FileName); |
---|
| 3674 | % set(handles.grid_civ2,'string',filegrid); |
---|
| 3675 | % set(handles.dx_civ2,'String',' '); |
---|
| 3676 | % set(handles.dy_civ2,'String',' '); |
---|
| 3677 | % % set(handles.grid_patch2,'string',filegrid); |
---|
| 3678 | |
---|
| 3679 | % --- Executes on button press in get_gridpatch1. |
---|
| 3680 | function get_gridpatch1_Callback(hObject, eventdata, handles) |
---|
| 3681 | % hObject handle to get_gridpatch1 (see GCBO) |
---|
| 3682 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 3683 | % handles structure with handles and user data (see GUIDATA) |
---|
| 3684 | |
---|
[71] | 3685 | filebase=get(handles.RootName,'String'); |
---|
[2] | 3686 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 3687 | {'*.grid', ' (*.grid)'; |
---|
| 3688 | '*.grid', '.grid files '; ... |
---|
| 3689 | '*.*', 'All Files (*.*)'}, ... |
---|
| 3690 | 'Pick a file',filebase); |
---|
[2] | 3691 | filegrid=fullfile(PathName,FileName); |
---|
| 3692 | set(handles.grid_patch1,'string',filegrid); |
---|
| 3693 | % set(handles.grid_patch2,'string',filegrid |
---|
| 3694 | |
---|
[12] | 3695 | %------------------------------------------------------------------------ |
---|
[2] | 3696 | % --- Executes on button press in get_gridpatch2. |
---|
| 3697 | function get_gridpatch2_Callback(hObject, eventdata, handles) |
---|
[12] | 3698 | %------------------------------------------------------------------------ |
---|
[2] | 3699 | |
---|
[12] | 3700 | %------------------------------------------------------------------------ |
---|
[2] | 3701 | function enable_civ1(handles,state) |
---|
[12] | 3702 | %------------------------------------------------------------------------ |
---|
[2] | 3703 | if isequal(state,'on') |
---|
| 3704 | set(handles.frame_civ1,'BackgroundColor',[1 1 0]) |
---|
| 3705 | set(handles.frame_para_civ1,'BackgroundColor',[1 1 0]) |
---|
| 3706 | set(handles.frame_grid_civ1,'BackgroundColor',[1 1 0]) |
---|
| 3707 | else |
---|
| 3708 | set(handles.frame_civ1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 3709 | set(handles.frame_para_civ1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 3710 | set(handles.frame_grid_civ1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 3711 | end |
---|
| 3712 | set(handles.ibx,'Visible',state) |
---|
| 3713 | set(handles.iby,'Visible',state) |
---|
| 3714 | set(handles.isx,'Visible',state) |
---|
| 3715 | set(handles.isy,'Visible',state) |
---|
| 3716 | set(handles.shiftx,'Visible',state) |
---|
| 3717 | set(handles.shifty,'Visible',state) |
---|
| 3718 | set(handles.rho,'Visible',state) |
---|
| 3719 | set(handles.dx_civ1,'Visible',state) |
---|
| 3720 | set(handles.dy_civ1,'Visible',state) |
---|
| 3721 | set(handles.calcul_search,'Visible',state) |
---|
| 3722 | set(handles.u_text,'Visible',state) |
---|
| 3723 | set(handles.v_text,'Visible',state) |
---|
| 3724 | set(handles.min,'Visible',state) |
---|
| 3725 | set(handles.max,'Visible',state) |
---|
| 3726 | set(handles.umin,'Visible',state) |
---|
| 3727 | set(handles.umax,'Visible',state) |
---|
| 3728 | set(handles.vmin,'Visible',state) |
---|
| 3729 | set(handles.vmax,'Visible',state) |
---|
| 3730 | set(handles.grid_civ1,'Visible',state) |
---|
| 3731 | set(handles.mask_civ1,'Visible',state) |
---|
| 3732 | set(handles.browse_gridciv1,'Visible',state) |
---|
| 3733 | set(handles.get_mask_civ1,'Visible',state) |
---|
| 3734 | set(handles.parameters,'Visible',state) |
---|
| 3735 | set(handles.grid,'Visible',state) |
---|
| 3736 | set(handles.dx_civ1,'Visible',state) |
---|
| 3737 | set(handles.dy_civ1,'Visible',state) |
---|
| 3738 | set(handles.ImaThreshold,'Visible',state) |
---|
| 3739 | if isequal(state,'off') |
---|
| 3740 | set(handles.MinIma,'Visible','off') |
---|
| 3741 | set(handles.MaxIma,'Visible','off') |
---|
| 3742 | set(handles.ImaThreshold,'Value',0) |
---|
| 3743 | end |
---|
| 3744 | set(handles.dx_civ1_title,'Visible',state) |
---|
| 3745 | set(handles.dy_civ1_title,'Visible',state) |
---|
| 3746 | set(handles.ImaThreshold_title,'Visible',state) |
---|
| 3747 | set(handles.ib_title,'Visible',state) |
---|
| 3748 | set(handles.is_title,'Visible',state) |
---|
| 3749 | set(handles.shift_title,'Visible',state) |
---|
| 3750 | set(handles.rho_title,'Visible',state) |
---|
[224] | 3751 | set(handles.TestCiv1,'Visible',state) |
---|
[257] | 3752 | %set(handles.CivMode,'Visible',state) |
---|
[2] | 3753 | |
---|
[12] | 3754 | %------------------------------------------------------------------------ |
---|
[2] | 3755 | function enable_fix1(handles,state) |
---|
[12] | 3756 | %------------------------------------------------------------------------ |
---|
[2] | 3757 | if isequal(state,0) |
---|
| 3758 | state='off'; |
---|
| 3759 | end |
---|
| 3760 | if isequal(state,1) |
---|
| 3761 | state='on'; |
---|
| 3762 | end |
---|
| 3763 | if isequal(state,'on') |
---|
| 3764 | set(handles.frame_fix1,'BackgroundColor',[1 1 0]) |
---|
| 3765 | else |
---|
| 3766 | set(handles.frame_fix1,'BackgroundColor',[0.7 0.7 0.7]) |
---|
| 3767 | end |
---|
| 3768 | set(handles.REMOVE,'Visible',state) |
---|
| 3769 | set(handles.vec_Fmin2,'Visible',state) |
---|
| 3770 | set(handles.vec_F2,'Visible',state) |
---|
| 3771 | set(handles.vec_F3,'Visible',state) |
---|
| 3772 | set(handles.thresh_vecC,'Visible',state) |
---|
| 3773 | set(handles.thresh_vecC_title,'Visible',state) |
---|
| 3774 | set(handles.thresh_vel,'Visible',state) |
---|
| 3775 | set(handles.thresh_vel_text,'Visible',state) |
---|
| 3776 | set(handles.mask_fix1,'Visible',state) |
---|
| 3777 | set(handles.get_mask_fix1,'Visible',state) |
---|
| 3778 | set(handles.get_ref_fix1,'Visible',state) |
---|
| 3779 | set(handles.ref_fix1,'Visible',state) |
---|
| 3780 | set(handles.inf_sup1,'Visible',state) |
---|
| 3781 | set(handles.field_ref1,'Visible',state) |
---|
| 3782 | |
---|
[12] | 3783 | %------------------------------------------------------------------------ |
---|
[2] | 3784 | function enable_patch1(handles) |
---|
[12] | 3785 | %------------------------------------------------------------------------ |
---|
[2] | 3786 | set(handles.frame_patch1,'BackgroundColor',[1 1 0]) |
---|
| 3787 | set(handles.rho_patch1,'Visible','on') |
---|
| 3788 | set(handles.rho_text1,'Visible','on') |
---|
[257] | 3789 | if get(handles.CivMode,'Value')==2 |
---|
[224] | 3790 | set(handles.thresh_patch1,'Visible','on') |
---|
| 3791 | set(handles.thresh_text1,'Visible','on') |
---|
| 3792 | end |
---|
[2] | 3793 | set(handles.subdomain_patch1,'Visible','on') |
---|
| 3794 | set(handles.subdomain_text1,'Visible','on') |
---|
| 3795 | set(handles.nx_patch1,'Visible','on') |
---|
| 3796 | set(handles.ny_patch1,'Visible','on') |
---|
| 3797 | set(handles.nx_patch1_title,'Visible','on') |
---|
| 3798 | set(handles.ny_patch1_title,'Visible','on') |
---|
[112] | 3799 | % if ~isempty(patch_newBin) |
---|
[224] | 3800 | set(handles.test_interp,'Visible','off'); |
---|
[252] | 3801 | stereo_test=get(handles.compare,'Value'); |
---|
| 3802 | if stereo_test==3 |
---|
| 3803 | set(handles.test_stereo1,'Visible','on') |
---|
| 3804 | end |
---|
[100] | 3805 | % end |
---|
[252] | 3806 | %set(handles.get_gridpatch1,'Visible','on') |
---|
| 3807 | %set(handles.grid_patch1,'string','none'); |
---|
| 3808 | %set(handles.grid_patch1,'Visible','on') |
---|
[2] | 3809 | |
---|
[12] | 3810 | %------------------------------------------------------------------------ |
---|
[2] | 3811 | function desable_patch1(handles) |
---|
[12] | 3812 | %------------------------------------------------------------------------ |
---|
[2] | 3813 | set(handles.frame_patch1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 3814 | set(handles.rho_patch1,'Visible','off') |
---|
| 3815 | set(handles.rho_text1,'Visible','off') |
---|
| 3816 | set(handles.thresh_patch1,'Visible','off') |
---|
| 3817 | set(handles.thresh_text1,'Visible','off') |
---|
| 3818 | set(handles.subdomain_patch1,'Visible','off') |
---|
| 3819 | set(handles.subdomain_text1,'Visible','off') |
---|
| 3820 | set(handles.nx_patch1,'Visible','off') |
---|
| 3821 | set(handles.ny_patch1,'Visible','off') |
---|
| 3822 | set(handles.nx_patch1_title,'Visible','off') |
---|
| 3823 | set(handles.ny_patch1_title,'Visible','off') |
---|
[252] | 3824 | set(handles.test_stereo1,'Visible','off') |
---|
[100] | 3825 | %set(handles.test_interp,'Visible','off') |
---|
[252] | 3826 | %set(handles.get_gridpatch1,'Visible','off') |
---|
| 3827 | %set(handles.grid_patch1,'Visible','off') |
---|
[2] | 3828 | |
---|
[12] | 3829 | %------------------------------------------------------------------------ |
---|
[2] | 3830 | function enable_civ2(handles,state) |
---|
[12] | 3831 | %------------------------------------------------------------------------ |
---|
[2] | 3832 | if isequal(state,0) |
---|
| 3833 | state='off'; |
---|
| 3834 | end |
---|
| 3835 | if isequal(state,1) |
---|
| 3836 | state='on'; |
---|
| 3837 | end |
---|
| 3838 | if isequal(state,'on') |
---|
| 3839 | set(handles.frame_civ2,'BackgroundColor',[1 1 0]) |
---|
| 3840 | set(handles.frame_para_civ2,'BackgroundColor',[1 1 0]) |
---|
| 3841 | set(handles.frame_grid_civ2,'BackgroundColor',[1 1 0]) |
---|
| 3842 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 3843 | else |
---|
| 3844 | set(handles.frame_civ2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 3845 | set(handles.frame_para_civ2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 3846 | set(handles.frame_grid_civ2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 3847 | set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 3848 | end |
---|
| 3849 | set(handles.ibx_civ2,'Visible',state) |
---|
| 3850 | set(handles.iby_civ2,'Visible',state) |
---|
| 3851 | set(handles.decimal,'Visible',state) |
---|
| 3852 | set(handles.deformation,'Visible',state) |
---|
| 3853 | set(handles.rho_civ2,'Visible',state) |
---|
| 3854 | set(handles.dx_civ2,'Visible',state) |
---|
| 3855 | set(handles.dy_civ2,'Visible',state) |
---|
| 3856 | set(handles.browse_gridciv2,'Visible',state) |
---|
| 3857 | set(handles.get_mask_civ2,'Visible',state) |
---|
| 3858 | set(handles.parameters,'Visible',state) |
---|
| 3859 | set(handles.grid,'Visible',state) |
---|
| 3860 | set(handles.parameters_text,'Visible',state) |
---|
| 3861 | set(handles.grid_text,'Visible',state) |
---|
| 3862 | set(handles.grid_civ2,'Visible',state) |
---|
| 3863 | set(handles.mask_civ2,'Visible',state) |
---|
| 3864 | set(handles.dx_civ2_title,'Visible',state) |
---|
| 3865 | set(handles.dy_civ2_title,'Visible',state) |
---|
| 3866 | set(handles.ibx_civ2_text,'Visible',state) |
---|
| 3867 | set(handles.rho_civ2_title,'Visible',state) |
---|
| 3868 | set(handles.ImaThreshold2,'Visible',state) |
---|
| 3869 | set(handles.ImaThreshold_title2,'Visible',state) |
---|
| 3870 | if isequal(state,'off') |
---|
| 3871 | set(handles.MinIma2,'Visible','off') |
---|
| 3872 | set(handles.MaxIma2,'Visible','off') |
---|
| 3873 | set(handles.ImaThreshold2,'Value',0) |
---|
[112] | 3874 | if isequal(get(handles.FIX2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) |
---|
[2] | 3875 | set(handles.list_pair_civ2,'Visible','off') |
---|
| 3876 | set(handles.subdir_civ2,'Visible','off') |
---|
| 3877 | set(handles.subdir_civ2_text,'Visible','off') |
---|
[71] | 3878 | set(handles.dt_unit_civ2,'Visible','off') |
---|
| 3879 | set(handles.ref_i_civ2,'Visible','off') |
---|
| 3880 | set(handles.i_ref_civ2_title,'Visible','off') |
---|
| 3881 | set(handles.j_ref_civ2_title,'Visible','off') |
---|
| 3882 | set(handles.ref_j_civ2,'Visible','off') |
---|
[2] | 3883 | end |
---|
| 3884 | else |
---|
| 3885 | set(handles.list_pair_civ2,'Visible','on') |
---|
| 3886 | set(handles.subdir_civ2,'Visible','on') |
---|
| 3887 | set(handles.subdir_civ2_text,'Visible','on') |
---|
[71] | 3888 | set(handles.dt_unit_civ2,'Visible','on') |
---|
| 3889 | set(handles.ref_i_civ2,'Visible','on') |
---|
| 3890 | set(handles.i_ref_civ2_title,'Visible','on') |
---|
| 3891 | set(handles.j_ref_civ2_title,'Visible','on') |
---|
| 3892 | set(handles.ref_j_civ2,'Visible','on') |
---|
[2] | 3893 | end |
---|
[71] | 3894 | set(handles.rho_civ2_title,'Visible',state) |
---|
[2] | 3895 | |
---|
[12] | 3896 | %------------------------------------------------------------------------ |
---|
[2] | 3897 | function enable_fix2(handles) |
---|
[12] | 3898 | %------------------------------------------------------------------------ |
---|
[2] | 3899 | set(handles.frame_fix2,'BackgroundColor',[1 1 0]) |
---|
| 3900 | set(handles.REMOVE2,'Visible','on') |
---|
| 3901 | set(handles.vec_Fmin2_2,'Visible','on') |
---|
| 3902 | set(handles.vec_F4,'Visible','on') |
---|
| 3903 | set(handles.vec_F3_2,'Visible','on') |
---|
| 3904 | set(handles.thresh_vec2C,'Visible','on') |
---|
| 3905 | set(handles.thresh_vec2C_text,'Visible','on') |
---|
| 3906 | set(handles.thresh_vel2,'Visible','on') |
---|
| 3907 | set(handles.thresh_vel2_text,'Visible','on') |
---|
| 3908 | set(handles.mask_fix2,'Visible','on') |
---|
| 3909 | set(handles.get_mask_fix2,'Visible','on') |
---|
| 3910 | set(handles.list_pair_civ2,'Visible','on') |
---|
| 3911 | set(handles.subdir_civ2,'Visible','on') |
---|
| 3912 | set(handles.subdir_civ2_text,'Visible','on') |
---|
| 3913 | set(handles.get_ref_fix2,'Visible','on') |
---|
| 3914 | set(handles.ref_fix2,'Visible','on') |
---|
| 3915 | set(handles.inf_sup2,'Visible','on') |
---|
| 3916 | set(handles.field_ref2,'Visible','on') |
---|
| 3917 | |
---|
[12] | 3918 | %------------------------------------------------------------------------ |
---|
[2] | 3919 | function desable_fix2(handles) |
---|
[12] | 3920 | %------------------------------------------------------------------------ |
---|
[2] | 3921 | set(handles.frame_fix2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 3922 | set(handles.REMOVE2,'Visible','off') |
---|
| 3923 | set(handles.vec_Fmin2_2,'Visible','off') |
---|
| 3924 | set(handles.vec_F4,'Visible','off') |
---|
| 3925 | set(handles.vec_F3_2,'Visible','off') |
---|
| 3926 | set(handles.thresh_vec2C,'Visible','off') |
---|
| 3927 | set(handles.thresh_vec2C_text,'Visible','off') |
---|
| 3928 | set(handles.thresh_vel2,'Visible','off') |
---|
| 3929 | set(handles.thresh_vel2_text,'Visible','off') |
---|
| 3930 | set(handles.mask_fix2,'Visible','off') |
---|
| 3931 | set(handles.get_mask_fix2,'Visible','off') |
---|
| 3932 | set(handles.get_ref_fix2,'Visible','off') |
---|
| 3933 | set(handles.ref_fix2,'Visible','off') |
---|
| 3934 | set(handles.inf_sup2,'Visible','off') |
---|
| 3935 | set(handles.field_ref2,'Visible','off') |
---|
[112] | 3936 | if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) |
---|
[2] | 3937 | set(handles.list_pair_civ2,'Visible','off') |
---|
| 3938 | set(handles.subdir_civ2,'Visible','off') |
---|
| 3939 | set(handles.subdir_civ2_text,'Visible','off') |
---|
| 3940 | end |
---|
| 3941 | |
---|
[12] | 3942 | %------------------------------------------------------------------------ |
---|
[2] | 3943 | function enable_patch2(handles) |
---|
[12] | 3944 | %------------------------------------------------------------------------ |
---|
[2] | 3945 | set(handles.frame_patch2,'BackgroundColor',[1 1 0]) |
---|
[119] | 3946 | set(handles.rho_patch2,'Visible','on') |
---|
[2] | 3947 | set(handles.rho_text2,'Visible','on') |
---|
| 3948 | set(handles.thresh_patch2,'Visible','on') |
---|
| 3949 | set(handles.thresh_text2,'Visible','on') |
---|
| 3950 | set(handles.subdomain_patch2,'Visible','on') |
---|
| 3951 | set(handles.subdomain_text2,'Visible','on') |
---|
| 3952 | set(handles.nx_patch2,'Visible','on') |
---|
| 3953 | set(handles.ny_patch2,'Visible','on') |
---|
| 3954 | set(handles.nx_patch2_title,'Visible','on') |
---|
| 3955 | set(handles.ny_patch2_title,'Visible','on') |
---|
[252] | 3956 | % set(handles.get_gridpatch2,'Visible','on') |
---|
| 3957 | % set(handles.grid_patch2,'Visible','on') |
---|
[2] | 3958 | set(handles.list_pair_civ2,'Visible','on') |
---|
| 3959 | set(handles.subdir_civ2,'Visible','on') |
---|
| 3960 | set(handles.subdir_civ2_text,'Visible','on') |
---|
[252] | 3961 | stereo_test=get(handles.compare,'Value'); |
---|
| 3962 | if stereo_test==3 |
---|
| 3963 | set(handles.test_stereo2,'Visible','on') |
---|
| 3964 | end |
---|
[2] | 3965 | |
---|
[12] | 3966 | %------------------------------------------------------------------------ |
---|
[2] | 3967 | function desable_patch2(handles) |
---|
[12] | 3968 | %------------------------------------------------------------------------ |
---|
[2] | 3969 | set(handles.frame_patch2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 3970 | set(handles.rho_patch2,'Visible','off') |
---|
| 3971 | set(handles.rho_text2,'Visible','off') |
---|
| 3972 | set(handles.thresh_patch2,'Visible','off') |
---|
| 3973 | set(handles.thresh_text2,'Visible','off') |
---|
| 3974 | set(handles.subdomain_patch2,'Visible','off') |
---|
| 3975 | set(handles.subdomain_text2,'Visible','off') |
---|
| 3976 | set(handles.nx_patch2,'Visible','off') |
---|
| 3977 | set(handles.ny_patch2,'Visible','off') |
---|
| 3978 | set(handles.nx_patch2_title,'Visible','off') |
---|
| 3979 | set(handles.ny_patch2_title,'Visible','off') |
---|
[252] | 3980 | % set(handles.get_gridpatch2,'Visible','off') |
---|
| 3981 | % set(handles.grid_patch2,'Visible','off') |
---|
[112] | 3982 | if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0) |
---|
[2] | 3983 | set(handles.list_pair_civ2,'Visible','off') |
---|
| 3984 | set(handles.subdir_civ2,'Visible','off') |
---|
| 3985 | set(handles.subdir_civ2_text,'Visible','off') |
---|
| 3986 | end |
---|
[252] | 3987 | set(handles.test_stereo2,'Visible','off') |
---|
[12] | 3988 | %------------------------------------------------------------------------ |
---|
[2] | 3989 | function enable_pair1(handles,state) |
---|
[12] | 3990 | %------------------------------------------------------------------------ |
---|
[2] | 3991 | set(handles.subdir_civ1,'Visible',state) |
---|
| 3992 | set(handles.list_subdir_civ1,'Visible',state) |
---|
| 3993 | set(handles.SUBDIR_CIV1_txt,'Visible',state) |
---|
| 3994 | set(handles.frame_subdirciv1,'Visible',state) |
---|
| 3995 | set(handles.list_pair_civ1,'Visible',state) |
---|
| 3996 | set(handles.PAIR_txt,'Visible',state) |
---|
[71] | 3997 | %set(handles.dt_unit,'Visible',state) |
---|
[2] | 3998 | set(handles.PAIR_frame,'Visible',state) |
---|
| 3999 | |
---|
[12] | 4000 | %------------------------------------------------------------------------ |
---|
| 4001 | % --- Read the parameters for civ1 on the interface |
---|
[2] | 4002 | function par=read_param_civ1(handles,file_ima) |
---|
[12] | 4003 | %------------------------------------------------------------------------ |
---|
[127] | 4004 | ibx_val=str2double(get(handles.ibx,'String')); |
---|
[2] | 4005 | par.ibx=num2str(ibx_val); |
---|
[127] | 4006 | iby_val=str2double(get(handles.iby,'String')); |
---|
[2] | 4007 | par.iby=num2str(iby_val); |
---|
| 4008 | isx=get(handles.isx,'String'); |
---|
[127] | 4009 | if isnan(str2double(isx)), isx='41'; set(handles.isx,'String','41'), end; %default |
---|
| 4010 | if str2double(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.isx,'String',num2str(ibx_val+8)); end |
---|
[2] | 4011 | isy=get(handles.isy,'String'); |
---|
[127] | 4012 | if isnan(str2double(isy)), isy='41'; set(handles.isy,'String','41'), end;%default |
---|
| 4013 | if str2double(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.isy,'String',num2str(iby_val+8)); end |
---|
[2] | 4014 | par.isx=get(handles.isx,'String'); |
---|
| 4015 | par.isy=get(handles.isy,'String'); |
---|
| 4016 | par.shiftx=get(handles.shiftx,'String'); |
---|
| 4017 | par.shifty=get(handles.shifty,'String'); |
---|
[127] | 4018 | if isnan(str2double(par.isx)) |
---|
[112] | 4019 | par.isx='41';%default |
---|
| 4020 | set(handles.isx,'String','41'); |
---|
[2] | 4021 | end |
---|
[127] | 4022 | if isnan(str2double(par.isy)) |
---|
[112] | 4023 | par.isy='41'; %default |
---|
| 4024 | set(handles.isy,'String','41'); |
---|
[12] | 4025 | end |
---|
[127] | 4026 | if isnan(str2double(par.shiftx)) |
---|
[112] | 4027 | par.shiftx='0';%default |
---|
| 4028 | set(handles.shiftx,'String','0'); |
---|
| 4029 | end |
---|
[127] | 4030 | if isnan(str2double(par.shifty)) |
---|
[112] | 4031 | par.shifty='0'; %default |
---|
| 4032 | set(handles.shifty,'String','0'); |
---|
[12] | 4033 | end |
---|
[112] | 4034 | par.rho=get(handles.rho,'String'); |
---|
[238] | 4035 | if isequal(get(handles.rho,'Style'),'popupmenu') |
---|
| 4036 | index=get(handles.rho,'Value'); |
---|
| 4037 | par.rho=par.rho{index}; |
---|
| 4038 | end |
---|
[112] | 4039 | par.dx=get(handles.dx_civ1,'String'); |
---|
| 4040 | par.dy=get(handles.dy_civ1,'String'); |
---|
[127] | 4041 | if isnan(str2double(par.dx)) |
---|
[112] | 4042 | if isempty(get(handles.grid_civ1,'String')); |
---|
| 4043 | par.dx='0'; %just read by civ program, not used |
---|
| 4044 | else |
---|
[12] | 4045 | par.dx='20';%default |
---|
| 4046 | set(handles.dx_civ1,'String','20'); |
---|
[112] | 4047 | end |
---|
| 4048 | end |
---|
[127] | 4049 | if isnan(str2double(par.dy)) |
---|
[112] | 4050 | if isempty(get(handles.grid_civ1,'String')); |
---|
| 4051 | par.dy='0';%just read by civ program, not used |
---|
| 4052 | else |
---|
[12] | 4053 | par.dy='20';%default |
---|
| 4054 | set(handles.dy_civ1_title,'String','20'); |
---|
[112] | 4055 | end |
---|
| 4056 | end |
---|
| 4057 | par.pxcmx='1'; %velocities are expressed in pixel dispalcement |
---|
| 4058 | par.pxcmy='1'; |
---|
[150] | 4059 | if exist('file_ima','var') |
---|
[112] | 4060 | A=imread(file_ima);%read the first image to get the size |
---|
| 4061 | sizim=size(A); |
---|
| 4062 | par.npx=num2str(sizim(2)); |
---|
| 4063 | par.npy=num2str(sizim(1)); |
---|
[150] | 4064 | end |
---|
[127] | 4065 | %time=get(handles.RootName,'UserData'); %get the set of times |
---|
[112] | 4066 | par.gridname=get(handles.grid_civ1,'String'); |
---|
| 4067 | par.gridflag='y'; |
---|
[127] | 4068 | if strcmp(par.gridname,'')|| isempty(par.gridname) |
---|
[112] | 4069 | par.gridname='nogrid'; |
---|
| 4070 | par.gridflag='n'; |
---|
| 4071 | end |
---|
[12] | 4072 | |
---|
| 4073 | %------------------------------------------------------------------------ |
---|
[2] | 4074 | function par=read_param_civ2(handles,file_ima) |
---|
[12] | 4075 | %------------------------------------------------------------------------ |
---|
| 4076 | par.ibx=get(handles.ibx_civ2,'String'); |
---|
| 4077 | par.iby=get(handles.iby_civ2,'String'); |
---|
| 4078 | par.rho=get(handles.rho_civ2,'String'); |
---|
| 4079 | par.decimal=int2str(get(handles.decimal,'Value')); |
---|
| 4080 | par.deformation=int2str(get(handles.deformation,'Value')); |
---|
| 4081 | par.dx=get(handles.dx_civ2,'String'); |
---|
| 4082 | par.dy=get(handles.dy_civ2,'String'); |
---|
[127] | 4083 | if isnan(str2double(par.dx)) |
---|
[112] | 4084 | if isempty(get(handles.grid_civ2,'String')); |
---|
| 4085 | par.dx='0'; %just read by civ program, not used |
---|
| 4086 | else |
---|
[12] | 4087 | par.dx='20';%default |
---|
| 4088 | set(handles.dx_civ2,'String','20'); |
---|
[112] | 4089 | end |
---|
| 4090 | end |
---|
[127] | 4091 | if isnan(str2double(par.dy)) |
---|
[112] | 4092 | if isempty(get(handles.grid_civ2,'String')); |
---|
| 4093 | par.dy='0';%just read by civ program, not used |
---|
| 4094 | else |
---|
[12] | 4095 | par.dy='20';%default |
---|
| 4096 | set(handles.dy_civ2,'String','20'); |
---|
[112] | 4097 | end |
---|
| 4098 | end |
---|
| 4099 | par.pxcmx='1'; |
---|
| 4100 | par.pxcmy='1'; |
---|
[12] | 4101 | A=imread(file_ima);%read the first image to get the size |
---|
| 4102 | sizim=size(A); |
---|
| 4103 | par.npx=num2str(sizim(2)); |
---|
| 4104 | par.npy=num2str(sizim(1)); |
---|
[127] | 4105 | %time=get(handles.RootName,'UserData'); %get the set of times |
---|
[12] | 4106 | par.gridname=get(handles.grid_civ2,'String'); |
---|
| 4107 | par.gridflag='y'; |
---|
[127] | 4108 | if strcmp(par.gridname,'')|| isempty(par.gridname) |
---|
[12] | 4109 | par.gridname='nogrid'; |
---|
| 4110 | par.gridflag='n'; |
---|
| 4111 | end |
---|
[2] | 4112 | |
---|
[12] | 4113 | %------------------------------------------------------------------------ |
---|
| 4114 | % --- CIV1 CIV1 CIV1 CIV1 |
---|
[94] | 4115 | function cmd_CIV1=CIV1_CMD(filename,namelog,par,handles,sparam) |
---|
[12] | 4116 | %------------------------------------------------------------------------ |
---|
[2] | 4117 | %pixels per cm and matrix of the image times, read from the .civ file by uvmat |
---|
| 4118 | |
---|
| 4119 | %changes : filename_cmx -> filename ( no extension ) |
---|
[174] | 4120 | % input namelog not used |
---|
[112] | 4121 | if isequal(par.Dt,'0') |
---|
| 4122 | par.Dt='1' ;%case of 'displacement' mode |
---|
| 4123 | end |
---|
[90] | 4124 | par.filename_ima_a=regexprep(par.filename_ima_a,'.png',''); |
---|
[94] | 4125 | par.filename_ima_b=regexprep(par.filename_ima_b,'.png',''); |
---|
[230] | 4126 | fid=fopen([filename '.civ1.cmx'],'w'); |
---|
[12] | 4127 | fprintf(fid,['############## CMX file' '\n' ]); |
---|
[112] | 4128 | fprintf(fid, ['FirstImage ' regexprep(par.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
| 4129 | fprintf(fid, ['LastImage ' regexprep(par.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
| 4130 | fprintf(fid, ['XX' '\n' ]); |
---|
| 4131 | fprintf(fid, ['Mask ' par.maskflag '\n' ]); |
---|
| 4132 | fprintf(fid, ['MaskName ' regexprep(par.maskname,'\\','\\\\') '\n' ]); |
---|
| 4133 | fprintf(fid, ['ImageSize ' par.npx ' ' par.npy '\n' ]); %VERIFIER CAS GENERAL ? |
---|
| 4134 | fprintf(fid, ['CorrelationBoxesSize ' par.ibx ' ' par.iby '\n' ]); |
---|
| 4135 | fprintf(fid, ['SearchBoxeSize ' par.isx ' ' par.isy '\n' ]); |
---|
| 4136 | fprintf(fid, ['RO ' par.rho '\n' ]); |
---|
| 4137 | fprintf(fid, ['GridSpacing ' par.dx ' ' par.dy '\n' ]); |
---|
| 4138 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 4139 | fprintf(fid, ['Dt_TO ' par.Dt ' ' par.T0 '\n' ]); |
---|
| 4140 | fprintf(fid, ['PixCmXY ' par.pxcmx ' ' par.pxcmy '\n' ]); |
---|
| 4141 | fprintf(fid, ['XX 1' '\n' ]); |
---|
| 4142 | fprintf(fid, ['ShiftXY ' par.shiftx ' ' par.shifty '\n' ]); |
---|
| 4143 | fprintf(fid, ['Grid ' par.gridflag '\n' ]); |
---|
| 4144 | fprintf(fid, ['GridName ' regexprep(par.gridname,'\\','\\\\') '\n' ]); |
---|
| 4145 | fprintf(fid, ['XX 85' '\n' ]); |
---|
| 4146 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 4147 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 4148 | fprintf(fid, ['Hart 1' '\n' ]); |
---|
| 4149 | fprintf(fid, [ 'DecimalShift 0' '\n' ]); |
---|
| 4150 | fprintf(fid, ['Deformation 0' '\n' ]); |
---|
| 4151 | fprintf(fid, ['CorrelationMin 0' '\n' ]); |
---|
| 4152 | fprintf(fid, ['IntensityMin 0' '\n' ]); |
---|
| 4153 | fprintf(fid, ['SeuilImage n' '\n' ]); |
---|
| 4154 | fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); |
---|
| 4155 | fprintf(fid, ['ImageToUse ' par.term_a ' ' par.term_b '\n' ]); % VERIFIER ? |
---|
| 4156 | fprintf(fid, ['ImageUsedBefore null null' '\n' ]); |
---|
[12] | 4157 | fclose(fid); |
---|
[112] | 4158 | |
---|
[163] | 4159 | % cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file |
---|
| 4160 | % cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\'); |
---|
| 4161 | % namelog=regexprep(namelog,'\\','\\\\'); |
---|
[12] | 4162 | if(isunix) |
---|
[230] | 4163 | cmd_CIV1=['cp -f ' filename '.civ1.cmx ' filename '.cmx\n']; |
---|
| 4164 | cmd_CIV1=[cmd_CIV1 sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx |
---|
[219] | 4165 | 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] | 4166 | % cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.civ1.cmx' '\n'];%rename .cmx as .civ1.cmx |
---|
[163] | 4167 | else %Windows system |
---|
[230] | 4168 | flname=regexprep(flname,'\\','\\\\'); |
---|
| 4169 | % cmd=[cmd 'copy /Y "' flname '.civ1.cmx" "' flname '.cmx"\n']; |
---|
[174] | 4170 | filename=regexprep(filename,'\\','\\\\'); |
---|
[230] | 4171 | cmd_CIV1=['copy /Y "' filename '.civ1.cmx" "' filename '.cmx"\n'];% copy the .civ1.cmx parameter file to .cmx |
---|
[163] | 4172 | cmd_CIV1=['"' sparam.Civ1Bin '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file |
---|
| 4173 | cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\'); |
---|
| 4174 | namelog=regexprep(namelog,'\\','\\\\'); |
---|
[230] | 4175 | cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' filename '.log' '" "' filename '.civ1.log"']; %preserve the log file as .civ1.log |
---|
| 4176 | % cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.civ1.cmx"']; |
---|
[12] | 4177 | end |
---|
[2] | 4178 | |
---|
[12] | 4179 | %------------------------------------------------------------------------ |
---|
| 4180 | % --- CIV1 Unified |
---|
[94] | 4181 | function xml_civ1_parameters=CIV1_CMD_Unified(filename,namelog,par) |
---|
[12] | 4182 | %------------------------------------------------------------------------ |
---|
[2] | 4183 | %pixels per cm and matrix of the image times, read from the .civ file by uvmat |
---|
[73] | 4184 | %global CivBin%name of the executable for civ1 calculation |
---|
[2] | 4185 | |
---|
[112] | 4186 | civ1.image1=par.filename_ima_a; |
---|
| 4187 | civ1.image2=par.filename_ima_b; |
---|
| 4188 | civ1.imageSize_X=par.npx; |
---|
| 4189 | civ1.imageSize_Y=par.npy; |
---|
| 4190 | civ1.outputFileName=[filename '.nc']; |
---|
| 4191 | civ1.correlationBoxesSize_X=par.ibx; |
---|
| 4192 | civ1.correlationBoxesSize_Y=par.iby; |
---|
| 4193 | civ1.searchBoxesSize_X=par.isx; |
---|
| 4194 | civ1.searchBoxesSize_Y=par.isy; |
---|
| 4195 | civ1.globalShift_X=par.shiftx; |
---|
| 4196 | civ1.globalShift_Y=par.shifty; |
---|
| 4197 | civ1.ro=par.rho; |
---|
| 4198 | civ1.hart='y'; |
---|
| 4199 | if isequal(par.gridflag,'y') |
---|
| 4200 | civ1.grid=par.gridname; |
---|
| 4201 | else |
---|
| 4202 | civ1.grid='n'; |
---|
| 4203 | civ1.gridSpacing_X=par.dx; |
---|
| 4204 | civ1.gridSpacing_Y=par.dy; |
---|
| 4205 | end |
---|
| 4206 | if isequal(par.maskflag,'y') |
---|
| 4207 | civ1.mask=par.maskname; |
---|
| 4208 | end |
---|
[229] | 4209 | civ1.dt=par.Dt; |
---|
[112] | 4210 | civ1.unit='pixel'; |
---|
| 4211 | civ1.absolut_time_T0=par.T0; |
---|
| 4212 | civ1.pixcmx=par.pxcmx; |
---|
| 4213 | civ1.pixcmy=par.pxcmy; |
---|
| 4214 | civ1.convectFlow='n'; |
---|
[12] | 4215 | |
---|
[112] | 4216 | xml_civ1_parameters=civ1; |
---|
| 4217 | |
---|
[12] | 4218 | %------------------------------------------------------------------------ |
---|
| 4219 | % --- CIV2 Unified |
---|
[94] | 4220 | function civ2=CIV2_CMD_Unified(filename,namelog,par) |
---|
[12] | 4221 | %------------------------------------------------------------------------ |
---|
[2] | 4222 | %pixels per cm and matrix of the image times, read from the .civ file by uvmat |
---|
[73] | 4223 | %global CivBin%name of the executable for civ1 calculation |
---|
[2] | 4224 | |
---|
| 4225 | civ2.image1=par.filename_ima_a; |
---|
| 4226 | civ2.image2=par.filename_ima_b; |
---|
[112] | 4227 | civ2.imageSize_X=par.npx; |
---|
[2] | 4228 | civ2.imageSize_Y=par.npy; |
---|
| 4229 | civ2.inputFileName=[par.filename_nc1 '.nc']; |
---|
| 4230 | civ2.outputFileName=[filename '.nc']; |
---|
| 4231 | civ2.correlationBoxesSize_X=par.ibx; |
---|
| 4232 | civ2.correlationBoxesSize_Y=par.iby; |
---|
| 4233 | civ2.ro=par.rho; |
---|
| 4234 | %civ2.decimalShift=par.decimal; |
---|
| 4235 | %civ2.deformation=par.deformation; |
---|
| 4236 | if isequal(par.decimal,'1') |
---|
| 4237 | civ2.decimalShift='y'; |
---|
| 4238 | else |
---|
| 4239 | civ2.decimalShift='n'; |
---|
| 4240 | end |
---|
| 4241 | if isequal(par.deformation,'1') |
---|
| 4242 | civ2.deformation='y'; |
---|
| 4243 | else |
---|
| 4244 | civ2.deformation='n'; |
---|
| 4245 | end |
---|
| 4246 | if isequal(par.gridflag,'y') |
---|
| 4247 | civ2.grid=par.gridname; |
---|
| 4248 | else |
---|
| 4249 | civ2.grid='n'; |
---|
| 4250 | civ2.gridSpacing_X=par.dx; |
---|
| 4251 | civ2.gridSpacing_Y=par.dy; |
---|
| 4252 | end |
---|
| 4253 | civ2.gridSpacing_X='10'; |
---|
| 4254 | civ2.gridSpacing_Y='10';%NOTE: faut mettre gridSpacing pourque ca tourne, meme si c'est la grille qui est utilisee |
---|
| 4255 | if isequal(par.maskflag,'y') |
---|
| 4256 | civ2.mask=par.maskname; |
---|
| 4257 | else |
---|
| 4258 | civ2.mask='n'; |
---|
| 4259 | end |
---|
| 4260 | civ2.dt=par.Dt; |
---|
| 4261 | civ2.unit='pixel'; |
---|
| 4262 | civ2.absolut_time_T0=par.T0; |
---|
| 4263 | civ2.pixcmx=par.pxcmx; |
---|
| 4264 | civ2.pixcmy=par.pxcmy; |
---|
| 4265 | civ2.convectFlow='n'; |
---|
| 4266 | civ2.pixcmx=par.pxcmx; |
---|
| 4267 | civ2.pixcmy=par.pxcmy; |
---|
| 4268 | civ2.convectFlow='n'; |
---|
| 4269 | |
---|
[12] | 4270 | %------------------------------------------------------------------------ |
---|
| 4271 | % --- CIV2 CIV2 CIV2 CIV2 |
---|
[134] | 4272 | function cmd_CIV2=CIV2_CMD(filename,namelog,par,sparam) |
---|
[12] | 4273 | %------------------------------------------------------------------------ |
---|
[2] | 4274 | %pixels per cm and matrix of the image times, read from the .civ file by uvmat |
---|
[67] | 4275 | % global civ2Bin sge%name of the executable for civ1 calculation |
---|
[112] | 4276 | if isequal(par.Dt,'0') |
---|
| 4277 | par.Dt='1' ;%case of 'displacement' mode |
---|
| 4278 | end |
---|
[94] | 4279 | par.filename_ima_a=regexprep(par.filename_ima_a,'.png',''); |
---|
| 4280 | par.filename_ima_b=regexprep(par.filename_ima_b,'.png','');% bug : .png appears two times ? |
---|
[174] | 4281 | [fid,errormsg]=fopen([filename '.civ2.cmx'],'w'); |
---|
| 4282 | if isequal(fid,-1) |
---|
| 4283 | msgbox_uvmat('ERROR',errormsg) |
---|
| 4284 | cmd_CIV2=''; |
---|
| 4285 | return |
---|
| 4286 | end |
---|
[94] | 4287 | fprintf(fid,['############## CMX file' '\n' ]); |
---|
| 4288 | fprintf(fid, ['FirstImage ' regexprep(par.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
| 4289 | fprintf(fid, ['LastImage ' regexprep(par.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
| 4290 | fprintf(fid, ['XX' '\n' ]); |
---|
| 4291 | fprintf(fid, ['Mask ' par.maskflag '\n' ]); |
---|
| 4292 | fprintf(fid, ['MaskName ' regexprep(par.maskname,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
| 4293 | fprintf(fid, ['ImageSize ' par.npx ' ' par.npy '\n' ]); %VERIFIER CAS GENERAL ? |
---|
| 4294 | fprintf(fid, ['CorrelationBoxesSize ' par.ibx ' ' par.iby '\n' ]); |
---|
| 4295 | fprintf(fid, ['SearchBoxeSize ' par.ibx ' ' par.iby '\n']); |
---|
| 4296 | fprintf(fid, ['RO ' par.rho '\n']); |
---|
| 4297 | fprintf(fid, ['GridSpacing ' par.dx ' ' par.dy '\n']); |
---|
| 4298 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 4299 | fprintf(fid, ['Dt_TO ' par.Dt ' ' par.T0 '\n' ]); |
---|
| 4300 | fprintf(fid, ['PixCmXY ' par.pxcmx ' ' par.pxcmy '\n' ]); |
---|
| 4301 | fprintf(fid, ['XX 1' '\n' ]); |
---|
[122] | 4302 | fprintf(fid, 'ShiftXY 0 0\n'); |
---|
[94] | 4303 | fprintf(fid, ['Grid ' par.gridflag '\n' ]); |
---|
| 4304 | fprintf(fid, ['GridName ' regexprep(par.gridname,'\\','\\\\') '\n']); |
---|
| 4305 | fprintf(fid, ['XX 85' '\n' ]); |
---|
| 4306 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 4307 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 4308 | fprintf(fid, ['Hart 1' '\n' ]); |
---|
| 4309 | fprintf(fid, ['DecimalShift ' par.decimal '\n']); |
---|
| 4310 | fprintf(fid, ['Deformation ' par.deformation '\n']); |
---|
| 4311 | fprintf(fid, ['CorrelationMin 0' '\n' ]); |
---|
| 4312 | fprintf(fid, ['IntensityMin 0' '\n' ]); |
---|
| 4313 | fprintf(fid, ['SeuilImage n' '\n' ]); |
---|
| 4314 | fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); |
---|
| 4315 | fprintf(fid, ['ImageToUse ' par.term_a ' ' par.term_b '\n' ]); % VERIFIER ? |
---|
| 4316 | fprintf(fid, ['ImageUsedBefore ' regexprep(par.filename_nc1,'\\','\\\\') '\n']); |
---|
| 4317 | fclose(fid); |
---|
| 4318 | |
---|
[134] | 4319 | if(isunix) |
---|
[230] | 4320 | cmd_CIV2=['cp -f ' filename '.civ2.cmx ' filename '.cmx\n']; |
---|
| 4321 | cmd_CIV2=[cmd_CIV2 sparam.Civ2Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx |
---|
| 4322 | cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.log' ' ' filename '.civ2.log' '\n' 'chmod g+w ' filename '.nc'];%preserve the log file as .civ2.log |
---|
| 4323 | % 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 |
---|
| 4324 | |
---|
[163] | 4325 | else |
---|
[174] | 4326 | filename=regexprep(filename,'\\','\\\\'); |
---|
[230] | 4327 | cmd_CIV2=['copy /Y "' filename '.civ2.cmx" "' filename '.cmx"\n']; |
---|
| 4328 | cmd_CIV2=[cmd_CIV2 '"' sparam.Civ2Bin '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file |
---|
[163] | 4329 | cmd_CIV2=regexprep(cmd_CIV2,'\\','\\\\'); |
---|
[174] | 4330 | cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.log' '" "' filename '.civ2.log"']; |
---|
[230] | 4331 | % cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.civ2.cmx"']; |
---|
[134] | 4332 | end |
---|
| 4333 | |
---|
[238] | 4334 | % %------------------------------------------------------------------------ |
---|
| 4335 | % % --- civ using pivlab |
---|
| 4336 | % function Data=civ_uvmat(par_civ1) |
---|
| 4337 | % %------------------------------------------------------------------------ |
---|
| 4338 | % image1=imread(par_civ1.filename_ima_a); |
---|
| 4339 | % image2=imread(par_civ1.filename_ima_b); |
---|
| 4340 | % stepx=str2num(par_civ1.dx); |
---|
| 4341 | % stepy=str2num(par_civ1.dy); |
---|
| 4342 | % ibx2=ceil(str2num(par_civ1.ibx)/2); |
---|
| 4343 | % iby2=ceil(str2num(par_civ1.iby)/2); |
---|
| 4344 | % isx2=ceil(str2num(par_civ1.isx)/2); |
---|
| 4345 | % isy2=ceil(str2num(par_civ1.isy)/2); |
---|
| 4346 | % shiftx=str2num(par_civ1.shiftx); |
---|
| 4347 | % shifty=str2num(par_civ1.shifty); |
---|
| 4348 | % miniy=max(1+isy2-shifty,1+iby2); |
---|
| 4349 | % minix=max(1+isx2-shiftx,1+ibx2); |
---|
| 4350 | % maxiy=min(size(image1,1)-isy2-shifty,size(image1,1)-iby2); |
---|
| 4351 | % maxix=min(size(image1,2)-isx2-shiftx,size(image1,2)-ibx2); |
---|
| 4352 | % [GridX,GridY]=meshgrid(minix:stepx:maxix,miniy:stepy:maxiy); |
---|
| 4353 | % PointCoord(:,1)=reshape(GridX,[],1); |
---|
| 4354 | % PointCoord(:,2)=reshape(GridY,[],1); |
---|
| 4355 | % % caluclate velocity data (y and v in indices, reverse to y component) |
---|
| 4356 | % [xtable ytable utable vtable ctable F] = pivlab (image1,image2,ibx2,iby2,isx2,isy2,shiftx,shifty,PointCoord, 1, []); |
---|
| 4357 | % Data.ListGlobalAttribute=[{'Conventions','Program','CivStage'} {'Time','Dt'}]; |
---|
| 4358 | % Data.Conventions='uvmat/civdata'; |
---|
| 4359 | % Data.Program='civ_uvmat'; |
---|
| 4360 | % Data.CivStage=1; |
---|
| 4361 | % % list_param=fieldnames(Param.Civ1); |
---|
| 4362 | % % for ilist=1:length(list_param) |
---|
| 4363 | % % eval(['Data.Civ1_' list_param{ilist} '=Param.Civ1.' list_param{ilist} ';']) |
---|
| 4364 | % % end |
---|
| 4365 | % Data.Time=str2double(par_civ1.T0); |
---|
| 4366 | % Data.Dt=str2double(par_civ1.Dt); |
---|
| 4367 | % Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F'};% cell array containing the names of the fields to record |
---|
| 4368 | % Data.VarDimName={'nbvec','nbvec','nbvec','nbvec','nbvec','nbvec'}; |
---|
| 4369 | % Data.VarAttribute{1}.Role='coord_x'; |
---|
| 4370 | % Data.VarAttribute{2}.Role='coord_y'; |
---|
| 4371 | % Data.VarAttribute{3}.Role='vector_x'; |
---|
| 4372 | % Data.VarAttribute{4}.Role='vector_y'; |
---|
| 4373 | % Data.VarAttribute{5}.Role='warnflag'; |
---|
| 4374 | % Data.Civ1_X=reshape(xtable,[],1); |
---|
| 4375 | % Data.Civ1_Y=reshape(size(image1,1)-ytable+1,[],1); |
---|
| 4376 | % Data.Civ1_U=reshape(utable,[],1); |
---|
| 4377 | % Data.Civ1_V=reshape(-vtable,[],1); |
---|
| 4378 | % Data.Civ1_C=reshape(ctable,[],1); |
---|
| 4379 | % Data.Civ1_F=reshape(F,[],1); |
---|
[134] | 4380 | |
---|
[12] | 4381 | %------------------------------------------------------------------------ |
---|
[2] | 4382 | % --- Executes on button press in HELP. |
---|
| 4383 | function HELP_Callback(hObject, eventdata, handles) |
---|
[12] | 4384 | %------------------------------------------------------------------------ |
---|
[2] | 4385 | path_to_uvmat=which ('uvmat');% check the path of uvmat |
---|
| 4386 | pathelp=fileparts(path_to_uvmat); |
---|
[85] | 4387 | helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html'); |
---|
[36] | 4388 | if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package') |
---|
[2] | 4389 | else |
---|
[36] | 4390 | addpath (fullfile(pathelp,'uvmat_doc')) |
---|
[112] | 4391 | web([helpfile '#civ']) |
---|
[2] | 4392 | end |
---|
| 4393 | |
---|
[12] | 4394 | %------------------------------------------------------------------------ |
---|
[2] | 4395 | %--read images and convert them to the uint16 format used for PIV |
---|
[45] | 4396 | function A=read_image(filename,type_ima,num,movieobject) |
---|
[12] | 4397 | %------------------------------------------------------------------------ |
---|
[2] | 4398 | %num is the view number needed for an avi movie |
---|
[45] | 4399 | switch type_ima |
---|
| 4400 | case 'movie' |
---|
| 4401 | A=read(movieobject,num); |
---|
| 4402 | case 'avi' |
---|
[112] | 4403 | mov=aviread(filename,num); |
---|
| 4404 | A=frame2im(mov(1)); |
---|
[45] | 4405 | case 'multimage' |
---|
| 4406 | A=imread(filename,num); |
---|
[112] | 4407 | case 'image' |
---|
[45] | 4408 | A=imread(filename); |
---|
| 4409 | end |
---|
| 4410 | siz=size(A); |
---|
| 4411 | if length(siz)==3;%color images |
---|
[2] | 4412 | A=sum(double(A),3); |
---|
| 4413 | A=uint16(A); |
---|
| 4414 | end |
---|
| 4415 | |
---|
[12] | 4416 | %------------------------------------------------------------------------ |
---|
[2] | 4417 | function ref_i_Callback(hObject, eventdata, handles) |
---|
[12] | 4418 | %------------------------------------------------------------------------ |
---|
[2] | 4419 | mode_list=get(handles.mode,'String'); |
---|
| 4420 | mode_value=get(handles.mode,'Value'); |
---|
| 4421 | mode=mode_list{mode_value}; |
---|
[45] | 4422 | find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
[12] | 4423 | if isequal(mode,'series(Di)') || ...% we do patch2 only |
---|
[112] | 4424 | (get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0) |
---|
[2] | 4425 | find_netcpair_civ2(hObject, eventdata, handles); |
---|
| 4426 | end |
---|
| 4427 | |
---|
[12] | 4428 | %------------------------------------------------------------------------ |
---|
[2] | 4429 | function ref_j_Callback(hObject, eventdata, handles) |
---|
[12] | 4430 | %------------------------------------------------------------------------ |
---|
[2] | 4431 | mode_list=get(handles.mode,'String'); |
---|
| 4432 | mode_value=get(handles.mode,'Value'); |
---|
| 4433 | mode=mode_list{mode_value}; |
---|
[112] | 4434 | if isequal(get(handles.CIV1,'Value'),0)|| isequal(mode,'series(Dj)') |
---|
[2] | 4435 | find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
| 4436 | end |
---|
[45] | 4437 | if isequal(mode,'series(Dj)') || ... |
---|
[112] | 4438 | (get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0) |
---|
[2] | 4439 | find_netcpair_civ2(hObject, eventdata, handles); |
---|
| 4440 | end |
---|
[12] | 4441 | |
---|
| 4442 | %------------------------------------------------------------------------ |
---|
[71] | 4443 | function ref_i_civ2_Callback(hObject, eventdata, handles) |
---|
| 4444 | %------------------------------------------------------------------------ |
---|
| 4445 | mode_list=get(handles.mode,'String'); |
---|
| 4446 | mode_value=get(handles.mode,'Value'); |
---|
| 4447 | mode=mode_list{mode_value}; |
---|
| 4448 | find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
| 4449 | |
---|
| 4450 | %------------------------------------------------------------------------ |
---|
| 4451 | function ref_j_civ2_Callback(hObject, eventdata, handles) |
---|
| 4452 | %------------------------------------------------------------------------ |
---|
| 4453 | mode_list=get(handles.mode,'String'); |
---|
| 4454 | mode_value=get(handles.mode,'Value'); |
---|
| 4455 | mode=mode_list{mode_value}; |
---|
[112] | 4456 | if isequal(mode,'series(Dj)') |
---|
[71] | 4457 | find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
| 4458 | end |
---|
| 4459 | |
---|
| 4460 | %------------------------------------------------------------------------ |
---|
[2] | 4461 | % --- Executes on button press in compare. |
---|
| 4462 | function compare_Callback(hObject, eventdata, handles) |
---|
[12] | 4463 | %------------------------------------------------------------------------ |
---|
[2] | 4464 | test=get(handles.compare,'Value'); |
---|
[112] | 4465 | if test==2 || test==3 |
---|
[71] | 4466 | filebase=get(handles.RootName,'String'); |
---|
[2] | 4467 | browse=get(handles.browse_root,'Userdata'); |
---|
| 4468 | browse.nom_type_ima1=browse.nom_type_ima; |
---|
| 4469 | set(handles.browse_root,'UserData',browse); |
---|
| 4470 | set(handles.sub_txt,'Visible','on') |
---|
[112] | 4471 | set(handles.RootName_1,'Visible','On');%mkes the second file input window visible |
---|
[2] | 4472 | mode_store=get(handles.mode,'String');%get the present 'mode' |
---|
[112] | 4473 | set(handles.compare,'UserData',mode_store);%store the mode display |
---|
[2] | 4474 | set(handles.mode,'Visible','off') |
---|
| 4475 | if test==2 |
---|
[112] | 4476 | set(handles.mode,'Visible','off') |
---|
[2] | 4477 | else |
---|
| 4478 | set(handles.mode,'Visible','on') |
---|
| 4479 | end |
---|
| 4480 | |
---|
[229] | 4481 | %% open an image file with the browser |
---|
[2] | 4482 | ind_opening=1;%default |
---|
| 4483 | browse.incr_pair=[0 0]; %default |
---|
[71] | 4484 | oldfile=get(handles.RootName,'String'); |
---|
[229] | 4485 | menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)'; |
---|
| 4486 | '*.xml', '.xml files '; ... |
---|
| 4487 | '*.civ', '.civ files '; ... |
---|
| 4488 | '*.png','.png image files'; ... |
---|
| 4489 | '*.jpg',' jpeg image files'; ... |
---|
| 4490 | '*.tif','.tif image files'; ... |
---|
| 4491 | '*.avi;*.AVI','.avi movie files'; ... |
---|
| 4492 | '*.nc','.netcdf files'; ... |
---|
| 4493 | '*.*', 'All Files (*.*)'}; |
---|
| 4494 | [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file of the second series',oldfile); |
---|
[112] | 4495 | fileinput=[PathName FileName];%complete file name |
---|
[2] | 4496 | sizf=size(fileinput); |
---|
[229] | 4497 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
[2] | 4498 | [path,name,ext]=fileparts(fileinput); |
---|
| 4499 | [path1]=fileparts(filebase); |
---|
[229] | 4500 | % if isunix |
---|
| 4501 | % ['readlink ' path] |
---|
| 4502 | % [status,path]=system(['readlink ' path]) |
---|
| 4503 | % [status,path1]=system(['readlink ' path1])% look for the true path in case of symbolic paths |
---|
| 4504 | % end |
---|
[2] | 4505 | if ~strcmp(path1,path) |
---|
[112] | 4506 | msgbox_uvmat('ERROR','The two input image series must be in the same directory') |
---|
[2] | 4507 | return |
---|
| 4508 | end |
---|
[71] | 4509 | set(handles.RootName_1,'String',name); |
---|
[2] | 4510 | [RootPath,RootFile,field_count,str2,str_a,str_b,xx,nom_type,subdir]=name2display(name); |
---|
| 4511 | browse=get(handles.browse_root,'UserData'); |
---|
| 4512 | browse.nom_type_ima_1=nom_type; |
---|
[112] | 4513 | set(handles.browse_root,'UserData',browse) |
---|
[2] | 4514 | |
---|
| 4515 | %check image extension |
---|
[71] | 4516 | if ~strcmp(ext,get(handles.ImaExt,'String')) |
---|
[229] | 4517 | msgbox_uvmat('ERROR','The two input image series must have the same extension name') |
---|
[2] | 4518 | return |
---|
| 4519 | end |
---|
| 4520 | |
---|
[229] | 4521 | %% check coincidence of image sizes |
---|
| 4522 | ref_i=get(handles.ref_i,'string'); |
---|
| 4523 | ref_j=get(handles.ref_j,'string'); |
---|
| 4524 | [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]); |
---|
| 4525 | A=imread(filecell.ima1.civ1{1}); |
---|
| 4526 | A_1=imread(fileinput); |
---|
| 4527 | npxy=size(A); |
---|
| 4528 | npxy_1=size(A_1); |
---|
| 4529 | if ~isequal(size(A),size(A_1)) |
---|
| 4530 | msgbox_uvmat('ERROR','The two input image series do not have the same size') |
---|
[2] | 4531 | return |
---|
| 4532 | end |
---|
| 4533 | else |
---|
| 4534 | set(handles.mode,'Visible','on') |
---|
[71] | 4535 | set(handles.RootName_1,'Visible','Off'); |
---|
[2] | 4536 | set(handles.sub_txt,'Visible','off') |
---|
[71] | 4537 | set(handles.RootName_1,'String',[]); |
---|
[2] | 4538 | mode_store=get(handles.compare,'UserData'); |
---|
[177] | 4539 | set(handles.mode,'Value',1) |
---|
[2] | 4540 | set(handles.mode,'String',mode_store) |
---|
| 4541 | set(handles.test_stereo1,'Value',0) |
---|
| 4542 | set(handles.test_stereo2,'Value',0) |
---|
| 4543 | end |
---|
[252] | 4544 | if test==3 && get(handles.PATCH1,'Value') |
---|
| 4545 | set(handles.stereo1,'Visible','on') |
---|
| 4546 | else |
---|
| 4547 | set(handles.stereo1,'Visible','off') |
---|
| 4548 | end |
---|
| 4549 | if test==3 && get(handles.PATCH2,'Value') |
---|
| 4550 | set(handles.stereo2,'Visible','on') |
---|
| 4551 | else |
---|
| 4552 | set(handles.stereo2,'Visible','off') |
---|
| 4553 | end |
---|
[2] | 4554 | mode_Callback(hObject, eventdata, handles) |
---|
| 4555 | |
---|
[12] | 4556 | %------------------------------------------------------------------------ |
---|
[2] | 4557 | % --- Executes on button press in get_ref_fix1. |
---|
| 4558 | function get_ref_fix1_Callback(hObject, eventdata, handles) |
---|
[12] | 4559 | %------------------------------------------------------------------------ |
---|
[71] | 4560 | filebase=get(handles.RootName,'String'); |
---|
[2] | 4561 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 4562 | {'*.nc', ' (*.nc)'; |
---|
| 4563 | '*.nc', 'netcdf files '; ... |
---|
| 4564 | '*.*', 'All Files (*.*)'}, ... |
---|
| 4565 | 'Pick a file',filebase); |
---|
| 4566 | |
---|
[2] | 4567 | fileinput=[PathName FileName]; |
---|
| 4568 | sizf=size(fileinput); |
---|
[122] | 4569 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
[2] | 4570 | [Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
| 4571 | ref.filebase=fullfile(Path,File); |
---|
| 4572 | ref.num_a=stra2num(str_a); |
---|
| 4573 | ref.num_b=stra2num(str_b); |
---|
[89] | 4574 | ref.num1=str2double(field_count); |
---|
| 4575 | ref.num2=str2double(str2); |
---|
[2] | 4576 | browse=[];%initialisation |
---|
| 4577 | if ~isequal(ref.ext,'.nc') |
---|
| 4578 | msgbox_uvmat('ERROR','the reference file must be in netcdf format (*.nc)') |
---|
| 4579 | return |
---|
| 4580 | end |
---|
| 4581 | set(handles.ref_fix1,'String',[fullfile(ref.subdir,File) '....nc']); |
---|
| 4582 | set(handles.ref_fix1,'UserData',ref) |
---|
| 4583 | menu_field{1}='civ1'; |
---|
| 4584 | Data=nc2struct(fileinput,[]); |
---|
[45] | 4585 | if isfield(Data,'patch') && isequal(Data.patch,1) |
---|
[2] | 4586 | menu_field{2}='filter1'; |
---|
| 4587 | end |
---|
[45] | 4588 | if isfield(Data,'civ2') && isequal(Data.civ2,1) |
---|
[2] | 4589 | menu_field{3}='civ2'; |
---|
| 4590 | end |
---|
[45] | 4591 | if isfield(Data,'patch2') && isequal(Data.patch2,1) |
---|
[2] | 4592 | menu_field{4}='filter2'; |
---|
| 4593 | end |
---|
| 4594 | set(handles.field_ref1,'String',menu_field); |
---|
| 4595 | set(handles.field_ref1,'Value',length(menu_field)); |
---|
| 4596 | set(handles.inf_sup1,'Value',2); |
---|
| 4597 | set(handles.thresh_vel,'String','1');%default threshold |
---|
| 4598 | set(handles.ref_fix1,'Enable','on') |
---|
[12] | 4599 | |
---|
| 4600 | %------------------------------------------------------------------------ |
---|
[2] | 4601 | % --- Executes on button press in get_ref_fix2. |
---|
| 4602 | function get_ref_fix2_Callback(hObject, eventdata, handles) |
---|
[12] | 4603 | %------------------------------------------------------------------------ |
---|
[2] | 4604 | if isequal(get(handles.get_ref_fix2,'Value'),1) |
---|
[71] | 4605 | filebase=get(handles.RootName,'String'); |
---|
[2] | 4606 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 4607 | {'*.nc', ' (*.nc)'; |
---|
| 4608 | '*.nc', 'netcdf files '; ... |
---|
| 4609 | '*.*', 'All Files (*.*)'}, ... |
---|
| 4610 | 'Pick a file',filebase); |
---|
[2] | 4611 | fileinput=[PathName FileName]; |
---|
| 4612 | sizf=size(fileinput); |
---|
[45] | 4613 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
[2] | 4614 | [Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
| 4615 | ref.filebase=fullfile(Path,File); |
---|
| 4616 | ref.num_a=stra2num(str_a); |
---|
| 4617 | ref.num_b=stra2num(str_b); |
---|
| 4618 | ref.num1=str2num(field_count); |
---|
| 4619 | ref.num2=str2num(str2); |
---|
| 4620 | browse=[];%initialisation |
---|
| 4621 | if ~isequal(ref.ext,'.nc') |
---|
| 4622 | msgbox_uvmat('ERROR','the reference file must be in netcdf format (*.nc)') |
---|
| 4623 | return |
---|
| 4624 | end |
---|
| 4625 | set(handles.ref_fix2,'String',[fullfile(ref.subdir,File) '....nc']); |
---|
[112] | 4626 | set(handles.ref_fix2,'UserData',ref) |
---|
[2] | 4627 | menu_field{1}='civ1'; |
---|
| 4628 | Data=nc2struct(fileinput,[]); |
---|
| 4629 | if isfield(Data,'patch') & isequal(Data.patch,1) |
---|
| 4630 | menu_field{2}='filter1'; |
---|
| 4631 | end |
---|
| 4632 | if isfield(Data,'civ2') & isequal(Data.civ2,1) |
---|
| 4633 | menu_field{3}='civ2'; |
---|
| 4634 | end |
---|
| 4635 | if isfield(Data,'patch2') & isequal(Data.patch2,1) |
---|
| 4636 | menu_field{4}='filter2'; |
---|
| 4637 | end |
---|
| 4638 | set(handles.field_ref2,'String',menu_field); |
---|
| 4639 | set(handles.field_ref2,'Value',length(menu_field)); |
---|
| 4640 | set(handles.inf_sup2,'Value',2); |
---|
| 4641 | set(handles.thresh_vel2,'String','1');%default threshold |
---|
| 4642 | set(handles.ref_fix2,'Enable','on') |
---|
| 4643 | set(handles.ref_fix2,'Visible','on') |
---|
| 4644 | set(handles.field_ref2,'Visible','on') |
---|
| 4645 | else |
---|
| 4646 | set(handles.ref_fix2,'Visible','off') |
---|
| 4647 | set(handles.field_ref2,'Visible','off') |
---|
| 4648 | end |
---|
| 4649 | |
---|
[12] | 4650 | %------------------------------------------------------------------------ |
---|
[2] | 4651 | function ref_fix1_Callback(hObject, eventdata, handles) |
---|
[12] | 4652 | %------------------------------------------------------------------------ |
---|
| 4653 | set(handles.inf_sup1,'Value',1); |
---|
| 4654 | set(handles.field_ref1,'Value',1) |
---|
| 4655 | set(handles.field_ref1,'String',{' '}) |
---|
| 4656 | set(handles.ref_fix1,'UserData',[]); |
---|
| 4657 | set(handles.ref_fix1,'String',''); |
---|
| 4658 | set(handles.thresh_vel1,'String','0'); |
---|
[112] | 4659 | |
---|
[12] | 4660 | %------------------------------------------------------------------------ |
---|
[2] | 4661 | function ref_fix2_Callback(hObject, eventdata, handles) |
---|
[12] | 4662 | %------------------------------------------------------------------------ |
---|
| 4663 | set(handles.inf_sup2,'Value',1); |
---|
| 4664 | set(handles.field_ref2,'Value',1) |
---|
| 4665 | set(handles.field_ref2,'String',{' '}) |
---|
| 4666 | set(handles.ref_fix2,'UserData',[]); |
---|
| 4667 | set(handles.ref_fix2,'String',''); |
---|
| 4668 | set(handles.thresh_vel2,'String','0'); |
---|
[2] | 4669 | |
---|
[12] | 4670 | %------------------------------------------------------------------------ |
---|
[2] | 4671 | % --- Executes on button press in test_stereo1. |
---|
| 4672 | function test_stereo1_Callback(hObject, eventdata, handles) |
---|
[12] | 4673 | %------------------------------------------------------------------------ |
---|
[2] | 4674 | if isequal(get(handles.test_stereo1,'Value'),0) |
---|
| 4675 | set(handles.subdomain_patch1,'Visible','on') |
---|
| 4676 | set(handles.rho_patch1,'Visible','on') |
---|
| 4677 | else |
---|
| 4678 | set(handles.subdomain_patch1,'Visible','off') |
---|
| 4679 | set(handles.rho_patch1,'Visible','off') |
---|
| 4680 | end |
---|
| 4681 | |
---|
[12] | 4682 | %------------------------------------------------------------------------ |
---|
[2] | 4683 | % --- Executes on button press in test_stereo2. |
---|
| 4684 | function test_stereo2_Callback(hObject, eventdata, handles) |
---|
[12] | 4685 | %------------------------------------------------------------------------ |
---|
[2] | 4686 | if isequal(get(handles.test_stereo2,'Value'),0) |
---|
| 4687 | set(handles.subdomain_patch2,'Visible','on') |
---|
| 4688 | set(handles.rho_patch2,'Visible','on') |
---|
| 4689 | else |
---|
| 4690 | set(handles.subdomain_patch2,'Visible','off') |
---|
| 4691 | set(handles.rho_patch2,'Visible','off') |
---|
| 4692 | end |
---|
| 4693 | |
---|
[12] | 4694 | %------------------------------------------------------------------------ |
---|
[2] | 4695 | % --- Executes on button press in ImaThreshold. |
---|
| 4696 | function ImaThreshold_Callback(hObject, eventdata, handles) |
---|
[12] | 4697 | %------------------------------------------------------------------------ |
---|
[2] | 4698 | if isequal(get(handles.ImaThreshold,'Value'),1) |
---|
| 4699 | set(handles.MinIma,'Visible','on') |
---|
| 4700 | set(handles.MaxIma,'Visible','on') |
---|
| 4701 | else |
---|
| 4702 | set(handles.MinIma,'Visible','off') |
---|
| 4703 | set(handles.MaxIma,'Visible','off') |
---|
| 4704 | end |
---|
| 4705 | |
---|
[12] | 4706 | %------------------------------------------------------------------------ |
---|
[2] | 4707 | % --- Executes on button press in ImaThreshold2. |
---|
| 4708 | function ImaThreshold2_Callback(hObject, eventdata, handles) |
---|
[12] | 4709 | %------------------------------------------------------------------------ |
---|
[2] | 4710 | if isequal(get(handles.ImaThreshold2,'Value'),1) |
---|
| 4711 | set(handles.MinIma2,'Visible','on') |
---|
| 4712 | set(handles.MaxIma2,'Visible','on') |
---|
| 4713 | else |
---|
| 4714 | set(handles.MinIma2,'Visible','off') |
---|
| 4715 | set(handles.MaxIma2,'Visible','off') |
---|
| 4716 | end |
---|
| 4717 | |
---|
[224] | 4718 | %------------------------------------------------------------------------ |
---|
[225] | 4719 | % --- Executes on button press in TestCiv1: display image correlation function |
---|
[150] | 4720 | function TestCiv1_Callback(hObject, eventdata, handles) |
---|
[224] | 4721 | %------------------------------------------------------------------------ |
---|
[233] | 4722 | set(handles.TestCiv1,'BackgroundColor',[1 1 0]) |
---|
| 4723 | drawnow |
---|
[150] | 4724 | test_civ1=get(handles.TestCiv1,'Value'); |
---|
| 4725 | if test_civ1 |
---|
[227] | 4726 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
| 4727 | if strcmp(get(handles.ref_j,'Visible'),'on') |
---|
| 4728 | ref_j=str2double(get(handles.ref_j,'String')); |
---|
| 4729 | else |
---|
| 4730 | ref_j=1;%default |
---|
| 4731 | end |
---|
[224] | 4732 | [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]=... |
---|
[248] | 4733 | set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]) |
---|
[224] | 4734 | Data.ListVarName={'ny','nx','A'}; |
---|
| 4735 | Data.VarDimName={'ny','nx',{'ny','nx'}}; |
---|
| 4736 | Data.A=imread(filecell.ima1.civ1{1}); |
---|
| 4737 | Data.ny=[size(Data.A,1) 1]; |
---|
| 4738 | Data.nx=[1 size(Data.A,2)]; |
---|
[227] | 4739 | par_civ1=read_param_civ1(handles,filecell.ima1.civ1{1}); |
---|
[231] | 4740 | par_civ1.filename_ima_a=filecell.ima1.civ1{1}; |
---|
| 4741 | par_civ1.filename_ima_b=filecell.ima2.civ1{1}; |
---|
| 4742 | par_civ1.T0=0; |
---|
| 4743 | par_civ1.Dt=1; |
---|
[246] | 4744 | Param.Civ1=par_civ1; |
---|
| 4745 | Data=civ_uvmat(Param); |
---|
[231] | 4746 | Data.ListVarName=[Data.ListVarName {'ny','nx','A'}]; |
---|
| 4747 | Data.VarDimName=[Data.VarDimName {'ny','nx',{'ny','nx'}}]; |
---|
| 4748 | Data.A=imread(filecell.ima1.civ1{1}); |
---|
| 4749 | Data.ny=[size(Data.A,1) 1]; |
---|
| 4750 | Data.nx=[1 size(Data.A,2)]; |
---|
| 4751 | hview_field=view_field(Data); |
---|
| 4752 | set(0,'CurrentFigure',hview_field) |
---|
| 4753 | hhview_field=guihandles(hview_field); |
---|
| 4754 | set(hview_field,'CurrentAxes',hhview_field.axes3) |
---|
| 4755 | ViewData=get(hview_field,'UserData'); |
---|
| 4756 | ViewData.CivHandle=handles.civ;% indicate the handle of the civ GUI in view_field |
---|
[224] | 4757 | ViewData.axes3.B=imread(filecell.ima2.civ1{1});%store the second image in the UserData of the GUI view_field |
---|
[236] | 4758 | ViewData.axes3.X=Data.Civ1_X; %keep the set of points in memeory |
---|
| 4759 | ViewData.axes3.Y=Data.Civ1_Y; |
---|
[231] | 4760 | set(hview_field,'UserData',ViewData) |
---|
[224] | 4761 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display |
---|
| 4762 | if isempty(corrfig) |
---|
| 4763 | corrfig=figure; |
---|
| 4764 | set(corrfig,'tag','corrfig') |
---|
| 4765 | set(corrfig,'name','image correlation') |
---|
| 4766 | set(corrfig,'DeleteFcn',{@closeview_field})% |
---|
| 4767 | end |
---|
[233] | 4768 | set(handles.TestCiv1,'BackgroundColor',[1 0 0]) |
---|
[224] | 4769 | else |
---|
| 4770 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display |
---|
| 4771 | if ~isempty(corrfig) |
---|
| 4772 | delete(corrfig) |
---|
| 4773 | end |
---|
| 4774 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
| 4775 | if ~isempty(hview_field) |
---|
| 4776 | delete(hview_field) |
---|
| 4777 | end |
---|
[150] | 4778 | end |
---|
[71] | 4779 | |
---|
[224] | 4780 | function closeview_field(gcbo,eventdata) |
---|
| 4781 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
| 4782 | if ~isempty(hview_field) |
---|
| 4783 | delete(hview_field) |
---|
| 4784 | end |
---|
[177] | 4785 | %------------------------------------------------------------------- |
---|
| 4786 | % --- Executes on button press in status. |
---|
| 4787 | function status_Callback(hObject, eventdata, handles) |
---|
| 4788 | %------------------------------------------------------------------- |
---|
| 4789 | val=get(handles.status,'Value'); |
---|
| 4790 | if val==0 |
---|
[252] | 4791 | set(handles.status,'BackgroundColor',[0 1 0]) |
---|
[177] | 4792 | hfig=findobj(allchild(0),'name','civ_status'); |
---|
| 4793 | if ~isempty(hfig) |
---|
| 4794 | delete(hfig) |
---|
| 4795 | end |
---|
| 4796 | return |
---|
| 4797 | end |
---|
[252] | 4798 | set(handles.status,'BackgroundColor',[1 1 0]) |
---|
| 4799 | drawnow |
---|
[177] | 4800 | listtype={'civ1','fix1','patch1','civ2','fix2','patch2'}; |
---|
| 4801 | box_test(1)=get(handles.CIV1,'Value'); |
---|
| 4802 | box_test(2)=get(handles.FIX1,'Value'); |
---|
| 4803 | box_test(3)=get(handles.PATCH1,'Value'); |
---|
| 4804 | box_test(4)=get(handles.CIV2,'Value'); |
---|
| 4805 | box_test(5)=get(handles.FIX2,'Value'); |
---|
[180] | 4806 | box_test(6)=get(handles.PATCH2,'Value'); |
---|
| 4807 | option_civ=find(box_test,1,'last');%last selected option (non-zero index of box_test) |
---|
[252] | 4808 | filecell=get(handles.civ,'UserData');%retrieve the list of output files expected for PIV |
---|
| 4809 | test_new=0; |
---|
[177] | 4810 | if ~isfield(filecell,'nc') |
---|
[252] | 4811 | test_new=1; |
---|
[227] | 4812 | [ref_i,ref_j,errormsg]=find_ref_indices(handles); |
---|
| 4813 | if ~isempty(errormsg) |
---|
| 4814 | msgbox_uvmat('ERROR',errormsg) |
---|
| 4815 | return |
---|
| 4816 | end |
---|
[252] | 4817 | filecell=set_civ_filenames(handles,ref_i,ref_j,box_test);%determine the output file expected from the GUI status |
---|
[177] | 4818 | end |
---|
| 4819 | if ~isequal(box_test(4:6),[0 0 0]) |
---|
[252] | 4820 | civ_files=filecell.nc.civ2;%case of civ2 operations |
---|
[177] | 4821 | else |
---|
| 4822 | civ_files=filecell.nc.civ1; |
---|
| 4823 | end |
---|
| 4824 | [root,filename,ext]=fileparts(civ_files{1}); |
---|
| 4825 | [rootroot,subdir,extdir]=fileparts(root); |
---|
| 4826 | hfig=findobj(allchild(0),'name','civ_status'); |
---|
| 4827 | if isempty(hfig) |
---|
[252] | 4828 | hfig=figure('DeleteFcn',@stop_status); |
---|
[177] | 4829 | set(hfig,'name','civ_status') |
---|
[182] | 4830 | hlist=uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @open_view_field,'tag','list'); |
---|
[252] | 4831 | uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox','Max',2,'String','checking files...'); |
---|
[177] | 4832 | uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); |
---|
[182] | 4833 | 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] | 4834 | BarPosition=[0.05 0.81 0.01 0.05]; |
---|
| 4835 | hwaitbar=uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar'); |
---|
[252] | 4836 | drawnow |
---|
[177] | 4837 | end |
---|
[188] | 4838 | % datnum=[]; |
---|
[177] | 4839 | Tabchar={}; |
---|
| 4840 | nbfiles=numel(civ_files); |
---|
| 4841 | count=0; |
---|
[188] | 4842 | testrecent=0; |
---|
[177] | 4843 | while count<nbfiles |
---|
| 4844 | count=0; |
---|
[188] | 4845 | datnum=zeros(1,nbfiles); |
---|
[177] | 4846 | for ifile=1:nbfiles |
---|
| 4847 | detect=exist(civ_files{ifile},'file'); % check the existence of the file |
---|
[179] | 4848 | option=0; |
---|
[177] | 4849 | if detect==0 |
---|
[179] | 4850 | option_str='not created'; |
---|
[177] | 4851 | else |
---|
[219] | 4852 | datfile=dir(civ_files{ifile}); |
---|
[188] | 4853 | if isfield(datfile,'datenum') |
---|
| 4854 | datnum(ifile)=datfile.datenum;%only available in recent matlab versions |
---|
| 4855 | testrecent=1; |
---|
| 4856 | end |
---|
[177] | 4857 | filefound(ifile)={datfile.name}; |
---|
| 4858 | lastfield=''; |
---|
| 4859 | % check the content netcdf file |
---|
| 4860 | Data=nc2struct(civ_files{ifile},'ListGlobalAttribute','patch2','fix2','civ2','patch','fix'); |
---|
| 4861 | if ~isempty(Data.patch2) && isequal(Data.patch2,1) |
---|
[179] | 4862 | option=6; |
---|
| 4863 | option_str='patch2'; |
---|
[177] | 4864 | elseif ~isempty(Data.fix2) && isequal(Data.fix2,1) |
---|
[179] | 4865 | option=5; |
---|
| 4866 | option_str='fix2'; |
---|
[177] | 4867 | elseif ~isempty(Data.civ2) && isequal(Data.civ2,1); |
---|
[179] | 4868 | option=4; |
---|
| 4869 | option_str='civ2'; |
---|
[177] | 4870 | elseif ~isempty(Data.patch) && isequal(Data.patch,1); |
---|
[179] | 4871 | option=3; |
---|
| 4872 | option_str='patch1'; |
---|
[177] | 4873 | elseif ~isempty(Data.fix) && isequal(Data.fix,1); |
---|
[179] | 4874 | option=2; |
---|
| 4875 | option_str='fix1'; |
---|
[177] | 4876 | else |
---|
[179] | 4877 | option=1; |
---|
| 4878 | option_str='civ1'; |
---|
[177] | 4879 | end |
---|
| 4880 | end |
---|
[179] | 4881 | if option >= option_civ |
---|
[177] | 4882 | count=count+1; |
---|
| 4883 | end |
---|
| 4884 | [rr,filename,ext]=fileparts(civ_files{ifile}); |
---|
[179] | 4885 | Tabchar{ifile,1}=[fullfile([subdir extdir],filename) ext '...' option_str]; |
---|
[177] | 4886 | end |
---|
[219] | 4887 | datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files |
---|
[188] | 4888 | if isempty(datnum) |
---|
| 4889 | if testrecent |
---|
| 4890 | message='no civ result created yet'; |
---|
| 4891 | else |
---|
| 4892 | message=''; |
---|
| 4893 | end |
---|
[177] | 4894 | else |
---|
[219] | 4895 | datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files |
---|
[177] | 4896 | [first,ind]=min(datnum); |
---|
| 4897 | [last,indlast]=max(datnum); |
---|
[252] | 4898 | if test_new |
---|
| 4899 | message='existing file status, no processing launched yet'; |
---|
| 4900 | else |
---|
[177] | 4901 | message={[num2str(count) ' file(s) done over ' num2str(nbfiles)] ;['oldest modification: ' cell2mat(filefound(ind)) ' : ' datestr(first)];... |
---|
| 4902 | ['latest modification: ' cell2mat(filefound(indlast)) ' : ' datestr(last)]}; |
---|
[252] | 4903 | end |
---|
[177] | 4904 | end |
---|
| 4905 | hfig=findobj(allchild(0),'name','civ_status'); |
---|
[252] | 4906 | if isempty(hfig)% the status list has been deleted |
---|
[177] | 4907 | return |
---|
| 4908 | else |
---|
| 4909 | hlist=findobj(hfig,'tag','list'); |
---|
| 4910 | hmsgbox=findobj(hfig,'tag','msgbox'); |
---|
| 4911 | hwaitbar=findobj(hfig,'tag','waitbar'); |
---|
| 4912 | set(hlist,'String',Tabchar) |
---|
| 4913 | set(hmsgbox,'String', message) |
---|
[252] | 4914 | if count>0 && ~test_new |
---|
[177] | 4915 | BarPosition(3)=0.9*count/nbfiles; |
---|
| 4916 | set(hwaitbar,'Position',BarPosition) |
---|
| 4917 | end |
---|
| 4918 | end |
---|
| 4919 | set(hlist,'UserData',rootroot) |
---|
[252] | 4920 | pause(10)% wait 10 seconds for next check |
---|
[177] | 4921 | end |
---|
[150] | 4922 | |
---|
[177] | 4923 | |
---|
[252] | 4924 | %------------------------------------------------------------------------ |
---|
| 4925 | % call 'view_field.fig' to display the field selected in the list of 'status' |
---|
[177] | 4926 | function open_view_field(hObject, eventdata) |
---|
[252] | 4927 | %------------------------------------------------------------------------ |
---|
| 4928 | list=get(hObject,'String'); |
---|
| 4929 | index=get(hObject,'Value'); |
---|
| 4930 | rootroot=get(hObject,'UserData'); |
---|
| 4931 | filename=list{index}; |
---|
| 4932 | ind_dot=findstr(filename,'...'); |
---|
| 4933 | filename=filename(1:ind_dot-1); |
---|
| 4934 | filename=fullfile(rootroot,filename); |
---|
| 4935 | delete(get(hObject,'parent'))%delete the display figure to stop the check process |
---|
| 4936 | if exist(filename,'file')%visualise the vel field if it exists |
---|
| 4937 | uvmat(filename) |
---|
| 4938 | set(gcbo,'Value',1) |
---|
| 4939 | end |
---|
[150] | 4940 | |
---|
[252] | 4941 | %------------------------------------------------------------------------ |
---|
| 4942 | % launched by pressing OK on the status figure |
---|
[182] | 4943 | function close_GUI(hObject, eventdata) |
---|
[252] | 4944 | %------------------------------------------------------------------------ |
---|
| 4945 | delete(gcbf) |
---|
| 4946 | |
---|
| 4947 | %------------------------------------------------------------------------ |
---|
| 4948 | % launched by deleting the status figure |
---|
| 4949 | function stop_status(hObject, eventdata) |
---|
| 4950 | %------------------------------------------------------------------------ |
---|
| 4951 | hciv=findobj(allchild(0),'tag','civ'); |
---|
| 4952 | hhciv=guidata(hciv); |
---|
| 4953 | set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ |
---|
| 4954 | set(hhciv.status,'BackgroundColor',[0 1 0]) |
---|
[220] | 4955 | |
---|
[252] | 4956 | %------------------------------------------------------------------------ |
---|
[257] | 4957 | % --- Executes on button press in CivMode. |
---|
| 4958 | function CivMode_Callback(hObject, eventdata, handles) |
---|
[252] | 4959 | %------------------------------------------------------------------------ |
---|
[257] | 4960 | Listprog=get(handles.CivMode,'String'); |
---|
| 4961 | index=get(handles.CivMode,'Value'); |
---|
[238] | 4962 | prog=Listprog{index}; |
---|
| 4963 | switch prog |
---|
| 4964 | case 'CivX' |
---|
| 4965 | set(handles.thresh_patch1,'Visible','off') |
---|
| 4966 | set(handles.thresh_text1,'Visible','off') |
---|
[252] | 4967 | set(handles.thresh_patch2,'Visible','off') |
---|
| 4968 | set(handles.thresh_text2,'Visible','off') |
---|
[238] | 4969 | set(handles.rho,'Style','edit') |
---|
| 4970 | set(handles.rho,'String','1') |
---|
[252] | 4971 | set(handles.BATCH,'Enable','on') |
---|
[238] | 4972 | case 'CivAll' |
---|
| 4973 | if get(handles.PATCH1,'Value') |
---|
| 4974 | set(handles.thresh_patch1,'Visible','on') |
---|
| 4975 | set(handles.thresh_text1,'Visible','on') |
---|
| 4976 | end |
---|
| 4977 | set(handles.rho,'Style','edit') |
---|
| 4978 | set(handles.rho,'String','1') |
---|
[252] | 4979 | set(handles.BATCH,'Enable','on') |
---|
[238] | 4980 | case 'CivUvmat' |
---|
| 4981 | if get(handles.PATCH1,'Value') |
---|
| 4982 | set(handles.thresh_patch1,'Visible','on') |
---|
| 4983 | set(handles.thresh_text1,'Visible','on') |
---|
| 4984 | end |
---|
[252] | 4985 | if get(handles.PATCH2,'Value') |
---|
| 4986 | set(handles.thresh_patch2,'Visible','on') |
---|
| 4987 | set(handles.thresh_text2,'Visible','on') |
---|
| 4988 | end |
---|
[238] | 4989 | set(handles.rho,'Style','popupmenu') |
---|
| 4990 | set(handles.rho,'Value',1) |
---|
| 4991 | set(handles.rho,'String',{'1';'2'}) |
---|
[252] | 4992 | set(handles.BATCH,'Enable','off') |
---|
[224] | 4993 | end |
---|