- Timestamp:
- May 5, 2012, 6:34:46 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field.m
r406 r408 71 71 case{'vort','div','strain'}% needs spatial derivatives spatial derivatives 72 72 check_der=1; 73 case {'velocity','norm_vel' };73 case {'velocity','norm_vel','ima_cor'}; 74 74 otherwise 75 75 check_calc(ilist)=0; -
trunk/src/get_file_series.m
r400 r408 26 26 end 27 27 % Pairs=Param.Pairs; 28 r.mode='';29 if isfield(Param,'Pairs') && isfield (Param.Pairs,'list_pair_civ')30 r=regexp(Param.Pairs.list_pair_civ,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names');31 if isempty(r)32 r=regexp(Param.Pairs.list_pair_civ,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names');33 end34 28 35 % TODO case of free pairs:36 %r=regexp(pair_string,'.*\D(?<num1>[\d+|*])(?<delim>[-||])(?<num2>[\d+|*])','names');37 end38 if isempty(r.mode)39 r.num1='';40 r.num2='';41 end42 29 43 30 %% determine the list of input file names … … 45 32 46 33 for iview=1:size(InputTable,1) 34 r.mode=''; 35 if isfield (Param.IndexRange,'PairString') 36 r=regexp(Param.IndexRange.PairString{iview,1},'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names'); 37 if isempty(r) 38 r=regexp(Param.IndexRange.PairString{iview,1},'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names'); 39 end 40 % TODO case of free pairs: 41 %r=regexp(pair_string,'.*\D(?<num1>[\d+|*])(?<delim>[-||])(?<num2>[\d+|*])','names'); 42 end 43 if isempty(r.mode) 44 r.num1=''; 45 r.num2=''; 46 end 47 47 [i1_series{iview},i2_series{iview},j1_series{iview},j2_series{iview}]=find_file_indices(ref_i,ref_j,str2num(r.num1),str2num(r.num2),r.mode); 48 48 %case of pairs (.nc files) -
trunk/src/proj_field.m
r402 r408 82 82 function [ProjData,errormsg]=proj_field(FieldData,ObjectData) 83 83 errormsg='';%default 84 % if ~exist('FieldName','var') 85 % FieldName=''; 86 % end 84 ProjData=[]; 85 87 86 %% case of no projection (object is used only as graph display) 88 87 if isfield(ObjectData,'ProjMode') && (isequal(ObjectData.ProjMode,'none')||isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside')) 89 ProjData=[];90 88 return 91 89 end 92 90 91 %% check coincidence of coordinate units 92 if isfield(FieldData,'CoordUnit') && isfield(ObjectData,'CoordUnit')&&~strcmp(FieldData.CoordUnit,ObjectData.CoordUnit) 93 errormsg='inconsistent coord units for field and projection object'; 94 return 95 end 96 93 97 %% in the absence of object Type or projection mode, or object coordinaes, the input field is just tranfered without change 94 98 if ~isfield(ObjectData,'Type')||~isfield(ObjectData,'ProjMode') … … 1091 1095 if testbound 1092 1096 indcut=find(testin); 1097 if isempty(indcut) 1098 errormsg='data outside the bounds of the projection object'; 1099 return 1100 end 1093 1101 for ivar=VarIndex 1094 1102 VarName=FieldData.ListVarName{ivar}; … … 1105 1113 switch ObjectData.ProjMode 1106 1114 case 'projection' 1107 %the list of dimension1108 %ProjData.ListDimName=[ProjData.ListDimName FieldData.VarDimName(VarIndex(1))];%add the point index to the list of dimensions1109 %ProjData.DimValue=[ProjData.1110 %length(coord_X)];1111 1112 1115 for ivar=VarIndex %transfer variables to the projection plane 1113 1116 VarName=FieldData.ListVarName{ivar}; … … 1147 1150 if ~isequal(ivar_FF,0) 1148 1151 VarName_FF=FieldData.ListVarName{ivar_FF}; 1149 eval(['indsel=find(FieldData.' VarName_FF '==0);'])1152 indsel=find(FieldData.(VarName_FF)==0); 1150 1153 coord_X=coord_X(indsel); 1151 1154 coord_Y=coord_Y(indsel); -
trunk/src/series.m
r399 r408 30 30 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 31 31 32 %------------------------------------------------------------------------ 33 %------------------------------------------------------------------------ 34 % I - MAIN FUNCTION series 35 %------------------------------------------------------------------------ 36 %------------------------------------------------------------------------ 32 37 function varargout = series(varargin) 33 38 … … 63 68 drawnow 64 69 set(hObject,'Units','pixels') 70 set(handles.PairString,'ColumnEditable',logical(0)) 71 set(handles.PairString,'ColumnFormat',{'char'}) 72 set(handles.PairString,'ColumnWidth',{60}) 73 set(handles.PairString,'Data',{''}) 65 74 % set(0,'Units','pixels') 66 75 % screensize=get(0,'ScreenSize'); %screen size in pixels … … 112 121 if isfield(param,'FileName') 113 122 if isfield(param,'FileName_1') 114 update_rootfile(handles,param.FileName_1,0)115 update_rootfile(handles,param.FileName,1)123 display_file_name(handles,param.FileName_1,0) 124 display_file_name(handles,param.FileName,1) 116 125 else 117 update_rootfile(handles,param.FileName,0)126 display_file_name(handles,param.FileName,0) 118 127 end 119 128 end … … 126 135 end 127 136 128 %REFRESH_INDICES_Callback(hObject, eventdata, handles)129 137 %loads the information stored in prefdir to initiate the list of ACTION functions 130 138 fct_menu={'check_data_files';'aver_stat';'time_series';'merge_proj';'clean_civ_cmx'}; … … 195 203 ACTION_Callback(hObject, eventdata, handles) 196 204 197 %-------------------------------------------------------------- 205 %------------------------------------------------------------------------ 198 206 % --- Outputs from this function are returned to the command line. 199 %-----------------------------------------------------------------200 207 function varargout = series_OutputFcn(hObject, eventdata, handles) 208 %------------------------------------------------------------------------ 201 209 % varargout cell array for returning output args (see VARARGOUT); 202 210 % hObject handle to figure … … 206 214 varargout{1} = handles.output; 207 215 208 % -------------------------------------------------------------------- 216 %------------------------------------------------------------------------ 217 %------------------------------------------------------------------------ 218 % II - FUNCTIONS FOR INTRODUCING THE INPUT FILES 219 % automatically sets the global properties when the rootfile name is introduced 220 % then activate the view-field action if selected 221 % it is activated either by clicking on the RootPath window or by the 222 % browser 223 %------------------------------------------------------------------------ 224 %------------------------------------------------------------------------ 209 225 function MenuBrowse_Callback(hObject, eventdata, handles) 226 %------------------------------------------------------------------------ 210 227 InputTable=get(handles.InputTable,'Data'); 211 228 RootPathCell=InputTable(:,1); 212 229 SubDirCell=InputTable(:,2); 213 230 RootFileCell=InputTable(:,3); 214 %RootPathCell=get(handles.RootPath,'String');215 %SubDirCell=get(handles.SubDir,'String');216 %RootFileCell=get(handles.RootFile,'String');217 231 oldfile=''; %default 218 232 if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box … … 242 256 'Pick a file',oldfile); 243 257 fileinput=[PathName FileName];%complete file name 244 %testblank=findstr(fileinput,' ');%look for blanks245 % if ~isempty(testblank)246 % errordlg('forbidden input file name: contain blanks')247 % return248 % end249 258 sizf=size(fileinput); 250 259 if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end … … 252 261 SeriesData=[];%dfault 253 262 if isequal(ext,'.xml') 254 warndlg_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer263 msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 255 264 elseif isequal(ext,'.xls') 256 warndlg_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer265 msg_box_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 257 266 else 258 update_rootfile(handles,fileinput,0)267 display_file_name(handles,fileinput,0) 259 268 %update list of recent files in the menubar 260 269 MenuFile_1=fileinput; … … 289 298 end 290 299 291 292 300 % -------------------------------------------------------------------- 293 301 function MenuFile_1_Callback(hObject, eventdata, handles) 294 302 fileinput=get(handles.MenuFile_1,'Label'); 295 update_rootfile(handles,fileinput,0)303 display_file_name(handles,fileinput,0) 296 304 297 305 % -------------------------------------------------------------------- 298 306 function MenuFile_2_Callback(hObject, eventdata, handles) 299 307 fileinput=get(handles.MenuFile_2,'Label'); 300 update_rootfile(handles,fileinput,0)308 display_file_name(handles,fileinput,0) 301 309 302 310 % -------------------------------------------------------------------- 303 311 function MenuFile_3_Callback(hObject, eventdata, handles) 304 312 fileinput=get(handles.MenuFile_3,'Label'); 305 update_rootfile( handles,fileinput,0)313 display_file_name( handles,fileinput,0) 306 314 307 315 % -------------------------------------------------------------------- 308 316 function MenuFile_4_Callback(hObject, eventdata, handles) 309 317 fileinput=get(handles.MenuFile_4,'Label'); 310 update_rootfile(handles,fileinput,0)318 display_file_name(handles,fileinput,0) 311 319 312 320 % -------------------------------------------------------------------- 313 321 function MenuFile_5_Callback(hObject, eventdata, handles) 314 322 fileinput=get(handles.MenuFile_5,'Label'); 315 update_rootfile(handles,fileinput,0)323 display_file_name(handles,fileinput,0) 316 324 317 325 % -------------------------------------------------------------------- … … 349 357 'Pick a file',oldfile); 350 358 fileinput=[PathName FileName];%complete file name 351 % testblank=findstr(fileinput,' ');%look for blanks352 % if ~isempty(testblank)353 % errordlg('forbidden input file name: contain blanks')354 % return355 % end356 359 sizf=size(fileinput); 357 360 if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end 358 361 [path,name,ext]=fileparts(fileinput); 359 SeriesData=[];%dfault360 362 if isequal(ext,'.xml') 361 363 msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer … … 363 365 msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 364 366 else 365 update_rootfile(handles,fileinput,1) 366 %update list of recent files in the menubar 367 MenuFile_1=fileinput; 368 MenuFile_2=get(handles.MenuFile_1,'Label'); 369 MenuFile_3=get(handles.MenuFile_2,'Label'); 370 MenuFile_4=get(handles.MenuFile_3,'Label'); 371 MenuFile_5=get(handles.MenuFile_4,'Label'); 372 set(handles.MenuFile_1,'Label',MenuFile_1) 373 set(handles.MenuFile_2,'Label',MenuFile_2) 374 set(handles.MenuFile_3,'Label',MenuFile_3) 375 set(handles.MenuFile_4,'Label',MenuFile_4) 376 set(handles.MenuFile_5,'Label',MenuFile_5) 377 set(handles.MenuFile_insert_1,'Label',MenuFile_1) 378 set(handles.MenuFile_insert_2,'Label',MenuFile_2) 379 set(handles.MenuFile_insert_3,'Label',MenuFile_3) 380 set(handles.MenuFile_insert_4,'Label',MenuFile_4) 381 set(handles.MenuFile_insert_5,'Label',MenuFile_5) 382 dir_perso=prefdir; 383 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 384 if exist(profil_perso,'file') 385 save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat 386 else 387 txt=ver('MATLAB'); 388 Release=txt.Release; 389 relnumb=str2num(Release(3:4)); 390 if relnumb >= 14 391 save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat 392 else 393 save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat 394 end 395 end 396 end 397 %------------------------------------------------ 367 display_file_name(handles,fileinput,1) 368 end 398 369 399 370 % -------------------------------------------------------------------- 400 371 function MenuFile_insert_1_Callback(hObject, eventdata, handles) 372 % -------------------------------------------------------------------- 401 373 fileinput=get(handles.MenuFile_insert_1,'Label'); 402 update_rootfile(handles,fileinput,1)374 display_file_name(handles,fileinput,1) 403 375 404 376 % -------------------------------------------------------------------- 405 377 function MenuFile_insert_2_Callback(hObject, eventdata, handles) 378 % -------------------------------------------------------------------- 406 379 fileinput=get(handles.MenuFile_insert_2,'Label'); 407 update_rootfile(handles,fileinput,1)380 display_file_name(handles,fileinput,1) 408 381 409 382 % -------------------------------------------------------------------- 410 383 function MenuFile_insert_3_Callback(hObject, eventdata, handles) 384 % -------------------------------------------------------------------- 411 385 fileinput=get(handles.MenuFile_insert_3,'Label'); 412 update_rootfile( handles,fileinput,1)386 display_file_name( handles,fileinput,1) 413 387 414 388 % -------------------------------------------------------------------- 415 389 function MenuFile_insert_4_Callback(hObject, eventdata, handles) 390 % -------------------------------------------------------------------- 416 391 fileinput=get(handles.MenuFile_insert_4,'Label'); 417 update_rootfile( handles,fileinput,1)392 display_file_name( handles,fileinput,1) 418 393 419 394 % -------------------------------------------------------------------- 420 395 function MenuFile_insert_5_Callback(hObject, eventdata, handles) 396 % -------------------------------------------------------------------- 421 397 fileinput=get(handles.MenuFile_insert_5,'Label'); 422 update_rootfile(handles,fileinput,1) 423 424 %------------------------------------------------------------------------ 425 % --- refresh the GUI data after introduction of a new file series 398 display_file_name(handles,fileinput,1) 399 400 %------------------------------------------------------------------------ 401 % --- Executes when entered data in editable cell(s) in InputTable. 402 function InputTable_CellEditCallback(hObject, eventdata, handles) 403 %------------------------------------------------------------------------ 404 iview=eventdata.Indices(1); 405 InputTable=get(handles.InputTable,'Data'); 406 filename=fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}]) 407 display_file_name(handles,fileinput,0) 408 409 % hObject handle to InputTable (see GCBO) 410 % eventdata structure with the following fields (see UITABLE) 411 % Indices: row and column indices of the cell(s) edited 412 % PreviousData: previous data for the cell(s) edited 413 % EditData: string(s) entered by the user 414 % NewData: EditData or its converted form set on the Data property. Empty if Data was not changed 415 % Error: error string when failed to convert EditData to appropriate value for Data 416 % handles structure with handles and user data (see GUIDATA) 417 % check_lines=get(handles.REFRESH_INDICES,'UserData'); 418 % check_lines(eventdata.Indices(1))=1; %select the edited line for refresh 419 % set(handles.REFRESH_INDICES,'UserData',check_lines); 420 % set(handles.REFRESH_INDICES,'Visible','on') 421 %InputTable=get(handles.InputTable,'Data') 422 423 %------------------------------------------------------------------------ 424 % --- refresh the GUI data after introduction of a new file 426 425 % INPUT: 427 % handles: 426 % handles: handles of the elements in the GUI series 428 427 % fileinput: name of the input file 429 % a ddtest: =0 to refresh the list of file series, =1 to append a new series to the list (from the menu bar option 'Open_insert')430 function update_rootfile(handles,fileinput,addtest)428 % append: =0 to refresh the list of file series, =1 to append a new series to the list (from the menu bar option 'Open_insert') 429 function display_file_name(handles,fileinput,append) 431 430 %------------------------------------------------------------------------ 431 432 %% get the input root name, indices, file extension and nomenclature NomType 433 if ~exist(fileinput,'file') 434 msgbox_uvmat('ERROR',['input file ' fileinput ' does not exist']) 435 return 436 end 432 437 433 438 %% enable other menus and uicontrols … … 444 449 drawnow 445 450 446 %% get the input root name, indices, file extension and nomenclature NomType 447 if ~exist(fileinput,'file') 448 msgbox_uvmat('ERROR',['input file ' fileinput ' does not exist']) 451 452 %% detect root name, nomenclature and indices in the input file name: 453 [FilePath,FileName,FileExt]=fileparts(fileinput); 454 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 455 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists 456 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]); 457 if isempty(RootFile)&&isempty(i1_series) 458 errormsg='no input file in the series'; 449 459 return 450 460 end 451 [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomType]=fileparts_uvmat(fileinput);452 461 453 462 %% fill the list of file series 454 463 InputTable=get(handles.InputTable,'Data'); 455 if addtest % display the input data as a new line in the table 456 val=size(InputTable,1)+1; 457 InputTable(val,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 458 check_lines=get(handles.REFRESH_INDICES,'UserData'); 464 if append % display the input data as a new line in the table 465 lastview=size(InputTable,1)+1; 466 InputTable(lastview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 467 set(handles.ListView,'String',[get(handles.ListView,'String');{num2str(lastview)}]) 468 set(handles.ListView,'Value',lastview) 469 % check_lines=get(handles.REFRESH_INDICES,'UserData'); 459 470 else % or re-initialise the list of input file series 460 val=1;471 lastview=1; 461 472 InputTable=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 462 473 set(handles.TimeTable,'Data',[{[]},{[]},{[]},{[]}]) 463 474 set(handles.MinIndex,'Data',[{[]},{[]}]) 464 475 set(handles.MaxIndex,'Data',[{[]},{[]}]) 476 set(handles.ListView,'Value',1) 477 set(handles.ListView,'String',{'1'}) 465 478 end 466 479 set(handles.InputTable,'Data',InputTable) 467 check_lines(val)=1; %select the edited line for refresh468 set(handles.REFRESH_INDICES,'UserData',check_lines);469 470 %% refresh menus with info from the new series 471 REFRESH_INDICES_Callback([],[], handles)472 473 %% determine the selected reference field indices for pair disp aly480 % check_lines(lastview)=1; %select the edited line for refresh 481 % set(handles.REFRESH_INDICES,'UserData',check_lines); 482 483 %% refresh menus with info from the new series: TODO:check 484 %REFRESH_INDICES_Callback([],[], handles) 485 486 %% determine the selected reference field indices for pair display 474 487 ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV 475 488 if ~isempty(i1) … … 479 492 end 480 493 end 481 set(handles. ref_i,'String',num2str(ref_i));494 set(handles.num_ref_i,'String',num2str(ref_i)); 482 495 ref_j=1; %default ref_j is a reference frame index used to find existing pairs from PIV 483 496 if ~isempty(j1) … … 487 500 end 488 501 end 489 set(handles.ref_j,'String',num2str(ref_j)); 490 ref_i_Callback([],[], handles) 491 ref_j_Callback([],[], handles) 492 493 %% update the first and last reference indices if empty 494 first_i=str2num(get(handles.num_first_i,'String')); 495 if isempty(first_i) 496 set(handles.num_first_i,'String',num2str(ref_i)); 497 set(handles.num_last_i,'String',num2str(ref_i)); 498 set(handles.num_first_j,'String',num2str(ref_j)) 499 set(handles.num_last_j,'String',num2str(ref_j)); 500 end 501 502 %% store the root name for future opening of uvmat 502 set(handles.num_ref_j,'String',num2str(ref_j)); 503 504 %% update list of recent files in the menubar and save it for future opening 505 MenuFile=[{get(handles.MenuFile_1,'Label')};{get(handles.MenuFile_2,'Label')};... 506 {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}]; 507 str_find=strcmp(FileName,MenuFile); 508 if isempty(find(str_find,1)) 509 MenuFile=[{FileName};MenuFile];%insert the current file if not already in the list 510 end 511 for ifile=1:min(length(MenuFile),5) 512 eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',MenuFile{ifile});']) 513 eval(['set(handles.MenuFile_insert_' num2str(ifile) ',''Label'',MenuFile{ifile});']) 514 end 503 515 dir_perso=prefdir; 504 516 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 505 517 if exist(profil_perso,'file') 506 save (profil_perso,' RootPath','SubDir','RootFile','NomType', '-append'); %store the root namefor future opening of uvmat518 save (profil_perso,'MenuFile','-append'); %store the file names for future opening of uvmat 507 519 else 508 txt=ver('MATLAB'); 509 Release=txt.Release; 510 relnumb=str2num(Release(3:4)); 511 if relnumb >= 14 512 save (profil_perso,'RootPath','SubDir','RootFile','NomType','-V6') %store the root name for future opening of uvmat 520 save (profil_perso,'MenuFile','-V6'); %store the file names for future opening of uvmat 521 end 522 523 set(handles.InputTable,'BackgroundColor',[1 1 1]) 524 525 %% initiate input file series and refresh the current field view: 526 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,lastview); 527 528 %------------------------------------------------------------------------ 529 % --- Update information about a new field series (indices to scan, timing, 530 % calibration from an xml file, then refresh current plots 531 function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,VideoObject,iview) 532 %------------------------------------------------------------------------ 533 534 %% enable j index visibility 535 if isempty(j1_series) 536 state='off'; 537 else 538 state='on'; 539 end 540 enable_j(handles,state) 541 542 %% display the min and max indices for all the file series 543 MinIndex=get(handles.MinIndex,'Data');%retrieve the min indices in the table MinIndex 544 MaxIndex=get(handles.MaxIndex,'Data');%retrieve the max indices in the table MaxIndex 545 % MinIndex_i=min(i1_series(i1_series>0)); 546 % if ~isempty(i2_series) 547 % MaxIndex_i=max(i2_series(i2_series>0)); 548 % else 549 % MaxIndex_i=max(i1_series(i1_series>0)); 550 % end 551 % MinIndex_j=min(j1_series(j1_series>0)); 552 % if ~isempty(j2_series) 553 % MaxIndex_j=max(j2_series(j2_series>0)); 554 % else 555 % MaxIndex_j=max(j1_series(j1_series>0)); 556 % end 557 i_sum=sum(sum(i1_series,2),3); 558 MaxIndex_i=max(find(i_sum>0))-1; 559 MinIndex_i=min(find(i_sum>0))-1; 560 j_sum=sum(sum(i1_series,1),3); 561 MaxIndex_j=max(find(j_sum>0))-1; 562 MinIndex_j=min(find(j_sum>0))-1; 563 MinIndex{iview,1}=MinIndex_i; 564 MinIndex{iview,2}=MinIndex_j; 565 MaxIndex{iview,1}=MaxIndex_i; 566 MaxIndex{iview,2}=MaxIndex_j; 567 set(handles.MinIndex,'Data',MinIndex)%display the min indices in the table MinIndex 568 set(handles.MaxIndex,'Data',MaxIndex)%display the max indices in the table MaxIndex 569 570 %% adjust the first and last indices if requested by the bounds 571 first_i=str2num(get(handles.num_first_i,'String')); 572 ref_i=str2num(get(handles.num_ref_i,'String')); 573 ref_j=str2num(get(handles.num_ref_j,'String')); 574 if isempty(first_i) 575 first_i=ref_i; 576 elseif first_i < MinIndex_i 577 first_i=MinIndex_i; 578 end 579 first_j=str2num(get(handles.num_first_j,'String')); 580 if isempty(first_j) 581 first_j=ref_j; 582 elseif first_j<MinIndex_j 583 first_j=MinIndex_j; 584 end 585 last_i=str2num(get(handles.num_last_i,'String')); 586 if isempty(last_i) 587 last_i=ref_i; 588 elseif last_i > MaxIndex_i 589 last_i=MaxIndex_i; 590 end 591 last_j=str2num(get(handles.num_first_j,'String')); 592 if isempty(last_j) 593 last_j=ref_j; 594 elseif last_j>MaxIndex_j 595 last_j=MaxIndex_j; 596 end 597 set(handles.num_first_i,'String',num2str(first_i)); 598 set(handles.num_first_j,'String',num2str(first_j)); 599 set(handles.num_last_i,'String',num2str(last_i)); 600 set(handles.num_last_j,'String',num2str(last_j)); 601 602 %% read timing and total frame number from the current file (movie files) !! may be overrid by xml file 603 InputTable=get(handles.InputTable,'Data'); 604 FileBase=fullfile(InputTable{iview,1},InputTable{iview,3}); 605 time=[];%default 606 % case of movies 607 if strcmp(InputTable{iview,4},'*') 608 if ~isempty(VideoObject) 609 imainfo=get(VideoObject); 610 time=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames-1)/imainfo.FrameRate)'; 611 set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec 612 ColorType='truecolor'; 613 elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image 614 if ~isempty(InputTable{iview,2}) 615 imainfo=imfinfo(fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,5}])); 616 else 617 imainfo=imfinfo([FileBase InputTable{iview,5}]); 618 end 619 ColorType=imainfo.ColorType;%='truecolor' for color images 620 if length(imainfo) >1 %case of image with multiple frames 621 nbfield=length(imainfo); 622 nbfield_j=1; 623 end 624 end 625 end 626 627 %% read image documentation file if found%%%%%%%%%%%%%%%%%%%%%%%%%%% 628 629 ext_imadoc=''; 630 if exist([FileBase '.xml'],'file') 631 ext_imadoc='.xml'; 632 elseif exist([FileBase '.civ'],'file') 633 ext_imadoc='.civ'; 634 end 635 %read the ImaDoc file 636 XmlData=[]; 637 NbSlice_calib={}; 638 if isequal(ext_imadoc,'.xml') 639 [XmlData,warntext]=imadoc2struct([FileBase '.xml']); 640 if isfield(XmlData,'Heading') && isfield(XmlData.Heading,'ImageName') && ischar(XmlData.Heading.ImageName) 641 [PP,FF,ext_ima_read]=fileparts(XmlData.Heading.ImageName); 642 end 643 if isfield(XmlData,'Time') 644 time=XmlData.Time; 645 end 646 if isfield(XmlData,'Camera') 647 if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice) 648 NbSlice_calib{iview}=XmlData.Camera.NbSlice;% Nbre of slices for Zindex in phys transform 649 if ~isequal(NbSlice_calib{iview},NbSlice_calib{1}) 650 msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series'); 651 end 652 end 653 if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit) 654 TimeUnit=XmlData.Camera.TimeUnit; 655 end 656 end 657 if ~isempty(warntext) 658 msgbox_uvmat('WARNING',warntext) 659 end 660 elseif isequal(ext_imadoc,'.civ') 661 [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']); 662 time=XmlData.Time; 663 if error==2, warntext=['no file ' FileBase '.civ']; 664 elseif error==1, warntext='inconsistent number of fields in the .civ file'; 665 end 666 end 667 668 %% update time table 669 TimeTable=get(handles.TimeTable,'Data'); 670 if isempty(MinIndex_j) 671 TimeTable{iview,1}=time(MinIndex_i); 672 TimeTable{iview,2}=time(first_i); 673 TimeTable{iview,3}=time(last_i); 674 TimeTable{iview,4}=time(MaxIndex_i); 675 else 676 TimeTable{iview,1}=time(MinIndex_i,MinIndex_j); 677 TimeTable{iview,2}=time(first_i,first_j); 678 TimeTable{iview,3}=time(last_i,last_j); 679 TimeTable{iview,4}=time(MaxIndex_i,MaxIndex_j); 680 end 681 set(handles.TimeTable,'Data',TimeTable) 682 683 %% number of slices 684 if isfield(XmlData,'GeometryCalib') && isfield(XmlData.GeometryCalib,'SliceCoord') 685 siz=size(XmlData.GeometryCalib.SliceCoord); 686 if siz(1)>1 687 NbSlice=siz(1); 513 688 else 514 save(profil_perso,'RootPath','SubDir','RootFile','NomType') 515 end 516 end 517 set(handles.InputTable,'BackgroundColor',[1 1 1]) 518 % set(handles.PathCampaign,'String',SeriesData.PathCampaign) 519 %num_last_j_Callback([], [], handles)% TODO:update 520 %num_last_i_Callback([], [], handles) 521 522 523 % --- Executes when entered data in editable cell(s) in InputTable. 524 function InputTable_CellEditCallback(hObject, eventdata, handles) 525 % hObject handle to InputTable (see GCBO) 526 % eventdata structure with the following fields (see UITABLE) 527 % Indices: row and column indices of the cell(s) edited 528 % PreviousData: previous data for the cell(s) edited 529 % EditData: string(s) entered by the user 530 % NewData: EditData or its converted form set on the Data property. Empty if Data was not changed 531 % Error: error string when failed to convert EditData to appropriate value for Data 532 % handles structure with handles and user data (see GUIDATA) 689 NbSlice=1; 690 end 691 set(handles.num_NbSlice,'String',num2str(NbSlice)) 692 end 693 694 %% update pair menus 695 ListView=get(handles.ListView,'String'); 696 ListView{iview}=num2str(iview); 697 set(handles.ListView,'String'); 698 set(handles.ListView,'Value',iview) 699 update_mode(handles,i1_series,i2_series,j1_series,j2_series,time) 700 701 %% display the set of existing files as an image 702 set(handles.waitbar_frame,'Units','pixels') 703 pos=get(handles.waitbar_frame,'Position'); 704 xima=0.5:pos(3)-0.5;% pixel positions on the image representing the existing file indices 705 yima=0.5:pos(4)-0.5; 706 [XIma,YIma]=meshgrid(xima,yima); 707 nb_i=size(i1_series,1); 708 nb_j=size(i1_series,2); 709 ind_i=(0.5:nb_i-0.5)*pos(3)/nb_i; 710 ind_j=(0.5:nb_j-0.5)*pos(4)/nb_j; 711 [Ind_i,Ind_j]=meshgrid(ind_i,ind_j); 712 CData=zeros([size(XIma) 3]); 713 file_ima=double((i1_series(:,:,1)>0)'); 714 if numel(file_ima)>=2 715 if size(file_ima,1)==1 716 CLine=interp1(ind_i,file_ima,xima,'nearest'); 717 CData(:,:,2)=ones(size(yima'))*CLine; 718 else 719 CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest'); 720 end 721 set(handles.waitbar_frame,'CData',CData) 722 end 723 set(handles.waitbar_frame,'Units','normalized') 724 725 %% enable field and veltype menus 726 SeriesData=get(handles.series,'UserData'); 727 SeriesData.FileType{iview}=FileType; 728 check_civ=0; 729 check_netcdf=0; 730 for iview=1:length(SeriesData.FileType) 731 switch SeriesData.FileType{iview} 732 case {'civx','civdata'} 733 check_civ=check_civ+1; 734 case 'netcdf' 735 check_netcdf=check_netcdf+1; 736 end 737 end 738 if check_civ 739 enable='on'; 740 else 741 enable='off'; 742 end 743 set(handles.VelTypeMenu,'Visible',enable) 744 set(handles.VelType_text,'Visible',enable) 745 if check_civ>=2 746 enable='on'; 747 else 748 enable='off'; 749 end 750 set(handles.VelTypeMenu_1,'Visible',enable) 751 set(handles.VelType_text_1,'Visible',enable) 752 if check_civ || check_netcdf 753 enable='on'; 754 else 755 enable='off'; 756 end 757 set(handles.FieldMenu,'Visible',enable) 758 set(handles.Field_text,'Visible',enable) 759 if check_civ+ check_netcdf>=2 760 enable='on'; 761 else 762 enable='off'; 763 end 764 set(handles.FieldMenu_1,'Visible',enable) 765 set(handles.Field_text_1,'Visible',enable) 766 FieldString={''}; 767 if check_civ 768 FieldString=[calc_field;{'get_field...'}]; 769 elseif check_netcdf 770 FieldString={'get_field...'}; 771 end 772 set(handles.FieldMenu,'String',FieldString) 773 FieldString={''}; 774 if check_civ>=2 775 FieldString=[calc_field;{'get_field...'}]; 776 elseif check_civ+check_netcdf>=2 777 FieldString={'get_field...'}; 778 end 779 set(handles.FieldMenu_1,'String',{'get_field...'}) 780 % testfield=isequal(get(handles.FieldMenu,'enable'),'on'); 781 % testfield_1=isequal(get(handles.FieldMenu_1,'enable'),'on'); 782 % testveltype=isequal(get(handles.VelTypeMenu,'enable'),'on'); 783 % testveltype_1=isequal(get(handles.VelTypeMenu_1,'enable'),'on'); 784 % testtransform=isequal(get(handles.transform_fct,'Enable'),'on'); 785 % testnc=0; 786 % testnc_1=0; 787 % testcivx=0; 788 % testcivx_1=0; 789 % testima=0; %test for image input 790 % if isequal(lower(FileExt),'.avi') %.avi file 791 % testima=1; 792 % elseif ~isempty(imformats(FileExt(2:end))) 793 % testima=1; 794 % elseif isequal(FileExt,'.vol') 795 % testima=1; 796 % end 797 %TODO: update 798 % if length(FileExtCell)==1 || length(FileExtCell)>2 799 % for iview=1:length(FileExtCell) 800 % if isequal(FileExtCell{iview},'.nc') 801 % testnc=1; 802 % end 803 % if isequal(FileTypeCell{iview},'civx') 804 % testcivx=1; 805 % end 806 % end 807 % elseif length(FileExtCell)==2 808 % testnc=isequal(FileExtCell{1},'.nc'); 809 % testnc_1=isequal(FileExtCell{2},'.nc'); 810 % testcivx=isequal(FileTypeCell{1},'civx'); 811 % testcivx_1=isequal(FileTypeCell{2},'civx'); 812 % end 813 % switch FileType 814 % case {'civx','civdata'} 815 % view_FieldMenu(handles,'on') 816 % menustr=get(handles.FieldMenu,'String'); 817 % if isequal(menustr,{'get_field...'}) 818 % set(handles.FieldMenu,'String',{'get_field...';'velocity';'vort';'div';'more...'}) 819 % end 820 % set(handles.VelTypeMenu,'Visible','on') 821 % set(handles.FieldTransform,'Visible','on') 822 % % view_TRANSFORM(handles,'on') 823 % % TODO: second menu 824 % % view_FieldMenu_1(handles,'on') 825 % % if testcivx_1 826 % % menustr=get(handles.FieldMenu_1,'String'); 827 % % if isequal(menustr,{'get_field...'}) 828 % % set(handles.FieldMenu_1,'String',{'get_field...';'velocity';'vort';'div';'more...'}) 829 % % end 830 % % else 831 % % set(handles.FieldMenu_1,'Value',1) 832 % % set(handles.FieldMenu_1,'String',{'get_field...'}) 833 % % set(handles.VelTypeMenu_1,'Visible','on') 834 % % set(handles.VelType_text_1,'Visible','on'); 835 % % end 836 % % view_FieldMenu_1(handles,'off') 837 % case 'netcdf' 838 % view_FieldMenu(handles,'on') 839 % set(handles.FieldMenu,'Value',1) 840 % set(handles.FieldMenu,'String',{'get_field...'}) 841 % set(handles.FieldTransform,'Visible','off') 842 % % view_TRANSFORM(handles,'off') 843 % case {'image','multimage','video'} 844 % view_FieldMenu(handles,'off') 845 % view_FieldMenu_1(handles,'off') 846 % set(handles.VelTypeMenu,'Visible','off') 847 % set(handles.VelType_text,'Visible','off'); 848 % end 849 850 851 852 %% store the series info in 'UserData' 853 854 SeriesData.i1_series{iview}=i1_series; 855 SeriesData.i2_series{iview}=i2_series; 856 SeriesData.j1_series{iview}=j1_series; 857 SeriesData.j2_series{iview}=j2_series; 858 SeriesData.FileType{iview}=FileType; 859 SeriesData.Time{iview}=time; 860 set(handles.series,'UserData',SeriesData) 861 862 863 864 return 865 866 %% set default options in menu 'Fields'%% TODO: check VelType 867 if ~testima 868 testcivx=0; 869 if isfield(UvData,'FieldsString') && isequal(UvData.FieldsString,{'get_field...'})% field menu defined as input (from get_field) 870 set(handles_Fields,'Value',1) 871 set(handles_Fields,'String',{'get_field...'}) 872 UvData=rmfield(UvData,'FieldsString'); 873 else 874 Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ'); 875 if strcmp(Data.Conventions,'uvmat/civdata') ||( ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0))%if the new input is Civx 876 FieldList=calc_field; 877 set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 878 set(handles_Fields,'Value',2) % set menu to 'velocity' 879 col_vec=FieldList; 880 col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar) 881 testcivx=1; 882 end 883 if ~testcivx 884 set(handles_Fields,'Value',1) % set menu to 'get_field... 885 set(handles_Fields,'String',{'get_field...'}) 886 col_vec={'get_field...'}; 887 end 888 set(handles.ColorScalar,'String',col_vec) 889 end 890 end 891 set(handles.uvmat,'UserData',UvData) 892 893 %% set index navigation options and refresh plots 894 scan_option='i';%default 895 state_j='off'; %default 896 if index==2 897 if get(handles.scan_j,'Value') 898 scan_option='j'; %keep the scan option for the second fiel series 899 end 900 if strcmp(get(handles.j1,'Visible'),'on') 901 state_j='on'; 902 end 903 end 904 if ~isempty(j1_series) 905 state_j='on'; 906 if isequal(nbfield,1) &&index==1 907 scan_option='j'; %scan j index by default if nbfield=1 908 end 909 end 910 if isequal(scan_option,'i') 911 set(handles.scan_i,'Value',1) 912 scan_i_Callback([],[], handles); 913 else 914 set(handles.scan_j,'Value',1) 915 scan_j_Callback([],[], handles); 916 end 917 set(handles.scan_j,'Visible',state_j) 918 set(handles.j1,'Visible',state_j) 919 set(handles.j2,'Visible',state_j) 920 set(handles.last_j,'Visible',state_j); 921 set(handles.frame_j,'Visible',state_j); 922 set(handles.j_text,'Visible',state_j); 923 if ~isempty(i2_series)||~isempty(j2_series) 924 set(handles.CheckFixPair,'Visible','on') 925 elseif index==1 926 set(handles.CheckFixPair,'Visible','off') 927 end 928 929 930 mode_Callback(hObject, eventdata, handles) 931 932 set(handles.REFRESH_INDICES,'BackgroundColor',[0.7 0.7 0.7]) 933 InputTable=get(handles.InputTable,'Data'); 533 934 check_lines=get(handles.REFRESH_INDICES,'UserData'); 534 check_lines(eventdata.Indices(1))=1; %select the edited line for refresh 535 set(handles.REFRESH_INDICES,'UserData',check_lines); 536 set(handles.REFRESH_INDICES,'Visible','on') 537 538 539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%???????????? 935 936 %% check the indices and FileTypes for each series (limited to the new ones to save time) 937 for ind_list=1:length(check_lines) 938 if check_lines(ind_list) 939 InputLine=InputTable(ind_list,:); 940 detect_idem=strcmp('"',InputLine);% look for '" (repeat of previous data) 941 detect_idem=detect_idem(detect_idem>0); 942 if ~isempty (detect_idem) 943 InputLine(detect_idem)=InputTable(ind_list-1,detect_idem); 944 set(handles.InputTable,'Data',InputTable) 945 end 946 fileinput=fullfile_uvmat(InputLine{1},InputLine{2},InputLine{3},InputLine{5},InputLine{4},1,2,1,2); 947 %fileinput=name_generator(fullfile(InputLine{1},InputLine{3}),1,1,InputLine{5},InputLine{4},1,2,2,InputLine{2}) 948 %update file series defined by the selected line 949 [InputTable{ind_list,3},InputTable{(ind_list),4},errormsg]=update_indices(handles,fileinput,ind_list); 950 if ~isempty(errormsg) 951 msgbox_uvmat('ERROR',errormsg) 952 return 953 end 954 end 955 end 956 set(handles.InputTable,'Data',InputTable) 957 SeriesData=get(handles.series,'UserData'); 958 959 state_j='off'; 960 state_Pairs='off'; 961 state_InputFields='off'; 962 val=get(handles.ListView,'Value'); 963 ListViewString={''}; 964 if ~isempty(SeriesData) 965 % ListViewString={}; 966 for iview=1:size(InputTable,1) 967 if ~isempty(SeriesData.j1_series{iview}) 968 state_j='on'; 969 end 970 if ~isempty(SeriesData.i2_series{iview})||~isempty(SeriesData.j2_series{iview}) 971 state_Pairs='on'; 972 ListViewString{iview}=num2str(iview); 973 if check_lines(iview) 974 val=iview;%select the last pair if it is a new entry 975 end 976 end 977 if strcmp(SeriesData.FileType{iview},'civx')||strcmp(SeriesData.FileType{iview},'civdata') 978 state_InputFields='on'; 979 end 980 end 981 end 982 set(handles.ListView,'Value',val) 983 set(handles.ListView,'String',ListViewString) 984 if strcmp(state_Pairs,'on') 985 ListView_Callback(hObject,eventdata,handles) 986 end 987 set(handles.PairString,'Visible',state_Pairs) 988 enable_j(handles,state_j) 989 990 991 %------------------------------------------------------------------------ 992 % --- Executes when selected cell(s) is changed in PairString. 993 function PairString_CellSelectionCallback(hObject, eventdata, handles) 994 %------------------------------------------------------------------------ 995 set(handles.ListView,'Value',eventdata.Indices(1))% detect the selected raw index 996 ListView_Callback ([],[],handles) % update the list of available pairs 997 998 %------------------------------------------------------------------------ 999 %------------------------------------------------------------------------ 1000 % III - FUNCTIONS ASSOCIATED TO THE FRAME SET PAIRS 1001 %------------------------------------------------------------------------ 1002 %------------------------------------------------------------------------ 1003 % --- Executes on selection change in ListView. 1004 function ListView_Callback(hObject, eventdata, handles) 1005 %------------------------------------------------------------------------ 1006 SeriesData=get(handles.series,'UserData'); 1007 i2_series=[]; 1008 j2_series=[]; 1009 iview=get(handles.ListView,'Value'); 1010 if ~isempty(SeriesData.i2_series{iview}) 1011 i2_series=SeriesData.i2_series{iview}; 1012 end 1013 if ~isempty(SeriesData.j2_series{iview}) 1014 j2_series=SeriesData.j2_series{iview}; 1015 end 1016 update_mode(handles,SeriesData.i1_series{iview},SeriesData.i2_series{iview},... 1017 SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.Time{iview}) 1018 1019 %------------------------------------------------------------------------ 540 1020 % --- Executes on button press in mode. 541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%542 1021 function mode_Callback(hObject, eventdata, handles) 543 1022 %------------------------------------------------------------------------ 544 1023 SeriesData=get(handles.series,'UserData'); 1024 iview=get(handles.ListView,'Value'); 545 1025 mode_list=get(handles.mode,'String'); 546 mode_value=get(handles.mode,'Value'); 547 mode=mode_list{mode_value}; 548 time=[]; 549 if isfield(SeriesData,'Time') 550 time=SeriesData.Time{1}; %get the set of times 551 end 1026 mode=mode_list{get(handles.mode,'Value')}; 552 1027 if isequal(mode,'bursts') 553 1028 enable_i(handles,'On') … … 557 1032 enable_j(handles,'Off') 558 1033 end 559 find_netcpair_civ(handles) 560 561 %------------------------------------- 562 function enable_i(handles,state) 563 set(handles.i_txt,'Visible',state) 564 set(handles.num_first_i,'Visible',state) 565 set(handles.num_last_i,'Visible',state) 566 set(handles.num_incr_i,'Visible',state) 567 % set(handles.num_MaxIndex_i,'Visible',state) 568 set(handles.ref_i,'Visible',state) 569 set(handles.ref_i_text,'Visible',state) 570 571 %----------------------------------- 572 function enable_j(handles,state) 573 set(handles.j_txt,'Visible',state) 574 % set(handles.num_MinIndex_j,'Visible',state) 575 set(handles.num_first_j,'Visible',state) 576 set(handles.num_last_j,'Visible',state) 577 set(handles.num_incr_j,'Visible',state) 578 % set(handles.num_MaxIndex_j,'Visible',state) 579 set(handles.ref_j,'Visible',state) 580 set(handles.ref_j_text,'Visible',state) 581 582 %----------------------------------- 583 function view_FieldMenu(handles,state) 584 % set(handles.FieldMenu,'Visible',state) 585 % set(handles.Field_text,'Visible',state) 586 set(handles.InputFields,'Visible',state) 587 588 %----------------------------------- 589 function view_FieldMenu_1(handles,state) 590 set(handles.FieldMenu_1,'Visible',state) 591 set(handles.Field_text_1,'Visible',state) 592 593 % %----------------------------------- 594 % function view_TRANSFORM(handles,state) 595 % set(handles.TRANSFORM_frame,'Visible',state) 596 % set(handles.transform_fct,'Visible',state); 597 % set(handles.TRANSFORM_title,'Visible',state) 1034 fill_ListPair(handles,SeriesData.i1_series{iview},SeriesData.i2_series{iview},... 1035 SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.Time{iview}) 1036 ListPairs_Callback([],[],handles) 1037 1038 %------------------------------------------------------------- 1039 % --- Executes on selection in ListPairs. 1040 function ListPairs_Callback(hObject,eventdata,handles) 1041 %------------------------------------------------------------ 1042 list_pair=get(handles.ListPairs,'String');%get the menu of image pairs 1043 string=list_pair{get(handles.ListPairs,'Value')}; 1044 string=regexprep(string,',.*','');%removes time indication (after ',') 1045 PairString=get(handles.PairString,'Data'); 1046 iview=get(handles.ListView,'Value'); 1047 PairString{iview,1}=string; 1048 % report the selected pair string to the table PairString 1049 set(handles.PairString,'Data',PairString) 1050 1051 %------------------------------------------------------------------------ 1052 function num_ref_i_Callback(hObject, eventdata, handles) 1053 %------------------------------------------------------------------------ 1054 mode_list=get(handles.mode,'String'); 1055 mode=mode_list{get(handles.mode,'Value')}; 1056 SeriesData=get(handles.series,'UserData'); 1057 iview=get(handles.ListView,'Value'); 1058 fill_ListPair(handles,SeriesData.i1_series{iview},SeriesData.i2_series{iview},... 1059 SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.time{iview});% update the menu of pairs depending on the available netcdf files 1060 ListPairs_Callback([],[],handles) 1061 1062 %------------------------------------------------------------------------ 1063 function num_ref_j_Callback(hObject, eventdata, handles) 1064 %------------------------------------------------------------------------ 1065 num_ref_i_Callback(hObject, eventdata, handles) 1066 1067 %------------------------------------------------------------------------ 1068 function update_mode(handles,i1_series,i2_series,j1_series,j2_series,time) 1069 %------------------------------------------------------------------------ 1070 check_burst=1; 1071 if isempty(j2_series)% no pair menu to display 1072 if isempty(i2_series) 1073 set(handles.mode,'String',{''}) 1074 else 1075 set(handles.mode,'Value',1) 1076 set(handles.mode,'String',{'series(Di)'}) 1077 end 1078 else 1079 nbfield=size(j2_series{View},1); 1080 nbfield2=size(j2_series{View},2); 1081 set(handles.mode,'String',{'bursts';'series(Dj)'}) 1082 if nbfield2>10 || nbfield==1 1083 set(handles.mode,'Value',2); 1084 else 1085 set(handles.mode,'Value',1); 1086 check_burst=1; 1087 end 1088 end 1089 if check_burst 1090 enable_i(handles,'On') 1091 enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 1092 else 1093 enable_i(handles,'On') 1094 enable_j(handles,'Off') 1095 end 1096 fill_ListPair(handles,i1_series,i2_series,j1_series,j2_series,time) 1097 ListPairs_Callback([],[],handles) 598 1098 599 1099 %-------------------------------------------------------------- 600 % determine the menu for civ1 pairs depending on existing netcdf files601 % with the reference indices ref_i andref_j1100 % determine the menu for civ1 pairstring depending on existing netcdf files 1101 % with the reference indices num_ref_i and num_ref_j 602 1102 %---------------------------------------------------------------- 603 function find_netcpair_civ(handles) 604 SeriesData=get(handles.series,'UserData'); 605 set(handles.Pairs,'Visible','on')% makes the panel "Pairs' visible 1103 function fill_ListPair(handles,i1_series,i2_series,j1_series,j2_series,time) 1104 606 1105 mode_list=get(handles.mode,'String'); 607 mode_value=get(handles.mode,'Value'); 608 mode=mode_list{mode_value}; 609 610 %reads image numbers from the interface 611 % ref_i=str2num(get(handles.ref_i,'String')); 612 % ref_j=str2num(get(handles.ref_j,'String')); 613 % ref_time=0; 614 % nbfield=50; 615 % nbfield2=50;%default max number of pairs 616 617 %look for existing processed pairs involving the field at the middle of the series if civ1 will not 618 % be performed, while the result is needed for next steps. 619 620 % ind_exist=0; 1106 mode=mode_list{get(handles.mode,'Value')}; 1107 ref_i=str2num(get(handles.num_ref_i,'String')); 1108 ref_j=str2num(get(handles.num_ref_j,'String')); 1109 if isempty(ref_i) 1110 ref_i=1; 1111 end 1112 if isempty(ref_j) 1113 ref_j=1; 1114 end 621 1115 TimeUnit=get(handles.TimeUnit,'String'); 622 1116 if length(TimeUnit)>=1 … … 626 1120 end 627 1121 628 %% NEW629 for Val=1:numel(SeriesData.i1_series)630 631 i1_series=SeriesData.i1_series{Val};632 i2_series=SeriesData.i2_series{Val};633 j1_series=SeriesData.j1_series{Val};634 j2_series=SeriesData.j2_series{Val};635 1122 displ_pair={}; 636 1123 if strcmp(mode,'series(Di)') … … 644 1131 for ipair=min_diff:max_diff 645 1132 if numel(diff_i(diff_i==ipair))>0 646 displ_pair=[displ_pair;{['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]}]; 1133 pair_string=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]; 1134 if ~isempty(time) 1135 Dt=time(ref_i+ceil(ipair/2),ref_j)-time(ref_i-floor(ipair/2),ref_j); 1136 pair_string=[pair_string ', Dt=' num2str(Dt) ' ' dtunit]; 1137 end 1138 displ_pair=[displ_pair;{pair_string}]; 647 1139 end 648 1140 end … … 660 1152 for ipair=min_diff:max_diff 661 1153 if numel(diff_j(diff_j==ipair))>0 662 displ_pair=[displ_pair;{['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]}]; 1154 pair_string=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]; 1155 if ~isempty(time) 1156 Dt=time(ref_i,ref_j+ceil(ipair/2))-time(ref_i,ref_j-floor(ipair/2)); 1157 pair_string=[pair_string ', Dt=' num2str(Dt) ' ' dtunit]; 1158 end 1159 displ_pair=[displ_pair;{pair_string}]; 663 1160 end 664 1161 end … … 687 1184 end 688 1185 end 689 end 690 %% display list of pairs 691 displ_pair_list=get(handles. list_pair_civ,'String');1186 1187 %% display list of pairstring 1188 displ_pair_list=get(handles.ListPairs,'String'); 692 1189 NewVal=[]; 693 1190 if ~isempty(displ_pair_list) 694 Val=get(handles. list_pair_civ,'Value');1191 Val=get(handles.ListPairs,'Value'); 695 1192 NewVal=find(strcmp(displ_pair_list{Val},displ_pair),1);% look at the previous display in the new menu displ_pâir 696 1193 end 697 1194 if ~isempty(NewVal) 698 set(handles. list_pair_civ,'Value',NewVal)1195 set(handles.ListPairs,'Value',NewVal) 699 1196 else 700 set(handles. list_pair_civ,'Value',1)701 end 702 set(handles. list_pair_civ,'String',displ_pair)1197 set(handles.ListPairs,'Value',1) 1198 end 1199 set(handles.ListPairs,'String',displ_pair) 703 1200 if isempty(displ_pair) 704 1201 msgbox_uvmat('ERROR',['no file available for the selected subdirectory ' subdir]) 705 1202 end 706 return 707 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%END FUNCTION 708 709 710 if ind_exist==0 711 if isequal(mode,'series(Dj)') | isequal(mode,'st_series(Dj)') 712 msgbox_uvmat('ERROR',['no .nc file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir]) 713 else 714 msgbox_uvmat('ERROR',['no .nc file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir]) 715 end 716 if isequal(mode,'bursts') %case of bursts 717 set(handles.list_pair_civ,'String',{'j=*-*'}); 718 elseif isequal(mode,'series(Di)') %case of bursts 719 set(handles.list_pair_civ,'String',{'Di=*|*'}); 720 elseif isequal(mode,'series(Dj)') %case of bursts 721 set(handles.list_pair_civ,'String',{'Dj=*|*'}); 722 end 723 end 724 return 725 %TO update 726 val=get(handles.list_pair_civ,'Value'); 727 if val > length(displ_pair) 728 set(handles.list_pair_civ,'Value',1);% first pair proposed by default in the menu 729 val=1; 730 end 731 iview=get(handles.NomType,'Value'); 732 SeriesData.displ_num(iview,:)=(displ_num(:,val))'; 733 SeriesData.ref_time=ref_time; 734 set(handles.series,'UserData',SeriesData) 735 list_pair_civ_Callback([],[],handles) 736 737 %------------------------------------------------------------- 738 % --- Executes on selection in list_pair_civ. 739 function list_pair_civ_Callback(hObject,eventdata,handles) 740 %------------------------------------------------------------ 741 return 742 %%%%%%%% 743 %update num_first_i and num_last_i according to the chosen image pairs 744 testupdate=0; 745 Val=get(handles.RootPath,'Value'); 746 IndexCell=get(handles.NomType,'String'); 747 SeriesData=get(handles.series,'UserData'); 748 NomType=SeriesData.NomType{Val}; 749 list_pair=get(handles.list_pair_civ,'String');%get the menu of image pairs 750 index_pair=get(handles.list_pair_civ,'Value'); 751 str_pair=list_pair{index_pair}; 752 ind_equ=strfind(str_pair,'=');%find '=' 753 ind_sep=strfind(str_pair,'|');%find pair separator '|' 754 ind_com=strfind(str_pair,':');%find ':' 755 test_bursts=0; 756 if isempty(ind_sep) 757 ind_sep=strfind(str_pair,'-');%find pair separator if it is not '|' 758 test_bursts=1;% we are in the case of bursts 759 end 760 displ_num=[0 0 0 0]; %default 761 if ~isempty(ind_sep)&& ~strcmp(str_pair(ind_sep-1),'*')% if there is a pair separator ('|' or '-') 762 num1_str=str_pair(ind_equ(1)+1:ind_sep-1); 763 num2_str=str_pair(ind_sep+1:ind_com-1); 764 num1=str2double(num1_str); 765 num2=str2double(num2_str); 766 if isequal(num1_str(1),' ') 767 num1_str(1)=[]; 768 end 769 if isequal(num2_str(end),' ') 770 num2_str(end)=[]; 771 end 772 switch NomType 773 case {'_1-2_1'} 774 if isequal(num1_str(1),'0') 775 IndexCell{Val}=['_(i-(i+' num2_str ')_j']; 776 else 777 IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')_j']; 778 end 779 displ_num(3)=num1; 780 displ_num(4)=num2; 781 case {'_1-2'} 782 if isequal(num1_str(1),'0') 783 IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')']; 784 else 785 IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')']; 786 end 787 displ_num(3)=num1; 788 displ_num(4)=num2; 789 case '_1_1-2' 790 if test_bursts 791 IndexCell{Val}=['_i_' num1_str '-' num2_str ]; 792 else 793 if isequal(num1_str(1),'0') 794 IndexCell{Val}=['_i_j-(j+' num2_str ')']; 795 else 796 IndexCell{Val}=['_i_(j' num1_str ')-(j+' num2_str ')']; 797 end 798 end 799 displ_num(1)=num1; 800 displ_num(2)=num2; 801 case {'#_ab'} %TO COMPLETE 802 IndexCell{Val}=['_i_' num1_str '-' num2_str ]; 803 804 end 805 end 806 set(handles.NomType,'String',IndexCell) 807 SeriesData.displ_num(Val,:)=displ_num; 808 set(handles.series,'UserData',SeriesData) 809 % set(handles.NomType,'Value',Val) 810 811 if ~isequal(str_pair,'Dj=*|*')&~isequal(str_pair,'Di=*|*') 812 mode_list=get(handles.mode,'String'); 813 mode_value=get(handles.mode,'Value'); 814 mode=mode_list{mode_value}; 815 if isequal(mode,'series(Di)') 816 first_i=str2num(get(handles.num_first_i,'String')); 817 last_i=str2num(get(handles.num_last_i,'String')); 818 incr_i=str2num(get(handles.num_incr_i,'String')); 819 num1=first_i:incr_i:last_i; 820 lastfieldCell=get(handles.num_MaxIndex_i,'String'); 821 lastfield=str2num(lastfieldCell{1}); 822 if ~isempty(lastfield) 823 ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield)); 824 num1=num1(ind); 825 end 826 if ~isempty(num1) 827 set(handles.num_first_i,'String',num2str(num1(1))); 828 set(handles.num_last_i,'String',num2str(num1(end))); 829 end 830 testupdate=1; 831 elseif isequal(mode,'series(Dj)') 832 first_j=str2num(get(handles.num_first_j,'String')); 833 last_j=str2num(get(handles.num_last_j,'String')); 834 incr_j=str2num(get(handles.num_incr_j,'String')); 835 num_j=first_j:incr_j:last_j; 836 lastfieldCell=get(handles.num_MaxIndex_j,'String'); 837 if ~isempty(lastfieldCell) 838 lastfield2=lastfieldCell{1}; 839 ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... 840 (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2)); 841 end 842 testupdate=1; 843 end 844 845 %update the first and last times of the series 846 if testupdate && isfield(SeriesData,'Time') 847 if ~isempty(SeriesData.Time{1}) 848 displ_time(handles); 849 end 850 end 851 end 1203 1204 1205 1206 % return 1207 % %%%%%%%% 1208 % %update num_first_i and num_last_i according to the chosen image pairstring 1209 % testupdate=0; 1210 % 1211 % SeriesData=get(handles.series,'UserData'); 1212 % NomType=SeriesData.NomType{Val}; 1213 % list_pair=get(handles.ListPairs,'String');%get the menu of image pairs 1214 % index_pair=get(handles.ListPairs,'Value'); 1215 % str_pair=list_pair{index_pair}; 1216 % ind_equ=strfind(str_pair,'=');%find '=' 1217 % ind_sep=strfind(str_pair,'|');%find pair separator '|' 1218 % ind_com=strfind(str_pair,':');%find ':' 1219 % test_bursts=0; 1220 % if isempty(ind_sep) 1221 % ind_sep=strfind(str_pair,'-');%find pair separator if it is not '|' 1222 % test_bursts=1;% we are in the case of bursts 1223 % end 1224 % displ_num=[0 0 0 0]; %default 1225 % if ~isempty(ind_sep)&& ~strcmp(str_pair(ind_sep-1),'*')% if there is a pair separator ('|' or '-') 1226 % num1_str=str_pair(ind_equ(1)+1:ind_sep-1); 1227 % num2_str=str_pair(ind_sep+1:ind_com-1); 1228 % num1=str2double(num1_str); 1229 % num2=str2double(num2_str); 1230 % if isequal(num1_str(1),' ') 1231 % num1_str(1)=[]; 1232 % end 1233 % if isequal(num2_str(end),' ') 1234 % num2_str(end)=[]; 1235 % end 1236 % switch NomType 1237 % case {'_1-2_1'} 1238 % if isequal(num1_str(1),'0') 1239 % IndexCell{Val}=['_(i-(i+' num2_str ')_j']; 1240 % else 1241 % IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')_j']; 1242 % end 1243 % displ_num(3)=num1; 1244 % displ_num(4)=num2; 1245 % case {'_1-2'} 1246 % if isequal(num1_str(1),'0') 1247 % IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')']; 1248 % else 1249 % IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')']; 1250 % end 1251 % displ_num(3)=num1; 1252 % displ_num(4)=num2; 1253 % case '_1_1-2' 1254 % if test_bursts 1255 % IndexCell{Val}=['_i_' num1_str '-' num2_str ]; 1256 % else 1257 % if isequal(num1_str(1),'0') 1258 % IndexCell{Val}=['_i_j-(j+' num2_str ')']; 1259 % else 1260 % IndexCell{Val}=['_i_(j' num1_str ')-(j+' num2_str ')']; 1261 % end 1262 % end 1263 % displ_num(1)=num1; 1264 % displ_num(2)=num2; 1265 % case {'#_ab'} %TO COMPLETE 1266 % IndexCell{Val}=['_i_' num1_str '-' num2_str ]; 1267 % 1268 % end 1269 % end 1270 % set(handles.NomType,'String',IndexCell) 1271 % SeriesData.displ_num(Val,:)=displ_num; 1272 % set(handles.series,'UserData',SeriesData) 1273 % % set(handles.NomType,'Value',Val) 1274 % 1275 % if ~isequal(str_pair,'Dj=*|*')&~isequal(str_pair,'Di=*|*') 1276 % mode_list=get(handles.mode,'String'); 1277 % mode_value=get(handles.mode,'Value'); 1278 % mode=mode_list{mode_value}; 1279 % if isequal(mode,'series(Di)') 1280 % first_i=str2num(get(handles.num_first_i,'String')); 1281 % last_i=str2num(get(handles.num_last_i,'String')); 1282 % incr_i=str2num(get(handles.num_incr_i,'String')); 1283 % num1=first_i:incr_i:last_i; 1284 % lastfieldCell=get(handles.num_MaxIndex_i,'String'); 1285 % lastfield=str2num(lastfieldCell{1}); 1286 % if ~isempty(lastfield) 1287 % ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield)); 1288 % num1=num1(ind); 1289 % end 1290 % if ~isempty(num1) 1291 % set(handles.num_first_i,'String',num2str(num1(1))); 1292 % set(handles.num_last_i,'String',num2str(num1(end))); 1293 % end 1294 % testupdate=1; 1295 % elseif isequal(mode,'series(Dj)') 1296 % first_j=str2num(get(handles.num_first_j,'String')); 1297 % last_j=str2num(get(handles.num_last_j,'String')); 1298 % incr_j=str2num(get(handles.num_incr_j,'String')); 1299 % num_j=first_j:incr_j:last_j; 1300 % lastfieldCell=get(handles.num_MaxIndex_j,'String'); 1301 % if ~isempty(lastfieldCell) 1302 % lastfield2=lastfieldCell{1}; 1303 % ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... 1304 % (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2)); 1305 % end 1306 % testupdate=1; 1307 % end 1308 % 1309 % %update the first and last times of the series 1310 % if testupdate && isfield(SeriesData,'Time') 1311 % if ~isempty(SeriesData.Time{1}) 1312 % displ_time(handles); 1313 % end 1314 % end 1315 % end 1316 1317 %------------------------------------- 1318 function enable_i(handles,state) 1319 set(handles.i_txt,'Visible',state) 1320 set(handles.num_first_i,'Visible',state) 1321 set(handles.num_last_i,'Visible',state) 1322 set(handles.num_incr_i,'Visible',state) 1323 % set(handles.num_MaxIndex_i,'Visible',state) 1324 set(handles.num_ref_i,'Visible',state) 1325 set(handles.ref_i_text,'Visible',state) 1326 1327 %----------------------------------- 1328 function enable_j(handles,state) 1329 set(handles.j_txt,'Visible',state) 1330 % set(handles.num_MinIndex_j,'Visible',state) 1331 set(handles.num_first_j,'Visible',state) 1332 set(handles.num_last_j,'Visible',state) 1333 set(handles.num_incr_j,'Visible',state) 1334 % set(handles.num_MaxIndex_j,'Visible',state) 1335 set(handles.num_ref_j,'Visible',state) 1336 set(handles.ref_j_text,'Visible',state) 1337 1338 %----------------------------------- 1339 function view_FieldMenu(handles,state) 1340 % set(handles.FieldMenu,'Visible',state) 1341 % set(handles.Field_text,'Visible',state) 1342 set(handles.InputFields,'Visible',state) 1343 1344 %----------------------------------- 1345 function view_FieldMenu_1(handles,state) 1346 set(handles.FieldMenu_1,'Visible',state) 1347 set(handles.Field_text_1,'Visible',state) 1348 1349 % %----------------------------------- 1350 % function view_TRANSFORM(handles,state) 1351 % set(handles.TRANSFORM_frame,'Visible',state) 1352 % set(handles.transform_fct,'Visible',state); 1353 % set(handles.TRANSFORM_title,'Visible',state) 1354 1355 1356 %list_pair_civ_Callback([],[],handles) 1357 1358 852 1359 853 1360 %------------------------------------------------------------------------ … … 1035 1542 last_j=str2num(get(handles.num_last_j,'String')); 1036 1543 ref_j=ceil((first_j+last_j)/2); 1037 set(handles. ref_j,'String', num2str(ref_j))1544 set(handles.num_ref_j,'String', num2str(ref_j)) 1038 1545 ref_j_Callback(hObject, eventdata, handles) 1039 1546 SeriesData=get(handles.series,'UserData'); … … 1044 1551 1045 1552 1046 %------------------------------------------------------------------------1047 function ref_i_Callback(hObject, eventdata, handles)1048 %------------------------------------------------------------------------1049 mode_list=get(handles.mode,'String');1050 mode_value=get(handles.mode,'Value');1051 mode=mode_list{mode_value};1052 SeriesData=get(handles.series,'UserData');1053 % if ~isempty(SeriesData)1054 if ~isempty(SeriesData.i2_series)||~isempty(SeriesData.j2_series)1055 if isequal(mode,'series(Di)')1056 find_netcpair_civ(handles);% update the menu of pairs depending on the available netcdf files1057 end1058 end1059 % end1060 1061 %------------------------------------------------------------------------1062 function ref_j_Callback(hObject, eventdata, handles)1063 %------------------------------------------------------------------------1064 mode_list=get(handles.mode,'String');1065 mode_value=get(handles.mode,'Value');1066 mode=mode_list{mode_value};1067 SeriesData=get(handles.series,'UserData');1068 if ~isempty(SeriesData)1069 if ~isempty(SeriesData.i2_series)||~isempty(SeriesData.j2_series)1070 if isequal(mode,'series(Di)')1071 find_netcpair_civ(handles);% update the menu of pairs depending on the available netcdf files1072 end1073 end1074 end1075 1553 % NomTypeCell=SeriesData.NomType; 1076 1554 % if ~isempty(NomTypeCell) … … 1079 1557 % if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2') 1080 1558 % if isequal(mode,'series(Dj)') 1081 % fi nd_netcpair_civ(handles,Val);% update the menu of pairsdepending on the available netcdf files1559 % fill_ListPair(handles,Val);% update the menu of pairstring depending on the available netcdf files 1082 1560 % end 1083 1561 % end 1084 1562 % end 1563 %------------------------------------------------------------------------ 1564 % ---- find the times corresponding to the first and last indices of a series 1565 function displ_time(handles) 1566 %------------------------------------------------------------------------ 1567 SeriesData=get(handles.series,'UserData');% 1568 ref_i=[str2num(get(handles.num_first_i,'String')) str2num(get(handles.num_last_i,'String'))]; 1569 ref_j=[str2num(get(handles.num_first_j,'String')) str2num(get(handles.num_last_j,'String'))]; 1570 % last_i=str2num(get(handles.num_last_i,'String')); 1571 % last_j=str2num(get(handles.num_last_j,'String')); 1572 TimeTable=get(handles.TimeTable,'Data'); 1573 1574 for iview=1:size(TimeTable,1) 1575 Pairs=get(handles.PairString,'Data'); 1576 i1=ref_i; 1577 j1=ref_j; 1578 i2=ref_i; 1579 j2=ref_j; 1580 if ~isempty(Pairs{iview,1}) 1581 r=regexp(Param.Pairs.list_pair_civ,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names'); 1582 if isempty(r) 1583 r=regexp(Param.Pairs.list_pair_civ,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names'); 1584 end 1585 switch r.mode 1586 case 'Di=' % case 'series(Di)') 1587 i1=ref_i-str2num(r.num1); 1588 i2=ref_i+str2num(r.num2); 1589 case 'Dj=' % case 'series(Dj)' 1590 j1=ref_j-str2num(r.num1); 1591 j2=ref_j+str2num(r.num2); 1592 case '-' % case 'bursts' 1593 j1=str2num(r.num1)*ones(size(ref_i)); 1594 j2=str2num(r.num2)*ones(size(ref_i)); 1595 end 1596 end 1597 if isempty(ref_j) 1598 time_first=(SeriesData.Time{iview}(i1(1))+SeriesData.Time{iview}(i2(1)))/2; 1599 time_last=(SeriesData.Time{iview}(i1(2))+SeriesData.Time{iview}(i2(2)))/2; 1600 else 1601 time_first=(SeriesData.Time{iview}(i1(1),j1(1))+SeriesData.Time{iview}(i2(1),j2(1)))/2; 1602 time_last=(SeriesData.Time{iview}(i1(2),j1(2))+SeriesData.Time{iview}(i2(2),j2(2)))/2; 1603 end 1604 TimeTable{iview,2}=time_first; %TODO: take into account pairs 1605 TimeTable{iview,3}=time_last; %TODO: take into account pairs 1606 end 1607 set(handles.TimeTable,'Data',TimeTable) 1608 return 1609 1610 1611 NomType=InputTable(:,4); 1612 mode_list=get(handles.mode,'String'); 1613 index_mode=get(handles.mode,'Value'); 1614 1615 mode=mode_list{index_mode}; 1616 1617 time_first=[]; 1618 time_last=[]; 1619 if ~isfield(SeriesData,'Time') 1620 SeriesData.Time{1}=[]; 1621 end 1622 TimeTable=get(handles.TimeTable,'Data'); 1623 for iview=1:size(TimeTable,1) 1624 time_first_cell{iview}='?'; 1625 time_last_cell{iview}='?';%default 1626 time=SeriesData.Time{iview}; 1627 if isequal(NomType{iview},'_1-2_1')|isequal(NomType{iview},'_1_1-2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_1-2') 1628 if isfield(SeriesData,'displ_num')& ~isempty(SeriesData.displ_num) 1629 ind_shift=SeriesData.displ_num(iview,:); 1630 if isequal(mode,'bursts') 1631 first_j=0; 1632 last_j=0; 1633 end 1634 first_i1=first_i +ind_shift(3); 1635 first_i2 =first_i +ind_shift(4); 1636 first_j1 =first_j +ind_shift(1); 1637 first_j2 =first_j +ind_shift(2); 1638 last_i1=last_i +ind_shift(3); 1639 last_i2 =last_i +ind_shift(4); 1640 last_j1 =last_j +ind_shift(1); 1641 last_j2 =last_j +ind_shift(2); 1642 siz=size(SeriesData.Time{1}); 1643 if first_i1>=1 && first_j1>=1 && siz(1)>=last_i2 && siz(2)>=last_j2 1644 time_first=(time(first_i1,first_j1)+time(first_i2,first_j2))/2; 1645 time_last=(time(last_i1,last_j1)+time(last_i2,last_j2))/2; 1646 else%read the time in the nc files 1647 RootPath=get(handles.RootPath,'String'); 1648 RootFile=get(handles.RootFile,'String'); 1649 SubDir=get(handles.SubDir,'String'); 1650 %VelType=get(handles.VelType,'String'); 1651 VelType_str=get(handles.VelTypeMenu,'String'); 1652 VelType_val=get(handles.VelTypeMenu,'Value'); 1653 VelType=VelType_str{VelType_val}; 1654 filebase=fullfile(RootPath{1},RootFile{1}); 1655 [filefirst]=name_generator(filebase,first_i1,first_j1,'.nc',NomType{iview},1,first_i2,first_j2,SubDir{iview}); 1656 if exist(filefirst,'file') 1657 Attrib=nc2struct(filefirst,[]); 1658 if isfield(Attrib,'Time') 1659 time_first=Attrib.Time; 1660 else 1661 if isfield(Attrib,'absolut_time_T0') 1662 time_first=Attrib.absolut_time_T0; 1663 end 1664 if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) 1665 time_first=Attrib.absolut_time_T0_2; 1666 end 1667 end 1668 end 1669 [filelast]=name_generator(filebase,last_i1,last_j1,'.nc',NomType{iview},1,last_i2,last_j2,SubDir{iview}); 1670 if exist(filelast,'file') 1671 Attrib=nc2struct(filelast,[]); 1672 if isfield(Attrib,'Time') 1673 time_last=Attrib.Time; 1674 else 1675 if isfield(Attrib,'absolut_time_T0') 1676 time_last=Attrib.absolut_time_T0; 1677 end 1678 if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) 1679 time_last=Attrib.absolut_time_T0_2; 1680 end 1681 end 1682 end 1683 end 1684 end 1685 else 1686 siz=size(time); 1687 if siz(1)>=last_i && siz(2)>=last_j && first_i>=1 && first_j>=1 1688 time_first=times(first_i,first_j); 1689 time_last=times(last_i,last_j); 1690 end 1691 end 1692 time_first_cell{iview}=num2str(time_first,4); 1693 time_last_cell{iview}=num2str(time_last,4); 1694 end 1695 1085 1696 1086 1697 %------------------------------------------------------------------------ … … 1405 2016 1406 2017 %------------------------------------------------------------------------ 1407 % --- determine the list of index pairs of processing file2018 % --- determine the list of index pairstring of processing file 1408 2019 function [num_i1,num_i2,num_j1,num_j2,num_i_out,num_j_out]=find_file_indices(num_i,num_j,ind_shift,NomType,mode) 1409 2020 %------------------------------------------------------------------------ … … 1444 2055 end 1445 2056 1446 %------------------------------------------------------------------------ 1447 % ---- find the times corresponding to the first and last indices of a series 1448 function displ_time(handles) 1449 %------------------------------------------------------------------------ 1450 SeriesData=get(handles.series,'UserData');% 1451 first_i=str2num(get(handles.num_first_i,'String')); 1452 first_j=str2num(get(handles.num_first_j,'String')); 1453 last_i=str2num(get(handles.num_last_i,'String')); 1454 last_j=str2num(get(handles.num_last_j,'String')); 1455 InputTable=get(handles.InputTable,'Data'); 1456 NomType=InputTable(:,4); 1457 % NomType=SeriesData.NomType; 1458 mode_list=get(handles.mode,'String'); 1459 index_mode=get(handles.mode,'Value'); 1460 mode=mode_list{index_mode}; 1461 1462 time_first=[]; 1463 time_last=[]; 1464 if ~isfield(SeriesData,'Time') 1465 SeriesData.Time{1}=[]; 1466 end 1467 for iview=1:length(NomType) 1468 time_first_cell{iview}='?'; 1469 time_last_cell{iview}='?';%default 1470 time=SeriesData.Time{iview}; 1471 if isequal(NomType{iview},'_1-2_1')|isequal(NomType{iview},'_1_1-2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_1-2') 1472 if isfield(SeriesData,'displ_num')& ~isempty(SeriesData.displ_num) 1473 ind_shift=SeriesData.displ_num(iview,:); 1474 if isequal(mode,'bursts') 1475 first_j=0; 1476 last_j=0; 1477 end 1478 first_i1=first_i +ind_shift(3); 1479 first_i2 =first_i +ind_shift(4); 1480 first_j1 =first_j +ind_shift(1); 1481 first_j2 =first_j +ind_shift(2); 1482 last_i1=last_i +ind_shift(3); 1483 last_i2 =last_i +ind_shift(4); 1484 last_j1 =last_j +ind_shift(1); 1485 last_j2 =last_j +ind_shift(2); 1486 siz=size(SeriesData.Time{1}); 1487 if first_i1>=1 && first_j1>=1 && siz(1)>=last_i2 && siz(2)>=last_j2 1488 time_first=(time(first_i1,first_j1)+time(first_i2,first_j2))/2; 1489 time_last=(time(last_i1,last_j1)+time(last_i2,last_j2))/2; 1490 else%read the time in the nc files 1491 RootPath=get(handles.RootPath,'String'); 1492 RootFile=get(handles.RootFile,'String'); 1493 SubDir=get(handles.SubDir,'String'); 1494 %VelType=get(handles.VelType,'String'); 1495 VelType_str=get(handles.VelTypeMenu,'String'); 1496 VelType_val=get(handles.VelTypeMenu,'Value'); 1497 VelType=VelType_str{VelType_val}; 1498 filebase=fullfile(RootPath{1},RootFile{1}); 1499 [filefirst]=name_generator(filebase,first_i1,first_j1,'.nc',NomType{iview},1,first_i2,first_j2,SubDir{iview}); 1500 if exist(filefirst,'file') 1501 Attrib=nc2struct(filefirst,[]); 1502 if isfield(Attrib,'Time') 1503 time_first=Attrib.Time; 1504 else 1505 if isfield(Attrib,'absolut_time_T0') 1506 time_first=Attrib.absolut_time_T0; 1507 end 1508 if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) 1509 time_first=Attrib.absolut_time_T0_2; 1510 end 1511 end 1512 end 1513 [filelast]=name_generator(filebase,last_i1,last_j1,'.nc',NomType{iview},1,last_i2,last_j2,SubDir{iview}); 1514 if exist(filelast,'file') 1515 Attrib=nc2struct(filelast,[]); 1516 if isfield(Attrib,'Time') 1517 time_last=Attrib.Time; 1518 else 1519 if isfield(Attrib,'absolut_time_T0') 1520 time_last=Attrib.absolut_time_T0; 1521 end 1522 if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) 1523 time_last=Attrib.absolut_time_T0_2; 1524 end 1525 end 1526 end 1527 end 1528 end 1529 else 1530 siz=size(time); 1531 if siz(1)>=last_i && siz(2)>=last_j && first_i>=1 && first_j>=1 1532 time_first=times(first_i,first_j); 1533 time_last=times(last_i,last_j); 1534 end 1535 end 1536 time_first_cell{iview}=num2str(time_first,4); 1537 time_last_cell{iview}=num2str(time_last,4); 1538 end 2057 1539 2058 % set(handles.time_first,'Value',1) 1540 2059 % set(handles.time_last,'Value',1) … … 1693 2212 end 1694 2213 2214 %------------------------------------------------------------------------ 1695 2215 % --- Executes on button press in REFRESH_INDICES. 1696 2216 function REFRESH_INDICES_Callback(hObject, eventdata, handles) 2217 %------------------------------------------------------------------------ 1697 2218 % hObject handle to REFRESH_INDICES (see GCBO) 1698 2219 % eventdata reserved - to be defined in a future version of MATLAB … … 1753 2274 ListView_Callback(hObject,eventdata,handles) 1754 2275 end 1755 set(handles.Pair s,'Visible',state_Pairs)2276 set(handles.PairString,'Visible',state_Pairs) 1756 2277 enable_j(handles,state_j) 1757 2278 set(handles.REFRESH_INDICES,'BackgroundColor',[1 0 0]) … … 1773 2294 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists 1774 2295 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]); 1775 1776 %1777 % [RootPathSub,FileName,FileExt]=fileparts(fileinput);1778 % [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPathSub,[FileName FileExt]);1779 2296 if isempty(RootFile)&&isempty(i1_series) 1780 2297 errormsg='no input file in the series'; 1781 2298 return 1782 2299 end 1783 % [tild,tild,FileExt]=fileparts(fileinput); 1784 2300 2301 %% adjust the min and max indices common to all the file series 1785 2302 MinIndex=get(handles.MinIndex,'Data'); 1786 2303 MaxIndex=get(handles.MaxIndex,'Data'); … … 1931 2448 end 1932 2449 if isfield(XmlData,'Time') 1933 time =XmlData.Time;2450 time{iview}=XmlData.Time; 1934 2451 end 1935 2452 if isfield(XmlData,'Camera') … … 1949 2466 elseif isequal(ext_imadoc,'.civ') 1950 2467 [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']); 1951 time =XmlData.Time;2468 time{iview}=XmlData.Time; 1952 2469 if error==2, warntext=['no file ' FileBase '.civ']; 1953 2470 elseif error==1, warntext='inconsistent number of fields in the .civ file'; 1954 2471 end 1955 end 1956 2472 end 2473 2474 %% update time table 2475 TimeTable=get(handles.TimeTable,'Data') 2476 TimeTable{iview,1}=time(MinIndex_i,MinIndex_j); 2477 TimeTable{iview,4}=time(MaxIndex_i,MaxIndex_j); 2478 set(handles.TimeTable,'Data',TimeTable) 1957 2479 1958 2480 %% number of slices … … 1966 2488 set(handles.num_NbSlice,'String',num2str(NbSlice)) 1967 2489 end 1968 % set(handles.mode,'Visible','off') % do not show index pairs by default1969 set(handles.Pair s,'Visible','off')1970 % set(handles. ref_i,'Visible','off')2490 % set(handles.mode,'Visible','off') % do not show index pairstring by default 2491 set(handles.PairString,'Visible','off') 2492 % set(handles.num_ref_i,'Visible','off') 1971 2493 % set(handles.ref_i_text,'Visible','off') 1972 2494 testpair=0; 1973 %set the menus of image pairs and default selection for series1974 %list pairs if relevant2495 %set the menus of image pairstring and default selection for series 2496 %list pairstring if relevant 1975 2497 % Val=get(handles.NomType,'Value'); 1976 2498 % synchronise_view(handles,Val) … … 1981 2503 % state_j='on'; %case of j index 1982 2504 % end 1983 % show index pairs if files exist2505 % show index pairstring if files exist 1984 2506 set(handles.series,'UserData',SeriesData) 1985 2507 … … 2020 2542 2021 2543 h_fun('BATCH');% TODO modify the called function to read the xml file as input parameter 2022 2023 2024 % --- Executes on selection change in txt_Pairs2025 function txt_Pairs_Callback(hObject, eventdata, handles)2026 2027 %------------------------------------------------------------------------2028 % --- Executes on selection change in ListView.2029 function ListView_Callback(hObject, eventdata, handles)2030 %------------------------------------------------------------------------2031 ListViewString=get(handles.ListView,'String');2032 if isempty(ListViewString)2033 ListViewString={''};2034 end2035 ListViewValue=get(handles.ListView,'Value');2036 View=str2double(ListViewString{ListViewValue});2037 if isnan(View)2038 set(handles.Pairs,'Visible','off')2039 else2040 set(handles.Pairs,'Visible','on')2041 SeriesData=get(handles.series,'UserData');2042 if isfield(SeriesData,'j1_series')&&(~isempty(SeriesData.i2_series{View})||~isempty(SeriesData.j2_series{View}))2043 if ~isempty(SeriesData.i2_series{View}) %pairs with i View2044 set(handles.mode,'Value',1)2045 set(handles.mode,'String',{'series(Di)'})2046 else %pairs with j View2047 nbfield=size(SeriesData.j2_series{View},1);2048 nbfield2=size(SeriesData.j2_series{View},2);2049 set(handles.mode,'Value',1)2050 set(handles.mode,'String',{'bursts';'series(Dj)'})2051 if nbfield2>10 || nbfield==12052 set(handles.mode,'Value',2);2053 else2054 set(handles.mode,'Value',1);2055 end2056 end2057 end2058 mode_Callback([],[], handles)2059 end2060 2061 -
trunk/src/uvmat.m
r407 r408 783 783 set(handles.FileIndex_1,'String',FileIndex_1) 784 784 else 785 set(handles.SubField,'Value',0) 786 SubField_Callback([], [], handles) 785 msgbox_uvmat('WARNING','unable to synchronise the indices of the two series') 786 % set(handles.SubField,'Value',0) 787 % SubField_Callback([], [], handles) 787 788 end 788 789 end -
trunk/src/view_field.m
r406 r408 788 788 % Hints: contents = cellstr(get(hObject,'String')) returns ColorScalar contents as cell array 789 789 % contents{get(hObject,'Value')} returns selected item from ColorScalar 790 791 792 793 function num_ColCode2_Callback(hObject, eventdata, handles) 794 % hObject handle to num_colcode2 (see GCBO) 795 % eventdata reserved - to be defined in a future version of MATLAB 796 % handles structure with handles and user data (see GUIDATA) 797 798 % Hints: get(hObject,'String') returns contents of num_colcode2 as text 799 % str2double(get(hObject,'String')) returns contents of num_colcode2 as a double
Note: See TracChangeset
for help on using the changeset viewer.