[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 | |
---|
[71] | 24 | % Last Modified by GUIDE v2.5 27-Mar-2010 13:41:11 |
---|
[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); |
---|
| 64 | |
---|
| 65 | %default initial parameters |
---|
| 66 | filebase=''; % root file name ('filebase'.civ) |
---|
| 67 | ext=[]; |
---|
[112] | 68 | testall=0; |
---|
[71] | 69 | %default input parameters: |
---|
| 70 | num1=1; % set of field i numbers |
---|
[122] | 71 | num2=1; % set of field i numbers |
---|
[71] | 72 | num_a=1; % set of field j numbers (fields a) |
---|
| 73 | num_b=1; % second set of field j numbers (fields b) |
---|
| 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; |
---|
| 80 | num1=param.num1; |
---|
| 81 | num2=param.num2; |
---|
| 82 | num_a=param.num_a; |
---|
| 83 | num_b=param.num_b; |
---|
| 84 | subdir=param.SubDir; |
---|
| 85 | ind_opening=param.IndOpening; |
---|
| 86 | ext=param.ImaExt; |
---|
[2] | 87 | end |
---|
[122] | 88 | browse.num_i1=num1; |
---|
| 89 | browse.num_i2=num2; |
---|
| 90 | browse.num_j1=num_a; |
---|
| 91 | browse.num_j2=num_b; |
---|
| 92 | if ~isempty(ext) && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat |
---|
[112] | 93 | set(handles.ImaExt,'String',ext) |
---|
| 94 | if exist('nom_type_read','var') |
---|
| 95 | browse.nom_type_ima=nom_type_read; % the image nomenclature is stored |
---|
| 96 | end |
---|
[2] | 97 | elseif isequal(ext,'.nc') |
---|
| 98 | if exist('nom_type_read','var') |
---|
| 99 | browse.nom_type_nc=nom_type_read;% the netcdf nomenclature is stored |
---|
| 100 | end |
---|
| 101 | end |
---|
[71] | 102 | set(handles.RootName,'String',filebase); |
---|
[2] | 103 | set(handles.ImaDoc,'UserData',testall); |
---|
| 104 | set(handles.ImaDoc,'String',ext) |
---|
| 105 | |
---|
[122] | 106 | %read names of the .exe file to adjust the interface according to available binaries |
---|
[2] | 107 | path_uvmat=which('uvmat');% check the path detected for source file uvmat |
---|
| 108 | path_UVMAT=fileparts(path_uvmat); %path to UVMAT |
---|
[45] | 109 | errormsg=[];%default error message |
---|
[111] | 110 | % xmlfile=fullfile(path_UVMAT,'PARAM.xml'); |
---|
| 111 | % if ~exist(xmlfile,'file') |
---|
[112] | 112 | xmlfile='PARAM.xml'; |
---|
[111] | 113 | % end |
---|
[54] | 114 | if exist(xmlfile,'file') |
---|
| 115 | try |
---|
[112] | 116 | t=xmltree(xmlfile); |
---|
| 117 | sparam=convert(t); |
---|
[54] | 118 | catch |
---|
[112] | 119 | errormsg={' Unable to read the file PARAM.xml defining the civx binaries:'; lasterr}; |
---|
[2] | 120 | end |
---|
[54] | 121 | else |
---|
| 122 | errormsg=[xmlfile ' not found: path to civx binaries undefined']; |
---|
[2] | 123 | end |
---|
[71] | 124 | |
---|
[110] | 125 | |
---|
[45] | 126 | if ~isempty(errormsg) |
---|
[112] | 127 | msgbox_uvmat('ERROR',errormsg); |
---|
[45] | 128 | end |
---|
[71] | 129 | % patch_newBin=''; |
---|
| 130 | test_batch=0;%default: ,no batch mode available |
---|
| 131 | if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode') |
---|
| 132 | test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod |
---|
[2] | 133 | end |
---|
| 134 | if test_batch==0 |
---|
[84] | 135 | set(handles.BATCH,'Enable','off')% put the BATCH button in grey (unactivated) |
---|
[2] | 136 | set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated) |
---|
| 137 | end |
---|
[94] | 138 | if isfield(sparam.RunParam,'CivBin') |
---|
| 139 | if ~exist(sparam.RunParam.CivBin,'file') |
---|
[112] | 140 | sparam.RunParam.CivBin=fullfile(path_UVMAT,sparam.RunParam.CivBin); |
---|
[94] | 141 | end |
---|
[97] | 142 | else |
---|
| 143 | sparam.RunParam.CivBin=''; |
---|
[94] | 144 | end |
---|
[96] | 145 | patch_newBin=exist(sparam.RunParam.CivBin,'file'); |
---|
[2] | 146 | set(handles.subdir_civ1,'String',subdir)%default subdir on which uvmat was working |
---|
| 147 | set(handles.subdir_civ2,'String',subdir)%default subdir on which uvmat was working |
---|
| 148 | |
---|
| 149 | %initiate advised operations |
---|
| 150 | if isequal(ind_opening,[]) |
---|
| 151 | ind_opening=1; % default |
---|
| 152 | end |
---|
| 153 | % set default operation options |
---|
[112] | 154 | enable_civ1(handles,'off') |
---|
| 155 | enable_civ2(handles,'off') |
---|
| 156 | enable_pair1(handles,'on') |
---|
| 157 | enable_fix1(handles,'off') |
---|
| 158 | desable_patch1(handles) |
---|
| 159 | desable_fix2(handles) |
---|
| 160 | desable_patch2(handles) |
---|
| 161 | set(handles.CIV1,'Value',0) |
---|
| 162 | set(handles.FIX1,'Value',0) |
---|
| 163 | set(handles.PATCH1,'Value',0) |
---|
| 164 | set(handles.CIV2,'Value',0) |
---|
| 165 | set(handles.FIX2,'Value',0) |
---|
| 166 | set(handles.PATCH2,'Value',0) |
---|
| 167 | set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
[2] | 168 | if isequal(ind_opening,1) |
---|
| 169 | set(handles.CIV1,'Value',1) |
---|
| 170 | enable_civ1(handles,'on') |
---|
| 171 | elseif isequal(ind_opening,2) |
---|
| 172 | set(handles.FIX1,'Value',1) |
---|
| 173 | enable_fix1(handles,'on') |
---|
| 174 | elseif isequal(ind_opening,3) |
---|
| 175 | set(handles.PATCH1,'Value',1) |
---|
| 176 | enable_patch1(handles) |
---|
| 177 | elseif isequal(ind_opening,4) |
---|
| 178 | set(handles.CIV2,'Value',1) |
---|
| 179 | enable_civ2(handles,1) |
---|
| 180 | elseif isequal(ind_opening,5) |
---|
| 181 | set(handles.FIX2,'Value',1) |
---|
| 182 | enable_fix2(handles) |
---|
[112] | 183 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 184 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 185 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 186 | enable_pair1(handles,'off') |
---|
[2] | 187 | elseif isequal(ind_opening,6) |
---|
| 188 | set(handles.PATCH2,'Value',1) |
---|
| 189 | enable_patch2(handles) |
---|
| 190 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 191 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 192 | enable_pair1(handles,'off') |
---|
| 193 | end |
---|
| 194 | |
---|
| 195 | % set the range of fields (1:1 by default) and selected pair |
---|
[89] | 196 | if isnan(num2)||isequal(num2,num1) |
---|
[2] | 197 | num_ref_i=num1; |
---|
| 198 | else |
---|
| 199 | num_ref_i=floor((num1+num2)/2); |
---|
| 200 | browse.incr_pair(1)=num2-num1; |
---|
| 201 | browse.incr_pair(2)=0; |
---|
| 202 | end |
---|
[89] | 203 | if isnan(num_b)||isequal(num_a,num_b) |
---|
| 204 | if isnan(num_a) |
---|
[2] | 205 | num_ref_j=1; |
---|
| 206 | else |
---|
| 207 | num_ref_j=num_a; |
---|
| 208 | end |
---|
| 209 | else |
---|
| 210 | num_ref_j=floor((num_a+num_b)/2); |
---|
[112] | 211 | browse.incr_pair(2)=num_b-num_a; |
---|
[2] | 212 | end |
---|
| 213 | set(handles.first_i,'String',num2str(num_ref_i)); |
---|
| 214 | set(handles.last_i,'String',num2str(num_ref_i)); |
---|
| 215 | set(handles.first_j,'String',num2str(num_ref_j)); |
---|
| 216 | set(handles.last_j,'String',num2str(num_ref_j)); |
---|
| 217 | set(handles.ref_i,'String',num2str(num_ref_i)); |
---|
| 218 | set(handles.ref_j,'String',num2str(num_ref_j)); |
---|
[71] | 219 | set(handles.ref_i_civ2,'String',num2str(num_ref_i)); |
---|
| 220 | set(handles.ref_j_civ2,'String',num2str(num_ref_j)); |
---|
[2] | 221 | set(handles.browse_root,'UserData',browse); |
---|
[71] | 222 | if exist('param','var')%varargin the interface is opened from uvmat |
---|
[112] | 223 | RootName_Callback(hObject, eventdata, handles); |
---|
[2] | 224 | end |
---|
| 225 | |
---|
| 226 | set(handles.waitbar_1,'Position',[0.946 0.877 0.03 0.001]) |
---|
| 227 | set(handles.waitbar_patch1,'Position',[0.946 0.626 0.03 0.001]) |
---|
| 228 | set(handles.waitbar_civ2,'Position',[0.946 0.406 0.03 0.001]) |
---|
| 229 | set(handles.waitbar_patch2,'Position',[0.946 0.187 0.03 0.001]) |
---|
| 230 | |
---|
[12] | 231 | %------------------------------------------------------------------------ |
---|
[2] | 232 | % --- Outputs from this function are returned to the command line. |
---|
| 233 | function varargout = civ_OutputFcn(hObject, eventdata, handles) |
---|
[12] | 234 | %------------------------------------------------------------------------ |
---|
[2] | 235 | % varargout cell array for returning output args (see VARARGOUT); |
---|
| 236 | % hObject handle to figure |
---|
| 237 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 238 | % handles structure with handles and user data (see GUIDATA) |
---|
| 239 | % Get default command line output from handles structure |
---|
| 240 | varargout{1} = handles.output; |
---|
| 241 | |
---|
[12] | 242 | %------------------------------------------------------------------------ |
---|
[2] | 243 | % --- Executes on button press in browse_root. |
---|
| 244 | function browse_root_Callback(hObject, eventdata, handles) |
---|
[12] | 245 | %------------------------------------------------------------------------ |
---|
[2] | 246 | %get the input file properties |
---|
[71] | 247 | filebase=get(handles.RootName,'String'); |
---|
[2] | 248 | oldfile=''; %default |
---|
[39] | 249 | if isempty(filebase)|| isequal(filebase,'')%loads the previously stored file name and set it as default in the file_input box |
---|
[112] | 250 | dir_perso=prefdir; |
---|
| 251 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
| 252 | if exist(profil_perso,'file') |
---|
| 253 | h=load (profil_perso); |
---|
| 254 | if isfield(h,'filebase')&& ischar(h.filebase) |
---|
| 255 | oldfile=h.filebase; |
---|
| 256 | end |
---|
| 257 | if isfield(h,'RootPath') && ischar(h.RootPath) |
---|
| 258 | oldfile=h.RootPath; |
---|
| 259 | end |
---|
| 260 | end |
---|
| 261 | else |
---|
| 262 | oldfile=filebase; |
---|
| 263 | end |
---|
[2] | 264 | testall=get(handles.ImaDoc,'UserData'); |
---|
| 265 | ind_opening=1;%default |
---|
| 266 | browse.incr_pair=[0 0]; %default |
---|
[112] | 267 | if testall |
---|
[2] | 268 | menu={'*.*', 'All Files (*.*)'; '*.xml; *.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... |
---|
| 269 | '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc','.nc files'}; |
---|
| 270 | else % menu selecting only .civ or .avi files |
---|
[112] | 271 | menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... |
---|
[2] | 272 | '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';... |
---|
| 273 | '*.*', 'All Files (*.*)'}; |
---|
| 274 | end |
---|
| 275 | [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile); |
---|
[112] | 276 | fileinput=[PathName FileName];%complete file name |
---|
[2] | 277 | sizf=size(fileinput); |
---|
| 278 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
| 279 | [path,name,ext]=fileparts(fileinput); |
---|
| 280 | testeditxml=0; |
---|
| 281 | if isequal(ext,'.xml') |
---|
| 282 | testeditxml=1; |
---|
| 283 | t_browse=xmltree(fileinput); |
---|
| 284 | head_element=get(t_browse,1); |
---|
[45] | 285 | if isfield(head_element,'name')&& isequal(head_element.name,'ImaDoc') |
---|
[2] | 286 | testeditxml=0; |
---|
| 287 | end |
---|
| 288 | end |
---|
[45] | 289 | if testeditxml==1 || isequal(ext,'.xls') |
---|
[112] | 290 | heditxml=editxml({fileinput}); |
---|
| 291 | set(heditxml,'Tag','browser') |
---|
| 292 | waitfor(heditxml,'Tag','idle') |
---|
| 293 | if ~ishandle(heditxml) |
---|
| 294 | return |
---|
| 295 | end |
---|
| 296 | attr=findobj(get(heditxml,'children'),'Tag','CurrentAttributes'); |
---|
| 297 | set(handles.browse,'UserData',fileinput)% store for future opening with browser |
---|
| 298 | fileinput=get(attr,'UserData'); |
---|
| 299 | if ~exist(fileinput,'file') |
---|
| 300 | return |
---|
| 301 | end |
---|
[2] | 302 | end |
---|
[82] | 303 | [RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput); |
---|
[2] | 304 | filebase=fullfile(RootPath,RootFile); |
---|
[89] | 305 | num_i1=str2double(str1); |
---|
| 306 | if isnan(num_i1),num_i1=1;end |
---|
| 307 | num_i2=str2double(str2); |
---|
| 308 | if isnan(num_i2),num_i2=num_i1;end |
---|
[54] | 309 | num_j1=stra2num(str_a); |
---|
[89] | 310 | if isnan(num_j1),num_j1=1;end |
---|
[54] | 311 | num_j2=stra2num(str_b); |
---|
[112] | 312 | if isnan(num_j2),num_j2=num_j1;end |
---|
[2] | 313 | if isequal(get(handles.compare,'Value'),1) |
---|
| 314 | browse=[];%initialisation |
---|
| 315 | else |
---|
| 316 | browse=get(handles.browse_root,'UserData'); |
---|
| 317 | end |
---|
[122] | 318 | browse.num_i1=num_i1; |
---|
| 319 | browse.num_i2=num_i2; |
---|
| 320 | browse.num_j1=num_j1; |
---|
| 321 | browse.num_j2=num_j2; |
---|
| 322 | if length(ext)>1 && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat |
---|
| 323 | % set(handles.ImaExt,'String',ext) |
---|
[2] | 324 | browse.nom_type_ima=nom_type; |
---|
[122] | 325 | browse.ext_ima=ext; |
---|
[2] | 326 | end |
---|
| 327 | set(handles.ImaDoc,'String',ext); |
---|
| 328 | |
---|
| 329 | %%%%% read the state of the selected netcdf file to advise default operation |
---|
| 330 | if isequal(ext,'.nc') |
---|
| 331 | browse.nom_type_nc=nom_type; |
---|
[112] | 332 | ind_opening=2;% propose 'fix' as the default option |
---|
[2] | 333 | Data=nc2struct(fileinput,[]); |
---|
[112] | 334 | if isfield(Data,'absolut_time_T0')%test for civx files |
---|
[2] | 335 | if isfield(Data,'fix') && isequal(Data.fix,1) |
---|
| 336 | ind_opening=3; |
---|
| 337 | end |
---|
| 338 | if isfield(Data,'patch') && isequal(Data.patch,1) |
---|
| 339 | ind_opening=4; |
---|
| 340 | end |
---|
| 341 | if isfield(Data,'civ2') && isequal(Data.civ2,1) |
---|
| 342 | ind_opening=5; |
---|
| 343 | end |
---|
| 344 | if isfield(Data,'fix2') && isequal(Data.fix2,1) |
---|
| 345 | ind_opening=6; |
---|
| 346 | end |
---|
| 347 | testciv=1; %TO SUPPRESS WITH NEW VERSION OF CIVX |
---|
| 348 | else |
---|
[112] | 349 | ind_opening=3; %GUI used only for patch |
---|
[2] | 350 | testciv=0; |
---|
| 351 | end |
---|
| 352 | set(handles.subdir_civ1,'String',subdir);%set the default subdir directories for installing the .nc results |
---|
| 353 | set(handles.subdir_civ2,'String',subdir); |
---|
| 354 | browse.testciv=testciv; |
---|
| 355 | browse.ind_opening=ind_opening; |
---|
| 356 | end |
---|
[71] | 357 | set(handles.RootName,'String',filebase); |
---|
[2] | 358 | set(handles.ImaDoc,'String',ext); |
---|
[45] | 359 | if ~isempty(num_i1) |
---|
[82] | 360 | ref_i=num_i1; |
---|
[45] | 361 | if ~isempty(num_i2) |
---|
| 362 | ref_i=floor((ref_i+num_i2)/2);% reference image number corresponding to the file |
---|
| 363 | browse.incr_pair(1)=num_i2-num_i1; |
---|
[2] | 364 | browse.incr_pair(2)=0; |
---|
| 365 | end |
---|
| 366 | set(handles.first_i,'String',num2str(ref_i)); |
---|
| 367 | set(handles.last_i,'String',num2str(ref_i)); |
---|
[71] | 368 | set(handles.ref_i,'String',num2str(ref_i)); |
---|
| 369 | set(handles.ref_i_civ2,'String',num2str(ref_i)) |
---|
[2] | 370 | end |
---|
[45] | 371 | if isempty(num_j1) |
---|
[2] | 372 | set(handles.ref_j,'String','1'); |
---|
[71] | 373 | set(handles.ref_j_civ2,'String','1'); |
---|
[2] | 374 | else |
---|
[45] | 375 | ref_j=num_j1; |
---|
| 376 | if ~isempty(num_j2) |
---|
| 377 | ref_j=floor((num_j1+num_j2)/2); |
---|
[112] | 378 | browse.incr_pair(2)=num_j2-num_j1; |
---|
[2] | 379 | end |
---|
| 380 | set(handles.first_j,'String',num2str(ref_j)); |
---|
| 381 | set(handles.last_j,'String',num2str(ref_j)); |
---|
[112] | 382 | set(handles.ref_j,'String',num2str(ref_j)); |
---|
[71] | 383 | set(handles.ref_j_civ2,'String',num2str(ref_j)); |
---|
[2] | 384 | end |
---|
| 385 | |
---|
| 386 | % set default operation options |
---|
| 387 | enable_civ1(handles,'off') |
---|
| 388 | enable_civ2(handles,'off') |
---|
| 389 | enable_pair1(handles,'on') |
---|
| 390 | enable_fix1(handles,'off') |
---|
| 391 | desable_patch1(handles) |
---|
| 392 | desable_fix2(handles) |
---|
| 393 | desable_patch2(handles) |
---|
| 394 | set(handles.CIV1,'Value',0) |
---|
| 395 | set(handles.FIX1,'Value',0) |
---|
| 396 | set(handles.PATCH1,'Value',0) |
---|
| 397 | set(handles.CIV2,'Value',0) |
---|
| 398 | set(handles.FIX2,'Value',0) |
---|
| 399 | set(handles.PATCH2,'Value',0) |
---|
| 400 | set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 401 | if isequal(ind_opening,1) |
---|
| 402 | set(handles.CIV1,'Value',1) |
---|
| 403 | enable_civ1(handles,'on') |
---|
| 404 | elseif isequal(ind_opening,2) |
---|
| 405 | set(handles.FIX1,'Value',1) |
---|
| 406 | enable_fix1(handles,'on') |
---|
| 407 | elseif isequal(ind_opening,3) |
---|
| 408 | set(handles.PATCH1,'Value',1) |
---|
| 409 | enable_patch1(handles) |
---|
| 410 | elseif isequal(ind_opening,4) |
---|
| 411 | set(handles.CIV2,'Value',1) |
---|
| 412 | enable_civ2(handles,1) |
---|
| 413 | elseif isequal(ind_opening,5) |
---|
| 414 | enable_pair1(handles,'off') |
---|
| 415 | set(handles.FIX2,'Value',1) |
---|
| 416 | enable_fix2(handles) |
---|
[112] | 417 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 418 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 419 | set(handles.list_pair_civ2,'Enable','On') |
---|
[2] | 420 | elseif isequal(ind_opening,6) |
---|
| 421 | enable_pair1(handles,'off') |
---|
| 422 | set(handles.PATCH2,'Value',1) |
---|
| 423 | enable_patch2(handles) |
---|
| 424 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 425 | set(handles.list_pair_civ2,'Enable','On') |
---|
| 426 | end |
---|
| 427 | set(handles.browse_root,'UserData',browse);% store information from browser |
---|
| 428 | testall=isequal(menu(filtindex,1),{'*.*'}); |
---|
| 429 | set(handles.ImaDoc,'UserData',testall); |
---|
| 430 | |
---|
[71] | 431 | RootName_Callback(hObject, eventdata, handles); |
---|
[2] | 432 | |
---|
[12] | 433 | %------------------------------------------------------------------------ |
---|
[2] | 434 | function ImaDoc_Callback(hObject, eventdata, handles) |
---|
[12] | 435 | %------------------------------------------------------------------------ |
---|
[71] | 436 | RootName_Callback(hObject, eventdata, handles) |
---|
[2] | 437 | |
---|
[12] | 438 | %------------------------------------------------------------------------ |
---|
[54] | 439 | % --- function activated when a new filebase (image series) is introduced |
---|
[71] | 440 | function RootName_Callback(hObject, eventdata, handles) |
---|
[12] | 441 | %------------------------------------------------------------------------ |
---|
[2] | 442 | set(handles.compare,'Visible','on') |
---|
[122] | 443 | %ext_ima=get(handles.ImaExt,'String'); |
---|
| 444 | ext_ima='';%default |
---|
[2] | 445 | nom_type_ima=[];%default |
---|
| 446 | field_count=1;%default |
---|
| 447 | nom_type_nc=[]; |
---|
| 448 | time=[]; |
---|
[71] | 449 | TimeUnit='frame'; %default |
---|
| 450 | CoordUnit='px';%default |
---|
[2] | 451 | pxcmx_search=[];%default |
---|
| 452 | pxcmy_search=[];%default |
---|
[71] | 453 | filebase=get(handles.RootName,'String'); |
---|
[2] | 454 | ext=get(handles.ImaDoc,'String'); |
---|
| 455 | browse=get(handles.browse_root,'UserData');%default |
---|
[122] | 456 | if isfield(browse,'nom_type_ima') |
---|
| 457 | nom_type_ima=browse.nom_type_ima;% get an image nomenclature type already determined by an input image name |
---|
| 458 | ext_ima=browse.ext_ima; |
---|
[2] | 459 | end |
---|
[122] | 460 | if isfield(browse,'nom_type_nc') |
---|
| 461 | nom_type_nc=browse.nom_type_nc;% get an image nomenclature type already determined by an input image name |
---|
| 462 | end |
---|
| 463 | if isfield(browse,'num_i1') |
---|
| 464 | field_count=browse.num_i1;% get an image index type already determined by an input file |
---|
| 465 | end |
---|
[2] | 466 | |
---|
| 467 | %default first_i and j and increments |
---|
| 468 | first_i=str2num(get(handles.first_i,'String'));%value possibly set by uvmat_Opening |
---|
[12] | 469 | if isempty(first_i)|| first_i < 1 |
---|
[2] | 470 | first_i=1; %default first_i |
---|
| 471 | end |
---|
| 472 | last_i=str2num(get(handles.last_i,'String')); |
---|
[12] | 473 | if isempty(last_i)|| last_i < first_i |
---|
[2] | 474 | last_i=first_i; %default last_i |
---|
| 475 | end |
---|
| 476 | first_j=str2num(get(handles.first_j,'String')); |
---|
[39] | 477 | if isempty(first_j)|| first_j < 1 |
---|
[2] | 478 | first_j=1; %default first_j |
---|
| 479 | end |
---|
| 480 | last_j=str2num(get(handles.last_j,'String')); |
---|
[39] | 481 | if isempty(last_j)|| last_j < first_j |
---|
[2] | 482 | last_j=first_j; %default last_j |
---|
| 483 | end |
---|
| 484 | incr_i=str2num(get(handles.incr_i,'String')); |
---|
[39] | 485 | if isempty(incr_i) || incr_i < 1; |
---|
[2] | 486 | set(handles.incr_i,'String','1') %default incr_i |
---|
| 487 | end |
---|
| 488 | incr_j=str2num(get(handles.incr_j,'String')); |
---|
[39] | 489 | if isempty(incr_j) || incr_j < 1; |
---|
[2] | 490 | set(handles.incr_j,'String','1') %default incr_j |
---|
| 491 | end |
---|
| 492 | dt=[];%default |
---|
| 493 | testmode=0;%default |
---|
| 494 | nbfield=[]; %default |
---|
| 495 | nburst=[];%default |
---|
| 496 | pxcmx=1; |
---|
[112] | 497 | pxcmy=1; |
---|
[2] | 498 | |
---|
[112] | 499 | %look for an image documentation file |
---|
[2] | 500 | if ~isequal(ext,'.xml') && ~isequal(ext,'.civ')&& ~isequal(ext,'.avi')&& ~isequal(ext,'.AVI') |
---|
| 501 | if exist([filebase '.xml'],'file') |
---|
[112] | 502 | ext='.xml'; |
---|
[2] | 503 | elseif exist([filebase '.civxml'],'file') |
---|
[112] | 504 | ext='.civxml'; |
---|
[2] | 505 | elseif exist([filebase '.civ'],'file') |
---|
[112] | 506 | ext='.civ'; |
---|
| 507 | elseif exist([filebase '.avi'],'file') |
---|
| 508 | ext='.avi'; |
---|
[2] | 509 | elseif exist([filebase '.AVI'],'file') |
---|
[112] | 510 | ext='.AVI'; |
---|
[2] | 511 | end |
---|
| 512 | set(handles.ImaDoc,'String',ext) |
---|
| 513 | end |
---|
| 514 | |
---|
| 515 | %%%%%%%% read image documentation file %%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
[84] | 516 | mode=''; %default |
---|
| 517 | set(handles.ImaDoc,'BackgroundColor',[1 1 0]) |
---|
| 518 | drawnow |
---|
[12] | 519 | if isequal(ext,'.civxml') || isequal(ext,'.xml')|| isequal(ext,'.civ') |
---|
[2] | 520 | set(handles.ref_i,'Visible','On')%use a reference index |
---|
| 521 | set(handles.ref_j,'Visible','On') |
---|
[12] | 522 | elseif isequal(ext,'.avi') || isequal(ext,'.AVI') |
---|
[2] | 523 | set(handles.ref_j,'Visible','Off') |
---|
| 524 | else |
---|
| 525 | set(handles.ref_i,'Visible','Off') |
---|
| 526 | set(handles.ref_j,'Visible','Off') |
---|
| 527 | end |
---|
[12] | 528 | testima_xml=0; |
---|
[2] | 529 | if isequal(ext,'.civxml')%TO ABANDON |
---|
[122] | 530 | [nbfield,nbfield2,time]=read_civxml([filebase '.civxml']); |
---|
[2] | 531 | mode='pair j1-j2'; |
---|
| 532 | if isempty(nom_type_ima)% dtermine types by default if not already selected by browser or uvmat |
---|
[112] | 533 | nom_type_ima='_i_j'; |
---|
[2] | 534 | end |
---|
| 535 | elseif isequal(ext,'.xml') |
---|
[73] | 536 | [XmlData,warntext]=imadoc2struct([filebase '.xml']); |
---|
[2] | 537 | ext_ima_read=[]; |
---|
| 538 | nom_type_read=[]; |
---|
[12] | 539 | if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file |
---|
[2] | 540 | [PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName); |
---|
[112] | 541 | fullname=fullfile(fileparts(filebase),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file, |
---|
[45] | 542 | if ~exist(fullname,'file') |
---|
[12] | 543 | msgbox_uvmat('WARNING',['FirstImage ' fullname ' defined in the xml file does not exist']) |
---|
| 544 | end |
---|
[2] | 545 | end |
---|
[84] | 546 | if isfield(XmlData,'Time') |
---|
[85] | 547 | time=XmlData.Time; |
---|
[84] | 548 | nbfield=size(time,1); |
---|
[122] | 549 | nbfield2=size(time,2); |
---|
[84] | 550 | %transform .Time to a column vector if it is a line vector the nomenclature uses a single index |
---|
[122] | 551 | if isequal(nbfield,1) && ~isequal(nbfield2,1)% .Time is a line vector |
---|
[84] | 552 | if numel(nom_type_read)>=2 && (strcmp(nom_type_read,'_i')||strcmp(nom_type_read(1:2),'%0')||strcmp(nom_type_read(1:2),'_%')) |
---|
| 553 | time=time'; |
---|
[122] | 554 | nbfield=nbfield2; |
---|
| 555 | nbfield2=1; |
---|
[84] | 556 | end |
---|
| 557 | end |
---|
| 558 | end |
---|
[71] | 559 | if isfield(XmlData,'TimeUnit') |
---|
| 560 | TimeUnit=XmlData.TimeUnit; |
---|
[2] | 561 | end |
---|
[71] | 562 | if isfield(XmlData,'Npx') |
---|
| 563 | npx=XmlData.Npx; |
---|
| 564 | npy=XmlData.Npy; |
---|
| 565 | end |
---|
[2] | 566 | pxcmx_search=1; |
---|
| 567 | pxcmy_search=1; |
---|
| 568 | if isfield(XmlData,'GeometryCalib') |
---|
| 569 | tsai=XmlData.GeometryCalib; |
---|
[112] | 570 | if isfield(tsai,'f') && isfield(tsai,'Tz') && isfield(tsai,'dpx') && isfield(tsai,'dpy')&& isfield(tsai,'R') |
---|
| 571 | rot2D=tsai.R(1:2,[1,2]); |
---|
| 572 | pxcmx_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpx); |
---|
| 573 | pxcmy_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpy); |
---|
[2] | 574 | end |
---|
[112] | 575 | if isfield(tsai,'CoordUnit') |
---|
| 576 | CoordUnit=tsai.CoordUnit; |
---|
[2] | 577 | end |
---|
[112] | 578 | end |
---|
[2] | 579 | if ~isempty(ext_ima_read) && ~isempty(nom_type_read) |
---|
[122] | 580 | % if isempty(ext_ima) |
---|
| 581 | % ext_ima=ext_ima_read;% define image extension from the xml file if an image has not been opened previously |
---|
| 582 | % else %keep the image extension |
---|
| 583 | % if ~strcmp(ext_ima_read,ext_ima) |
---|
| 584 | % msgbox_uvmat('WARNING',['FirtsImage extension ' ext_ima_read ' announced in the xml file inconsistent with the selected image']) |
---|
| 585 | % end |
---|
| 586 | % end |
---|
[2] | 587 | nom_type_ima=nom_type_read; |
---|
| 588 | end |
---|
[122] | 589 | elseif strcmp(ext,'.civ')% case of .civ image documentation file |
---|
[112] | 590 | [error,time,TimeUnit,mode,npx,npy]=read_imatext([filebase '.civ']); |
---|
| 591 | if error==2, msgbox_uvmat('WARNING',['no file ' filebase '.civ']); |
---|
| 592 | elseif error==1, msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file'); |
---|
| 593 | end |
---|
| 594 | % ImaExt='.png'; |
---|
| 595 | nom_type_ima='png_old'; |
---|
[122] | 596 | elseif strcmpi(ext,'.avi') |
---|
[112] | 597 | nom_type_ima='*'; |
---|
| 598 | ext_ima=ext; |
---|
| 599 | set(handles.mode,'String',{'series(Di)'}) |
---|
| 600 | dt=0.04;%default |
---|
| 601 | if exist([filebase ext],'file')==2 |
---|
| 602 | info=aviinfo([filebase ext]);%read infos on the avi movie |
---|
| 603 | dt=1/info.FramesPerSecond;%time interval between successive frames |
---|
| 604 | nbfield=info.NumFrames;%number of frames |
---|
| 605 | end |
---|
| 606 | time=(dt*(0:nbfield-1))';%list of image times |
---|
| 607 | %set(handles.dt,'String',num2str(dt*1000));%store the time interval between successive images |
---|
[2] | 608 | end |
---|
| 609 | if isempty(time) |
---|
| 610 | set(handles.ImaDoc,'String',''); %xml file not used for timing |
---|
| 611 | end |
---|
| 612 | set(handles.ImaDoc,'BackgroundColor',[1 1 1]) |
---|
| 613 | |
---|
[122] | 614 | %get the imabe nomenclature type if not defined by the input file nor by the xml file |
---|
| 615 | dirima=[];%default |
---|
[12] | 616 | if isempty(nom_type_ima) |
---|
| 617 | %look for double image series '_i_j' |
---|
| 618 | dirima=dir([filebase '_' num2str(first_i) '_' num2str(first_j) '.*']); |
---|
| 619 | if isempty(dirima) |
---|
[112] | 620 | % look for images series with sub marker '_' |
---|
| 621 | dirima=dir([filebase '_*' num2str(first_i) '.*']); |
---|
| 622 | if isempty(dirima) |
---|
| 623 | % look for other images series |
---|
| 624 | dirima=dir([filebase '*' num2str(first_i) '.*']); |
---|
[122] | 625 | if isempty(dirima) |
---|
| 626 | % look for other images series witth letter appendix |
---|
| 627 | appendix=char(96+first_j); |
---|
| 628 | dirima=dir([filebase '*' num2str(first_i) appendix '.*']); |
---|
| 629 | % if ~isempty(dirima) |
---|
| 630 | % [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); |
---|
| 631 | % end |
---|
| 632 | % else |
---|
| 633 | % [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); |
---|
[112] | 634 | end |
---|
[122] | 635 | % else |
---|
| 636 | % [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); |
---|
[112] | 637 | end |
---|
[122] | 638 | % else |
---|
| 639 | % [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); |
---|
[12] | 640 | end |
---|
[112] | 641 | end |
---|
[122] | 642 | for ilist=1:numel(dirima) |
---|
| 643 | [pp,ff,fc,str2,str_a,str_b,ext_list,nom_type_list]=name2display(dirima(ilist).name); |
---|
| 644 | form=imformats(ext_list(2:end)); |
---|
| 645 | if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab |
---|
| 646 | ext_ima=ext_list; |
---|
| 647 | nom_type_ima=nom_type_list; |
---|
| 648 | break |
---|
| 649 | end |
---|
| 650 | end |
---|
| 651 | % no image documentation file found: look for a series of existing files,images by priority or .nc files |
---|
| 652 | if isempty(nom_type_ima) |
---|
| 653 | ext_search=ext; |
---|
| 654 | nom_type_search=nom_type_nc; |
---|
| 655 | else |
---|
| 656 | ext_search=ext_ima; |
---|
| 657 | nom_type_search=nom_type_ima; |
---|
| 658 | end |
---|
| 659 | if isempty(time) && ~strcmp(nom_type_search,'none') && ~strcmp(nom_type_search,'') && ~strcmp(nom_type_search,'*') |
---|
[12] | 660 | subdir=get(handles.subdir_civ1,'String'); |
---|
| 661 | incr_pair=[0 0];%default |
---|
| 662 | if isfield(browse,'incr_pair') |
---|
[112] | 663 | incr_pair=browse.incr_pair; |
---|
[12] | 664 | end |
---|
[112] | 665 | % nbdetect=0;%test of detected images |
---|
[122] | 666 | field_i=browse.num_i2; |
---|
[12] | 667 | idetect=1; |
---|
[112] | 668 | while idetect==1 %look for the maximum file number in the series |
---|
[122] | 669 | imagename=name_generator(filebase,field_i+1,1,ext_search,nom_type_search); |
---|
[81] | 670 | idetect=(exist(imagename,'file')==2); |
---|
| 671 | if idetect |
---|
[12] | 672 | field_i=field_i+1; |
---|
[81] | 673 | end |
---|
[112] | 674 | %SEE CASE OF NETCDF FILES |
---|
| 675 | % nbdetect=nbdetect+(exist(imagename,'file')==2); |
---|
[12] | 676 | end |
---|
[122] | 677 | nbfield=field_i;% last detected field number |
---|
| 678 | field_i=browse.num_i1;%look for the minimum file number in the series |
---|
[12] | 679 | idetect=1; |
---|
[112] | 680 | while idetect==1 |
---|
[122] | 681 | imagename=name_generator(filebase,field_i-1,1,ext_search,nom_type_search); |
---|
[81] | 682 | idetect=(exist(imagename,'file')==2); |
---|
| 683 | if idetect |
---|
[112] | 684 | field_i=field_i-1; |
---|
[81] | 685 | end |
---|
[12] | 686 | end |
---|
[122] | 687 | first_i=max(field_i,1); |
---|
| 688 | if numel(regexp(nom_type_search,'\D'))>=1%two indices i and j |
---|
| 689 | field_i=browse.num_i1; |
---|
| 690 | field_j=browse.num_j2; |
---|
[89] | 691 | jdetect=1; |
---|
| 692 | while jdetect==1 %look for the maximum file number in the series |
---|
[122] | 693 | imagename=name_generator(filebase,field_i,field_j,ext_search,nom_type_search); |
---|
[89] | 694 | jdetect=(exist(imagename,'file')==2); |
---|
| 695 | if jdetect |
---|
| 696 | field_j=field_j+1; |
---|
| 697 | end |
---|
| 698 | %SEE CASE OF NETCDF FILES |
---|
| 699 | % nbdetect=nbdetect+(exist(imagename,'file')==2); |
---|
| 700 | end |
---|
[122] | 701 | nbfield2=field_j;% last detected field number |
---|
[120] | 702 | end |
---|
[122] | 703 | |
---|
[89] | 704 | %determine the set of times and possible intervals for CIV |
---|
[112] | 705 | % dt=(1/1000)*str2num(get(handles.dt,'String')); |
---|
[122] | 706 | time=(0:nbfield-1)';% time=file index -1 by default |
---|
| 707 | if numel(regexp(nom_type_search,'\D'))>=1%two indices i and j |
---|
| 708 | % switch nom_type_search |
---|
| 709 | % case {'_i_j','%01dA','%02dA','%03dA','%04dA'} |
---|
[112] | 710 | % time=[0:nb_field-1]'*ones(1,nb_field_j);% time=file index -1 by default |
---|
[122] | 711 | [x,y]=meshgrid(0:nbfield2-1,0:nbfield-1); |
---|
[120] | 712 | time=x+y; |
---|
| 713 | % time=[0:nb_field-1]'*[0:nb_field_j-1];% time=file index -1 by default |
---|
[89] | 714 | end |
---|
[122] | 715 | % set(handles.mode,'String',{'series(Di)'}) |
---|
[2] | 716 | end |
---|
[120] | 717 | |
---|
[2] | 718 | if exist('time','var') |
---|
| 719 | if size(time,1)+size(time,2)>=3 % if there are at least two time values to define dt |
---|
| 720 | nbfield=size(time,1); |
---|
| 721 | nbfield2=size(time,2); |
---|
[71] | 722 | set(handles.RootName,'UserData',time); %store the set of times |
---|
| 723 | set(handles.dt_unit,'String',['dt in m' TimeUnit]); |
---|
| 724 | set(handles.dt_unit_civ2,'String',['dt in m' TimeUnit]); |
---|
| 725 | set(handles.TimeUnit,'String',TimeUnit); |
---|
[2] | 726 | set(handles.nb_field,'String',num2str(nbfield)); |
---|
| 727 | set(handles.nb_field2,'String',num2str(nbfield2)); |
---|
| 728 | end |
---|
| 729 | end |
---|
[71] | 730 | set(handles.CoordUnit,'String',CoordUnit) |
---|
[2] | 731 | set(handles.calcul_search,'UserData',[pxcmx_search pxcmy_search]); |
---|
| 732 | % npxy=[npy npx]; |
---|
[71] | 733 | set(handles.ImaExt,'String',ext_ima) |
---|
[2] | 734 | set(handles.first_i,'String',num2str(first_i)); |
---|
| 735 | set(handles.last_i,'String',num2str(last_i));% |
---|
| 736 | set(handles.first_j,'String',num2str(first_j)); |
---|
| 737 | set(handles.last_j,'String',num2str(last_j));% |
---|
| 738 | browse.nom_type_ima=nom_type_ima; |
---|
| 739 | set(handles.browse_root,'UserData',browse)% store the nomenclature type |
---|
| 740 | |
---|
[112] | 741 | %%%%%%%%%%% set the menus of image pairs and default selection for civ %%%%%%%%%%%%%%%%%%% |
---|
[122] | 742 | test_ima_i=numel(nom_type_ima)>1 && isempty(regexp(nom_type_ima(2:end),'\D'));%images with single indexing |
---|
| 743 | if test_ima_i || isequal(nom_type_nc,'_i1-i2')||~(exist('nbfield2','var')&&(nbfield2~=1)) |
---|
[2] | 744 | set(handles.mode,'String',{'series(Di)'}) |
---|
| 745 | set(handles.mode,'Value',1) |
---|
| 746 | elseif (nbfield==1)% simple series in j |
---|
| 747 | set(handles.mode,'String',{'series(Dj)'}) |
---|
| 748 | set(handles.mode,'Value',1) |
---|
| 749 | else |
---|
| 750 | set(handles.mode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice |
---|
[122] | 751 | if nbfield2 <= 10 |
---|
[112] | 752 | set(handles.mode,'Value',1)% advice 'pair j1-j2' for small burst |
---|
[2] | 753 | end |
---|
| 754 | end |
---|
| 755 | |
---|
[112] | 756 | %update the subdir |
---|
[2] | 757 | pathdir=fileparts(filebase);%path to the current xml file |
---|
| 758 | listot=dir(pathdir); |
---|
| 759 | idir=0; |
---|
| 760 | listdir={''};%default |
---|
| 761 | for ilist=1:length(listot) |
---|
| 762 | if listot(ilist).isdir |
---|
| 763 | name=listot(ilist).name; |
---|
| 764 | if ~isequal(name,'.') && ~isequal(name,'..') |
---|
| 765 | idir=idir+1; |
---|
| 766 | listdir{idir,1}=listot(ilist).name; |
---|
| 767 | end |
---|
| 768 | end |
---|
| 769 | end |
---|
[112] | 770 | set(handles.list_subdir_civ1,'Value',1) |
---|
[2] | 771 | set(handles.list_subdir_civ2,'Value',1) |
---|
[107] | 772 | set(handles.list_subdir_civ1,'String',[{'browse...'};listdir]) |
---|
| 773 | set(handles.list_subdir_civ2,'String',[{'browse...'};listdir]) |
---|
[2] | 774 | %check wether the current subdir exists: |
---|
| 775 | subdir_civ1=get(handles.subdir_civ1,'String'); |
---|
| 776 | subdir_civ2=get(handles.subdir_civ2,'String'); |
---|
| 777 | |
---|
[112] | 778 | mode_Callback(hObject, eventdata, handles) |
---|
[2] | 779 | |
---|
| 780 | %%%%%% initialize waitbars and RUN button |
---|
| 781 | set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001]) |
---|
| 782 | set(handles.waitbar_patch1,'Position',[0.946 0.439 0.03 0.001]) |
---|
| 783 | set(handles.waitbar_civ2,'Position',[0.946 0.219 0.03 0.001]) |
---|
| 784 | set(handles.waitbar_patch2,'Position',[0.946 0.0 0.03 0.001]) |
---|
| 785 | set(handles.RUN, 'Enable','On') |
---|
| 786 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
[122] | 787 | set(handles.BATCH,'Enable','On') |
---|
| 788 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
[112] | 789 | |
---|
[2] | 790 | %%%%% store the root input filename for future opening |
---|
| 791 | dir_perso=prefdir; |
---|
| 792 | profil_perso=fullfile(prefdir,'uvmat_perso.mat'); |
---|
| 793 | RootPath=fileparts(filebase); |
---|
| 794 | if exist(profil_perso,'file') |
---|
| 795 | save (profil_perso,'RootPath','-append'); %store the root name for future opening of uvmat |
---|
| 796 | else |
---|
| 797 | txt=ver; |
---|
| 798 | Release=txt(1).Release; |
---|
| 799 | relnumb=str2num(Release(3:4)); |
---|
| 800 | if relnumb >= 14 |
---|
[112] | 801 | save (profil_perso,'RootPath','-V6'); %store the root name for future opening of uvmat |
---|
[2] | 802 | else |
---|
| 803 | save (profil_perso,'RootPath'); %store the root name for future opening of uvmat |
---|
| 804 | end |
---|
| 805 | end |
---|
| 806 | % save(profil_perso, 'filebase'); %store the root name for future opening of uvmat |
---|
| 807 | set(gcf,'Pointer','arrow') |
---|
| 808 | |
---|
[12] | 809 | %------------------------------------------------------------------------ |
---|
[2] | 810 | % --- Executes on button press in mode. |
---|
| 811 | function mode_Callback(hObject, eventdata, handles) |
---|
[12] | 812 | %------------------------------------------------------------------------ |
---|
[2] | 813 | browse=get(handles.browse_root,'UserData'); |
---|
| 814 | compare_list=get(handles.compare,'String'); |
---|
| 815 | val=get(handles.compare,'Value'); |
---|
| 816 | compare=compare_list{val}; |
---|
| 817 | if strcmp(compare,'displacement') |
---|
| 818 | mode='displacement'; |
---|
| 819 | else |
---|
| 820 | mode_list=get(handles.mode,'String'); |
---|
| 821 | mode_value=get(handles.mode,'Value'); |
---|
| 822 | mode=mode_list{mode_value}; |
---|
| 823 | end |
---|
| 824 | displ_num=[];%default |
---|
[54] | 825 | ref_i=str2num(get(handles.ref_i,'String')); |
---|
[2] | 826 | % last_i=str2num(get(handles.last_i,'String')); |
---|
[71] | 827 | time=get(handles.RootName,'UserData'); %get the set of times |
---|
[2] | 828 | siztime=size(time); |
---|
| 829 | nbfield=siztime(1); |
---|
| 830 | nbfield2=siztime(2); |
---|
| 831 | indchosen=1; %%first pair selected by default |
---|
| 832 | if isequal(mode,'pair j1-j2')%| isequal(mode,'st_pair j1-j2') |
---|
| 833 | dt=1; |
---|
| 834 | displ=''; |
---|
| 835 | index=0; |
---|
| 836 | numlist_a=[]; |
---|
| 837 | numlist_B=[]; |
---|
| 838 | %get all the time intervals in bursts |
---|
| 839 | displ_dt=1;%default |
---|
| 840 | nbfield2=min(nbfield2,10);%limitate the number of pairs to 10x10 |
---|
| 841 | for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'pair j1-j2' mode |
---|
| 842 | for numod_b=(numod_a+1):nbfield2 |
---|
[112] | 843 | index=index+1; |
---|
| 844 | numlist_a(index)=numod_a; |
---|
| 845 | numlist_b(index)=numod_b; |
---|
| 846 | if ~isempty(time) |
---|
[54] | 847 | dt(numod_a,numod_b)=time(ref_i,numod_b)-time(ref_i,numod_a);%first time interval dt |
---|
[2] | 848 | displ_dt(index)=dt(numod_a,numod_b); |
---|
[112] | 849 | else |
---|
| 850 | displ_dt(index)=1; |
---|
| 851 | end |
---|
| 852 | end |
---|
| 853 | end |
---|
| 854 | [dtsort,indsort]=sort(displ_dt); |
---|
| 855 | if ~isempty(numlist_a) |
---|
| 856 | displ_num(1,:)=numlist_a(indsort); |
---|
| 857 | displ_num(2,:)=numlist_b(indsort); |
---|
| 858 | end |
---|
| 859 | displ_num(3,:)=0; |
---|
| 860 | displ_num(4,:)=0; |
---|
| 861 | set(handles.jtext,'Visible','Off') |
---|
[2] | 862 | set(handles.first_j,'Visible','Off') |
---|
| 863 | set(handles.last_j,'Visible','Off') |
---|
| 864 | set(handles.incr_j,'Visible','Off') |
---|
| 865 | set(handles.nb_field2,'Visible','Off') |
---|
| 866 | set(handles.ref_j,'Visible','Off') |
---|
| 867 | elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') |
---|
[112] | 868 | for index=1:min(nbfield2-1,200) |
---|
| 869 | displ_num(1,index)=-floor(index/2); |
---|
| 870 | displ_num(2,index)=ceil(index/2); |
---|
| 871 | displ_num(3,index)=0; |
---|
| 872 | displ_num(4,index)=0; |
---|
| 873 | end |
---|
| 874 | set(handles.jtext,'Visible','On') |
---|
| 875 | set(handles.first_j,'Visible','On') |
---|
| 876 | set(handles.last_j,'Visible','On') |
---|
| 877 | set(handles.incr_j,'Visible','On') |
---|
| 878 | set(handles.nb_field2,'Visible','On') |
---|
| 879 | set(handles.ref_j,'Visible','On') |
---|
| 880 | if nbfield > 1 |
---|
[2] | 881 | set(handles.itext,'Visible','On') |
---|
| 882 | set(handles.first_i,'Visible','On') |
---|
| 883 | set(handles.last_i,'Visible','On') |
---|
| 884 | set(handles.incr_i,'Visible','On') |
---|
| 885 | set(handles.nb_field,'Visible','On') |
---|
| 886 | set(handles.ref_i,'Visible','On') |
---|
| 887 | else |
---|
| 888 | set(handles.itext,'Visible','Off') |
---|
| 889 | set(handles.first_i,'Visible','Off') |
---|
| 890 | set(handles.last_i,'Visible','Off') |
---|
| 891 | set(handles.incr_i,'Visible','Off') |
---|
| 892 | set(handles.nb_field,'Visible','Off') |
---|
| 893 | set(handles.ref_i,'Visible','Off') |
---|
| 894 | end |
---|
[112] | 895 | elseif isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') |
---|
| 896 | for index=1:200%min(nbfield-1,200) |
---|
| 897 | displ_num(1,index)=0; |
---|
| 898 | displ_num(2,index)=0; |
---|
| 899 | displ_num(3,index)=-floor(index/2); |
---|
| 900 | displ_num(4,index)=ceil(index/2); |
---|
| 901 | end |
---|
| 902 | set(handles.itext,'Visible','On') |
---|
| 903 | set(handles.first_i,'Visible','On') |
---|
| 904 | set(handles.last_i,'Visible','On') |
---|
| 905 | set(handles.incr_i,'Visible','On') |
---|
| 906 | set(handles.nb_field,'Visible','On') |
---|
| 907 | set(handles.ref_i,'Visible','On') |
---|
| 908 | if nbfield2 > 1 |
---|
[2] | 909 | set(handles.jtext,'Visible','On') |
---|
| 910 | set(handles.first_j,'Visible','On') |
---|
| 911 | set(handles.last_j,'Visible','On') |
---|
| 912 | set(handles.incr_j,'Visible','On') |
---|
| 913 | set(handles.nb_field2,'Visible','On') |
---|
| 914 | set(handles.ref_j,'Visible','On') |
---|
[112] | 915 | else |
---|
[2] | 916 | set(handles.jtext,'Visible','Off') |
---|
| 917 | set(handles.first_j,'Visible','Off') |
---|
| 918 | set(handles.last_j,'Visible','Off') |
---|
| 919 | set(handles.incr_j,'Visible','Off') |
---|
| 920 | set(handles.nb_field2,'Visible','Off') |
---|
| 921 | set(handles.ref_j,'Visible','Off') |
---|
| 922 | end |
---|
| 923 | elseif isequal(mode,'displacement')%the pairs have the same indices |
---|
[112] | 924 | displ_num(1,1)=0; |
---|
| 925 | displ_num(2,1)=0; |
---|
| 926 | displ_num(3,1)=0; |
---|
| 927 | displ_num(4,1)=0; |
---|
| 928 | if nbfield > 1 |
---|
[2] | 929 | set(handles.itext,'Visible','On') |
---|
| 930 | set(handles.first_i,'Visible','On') |
---|
| 931 | set(handles.last_i,'Visible','On') |
---|
| 932 | set(handles.incr_i,'Visible','On') |
---|
| 933 | set(handles.nb_field,'Visible','On') |
---|
| 934 | set(handles.ref_i,'Visible','On') |
---|
| 935 | else |
---|
| 936 | set(handles.itext,'Visible','Off') |
---|
| 937 | set(handles.first_i,'Visible','Off') |
---|
| 938 | set(handles.last_i,'Visible','Off') |
---|
| 939 | set(handles.incr_i,'Visible','Off') |
---|
| 940 | set(handles.nb_field,'Visible','Off') |
---|
| 941 | set(handles.ref_i,'Visible','Off') |
---|
| 942 | end |
---|
| 943 | if nbfield2 > 1 |
---|
[112] | 944 | set(handles.jtext,'Visible','On') |
---|
| 945 | set(handles.first_j,'Visible','On') |
---|
| 946 | set(handles.last_j,'Visible','On') |
---|
| 947 | set(handles.incr_j,'Visible','On') |
---|
| 948 | set(handles.nb_field2,'Visible','On') |
---|
| 949 | set(handles.ref_j,'Visible','On') |
---|
[2] | 950 | else |
---|
| 951 | set(handles.jtext,'Visible','Off') |
---|
| 952 | set(handles.first_j,'Visible','Off') |
---|
| 953 | set(handles.last_j,'Visible','Off') |
---|
| 954 | set(handles.incr_j,'Visible','Off') |
---|
| 955 | set(handles.nb_field2,'Visible','Off') |
---|
| 956 | set(handles.ref_j,'Visible','Off') |
---|
| 957 | end |
---|
[112] | 958 | end |
---|
[2] | 959 | set(handles.list_pair_civ1,'UserData',displ_num); |
---|
| 960 | find_netcpair_civ1(hObject, eventdata, handles) |
---|
| 961 | find_netcpair_civ2(hObject, eventdata, handles) |
---|
| 962 | |
---|
[12] | 963 | %------------------------------------------------------------------------ |
---|
[2] | 964 | % determine the menu for civ1 pairs depending on existing netcdf file at the middle of |
---|
| 965 | % the field series set by first_i, incr, last_i |
---|
| 966 | function find_netcpair_civ1(hObject, eventdata, handles) |
---|
[12] | 967 | %------------------------------------------------------------------------ |
---|
[2] | 968 | set(gcf,'Pointer','watch') |
---|
| 969 | %nomenclature types |
---|
[71] | 970 | filebase=get(handles.RootName,'String'); |
---|
[2] | 971 | [filepath,Nme,ext_dir]=fileparts(filebase); |
---|
| 972 | browse=get(handles.browse_root,'UserData'); |
---|
| 973 | compare_list=get(handles.compare,'String'); |
---|
| 974 | val=get(handles.compare,'Value'); |
---|
| 975 | compare=compare_list{val}; |
---|
| 976 | if strcmp(compare,'displacement') |
---|
| 977 | mode='displacement'; |
---|
| 978 | else |
---|
| 979 | mode_list=get(handles.mode,'String'); |
---|
| 980 | mode_value=get(handles.mode,'Value'); |
---|
| 981 | mode=mode_list{mode_value}; |
---|
| 982 | end |
---|
| 983 | |
---|
| 984 | % nomenclature type of the .nc files |
---|
| 985 | nom_type_ima=[];%default |
---|
| 986 | if isfield(browse,'nom_type_ima') |
---|
| 987 | nom_type_ima=browse.nom_type_ima; |
---|
| 988 | end |
---|
| 989 | |
---|
[112] | 990 | %determine nom_type_nc: |
---|
[2] | 991 | nom_type_nc=[];%default |
---|
| 992 | if isfield(browse,'nom_type_nc') |
---|
| 993 | nom_type_nc=browse.nom_type_nc; |
---|
| 994 | end |
---|
| 995 | if isempty(nom_type_nc) |
---|
[112] | 996 | [nom_type_nc]=nomtype2pair(nom_type_ima,isequal(mode,'series(Di)'),isequal(mode,'series(Dj)')); |
---|
[2] | 997 | end |
---|
| 998 | browse.nom_type_nc=nom_type_nc; |
---|
| 999 | set(handles.browse_root,'UserData',browse) |
---|
| 1000 | |
---|
| 1001 | %reads .nc subdirectoy and image numbers from the interface |
---|
| 1002 | subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf data |
---|
[45] | 1003 | % first_i=str2num(get(handles.first_i,'String')); |
---|
| 1004 | % last_i=str2num(get(handles.last_i,'String')); |
---|
| 1005 | % incr=str2num(get(handles.incr_i,'String')); |
---|
| 1006 | % num1=first_i:incr:last_i; |
---|
| 1007 | % if isempty(num1) |
---|
| 1008 | % set(handles.list_pair_civ1,'String',{''}); |
---|
| 1009 | % return |
---|
| 1010 | % end |
---|
| 1011 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
[2] | 1012 | if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') |
---|
| 1013 | ref_j=0; |
---|
| 1014 | else |
---|
[45] | 1015 | ref_j=str2double(get(handles.ref_j,'String')); |
---|
[2] | 1016 | end |
---|
[71] | 1017 | time=get(handles.RootName,'UserData');%get the set of times |
---|
[2] | 1018 | if isempty(time) |
---|
| 1019 | time=[0 1]; |
---|
[112] | 1020 | end |
---|
[71] | 1021 | %dt_unit=str2double(get(handles.dt,'String'));% used when there is no image documentation file |
---|
| 1022 | dt_unit=1000;%default |
---|
[2] | 1023 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
| 1024 | |
---|
[112] | 1025 | %eliminate the first pairs inconsistent with the position |
---|
| 1026 | if isempty(displ_num) |
---|
| 1027 | nbpair=0; |
---|
| 1028 | else |
---|
[2] | 1029 | nbpair=length(displ_num(1,:));%nbre of displayed pairs |
---|
| 1030 | if isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') |
---|
| 1031 | nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index |
---|
| 1032 | elseif isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') |
---|
| 1033 | nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index |
---|
| 1034 | end |
---|
[112] | 1035 | end |
---|
[2] | 1036 | nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 |
---|
| 1037 | |
---|
[112] | 1038 | %look for existing processed pairs involving the field at the middle of the series if civ1 will not |
---|
[2] | 1039 | % be performed, while the result is needed for next steps. |
---|
| 1040 | displ_pair={''}; |
---|
| 1041 | select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs |
---|
| 1042 | testpair=0; |
---|
| 1043 | if get(handles.CIV1,'Value')==0 % |
---|
[112] | 1044 | if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir') |
---|
| 1045 | msgbox_uvmat('ERROR',['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist']); |
---|
| 1046 | set(handles.list_pair_civ1,'String',{}); |
---|
| 1047 | return |
---|
[2] | 1048 | end |
---|
[112] | 1049 | for ipair=1:nbpair |
---|
[2] | 1050 | filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... |
---|
[112] | 1051 | ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); |
---|
[2] | 1052 | select(ipair)=exist(filename,'file')==2; |
---|
| 1053 | end |
---|
| 1054 | if ~exist('select','var') || isequal(select,zeros(size(1:nbpair))) |
---|
[112] | 1055 | if isfield(browse,'incr_pair') |
---|
[2] | 1056 | num_i1=ref_i-floor(browse.incr_pair(1)/2); |
---|
| 1057 | num_i2=ref_i+ceil(browse.incr_pair(1)/2); |
---|
| 1058 | num_j1=ref_j-floor(browse.incr_pair(2)/2); |
---|
| 1059 | num_j2=ref_j+ceil(browse.incr_pair(2)/2); |
---|
| 1060 | filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ1); |
---|
| 1061 | select(1)=exist(filename,'file')==2; |
---|
| 1062 | testpair=1; |
---|
| 1063 | else |
---|
[112] | 1064 | if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') |
---|
[2] | 1065 | msgbox_uvmat('ERROR',['no civ1 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ1]); |
---|
| 1066 | else |
---|
| 1067 | msgbox_uvmat('ERROR',['no civ1 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ1]); |
---|
| 1068 | end |
---|
[112] | 1069 | set(handles.list_pair_civ1,'String',{''}); |
---|
| 1070 | %COMPLETER CAS STEREO |
---|
[2] | 1071 | return |
---|
| 1072 | end |
---|
| 1073 | end |
---|
| 1074 | end |
---|
| 1075 | if isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') |
---|
| 1076 | if testpair |
---|
[73] | 1077 | displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; |
---|
| 1078 | % elseif ~isequal(get(handles.root_txt,'String'),'dt(ms)=') |
---|
| 1079 | % for ipair=1:nbpair |
---|
| 1080 | % if select(ipair) |
---|
| 1081 | % if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
| 1082 | % 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 |
---|
| 1083 | % displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
| 1084 | % end |
---|
| 1085 | % else |
---|
| 1086 | % displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1087 | % end |
---|
| 1088 | % end |
---|
[2] | 1089 | else |
---|
[73] | 1090 | for ipair=1:nbpair |
---|
| 1091 | if select(ipair) |
---|
| 1092 | if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
| 1093 | 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 |
---|
| 1094 | displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
| 1095 | else |
---|
| 1096 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1097 | end |
---|
| 1098 | end |
---|
| 1099 | end |
---|
[2] | 1100 | end |
---|
| 1101 | elseif isequal(mode,'series(Dj)')%|isequal(mode,'st_series(Dj)')% series on the j index |
---|
| 1102 | if testpair |
---|
[112] | 1103 | displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; |
---|
[2] | 1104 | else |
---|
[112] | 1105 | for ipair=1:nbpair |
---|
| 1106 | if select(ipair) |
---|
| 1107 | if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
| 1108 | 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 |
---|
| 1109 | displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
| 1110 | end |
---|
| 1111 | elseif testpair |
---|
| 1112 | displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(2)/2)) '|' num2str(ceil(browse.incr_pair(2)/2))]; |
---|
| 1113 | else |
---|
| 1114 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1115 | end |
---|
| 1116 | end |
---|
| 1117 | end |
---|
[2] | 1118 | elseif isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')%case of pairs |
---|
| 1119 | for ipair=1:nbpair |
---|
| 1120 | if select(ipair) |
---|
[112] | 1121 | 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 |
---|
| 1122 | displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair),nom_type_ima) '-' num2stra(displ_num(2,ipair),nom_type_ima) ... |
---|
| 1123 | ' :dt= ' num2str(dt*1000)]; |
---|
| 1124 | else |
---|
| 1125 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1126 | end |
---|
| 1127 | end |
---|
[2] | 1128 | elseif isequal(mode,'displacement') |
---|
[112] | 1129 | displ_pair={'Di=Dj=0'}; |
---|
| 1130 | end |
---|
[2] | 1131 | set(handles.list_pair_civ1,'String',displ_pair'); |
---|
| 1132 | ichoice=min(find(select)); |
---|
[45] | 1133 | if (isempty(ichoice) || ichoice < 1); ichoice=1; end; |
---|
| 1134 | initial=get(handles.list_pair_civ1,'Value');%initial choice of pair |
---|
[112] | 1135 | if initial>nbpair |
---|
| 1136 | set(handles.list_pair_civ1,'Value',ichoice);% first valid pair proposed by default in the menu |
---|
[45] | 1137 | end |
---|
| 1138 | if numel(select)>=initial && ~isequal(select(initial),1) |
---|
[2] | 1139 | set(handles.list_pair_civ1,'Value',ichoice);% first valid pair proposed by default in the menu |
---|
| 1140 | end |
---|
[45] | 1141 | |
---|
[2] | 1142 | %set(handles.list_pair_civ2,'String',displ_pair'); |
---|
| 1143 | initial=get(handles.list_pair_civ2,'Value'); |
---|
| 1144 | if initial>length(displ_pair')%|~isequal(select(initial),1) |
---|
| 1145 | if ichoice <= length(displ_pair') |
---|
| 1146 | set(handles.list_pair_civ2,'Value',ichoice);% same pair proposed by default for civ2 |
---|
| 1147 | else |
---|
| 1148 | set(handles.list_pair_civ2,'Value',1);% same pair proposed by default for civ2 |
---|
| 1149 | end |
---|
| 1150 | end |
---|
| 1151 | set(handles.list_pair_civ2,'String',displ_pair'); |
---|
| 1152 | set(gcf,'Pointer','arrow') |
---|
[12] | 1153 | |
---|
| 1154 | %------------------------------------------------------------------------ |
---|
[112] | 1155 | % determine the menu for civ2 pairs depending on the existing netcdf file at the |
---|
| 1156 | %middle of the series set by first_i, incr, last_i |
---|
[2] | 1157 | function find_netcpair_civ2(hObject, eventdata, handles) |
---|
[12] | 1158 | %------------------------------------------------------------------------ |
---|
[2] | 1159 | set(gcf,'Pointer','watch') |
---|
| 1160 | %nomenclature types |
---|
[71] | 1161 | filebase=get(handles.RootName,'String'); |
---|
[2] | 1162 | [filepath,Nme,ext_dir]=fileparts(filebase); |
---|
| 1163 | browse=get(handles.browse_root,'UserData'); |
---|
| 1164 | compare_list=get(handles.compare,'String'); |
---|
| 1165 | val=get(handles.compare,'Value'); |
---|
| 1166 | compare=compare_list{val}; |
---|
| 1167 | if strcmp(compare,'displacement') |
---|
| 1168 | mode='displacement'; |
---|
| 1169 | else |
---|
| 1170 | mode_list=get(handles.mode,'String'); |
---|
| 1171 | mode_value=get(handles.mode,'Value'); |
---|
| 1172 | mode=mode_list{mode_value}; |
---|
| 1173 | end |
---|
| 1174 | |
---|
| 1175 | % nomenclature type of the .nc files |
---|
| 1176 | nom_type_ima='ima_num';%default |
---|
| 1177 | if isfield(browse,'nom_type_ima') |
---|
| 1178 | nom_type_ima=browse.nom_type_ima; |
---|
| 1179 | end |
---|
| 1180 | nom_type_nc='_i1-i2';%default |
---|
| 1181 | if isfield(browse,'nom_type_nc') |
---|
| 1182 | nom_type_nc=browse.nom_type_nc; |
---|
| 1183 | end |
---|
[94] | 1184 | 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] | 1185 | nom_type_nc='netc_old';%nom_type for the netcdf files |
---|
[94] | 1186 | elseif isequal(nom_type_ima,'none')||isequal(nom_type_nc,'none') |
---|
[2] | 1187 | nom_type_nc='none'; |
---|
[94] | 1188 | elseif isequal(nom_type_ima,'avi')||isequal(nom_type_ima,'_i')||isequal(nom_type_ima,'ima_num')||isequal(nom_type_nc,'_i1-i2') |
---|
[112] | 1189 | nom_type_nc='_i1-i2'; |
---|
[2] | 1190 | else |
---|
| 1191 | if isequal(mode,'series(Di)')%|isequal(mode,'st_series(Di)') |
---|
| 1192 | nom_type_nc='_i1-i2_j'; % PIV in volume |
---|
| 1193 | else |
---|
| 1194 | nom_type_nc='_i_j1-j2'; |
---|
[112] | 1195 | end |
---|
[2] | 1196 | end |
---|
| 1197 | browse.nom_type_nc=nom_type_nc; |
---|
| 1198 | set(handles.browse_root,'UserData',browse) |
---|
| 1199 | |
---|
| 1200 | %reads .nc subdirectory and image numbers from the interface |
---|
| 1201 | subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf data |
---|
| 1202 | subdir_civ2=get(handles.subdir_civ2,'String');%subdirectory subdir_civ2 for the netcdf data |
---|
[45] | 1203 | % first_i=str2num(get(handles.first_i,'String')); |
---|
| 1204 | % last_i=str2num(get(handles.last_i,'String')); |
---|
| 1205 | % incr=str2num(get(handles.incr_i,'String')); |
---|
| 1206 | % num1=first_i:incr:last_i; |
---|
| 1207 | % if isempty(num1) |
---|
| 1208 | % set(handles.list_pair_civ2,'Value',1); |
---|
| 1209 | % set(handles.list_pair_civ2,'String',{''}); |
---|
| 1210 | % return |
---|
| 1211 | % end |
---|
[71] | 1212 | ref_i=str2num(get(handles.ref_i_civ2,'String')); |
---|
[2] | 1213 | if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') |
---|
| 1214 | ref_j=0; |
---|
| 1215 | else |
---|
[71] | 1216 | ref_j=str2num(get(handles.ref_j_civ2,'String')); |
---|
[2] | 1217 | end |
---|
[71] | 1218 | time=get(handles.RootName,'UserData'); %get the set of times |
---|
[2] | 1219 | if isempty(time) |
---|
| 1220 | time=[0 1];%default |
---|
| 1221 | end |
---|
[71] | 1222 | %dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file |
---|
[73] | 1223 | %dt_unit=1000; |
---|
[2] | 1224 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
| 1225 | |
---|
| 1226 | |
---|
[112] | 1227 | %eliminate the first pairs inconsistent with the position |
---|
[2] | 1228 | if isempty(displ_num) |
---|
| 1229 | nbpair=0; |
---|
| 1230 | else |
---|
| 1231 | nbpair=length(displ_num(1,:));%nbre of displayed pairs |
---|
[112] | 1232 | if isequal(mode,'series(Di)')% | isequal(mode,'st_series(Di)') |
---|
[2] | 1233 | nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index |
---|
[112] | 1234 | elseif isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') |
---|
[2] | 1235 | nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index |
---|
| 1236 | end |
---|
| 1237 | end |
---|
| 1238 | nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 |
---|
| 1239 | |
---|
[112] | 1240 | %look for existing processed pairs involving the field at the middle of the series if civ1 will not |
---|
[2] | 1241 | % be performed, while the result is needed for next steps. |
---|
| 1242 | displ_pair={''}; %default |
---|
| 1243 | select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs |
---|
| 1244 | if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0%&... |
---|
[112] | 1245 | if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir') |
---|
| 1246 | errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist']) |
---|
| 1247 | set(handles.list_pair_civ2,'Value',1); |
---|
| 1248 | set(handles.list_pair_civ2,'String',{''}); |
---|
| 1249 | return |
---|
[2] | 1250 | end |
---|
[112] | 1251 | for ipair=1:nbpair |
---|
[2] | 1252 | filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... |
---|
[112] | 1253 | ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); |
---|
[2] | 1254 | select(ipair)=exist(filename,'file')==2; |
---|
| 1255 | end |
---|
| 1256 | if isequal(select,zeros(size(1:nbpair))) |
---|
[112] | 1257 | if isfield(browse,'incr_pair') |
---|
[2] | 1258 | num_i1=ref_i-floor(browse.incr_pair(1)/2); |
---|
| 1259 | num_i2=ref_i+floor((browse.incr_pair(1)+1)/2); |
---|
| 1260 | num_j1=ref_j-floor(browse.incr_pair(2)/2); |
---|
| 1261 | num_j2=ref_j+floor((browse.incr_pair(2)+1)/2); |
---|
| 1262 | filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ2); |
---|
| 1263 | select(1)=exist(filename,'file')==2; |
---|
| 1264 | else |
---|
[112] | 1265 | if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') |
---|
[2] | 1266 | errordlg(['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2]) |
---|
| 1267 | else |
---|
| 1268 | errordlg(['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2]) |
---|
| 1269 | end |
---|
[112] | 1270 | set(handles.list_pair_civ2,'Value',1); |
---|
| 1271 | set(handles.list_pair_civ2,'String',{''}); |
---|
[2] | 1272 | return |
---|
| 1273 | end |
---|
| 1274 | end |
---|
| 1275 | end |
---|
[112] | 1276 | if isequal(mode,'series(Di)') % | isequal(mode,'st_series(Di)') |
---|
| 1277 | for ipair=1:nbpair |
---|
| 1278 | if select(ipair) |
---|
| 1279 | if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
[2] | 1280 | 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 |
---|
| 1281 | displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
[112] | 1282 | end |
---|
| 1283 | else |
---|
| 1284 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1285 | end |
---|
| 1286 | end |
---|
[2] | 1287 | elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') % series on the j index |
---|
[112] | 1288 | for ipair=1:nbpair |
---|
| 1289 | if select(ipair) |
---|
| 1290 | if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) |
---|
| 1291 | 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 |
---|
| 1292 | displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; |
---|
| 1293 | end |
---|
| 1294 | else |
---|
| 1295 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1296 | end |
---|
| 1297 | end |
---|
[2] | 1298 | elseif isequal(mode,'pair j1-j2')% | isequal(mode,'st_pair j1-j2') %case of pairs |
---|
| 1299 | for ipair=1:nbpair |
---|
| 1300 | if select(ipair) |
---|
[112] | 1301 | 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 |
---|
| 1302 | displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair),nom_type_ima) '-' num2stra(displ_num(2,ipair),nom_type_ima) ... |
---|
| 1303 | ' :dt= ' num2str(dt*1000)]; |
---|
| 1304 | else |
---|
| 1305 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
| 1306 | end |
---|
| 1307 | end |
---|
[2] | 1308 | elseif isequal(mode,'displacement') |
---|
[112] | 1309 | displ_pair={'Di=Dj=0'}; |
---|
| 1310 | end |
---|
[2] | 1311 | val=get(handles.list_pair_civ2,'Value'); |
---|
| 1312 | ichoice=min(find(select)); |
---|
| 1313 | if (isempty(ichoice) | ichoice < 1); ichoice=1; end; |
---|
| 1314 | if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0 |
---|
| 1315 | val=ichoice;% first valid pair proposed by default in the menu |
---|
| 1316 | end |
---|
| 1317 | if val>length(displ_pair') |
---|
| 1318 | set(handles.list_pair_civ2,'Value',1);% first valid pair proposed by default in the menu |
---|
| 1319 | else |
---|
| 1320 | set(handles.list_pair_civ2,'Value',val); |
---|
| 1321 | end |
---|
| 1322 | set(handles.list_pair_civ2,'String',displ_pair'); |
---|
[12] | 1323 | set(gcf,'Pointer','arrow') |
---|
[2] | 1324 | |
---|
[12] | 1325 | %------------------------------------------------------------------------ |
---|
[112] | 1326 | % determine the list of index pairs of processing file |
---|
[2] | 1327 | function [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... |
---|
| 1328 | find_pair_indices(handles,mode) |
---|
[12] | 1329 | %------------------------------------------------------------------------ |
---|
[112] | 1330 | first_i=str2double(get(handles.first_i,'String'));%first index i |
---|
| 1331 | last_i=str2double(get(handles.last_i,'String'));%last index i |
---|
[45] | 1332 | incr=str2double(get(handles.incr_i,'String'));% increment |
---|
[39] | 1333 | num_i=[first_i:incr:last_i];% list of i indices (reference values for each pair) |
---|
[2] | 1334 | if isequal(get(handles.first_j,'Visible'),'on') |
---|
[45] | 1335 | first_j=str2double(get(handles.first_j,'String'));%first index j |
---|
[112] | 1336 | last_j=str2double(get(handles.last_j,'String'));%last index j |
---|
[45] | 1337 | incr_j=str2double(get(handles.incr_j,'String'));% increment |
---|
[2] | 1338 | else |
---|
| 1339 | first_j=1; |
---|
| 1340 | last_j=1; |
---|
| 1341 | incr_j=1; |
---|
| 1342 | end |
---|
[36] | 1343 | num_j=[first_j:incr_j:last_j];% list of j indices (reference values for each pair) |
---|
[2] | 1344 | list_civ1=get(handles.list_pair_civ1,'String'); |
---|
| 1345 | index_civ1=get(handles.list_pair_civ1,'Value'); |
---|
[36] | 1346 | str_civ1=list_civ1{index_civ1};%string defining the image pairs for civ1 |
---|
[2] | 1347 | if isempty(str_civ1)||isequal(str_civ1,'') |
---|
| 1348 | msgbox_uvmat('ERROR','no image pair selected for civ1') |
---|
| 1349 | return |
---|
| 1350 | end |
---|
| 1351 | list_civ2=get(handles.list_pair_civ2,'String'); |
---|
| 1352 | index_civ2=get(handles.list_pair_civ2,'Value'); |
---|
| 1353 | if index_civ2>length(list_civ2) |
---|
| 1354 | list_civ2=list_civ1; |
---|
| 1355 | index_civ2=index_civ1; |
---|
| 1356 | end |
---|
[36] | 1357 | str_civ2=list_civ2{index_civ2};%string defining the image pairs for civ2 |
---|
| 1358 | if isempty(first_i)||isempty(first_j), msgbox_uvmat('ERROR','first field number not defined'),... |
---|
[112] | 1359 | return,end; |
---|
[39] | 1360 | if isequal(last_i,[])|| isequal(last_j,[]),msgbox_uvmat('ERROR','last field number not defined'),... |
---|
[112] | 1361 | return,end; |
---|
[39] | 1362 | if isequal(incr,[])|| isequal(incr_j,[]),msgbox_uvmat('ERROR','increment in field number not defined'),... |
---|
[112] | 1363 | return,end; |
---|
[39] | 1364 | if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... |
---|
[112] | 1365 | return,end; |
---|
| 1366 | if isequal (mode,'series(Di)') |
---|
| 1367 | %recognize the pair civ1 from the display |
---|
| 1368 | indsel=find((double(str_civ1)<48)|(double(str_civ1)>57));% character indices of non numerical characters |
---|
[2] | 1369 | str_raw=str_civ1(indsel); |
---|
| 1370 | indsepar=find(str_raw=='|'); %character index of the separator |
---|
[45] | 1371 | d1=str2double(str_civ1([indsel(indsepar-1)+1:indsel(indsepar)-1])); |
---|
[2] | 1372 | if indsepar==length(str_raw) |
---|
[45] | 1373 | d2=str2double(str_civ1([indsel(indsepar)+1:end])); |
---|
[2] | 1374 | else |
---|
[45] | 1375 | d2=str2double(str_civ1([indsel(indsepar)+1:indsel(indsepar+1)-1])); |
---|
[112] | 1376 | end |
---|
[39] | 1377 | num1_civ1=num_i-d1;% set of first image numbers |
---|
| 1378 | num2_civ1=num_i+d2; |
---|
[2] | 1379 | num_a_civ1=num_j; |
---|
| 1380 | num_b_civ1=num_j; |
---|
| 1381 | |
---|
| 1382 | %recognize the pair civ2 from the display |
---|
| 1383 | indsel=find((double(str_civ2)<48)|(double(str_civ2)>57));% character indices of non numerical characters |
---|
| 1384 | str_raw=str_civ2(indsel); |
---|
| 1385 | indsepar=find(str_raw=='|'); %character index of the separator |
---|
| 1386 | d1=str2num(str_civ2([indsel(indsepar-1)+1:indsel(indsepar)-1])); |
---|
| 1387 | if indsepar==length(str_raw) |
---|
| 1388 | d2=str2num(str_civ2([indsel(indsepar)+1:end])); |
---|
| 1389 | else |
---|
| 1390 | d2=str2num(str_civ2([indsel(indsepar)+1:indsel(indsepar+1)-1])); |
---|
[112] | 1391 | end |
---|
[2] | 1392 | if isempty(d1) |
---|
[39] | 1393 | num1_civ2=num_i; |
---|
[2] | 1394 | else |
---|
[39] | 1395 | num1_civ2=num_i-d1;% set of first image numbers |
---|
[2] | 1396 | end |
---|
| 1397 | if isempty(d2) |
---|
[39] | 1398 | num2_civ2=num_i; |
---|
[2] | 1399 | else |
---|
[39] | 1400 | num2_civ2=num_i+d2; |
---|
[2] | 1401 | end |
---|
| 1402 | num_a_civ2=num_j; |
---|
| 1403 | num_b_civ2=num_j; |
---|
| 1404 | |
---|
| 1405 | % adjust the first and last field number |
---|
| 1406 | lastfield=str2num(get(handles.nb_field,'String')); |
---|
| 1407 | if isequal(lastfield,[]) |
---|
| 1408 | indsel=find((num1_civ1 >= 1)&(num1_civ2 >= 1)); |
---|
| 1409 | else |
---|
| 1410 | indsel=find((num2_civ1 <= lastfield)&(num2_civ2 <= lastfield)&(num1_civ1 >= 1)&(num1_civ2 >= 1)); |
---|
| 1411 | end |
---|
| 1412 | if length(indsel)>=1 |
---|
| 1413 | firstind=indsel(1); |
---|
| 1414 | lastind=indsel(end); |
---|
[39] | 1415 | set(handles.first_i,'String',num2str(num_i(firstind)))%update the display of first and last fields |
---|
| 1416 | set(handles.last_i,'String',num2str(num_i(lastind))) |
---|
| 1417 | num_i=num_i(indsel); |
---|
[2] | 1418 | num1_civ1=num1_civ1(indsel); |
---|
| 1419 | num1_civ2=num1_civ2(indsel); |
---|
| 1420 | num2_civ1=num2_civ1(indsel); |
---|
| 1421 | num2_civ2=num2_civ2(indsel); |
---|
| 1422 | end |
---|
[36] | 1423 | elseif isequal (mode,'series(Dj)') |
---|
[2] | 1424 | lastfield_j=str2num(get(handles.nb_field2,'String')); |
---|
[39] | 1425 | num1_civ1=num_i;% set of first image numbers |
---|
| 1426 | num2_civ1=num_i; |
---|
[2] | 1427 | num_a_civ1=num_j-floor(index_civ1/2)*ones(size(num_j)); |
---|
| 1428 | num_b_civ1=num_j+ceil(index_civ1/2)*ones(size(num_j)); |
---|
[39] | 1429 | num1_civ2=num_i; |
---|
| 1430 | num2_civ2=num_i; |
---|
[2] | 1431 | num_a_civ2=num_j-floor(index_civ2/2)*ones(size(num_j)); |
---|
| 1432 | num_b_civ2=num_j+ceil(index_civ2/2)*ones(size(num_j)); |
---|
| 1433 | % adjust the first and last field number |
---|
| 1434 | if isequal(lastfield_j,[]) |
---|
| 1435 | indsel=find((num_a_civ1 >= 1)&(num_a_civ2 >= 1)); |
---|
| 1436 | else |
---|
| 1437 | indsel=find((num_b_civ1 <= lastfield_j)&(num_b_civ2 <= lastfield_j)&(num_a_civ1 >= 1)&(num_a_civ2 >= 1)); |
---|
| 1438 | end |
---|
| 1439 | if length(indsel)>=1 |
---|
| 1440 | firstind=indsel(1); |
---|
| 1441 | lastind=indsel(end); |
---|
| 1442 | set(handles.first_j,'String',num2str(num_j(firstind)))%update the display of first and last fields |
---|
| 1443 | set(handles.last_j,'String',num2str(num_j(lastind))) |
---|
| 1444 | num_j=num_j(indsel); |
---|
| 1445 | num_a_civ1=num_a_civ1(indsel); |
---|
| 1446 | num_a_civ2=num_a_civ2(indsel); |
---|
| 1447 | num_b_civ1=num_b_civ1(indsel); |
---|
| 1448 | num_b_civ2=num_b_civ2(indsel); |
---|
| 1449 | end |
---|
[36] | 1450 | elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) |
---|
[39] | 1451 | num1_civ1=num_i; |
---|
| 1452 | num1_civ2=num_i; |
---|
[2] | 1453 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
[39] | 1454 | num2_civ1=num_i; |
---|
[2] | 1455 | num_a_civ1=displ_num(1,index_civ1); |
---|
| 1456 | num_b_civ1=displ_num(2,index_civ1); |
---|
[39] | 1457 | num2_civ2=num_i; |
---|
[2] | 1458 | num_a_civ2=displ_num(1,index_civ2); |
---|
| 1459 | num_b_civ2=displ_num(2,index_civ2); |
---|
| 1460 | elseif isequal(mode,'displacement') |
---|
[39] | 1461 | num1_civ1=num_i; |
---|
| 1462 | num2_civ1=num_i; |
---|
[2] | 1463 | num_a_civ1=num_j; |
---|
| 1464 | num_b_civ1=num_j; |
---|
[39] | 1465 | num1_civ2=num_i; |
---|
| 1466 | num2_civ2=num_i; |
---|
[2] | 1467 | num_a_civ2=num_j; |
---|
| 1468 | num_b_civ2=num_j; |
---|
| 1469 | end |
---|
| 1470 | |
---|
[41] | 1471 | |
---|
[12] | 1472 | %------------------------------------------------------------------------ |
---|
[2] | 1473 | % --- Executes on selection change in list_pair_civ1. |
---|
| 1474 | function list_pair_civ1_Callback(hObject, eventdata, handles) |
---|
[12] | 1475 | %------------------------------------------------------------------------ |
---|
[2] | 1476 | %reproduce by default the chosen pair in the civ2 menu |
---|
| 1477 | list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs |
---|
| 1478 | index_pair=get(handles.list_pair_civ1,'Value'); |
---|
| 1479 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
| 1480 | num_a=displ_num(1,index_pair); |
---|
| 1481 | num_b=displ_num(2,index_pair); |
---|
| 1482 | list_pair2=get(handles.list_pair_civ2,'String');%get the menu of image pairs |
---|
| 1483 | if index_pair<=length(list_pair2) |
---|
| 1484 | set(handles.list_pair_civ2,'Value',index_pair); |
---|
| 1485 | end |
---|
| 1486 | |
---|
[112] | 1487 | %update first_i and last_i according to the chosen image pairs |
---|
[2] | 1488 | mode_list=get(handles.mode,'String'); |
---|
| 1489 | mode_value=get(handles.mode,'Value'); |
---|
| 1490 | mode=mode_list{mode_value}; |
---|
| 1491 | if isequal(mode,'series(Di)') |
---|
| 1492 | first_i=str2num(get(handles.first_i,'String')); |
---|
| 1493 | last_i=str2num(get(handles.last_i,'String')); |
---|
| 1494 | incr_i=str2num(get(handles.incr_i,'String')); |
---|
| 1495 | num1=first_i:incr_i:last_i; |
---|
| 1496 | lastfield=str2num(get(handles.nb_field,'String')); |
---|
| 1497 | if ~isequal(lastfield,[]) |
---|
| 1498 | ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& ... |
---|
[112] | 1499 | (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield)); |
---|
[2] | 1500 | num1=num1(ind); |
---|
| 1501 | end |
---|
| 1502 | set(handles.first_i,'String',num2str(num1(1))); |
---|
| 1503 | set(handles.last_i,'String',num2str(num1(end))); |
---|
| 1504 | elseif isequal(mode,'series(Dj)') |
---|
| 1505 | first_j=str2num(get(handles.first_j,'String')); |
---|
| 1506 | last_j=str2num(get(handles.last_j,'String')); |
---|
| 1507 | incr_j=str2num(get(handles.incr_j,'String')); |
---|
| 1508 | num_j=first_j:incr_j:last_j; |
---|
| 1509 | lastfield2=str2num(get(handles.nb_field2,'String')); |
---|
| 1510 | if ~isequal(lastfield2,[]) |
---|
| 1511 | ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... |
---|
[112] | 1512 | (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2)); |
---|
[2] | 1513 | num1=num_j(ind); |
---|
| 1514 | end |
---|
| 1515 | set(handles.first_j,'String',num2str(num1(1))); |
---|
| 1516 | set(handles.last_j,'String',num2str(num1(end))); |
---|
[112] | 1517 | end |
---|
[2] | 1518 | |
---|
[12] | 1519 | %------------------------------------------------------------------------ |
---|
[2] | 1520 | % --- Executes on selection change in list_pair_civ2. |
---|
| 1521 | function list_pair_civ2_Callback(hObject, eventdata, handles) |
---|
[12] | 1522 | %------------------------------------------------------------------------ |
---|
[112] | 1523 | index_pair=get(handles.list_pair_civ2,'Value');%get the selected position index in the menu |
---|
[2] | 1524 | |
---|
[112] | 1525 | %update first_i and last_i according to the chosen image pairs |
---|
[2] | 1526 | mode_list=get(handles.mode,'String'); |
---|
| 1527 | mode_value=get(handles.mode,'Value'); |
---|
| 1528 | mode=mode_list{mode_value}; |
---|
| 1529 | if isequal(mode,'series(Di)') |
---|
| 1530 | first_i=str2num(get(handles.first_i,'String')); |
---|
| 1531 | last_i=str2num(get(handles.last_i,'String')); |
---|
| 1532 | incr_i=str2num(get(handles.incr_i,'String')); |
---|
| 1533 | num1=first_i:incr_i:last_i; |
---|
| 1534 | lastfield=str2num(get(handles.nb_field,'String')); |
---|
| 1535 | if ~isequal(lastfield,[]) |
---|
| 1536 | ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& ... |
---|
[112] | 1537 | (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield)); |
---|
[2] | 1538 | num1=num1(ind); |
---|
| 1539 | end |
---|
| 1540 | set(handles.first_i,'String',num2str(num1(1))); |
---|
| 1541 | set(handles.last_i,'String',num2str(num1(end))); |
---|
| 1542 | elseif isequal(mode,'series(Dj)') |
---|
| 1543 | first_j=str2num(get(handles.first_j,'String')); |
---|
| 1544 | last_j=str2num(get(handles.last_j,'String')); |
---|
| 1545 | incr_j=str2num(get(handles.incr_j,'String')); |
---|
| 1546 | num_j=first_j:incr_j:last_j; |
---|
| 1547 | lastfield2=str2num(get(handles.nb_field2,'String')); |
---|
| 1548 | if ~isequal(lastfield2,[]) |
---|
| 1549 | ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... |
---|
[112] | 1550 | (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2)); |
---|
[2] | 1551 | num1=num_j(ind); |
---|
| 1552 | end |
---|
| 1553 | set(handles.first_j,'String',num2str(num1(1))); |
---|
| 1554 | set(handles.last_j,'String',num2str(num1(end))); |
---|
[112] | 1555 | end |
---|
[2] | 1556 | |
---|
[12] | 1557 | %------------------------------------------------------------------------ |
---|
[2] | 1558 | % --- Executes on button press in RUN. |
---|
| 1559 | |
---|
| 1560 | |
---|
| 1561 | |
---|
[67] | 1562 | % compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3) |
---|
| 1563 | % %check the list of operations: |
---|
| 1564 | % operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'}; |
---|
| 1565 | % run_flag=1; |
---|
| 1566 | % box_test(1)=get(handles.CIV1,'Value'); |
---|
| 1567 | % box_test(2)=get(handles.FIX1,'Value'); |
---|
| 1568 | % box_test(3)=get(handles.PATCH1,'Value'); |
---|
| 1569 | % box_test(4)=get(handles.CIV2,'Value'); |
---|
| 1570 | % box_test(5)=get(handles.FIX2,'Value'); |
---|
| 1571 | % box_test(6)=get(handles.PATCH2,'Value'); |
---|
| 1572 | % index=find(box_test==1); |
---|
| 1573 | % if isempty(index) |
---|
| 1574 | % msgbox_uvmat('ERROR','no selected operation') |
---|
| 1575 | % return |
---|
| 1576 | % end |
---|
| 1577 | % index_first=min(index); |
---|
| 1578 | % index_last=max(index); |
---|
| 1579 | % box_used=box_test([index_first : index_last]); |
---|
| 1580 | % [box_missing,ind_missing]=min(box_used); |
---|
| 1581 | % if isequal(box_missing,0) |
---|
| 1582 | % msgbox_uvmat('ERROR',['missing' cell2mat(operations(ind_missing))]); |
---|
| 1583 | % return |
---|
| 1584 | % end |
---|
[112] | 1585 | % |
---|
[67] | 1586 | % %root name |
---|
[71] | 1587 | % filebase=get(handles.RootName,'String'); |
---|
[67] | 1588 | % if isempty(filebase)||isequal(filebase,'') |
---|
| 1589 | % msgbox_uvmat('ERROR','no input files') |
---|
| 1590 | % return |
---|
| 1591 | % end |
---|
| 1592 | % %check mask if selecetd |
---|
| 1593 | % if isequal(get(handles.get_mask_civ1,'Value'),1) |
---|
| 1594 | % maskname=get(handles.mask_civ1,'String'); |
---|
| 1595 | % if ~exist(maskname,'file') |
---|
| 1596 | % get_mask_civ1_Callback(hObject, eventdata, handles); |
---|
| 1597 | % end |
---|
| 1598 | % end |
---|
| 1599 | % if isequal(get(handles.get_mask_fix1,'Value'),1) |
---|
| 1600 | % maskname=get(handles.mask_fix1,'String'); |
---|
| 1601 | % if ~exist(maskname,'file') |
---|
| 1602 | % get_mask_fix1_Callback(hObject, eventdata, handles); |
---|
| 1603 | % end |
---|
| 1604 | % end |
---|
| 1605 | % if isequal(get(handles.get_mask_civ2,'Value'),1) |
---|
| 1606 | % maskname=get(handles.mask_civ2,'String'); |
---|
| 1607 | % if ~exist(maskname,'file') |
---|
| 1608 | % get_mask_civ2_Callback(hObject, eventdata, handles); |
---|
| 1609 | % end |
---|
| 1610 | % end |
---|
| 1611 | % if isequal(get(handles.get_mask_fix2,'Value'),1) |
---|
| 1612 | % maskname=get(handles.mask_fix2,'String'); |
---|
| 1613 | % if ~exist(maskname,'file') |
---|
| 1614 | % get_mask_fix2_Callback(hObject, eventdata, handles); |
---|
| 1615 | % end |
---|
| 1616 | % end |
---|
[112] | 1617 | % |
---|
| 1618 | % %read names of the .exe file |
---|
| 1619 | % if box_test(1)==1 || box_test(3)==1 || box_test(4)==1 || box_test(6)==1 |
---|
[67] | 1620 | % path_uvmat=which('uvmat');% check the path detected for source file uvmat |
---|
| 1621 | % path_UVMAT=fileparts(path_uvmat); %path to UVMAT |
---|
| 1622 | % %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ binary names |
---|
| 1623 | % xmlfile=fullfile(path_UVMAT,'PARAM.xml'); |
---|
| 1624 | % if exist(xmlfile,'file') |
---|
| 1625 | % t=xmltree(xmlfile); |
---|
| 1626 | % sparam=convert(t); |
---|
| 1627 | % end |
---|
| 1628 | % if isfield(sparam,'Civ1Bin') |
---|
| 1629 | % civ1Bin=sparam.Civ1Bin; |
---|
| 1630 | % if ~exist(civ1Bin,'file') |
---|
| 1631 | % civ1Bin=fullfile(path_UVMAT,civ1Bin); |
---|
| 1632 | % end |
---|
| 1633 | % end |
---|
| 1634 | % if isfield(sparam,'Civ2Bin') |
---|
| 1635 | % civ2Bin=sparam.Civ2Bin; |
---|
| 1636 | % if ~exist(civ2_exe,'file')%the binary is defined in /bin, default setting |
---|
| 1637 | % civ2_exe=fullfile(path_UVMAT,civ2_exe); |
---|
| 1638 | % end |
---|
| 1639 | % end |
---|
| 1640 | % if isfield(sparam,'Patch_exe') |
---|
| 1641 | % patch_exe=sparam.Patch_exe; |
---|
| 1642 | % if ~exist(patch_exe,'file')%the binary is defined in /bin, default setting |
---|
| 1643 | % patch_exe=fullfile(path_UVMAT,patch_exe); |
---|
| 1644 | % end |
---|
| 1645 | % end |
---|
| 1646 | % if isfield(sparam,'Stinterp_exe') |
---|
| 1647 | % stinterp_exe=sparam.Stinterp_exe; |
---|
| 1648 | % end |
---|
| 1649 | % if isfield(sparam,'SGE') |
---|
| 1650 | % sge=str2double(sparam.SGE); |
---|
[112] | 1651 | % end |
---|
[67] | 1652 | % if ~isunix % for windows system, check whether the Matlab working dir is a UBC name |
---|
| 1653 | % dircur=pwd; |
---|
| 1654 | % if ~isequal(dircur([2 3]),':\') |
---|
| 1655 | % msgbox_uvmat('ERROR','move to a Matlab current working directory with a Windows name, e.g. m:/...') |
---|
| 1656 | % return; |
---|
| 1657 | % end |
---|
| 1658 | % end |
---|
| 1659 | % end |
---|
[112] | 1660 | % |
---|
[67] | 1661 | % %initialize the waitbars |
---|
| 1662 | % set(handles.waitbar_1,'Position',[0.946 0.877 0.03 0.001]) |
---|
| 1663 | % set(handles.waitbar_patch1,'Position',[0.946 0.626 0.03 0.001]) |
---|
| 1664 | % set(handles.waitbar_civ2,'Position',[0.946 0.406 0.03 0.001]) |
---|
| 1665 | % set(handles.waitbar_patch2,'Position',[0.946 0.187 0.03 0.001]) |
---|
| 1666 | % set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 1667 | % set(handles.RUN, 'Enable','Off') |
---|
| 1668 | % drawnow |
---|
[112] | 1669 | % |
---|
[67] | 1670 | % % get the list of file names and check the files |
---|
| 1671 | % display('checking the files...') |
---|
| 1672 | % [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]=... |
---|
| 1673 | % set_civ_filenames(handles,compare,box_test); |
---|
| 1674 | % nbfield=numel(num1_civ1); |
---|
| 1675 | % nbslice=size(num_a_civ1); |
---|
[112] | 1676 | % |
---|
[67] | 1677 | % if isempty(filecell) |
---|
| 1678 | % set(handles.RUN, 'Enable','On') |
---|
| 1679 | % set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
| 1680 | % set(handles.BATCH, 'Enable','On') |
---|
| 1681 | % set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
| 1682 | % return |
---|
| 1683 | % end |
---|
[112] | 1684 | % display('files OK, processing...') |
---|
[67] | 1685 | % nbfield=size(num1_civ1,2); |
---|
| 1686 | % nbslice=size(num1_civ1,1); |
---|
[112] | 1687 | % |
---|
[67] | 1688 | % %RUN CIV1 |
---|
| 1689 | % if box_test(1)==1 |
---|
| 1690 | % RUN_CIV1(handles,filecell.ima1.civ1,filecell.ima2.civ1,filecell.nc.civ1,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,nom_type_nc) |
---|
| 1691 | % if compare==3 |
---|
| 1692 | % RUN_CIV1(handles,filecell.imaA1.civ1,filecell.imaA2.civ1,filecell.ncA.civ1,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,nom_type_nc) |
---|
| 1693 | % end |
---|
| 1694 | % end |
---|
[112] | 1695 | % |
---|
[67] | 1696 | % %RUN FIX1 |
---|
[112] | 1697 | % if box_test(2)==1 |
---|
[71] | 1698 | % filebase=get(handles.RootName,'String'); |
---|
[67] | 1699 | % %names of the civ1 fields |
---|
| 1700 | % field1.vel_type='civ1'; |
---|
| 1701 | % field1.nb='nb_vectors'; |
---|
| 1702 | % % field1.X='vec_X'; |
---|
| 1703 | % % field1.Y='vec_Y'; |
---|
| 1704 | % % field1.U='vec_U'; |
---|
| 1705 | % % field1.V='vec_V'; |
---|
| 1706 | % field1.fixflag='vec_FixFlag'; |
---|
| 1707 | % flagindex(1)=get(handles.vec_Fmin2, 'Value'); |
---|
| 1708 | % flagindex(2)=get(handles.vec_F3, 'Value'); |
---|
| 1709 | % flagindex(3)=get(handles.vec_F2, 'Value'); |
---|
| 1710 | % thresh_vecC=str2double(get(handles.thresh_vecC,'String'));%threshold on image correlation vec_C |
---|
| 1711 | % thresh_vel=str2double(get(handles.thresh_vel,'String'));%threshold on velocity modulus |
---|
| 1712 | % inf_sup=get(handles.inf_sup1,'Value'); |
---|
| 1713 | % menu=get(handles.field_ref1,'String'); |
---|
| 1714 | % index=get(handles.field_ref1,'Value'); |
---|
| 1715 | % if isempty(menu) |
---|
| 1716 | % fieldchoice=''; |
---|
| 1717 | % else |
---|
| 1718 | % fieldchoice=menu{index}; |
---|
[112] | 1719 | % end |
---|
| 1720 | % h = waitbar(0,'removing velocity vectors, fix1');% display a wait bar |
---|
| 1721 | % test_mask=get(handles.get_mask_fix1,'Value'); |
---|
[67] | 1722 | % if test_mask |
---|
| 1723 | % maskdispl=get(handles.mask_fix1,'String'); |
---|
| 1724 | % if exist(maskdispl,'file') |
---|
| 1725 | % test_mask=2; |
---|
| 1726 | % maskname=maskdispl; |
---|
| 1727 | % else |
---|
[71] | 1728 | % maskbase=[get(handles.RootName,'String') '_' maskdispl]; % mask root name |
---|
[67] | 1729 | % end |
---|
| 1730 | % end |
---|
| 1731 | % for ifile=1:nbfield |
---|
| 1732 | % waitbar(ifile/nbfield); %update the waitbar |
---|
| 1733 | % for j=1:nbslice |
---|
| 1734 | % if test_mask==0 |
---|
| 1735 | % maskname='noFile use default'; |
---|
| 1736 | % maskflag=0; |
---|
| 1737 | % elseif test_mask==1 |
---|
[112] | 1738 | % nbslice_mask=str2double(maskdispl(1:end-4)); % |
---|
[67] | 1739 | % num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; |
---|
| 1740 | % maskname=name_generator(maskbase,num1_mask,1,'.png','_i');% mask corresponding to the first image of the pair |
---|
| 1741 | % maskflag= exist(maskname,'file')==2; |
---|
[112] | 1742 | % if ~maskflag; |
---|
[67] | 1743 | % maskname='noFile use default'; |
---|
[112] | 1744 | % end |
---|
[67] | 1745 | % end |
---|
| 1746 | % if ~isempty(file_ref_fix1) |
---|
| 1747 | % file_ref=file_ref_fix1{ifile,j}; |
---|
| 1748 | % else |
---|
| 1749 | % file_ref=''; |
---|
| 1750 | % end |
---|
| 1751 | % error=RUN_FIX(filecell.nc.civ1{ifile,j},field1,flagindex,1,thresh_vecC,maskflag,maskname,... |
---|
| 1752 | % thresh_vel,inf_sup,file_ref,fieldchoice); |
---|
[112] | 1753 | % |
---|
[67] | 1754 | % if compare==3 &&(isequal(mode,'pair j1-j2') || isequal(mode,'series(Dj)') || isequal(mode,'series(Di)')) |
---|
[112] | 1755 | % if test_mask==0 |
---|
[67] | 1756 | % maskname='noFile use default'; |
---|
| 1757 | % maskflag=0; |
---|
| 1758 | % else |
---|
[71] | 1759 | % maskbase=[get(handles.RootName2,'String') '_' maskdispl]; % mask root name |
---|
[112] | 1760 | % nbslice_mask=str2num(maskdispl(1:end-4)); % |
---|
| 1761 | % num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; |
---|
[67] | 1762 | % maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
| 1763 | % maskflag= exist(maskname,'file')==2; |
---|
[112] | 1764 | % if ~maskflag; |
---|
[67] | 1765 | % maskname='noFile use default'; |
---|
| 1766 | % end |
---|
| 1767 | % end |
---|
| 1768 | % error=RUN_FIX(filecell.ncA.civ1{ifile,j},field1,flagindex,1,thresh_vecC,maskflag,maskname,... |
---|
| 1769 | % thresh_vel,inf_sup,file_ref,fieldchoice); |
---|
| 1770 | % if ~isempty(error) |
---|
| 1771 | % msgbox_uvmat('ERROR',error) |
---|
| 1772 | % return |
---|
[112] | 1773 | % end |
---|
[67] | 1774 | % end |
---|
| 1775 | % end |
---|
| 1776 | % end |
---|
| 1777 | % close(h) |
---|
| 1778 | % end |
---|
[112] | 1779 | % |
---|
[67] | 1780 | % % RUN PATCH1 |
---|
| 1781 | % if box_test(3)==1 |
---|
| 1782 | % rho_patch1=str2num(get(handles.rho_patch1,'String')); |
---|
| 1783 | % if isempty(rho_patch1) |
---|
| 1784 | % rho_patch1='1000'; |
---|
| 1785 | % set(handles.rho_patch1,'String','1') |
---|
| 1786 | % else |
---|
| 1787 | % rho_patch1=num2str(1000*rho_patch1); |
---|
| 1788 | % end |
---|
| 1789 | % nx_patch1=get(handles.nx_patch1,'String'); |
---|
| 1790 | % if isequal(str2num(nx_patch1),[]) |
---|
| 1791 | % nx_patch1='50' ;%default |
---|
| 1792 | % set(handles.nx_patch1,'String','50'); |
---|
| 1793 | % end |
---|
| 1794 | % ny_patch1=get(handles.ny_patch1,'String'); |
---|
| 1795 | % if isequal(str2num(ny_patch1),[]) |
---|
| 1796 | % ny_patch1='50' ;%default |
---|
| 1797 | % set(handles.ny_patch1,'String','50'); |
---|
| 1798 | % end |
---|
| 1799 | % subdomain_patch1=get(handles.subdomain_patch1,'String'); |
---|
| 1800 | % thresh_patch1=get(handles.thresh_patch1,'String'); |
---|
[112] | 1801 | % test_interp=get(handles.test_interp,'Value'); |
---|
[67] | 1802 | % icount=0; |
---|
| 1803 | % for ifile=1:nbfield |
---|
| 1804 | % for j=1:nbslice |
---|
| 1805 | % icount=icount+1; |
---|
| 1806 | % barlength=0.188*icount/(nbfield*nbslice); |
---|
| 1807 | % set(handles.waitbar_patch1,'Position',[0.946 0.627-barlength 0.03 barlength]) |
---|
| 1808 | % drawnow |
---|
| 1809 | % if isequal(get(handles.test_stereo1,'Value'),0) |
---|
| 1810 | % cmd=RUN_PATCH(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp); |
---|
| 1811 | % s=-1; |
---|
| 1812 | % if sge |
---|
| 1813 | % [s,w]=unix(['qrsh -q -fast.q ' cmd]); |
---|
| 1814 | % end |
---|
| 1815 | % if s~=0 |
---|
| 1816 | % display(['!' cmd]) |
---|
[112] | 1817 | % eval(['!' cmd]); |
---|
[67] | 1818 | % end |
---|
[112] | 1819 | % |
---|
[67] | 1820 | % %stereo case: |
---|
| 1821 | % elseif isequal(get(handles.test_stereo1,'Value'),1) |
---|
| 1822 | % if exist('stinterp_exe','var')%Prog Gauthier |
---|
| 1823 | % cmd=RUN_STINTERP(stinterp_exe,filecell.ncA.civ1{ifile,j},filecell.nc.civ1{ifile,j},filecell.st{ifile,j},... |
---|
| 1824 | % nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,[filebase_A '.xml'],[filebase_B '.xml']); |
---|
| 1825 | % display(['!' cmd]) |
---|
[112] | 1826 | % eval(['!' cmd]); |
---|
[67] | 1827 | % else |
---|
| 1828 | % RUN_STLIN(filecell.ncA.civ1{ifile,j},filecell.nc.civ1{ifile,j},'civ1',filecell.st{ifile,j},... |
---|
| 1829 | % str2num(nx_patch1),str2num(ny_patch1),str2num(thresh_patch1),[filebase_A '.xml'],[filebase_B '.xml']); |
---|
| 1830 | % end |
---|
| 1831 | % end |
---|
| 1832 | % if compare==3 && isequal(get(handles.test_stereo1,'Value'),0) |
---|
| 1833 | % cmd=RUN_PATCH(filecell.ncA.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp); |
---|
| 1834 | % s=-1; |
---|
| 1835 | % if sge |
---|
| 1836 | % [s,w]=unix(['qrsh -q -fast.q ' cmd]); |
---|
| 1837 | % end |
---|
| 1838 | % if s~=0 |
---|
| 1839 | % display(['!' cmd]) |
---|
| 1840 | % eval(['!' cmd]); |
---|
| 1841 | % end |
---|
| 1842 | % end |
---|
| 1843 | % end |
---|
| 1844 | % end |
---|
| 1845 | % end |
---|
[112] | 1846 | % |
---|
[67] | 1847 | % % CIV2 |
---|
[112] | 1848 | % if box_test(4)==1 |
---|
[67] | 1849 | % RUN_CIV2(handles,filecell.ima1.civ2,filecell.ima2.civ2,filecell.nc.civ1,filecell.nc.civ2,num1_civ2,num2_civ2,... |
---|
| 1850 | % num_a_civ2,num_b_civ2,nom_type_nc) |
---|
| 1851 | % end |
---|
[112] | 1852 | % |
---|
[67] | 1853 | % % FIX2 |
---|
[112] | 1854 | % if box_test(5)==1 |
---|
[67] | 1855 | % %names of the civ2 fields |
---|
| 1856 | % field2.vel_type='civ2'; |
---|
| 1857 | % field2.nb='nb_vectors2'; |
---|
| 1858 | % field2.X='vec2_X'; |
---|
| 1859 | % field2.Y='vec2_Y'; |
---|
| 1860 | % field2.U='vec2_U'; |
---|
| 1861 | % field2.V='vec2_V'; |
---|
| 1862 | % field2.fixflag='vec2_FixFlag'; |
---|
| 1863 | % flagindex(1)=get(handles.vec_Fmin2_2, 'Value'); |
---|
| 1864 | % flagindex(2)=get(handles.vec_F3_2, 'Value'); |
---|
| 1865 | % flagindex(3)=get(handles.vec_F4, 'Value'); |
---|
| 1866 | % thresh_vec2C=str2num(get(handles.thresh_vec2C,'String'));%threshold on image correlation vec_C |
---|
| 1867 | % thresh_vel2=str2num(get(handles.thresh_vel2,'String'));%threshold on velocity modulus |
---|
| 1868 | % inf_sup=get(handles.inf_sup2,'Value'); |
---|
| 1869 | % menu=get(handles.field_ref2,'String'); |
---|
| 1870 | % index=get(handles.field_ref2,'Value'); |
---|
| 1871 | % if isempty(menu) |
---|
| 1872 | % fieldchoice=''; |
---|
| 1873 | % else |
---|
| 1874 | % fieldchoice=menu{index}; |
---|
[112] | 1875 | % end |
---|
[67] | 1876 | % h = waitbar(0,['removing velocity vectors, fix2']);% display a wait bar |
---|
| 1877 | % test_mask=get(handles.get_mask_fix2,'Value'); |
---|
| 1878 | % if test_mask |
---|
| 1879 | % maskdispl=get(handles.mask_fix2,'String'); |
---|
| 1880 | % if exist(maskdispl,'file') |
---|
| 1881 | % test_mask=2; |
---|
| 1882 | % maskname=maskdispl; |
---|
| 1883 | % else |
---|
[71] | 1884 | % maskbase=[get(handles.RootName,'String') '_' maskdispl]; % mask root name |
---|
[67] | 1885 | % end |
---|
| 1886 | % end |
---|
| 1887 | % for ifile=1:nbfield |
---|
| 1888 | % waitbar(ifile/nbfield); %update the waitbar |
---|
[112] | 1889 | % for j=1:nbslice |
---|
| 1890 | % if test_mask==0 |
---|
[67] | 1891 | % maskname='noFile use default'; |
---|
| 1892 | % maskflag=0; |
---|
| 1893 | % elseif test_mask==1 |
---|
[112] | 1894 | % nbslice_mask=str2num(maskdispl(1:end-4)); % |
---|
[67] | 1895 | % num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; |
---|
| 1896 | % maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
| 1897 | % maskflag= exist(maskname,'file')==2; |
---|
[112] | 1898 | % if ~maskflag; |
---|
[67] | 1899 | % maskname='noFile use default'; |
---|
| 1900 | % end |
---|
| 1901 | % end |
---|
| 1902 | % if ~isempty(file_ref_fix2) |
---|
| 1903 | % file_ref=file_ref_fix2{ifile,j}; |
---|
| 1904 | % else |
---|
| 1905 | % file_ref=''; |
---|
| 1906 | % end |
---|
| 1907 | % error=RUN_FIX(filecell.nc.civ2{ifile,j},field2,flagindex,2,thresh_vec2C,maskflag,maskname,... |
---|
[112] | 1908 | % thresh_vel2,inf_sup,file_ref,fieldchoice); |
---|
[67] | 1909 | % if ~isempty(error) |
---|
| 1910 | % msgbox_uvmat('ERROR',error) |
---|
| 1911 | % return |
---|
[112] | 1912 | % end |
---|
[67] | 1913 | % if compare==3 |
---|
[112] | 1914 | % if test_mask==0 |
---|
[67] | 1915 | % maskname='noFile use default'; |
---|
| 1916 | % maskflag=0; |
---|
| 1917 | % else |
---|
[71] | 1918 | % maskbase=[get(handles.RootName2,'String') '_' maskdispl]; % mask root name |
---|
[112] | 1919 | % nbslice_mask=str2num(maskdispl(1:end-4)); % |
---|
[67] | 1920 | % num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; |
---|
| 1921 | % maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
| 1922 | % maskflag= exist(maskname,'file')==2; |
---|
[112] | 1923 | % if ~maskflag; |
---|
[67] | 1924 | % maskname='noFile use default'; |
---|
| 1925 | % end |
---|
| 1926 | % end |
---|
| 1927 | % error=RUN_FIX(filecell.ncA.civ2{ifile,j},field2,flagindex,1,thresh_vec2C,maskflag,maskname,... |
---|
| 1928 | % thresh_vel2,inf_sup,file_ref,fieldchoice); |
---|
| 1929 | % if ~isempty(error) |
---|
| 1930 | % msgbox_uvmat('ERROR',error) |
---|
| 1931 | % return |
---|
[112] | 1932 | % end |
---|
[67] | 1933 | % end |
---|
| 1934 | % end |
---|
| 1935 | % end |
---|
| 1936 | % close(h) |
---|
| 1937 | % end |
---|
[112] | 1938 | % |
---|
[67] | 1939 | % %PATCH 2 |
---|
| 1940 | % if box_test(6)==1 |
---|
| 1941 | % rho_patch2=str2num(get(handles.rho_patch2,'String')); |
---|
| 1942 | % if isempty(rho_patch2) |
---|
| 1943 | % rho_patch2='1000'; |
---|
| 1944 | % set(handles.rho_patch2,'String','1') |
---|
| 1945 | % else |
---|
| 1946 | % rho_patch2=num2str(1000*rho_patch2); |
---|
| 1947 | % end |
---|
| 1948 | % nx_patch2=get(handles.nx_patch2,'String'); |
---|
| 1949 | % ny_patch2=get(handles.ny_patch2,'String'); |
---|
| 1950 | % thresh_patch2=get(handles.thresh_patch2,'String'); |
---|
| 1951 | % if isequal(str2num(nx_patch2),[]) |
---|
| 1952 | % nx_patch2='50' ;%default |
---|
| 1953 | % set(handles.nx_patch2,'String','50'); |
---|
| 1954 | % end |
---|
| 1955 | % if isequal(str2num(ny_patch2),[]) |
---|
| 1956 | % ny_patch2='50' ;%default |
---|
| 1957 | % set(handles.ny_patch2,'String','50'); |
---|
| 1958 | % end |
---|
| 1959 | % subdomain_patch2=get(handles.subdomain_patch2,'String'); |
---|
| 1960 | % icount=0; |
---|
| 1961 | % for ifile=1:nbfield |
---|
| 1962 | % for j=1:nbslice |
---|
| 1963 | % icount=icount+1; |
---|
| 1964 | % barlength=0.188*icount/(nbfield*nbslice); |
---|
| 1965 | % set(handles.waitbar_patch2,'Position',[0.946 0.188-barlength 0.03 barlength]) |
---|
| 1966 | % drawnow |
---|
| 1967 | % if compare~=3 | isequal(get(handles.test_stereo2,'Value'),0) |
---|
| 1968 | % cmd=RUN_PATCH(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,1,0); |
---|
| 1969 | % s=-1; |
---|
| 1970 | % if sge |
---|
| 1971 | % [s,w]=unix(['qrsh -q -fast.q ' cmd]); |
---|
| 1972 | % end |
---|
| 1973 | % if s~=0 |
---|
| 1974 | % display(['!' cmd]) |
---|
| 1975 | % eval(['!' cmd]); |
---|
| 1976 | % end |
---|
| 1977 | % elseif compare==3 && isequal(get(handles.test_stereo2,'Value'),1) |
---|
[112] | 1978 | % if exist('stinterp_exe','var')%Prog Gauthier |
---|
[67] | 1979 | % cmd=RUN_STINTERP(stinterp_exe,filecell.ncA.civ2{ifile,j},filecell.nc.civ2{ifile,j},filecell.st{ifile,j},... |
---|
| 1980 | % nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,[filebase_A '.xml'],[filebase_B '.xml']); |
---|
| 1981 | % display(['!' cmd]) |
---|
| 1982 | % eval(['!' cmd]) |
---|
| 1983 | % else |
---|
| 1984 | % RUN_STLIN(filecell.ncA.civ2{ifile,j},filecell.nc.civ2{ifile,j},'civ2',filecell.st{ifile,j},... |
---|
| 1985 | % str2num(nx_patch2),str2num(ny_patch2),str2num(thresh_patch2),[filebase_A '.xml'],[filebase_B '.xml']) |
---|
| 1986 | % end |
---|
[112] | 1987 | % end |
---|
[67] | 1988 | % if compare==3 && isequal(get(handles.test_stereo2,'Value'),0) |
---|
| 1989 | % cmd=RUN_PATCH(filecell.ncA.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,1,0); |
---|
| 1990 | % s=-1; |
---|
| 1991 | % if sge |
---|
| 1992 | % [s,w]=unix(['qrsh -q -fast.q ' cmd]); |
---|
| 1993 | % end |
---|
| 1994 | % if s~=0 |
---|
| 1995 | % display(['!' cmd]) |
---|
| 1996 | % eval(['!' cmd]); |
---|
| 1997 | % end |
---|
| 1998 | % end |
---|
| 1999 | % end |
---|
| 2000 | % end |
---|
| 2001 | % end |
---|
[112] | 2002 | % |
---|
[67] | 2003 | % set(handles.RUN, 'Enable','On') |
---|
| 2004 | % set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
[112] | 2005 | % |
---|
[67] | 2006 | % %save the current interface setting as figure namefig, append .0 to the name if it already exists |
---|
| 2007 | % if isfield(filecell,'st') |
---|
| 2008 | % fileresu=filecell.st{1,1}; |
---|
| 2009 | % elseif isfield(filecell,'nc') |
---|
| 2010 | % if isfield(filecell.nc,'civ2') |
---|
| 2011 | % fileresu=filecell.nc.civ2{1,1}; |
---|
| 2012 | % else |
---|
| 2013 | % fileresu=filecell.nc.civ1{1,1}; |
---|
| 2014 | % end |
---|
| 2015 | % end |
---|
| 2016 | % [RootPath,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileresu); |
---|
| 2017 | % namedoc=fullfile(RootPath,subdir,RootFile); |
---|
[112] | 2018 | % detect=1; |
---|
[67] | 2019 | % while detect==1 |
---|
| 2020 | % namefigfull=[namedoc '.fig']; |
---|
| 2021 | % hh=dir(namefigfull); |
---|
| 2022 | % if ~isempty(hh) |
---|
| 2023 | % detect=1; |
---|
| 2024 | % namedoc=[namedoc '.0']; |
---|
| 2025 | % else |
---|
| 2026 | % detect=0; |
---|
| 2027 | % end |
---|
| 2028 | % end |
---|
| 2029 | % saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) |
---|
[2] | 2030 | |
---|
[67] | 2031 | function RUN_Callback(hObject, eventdata, handles) |
---|
| 2032 | %------------------------------------------------------------------------ |
---|
| 2033 | % global civ1_exe civ2_exe patch_exe patch_new_exe sge |
---|
[73] | 2034 | set(handles.RUN, 'Enable','Off') |
---|
| 2035 | set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) |
---|
[67] | 2036 | batch=0; |
---|
| 2037 | launch_jobs(hObject, eventdata, handles,batch); |
---|
[73] | 2038 | set(handles.RUN, 'Enable','On') |
---|
| 2039 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
[36] | 2040 | |
---|
[12] | 2041 | %------------------------------------------------------------------------ |
---|
[2] | 2042 | % --- Executes on button press in BATCH: remote processing |
---|
| 2043 | function BATCH_Callback(hObject, eventdata, handles) |
---|
[12] | 2044 | %------------------------------------------------------------------------ |
---|
[67] | 2045 | %global civ1_exe civ2_exe patch_exe patch_new_exe fix_exe todo_path sge Civ_exe % probabely to remove |
---|
[73] | 2046 | set(handles.BATCH, 'Enable','Off') |
---|
| 2047 | set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784]) |
---|
[67] | 2048 | batch=1; |
---|
| 2049 | launch_jobs(hObject, eventdata, handles, batch) |
---|
[73] | 2050 | set(handles.BATCH, 'Enable','On') |
---|
| 2051 | set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
[67] | 2052 | |
---|
| 2053 | %------------------------------------------------------------------------ |
---|
| 2054 | % --- Executes on button press in BATCH: remote processing |
---|
| 2055 | function launch_jobs(hObject, eventdata, handles, batch) |
---|
| 2056 | %----------------------------------------------------------------------- |
---|
[2] | 2057 | compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3) |
---|
| 2058 | |
---|
| 2059 | %check the list of operations: |
---|
| 2060 | operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'}; |
---|
| 2061 | run_flag=1; |
---|
| 2062 | box_test(1)=get(handles.CIV1,'Value'); |
---|
| 2063 | box_test(2)=get(handles.FIX1,'Value'); |
---|
| 2064 | box_test(3)=get(handles.PATCH1,'Value'); |
---|
| 2065 | box_test(4)=get(handles.CIV2,'Value'); |
---|
| 2066 | box_test(5)=get(handles.FIX2,'Value'); |
---|
| 2067 | box_test(6)=get(handles.PATCH2,'Value'); |
---|
| 2068 | index=find(box_test==1); |
---|
| 2069 | if isempty(index) |
---|
| 2070 | msgbox_uvmat('ERROR','no selected operation') |
---|
| 2071 | return |
---|
| 2072 | end |
---|
| 2073 | index_first=min(index); |
---|
| 2074 | index_last=max(index); |
---|
| 2075 | box_used=box_test([index_first : index_last]); |
---|
| 2076 | [box_missing,ind_missing]=min(box_used); |
---|
| 2077 | if isequal(box_missing,0) |
---|
| 2078 | msgbox_uvmat('ERROR',['missing' cell2mat(operations(ind_missing))]); |
---|
| 2079 | return |
---|
| 2080 | end |
---|
| 2081 | |
---|
| 2082 | %root name |
---|
[71] | 2083 | filebase=get(handles.RootName,'String'); |
---|
[2] | 2084 | if isempty(filebase)||isequal(filebase,'') |
---|
| 2085 | msgbox_uvmat('ERROR','no input files') |
---|
| 2086 | return |
---|
| 2087 | end |
---|
[112] | 2088 | |
---|
[2] | 2089 | %check mask if selecetd |
---|
| 2090 | if isequal(get(handles.get_mask_civ1,'Value'),1) |
---|
[12] | 2091 | maskname=get(handles.mask_civ1,'String'); |
---|
| 2092 | if ~exist(maskname,'file') |
---|
| 2093 | get_mask_civ1_Callback(hObject, eventdata, handles); |
---|
| 2094 | end |
---|
[2] | 2095 | end |
---|
| 2096 | if isequal(get(handles.get_mask_fix1,'Value'),1) |
---|
[12] | 2097 | maskname=get(handles.mask_fix1,'String'); |
---|
| 2098 | if ~exist(maskname,'file') |
---|
| 2099 | get_mask_fix1_Callback(hObject, eventdata, handles); |
---|
| 2100 | end |
---|
[2] | 2101 | end |
---|
| 2102 | if isequal(get(handles.get_mask_civ2,'Value'),1) |
---|
[12] | 2103 | maskname=get(handles.mask_civ2,'String'); |
---|
| 2104 | if ~exist(maskname,'file') |
---|
[112] | 2105 | get_mask_civ2_Callback(hObject, eventdata, handles); |
---|
[12] | 2106 | end |
---|
[2] | 2107 | end |
---|
| 2108 | if isequal(get(handles.get_mask_fix2,'Value'),1) |
---|
[12] | 2109 | maskname=get(handles.mask_fix2,'String'); |
---|
| 2110 | if ~exist(maskname,'file') |
---|
[112] | 2111 | get_mask_fix2_Callback(hObject, eventdata, handles); |
---|
[12] | 2112 | end |
---|
[2] | 2113 | end |
---|
| 2114 | |
---|
| 2115 | %read names of the .exe file |
---|
| 2116 | path_uvmat=which('uvmat');% check the path detected for source file uvmat |
---|
| 2117 | path_UVMAT=fileparts(path_uvmat); %path to UVMAT |
---|
[112] | 2118 | xmlfile='PARAM.xml'; |
---|
[54] | 2119 | if exist(xmlfile,'file') |
---|
| 2120 | t=xmltree(xmlfile); |
---|
[67] | 2121 | s=convert(t); |
---|
[2] | 2122 | end |
---|
[116] | 2123 | test_interp=0; |
---|
| 2124 | if batch |
---|
[67] | 2125 | if isfield(s,'BatchParam') |
---|
| 2126 | sparam=s.BatchParam; |
---|
| 2127 | if ~ismember(sparam.BatchMode,{'sge'}) |
---|
| 2128 | msgbox_uvmat('ERROR',['batch mode ' sparam.BatchMode ' not supported by UVMAT']) |
---|
| 2129 | end |
---|
| 2130 | else |
---|
| 2131 | msgbox_uvmat('ERROR','no batch mode defined in PARAM.xml') |
---|
| 2132 | return |
---|
| 2133 | end |
---|
| 2134 | else |
---|
| 2135 | if isfield(s,'RunParam') |
---|
| 2136 | sparam=s.RunParam; |
---|
| 2137 | else |
---|
| 2138 | msgbox_uvmat('ERROR','no civ binaries defined in PARAM.xml') |
---|
| 2139 | return |
---|
| 2140 | end |
---|
[112] | 2141 | if isfield(sparam,'CivBin') |
---|
| 2142 | if ~exist(sparam.CivBin,'file') |
---|
| 2143 | sparam.CivBin=fullfile(path_UVMAT,sparam.CivBin); |
---|
| 2144 | end |
---|
[94] | 2145 | end |
---|
[112] | 2146 | if isfield(sparam,'Civ1Bin') |
---|
| 2147 | if ~exist(sparam.Civ1Bin,'file') |
---|
| 2148 | sparam.Civ1Bin=fullfile(path_UVMAT,sparam.Civ1Bin); |
---|
| 2149 | end |
---|
[94] | 2150 | end |
---|
[112] | 2151 | if isfield(sparam,'Civ2Bin') |
---|
| 2152 | if ~exist(sparam.Civ2Bin,'file') |
---|
| 2153 | sparam.Civ2Bin=fullfile(path_UVMAT,sparam.Civ2Bin); |
---|
| 2154 | end |
---|
[94] | 2155 | end |
---|
[112] | 2156 | %test_interp=get(handles.test_interp,'Value'); |
---|
[116] | 2157 | |
---|
[112] | 2158 | if isfield(sparam,'PatchBin') |
---|
| 2159 | if ~exist(sparam.PatchBin,'file') |
---|
| 2160 | sparam.PatchBin=fullfile(path_UVMAT,sparam.PatchBin); |
---|
| 2161 | end |
---|
[94] | 2162 | end |
---|
[112] | 2163 | % if test_interp && isfield(sparam,'PatchNewBin') |
---|
| 2164 | % if ~exist(sparam.PatchNewBin,'file') |
---|
| 2165 | % sparam.PatchNewBin=fullfile(path_UVMAT,sparam.PatchNewBin); |
---|
| 2166 | % end |
---|
| 2167 | % end |
---|
| 2168 | if isfield(sparam,'FixBin') |
---|
| 2169 | % fixBin=sparam.FixBin; |
---|
| 2170 | if ~exist(sparam.FixBin,'file') |
---|
| 2171 | sparam.FixBin=fullfile(path_UVMAT,sparam.FixBin); |
---|
| 2172 | end |
---|
[94] | 2173 | end |
---|
[73] | 2174 | end |
---|
[67] | 2175 | if batch |
---|
| 2176 | if isfield(sparam,'BatchMode') |
---|
| 2177 | batch_mode=sparam.BatchMode; |
---|
[2] | 2178 | end |
---|
[67] | 2179 | else |
---|
| 2180 | MaxCivProcesses=50; |
---|
[112] | 2181 | if isfield(sparam,'MaxCivProcesses') |
---|
[67] | 2182 | MaxCivProcesses=str2double(sparam.MaxCivProcesses); |
---|
[112] | 2183 | end |
---|
[2] | 2184 | end |
---|
| 2185 | |
---|
| 2186 | %initialize the waitbars |
---|
| 2187 | set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001]) |
---|
| 2188 | set(handles.waitbar_patch1,'Position',[0.946 0.439 0.03 0.001]) |
---|
| 2189 | set(handles.waitbar_civ2,'Position',[0.946 0.219 0.03 0.001]) |
---|
| 2190 | set(handles.waitbar_patch2,'Position',[0.946 0.0 0.03 0.001]) |
---|
| 2191 | drawnow |
---|
| 2192 | |
---|
| 2193 | % set the list of files and check them |
---|
| 2194 | display('checking the files...') |
---|
| 2195 | [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]=... |
---|
[112] | 2196 | set_civ_filenames(handles,compare,box_test); |
---|
[85] | 2197 | if isempty(filecell) |
---|
| 2198 | return |
---|
| 2199 | end |
---|
[67] | 2200 | %choice of batch priority |
---|
| 2201 | ind_answer=2; |
---|
| 2202 | if batch |
---|
| 2203 | [s,w]=unix('qstat -q civ.q|grep job_| wc -l'); %check the waiting list (command unix) |
---|
| 2204 | if isequal(s,0) |
---|
| 2205 | w(end)=[]; |
---|
| 2206 | str_displ={[w ' jobs in the waiting list'];'Select a priority:'}; |
---|
| 2207 | str={'urgent';'normal';'low'}; |
---|
| 2208 | [ind_answer,v] = listdlg('PromptString',str_displ,... |
---|
[112] | 2209 | 'SelectionMode','single',... |
---|
| 2210 | 'ListString',str,'ListSize',[200 200],'Name','job priority','InitialValue',3); |
---|
| 2211 | if isequal(v,0) % to handle Cancel button and figure close, |
---|
| 2212 | return % a better way should be create |
---|
[67] | 2213 | end |
---|
| 2214 | else |
---|
| 2215 | msgbox_uvmat('ERROR','batch system not available') |
---|
| 2216 | return |
---|
| 2217 | end |
---|
| 2218 | else |
---|
| 2219 | if isunix |
---|
| 2220 | [s,w]=unix('ps faux |grep civ|wc -l'); |
---|
| 2221 | w(end)=[]; |
---|
[113] | 2222 | if str2num(w)+numel(num1_civ1)> MaxCivProcesses |
---|
[67] | 2223 | msgbox_uvmat('ERROR',{['There are already ' w ' civ processes running locally'];'Use BATCH or submit RUN later'}) |
---|
| 2224 | return |
---|
| 2225 | end |
---|
| 2226 | end |
---|
| 2227 | end |
---|
[112] | 2228 | display('files OK, processing...') |
---|
[41] | 2229 | nbfield=numel(num1_civ1); |
---|
| 2230 | nbslice=numel(num_a_civ1); |
---|
[2] | 2231 | |
---|
| 2232 | %GET PARAMETERS: |
---|
[112] | 2233 | %get civ parameters |
---|
[2] | 2234 | if box_test(1)==1 |
---|
| 2235 | par_civ1=read_param_civ1(handles,filecell.ima1.civ1{1,1}); |
---|
[112] | 2236 | end |
---|
[2] | 2237 | |
---|
| 2238 | %get fix1 parameters |
---|
[112] | 2239 | if box_test(2)==1 |
---|
[2] | 2240 | flagindex1(1)=get(handles.vec_Fmin2, 'Value'); |
---|
| 2241 | flagindex1(2)=get(handles.vec_F3, 'Value'); |
---|
| 2242 | flagindex1(3)=get(handles.vec_F2, 'Value'); |
---|
| 2243 | thresh_vecC1=str2num(get(handles.thresh_vecC,'String'));%threshold on image correlation vec_C |
---|
| 2244 | thresh_vel1=str2num(get(handles.thresh_vel,'String'));%threshold on velocity modulus |
---|
| 2245 | test_mask=get(handles.get_mask_fix1,'Value'); |
---|
| 2246 | nbslice_mask=get(handles.mask_fix1,'UserData'); % get the number of slices (= number of masks) |
---|
| 2247 | %%%%%%%%%%%%%COMPLETER LE PROGRAMME FIX |
---|
[112] | 2248 | % inf_sup=get(handles.inf_sup1,'Value');80 |
---|
| 2249 | % fileref=get(handles.ref_fix1,'String'); |
---|
| 2250 | % refpath=get(handles.ref_fix1,'UserData'); |
---|
| 2251 | % fileref=fullfile(refpath,fileref); |
---|
[2] | 2252 | menu=get(handles.field_ref1,'String'); |
---|
| 2253 | index=get(handles.field_ref1,'Value'); |
---|
| 2254 | if isempty(menu) |
---|
| 2255 | fieldchoice=''; |
---|
| 2256 | else |
---|
| 2257 | fieldchoice=menu{index}; |
---|
[112] | 2258 | msgbox_uvmat('WARNING','reference field is not used presently with batch, use RUN option') |
---|
| 2259 | end |
---|
[2] | 2260 | end |
---|
[112] | 2261 | |
---|
| 2262 | %get patch1 parameters |
---|
[67] | 2263 | if box_test(3)==1 |
---|
[112] | 2264 | rho_patch1=str2num(get(handles.rho_patch1,'String')); |
---|
| 2265 | if isempty(rho_patch1) |
---|
| 2266 | rho_patch1='1000'; |
---|
| 2267 | set(handles.rho_patch1,'String','1') |
---|
| 2268 | else |
---|
| 2269 | rho_patch1=num2str(1000*rho_patch1); |
---|
| 2270 | end |
---|
| 2271 | nx_patch1=get(handles.nx_patch1,'String'); |
---|
| 2272 | ny_patch1=get(handles.ny_patch1,'String'); |
---|
| 2273 | if isequal(str2num(nx_patch1),[]) |
---|
| 2274 | nx_patch1='50' ;%default |
---|
| 2275 | set(handles.nx_patch1,'String','50'); |
---|
| 2276 | end |
---|
| 2277 | if isequal(str2num(ny_patch1),[]) |
---|
| 2278 | ny_patch1='50' ;%default |
---|
| 2279 | set(handles.ny_patch1,'String','50'); |
---|
| 2280 | end |
---|
| 2281 | subdomain_patch1=get(handles.subdomain_patch1,'String'); |
---|
| 2282 | thresh_patch1=get(handles.thresh_patch1,'String'); |
---|
| 2283 | end |
---|
| 2284 | |
---|
| 2285 | %get civ2 parameters |
---|
[2] | 2286 | if box_test(4)==1 |
---|
| 2287 | par_civ2=read_param_civ2(handles,cell2mat(filecell.ima1.civ2(1,1))); |
---|
| 2288 | end |
---|
| 2289 | |
---|
| 2290 | %get fix2 parameters |
---|
[112] | 2291 | if box_test(5)==1 |
---|
[2] | 2292 | flagindex2(1)=get(handles.vec_Fmin2_2, 'Value'); |
---|
| 2293 | flagindex2(2)=get(handles.vec_F3_2, 'Value'); |
---|
| 2294 | flagindex2(3)=get(handles.vec_F4, 'Value'); |
---|
| 2295 | thresh_vec2C=str2num(get(handles.thresh_vec2C,'String'));%threshold on image correlation vec_C |
---|
| 2296 | thresh_vel2=str2num(get(handles.thresh_vel2,'String'));%threshold on velocity modulus |
---|
| 2297 | test_mask=get(handles.get_mask_fix2,'Value'); |
---|
| 2298 | nbslice_mask=get(handles.mask_fix2,'UserData'); % get the number of slices (= number of masks) |
---|
[112] | 2299 | %%%%%%%%%%%%%COMPLETER LE PROGRAMME FIX AVEC REF FILE ET OPTION inf_sup=2 |
---|
| 2300 | % inf_sup=get(handles.inf_sup2,'Value'); |
---|
| 2301 | % ref=get(handles.ref_fix2,'UserData'); |
---|
| 2302 | |
---|
[2] | 2303 | %%%%%%%%%%%%%%%%%%% |
---|
| 2304 | end |
---|
| 2305 | |
---|
| 2306 | %get patch2 parameters |
---|
| 2307 | if box_test(6)==1 |
---|
| 2308 | rho_patch2=str2num(get(handles.rho_patch2,'String')); |
---|
| 2309 | if isempty(rho_patch2) |
---|
| 2310 | rho_patch2='1000'; |
---|
| 2311 | set(handles.rho_patch2,'String','1') |
---|
| 2312 | else |
---|
| 2313 | rho_patch2=num2str(1000*rho_patch2); |
---|
| 2314 | end |
---|
| 2315 | nx_patch2=get(handles.nx_patch2,'String'); |
---|
| 2316 | ny_patch2=get(handles.ny_patch2,'String'); |
---|
| 2317 | if isequal(str2num(nx_patch2),[]) |
---|
| 2318 | nx_patch2='50' ;%default |
---|
| 2319 | set(handles.nx_patch2,'String','50'); |
---|
| 2320 | end |
---|
| 2321 | if isequal(str2num(ny_patch2),[]) |
---|
| 2322 | ny_patch2='50' ;%default |
---|
| 2323 | set(handles.ny_patch2,'String','50'); |
---|
| 2324 | end |
---|
| 2325 | subdomain_patch2=get(handles.subdomain_patch2,'String'); |
---|
| 2326 | thresh_patch2=get(handles.thresh_patch2,'String'); |
---|
[112] | 2327 | % test_interp=get(handles.test_interp,'Value'); |
---|
[2] | 2328 | end |
---|
| 2329 | |
---|
| 2330 | %MAIN LOOP |
---|
| 2331 | % for ifile=1:nbfield |
---|
| 2332 | p1text=[];%initiate command text |
---|
[71] | 2333 | time=get(handles.RootName,'UserData'); %get the set of times |
---|
[112] | 2334 | civAll=get(handles.Experimental,'Value'); % Boolean for new civ excution method |
---|
[2] | 2335 | for ifile=1:nbfield |
---|
| 2336 | for j=1:nbslice |
---|
[112] | 2337 | i_cmd=0; |
---|
[2] | 2338 | cmd=''; |
---|
[73] | 2339 | if isunix % check: necessaire aussi en RUN? |
---|
[112] | 2340 | %fid=fopen([filename '.cmx'],'w') |
---|
| 2341 | cmd='#!/bin/bash \n'; |
---|
| 2342 | cmd=[cmd '#$ -cwd \n']; |
---|
| 2343 | cmd=[cmd 'hostname && date \n']; |
---|
[117] | 2344 | cmd=[cmd 'umask 002 \n']; |
---|
[2] | 2345 | end |
---|
| 2346 | if civAll |
---|
| 2347 | civAllxml=xmltree;% xml contents, all parameters |
---|
[73] | 2348 | civAllCmd=''; |
---|
[2] | 2349 | civAllxml=set(civAllxml,1,'name','CivDoc'); |
---|
| 2350 | end |
---|
[73] | 2351 | filename_cmx=filecell.nc.civ1{ifile,j};%output netcdf file |
---|
[41] | 2352 | filename_cmx(end-1:end)='cm';%name of cmx file |
---|
[2] | 2353 | filename_cmx=[filename_cmx 'x']; |
---|
| 2354 | |
---|
[112] | 2355 | %CIV1 |
---|
[2] | 2356 | if box_test(1)==1 |
---|
[41] | 2357 | par_civ1.filename_ima_a=filecell.ima1.civ1{ifile,j}; |
---|
[112] | 2358 | par_civ1.filename_ima_b=filecell.ima2.civ1{ifile,j}; |
---|
[2] | 2359 | namelog=[filename_cmx([1:end-3]) 'log']; |
---|
| 2360 | par_civ1.Dt=num2str(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j))); |
---|
[112] | 2361 | par_civ1.T0=num2str((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2); |
---|
[2] | 2362 | par_civ1.term_a=num2stra(num_a_civ1(j),nom_type_nc);%UTILITE? |
---|
[112] | 2363 | par_civ1.term_b=num2stra(num_b_civ1(j),nom_type_nc);% |
---|
[2] | 2364 | test_mask=get(handles.get_mask_civ1,'Value'); |
---|
[112] | 2365 | if test_mask==0 |
---|
[2] | 2366 | par_civ1.maskname='noFile use default'; |
---|
| 2367 | par_civ1.maskflag='n'; |
---|
| 2368 | else |
---|
| 2369 | maskdispl=get(handles.mask_civ1,'String'); |
---|
[12] | 2370 | if exist(maskdispl,'file') |
---|
| 2371 | par_civ1.maskname=maskdispl; |
---|
[112] | 2372 | par_civ1.maskflag='y'; |
---|
[2] | 2373 | else |
---|
[112] | 2374 | maskbase=[filebase '_' maskdispl]; % |
---|
| 2375 | nbslice_mask=str2num(maskdispl(1:end-4)); % |
---|
[12] | 2376 | num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; |
---|
| 2377 | par_civ1.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
| 2378 | if exist(par_civ1.maskname,'file') |
---|
[82] | 2379 | par_civ1.maskflag='y'; |
---|
[12] | 2380 | else |
---|
| 2381 | par_civ1.maskname='noFile use default'; |
---|
[112] | 2382 | par_civ1.maskflag='n'; |
---|
[12] | 2383 | end |
---|
[2] | 2384 | end |
---|
| 2385 | end |
---|
| 2386 | |
---|
| 2387 | test_grid=get(handles.browse_gridciv1,'Value'); |
---|
| 2388 | if test_grid |
---|
| 2389 | par_civ1.gridflag='y'; |
---|
| 2390 | gridname=get(handles.grid_civ1,'String'); |
---|
| 2391 | if isequal(gridname(end-3:end),'grid') |
---|
| 2392 | nbslice_grid=str2num(gridname(1:end-4)); % |
---|
| 2393 | if ~isempty(nbslice_grid) |
---|
| 2394 | num1_grid=mod(num1_civ1(ifile)-1,nbslice_grid)+1; |
---|
| 2395 | par_civ1.gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
| 2396 | if ~exist(par_civ1.gridname,'file') |
---|
[112] | 2397 | msgbox_uvmat('ERROR','grid file absent for civ1') |
---|
[2] | 2398 | end |
---|
| 2399 | elseif exist(gridname,'file') |
---|
[112] | 2400 | par_civ1.gridname=gridname; |
---|
[2] | 2401 | else |
---|
| 2402 | msgbox_uvmat('ERROR','grid file absent for civ1') |
---|
| 2403 | end |
---|
| 2404 | end |
---|
| 2405 | else |
---|
[112] | 2406 | par_civ1.gridname='noFile use default'; |
---|
| 2407 | par_civ1.gridflag='n'; |
---|
[2] | 2408 | end |
---|
[112] | 2409 | % |
---|
[2] | 2410 | i_cmd=i_cmd+1; |
---|
| 2411 | if isequal(civAll,0) |
---|
[94] | 2412 | cmd=[cmd CIV1_CMD(filename_cmx(1:end-4),namelog,par_civ1,handles,sparam) '\n']; |
---|
[2] | 2413 | else |
---|
[112] | 2414 | civAllCmd=[civAllCmd ' civ1 ']; |
---|
| 2415 | str=CIV1_CMD_Unified(filename_cmx([1:end-4]),namelog,par_civ1); |
---|
| 2416 | fieldnames=fields(str); |
---|
[2] | 2417 | [civAllxml,uid_civ1]=add(civAllxml,1,'element','civ1'); |
---|
| 2418 | for ilist=1:length(fieldnames) |
---|
[112] | 2419 | val=eval(['str.' fieldnames{ilist}]); |
---|
| 2420 | if ischar(val) |
---|
| 2421 | [civAllxml,uid_t]=add(civAllxml,uid_civ1,'element',fieldnames{ilist}); |
---|
| 2422 | [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); |
---|
| 2423 | end |
---|
| 2424 | end |
---|
[2] | 2425 | end |
---|
| 2426 | end |
---|
| 2427 | |
---|
[112] | 2428 | % FIX1 |
---|
| 2429 | if box_test(2)==1 |
---|
| 2430 | test_mask=get(handles.get_mask_fix1,'Value'); |
---|
| 2431 | if test_mask==0 |
---|
[2] | 2432 | maskname=''; |
---|
[112] | 2433 | else |
---|
[2] | 2434 | maskdispl=get(handles.mask_fix1,'String'); |
---|
[112] | 2435 | nbslice_mask=str2num(maskdispl(1:end-4)); % |
---|
[2] | 2436 | num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; |
---|
| 2437 | maskbase=[filebase '_' maskdispl]; |
---|
| 2438 | maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
[112] | 2439 | end |
---|
| 2440 | if isequal(civAll,0) |
---|
[94] | 2441 | cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(flagindex1(1)) ... |
---|
[112] | 2442 | ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ... |
---|
| 2443 | ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName ' maskname]; |
---|
[94] | 2444 | cmd_FIX=regexprep(cmd_FIX,'\\','\\\\'); |
---|
| 2445 | cmd=[cmd cmd_FIX '\n']; |
---|
[112] | 2446 | else |
---|
[2] | 2447 | fix1.inputFileName=filecell.nc.civ1{ifile,j} ; |
---|
| 2448 | fix1.fi1=num2str(flagindex1(1)); |
---|
| 2449 | fix1.fi2=num2str(flagindex1(2)); |
---|
| 2450 | fix1.fi3=num2str(flagindex1(3)); |
---|
| 2451 | fix1.threshC=num2str(thresh_vecC1); |
---|
[112] | 2452 | fix1.threshV=num2str(thresh_vel1); |
---|
[2] | 2453 | fieldnames=fields(fix1); |
---|
| 2454 | [civAllxml,uid_fix1]=add(civAllxml,1,'element','fix1'); |
---|
| 2455 | for ilist=1:length(fieldnames) |
---|
[112] | 2456 | val=eval(['fix1.' fieldnames{ilist}]); |
---|
| 2457 | if ischar(val) |
---|
| 2458 | [civAllxml,uid_t]=add(civAllxml,uid_fix1,'element',fieldnames{ilist}); |
---|
| 2459 | [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); |
---|
| 2460 | end |
---|
| 2461 | end |
---|
| 2462 | civAllCmd=[civAllCmd ' fix1 ']; |
---|
| 2463 | end |
---|
| 2464 | end |
---|
| 2465 | |
---|
| 2466 | %PATCH1 |
---|
| 2467 | if box_test(3)==1 |
---|
| 2468 | if isequal(civAll,0) |
---|
| 2469 | cmd_PATCH=PATCH_CMD(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp,sparam.PatchBin); |
---|
| 2470 | cmd_PATCH=regexprep(cmd_PATCH,'\\','\\\\'); |
---|
| 2471 | cmd=[cmd cmd_PATCH '\n']; |
---|
| 2472 | else |
---|
| 2473 | patch1.inputFileName=filecell.nc.civ1{ifile,j} ; |
---|
| 2474 | patch1.nopt=subdomain_patch1; |
---|
| 2475 | patch1.maxdiff=thresh_patch1; |
---|
| 2476 | patch1.ro=rho_patch1; |
---|
| 2477 | test_grid=get(handles.get_gridpatch1,'Value'); |
---|
| 2478 | if test_grid |
---|
| 2479 | patch1.gridflag='y'; |
---|
| 2480 | gridname=get(handles.grid_patch1,'String'); |
---|
| 2481 | if isequal(gridname(end-3:end),'grid') |
---|
| 2482 | nbslice_grid=str2num(gridname(1:end-4)); % |
---|
| 2483 | if ~isempty(nbslice_grid) |
---|
| 2484 | num1_grid=mod(num1_civ1(ifile)-1,nbslice_grid)+1; |
---|
| 2485 | patch1.gridPatch=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
| 2486 | if ~exist(patch1.gridPatch,'file') |
---|
| 2487 | msgbox_uvmat('ERROR','grid file absent for patch1') |
---|
| 2488 | end |
---|
| 2489 | elseif exist(gridname,'file') |
---|
| 2490 | patch1.gridPatch=gridname; |
---|
| 2491 | else |
---|
| 2492 | msgbox_uvmat('ERROR','grid file absent for patch1') |
---|
[2] | 2493 | end |
---|
| 2494 | end |
---|
[112] | 2495 | else |
---|
| 2496 | patch1.gridPatch='none'; |
---|
| 2497 | patch1.gridflag='n'; |
---|
| 2498 | patch1.m=nx_patch1; |
---|
| 2499 | patch1.n=ny_patch1; |
---|
[2] | 2500 | end |
---|
[112] | 2501 | patch1.convectFlow='n'; |
---|
| 2502 | fieldnames=fields(patch1); |
---|
[2] | 2503 | [civAllxml,uid_patch1]=add(civAllxml,1,'element','patch1'); |
---|
| 2504 | for ilist=1:length(fieldnames) |
---|
[112] | 2505 | val=eval(['patch1.' fieldnames{ilist}]); |
---|
| 2506 | if ischar(val) |
---|
| 2507 | [civAllxml,uid_t]=add(civAllxml,uid_patch1,'element',fieldnames{ilist}); |
---|
| 2508 | [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); |
---|
| 2509 | end |
---|
| 2510 | end |
---|
| 2511 | civAllCmd=[civAllCmd ' patch1 ']; |
---|
| 2512 | end |
---|
[2] | 2513 | end |
---|
[112] | 2514 | |
---|
| 2515 | if box_test(4)==1 | box_test(5)==1 | box_test(6)==1 |
---|
| 2516 | filename_cmx=filecell.nc.civ2{ifile,j};%output netcdf file |
---|
| 2517 | filename_cmx([end-1:end])=[ 'cm'];%name of cmx file |
---|
| 2518 | filename_cmx=[filename_cmx 'x']; |
---|
| 2519 | end |
---|
| 2520 | |
---|
| 2521 | if box_test(4)==1 |
---|
[2] | 2522 | par_civ2.filename_ima_a=filecell.ima1.civ2{ifile,j}; |
---|
| 2523 | %par_civ2.filename_ima_a([end-3:end])=[];%remove .png extension |
---|
| 2524 | par_civ2.filename_ima_b=filecell.ima2.civ2{ifile,j}; |
---|
| 2525 | %par_civ2.filename_ima_b([end-3:end])=[];%remove .png extension |
---|
| 2526 | namelog=[filename_cmx([1:end-3]) 'log']; |
---|
| 2527 | par_civ2.Dt=num2str(time(num2_civ2(ifile),num_b_civ2(j))-time(num1_civ2(ifile),num_a_civ2(j))); |
---|
[112] | 2528 | par_civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2); |
---|
[2] | 2529 | par_civ2.term_a=num2stra(num_a_civ2(j),nom_type_nc); |
---|
[112] | 2530 | par_civ2.term_b=num2stra(num_b_civ2(j),nom_type_nc); |
---|
[2] | 2531 | par_civ2.filename_nc1=filecell.nc.civ1{ifile,j}; |
---|
| 2532 | par_civ2.filename_nc1([end-2:end])=[]; % remove '.nc' |
---|
| 2533 | test_mask=get(handles.get_mask_civ2,'Value'); |
---|
[112] | 2534 | if test_mask==0 |
---|
[2] | 2535 | par_civ2.maskname='noFile use default'; |
---|
| 2536 | par_civ2.maskflag='n'; |
---|
| 2537 | else |
---|
| 2538 | maskdispl=get(handles.mask_civ2,'String'); |
---|
[12] | 2539 | if exist(maskdispl,'file') |
---|
| 2540 | par_civ2.maskname=maskdispl; |
---|
| 2541 | par_civ2.maskflag='y'; |
---|
[2] | 2542 | else |
---|
[112] | 2543 | maskbase=[filebase '_' maskdispl]; % |
---|
| 2544 | nbslice_mask=str2num(maskdispl(1:end-4)); % |
---|
[12] | 2545 | num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; |
---|
| 2546 | par_civ2.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
| 2547 | if exist(par_civ2.maskname,'file') |
---|
[112] | 2548 | par_civ2.maskflag='y'; |
---|
[12] | 2549 | else |
---|
| 2550 | par_civ2.maskname='noFile use default'; |
---|
[112] | 2551 | par_civ2.maskflag='n'; |
---|
[12] | 2552 | end |
---|
[2] | 2553 | end |
---|
| 2554 | end |
---|
| 2555 | %TESTgrid |
---|
| 2556 | test_grid=get(handles.browse_gridciv2,'Value'); |
---|
| 2557 | gridname=get(handles.grid_civ2,'String'); |
---|
| 2558 | gridflag='y'; |
---|
| 2559 | if numel(gridname)>=4 && isequal(gridname(end-3:end),'grid') |
---|
| 2560 | nbslice_grid=str2num(gridname(1:end-4)); % |
---|
| 2561 | if ~isempty(nbslice_grid) |
---|
| 2562 | par_civ2.gridflag='y'; |
---|
| 2563 | num1_grid=mod(num1_civ2(ifile)-1,nbslice_grid)+1; |
---|
| 2564 | par_civ2.gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
| 2565 | if exist(par_civ2.gridname,'file') |
---|
[112] | 2566 | par_civ2.gridflag='y'; |
---|
[2] | 2567 | else |
---|
| 2568 | par_civ2.gridname='noFile use default'; |
---|
[112] | 2569 | par_civ2.gridflag='n'; |
---|
[2] | 2570 | end |
---|
| 2571 | elseif exist(gridname,'file') |
---|
[112] | 2572 | par_civ2.gridflag='y'; |
---|
[2] | 2573 | else |
---|
| 2574 | par_civ2.gridname='noFile use default'; |
---|
[112] | 2575 | par_civ2.gridflag='n'; |
---|
[2] | 2576 | end |
---|
| 2577 | end |
---|
| 2578 | %endTESTgrid |
---|
| 2579 | i_cmd=i_cmd+1; |
---|
[94] | 2580 | cmd_CIV2=CIV2_CMD(filename_cmx,namelog,par_civ2,sparam); |
---|
[2] | 2581 | if isequal(civAll,0) |
---|
| 2582 | if(isunix) |
---|
[90] | 2583 | cmd=[cmd 'cp -f ' filename_cmx '2 ' filename_cmx '\n' cmd_CIV2 '\n']; |
---|
[2] | 2584 | else |
---|
[94] | 2585 | filename_cmx=regexprep(filename_cmx,'\\','\\\\'); |
---|
[90] | 2586 | cmd=[cmd 'copy /Y ' filename_cmx '2 ' filename_cmx '\n' cmd_CIV2 '\n']; |
---|
[2] | 2587 | end |
---|
| 2588 | else |
---|
[112] | 2589 | civAllCmd=[civAllCmd ' civ2 ']; |
---|
| 2590 | str=CIV2_CMD_Unified(filename_cmx([1:end-4]),namelog,par_civ2); |
---|
| 2591 | fieldnames=fields(str); |
---|
[2] | 2592 | [civAllxml,uid_civ2]=add(civAllxml,1,'element','civ2'); |
---|
| 2593 | for ilist=1:length(fieldnames) |
---|
| 2594 | val=eval(['str.' fieldnames{ilist}]); |
---|
| 2595 | if ischar(val) |
---|
[112] | 2596 | [civAllxml,uid_t]=add(civAllxml,uid_civ2,'element',fieldnames{ilist}); |
---|
| 2597 | [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); |
---|
[2] | 2598 | end |
---|
[112] | 2599 | end |
---|
[2] | 2600 | end |
---|
[112] | 2601 | end |
---|
| 2602 | |
---|
| 2603 | % FIX2 |
---|
| 2604 | if box_test(5)==1 |
---|
| 2605 | test_mask=get(handles.get_mask_fix2,'Value'); |
---|
| 2606 | if test_mask==0 |
---|
| 2607 | maskname=''; %no mask used |
---|
[2] | 2608 | else |
---|
| 2609 | maskdispl=get(handles.mask_fix2,'String'); |
---|
[112] | 2610 | maskbase=[filebase '_' maskdispl]; % |
---|
| 2611 | nbslice_mask=str2num(maskdispl(1:end-4)); % |
---|
[2] | 2612 | num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; |
---|
| 2613 | maskname =name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
[112] | 2614 | end |
---|
| 2615 | if isequal(civAll,0) |
---|
[94] | 2616 | cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ2{ifile,j} ' -fi1 ' num2str(flagindex2(1)) ... |
---|
[112] | 2617 | ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ... |
---|
| 2618 | ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname]; |
---|
| 2619 | cmd_FIX=regexprep(cmd_FIX,'\\','\\\\'); |
---|
| 2620 | cmd=[cmd cmd_FIX '\n']; |
---|
| 2621 | else |
---|
[2] | 2622 | fix2.inputFileName=filecell.nc.civ2{ifile,j} ; |
---|
| 2623 | fix2.fi1=num2str(flagindex2(1)); |
---|
| 2624 | fix2.fi2=num2str(flagindex2(2)); |
---|
| 2625 | fix2.fi3=num2str(flagindex2(3)); |
---|
| 2626 | fix2.threshC=num2str(thresh_vec2C); |
---|
[112] | 2627 | fix2.threshV=num2str(thresh_vel2); |
---|
[2] | 2628 | fieldnames=fields(fix2); |
---|
| 2629 | [civAllxml,uid_fix2]=add(civAllxml,1,'element','fix2'); |
---|
| 2630 | for ilist=1:length(fieldnames) |
---|
[112] | 2631 | val=eval(['fix2.' fieldnames{ilist}]); |
---|
| 2632 | if ischar(val) |
---|
| 2633 | [civAllxml,uid_t]=add(civAllxml,uid_fix2,'element',fieldnames{ilist}); |
---|
| 2634 | [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); |
---|
| 2635 | end |
---|
| 2636 | end |
---|
| 2637 | civAllCmd=[civAllCmd ' fix2 ']; |
---|
| 2638 | end |
---|
| 2639 | end |
---|
| 2640 | |
---|
| 2641 | %PATCH2 |
---|
| 2642 | if box_test(6)==1 |
---|
[12] | 2643 | if isequal(civAll,0) |
---|
[94] | 2644 | cmd_PATCH=PATCH_CMD(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp,sparam.PatchBin); |
---|
| 2645 | cmd_PATCH=regexprep(cmd_PATCH,'\\','\\\\'); |
---|
[90] | 2646 | cmd=[cmd cmd_PATCH '\n']; |
---|
[12] | 2647 | else |
---|
| 2648 | patch2.inputFileName=filecell.nc.civ1{ifile,j} ; |
---|
| 2649 | patch2.nopt=subdomain_patch1; |
---|
| 2650 | patch2.maxdiff=thresh_patch1; |
---|
| 2651 | patch2.ro=rho_patch1; |
---|
| 2652 | test_grid=get(handles.get_gridpatch2,'Value'); |
---|
| 2653 | if test_grid |
---|
| 2654 | patch2.gridflag='y'; |
---|
| 2655 | gridname=get(handles.grid_patch2,'String'); |
---|
| 2656 | if isequal(gridname(end-3:end),'grid') |
---|
| 2657 | nbslice_grid=str2num(gridname(1:end-4)); % |
---|
| 2658 | if ~isempty(nbslice_grid) |
---|
| 2659 | num1_grid=mod(num1_civ2(ifile)-1,nbslice_grid)+1; |
---|
| 2660 | patch2.gridPatch=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
| 2661 | if ~exist(patch2.gridPatch,'file') |
---|
[112] | 2662 | msgbox_uvmat('ERROR','grid file absent for patch2') |
---|
[12] | 2663 | end |
---|
| 2664 | elseif exist(gridname,'file') |
---|
[112] | 2665 | patch2.gridPatch=gridname; |
---|
[12] | 2666 | else |
---|
| 2667 | msgbox_uvmat('ERROR','grid file absent for patch2') |
---|
[2] | 2668 | end |
---|
| 2669 | end |
---|
[12] | 2670 | else |
---|
[112] | 2671 | patch2.gridPatch='none'; |
---|
| 2672 | patch2.gridflag='n'; |
---|
| 2673 | patch2.m=nx_patch2; |
---|
| 2674 | patch2.n=ny_patch2; |
---|
[2] | 2675 | end |
---|
[12] | 2676 | patch2.convectFlow='n'; |
---|
| 2677 | fieldnames=fields(patch2); |
---|
| 2678 | [civAllxml,uid_patch2]=add(civAllxml,1,'element','patch2'); |
---|
| 2679 | for ilist=1:length(fieldnames) |
---|
[112] | 2680 | val=eval(['patch2.' fieldnames{ilist}]); |
---|
| 2681 | if ischar(val) |
---|
| 2682 | [civAllxml,uid_t]=add(civAllxml,uid_patch2,'element',fieldnames{ilist}); |
---|
| 2683 | [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); |
---|
| 2684 | end |
---|
| 2685 | end |
---|
[12] | 2686 | civAllCmd=[civAllCmd ' patch2 ']; |
---|
[112] | 2687 | end |
---|
[12] | 2688 | end |
---|
| 2689 | if isequal(civAll,1) |
---|
| 2690 | save(civAllxml,[filename_cmx([1:end-4]) '.xml']); |
---|
[73] | 2691 | %cmd=char({cmd;[CivBin ' -f ' [filename_cmx([1:end-4]) '.xml'] ' ' civAllCmd]}); |
---|
[90] | 2692 | cmd=[cmd CivBin ' -f ' filename_cmx(1:end-4) '.xml ' civAllCmd '\n']; |
---|
[12] | 2693 | end |
---|
[112] | 2694 | % create the .bat file: |
---|
[67] | 2695 | if batch |
---|
[112] | 2696 | [Rootbat,Filebat,extbat]=fileparts(filename_cmx); |
---|
| 2697 | filename_bat=fullfile(Rootbat,['job_' Filebat extbat]); |
---|
[12] | 2698 | else |
---|
| 2699 | filename_bat=filename_cmx; |
---|
| 2700 | end |
---|
| 2701 | filename_bat(end-2:end)='bat'; |
---|
| 2702 | fid=fopen(filename_bat,'w'); |
---|
[39] | 2703 | fprintf(fid,cmd); |
---|
| 2704 | fclose(fid); |
---|
[12] | 2705 | %dlmwrite(filename_bat,cmd,'');%write commands in filename_bat |
---|
[67] | 2706 | if batch |
---|
| 2707 | switch batch_mode |
---|
| 2708 | case 'sge' |
---|
| 2709 | pvalue=num2str((1-ind_answer)*500); |
---|
| 2710 | namelog=[filename_bat '.patch.log']; |
---|
[73] | 2711 | display(['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]); |
---|
[67] | 2712 | eval( ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]); |
---|
| 2713 | end |
---|
[12] | 2714 | else |
---|
[112] | 2715 | %% to lauch the jobs locally : |
---|
[12] | 2716 | if(isunix) |
---|
[120] | 2717 | cmd_str=['!at -qb now -f ' filename_bat ' &']; %ou at -qb now -f |
---|
| 2718 | eval(cmd_str); |
---|
| 2719 | display(cmd_str); |
---|
[2] | 2720 | else |
---|
[120] | 2721 | cmd_str=['!' filename_bat ' &']; |
---|
| 2722 | eval(cmd_str); |
---|
| 2723 | display(cmd_str); |
---|
[2] | 2724 | end |
---|
[12] | 2725 | end |
---|
[112] | 2726 | end |
---|
[2] | 2727 | end |
---|
[85] | 2728 | % set(handles.BATCH, 'Enable','On') |
---|
| 2729 | % set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
[2] | 2730 | |
---|
| 2731 | %save interface state |
---|
| 2732 | if isfield(filecell,'nc') |
---|
| 2733 | if isfield(filecell.nc,'civ2') |
---|
| 2734 | fileresu=filecell.nc.civ2{1,1}; |
---|
| 2735 | else |
---|
| 2736 | fileresu=filecell.nc.civ1{1,1}; |
---|
| 2737 | end |
---|
| 2738 | end |
---|
| 2739 | [RootPath,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileresu); |
---|
| 2740 | namedoc=fullfile(RootPath,subdir,RootFile); |
---|
[112] | 2741 | detect=1; |
---|
[2] | 2742 | while detect==1 |
---|
| 2743 | namefigfull=[namedoc '.fig']; |
---|
| 2744 | hh=dir(namefigfull); |
---|
| 2745 | if ~isempty(hh) |
---|
| 2746 | detect=1; |
---|
| 2747 | namedoc=[namedoc '.0']; |
---|
| 2748 | else |
---|
| 2749 | detect=0; |
---|
| 2750 | end |
---|
| 2751 | end |
---|
| 2752 | saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) |
---|
| 2753 | |
---|
[12] | 2754 | %------------------------------------------------------------------------ |
---|
[2] | 2755 | %OUTPUT: |
---|
| 2756 | % filecell: structure of input and output files |
---|
| 2757 | % .ima1.civ1{i,j}, .ima1.civ2{i,j}; set of first image names for correlations, for civ1 and civ2 |
---|
| 2758 | % .ima2.civ1{i,j}, .ima2.civ2{i,j} ; set of second image names for correlations |
---|
| 2759 | % .imaA1.civ1{i,j}, .ima1.civ2{i,j}; set of first image names for correlations, for civ1 and civ2, with camA in stereo case (then .ima1 corresponds to camB) |
---|
| 2760 | % .imaA2.civ1{i,j}, .ima2.civ2{i,j} ; set of second image names for correlations, with camA in stereo case (then .ima1 corresponds to camB) |
---|
| 2761 | % .nc.civ1{i,j}, .nc.civ2{i,j}; set of nc files for PIV results |
---|
| 2762 | % .ncA.civ1{i,j}, .ncA.civ2{i,j}; set of nc files for PIV results with camA (then .nc corresponds to camB) |
---|
| 2763 | % .st{i,j}; set of nc files for the combined stereo fields |
---|
[41] | 2764 | % num1_civ1(i),num2_civ1(i): lists of first and last i indices for civ1 |
---|
| 2765 | % num_a_civ1(j),num_b_civ1(j): lists of first and last j indices for civ1 |
---|
| 2766 | % num1_civ2(i),num2_civ2(i): lists of first and last i indices for civ2 |
---|
| 2767 | % num_a_civ2(j),num_b_civ2(j): lists of first and last j indices for civ2 |
---|
[112] | 2768 | % nom_type_nc: nomenclature type for velocity files |
---|
[41] | 2769 | % file_ref_fix1,file_ref_fix2: reference files possibly used by Fix1 and 2 |
---|
[2] | 2770 | 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]=... |
---|
| 2771 | set_civ_filenames(handles,compare,box_test) |
---|
[12] | 2772 | %------------------------------------------------------------------------ |
---|
[85] | 2773 | filecell=[];%default |
---|
[2] | 2774 | %get the filename root, nomenclature and numbers |
---|
[71] | 2775 | filebase=get(handles.RootName,'String'); |
---|
[2] | 2776 | browse=get(handles.browse_root,'UserData'); |
---|
| 2777 | compare_list=get(handles.compare,'String'); |
---|
| 2778 | val=get(handles.compare,'Value'); |
---|
| 2779 | compare=compare_list{val}; |
---|
| 2780 | if strcmp(compare,'displacement') |
---|
| 2781 | mode='displacement'; |
---|
| 2782 | else |
---|
| 2783 | mode_list=get(handles.mode,'String'); |
---|
| 2784 | mode_value=get(handles.mode,'Value'); |
---|
| 2785 | mode=mode_list{mode_value}; |
---|
| 2786 | end |
---|
[71] | 2787 | time=get(handles.RootName,'UserData'); %get the set of times |
---|
| 2788 | ext_ima=get(handles.ImaExt,'String'); |
---|
[2] | 2789 | nom_type_nc=browse.nom_type_nc; |
---|
[122] | 2790 | if isfield(browse,'nom_type_ima') |
---|
| 2791 | nom_type_ima2=browse.nom_type_ima; |
---|
| 2792 | end |
---|
| 2793 | if isempty(nom_type_ima2),nom_type_ima2='1';end; %default |
---|
| 2794 | if isempty(nom_type_nc),nom_type_nc='_i1-i2';end; %default |
---|
[2] | 2795 | [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... |
---|
| 2796 | find_pair_indices(handles,mode); |
---|
| 2797 | %determine the new filebase for 'displacement' mode (comparison of two series) |
---|
| 2798 | filebase_B=filebase;% root name of the second field series for stereo |
---|
| 2799 | if strcmp(compare,'displacement') || strcmp(compare,'stereo PIV') |
---|
[112] | 2800 | test_disp=1; |
---|
[2] | 2801 | nom_type_ima1=browse.nom_type_ima_1; %nomenclature type of the second file series |
---|
| 2802 | [Path2,Name2]=fileparts(filebase_B); |
---|
| 2803 | Path1=Path2; |
---|
[71] | 2804 | Name1=get(handles.RootName_1,'String');% root name of the first field series for stereo |
---|
[2] | 2805 | filebase_A=fullfile(Path1,Name1); |
---|
| 2806 | if length(Name1)>6 |
---|
| 2807 | Name1=Name1(end-5:end); |
---|
| 2808 | end |
---|
| 2809 | if length(Name2)>6 |
---|
| 2810 | Name2=Name2(end-5:end); |
---|
| 2811 | end |
---|
| 2812 | filebase_AB=fullfile(Path2,[Name2 '-' Name1]); |
---|
| 2813 | else |
---|
| 2814 | test_disp=0; |
---|
| 2815 | filebase_A=filebase; |
---|
| 2816 | nom_type_ima1=nom_type_ima2; |
---|
| 2817 | filebase_AB=filebase; |
---|
| 2818 | end |
---|
| 2819 | if strcmp(compare,'displacement') |
---|
[112] | 2820 | filebase_ima1=filebase_A; |
---|
| 2821 | filebase_ima2=filebase_B; |
---|
| 2822 | filebase_nc=filebase_AB; %root name for the result of civ2 |
---|
[2] | 2823 | else |
---|
[112] | 2824 | filebase_ima1=filebase_B; |
---|
| 2825 | filebase_ima2=filebase_B; |
---|
| 2826 | filebase_nc=filebase_B; |
---|
| 2827 | end |
---|
[2] | 2828 | |
---|
| 2829 | %determine reference files for fix: |
---|
| 2830 | file_ref_fix1={};%default |
---|
| 2831 | file_ref_fix2={}; |
---|
| 2832 | nbfield=length(num1_civ1); |
---|
| 2833 | nbslice=length(num_a_civ1); |
---|
| 2834 | if box_test(2)==1% fix1 performed |
---|
| 2835 | ref=get(handles.ref_fix1,'UserData');%read data on the ref file stored by get_ref_fix1_Callback |
---|
| 2836 | if ~isempty(ref) |
---|
| 2837 | first_i=str2num(get(handles.first_i,'String')); |
---|
| 2838 | last_i=str2num(get(handles.last_i,'String')); |
---|
| 2839 | incr_i=str2num(get(handles.incr_i,'String')); |
---|
| 2840 | first_j=str2num(get(handles.first_j,'String')); |
---|
| 2841 | last_j=str2num(get(handles.last_j,'String')); |
---|
| 2842 | incr_j=str2num(get(handles.incr_j,'String')); |
---|
| 2843 | num_i_ref=[first_i:incr_i:last_i]; |
---|
| 2844 | num_j_ref=[first_j:incr_j:last_j]; |
---|
| 2845 | if isequal(mode,'displacement') |
---|
| 2846 | num_i1=num_i_ref; |
---|
| 2847 | num_i2=num_i_ref; |
---|
| 2848 | num_j1=num_j_ref; |
---|
| 2849 | num_j2=num_j_ref; |
---|
| 2850 | elseif isequal(mode,'pair j1-j2')% isequal(mode,'st_pair j1-j2') |
---|
| 2851 | num_i1=num_i_ref; |
---|
| 2852 | num_i2=num_i1; |
---|
| 2853 | num_j1=ref.num_a*ones(size(num_i_ref)); |
---|
| 2854 | num_j2=ref.num_b*ones(size(num_i_ref)); |
---|
| 2855 | elseif isequal(mode,'series(Di)') % isequal(mode,'st_series(Di)') |
---|
| 2856 | delta1=floor((ref.num2-ref.num1)/2); |
---|
| 2857 | delta2=ceil((ref.num2-ref.num1)/2); |
---|
| 2858 | num_i1=num_i_ref-delta1*ones(size(num_i_ref)); |
---|
| 2859 | num_i2=num_i_ref+delta2*ones(size(num_i_ref)); |
---|
| 2860 | if isempty(ref.num_a) |
---|
| 2861 | ref.num_a=1; |
---|
| 2862 | end |
---|
| 2863 | num_j1=ref.num_a*ones(size(num_i1)); |
---|
| 2864 | num_j2=num_j1; |
---|
| 2865 | elseif isequal(mode,'series(Dj)')%| isequal(mode,'st_series(Dj)') |
---|
| 2866 | delta1=floor((ref.num_b-ref.num_a)/2); |
---|
| 2867 | delta2=ceil((ref.num_b-ref.num_a)/2); |
---|
| 2868 | num_i1=ref.num1*ones(size(num_i_ref)); |
---|
| 2869 | num_i2=num_i1; |
---|
| 2870 | num_j1=num_j_ref-delta1*ones(size(num_j_ref)); |
---|
| 2871 | num_j2=num_j_ref+delta2*ones(size(num_j_ref)); |
---|
| 2872 | end |
---|
| 2873 | for ifile=1:nbfield |
---|
| 2874 | for j=1:nbslice |
---|
| 2875 | 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);% |
---|
| 2876 | file_ref_fix1(ifile,j)={file_ref}; |
---|
| 2877 | if ~exist(file_ref,'file') |
---|
| 2878 | msgbox_uvmat('ERROR',['reference file ' file_ref ' not found for fix1']) |
---|
[12] | 2879 | filecell=[]; |
---|
[2] | 2880 | return |
---|
| 2881 | end |
---|
| 2882 | end |
---|
| 2883 | end |
---|
| 2884 | end |
---|
| 2885 | end |
---|
| 2886 | |
---|
| 2887 | %determine reference files for fix2: |
---|
| 2888 | if box_test(5)==1% fix2 performed |
---|
| 2889 | ref=get(handles.ref_fix2,'UserData'); |
---|
| 2890 | if ~isempty(ref) |
---|
| 2891 | first_i=str2num(get(handles.first_i,'String')); |
---|
| 2892 | last_i=str2num(get(handles.last_i,'String')); |
---|
| 2893 | incr_i=str2num(get(handles.incr_i,'String')); |
---|
| 2894 | first_j=str2num(get(handles.first_j,'String')); |
---|
| 2895 | last_j=str2num(get(handles.last_j,'String')); |
---|
| 2896 | incr_j=str2num(get(handles.incr_j,'String')); |
---|
| 2897 | num_i_ref=[first_i:incr_i:last_i]; |
---|
| 2898 | num_j_ref=[first_j:incr_j:last_j]; |
---|
| 2899 | if isequal(mode,'displacement') |
---|
| 2900 | num_i1=num_i_ref; |
---|
| 2901 | num_i2=num_i_ref; |
---|
| 2902 | num_j1=num_j_ref; |
---|
| 2903 | num_j2=num_j_ref; |
---|
| 2904 | elseif isequal(mode,'pair j1-j2') |
---|
| 2905 | num_i1=num_i_ref; |
---|
| 2906 | num_i2=num_i1; |
---|
| 2907 | num_j1=ref.num_a; |
---|
| 2908 | num_j2=ref.num_b; |
---|
| 2909 | elseif isequal(mode,'series(Di)') |
---|
| 2910 | delta1=floor((ref.num2-ref.num1)/2); |
---|
| 2911 | delta2=ceil((ref.num2-ref.num1)/2); |
---|
| 2912 | num_i1=num_i_ref-delta1*ones(size(num_i_ref)); |
---|
| 2913 | num_i2=num_i_ref+delta2*ones(size(num_i_ref)); |
---|
| 2914 | num_j1=ref.num_a*ones(size(num_i1)); |
---|
| 2915 | num_j2=num_j1; |
---|
| 2916 | elseif isequal(mode,'series(Dj)') |
---|
| 2917 | delta1=floor((ref.num_b-ref.num_a)/2); |
---|
| 2918 | delta2=ceil((ref.num_b-ref.num_a)/2); |
---|
| 2919 | num_i1=ref.num1*ones(size(num_i_ref)); |
---|
| 2920 | num_i2=num_i1; |
---|
| 2921 | num_j1=num_j_ref-delta1*ones(size(num_j_ref)); |
---|
| 2922 | num_j2=num_j_ref+delta2*ones(size(num_j_ref)); |
---|
| 2923 | end |
---|
| 2924 | for ifile=1:nbfield |
---|
| 2925 | for j=1:nbslice |
---|
| 2926 | 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);% |
---|
| 2927 | file_ref_fix2(ifile,j)={file_ref}; |
---|
| 2928 | if ~exist(file_ref,'file') |
---|
| 2929 | msgbox_uvmat('ERROR',['reference file ' file_ref ' not found for fix2']) |
---|
[122] | 2930 | filecell={}; |
---|
[2] | 2931 | return |
---|
| 2932 | end |
---|
| 2933 | end |
---|
| 2934 | end |
---|
| 2935 | end |
---|
| 2936 | end |
---|
| 2937 | |
---|
| 2938 | %check dir |
---|
| 2939 | subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf output data |
---|
| 2940 | subdir_civ2=get(handles.subdir_civ2,'String'); |
---|
| 2941 | if isequal(subdir_civ1,''),subdir_civ1='A'; end% put default subdir |
---|
| 2942 | if isequal(subdir_civ2,''),subdir_civ2=subdir_civ1; end% put default subdir |
---|
| 2943 | currentdir=pwd;%store the current working directory |
---|
| 2944 | [Path_ima,Name]=fileparts(filebase);%Path of the image files (.civ) |
---|
| 2945 | if ~exist(Path_ima,'dir') |
---|
[12] | 2946 | msgbox_uvmat('ERROR',['path to images ' Path_ima ' not found']) |
---|
[122] | 2947 | filecell={}; |
---|
[2] | 2948 | return |
---|
| 2949 | end |
---|
| 2950 | cd(Path_ima);%move to the directory of the images: needed to create the result dir by 'mkdir' |
---|
| 2951 | dircur=pwd; %current working directory |
---|
| 2952 | m2=''; |
---|
| 2953 | [erread,message]=fileattrib(Path_ima); |
---|
[122] | 2954 | if ~isempty(message) && ~isequal(message.UserWrite,1) |
---|
[112] | 2955 | msgbox_uvmat('ERROR',['No writting access to ' Path_ima]) |
---|
[122] | 2956 | filecell={}; |
---|
[112] | 2957 | cd(currentdir); |
---|
| 2958 | return |
---|
[2] | 2959 | end |
---|
| 2960 | |
---|
| 2961 | %check the existence of the netcdf and image files involved |
---|
| 2962 | % %%%%%%%%%%%% case CIV1 activated %%%%%%%%%%%%% |
---|
| 2963 | if box_test(1)==1; |
---|
[112] | 2964 | detect=1; |
---|
| 2965 | while detect==1 %create a new subdir if the netcdf files already exist |
---|
[122] | 2966 | vers=0; |
---|
| 2967 | subdir_civ1_new=subdir_civ1; |
---|
| 2968 | for ifile=1:nbfield |
---|
[112] | 2969 | for j=1:nbslice |
---|
[122] | 2970 | 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] | 2971 | detect=exist(filename,'file')==2; |
---|
| 2972 | if detect% if a netcdf file already exists |
---|
[122] | 2973 | vers=vers+1; |
---|
| 2974 | subdir_civ1_new=[subdir_civ1 '_' num2str(vers)]; |
---|
[112] | 2975 | subdir_civ2=subdir_civ1; |
---|
| 2976 | break |
---|
| 2977 | end |
---|
| 2978 | filecell.nc.civ1(ifile,j)={filename}; |
---|
| 2979 | end |
---|
| 2980 | if detect% if a netcdf file already exists |
---|
| 2981 | break |
---|
| 2982 | end |
---|
| 2983 | end |
---|
[122] | 2984 | subdir_civ1=subdir_civ1_new; |
---|
[112] | 2985 | %create the new subdir_civ1 |
---|
| 2986 | if ~exist(fullfile(Path_ima,subdir_civ1),'dir') |
---|
| 2987 | [m1,m2,m3]=mkdir(subdir_civ1); |
---|
| 2988 | if ~isequal(m2,'') |
---|
[122] | 2989 | msgbox_uvmat('ERROR', m2)%error message for directory creation |
---|
| 2990 | cd(currentdir) |
---|
| 2991 | filecell={}; |
---|
| 2992 | return |
---|
[112] | 2993 | end |
---|
| 2994 | end |
---|
| 2995 | if strcmp(compare,'stereo PIV')&&(strcmp(mode,'pair j1-j2')||strcmp(mode,'series(Dj)')||strcmp(mode,'series(Di)'))%check second nc series |
---|
[122] | 2996 | vers=0; |
---|
| 2997 | subdir_civ1_new=subdir_civ1; |
---|
[112] | 2998 | for ifile=1:nbfield |
---|
| 2999 | for j=1:nbslice |
---|
[122] | 3000 | 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] | 3001 | detect=exist(filename,'file')==2; |
---|
[2] | 3002 | if detect% if a netcdf file already exists |
---|
[122] | 3003 | vers=vers+1; |
---|
| 3004 | subdir_civ1_new=[subdir_civ1 '_' num2str(vers)]; |
---|
[112] | 3005 | subdir_civ2=subdir_civ1; |
---|
| 3006 | break |
---|
[2] | 3007 | end |
---|
[112] | 3008 | filecell.ncA.civ1(ifile,j)={filename}; |
---|
| 3009 | end |
---|
| 3010 | if detect% if a netcdf file already exists |
---|
| 3011 | break |
---|
| 3012 | end |
---|
| 3013 | end |
---|
[122] | 3014 | subdir_civ1=subdir_civ1_new; |
---|
[112] | 3015 | %create the new subdir_civ1 |
---|
| 3016 | if ~exist(fullfile(Path_ima,subdir_civ1),'dir') |
---|
| 3017 | [m1,m2,m3]=mkdir(subdir_civ1); |
---|
| 3018 | if ~isequal(m2,'') |
---|
| 3019 | msgbox_uvmat('ERROR', m2) |
---|
[122] | 3020 | cd(currentdir) |
---|
| 3021 | filecell={}; |
---|
| 3022 | return |
---|
[112] | 3023 | end |
---|
| 3024 | end |
---|
| 3025 | end |
---|
| 3026 | end |
---|
[2] | 3027 | % get image names |
---|
| 3028 | for ifile=1:nbfield |
---|
[112] | 3029 | for j=1:nbslice |
---|
[2] | 3030 | filename=name_generator(filebase_ima1, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); |
---|
| 3031 | idetect(j)=exist(filename,'file')==2; |
---|
| 3032 | filecell.ima1.civ1(ifile,j)={filename}; %first image |
---|
| 3033 | filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); |
---|
| 3034 | idetect_1(j)=exist(filename,'file')==2; |
---|
| 3035 | filecell.ima2.civ1(ifile,j)={filename};%second image |
---|
[112] | 3036 | end |
---|
| 3037 | [idetectmin,indexj]=min(idetect); |
---|
| 3038 | if idetectmin==0, |
---|
| 3039 | msgbox_uvmat('ERROR',[filecell.ima1.civ1{ifile,indexj} ' not found']) |
---|
[122] | 3040 | filecell={}; |
---|
| 3041 | cd(currentdir) |
---|
[112] | 3042 | return |
---|
| 3043 | end |
---|
| 3044 | [idetectmin,indexj]=min(idetect_1); |
---|
| 3045 | if idetectmin==0, |
---|
| 3046 | msgbox_uvmat('ERROR',[filecell.ima2.civ1{ifile,indexj} ' not found']) |
---|
[122] | 3047 | filecell={}; |
---|
[112] | 3048 | cd(currentdir) |
---|
| 3049 | return |
---|
| 3050 | end |
---|
| 3051 | end |
---|
| 3052 | if strcmp(compare,'stereo PIV') && (strcmp(mode,'pair j1-j2') || strcmp(mode,'series(Dj)') || strcmp(mode,'series(Di)')) |
---|
| 3053 | for ifile=1:nbfield |
---|
| 3054 | for j=1:nbslice |
---|
| 3055 | filename=name_generator(filebase_A, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); |
---|
| 3056 | idetect(j)=exist(filename,'file')==2; |
---|
| 3057 | filecell.imaA1.civ1(ifile,j)={filename} ;%first image |
---|
| 3058 | filename=name_generator(filebase_A, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); |
---|
| 3059 | idetect_1(j)=exist(filename,'file')==2; |
---|
| 3060 | filecell.imaA2.civ1(ifile,j)={filename};%second image |
---|
| 3061 | end |
---|
[2] | 3062 | [idetectmin,indexj]=min(idetect); |
---|
[112] | 3063 | if idetectmin==0, |
---|
| 3064 | msgbox_uvmat('ERROR',[filecell.imaA1.civ1{ifile,indexj} ' not found']) |
---|
[122] | 3065 | filecell={}; |
---|
[112] | 3066 | cd(currentdir) |
---|
[2] | 3067 | return |
---|
[112] | 3068 | end |
---|
[2] | 3069 | [idetectmin,indexj]=min(idetect_1); |
---|
[112] | 3070 | if idetectmin==0, |
---|
| 3071 | msgbox_uvmat('ERROR',[filecell.imaA2.civ1{ifile,indexj} ' not found']) |
---|
[122] | 3072 | filecell={}; |
---|
[2] | 3073 | cd(currentdir) |
---|
| 3074 | return |
---|
[112] | 3075 | end |
---|
| 3076 | end |
---|
[2] | 3077 | end |
---|
[112] | 3078 | |
---|
| 3079 | %%%%%%%%%%%%% fix1 or patch1 activated but no civ1 %%%%%%%%%%%%% |
---|
| 3080 | elseif (box_test(2)==1 || box_test(3)==1); |
---|
[2] | 3081 | for ifile=1:nbfield |
---|
| 3082 | for j=1:nbslice |
---|
| 3083 | filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',... |
---|
[112] | 3084 | nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% |
---|
| 3085 | detect=exist(filename,'file')==2; |
---|
[122] | 3086 | if detect==0 |
---|
| 3087 | msgbox_uvmat('ERROR',[filename ' not found']) |
---|
| 3088 | filecell={}; |
---|
| 3089 | cd(currentdir) |
---|
| 3090 | return |
---|
| 3091 | end |
---|
[2] | 3092 | filecell.nc.civ1(ifile,j)={filename}; |
---|
| 3093 | end |
---|
| 3094 | end |
---|
| 3095 | if strcmp(compare,'stereo PIV') |
---|
[112] | 3096 | for ifile=1:nbfield |
---|
| 3097 | for j=1:nbslice |
---|
| 3098 | 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);% |
---|
| 3099 | filecell.ncA.civ1(ifile,j)={filename}; |
---|
| 3100 | if ~exist(filename,'file') |
---|
| 3101 | msgbox_uvmat('ERROR',['input file ' filename ' not found']) |
---|
| 3102 | set(handles.RUN, 'Enable','On') |
---|
| 3103 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
[122] | 3104 | filecell={}; |
---|
[112] | 3105 | cd(currentdir) |
---|
| 3106 | return |
---|
[2] | 3107 | end |
---|
| 3108 | end |
---|
[112] | 3109 | end |
---|
[2] | 3110 | end |
---|
| 3111 | end |
---|
| 3112 | |
---|
| 3113 | %%%%%%%%%%%%% if civ2 performed with pairs different than civ1 %%%%%%%%%%%%% |
---|
| 3114 | testdiff=0; |
---|
| 3115 | if (box_test(4)==1)&&... |
---|
[112] | 3116 | ((get(handles.list_pair_civ1,'Value')~=get(handles.list_pair_civ2,'Value'))||~isequal(subdir_civ2,subdir_civ1)) |
---|
[2] | 3117 | testdiff=1; |
---|
[112] | 3118 | detect=1; |
---|
[2] | 3119 | while detect==1 %create a new subdir if the netcdf files already exist |
---|
[112] | 3120 | for ifile=1:nbfield |
---|
| 3121 | for j=1:nbslice |
---|
| 3122 | 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);% |
---|
| 3123 | detect=exist(filename,'file')==2; |
---|
| 3124 | if detect% if a netcdf file already exists |
---|
| 3125 | subdir_civ2=[subdir_civ2 '.0']; |
---|
| 3126 | break |
---|
| 3127 | end |
---|
| 3128 | filecell.nc.civ2(ifile,j)={filename}; |
---|
| 3129 | end |
---|
| 3130 | if detect% if a netcdf file already exists |
---|
| 3131 | break |
---|
| 3132 | end |
---|
| 3133 | end |
---|
| 3134 | %create the new subdir_civ2 |
---|
| 3135 | if ~exist(fullfile(Path_ima,subdir_civ2),'dir') |
---|
| 3136 | [m1,m2,m3]=mkdir(subdir_civ2); |
---|
| 3137 | if ~isequal(m2,'') |
---|
| 3138 | msgbox_uvmat('ERROR', m2) |
---|
[122] | 3139 | filecell={}; |
---|
| 3140 | cd(currentdir) |
---|
| 3141 | return |
---|
[112] | 3142 | end |
---|
| 3143 | end |
---|
| 3144 | if strcmp(compare,'stereo PIV')%check second nc series |
---|
[122] | 3145 | vers=0; |
---|
| 3146 | subdir_civ2_new=subdir_civ2; |
---|
[112] | 3147 | for ifile=1:nbfield |
---|
| 3148 | for j=1:nbslice |
---|
| 3149 | filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
[122] | 3150 | nom_type_nc,1,num2_civ2(ifile),num_b_civ1(j),subdir_civ2_new);% |
---|
[112] | 3151 | detect=exist(filename,'file')==2; |
---|
[2] | 3152 | if detect% if a netcdf file already exists |
---|
[122] | 3153 | vers=vers+1; |
---|
| 3154 | subdir_civ2_new=[subdir_civ2 '_' num2str(vers)]; |
---|
[112] | 3155 | break |
---|
[2] | 3156 | end |
---|
[112] | 3157 | filecell.ncA.civ2(ifile,j)={filename}; |
---|
| 3158 | end |
---|
| 3159 | if detect% if a netcdf file already exists |
---|
| 3160 | break |
---|
| 3161 | end |
---|
| 3162 | end |
---|
[122] | 3163 | subdir_civ2=subdir_civ2_new; |
---|
[112] | 3164 | %create the new subdir_civ1 |
---|
| 3165 | if ~exist(fullfile(Path_ima,subdir_civ2),'dir') |
---|
| 3166 | [m1,m2,m3]=mkdir(subdir_civ2); |
---|
| 3167 | if ~isequal(m2,'') |
---|
[122] | 3168 | msgbox_uvmat('ERROR', m2)%error message for directory creation |
---|
| 3169 | cd(currentdir) |
---|
| 3170 | filecell={}; |
---|
| 3171 | return |
---|
[112] | 3172 | end |
---|
| 3173 | end |
---|
| 3174 | end |
---|
| 3175 | end |
---|
[2] | 3176 | end |
---|
| 3177 | cd(currentdir);%come back to the current working directory |
---|
| 3178 | |
---|
| 3179 | %%%%%%%%%%%%% if civ2 results are obtained or used %%%%%%%%%%%%% |
---|
| 3180 | if box_test(4)==1 || box_test(5)==1 || box_test(6)==1 %civ2 |
---|
| 3181 | %check source netcdf file of civ1 estimates |
---|
| 3182 | if box_test(1)==0; %no civ1 performed |
---|
| 3183 | for ifile=1:nbfield |
---|
| 3184 | for j=1:nbslice |
---|
| 3185 | filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',... |
---|
| 3186 | nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% |
---|
| 3187 | filecell.nc.civ1(ifile,j)={filename};% name of the civ1 file |
---|
| 3188 | if ~exist(filename,'file') |
---|
| 3189 | msgbox_uvmat('ERROR',['input file ' filename ' not found']) |
---|
[122] | 3190 | filecell={}; |
---|
[2] | 3191 | return |
---|
| 3192 | end |
---|
| 3193 | if ~testdiff % civ2 or patch2 are written in the same file as civ1 |
---|
| 3194 | if box_test(4)==0 ; %check the existence of civ2 if it is not calculated |
---|
| 3195 | Data=nc2struct(filename,'ListGlobalAttribute','civ2'); |
---|
| 3196 | if isempty(Data.civ2)||isequal(Data.civ2,0) |
---|
| 3197 | msgbox_uvmat('ERROR',['no civ2 data in ' filename]) |
---|
[12] | 3198 | filecell=[]; |
---|
[2] | 3199 | return |
---|
[112] | 3200 | end |
---|
[2] | 3201 | elseif box_test(3)==0; %check the existence of patch if it is not calculated |
---|
| 3202 | Data=nc2struct(filename,'ListGlobalAttribute','patch'); |
---|
| 3203 | if isempty(Data.patch)||isequal(Data.patch,0) |
---|
| 3204 | msgbox_uvmat('ERROR',['no patch data in ' filename]) |
---|
[12] | 3205 | filecell=[]; |
---|
[2] | 3206 | return |
---|
| 3207 | end |
---|
[112] | 3208 | end |
---|
[2] | 3209 | end |
---|
| 3210 | end |
---|
| 3211 | end |
---|
| 3212 | if strcmp(compare,'stereo PIV') |
---|
| 3213 | for ifile=1:nbfield |
---|
| 3214 | for j=1:nbslice |
---|
| 3215 | filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
| 3216 | nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% |
---|
| 3217 | filecell.ncA.civ2(ifile,j)={filename}; |
---|
| 3218 | if ~exist(filename,'file') |
---|
| 3219 | msgbox_uvmat('ERROR',['input file ' filename ' not found']) |
---|
| 3220 | set(handles.RUN, 'Enable','On') |
---|
| 3221 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
| 3222 | return |
---|
| 3223 | end |
---|
| 3224 | end |
---|
| 3225 | end |
---|
| 3226 | end |
---|
| 3227 | end |
---|
[112] | 3228 | |
---|
| 3229 | detect=1; |
---|
| 3230 | % while detect==1%creates a new subdir if the netcdf files already contain civ2 data |
---|
| 3231 | for ifile=1:nbfield |
---|
| 3232 | for j=1:nbslice |
---|
| 3233 | filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
[2] | 3234 | nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2); |
---|
[112] | 3235 | detect=exist(filename,'file')==2; |
---|
| 3236 | filecell.nc.civ2(ifile,j)={filename}; |
---|
[2] | 3237 | end |
---|
[112] | 3238 | end |
---|
[2] | 3239 | %get first image names for civ2 |
---|
| 3240 | if box_test(1)==1 & isequal(num1_civ1,num1_civ2) & isequal(num_a_civ1,num_a_civ2) |
---|
| 3241 | filecell.ima1.civ2=filecell.ima1.civ1; |
---|
| 3242 | elseif box_test(4)==1 |
---|
| 3243 | for ifile=1:nbfield |
---|
| 3244 | for j=1:nbslice |
---|
| 3245 | filename=name_generator(filebase_ima1, num1_civ2(ifile),num_a_civ2(j),ext_ima,nom_type_ima1); |
---|
| 3246 | idetect_2(j)=exist(filename,'file')==2; |
---|
| 3247 | filecell.ima1.civ2(ifile,j)={filename};%first image |
---|
| 3248 | end |
---|
[112] | 3249 | [idetectmin,indexj]=min(idetect_2); |
---|
[2] | 3250 | if idetectmin==0, |
---|
[112] | 3251 | msgbox_uvmat('ERROR',['input image ' filecell.ima1.civ2{ifile,indexj} ' not found']) |
---|
| 3252 | filecell=[]; |
---|
| 3253 | return |
---|
[2] | 3254 | end |
---|
| 3255 | end |
---|
| 3256 | end |
---|
| 3257 | |
---|
| 3258 | %get second image names for civ2 |
---|
| 3259 | if box_test(1)==1 & isequal(num2_civ1,num2_civ2) & isequal(num_b_civ1,num_b_civ2) |
---|
| 3260 | filecell.ima2.civ2=filecell.ima2.civ1; |
---|
| 3261 | elseif box_test(4)==1 |
---|
| 3262 | for ifile=1:nbfield |
---|
| 3263 | for j=1:nbslice |
---|
| 3264 | filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),ext_ima,nom_type_ima2); |
---|
| 3265 | idetect_3(j)=exist(filename,'file')==2; |
---|
| 3266 | filecell.ima2.civ2(ifile,j)={filename};%first image |
---|
| 3267 | end |
---|
[112] | 3268 | [idetectmin,indexj]=min(idetect_3); |
---|
[2] | 3269 | if idetectmin==0, |
---|
[112] | 3270 | msgbox_uvmat('ERROR',['input image ' filecell.ima2.civ2{ifile,indexj} ' not found']) |
---|
| 3271 | filecell=[]; |
---|
| 3272 | return |
---|
[2] | 3273 | end |
---|
| 3274 | end |
---|
| 3275 | end |
---|
| 3276 | end |
---|
| 3277 | if (box_test(5)==1 || box_test(6)==1 ) && box_test(4)==0 % need to read an existing netcdf civ2 file |
---|
| 3278 | if ~testdiff |
---|
| 3279 | filecell.nc.civ2=filecell.nc.civ1;% file already checked |
---|
[112] | 3280 | else % check the civ2 files |
---|
[2] | 3281 | for ifile=1:nbfield |
---|
| 3282 | for j=1:nbslice |
---|
| 3283 | filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
[112] | 3284 | nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% |
---|
[2] | 3285 | filecell.nc.civ2(ifile,j)={filename}; |
---|
| 3286 | if ~exist(filename,'file') |
---|
| 3287 | msgbox_uvmat('ERROR',['input file ' filename ' not found']) |
---|
[12] | 3288 | filecell=[]; |
---|
[2] | 3289 | return |
---|
| 3290 | else |
---|
| 3291 | Data=nc2struct(filename,'ListGlobalAttribute','civ2'); |
---|
[112] | 3292 | if isempty(Data.civ2)||isequal(Data.civ2,0) |
---|
[2] | 3293 | msgbox_uvmat('ERROR',['no civ2 data in ' filename]) |
---|
[12] | 3294 | filecell=[]; |
---|
[2] | 3295 | return |
---|
| 3296 | end |
---|
| 3297 | end |
---|
| 3298 | end |
---|
| 3299 | end |
---|
| 3300 | end |
---|
| 3301 | end |
---|
| 3302 | |
---|
| 3303 | %%%%%%%%%%%%% if stereo fields are calculated by PATCH %%%%%%%%%%%%% |
---|
| 3304 | if strcmp(compare,'stereo PIV') |
---|
[112] | 3305 | if box_test(3)==1 & isequal(get(handles.test_stereo1,'Value'),1) |
---|
[2] | 3306 | for ifile=1:nbfield |
---|
| 3307 | for j=1:nbslice |
---|
| 3308 | filename=name_generator(filebase_AB,num1_civ1(ifile),num_a_civ1(j),'.nc',... |
---|
| 3309 | nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% |
---|
| 3310 | filecell.st(ifile,j)={filename}; |
---|
| 3311 | end |
---|
| 3312 | end |
---|
| 3313 | end |
---|
[112] | 3314 | if box_test(6)==1 & isequal(get(handles.test_stereo2,'Value'),1) |
---|
[2] | 3315 | for ifile=1:nbfield |
---|
| 3316 | for j=1:nbslice |
---|
| 3317 | filename=name_generator(filebase_AB,num1_civ2(ifile),num_a_civ2(j),'.nc',... |
---|
| 3318 | nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% |
---|
| 3319 | filecell.st(ifile,j)={filename}; |
---|
| 3320 | end |
---|
| 3321 | end |
---|
[112] | 3322 | end |
---|
[2] | 3323 | end |
---|
| 3324 | set(handles.subdir_civ1,'String',subdir_civ1);%update the edit box |
---|
| 3325 | set(handles.subdir_civ2,'String',subdir_civ2);%update the edit box |
---|
| 3326 | browse.nom_type_nc=nom_type_nc; |
---|
| 3327 | set(handles.browse_root,'UserData',browse); %update the nomenclature type for uvmat |
---|
| 3328 | |
---|
| 3329 | |
---|
| 3330 | %COPY IMAGES TO THE FORMAT .png IF NEEDED |
---|
[45] | 3331 | if isequal(nom_type_ima1,'*')%case of movie files |
---|
| 3332 | nom_type_imanew1='_i'; |
---|
[2] | 3333 | else |
---|
| 3334 | nom_type_imanew1=nom_type_ima1; |
---|
| 3335 | end |
---|
[45] | 3336 | if isequal(nom_type_ima2,'*')%case of movie files |
---|
| 3337 | nom_type_imanew2='_i'; |
---|
[2] | 3338 | else |
---|
| 3339 | nom_type_imanew2=nom_type_ima2; |
---|
| 3340 | end |
---|
| 3341 | if ~isequal(ext_ima,'.png') |
---|
[45] | 3342 | %%type of image file |
---|
| 3343 | type_ima1='none';%default |
---|
| 3344 | movieobject1=[];%default |
---|
| 3345 | if isequal(lower(ext_ima),'.avi') |
---|
| 3346 | hhh=which('mmreader'); |
---|
| 3347 | if ~isequal(hhh,'')&& mmreader.isPlatformSupported()% if the mmreader function is found (recent version of matlab) |
---|
| 3348 | type_ima1='movie'; |
---|
| 3349 | movieobject1=mmreader([filebase_ima2 ext_ima]); |
---|
| 3350 | else |
---|
| 3351 | type_ima1='avi'; |
---|
| 3352 | end |
---|
[112] | 3353 | else |
---|
| 3354 | form=imformats(ext_ima(2:end)); |
---|
| 3355 | if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab |
---|
| 3356 | if isequal(nom_type_ima1,'*'); |
---|
| 3357 | type_ima1='multimage';%image series in a single image file |
---|
| 3358 | else |
---|
| 3359 | type_ima1='image'; |
---|
| 3360 | end |
---|
| 3361 | end |
---|
[45] | 3362 | end |
---|
| 3363 | type_ima2='none';%default |
---|
| 3364 | movieobject2=[]; |
---|
| 3365 | if isequal(lower(ext_ima),'.avi') |
---|
| 3366 | hhh=which('mmreader'); |
---|
| 3367 | if ~isequal(hhh,'')&& mmreader.isPlatformSupported()% if the mmreader function is found (recent version of matlab) |
---|
| 3368 | type_ima2='movie'; |
---|
| 3369 | movieobject2=mmreader([filebase_ima2 ext_ima]); |
---|
| 3370 | else |
---|
| 3371 | type_ima2='avi'; |
---|
| 3372 | end |
---|
[112] | 3373 | else |
---|
| 3374 | form=imformats(ext_ima(2:end)); |
---|
| 3375 | if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab |
---|
| 3376 | if isequal(nom_type_ima1,'*'); |
---|
| 3377 | type_ima2='multimage';%image series in a single image file |
---|
| 3378 | else |
---|
| 3379 | type_ima2='image'; |
---|
| 3380 | end |
---|
| 3381 | end |
---|
[45] | 3382 | end |
---|
[71] | 3383 | %npxy=get(handles.ImaExt,'UserData'); |
---|
[112] | 3384 | % % if numel(npxy)<2 |
---|
| 3385 | % |
---|
| 3386 | % filename=name_generator(filebase_ima1,num1_civ1(1),num_a_civ1(1),ImaExt,nom_type_ima1); |
---|
| 3387 | % A=imread(filename); |
---|
| 3388 | % npxy=size(A); |
---|
| 3389 | % % end |
---|
| 3390 | % npy=npxy(1); |
---|
| 3391 | % npx=npxy(2); |
---|
[2] | 3392 | if box_test(1)==1 %if civ1 is performed |
---|
[112] | 3393 | h = waitbar(0,['copy images to the .png format for civ1']);% display a wait bar |
---|
| 3394 | for ifile=1:nbfield |
---|
[2] | 3395 | waitbar(ifile/nbfield); |
---|
| 3396 | for j=1:nbslice |
---|
[112] | 3397 | filename=name_generator(filebase_ima1,num1_civ1(ifile),num_a_civ1(j),'.png',nom_type_imanew1); |
---|
| 3398 | if ~exist(filename,'file') |
---|
| 3399 | A=read_image(filecell.ima1.civ1{ifile,j},type_ima1,num1_civ1(ifile),movieobject1); |
---|
| 3400 | imwrite(A,filename,'BitDepth',16); |
---|
| 3401 | end |
---|
| 3402 | filecell.ima1.civ1(ifile,j)={filename}; |
---|
| 3403 | filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),'.png',nom_type_imanew2); |
---|
| 3404 | if ~exist(filename,'file') |
---|
| 3405 | A=read_image(filecell.ima2.civ1{ifile,j},type_ima2,num2_civ1(ifile),movieobject2); |
---|
| 3406 | imwrite(A,filename,'BitDepth',16); |
---|
| 3407 | end |
---|
| 3408 | filecell.ima2.civ1(ifile,j)={filename}; |
---|
[2] | 3409 | end |
---|
| 3410 | end |
---|
| 3411 | close(h) |
---|
| 3412 | end |
---|
| 3413 | if box_test(4)==1 %if civ2 is performed |
---|
[112] | 3414 | h = waitbar(0,['copy images to the .png format for civ2']);% display a wait bar |
---|
[2] | 3415 | for ifile=1:nbfield |
---|
| 3416 | waitbar(ifile/nbfield); |
---|
| 3417 | for j=1:nbslice |
---|
[112] | 3418 | filename=name_generator(filebase_ima1,num1_civ2(ifile),num_a_civ2(j),'.png',nom_type_imanew1); |
---|
| 3419 | if ~exist(filename,'file') |
---|
| 3420 | A=read_image(cell2mat(filecell.ima1.civ2(ifile,j)),type_ima2,num1_civ2(ifile)); |
---|
| 3421 | imwrite(A,filename,'BitDepth',16); |
---|
| 3422 | end |
---|
| 3423 | filecell.ima1.civ2(ifile,j)={filename}; |
---|
| 3424 | filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),'.png',nom_type_imanew2); |
---|
| 3425 | if ~exist(filename,'file') |
---|
| 3426 | A=read_image(cell2mat(filecell.ima2.civ2(ifile,j)),type_ima2,num2_civ2(ifile)); |
---|
| 3427 | imwrite(A,filename,'BitDepth',16); |
---|
| 3428 | end |
---|
| 3429 | filecell.ima2.civ2(ifile,j)={filename}; |
---|
[2] | 3430 | end |
---|
| 3431 | end |
---|
| 3432 | close(h); |
---|
| 3433 | end |
---|
| 3434 | end |
---|
| 3435 | |
---|
[12] | 3436 | %------------------------------------------------------------------------ |
---|
[73] | 3437 | %CIV1 CIV1 CIV1 CIV1 NOT USED: replaced by RUN_BATCH |
---|
[2] | 3438 | function RUN_CIV1(handles,filecell,filecell_1,filecell_nc1,num1,num2,num_a,num_b,nom_type_nc) |
---|
[12] | 3439 | %------------------------------------------------------------------------ |
---|
[2] | 3440 | %pixels per cm and matrix of the image times, read from the .civ file by uvmat |
---|
[67] | 3441 | global civ1Bin sge%name of the executable for civ1 calculation |
---|
[2] | 3442 | |
---|
| 3443 | %get civ parameters |
---|
| 3444 | ibx_val=str2num(get(handles.ibx,'String')); |
---|
| 3445 | if isempty(ibx_val) |
---|
| 3446 | ibx='21'; set(handles.ibx,'String','21') |
---|
[112] | 3447 | else |
---|
[2] | 3448 | ibx=num2str(ibx_val); |
---|
| 3449 | end |
---|
| 3450 | iby_val=str2num(get(handles.iby,'String')); |
---|
| 3451 | if isempty(iby_val) |
---|
| 3452 | iby='21'; set(handles.iby,'String','21') |
---|
[112] | 3453 | else |
---|
[2] | 3454 | iby=num2str(iby_val); |
---|
| 3455 | end |
---|
| 3456 | isx=get(handles.isx,'String'); |
---|
| 3457 | if isempty(str2num(isx)), isx='41'; set(handles.isx,'String','41'), end; %default |
---|
| 3458 | if str2num(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.isx,'String',num2str(ibx_val+8)); end |
---|
| 3459 | isy=get(handles.isy,'String'); |
---|
| 3460 | if isempty(str2num(isy)), isy='41'; set(handles.isy,'String','41'), end;%default |
---|
| 3461 | if str2num(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.isy,'String',num2str(iby_val+8)); end |
---|
| 3462 | shiftx=get(handles.shiftx,'String'); |
---|
| 3463 | if isempty(str2num(shiftx)), shiftx='0'; set(handles.shiftx,'String','0'), end;%default |
---|
| 3464 | shifty=get(handles.shifty,'String'); |
---|
| 3465 | if isempty(str2num(shifty)), shifty='0'; set(handles.shifty,'String','0'), end;%default |
---|
| 3466 | rho=get(handles.rho,'String'); |
---|
| 3467 | dx=get(handles.dx_civ1,'String'); |
---|
| 3468 | if isequal(str2num(dx),[]), dx='20'; set(handles.dx_civ1,'String','20'); end%default |
---|
| 3469 | dy=get(handles.dy_civ1,'String'); |
---|
| 3470 | if isequal(str2num(dy),[]), dy='20'; set(handles.dy_civ1,'String','20');end %default |
---|
| 3471 | if isequal(str2num(dy),[]), dy='20'; end%default |
---|
| 3472 | pxcmx='1'; %velocity fields are expressed in pixel displacement |
---|
| 3473 | pxcmy='1'; |
---|
| 3474 | image_first=cell2mat(filecell(1,1)); |
---|
| 3475 | if ~exist(image_first,'file') |
---|
| 3476 | msgbox_uvmat('ERROR',['image ' image_first 'not found']) |
---|
| 3477 | set(handles.RUN, 'Enable','On') |
---|
| 3478 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
| 3479 | return |
---|
| 3480 | end |
---|
| 3481 | A=imread(cell2mat(filecell(1,1)));%read the first image to get the size |
---|
| 3482 | sizim=size(A); |
---|
| 3483 | npx=num2str(sizim(2)); |
---|
| 3484 | npy=num2str(sizim(1)); |
---|
[71] | 3485 | time=get(handles.RootName,'UserData'); %get the set of times |
---|
[2] | 3486 | gridname='';%default ='noFile use default' |
---|
| 3487 | gridflag='n';%default |
---|
| 3488 | test_grid=get(handles.browse_gridciv1,'Value'); |
---|
| 3489 | nbslice_grid=[]; |
---|
| 3490 | if test_grid |
---|
| 3491 | gridname=get(handles.grid_civ1,'String'); |
---|
| 3492 | if numel(gridname)>4 && isequal(gridname(end-3:end),'grid') |
---|
| 3493 | nbslice_grid=str2num(gridname(1:end-4)); % |
---|
[112] | 3494 | if ~isempty(nbslice_grid) |
---|
| 3495 | gridflag='y'; |
---|
[2] | 3496 | end |
---|
| 3497 | elseif exist(gridname,'file') |
---|
| 3498 | gridflag='y'; |
---|
| 3499 | else |
---|
| 3500 | msgbox_uvmat('ERROR',['input grid file ' gridname ' not found']) |
---|
| 3501 | return |
---|
| 3502 | end |
---|
| 3503 | end |
---|
| 3504 | if isequal(get(handles.ImaThreshold,'Value'),1) |
---|
| 3505 | threshflag='y'; |
---|
| 3506 | min_ima=get(handles.MinIma,'String'); |
---|
| 3507 | max_ima=get(handles.MaxIma,'String'); |
---|
| 3508 | else |
---|
| 3509 | threshflag='n'; |
---|
| 3510 | min_ima='0'; |
---|
| 3511 | max_ima='4096'; |
---|
[112] | 3512 | end |
---|
| 3513 | %main loop |
---|
[71] | 3514 | filebase=get(handles.RootName,'String'); |
---|
[2] | 3515 | sizcell=size(filecell); |
---|
| 3516 | nbfield=sizcell(1); |
---|
| 3517 | nbslice=sizcell(2); |
---|
| 3518 | icount=0; |
---|
| 3519 | for ifile=1:nbfield |
---|
| 3520 | for j=1:nbslice |
---|
| 3521 | icount=icount+1; |
---|
| 3522 | barlength=0.188*icount/(nbfield*nbslice); |
---|
| 3523 | set(handles.waitbar_1,'Position',[0.946 0.877-barlength 0.03 barlength]) |
---|
| 3524 | drawnow |
---|
| 3525 | filename_ima=cell2mat(filecell(ifile,j)); |
---|
| 3526 | filename_ima([end-3:end])=[];%remove .png extension |
---|
| 3527 | filename_ima_1=cell2mat(filecell_1(ifile,j)); |
---|
| 3528 | filename_ima_1([end-3:end])=[];%remove .png extension |
---|
| 3529 | filename_cmx=cell2mat(filecell_nc1(ifile,j));%output netcdf file |
---|
| 3530 | filename_cmx([end-1:end])=[ 'cm'];%name of cmx file |
---|
| 3531 | filename_cmx=[filename_cmx 'x']; |
---|
[112] | 3532 | namelog=[filename_cmx([1:end-3]) 'log']; |
---|
[2] | 3533 | if size(time,1)>=num2(ifile) & size(time,2)>=num_b(j) |
---|
| 3534 | Dt=num2str(time(num2(ifile),num_b(j))-time(num1(ifile),num_a(j))); |
---|
| 3535 | if isequal(Dt,'0') |
---|
| 3536 | Dt='1' ;%case of 'displacement' mode |
---|
| 3537 | end |
---|
| 3538 | T0=num2str((time(num2(ifile),num_b(j))+time(num1(ifile),num_a(j)))/2); |
---|
| 3539 | else |
---|
| 3540 | Dt='1'; |
---|
| 3541 | T0='0'; |
---|
[112] | 3542 | end |
---|
[2] | 3543 | term_a=num2stra(num_a(j),nom_type_nc);%UTILITE? |
---|
| 3544 | term_b=num2stra(num_b(j),nom_type_nc);% |
---|
[112] | 3545 | if test_grid && ~isempty(nbslice_grid) |
---|
| 3546 | num1_grid=mod(num1(ifile)-1,nbslice_grid)+1; |
---|
[2] | 3547 | gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
| 3548 | if ~exist(gridname,'file') |
---|
| 3549 | msgbox_uvmat('ERROR',['missing grid file ' gridname]) |
---|
| 3550 | return |
---|
| 3551 | end |
---|
| 3552 | end |
---|
| 3553 | test_mask=get(handles.get_mask_civ1,'Value'); |
---|
| 3554 | if test_mask==0 |
---|
| 3555 | maskname='noFile use default'; |
---|
| 3556 | maskflag='n'; |
---|
| 3557 | else |
---|
| 3558 | maskdispl=get(handles.mask_civ1,'String');%look for mask name in edit box |
---|
[112] | 3559 | maskbase=[filebase '_' maskdispl];% |
---|
| 3560 | nbslice=str2num(maskdispl(1:end-4)); % |
---|
[2] | 3561 | num1_mask=mod(num1(ifile)-1,nbslice)+1; |
---|
| 3562 | maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
| 3563 | if exist(maskname,'file') |
---|
[112] | 3564 | maskflag='y'; |
---|
[2] | 3565 | else |
---|
| 3566 | maskname='noFile use default'; |
---|
[112] | 3567 | maskflag='n'; |
---|
[2] | 3568 | end |
---|
| 3569 | end |
---|
[112] | 3570 | textcmx={'############## CMX file';... |
---|
| 3571 | ['FirstImage ' filename_ima];... |
---|
| 3572 | ['LastImage ' filename_ima_1];... |
---|
| 3573 | 'XX' ;... |
---|
| 3574 | ['Mask ' maskflag] ;... |
---|
| 3575 | ['MaskName ' maskname];... |
---|
| 3576 | ['ImageSize ' npx ' ' npy];... %VERIFIER CAS GENERAL ? |
---|
| 3577 | ['CorrelationBoxesSize ' ibx ' ' iby];... |
---|
| 3578 | ['SearchBoxeSize ' isx ' ' isy];... |
---|
| 3579 | ['RO ' rho];... |
---|
| 3580 | ['GridSpacing ' dx ' ' dy];... |
---|
| 3581 | 'XX 1.0';... |
---|
| 3582 | ['Dt_TO ' Dt ' ' T0];... |
---|
| 3583 | ['PixCmXY ' pxcmx ' ' pxcmy];... |
---|
| 3584 | 'XX 1';... |
---|
| 3585 | ['ShiftXY ' shiftx ' ' shifty];... |
---|
| 3586 | ['Grid ' gridflag];... |
---|
| 3587 | ['GridName ' gridname] ;... |
---|
| 3588 | 'XX 85';... |
---|
| 3589 | 'XX 1.0';... |
---|
| 3590 | 'XX 1.0';... |
---|
| 3591 | 'Hart 1';... |
---|
| 3592 | 'DecimalShift 0';... |
---|
| 3593 | 'Deformation 0';... |
---|
| 3594 | 'CorrelationMin 0';... |
---|
| 3595 | 'IntensityMin 0';... |
---|
| 3596 | ['SeuilImage ' threshflag];... |
---|
| 3597 | ['SeuilImageValues ' min_ima ' ' max_ima];... |
---|
| 3598 | ['ImageToUse ' term_a ' ' term_b];... % VERIFIER ? |
---|
| 3599 | 'ImageUsedBefore null null'}; |
---|
| 3600 | textout=char(textcmx); |
---|
| 3601 | % dlmwrite(filename_cmx,textout,''); |
---|
| 3602 | fid=fopen([filename_cmx],'w'); |
---|
| 3603 | fprintf(fid, ['############## CMX file' '\n']); |
---|
| 3604 | fprintf(fid, ['FirstImage ' regexprep(filename_ima,'\\','\\\\') '\n' ]); |
---|
| 3605 | fprintf(fid, ['LastImage ' regexprep(filename_ima_1,'\\','\\\\') '\n' ]); |
---|
| 3606 | fprintf(fid, ['XX' '\n' ]); |
---|
| 3607 | fprintf(fid, ['Mask ' maskflag '\n' ]); |
---|
| 3608 | fprintf(fid, ['MaskName ' maskname '\n' ]); |
---|
| 3609 | fprintf(fid, ['ImageSize ' npx ' ' npy '\n' ]); %VERIFIER CAS GENERAL ? |
---|
| 3610 | fprintf(fid, ['CorrelationBoxesSize ' ibx ' ' iby '\n' ]); |
---|
| 3611 | fprintf(fid, ['SearchBoxeSize ' isx ' ' isy '\n' ]); |
---|
| 3612 | fprintf(fid, ['RO ' rho '\n' ]); |
---|
| 3613 | fprintf(fid, ['GridSpacing ' dx ' ' dy '\n' ]); |
---|
| 3614 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 3615 | fprintf(fid, ['Dt_TO ' Dt ' ' T0 '\n' ]); |
---|
| 3616 | fprintf(fid, ['PixCmXY ' pxcmx ' ' pxcmy '\n' ]); |
---|
| 3617 | fprintf(fid, ['XX 1' '\n' ]); |
---|
| 3618 | fprintf(fid, ['ShiftXY ' shiftx ' ' shifty '\n' ]); |
---|
| 3619 | fprintf(fid, ['Grid ' gridflag '\n' ]); |
---|
| 3620 | fprintf(fid, ['GridName ' gridname '\n' ]); |
---|
| 3621 | fprintf(fid, ['XX 85' '\n' ]); |
---|
| 3622 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 3623 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 3624 | fprintf(fid, ['Hart 1' '\n' ]); |
---|
| 3625 | fprintf(fid, [ 'DecimalShift 0' '\n' ]); |
---|
| 3626 | fprintf(fid, ['Deformation 0' '\n' ]); |
---|
| 3627 | fprintf(fid, ['CorrelationMin 0' '\n' ]); |
---|
| 3628 | fprintf(fid, ['IntensityMin 0' '\n' ]); |
---|
| 3629 | fprintf(fid, ['SeuilImage n' '\n' ]); |
---|
| 3630 | fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); |
---|
| 3631 | fprintf(fid, ['ImageToUse ' term_a ' ' term_b '\n' ]); % VERIFIER ? |
---|
| 3632 | fprintf(fid, ['ImageUsedBefore null null' '\n' ]); |
---|
| 3633 | fclose(fid); |
---|
| 3634 | |
---|
| 3635 | s=-1; |
---|
[67] | 3636 | display(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog ]) |
---|
| 3637 | eval(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog ]); |
---|
[112] | 3638 | % if sge%dispatch computation on the cluster using interactive queue |
---|
| 3639 | % % [s,w] = unix(['qrsh -q fast.q ' civ1Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1' ]); |
---|
| 3640 | % end |
---|
| 3641 | % if s~=0 |
---|
| 3642 | % % ['!' civ1Bin ' -f ' filename_cmx ' > ' namelog] |
---|
| 3643 | % % eval(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog]); |
---|
| 3644 | % end |
---|
[2] | 3645 | end |
---|
| 3646 | end |
---|
| 3647 | |
---|
[67] | 3648 | % %------------------------------------------------------------------------ |
---|
| 3649 | % % RUN CIV2 CIV2 CIV2 CIV2 |
---|
| 3650 | % function RUN_CIV2(handles,filecell_2,filecell_3,filecell_nc1,filecell_nc2,num1,num2,num_a,num_b,nom_type_nc) |
---|
| 3651 | % %------------------------------------------------------------------------ |
---|
| 3652 | % %filecell_2: names of first image |
---|
| 3653 | % %filecell_3: names of second images |
---|
| 3654 | % global civ2Bin sge |
---|
[112] | 3655 | % |
---|
[67] | 3656 | % %names of the civ2 fields |
---|
| 3657 | % field.vel_type='civ2'; |
---|
| 3658 | % field.nb='nb_vectors2'; |
---|
| 3659 | % field.X='vec2_X'; |
---|
| 3660 | % field.Y='vec2_Y'; |
---|
| 3661 | % field.U='vec2_U'; |
---|
| 3662 | % field.V='vec2_V'; |
---|
[112] | 3663 | % |
---|
[67] | 3664 | % %get civ parameters |
---|
| 3665 | % ibx=get(handles.ibx_civ2,'String'); |
---|
| 3666 | % iby=get(handles.iby_civ2,'String'); |
---|
| 3667 | % rho=get(handles.rho_civ2,'String'); |
---|
| 3668 | % decimal=int2str(get(handles.decimal,'Value')); |
---|
| 3669 | % deformation=int2str(get(handles.deformation,'Value')); |
---|
| 3670 | % dx=get(handles.dx_civ2,'String'); |
---|
| 3671 | % dy=get(handles.dy_civ2,'String'); |
---|
| 3672 | % if isequal(str2num(dx),[]) |
---|
| 3673 | % dx='20';%default |
---|
| 3674 | % end |
---|
| 3675 | % if isequal(str2num(dy),[]) |
---|
| 3676 | % dy='20';%default |
---|
| 3677 | % end |
---|
| 3678 | % pxcmx='1';%velocity fields are expressed in pixel displacement |
---|
| 3679 | % pxcmy='1'; |
---|
| 3680 | % A=imread(cell2mat(filecell_2(1,1)));%read the first image to get the size |
---|
| 3681 | % sizim=size(A); |
---|
| 3682 | % npx=num2str(sizim(2)); |
---|
| 3683 | % npy=num2str(sizim(1)); |
---|
[71] | 3684 | % time=get(handles.RootName,'UserData'); %get the set of times |
---|
| 3685 | % filebase=get(handles.RootName,'String'); |
---|
[67] | 3686 | % %grid |
---|
| 3687 | % gridname='';%default ='noFile use default' |
---|
| 3688 | % gridflag='n';%default |
---|
| 3689 | % test_grid=get(handles.browse_gridciv2,'Value'); |
---|
| 3690 | % nbslice_grid=[]; |
---|
| 3691 | % if test_grid |
---|
| 3692 | % gridname=get(handles.grid_civ2,'String'); |
---|
| 3693 | % if numel(gridname)>4 && isequal(gridname(end-3:end),'grid') |
---|
| 3694 | % nbslice_grid=str2num(gridname(1:end-4)); % |
---|
[112] | 3695 | % if ~isempty(nbslice_grid) |
---|
| 3696 | % gridflag='y'; |
---|
[67] | 3697 | % end |
---|
| 3698 | % elseif exist(gridname,'file') |
---|
| 3699 | % gridflag='y'; |
---|
| 3700 | % else |
---|
| 3701 | % msgbox_uvmat('ERROR',['input grid file ' gridname ' not found']) |
---|
| 3702 | % return |
---|
| 3703 | % end |
---|
| 3704 | % end |
---|
| 3705 | % sizcell=size(filecell_2); |
---|
| 3706 | % nbfield=sizcell(1); |
---|
| 3707 | % nbslice=sizcell(2); |
---|
[112] | 3708 | % |
---|
[67] | 3709 | % %main loop |
---|
| 3710 | % icount=0; |
---|
| 3711 | % for ifile=1:nbfield |
---|
| 3712 | % for j=1:nbslice |
---|
| 3713 | % icount=icount+1; |
---|
| 3714 | % barlength=0.188*icount/(nbfield*nbslice); |
---|
| 3715 | % set(handles.waitbar_civ2,'Position',[0.946 0.407-barlength 0.03 barlength]) |
---|
| 3716 | % drawnow |
---|
| 3717 | % filename_ima_2=cell2mat(filecell_2(ifile,j)); |
---|
| 3718 | % filename_ima_2([end-3:end])=[];%remove .png extension |
---|
| 3719 | % filename_ima_3=cell2mat(filecell_3(ifile,j)); |
---|
| 3720 | % filename_ima_3([end-3:end])=[];%remove .png extension |
---|
| 3721 | % filename_cmx=cell2mat(filecell_nc2(ifile,j));%output netcdf file |
---|
| 3722 | % filename_cmx([end-1:end])=[ 'cm'];%name of cmx file |
---|
| 3723 | % filename_cmx=[filename_cmx 'x']; |
---|
[112] | 3724 | % namelog=[filename_cmx([1:end-3]) 'log']; |
---|
[67] | 3725 | % if size(time,1)>=num2(ifile) & size(time,2)>=num_b(j) |
---|
| 3726 | % Dt=num2str(time(num2(ifile),num_b(j))-time(num1(ifile),num_a(j))); |
---|
| 3727 | % if isequal(Dt,'0') |
---|
| 3728 | % Dt='1' ;%case of 'displacement' mode |
---|
| 3729 | % end |
---|
| 3730 | % T0=num2str((time(num2(ifile),num_b(j))+time(num1(ifile),num_a(j)))/2); |
---|
| 3731 | % else |
---|
| 3732 | % Dt='1'; |
---|
| 3733 | % T0='0'; |
---|
[112] | 3734 | % end |
---|
[67] | 3735 | % term_a=num2stra(num_a(j),nom_type_nc); |
---|
| 3736 | % term_b=num2stra(num_b(j),nom_type_nc); |
---|
| 3737 | % filename_nc1=cell2mat(filecell_nc1(ifile,j)); |
---|
[112] | 3738 | % filename_nc1([end-2:end])=[]; % remove '.nc' |
---|
| 3739 | % if test_grid && ~isempty(nbslice_grid) |
---|
[67] | 3740 | % num1_grid=mod(num1(ifile)-1,nbslice_grid)+1; |
---|
| 3741 | % gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; |
---|
| 3742 | % if ~exist(gridname,'file') |
---|
| 3743 | % msgbox_uvmat('ERROR',['missing grid file ' gridname]) |
---|
| 3744 | % return |
---|
| 3745 | % end |
---|
[112] | 3746 | % end |
---|
[67] | 3747 | % test_mask=get(handles.get_mask_civ2,'Value'); |
---|
[112] | 3748 | % if test_mask==0 |
---|
[67] | 3749 | % maskname='noFile use default'; |
---|
| 3750 | % maskflag='n'; |
---|
| 3751 | % else |
---|
| 3752 | % maskdispl=get(handles.mask_civ2,'String'); |
---|
[112] | 3753 | % maskbase=[filebase '_' maskdispl]; % |
---|
| 3754 | % nbslice_mask=str2num(maskdispl(1:end-4)); % |
---|
[67] | 3755 | % num1_mask=mod(num1(ifile)-1,nbslice_mask)+1; |
---|
| 3756 | % maskname =name_generator(maskbase,num1_mask,1,'.png','_i'); |
---|
| 3757 | % if ~exist(maskname,'file') |
---|
[112] | 3758 | % maskflag='y'; |
---|
[67] | 3759 | % else |
---|
| 3760 | % maskname='noFile use default'; |
---|
[112] | 3761 | % maskflag='n'; |
---|
[67] | 3762 | % end |
---|
| 3763 | % end |
---|
[112] | 3764 | % |
---|
[67] | 3765 | % textcmx={'############## CMX file';... |
---|
| 3766 | % ['FirstImage ' filename_ima_2];... |
---|
| 3767 | % ['LastImage ' filename_ima_3];... |
---|
| 3768 | % 'XX' ;... |
---|
| 3769 | % ['Mask ' maskflag];... |
---|
| 3770 | % ['MaskName ' maskname];... |
---|
[112] | 3771 | % ['ImageSize ' npx ' ' npy];... |
---|
[67] | 3772 | % ['CorrelationBoxesSize ' ibx ' ' iby];... |
---|
| 3773 | % ['SearchBoxeSize ' ibx ' ' iby];... |
---|
| 3774 | % ['RO ' rho];... |
---|
| 3775 | % ['GridSpacing ' dx ' ' dy];... |
---|
| 3776 | % 'XX 1.0';... |
---|
| 3777 | % ['Dt_TO ' Dt ' ' T0];... |
---|
| 3778 | % ['PixCmXY ' pxcmx ' ' pxcmy];... |
---|
| 3779 | % 'XX 1';... |
---|
| 3780 | % ['ShiftXY 0 0'];... |
---|
| 3781 | % ['Grid ' gridflag];... |
---|
| 3782 | % ['GridName ' gridname];... |
---|
| 3783 | % 'XX 85';... |
---|
| 3784 | % 'XX 1.0';... |
---|
| 3785 | % 'XX 1.0';... |
---|
| 3786 | % 'Hart 1';... |
---|
| 3787 | % ['DecimalShift ' decimal];... |
---|
| 3788 | % ['Deformation ' deformation];... |
---|
| 3789 | % 'CorrelationMin 0';... |
---|
| 3790 | % 'IntensityMin 0';... |
---|
| 3791 | % 'SeuilImage n';... |
---|
| 3792 | % 'SeuilImageValues 0 4096';... |
---|
| 3793 | % ['ImageToUse ' term_a ' ' term_b];... % VERIFIER ? |
---|
| 3794 | % ['ImageUsedBefore ' filename_nc1]}; |
---|
| 3795 | % textout=char(textcmx); |
---|
[112] | 3796 | % dlmwrite(filename_cmx,textout,''); |
---|
| 3797 | % s=-1; |
---|
[67] | 3798 | % display(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog ]) |
---|
[112] | 3799 | % eval(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog ]); |
---|
| 3800 | % |
---|
[67] | 3801 | % % if sge%dispatch computation on the cluster using interactive queue |
---|
| 3802 | % % [s,w] = unix(['qrsh -q fast.q ' civ2Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1']); |
---|
[112] | 3803 | % % end |
---|
[67] | 3804 | % % if s~=0 |
---|
| 3805 | % % eval(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog]); |
---|
| 3806 | % % ['!' civ2Bin ' -f ' filename_cmx ' > ' namelog] |
---|
[112] | 3807 | % % end |
---|
[67] | 3808 | % end |
---|
| 3809 | % end |
---|
[112] | 3810 | % % close(h) |
---|
[2] | 3811 | |
---|
[12] | 3812 | %------------------------------------------------------------------------ |
---|
| 3813 | % --- PATCH |
---|
[94] | 3814 | function cmd_PATCH=PATCH_CMD(filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,test_interp,PatchBin) |
---|
[12] | 3815 | %------------------------------------------------------------------------ |
---|
[112] | 3816 | namelog=[filename_nc([1:end-3]) '_patch.log']; |
---|
| 3817 | if test_interp==0 |
---|
| 3818 | cmd_PATCH=[PatchBin ' -f ' filename_nc ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ... |
---|
| 3819 | ' > ' namelog ' 2>&1']; % redirect standard output to the log file |
---|
| 3820 | else %nouveau programme patch |
---|
| 3821 | cmd_PATCH=[PatchBin ' -f ' filename_nc ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ... |
---|
| 3822 | ' -max ' thresh_value ' -nopt ' subdomain_patch ' > ' namelog ' 2>&1']; % redirect standard output to the log file |
---|
| 3823 | end |
---|
[12] | 3824 | |
---|
| 3825 | %------------------------------------------------------------------------ |
---|
| 3826 | % --- STEREO Interp |
---|
[67] | 3827 | 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] | 3828 | %------------------------------------------------------------------------ |
---|
[2] | 3829 | namelog=[filename_nc([1:end-3]) '_stinterp.log']; |
---|
[67] | 3830 | cmd=[stinterpBin ' -f1 ' filename_A_nc ' -f2 ' filename_B_nc ' -f ' filename_nc ... |
---|
[2] | 3831 | ' -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 |
---|
| 3832 | |
---|
[12] | 3833 | %------------------------------------------------------------------------ |
---|
[2] | 3834 | % --- Executes on button press in CIV1. |
---|
| 3835 | function CIV1_Callback(hObject, eventdata, handles) |
---|
[12] | 3836 | %------------------------------------------------------------------------ |
---|
[2] | 3837 | val=get(handles.CIV1,'Value'); |
---|
| 3838 | if isequal(val,1) |
---|
| 3839 | enable_civ1(handles,'on') |
---|
| 3840 | enable_pair1(handles,'on') |
---|
| 3841 | else |
---|
| 3842 | enable_civ1(handles,'off') |
---|
| 3843 | end |
---|
| 3844 | find_netcpair_civ1(hObject, eventdata, handles); |
---|
| 3845 | |
---|
[12] | 3846 | %------------------------------------------------------------------------ |
---|
[2] | 3847 | % --- Executes on button press in FIX1. |
---|
| 3848 | function FIX1_Callback(hObject, eventdata, handles) |
---|
[12] | 3849 | %------------------------------------------------------------------------ |
---|
[2] | 3850 | enable_fix1(handles,get(handles.FIX1,'Value')) |
---|
| 3851 | |
---|
[12] | 3852 | %------------------------------------------------------------------------ |
---|
[2] | 3853 | % --- Executes on button press in PATCH1. |
---|
| 3854 | function PATCH1_Callback(hObject, eventdata, handles) |
---|
[12] | 3855 | %------------------------------------------------------------------------ |
---|
[2] | 3856 | if get(handles.PATCH1,'Value')==1 |
---|
[12] | 3857 | enable_patch1(handles) |
---|
[2] | 3858 | else |
---|
[12] | 3859 | desable_patch1(handles) |
---|
[2] | 3860 | end |
---|
| 3861 | |
---|
[12] | 3862 | %------------------------------------------------------------------------ |
---|
[2] | 3863 | % --- Executes on button press in CIV2. |
---|
| 3864 | function CIV2_Callback(hObject, eventdata, handles) |
---|
[12] | 3865 | %------------------------------------------------------------------------ |
---|
[2] | 3866 | state=get(handles.CIV2,'Value'); |
---|
| 3867 | enable_civ2(handles,state) |
---|
| 3868 | if state |
---|
| 3869 | find_netcpair_civ2(hObject, eventdata, handles) |
---|
| 3870 | enable_pair1(handles,'on') |
---|
| 3871 | end |
---|
| 3872 | |
---|
[12] | 3873 | %------------------------------------------------------------------------ |
---|
[2] | 3874 | % --- Executes on button press in FIX2. |
---|
| 3875 | function FIX2_Callback(hObject, eventdata, handles) |
---|
[12] | 3876 | %------------------------------------------------------------------------ |
---|
[2] | 3877 | if get(handles.FIX2,'Value')==1 |
---|
| 3878 | enable_fix2(handles) |
---|
| 3879 | if get(handles.CIV2,'Value')==0 |
---|
| 3880 | find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files |
---|
| 3881 | end |
---|
| 3882 | else |
---|
| 3883 | desable_fix2(handles) |
---|
| 3884 | end |
---|
| 3885 | |
---|
[12] | 3886 | %------------------------------------------------------------------------ |
---|
[2] | 3887 | % --- Executes on button press in PATCH2. |
---|
| 3888 | function PATCH2_Callback(hObject, eventdata, handles) |
---|
[12] | 3889 | %------------------------------------------------------------------------ |
---|
[2] | 3890 | if get(handles.PATCH2,'Value')==1 |
---|
| 3891 | enable_patch2(handles) |
---|
| 3892 | if get(handles.CIV2,'Value')==0 |
---|
| 3893 | find_netcpair_civ2(hObject, eventdata, handles) % select the available netcdf files |
---|
| 3894 | end |
---|
| 3895 | else |
---|
| 3896 | desable_patch2(handles) |
---|
| 3897 | end |
---|
| 3898 | |
---|
[12] | 3899 | %------------------------------------------------------------------------ |
---|
| 3900 | function first_i_Callback(hObject, eventdata, handles) |
---|
| 3901 | %------------------------------------------------------------------------ |
---|
| 3902 | % last_i_Callback(hObject, eventdata, handles) |
---|
| 3903 | first_i=str2num(get(handles.first_i,'String')); |
---|
| 3904 | % last_i=str2num(get(handles.last_i,'String')); |
---|
| 3905 | % ref_i=ceil((first_i+last_i)/2); |
---|
| 3906 | set(handles.ref_i,'String', num2str(first_i))% reference index for pair dt = first index |
---|
[71] | 3907 | set(handles.ref_i_civ2,'String', num2str(first_i))% reference index for pair dt = first index |
---|
[12] | 3908 | ref_i_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) |
---|
[2] | 3909 | |
---|
[12] | 3910 | %------------------------------------------------------------------------ |
---|
| 3911 | function first_j_Callback(hObject, eventdata, handles) |
---|
| 3912 | %------------------------------------------------------------------------ |
---|
| 3913 | first_j=str2num(get(handles.first_j,'String')); |
---|
| 3914 | set(handles.ref_j,'String', num2str(first_j))% reference index for pair dt = first index |
---|
| 3915 | ref_j_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) |
---|
[2] | 3916 | |
---|
[12] | 3917 | %------------------------------------------------------------------------ |
---|
[2] | 3918 | % --- Executes on button press in calcul_search: determine the search range isx,isy |
---|
| 3919 | function calcul_search_Callback(hObject, eventdata, handles) |
---|
[12] | 3920 | %------------------------------------------------------------------------ |
---|
[2] | 3921 | %determine pair numbers |
---|
| 3922 | list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs |
---|
| 3923 | index=get(handles.list_pair_civ1,'Value'); |
---|
| 3924 | displ_num=get(handles.list_pair_civ1,'UserData'); |
---|
[71] | 3925 | time=get(handles.RootName,'UserData'); %get the set of times |
---|
[2] | 3926 | pxcm_xy=get(handles.calcul_search,'UserData'); |
---|
| 3927 | pxcmx=pxcm_xy(1); |
---|
| 3928 | pxcmy=pxcm_xy(2); |
---|
| 3929 | mode_list=get(handles.mode,'String'); |
---|
| 3930 | mode_value=get(handles.mode,'Value'); |
---|
| 3931 | mode=mode_list{mode_value}; |
---|
| 3932 | if isequal (mode, 'series(Di)' ) |
---|
| 3933 | ref_i=str2num(get(handles.ref_i,'String')); |
---|
| 3934 | num1=ref_i-floor(index/2);% first image numbers |
---|
| 3935 | num2=ref_i+ceil(index/2); |
---|
| 3936 | num_a=1; |
---|
| 3937 | num_b=1; |
---|
[112] | 3938 | elseif isequal (mode, 'series(Dj)') |
---|
[2] | 3939 | num1=1; |
---|
| 3940 | num2=1; |
---|
| 3941 | ref_j=str2num(get(handles.ref_j,'String')); |
---|
| 3942 | num_a=ref_j-floor(index/2);% first image numbers |
---|
| 3943 | num_b=ref_j+ceil(index/2); |
---|
| 3944 | elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) |
---|
| 3945 | ref_i=str2num(get(handles.ref_i,'String')); |
---|
| 3946 | num1=ref_i; |
---|
| 3947 | num2=ref_i; |
---|
| 3948 | num_a=displ_num(1,index); |
---|
| 3949 | num_b=displ_num(2,index); |
---|
| 3950 | end |
---|
| 3951 | dt=time(num2,num_b)-time(num1,num_a); |
---|
| 3952 | ibx=str2num(get(handles.ibx,'String')); |
---|
| 3953 | iby=str2num(get(handles.iby,'String')); |
---|
| 3954 | umin=dt*pxcmx*str2num(get(handles.umin,'String')); |
---|
| 3955 | umax=dt*pxcmx*str2num(get(handles.umax,'String')); |
---|
| 3956 | vmin=dt*pxcmy*str2num(get(handles.vmin,'String')); |
---|
| 3957 | vmax=dt*pxcmy*str2num(get(handles.vmax,'String')); |
---|
| 3958 | shiftx=round((umin+umax)/2); |
---|
| 3959 | shifty=round((vmin+vmax)/2); |
---|
| 3960 | isx=(umax+2-shiftx)*2+ibx; |
---|
| 3961 | isx=2*ceil(isx/2)+1; |
---|
| 3962 | isy=(vmax+2-shifty)*2+iby; |
---|
| 3963 | isy=2*ceil(isy/2)+1; |
---|
| 3964 | set(handles.shiftx,'String',num2str(shiftx)); |
---|
| 3965 | set(handles.shifty,'String',num2str(shifty)); |
---|
| 3966 | set(handles.isx,'String',num2str(isx)); |
---|
| 3967 | set(handles.isy,'String',num2str(isy)); |
---|
| 3968 | |
---|
[12] | 3969 | %------------------------------------------------------------------------ |
---|
| 3970 | % --- Executes on carriage return on the subdir civ1 edit window |
---|
[2] | 3971 | function subdir_civ1_Callback(hObject, eventdata, handles) |
---|
[12] | 3972 | %------------------------------------------------------------------------ |
---|
[2] | 3973 | subdir=get(handles.subdir_civ1,'String'); |
---|
| 3974 | set(handles.subdir_civ2,'String',subdir); |
---|
[112] | 3975 | if get(handles.CIV1,'Value')==0 |
---|
[2] | 3976 | find_netcpair_civ1(hObject, eventdata, handles); %update the list of available pairs from netcdf files in the new directory |
---|
| 3977 | end |
---|
| 3978 | |
---|
[12] | 3979 | %------------------------------------------------------------------------ |
---|
| 3980 | % --- Executes on carriage return on the subdir civ1 edit window |
---|
[2] | 3981 | function subdir_civ2_Callback(hObject, eventdata, handles) |
---|
[12] | 3982 | %------------------------------------------------------------------------ |
---|
[2] | 3983 | %update the list of available pairs from netcdf files in the new directory |
---|
| 3984 | if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0 |
---|
| 3985 | find_netcpair_civ2(hObject, eventdata, handles); |
---|
| 3986 | end |
---|
| 3987 | |
---|
[12] | 3988 | %------------------------------------------------------------------------ |
---|
[2] | 3989 | % --- Executes on button press in get_mask_civ1. |
---|
| 3990 | function get_mask_civ1_Callback(hObject, eventdata, handles) |
---|
[12] | 3991 | %------------------------------------------------------------------------ |
---|
[2] | 3992 | maskval=get(handles.get_mask_civ1,'Value'); |
---|
| 3993 | if isequal(maskval,0) |
---|
| 3994 | set(handles.mask_civ1,'String','') |
---|
| 3995 | else |
---|
| 3996 | mask_displ='no mask'; %default |
---|
[71] | 3997 | filebase=get(handles.RootName,'String'); |
---|
[2] | 3998 | [ nbslice_mask, flag_mask]=get_mask(filebase,handles); |
---|
| 3999 | if isequal(flag_mask,1) |
---|
[112] | 4000 | mask_displ=[num2str(nbslice_mask) 'mask']; |
---|
[2] | 4001 | elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
[112] | 4002 | common_path=fileparts(filebase); |
---|
| 4003 | filebase_a=fullfile(common_path,get(handles.RootName_1,'String')); |
---|
| 4004 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
| 4005 | if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice_mask) |
---|
| 4006 | mask_displ='no mask'; |
---|
| 4007 | end |
---|
[2] | 4008 | end |
---|
| 4009 | if isequal(mask_displ,'no mask') |
---|
[12] | 4010 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 4011 | {'*.png', ' (*.png)'; |
---|
| 4012 | '*.png', '.png files '; ... |
---|
| 4013 | '*.*', 'All Files (*.*)'}, ... |
---|
| 4014 | 'Pick a mask file *.png',filebase); |
---|
| 4015 | mask_displ=fullfile(PathName,FileName); |
---|
[12] | 4016 | if ~exist(mask_displ,'file') |
---|
| 4017 | mask_displ='no mask'; |
---|
| 4018 | end |
---|
| 4019 | end |
---|
| 4020 | if isequal(mask_displ,'no mask') |
---|
[2] | 4021 | set(handles.get_mask_civ1,'Value',0) |
---|
| 4022 | set(handles.get_mask_fix1,'Value',0) |
---|
| 4023 | set(handles.get_mask_civ2,'Value',0) |
---|
| 4024 | set(handles.get_mask_fix2,'Value',0) |
---|
| 4025 | else |
---|
| 4026 | set(handles.get_mask_fix1,'Value',1) |
---|
| 4027 | set(handles.get_mask_fix2,'Value',1) |
---|
| 4028 | end |
---|
| 4029 | set(handles.mask_civ1,'String',mask_displ) |
---|
| 4030 | set(handles.mask_fix1,'String',mask_displ) |
---|
| 4031 | set(handles.mask_civ2,'String',mask_displ) |
---|
| 4032 | set(handles.mask_fix2,'String',mask_displ) |
---|
| 4033 | end |
---|
[82] | 4034 | set(handles.mask_civ2,'Value',maskval) |
---|
[2] | 4035 | |
---|
[12] | 4036 | %------------------------------------------------------------------------ |
---|
[2] | 4037 | % --- Executes on button press in get_mask_fix1. |
---|
| 4038 | function get_mask_fix1_Callback(hObject, eventdata, handles) |
---|
[12] | 4039 | %------------------------------------------------------------------------ |
---|
[2] | 4040 | maskval=get(handles.get_mask_fix1,'Value'); |
---|
| 4041 | if isequal(maskval,0) |
---|
| 4042 | set(handles.mask_fix1,'String','') |
---|
| 4043 | else |
---|
[112] | 4044 | mask_displ='no mask'; %default |
---|
| 4045 | filebase=get(handles.RootName,'String'); |
---|
| 4046 | [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
| 4047 | if isequal(flag_mask,1) |
---|
| 4048 | mask_displ=[num2str(nbslice) 'mask']; |
---|
| 4049 | elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
[71] | 4050 | filebase_a=get(handles.RootName_1,'String'); |
---|
[2] | 4051 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
| 4052 | if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice) |
---|
| 4053 | mask_displ='no mask'; |
---|
| 4054 | end |
---|
[112] | 4055 | end |
---|
| 4056 | if isequal(mask_displ,'no mask') |
---|
| 4057 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 4058 | {'*.png', ' (*.png)'; |
---|
[12] | 4059 | '*.png', '.png files '; ... |
---|
| 4060 | '*.*', 'All Files (*.*)'}, ... |
---|
| 4061 | 'Pick a mask file *.png',filebase); |
---|
[112] | 4062 | mask_displ=fullfile(PathName,FileName); |
---|
| 4063 | if ~exist(mask_displ,'file') |
---|
| 4064 | mask_displ='no mask'; |
---|
| 4065 | end |
---|
[12] | 4066 | end |
---|
[112] | 4067 | if isequal(mask_displ,'no mask') |
---|
| 4068 | set(handles.get_mask_fix1,'Value',0) |
---|
| 4069 | set(handles.get_mask_civ2,'Value',0) |
---|
| 4070 | set(handles.get_mask_fix2,'Value',0) |
---|
| 4071 | else |
---|
| 4072 | %set(handles.get_mask_civ2,'Value',1) |
---|
| 4073 | set(handles.get_mask_fix2,'Value',1) |
---|
| 4074 | end |
---|
| 4075 | set(handles.mask_fix1,'String',mask_displ) |
---|
| 4076 | set(handles.mask_civ2,'String',mask_displ) |
---|
| 4077 | set(handles.mask_fix2,'String',mask_displ) |
---|
[12] | 4078 | end |
---|
| 4079 | |
---|
| 4080 | %------------------------------------------------------------------------ |
---|
[2] | 4081 | % --- Executes on button press in get_mask_civ2. |
---|
| 4082 | function get_mask_civ2_Callback(hObject, eventdata, handles) |
---|
[12] | 4083 | %------------------------------------------------------------------------ |
---|
[2] | 4084 | maskval=get(handles.get_mask_civ2,'Value'); |
---|
| 4085 | if isequal(maskval,0) |
---|
| 4086 | set(handles.mask_civ2,'String','') |
---|
| 4087 | else |
---|
[112] | 4088 | mask_displ='no mask'; %default |
---|
| 4089 | filebase=get(handles.RootName,'String'); |
---|
| 4090 | [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
| 4091 | if isequal(flag_mask,1) |
---|
| 4092 | mask_displ=[num2str(nbslice) 'mask']; |
---|
| 4093 | elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
[71] | 4094 | filebase_a=get(handles.RootName_1,'String'); |
---|
[2] | 4095 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
| 4096 | if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice) |
---|
| 4097 | mask_displ='no mask'; |
---|
| 4098 | end |
---|
[112] | 4099 | end |
---|
| 4100 | if isequal(mask_displ,'no mask') |
---|
| 4101 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 4102 | {'*.png', ' (*.png)'; |
---|
[12] | 4103 | '*.png', '.png files '; ... |
---|
| 4104 | '*.*', 'All Files (*.*)'}, ... |
---|
| 4105 | 'Pick a mask file *.png',filebase); |
---|
[112] | 4106 | mask_displ=fullfile(PathName,FileName); |
---|
| 4107 | if ~exist(mask_displ,'file') |
---|
| 4108 | mask_displ='no mask'; |
---|
| 4109 | end |
---|
[12] | 4110 | end |
---|
[112] | 4111 | if isequal(mask_displ,'no mask') |
---|
| 4112 | set(handles.get_mask_civ2,'Value',0) |
---|
| 4113 | set(handles.get_mask_fix2,'Value',0) |
---|
| 4114 | else |
---|
| 4115 | set(handles.get_mask_fix2,'Value',1) |
---|
| 4116 | end |
---|
| 4117 | set(handles.mask_civ2,'String',mask_displ) |
---|
| 4118 | set(handles.mask_fix2,'String',mask_displ) |
---|
[12] | 4119 | end |
---|
| 4120 | |
---|
| 4121 | %------------------------------------------------------------------------ |
---|
[2] | 4122 | % --- Executes on button press in get_mask_fix2. |
---|
| 4123 | function get_mask_fix2_Callback(hObject, eventdata, handles) |
---|
[12] | 4124 | %------------------------------------------------------------------------ |
---|
[2] | 4125 | maskval=get(handles.get_mask_fix2,'Value'); |
---|
| 4126 | if isequal(maskval,0) |
---|
| 4127 | set(handles.mask_fix2,'String','') |
---|
| 4128 | else |
---|
[12] | 4129 | mask_displ='no mask'; %default |
---|
[71] | 4130 | filebase=get(handles.RootName,'String'); |
---|
[12] | 4131 | [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
| 4132 | if isequal(flag_mask,1) |
---|
[112] | 4133 | mask_displ=[num2str(nbslice) 'mask']; |
---|
[12] | 4134 | elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
[112] | 4135 | filebase_a=get(handles.RootName_1,'String'); |
---|
| 4136 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
| 4137 | if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice) |
---|
| 4138 | mask_displ='no mask'; |
---|
| 4139 | end |
---|
[12] | 4140 | end |
---|
| 4141 | if isequal(mask_displ,'no mask') |
---|
| 4142 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 4143 | {'*.png', ' (*.png)'; |
---|
| 4144 | '*.png', '.png files '; ... |
---|
| 4145 | '*.*', 'All Files (*.*)'}, ... |
---|
| 4146 | 'Pick a mask file *.png',filebase); |
---|
| 4147 | mask_displ=fullfile(PathName,FileName); |
---|
[12] | 4148 | if ~exist(mask_displ,'file') |
---|
[2] | 4149 | mask_displ='no mask'; |
---|
| 4150 | end |
---|
[12] | 4151 | end |
---|
| 4152 | if isequal(mask_displ,'no mask') |
---|
| 4153 | set(handles.get_mask_fix2,'Value',0) |
---|
[112] | 4154 | end |
---|
[12] | 4155 | set(handles.mask_fix2,'String',mask_displ) |
---|
[2] | 4156 | end |
---|
| 4157 | |
---|
[12] | 4158 | %------------------------------------------------------------------------ |
---|
| 4159 | % --- function called to look for mask files |
---|
[2] | 4160 | function [nbslice, flag_mask]=get_mask(filebase,handles) |
---|
[12] | 4161 | %------------------------------------------------------------------------ |
---|
[112] | 4162 | %detect mask files, images with appropriate file base |
---|
[2] | 4163 | %[filebase '_' xx 'mask'], xx=nbslice |
---|
| 4164 | %flag_mask=1 indicates detection |
---|
| 4165 | |
---|
| 4166 | flag_mask=0;%default |
---|
| 4167 | nbslice=1; |
---|
| 4168 | |
---|
| 4169 | % subdir=get(handles.subdir_civ1,'String'); |
---|
| 4170 | [Path,Name]=fileparts(filebase); |
---|
[12] | 4171 | if ~isdir(Path) |
---|
| 4172 | msgbox_uvmat('ERROR','no path for input files') |
---|
| 4173 | return |
---|
| 4174 | end |
---|
[2] | 4175 | currentdir=pwd; |
---|
| 4176 | cd(Path);%move in the dir of the root name filebase |
---|
| 4177 | maskfiles=dir([Name '_*mask_*.png']);%look for mask files |
---|
| 4178 | cd(currentdir);%come back to the current working directory |
---|
[12] | 4179 | if ~isempty(maskfiles) |
---|
[112] | 4180 | % msgbox_uvmat('ERROR','no mask available, to create it use Tools/Make mask in the upper menu bar of uvmat') |
---|
| 4181 | % else |
---|
[2] | 4182 | flag_mask=1; |
---|
| 4183 | maskname=maskfiles(1).name;% take the first mask file in the list |
---|
| 4184 | [Path2,Name,ext]=fileparts(maskname); |
---|
| 4185 | Namedouble=double(Name); |
---|
| 4186 | val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters |
---|
| 4187 | ind_mask=findstr('mask',Name); |
---|
| 4188 | i=ind_mask-1; |
---|
| 4189 | while val(i)==0 & i>0 |
---|
[112] | 4190 | i=i-1; |
---|
[2] | 4191 | end |
---|
| 4192 | nbslice=str2num(Name(i+1:ind_mask-1)); |
---|
| 4193 | if ~isequal(nbslice,[]) & Name(i)=='_' |
---|
[112] | 4194 | flag_mask=1; |
---|
[2] | 4195 | else |
---|
[112] | 4196 | msgbox_uvmat('ERROR',['bad mask file ' Name ext ' found in ' Path2]) |
---|
| 4197 | return |
---|
| 4198 | nbslice=1; |
---|
[2] | 4199 | end |
---|
[112] | 4200 | end |
---|
[2] | 4201 | |
---|
[12] | 4202 | %------------------------------------------------------------------------ |
---|
| 4203 | % --- function called to look for grid files |
---|
[2] | 4204 | function [nbslice, flag_mask]=get_grid(filebase,handles) |
---|
[12] | 4205 | %------------------------------------------------------------------------ |
---|
[2] | 4206 | flag_mask=0;%default |
---|
| 4207 | nbslice=1; |
---|
| 4208 | [Path,Name]=fileparts(filebase); |
---|
| 4209 | currentdir=pwd; |
---|
| 4210 | cd(Path);%move in the dir of the root name filebase |
---|
| 4211 | maskfiles=dir([Name '_*grid_*.grid']);%look for mask files |
---|
| 4212 | cd(currentdir);%come back to the current working directory |
---|
| 4213 | if ~isempty(maskfiles) |
---|
| 4214 | flag_mask=1; |
---|
| 4215 | maskname=maskfiles(1).name;% take the first mask file in the list |
---|
| 4216 | [Path2,Name,ext]=fileparts(maskname); |
---|
| 4217 | Namedouble=double(Name); |
---|
| 4218 | val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters |
---|
| 4219 | ind_mask=findstr('grid',Name); |
---|
| 4220 | i=ind_mask-1; |
---|
| 4221 | while val(i)==0 & i>0 |
---|
[112] | 4222 | i=i-1; |
---|
[2] | 4223 | end |
---|
| 4224 | nbslice=str2num(Name(i+1:ind_mask-1)); |
---|
| 4225 | if ~isequal(nbslice,[]) & Name(i)=='_' |
---|
[112] | 4226 | flag_mask=1; |
---|
[2] | 4227 | else |
---|
[112] | 4228 | msgbox_uvmat('ERROR',['bad grid file ' Name ext ' found in ' Path2]) |
---|
| 4229 | return |
---|
| 4230 | nbslice=1; |
---|
[2] | 4231 | end |
---|
[12] | 4232 | end |
---|
[2] | 4233 | |
---|
[12] | 4234 | %------------------------------------------------------------------------ |
---|
| 4235 | % --- transform numbers to letters |
---|
[122] | 4236 | function str=num2stra(num,nom_type) |
---|
[12] | 4237 | %------------------------------------------------------------------------ |
---|
[122] | 4238 | if isempty(nom_type) |
---|
| 4239 | str=''; |
---|
| 4240 | elseif strcmp(nom_type(end),'a') |
---|
[2] | 4241 | str=char(96+num); |
---|
[122] | 4242 | elseif strcmp(nom_type(end),'A') |
---|
| 4243 | str=char(96+num); |
---|
| 4244 | elseif isempty(nom_type(2:end))%a single index |
---|
[2] | 4245 | str=''; |
---|
| 4246 | else |
---|
| 4247 | str=num2str(num); |
---|
| 4248 | end |
---|
[12] | 4249 | |
---|
| 4250 | %------------------------------------------------------------------------ |
---|
[2] | 4251 | function mask_civ1_Callback(hObject, eventdata, handles) |
---|
[12] | 4252 | %------------------------------------------------------------------------ |
---|
[2] | 4253 | set(handles.mask_civ1,'UserData',[]) |
---|
| 4254 | set(handles.mask_civ1,'String','') |
---|
[12] | 4255 | |
---|
| 4256 | %------------------------------------------------------------------------ |
---|
[2] | 4257 | function mask_civ2_Callback(hObject, eventdata, handles) |
---|
[12] | 4258 | %------------------------------------------------------------------------ |
---|
[2] | 4259 | set(handles.mask_civ2,'UserData',[]) |
---|
| 4260 | set(handles.mask_civ2,'String','') |
---|
[12] | 4261 | |
---|
| 4262 | %------------------------------------------------------------------------ |
---|
[2] | 4263 | function mask_fix1_Callback(hObject, eventdata, handles) |
---|
[12] | 4264 | %------------------------------------------------------------------------ |
---|
[2] | 4265 | set(handles.mask_fix1,'UserData',[]) |
---|
| 4266 | set(handles.mask_fix1,'String','') |
---|
[12] | 4267 | |
---|
| 4268 | %------------------------------------------------------------------------ |
---|
[2] | 4269 | function mask_fix2_Callback(hObject, eventdata, handles) |
---|
[12] | 4270 | %------------------------------------------------------------------------ |
---|
[2] | 4271 | set(handles.mask_fix2,'UserData',[]) |
---|
| 4272 | set(handles.mask_fix2,'String','') |
---|
| 4273 | |
---|
[12] | 4274 | %------------------------------------------------------------------------ |
---|
[2] | 4275 | % --- Executes on button press in list_subdir_civ1. |
---|
| 4276 | function list_subdir_civ1_Callback(hObject, eventdata, handles) |
---|
[12] | 4277 | %------------------------------------------------------------------------ |
---|
[2] | 4278 | list_subdir_civ1=get(handles.list_subdir_civ1,'String'); |
---|
| 4279 | val=get(handles.list_subdir_civ1,'Value'); |
---|
| 4280 | if val>1 |
---|
| 4281 | subdir=list_subdir_civ1{val}; |
---|
| 4282 | set(handles.subdir_civ1,'String',subdir); |
---|
| 4283 | set(handles.list_subdir_civ1,'Value',1); |
---|
| 4284 | end |
---|
| 4285 | |
---|
[12] | 4286 | %------------------------------------------------------------------------ |
---|
[2] | 4287 | % --- Executes on button press in list_subdir_civ2. |
---|
| 4288 | function list_subdir_civ2_Callback(hObject, eventdata, handles) |
---|
[12] | 4289 | %------------------------------------------------------------------------ |
---|
[2] | 4290 | list_subdir_civ2=get(handles.list_subdir_civ2,'String'); |
---|
| 4291 | val=get(handles.list_subdir_civ2,'Value'); |
---|
| 4292 | if val>1 |
---|
| 4293 | subdir=list_subdir_civ2{val}; |
---|
| 4294 | set(handles.subdir_civ2,'String',subdir); |
---|
| 4295 | set(handles.list_subdir_civ2,'Value',1); |
---|
| 4296 | end |
---|
| 4297 | |
---|
[12] | 4298 | %------------------------------------------------------------------------ |
---|
[2] | 4299 | % --- Executes on button press in browse_gridciv1. |
---|
| 4300 | function browse_gridciv1_Callback(hObject, eventdata, handles) |
---|
[12] | 4301 | %------------------------------------------------------------------------ |
---|
[2] | 4302 | value=get(handles.browse_gridciv1,'Value'); |
---|
| 4303 | testgrid=0; |
---|
| 4304 | if value |
---|
[112] | 4305 | filebase=get(handles.RootName,'String'); |
---|
[39] | 4306 | [nbslice, flag_grid]=get_grid(filebase,handles); |
---|
[2] | 4307 | if isequal(flag_grid,1) |
---|
[112] | 4308 | filegrid=[num2str(nbslice) 'grid']; |
---|
| 4309 | testgrid=1; |
---|
| 4310 | else |
---|
[2] | 4311 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 4312 | {'*.grid', ' (*.grid)'; |
---|
| 4313 | '*.grid', '.grid files '; ... |
---|
| 4314 | '*.*', 'All Files (*.*)'}, ... |
---|
| 4315 | 'Pick a file',filebase); |
---|
[2] | 4316 | filegrid=fullfile(PathName,FileName); |
---|
| 4317 | if ~(isempty(FileName)||isempty(PathName)||isequal(FileName,0)||~exist(filegrid,'file')) |
---|
| 4318 | testgrid=1; |
---|
| 4319 | end |
---|
[112] | 4320 | end |
---|
[2] | 4321 | end |
---|
| 4322 | if testgrid |
---|
[112] | 4323 | set(handles.browse_gridciv2,'Value',1) |
---|
| 4324 | set(handles.get_gridpatch1,'Value',1) |
---|
| 4325 | set(handles.get_gridpatch2,'Value',1) |
---|
| 4326 | set(handles.dx_civ1,'Visible','off'); |
---|
| 4327 | set(handles.dy_civ1,'Visible','off'); |
---|
| 4328 | set(handles.dx_civ2,'Visible','off'); |
---|
| 4329 | set(handles.dy_civ2,'Visible','off'); |
---|
| 4330 | set(handles.grid_civ1,'String',filegrid) |
---|
| 4331 | set(handles.grid_patch1,'String',filegrid) |
---|
| 4332 | set(handles.grid_civ2,'String',filegrid) |
---|
| 4333 | set(handles.grid_patch2,'String',filegrid) |
---|
| 4334 | else |
---|
| 4335 | set(handles.browse_gridciv1,'Value',0); |
---|
| 4336 | set(handles.browse_gridciv2,'Value',0); |
---|
| 4337 | set(handles.get_gridpatch1,'Value',0) |
---|
| 4338 | set(handles.get_gridpatch2,'Value',0) |
---|
| 4339 | set(handles.dx_civ1,'Visible','on'); |
---|
| 4340 | set(handles.dy_civ1,'Visible','on'); |
---|
| 4341 | set(handles.dx_civ2,'Visible','on'); |
---|
| 4342 | set(handles.dy_civ2,'Visible','on'); |
---|
| 4343 | set(handles.grid_civ1,'String','') |
---|
| 4344 | set(handles.grid_patch1,'String','') |
---|
| 4345 | set(handles.grid_civ2,'String','') |
---|
| 4346 | set(handles.grid_patch2,'String','') |
---|
[2] | 4347 | end |
---|
| 4348 | |
---|
[12] | 4349 | %------------------------------------------------------------------------ |
---|
[2] | 4350 | % --- Executes on button press in browse_gridciv1. |
---|
| 4351 | function browse_gridciv2_Callback(hObject, eventdata, handles) |
---|
[12] | 4352 | %------------------------------------------------------------------------ |
---|
[2] | 4353 | value=get(handles.browse_gridciv2,'Value'); |
---|
| 4354 | if value |
---|
[112] | 4355 | filebase=get(handles.RootName,'String'); |
---|
[39] | 4356 | [nbslice, flag_grid]=get_grid(filebase,handles); |
---|
[2] | 4357 | if isequal(flag_grid,1) |
---|
| 4358 | mask_displ=[num2str(nbslice) 'grid']; |
---|
| 4359 | set(handles.grid_civ2,'String',mask_displ) |
---|
| 4360 | set(handles.dx_civ2,'Visible','off'); |
---|
| 4361 | set(handles.dy_civ2,'Visible','off'); |
---|
[112] | 4362 | else |
---|
[2] | 4363 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 4364 | {'*.grid', ' (*.grid)'; |
---|
| 4365 | '*.grid', '.grid files '; ... |
---|
| 4366 | '*.*', 'All Files (*.*)'}, ... |
---|
| 4367 | 'Pick a file',filebase); |
---|
[2] | 4368 | filegrid=fullfile(PathName,FileName); |
---|
| 4369 | if isempty(FileName)|isempty(PathName)|isequal(FileName,0)|~exist(filegrid,'file') |
---|
| 4370 | set(handles.browse_gridciv2,'Value',0); |
---|
| 4371 | set(handles.grid_civ2,'string',''); |
---|
| 4372 | set(handles.dx_civ2,'Visible','on'); |
---|
| 4373 | set(handles.dy_civ2,'Visible','on'); |
---|
| 4374 | set(handles.grid_civ2,'string',''); |
---|
| 4375 | else |
---|
| 4376 | set(handles.grid_civ2,'string',filegrid); |
---|
| 4377 | set(handles.dx_civ2,'Visible','off'); |
---|
| 4378 | set(handles.dy_civ2,'Visible','off'); |
---|
| 4379 | set(handles.grid_civ2,'string',filegrid); |
---|
| 4380 | end |
---|
| 4381 | end |
---|
| 4382 | else |
---|
| 4383 | set(handles.grid_civ2,'string',''); |
---|
[112] | 4384 | set(handles.dx_civ2,'Visible','on'); |
---|
| 4385 | set(handles.dy_civ2,'Visible','on'); |
---|
| 4386 | set(handles.grid_civ2,'string',''); |
---|
[2] | 4387 | end |
---|
| 4388 | |
---|
| 4389 | % % --- Executes on button press in browse_gridciv2. |
---|
| 4390 | % function browse_gridciv2_Callback(hObject, eventdata, handles) |
---|
[112] | 4391 | % |
---|
[71] | 4392 | % filebase=get(handles.RootName,'String'); |
---|
[2] | 4393 | % [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 4394 | % {'*.grid', ' (*.grid)'; |
---|
| 4395 | % '*.grid', '.grid files '; ... |
---|
| 4396 | % '*.*', 'All Files (*.*)'}, ... |
---|
| 4397 | % 'Pick a file',filebase); |
---|
| 4398 | % filegrid=fullfile(PathName,FileName); |
---|
| 4399 | % set(handles.grid_civ2,'string',filegrid); |
---|
| 4400 | % set(handles.dx_civ2,'String',' '); |
---|
| 4401 | % set(handles.dy_civ2,'String',' '); |
---|
| 4402 | % % set(handles.grid_patch2,'string',filegrid); |
---|
| 4403 | |
---|
| 4404 | % --- Executes on button press in get_gridpatch1. |
---|
| 4405 | function get_gridpatch1_Callback(hObject, eventdata, handles) |
---|
| 4406 | % hObject handle to get_gridpatch1 (see GCBO) |
---|
| 4407 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 4408 | % handles structure with handles and user data (see GUIDATA) |
---|
| 4409 | |
---|
[71] | 4410 | filebase=get(handles.RootName,'String'); |
---|
[2] | 4411 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 4412 | {'*.grid', ' (*.grid)'; |
---|
| 4413 | '*.grid', '.grid files '; ... |
---|
| 4414 | '*.*', 'All Files (*.*)'}, ... |
---|
| 4415 | 'Pick a file',filebase); |
---|
[2] | 4416 | filegrid=fullfile(PathName,FileName); |
---|
| 4417 | set(handles.grid_patch1,'string',filegrid); |
---|
| 4418 | % set(handles.grid_patch2,'string',filegrid |
---|
| 4419 | |
---|
[12] | 4420 | %------------------------------------------------------------------------ |
---|
[2] | 4421 | % --- Executes on button press in get_gridpatch2. |
---|
| 4422 | function get_gridpatch2_Callback(hObject, eventdata, handles) |
---|
[12] | 4423 | %------------------------------------------------------------------------ |
---|
[2] | 4424 | |
---|
[12] | 4425 | %------------------------------------------------------------------------ |
---|
[2] | 4426 | function enable_civ1(handles,state) |
---|
[12] | 4427 | %------------------------------------------------------------------------ |
---|
[2] | 4428 | if isequal(state,0) |
---|
| 4429 | state='off'; |
---|
| 4430 | end |
---|
| 4431 | if isequal(state,1) |
---|
| 4432 | state='on'; |
---|
| 4433 | end |
---|
| 4434 | if isequal(state,'on') |
---|
| 4435 | set(handles.frame_civ1,'BackgroundColor',[1 1 0]) |
---|
| 4436 | set(handles.frame_para_civ1,'BackgroundColor',[1 1 0]) |
---|
| 4437 | set(handles.frame_grid_civ1,'BackgroundColor',[1 1 0]) |
---|
| 4438 | else |
---|
| 4439 | set(handles.frame_civ1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 4440 | set(handles.frame_para_civ1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 4441 | set(handles.frame_grid_civ1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 4442 | end |
---|
| 4443 | set(handles.ibx,'Visible',state) |
---|
| 4444 | set(handles.iby,'Visible',state) |
---|
| 4445 | set(handles.isx,'Visible',state) |
---|
| 4446 | set(handles.isy,'Visible',state) |
---|
| 4447 | set(handles.shiftx,'Visible',state) |
---|
| 4448 | set(handles.shifty,'Visible',state) |
---|
| 4449 | set(handles.rho,'Visible',state) |
---|
| 4450 | set(handles.dx_civ1,'Visible',state) |
---|
| 4451 | set(handles.dy_civ1,'Visible',state) |
---|
| 4452 | set(handles.calcul_search,'Visible',state) |
---|
| 4453 | set(handles.u_text,'Visible',state) |
---|
| 4454 | set(handles.v_text,'Visible',state) |
---|
| 4455 | set(handles.min,'Visible',state) |
---|
| 4456 | set(handles.max,'Visible',state) |
---|
| 4457 | set(handles.umin,'Visible',state) |
---|
| 4458 | set(handles.umax,'Visible',state) |
---|
| 4459 | set(handles.vmin,'Visible',state) |
---|
| 4460 | set(handles.vmax,'Visible',state) |
---|
| 4461 | set(handles.grid_civ1,'Visible',state) |
---|
| 4462 | set(handles.mask_civ1,'Visible',state) |
---|
| 4463 | set(handles.browse_gridciv1,'Visible',state) |
---|
| 4464 | set(handles.get_mask_civ1,'Visible',state) |
---|
| 4465 | set(handles.parameters,'Visible',state) |
---|
| 4466 | set(handles.grid,'Visible',state) |
---|
| 4467 | set(handles.dx_civ1,'Visible',state) |
---|
| 4468 | set(handles.dy_civ1,'Visible',state) |
---|
| 4469 | set(handles.ImaThreshold,'Visible',state) |
---|
| 4470 | if isequal(state,'off') |
---|
| 4471 | set(handles.MinIma,'Visible','off') |
---|
| 4472 | set(handles.MaxIma,'Visible','off') |
---|
| 4473 | set(handles.ImaThreshold,'Value',0) |
---|
| 4474 | end |
---|
| 4475 | set(handles.dx_civ1_title,'Visible',state) |
---|
| 4476 | set(handles.dy_civ1_title,'Visible',state) |
---|
| 4477 | set(handles.ImaThreshold_title,'Visible',state) |
---|
| 4478 | set(handles.ib_title,'Visible',state) |
---|
| 4479 | set(handles.is_title,'Visible',state) |
---|
| 4480 | set(handles.shift_title,'Visible',state) |
---|
| 4481 | set(handles.rho_title,'Visible',state) |
---|
| 4482 | |
---|
[12] | 4483 | %------------------------------------------------------------------------ |
---|
[2] | 4484 | function enable_fix1(handles,state) |
---|
[12] | 4485 | %------------------------------------------------------------------------ |
---|
[2] | 4486 | if isequal(state,0) |
---|
| 4487 | state='off'; |
---|
| 4488 | end |
---|
| 4489 | if isequal(state,1) |
---|
| 4490 | state='on'; |
---|
| 4491 | end |
---|
| 4492 | if isequal(state,'on') |
---|
| 4493 | set(handles.frame_fix1,'BackgroundColor',[1 1 0]) |
---|
| 4494 | else |
---|
| 4495 | set(handles.frame_fix1,'BackgroundColor',[0.7 0.7 0.7]) |
---|
| 4496 | end |
---|
| 4497 | set(handles.REMOVE,'Visible',state) |
---|
| 4498 | set(handles.vec_Fmin2,'Visible',state) |
---|
| 4499 | set(handles.vec_F2,'Visible',state) |
---|
| 4500 | set(handles.vec_F3,'Visible',state) |
---|
| 4501 | set(handles.thresh_vecC,'Visible',state) |
---|
| 4502 | set(handles.thresh_vecC_title,'Visible',state) |
---|
| 4503 | set(handles.thresh_vel,'Visible',state) |
---|
| 4504 | set(handles.thresh_vel_text,'Visible',state) |
---|
| 4505 | set(handles.mask_fix1,'Visible',state) |
---|
| 4506 | set(handles.get_mask_fix1,'Visible',state) |
---|
| 4507 | set(handles.get_ref_fix1,'Visible',state) |
---|
| 4508 | set(handles.ref_fix1,'Visible',state) |
---|
| 4509 | set(handles.inf_sup1,'Visible',state) |
---|
| 4510 | set(handles.field_ref1,'Visible',state) |
---|
| 4511 | |
---|
[12] | 4512 | %------------------------------------------------------------------------ |
---|
[2] | 4513 | function enable_patch1(handles) |
---|
[12] | 4514 | %------------------------------------------------------------------------ |
---|
[67] | 4515 | global patch_newBin |
---|
[2] | 4516 | set(handles.frame_patch1,'BackgroundColor',[1 1 0]) |
---|
| 4517 | set(handles.rho_patch1,'Visible','on') |
---|
| 4518 | set(handles.rho_text1,'Visible','on') |
---|
| 4519 | set(handles.thresh_patch1,'Visible','on') |
---|
| 4520 | set(handles.thresh_text1,'Visible','on') |
---|
| 4521 | set(handles.subdomain_patch1,'Visible','on') |
---|
| 4522 | set(handles.subdomain_text1,'Visible','on') |
---|
| 4523 | set(handles.nx_patch1,'Visible','on') |
---|
| 4524 | set(handles.ny_patch1,'Visible','on') |
---|
| 4525 | set(handles.nx_patch1_title,'Visible','on') |
---|
| 4526 | set(handles.ny_patch1_title,'Visible','on') |
---|
[112] | 4527 | % if ~isempty(patch_newBin) |
---|
[100] | 4528 | % set(handles.test_interp,'Visible','on'); |
---|
| 4529 | % end |
---|
[2] | 4530 | set(handles.get_gridpatch1,'Visible','on') |
---|
| 4531 | set(handles.grid_patch1,'string','none'); |
---|
| 4532 | set(handles.grid_patch1,'Visible','on') |
---|
| 4533 | |
---|
[12] | 4534 | %------------------------------------------------------------------------ |
---|
[2] | 4535 | function desable_patch1(handles) |
---|
[12] | 4536 | %------------------------------------------------------------------------ |
---|
[2] | 4537 | set(handles.frame_patch1,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 4538 | set(handles.rho_patch1,'Visible','off') |
---|
| 4539 | set(handles.rho_text1,'Visible','off') |
---|
| 4540 | set(handles.thresh_patch1,'Visible','off') |
---|
| 4541 | set(handles.thresh_text1,'Visible','off') |
---|
| 4542 | set(handles.subdomain_patch1,'Visible','off') |
---|
| 4543 | set(handles.subdomain_text1,'Visible','off') |
---|
| 4544 | set(handles.nx_patch1,'Visible','off') |
---|
| 4545 | set(handles.ny_patch1,'Visible','off') |
---|
| 4546 | set(handles.nx_patch1_title,'Visible','off') |
---|
| 4547 | set(handles.ny_patch1_title,'Visible','off') |
---|
[100] | 4548 | %set(handles.test_interp,'Visible','off') |
---|
[2] | 4549 | set(handles.get_gridpatch1,'Visible','off') |
---|
| 4550 | set(handles.grid_patch1,'Visible','off') |
---|
| 4551 | |
---|
[12] | 4552 | %------------------------------------------------------------------------ |
---|
[2] | 4553 | function enable_civ2(handles,state) |
---|
[12] | 4554 | %------------------------------------------------------------------------ |
---|
[2] | 4555 | if isequal(state,0) |
---|
| 4556 | state='off'; |
---|
| 4557 | end |
---|
| 4558 | if isequal(state,1) |
---|
| 4559 | state='on'; |
---|
| 4560 | end |
---|
| 4561 | if isequal(state,'on') |
---|
| 4562 | set(handles.frame_civ2,'BackgroundColor',[1 1 0]) |
---|
| 4563 | set(handles.frame_para_civ2,'BackgroundColor',[1 1 0]) |
---|
| 4564 | set(handles.frame_grid_civ2,'BackgroundColor',[1 1 0]) |
---|
| 4565 | set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) |
---|
| 4566 | else |
---|
| 4567 | set(handles.frame_civ2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 4568 | set(handles.frame_para_civ2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 4569 | set(handles.frame_grid_civ2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 4570 | set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 4571 | end |
---|
| 4572 | set(handles.ibx_civ2,'Visible',state) |
---|
| 4573 | set(handles.iby_civ2,'Visible',state) |
---|
| 4574 | set(handles.decimal,'Visible',state) |
---|
| 4575 | set(handles.deformation,'Visible',state) |
---|
| 4576 | set(handles.rho_civ2,'Visible',state) |
---|
| 4577 | set(handles.dx_civ2,'Visible',state) |
---|
| 4578 | set(handles.dy_civ2,'Visible',state) |
---|
| 4579 | set(handles.browse_gridciv2,'Visible',state) |
---|
| 4580 | set(handles.get_mask_civ2,'Visible',state) |
---|
| 4581 | set(handles.parameters,'Visible',state) |
---|
| 4582 | set(handles.grid,'Visible',state) |
---|
| 4583 | set(handles.parameters_text,'Visible',state) |
---|
| 4584 | set(handles.grid_text,'Visible',state) |
---|
| 4585 | set(handles.grid_civ2,'Visible',state) |
---|
| 4586 | set(handles.mask_civ2,'Visible',state) |
---|
| 4587 | set(handles.dx_civ2_title,'Visible',state) |
---|
| 4588 | set(handles.dy_civ2_title,'Visible',state) |
---|
| 4589 | set(handles.ibx_civ2_text,'Visible',state) |
---|
| 4590 | set(handles.rho_civ2_title,'Visible',state) |
---|
| 4591 | set(handles.ImaThreshold2,'Visible',state) |
---|
| 4592 | set(handles.ImaThreshold_title2,'Visible',state) |
---|
| 4593 | if isequal(state,'off') |
---|
| 4594 | set(handles.MinIma2,'Visible','off') |
---|
| 4595 | set(handles.MaxIma2,'Visible','off') |
---|
| 4596 | set(handles.ImaThreshold2,'Value',0) |
---|
[112] | 4597 | if isequal(get(handles.FIX2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) |
---|
[2] | 4598 | set(handles.list_pair_civ2,'Visible','off') |
---|
| 4599 | set(handles.subdir_civ2,'Visible','off') |
---|
| 4600 | set(handles.subdir_civ2_text,'Visible','off') |
---|
[71] | 4601 | set(handles.dt_unit_civ2,'Visible','off') |
---|
| 4602 | set(handles.ref_i_civ2,'Visible','off') |
---|
| 4603 | set(handles.i_ref_civ2_title,'Visible','off') |
---|
| 4604 | set(handles.j_ref_civ2_title,'Visible','off') |
---|
| 4605 | set(handles.ref_j_civ2,'Visible','off') |
---|
[2] | 4606 | end |
---|
| 4607 | else |
---|
| 4608 | set(handles.list_pair_civ2,'Visible','on') |
---|
| 4609 | set(handles.subdir_civ2,'Visible','on') |
---|
| 4610 | set(handles.subdir_civ2_text,'Visible','on') |
---|
[71] | 4611 | set(handles.dt_unit_civ2,'Visible','on') |
---|
| 4612 | set(handles.ref_i_civ2,'Visible','on') |
---|
| 4613 | set(handles.i_ref_civ2_title,'Visible','on') |
---|
| 4614 | set(handles.j_ref_civ2_title,'Visible','on') |
---|
| 4615 | set(handles.ref_j_civ2,'Visible','on') |
---|
[2] | 4616 | end |
---|
[71] | 4617 | set(handles.rho_civ2_title,'Visible',state) |
---|
[2] | 4618 | |
---|
[12] | 4619 | %------------------------------------------------------------------------ |
---|
[2] | 4620 | function enable_fix2(handles) |
---|
[12] | 4621 | %------------------------------------------------------------------------ |
---|
[2] | 4622 | set(handles.frame_fix2,'BackgroundColor',[1 1 0]) |
---|
| 4623 | set(handles.REMOVE2,'Visible','on') |
---|
| 4624 | set(handles.vec_Fmin2_2,'Visible','on') |
---|
| 4625 | set(handles.vec_F4,'Visible','on') |
---|
| 4626 | set(handles.vec_F3_2,'Visible','on') |
---|
| 4627 | set(handles.thresh_vec2C,'Visible','on') |
---|
| 4628 | set(handles.thresh_vec2C_text,'Visible','on') |
---|
| 4629 | set(handles.thresh_vel2,'Visible','on') |
---|
| 4630 | set(handles.thresh_vel2_text,'Visible','on') |
---|
| 4631 | set(handles.mask_fix2,'Visible','on') |
---|
| 4632 | set(handles.get_mask_fix2,'Visible','on') |
---|
| 4633 | set(handles.list_pair_civ2,'Visible','on') |
---|
| 4634 | set(handles.subdir_civ2,'Visible','on') |
---|
| 4635 | set(handles.subdir_civ2_text,'Visible','on') |
---|
| 4636 | set(handles.get_ref_fix2,'Visible','on') |
---|
| 4637 | set(handles.ref_fix2,'Visible','on') |
---|
| 4638 | set(handles.inf_sup2,'Visible','on') |
---|
| 4639 | set(handles.field_ref2,'Visible','on') |
---|
| 4640 | |
---|
[12] | 4641 | %------------------------------------------------------------------------ |
---|
[2] | 4642 | function desable_fix2(handles) |
---|
[12] | 4643 | %------------------------------------------------------------------------ |
---|
[2] | 4644 | set(handles.frame_fix2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 4645 | set(handles.REMOVE2,'Visible','off') |
---|
| 4646 | set(handles.vec_Fmin2_2,'Visible','off') |
---|
| 4647 | set(handles.vec_F4,'Visible','off') |
---|
| 4648 | set(handles.vec_F3_2,'Visible','off') |
---|
| 4649 | set(handles.thresh_vec2C,'Visible','off') |
---|
| 4650 | set(handles.thresh_vec2C_text,'Visible','off') |
---|
| 4651 | set(handles.thresh_vel2,'Visible','off') |
---|
| 4652 | set(handles.thresh_vel2_text,'Visible','off') |
---|
| 4653 | set(handles.mask_fix2,'Visible','off') |
---|
| 4654 | set(handles.get_mask_fix2,'Visible','off') |
---|
| 4655 | set(handles.get_ref_fix2,'Visible','off') |
---|
| 4656 | set(handles.ref_fix2,'Visible','off') |
---|
| 4657 | set(handles.inf_sup2,'Visible','off') |
---|
| 4658 | set(handles.field_ref2,'Visible','off') |
---|
[112] | 4659 | if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) |
---|
[2] | 4660 | set(handles.list_pair_civ2,'Visible','off') |
---|
| 4661 | set(handles.subdir_civ2,'Visible','off') |
---|
| 4662 | set(handles.subdir_civ2_text,'Visible','off') |
---|
| 4663 | end |
---|
| 4664 | |
---|
[12] | 4665 | %------------------------------------------------------------------------ |
---|
[2] | 4666 | function enable_patch2(handles) |
---|
[12] | 4667 | %------------------------------------------------------------------------ |
---|
[2] | 4668 | set(handles.frame_patch2,'BackgroundColor',[1 1 0]) |
---|
[119] | 4669 | set(handles.rho_patch2,'Visible','on') |
---|
[2] | 4670 | set(handles.rho_text2,'Visible','on') |
---|
| 4671 | set(handles.thresh_patch2,'Visible','on') |
---|
| 4672 | set(handles.thresh_text2,'Visible','on') |
---|
| 4673 | set(handles.subdomain_patch2,'Visible','on') |
---|
| 4674 | set(handles.subdomain_text2,'Visible','on') |
---|
| 4675 | set(handles.nx_patch2,'Visible','on') |
---|
| 4676 | set(handles.ny_patch2,'Visible','on') |
---|
| 4677 | set(handles.nx_patch2_title,'Visible','on') |
---|
| 4678 | set(handles.ny_patch2_title,'Visible','on') |
---|
| 4679 | set(handles.get_gridpatch2,'Visible','on') |
---|
| 4680 | set(handles.grid_patch2,'Visible','on') |
---|
| 4681 | set(handles.list_pair_civ2,'Visible','on') |
---|
| 4682 | set(handles.subdir_civ2,'Visible','on') |
---|
| 4683 | set(handles.subdir_civ2_text,'Visible','on') |
---|
| 4684 | |
---|
[12] | 4685 | %------------------------------------------------------------------------ |
---|
[2] | 4686 | function desable_patch2(handles) |
---|
[12] | 4687 | %------------------------------------------------------------------------ |
---|
[2] | 4688 | set(handles.frame_patch2,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 4689 | set(handles.rho_patch2,'Visible','off') |
---|
| 4690 | set(handles.rho_text2,'Visible','off') |
---|
| 4691 | set(handles.thresh_patch2,'Visible','off') |
---|
| 4692 | set(handles.thresh_text2,'Visible','off') |
---|
| 4693 | set(handles.subdomain_patch2,'Visible','off') |
---|
| 4694 | set(handles.subdomain_text2,'Visible','off') |
---|
| 4695 | set(handles.nx_patch2,'Visible','off') |
---|
| 4696 | set(handles.ny_patch2,'Visible','off') |
---|
| 4697 | set(handles.nx_patch2_title,'Visible','off') |
---|
| 4698 | set(handles.ny_patch2_title,'Visible','off') |
---|
| 4699 | set(handles.get_gridpatch2,'Visible','off') |
---|
| 4700 | set(handles.grid_patch2,'Visible','off') |
---|
[112] | 4701 | if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0) |
---|
[2] | 4702 | set(handles.list_pair_civ2,'Visible','off') |
---|
| 4703 | set(handles.subdir_civ2,'Visible','off') |
---|
| 4704 | set(handles.subdir_civ2_text,'Visible','off') |
---|
| 4705 | end |
---|
| 4706 | |
---|
[12] | 4707 | %------------------------------------------------------------------------ |
---|
[2] | 4708 | function enable_pair1(handles,state) |
---|
[12] | 4709 | %------------------------------------------------------------------------ |
---|
[2] | 4710 | set(handles.subdir_civ1,'Visible',state) |
---|
| 4711 | set(handles.list_subdir_civ1,'Visible',state) |
---|
| 4712 | set(handles.SUBDIR_CIV1_txt,'Visible',state) |
---|
| 4713 | set(handles.frame_subdirciv1,'Visible',state) |
---|
| 4714 | set(handles.list_pair_civ1,'Visible',state) |
---|
| 4715 | set(handles.PAIR_txt,'Visible',state) |
---|
[71] | 4716 | %set(handles.dt_unit,'Visible',state) |
---|
[2] | 4717 | set(handles.PAIR_frame,'Visible',state) |
---|
| 4718 | |
---|
[12] | 4719 | %------------------------------------------------------------------------ |
---|
| 4720 | % --- Read the parameters for civ1 on the interface |
---|
[2] | 4721 | function par=read_param_civ1(handles,file_ima) |
---|
[12] | 4722 | %------------------------------------------------------------------------ |
---|
[2] | 4723 | ibx_val=str2num(get(handles.ibx,'String')); |
---|
| 4724 | par.ibx=num2str(ibx_val); |
---|
| 4725 | iby_val=str2num(get(handles.iby,'String')); |
---|
| 4726 | par.iby=num2str(iby_val); |
---|
| 4727 | isx=get(handles.isx,'String'); |
---|
| 4728 | if isempty(str2num(isx)), isx='41'; set(handles.isx,'String','41'), end; %default |
---|
| 4729 | if str2num(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.isx,'String',num2str(ibx_val+8)); end |
---|
| 4730 | isy=get(handles.isy,'String'); |
---|
| 4731 | if isempty(str2num(isy)), isy='41'; set(handles.isy,'String','41'), end;%default |
---|
| 4732 | if str2num(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.isy,'String',num2str(iby_val+8)); end |
---|
| 4733 | par.isx=get(handles.isx,'String'); |
---|
| 4734 | par.isy=get(handles.isy,'String'); |
---|
| 4735 | par.shiftx=get(handles.shiftx,'String'); |
---|
| 4736 | par.shifty=get(handles.shifty,'String'); |
---|
| 4737 | if isempty(str2num(par.isx)) |
---|
[112] | 4738 | par.isx='41';%default |
---|
| 4739 | set(handles.isx,'String','41'); |
---|
[2] | 4740 | end |
---|
| 4741 | if isempty(str2num(par.isy)) |
---|
[112] | 4742 | par.isy='41'; %default |
---|
| 4743 | set(handles.isy,'String','41'); |
---|
[12] | 4744 | end |
---|
[2] | 4745 | if isempty(str2num(par.shiftx)) |
---|
[112] | 4746 | par.shiftx='0';%default |
---|
| 4747 | set(handles.shiftx,'String','0'); |
---|
| 4748 | end |
---|
[2] | 4749 | if isempty(str2num(par.shifty)) |
---|
[112] | 4750 | par.shifty='0'; %default |
---|
| 4751 | set(handles.shifty,'String','0'); |
---|
[12] | 4752 | end |
---|
[112] | 4753 | par.rho=get(handles.rho,'String'); |
---|
| 4754 | par.dx=get(handles.dx_civ1,'String'); |
---|
| 4755 | par.dy=get(handles.dy_civ1,'String'); |
---|
| 4756 | if isequal(str2num(par.dx),[]) |
---|
| 4757 | if isempty(get(handles.grid_civ1,'String')); |
---|
| 4758 | par.dx='0'; %just read by civ program, not used |
---|
| 4759 | else |
---|
[12] | 4760 | par.dx='20';%default |
---|
| 4761 | set(handles.dx_civ1,'String','20'); |
---|
[112] | 4762 | end |
---|
| 4763 | end |
---|
| 4764 | if isequal(str2num(par.dy),[]) |
---|
| 4765 | if isempty(get(handles.grid_civ1,'String')); |
---|
| 4766 | par.dy='0';%just read by civ program, not used |
---|
| 4767 | else |
---|
[12] | 4768 | par.dy='20';%default |
---|
| 4769 | set(handles.dy_civ1_title,'String','20'); |
---|
[112] | 4770 | end |
---|
| 4771 | end |
---|
| 4772 | par.pxcmx='1'; %velocities are expressed in pixel dispalcement |
---|
| 4773 | par.pxcmy='1'; |
---|
[2] | 4774 | % end |
---|
[112] | 4775 | A=imread(file_ima);%read the first image to get the size |
---|
| 4776 | sizim=size(A); |
---|
| 4777 | par.npx=num2str(sizim(2)); |
---|
| 4778 | par.npy=num2str(sizim(1)); |
---|
| 4779 | time=get(handles.RootName,'UserData'); %get the set of times |
---|
| 4780 | par.gridname=get(handles.grid_civ1,'String'); |
---|
| 4781 | par.gridflag='y'; |
---|
| 4782 | if isequal(par.gridname,'')| isempty(par.gridname) |
---|
| 4783 | par.gridname='nogrid'; |
---|
| 4784 | par.gridflag='n'; |
---|
| 4785 | end |
---|
[12] | 4786 | |
---|
| 4787 | %------------------------------------------------------------------------ |
---|
[2] | 4788 | function par=read_param_civ2(handles,file_ima) |
---|
[12] | 4789 | %------------------------------------------------------------------------ |
---|
| 4790 | par.ibx=get(handles.ibx_civ2,'String'); |
---|
| 4791 | par.iby=get(handles.iby_civ2,'String'); |
---|
| 4792 | par.rho=get(handles.rho_civ2,'String'); |
---|
| 4793 | par.decimal=int2str(get(handles.decimal,'Value')); |
---|
| 4794 | par.deformation=int2str(get(handles.deformation,'Value')); |
---|
| 4795 | par.dx=get(handles.dx_civ2,'String'); |
---|
| 4796 | par.dy=get(handles.dy_civ2,'String'); |
---|
[112] | 4797 | if isequal(str2num(par.dx),[]) |
---|
| 4798 | if isempty(get(handles.grid_civ2,'String')); |
---|
| 4799 | par.dx='0'; %just read by civ program, not used |
---|
| 4800 | else |
---|
[12] | 4801 | par.dx='20';%default |
---|
| 4802 | set(handles.dx_civ2,'String','20'); |
---|
[112] | 4803 | end |
---|
| 4804 | end |
---|
| 4805 | if isequal(str2num(par.dy),[]) |
---|
| 4806 | if isempty(get(handles.grid_civ2,'String')); |
---|
| 4807 | par.dy='0';%just read by civ program, not used |
---|
| 4808 | else |
---|
[12] | 4809 | par.dy='20';%default |
---|
| 4810 | set(handles.dy_civ2,'String','20'); |
---|
[112] | 4811 | end |
---|
| 4812 | end |
---|
| 4813 | par.pxcmx='1'; |
---|
| 4814 | par.pxcmy='1'; |
---|
[12] | 4815 | A=imread(file_ima);%read the first image to get the size |
---|
| 4816 | sizim=size(A); |
---|
| 4817 | par.npx=num2str(sizim(2)); |
---|
| 4818 | par.npy=num2str(sizim(1)); |
---|
[71] | 4819 | time=get(handles.RootName,'UserData'); %get the set of times |
---|
[12] | 4820 | par.gridname=get(handles.grid_civ2,'String'); |
---|
| 4821 | par.gridflag='y'; |
---|
| 4822 | if isequal(par.gridname,'')| isempty(par.gridname) |
---|
| 4823 | par.gridname='nogrid'; |
---|
| 4824 | par.gridflag='n'; |
---|
| 4825 | end |
---|
[2] | 4826 | |
---|
[12] | 4827 | %------------------------------------------------------------------------ |
---|
| 4828 | % --- CIV1 CIV1 CIV1 CIV1 |
---|
[94] | 4829 | function cmd_CIV1=CIV1_CMD(filename,namelog,par,handles,sparam) |
---|
[12] | 4830 | %------------------------------------------------------------------------ |
---|
[2] | 4831 | %pixels per cm and matrix of the image times, read from the .civ file by uvmat |
---|
| 4832 | |
---|
| 4833 | %changes : filename_cmx -> filename ( no extension ) |
---|
| 4834 | |
---|
[112] | 4835 | if isequal(par.Dt,'0') |
---|
| 4836 | par.Dt='1' ;%case of 'displacement' mode |
---|
| 4837 | end |
---|
| 4838 | % |
---|
[12] | 4839 | % textcmx={'############## CMX file';... |
---|
| 4840 | % ['FirstImage ' par.filename_ima_a];... |
---|
| 4841 | % ['LastImage ' par.filename_ima_b];... |
---|
| 4842 | % 'XX' ;... |
---|
| 4843 | % ['Mask ' par.maskflag] ;... |
---|
| 4844 | % ['MaskName ' par.maskname];... |
---|
| 4845 | % ['ImageSize ' par.npx ' ' par.npy];... %VERIFIER CAS GENERAL ? |
---|
| 4846 | % ['CorrelationBoxesSize ' par.ibx ' ' par.iby];... |
---|
| 4847 | % ['SearchBoxeSize ' par.isx ' ' par.isy];... |
---|
| 4848 | % ['RO ' par.rho];... |
---|
| 4849 | % ['GridSpacing ' par.dx ' ' par.dy];... |
---|
| 4850 | % 'XX 1.0';... |
---|
| 4851 | % ['Dt_TO ' par.Dt ' ' par.T0];... |
---|
| 4852 | % ['PixCmXY ' par.pxcmx ' ' par.pxcmy];... |
---|
| 4853 | % 'XX 1';... |
---|
| 4854 | % ['ShiftXY ' par.shiftx ' ' par.shifty];... |
---|
| 4855 | % ['Grid ' par.gridflag];... |
---|
| 4856 | % ['GridName ' par.gridname] ;... |
---|
| 4857 | % 'XX 85';... |
---|
| 4858 | % 'XX 1.0';... |
---|
| 4859 | % 'XX 1.0';... |
---|
| 4860 | % 'Hart 1';... |
---|
| 4861 | % 'DecimalShift 0';... |
---|
| 4862 | % 'Deformation 0';... |
---|
| 4863 | % 'CorrelationMin 0';... |
---|
| 4864 | % 'IntensityMin 0';... |
---|
| 4865 | % 'SeuilImage n';... |
---|
| 4866 | % 'SeuilImageValues 0 4096';... |
---|
| 4867 | % ['ImageToUse ' par.term_a ' ' par.term_b];... % VERIFIER ? |
---|
| 4868 | % 'ImageUsedBefore null null'}; |
---|
[112] | 4869 | % |
---|
[12] | 4870 | % textout=char(textcmx); |
---|
[90] | 4871 | par.filename_ima_a=regexprep(par.filename_ima_a,'.png',''); |
---|
[94] | 4872 | par.filename_ima_b=regexprep(par.filename_ima_b,'.png',''); |
---|
| 4873 | fid=fopen([filename '.cmx'],'w'); |
---|
[12] | 4874 | fprintf(fid,['############## CMX file' '\n' ]); |
---|
[112] | 4875 | fprintf(fid, ['FirstImage ' regexprep(par.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
| 4876 | fprintf(fid, ['LastImage ' regexprep(par.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
| 4877 | fprintf(fid, ['XX' '\n' ]); |
---|
| 4878 | fprintf(fid, ['Mask ' par.maskflag '\n' ]); |
---|
| 4879 | fprintf(fid, ['MaskName ' regexprep(par.maskname,'\\','\\\\') '\n' ]); |
---|
| 4880 | fprintf(fid, ['ImageSize ' par.npx ' ' par.npy '\n' ]); %VERIFIER CAS GENERAL ? |
---|
| 4881 | fprintf(fid, ['CorrelationBoxesSize ' par.ibx ' ' par.iby '\n' ]); |
---|
| 4882 | fprintf(fid, ['SearchBoxeSize ' par.isx ' ' par.isy '\n' ]); |
---|
| 4883 | fprintf(fid, ['RO ' par.rho '\n' ]); |
---|
| 4884 | fprintf(fid, ['GridSpacing ' par.dx ' ' par.dy '\n' ]); |
---|
| 4885 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 4886 | fprintf(fid, ['Dt_TO ' par.Dt ' ' par.T0 '\n' ]); |
---|
| 4887 | fprintf(fid, ['PixCmXY ' par.pxcmx ' ' par.pxcmy '\n' ]); |
---|
| 4888 | fprintf(fid, ['XX 1' '\n' ]); |
---|
| 4889 | fprintf(fid, ['ShiftXY ' par.shiftx ' ' par.shifty '\n' ]); |
---|
| 4890 | fprintf(fid, ['Grid ' par.gridflag '\n' ]); |
---|
| 4891 | fprintf(fid, ['GridName ' regexprep(par.gridname,'\\','\\\\') '\n' ]); |
---|
| 4892 | fprintf(fid, ['XX 85' '\n' ]); |
---|
| 4893 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 4894 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 4895 | fprintf(fid, ['Hart 1' '\n' ]); |
---|
| 4896 | fprintf(fid, [ 'DecimalShift 0' '\n' ]); |
---|
| 4897 | fprintf(fid, ['Deformation 0' '\n' ]); |
---|
| 4898 | fprintf(fid, ['CorrelationMin 0' '\n' ]); |
---|
| 4899 | fprintf(fid, ['IntensityMin 0' '\n' ]); |
---|
| 4900 | fprintf(fid, ['SeuilImage n' '\n' ]); |
---|
| 4901 | fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); |
---|
| 4902 | fprintf(fid, ['ImageToUse ' par.term_a ' ' par.term_b '\n' ]); % VERIFIER ? |
---|
| 4903 | fprintf(fid, ['ImageUsedBefore null null' '\n' ]); |
---|
[12] | 4904 | fclose(fid); |
---|
[112] | 4905 | |
---|
[120] | 4906 | cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file |
---|
[90] | 4907 | cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\'); |
---|
| 4908 | namelog=regexprep(namelog,'\\','\\\\'); |
---|
| 4909 | |
---|
[12] | 4910 | if(isunix) |
---|
| 4911 | [Rootbat,Filebat,extbat]=fileparts(namelog); |
---|
| 4912 | ncName=fullfile(Rootbat,[ Filebat '.nc']); |
---|
[67] | 4913 | cmd_CIV1=[cmd_CIV1 '\n' 'mv ' namelog ' ' regexprep(namelog,'\.log','') '.civ1.log' '\n' 'chmod g+w ' ncName]; |
---|
[12] | 4914 | else |
---|
[67] | 4915 | cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y ' namelog ' ' regexprep(namelog,'\.log','') '.civ1.log']; |
---|
[12] | 4916 | end |
---|
[2] | 4917 | |
---|
[12] | 4918 | %------------------------------------------------------------------------ |
---|
| 4919 | % --- CIV1 Unified |
---|
[94] | 4920 | function xml_civ1_parameters=CIV1_CMD_Unified(filename,namelog,par) |
---|
[12] | 4921 | %------------------------------------------------------------------------ |
---|
[2] | 4922 | %pixels per cm and matrix of the image times, read from the .civ file by uvmat |
---|
[73] | 4923 | %global CivBin%name of the executable for civ1 calculation |
---|
[2] | 4924 | |
---|
[112] | 4925 | civ1.image1=par.filename_ima_a; |
---|
| 4926 | civ1.image2=par.filename_ima_b; |
---|
| 4927 | civ1.imageSize_X=par.npx; |
---|
| 4928 | civ1.imageSize_Y=par.npy; |
---|
| 4929 | civ1.outputFileName=[filename '.nc']; |
---|
| 4930 | civ1.correlationBoxesSize_X=par.ibx; |
---|
| 4931 | civ1.correlationBoxesSize_Y=par.iby; |
---|
| 4932 | civ1.searchBoxesSize_X=par.isx; |
---|
| 4933 | civ1.searchBoxesSize_Y=par.isy; |
---|
| 4934 | civ1.globalShift_X=par.shiftx; |
---|
| 4935 | civ1.globalShift_Y=par.shifty; |
---|
| 4936 | civ1.ro=par.rho; |
---|
| 4937 | civ1.hart='y'; |
---|
| 4938 | if isequal(par.gridflag,'y') |
---|
| 4939 | civ1.grid=par.gridname; |
---|
| 4940 | else |
---|
| 4941 | civ1.grid='n'; |
---|
| 4942 | civ1.gridSpacing_X=par.dx; |
---|
| 4943 | civ1.gridSpacing_Y=par.dy; |
---|
| 4944 | end |
---|
| 4945 | if isequal(par.maskflag,'y') |
---|
| 4946 | civ1.mask=par.maskname; |
---|
| 4947 | end |
---|
| 4948 | civ1.dt=par.Dt; |
---|
| 4949 | civ1.unit='pixel'; |
---|
| 4950 | civ1.absolut_time_T0=par.T0; |
---|
| 4951 | civ1.pixcmx=par.pxcmx; |
---|
| 4952 | civ1.pixcmy=par.pxcmy; |
---|
| 4953 | civ1.convectFlow='n'; |
---|
[12] | 4954 | |
---|
[112] | 4955 | xml_civ1_parameters=civ1; |
---|
| 4956 | |
---|
[12] | 4957 | %------------------------------------------------------------------------ |
---|
| 4958 | % --- CIV2 Unified |
---|
[94] | 4959 | function civ2=CIV2_CMD_Unified(filename,namelog,par) |
---|
[12] | 4960 | %------------------------------------------------------------------------ |
---|
[2] | 4961 | %pixels per cm and matrix of the image times, read from the .civ file by uvmat |
---|
[73] | 4962 | %global CivBin%name of the executable for civ1 calculation |
---|
[2] | 4963 | |
---|
| 4964 | civ2.image1=par.filename_ima_a; |
---|
| 4965 | civ2.image2=par.filename_ima_b; |
---|
[112] | 4966 | civ2.imageSize_X=par.npx; |
---|
[2] | 4967 | civ2.imageSize_Y=par.npy; |
---|
| 4968 | civ2.inputFileName=[par.filename_nc1 '.nc']; |
---|
| 4969 | civ2.outputFileName=[filename '.nc']; |
---|
| 4970 | civ2.correlationBoxesSize_X=par.ibx; |
---|
| 4971 | civ2.correlationBoxesSize_Y=par.iby; |
---|
| 4972 | civ2.ro=par.rho; |
---|
| 4973 | %civ2.decimalShift=par.decimal; |
---|
| 4974 | %civ2.deformation=par.deformation; |
---|
| 4975 | if isequal(par.decimal,'1') |
---|
| 4976 | civ2.decimalShift='y'; |
---|
| 4977 | else |
---|
| 4978 | civ2.decimalShift='n'; |
---|
| 4979 | end |
---|
| 4980 | if isequal(par.deformation,'1') |
---|
| 4981 | civ2.deformation='y'; |
---|
| 4982 | else |
---|
| 4983 | civ2.deformation='n'; |
---|
| 4984 | end |
---|
| 4985 | if isequal(par.gridflag,'y') |
---|
| 4986 | civ2.grid=par.gridname; |
---|
| 4987 | else |
---|
| 4988 | civ2.grid='n'; |
---|
| 4989 | civ2.gridSpacing_X=par.dx; |
---|
| 4990 | civ2.gridSpacing_Y=par.dy; |
---|
| 4991 | end |
---|
| 4992 | civ2.gridSpacing_X='10'; |
---|
| 4993 | civ2.gridSpacing_Y='10';%NOTE: faut mettre gridSpacing pourque ca tourne, meme si c'est la grille qui est utilisee |
---|
| 4994 | if isequal(par.maskflag,'y') |
---|
| 4995 | civ2.mask=par.maskname; |
---|
| 4996 | else |
---|
| 4997 | civ2.mask='n'; |
---|
| 4998 | end |
---|
| 4999 | civ2.dt=par.Dt; |
---|
| 5000 | civ2.unit='pixel'; |
---|
| 5001 | civ2.absolut_time_T0=par.T0; |
---|
| 5002 | civ2.pixcmx=par.pxcmx; |
---|
| 5003 | civ2.pixcmy=par.pxcmy; |
---|
| 5004 | civ2.convectFlow='n'; |
---|
| 5005 | civ2.pixcmx=par.pxcmx; |
---|
| 5006 | civ2.pixcmy=par.pxcmy; |
---|
| 5007 | civ2.convectFlow='n'; |
---|
| 5008 | |
---|
[12] | 5009 | %------------------------------------------------------------------------ |
---|
| 5010 | % --- CIV2 CIV2 CIV2 CIV2 |
---|
[94] | 5011 | function cmd_CIV2=CIV2_CMD(filename_cmx,namelog,par,sparam) |
---|
[12] | 5012 | %------------------------------------------------------------------------ |
---|
[2] | 5013 | %pixels per cm and matrix of the image times, read from the .civ file by uvmat |
---|
[67] | 5014 | % global civ2Bin sge%name of the executable for civ1 calculation |
---|
[112] | 5015 | if isequal(par.Dt,'0') |
---|
| 5016 | par.Dt='1' ;%case of 'displacement' mode |
---|
| 5017 | end |
---|
[94] | 5018 | % textcmx=['############## CMX file' '\n'... |
---|
| 5019 | % ['FirstImage ' par.filename_ima_a] '\n'... |
---|
| 5020 | % ['LastImage ' par.filename_ima_b] '\n'... |
---|
| 5021 | % 'XX' '\n'... |
---|
| 5022 | % ['Mask ' par.maskflag] '\n'... |
---|
| 5023 | % ['MaskName ' par.maskname] '\n'... |
---|
[112] | 5024 | % ['ImageSize ' par.npx ' ' par.npy] '\n'... |
---|
[94] | 5025 | % ['CorrelationBoxesSize ' par.ibx ' ' par.iby] '\n'... |
---|
| 5026 | % ['SearchBoxeSize ' par.ibx ' ' par.iby] '\n'... |
---|
| 5027 | % ['RO ' par.rho] '\n'... |
---|
| 5028 | % ['GridSpacing ' par.dx ' ' par.dy] '\n'... |
---|
| 5029 | % 'XX 1.0' '\n'... |
---|
| 5030 | % ['Dt_TO ' par.Dt ' ' par.T0] '\n'... |
---|
| 5031 | % ['PixCmXY ' par.pxcmx ' ' par.pxcmy] '\n'... |
---|
| 5032 | % 'XX 1' '\n'... |
---|
| 5033 | % ['ShiftXY 0 0'] '\n'... |
---|
| 5034 | % ['Grid ' par.gridflag] '\n'... |
---|
| 5035 | % ['GridName ' par.gridname] '\n'... |
---|
| 5036 | % 'XX 85' '\n'... |
---|
| 5037 | % 'XX 1.0' '\n'... |
---|
| 5038 | % 'XX 1.0' '\n'... |
---|
| 5039 | % 'Hart 1' '\n'... |
---|
| 5040 | % ['DecimalShift ' par.decimal] '\n'... |
---|
| 5041 | % ['Deformation ' par.deformation] '\n'... |
---|
| 5042 | % 'CorrelationMin 0' '\n'... |
---|
| 5043 | % 'IntensityMin 0' '\n'... |
---|
| 5044 | % 'SeuilImage n' '\n'... |
---|
| 5045 | % 'SeuilImageValues 0 4096' '\n'... |
---|
| 5046 | % ['ImageToUse ' par.term_a ' ' par.term_b] '\n'... % VERIFIER ? |
---|
| 5047 | % ['ImageUsedBefore ' par.filename_nc1]]; |
---|
| 5048 | % textout=char(textcmx); |
---|
| 5049 | % fid=fopen([filename_cmx '2'],'w'); |
---|
[112] | 5050 | % fprintf(fid,textout); |
---|
[94] | 5051 | % fclose(fid) |
---|
[2] | 5052 | |
---|
[94] | 5053 | par.filename_ima_a=regexprep(par.filename_ima_a,'.png',''); |
---|
| 5054 | par.filename_ima_b=regexprep(par.filename_ima_b,'.png','');% bug : .png appears two times ? |
---|
[112] | 5055 | fid=fopen([filename_cmx '2'],'w'); |
---|
[94] | 5056 | fprintf(fid,['############## CMX file' '\n' ]); |
---|
| 5057 | fprintf(fid, ['FirstImage ' regexprep(par.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
| 5058 | fprintf(fid, ['LastImage ' regexprep(par.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
| 5059 | fprintf(fid, ['XX' '\n' ]); |
---|
| 5060 | fprintf(fid, ['Mask ' par.maskflag '\n' ]); |
---|
| 5061 | fprintf(fid, ['MaskName ' regexprep(par.maskname,'\\','\\\\') '\n' ]);% for windows compatibility |
---|
| 5062 | fprintf(fid, ['ImageSize ' par.npx ' ' par.npy '\n' ]); %VERIFIER CAS GENERAL ? |
---|
| 5063 | fprintf(fid, ['CorrelationBoxesSize ' par.ibx ' ' par.iby '\n' ]); |
---|
| 5064 | fprintf(fid, ['SearchBoxeSize ' par.ibx ' ' par.iby '\n']); |
---|
| 5065 | fprintf(fid, ['RO ' par.rho '\n']); |
---|
| 5066 | fprintf(fid, ['GridSpacing ' par.dx ' ' par.dy '\n']); |
---|
| 5067 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 5068 | fprintf(fid, ['Dt_TO ' par.Dt ' ' par.T0 '\n' ]); |
---|
| 5069 | fprintf(fid, ['PixCmXY ' par.pxcmx ' ' par.pxcmy '\n' ]); |
---|
| 5070 | fprintf(fid, ['XX 1' '\n' ]); |
---|
[122] | 5071 | fprintf(fid, 'ShiftXY 0 0\n'); |
---|
[94] | 5072 | fprintf(fid, ['Grid ' par.gridflag '\n' ]); |
---|
| 5073 | fprintf(fid, ['GridName ' regexprep(par.gridname,'\\','\\\\') '\n']); |
---|
| 5074 | fprintf(fid, ['XX 85' '\n' ]); |
---|
| 5075 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 5076 | fprintf(fid, ['XX 1.0' '\n' ]); |
---|
| 5077 | fprintf(fid, ['Hart 1' '\n' ]); |
---|
| 5078 | fprintf(fid, ['DecimalShift ' par.decimal '\n']); |
---|
| 5079 | fprintf(fid, ['Deformation ' par.deformation '\n']); |
---|
| 5080 | fprintf(fid, ['CorrelationMin 0' '\n' ]); |
---|
| 5081 | fprintf(fid, ['IntensityMin 0' '\n' ]); |
---|
| 5082 | fprintf(fid, ['SeuilImage n' '\n' ]); |
---|
| 5083 | fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); |
---|
| 5084 | fprintf(fid, ['ImageToUse ' par.term_a ' ' par.term_b '\n' ]); % VERIFIER ? |
---|
| 5085 | fprintf(fid, ['ImageUsedBefore ' regexprep(par.filename_nc1,'\\','\\\\') '\n']); |
---|
| 5086 | fclose(fid); |
---|
| 5087 | |
---|
| 5088 | cmd_CIV2=[sparam.Civ2Bin ' -f ' filename_cmx ]; % redirect standard output to the log file |
---|
| 5089 | cmd_CIV2=regexprep(cmd_CIV2,'\\','\\\\'); |
---|
| 5090 | |
---|
[12] | 5091 | %------------------------------------------------------------------------ |
---|
[2] | 5092 | % --- Executes on button press in HELP. |
---|
| 5093 | function HELP_Callback(hObject, eventdata, handles) |
---|
[12] | 5094 | %------------------------------------------------------------------------ |
---|
[2] | 5095 | path_to_uvmat=which ('uvmat');% check the path of uvmat |
---|
| 5096 | pathelp=fileparts(path_to_uvmat); |
---|
[85] | 5097 | helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html'); |
---|
[36] | 5098 | 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] | 5099 | else |
---|
[36] | 5100 | addpath (fullfile(pathelp,'uvmat_doc')) |
---|
[112] | 5101 | web([helpfile '#civ']) |
---|
[2] | 5102 | end |
---|
| 5103 | |
---|
[12] | 5104 | %------------------------------------------------------------------------ |
---|
[2] | 5105 | %--read images and convert them to the uint16 format used for PIV |
---|
[45] | 5106 | function A=read_image(filename,type_ima,num,movieobject) |
---|
[12] | 5107 | %------------------------------------------------------------------------ |
---|
[2] | 5108 | %num is the view number needed for an avi movie |
---|
[45] | 5109 | switch type_ima |
---|
| 5110 | case 'movie' |
---|
| 5111 | A=read(movieobject,num); |
---|
| 5112 | case 'avi' |
---|
[112] | 5113 | mov=aviread(filename,num); |
---|
| 5114 | A=frame2im(mov(1)); |
---|
[45] | 5115 | case 'multimage' |
---|
| 5116 | A=imread(filename,num); |
---|
[112] | 5117 | case 'image' |
---|
[45] | 5118 | A=imread(filename); |
---|
| 5119 | end |
---|
| 5120 | siz=size(A); |
---|
| 5121 | if length(siz)==3;%color images |
---|
[2] | 5122 | A=sum(double(A),3); |
---|
| 5123 | A=uint16(A); |
---|
| 5124 | end |
---|
| 5125 | |
---|
[12] | 5126 | %------------------------------------------------------------------------ |
---|
[2] | 5127 | function ref_i_Callback(hObject, eventdata, handles) |
---|
[12] | 5128 | %------------------------------------------------------------------------ |
---|
[2] | 5129 | mode_list=get(handles.mode,'String'); |
---|
| 5130 | mode_value=get(handles.mode,'Value'); |
---|
| 5131 | mode=mode_list{mode_value}; |
---|
[45] | 5132 | find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
[12] | 5133 | if isequal(mode,'series(Di)') || ...% we do patch2 only |
---|
[112] | 5134 | (get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0) |
---|
[2] | 5135 | find_netcpair_civ2(hObject, eventdata, handles); |
---|
| 5136 | end |
---|
| 5137 | |
---|
[12] | 5138 | %------------------------------------------------------------------------ |
---|
[2] | 5139 | function ref_j_Callback(hObject, eventdata, handles) |
---|
[12] | 5140 | %------------------------------------------------------------------------ |
---|
[2] | 5141 | mode_list=get(handles.mode,'String'); |
---|
| 5142 | mode_value=get(handles.mode,'Value'); |
---|
| 5143 | mode=mode_list{mode_value}; |
---|
[112] | 5144 | if isequal(get(handles.CIV1,'Value'),0)|| isequal(mode,'series(Dj)') |
---|
[2] | 5145 | find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
| 5146 | end |
---|
[45] | 5147 | if isequal(mode,'series(Dj)') || ... |
---|
[112] | 5148 | (get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0) |
---|
[2] | 5149 | find_netcpair_civ2(hObject, eventdata, handles); |
---|
| 5150 | end |
---|
[12] | 5151 | |
---|
| 5152 | %------------------------------------------------------------------------ |
---|
[71] | 5153 | function ref_i_civ2_Callback(hObject, eventdata, handles) |
---|
| 5154 | %------------------------------------------------------------------------ |
---|
| 5155 | mode_list=get(handles.mode,'String'); |
---|
| 5156 | mode_value=get(handles.mode,'Value'); |
---|
| 5157 | mode=mode_list{mode_value}; |
---|
| 5158 | find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
| 5159 | |
---|
| 5160 | %------------------------------------------------------------------------ |
---|
| 5161 | function ref_j_civ2_Callback(hObject, eventdata, handles) |
---|
| 5162 | %------------------------------------------------------------------------ |
---|
| 5163 | mode_list=get(handles.mode,'String'); |
---|
| 5164 | mode_value=get(handles.mode,'Value'); |
---|
| 5165 | mode=mode_list{mode_value}; |
---|
[112] | 5166 | if isequal(mode,'series(Dj)') |
---|
[71] | 5167 | find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files |
---|
| 5168 | end |
---|
| 5169 | |
---|
| 5170 | %------------------------------------------------------------------------ |
---|
[2] | 5171 | % --- Executes on button press in compare. |
---|
| 5172 | function compare_Callback(hObject, eventdata, handles) |
---|
[12] | 5173 | %------------------------------------------------------------------------ |
---|
[2] | 5174 | test=get(handles.compare,'Value'); |
---|
[112] | 5175 | if test==2 || test==3 |
---|
[71] | 5176 | filebase=get(handles.RootName,'String'); |
---|
[2] | 5177 | browse=get(handles.browse_root,'Userdata'); |
---|
| 5178 | browse.nom_type_ima1=browse.nom_type_ima; |
---|
| 5179 | set(handles.browse_root,'UserData',browse); |
---|
| 5180 | set(handles.sub_txt,'Visible','on') |
---|
[112] | 5181 | set(handles.RootName_1,'Visible','On');%mkes the second file input window visible |
---|
[2] | 5182 | mode_store=get(handles.mode,'String');%get the present 'mode' |
---|
[112] | 5183 | set(handles.compare,'UserData',mode_store);%store the mode display |
---|
[2] | 5184 | set(handles.mode,'Visible','off') |
---|
| 5185 | if test==2 |
---|
[112] | 5186 | set(handles.mode,'Visible','off') |
---|
[2] | 5187 | else |
---|
| 5188 | set(handles.mode,'Visible','on') |
---|
| 5189 | end |
---|
| 5190 | |
---|
| 5191 | % open an image file with the browser |
---|
| 5192 | ind_opening=1;%default |
---|
| 5193 | browse.incr_pair=[0 0]; %default |
---|
[71] | 5194 | oldfile=get(handles.RootName,'String'); |
---|
[2] | 5195 | menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... |
---|
[112] | 5196 | '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';... |
---|
| 5197 | '*.*', 'All Files (*.*)'}; |
---|
[2] | 5198 | [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile); |
---|
[112] | 5199 | fileinput=[PathName FileName];%complete file name |
---|
[2] | 5200 | sizf=size(fileinput); |
---|
| 5201 | if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
| 5202 | [path,name,ext]=fileparts(fileinput); |
---|
| 5203 | [path1]=fileparts(filebase); |
---|
| 5204 | if ~strcmp(path1,path) |
---|
[112] | 5205 | msgbox_uvmat('ERROR','The two input image series must be in the same directory') |
---|
[2] | 5206 | return |
---|
| 5207 | end |
---|
[71] | 5208 | set(handles.RootName_1,'String',name); |
---|
[2] | 5209 | [RootPath,RootFile,field_count,str2,str_a,str_b,xx,nom_type,subdir]=name2display(name); |
---|
| 5210 | browse=get(handles.browse_root,'UserData'); |
---|
| 5211 | browse.nom_type_ima_1=nom_type; |
---|
[112] | 5212 | set(handles.browse_root,'UserData',browse) |
---|
[2] | 5213 | |
---|
| 5214 | %check image extension |
---|
[71] | 5215 | if ~strcmp(ext,get(handles.ImaExt,'String')) |
---|
[2] | 5216 | msgbox_uvmat('ERROR','The two input image series must have the same extenion name') |
---|
| 5217 | return |
---|
| 5218 | end |
---|
| 5219 | |
---|
| 5220 | %check image size |
---|
| 5221 | A=imread(fileinput); |
---|
[71] | 5222 | npxy=get(handles.ImaExt,'UserData'); |
---|
[2] | 5223 | if ~isequal(npxy(1),size(A,1))|| ~isequal(npxy(2),size(A,2)) |
---|
| 5224 | msgbox_uvmat('ERROR','The two input image series must have the same size') |
---|
| 5225 | return |
---|
| 5226 | end |
---|
| 5227 | else |
---|
| 5228 | set(handles.mode,'Visible','on') |
---|
[71] | 5229 | set(handles.RootName_1,'Visible','Off'); |
---|
[2] | 5230 | set(handles.sub_txt,'Visible','off') |
---|
[71] | 5231 | set(handles.RootName_1,'String',[]); |
---|
[2] | 5232 | mode_store=get(handles.compare,'UserData'); |
---|
| 5233 | set(handles.mode,'String',mode_store) |
---|
| 5234 | set(handles.test_stereo1,'Value',0) |
---|
| 5235 | set(handles.test_stereo2,'Value',0) |
---|
| 5236 | end |
---|
| 5237 | mode_Callback(hObject, eventdata, handles) |
---|
| 5238 | |
---|
[12] | 5239 | %------------------------------------------------------------------------ |
---|
[2] | 5240 | % --- Executes on button press in get_ref_fix1. |
---|
| 5241 | function get_ref_fix1_Callback(hObject, eventdata, handles) |
---|
[12] | 5242 | %------------------------------------------------------------------------ |
---|
[71] | 5243 | filebase=get(handles.RootName,'String'); |
---|
[2] | 5244 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 5245 | {'*.nc', ' (*.nc)'; |
---|
| 5246 | '*.nc', 'netcdf files '; ... |
---|
| 5247 | '*.*', 'All Files (*.*)'}, ... |
---|
| 5248 | 'Pick a file',filebase); |
---|
| 5249 | |
---|
[2] | 5250 | fileinput=[PathName FileName]; |
---|
| 5251 | sizf=size(fileinput); |
---|
[122] | 5252 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
[2] | 5253 | [Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
| 5254 | ref.filebase=fullfile(Path,File); |
---|
| 5255 | ref.num_a=stra2num(str_a); |
---|
| 5256 | ref.num_b=stra2num(str_b); |
---|
[89] | 5257 | ref.num1=str2double(field_count); |
---|
| 5258 | ref.num2=str2double(str2); |
---|
[2] | 5259 | browse=[];%initialisation |
---|
| 5260 | if ~isequal(ref.ext,'.nc') |
---|
| 5261 | msgbox_uvmat('ERROR','the reference file must be in netcdf format (*.nc)') |
---|
| 5262 | return |
---|
| 5263 | end |
---|
| 5264 | set(handles.ref_fix1,'String',[fullfile(ref.subdir,File) '....nc']); |
---|
| 5265 | set(handles.ref_fix1,'UserData',ref) |
---|
| 5266 | menu_field{1}='civ1'; |
---|
| 5267 | Data=nc2struct(fileinput,[]); |
---|
[45] | 5268 | if isfield(Data,'patch') && isequal(Data.patch,1) |
---|
[2] | 5269 | menu_field{2}='filter1'; |
---|
| 5270 | end |
---|
[45] | 5271 | if isfield(Data,'civ2') && isequal(Data.civ2,1) |
---|
[2] | 5272 | menu_field{3}='civ2'; |
---|
| 5273 | end |
---|
[45] | 5274 | if isfield(Data,'patch2') && isequal(Data.patch2,1) |
---|
[2] | 5275 | menu_field{4}='filter2'; |
---|
| 5276 | end |
---|
| 5277 | set(handles.field_ref1,'String',menu_field); |
---|
| 5278 | set(handles.field_ref1,'Value',length(menu_field)); |
---|
| 5279 | set(handles.inf_sup1,'Value',2); |
---|
| 5280 | set(handles.thresh_vel,'String','1');%default threshold |
---|
| 5281 | set(handles.ref_fix1,'Enable','on') |
---|
[12] | 5282 | |
---|
| 5283 | %------------------------------------------------------------------------ |
---|
[2] | 5284 | % --- Executes on button press in get_ref_fix2. |
---|
| 5285 | function get_ref_fix2_Callback(hObject, eventdata, handles) |
---|
[12] | 5286 | %------------------------------------------------------------------------ |
---|
[2] | 5287 | if isequal(get(handles.get_ref_fix2,'Value'),1) |
---|
[71] | 5288 | filebase=get(handles.RootName,'String'); |
---|
[2] | 5289 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
[112] | 5290 | {'*.nc', ' (*.nc)'; |
---|
| 5291 | '*.nc', 'netcdf files '; ... |
---|
| 5292 | '*.*', 'All Files (*.*)'}, ... |
---|
| 5293 | 'Pick a file',filebase); |
---|
[2] | 5294 | fileinput=[PathName FileName]; |
---|
| 5295 | sizf=size(fileinput); |
---|
[45] | 5296 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
[2] | 5297 | [Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
| 5298 | ref.filebase=fullfile(Path,File); |
---|
| 5299 | ref.num_a=stra2num(str_a); |
---|
| 5300 | ref.num_b=stra2num(str_b); |
---|
| 5301 | ref.num1=str2num(field_count); |
---|
| 5302 | ref.num2=str2num(str2); |
---|
| 5303 | browse=[];%initialisation |
---|
| 5304 | if ~isequal(ref.ext,'.nc') |
---|
| 5305 | msgbox_uvmat('ERROR','the reference file must be in netcdf format (*.nc)') |
---|
| 5306 | return |
---|
| 5307 | end |
---|
| 5308 | set(handles.ref_fix2,'String',[fullfile(ref.subdir,File) '....nc']); |
---|
[112] | 5309 | set(handles.ref_fix2,'UserData',ref) |
---|
[2] | 5310 | menu_field{1}='civ1'; |
---|
| 5311 | Data=nc2struct(fileinput,[]); |
---|
| 5312 | if isfield(Data,'patch') & isequal(Data.patch,1) |
---|
| 5313 | menu_field{2}='filter1'; |
---|
| 5314 | end |
---|
| 5315 | if isfield(Data,'civ2') & isequal(Data.civ2,1) |
---|
| 5316 | menu_field{3}='civ2'; |
---|
| 5317 | end |
---|
| 5318 | if isfield(Data,'patch2') & isequal(Data.patch2,1) |
---|
| 5319 | menu_field{4}='filter2'; |
---|
| 5320 | end |
---|
| 5321 | set(handles.field_ref2,'String',menu_field); |
---|
| 5322 | set(handles.field_ref2,'Value',length(menu_field)); |
---|
| 5323 | set(handles.inf_sup2,'Value',2); |
---|
| 5324 | set(handles.thresh_vel2,'String','1');%default threshold |
---|
| 5325 | set(handles.ref_fix2,'Enable','on') |
---|
| 5326 | set(handles.ref_fix2,'Visible','on') |
---|
| 5327 | set(handles.field_ref2,'Visible','on') |
---|
| 5328 | else |
---|
| 5329 | set(handles.ref_fix2,'Visible','off') |
---|
| 5330 | set(handles.field_ref2,'Visible','off') |
---|
| 5331 | end |
---|
| 5332 | |
---|
[12] | 5333 | %------------------------------------------------------------------------ |
---|
[2] | 5334 | function ref_fix1_Callback(hObject, eventdata, handles) |
---|
[12] | 5335 | %------------------------------------------------------------------------ |
---|
| 5336 | set(handles.inf_sup1,'Value',1); |
---|
| 5337 | set(handles.field_ref1,'Value',1) |
---|
| 5338 | set(handles.field_ref1,'String',{' '}) |
---|
| 5339 | set(handles.ref_fix1,'UserData',[]); |
---|
| 5340 | set(handles.ref_fix1,'String',''); |
---|
| 5341 | set(handles.thresh_vel1,'String','0'); |
---|
[112] | 5342 | |
---|
[12] | 5343 | %------------------------------------------------------------------------ |
---|
[2] | 5344 | function ref_fix2_Callback(hObject, eventdata, handles) |
---|
[12] | 5345 | %------------------------------------------------------------------------ |
---|
| 5346 | set(handles.inf_sup2,'Value',1); |
---|
| 5347 | set(handles.field_ref2,'Value',1) |
---|
| 5348 | set(handles.field_ref2,'String',{' '}) |
---|
| 5349 | set(handles.ref_fix2,'UserData',[]); |
---|
| 5350 | set(handles.ref_fix2,'String',''); |
---|
| 5351 | set(handles.thresh_vel2,'String','0'); |
---|
[2] | 5352 | |
---|
[89] | 5353 | % %------------------------------------------------------------------------ |
---|
| 5354 | % % transform letters to numbers |
---|
| 5355 | % function numres=stra2num(str) |
---|
| 5356 | % %------------------------------------------------------------------------ |
---|
| 5357 | % numres=double(str)-96; |
---|
| 5358 | % if double(str) >= 48 & double(str) <= 57 % = 1 for numbers |
---|
| 5359 | % numres=str2num(str); |
---|
| 5360 | % end |
---|
[2] | 5361 | |
---|
[12] | 5362 | %------------------------------------------------------------------------ |
---|
[2] | 5363 | % --- Executes on button press in test_stereo1. |
---|
| 5364 | function test_stereo1_Callback(hObject, eventdata, handles) |
---|
[12] | 5365 | %------------------------------------------------------------------------ |
---|
[2] | 5366 | if isequal(get(handles.test_stereo1,'Value'),0) |
---|
| 5367 | set(handles.subdomain_patch1,'Visible','on') |
---|
| 5368 | set(handles.rho_patch1,'Visible','on') |
---|
| 5369 | else |
---|
| 5370 | set(handles.subdomain_patch1,'Visible','off') |
---|
| 5371 | set(handles.rho_patch1,'Visible','off') |
---|
| 5372 | end |
---|
| 5373 | |
---|
[12] | 5374 | %------------------------------------------------------------------------ |
---|
[2] | 5375 | % --- Executes on button press in test_stereo2. |
---|
| 5376 | function test_stereo2_Callback(hObject, eventdata, handles) |
---|
[12] | 5377 | %------------------------------------------------------------------------ |
---|
[2] | 5378 | if isequal(get(handles.test_stereo2,'Value'),0) |
---|
| 5379 | set(handles.subdomain_patch2,'Visible','on') |
---|
| 5380 | set(handles.rho_patch2,'Visible','on') |
---|
| 5381 | else |
---|
| 5382 | set(handles.subdomain_patch2,'Visible','off') |
---|
| 5383 | set(handles.rho_patch2,'Visible','off') |
---|
| 5384 | end |
---|
| 5385 | |
---|
[12] | 5386 | %------------------------------------------------------------------------ |
---|
[2] | 5387 | % --- Executes on button press in ImaThreshold. |
---|
| 5388 | function ImaThreshold_Callback(hObject, eventdata, handles) |
---|
[12] | 5389 | %------------------------------------------------------------------------ |
---|
[2] | 5390 | if isequal(get(handles.ImaThreshold,'Value'),1) |
---|
| 5391 | set(handles.MinIma,'Visible','on') |
---|
| 5392 | set(handles.MaxIma,'Visible','on') |
---|
| 5393 | else |
---|
| 5394 | set(handles.MinIma,'Visible','off') |
---|
| 5395 | set(handles.MaxIma,'Visible','off') |
---|
| 5396 | end |
---|
| 5397 | |
---|
[12] | 5398 | %------------------------------------------------------------------------ |
---|
[2] | 5399 | % --- Executes on button press in ImaThreshold2. |
---|
| 5400 | function ImaThreshold2_Callback(hObject, eventdata, handles) |
---|
[12] | 5401 | %------------------------------------------------------------------------ |
---|
[2] | 5402 | if isequal(get(handles.ImaThreshold2,'Value'),1) |
---|
| 5403 | set(handles.MinIma2,'Visible','on') |
---|
| 5404 | set(handles.MaxIma2,'Visible','on') |
---|
| 5405 | else |
---|
| 5406 | set(handles.MinIma2,'Visible','off') |
---|
| 5407 | set(handles.MaxIma2,'Visible','off') |
---|
| 5408 | end |
---|
| 5409 | |
---|
[71] | 5410 | |
---|
| 5411 | |
---|
| 5412 | |
---|