Changeset 332 for trunk/src/series.m
- Timestamp:
- Dec 13, 2011, 11:20:07 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r329 r332 65 65 % set(0,'Units','pixels') 66 66 % screensize=get(0,'ScreenSize'); %screen size in pixels 67 set(hObject,'Position',[150 100 1000 600] );%position and size in pixels (get adjusted to the screen size in case of excess) 67 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display) 68 %set(hObject,'Position',[150 100 1000 600] );%position and size in pixels (get adjusted to the screen size in case of excess) 68 69 %load the list of previously browsed files in menus Open and Open_1 69 70 dir_perso=prefdir; … … 112 113 if isfield(param,'FileName') 113 114 if isfield(param,'FileName_1') 114 update_file(h Object, eventdata, handles,param.FileName_1,0)115 update_file(h Object, eventdata, handles,param.FileName,1)115 update_file(handles,param.FileName_1,0) 116 update_file(handles,param.FileName,1) 116 117 else 117 update_file(h Object, eventdata, handles,param.FileName,0)118 update_file(handles,param.FileName,0) 118 119 end 119 120 end … … 125 126 FieldCell{1}=param.list_fields{param.index_fields}; 126 127 end 127 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display)128 128 NomType_Callback(hObject, eventdata, handles) 129 129 … … 135 135 [path_series,name,ext]=fileparts(which('series')); 136 136 path_series=fullfile(path_series,'series');%path of the function 'series' 137 addpath path_series; %add the path to UVMAT, (useful in case of change of working directory after civ has been s opened in the working directory)137 addpath (path_series) ; %add the path to UVMAT, (useful in case of change of working directory after civ has been s opened in the working directory) 138 138 path_transform=fullfile(path_series,'transform_field');%path to the field transform functions 139 139 for ilist=1:length(fct_menu) … … 256 256 warndlg_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 257 257 else 258 update_file(h Object, eventdata, handles,fileinput,0)258 update_file(handles,fileinput,0) 259 259 %update list of recent files in the menubar 260 260 MenuFile_1=fileinput; … … 293 293 function MenuFile_1_Callback(hObject, eventdata, handles) 294 294 fileinput=get(handles.MenuFile_1,'Label'); 295 update_file(h Object, eventdata, handles,fileinput,0)295 update_file(handles,fileinput,0) 296 296 297 297 % -------------------------------------------------------------------- 298 298 function MenuFile_2_Callback(hObject, eventdata, handles) 299 299 fileinput=get(handles.MenuFile_2,'Label'); 300 update_file(h Object, eventdata, handles,fileinput,0)300 update_file(handles,fileinput,0) 301 301 302 302 % -------------------------------------------------------------------- 303 303 function MenuFile_3_Callback(hObject, eventdata, handles) 304 304 fileinput=get(handles.MenuFile_3,'Label'); 305 update_file( hObject, eventdata,handles,fileinput,0)305 update_file( handles,fileinput,0) 306 306 307 307 % -------------------------------------------------------------------- 308 308 function MenuFile_4_Callback(hObject, eventdata, handles) 309 309 fileinput=get(handles.MenuFile_4,'Label'); 310 update_file(h Object, eventdata, handles,fileinput,0)310 update_file(handles,fileinput,0) 311 311 312 312 % -------------------------------------------------------------------- 313 313 function MenuFile_5_Callback(hObject, eventdata, handles) 314 314 fileinput=get(handles.MenuFile_5,'Label'); 315 update_file(h Object, eventdata, handles,fileinput,0)315 update_file(handles,fileinput,0) 316 316 317 317 % -------------------------------------------------------------------- … … 360 360 msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 361 361 else 362 update_file(h Object, eventdata, handles,fileinput,1)362 update_file(handles,fileinput,1) 363 363 %update list of recent files in the menubar 364 364 MenuFile_1=fileinput; … … 397 397 function MenuFile_insert_1_Callback(hObject, eventdata, handles) 398 398 fileinput=get(handles.MenuFile_insert_1,'Label'); 399 update_file(h Object, eventdata, handles,fileinput,1)399 update_file(handles,fileinput,1) 400 400 401 401 % -------------------------------------------------------------------- 402 402 function MenuFile_insert_2_Callback(hObject, eventdata, handles) 403 403 fileinput=get(handles.MenuFile_insert_2,'Label'); 404 update_file(h Object, eventdata, handles,fileinput,1)404 update_file(handles,fileinput,1) 405 405 406 406 % -------------------------------------------------------------------- 407 407 function MenuFile_insert_3_Callback(hObject, eventdata, handles) 408 408 fileinput=get(handles.MenuFile_insert_3,'Label'); 409 update_file( hObject, eventdata,handles,fileinput,1)409 update_file( handles,fileinput,1) 410 410 411 411 % -------------------------------------------------------------------- 412 412 function MenuFile_insert_4_Callback(hObject, eventdata, handles) 413 413 fileinput=get(handles.MenuFile_insert_4,'Label'); 414 update_file( hObject, eventdata,handles,fileinput,1)414 update_file( handles,fileinput,1) 415 415 416 416 % -------------------------------------------------------------------- 417 417 function MenuFile_insert_5_Callback(hObject, eventdata, handles) 418 418 fileinput=get(handles.MenuFile_insert_5,'Label'); 419 update_file(h Object, eventdata, handles,fileinput,1)419 update_file(handles,fileinput,1) 420 420 421 421 %------------------------------------------------------------------------ 422 422 % --- refresh the GUI data after introduction of a new file series 423 function update_file(hObject, eventdata, handles,fileinput,addtest) 423 % INPUT: 424 % handles: 425 % fileinput: name of the input file 426 % 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) 424 428 %------------------------------------------------------------------------ 429 430 %% enable other menus and uicontrols 431 set(handles.MenuOpen_insert,'Enable','on') 432 set(handles.MenuFile_insert_1,'Enable','on') 433 set(handles.MenuFile_insert_2,'Enable','on') 434 set(handles.MenuFile_insert_3,'Enable','on') 435 set(handles.MenuFile_insert_4,'Enable','on') 436 set(handles.MenuFile_insert_5,'Enable','on') 437 set(handles.RUN, 'Enable','On') 438 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 440 drawnow 441 442 %% get the input root name, indices, file extension and nomenclature NomType 425 443 if ~exist(fileinput,'file') 426 444 msgbox_uvmat('ERROR',['input file ' fileinput ' does not exist']) 427 445 return 428 446 end 429 430 % refresh input root name, indices, file extension and nomenclature 431 [RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput); 432 433 %check for movie image files 434 if ~isempty(FileExt) 435 if ~isempty(imformats(FileExt(2:end))) 436 imainfo=imfinfo(fileinput); 437 if length(imainfo) >1 %case of image with multiple frames 438 NomType='*'; 439 [RootPath,RootFile]=fileparts(fileinput); 440 end 441 end 442 end 443 NcType='none';%default 444 if isequal(FileExt,'.nc') 445 Data=nc2struct(fileinput,[]); 446 if isfield(Data,'absolut_time_T0') 447 NcType='civx'; % test for civx velocity fields 448 end 449 end 450 451 set(handles.RootPath,'Value',1) 452 set(handles.SubDir,'Value',1) 453 set(handles.RootFile,'Value',1) 454 set(handles.NomType,'Value',1) 455 set(handles.FileExt,'Value',1) 456 set(handles.nb_field,'Value',1) 457 set(handles.nb_field2,'Value',1) 458 if addtest 459 SeriesData=get(handles.figure1,'UserData'); 460 SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num]; 461 SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile; 462 RootPathCell=[{RootPath}; get(handles.RootPath,'String')] ; 463 SubDirCell=[{SubDir}; get(handles.SubDir,'String')]; 464 RootFileCell=[{RootFile}; get(handles.RootFile,'String')]; 465 NomTypeCell=[{NomType}; SeriesData.NomType]; 466 FileExtCell=[{FileExt}; get(handles.FileExt,'String')]; 467 NcTypeCell=[{NcType};SeriesData.NcType]; 468 set(handles.NomType,'String',[{};get(handles.NomType,'String')]) 469 else 470 SeriesData=[];%re-initialisation 471 SeriesData.displ_num=[0 0 0 0]; 472 RootPathCell={RootPath}; 473 SubDirCell={SubDir}; 474 RootFileCell={RootFile}; 475 NomTypeCell={NomType}; 476 FileExtCell={FileExt}; 477 NcTypeCell={NcType}; 478 end 479 480 SeriesData.NomType=NomTypeCell; 481 SeriesData.NcType=NcTypeCell; 482 SeriesData.CurrentInputFile=fileinput; 483 set(handles.RootPath,'String',RootPathCell); 484 set(handles.SubDir,'String',SubDirCell); 485 set(handles.RootFile,'String',RootFileCell); 486 set(handles.NomType,'String',NomTypeCell); 487 set(handles.FileExt,'String',FileExtCell); 488 489 %determine field indices 447 [RootPath,RootFile,i1,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput); 448 449 %% look for min and max indices existing in the file series and update NomType 450 [num_i1,num_i2,num_j1,num_j2,NomType,FileType,Object]=find_file_series(fileinput); 451 if strcmp(NomType,'*') 452 MinIndex_i=1; 453 MinIndex_j=1; 454 nb_field=num_i2; 455 nb_field2=1; 456 else 457 MinIndex_i=min(floor((min(num_i1)+min(num_i2))/2)); 458 MinIndex_j=min(floor((min(num_j1)+min(num_j2))/2)); 459 nb_field=max(floor((max(num_i1)+max(num_i2))/2)); 460 nb_field2=max(floor((max(num_j1)+max(num_j2))/2)); 461 end 462 if isnan(nb_field) 463 nb_field_str='?'; 464 nb_field_str2='?'; 465 else 466 MinIndex_i_str=num2str(MinIndex_i); 467 MinIndex_j_str=num2str(MinIndex_j); 468 nb_field_str=num2str(nb_field); 469 nb_field_str2=num2str(nb_field2); 470 end 471 if addtest% case of insertion of a new series (menu bar option Open_insert) 472 MinIndex_i_cell=[{MinIndex_i_str} ;get(handles.MinIndex_i,'String')]; 473 MinIndex_j_cell=[{MinIndex_j_str} ;get(handles.MinIndex_j,'String')]; 474 nb_field_cell=[{nb_field_str} ;get(handles.nb_field,'String')]; 475 nb_field2_cell=[{nb_field_str2} ;get(handles.nb_field2,'String')]; 476 else % refresh the list (menu bar option Open) 477 MinIndex_i_cell={MinIndex_i_str}; 478 MinIndex_j_cell={MinIndex_j_str}; 479 nb_field_cell={nb_field_str}; 480 nb_field2_cell={nb_field_str2}; 481 end 482 set(handles.MinIndex_i,'String',MinIndex_i_cell); 483 set(handles.MinIndex_j,'String',MinIndex_j_cell); 484 set(handles.nb_field,'String',nb_field_cell); 485 set(handles.nb_field2,'String',nb_field2_cell); 486 487 488 %% determine reference field indices 490 489 ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV 491 if ~isempty(str2num( field_count))492 ref_i=str2num( field_count);490 if ~isempty(str2num(i1)) 491 ref_i=str2num(i1); 493 492 if ~isempty(str2num(str2)) 494 493 ref_i=floor((ref_i+str2num(str2))/2);% reference image number corresponding to the file 495 SeriesData.browse_Di=str2num(str2)-str2num( field_count);494 SeriesData.browse_Di=str2num(str2)-str2num(i1); 496 495 end 497 496 end … … 511 510 set(handles.last_j,'String',num2str(ref_j)); 512 511 513 %enable other menus and uicontrols514 set(handles.MenuOpen_insert,'Enable','on')515 set(handles.MenuFile_insert_1,'Enable','on')516 set(handles.MenuFile_insert_2,'Enable','on')517 set(handles.MenuFile_insert_3,'Enable','on')518 set(handles.MenuFile_insert_4,'Enable','on')519 set(handles.MenuFile_insert_5,'Enable','on')520 set(handles.RUN, 'Enable','On')521 set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red522 set(handles.RootPath,'BackgroundColor',[1 1 0]) % set RootPath edit box to yellow523 drawnow524 525 512 TimeUnit=''; %default 526 513 time=[];%default … … 536 523 if isequal(lower(FileExt),'.avi') %.avi file 537 524 testima=1; 538 info=aviinfo([FileBase FileExt]);539 time=(0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond)';540 nb_field=info.NumFrames;541 nb_field2=1;525 % info=aviinfo([FileBase FileExt]); 526 % time=(0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond)'; 527 % nb_field=info.NumFrames; 528 % nb_field2=1; 542 529 elseif ~isempty(imformats(FileExt(2:end))) 543 530 testima=1; 544 if isequal(NomType,'*')% multi-frame image545 imainfo=imfinfo([FileBase FileExt]);546 if length(imainfo) >1 %case of image with multiple frames547 nb_field=length(imainfo);548 nb_field2=1;549 end550 end531 % if isequal(NomType,'*')% multi-frame image 532 % imainfo=imfinfo([FileBase FileExt]); 533 % if length(imainfo) >1 %case of image with multiple frames 534 % nb_field=length(imainfo); 535 % nb_field2=1; 536 % end 537 % end 551 538 elseif isequal(FileExt,'.vol') 552 539 testima=1; 553 540 end 554 541 555 % enable field and veltype menus 542 543 %% fill the list of file series 544 % select the first line in the list 545 set(handles.RootPath,'Value',1) 546 set(handles.SubDir,'Value',1) 547 set(handles.RootFile,'Value',1) 548 set(handles.NomType,'Value',1) 549 set(handles.FileExt,'Value',1) 550 set(handles.nb_field,'Value',1) 551 set(handles.nb_field2,'Value',1) 552 % append the current file series to the list 553 if addtest 554 SeriesData=get(handles.series,'UserData'); 555 SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num]; 556 SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile; 557 RootPathCell=[{RootPath}; get(handles.RootPath,'String')] ; 558 SubDirCell=[{SubDir}; get(handles.SubDir,'String')]; 559 RootFileCell=[{RootFile}; get(handles.RootFile,'String')]; 560 NomTypeCell=[{NomType}; SeriesData.NomType]; 561 FileExtCell=[{FileExt}; get(handles.FileExt,'String')]; 562 FileTypeCell=[{FileType};SeriesData.FileType]; 563 set(handles.NomType,'String',[{};get(handles.NomType,'String')]) 564 % or re-initialise the list of input file series 565 else 566 SeriesData=[];%re-initialisation 567 SeriesData.displ_num=[0 0 0 0]; 568 RootPathCell={RootPath}; 569 SubDirCell={SubDir}; 570 RootFileCell={RootFile}; 571 NomTypeCell={NomType}; 572 FileExtCell={FileExt}; 573 FileTypeCell={FileType}; 574 end 575 SeriesData.NomType=NomTypeCell; 576 SeriesData.FileType=FileTypeCell; 577 SeriesData.CurrentInputFile=fileinput; 578 set(handles.RootPath,'String',RootPathCell); 579 set(handles.SubDir,'String',SubDirCell); 580 set(handles.RootFile,'String',RootFileCell); 581 set(handles.NomType,'String',NomTypeCell); 582 set(handles.FileExt,'String',FileExtCell); 583 584 %% enable field and veltype menus 556 585 testfield=isequal(get(handles.FieldMenu,'enable'),'on'); 557 586 testfield_1=isequal(get(handles.FieldMenu_1,'enable'),'on'); … … 568 597 testnc=1; 569 598 end 570 if isequal( NcTypeCell{iview},'civx')599 if isequal(FileTypeCell{iview},'civx') 571 600 testcivx=1; 572 601 end … … 575 604 testnc=isequal(FileExtCell{1},'.nc'); 576 605 testnc_1=isequal(FileExtCell{2},'.nc'); 577 testcivx=isequal( NcTypeCell{1},'civx');578 testcivx_1=isequal( NcTypeCell{2},'civx');606 testcivx=isequal(FileTypeCell{1},'civx'); 607 testcivx_1=isequal(FileTypeCell{2},'civx'); 579 608 end 580 609 if testfield && testnc … … 630 659 end 631 660 632 %%%%%%%% read image documentation file if found%%%%%%%%%%%%%%%%%%%%%%%%%%% 633 %look for the file existence 661 %% read image documentation file if found%%%%%%%%%%%%%%%%%%%%%%%%%%% 634 662 ext_imadoc=''; 635 663 if isequal(FileExt,'.xml')||isequal(FileExt,'.civ') … … 640 668 ext_imadoc='.civ'; 641 669 end 642 670 %read the ImaDoc file 643 671 XmlData=[]; 644 672 NbSlice_calib={}; … … 672 700 end 673 701 end 702 703 704 705 %% display times 674 706 if addtest 675 707 SeriesData.Time=[{time} SeriesData.Time]; … … 677 709 SeriesData.Time={time}; 678 710 end 679 680 681 % if ~isempty(time)682 % siztime=size(time);683 % nb_field=siztime(1);684 % nb_field2=siztime(2);685 % end686 711 set(handles.TimeUnit,'String',TimeUnit) 687 %look for max indices 688 if ~strcmp(NomType,'*') 689 [num_i1,num_i2,num_j1,num_j2]=find_indexseries(fileinput); 690 nb_field=max(floor((max(num_i1)+max(num_i2))/2)); 691 nb_field2=max(floor((max(num_j1)+max(num_j2))/2)); 692 end 693 if isnan(nb_field) 694 nb_field_str='?'; 695 nb_field_str2='?'; 696 else 697 nb_field_str=num2str(nb_field); 698 nb_field_str2=num2str(nb_field2); 699 end 700 if addtest 701 nb_field_cell=[{nb_field_str} ;get(handles.nb_field,'String')]; 702 nb_field2_cell=[{nb_field_str2} ;get(handles.nb_field2,'String')]; 703 else 704 nb_field_cell={nb_field_str}; 705 nb_field2_cell={nb_field_str2}; 706 end 707 set(handles.nb_field,'String',nb_field_cell); 708 set(handles.nb_field2,'String',nb_field2_cell); 709 set(handles.figure1,'UserData',SeriesData); 710 711 %number of slices 712 set(handles.series,'UserData',SeriesData); 713 714 %% number of slices 712 715 if isfield(XmlData,'GeometryCalib') && isfield(XmlData.GeometryCalib,'SliceCoord') 713 716 siz=size(XmlData.GeometryCalib.SliceCoord); … … 721 724 722 725 % set menus of index pairs 723 NomType_Callback( hObject, eventdata, handles)726 NomType_Callback([], [], handles) 724 727 725 728 %store the root name for future opening of uvmat … … 739 742 end 740 743 set(handles.RootPath,'BackgroundColor',[1 1 1]) 741 set(handles.PathCampaign,'String',SeriesData.PathCampaign)742 last_j_Callback( hObject, eventdata, handles)743 last_i_Callback( hObject, eventdata, handles)744 % set(handles.PathCampaign,'String',SeriesData.PathCampaign) 745 last_j_Callback([], [], handles) 746 last_i_Callback([], [], handles) 744 747 745 748 %------------------------------------------------------------------------ … … 819 822 function NomType_Callback(hObject, eventdata, handles) 820 823 %------------------------------------------------------------------------ 821 hseries=get(handles.ProjObject,'Parent'); 822 SeriesData=get(hseries,'UserData'); 824 SeriesData=get(handles.series,'UserData'); 823 825 if isfield(SeriesData,'NomType') 824 826 NomTypeCell=SeriesData.NomType; … … 853 855 NomType=NomTypeCell{Val}; 854 856 switch NomType 855 case {'_ i1-i2_j', '_i1-i2'}857 case {'_1-2_1', '_1-2'} 856 858 set(handles.mode,'String',{'series(Di)'}) 857 859 set(handles.mode,'Value',1); … … 862 864 set(handles.mode,'Value',1); 863 865 testpair=1; 864 case '_ i_j1-j2'866 case '_1_1-2' 865 867 set(handles.mode,'String',{'bursts';'series(Dj)'})%multiple choice 866 868 if ~isempty(nbfield) && ~isempty(nbfield2) && ((nbfield2>10) || (nbfield==1)) … … 873 875 end 874 876 switch NomType 875 case {'_1_1','_ i_j1-j2','_i1-i2_j','1_ab','01_ab'},% two navigation indices877 case {'_1_1','_1_1-2','_1-2_1','1_ab','01_ab'},% two navigation indices 876 878 state_j='on'; 877 879 end … … 881 883 else 882 884 set(handles.NomType,'String',NomTypeCell) 885 set(handles.j_txt,'Visible',state_j) 886 set(handles.MinIndex_j,'Visible',state_j) 883 887 set(handles.first_j,'Visible',state_j) 884 888 set(handles.incr_j,'Visible',state_j) 885 889 set(handles.last_j,'Visible',state_j) 886 set(handles.nb_field2,'Visible',state_j) 890 set(handles.nb_field2,'Visible',state_j) 887 891 end 888 892 … … 892 896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 893 897 function mode_Callback(hObject, eventdata, handles) 894 %hseries=get(handles.mode,'parent'); 895 hseries=handles.figure1; 896 SeriesData=get(hseries,'UserData'); 898 SeriesData=get(handles.series,'UserData'); 897 899 mode_list=get(handles.mode,'String'); 898 900 mode_value=get(handles.mode,'Value'); … … 904 906 Val=get(handles.NomType,'Value'); 905 907 NomType=NomTypeCell{Val}; 906 test_find_pair=isequal(NomType,'_ i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2')|| isequal(NomType,'#_ab');908 test_find_pair=isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2')|| isequal(NomType,'#_ab'); 907 909 end 908 910 time=[]; … … 917 919 enable_i(handles,'On') 918 920 enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 919 elseif isequal(NomType,'_ i_j1-j2')|| isequal(NomType,'_i1-i2_j')921 elseif isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1') 920 922 enable_i(handles,'On') 921 923 enable_j(handles,'On') % allow both i and j index scanning … … 925 927 end 926 928 set(handles.list_pair_civ,'Value',indchosen);%set the default choice of image pairs for civ1 927 set(h series,'UserData',SeriesData)929 set(handles.series,'UserData',SeriesData) 928 930 929 931 %list pairs if relevant … … 945 947 function enable_j(handles,state) 946 948 set(handles.j_txt,'Visible',state) 949 set(handles.MinIndex_j,'Visible',state) 947 950 set(handles.first_j,'Visible',state) 948 951 set(handles.last_j,'Visible',state) … … 974 977 %---------------------------------------------------------------- 975 978 function find_netcpair_civ(hObject, eventdata, handles,Val) 976 %hseries=get(handles.list_pair_civ,'parent'); 977 SeriesData=get(handles.figure1,'UserData'); 979 SeriesData=get(handles.series,'UserData'); 978 980 % NomTypeCell=get(handles.NomType,'String'); 979 981 NomTypeCell=SeriesData.NomType; … … 1080 1082 for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'bursts' mode 1081 1083 for numod_b=(numod_a+1):nbfield2 1082 [filename]=name_generator(filebase,ref_i,numod_a,'.nc',NomType,1,ref_i,numod_b,subdir) ;1083 select=(exist(filename,'file')==2) ;1084 [filename]=name_generator(filebase,ref_i,numod_a,'.nc',NomType,1,ref_i,numod_b,subdir) 1085 select=(exist(filename,'file')==2) 1084 1086 if select==1 1085 1087 ind_exist=ind_exist+1; … … 1104 1106 nom_type_ima='#A'; 1105 1107 otherwise 1106 nom_type_ima='_ i_j';1108 nom_type_ima='_1_1'; 1107 1109 end 1108 1110 displ_pair{ind_exist}=['j= ' num2stra(numod_a,nom_type_ima,2) '-' num2stra(numod_b,nom_type_ima,2) ... … … 1145 1147 SeriesData.displ_num(iview,:)=(displ_num(:,val))'; 1146 1148 SeriesData.ref_time=ref_time; 1147 set(handles. figure1,'UserData',SeriesData)1149 set(handles.series,'UserData',SeriesData) 1148 1150 list_pair_civ_Callback(hObject, eventdata, handles) 1149 1151 … … 1157 1159 Val=get(handles.RootPath,'Value'); 1158 1160 IndexCell=get(handles.NomType,'String'); 1159 %hseries=get(handles.list_pair_civ,'parent'); 1160 SeriesData=get(handles.figure1,'UserData'); 1161 SeriesData=get(handles.series,'UserData'); 1161 1162 NomType=SeriesData.NomType{Val}; 1162 1163 list_pair=get(handles.list_pair_civ,'String');%get the menu of image pairs … … 1184 1185 end 1185 1186 switch NomType 1186 case {'_ i1-i2_j'}1187 case {'_1-2_1'} 1187 1188 if isequal(num1_str(1),'0') 1188 1189 IndexCell{Val}=['_(i-(i+' num2_str ')_j']; … … 1192 1193 displ_num(3)=num1; 1193 1194 displ_num(4)=num2; 1194 case {'_ i1-i2'}1195 case {'_1-2'} 1195 1196 if isequal(num1_str(1),'0') 1196 1197 IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')']; … … 1200 1201 displ_num(3)=num1; 1201 1202 displ_num(4)=num2; 1202 case '_ i_j1-j2'1203 case '_1_1-2' 1203 1204 if test_bursts 1204 1205 IndexCell{Val}=['_i_' num1_str '-' num2_str ]; … … 1219 1220 set(handles.NomType,'String',IndexCell) 1220 1221 SeriesData.displ_num(Val,:)=displ_num; 1221 set(handles. figure1,'UserData',SeriesData)1222 set(handles.series,'UserData',SeriesData) 1222 1223 % set(handles.NomType,'Value',Val) 1223 1224 … … 1270 1271 %read root name and field type 1271 1272 set(handles.RUN,'BusyAction','queue'); 1272 %hseries=get(handles.RUN,'parent'); 1273 set(0,'CurrentFigure',handles.figure1) 1273 set(0,'CurrentFigure',handles.series) 1274 1274 if isequal(get(handles.GetObject,'Visible'),'on') && isequal(get(handles.GetObject,'Value'),1) 1275 1275 Series.GetObject=1; … … 1278 1278 Series.GetObject=0; 1279 1279 end 1280 SeriesData=get(handles. figure1,'UserData');1280 SeriesData=get(handles.series,'UserData'); 1281 1281 1282 1282 %reinitiate waitbar position … … 1324 1324 Series.transform_fct=transform_list{menu_index};% transform function handles 1325 1325 end 1326 Series.hseries=handles. figure1; % handles to the series GUI1326 Series.hseries=handles.series; % handles to the series GUI 1327 1327 1328 1328 %read the set of field numbers … … 1387 1387 %case of pairs (.nc files) 1388 1388 1389 if isequal(NomType{iview},'_ i_j1-j2')|| isequal(NomType{iview},'_i1-i2_j')|| isequal(NomType{iview},'_i1-i2')|| isequal(NomType{iview},'#_ab')1389 if isequal(NomType{iview},'_1_1-2')|| isequal(NomType{iview},'_1-2_1')|| isequal(NomType{iview},'_1-2')|| isequal(NomType{iview},'#_ab') 1390 1390 ind_shift=SeriesData.displ_num(iview,:); 1391 1391 if isequal(ind_shift,[0 0 0 0]) % undefined pairs … … 1490 1490 function last_i_Callback(hObject, eventdata, handles) 1491 1491 %------------------------------------------------------------------------ 1492 % hseries=get(handles.last_i,'parent'); 1493 % first_i=str2num(get(handles.first_i,'String')); 1494 % last_i=str2num(get(handles.last_i,'String')); 1495 % ref_i=ceil((first_i+last_i)/2); 1496 % set(handles.ref_i,'String', num2str(ref_i)) 1497 % ref_i_Callback(hObject, eventdata, handles) 1498 SeriesData=get(handles.figure1,'UserData'); 1492 SeriesData=get(handles.series,'UserData'); 1499 1493 if ~isfield(SeriesData,'Time') 1500 1494 SeriesData.Time{1}=[]; … … 1515 1509 set(handles.ref_j,'String', num2str(ref_j)) 1516 1510 ref_j_Callback(hObject, eventdata, handles) 1517 SeriesData=get(handles. figure1,'UserData');1511 SeriesData=get(handles.series,'UserData'); 1518 1512 if ~isfield(SeriesData,'Time') 1519 1513 SeriesData.Time{1}=[]; … … 1528 1522 mode_value=get(handles.mode,'Value'); 1529 1523 mode=mode_list{mode_value}; 1530 %hseries=get(handles.ref_i,'parent'); 1531 SeriesData=get(handles.figure1,'UserData'); 1524 SeriesData=get(handles.series,'UserData'); 1532 1525 %NomTypeCell=get(handles.NomType,'String'); 1533 1526 NomTypeCell=SeriesData.NomType; … … 1536 1529 NomType=NomTypeCell{Val}; 1537 1530 % for ilist=1:length(NomType) 1538 if isequal(NomType,'_ i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2')1531 if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2') 1539 1532 if isequal(mode,'series(Di)') 1540 1533 find_netcpair_civ(hObject, eventdata, handles,Val);% update the menu of pairs depending on the available netcdf files … … 1550 1543 mode_value=get(handles.mode,'Value'); 1551 1544 mode=mode_list{mode_value}; 1552 %hseries=get(handles.ref_i,'parent'); 1553 SeriesData=get(handles.figure1,'UserData'); 1545 SeriesData=get(handles.series,'UserData'); 1554 1546 NomTypeCell=SeriesData.NomType; 1555 1547 if ~isempty(NomTypeCell) 1556 1548 Val=get(handles.NomType,'Value'); 1557 1549 NomType=NomTypeCell{Val}; 1558 if isequal(NomType,'_ i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2')1550 if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2') 1559 1551 if isequal(mode,'series(Dj)') 1560 1552 find_netcpair_civ(hObject, eventdata, handles,Val);% update the menu of pairs depending on the available netcdf files … … 1807 1799 delete(hget_field)%delete opened versions of get_field 1808 1800 end 1809 %hseries=get(handles.FieldMenu,'parent'); 1810 SeriesData=get(handles.figure1,'UserData'); 1801 SeriesData=get(handles.series,'UserData'); 1811 1802 filename=SeriesData.CurrentInputFile; 1812 1803 if exist(filename,'file') … … 1835 1826 delete(hget_field) 1836 1827 end 1837 %hseries=get(handles.FieldMenu,'parent'); 1838 SeriesData=get(handles.figure1,'UserData'); 1828 SeriesData=get(handles.series,'UserData'); 1839 1829 filename=SeriesData.CurrentInputFile_1; 1840 1830 if exist(filename,'file') … … 1888 1878 num_i_out=num_i; 1889 1879 num_j_out=num_j; 1890 if isequal (NomType,'_ i1-i2_j') || isequal (NomType,'_i1-i2')1880 if isequal (NomType,'_1-2_1') || isequal (NomType,'_1-2') 1891 1881 num_i1_line=num_i+ind_shift(3);% set of first image numbers 1892 1882 num_i2_line=num_i+ind_shift(4); … … 1900 1890 [xx,num_i1]=meshgrid(num_j,num_i1_line); 1901 1891 [xx,num_i2]=meshgrid(num_j,num_i2_line); 1902 elseif isequal (NomType,'_ i_j1-j2') || isequal (NomType,'#_ab')1892 elseif isequal (NomType,'_1_1-2') || isequal (NomType,'#_ab') 1903 1893 if isequal(mode,'bursts') %case of bursts (png_old or png_2D) 1904 1894 num_j1=ind_shift(1)*ones(size(num_i)); … … 1921 1911 function displ_time(handles,times) 1922 1912 %------------------------------------------------------------------------ 1923 hseries=get(handles.last_i,'parent'); 1924 SeriesData=get(hseries,'UserData');% 1913 SeriesData=get(handles.series,'UserData');% 1925 1914 first_i=str2num(get(handles.first_i,'String')); 1926 1915 first_j=str2num(get(handles.first_j,'String')); 1927 1916 last_i=str2num(get(handles.last_i,'String')); 1928 1917 last_j=str2num(get(handles.last_j,'String')); 1929 % index_civ=get(handles.list_pair_civ,'Value');1930 % NomType=get(handles.NomType,'String');1931 1918 NomType=SeriesData.NomType; 1932 1919 mode_list=get(handles.mode,'String'); 1933 1920 index_mode=get(handles.mode,'Value'); 1934 1921 mode=mode_list{index_mode}; 1935 % ind_shift=0;%default1936 1922 1937 1923 time_first=[]; … … 1944 1930 time_last_cell{iview}='?';%default 1945 1931 time=SeriesData.Time{iview}; 1946 if isequal(NomType{iview},'_ i1-i2_j')|isequal(NomType{iview},'_i_j1-j2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_i1-i2')1932 if isequal(NomType{iview},'_1-2_1')|isequal(NomType{iview},'_1_1-2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_1-2') 1947 1933 if isfield(SeriesData,'displ_num')& ~isempty(SeriesData.displ_num) 1948 1934 ind_shift=SeriesData.displ_num(iview,:); … … 2021 2007 function GetObject_Callback(hObject, eventdata, handles) 2022 2008 %------------------------------------------------------------------------ 2023 hseries=get(handles.GetObject,'parent'); 2024 SeriesData=get(hseries,'UserData'); 2009 SeriesData=get(handles.series,'UserData'); 2025 2010 value=get(handles.GetObject,'Value'); 2026 2011 if value … … 2075 2060 % end 2076 2061 end 2077 set(h series,'UserData',SeriesData)2062 set(handles.series,'UserData',SeriesData) 2078 2063 2079 2064 %-------------------------------------------------------------- … … 2114 2099 global nb_transform 2115 2100 2116 % huvmat=get(handles.transform_fct,'parent');2117 2101 menu=get(handles.transform_fct,'String'); 2118 2102 ind_coord=get(handles.transform_fct,'Value'); … … 2305 2289 end 2306 2290 2307 %------------------------------------------------------------------------ 2308 % --- generates series of file indices corresponding to a file fileinput 2309 function [num_i1,num_i2,num_j1,num_j2]=find_indexseries(fileinput) 2310 %------------------------------------------------------------------------ 2311 num_i1=NaN;%default 2312 num_i2=NaN;%default 2313 num_j1=NaN;%default 2314 num_j2=NaN;%default 2315 % refresh input root name, indices, file extension and nomenclature 2316 [RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput); 2317 if strcmp(SubDir,'') 2318 filebasesub=fullfile(RootPath,RootFile); 2319 else 2320 filebasesub=fullfile(RootPath,SubDir,RootFile); 2321 end 2322 dirpair=[]; %default 2323 switch NomType 2324 case '_1' 2325 dirpair=dir([filebasesub '_*' FileExt]); 2326 case '_1_1' 2327 dirpair=dir([filebasesub '_*_*' FileExt]); 2328 case '_i1-i2' 2329 dirpair=dir([filebasesub '_*-*' FileExt]); 2330 case '1_ab' 2331 dirpair=dir([filebasesub '*_*' FileExt]); 2332 case '_i_j1-j2' 2333 dirpair=dir([filebasesub '*_*-*' FileExt]); 2334 case '_i1-i2_j' 2335 dirpair=dir([filebasesub '*-*_*' FileExt]); 2336 end 2337 for ifile=1:length(dirpair) 2338 [RootPath,RF,str_1,str_2,str_a,str_b]=name2display(dirpair(ifile).name); 2339 num_i1(ifile)=str2double(str_1); 2340 num_i2(ifile)=str2double(str_2); 2341 if isnan(num_i2(ifile)) 2342 num_i2(ifile)=num_i1(ifile); 2343 end 2344 num_j1(ifile)=stra2num(str_a); 2345 if isnan(num_j1(ifile)) 2346 num_j1(ifile)=1; 2347 end 2348 num_j2(ifile)=stra2num(str_b); 2349 if isnan(num_j2(ifile)) 2350 num_j2(ifile)=num_j1(ifile); 2351 end 2352 end 2353 2291 2292
Note: See TracChangeset
for help on using the changeset viewer.