Changeset 298 for trunk/src/civ.m
- Timestamp:
- Nov 24, 2011, 4:33:06 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r297 r298 45 45 %------------------------------------------------------------------------ 46 46 % --- Executes just before civ is made visible. 47 function civ_OpeningFcn(hObject, eventdata, handles, param)47 function civ_OpeningFcn(hObject, eventdata, handles, fileinput) 48 48 %------------------------------------------------------------------------ 49 49 % This function has no output args, see OutputFcn. 50 %filebase: root name 51 %nom_type: nomencalture used ('png_old','_i_j'...) 52 %list of field numbers to process 53 %subdir: subdirectory of the opened netcdf file 54 %ind_opening: operation number advised for beginning (1=checkciv1,2=checkfix1,3=checkpatch1,4=checkciv2,5=checkfix2,6=checkpatch2), 55 %ind_a_opening ind_b_opening chosen pair from the opened netcdf file 56 % Choose default command line output for civ 50 51 %% General settings 57 52 handles.output = hObject; 58 % Update handles structure 59 guidata(hObject, handles); 60 set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display) 61 %default initial parameters 62 filebase=''; % root file name ('filebase'.civ) 63 ext=[]; 64 65 %% read names of the .exe file to adjust the interface according to available binaries 66 %path_uvmat=which('uvmat');% check the path detected for source file uvmat 53 guidata(hObject, handles); % Update handles structure 54 set(hObject,'WindowButtonDownFcn',{'mouse_down',handles}) % allows mouse action with right button (zoom for uicontrol display) 55 56 %% Adjust the GUI according to the binaries available in PARAM.xml 67 57 path_civ=fileparts(which('civ')); %path to civ 68 addpath (path_civ) ; %add the path to UVMAT, (useful in case of change of working directory after civ has been s opened in the working directory)58 addpath (path_civ) ; %add the path to civ, (useful in case of change of working directory after civ has been s opened in the working directory) 69 59 errormsg=[];%default error message 70 60 xmlfile='PARAM.xml'; … … 84 74 msgbox_uvmat('ERROR',errormsg); 85 75 end 86 87 76 test_batch=0;%default: ,no batch mode available 88 77 if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode') … … 101 90 end 102 91 103 %% load the list of previously browsed files in menu Open92 %% load the list of previously browsed files in the upper bar menu Open/ 104 93 dir_perso=prefdir; % path to the directory .matlab for personal data 105 94 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmauvmat_perso.mat' in .matlab … … 113 102 end 114 103 115 %default input parameters: 116 num_i1=1; % set of field i numbers 117 num_i2=1; % set of field i numbers 118 num_j1=1; % set of field j numbers (fields a) 119 num_j2=1; % second set of field j numbers (fields b) 120 %subdir='A'; % subdir for the netcdf result files 121 ind_opening=0; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2) 122 %load the initial parameters if the interface is started from uvmat 123 if exist('param','var')&&isstruct(param)% the interface is opened from uvmat 124 filebase=param.RootName; 125 nom_type_read=param.NomType; 126 num_i1=param.num1; 127 if isnan(num_i1),num_i1=1;end 128 num_i2=param.num2; 129 if isnan(num_i2),num_i2=num_i1;end 130 num_j1=param.num_a; 131 if isnan(num_j1),num_j1=1;end 132 num_j2=param.num_b; 133 if isnan(num_j2),num_j2=num_j1;end 134 subdir=param.SubDir; 135 ind_opening=param.IndOpening; 136 ext=param.ImaExt; 137 end 138 browse.num_i1=num_i1; 139 browse.num_i2=num_i2; 140 browse.num_j1=num_j1; 141 browse.num_j2=num_j2; 142 if ~isempty(ext) && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat 143 set(handles.ImaExt,'String',ext) 144 browse.ext_ima=ext; 145 if exist('nom_type_read','var') 146 browse.nom_type_ima=nom_type_read; % the image nomenclature is stored 147 end 148 elseif isequal(ext,'.nc') 149 if exist('nom_type_read','var') 150 browse.nom_type_nc=nom_type_read;% the netcdf nomenclature is stored 151 end 152 end 153 set(handles.RootName,'String',filebase); 154 set(handles.ImaDoc,'String',ext) 155 156 %initiate advised operations 157 enable_civ1(handles,0) 158 enable_civ2(handles,0) 159 %enable_pair1(handles,'on') 160 enable_fix1(handles,0) 161 enable_patch1(handles,0) 162 enable_fix2(handles,0) 163 enable_patch2(handles,0) 164 set(handles.CheckCiv1,'Value',0) 165 set(handles.CheckFix1,'Value',0) 166 set(handles.CheckPatch1,'Value',0) 167 set(handles.CheckCiv2,'Value',0) 168 set(handles.CheckFix2,'Value',0) 169 set(handles.CheckPatch2,'Value',0) 170 %set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) 171 if isequal(ind_opening,1) 172 set(handles.CheckCiv1,'Value',1) 173 enable_civ1(handles,1) 174 elseif isequal(ind_opening,2) 175 set(handles.CheckFix1,'Value',1) 176 enable_fix1(handles,1) 177 elseif isequal(ind_opening,3) 178 set(handles.CheckPatch1,'Value',1) 179 enable_patch1(handles,1) 180 elseif isequal(ind_opening,4) 181 set(handles.CheckCiv2,'Value',1) 182 enable_civ2(handles,1) 183 elseif isequal(ind_opening,5) 184 set(handles.CheckFix2,'Value',1) 185 enable_fix2(handles,1) 186 set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) 187 set(handles.ListPairCiv2,'Enable','On') 188 set(handles.ListPairCiv2,'Enable','On') 189 enable_pair1(handles,'off') 190 elseif isequal(ind_opening,6) 191 set(handles.CheckPatch2,'Value',1) 192 enable_patch2(handles,1) 104 %% input parameters: 105 % param 106 % filebase=''; % root file name ('filebase'.civ) 107 % ext=[]; 108 % num_i1=1; % set of field i numbers 109 % num_i2=1; % set of field i numbers 110 % num_j1=1; % set of field j numbers (fields a) 111 % num_j2=1; % second set of field j numbers (fields b) 112 % %subdir='A'; % subdir for the netcdf result files 113 % ind_opening=0; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2) 114 % %load the initial parameters if the interface is started from uvmat 115 % if exist('param','var')&&isstruct(param)% the interface is opened from uvmat 116 % filebase=param.RootName; 117 % nom_type_read=param.NomType; 118 % num_i1=param.num1; 119 % if isnan(num_i1),num_i1=1;end 120 % num_i2=param.num2; 121 % if isnan(num_i2),num_i2=num_i1;end 122 % num_j1=param.num_a; 123 % if isnan(num_j1),num_j1=1;end 124 % num_j2=param.num_b; 125 % if isnan(num_j2),num_j2=num_j1;end 126 % subdir=param.SubDir; 127 % ind_opening=param.IndOpening; 128 % ext=param.ImaExt; 129 % end 130 % browse.num_i1=num_i1; 131 % browse.num_i2=num_i2; 132 % browse.num_j1=num_j1; 133 % browse.num_j2=num_j2; 134 % if ~isempty(ext) && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat 135 % set(handles.ImaExt,'String',ext) 136 % % browse.ext_ima=ext; 137 % % if exist('nom_type_read','var') 138 % % browse.nom_type_ima=nom_type_read; % the image nomenclature is stored 139 % % end 140 % % elseif isequal(ext,'.nc') 141 % % if exist('nom_type_read','var') 142 % % browse.nom_type_nc=nom_type_read;% the netcdf nomenclature is stored 143 % % end 144 % end 145 % set(handles.RootName,'String',filebase); 146 % set(handles.ImaDoc,'String',ext) 147 148 149 %% prepare the GUI with parameters from the input file if opened from uvmat 150 if exist('fileinput','var')% && isfield(param,'RootName') && ~isempty(param.RootName) 151 errormsg=display_file_name(handles,fileinput); 152 if ~isempty(errormsg) 153 msgbox_uvmat('ERROR',errormsg) 154 end 155 end 156 157 % %initiate advised operations 158 % enable_civ1(handles,0) 159 % enable_civ2(handles,0) 160 % %enable_pair1(handles,'on') 161 % enable_fix1(handles,0) 162 % enable_patch1(handles,0) 163 % enable_fix2(handles,0) 164 % enable_patch2(handles,0) 165 % set(handles.CheckCiv1,'Value',0) 166 % set(handles.CheckFix1,'Value',0) 167 % set(handles.CheckPatch1,'Value',0) 168 % set(handles.CheckCiv2,'Value',0) 169 % set(handles.CheckFix2,'Value',0) 170 % set(handles.CheckPatch2,'Value',0) 171 % 172 % if isequal(ind_opening,1) 173 % set(handles.CheckCiv1,'Value',1) 174 % enable_civ1(handles,1) 175 % elseif isequal(ind_opening,2) 176 % set(handles.CheckFix1,'Value',1) 177 % enable_fix1(handles,1) 178 % elseif isequal(ind_opening,3) 179 % set(handles.CheckPatch1,'Value',1) 180 % enable_patch1(handles,1) 181 % elseif isequal(ind_opening,4) 182 % set(handles.CheckCiv2,'Value',1) 183 % enable_civ2(handles,1) 184 % elseif isequal(ind_opening,5) 185 % set(handles.CheckFix2,'Value',1) 186 % enable_fix2(handles,1) 193 187 % set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) 194 set(handles.ListPairCiv2,'Enable','On') 195 enable_pair1(handles,'off') 196 end 197 198 % set the range of fields (1:1 by default) and selected pair 199 if isequal(num_i2,num_i1) 200 num_ref_i=num_i1; 201 else 202 num_ref_i=floor((num_i1+num_i2)/2); 203 browse.incr_pair(1)=num_i2-num_i1; 204 browse.incr_pair(2)=0; 205 end 206 if isequal(num_j1,num_j2) 207 if isnan(num_j1) 208 num_ref_j=1; 209 else 210 num_ref_j=num_j1; 211 end 212 else 213 num_ref_j=floor((num_j1+num_j2)/2); 214 browse.incr_pair(2)=num_j2-num_j1; 215 end 216 set(handles.first_i,'String',num2str(num_ref_i)); 217 set(handles.last_i,'String',num2str(num_ref_i)); 218 set(handles.first_j,'String',num2str(num_ref_j)); 219 set(handles.last_j,'String',num2str(num_ref_j)); 220 set(handles.ref_i,'String',num2str(num_ref_i)); 221 set(handles.ref_j,'String',num2str(num_ref_j)); 222 % set(handles.ref_i_civ2,'String',num2str(num_ref_i)); 223 % set(handles.ref_j_civ2,'String',num2str(num_ref_j)); 224 set(handles.RootName,'UserData',browse); 225 if exist('param','var') && isfield(param,'RootName') && ~isempty(param.RootName)%varargin the interface is opened from uvmat 226 RootName_Callback(hObject, eventdata, handles); 227 end 188 % set(handles.ListPairCiv2,'Enable','On') 189 % set(handles.ListPairCiv2,'Enable','On') 190 % enable_pair1(handles,'off') 191 % elseif isequal(ind_opening,6) 192 % set(handles.CheckPatch2,'Value',1) 193 % enable_patch2(handles,1) 194 % set(handles.ListPairCiv2,'Enable','On') 195 % enable_pair1(handles,'off') 196 % end 197 % 198 % % set the range of fields (1:1 by default) and selected pair 199 % if isequal(num_i2,num_i1) 200 % num_ref_i=num_i1; 201 % else 202 % num_ref_i=floor((num_i1+num_i2)/2); 203 % browse.incr_pair(1)=num_i2-num_i1; 204 % browse.incr_pair(2)=0; 205 % end 206 % if isequal(num_j1,num_j2) 207 % if isnan(num_j1) 208 % num_ref_j=1; 209 % else 210 % num_ref_j=num_j1; 211 % end 212 % else 213 % num_ref_j=floor((num_j1+num_j2)/2); 214 % browse.incr_pair(2)=num_j2-num_j1; 215 % end 216 % set(handles.first_i,'String',num2str(num_ref_i)); 217 % set(handles.last_i,'String',num2str(num_ref_i)); 218 % set(handles.first_j,'String',num2str(num_ref_j)); 219 % set(handles.last_j,'String',num2str(num_ref_j)); 220 % set(handles.ref_i,'String',num2str(num_ref_i)); 221 % set(handles.ref_j,'String',num2str(num_ref_j)); 222 % set(handles.RootName,'UserData',browse); 228 223 229 224 %------------------------------------------------------------------------ … … 231 226 function varargout = civ_OutputFcn(hObject, eventdata, handles) 232 227 %------------------------------------------------------------------------ 233 % varargout cell array for returning output args (see VARARGOUT);234 % hObject handle to figure235 % eventdata reserved - to be defined in a future version of MATLAB236 % handles structure with handles and user data (see GUIDATA)237 228 % Get default command line output from handles structure 238 229 varargout{1} = handles.output; 239 230 240 % -------------------------------------------------------------------- 231 %------------------------------------------------------------------------ 232 % --- function activated by the Open/Browse... option in the upper menu bar. 241 233 function MenuBrowse_Callback(hObject, eventdata, handles) 242 243 %get the input file properties234 %------------------------------------------------------------------------ 235 %get the current input root file name to initiate the browser 244 236 filebase=get(handles.RootName,'String'); 245 237 oldfile=''; %default 246 if isempty(filebase)|| isequal(filebase,'')%loads the previously stored file name and set it as default in the file_input box238 if isempty(filebase)|| isequal(filebase,'')%loads the previously stored root file name 247 239 dir_perso=prefdir; 248 240 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); … … 274 266 sizf=size(fileinput); 275 267 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string 276 [path,name,ext]=fileparts(fileinput); 277 testeditxml=0; 278 if isequal(ext,'.xml') 279 testeditxml=1; 280 t_browse=xmltree(fileinput); 281 head_element=get(t_browse,1); 282 if isfield(head_element,'name')&& isequal(head_element.name,'ImaDoc') 283 testeditxml=0; 284 end 285 end 286 if testeditxml==1 || isequal(ext,'.xls') 287 heditxml=editxml({fileinput}); 288 set(heditxml,'Tag','browser') 289 waitfor(heditxml,'Tag','idle') 290 if ~ishandle(heditxml) 291 return 292 end 293 attr=findobj(get(heditxml,'children'),'Tag','CurrentAttributes'); 294 set(handles.browse,'UserData',fileinput)% store for future opening with browser 295 fileinput=get(attr,'UserData'); 296 if ~exist(fileinput,'file') 297 return 298 end 299 end 300 [RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput); 301 filebase=fullfile(RootPath,RootFile); 302 num_i1=str2double(str1); 303 if isnan(num_i1),num_i1=1;end 304 num_i2=str2double(str2); 305 if isnan(num_i2),num_i2=num_i1;end 306 num_j1=stra2num(str_a); 307 if isnan(num_j1),num_j1=1;end 308 num_j2=stra2num(str_b); 309 if isnan(num_j2),num_j2=num_j1;end 310 if isequal(get(handles.ListCompareMode,'Value'),1) 311 browse=[];%initialisation 312 else 313 browse=get(handlesRootName,'UserData'); 314 end 315 browse.num_i1=num_i1; 316 browse.num_i2=num_i2; 317 browse.num_j1=num_j1; 318 browse.num_j2=num_j2; 319 if length(ext)>1 && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat 320 browse.nom_type_ima=nom_type; 321 browse.ext_ima=ext; 322 set(handles.ImaExt,'String',ext) 323 end 324 set(handles.ImaDoc,'String',ext); 325 326 %%%%% read the state of the selected netcdf file to advise default operation 327 if isequal(ext,'.nc') 328 browse.nom_type_nc=nom_type; 329 ind_opening=2;% propose 'fix' as the default option 330 Data=nc2struct(fileinput,'ListGlobalAttribute','CivStage','absolut_time_T0','fix','patch','civ2','fix2'); 331 if ~isempty(Data.CivStage)%test for civ files 332 ind_opening=Data.CivStage; 333 set(handles.ListPairMode,'Value',3) 334 end 335 if ~isempty(Data.absolut_time_T0)%test for civx files 336 set(handles.ListPairMode,'Value',1) 337 if isfield(Data,'fix') && isequal(Data.fix,1) 338 ind_opening=3; 339 end 340 if isequal(Data.patch,1) 341 ind_opening=4; 342 end 343 if isequal(Data.civ2,1) 344 ind_opening=5; 345 end 346 if isequal(Data.fix2,1) 347 ind_opening=6; 348 end 349 testciv=1; %TO SUPPRESS WITH NEW VERSION OF CIVX 350 else 351 ind_opening=3; %GUI used only for patch 352 testciv=0; 353 end 354 set(handles.txt_SubdirCiv1,'String',subdir);%set the default subdir directories for installing the .nc results 355 set(handles.txt_SubdirCiv2,'String',subdir); 356 browse.testciv=testciv; 357 browse.ind_opening=ind_opening; 358 end 359 set(handles.RootName,'String',filebase); 360 set(handles.ImaDoc,'String',ext); 361 if ~isempty(num_i1) 362 ref_i=num_i1; 363 if ~isempty(num_i2) 364 ref_i=floor((ref_i+num_i2)/2);% reference image number corresponding to the file 365 browse.incr_pair(1)=num_i2-num_i1; 366 browse.incr_pair(2)=0; 367 end 368 set(handles.first_i,'String',num2str(ref_i)); 369 set(handles.last_i,'String',num2str(ref_i)); 370 set(handles.ref_i,'String',num2str(ref_i)); 371 % set(handles.ref_i_civ2,'String',num2str(ref_i)) 372 end 373 if isempty(num_j1) 374 set(handles.ref_j,'String','1'); 375 set(handles.ref_j_civ2,'String','1'); 376 else 377 ref_j=num_j1; 378 if ~isempty(num_j2) 379 ref_j=floor((num_j1+num_j2)/2); 380 browse.incr_pair(2)=num_j2-num_j1; 381 end 382 set(handles.first_j,'String',num2str(ref_j)); 383 set(handles.last_j,'String',num2str(ref_j)); 384 set(handles.ref_j,'String',num2str(ref_j)); 385 % set(handles.ref_j_civ2,'String',num2str(ref_j)); 386 end 387 388 % set default operation options 389 enable_civ1(handles,0) 390 enable_civ2(handles,0') 391 enable_pair1(handles,'on') 392 enable_fix1(handles,0) 393 enable_patch1(handles,0) 394 enable_fix2(handles,0) 395 enable_patch2(handles,0) 396 set(handles.CheckCiv1,'Value',0) 397 set(handles.CheckFix1,'Value',0) 398 set(handles.CheckPatch1,'Value',0) 399 set(handles.CheckCiv2,'Value',0) 400 set(handles.CheckFix2,'Value',0) 401 set(handles.CheckPatch2,'Value',0) 402 % set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) 403 if isequal(ind_opening,1) 404 set(handles.CheckCiv1,'Value',1) 405 enable_civ1(handles,'on') 406 elseif isequal(ind_opening,2) 407 set(handles.CheckFix1,'Value',1) 408 enable_fix1(handles,'on') 409 elseif isequal(ind_opening,3) 410 set(handles.CheckPatch1,'Value',1) 411 enable_patch1(handles) 412 elseif isequal(ind_opening,4) 413 set(handles.CheckCiv2,'Value',1) 414 enable_civ2(handles,'on') 415 elseif isequal(ind_opening,5) 416 enable_pair1(handles,'off') 417 set(handles.CheckFix2,'Value',1) 418 enable_fix2(handles) 419 set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) 420 set(handles.ListPairCiv2,'Enable','On') 421 set(handles.ListPairCiv2,'Enable','On') 422 elseif isequal(ind_opening,6) 423 enable_pair1(handles,'off') 424 set(handles.CheckPatch2,'Value',1) 425 enable_patch2(handles) 426 set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) 427 set(handles.ListPairCiv2,'Enable','On') 428 end 429 set(handles.RootName,'UserData',browse);% store information from browser 430 RootName_Callback(hObject, eventdata, handles); 431 268 269 %% prepare the GUI with parameters from the input file if opened from uvmat 270 errormsg=display_file_name(handles,fileinput); 271 if ~isempty(errormsg) 272 msgbox_uvmat('ERROR',erromsg) 273 end 274 275 % 276 % [path,name,ext]=fileparts(fileinput); 277 % testeditxml=0; 278 % if isequal(ext,'.xml') 279 % testeditxml=1; 280 % t_browse=xmltree(fileinput); 281 % head_element=get(t_browse,1); 282 % if isfield(head_element,'name')&& isequal(head_element.name,'ImaDoc') 283 % testeditxml=0; 284 % end 285 % end 286 % if testeditxml==1 || isequal(ext,'.xls') 287 % heditxml=editxml({fileinput}); 288 % set(heditxml,'Tag','browser') 289 % waitfor(heditxml,'Tag','idle') 290 % if ~ishandle(heditxml) 291 % return 292 % end 293 % attr=findobj(get(heditxml,'children'),'Tag','CurrentAttributes'); 294 % set(handles.browse,'UserData',fileinput)% store for future opening with browser 295 % fileinput=get(attr,'UserData'); 296 % if ~exist(fileinput,'file') 297 % return 298 % end 299 % end 300 % [RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput); 301 % filebase=fullfile(RootPath,RootFile); 302 % num_i1=str2double(str1); 303 % if isnan(num_i1),num_i1=1;end 304 % num_i2=str2double(str2); 305 % if isnan(num_i2),num_i2=num_i1;end 306 % num_j1=stra2num(str_a); 307 % if isnan(num_j1),num_j1=1;end 308 % num_j2=stra2num(str_b); 309 % if isnan(num_j2),num_j2=num_j1;end 310 % if isequal(get(handles.ListCompareMode,'Value'),1) 311 % browse=[];%initialisation 312 % else 313 % browse=get(handlesRootName,'UserData'); 314 % end 315 % browse.num_i1=num_i1; 316 % browse.num_i2=num_i2; 317 % browse.num_j1=num_j1; 318 % browse.num_j2=num_j2; 319 % if length(ext)>1 && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat 320 % browse.nom_type_ima=nom_type; 321 % browse.ext_ima=ext; 322 % set(handles.ImaExt,'String',ext) 323 % end 324 % set(handles.ImaDoc,'String',ext); 325 % 326 % 327 % set(handles.RootName,'UserData',browse);% store information from browser 328 % RootName_Callback(hObject, eventdata, handles); 432 329 433 330 % ----------------------------------------------------------------------- … … 436 333 %------------------------------------------------------------------------ 437 334 fileinput=get(handles.MenuFile_1,'Label'); 438 display_file_name(hObject, eventdata, handles,fileinput) 335 errormsg=display_file_name(handles,fileinput); 336 if ~isempty(errormsg) 337 msgbox_uvmat('ERROR',erromsg) 338 end 439 339 440 340 % ----------------------------------------------------------------------- … … 443 343 %------------------------------------------------------------------------ 444 344 fileinput=get(handles.MenuFile_2,'Label'); 445 display_file_name(hObject, eventdata, handles,fileinput) 446 345 errormsg=display_file_name(handles,fileinput); 346 if ~isempty(errormsg) 347 msgbox_uvmat('ERROR',erromsg) 348 end 447 349 % ----------------------------------------------------------------------- 448 350 % --- Open again the file whose name has been recorded in MenuFile_3 … … 450 352 %------------------------------------------------------------------------ 451 353 fileinput=get(handles.MenuFile_3,'Label'); 452 display_file_name(hObject, eventdata, handles,fileinput) 453 354 errormsg=display_file_name(handles,fileinput); 355 if ~isempty(errormsg) 356 msgbox_uvmat('ERROR',erromsg) 357 end 454 358 % ----------------------------------------------------------------------- 455 359 % --- Open again the file whose name has been recorded in MenuFile_4 … … 457 361 %------------------------------------------------------------------------ 458 362 fileinput=get(handles.MenuFile_4,'Label'); 459 display_file_name(hObject, eventdata, handles,fileinput) 460 363 errormsg=display_file_name(handles,fileinput); 364 if ~isempty(errormsg) 365 msgbox_uvmat('ERROR',erromsg) 366 end 461 367 % ----------------------------------------------------------------------- 462 368 % --- Open again the file whose name has been recorded in MenuFile_5 … … 464 370 %------------------------------------------------------------------------ 465 371 fileinput=get(handles.MenuFile_5,'Label'); 466 display_file_name(hObject, eventdata, handles,fileinput) 467 372 errormsg=display_file_name(handles,fileinput); 373 if ~isempty(errormsg) 374 msgbox_uvmat('ERROR',erromsg) 375 end 468 376 %------------------------------------------------------------------------ 469 377 function ImaDoc_Callback(hObject, eventdata, handles) … … 476 384 %------------------------------------------------------------------------ 477 385 filebase=get(handles.RootName,'String'); 478 display_file_name(hObject, eventdata, handles,filebase) 479 480 %------------------------------------------------------------------------ 481 function display_file_name(hObject, eventdata, handles,filebase) 386 errormsg=display_file_name(handles,filebase); 387 if ~isempty(errormsg) 388 msgbox_uvmat('ERROR',erromsg) 389 end 390 %------------------------------------------------------------------------ 391 function errormsg=display_file_name(handles,fileinput) 482 392 %------------------------------------------------------------------------ 483 393 set(handles.ListCompareMode,'Visible','on') 394 errormsg='';%default empty error message 395 396 %% enable RUN, BATCH button and 'status' display 397 set(handles.RUN, 'Enable','On') 398 set(handles.RUN,'BackgroundColor',[1 0 0])%set RUN button to red color 399 set(handles.BATCH,'Enable','On') 400 set(handles.BATCH,'BackgroundColor',[1 0 0])%set BATCH button to red color 401 if isfield(handles,'status') 402 set(handles.status,'Value',0); %suppress the 'status' display 403 status_Callback([], [], handles) 404 end 405 406 % %% default first_i and j and increments 407 % first_i=str2double(get(handles.first_i,'String'));%value possibly set by uvmat_Opening 408 % if isnan(first_i)|| first_i < 1 409 % first_i=1; %default first_i 410 % end 411 % last_i=str2double(get(handles.last_i,'String')); 412 % if isnan(last_i)|| last_i < first_i 413 % last_i=first_i; %default last_i 414 % end 415 % first_j=str2double(get(handles.first_j,'String')); 416 % if isnan(first_j)|| first_j < 1 417 % first_j=1; %default first_j 418 % end 419 % last_j=str2double(get(handles.last_j,'String')); 420 % if isnan(last_j)|| last_j < first_j 421 % last_j=first_j; %default last_j 422 % end 423 % incr_i=str2double(get(handles.incr_i,'String')); 424 % if isnan(incr_i) || incr_i < 1; 425 % set(handles.incr_i,'String','1') %default incr_i 426 % end 427 % incr_j=str2double(get(handles.incr_j,'String')); 428 % if isnan(incr_j) || incr_j < 1; 429 % set(handles.incr_j,'String','1') %default incr_j 430 % end 431 432 %% determine nomenclature types and extension of the input files 484 433 ext_ima='';%default 485 nom_type_ima=[];%default 486 field_count=1;%default 487 nom_type_nc=[]; 434 nom_type_ima='';%default 435 nom_type_nc=''; 436 [RootPath,FileName,i1_str,i2_str,j1_str,j2_str,ext_input,nom_type_input,subdir]=name2display(fileinput); 437 RootName=fullfile(RootPath,FileName); 438 set(handles.RootName,'String',RootName) 439 num_ref_i=str2double(i1_str); 440 num_ref_j=str2double(j1_str); 441 browse=[];%default 442 if ~isempty(imformats(ext_input(2:end)))||strcmp(lower(ext_input),'.avi')% if the extension corresponds to an image or movie format recognized by Matlab 443 ext_ima=ext_input; 444 nom_type_ima=nom_type_input; 445 else %case of netcdf input file, look for corresponding images 446 nom_type_nc=nom_type_input; 447 %TODO: read the image name in the netcdf file (if documented) 448 dirima='';%default 449 %look for double image series '_i_j' 450 dirima=dir([RootName '_' i1_str '_' j1_str '.*']); 451 if isempty(dirima) 452 % look for images series with sub marker '_' 453 dirima=dir([RootName '_*' i1_str '.*']); 454 if isempty(dirima) 455 % look for other images series 456 dirima=dir([RootName '*' i1_str '.*']); 457 if isempty(dirima) 458 % look for other images series witth letter appendix 459 appendix=char(96+j1_str); 460 dirima=dir([RootName '*' i1_str appendix '.*']); 461 end 462 end 463 end 464 for ilist=1:numel(dirima) 465 [pp,ff,i1,i2,j1,j2,ext_list,nom_type_list]=name2display(dirima(ilist).name); 466 form=imformats(ext_list(2:end)); 467 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 468 ext_ima=ext_list; 469 nom_type_ima=nom_type_list; 470 num_i1=str2double(i1); 471 num_j1=str2double(j1); 472 num_i2=str2double(i2); 473 num_j2=str2double(j2); 474 475 % set the range of fields (1:1 by default) and selected pair 476 if isequal(num_i2,num_i1)||isnan(num_i2) 477 num_ref_i=num_i1; 478 else 479 num_ref_i=floor((num_i1+num_i2)/2); 480 browse.incr_pair(1)=num_i2-num_i1; 481 browse.incr_pair(2)=0; 482 end 483 if isequal(num_j1,num_j2)||isnan(num_j2) 484 if isnan(num_j1) 485 num_ref_j=1; 486 else 487 num_ref_j=num_j1; 488 end 489 else 490 num_ref_j=floor((num_j1+num_j2)/2); 491 browse.incr_pair(2)=num_j2-num_j1; 492 end 493 break 494 end 495 end 496 end 497 set(handles.RootName,'UserData',browse); 498 % ext_imadoc=get(handles.ImaDoc,'String'); 499 % browse=get(handles.RootName,'UserData');%default 500 % if isfield(browse,'nom_type_ima') 501 % nom_type_ima=browse.nom_type_ima;% get an image nomenclature type already determined by an input image name 502 % end 503 % if isfield(browse,'ext_ima') 504 % ext_ima=browse.ext_ima; 505 % end 506 % if isfield(browse,'nom_type_nc') 507 % nom_type_nc=browse.nom_type_nc;% get an image nomenclature type already determined by an input image name 508 % end 509 % if isfield(browse,'num_i1') 510 % field_count=browse.num_i1;% get an image index type already determined by an input file 511 % end 512 %set(handles.civ,'UserData',[]); %refresh list of previous civ files (for STATUS) 513 514 515 %% look for an image documentation file 516 ext_imadoc='';%default 517 if exist([RootName '.xml'],'file') 518 ext_imadoc='.xml'; 519 elseif exist([RootName '.civxml'],'file') 520 ext_imadoc='.civxml'; 521 elseif exist([RootName '.civ'],'file') 522 ext_imadoc='.civ'; 523 elseif exist([RootName '.avi'],'file') 524 ext_imadoc='.avi'; 525 elseif exist([RootName '.AVI'],'file') 526 ext_imadoc='.AVI'; 527 end 528 set(handles.ImaDoc,'String',ext_imadoc)% display the extension name for the image documentation file used 529 set(handles.ImaDoc,'BackgroundColor',[1 1 0]) 530 drawnow 531 %%%%%%%% read image documentation file %%%%%%%%%%%%%%%%%%%%%%%%%%% 532 mode=''; %default 488 533 time=[]; 489 534 TimeUnit='frame'; %default … … 491 536 pxcmx_search=[];%default 492 537 pxcmy_search=[];%default 493 494 ext_imadoc=get(handles.ImaDoc,'String'); 495 browse=get(handles.RootName,'UserData');%default 496 if isfield(browse,'nom_type_ima') 497 nom_type_ima=browse.nom_type_ima;% get an image nomenclature type already determined by an input image name 498 end 499 if isfield(browse,'ext_ima') 500 ext_ima=browse.ext_ima; 501 end 502 if isfield(browse,'nom_type_nc') 503 nom_type_nc=browse.nom_type_nc;% get an image nomenclature type already determined by an input image name 504 end 505 if isfield(browse,'num_i1') 506 field_count=browse.num_i1;% get an image index type already determined by an input file 507 end 508 set(handles.civ,'UserData',[]); %refresh list of previous civ files (for STATUS) 509 510 %default first_i and j and increments 511 first_i=str2double(get(handles.first_i,'String'));%value possibly set by uvmat_Opening 512 if isnan(first_i)|| first_i < 1 513 first_i=1; %default first_i 514 end 515 last_i=str2double(get(handles.last_i,'String')); 516 if isnan(last_i)|| last_i < first_i 517 last_i=first_i; %default last_i 518 end 519 first_j=str2double(get(handles.first_j,'String')); 520 if isnan(first_j)|| first_j < 1 521 first_j=1; %default first_j 522 end 523 last_j=str2double(get(handles.last_j,'String')); 524 if isnan(last_j)|| last_j < first_j 525 last_j=first_j; %default last_j 526 end 527 incr_i=str2double(get(handles.incr_i,'String')); 528 if isnan(incr_i) || incr_i < 1; 529 set(handles.incr_i,'String','1') %default incr_i 530 end 531 incr_j=str2double(get(handles.incr_j,'String')); 532 if isnan(incr_j) || incr_j < 1; 533 set(handles.incr_j,'String','1') %default incr_j 534 end 535 dt=[];%default 536 testmode=0;%default 537 nbfield=[]; %default 538 nburst=[];%default 539 pxcmx=1; 540 pxcmy=1; 541 542 %look for an image documentation file 543 if ~strcmp(ext_imadoc,'.xml') && ~strcmp(ext_imadoc,'.civ')&& ~strcmpi(ext_imadoc,'.avi') 544 if exist([filebase '.xml'],'file') 545 ext_imadoc='.xml'; 546 elseif exist([filebase '.civxml'],'file') 547 ext_imadoc='.civxml'; 548 elseif exist([filebase '.civ'],'file') 549 ext_imadoc='.civ'; 550 elseif exist([filebase '.avi'],'file') 551 ext_imadoc='.avi'; 552 elseif exist([filebase '.AVI'],'file') 553 ext_imadoc='.AVI'; 554 end 555 set(handles.ImaDoc,'String',ext_imadoc) 556 end 557 558 %%%%%%%% read image documentation file %%%%%%%%%%%%%%%%%%%%%%%%%%% 559 mode=''; %default 560 set(handles.ImaDoc,'BackgroundColor',[1 1 0]) 561 drawnow 562 if isequal(ext_imadoc,'.civxml') || isequal(ext_imadoc,'.xml')|| isequal(ext_imadoc,'.civ') 563 set(handles.ref_i,'Visible','On')%use a reference index 564 set(handles.ref_j,'Visible','On') 565 elseif isequal(ext_imadoc,'.avi') || isequal(ext_imadoc,'.AVI') 566 set(handles.ref_j,'Visible','Off') 567 else 568 set(handles.ref_i,'Visible','Off') 569 set(handles.ref_j,'Visible','Off') 570 end 571 testima_xml=0; 538 % first_i=1;%default 539 % last_i=1;%default 572 540 if isequal(ext_imadoc,'.civxml')%TO ABANDON 573 [nbfield,nbfield2,time]=read_civxml([ filebase '.civxml']);541 [nbfield,nbfield2,time]=read_civxml([RootName '.civxml']); 574 542 mode='pair j1-j2'; 575 543 if isempty(nom_type_ima)% dtermine types by default if not already selected by browser or uvmat … … 577 545 end 578 546 elseif isequal(ext_imadoc,'.xml') 579 [XmlData,warntext]=imadoc2struct([ filebase '.xml']);547 [XmlData,warntext]=imadoc2struct([RootName '.xml']); 580 548 ext_ima_read=[]; 581 549 nom_type_read=[]; 582 550 if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file 583 551 [PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName); 584 fullname=fullfile(fileparts( filebase),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file,552 fullname=fullfile(fileparts(RootName),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file, 585 553 if ~exist(fullname,'file') 586 554 msgbox_uvmat('WARNING',['FirstImage ' fullname ' defined in the xml file does not exist']) … … 603 571 TimeUnit=XmlData.TimeUnit; 604 572 end 605 if isfield(XmlData,'Npx')606 npx=XmlData.Npx;607 npy=XmlData.Npy;608 end609 573 pxcmx_search=1; 610 574 pxcmy_search=1; … … 621 585 end 622 586 elseif strcmp(ext_imadoc,'.civ')% case of .civ image documentation file 623 [error,time,TimeUnit,mode,npx,npy]=read_imatext([ filebase '.civ']);624 if error==2, msgbox_uvmat('WARNING',['no file ' filebase '.civ']);587 [error,time,TimeUnit,mode,npx,npy]=read_imatext([RootName '.civ']); 588 if error==2, msgbox_uvmat('WARNING',['no file ' RootName '.civ']); 625 589 elseif error==1, msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file'); 626 590 end … … 632 596 set(handles.ListPairMode,'String',{'series(Di)'}) 633 597 dt=0.04;%default 634 if exist([ filebase ext_imadoc],'file')==2635 info=aviinfo([ filebase ext_imadoc]);%read infos on the avi movie598 if exist([RootName ext_imadoc],'file')==2 599 info=aviinfo([RootName ext_imadoc]);%read infos on the avi movie 636 600 dt=1/info.FramesPerSecond;%time interval between successive frames 637 601 nbfield=info.NumFrames;%number of frames … … 642 606 set(handles.ImaDoc,'String',''); %xml file not used for timing 643 607 end 644 set(handles.ImaDoc,'BackgroundColor',[1 1 1]) 645 646 %get the imabe nomenclature type if not defined by the input file nor by the xml file 647 dirima=[];%default 648 if isempty(nom_type_ima) 649 %look for double image series '_i_j' 650 dirima=dir([filebase '_' num2str(first_i) '_' num2str(first_j) '.*']); 651 if isempty(dirima) 652 % look for images series with sub marker '_' 653 dirima=dir([filebase '_*' num2str(first_i) '.*']); 654 if isempty(dirima) 655 % look for other images series 656 dirima=dir([filebase '*' num2str(first_i) '.*']); 657 if isempty(dirima) 658 % look for other images series witth letter appendix 659 appendix=char(96+first_j); 660 dirima=dir([filebase '*' num2str(first_i) appendix '.*']); 661 end 662 end 663 end 664 end 665 for ilist=1:numel(dirima) 666 [pp,ff,fc,str2,str_a,str_b,ext_list,nom_type_list]=name2display(dirima(ilist).name); 667 form=imformats(ext_list(2:end)); 668 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 669 ext_ima=ext_list; 670 nom_type_ima=nom_type_list; 671 break 672 end 673 end 674 % no image documentation file found: look for a series of existing files,images by priority or .nc files 675 if isempty(nom_type_ima) 676 ext_search=ext_imadoc; 677 nom_type_search=nom_type_nc; 678 else 679 ext_search=ext_ima; 680 nom_type_search=nom_type_ima; 681 end 682 if isempty(time) && ~strcmp(nom_type_search,'none') && ~strcmp(nom_type_search,'') && ~strcmp(nom_type_search,'*') 683 subdir=get(handles.txt_SubdirCiv1,'String'); 684 incr_pair=[0 0];%default 685 if isfield(browse,'incr_pair') 686 incr_pair=browse.incr_pair; 687 end 688 % nbdetect=0;%test of detected images 689 field_i=browse.num_i2; 690 imagename=name_generator(filebase,field_i,1,ext_search,nom_type_search); 691 imagename_plus=''; 692 idetect=1; 693 while idetect %look for the maximum file number in the series 694 imagename_plus=name_generator(filebase,field_i+1,1,ext_search,nom_type_search); 695 idetect=(exist(imagename_plus,'file')==2)&& ~strcmp(imagename,imagename_plus); 696 if idetect 697 field_i=field_i+1; 698 end 699 %SEE CASE OF NETCDF FILES 700 % nbdetect=nbdetect+(exist(imagename,'file')==2); 701 end 702 nbfield=field_i;% last detected field number 703 field_i=browse.num_i1;%look for the minimum file number in the series 704 imagename_min=''; 705 idetect=1; 706 while idetect==1 707 imagename_min=name_generator(filebase,field_i-1,1,ext_search,nom_type_search); 708 idetect=(exist(imagename_min,'file')==2)&& ~strcmp(imagename,imagename_min); 709 if idetect 710 field_i=field_i-1; 711 end 712 end 713 first_i=max(field_i,1); 714 if numel(regexp(nom_type_search,'\D'))>=1%two indices i and j 715 field_i=browse.num_i1; 716 field_j=browse.num_j2; 717 imagename=name_generator(filebase,field_i,field_j,ext_search,nom_type_search); 718 imagename_plus=''; 719 jdetect=1; 720 while jdetect==1 %look for the maximum file number in the series 721 imagename_plus=name_generator(filebase,field_i,field_j+1,ext_search,nom_type_search); 722 jdetect=(exist(imagename_plus,'file')==2)&& ~strcmp(imagename,imagename_plus); 723 if jdetect 724 field_j=field_j+1; 725 end 726 %SEE CASE OF NETCDF FILES 727 % nbdetect=nbdetect+(exist(imagename,'file')==2); 728 end 729 nbfield2=field_j;% last detected field number 730 end 731 732 %determine the set of times and possible intervals for CIV 733 % dt=(1/1000)*str2double(get(handles.dt,'String')); 734 time=(0:nbfield-1)';% time=file index -1 by default 735 if numel(regexp(nom_type_search,'\D'))>=1%two indices i and j 736 [x,y]=meshgrid(0:nbfield2-1,0:nbfield-1); 737 time=x+y; 738 end 739 end 740 741 if exist('time','var') 608 set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box to yellow color 609 610 611 %% timing display 612 %show the reference image edit box if relevant (not needed for movies or in the absence of time information 613 % if isempty(time)|| strcmp(nom_type_ima,'*')||strcmp(nom_type_ima,'') 614 % % set(handles.ref_i,'Visible','Off')% do not use a reference index to display time intervals 615 % % set(handles.ref_j,'Visible','Off') 616 % first_i=1; 617 % last_i=1; 618 % else 619 % % set(handles.ref_i,'Visible','On')%use a reference index 620 % % set(handles.ref_j,'Visible','On') 621 % set(handles.ref_i,'String',i1_str) 622 % set(handles.ref_j,'String',j1_str) 623 % end 624 if ~isempty(time) 742 625 if size(time,1)+size(time,2)>=3 % if there are at least two time values to define dt 743 626 nbfield=size(time,1); … … 745 628 set(handles.ImaDoc,'UserData',time); %store the set of times 746 629 set(handles.dt_unit,'String',['dt in m' TimeUnit]); 747 % set(handles.dt_unit_civ2,'String',['dt in m' TimeUnit]);748 630 set(handles.TimeUnit,'String',TimeUnit); 749 631 set(handles.nb_field,'String',num2str(nbfield)); … … 753 635 set(handles.CoordUnit,'String',CoordUnit) 754 636 set(handles.SearchRange,'UserData',[pxcmx_search pxcmy_search]); 755 % npxy=[npy npx];756 637 set(handles.ImaExt,'String',ext_ima) 757 set(handles.first_i,'String',num2str(first_i)); 758 set(handles.last_i,'String',num2str(last_i));% 759 set(handles.first_j,'String',num2str(first_j)); 760 set(handles.last_j,'String',num2str(last_j));% 638 set(handles.ref_i,'String',num2str(num_ref_i)) 639 set(handles.first_i,'String',num2str(num_ref_i)); 640 set(handles.last_i,'String',num2str(num_ref_i));% 641 set(handles.ref_j,'String',num2str(num_ref_j)) 642 set(handles.first_j,'String',num2str(num_ref_j)); 643 set(handles.last_j,'String',num2str(num_ref_j));% 761 644 browse.nom_type_ima=nom_type_ima; 762 645 set(handles.RootName,'UserData',browse)% store the nomenclature type 646 647 %% set the civ options depending on the input file content 648 ind_opening=0;%default 649 if isequal(ext_input,'.nc') 650 browse.nom_type_nc=nom_type_input; 651 ind_opening=2;% propose 'fix' as the default option 652 Data=nc2struct(fileinput,'ListGlobalAttribute','CivStage','absolut_time_T0','fix','patch','civ2','fix2'); 653 if ~isempty(Data.CivStage)%test for civ files 654 ind_opening=Data.CivStage; 655 set(handles.ListPairMode,'Value',3) 656 end 657 end 658 ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'}; 659 for index = 1:ind_opening 660 set(handles.(ListOptions{index}),'value',0) 661 end 662 for index = ind_opening+1:length(ListOptions) 663 set(handles.(ListOptions{index}),'value',1) 664 end 665 update_CivOptions(handles) 666 763 667 764 668 %% set the menus of image pairs and default selection for civ %%%%%%%%%%%%%%%%%%% … … 777 681 end 778 682 779 780 %% desable status and RUN button 781 set(handles.RUN, 'Enable','On') 782 set(handles.RUN,'BackgroundColor',[1 0 0]) 783 set(handles.BATCH,'Enable','On') 784 set(handles.BATCH,'BackgroundColor',[1 0 0]) 785 if isfield(handles,'status') 786 set(handles.status,'Value',0);%suppress status display 787 status_Callback(hObject, eventdata, handles) 788 end 789 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('MATLAB'); 798 Release=txt.Release; 799 relnumb=str2double(Release(3:4)); 800 if relnumb >= 14 801 save (profil_perso,'RootPath','-V6'); %store the root name for future opening of uvmat 802 else 803 save (profil_perso,'RootPath'); %store the root name for future opening of uvmat 804 end 805 end 806 807 %% update the subdir 808 pathdir=fileparts(filebase);%path to the current xml file 809 listot=dir(pathdir); 683 %% update the subdirectory display 684 listot=dir(RootPath); 810 685 idir=0; 811 686 listdir={''};%default … … 819 694 end 820 695 end 696 Value=find(strcmp(subdir,listdir));%search the index of subdir in the cell listdir 697 if isempty(Value) 698 ValueCiv1=get(handles.ListSubdirCiv1,'Value'); 699 if ValueCiv1>numel(listdir) 700 ValueCiv1=1; 701 end 702 set(handles.ListSubdirCiv1,'Value',ValueCiv1) 703 ValueCiv2=get(handles.ListSubdirCiv2,'Value'); 704 if ValueCiv2>numel(listdir) 705 ValueCiv2=1; 706 end 707 set(handles.ListSubdirCiv2,'Value',ValueCiv2) 708 else 709 set(handles.ListSubdirCiv1,'Value',Value) 710 set(handles.ListSubdirCiv2,'Value',Value) 711 end 821 712 set(handles.ListSubdirCiv1,'Value',1) 822 713 set(handles.ListSubdirCiv2,'Value',1) … … 824 715 set(handles.ListSubdirCiv2,'String',[listdir;'new...']) 825 716 if isempty(listdir) 826 dirname= listdir{1};827 else 828 dirname= 'CIV'; %default civ directory name717 dirname='CIV'; 718 else 719 dirname=listdir{1}; %default civ directory name 829 720 end 830 721 set(handles.txt_SubdirCiv1,'String',dirname) 831 722 set(handles.txt_SubdirCiv2,'String',dirname) 832 %check wether the current subdir exists: 833 % txt_SubdirCiv1=get(handles.txt_SubdirCiv1,'String'); 834 % txt_SubdirCiv2=get(handles.txt_SubdirCiv2,'String'); 835 836 ListPairMode_Callback(hObject, eventdata, handles) 723 724 725 %% list the possible index pairs, depending on the option set in ListPairMode 726 ListPairMode_Callback([], [], handles) 727 728 %% store the root input filename for future opening 729 dir_perso=prefdir; 730 profil_perso=fullfile(prefdir,'uvmat_perso.mat'); 731 % RootPath=fileparts(RootName); 732 if exist(profil_perso,'file') 733 save (profil_perso,'RootPath','-append'); %store the root name for future opening of uvmat 734 else 735 txt=ver('MATLAB'); 736 Release=txt.Release; 737 relnumb=str2double(Release(3:4)); 738 if relnumb >= 14 739 save (profil_perso,'RootPath','-V6'); %store the root name for future opening of uvmat 740 else 741 save (profil_perso,'RootPath'); %store the root name for future opening of uvmat 742 end 743 end 837 744 838 745 %------------------------------------------------------------------------ … … 1068 975 testpair=0; 1069 976 % case with no checkciv1 operation, netcdf files need to exist for reading 1070 if get(handles.CheckCiv1,'Value')==0%977 if ~get(handles.CheckCiv1,'Value') % 1071 978 if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir') 1072 979 msgbox_uvmat('ERROR',['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist']); … … 1263 1170 displ_pair={''}; %default 1264 1171 select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs 1265 if get(handles.CheckCiv2,'Value')==0 & get(handles.CheckCiv1,'Value')==0 & get(handles.CheckFix1,'Value')==0 & get(handles.CheckPatch1,'Value')==0%&...1172 if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value') 1266 1173 if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir') 1267 1174 errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist']) … … 2294 2201 2295 2202 if isempty(filebase)||isequal(filebase,'') 2296 msgbox_uvmat('ERROR',' no input files')2203 msgbox_uvmat('ERROR','please open an image with the upper menu option Open/Browse...') 2297 2204 return 2298 2205 end … … 3170 3077 checkbox(4)=get(handles.CheckCiv2,'Value'); 3171 3078 checkbox(5)=get(handles.CheckFix2,'Value'); 3172 checkbox(6)=get(handles.CheckPatch2,'Value') ;3079 checkbox(6)=get(handles.CheckPatch2,'Value') 3173 3080 ind_selected=find(checkbox); 3174 3081 if ~isempty(ind_selected) … … 3207 3114 end 3208 3115 3209 % end3210 3211 % set(handles.(operations(ind_selected)),'Visible','on')3212 %3213 % if state3214 % RootName=get(handles.RootName,'String');3215 % if isempty(RootName)3216 % msgbox_uvmat('ERROR','No input file')3217 % return3218 % end3219 % set(handles.Civ1,'Visible','on')3220 % set(handles.PairIndices,'Visible','on')3221 % else3222 % set(handles.Civ1,'Visible','off')3223 % end3224 3225 3226 3116 %------------------------------------------------------------------------ 3227 3117 function first_i_Callback(hObject, eventdata, handles) 3228 3118 %------------------------------------------------------------------------ 3229 % last_i_Callback(hObject, eventdata, handles)3230 3119 first_i=str2double(get(handles.first_i,'String')); 3231 % last_i=str2num(get(handles.last_i,'String'));3232 % ref_i=ceil((first_i+last_i)/2);3233 3120 set(handles.ref_i,'String', num2str(first_i))% reference index for pair dt = first index 3234 %set(handles.ref_i_civ2,'String', num2str(first_i))% reference index for pair dt = first index3235 3121 ref_i_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) 3236 3122
Note: See TracChangeset
for help on using the changeset viewer.