- Timestamp:
- Jun 11, 2012, 9:33:54 AM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r444 r446 1021 1021 1022 1022 1023 %-------------- orm----------------------------------------------------------1023 %------------------------------------------------------------------------ 1024 1024 % --- Main lauch command, called by RUN and BATCH 1025 1025 function errormsg=launch_jobs(hObject, eventdata, handles, batch) 1026 %----------------------------------------------------------------------- 1026 %------------------------------------------------------------------------ 1027 1027 errormsg='';%default 1028 1028 … … 1076 1076 if isfield(handles,'status') 1077 1077 set(handles.status,'Value',0);%suppress status display 1078 status_Callback( hObject, eventdata, handles)1078 status_Callback([], [], handles) 1079 1079 end 1080 1080 … … 2100 2100 detect=exist(filename,'file')==2; 2101 2101 if detect% if a netcdf file already exists 2102 r=regexp(subdir_civ1_new,'(?<root>.*\D)(?<num1>\d+)$','names');%detect whether name ends by a number 2103 if isempty(r) 2104 r(1).root=[subdir_civ1_new '_']; 2105 r(1).num1='0'; 2102 answer=msgbox_uvmat('INPUT_Y-N',['delete files in ' subdir_civ1_new]); 2103 if ~strcmp(answer,'Yes') 2104 r=regexp(subdir_civ1_new,'(?<root>.*\D)(?<num1>\d+)$','names');%detect whether name ends by a number 2105 if isempty(r) 2106 r(1).root=[subdir_civ1_new '_']; 2107 r(1).num1='0'; 2108 end 2109 subdir_civ1_new=[r(1).root num2str(str2num(r(1).num1)+1)];%increment the index by 1 or put 1 2110 subdir_civ2=subdir_civ1_new; 2106 2111 end 2107 subdir_civ1_new=[r(1).root num2str(str2num(r(1).num1)+1)];%increment the index by 1 or put 12108 % indstr=regexp(subdir_civ1_new,'\D');2109 % if indstr(end)<length(subdir_civ1_new) %subdir_civ1 ends by a number2110 % vers=str2double(subdir_civ1_new(indstr(end)+1:end))+1;2111 % subdir_civ1_new=[subdir_civ1_new(1:indstr(end)) num2str(vers)];2112 % else2113 % vers=vers+1;2114 % subdir_civ1_new=[subdir_civ1_new(1:indstr(end)) '_' num2str(vers)];2115 % end2116 subdir_civ2=subdir_civ1_new;2117 2112 break 2118 2113 end -
trunk/src/get_file_series.m
r440 r446 4 4 % 5 5 % OUTPUT: 6 % filecell{i,j}: cell array with the two reference indices i and j representing the list of file names 7 % i1_series,i2_series,j1_series,j2_series: corresponding arrays of indices i1,i2,j1,j2. 8 % 6 % filecell{iview,fileindex}: cell array representing the list of file names 7 % iview: line in the table corresponding to a given file series 8 % fileindex: file index within the file series, 9 % i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j 10 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 11 9 12 % INPUT: 10 13 % Param: structure of input parameters as read from the GUI series (by the function read_GUI) … … 25 28 ref_j=first_j:incr_j:last_j; 26 29 end 27 % Pairs=Param.Pairs;28 29 30 30 31 %% determine the list of input file names … … 46 47 r(1).mode=''; 47 48 end 48 [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);49 [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); 49 50 %case of pairs (.nc files) 50 51 i2=[];j1=[];j2=[]; 51 for ifile=1:numel(i1_series {iview})52 i1=i1_series {iview}(ifile);53 if ~isempty(i2_series {iview})54 i2=i2_series {iview}(ifile);52 for ifile=1:numel(i1_series_iview) 53 i1=i1_series_iview(ifile); 54 if ~isempty(i2_series_iview) 55 i2=i2_series_iview(ifile); 55 56 end 56 if ~isempty(j1_series {iview})57 j1=j1_series {iview}(ifile);57 if ~isempty(j1_series_iview) 58 j1=j1_series_iview(ifile); 58 59 end 59 if ~isempty(j2_series {iview})60 j2=j2_series {iview}(ifile);60 if ~isempty(j2_series_iview) 61 j2=j2_series_iview(ifile); 61 62 end 62 63 filecell{iview,ifile}=fullfile_uvmat(InputTable{iview,1},InputTable{iview,2},InputTable{iview,3},InputTable{iview,5},InputTable{iview,4}... 63 64 ,i1,i2,j1,j2); 64 65 end 66 i1_series(iview,:,:)=i1_series_iview; 67 i2_series(iview,:,:)=i2_series_iview; 68 j1_series(iview,:,:)=j1_series_iview; 69 j2_series(iview,:,:)=j2_series_iview; 65 70 end 66 71 … … 70 75 j1_series=[]; 71 76 if ~isempty(ref_j) 72 % i1_series=meshgrid(ref_i,ones(size(ref_j)));73 % % j1_series=meshgrid(ref_i,ones(size(ref_j)));74 % j1_series=meshgrid(ones(size(ref_i)),ref_j);75 77 [i1_series,j1_series]=meshgrid(ref_i,ref_j); 76 78 end -
trunk/src/get_file_type.m
r435 r446 32 32 if length(imainfo) >1 %case of image with multiple frames 33 33 FileType='multimage'; 34 FileInfo=imainfo{1};%take info from the first frame 34 35 FileInfo.NbFrame=length(imainfo); 36 else 37 FileInfo=imainfo; 35 38 end 36 39 end -
trunk/src/series.m
r441 r446 6 6 %INPUT 7 7 % param: structure with input parameters (link with the GUI uvmat) 8 % .menu_coord_str: string for the transform_fct(menu for coordinate transforms)9 % .menu_coord_val: value for transform_fct(menu for coordinate transforms)8 % .menu_coord_str: string for the TransformName (menu for coordinate transforms) 9 % .menu_coord_val: value for TransformName (menu for coordinate transforms) 10 10 % .FileName: input file name 11 11 % .FileName_1: second input file name … … 83 83 h=load (profil_perso); 84 84 test_profil_perso=1; 85 if isfield(h,'MenuFile_1') 85 if isfield(h,'MenuFile_1') && exist(h.MenuFile_1,'file') 86 86 set(handles.MenuFile_1,'Label',h.MenuFile_1); 87 87 set(handles.MenuFile_insert_1,'Label',h.MenuFile_1); 88 88 end 89 if isfield(h,'MenuFile_ 1')89 if isfield(h,'MenuFile_2')&& exist(h.MenuFile_2,'file') 90 90 set(handles.MenuFile_2,'Label',h.MenuFile_2); 91 91 set(handles.MenuFile_insert_2,'Label',h.MenuFile_2); 92 92 end 93 if isfield(h,'MenuFile_ 1')93 if isfield(h,'MenuFile_3')&& exist(h.MenuFile_3,'file') 94 94 set(handles.MenuFile_3,'Label',h.MenuFile_3); 95 95 set(handles.MenuFile_insert_3,'Label',h.MenuFile_3); 96 96 end 97 if isfield(h,'MenuFile_ 1')97 if isfield(h,'MenuFile_4')&& exist(h.MenuFile_4,'file') 98 98 set(handles.MenuFile_4,'Label',h.MenuFile_4); 99 99 set(handles.MenuFile_insert_4,'Label',h.MenuFile_4); 100 100 end 101 if isfield(h,'MenuFile_ 1')101 if isfield(h,'MenuFile_5')&& exist(h.MenuFile_5,'file') 102 102 set(handles.MenuFile_5,'Label',h.MenuFile_5); 103 103 set(handles.MenuFile_insert_5,'Label',h.MenuFile_5); … … 112 112 %% file name and browser initialisation 113 113 if isfield(param,'menu_coord_str') 114 set(handles. transform_fct,'String',param.menu_coord_str)114 set(handles.TransformName,'String',param.menu_coord_str) 115 115 end 116 116 if isfield(param,'menu_coord_val') 117 set(handles. transform_fct,'Value',param.menu_coord_val);118 else 119 set(handles. transform_fct,'Value',1);%default117 set(handles.TransformName,'Value',param.menu_coord_val); 118 else 119 set(handles.TransformName,'Value',1);%default 120 120 end 121 121 if isfield(param,'FileName') … … 130 130 %% fields input initialisation 131 131 if isfield(param,'list_fields')&& isfield(param,'index_fields') &&~isempty(param.list_fields) &&~isempty(param.index_fields) 132 set(handles.Field Menu,'String',param.list_fields);% list menu fields133 set(handles.Field Menu,'Value',param.index_fields);% selected string index132 set(handles.FieldName,'String',param.list_fields);% list menu fields 133 set(handles.FieldName,'Value',param.index_fields);% selected string index 134 134 FieldCell{1}=param.list_fields{param.index_fields}; 135 135 end 136 136 137 %loads the information stored in prefdir to initiate the list of A CTIONfunctions137 %loads the information stored in prefdir to initiate the list of ActionName functions 138 138 fct_menu={'check_data_files';'aver_stat';'time_series';'merge_proj';'clean_civ_cmx'}; 139 139 transform_menu={'';'phys';'px';'phys_polar'}; … … 192 192 end 193 193 fct_menu=[fct_menu;{'more...'}]; 194 set(handles.A CTION,'String',fct_menu)195 set(handles.A CTION,'UserData',fct_path)% store the list of path in UserData of ACTION194 set(handles.ActionName,'String',fct_menu) 195 set(handles.ActionName,'UserData',fct_path)% store the list of path in UserData of ACTION 196 196 menu_str=menu_str(find(testexist)); 197 197 fct_handle=fct_handle(find(testexist)); 198 198 menu_str=[menu_str;{'more...'}]; 199 set(handles. transform_fct,'String',menu_str)200 set(handles. transform_fct,'UserData',fct_handle)% store the list of path in UserData of ACTION201 202 % display the GUI for the default action 'check_data_files'203 A CTION_Callback(hObject, eventdata, handles)199 set(handles.TransformName,'String',menu_str) 200 set(handles.TransformName,'UserData',fct_handle)% store the list of path in UserData of ACTION 201 202 % display the GUI for the default actionname 'check_data_files' 203 ActionName_Callback(hObject, eventdata, handles) 204 204 205 205 %------------------------------------------------------------------------ … … 218 218 % II - FUNCTIONS FOR INTRODUCING THE INPUT FILES 219 219 % automatically sets the global properties when the rootfile name is introduced 220 % then activate the view-field action if selected220 % then activate the view-field actionname if selected 221 221 % it is activated either by clicking on the RootPath window or by the 222 222 % browser … … 267 267 display_file_name(handles,fileinput,0) 268 268 %update list of recent files in the menubar 269 MenuFile_1=fileinput;270 MenuFile_2=get(handles.MenuFile_1,'Label');271 MenuFile_3=get(handles.MenuFile_2,'Label');272 MenuFile_4=get(handles.MenuFile_3,'Label');273 MenuFile_5=get(handles.MenuFile_4,'Label');274 set(handles.MenuFile_1,'Label',MenuFile_1)275 set(handles.MenuFile_2,'Label',MenuFile_2)276 set(handles.MenuFile_3,'Label',MenuFile_3)277 set(handles.MenuFile_4,'Label',MenuFile_4)278 set(handles.MenuFile_5,'Label',MenuFile_5)279 set(handles.MenuFile_insert_1,'Label',MenuFile_1)280 set(handles.MenuFile_insert_2,'Label',MenuFile_2)281 set(handles.MenuFile_insert_3,'Label',MenuFile_3)282 set(handles.MenuFile_insert_4,'Label',MenuFile_4)283 set(handles.MenuFile_insert_5,'Label',MenuFile_5)284 dir_perso=prefdir;285 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');286 if exist(profil_perso,'file')287 save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat288 else289 txt=ver('MATLAB');290 Release=txt.Release;291 relnumb=str2num(Release(3:4));292 if relnumb >= 14293 save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat294 else295 save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat296 end297 end269 % MenuFile_1=fileinput; 270 % MenuFile_2=get(handles.MenuFile_1,'Label'); 271 % MenuFile_3=get(handles.MenuFile_2,'Label'); 272 % MenuFile_4=get(handles.MenuFile_3,'Label'); 273 % MenuFile_5=get(handles.MenuFile_4,'Label'); 274 % set(handles.MenuFile_1,'Label',MenuFile_1) 275 % set(handles.MenuFile_2,'Label',MenuFile_2) 276 % set(handles.MenuFile_3,'Label',MenuFile_3) 277 % set(handles.MenuFile_4,'Label',MenuFile_4) 278 % set(handles.MenuFile_5,'Label',MenuFile_5) 279 % set(handles.MenuFile_insert_1,'Label',MenuFile_1) 280 % set(handles.MenuFile_insert_2,'Label',MenuFile_2) 281 % set(handles.MenuFile_insert_3,'Label',MenuFile_3) 282 % set(handles.MenuFile_insert_4,'Label',MenuFile_4) 283 % set(handles.MenuFile_insert_5,'Label',MenuFile_5) 284 % dir_perso=prefdir; 285 % profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 286 % if exist(profil_perso,'file') 287 % save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat 288 % else 289 % txt=ver('MATLAB'); 290 % Release=txt.Release; 291 % relnumb=str2num(Release(3:4)); 292 % if relnumb >= 14 293 % save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat 294 % else 295 % save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat 296 % end 297 % end 298 298 end 299 299 … … 329 329 SubDirCell=InputTable(:,3); 330 330 RootFileCell=InputTable(:,2); 331 % RootPathCell=get(handles.RootPath,'String');332 % RootFileCell=get(handles.RootFile,'String');333 331 oldfile=''; %default 334 332 if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box … … 404 402 iview=eventdata.Indices(1); 405 403 InputTable=get(handles.InputTable,'Data'); 406 file name=fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}])404 fileinput=fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}]); 407 405 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') 406 %update the output dir 407 SubDir=sort(InputTable(:,2)); %set of subdirectories sorted in alphabetical order 408 SubDirOut=SubDir{1}; 409 if numel(SubDir)>1 410 for ilist=2:numel(SubDir) 411 SubDirOut=[SubDirOut '-' SubDir{ilist}]; 412 end 413 end 414 set(handles.OutputSubDir,'String',SubDirOut) 422 415 423 416 %------------------------------------------------------------------------ … … 445 438 set(handles.RUN, 'Enable','On') 446 439 set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red 447 % set(handles.RootPath,'BackgroundColor',[1 1 0]) % set RootPath edit box to yellow448 440 set(handles.InputTable,'BackgroundColor',[1 1 0]) % set RootPath edit box to yellow 449 441 drawnow 450 451 442 452 443 %% detect root name, nomenclature and indices in the input file name: … … 467 458 set(handles.ListView,'String',[get(handles.ListView,'String');{num2str(lastview)}]) 468 459 set(handles.ListView,'Value',lastview) 469 % check_lines=get(handles.REFRESH_INDICES,'UserData'); 460 470 461 else % or re-initialise the list of input file series 471 462 lastview=1; … … 478 469 end 479 470 set(handles.InputTable,'Data',InputTable) 480 % 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) 471 472 %update the output dir 473 SubDir=sort(InputTable(:,2)); %set of subdirectories sorted in alphabetical order 474 SubDirOut=SubDir{1}; 475 if numel(SubDir)>1 476 for ilist=2:numel(SubDir) 477 SubDirOut=[SubDirOut '-' SubDir{ilist}]; 478 end 479 end 480 set(handles.OutputSubDir,'String',SubDirOut) 485 481 486 482 %% determine the selected reference field indices for pair display … … 502 498 set(handles.num_ref_j,'String',num2str(ref_j)); 503 499 504 %% update list of recent files in the menubar and save it for future opening500 %% update the list of recent files in the menubar and save it for future opening 505 501 MenuFile=[{get(handles.MenuFile_1,'Label')};{get(handles.MenuFile_2,'Label')};... 506 502 {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}]; 507 str_find=strcmp( FileName,MenuFile);503 str_find=strcmp(fileinput,MenuFile); 508 504 if isempty(find(str_find,1)) 509 MenuFile=[{ FileName};MenuFile];%insert the current file if not already in the list505 MenuFile=[{fileinput};MenuFile];%insert the current file if not already in the list 510 506 end 511 507 for ifile=1:min(length(MenuFile),5) … … 543 539 MinIndex=get(handles.MinIndex,'Data');%retrieve the min indices in the table MinIndex 544 540 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 % else549 % MaxIndex_i=max(i1_series(i1_series>0));550 % end551 % MinIndex_j=min(j1_series(j1_series>0));552 % if ~isempty(j2_series)553 % MaxIndex_j=max(j2_series(j2_series>0));554 % else555 % MaxIndex_j=max(j1_series(j1_series>0));556 % end557 541 i_sum=sum(sum(i1_series,2),3); 558 542 MaxIndex_i=max(find(i_sum>0))-1; … … 626 610 627 611 %% read image documentation file if found%%%%%%%%%%%%%%%%%%%%%%%%%%% 628 629 612 ext_imadoc=''; 630 613 if exist([FileBase '.xml'],'file') … … 744 727 enable='off'; 745 728 end 746 set(handles.VelType Menu,'Visible',enable)729 set(handles.VelType,'Visible',enable) 747 730 set(handles.VelType_text,'Visible',enable) 748 731 if check_civ>=2 … … 751 734 enable='off'; 752 735 end 753 set(handles.VelType Menu_1,'Visible',enable)736 set(handles.VelType_1,'Visible',enable) 754 737 set(handles.VelType_text_1,'Visible',enable) 755 738 if check_civ || check_netcdf … … 758 741 enable='off'; 759 742 end 760 set(handles.Field Menu,'Visible',enable)743 set(handles.FieldName,'Visible',enable) 761 744 set(handles.Field_text,'Visible',enable) 762 745 if check_civ+ check_netcdf>=2 … … 765 748 enable='off'; 766 749 end 767 set(handles.Field Menu_1,'Visible',enable)750 set(handles.FieldName_1,'Visible',enable) 768 751 set(handles.Field_text_1,'Visible',enable) 769 752 FieldString={''}; … … 773 756 FieldString={'get_field...'}; 774 757 end 775 set(handles.Field Menu,'String',FieldString)758 set(handles.FieldName,'String',FieldString) 776 759 FieldString={''}; 777 760 if check_civ>=2 … … 780 763 FieldString={'get_field...'}; 781 764 end 782 set(handles.FieldMenu_1,'String',{'get_field...'}) 783 % testfield=isequal(get(handles.FieldMenu,'enable'),'on'); 784 % testfield_1=isequal(get(handles.FieldMenu_1,'enable'),'on'); 785 % testveltype=isequal(get(handles.VelTypeMenu,'enable'),'on'); 786 % testveltype_1=isequal(get(handles.VelTypeMenu_1,'enable'),'on'); 787 % testtransform=isequal(get(handles.transform_fct,'Enable'),'on'); 788 % testnc=0; 789 % testnc_1=0; 790 % testcivx=0; 791 % testcivx_1=0; 792 % testima=0; %test for image input 793 % if isequal(lower(FileExt),'.avi') %.avi file 794 % testima=1; 795 % elseif ~isempty(imformats(FileExt(2:end))) 796 % testima=1; 797 % elseif isequal(FileExt,'.vol') 798 % testima=1; 799 % end 800 %TODO: update 801 % if length(FileExtCell)==1 || length(FileExtCell)>2 802 % for iview=1:length(FileExtCell) 803 % if isequal(FileExtCell{iview},'.nc') 804 % testnc=1; 805 % end 806 % if isequal(FileTypeCell{iview},'civx') 807 % testcivx=1; 808 % end 809 % end 810 % elseif length(FileExtCell)==2 811 % testnc=isequal(FileExtCell{1},'.nc'); 812 % testnc_1=isequal(FileExtCell{2},'.nc'); 813 % testcivx=isequal(FileTypeCell{1},'civx'); 814 % testcivx_1=isequal(FileTypeCell{2},'civx'); 815 % end 816 % switch FileType 817 % case {'civx','civdata'} 818 % view_FieldMenu(handles,'on') 819 % menustr=get(handles.FieldMenu,'String'); 820 % if isequal(menustr,{'get_field...'}) 821 % set(handles.FieldMenu,'String',{'get_field...';'velocity';'vort';'div';'more...'}) 822 % end 823 % set(handles.VelTypeMenu,'Visible','on') 824 % set(handles.FieldTransform,'Visible','on') 825 % % view_TRANSFORM(handles,'on') 826 % % TODO: second menu 827 % % view_FieldMenu_1(handles,'on') 828 % % if testcivx_1 829 % % menustr=get(handles.FieldMenu_1,'String'); 830 % % if isequal(menustr,{'get_field...'}) 831 % % set(handles.FieldMenu_1,'String',{'get_field...';'velocity';'vort';'div';'more...'}) 832 % % end 833 % % else 834 % % set(handles.FieldMenu_1,'Value',1) 835 % % set(handles.FieldMenu_1,'String',{'get_field...'}) 836 % % set(handles.VelTypeMenu_1,'Visible','on') 837 % % set(handles.VelType_text_1,'Visible','on'); 838 % % end 839 % % view_FieldMenu_1(handles,'off') 840 % case 'netcdf' 841 % view_FieldMenu(handles,'on') 842 % set(handles.FieldMenu,'Value',1) 843 % set(handles.FieldMenu,'String',{'get_field...'}) 844 % set(handles.FieldTransform,'Visible','off') 845 % % view_TRANSFORM(handles,'off') 846 % case {'image','multimage','video'} 847 % view_FieldMenu(handles,'off') 848 % view_FieldMenu_1(handles,'off') 849 % set(handles.VelTypeMenu,'Visible','off') 850 % set(handles.VelType_text,'Visible','off'); 851 % end 852 765 set(handles.FieldName_1,'String',{'get_field...'}) 853 766 854 767 … … 1003 916 enable_j(handles,state_j) 1004 917 918 %------------------------------------------------------------------------ 919 function num_first_i_Callback(hObject, eventdata, handles) 920 %------------------------------------------------------------------------ 921 num_last_i_Callback(hObject, eventdata, handles) 922 923 %------------------------------------------------------------------------ 924 function num_last_i_Callback(hObject, eventdata, handles) 925 %------------------------------------------------------------------------ 926 SeriesData=get(handles.series,'UserData'); 927 if ~isfield(SeriesData,'Time') 928 SeriesData.Time{1}=[]; 929 end 930 displ_time(handles); 931 932 %------------------------------------------------------------------------ 933 function num_first_j_Callback(hObject, eventdata, handles) 934 %------------------------------------------------------------------------ 935 num_last_j_Callback(hObject, eventdata, handles) 936 937 %------------------------------------------------------------------------ 938 function num_last_j_Callback(hObject, eventdata, handles) 939 %------------------------------------------------------------------------ 940 first_j=str2num(get(handles.num_first_j,'String')); 941 last_j=str2num(get(handles.num_last_j,'String')); 942 ref_j=ceil((first_j+last_j)/2); 943 set(handles.num_ref_j,'String', num2str(ref_j)) 944 num_ref_j_Callback(hObject, eventdata, handles) 945 SeriesData=get(handles.series,'UserData'); 946 if ~isfield(SeriesData,'Time') 947 SeriesData.Time{1}=[]; 948 end 949 displ_time(handles); 950 951 %------------------------------------------------------------------------ 952 % ---- find the times corresponding to the first and last indices of a series 953 function displ_time(handles) 954 %------------------------------------------------------------------------ 955 SeriesData=get(handles.series,'UserData');% 956 ref_i=[str2num(get(handles.num_first_i,'String')) str2num(get(handles.num_last_i,'String'))]; 957 ref_j=[str2num(get(handles.num_first_j,'String')) str2num(get(handles.num_last_j,'String'))]; 958 % last_i=str2num(get(handles.num_last_i,'String')); 959 % last_j=str2num(get(handles.num_last_j,'String')); 960 TimeTable=get(handles.TimeTable,'Data'); 961 Pairs=get(handles.PairString,'Data'); 962 for iview=1:size(TimeTable,1) 963 if size(SeriesData.Time,1)<iview 964 break 965 end 966 i1=ref_i; 967 j1=ref_j; 968 i2=ref_i; 969 j2=ref_j; 970 % case of pairs 971 if ~isempty(Pairs{iview,1}) 972 r=regexp(Pairs{iview,1},'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names'); 973 if isempty(r) 974 r=regexp(Pairs{iview,1},'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names'); 975 end 976 switch r.mode 977 case 'Di=' % case 'series(Di)') 978 i1=ref_i-str2num(r.num1); 979 i2=ref_i+str2num(r.num2); 980 case 'Dj=' % case 'series(Dj)' 981 j1=ref_j-str2num(r.num1); 982 j2=ref_j+str2num(r.num2); 983 case '-' % case 'bursts' 984 j1=str2num(r.num1)*ones(size(ref_i)); 985 j2=str2num(r.num2)*ones(size(ref_i)); 986 end 987 end 988 TimeTable{iview,2}=[]; 989 TimeTable{iview,3}=[]; 990 if size(SeriesData.Time{iview},1)>=i2(2)&&size(SeriesData.Time{iview},1)>=j2(2) 991 if isempty(ref_j) 992 time_first=(SeriesData.Time{iview}(i1(1))+SeriesData.Time{iview}(i2(1)))/2; 993 time_last=(SeriesData.Time{iview}(i1(2))+SeriesData.Time{iview}(i2(2)))/2; 994 else 995 time_first=(SeriesData.Time{iview}(i1(1),j1(1))+SeriesData.Time{iview}(i2(1),j2(1)))/2; 996 time_last=(SeriesData.Time{iview}(i1(2),j1(2))+SeriesData.Time{iview}(i2(2),j2(2)))/2; 997 end 998 TimeTable{iview,2}=time_first; %TODO: take into account pairs 999 TimeTable{iview,3}=time_last; %TODO: take into account pairs 1000 end 1001 end 1002 set(handles.TimeTable,'Data',TimeTable) 1005 1003 1006 1004 %------------------------------------------------------------------------ … … 1076 1074 iview=get(handles.ListView,'Value'); 1077 1075 fill_ListPair(handles,SeriesData.i1_series{iview},SeriesData.i2_series{iview},... 1078 SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData. time{iview});% update the menu of pairs depending on the available netcdf files1076 SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.Time{iview});% update the menu of pairs depending on the available netcdf files 1079 1077 ListPairs_Callback([],[],handles) 1080 1078 … … 1217 1215 end 1218 1216 set(handles.ListPairs,'String',displ_pair) 1219 % if isempty(displ_pair)1220 % msgbox_uvmat('ERROR',['no file available for the selected subdirectory' ])1221 % end1222 1223 1224 1225 % return1226 % %%%%%%%%1227 % %update num_first_i and num_last_i according to the chosen image pairstring1228 % testupdate=0;1229 %1230 % SeriesData=get(handles.series,'UserData');1231 % NomType=SeriesData.NomType{Val};1232 % list_pair=get(handles.ListPairs,'String');%get the menu of image pairs1233 % index_pair=get(handles.ListPairs,'Value');1234 % str_pair=list_pair{index_pair};1235 % ind_equ=strfind(str_pair,'=');%find '='1236 % ind_sep=strfind(str_pair,'|');%find pair separator '|'1237 % ind_com=strfind(str_pair,':');%find ':'1238 % test_bursts=0;1239 % if isempty(ind_sep)1240 % ind_sep=strfind(str_pair,'-');%find pair separator if it is not '|'1241 % test_bursts=1;% we are in the case of bursts1242 % end1243 % displ_num=[0 0 0 0]; %default1244 % if ~isempty(ind_sep)&& ~strcmp(str_pair(ind_sep-1),'*')% if there is a pair separator ('|' or '-')1245 % num1_str=str_pair(ind_equ(1)+1:ind_sep-1);1246 % num2_str=str_pair(ind_sep+1:ind_com-1);1247 % num1=str2double(num1_str);1248 % num2=str2double(num2_str);1249 % if isequal(num1_str(1),' ')1250 % num1_str(1)=[];1251 % end1252 % if isequal(num2_str(end),' ')1253 % num2_str(end)=[];1254 % end1255 % switch NomType1256 % case {'_1-2_1'}1257 % if isequal(num1_str(1),'0')1258 % IndexCell{Val}=['_(i-(i+' num2_str ')_j'];1259 % else1260 % IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')_j'];1261 % end1262 % displ_num(3)=num1;1263 % displ_num(4)=num2;1264 % case {'_1-2'}1265 % if isequal(num1_str(1),'0')1266 % IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')'];1267 % else1268 % IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')'];1269 % end1270 % displ_num(3)=num1;1271 % displ_num(4)=num2;1272 % case '_1_1-2'1273 % if test_bursts1274 % IndexCell{Val}=['_i_' num1_str '-' num2_str ];1275 % else1276 % if isequal(num1_str(1),'0')1277 % IndexCell{Val}=['_i_j-(j+' num2_str ')'];1278 % else1279 % IndexCell{Val}=['_i_(j' num1_str ')-(j+' num2_str ')'];1280 % end1281 % end1282 % displ_num(1)=num1;1283 % displ_num(2)=num2;1284 % case {'#_ab'} %TO COMPLETE1285 % IndexCell{Val}=['_i_' num1_str '-' num2_str ];1286 %1287 % end1288 % end1289 % set(handles.NomType,'String',IndexCell)1290 % SeriesData.displ_num(Val,:)=displ_num;1291 % set(handles.series,'UserData',SeriesData)1292 % % set(handles.NomType,'Value',Val)1293 %1294 % if ~isequal(str_pair,'Dj=*|*')&~isequal(str_pair,'Di=*|*')1295 % mode_list=get(handles.mode,'String');1296 % mode_value=get(handles.mode,'Value');1297 % mode=mode_list{mode_value};1298 % if isequal(mode,'series(Di)')1299 % first_i=str2num(get(handles.num_first_i,'String'));1300 % last_i=str2num(get(handles.num_last_i,'String'));1301 % incr_i=str2num(get(handles.num_incr_i,'String'));1302 % num1=first_i:incr_i:last_i;1303 % lastfieldCell=get(handles.num_MaxIndex_i,'String');1304 % lastfield=str2num(lastfieldCell{1});1305 % if ~isempty(lastfield)1306 % ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield));1307 % num1=num1(ind);1308 % end1309 % if ~isempty(num1)1310 % set(handles.num_first_i,'String',num2str(num1(1)));1311 % set(handles.num_last_i,'String',num2str(num1(end)));1312 % end1313 % testupdate=1;1314 % elseif isequal(mode,'series(Dj)')1315 % first_j=str2num(get(handles.num_first_j,'String'));1316 % last_j=str2num(get(handles.num_last_j,'String'));1317 % incr_j=str2num(get(handles.num_incr_j,'String'));1318 % num_j=first_j:incr_j:last_j;1319 % lastfieldCell=get(handles.num_MaxIndex_j,'String');1320 % if ~isempty(lastfieldCell)1321 % lastfield2=lastfieldCell{1};1322 % ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ...1323 % (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2));1324 % end1325 % testupdate=1;1326 % end1327 %1328 % %update the first and last times of the series1329 % if testupdate && isfield(SeriesData,'Time')1330 % if ~isempty(SeriesData.Time{1})1331 % displ_time(handles);1332 % end1333 % end1334 % end1335 1217 1336 1218 %------------------------------------- … … 1357 1239 %----------------------------------- 1358 1240 function view_FieldMenu(handles,state) 1359 % set(handles.Field Menu,'Visible',state)1241 % set(handles.FieldName,'Visible',state) 1360 1242 % set(handles.Field_text,'Visible',state) 1361 1243 set(handles.InputFields,'Visible',state) … … 1363 1245 %----------------------------------- 1364 1246 function view_FieldMenu_1(handles,state) 1365 set(handles.Field Menu_1,'Visible',state)1247 set(handles.FieldName_1,'Visible',state) 1366 1248 set(handles.Field_text_1,'Visible',state) 1367 1249 1368 % %----------------------------------- 1369 % function view_TRANSFORM(handles,state) 1370 % set(handles.TRANSFORM_frame,'Visible',state) 1371 % set(handles.transform_fct,'Visible',state); 1372 % set(handles.TRANSFORM_title,'Visible',state) 1373 1374 1375 %list_pair_civ_Callback([],[],handles) 1376 1377 1378 1250 1251 %%%%%%%%%%%%%%%%%%%% 1252 %% MAIN ActionName FUNCTIONS 1253 %%%%%%%%%%%%%%%%%%%% 1379 1254 %------------------------------------------------------------------------ 1380 1255 % --- Executes on button press in RUN. 1381 1256 function RUN_Callback(hObject, eventdata, handles) 1382 1257 %------------------------------------------------------------------------ 1383 %% Read parameters from series1384 Series=read_GUI(handles.series);%TODO: extend to all input param1385 Series.hseries=handles.series; % handles to the series GUI1386 1387 %% read root name and field type1388 1258 set(handles.RUN,'BusyAction','queue'); 1389 1259 set(0,'CurrentFigure',handles.series) 1390 if isequal(get(handles.GetObject,'Visible'),'on') && isequal(get(handles.GetObject,'Value'),1) 1391 Series.GetObject=1; 1392 GetObject_Callback(hObject, eventdata, handles) 1393 else 1394 Series.GetObject=0; 1395 end 1396 % SeriesData=get(handles.series,'UserData'); 1397 1398 % Series.hseries=handles.series; % handles to the series GUI 1399 first_i=1; 1400 last_i=1; 1401 incr_i=1; 1402 first_j=1; 1403 last_j=1; 1404 incr_j=1; 1260 set(handles.RUN, 'Enable','Off') 1261 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 1262 [h_fun,Series,errormsg]=prepare_jobs(handles); 1263 if ~isempty(errormsg) 1264 msgbox_uvmat('ERROR',errormsg) 1265 else 1266 h_fun(Series); 1267 end 1268 set(handles.RUN, 'Enable','On') 1269 set(handles.RUN,'BackgroundColor',[1 0 0]) 1270 1271 %------------------------------------------------------------------------ 1272 function STOP_Callback(hObject, eventdata, handles) 1273 %------------------------------------------------------------------------ 1274 set(handles.RUN, 'BusyAction','cancel') 1275 set(handles.RUN,'BackgroundColor',[1 0 0]) 1276 set(handles.RUN,'enable','on') 1277 1278 %------------------------------------------------------------------------ 1279 % --- Executes on button press in BATCH. 1280 function BATCH_Callback(hObject, eventdata, handles) 1281 %------------------------------------------------------------------------ 1282 set(handles.BATCH, 'Enable','Off') 1283 set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784]) 1284 [h_fun,errormsg]=prepare_jobs(handles); 1285 set(handles.BATCH, 'Enable','On') 1286 set(handles.BATCH,'BackgroundColor',[1 0 0]) 1287 path_civ=fileparts(which('civ')); 1288 filename_bat=[OutputFile '.bat']; 1289 [fid,message]=fopen(filename_bat,'w'); 1290 if isequal(fid,-1) 1291 errormsg= ['creation of .bat file: ' message]; 1292 return 1293 end 1294 text_matlabscript=[... 1295 '#!/bin/bash \n'... 1296 '. /etc/sysprofile \n'... 1297 'matlab -nodisplay -nosplash -nojvm <<END_MATLAB \n'... 1298 'cd(''' path_civ '''); \n'... 1299 'civ_matlab(''' filename_xml ''',''' OutputFile '.nc''); \n'... 1300 'exit \n'... 1301 'END_MATLAB \n']; 1302 fprintf(fid,text_matlabscript); 1303 fclose(fid); 1304 if isunix 1305 system(['chmod +x ' filename_bat]); 1306 end 1307 1308 %------------------------------------------------------------------------ 1309 % --- Executes on button press in BIN. 1310 function BIN_Callback(hObject, eventdata, handles) 1311 %------------------------------------------------------------------------ 1312 cmd=['#!/bin/bash \n '... 1313 '#$ -cwd \n '... 1314 'hostname && date \n '... 1315 'umask 002 \n'... 1316 Param.xml.CivmBin ' ' Param.xml.RunTime ' ' filename_xml ' ' OutputFile '.nc']; 1317 1318 %------------------------------------------------------------------------ 1319 % --- Main lauch command, called by RUN and BATCH 1320 function [h_fun,Series,errormsg]=prepare_jobs(handles) 1321 %------------------------------------------------------------------------ 1322 errormsg=''; 1323 %% Read parameters from series 1324 Series=read_GUI(handles.series); 1325 if isfield(Series,'Pairs') 1326 Series=rmfield(Series,'Pairs'); %info Pairs not needed for output 1327 end 1328 1329 %% read root name and field type 1330 first_i=1; 1331 last_i=1; 1332 incr_i=1; 1333 first_j=1; 1334 last_j=1; 1335 incr_j=1; 1405 1336 if isfield(Series.IndexRange,'first_i') 1406 1337 first_i=Series.IndexRange.first_i; … … 1415 1346 1416 1347 %% read input file parameters and set menus 1417 Series.PathProject=get(handles.PathCampaign,'String'); 1418 % InputTable=get(handles.InputTable,'Data'); 1419 % RootPath=Series.InputTable(:,1); 1420 % SubDir=Series.InputTable(:,2); 1421 % RootFile=Series.InputTable(:,3); 1422 % NomType=Series.InputTable(:,4); 1423 % FileExt=Series.InputTable(:,5); 1424 % if isempty(SeriesData) 1425 % msgbox_uvmat('ERROR','no input file series') 1426 % return 1427 % end 1428 % NomType=SeriesData.NomType; 1429 % if length(RootPath)==1 %string character input for user fct 1430 % Series.RootPath=RootPath{1}; 1431 % Series.RootFile=RootFile{1}; 1432 % Series.SubDir=SubDir{1}; 1433 % Series.FileExt=FileExt{1}; 1434 % Series.NomType=NomType{1}; 1435 % else %cell input for user fct 1436 % Series.RootPath=RootPath; 1437 % Series.RootFile=RootFile; 1438 % Series.SubDir=SubDir; 1439 % Series.FileExt=FileExt; 1440 % Series.NomType=NomType; 1441 % end 1442 % if isequal(get(handles.FieldMenu,'Visible'),'on') 1443 % FieldMenu=get(handles.FieldMenu,'String'); 1444 % FieldValue=get(handles.FieldMenu,'Value'); 1445 % Series.Field=FieldMenu(FieldValue); 1446 % end 1447 menu_coord_state=get(handles.transform_fct,'Visible'); 1448 Series.CoordType='';%default 1348 menu_coord_state=get(handles.TransformName,'Visible'); 1449 1349 if isequal(menu_coord_state,'on') 1450 % menu_coord=get(handles.transform_fct,'String'); 1451 menu_index=get(handles.transform_fct,'Value'); 1452 transform_list=get(handles.transform_fct,'UserData'); 1453 Series.FieldTransform.fct_handle=transform_list{menu_index};% transform function handles 1454 end 1455 1456 %reinitiate waitbar position 1457 Series.WaitbarPos=get(handles.waitbar_frame,'Position');%TO SUPPRESS 1458 waitbarpos=Series.WaitbarPos; 1459 waitbarpos(4)=0.005;%reinitialize waitbar to zero height 1460 waitbarpos(2)=Series.WaitbarPos(2)+Series.WaitbarPos(4)-0.005; 1461 % set(handles.waitbar,'Position',waitbarpos) 1462 1463 if isfield(Series.IndexRange,'NbSlice') 1464 Series.NbSlice=Series.IndexRange.NbSlice; 1465 end 1350 menu_index=get(handles.TransformName,'Value'); 1351 transform_list=get(handles.TransformName,'UserData'); 1352 Series.FieldTransform.TransformHandle=transform_list{menu_index};% transform function handles 1353 end 1354 1466 1355 if last_i < first_i | last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... 1467 1356 set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; 1468 num_i=first_i:incr_i:last_i; 1469 num_j=first_j:incr_j:last_j; 1470 % nbfield_cell=get(handles.num_MaxIndex_i,'String'); 1471 nbfield=cell2mat(Series.IndexRange.MaxIndex); 1472 nb=min(nbfield,1); 1473 % nbfield=nb(1); 1474 % nbfield2=nb(2); 1475 1476 %get complementary information from the 'series' interface 1477 list_action=get(handles.ACTION,'String');% list menu action 1478 index_action=get(handles.ACTION,'Value');% selected string index 1479 action= list_action{index_action}; % selected string 1480 mode_list=get(handles.mode,'String'); 1481 index_mode=get(handles.mode,'Value'); 1482 mode=mode_list{index_mode}; 1483 ind_shift=0;%default 1484 1485 1486 %% defining the ACTION function handle 1357 1358 %% projection object 1359 if isfield(Series,'CheckObject') 1360 if Series.CheckObject 1361 hset_object=findobj(allchild(0),'tag','set_object'); 1362 Series.ProjObject=read_GUI(hset_object); 1363 GetObject_Callback([], [], handles) 1364 end 1365 else 1366 Series.CheckObject=0; 1367 end 1368 1369 %% get_field GUI 1370 if isfield(Series,'InputFields')&&isfield(Series.InputFields,'Field') 1371 if strcmp(Series.InputFields.Field,'get_field...') 1372 hget_field=findobj(allchild(0),'name','get_field'); 1373 Series.GetField=read_GUI(hget_field); 1374 end 1375 end 1376 1377 %% defining the ActionName function handle 1378 list_action=get(handles.ActionName,'String');% list menu action 1379 index=get(handles.ActionName,'Value'); 1380 action= list_action{index}; % selected string 1381 Series.Action=action;%name of the processing programme 1382 Series.hseries=handles.series; % handles to the series GUI 1487 1383 path_series=which('series'); 1488 list_path=get(handles.ACTION,'UserData'); 1489 index=get(handles.ACTION,'Value'); 1384 list_path=get(handles.ActionName,'UserData'); 1490 1385 fct_path=list_path{index}; %path stored for the function ACTION 1491 1386 if ~isequal(fct_path,path_series) 1492 1387 eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION 1493 1388 if ~exist(fct_path,'dir') 1494 msgbox_uvmat('ERROR',['The prescibed function path ' fct_path ' does not exist'])1389 errormsg=['The prescibed function path ' fct_path ' does not exist']; 1495 1390 return 1496 1391 end … … 1504 1399 end 1505 1400 1506 %% RUN ACTION 1507 Series.Action=action;%name of the processing programme 1508 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 1509 h_fun(Series); 1510 % if length(RootPath)>1 1511 % h_fun(i1_series_cell,i2_series_cell,j1_series_cell,j2_series_cell,Series); 1512 % else 1513 % h_fun(i1_series,i2_series,j1_series,j2_series,Series); 1514 % end 1515 set(handles.RUN,'BackgroundColor',[1 0 0]) 1516 1517 % %save the current interface setting as figure namefig, append .0 to the name if it already exists 1518 % detect=1; 1519 % while detect==1 1520 % namefigfull=[namedoc '.fig']; 1521 % hh=dir(namefigfull); 1522 % if ~isempty(hh) 1523 % detect=1; 1524 % namedoc=[namedoc '.0']; 1525 % else 1526 % detect=0; 1527 % end 1528 % end 1529 % saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) 1530 1531 %------------------------------------------------------------------------ 1532 function STOP_Callback(hObject, eventdata, handles) 1533 %------------------------------------------------------------------------ 1534 set(handles.RUN, 'BusyAction','cancel') 1535 set(handles.RUN,'BackgroundColor',[1 0 0]) 1536 1537 1538 %------------------------------------------------------------------------ 1539 function num_first_i_Callback(hObject, eventdata, handles) 1540 %------------------------------------------------------------------------ 1541 num_last_i_Callback(hObject, eventdata, handles) 1542 1543 %------------------------------------------------------------------------ 1544 function num_last_i_Callback(hObject, eventdata, handles) 1545 %------------------------------------------------------------------------ 1546 SeriesData=get(handles.series,'UserData'); 1547 if ~isfield(SeriesData,'Time') 1548 SeriesData.Time{1}=[]; 1549 end 1550 displ_time(handles); 1551 1552 %------------------------------------------------------------------------ 1553 function num_first_j_Callback(hObject, eventdata, handles) 1554 %------------------------------------------------------------------------ 1555 num_last_j_Callback(hObject, eventdata, handles) 1556 1557 %------------------------------------------------------------------------ 1558 function num_last_j_Callback(hObject, eventdata, handles) 1559 %------------------------------------------------------------------------ 1560 first_j=str2num(get(handles.num_first_j,'String')); 1561 last_j=str2num(get(handles.num_last_j,'String')); 1562 ref_j=ceil((first_j+last_j)/2); 1563 set(handles.num_ref_j,'String', num2str(ref_j)) 1564 num_ref_j_Callback(hObject, eventdata, handles) 1565 SeriesData=get(handles.series,'UserData'); 1566 if ~isfield(SeriesData,'Time') 1567 SeriesData.Time{1}=[]; 1568 end 1569 displ_time(handles); 1570 1571 1572 % NomTypeCell=SeriesData.NomType; 1573 % if ~isempty(NomTypeCell) 1574 % Val=get(handles.NomType,'Value'); 1575 % NomType=NomTypeCell{Val}; 1576 % if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2') 1577 % if isequal(mode,'series(Dj)') 1578 % fill_ListPair(handles,Val);% update the menu of pairstring depending on the available netcdf files 1579 % end 1580 % end 1581 % end 1582 %------------------------------------------------------------------------ 1583 % ---- find the times corresponding to the first and last indices of a series 1584 function displ_time(handles) 1585 %------------------------------------------------------------------------ 1586 SeriesData=get(handles.series,'UserData');% 1587 ref_i=[str2num(get(handles.num_first_i,'String')) str2num(get(handles.num_last_i,'String'))]; 1588 ref_j=[str2num(get(handles.num_first_j,'String')) str2num(get(handles.num_last_j,'String'))]; 1589 % last_i=str2num(get(handles.num_last_i,'String')); 1590 % last_j=str2num(get(handles.num_last_j,'String')); 1591 TimeTable=get(handles.TimeTable,'Data'); 1592 Pairs=get(handles.PairString,'Data'); 1593 for iview=1:size(TimeTable,1) 1594 if size(SeriesData.Time,1)<iview 1595 break 1596 end 1597 i1=ref_i; 1598 j1=ref_j; 1599 i2=ref_i; 1600 j2=ref_j; 1601 % case of pairs 1602 if ~isempty(Pairs{iview,1}) 1603 r=regexp(Pairs{iview,1},'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names'); 1401 %% create the output data directory and write in it the xml file from the GUI config 1402 %determine the root file corresponding to the first sub dir 1403 if isfield(Series,'OutputSubDir') 1404 SubDirOut=[Series.OutputSubDir Series.OutputDirExt]; 1405 SubDirOutNew=SubDirOut; 1406 iview=1; 1407 SeriesData=get(handles.series,'UserData'); 1408 if size(Series.InputTable,1)>1 && isfield(SeriesData,'AllowInputSort') && isfield(SeriesData.AllowInputSort) 1409 [tild,iview]=sort(Series.InputTable(:,2)); %subdirectories sorted in alphabetical order 1410 Series.InputTable=Series.InputTable(iview,:); 1411 end 1412 detect=exist(fullfile(Series.InputTable{1,1},SubDirOutNew),'file')==2;% test if the dir already exist 1413 while detect 1414 r=regexp(SubDirOut,'(?<root>.*\D)(?<num1>\d+)$','names');%detect whether name ends by a number 1604 1415 if isempty(r) 1605 r=regexp(Pairs.list_pair_civ,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names'); 1606 end 1607 switch r.mode 1608 case 'Di=' % case 'series(Di)') 1609 i1=ref_i-str2num(r.num1); 1610 i2=ref_i+str2num(r.num2); 1611 case 'Dj=' % case 'series(Dj)' 1612 j1=ref_j-str2num(r.num1); 1613 j2=ref_j+str2num(r.num2); 1614 case '-' % case 'bursts' 1615 j1=str2num(r.num1)*ones(size(ref_i)); 1616 j2=str2num(r.num2)*ones(size(ref_i)); 1617 end 1618 end 1619 TimeTable{iview,2}=[]; 1620 TimeTable{iview,3}=[]; 1621 if size(SeriesData.Time{iview},1)>=i2(2)&&size(SeriesData.Time{iview},1)>=j2(2) 1622 if isempty(ref_j) 1623 time_first=(SeriesData.Time{iview}(i1(1))+SeriesData.Time{iview}(i2(1)))/2; 1624 time_last=(SeriesData.Time{iview}(i1(2))+SeriesData.Time{iview}(i2(2)))/2; 1625 else 1626 time_first=(SeriesData.Time{iview}(i1(1),j1(1))+SeriesData.Time{iview}(i2(1),j2(1)))/2; 1627 time_last=(SeriesData.Time{iview}(i1(2),j1(2))+SeriesData.Time{iview}(i2(2),j2(2)))/2; 1628 end 1629 TimeTable{iview,2}=time_first; %TODO: take into account pairs 1630 TimeTable{iview,3}=time_last; %TODO: take into account pairs 1631 end 1632 end 1633 set(handles.TimeTable,'Data',TimeTable) 1634 1635 1636 % 1637 % NomType=InputTable(:,4); 1638 % mode_list=get(handles.mode,'String'); 1639 % index_mode=get(handles.mode,'Value'); 1640 % 1641 % mode=mode_list{index_mode}; 1642 % 1643 % time_first=[]; 1644 % time_last=[]; 1645 % if ~isfield(SeriesData,'Time') 1646 % SeriesData.Time{1}=[]; 1647 % end 1648 % TimeTable=get(handles.TimeTable,'Data'); 1649 % for iview=1:size(TimeTable,1) 1650 % time_first_cell{iview}='?'; 1651 % time_last_cell{iview}='?';%default 1652 % time=SeriesData.Time{iview}; 1653 % if isequal(NomType{iview},'_1-2_1')|isequal(NomType{iview},'_1_1-2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_1-2') 1654 % if isfield(SeriesData,'displ_num')& ~isempty(SeriesData.displ_num) 1655 % ind_shift=SeriesData.displ_num(iview,:); 1656 % if isequal(mode,'bursts') 1657 % first_j=0; 1658 % last_j=0; 1659 % end 1660 % first_i1=first_i +ind_shift(3); 1661 % first_i2 =first_i +ind_shift(4); 1662 % first_j1 =first_j +ind_shift(1); 1663 % first_j2 =first_j +ind_shift(2); 1664 % last_i1=last_i +ind_shift(3); 1665 % last_i2 =last_i +ind_shift(4); 1666 % last_j1 =last_j +ind_shift(1); 1667 % last_j2 =last_j +ind_shift(2); 1668 % siz=size(SeriesData.Time{1}); 1669 % if first_i1>=1 && first_j1>=1 && siz(1)>=last_i2 && siz(2)>=last_j2 1670 % time_first=(time(first_i1,first_j1)+time(first_i2,first_j2))/2; 1671 % time_last=(time(last_i1,last_j1)+time(last_i2,last_j2))/2; 1672 % else%read the time in the nc files 1673 % RootPath=get(handles.RootPath,'String'); 1674 % RootFile=get(handles.RootFile,'String'); 1675 % SubDir=get(handles.SubDir,'String'); 1676 % %VelType=get(handles.VelType,'String'); 1677 % VelType_str=get(handles.VelTypeMenu,'String'); 1678 % VelType_val=get(handles.VelTypeMenu,'Value'); 1679 % VelType=VelType_str{VelType_val}; 1680 % filebase=fullfile(RootPath{1},RootFile{1}); 1681 % [filefirst]=name_generator(filebase,first_i1,first_j1,'.nc',NomType{iview},1,first_i2,first_j2,SubDir{iview}); 1682 % if exist(filefirst,'file') 1683 % Attrib=nc2struct(filefirst,[]); 1684 % if isfield(Attrib,'Time') 1685 % time_first=Attrib.Time; 1686 % else 1687 % if isfield(Attrib,'absolut_time_T0') 1688 % time_first=Attrib.absolut_time_T0; 1689 % end 1690 % if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) 1691 % time_first=Attrib.absolut_time_T0_2; 1692 % end 1693 % end 1694 % end 1695 % [filelast]=name_generator(filebase,last_i1,last_j1,'.nc',NomType{iview},1,last_i2,last_j2,SubDir{iview}); 1696 % if exist(filelast,'file') 1697 % Attrib=nc2struct(filelast,[]); 1698 % if isfield(Attrib,'Time') 1699 % time_last=Attrib.Time; 1700 % else 1701 % if isfield(Attrib,'absolut_time_T0') 1702 % time_last=Attrib.absolut_time_T0; 1703 % end 1704 % if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) 1705 % time_last=Attrib.absolut_time_T0_2; 1706 % end 1707 % end 1708 % end 1709 % end 1710 % end 1711 % else 1712 % siz=size(time); 1713 % if siz(1)>=last_i && siz(2)>=last_j && first_i>=1 && first_j>=1 1714 % time_first=times(first_i,first_j); 1715 % time_last=times(last_i,last_j); 1716 % end 1717 % end 1718 % time_first_cell{iview}=num2str(time_first,4); 1719 % time_last_cell{iview}=num2str(time_last,4); 1720 % end 1721 % 1722 1723 %------------------------------------------------------------------------ 1724 % --- Executes on selection change in ACTION. 1725 function ACTION_Callback(hObject, eventdata, handles) 1416 r(1).root=[SubDirOut '_']; 1417 r(1).num1='0'; 1418 end 1419 SubDirOutNew=[r(1).root num2str(str2num(r(1).num1)+1)];%increment the index by 1 or put 1 1420 detect=exist(fullfile(Series.InputTable{1,1},SubDirOutNew),'file')==2;% test if the dir already exists 1421 end 1422 Series.OutputSubDir=SubDirOutNew; 1423 Series.OutputDir=fullfile(Series.InputTable{1,1},Series.OutputSubDir);%directory set for output results 1424 Series.OutputRootFile=Series.InputTable{1,3};% the first sorted RootFile taken for output 1425 Series=rmfield(Series,'OutputDirExt');%removes redondant information 1426 % create output directory 1427 answer='No'; 1428 if exist(Series.OutputDir,'dir') 1429 answer=msgbox_uvmat('INPUT_Y-N',['use existing ouput directory: ' Series.OutputDir ', possibly delete previous data']); 1430 end 1431 if ~isequal(answer,'Yes') 1432 [tild,msg1]=mkdir(Series.OutputDir); 1433 if ~strcmp(msg1,'') 1434 errormsg=['cannot create ' Series.OutputDir ': ' msg1];%error message for directory creation 1435 return 1436 end 1437 end 1438 filexml=fullfile(Series.OutputDir,[Series.InputTable{1,3} '.xml']);% name of the parameter xml file set in this directory 1439 t=struct2xml(Series); 1440 save(t,filexml); 1441 end 1442 1443 %------------------------------------------------------------------------ 1444 % --- Executes on selection change in ActionName. 1445 function ActionName_Callback(hObject, eventdata, handles) 1726 1446 %------------------------------------------------------------------------ 1727 1447 global nb_builtin_ACTION 1728 list_ACTION=get(handles.A CTION,'String');% list menu fields1729 index_ACTION=get(handles.A CTION,'Value');% selected string index1448 list_ACTION=get(handles.ActionName,'String');% list menu fields 1449 index_ACTION=get(handles.ActionName,'Value');% selected string index 1730 1450 ACTION= list_ACTION{index_ACTION}; % selected function name 1731 1451 path_series=which('series');%path to series.m 1732 list_path=get(handles.A CTION,'UserData');%list of recorded paths to functions of the list ACTION1452 list_path=get(handles.ActionName,'UserData');%list of recorded paths to functions of the list ACTION 1733 1453 default_file=fullfile(list_path{end},ACTION); 1734 1454 % add a new function to the menu if the selected item is 'more...' … … 1749 1469 end 1750 1470 1751 % insert the choice in the action menu1752 menu_str=update_menu(handles.A CTION,ACTION);%new action menu in which the new item has been appended if needed1753 index_ACTION=get(handles.A CTION,'Value');% currently selected index in the list1471 % insert the choice in the actionname menu 1472 menu_str=update_menu(handles.ActionName,ACTION);%new action menu in which the new item has been appended if needed 1473 index_ACTION=get(handles.ActionName,'Value');% currently selected index in the list 1754 1474 list_path{index_ACTION}=PathName; 1755 1475 if length(menu_str)>nb_builtin_ACTION+5; %nb_builtin=nbre of functions always remaining in the initial menu … … 1758 1478 list_path(nb_builtin_ACTION+1:end-4)=[]; 1759 1479 index_ACTION=index_ACTION-nbremove; 1760 set(handles.A CTION,'Value',index_ACTION)1761 set(handles.A CTION,'String',menu_str)1480 set(handles.ActionName,'Value',index_ACTION) 1481 set(handles.ActionName,'String',menu_str) 1762 1482 end 1763 1483 list_path{index_ACTION}=PathName; 1764 set(handles.A CTION,'UserData',list_path);1765 set(handles. path,'enable','inactive')% indicate that the current path is accessible (not 'off')1484 set(handles.ActionName,'UserData',list_path); 1485 set(handles.ActionPath,'enable','inactive')% indicate that the current path is accessible (not 'off') 1766 1486 1767 1487 %record the current menu in personal file profil_perso … … 1787 1507 end 1788 1508 1789 %check the current path to the selected function1509 %check the current ActionPath to the selected function 1790 1510 PathName=list_path{index_ACTION};%current recorded path 1791 set(handles. path,'String',PathName); %show the path to the senlected function1511 set(handles.ActionPath,'String',PathName); %show the path to the senlected function 1792 1512 1793 1513 %default setting for the visibility of the GUI elements 1794 % set(handles.RootPath,'UserData','many')1795 % set(handles.SubDir,'Visible','on')1796 % set(handles.RootFile,'Visible','on')1797 % set(handles.NomType,'Visible','on')1798 % set(handles.FileExt,'Visible','on')1799 1514 set(handles.num_NbSlice,'Visible','off') 1800 1515 set(handles.NbSlice_title,'Visible','off') 1801 set(handles.VelType Menu,'Visible','off');1516 set(handles.VelType,'Visible','off'); 1802 1517 set(handles.VelType_text,'Visible','off'); 1803 set(handles.VelType Menu_1,'Visible','off');1518 set(handles.VelType_1,'Visible','off'); 1804 1519 set(handles.VelType_text_1,'Visible','off'); 1805 1520 view_FieldMenu(handles,'off') 1806 1521 view_FieldMenu_1(handles,'off') 1807 1522 set(handles.FieldTransform,'Visible','off') 1808 % view_TRANSFORM(handles,'off')Visible','off') 1809 set(handles. Objects,'Visible','off');1810 set(handles. GetMask,'Visible','off')1523 set(handles.CheckObject,'Visible','off'); 1524 set(handles.ProjObject,'Visible','off'); 1525 set(handles.CheckMask,'Visible','off') 1811 1526 set(handles.Mask,'Visible','off') 1812 % set(handles.GetObject,'Visible','off'); 1813 set(handles.OutputDir,'Visible','off'); 1814 % set(handles.PARAMETERS_frame,'Visible','off'); 1815 % set(handles.PARAMETERS_title,'Visible','off'); 1527 % set(handles.OutputDirExt,'Visible','off'); 1816 1528 set(handles.ParamKey,'Visible','off') 1817 1529 set(handles.ParamVal,'Visible','off') 1818 1530 ParamKey={}; 1819 set(handles.FieldMenu,'Enable','off') 1820 set(handles.VelTypeMenu,'Enable','off') 1821 set(handles.FieldMenu_1,'Enable','off') 1822 set(handles.VelTypeMenu_1,'Enable','off') 1823 set(handles.transform_fct,'Enable','off') 1531 set(handles.FieldName,'Enable','off') 1532 set(handles.VelType,'Enable','off') 1533 set(handles.FieldName_1,'Enable','off') 1534 set(handles.VelType_1,'Enable','off') 1535 set(handles.TransformName,'Enable','off') 1536 set(handles.OutputDirExt,'Visible','off') 1537 set(handles.OutputSubDir,'Visible','off') 1538 set(handles.OutputDir_title,'Visible','off') 1824 1539 %set the displayed GUI item needed for input parameters 1825 1540 if ~isequal(path_series,PathName) … … 1831 1546 InputText=textscan(fid,'%s',1,'delimiter','\n'); 1832 1547 fclose(fid) 1833 set(handles.A CTION,'ToolTipString',InputText{1}{1})1548 set(handles.ActionName,'ToolTipString',InputText{1}{1}) 1834 1549 end 1835 1550 if ~isequal(path_series,PathName) … … 1839 1554 Param_list={}; 1840 1555 1841 %nb_series=length(RootFile);1842 % FileExt=get(handles.FileExt,'String');1843 % nb_series=length(FileExt);1844 1556 InputTable=get(handles.InputTable,'Data'); 1845 1557 nb_series=size(InputTable,1); 1846 % if ~isempty(checkcell)1847 % nb_series=checkcell(end);1848 % end1849 % nb_series=size(InputFiles,1)1850 1558 testima_series=1; %test for a list of images only 1851 1559 testima=1; … … 1870 1578 for ilist=1:length(varargout)-1 1871 1579 switch varargout{ilist} 1872 1873 %RootFile always visible 1874 % case 'RootPath' %visible by default 1875 % value=lower(varargout{ilist+1}); 1876 % if isequal(value,'one')||isequal(value,'two')||isequal(value,'many') 1877 % set(handles.RootFile,'UserData',value)% for use in menu Open_insert 1878 % end 1879 % case 'SubDir' %visible by default 1880 % if isequal(lower(varargout{ilist+1}),'off') 1881 % set(handles.SubDir,'Visible','off') 1882 % end 1883 % case 'RootFile' %visible by default 1884 % value=lower(varargout{ilist+1}); 1885 % if isequal(value,'off') 1886 % set(handles.RootFile,'Visible','off') 1887 % elseif isequal(value,'one')||isequal(value,'two')||isequal(value,'many') 1888 % set(handles.RootFile,'Visible','on') 1889 % set(handles.RootFile,'UserData',value)% for use in menu Open_insert 1890 % end 1891 % case 'NomType' %visible by default 1892 % if isequal(lower(varargout{ilist+1}),'off') 1893 % set(handles.NomType,'Visible','off') 1894 % end 1895 % case 'FileExt' %visible by default 1896 % if isequal(lower(varargout{ilist+1}),'off') 1897 % set(handles.FileExt,'Visible','off') 1898 % end 1580 case 'NbViewMax' 1581 if ~isempty (varargout{ilist+1}) 1582 if size(InputTable,1)>varargout{ilist+1} 1583 InputTable=InputTable(1:varargout{ilist+1},:); 1584 set(handles.InputTable,'Data',InputTable) 1585 end 1586 end 1587 case 'AllowInputSort' 1588 if isequal(lower(varargout{ilist+1}),'on')% sort the input table by alphabetical order of the SubDir 1589 SeriesData=get(handles.series,'UserData'); 1590 SeriesData.AllowInputSort=1; 1591 set(handles.series,'UserData',SeriesData) 1592 end 1899 1593 case 'NbSlice' %hidden by default 1900 1594 if isequal(lower(varargout{ilist+1}),'on') … … 1902 1596 set(handles.NbSlice_title,'Visible','on') 1903 1597 end 1904 case 'VelType Menu' %hidden by default1598 case 'VelType' %hidden by default 1905 1599 if isequal(lower(varargout{ilist+1}),'one') || isequal(lower(varargout{ilist+1}),'two') 1906 set(handles.VelType Menu,'Enable','on')1600 set(handles.VelType,'Enable','on') 1907 1601 if nb_series >=1 && ~testima_series 1908 set(handles.VelType Menu,'Visible','on')1602 set(handles.VelType,'Visible','on') 1909 1603 set(handles.VelType_text,'Visible','on'); 1910 % set(handles.Field_frame,'Visible','on')1911 1604 end 1912 1605 end 1913 1606 if isequal(lower(varargout{ilist+1}),'two') 1914 set(handles.VelType Menu_1,'Enable','on')1607 set(handles.VelType_1,'Enable','on') 1915 1608 if nb_series >=2 && ~testima_series 1916 set(handles.VelType Menu_1,'Visible','on')1609 set(handles.VelType_1,'Visible','on') 1917 1610 set(handles.VelType_text_1,'Visible','on'); 1918 1611 end 1919 1612 end 1920 case 'Field Menu' %hidden by default1613 case 'FieldName' %hidden by default 1921 1614 if isequal(lower(varargout{ilist+1}),'one')||isequal(lower(varargout{ilist+1}),'two') 1922 set(handles.Field Menu,'Enable','on') % test for MenuBorser1615 set(handles.FieldName,'Enable','on') % test for MenuBorser 1923 1616 if nb_series >=1 && ~testima_series 1924 1617 view_FieldMenu(handles,'on') … … 1926 1619 end 1927 1620 if isequal(lower(varargout{ilist+1}),'two') 1928 set(handles.Field Menu_1,'Enable','on')1621 set(handles.FieldName_1,'Enable','on') 1929 1622 if nb_series >=2 && ~testima_1 1930 1623 view_FieldMenu_1(handles,'on') 1931 1624 end 1932 1625 end 1933 case ' CoordType' %hidden by default1626 case 'FieldTransform' %hidden by default 1934 1627 if isequal(lower(varargout{ilist+1}),'on') 1935 set(handles. transform_fct,'Enable','on')1628 set(handles.TransformName,'Enable','on') 1936 1629 set(handles.FieldTransform,'Visible','on') 1937 % view_TRANSFORM(handles,'on')1938 1630 end 1939 case ' GetObject' %hidden by default1631 case 'ProjObject' %hidden by default 1940 1632 if isequal(lower(varargout{ilist+1}),'on') 1941 set(handles. Objects,'Visible','on')1942 % set(handles.GetObject,'Visible','on'); 1633 set(handles.CheckObject,'Visible','on') 1634 set(handles.ProjObject,'Visible','on') 1943 1635 end 1944 1636 case 'Mask' %hidden by default 1945 1637 if isequal(lower(varargout{ilist+1}),'on') 1946 set(handles. Objects,'Visible','on')1947 % set(handles.GetMask,'Visible','on');1638 set(handles.Mask,'Visible','on') 1639 set(handles.CheckMask,'Visible','on'); 1948 1640 end 1949 case 'PARAMETER' 1641 case 'PARAMETER' % NOT USED 1950 1642 set(handles.PARAMETERS_frame,'Visible','on') 1951 1643 set(handles.PARAMETERS_title,'Visible','on') … … 1953 1645 %set(handles.ParamVal,'Visible','on') 1954 1646 Param_str=varargout{ilist+1}; 1955 Param_list=[Param_list; {Param_str}]; 1647 Param_list=[Param_list; {Param_str}]; 1648 case 'OutputDirExt' 1649 if ~isempty(varargout{ilist+1}) 1650 set(handles.OutputDirExt,'String',varargout{ilist+1}) 1651 set(handles.OutputDirExt,'Visible','on') 1652 set(handles.OutputSubDir,'Visible','on') 1653 set(handles.OutputDir_title,'Visible','on') 1654 end 1956 1655 end 1957 1656 end … … 1962 1661 1963 1662 %------------------------------------------------------------------------ 1964 % --- Executes on selection change in Field Menu.1965 function Field Menu_Callback(hObject, eventdata, handles)1966 %------------------------------------------------------------------------ 1967 field_str=get(handles.Field Menu,'String');1968 field_index=get(handles.Field Menu,'Value');1663 % --- Executes on selection change in FieldName. 1664 function FieldName_Callback(hObject, eventdata, handles) 1665 %------------------------------------------------------------------------ 1666 field_str=get(handles.FieldName,'String'); 1667 field_index=get(handles.FieldName,'Value'); 1969 1668 field=field_str{field_index(1)}; 1970 1669 if isequal(field,'get_field...') … … 1982 1681 'SelectionMode','single',... 1983 1682 'ListString',str); 1984 % edit the choice in the fields and action menu1683 % edit the choice in the fields and actionname menu 1985 1684 scalar=cell2mat(str(ind_answer)); 1986 update_menu(handles.Field Menu,scalar)1987 end 1988 1989 %------------------------------------------------------------------------ 1990 % --- Executes on selection change in Field Menu_1.1991 function Field Menu_1_Callback(hObject, eventdata, handles)1992 %------------------------------------------------------------------------ 1993 field_str=get(handles.Field Menu_1,'String');1994 field_index=get(handles.Field Menu_1,'Value');1685 update_menu(handles.FieldName,scalar) 1686 end 1687 1688 %------------------------------------------------------------------------ 1689 % --- Executes on selection change in FieldName_1. 1690 function FieldName_1_Callback(hObject, eventdata, handles) 1691 %------------------------------------------------------------------------ 1692 field_str=get(handles.FieldName_1,'String'); 1693 field_index=get(handles.FieldName_1,'Value'); 1995 1694 field=field_str{field_index}; 1996 1695 if isequal(field,'get_field...') … … 2010 1709 'SelectionMode','single',... 2011 1710 'ListString',str); 2012 % edit the choice in the fields and action menu1711 % edit the choice in the fields and actionname menu 2013 1712 scalar=cell2mat(str(ind_answer)); 2014 update_menu(handles.Field Menu_1,scalar)1713 update_menu(handles.FieldName_1,scalar) 2015 1714 end 2016 1715 … … 2080 1779 end 2081 1780 2082 2083 % set(handles.time_first,'Value',1) 2084 % set(handles.time_last,'Value',1) 2085 % set(handles.time_first,'String',time_first_cell); 2086 % set(handles.time_last,'String',time_last_cell); 2087 2088 %------------------------------------------------------------------------ 2089 % --- Executes on button press in GetObject. 2090 function GetObject_Callback(hObject, eventdata, handles) 2091 %------------------------------------------------------------------------ 2092 SeriesData=get(handles.series,'UserData'); 2093 value=get(handles.GetObject,'Value'); 1781 %------------------------------------------------------------------------ 1782 % --- Executes on button press in CheckObject. 1783 function CheckObject_Callback(hObject, eventdata, handles) 1784 %------------------------------------------------------------------------ 1785 % SeriesData=get(handles.series,'UserData'); 1786 value=get(handles.CheckObject,'Value'); 2094 1787 if value 2095 set(handles. GetObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow1788 set(handles.CheckObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow 2096 1789 hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle 2097 1790 if ishandle(hset_object) … … 2114 1807 %read the file 2115 1808 data=xml2struct(fileinput); 2116 % t=xmltree(fileinput); 2117 % data=convert(t); 2118 if ~isfield(data,'Style') 2119 data.Style='points'; 1809 if ~isfield(data,'Type') 1810 msgbox_uvmat('ERROR',[fileinput ' is not an object xml file']) 1811 return 2120 1812 end 2121 1813 if ~isfield(data,'ProjMode') 2122 data.ProjMode='projection'; 2123 end 2124 % data.desable_plot=1; 2125 [SeriesData.hset_object,SeriesData.sethandles]=set_object(data);% call the set_object interface 1814 data.ProjMode='none'; 1815 end 1816 hset_object=set_object(data);% call the set_object interface 2126 1817 end 2127 else 2128 set(handles.GetObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green 2129 end 2130 set(handles.series,'UserData',SeriesData) 1818 Object=read_GUI(hset_object); 1819 set(handles.ProjObject,'String',Object.Name);%display the object name 1820 else 1821 set(handles.CheckObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green 1822 end 1823 %set(handles.series,'UserData',SeriesData) 2131 1824 2132 1825 %-------------------------------------------------------------- 2133 function GetMask_Callback(hObject, eventdata, handles)2134 value=get(handles. GetMask,'Value');1826 function CheckMask_Callback(hObject, eventdata, handles) 1827 value=get(handles.CheckMask,'Value'); 2135 1828 if value 2136 1829 msgbox_uvmat('ERROR','not implemented yet') … … 2162 1855 2163 1856 %------------------------------------------------------------------- 2164 % --- Executes on selection change in transform_fct.2165 function transform_fct_Callback(hObject, eventdata, handles)1857 % --- Executes on selection change in TransformName. 1858 function TransformName_Callback(hObject, eventdata, handles) 2166 1859 %------------------------------------------------------------------- 2167 1860 global nb_transform 2168 1861 2169 menu=get(handles. transform_fct,'String');2170 ind_coord=get(handles. transform_fct,'Value');1862 menu=get(handles.TransformName,'String'); 1863 ind_coord=get(handles.TransformName,'Value'); 2171 1864 coord_option=menu{ind_coord}; 2172 list_transform=get(handles. transform_fct,'UserData');1865 list_transform=get(handles.TransformName,'UserData'); 2173 1866 ff=functions(list_transform{end}); 2174 1867 if isequal(coord_option,'more...'); … … 2194 1887 return 2195 1888 end 2196 menu=update_menu(handles. transform_fct,transform);%add the selected fct to the menu2197 ind_coord=get(handles. transform_fct,'Value');1889 menu=update_menu(handles.TransformName,transform);%add the selected fct to the menu 1890 ind_coord=get(handles.TransformName,'Value'); 2198 1891 addpath(PathName) 2199 1892 list_transform{ind_coord}=str2func(transform);% create the function handle corresponding to the newly seleced function 2200 set(handles. transform_fct,'UserData',list_transform)1893 set(handles.TransformName,'UserData',list_transform) 2201 1894 rmpath(PathName) 2202 1895 % save the new menu in the personal file 'uvmat_perso.mat' … … 2212 1905 end 2213 1906 2214 %check the current path to the selected function1907 %check the current ActionPath to the selected function 2215 1908 if ~isempty(list_transform{ind_coord}) 2216 1909 func=functions(list_transform{ind_coord}); 2217 set(handles. path_transform,'String',fileparts(func.file)); %show the path to the senlected function2218 else 2219 set(handles. path_transform,'String',''); %show the path to the senlected function2220 end 2221 2222 % ------------------------------------------------------------------------2223 % --- Executes on button press in REFRESH_INDICES.2224 function REFRESH_INDICES_Callback(hObject, eventdata, handles)2225 % ------------------------------------------------------------------------2226 % hObject handle to REFRESH_INDICES (see GCBO)2227 % eventdata reserved - to be defined in a future version of MATLAB2228 % handles structure with handles and user data (see GUIDATA)2229 set(handles.REFRESH_INDICES,'BackgroundColor',[0.7 0.7 0.7])2230 InputTable=get(handles.InputTable,'Data');2231 check_lines=get(handles.REFRESH_INDICES,'UserData');2232 2233 % % check the indices and FileTypes for each series (limited to the new ones to save time)2234 for ind_list=1:length(check_lines)2235 if check_lines(ind_list)2236 InputLine=InputTable(ind_list,:);2237 detect_idem=strcmp('"',InputLine);% look for '" (repeat of previous data)2238 detect_idem=detect_idem(detect_idem>0);2239 if ~isempty (detect_idem)2240 InputLine(detect_idem)=InputTable(ind_list-1,detect_idem);2241 set(handles.InputTable,'Data',InputTable)2242 end2243 fileinput=fullfile_uvmat(InputLine{1},InputLine{2},InputLine{3},InputLine{5},InputLine{4},1,2,1,2);2244 %fileinput=name_generator(fullfile(InputLine{1},InputLine{3}),1,1,InputLine{5},InputLine{4},1,2,2,InputLine{2})2245 %update file series defined by the selected line2246 [InputTable{ind_list,3},InputTable{(ind_list),4},errormsg]=update_indices(handles,fileinput,ind_list);2247 if ~isempty(errormsg)2248 msgbox_uvmat('ERROR',errormsg)2249 return2250 end2251 end2252 end2253 set(handles.InputTable,'Data',InputTable)2254 SeriesData=get(handles.series,'UserData');2255 2256 state_j='off';2257 state_Pairs='off';2258 state_InputFields='off';2259 val=get(handles.ListView,'Value');2260 ListViewString={''};2261 if ~isempty(SeriesData)2262 % ListViewString={};2263 for iview=1:size(InputTable,1)2264 if ~isempty(SeriesData.j1_series{iview})2265 state_j='on';2266 end2267 if ~isempty(SeriesData.i2_series{iview})||~isempty(SeriesData.j2_series{iview})2268 state_Pairs='on';2269 ListViewString{iview}=num2str(iview);2270 if check_lines(iview)2271 val=iview;%select the last pair if it is a new entry2272 end2273 end2274 if strcmp(SeriesData.FileType{iview},'civx')||strcmp(SeriesData.FileType{iview},'civdata')2275 state_InputFields='on';2276 end2277 end2278 end2279 set(handles.ListView,'Value',val)2280 set(handles.ListView,'String',ListViewString)2281 if strcmp(state_Pairs,'on')2282 ListView_Callback(hObject,eventdata,handles)2283 end2284 set(handles.PairString,'Visible',state_Pairs)2285 enable_j(handles,state_j)2286 set(handles.REFRESH_INDICES,'BackgroundColor',[1 0 0])2287 set(handles.REFRESH_INDICES,'visible','off')1910 set(handles.TransformPath,'String',fileparts(func.file)); %show the path to the senlected function 1911 else 1912 set(handles.TransformPath,'String',''); %show the path to the senlected function 1913 end 1914 1915 % %------------------------------------------------------------------------ 1916 % % --- Executes on button press in REFRESH_INDICES. 1917 % function REFRESH_INDICES_Callback(hObject, eventdata, handles) 1918 % %------------------------------------------------------------------------ 1919 % % hObject handle to REFRESH_INDICES (see GCBO) 1920 % % eventdata reserved - to be defined in a future version of MATLAB 1921 % % handles structure with handles and user data (see GUIDATA) 1922 % set(handles.REFRESH_INDICES,'BackgroundColor',[0.7 0.7 0.7]) 1923 % InputTable=get(handles.InputTable,'Data'); 1924 % check_lines=get(handles.REFRESH_INDICES,'UserData'); 1925 % 1926 % %% check the indices and FileTypes for each series (limited to the new ones to save time) 1927 % for ind_list=1:length(check_lines) 1928 % if check_lines(ind_list) 1929 % InputLine=InputTable(ind_list,:); 1930 % detect_idem=strcmp('"',InputLine);% look for '" (repeat of previous data) 1931 % detect_idem=detect_idem(detect_idem>0); 1932 % if ~isempty (detect_idem) 1933 % InputLine(detect_idem)=InputTable(ind_list-1,detect_idem); 1934 % set(handles.InputTable,'Data',InputTable) 1935 % end 1936 % fileinput=fullfile_uvmat(InputLine{1},InputLine{2},InputLine{3},InputLine{5},InputLine{4},1,2,1,2); 1937 % %fileinput=name_generator(fullfile(InputLine{1},InputLine{3}),1,1,InputLine{5},InputLine{4},1,2,2,InputLine{2}) 1938 % %update file series defined by the selected line 1939 % [InputTable{ind_list,3},InputTable{(ind_list),4},errormsg]=update_indices(handles,fileinput,ind_list); 1940 % if ~isempty(errormsg) 1941 % msgbox_uvmat('ERROR',errormsg) 1942 % return 1943 % end 1944 % end 1945 % end 1946 % set(handles.InputTable,'Data',InputTable) 1947 % SeriesData=get(handles.series,'UserData'); 1948 % 1949 % state_j='off'; 1950 % state_Pairs='off'; 1951 % state_InputFields='off'; 1952 % val=get(handles.ListView,'Value'); 1953 % ListViewString={''}; 1954 % if ~isempty(SeriesData) 1955 % % ListViewString={}; 1956 % for iview=1:size(InputTable,1) 1957 % if ~isempty(SeriesData.j1_series{iview}) 1958 % state_j='on'; 1959 % end 1960 % if ~isempty(SeriesData.i2_series{iview})||~isempty(SeriesData.j2_series{iview}) 1961 % state_Pairs='on'; 1962 % ListViewString{iview}=num2str(iview); 1963 % if check_lines(iview) 1964 % val=iview;%select the last pair if it is a new entry 1965 % end 1966 % end 1967 % if strcmp(SeriesData.FileType{iview},'civx')||strcmp(SeriesData.FileType{iview},'civdata') 1968 % state_InputFields='on'; 1969 % end 1970 % end 1971 % end 1972 % set(handles.ListView,'Value',val) 1973 % set(handles.ListView,'String',ListViewString) 1974 % if strcmp(state_Pairs,'on') 1975 % ListView_Callback(hObject,eventdata,handles) 1976 % end 1977 % set(handles.PairString,'Visible',state_Pairs) 1978 % enable_j(handles,state_j) 1979 % set(handles.REFRESH_INDICES,'BackgroundColor',[1 0 0]) 1980 % set(handles.REFRESH_INDICES,'visible','off') 2288 1981 2289 1982 % ----------------------------------------------------------------------- … … 2360 2053 2361 2054 %% enable field and veltype menus 2362 testfield=isequal(get(handles.Field Menu,'enable'),'on');2363 testfield_1=isequal(get(handles.Field Menu_1,'enable'),'on');2364 testveltype=isequal(get(handles.VelType Menu,'enable'),'on');2365 testveltype_1=isequal(get(handles.VelType Menu_1,'enable'),'on');2366 testtransform=isequal(get(handles. transform_fct,'Enable'),'on');2055 testfield=isequal(get(handles.FieldName,'enable'),'on'); 2056 testfield_1=isequal(get(handles.FieldName_1,'enable'),'on'); 2057 testveltype=isequal(get(handles.VelType,'enable'),'on'); 2058 testveltype_1=isequal(get(handles.VelType_1,'enable'),'on'); 2059 testtransform=isequal(get(handles.TransformName,'Enable'),'on'); 2367 2060 % testnc=0; 2368 2061 % testnc_1=0; … … 2396 2089 case {'civx','civdata'} 2397 2090 view_FieldMenu(handles,'on') 2398 menustr=get(handles.Field Menu,'String');2091 menustr=get(handles.FieldName,'String'); 2399 2092 if isequal(menustr,{'get_field...'}) 2400 set(handles.Field Menu,'String',{'get_field...';'velocity';'vort';'div';'more...'})2401 end 2402 set(handles.VelType Menu,'Visible','on')2093 set(handles.FieldName,'String',{'get_field...';'velocity';'vort';'div';'more...'}) 2094 end 2095 set(handles.VelType,'Visible','on') 2403 2096 set(handles.FieldTransform,'Visible','on') 2404 2097 % view_TRANSFORM(handles,'on') … … 2406 2099 % view_FieldMenu_1(handles,'on') 2407 2100 % if testcivx_1 2408 % menustr=get(handles.Field Menu_1,'String');2101 % menustr=get(handles.FieldName_1,'String'); 2409 2102 % if isequal(menustr,{'get_field...'}) 2410 % set(handles.Field Menu_1,'String',{'get_field...';'velocity';'vort';'div';'more...'})2103 % set(handles.FieldName_1,'String',{'get_field...';'velocity';'vort';'div';'more...'}) 2411 2104 % end 2412 2105 % else 2413 % set(handles.Field Menu_1,'Value',1)2414 % set(handles.Field Menu_1,'String',{'get_field...'})2415 % set(handles.VelType Menu_1,'Visible','on')2106 % set(handles.FieldName_1,'Value',1) 2107 % set(handles.FieldName_1,'String',{'get_field...'}) 2108 % set(handles.VelType_1,'Visible','on') 2416 2109 % set(handles.VelType_text_1,'Visible','on'); 2417 2110 % end … … 2419 2112 case 'netcdf' 2420 2113 view_FieldMenu(handles,'on') 2421 set(handles.Field Menu,'Value',1)2422 set(handles.Field Menu,'String',{'get_field...'})2114 set(handles.FieldName,'Value',1) 2115 set(handles.FieldName,'String',{'get_field...'}) 2423 2116 set(handles.FieldTransform,'Visible','off') 2424 2117 % view_TRANSFORM(handles,'off') … … 2426 2119 view_FieldMenu(handles,'off') 2427 2120 view_FieldMenu_1(handles,'off') 2428 set(handles.VelType Menu,'Visible','off')2121 set(handles.VelType,'Visible','off') 2429 2122 set(handles.VelType_text,'Visible','off'); 2430 2123 end … … 2481 2174 2482 2175 %% update time table 2483 TimeTable=get(handles.TimeTable,'Data') 2176 TimeTable=get(handles.TimeTable,'Data'); 2484 2177 TimeTable{iview,1}=time(MinIndex_i,MinIndex_j); 2485 2178 TimeTable{iview,4}=time(MaxIndex_i,MaxIndex_j); … … 2515 2208 2516 2209 2517 2518 % --- Executes on button press in BATCH. 2519 function BATCH_Callback(hObject, eventdata, handles) 2520 % hObject handle to BATCH (see GCBO) 2521 % eventdata reserved - to be defined in a future version of MATLAB 2522 % handles structure with handles and user data (see GUIDATA) 2523 Series=read_GUI(handles.series); 2524 t=struct2xml(Series); 2525 save(t); %TODO: determine a xml file name 2526 2527 % list_action=get(handles.ACTION,'String');% list menu action 2528 % index_action=get(handles.ACTION,'Value');% selected string index 2529 % action= list_action{index_action}; % selected string 2530 2531 %% defining the ACTION function handle 2532 path_series=which('series'); 2533 list_path=get(handles.ACTION,'UserData'); 2534 index=get(handles.ACTION,'Value'); 2535 fct_path=list_path{index}; %path stored for the function ACTION 2536 if ~isequal(fct_path,path_series) 2537 eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION 2538 if ~exist(fct_path,'dir') 2539 msgbox_uvmat('ERROR',['The prescibed function path ' fct_path ' does not exist']) 2540 return 2541 end 2542 if ~isequal(spath,fct_path) 2543 addpath(fct_path)% add the prescribed path if not the current one 2544 end 2545 end 2546 eval(['h_fun=@' action ';'])%create a function handle for ACTION 2547 if ~isequal(fct_path,path_series) 2548 rmpath(fct_path)% add the prescribed path if not the current one 2549 end 2550 2551 h_fun('BATCH');% TODO modify the called function to read the xml file as input parameter 2210 % -------------------------------------------------------------------- 2211 function MenuExportConfig_Callback(hObject, eventdata, handles) 2212 global Series 2213 [tild,Series,errormsg]=prepare_jobs(handles); 2214 % Series=read_GUI(handles.series); 2215 2216 evalin('base','global Series')%make CurData global in the workspace 2217 display('current series config :') 2218 evalin('base','Series') %display CurData in the workspace 2219 commandwindow; %brings the Matlab command window to the front -
trunk/src/uvmat.m
r445 r446 2290 2290 end 2291 2291 siz=size(UvData.XmlData{1}.Time); 2292 if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2)2292 if ~isempty(num_i1)&& ~isempty(num_i2)&&siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2) 2293 2293 abstime=(UvData.XmlData{1}.Time(num_i1,num_j1)+UvData.XmlData{1}.Time(num_i2,num_j2))/2;%overset the time read from files 2294 2294 dt=(UvData.XmlData{1}.Time(num_i2,num_j2)-UvData.XmlData{1}.Time(num_i1,num_j1));
Note: See TracChangeset
for help on using the changeset viewer.