- Timestamp:
- Dec 23, 2011, 11:56:21 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_file_series.m
r343 r350 40 40 41 41 %% get input root name and nomenclature type 42 % [RootPath,RootFile,~,~,~,~,FileExt,NomType,SubDir]=name2display(fileinput);43 42 [RootPath,SubDir,RootFile,~,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fileinput); 44 43 … … 180 179 % look for the numerical string of the first files to update the NomType (take into account the 0 before the number) 181 180 max_j=max(ref_j_list); 182 ref_ij=ref_i_list*max_j+ref_j_list; % ordered by index i, then by j for a given i. 181 if isempty(max_j) 182 ref_ij=ref_i_list; 183 else 184 ref_ij=ref_i_list*max_j+ref_j_list; % ordered by index i, then by j for a given i. 185 end 183 186 [~,ifile]=min(ref_ij(ref_ij>0)); 187 if isempty(ifile) 188 RootPath=''; 189 RootFile=''; 190 NomType=''; 191 else 184 192 [~,~,~,~,~,~,~,~,NomType]=fileparts_uvmat(dirpair(ifile).name); 193 end 185 194 end 186 195 -
trunk/src/read_GUI.m
r323 r350 59 59 % eval(['struct.' tag '=input;']) 60 60 end 61 case 'uitable' 62 struct.(tag)=get(hchild(ichild),'Data'); 61 63 end 62 64 end -
trunk/src/series.m
r343 r350 113 113 if isfield(param,'FileName') 114 114 if isfield(param,'FileName_1') 115 update_ file(handles,param.FileName_1,0)116 update_ file(handles,param.FileName,1)115 update_rootfile(handles,param.FileName_1,0) 116 update_rootfile(handles,param.FileName,1) 117 117 else 118 update_ file(handles,param.FileName,0)118 update_rootfile(handles,param.FileName,0) 119 119 end 120 120 end … … 126 126 FieldCell{1}=param.list_fields{param.index_fields}; 127 127 end 128 NomType_Callback(hObject, eventdata, handles)129 128 % NomType_Callback(hObject, eventdata, handles) 129 REFRESH_INDICES_Callback(hObject, eventdata, handles) 130 130 %loads the information stored in prefdir to initiate the list of ACTION functions 131 131 fct_menu={'check_data_files';'aver_stat';'time_series';'merge_proj';'clean_civ_cmx'}; … … 211 211 % -------------------------------------------------------------------- 212 212 function MenuBrowse_Callback(hObject, eventdata, handles) 213 214 RootPathCell=get(handles.RootPath,'String'); 215 SubDirCell=get(handles.SubDir,'String'); 216 RootFileCell=get(handles.RootFile,'String'); 213 InputTable=get(handles.InputTable,'Data'); 214 RootPathCell=InputTable(:,1); 215 SubDirCell=InputTable(:,1); 216 RootFileCell=InputTable(:,1); 217 %RootPathCell=get(handles.RootPath,'String'); 218 %SubDirCell=get(handles.SubDir,'String'); 219 %RootFileCell=get(handles.RootFile,'String'); 217 220 oldfile=''; %default 218 221 if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box … … 256 259 warndlg_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 257 260 else 258 update_ file(handles,fileinput,0)261 update_rootfile(handles,fileinput,0) 259 262 %update list of recent files in the menubar 260 263 MenuFile_1=fileinput; … … 293 296 function MenuFile_1_Callback(hObject, eventdata, handles) 294 297 fileinput=get(handles.MenuFile_1,'Label'); 295 update_ file(handles,fileinput,0)298 update_rootfile(handles,fileinput,0) 296 299 297 300 % -------------------------------------------------------------------- 298 301 function MenuFile_2_Callback(hObject, eventdata, handles) 299 302 fileinput=get(handles.MenuFile_2,'Label'); 300 update_ file(handles,fileinput,0)303 update_rootfile(handles,fileinput,0) 301 304 302 305 % -------------------------------------------------------------------- 303 306 function MenuFile_3_Callback(hObject, eventdata, handles) 304 307 fileinput=get(handles.MenuFile_3,'Label'); 305 update_ file( handles,fileinput,0)308 update_rootfile( handles,fileinput,0) 306 309 307 310 % -------------------------------------------------------------------- 308 311 function MenuFile_4_Callback(hObject, eventdata, handles) 309 312 fileinput=get(handles.MenuFile_4,'Label'); 310 update_ file(handles,fileinput,0)313 update_rootfile(handles,fileinput,0) 311 314 312 315 % -------------------------------------------------------------------- 313 316 function MenuFile_5_Callback(hObject, eventdata, handles) 314 317 fileinput=get(handles.MenuFile_5,'Label'); 315 update_ file(handles,fileinput,0)318 update_rootfile(handles,fileinput,0) 316 319 317 320 % -------------------------------------------------------------------- 318 321 function MenuBrowse_insert_Callback(hObject, eventdata, handles) 319 320 RootPathCell=get(handles.RootPath,'String'); 321 RootFileCell=get(handles.RootFile,'String'); 322 InputTable=get(handles.InputTable,'Data'); 323 RootPathCell=InputTable(:,1); 324 SubDirCell=InputTable(:,3); 325 RootFileCell=InputTable(:,2); 326 % RootPathCell=get(handles.RootPath,'String'); 327 % RootFileCell=get(handles.RootFile,'String'); 322 328 oldfile=''; %default 323 329 if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box … … 360 366 msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 361 367 else 362 update_ file(handles,fileinput,1)368 update_rootfile(handles,fileinput,1) 363 369 %update list of recent files in the menubar 364 370 MenuFile_1=fileinput; … … 397 403 function MenuFile_insert_1_Callback(hObject, eventdata, handles) 398 404 fileinput=get(handles.MenuFile_insert_1,'Label'); 399 update_ file(handles,fileinput,1)405 update_rootfile(handles,fileinput,1) 400 406 401 407 % -------------------------------------------------------------------- 402 408 function MenuFile_insert_2_Callback(hObject, eventdata, handles) 403 409 fileinput=get(handles.MenuFile_insert_2,'Label'); 404 update_ file(handles,fileinput,1)410 update_rootfile(handles,fileinput,1) 405 411 406 412 % -------------------------------------------------------------------- 407 413 function MenuFile_insert_3_Callback(hObject, eventdata, handles) 408 414 fileinput=get(handles.MenuFile_insert_3,'Label'); 409 update_ file( handles,fileinput,1)415 update_rootfile( handles,fileinput,1) 410 416 411 417 % -------------------------------------------------------------------- 412 418 function MenuFile_insert_4_Callback(hObject, eventdata, handles) 413 419 fileinput=get(handles.MenuFile_insert_4,'Label'); 414 update_ file( handles,fileinput,1)420 update_rootfile( handles,fileinput,1) 415 421 416 422 % -------------------------------------------------------------------- 417 423 function MenuFile_insert_5_Callback(hObject, eventdata, handles) 418 424 fileinput=get(handles.MenuFile_insert_5,'Label'); 419 update_ file(handles,fileinput,1)425 update_rootfile(handles,fileinput,1) 420 426 421 427 %------------------------------------------------------------------------ … … 425 431 % fileinput: name of the input file 426 432 % addtest: =0 to refresh the list of file series, =1 to append a new series to the list (from the menu bar option 'Open_insert') 427 function update_ file(handles,fileinput,addtest)433 function update_rootfile(handles,fileinput,addtest) 428 434 %------------------------------------------------------------------------ 429 435 … … 437 443 set(handles.RUN, 'Enable','On') 438 444 set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red 439 set(handles.RootPath,'BackgroundColor',[1 1 0]) % set RootPath edit box to yellow 445 % set(handles.RootPath,'BackgroundColor',[1 1 0]) % set RootPath edit box to yellow 446 set(handles.InputTable,'BackgroundColor',[1 1 0]) % set RootPath edit box to yellow 440 447 drawnow 441 448 … … 445 452 return 446 453 end 447 [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput); 448 449 450 %% look for min and max indices existing in the file series and update NomType 451 [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(fileinput) 452 MinIndex_i=min(i1_series(i1_series>0)); 453 if ~isempty(i2_series) 454 MaxIndex_i=max(i2_series(i2_series>0)); 455 else 456 MaxIndex_i=max(i1_series(i1_series>0)); 457 end 458 MinIndex_j=min(j1_series(j1_series>0)); 459 if ~isempty(j2_series) 460 MaxIndex_j=max(j2_series(j2_series>0)); 461 else 462 MaxIndex_j=max(j1_series(j1_series>0)); 463 end 464 if addtest% case of insertion of a new series (menu bar option Open_insert) 465 MinIndex_i_cell=[{num2str(MinIndex_i)} ;get(handles.num_MinIndex_i,'String')]; 466 nb_field_cell=[{num2str(MaxIndex_i)} ;get(handles.num_MaxIndex_i,'String')]; 467 MinIndex_j_cell=[{num2str(MinIndex_j)} ;get(handles.num_MinIndex_j,'String')]; 468 nb_field2_cell=[{num2str(MaxIndex_j)} ;get(handles.num_MaxIndex_j,'String')]; 469 else % refresh the list (menu bar option Open) 470 MinIndex_i_cell={num2str(MinIndex_i)}; 471 MinIndex_j_cell={num2str(MinIndex_j)}; 472 nb_field_cell={num2str(MaxIndex_i)}; 473 nb_field2_cell={num2str(MaxIndex_j)}; 474 end 475 set(handles.num_MinIndex_i,'String',MinIndex_i_cell); 476 set(handles.num_MinIndex_j,'String',MinIndex_j_cell); 477 set(handles.num_MaxIndex_i,'String',nb_field_cell); 478 set(handles.num_MaxIndex_j,'String',nb_field2_cell); 479 480 set(handles.waitbar_frame,'Units','pixels') 481 pos=get(handles.waitbar_frame,'Position'); 482 xima=0.5:pos(3)-0.5;% pixel positions on the image representing the existing file indices 483 yima=0.5:pos(4)-0.5; 484 [XIma,YIma]=meshgrid(xima,yima); 485 nb_i=size(i1_series,1); 486 nb_j=size(i1_series,2); 487 ind_i=(0.5:nb_i-0.5)*pos(3)/nb_i; 488 ind_j=(0.5:nb_j-0.5)*pos(4)/nb_j; 489 [Ind_i,Ind_j]=meshgrid(ind_i,ind_j); 490 CData=zeros([size(XIma) 3]); 491 file_ima=double((i1_series(:,:,1)>0)'); 492 if numel(file_ima)>=2 493 if size(file_ima,1)==1 494 CLine=interp1(ind_i,file_ima,xima,'nearest'); 495 CData(:,:,2)=ones(size(yima'))*CLine; 496 % file_ima=ones(pos(4),1)*file_ima; 497 % Ind_i= 498 else 499 CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest'); 500 end 501 set(handles.waitbar_frame,'CData',CData) 502 end 503 set(handles.waitbar_frame,'Units','normalized') 504 505 % CData(:,1:floor(advance_ratio*size(CData,2)),1:2)=1; 506 % set(hwaitbar,'CData',CData) 507 %update_waitbar(handles.waitbar_frame,[],0) 508 454 [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomType]=fileparts_uvmat(fileinput); 509 455 510 456 %% determine reference field indices … … 558 504 559 505 %% fill the list of file series 560 % select the first line in the list561 set(handles.RootPath,'Value',1)562 set(handles.SubDir,'Value',1)563 set(handles.RootFile,'Value',1)564 set(handles.NomType,'Value',1)565 set(handles.FileExt,'Value',1)566 set(handles.num_MaxIndex_i,'Value',1)567 set(handles.num_MaxIndex_j,'Value',1)568 506 569 507 % insert the current file series at the head of the list 508 InputTable=get(handles.InputTable,'Data'); 570 509 if addtest 571 SeriesData=get(handles.series,'UserData'); 572 % SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num]; 573 SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile; 574 SeriesData.i1_series=[SeriesData.i1_series;{i1_series}]; 575 SeriesData.i2_series=[SeriesData.i2_series;{i2_series}]; 576 SeriesData.j1_series=[SeriesData.j1_series;{j1_series}]; 577 SeriesData.j2_series=[SeriesData.j2_series;{j2_series}]; 578 RootPathCell=[{RootPath}; get(handles.RootPath,'String')] ; 579 SubDirCell=[{SubDir}; get(handles.SubDir,'String')]; 580 RootFileCell=[{RootFile}; get(handles.RootFile,'String')]; 581 NomTypeCell=[{NomType}; SeriesData.NomType]; 582 FileExtCell=[{FileExt}; get(handles.FileExt,'String')]; 583 FileTypeCell=[{FileType};SeriesData.FileType]; 584 set(handles.NomType,'String',[{};get(handles.NomType,'String')]) 510 % SeriesData=get(handles.series,'UserData'); 511 % % SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num]; 512 % SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile; 513 % SeriesData.i1_series=[SeriesData.i1_series;{i1_series}]; 514 % SeriesData.i2_series=[SeriesData.i2_series;{i2_series}]; 515 % SeriesData.j1_series=[SeriesData.j1_series;{j1_series}]; 516 % SeriesData.j2_series=[SeriesData.j2_series;{j2_series}]; 517 InputTable=get(handles.InputTable,'Data'); 518 InputTable=[{RootPath},{RootFile},{SubDir},{NomType},{FileExt};InputTable]; 519 % RootPathCell=[{RootPath}; InputTable{] ; 520 % SubDirCell=[{SubDir}; get(handles.SubDir,'String')]; 521 % RootFileCell=[{RootFile}; get(handles.RootFile,'String')]; 522 % NomTypeCell=[{NomType}; SeriesData.NomType]; 523 % FileExtCell=[{FileExt}; get(handles.FileExt,'String')]; 524 % FileTypeCell=[{FileType};SeriesData.FileType]; 525 % set(handles.NomType,'String',[{};get(handles.NomType,'String')]) 585 526 586 527 % or re-initialise the list of input file series 587 528 else 588 SeriesData=[];%re-initialisation 589 % SeriesData.displ_num=[0 0 0 0]; 590 SeriesData.i1_series={i1_series}; 591 SeriesData.i2_series={i2_series}; 592 SeriesData.j1_series={j1_series}; 593 SeriesData.j2_series={j2_series}; 594 RootPathCell={RootPath}; 595 SubDirCell={SubDir}; 596 RootFileCell={RootFile}; 597 NomTypeCell={NomType}; 598 FileExtCell={FileExt}; 599 FileTypeCell={FileType}; 600 end 601 SeriesData.NomType=NomTypeCell; 602 SeriesData.FileType=FileTypeCell; 529 InputTable=[{RootPath},{RootFile},{SubDir},{NomType},{FileExt}]; 530 end 531 set(handles.InputTable,'Data',InputTable) 532 % SeriesData=[];%re-initialisation 533 % % SeriesData.displ_num=[0 0 0 0]; 534 % % SeriesData.i1_series={i1_series}; 535 % % SeriesData.i2_series={i2_series}; 536 % % SeriesData.j1_series={j1_series}; 537 % % SeriesData.j2_series={j2_series}; 538 % RootPathCell={RootPath}; 539 % SubDirCell={SubDir}; 540 % RootFileCell={RootFile}; 541 % NomTypeCell={NomType}; 542 % FileExtCell={FileExt}; 543 % % FileTypeCell={FileType}; 544 % end 545 % SeriesData.NomType=NomTypeCell; 546 %SeriesData.FileType=FileTypeCell; 603 547 SeriesData.CurrentInputFile=fileinput; 604 set(handles.RootPath,'String',RootPathCell); 605 set(handles.SubDir,'String',SubDirCell); 606 set(handles.RootFile,'String',RootFileCell); 607 set(handles.NomType,'String',NomTypeCell); 608 set(handles.FileExt,'String',FileExtCell); 609 610 %% enable field and veltype menus 611 testfield=isequal(get(handles.FieldMenu,'enable'),'on'); 612 testfield_1=isequal(get(handles.FieldMenu_1,'enable'),'on'); 613 testveltype=isequal(get(handles.VelTypeMenu,'enable'),'on'); 614 testveltype_1=isequal(get(handles.VelTypeMenu_1,'enable'),'on'); 615 testtransform=isequal(get(handles.transform_fct,'Enable'),'on'); 616 testnc=0; 617 testnc_1=0; 618 testcivx=0; 619 testcivx_1=0; 620 if length(FileExtCell)==1 || length(FileExtCell)>2 621 for iview=1:length(FileExtCell) 622 if isequal(FileExtCell{iview},'.nc') 623 testnc=1; 624 end 625 if isequal(FileTypeCell{iview},'civx') 626 testcivx=1; 627 end 628 end 629 elseif length(FileExtCell)==2 630 testnc=isequal(FileExtCell{1},'.nc'); 631 testnc_1=isequal(FileExtCell{2},'.nc'); 632 testcivx=isequal(FileTypeCell{1},'civx'); 633 testcivx_1=isequal(FileTypeCell{2},'civx'); 634 end 635 if testfield && testnc 636 view_FieldMenu(handles,'on') 637 if testcivx 638 menustr=get(handles.FieldMenu,'String'); 639 if isequal(menustr,{'get_field...'}) 640 set(handles.FieldMenu,'String',{'get_field...';'velocity';'vort';'div';'more...'}) 641 end 642 else 643 set(handles.FieldMenu,'Value',1) 644 set(handles.FieldMenu,'String',{'get_field...'}) 645 end 646 else 647 view_FieldMenu(handles,'off') 648 end 649 if testfield_1 && testnc_1 650 view_FieldMenu_1(handles,'on') 651 if testcivx_1 652 menustr=get(handles.FieldMenu_1,'String'); 653 if isequal(menustr,{'get_field...'}) 654 set(handles.FieldMenu_1,'String',{'get_field...';'velocity';'vort';'div';'more...'}) 655 end 656 else 657 set(handles.FieldMenu_1,'Value',1) 658 set(handles.FieldMenu_1,'String',{'get_field...'}) 659 end 660 else 661 view_FieldMenu_1(handles,'off') 662 end 663 if testveltype && testcivx 664 set(handles.VelTypeMenu,'Visible','on') 665 set(handles.VelType_text,'Visible','on'); 666 else 667 set(handles.VelTypeMenu,'Visible','off') 668 set(handles.VelType_text,'Visible','off'); 669 end 670 if testveltype_1 && testcivx_1 671 set(handles.VelTypeMenu_1,'Visible','on') 672 set(handles.VelType_text_1,'Visible','on'); 673 else 674 set(handles.VelTypeMenu_1,'Visible','off') 675 set(handles.VelType_text_1,'Visible','off'); 676 end 677 if testtransform && (testcivx || testima) 678 set(handles.FieldTransform,'Visible','on') 679 % view_TRANSFORM(handles,'on') 680 else 681 set(handles.FieldTransform,'Visible','off') 682 % view_TRANSFORM(handles,'off') 683 end 684 if ~isequal(FileExt,'.nc') && ~isequal(FileExt,'.cdf') && ~testima 685 msgbox_uvmat('ERROR',['invalid input file extension ' FileExt]) 686 return 687 end 688 689 %% read image documentation file if found%%%%%%%%%%%%%%%%%%%%%%%%%%% 690 ext_imadoc=''; 691 if isequal(FileExt,'.xml')||isequal(FileExt,'.civ') 692 ext_imadoc=FileExt; 693 elseif exist([FileBase '.xml'],'file') 694 ext_imadoc='.xml'; 695 elseif exist([FileBase '.civ'],'file') 696 ext_imadoc='.civ'; 697 end 698 %read the ImaDoc file 699 XmlData=[]; 700 NbSlice_calib={}; 701 if isequal(ext_imadoc,'.xml') 702 [XmlData,warntext]=imadoc2struct([FileBase '.xml']); 703 if isfield(XmlData,'Heading') && isfield(XmlData.Heading,'ImageName') && ischar(XmlData.Heading.ImageName) 704 [PP,FF,ext_ima_read]=fileparts(XmlData.Heading.ImageName); 705 end 706 if isfield(XmlData,'Time') 707 time=XmlData.Time; 708 end 709 if isfield(XmlData,'Camera') 710 if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice) 711 NbSlice_calib{iview}=XmlData.Camera.NbSlice;% Nbre of slices for Zindex in phys transform 712 if ~isequal(NbSlice_calib{iview},NbSlice_calib{1}) 713 msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series'); 714 end 715 end 716 if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit) 717 TimeUnit=XmlData.Camera.TimeUnit; 718 end 719 end 720 if ~isempty(warntext) 721 msgbox_uvmat('WARNING',warntext) 722 end 723 elseif isequal(ext_imadoc,'.civ') 724 [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']); 725 time=XmlData.Time; 726 if error==2, warntext=['no file ' FileBase '.civ']; 727 elseif error==1, warntext='inconsistent number of fields in the .civ file'; 728 end 729 end 730 731 %% display times 732 if addtest 733 SeriesData.Time=[{time} SeriesData.Time]; 734 else 735 SeriesData.Time={time}; 736 end 737 set(handles.TimeUnit,'String',TimeUnit) 738 set(handles.series,'UserData',SeriesData); 739 740 %% number of slices 741 if isfield(XmlData,'GeometryCalib') && isfield(XmlData.GeometryCalib,'SliceCoord') 742 siz=size(XmlData.GeometryCalib.SliceCoord); 743 if siz(1)>1 744 NbSlice=siz(1); 745 else 746 NbSlice=1; 747 end 748 set(handles.num_NbSlice,'String',num2str(NbSlice)) 749 end 750 751 % set menus of index pairs 752 NomType_Callback([], [], handles) 548 % set(handles.RootPath,'String',RootPathCell); 549 % set(handles.SubDir,'String',SubDirCell); 550 % set(handles.RootFile,'String',RootFileCell); 551 % set(handles.NomType,'String',NomTypeCell); 552 % set(handles.FileExt,'String',FileExtCell); 553 %set(handles.InputTable,'Data',[RootPathCell SubDirCell RootFileCell NomTypeCell FileExtCell]) ; 554 update_indices(handles,fileinput,1) 555 556 557 % %% display times 558 % if addtest 559 % SeriesData.Time=[{time} SeriesData.Time]; 560 % else 561 % SeriesData.Time={time}; 562 % end 563 % set(handles.TimeUnit,'String',TimeUnit) 564 % set(handles.series,'UserData',SeriesData); 565 % time_display=[time(MinIndex_i,MinIndex_j) time(ref_i,ref_j) time(ref_i,ref_j) time(MaxIndex_i,MaxIndex_j);... 566 % time(MinIndex_i,MinIndex_j) time(ref_i,ref_j) time(ref_i,ref_j) time(MaxIndex_i,MaxIndex_j)]; 567 % set(handles.time_table,'Data',time_display) 568 569 753 570 754 571 %store the root name for future opening of uvmat … … 767 584 end 768 585 end 769 set(handles. RootPath,'BackgroundColor',[1 1 1])586 set(handles.InputTable,'BackgroundColor',[1 1 1]) 770 587 % set(handles.PathCampaign,'String',SeriesData.PathCampaign) 771 num_last_j_Callback([], [], handles) 772 num_last_i_Callback([], [], handles)773 774 % ------------------------------------------------------------------------775 function RootPath_Callback(hObject, eventdata, handles)776 % ------------------------------------------------------------------------777 Val=get(handles.RootPath,'Value');778 synchronise_view(handles,Val)779 NomType_Callback(hObject, eventdata, handles)780 781 % ------------------------------------------------------------------------782 function synchronise_view(handles,Val)783 % ------------------------------------------------------------------------784 set(handles.RootPath,'Value',Val)785 set(handles.SubDir,'Value',Val)786 set(handles.RootFile,'Value',Val)787 set(handles.NomType,'Value',Val)788 set(handles.FileExt,'Value',Val)789 set(handles.num_MaxIndex_i,'Value',Val)790 set(handles.num_MaxIndex_j,'Value',Val)791 set(handles.time_first,'Value',Val)792 set(handles.time_last,'Value',Val)793 794 795 % ------------------------------------------------------------------------796 % Executes on carriage return on the subdir civ1 edit window797 function SubDir_Callback(hObject, eventdata, handles)798 % ------------------------------------------------------------------------799 Val=get(handles.SubDir,'Value');800 synchronise_view(handles,Val)801 NomType_Callback(hObject, eventdata, handles)802 803 % ------------------------------------------------------------------------804 % --- function activated when a new filebase (image series) is introduced805 function RootFile_Callback(hObject, eventdata, handles)806 % ------------------------------------------------------------------------807 Val=get(handles.RootFile,'Value');808 synchronise_view(handles,Val)809 NomType_Callback(hObject, eventdata, handles)588 %num_last_j_Callback([], [], handles)% TODO:update 589 %num_last_i_Callback([], [], handles) 590 591 % %------------------------------------------------------------------------ 592 % function RootPath_Callback(hObject, eventdata, handles) 593 % %------------------------------------------------------------------------ 594 % Val=get(handles.RootPath,'Value'); 595 % synchronise_view(handles,Val) 596 % NomType_Callback(hObject, eventdata, handles) 597 598 % %------------------------------------------------------------------------ 599 % function synchronise_view(handles,Val) 600 % %------------------------------------------------------------------------ 601 % set(handles.RootPath,'Value',Val) 602 % set(handles.SubDir,'Value',Val) 603 % set(handles.RootFile,'Value',Val) 604 % set(handles.NomType,'Value',Val) 605 % set(handles.FileExt,'Value',Val) 606 % set(handles.num_MaxIndex_i,'Value',Val) 607 % set(handles.num_MaxIndex_j,'Value',Val) 608 % % set(handles.time_first,'Value',Val) 609 % % set(handles.time_last,'Value',Val) 610 611 612 % %------------------------------------------------------------------------ 613 % % Executes on carriage return on the subdir civ1 edit window 614 % function SubDir_Callback(hObject, eventdata, handles) 615 % %------------------------------------------------------------------------ 616 % Val=get(handles.SubDir,'Value'); 617 % synchronise_view(handles,Val) 618 % NomType_Callback(hObject, eventdata, handles) 619 620 % %------------------------------------------------------------------------ 621 % % --- function activated when a new filebase (image series) is introduced 622 % function RootFile_Callback(hObject, eventdata, handles) 623 % %------------------------------------------------------------------------ 624 % Val=get(handles.RootFile,'Value'); 625 % synchronise_view(handles,Val) 626 % NomType_Callback(hObject, eventdata, handles) 810 627 811 628 %-------------------------------------------------------------- 812 %function activated when a new filebase (image series) is introduced 813 %------------------------------------------------------------ 814 function FileExt_Callback(hObject, eventdata, handles) 815 Val=get(handles.FileExt,'Value'); 816 synchronise_view(handles,Val) 817 818 %-------------------------------------------------------------- 819 %function activated when a new filebase (image series) is introduced 820 %------------------------------------------------------------ 821 function num_MaxIndex_i_Callback(hObject, eventdata, handles) 822 Val=get(handles.num_MaxIndex_i,'Value'); 823 synchronise_view(handles,Val) 824 825 %-------------------------------------------------------------- 826 %function activated when a new filebase (image series) is introduced 827 %------------------------------------------------------------ 828 function num_MaxIndex_j_Callback(hObject, eventdata, handles) 829 Val=get(handles.num_MaxIndex_j,'Value'); 830 synchronise_view(handles,Val) 831 832 %-------------------------------------------------------------- 833 %function activated when a new filebase (image series) is introduced 834 %------------------------------------------------------------ 835 function time_first_Callback(hObject, eventdata, handles) 836 Val=get(handles.time_first,'Value'); 837 synchronise_view(handles,Val) 838 839 %-------------------------------------------------------------- 840 %function activated when a new filebase (image series) is introduced 841 %------------------------------------------------------------ 842 function time_last_Callback(hObject, eventdata, handles) 843 Val=get(handles.time_last,'Value'); 844 synchronise_view(handles,Val) 845 NomType_Callback(hObject, eventdata, handles) 846 847 %------------------------------------------------------------------------ 848 function NomType_Callback(hObject, eventdata, handles) 849 %------------------------------------------------------------------------ 850 851 SeriesData=get(handles.series,'UserData'); 852 if isfield(SeriesData,'NomType') 853 NomTypeCell=SeriesData.NomType; 854 else 855 NomTypeCell={}; 856 end 857 nbfield2_cell=get(handles.num_MaxIndex_j,'String'); 858 val=get(handles.num_MaxIndex_j,'Value'); 859 if iscell(nbfield2_cell) 860 nbfield2=str2num(nbfield2_cell{val}); 861 else 862 nbfield2=str2num(nbfield2_cell); 863 end 864 nbfield_cell=get(handles.num_MaxIndex_i,'String'); 865 if iscell(nbfield_cell) 866 nbfield=str2num(nbfield_cell{val}); 867 else 868 nbfield=str2num(nbfield_cell); 869 end 870 871 % set(handles.mode,'Visible','off') % do not show index pairs by default 872 set(handles.Pairs,'Visible','off') 873 % set(handles.ref_i,'Visible','off') 874 % set(handles.ref_i_text,'Visible','off') 875 testpair=0; 876 %set the menus of image pairs and default selection for series 877 %list pairs if relevant 878 Val=get(handles.NomType,'Value'); 879 synchronise_view(handles,Val) 880 if ~isfield(SeriesData,'j1_series')||isempty(SeriesData.j1_series{Val}) 881 state_j='off'; %no need for j index 882 else 883 state_j='on'; %case of j index 884 end 885 % show index pairs if files exist 886 if isfield(SeriesData,'j1_series')&&(~isempty(SeriesData.i2_series{Val})||~isempty(SeriesData.j2_series{Val})) 887 testpair=1; 888 if ~isempty(SeriesData.i2_series{Val}) %pairs with i index 889 set(handles.mode,'Value',1) 890 set(handles.mode,'String',{'series(Di)'}) 891 else %pairs with j index 892 set(handles.mode,'Value',1) 893 set(handles.mode,'String',{'bursts';'series(Dj)'}) 894 if nbfield2>10 || nbfield==1 895 set(handles.mode,'Value',2); 896 else 897 set(handles.mode,'Value',1); 898 end 899 end 900 set(handles.mode,'Visible','on') 901 else 902 set(handles.mode,'Visible','off') 903 end 904 % if ~isempty(NomTypeCell) 905 % NomType=NomTypeCell{Val}; 906 % switch NomType 907 % case {'_1-2_1', '_1-2'} 908 % set(handles.mode,'String',{'series(Di)'}) 909 % set(handles.mode,'Value',1); 910 % set(handles.mode,'Visible','on') 911 % testpair=1; 912 % case {'#_ab'} 913 % set(handles.mode,'String',{'bursts'}) 914 % set(handles.mode,'Value',1); 915 % testpair=1; 916 % case '_1_1-2' 917 % set(handles.mode,'String',{'bursts';'series(Dj)'})%multiple choice 918 % if ~isempty(nbfield) && ~isempty(nbfield2) && ((nbfield2>10) || (nbfield==1)) 919 % set(handles.mode,'Value',2); 920 % else 921 % set(handles.mode,'Value',1);% advice 'bursts' for small bursts 922 % end 923 % set(handles.mode,'Visible','on') 924 % testpair=1; 925 % end 926 % switch NomType 927 % case {'_1_1','_1_1-2','_1-2_1','1_ab','01_ab'},% two navigation indices 928 % state_j='on'; 929 % end 930 % end 931 if testpair 932 mode_Callback(hObject, eventdata, handles) 933 else 934 set(handles.NomType,'String',NomTypeCell) 935 set(handles.j_txt,'Visible',state_j) 936 set(handles.num_MinIndex_j,'Visible',state_j) 937 set(handles.num_first_j,'Visible',state_j) 938 set(handles.num_incr_j,'Visible',state_j) 939 set(handles.num_last_j,'Visible',state_j) 940 set(handles.num_MaxIndex_j,'Visible',state_j) 941 end 629 % %function activated when a new filebase (image series) is introduced 630 % %------------------------------------------------------------ 631 % function FileExt_Callback(hObject, eventdata, handles) 632 % Val=get(handles.FileExt,'Value'); 633 % synchronise_view(handles,Val) 634 635 % %-------------------------------------------------------------- 636 % %function activated when a new filebase (image series) is introduced 637 % %------------------------------------------------------------ 638 % function num_MaxIndex_i_Callback(hObject, eventdata, handles) 639 % Val=get(handles.num_MaxIndex_i,'Value'); 640 % synchronise_view(handles,Val) 641 642 % %-------------------------------------------------------------- 643 % %function activated when a new filebase (image series) is introduced 644 % %------------------------------------------------------------ 645 % function num_MaxIndex_j_Callback(hObject, eventdata, handles) 646 % Val=get(handles.num_MaxIndex_j,'Value'); 647 % synchronise_view(handles,Val) 648 % 649 % %-------------------------------------------------------------- 650 % %function activated when a new filebase (image series) is introduced 651 % %------------------------------------------------------------ 652 % function time_first_Callback(hObject, eventdata, handles) 653 % Val=get(handles.time_first,'Value'); 654 % synchronise_view(handles,Val) 655 % 656 % %-------------------------------------------------------------- 657 % %function activated when a new filebase (image series) is introduced 658 % %------------------------------------------------------------ 659 % function time_last_Callback(hObject, eventdata, handles) 660 % Val=get(handles.time_last,'Value'); 661 % synchronise_view(handles,Val) 662 % NomType_Callback(hObject, eventdata, handles) 663 664 % %------------------------------------------------------------------------ 665 % function NomType_Callback(hObject, eventdata, handles) 666 % %------------------------------------------------------------------------ 667 668 % --- Executes when entered data in editable cell(s) in InputTable. 669 function InputTable_CellEditCallback(hObject, eventdata, handles) 670 % hObject handle to InputTable (see GCBO) 671 % eventdata structure with the following fields (see UITABLE) 672 % Indices: row and column indices of the cell(s) edited 673 % PreviousData: previous data for the cell(s) edited 674 % EditData: string(s) entered by the user 675 % NewData: EditData or its converted form set on the Data property. Empty if Data was not changed 676 % Error: error string when failed to convert EditData to appropriate value for Data 677 % handles structure with handles and user data (see GUIDATA) 678 eventdata 679 list_lines=get(handles.REFRESH_INDICES,'UserData'); 680 list_lines(eventdata.Indices(1))=1; %select the edited line for refresh 681 set(handles.REFRESH_INDICES,'UserData',list_lines); 682 set(handles.REFRESH_INDICES,'Visible','on') 942 683 943 684 … … 945 686 % --- Executes on button press in mode. 946 687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 947 function mode_Callback(hObject, eventdata, handles)948 949 SeriesData=get(handles.series,'UserData');950 mode_list=get(handles.mode,'String');951 mode_value=get(handles.mode,'Value');952 mode=mode_list{mode_value};953 NomType=[];954 % test_find_pair=0;955 % if isfield(SeriesData,'NomType')956 NomTypeCell=SeriesData.NomType;957 Val=get(handles.NomType,'Value');958 NomType=NomTypeCell{Val};959 check_pairs=~isempty(SeriesData.i2_series{Val})||~isempty(SeriesData.j2_series{Val});960 961 time=[];962 if isfield(SeriesData,'Time')963 time=SeriesData.Time{1}; %get the set of times964 end965 siztime=size(time);966 nbfield=siztime(1);967 nbfield2=siztime(2);968 % indchosen=1; %%first pair selected by default969 if isequal(mode,'bursts')970 enable_i(handles,'On')971 enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice)972 elseif ~isempty(SeriesData.j2_series{Val})973 enable_i(handles,'On')974 enable_j(handles,'On') % allow both i and j index scanning975 else976 enable_i(handles,'On')977 enable_j(handles,'Off')978 end 979 % set(handles.list_pair_civ,'Value',indchosen);%set the default choice of image pairs for civ1980 set(handles.series,'UserData',SeriesData)981 982 %list pairs if relevant983 if check_pairs984 find_netcpair_civ(handles,Val)985 end688 function mode_Callback(hObject, eventdata, handles) 689 690 SeriesData=get(handles.series,'UserData'); 691 mode_list=get(handles.mode,'String'); 692 mode_value=get(handles.mode,'Value'); 693 mode=mode_list{mode_value}; 694 NomType=[]; 695 % test_find_pair=0; 696 % if isfield(SeriesData,'NomType') 697 NomTypeCell=SeriesData.NomType; 698 Val=get(handles.NomType,'Value'); 699 NomType=NomTypeCell{Val}; 700 check_pairs=~isempty(SeriesData.i2_series{Val})||~isempty(SeriesData.j2_series{Val}); 701 702 time=[]; 703 if isfield(SeriesData,'Time') 704 time=SeriesData.Time{1}; %get the set of times 705 end 706 siztime=size(time); 707 nbfield=siztime(1); 708 nbfield2=siztime(2); 709 % indchosen=1; %%first pair selected by default 710 if isequal(mode,'bursts') 711 enable_i(handles,'On') 712 enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 713 elseif ~isempty(SeriesData.j2_series{Val}) 714 enable_i(handles,'On') 715 enable_j(handles,'On') % allow both i and j index scanning 716 else 717 enable_i(handles,'On') 718 enable_j(handles,'Off') 719 end 720 % set(handles.list_pair_civ,'Value',indchosen);%set the default choice of image pairs for civ1 721 set(handles.series,'UserData',SeriesData) 722 723 %list pairs if relevant 724 if check_pairs 725 find_netcpair_civ(handles,Val) 726 end 986 727 987 728 %------------------------------------- … … 1008 749 %----------------------------------- 1009 750 function view_FieldMenu(handles,state) 1010 set(handles.FieldMenu,'Visible',state)1011 set(handles.Field_text,'Visible',state)1012 set(handles. Field_frame,'Visible',state)751 % set(handles.FieldMenu,'Visible',state) 752 % set(handles.Field_text,'Visible',state) 753 set(handles.InputFields,'Visible',state) 1013 754 1014 755 %----------------------------------- … … 1390 1131 if testupdate && isfield(SeriesData,'Time') 1391 1132 if ~isempty(SeriesData.Time{1}) 1392 displ_time(handles ,SeriesData.Time{1});1133 displ_time(handles); 1393 1134 end 1394 1135 end … … 1685 1426 SeriesData.Time{1}=[]; 1686 1427 end 1687 displ_time(handles ,SeriesData.Time{1});1428 displ_time(handles); 1688 1429 1689 1430 %------------------------------------------------------------------------ … … 1704 1445 SeriesData.Time{1}=[]; 1705 1446 end 1706 displ_time(handles ,SeriesData.Time{1});1447 displ_time(handles); 1707 1448 1708 1449 … … 1817 1558 1818 1559 %default setting for the visibility of the GUI elements 1819 set(handles.RootPath,'UserData','many')1820 set(handles.SubDir,'Visible','on')1821 set(handles.RootFile,'Visible','on')1822 set(handles.NomType,'Visible','on')1823 set(handles.FileExt,'Visible','on')1560 % set(handles.RootPath,'UserData','many') 1561 % set(handles.SubDir,'Visible','on') 1562 % set(handles.RootFile,'Visible','on') 1563 % set(handles.NomType,'Visible','on') 1564 % set(handles.FileExt,'Visible','on') 1824 1565 set(handles.num_NbSlice,'Visible','off') 1825 1566 set(handles.NbSlice_title,'Visible','off') … … 1865 1606 1866 1607 %nb_series=length(RootFile); 1867 FileExt=get(handles.FileExt,'String'); 1868 nb_series=length(FileExt); 1608 % FileExt=get(handles.FileExt,'String'); 1609 % nb_series=length(FileExt); 1610 InputFiles=get(handles.InputTable,'Data') 1611 FileExt=InputFiles(:,5); 1612 checkcell=find(cellfun('isempty',FileExt)~=0); 1613 nb_series=0; 1614 if ~isempty(checkcell) 1615 nb_series=checkcell(end); 1616 end 1617 % nb_series=size(InputFiles,1) 1869 1618 testima_series=1; %test for a list of images only 1870 1619 testima=1; … … 1872 1621 testciv_series=1; 1873 1622 for iview=1:nb_series 1874 ext=FileExt{iview};1623 ext=FileExt{iview}; 1875 1624 if length(ext)<2 1876 1625 ext='.none'; … … 1890 1639 switch varargout{ilist} 1891 1640 %RootFile always visible 1892 case 'RootPath' %visible by default1893 value=lower(varargout{ilist+1});1894 if isequal(value,'one')||isequal(value,'two')||isequal(value,'many')1895 set(handles.RootFile,'UserData',value)% for use in menu Open_insert1896 end1897 case 'SubDir' %visible by default1898 if isequal(lower(varargout{ilist+1}),'off')1899 set(handles.SubDir,'Visible','off')1900 end1901 case 'RootFile' %visible by default1902 value=lower(varargout{ilist+1});1903 if isequal(value,'off')1904 set(handles.RootFile,'Visible','off')1905 elseif isequal(value,'one')||isequal(value,'two')||isequal(value,'many')1906 set(handles.RootFile,'Visible','on')1907 set(handles.RootFile,'UserData',value)% for use in menu Open_insert1908 end1909 case 'NomType' %visible by default1910 if isequal(lower(varargout{ilist+1}),'off')1911 set(handles.NomType,'Visible','off')1912 end1913 case 'FileExt' %visible by default1914 if isequal(lower(varargout{ilist+1}),'off')1915 set(handles.FileExt,'Visible','off')1916 end1641 % case 'RootPath' %visible by default 1642 % value=lower(varargout{ilist+1}); 1643 % if isequal(value,'one')||isequal(value,'two')||isequal(value,'many') 1644 % set(handles.RootFile,'UserData',value)% for use in menu Open_insert 1645 % end 1646 % case 'SubDir' %visible by default 1647 % if isequal(lower(varargout{ilist+1}),'off') 1648 % set(handles.SubDir,'Visible','off') 1649 % end 1650 % case 'RootFile' %visible by default 1651 % value=lower(varargout{ilist+1}); 1652 % if isequal(value,'off') 1653 % set(handles.RootFile,'Visible','off') 1654 % elseif isequal(value,'one')||isequal(value,'two')||isequal(value,'many') 1655 % set(handles.RootFile,'Visible','on') 1656 % set(handles.RootFile,'UserData',value)% for use in menu Open_insert 1657 % end 1658 % case 'NomType' %visible by default 1659 % if isequal(lower(varargout{ilist+1}),'off') 1660 % set(handles.NomType,'Visible','off') 1661 % end 1662 % case 'FileExt' %visible by default 1663 % if isequal(lower(varargout{ilist+1}),'off') 1664 % set(handles.FileExt,'Visible','off') 1665 % end 1917 1666 case 'NbSlice' %hidden by default 1918 1667 if isequal(lower(varargout{ilist+1}),'on') … … 2101 1850 %------------------------------------------------------------------------ 2102 1851 % ---- find the times corresponding to the first and last indices of a series 2103 function displ_time(handles ,times)1852 function displ_time(handles) 2104 1853 %------------------------------------------------------------------------ 2105 1854 SeriesData=get(handles.series,'UserData');% … … 2181 1930 end 2182 1931 else 2183 siz=size(time s);1932 siz=size(time); 2184 1933 if siz(1)>=last_i && siz(2)>=last_j && first_i>=1 && first_j>=1 2185 1934 time_first=times(first_i,first_j); … … 2190 1939 time_last_cell{iview}=num2str(time_last,4); 2191 1940 end 2192 set(handles.time_first,'Value',1)2193 set(handles.time_last,'Value',1)2194 set(handles.time_first,'String',time_first_cell);2195 set(handles.time_last,'String',time_last_cell);1941 % set(handles.time_first,'Value',1) 1942 % set(handles.time_last,'Value',1) 1943 % set(handles.time_first,'String',time_first_cell); 1944 % set(handles.time_last,'String',time_last_cell); 2196 1945 2197 1946 %------------------------------------------------------------------------ … … 2480 2229 % nbmissing=nbline*nbcolumn-length(ind_ij); 2481 2230 % end 2231 2232 2233 % --- Executes on button press in REFRESH_INDICES. 2234 function REFRESH_INDICES_Callback(hObject, eventdata, handles) 2235 % hObject handle to REFRESH_INDICES (see GCBO) 2236 % eventdata reserved - to be defined in a future version of MATLAB 2237 % handles structure with handles and user data (see GUIDATA) 2238 set(handles.REFRESH_INDICES,'BackgroundColor',[0.7 0.7 0.7]) 2239 InputTable=get(handles.InputTable,'Data'); 2240 list_lines=get(handles.REFRESH_INDICES,'UserData'); 2241 2242 %% check the indices and FileTypes for each series (limited to the new ones to save time) 2243 for ind_list=1:length(list_lines) 2244 if list_lines(ind_list) 2245 InputLine=InputTable(list_lines(ind_list),:); 2246 detect_idem=strcmp('"',InputLine);% look for '" (repeat of previous data) 2247 if ~isempty(detect_idem)&& list_lines(ind_list)>1 2248 InputLine{detect_idem}=InputTable(list_lines(ind_list)-1,detect_idem); 2249 set(handles.InputTable,'Data',InputTable) 2250 end 2251 fileinput=name_generator(fullfile(InputLine{1},InputLine{3}),1,1,InputLine{5},InputLine{4},1,2,2,InputLine{2}); 2252 %update file series defined by the selected line 2253 [InputTable{list_lines(ind_list),1},InputTable{list_lines(ind_list),2},InputTable{list_lines(ind_list),4},errormsg]=update_indices(handles,fileinput,list_lines(ind_list)); 2254 if ~isempty(errormsg) 2255 msgbox_uvmat('ERROR',errormsg) 2256 return 2257 end 2258 end 2259 end 2260 set(handles.InputTable,'Data',InputTable) 2261 SeriesData=get(handles.series,'UserData'); 2262 2263 state_j='off'; 2264 state_Pairs='off'; 2265 state_InputFields='off'; 2266 if ~isempty(SeriesData) 2267 for ilist=1:size(InputTable,1) 2268 if ~isempty(SeriesData.j1_series{ilist}) 2269 state_j='on'; 2270 end 2271 if ~isempty(SeriesData.i2_series{ilist})||~isempty(SeriesData.j2_series{ilist}) 2272 state_Pairs='on'; 2273 end 2274 if strcmp(SeriesData.FileType,'civx')||strcmp(SeriesData.FileType,'civdata') 2275 state_InputFields='on'; 2276 end 2277 end 2278 end 2279 set(handles.num_first_j,'Visible',state_j) 2280 set(handles.num_last_j,'Visible',state_j) 2281 set(handles.num_incr_j,'Visible',state_j) 2282 set(handles.Pairs,'Visible',state_InputFields) 2283 2284 set(handles.REFRESH_INDICES,'BackgroundColor',[1 0 0]) 2285 set(handles.REFRESH_INDICES,'visible','off') 2286 2287 % update min and max indices for a series 2288 function [RootPath,RootFile,NomType,errormsg]=update_indices(handles,fileinput,index) 2289 2290 %% look for min and max indices existing in the file series and update SeriesData 2291 errormsg=''; 2292 [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(fileinput); 2293 if isempty(RootFile)&&isempty(i1_series) 2294 errormsg='not input file in the series'; 2295 return 2296 end 2297 [~,~,FileExt]=fileparts(fileinput); 2298 2299 MinIndex=get(handles.MinIndex,'Data'); 2300 MaxIndex=get(handles.MaxIndex,'Data'); 2301 MinIndex_i=min(i1_series(i1_series>0)); 2302 if ~isempty(i2_series) 2303 MaxIndex_i=max(i2_series(i2_series>0)); 2304 else 2305 MaxIndex_i=max(i1_series(i1_series>0)); 2306 end 2307 MinIndex_j=min(j1_series(j1_series>0)); 2308 if ~isempty(j2_series) 2309 MaxIndex_j=max(j2_series(j2_series>0)); 2310 else 2311 MaxIndex_j=max(j1_series(j1_series>0)); 2312 end 2313 MinIndex{index,1}=MinIndex_i; 2314 MinIndex{index,2}=MinIndex_j; 2315 MaxIndex{index,1}=MaxIndex_i; 2316 MaxIndex{index,2}=MaxIndex_j; 2317 set(handles.MinIndex,'Data',MinIndex) 2318 set(handles.MaxIndex,'Data',MaxIndex) 2319 SeriesData=get(handles.series,'UserData'); 2320 SeriesData.i1_series{index}=i1_series; 2321 SeriesData.i2_series{index}=i2_series; 2322 SeriesData.j1_series{index}=j1_series; 2323 SeriesData.j2_series{index}=j2_series; 2324 SeriesData.FileType{index}=FileType; 2325 2326 %% represents the set of existing files as an image 2327 set(handles.waitbar_frame,'Units','pixels') 2328 pos=get(handles.waitbar_frame,'Position'); 2329 xima=0.5:pos(3)-0.5;% pixel positions on the image representing the existing file indices 2330 yima=0.5:pos(4)-0.5; 2331 [XIma,YIma]=meshgrid(xima,yima); 2332 nb_i=size(i1_series,1); 2333 nb_j=size(i1_series,2); 2334 ind_i=(0.5:nb_i-0.5)*pos(3)/nb_i; 2335 ind_j=(0.5:nb_j-0.5)*pos(4)/nb_j; 2336 [Ind_i,Ind_j]=meshgrid(ind_i,ind_j); 2337 CData=zeros([size(XIma) 3]); 2338 file_ima=double((i1_series(:,:,1)>0)'); 2339 if numel(file_ima)>=2 2340 if size(file_ima,1)==1 2341 CLine=interp1(ind_i,file_ima,xima,'nearest'); 2342 CData(:,:,2)=ones(size(yima'))*CLine; 2343 else 2344 CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest'); 2345 end 2346 set(handles.waitbar_frame,'CData',CData) 2347 end 2348 set(handles.waitbar_frame,'Units','normalized') 2349 2350 %% enable field and veltype menus 2351 testfield=isequal(get(handles.FieldMenu,'enable'),'on'); 2352 testfield_1=isequal(get(handles.FieldMenu_1,'enable'),'on'); 2353 testveltype=isequal(get(handles.VelTypeMenu,'enable'),'on'); 2354 testveltype_1=isequal(get(handles.VelTypeMenu_1,'enable'),'on'); 2355 testtransform=isequal(get(handles.transform_fct,'Enable'),'on'); 2356 testnc=0; 2357 testnc_1=0; 2358 testcivx=0; 2359 testcivx_1=0; 2360 %TODO: update 2361 % if length(FileExtCell)==1 || length(FileExtCell)>2 2362 % for iview=1:length(FileExtCell) 2363 % if isequal(FileExtCell{iview},'.nc') 2364 % testnc=1; 2365 % end 2366 % if isequal(FileTypeCell{iview},'civx') 2367 % testcivx=1; 2368 % end 2369 % end 2370 % elseif length(FileExtCell)==2 2371 % testnc=isequal(FileExtCell{1},'.nc'); 2372 % testnc_1=isequal(FileExtCell{2},'.nc'); 2373 % testcivx=isequal(FileTypeCell{1},'civx'); 2374 % testcivx_1=isequal(FileTypeCell{2},'civx'); 2375 % end 2376 if testfield && testnc 2377 view_FieldMenu(handles,'on') 2378 if testcivx 2379 menustr=get(handles.FieldMenu,'String'); 2380 if isequal(menustr,{'get_field...'}) 2381 set(handles.FieldMenu,'String',{'get_field...';'velocity';'vort';'div';'more...'}) 2382 end 2383 else 2384 set(handles.FieldMenu,'Value',1) 2385 set(handles.FieldMenu,'String',{'get_field...'}) 2386 end 2387 else 2388 view_FieldMenu(handles,'off') 2389 end 2390 if testfield_1 && testnc_1 2391 view_FieldMenu_1(handles,'on') 2392 if testcivx_1 2393 menustr=get(handles.FieldMenu_1,'String'); 2394 if isequal(menustr,{'get_field...'}) 2395 set(handles.FieldMenu_1,'String',{'get_field...';'velocity';'vort';'div';'more...'}) 2396 end 2397 else 2398 set(handles.FieldMenu_1,'Value',1) 2399 set(handles.FieldMenu_1,'String',{'get_field...'}) 2400 end 2401 else 2402 view_FieldMenu_1(handles,'off') 2403 end 2404 if testveltype && testcivx 2405 set(handles.VelTypeMenu,'Visible','on') 2406 set(handles.VelType_text,'Visible','on'); 2407 else 2408 set(handles.VelTypeMenu,'Visible','off') 2409 set(handles.VelType_text,'Visible','off'); 2410 end 2411 if testveltype_1 && testcivx_1 2412 set(handles.VelTypeMenu_1,'Visible','on') 2413 set(handles.VelType_text_1,'Visible','on'); 2414 else 2415 set(handles.VelTypeMenu_1,'Visible','off') 2416 set(handles.VelType_text_1,'Visible','off'); 2417 end 2418 if testtransform && (testcivx || testima) 2419 set(handles.FieldTransform,'Visible','on') 2420 % view_TRANSFORM(handles,'on') 2421 else 2422 set(handles.FieldTransform,'Visible','off') 2423 % view_TRANSFORM(handles,'off') 2424 end 2425 %TODO:update 2426 % if ~isequal(FileExt,'.nc') && ~isequal(FileExt,'.cdf') && ~testima 2427 % msgbox_uvmat('ERROR',['invalid input file extension ' FileExt]) 2428 % return 2429 % end 2430 2431 %% read image documentation file if found%%%%%%%%%%%%%%%%%%%%%%%%%%% 2432 ext_imadoc=''; 2433 FileBase=fullfile(RootPath,RootFile); 2434 if isequal(FileExt,'.xml')||isequal(FileExt,'.civ') 2435 ext_imadoc=FileExt; 2436 elseif exist([FileBase '.xml'],'file') 2437 ext_imadoc='.xml'; 2438 elseif exist([FileBase '.civ'],'file') 2439 ext_imadoc='.civ'; 2440 end 2441 %read the ImaDoc file 2442 XmlData=[]; 2443 NbSlice_calib={}; 2444 if isequal(ext_imadoc,'.xml') 2445 [XmlData,warntext]=imadoc2struct([FileBase '.xml']); 2446 if isfield(XmlData,'Heading') && isfield(XmlData.Heading,'ImageName') && ischar(XmlData.Heading.ImageName) 2447 [PP,FF,ext_ima_read]=fileparts(XmlData.Heading.ImageName); 2448 end 2449 if isfield(XmlData,'Time') 2450 time=XmlData.Time; 2451 end 2452 if isfield(XmlData,'Camera') 2453 if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice) 2454 NbSlice_calib{iview}=XmlData.Camera.NbSlice;% Nbre of slices for Zindex in phys transform 2455 if ~isequal(NbSlice_calib{iview},NbSlice_calib{1}) 2456 msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series'); 2457 end 2458 end 2459 if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit) 2460 TimeUnit=XmlData.Camera.TimeUnit; 2461 end 2462 end 2463 if ~isempty(warntext) 2464 msgbox_uvmat('WARNING',warntext) 2465 end 2466 elseif isequal(ext_imadoc,'.civ') 2467 [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']); 2468 time=XmlData.Time; 2469 if error==2, warntext=['no file ' FileBase '.civ']; 2470 elseif error==1, warntext='inconsistent number of fields in the .civ file'; 2471 end 2472 end 2473 2474 2475 %% number of slices 2476 if isfield(XmlData,'GeometryCalib') && isfield(XmlData.GeometryCalib,'SliceCoord') 2477 siz=size(XmlData.GeometryCalib.SliceCoord); 2478 if siz(1)>1 2479 NbSlice=siz(1); 2480 else 2481 NbSlice=1; 2482 end 2483 set(handles.num_NbSlice,'String',num2str(NbSlice)) 2484 end 2485 % set(handles.mode,'Visible','off') % do not show index pairs by default 2486 set(handles.Pairs,'Visible','off') 2487 % set(handles.ref_i,'Visible','off') 2488 % set(handles.ref_i_text,'Visible','off') 2489 testpair=0; 2490 %set the menus of image pairs and default selection for series 2491 %list pairs if relevant 2492 % Val=get(handles.NomType,'Value'); 2493 % synchronise_view(handles,Val) 2494 2495 % if ~isfield(SeriesData,'j1_series')||isempty(SeriesData.j1_series{index}) 2496 % state_j='off'; %no need for j index 2497 % else 2498 % state_j='on'; %case of j index 2499 % end 2500 % show index pairs if files exist 2501 if isfield(SeriesData,'j1_series')&&(~isempty(SeriesData.i2_series{index})||~isempty(SeriesData.j2_series{index})) 2502 testpair=1; 2503 if ~isempty(SeriesData.i2_series{index}) %pairs with i index 2504 set(handles.mode,'Value',1) 2505 set(handles.mode,'String',{'series(Di)'}) 2506 else %pairs with j index 2507 set(handles.mode,'Value',1) 2508 set(handles.mode,'String',{'bursts';'series(Dj)'}) 2509 if nbfield2>10 || nbfield==1 2510 set(handles.mode,'Value',2); 2511 else 2512 set(handles.mode,'Value',1); 2513 end 2514 end 2515 set(handles.mode,'Visible','on') 2516 else 2517 set(handles.mode,'Visible','off') 2518 end 2519 % if ~isempty(NomTypeCell) 2520 % NomType=NomTypeCell{Val}; 2521 % switch NomType 2522 % case {'_1-2_1', '_1-2'} 2523 % set(handles.mode,'String',{'series(Di)'}) 2524 % set(handles.mode,'Value',1); 2525 % set(handles.mode,'Visible','on') 2526 % testpair=1; 2527 % case {'#_ab'} 2528 % set(handles.mode,'String',{'bursts'}) 2529 % set(handles.mode,'Value',1); 2530 % testpair=1; 2531 % case '_1_1-2' 2532 % set(handles.mode,'String',{'bursts';'series(Dj)'})%multiple choice 2533 % if ~isempty(nbfield) && ~isempty(nbfield2) && ((nbfield2>10) || (nbfield==1)) 2534 % set(handles.mode,'Value',2); 2535 % else 2536 % set(handles.mode,'Value',1);% advice 'bursts' for small bursts 2537 % end 2538 % set(handles.mode,'Visible','on') 2539 % testpair=1; 2540 % end 2541 % switch NomType 2542 % case {'_1_1','_1_1-2','_1-2_1','1_ab','01_ab'},% two navigation indices 2543 % state_j='on'; 2544 % end 2545 % end 2546 set(handles.series,'UserData',SeriesData) 2547 if testpair 2548 mode_Callback(hObject, eventdata, handles) 2549 else 2550 % set(handles.NomType,'String',NomTypeCell) 2551 % set(handles.j_txt,'Visible',state_j) 2552 % set(handles.num_MinIndex_j,'Visible',state_j) 2553 % set(handles.num_first_j,'Visible',state_j) 2554 % set(handles.num_incr_j,'Visible',state_j) 2555 % set(handles.num_last_j,'Visible',state_j) 2556 % set(handles.num_MaxIndex_j,'Visible',state_j) 2557 end 2558
Note: See TracChangeset
for help on using the changeset viewer.