Changeset 526
- Timestamp:
- Aug 20, 2012, 12:32:31 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/get_field.m
r521 r526 831 831 function RUN_Callback(hObject, eventdata, handles) 832 832 %--------------------------------------------------------- 833 % set(handles.RUN,'BackgroundColor',[1 1 0])% mark use of RUN action 834 % test_fig=get(handles.SelectFigure,'Value'); 835 % 836 % % plot requested in uvmat 837 % if ~test_fig 838 % inputfile=get(handles.inputfile,'String'); 839 % huvmat=findobj(allchild(0),'tag','uvmat'); 840 % if isempty(huvmat) 841 % input.InputFile=inputfile; 842 % input.FieldsString={'get_field...'}; 843 % uvmat(input) 844 % else 845 % set(huvmat,'Visible','on')%make uvmat visible (bugs can hide it in some cases) 846 % hhuvmat=guidata(huvmat); 847 % set(hhuvmat.Fields,'Value',1) 848 % set(hhuvmat.Fields,'String',{'get_field...'}) 849 % uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat 850 % end 851 % 852 % % other kind of plot 853 % else %TODO: check and update: add plot on an existing axes 854 % figcell=get(handles.list_fig,'String'); 855 % index=get(handles.list_fig,'value'); 856 % figstring=figcell{index}; 857 % index=get(handles.ACTION,'Value'); 858 % list_func=get(handles.ACTION,'UserData'); 859 % h_fun=list_func{index}; 860 % set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 861 % drawnow 862 % SubField=h_fun(handles.get_field);%handles.figure1 =handles of the GUI get_field 863 % if ~isempty(SubField) 864 % plot_get_field(SubField,handles) 865 % end 866 % browse_fig(handles.list_fig); %update the list of new existing figures 867 % end 868 % set(handles.RUN,'BackgroundColor',[1 0 0]) 833 hfield=[]; 869 834 huvmat=findobj(allchild(0),'tag','uvmat'); 870 hhuvmat=guidata(huvmat); 871 FieldsMenu=get(hhuvmat.Fields,'String'); 872 Fields=FieldsMenu{get(hhuvmat.Fields,'Value')}; 873 check_first=strcmp(Fields,'get_field...'); % =1 if the first field sereis is selected, =0 else 835 hseries=findobj(allchild(0),'tag','series'); 836 check_series=0; 874 837 if ~isempty(huvmat) 875 get_field_GUI=read_GUI(handles.get_field); 876 if isfield(get_field_GUI,'PanelVectors') 877 set(hhuvmat.Coord_x,'value',1) 878 set(hhuvmat.Coord_y,'value',1) 879 set(hhuvmat.Coord_x,'String',{get_field_GUI.PanelVectors.coord_x_vectors}) 880 set(hhuvmat.Coord_y,'String',{get_field_GUI.PanelVectors.coord_y_vectors}) 881 UName=get_field_GUI.PanelVectors.vector_x; 882 VName=get_field_GUI.PanelVectors.vector_y; 883 menu_str=[{['vec(' UName ',' VName ')']};{UName};{VName};{['norm(' UName ',' VName ')']};{'get_field...'}]; 884 menu_color=[{''};{UName};{VName};{['norm(' UName ',' VName ')']}]; 885 if check_first 886 set(hhuvmat.Fields,'Value',1) 887 set(hhuvmat.Fields,'String',menu_str) 888 else %get_field has been called by Fields_1 889 set(hhuvmat.Fields_1,'Value',1) 890 set(hhuvmat.Fields_1,'String',menu_str) 891 end 892 ind_menu=find(strcmp(get_field_GUI.PanelVectors.vec_color,menu_color)); 893 if ~isempty(ind_menu) 894 set(hhuvmat.ColorScalar,'Value',ind_menu) 895 else 896 set(hhuvmat.ColorScalar,'Value',1) 897 end 898 set(hhuvmat.ColorScalar,'String',menu_color) 899 elseif isfield(get_field_GUI,'PanelScalar') 900 set(hhuvmat.Coord_x,'value',1) 901 set(hhuvmat.Coord_y,'value',1) 902 set(hhuvmat.Coord_x,'String',{get_field_GUI.PanelScalar.coord_x_scalar}) 903 set(hhuvmat.Coord_y,'String',{get_field_GUI.PanelScalar.coord_y_scalar}) 904 AName=get_field_GUI.PanelScalar.scalar; 905 if check_first 906 menu=get(hhuvmat.Fields,'String'); 907 else 908 menu=get(hhuvmat.Fields_1,'String'); 909 end 910 ind_select=find(strcmp(AName,menu)); 911 if isempty(ind_select) 912 menu=[menu(1:end-1);{AName};{'get_field...'}]; 913 ind_select=numel(menu)-1; 914 end 915 if check_first 916 set(hhuvmat.Fields,'Value',ind_select); 917 set(hhuvmat.Fields,'String',menu); 918 else 919 set(hhuvmat.Fields_1,'Value',ind_select); 920 set(hhuvmat.Fields_1,'String',menu); 921 end 922 end 923 if ~strcmp(get(gcbf,'tag'),'uvmat')%if uvmat is not already active 924 uvmat('run0_Callback',hObject,eventdata,hhuvmat); %refresh uvmat 925 end 838 hh=guidata(huvmat); 839 FieldMenu=get(hh.FieldName,'String'); 840 FieldName=FieldMenu{get(hh.FieldName,'Value')}; 841 if strcmp(FieldName,'get_field...') 842 hfield=hh.FieldName; %FieldName on uvmat 843 elseif strcmp(get(hh.FieldName_1,'Visible'),'on') 844 FieldMenu=get(hh.FieldName_1,'String'); 845 if ~isempty(FieldMenu) 846 FieldName=FieldMenu{get(hh.FieldName_1,'Value')}; 847 if strcmp(FieldName,'get_field...') 848 hfield=hh.FieldName_1; %FieldName_1 on uvmat 849 end 850 end 851 end 852 end 853 if isempty(hfield) && ~isempty(hseries) 854 check_series=1; 855 hh=guidata(hseries); 856 FieldMenu=get(hh.FieldName,'String'); 857 FieldName=FieldMenu{get(hh.FieldName,'Value')}; 858 if strcmp(FieldName,'get_field...') 859 hfield=hh.FieldName; %FieldName on series 860 else 861 FieldMenu=get(hh.FieldName_1,'String'); 862 FieldName=FieldMenu{get(hh.FieldName_1,'Value')}; 863 if strcmp(FieldName,'get_field...') 864 hfield=hh.FieldName_1; %FieldName_1 on series 865 end 866 end 867 end 868 if ~isempty(hfield) 869 get_field_GUI=read_GUI(handles.get_field); 870 if isfield(get_field_GUI,'PanelVectors') 871 set(hh.Coord_x,'value',1) 872 set(hh.Coord_y,'value',1) 873 set(hh.Coord_x,'String',{get_field_GUI.PanelVectors.coord_x_vectors}) 874 set(hh.Coord_y,'String',{get_field_GUI.PanelVectors.coord_y_vectors}) 875 UName=get_field_GUI.PanelVectors.vector_x; 876 VName=get_field_GUI.PanelVectors.vector_y; 877 menu_str=[{['vec(' UName ',' VName ')']};{UName};{VName};{['norm(' UName ',' VName ')']};{'get_field...'}]; 878 menu_color=[{''};{UName};{VName};{['norm(' UName ',' VName ')']}]; 879 set(hfield,'Value',1) 880 set(hfield,'String',menu_str) 881 if ~check_series 882 ind_menu=find(strcmp(get_field_GUI.PanelVectors.vec_color,menu_color)); 883 if ~isempty(ind_menu) 884 set(hh.ColorScalar,'Value',ind_menu) 885 else 886 set(hh.ColorScalar,'Value',1) 887 end 888 set(hh.ColorScalar,'String',menu_color) 889 end 890 elseif isfield(get_field_GUI,'PanelScalar') 891 set(hh.Coord_x,'value',1) 892 set(hh.Coord_y,'value',1) 893 set(hh.Coord_x,'String',{get_field_GUI.PanelScalar.coord_x_scalar}) 894 set(hh.Coord_y,'String',{get_field_GUI.PanelScalar.coord_y_scalar}) 895 AName=get_field_GUI.PanelScalar.scalar; 896 menu=get(hfield,'String'); 897 ind_select=find(strcmp(AName,menu)); 898 if isempty(ind_select) 899 menu=[menu(1:end-1);{AName};{'get_field...'}]; 900 ind_select=numel(menu)-1; 901 end 902 set(hfield,'Value',ind_select); 903 set(hfield,'String',menu); 904 elseif isfield(get_field_GUI,'Panel1Dplot') 905 set(hh.Coord_x,'Value',1) 906 set(hh.Coord_x,'String',{get_field_GUI.Panel1Dplot.abscissa}) 907 set(hh.Coord_y,'String',{get_field_GUI.Panel1Dplot.ordinate}) 908 set(hh.Coord_y,'Value',1:numel(get_field_GUI.Panel1Dplot.ordinate)) 909 set(hfield,'Value',1) 910 set(hfield,'String',[{''};{'get_field...'}]) 911 end 912 if ~check_series && strcmp(get(gcbf,'tag'),'get_field')%get_field is not called by another GUI (uvmat) 913 uvmat('run0_Callback',hObject,eventdata,hh); %refresh uvmat 914 end 926 915 end 927 916 delete(handles.get_field) 928 % set(hhuvmat.Fields,'String',{'get_field...'})929 % uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat930 % end931 917 932 918 %------------------------------------------------------------------------ -
trunk/src/read_field.m
r521 r526 39 39 % end 40 40 A=[]; 41 if ischar(ParamIn.FieldName) 42 ParamIn.FieldName={ParamIn.FieldName}; 41 if isstruct(ParamIn) 42 if isfield(ParamIn,'FieldName')&& ischar(ParamIn.FieldName) 43 ParamIn.FieldName={ParamIn.FieldName}; 44 end 45 if isfield(ParamIn,'ColorVar') 46 InputField=[ParamIn.FieldName {ParamIn.ColorVar}]; 47 check_colorvar=1; 48 else 49 InputField= ParamIn.FieldName; 50 check_colorvar=0; 51 end 43 52 end 44 if isfield(ParamIn,'ColorVar')45 InputField=[ParamIn.FieldName {ParamIn.ColorVar}];46 check_colorvar=1;47 else48 InputField= ParamIn.FieldName;49 check_colorvar=0;50 end51 53 %% distingush different input file types 52 54 try … … 73 75 Role{numel(ListVar)}='vector_y'; 74 76 Role{numel(ListVar)-1}='vector_x'; 75 % switch r.Operator 77 % TODO; introduce that for unstructured coordinates 78 % switch r.Operator TODO; introduce that for unstructured coordinates 76 79 % case 'norm' 77 80 % FieldRequest{numel(ListVar)-1}='interp_lin';%scalar field (requires interpolation for plot) … … 85 88 Role{numel(ListVar)}='ancillary';% scalar used for color vector (not projected) 86 89 end 87 [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.Coord NameListVar]);90 [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.Coord_x ParamIn.Coord_y ListVar]); 88 91 for ivar=1:numel(ListVar) 89 92 Field.VarAttribute{ivar+2}.Role=Role{ivar}; 90 93 % Field.VarAttribute{ivar+2}.FieldRequest=FieldRequest{ivar}; 91 94 end 92 % GUIName='get_field'; %default name of the GUI get_field93 % if isfield(ParamIn,'GUIName')94 % GUIName=ParamIn.GUIName;95 % end96 % CivStage=0;97 % % if ~strcmp(ParamIn.FieldName,'get_field...')% if get_field is not requested, look for Civx data98 % FieldList=calc_field;%list of possible fields for Civx data99 % ParamOut.ColorVar='';%default100 % if ischar(ParamIn.FieldName)101 % FieldName=ParamIn.FieldName;102 % else103 % FieldName=ParamIn.FieldName{1};104 % end105 % field_index=strcmp(FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data106 % if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist107 % Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage');108 % % case of new civdata conventions109 % if isequal(Data.Conventions,'uvmat/civdata')110 %111 % %case of old civx conventions112 % elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)113 % ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default114 % ParamOut.ColorVar='ima_cor';115 % InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}];116 % [Field,ParamOut.VelType]=read_civxdata(FileName,InputField,ParamIn.VelType);117 % if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end118 % CivStage=Field.CivStage;119 % ParamOut.CivStage=Field.CivStage;120 % % not cvix file, fields will be chosen through the GUI get_field121 % else122 % ParamOut.FieldName='get_field...';123 % hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI124 % if ~isempty(hget_field)125 % delete(hget_field)%delete get_field for reinitialisation126 % end127 % end128 % else129 % InputField=ParamOut.FieldName;130 % if ischar(InputField)131 % InputField={InputField};132 % end133 % if isfield(ParamIn,'ColorVar')134 % ParamOut.ColorVar=ParamIn.ColorVar;135 % InputField=[InputField {ParamOut.ColorVar}];136 % end137 % [Field,ParamOut.VelType,errormsg]=read_civxdata(FileName,InputField,ParamIn.VelType);138 % if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end139 % CivStage=Field.CivStage;140 % ParamOut.CivStage=Field.CivStage;141 % end142 % ParamOut.FieldList=[{'image'};FieldList;{'get_field...'}];143 % end144 % if CivStage==0% read the field names on the interface get_field.145 % hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI146 % if isempty(hget_field)% open the GUI get_field if it is not found147 % hget_field= get_field(FileName);%open the get_field GUI148 % set(hget_field,'Name',GUIName)%update the name of get_field (e.g. get_field_1)149 % end150 % hhget_field=guidata(hget_field);151 % %% update the get_field GUI152 % set(hhget_field.inputfile,'String',FileName)153 % set(hhget_field.list_fig,'Value',1)154 % if exist('num','var')&&~isnan(num)155 % set(hhget_field.TimeIndexValue,'String',num2str(num))156 % end157 % % funct_list=get(hhget_field.ACTION,'UserData');158 % % funct_index=get(hhget_field.ACTION,'Value');159 % % funct=funct_list{funct_index};%select the current action in get_field, e;g. PLOT160 % % Field=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot161 % [Field,errormsg]=read_get_field(hget_field);162 % Tabchar={''};%default163 % Tabcell=[];164 % set(hhget_field.inputfile,'String',FileName)165 % if isfield(Field,'ListGlobalAttribute')&& ~isempty(Field.ListGlobalAttribute)166 % for iline=1:length(Field.ListGlobalAttribute)167 % Tabcell{iline,1}=Field.ListGlobalAttribute{iline};168 % if isfield(Field, Field.ListGlobalAttribute{iline})169 % val=Field.(Field.ListGlobalAttribute{iline});170 % if ischar(val);171 % Tabcell{iline,2}=val;172 % else173 % Tabcell{iline,2}=num2str(val);174 % end175 % end176 % end177 % if ~isempty(Tabcell)178 % Tabchar=cell2tab(Tabcell,'=');179 % Tabchar=[{''};Tabchar];180 % end181 % end182 % ParamOut.CivStage=0;183 % ParamOut.VelType=[];184 % if isfield(Field,'TimeIndex')185 % ParamOut.TimeIndex=Field.TimeIndex;186 % end187 % if isfield(Field,'TimeValue')188 % ParamOut.TimeValue=Field.TimeValue;189 % end190 % ParamOut.FieldList={'get_field...'};191 95 192 96 case 'video' -
trunk/src/series.m
r525 r526 68 68 drawnow 69 69 set(hObject,'Units','pixels') 70 set(handles.PairString,'ColumnName',{'pairs'}) 70 71 set(handles.PairString,'ColumnEditable',logical(0)) 71 72 set(handles.PairString,'ColumnFormat',{'char'}) 72 set(handles.PairString,'ColumnWidth',{60})73 73 set(handles.PairString,'Data',{''}) 74 series_ResizeFcn(hObject, eventdata, handles)%resize table according to series GUI size 74 75 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display) 75 76 dir_perso=prefdir; … … 92 93 93 94 %% file name and browser initialisation 94 if isfield(param,' menu_coord_str')95 set(handles.TransformName,'String',param. menu_coord_str)96 end 97 if isfield(param,' menu_coord_val')98 set(handles.TransformName,'Value',param. menu_coord_val);95 if isfield(param,'transform_str') 96 set(handles.TransformName,'String',param.transform_str) 97 end 98 if isfield(param,'transform_val') 99 set(handles.TransformName,'Value',param.transform_val); 99 100 else 100 101 set(handles.TransformName,'Value',1);%default … … 121 122 set(handles.FieldName,'String',param.list_fields);% list menu fields 122 123 set(handles.FieldName,'Value',param.index_fields);% selected string index 123 % FieldCell{1}=param.list_fields{param.index_fields}; 124 end 125 if isfield(param,'Coord_x_str')&& isfield(param,'Coord_x_val') 126 set(handles.Coord_x,'String',param.Coord_x_str);% list menu fields 127 set(handles.Coord_x,'Value',param.Coord_x_val);% selected string index 128 end 129 if isfield(param,'Coord_y_str')&& isfield(param,'Coord_y_val') 130 set(handles.Coord_y,'String',param.Coord_y_str);% list menu fields 131 set(handles.Coord_y,'Value',param.Coord_y_val);% selected string index 124 132 end 125 133 … … 585 593 586 594 %% display the min and max indices for the file series 595 if size(i1_series,2)==1 596 MinIndex_j=1; 597 MaxIndex_j=1; 598 MinIndex_i=min(find(i1_series)); 599 MaxIndex_i=max(find(i1_series)); 600 else 587 601 pair_max=squeeze(max(i1_series,[],1)); %max on pair index 588 602 j_max=max(pair_max,[],1); … … 590 604 MaxIndex_i=max(find(j_max))-1;% max ref index i 591 605 MinIndex_i=min(find(j_max))-1;% min ref index i 606 diff_i_max=diff(j_max); 607 if isequal (diff_i_max,diff_i_max(1)*ones(size(diff_i_max))) 608 set(handles.num_incr_i,'String',num2str(diff_i_max(1))) 609 end 592 610 i_max=max(pair_max,[],2); 593 611 MaxIndex_j=max(find(i_max))-1;% max ref index i 594 612 MinIndex_j=min(find(i_max))-1;% min ref index i 613 diff_j_max=diff(i_max); 614 if isequal (diff_j_max,diff_j_max(1)*ones(size(diff_j_max))) 615 set(handles.num_incr_j,'String',num2str(diff_j_max(1))) 616 end 617 end 595 618 MinIndex=get(handles.MinIndex,'Data');%retrieve the min indices in the table MinIndex 596 619 MaxIndex=get(handles.MaxIndex,'Data');%retrieve the max indices in the table MaxIndex … … 611 634 elseif first_i < MinIndex_i 612 635 first_i=MinIndex_i; 636 elseif first_i >MaxIndex_i 637 first_i=MinIndex_i; 613 638 end 614 639 first_j=str2num(get(handles.num_first_j,'String')); … … 617 642 elseif first_j<MinIndex_j 618 643 first_j=MinIndex_j; 644 elseif first_j >MaxIndex_j 645 first_j=MinIndex_j; 619 646 end 620 647 last_i=str2num(get(handles.num_last_i,'String')); … … 623 650 elseif last_i > MaxIndex_i 624 651 last_i=MaxIndex_i; 652 elseif last_i<first_i 653 last_i=first_i; 625 654 end 626 655 last_j=str2num(get(handles.num_first_j,'String')); … … 629 658 elseif last_j>MaxIndex_j 630 659 last_j=MaxIndex_j; 660 elseif last_i<first_i 661 last_i=first_i; 631 662 end 632 663 set(handles.num_first_i,'String',num2str(first_i)); … … 635 666 set(handles.num_last_j,'String',num2str(last_j)); 636 667 637 %% read timing and total frame number from the current file (movie files) !!may be overrid by xml file668 %% read timing and total frame number from the current file (movie files) may be overrid by xml file 638 669 InputTable=get(handles.InputTable,'Data'); 639 670 FileBase=fullfile(InputTable{iview,1},InputTable{iview,3}); … … 644 675 imainfo=get(VideoObject); 645 676 time=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames-1)/imainfo.FrameRate)'; 646 set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec677 % set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec 647 678 ColorType='truecolor'; 648 679 elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image … … 771 802 for iview=1:nbview 772 803 pair_max{iview}=squeeze(max(SeriesData.i1_series{iview},[],1)); %max on pair index 773 if strcmp(get(handles.num_first_j,'Visible'),'off')804 if (strcmp(get(handles.num_first_j,'Visible'),'off')&& size(pair_max{iview},2)~=1) 774 805 pair_max{iview}=squeeze(max(pair_max{iview},[],1)); % consider only the i index 775 806 end … … 831 862 set(handles.Coord_y,'String',{'Y'}); 832 863 case 'netcdf' 833 set(handles_Fields,'Value',1) 834 set(handles_Fields,'String',{'get_field...'}) 864 set(handles.FieldName,'Value',1) 865 set(handles.FieldName,'String',{'get_field...'}) 866 if isempty(i2_series) 867 i2=[]; 868 else 869 i2=i2_series(1,ref_j+1,ref_i+1); 870 end 871 if isempty(j1_series) 872 j1=[];j2=[]; 873 else 874 j1=j1_series(1,ref_j+1,ref_i+1); 875 if isempty(j2_series) 876 j2=[]; 877 else 878 j2=j2_series(1,ref_j+1,ref_i+1); 879 end 880 end 881 FileName=fullfile_uvmat(InputTable{iview,1},InputTable{iview,2},InputTable{iview,3},InputTable{iview,5},InputTable{iview,4},i1_series(1,ref_j+1,ref_i+1),i2,j1,j2); 835 882 hget_field=get_field(FileName); 836 883 hhget_field=guidata(hget_field); 837 884 get_field('RUN_Callback',hhget_field.RUN,[],hhget_field); 838 885 otherwise 839 set(handles _Fields,'Value',1) % set menu to 'image'840 set(handles _Fields,'String',{'image'})886 set(handles.FieldName,'Value',1) % set menu to 'image' 887 set(handles.FieldName,'String',{'image'}) 841 888 set(handles.Coord_x,'Value',1); 842 889 set(handles.Coord_x,'String',{'AX'}); … … 844 891 set(handles.Coord_y,'String',{'AY'}); 845 892 end 846 % %% set default options in menu 'Fields'%% TODO: check VelType847 % if ~testima848 % testcivx=0;849 % if isfield(UvData,'FieldsString') && isequal(UvData.FieldsString,{'get_field...'})% field menu defined as input (from get_field)850 % set(handles_Fields,'Value',1)851 % set(handles_Fields,'String',{'get_field...'})852 % UvData=rmfield(UvData,'FieldsString');853 % else854 % Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ');855 % if strcmp(Data.Conventions,'uvmat/civdata') ||( ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0))%if the new input is Civx856 % FieldList=calc_field;857 % set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data858 % set(handles_Fields,'Value',2) % set menu to 'velocity'859 % col_vec=FieldList;860 % col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar)861 % testcivx=1;862 % end863 % if ~testcivx864 % set(handles_Fields,'Value',1) % set menu to 'get_field...865 % set(handles_Fields,'String',{'get_field...'})866 % col_vec={'get_field...'};867 % end868 % set(handles.ColorScalar,'String',col_vec)869 % end870 % end871 % set(handles.uvmat,'UserData',UvData)872 %873 % %% set index navigation options and refresh plots874 % scan_option='i';%default875 % state_j='off'; %default876 % if index==2877 % if get(handles.scan_j,'Value')878 % scan_option='j'; %keep the scan option for the second fiel series879 % end880 % if strcmp(get(handles.j1,'Visible'),'on')881 % state_j='on';882 % end883 % end884 % if ~isempty(j1_series)885 % state_j='on';886 % if isequal(nbfield,1) &&index==1887 % scan_option='j'; %scan j index by default if nbfield=1888 % end889 % end890 % if isequal(scan_option,'i')891 % set(handles.scan_i,'Value',1)892 % scan_i_Callback([],[], handles);893 % else894 % set(handles.scan_j,'Value',1)895 % scan_j_Callback([],[], handles);896 % end897 % set(handles.scan_j,'Visible',state_j)898 % set(handles.j1,'Visible',state_j)899 % set(handles.j2,'Visible',state_j)900 % set(handles.last_j,'Visible',state_j);901 % set(handles.frame_j,'Visible',state_j);902 % set(handles.j_text,'Visible',state_j);903 % if ~isempty(i2_series)||~isempty(j2_series)904 % set(handles.CheckFixPair,'Visible','on')905 % elseif index==1906 % set(handles.CheckFixPair,'Visible','off')907 % end908 %909 %910 % mode_Callback(hObject, eventdata, handles)911 %912 % set(handles.REFRESH,'BackgroundColor',[0.7 0.7 0.7])913 % InputTable=get(handles.InputTable,'Data');914 % check_lines=get(handles.REFRESH,'UserData');915 %916 % %% check the indices and FileTypes for each series (limited to the new ones to save time)917 % for ind_list=1:length(check_lines)918 % if check_lines(ind_list)919 % InputLine=InputTable(ind_list,:);920 % detect_idem=strcmp('"',InputLine);% look for '" (repeat of previous data)921 % detect_idem=detect_idem(detect_idem>0);922 % if ~isempty (detect_idem)923 % InputLine(detect_idem)=InputTable(ind_list-1,detect_idem);924 % set(handles.InputTable,'Data',InputTable)925 % end926 % fileinput=fullfile_uvmat(InputLine{1},InputLine{2},InputLine{3},InputLine{5},InputLine{4},1,2,1,2);927 % %fileinput=name_generator(fullfile(InputLine{1},InputLine{3}),1,1,InputLine{5},InputLine{4},1,2,2,InputLine{2})928 % %update file series defined by the selected line929 % [InputTable{ind_list,3},InputTable{(ind_list),4},errormsg]=update_indices(handles,fileinput,ind_list);930 % if ~isempty(errormsg)931 % msgbox_uvmat('ERROR',errormsg)932 % return933 % end934 % end935 % end936 % set(handles.InputTable,'Data',InputTable)937 % SeriesData=get(handles.series,'UserData');938 %939 % state_j='off';940 % state_Pairs='off';941 % state_InputFields='off';942 % val=get(handles.ListView,'Value');943 % ListViewString={''};944 % if ~isempty(SeriesData)945 % % ListViewString={};946 % for iview=1:size(InputTable,1)947 % if ~isempty(SeriesData.j1_series{iview})948 % state_j='on';949 % end950 % if ~isempty(SeriesData.i2_series{iview})||~isempty(SeriesData.j2_series{iview})951 % state_Pairs='on';952 % ListViewString{iview}=num2str(iview);953 % if check_lines(iview)954 % val=iview;%select the last pair if it is a new entry955 % end956 % end957 % if strcmp(SeriesData.FileType{iview},'civx')||strcmp(SeriesData.FileType{iview},'civdata')958 % state_InputFields='on';959 % end960 % end961 % end962 % set(handles.ListView,'Value',val)963 % set(handles.ListView,'String',ListViewString)964 % if strcmp(state_Pairs,'on')965 % ListView_Callback(hObject,eventdata,handles)966 % end967 % set(handles.PairString,'Visible',state_Pairs)968 % enable_j(handles,state_j)969 893 970 894 %------------------------------------------------------------------------ … … 1059 983 % end 1060 984 for iview=1:numel(SeriesData.i1_series) 1061 index_min(iview)=min(find(SeriesData.i1_series{iview}(1,2:end,2:end)>0)); 1062 index_max(iview)=max(find(SeriesData.i1_series{iview}(1,2:end,2:end)>0)); 985 pair_max{iview}=squeeze(max(SeriesData.i1_series{iview},[],1)); %max on pair index 986 if (strcmp(get(handles.num_first_j,'Visible'),'off')&& size(pair_max{iview},2)~=1) 987 pair_max{iview}=squeeze(max(pair_max{iview},[],1)); % consider only the i index 988 end 989 pair_max{iview}=reshape(pair_max{iview},1,[]); 990 index_min(iview)=find(pair_max{iview}>0, 1 ); 991 index_max(iview)=find(pair_max{iview}>0, 1, 'last' ); 1063 992 end 1064 993 [index_min,iview_min]=min(index_min); 1065 994 [index_max,iview_max]=min(index_max); 1066 index_first=(ref_i(1)-1)*(size(SeriesData.i1_series{iview_min},2)-1)+ref_j(1); 1067 index_last=(ref_i(2)-1)*(size(SeriesData.i1_series{iview_max},2)-1)+ref_j(2); 995 if size(SeriesData.i1_series{iview_min},2)==1% movie 996 index_first=ref_i(1); 997 index_last=ref_i(2); 998 else 999 %index_first=(ref_i(1)-1)*(size(SeriesData.i1_series{iview_min},2)-1)+ref_j(1); 1000 %index_last=(ref_i(2)-1)*(size(SeriesData.i1_series{iview_max},2)-1)+ref_j(2); 1001 index_first=(ref_i(1))*(size(SeriesData.i1_series{iview_min},2))+ref_j(1)+1; 1002 index_last=(ref_i(2))*(size(SeriesData.i1_series{iview_max},2))+ref_j(2)+1; 1003 end 1068 1004 range=index_max-index_min+1; 1069 1005 coeff_min=(index_first-index_min)/range; … … 1334 1270 function enable_j(handles,state) 1335 1271 set(handles.j_txt,'Visible',state) 1336 % set(handles.num_MinIndex_j,'Visible',state)1337 1272 set(handles.num_first_j,'Visible',state) 1338 1273 set(handles.num_last_j,'Visible',state) 1339 1274 set(handles.num_incr_j,'Visible',state) 1340 % set(handles.num_MaxIndex_j,'Visible',state)1341 1275 set(handles.num_ref_j,'Visible',state) 1342 1276 set(handles.ref_j_text,'Visible',state) 1277 % if strcmp(state,'off') 1278 % set(handles.MinIndex,'ColumnName',{'imax'}) 1279 % set(handles.MinIndex,'ColumnEditable',logical(0)) 1280 % else 1281 % set(handles.MinIndex,'ColumnName',{'imax','jmax'}) 1282 % end 1343 1283 1344 1284 … … 2067 2007 function RunMode_Callback(hObject, eventdata, handles) 2068 2008 2069 2070 % --- Executes on selection change in popupmenu14. 2071 function popupmenu14_Callback(hObject, eventdata, handles) 2072 % hObject handle to popupmenu14 (see GCBO) 2073 % eventdata reserved - to be defined in a future version of MATLAB 2074 % handles structure with handles and user data (see GUIDATA) 2075 2076 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu14 contents as cell array 2077 % contents{get(hObject,'Value')} returns selected item from popupmenu14 2078 2079 2080 % --- Executes during object creation, after setting all properties. 2081 function popupmenu14_CreateFcn(hObject, eventdata, handles) 2082 % hObject handle to popupmenu14 (see GCBO) 2083 % eventdata reserved - to be defined in a future version of MATLAB 2084 % handles empty - handles not created until after all CreateFcns called 2085 2086 % Hint: popupmenu controls usually have a white background on Windows. 2087 % See ISPC and COMPUTER. 2088 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2089 set(hObject,'BackgroundColor','white'); 2090 end 2009 % --- Executes on selection change in Coord_x. 2010 function Coord_x_Callback(hObject, eventdata, handles) 2011 2012 2013 % --- Executes on selection change in Coord_y. 2014 function Coord_y_Callback(hObject, eventdata, handles) 2015 2016 2017 2018 % --- Executes when series is resized. 2019 function series_ResizeFcn(hObject, eventdata, handles) 2020 %% input table 2021 set(handles.InputTable,'Unit','pixel') 2022 Pos=get(handles.InputTable,'Position'); 2023 set(handles.InputTable,'Unit','normalized') 2024 ColumnWidth=round([0.5 0.14 0.14 0.14 0.08]*(Pos(3)-52)); 2025 ColumnWidth=num2cell(ColumnWidth); 2026 set(handles.InputTable,'ColumnWidth',ColumnWidth) 2027 2028 %% MinIndex and MaxIndex 2029 set(handles.MinIndex,'Unit','pixel') 2030 Pos=get(handles.MinIndex,'Position'); 2031 set(handles.MinIndex,'Unit','normalized') 2032 ColumnWidth=get(handles.MinIndex,'ColumnWidth'); 2033 if numel(ColumnWidth)==2 2034 ColumnWidth=num2cell(floor([0.5 0.5]*(Pos(3)-20))); 2035 else 2036 ColumnWidth={Pos(3)-5}; 2037 end 2038 set(handles.MinIndex,'ColumnWidth',ColumnWidth) 2039 set(handles.MaxIndex,'ColumnWidth',ColumnWidth) 2040 2041 %% TimeTable 2042 set(handles.TimeTable,'Unit','pixel') 2043 Pos=get(handles.TimeTable,'Position'); 2044 set(handles.TimeTable,'Unit','normalized') 2045 ColumnWidth=get(handles.TimeTable,'ColumnWidth'); 2046 ColumnWidth=num2cell(floor([0.25 0.25 0.25 0.25]*(Pos(3)-20))); 2047 set(handles.TimeTable,'ColumnWidth',ColumnWidth) 2048 2049 2050 %% PairString 2051 set(handles.PairString,'Unit','pixel') 2052 Pos=get(handles.PairString,'Position'); 2053 set(handles.PairString,'Unit','normalized') 2054 set(handles.PairString,'ColumnWidth',{Pos(3)-5}) -
trunk/src/series/aver_stat.m
r494 r526 182 182 183 183 %% MAIN LOOP ON SLICES 184 %%%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%185 184 for i_slice=1:NbSlice 186 185 index_slice=i_slice:NbSlice:nbfield;% select file indices of the slice … … 196 195 stopstate='queue'; 197 196 end 198 197 if isequal(stopstate,'queue')% enable STOP command 198 199 199 %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%% 200 200 for iview=1:nbview … … 209 209 end 210 210 end 211 Field=[]; % initiate the current input field structure 211 else 212 errormsg='stop'; 213 end 212 214 %%%%%%%%%%%%%%%% end loop on views (input lines) %%%%%%%%%%%%%%%% 213 215 %%%%%%%%%%%% END STANDARD PART %%%%%%%%%%%% 214 216 % EDIT FROM HERE 215 217 216 218 if isempty(errormsg) 217 % coordinate transform (or other user defined transform) 219 Field=Data{1}; % default input field structure 220 %% coordinate transform (or other user defined transform) 218 221 if ~isempty(transform_fct) 219 if nbview==2 220 [Data{1},Data{2}]=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2}); 221 if isempty(Data{2}) 222 Data(2)=[]; 223 end 224 else 225 Data{1}=transform_fct(Data{1},XmlData{1}); 222 switch nargin(transform_fct) 223 case 4 224 if length(Data)==2 225 Field=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2}); 226 else 227 Field=transform_fct(Data{1},XmlData{1}); 228 end 229 case 3 230 if length(Data)==2 231 Field=transform_fct(Data{1},XmlData{1},Data{2}); 232 else 233 Field=transform_fct(Data{1},XmlData{1}); 234 end 235 case 2 236 Field=transform_fct(Data{1},XmlData{1}); 237 case 1 238 Field=transform_fct(Data{1}); 226 239 end 227 240 end 228 241 229 %% check whether tps is needed, then calculate tps coefficients if needed 230 check_tps=0; 231 if ischar(Param.InputFields.FieldName) 232 Param.InputFields.FieldName={Param.InputFields.FieldName}; 233 end 234 for ilist=1:numel(Param.InputFields.FieldName) 235 switch Param.InputFields.FieldName{ilist} 236 case {'vort','div','strain'} 237 check_tps=1; 238 end 239 end 240 if strcmp(Param.ProjObject.ProjMode,'filter') 241 check_tps=1; 242 end 243 if check_tps 244 SubDomain=1500; %default, estimated nbre of vectors in a subdomain used for tps 245 if isfield(Data{iview},'SubDomain') 246 SubDomain=Data{iview}.SubDomain;% 247 end 248 [Data{iview}.SubRange,Data{iview}.NbSites,Data{iview}.Coord_tps,Data{iview}.U_tps,Data{iview}.V_tps,tild,U_smooth,V_smooth,W_smooth,FF] =... 249 filter_tps([Data{iview}.X(Data{iview}.FF==0) Data{iview}.Y(Data{iview}.FF==0)],Data{iview}.U(Data{iview}.FF==0),Data{iview}.V(Data{iview}.FF==0),[],SubDomain,0); 250 nbvar=numel(Data{iview}.ListVarName); 251 Data{iview}.ListVarName=[Data{iview}.ListVarName {'SubRange','NbSites','Coord_tps','U_tps','V_tps'}]; 252 Data{iview}.VarDimName=[Data{iview}.VarDimName {{'nb_coord','nb_bounds','nb_subdomain'},{'nb_subdomain'},... 253 {'nb_tps','nb_coord','nb_subdomain'},{'nb_tps','nb_subdomain'},{'nb_tps','nb_subdomain'}}]; 254 Data{iview}.VarAttribute{nbvar+3}.Role='coord_tps'; 255 Data{iview}.VarAttribute{nbvar+4}.Role='vector_x'; 256 Data{iview}.VarAttribute{nbvar+5}.Role='vector_y'; 257 if isfield(Data{iview},'ListDimName')%cleaning 258 Data{iview}=rmfield(Data{iview},'ListDimName'); 259 end 260 if isfield(Data{iview},'DimValue')%cleaning 261 Data{iview}=rmfield(Data{iview},'DimValue'); 262 end 263 end 264 265 % field calculation (vort, div...) 266 if strcmp(FileType{1},'civx')||strcmp(FileType{1},'civdata') 267 if isfield(Data{1},'Coord_tps') 268 Data{1}.FieldList=Param.InputFields.FieldName; 269 else 270 Data{1}=calc_field(Param.InputFields.FieldName,Data{1});%calculate field (vort..) 271 end 272 end 273 274 % field substration (for two input file series) 275 if length(Data)==2 276 if strcmp(FileType{2},'civx')||strcmp(FileType{2},'civdata') 277 if isfield(Data{2},'Coord_tps') 278 Data{2}.FieldList=Param.InputFields.FieldName; 279 else 280 Data{2}=calc_field(Param.InputFields.FieldName,Data{2});%calculate field (vort..) 281 end 282 end 283 [Field,errormsg]=sub_field(Data{1},Data{2}); %substract the two fields 284 if ~isempty(errormsg) 285 msgbox_uvmat('ERROR',['error in aver_stat/sub_field:' errormsg]) 286 return 287 end 288 else 289 Field=Data{1}; 290 end 291 242 %% calculate tps coefficients if needed 243 if isfield(Param.ProjObject,'ProjMode')&& strcmp(Param.ProjObject.ProjMode,'filter') 244 Field=calc_tps(Field,check_proj_tps); 245 end 246 292 247 %field projection on an object 293 248 if Param.CheckObject … … 356 311 end 357 312 358 %writ ing the result file313 %writting the result file 359 314 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,i1_series{1}(1),i1_series{1}(end),i_slice,[]); 360 315 if CheckImage{1} %case of images … … 381 336 %% open the result file with uvmat (in RUN mode) 382 337 if checkrun 383 hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI384 delete(hget_field)338 % hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI 339 % delete(hget_field) 385 340 uvmat(OutputFile)% open the last result file with uvmat 386 341 end -
trunk/src/series/time_series.m
r524 r526 63 63 end 64 64 65 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT)%%%%%%%%%%%%65 %%%%%%%%%%%% STANDARD PART %%%%%%%%%%%% 66 66 %% select different modes, RUN, parameter input, BATCH 67 67 % BATCH case: read the xml file for batch case … … 87 87 NomType=Param.InputTable(:,4); 88 88 FileExt=Param.InputTable(:,5); 89 90 % get the set of input file names (cell array filecell), and the lists of91 % input file or frame indices i1_series,i2_series,j1_series,j2_series92 89 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); 93 % filecell{iview,fileindex}: cell array representing the list of file names 90 %%%%%%%%%%%% 91 % The cell array filecell is the list of input file names, while 92 % filecell{iview,fileindex}: 94 93 % iview: line in the table corresponding to a given file series 95 94 % fileindex: file index within the file series, 96 95 % 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 97 96 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 98 % set of frame indices used for movie or multimage input 99 % numbers of slices and file indices 100 97 %%%%%%%%%%%% 101 98 NbSlice=1;%default 102 99 if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice) … … 138 135 139 136 %% coordinate transform or other user defined transform 140 transform_fct= '';%default137 transform_fct=[];%default 141 138 if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName) 142 139 addpath(Param.FieldTransform.TransformPath) … … 148 145 % EDIT FROM HERE 149 146 150 %% check the validity of input file types147 %% check the validity of ctinput file types 151 148 if CheckImage{1} 152 149 FileExtOut='.png'; % write result as .png images for image inputs … … 162 159 end 163 160 NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series 164 % if NbSlice~=nbfield_j165 % answer=_uvmat('INPUT_Y-N',['will not average slice by slice: for so cancel and set NbSlice= ' num2str(nbfield_j)]);166 % if ~strcmp(answer,'Yes')167 % return168 % end169 % end170 161 if checkrun==1 171 162 return % stop here for input checks … … 189 180 end 190 181 end 191 %%% TO UPDATE192 if isequal(InputFields{1},'get_field...')193 hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI194 if numel(hget_field)>1195 delete(hget_field(2:end)) % delete multiple occurerence of the GUI get_fioeld196 elseif isempty(hget_field)197 filename=filecell{1,1};198 % filename=name_generator(filebase{1},i1_series{1}(1),j1_series{1}(1),FileExt{1},NomType{1},1,i2_series{1}(1),num_j2{1}(1),SubDir{1});199 idetect(iview)=exist(filename,'file');200 hget_field=get_field(filename);201 return202 end203 SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI204 if isempty(SubField)205 delete(hget_field)206 filename=filecell{1,1};207 %filename=name_generator(filebase{1},i1_series{1}(1),j1_series{1}(1),FileExt{1},NomType{1},1,i2_series{1}(1),j2_series{1}(1),SubDir{1});208 hget_field=get_field(filename);209 SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI210 end211 end212 %%%%%%%213 182 214 183 %% Initiate output fields … … 255 224 stopstate='queue'; 256 225 end 257 258 %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%%259 226 if isequal(stopstate,'queue')% enable STOP command 260 227 Data=cell(1,nbview);%initiate the set Data 261 228 nbtime=0; 262 229 dt=[]; 263 % loop on views (in case of multiple input series)230 %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%% 264 231 for iview=1:nbview 265 232 % reading input file(s) 266 [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview}, Param.InputFields,frame_index{iview}(index));233 [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},InputFields{iview},frame_index{iview}(index)); 267 234 if ~isempty(errormsg) 268 235 errormsg=['time_series/read_field/' errormsg]; … … 280 247 end 281 248 249 Field=Data{1}; % default input field structure 282 250 % coordinate transform (or other user defined transform) 283 251 if ~isempty(transform_fct) 284 if nbview==2 285 [Data{1},Data{2}]=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2}); 286 if isempty(Data{2}) 287 Data(2)=[]; 288 end 289 else 290 Data{1}=transform_fct(Data{1},XmlData{1}); 291 end 292 end 293 294 % field substration (for two input file series) 295 if length(Data)==2 296 [Field,errormsg]=sub_field(Data{1},Data{2}); %substract the two fields 297 else 298 Field=Data{1}; 299 end 252 switch nargin(transform_fct) 253 case 4 254 if length(Data)==2 255 Field=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2}); 256 else 257 Field=transform_fct(Data{1},XmlData{1}); 258 end 259 case 3 260 if length(Data)==2 261 Field=transform_fct(Data{1},XmlData{1},Data{2}); 262 else 263 Field=transform_fct(Data{1},XmlData{1}); 264 end 265 case 2 266 Field=transform_fct(Data{1},XmlData{1}); 267 case 1 268 Field=transform_fct(Data{1}); 269 end 270 end 271 272 % calculate tps coefficients if needed 273 if isfield(Param.ProjObject,'ProjMode')&& strcmp(Param.ProjObject.ProjMode,'filter') 274 Field=calc_tps(Field,check_proj_tps); 275 end 276 277 %field projection on an object 300 278 if Param.CheckObject 301 279 [Field,errormsg]=proj_field(Field,Param.ProjObject); 280 if ~isempty(errormsg) 281 msgbox_uvmat('ERROR',['error in aver_stat/proj_field:' errormsg]) 282 return 283 end 302 284 end 303 285 nbfile=nbfile+1; -
trunk/src/struct2nc.m
r404 r526 98 98 attr_names=fields(VarAttribute{ivar}); 99 99 for iattr=1:length(attr_names) 100 eval(['attr_val=VarAttribute{ivar}.' attr_names{iattr} ';']);101 if ~isempty(attr_names{iattr})&& ~isempty(attr_val) 100 attr_val=VarAttribute{ivar}.(attr_names{iattr}); 101 if ~isempty(attr_names{iattr})&& ~isempty(attr_val)&&~iscell(attr_val) 102 102 netcdf.putAtt(nc,varid(ivar),attr_names{iattr},attr_val); 103 103 end -
trunk/src/uvmat.m
r525 r526 9 9 %INPUT: 10 10 % input: input file name (if character chain), or input image matrix to 11 % visualize, or Matlab structure representing netcdf field s (with fields11 % visualize, or Matlab structure representing netcdf fieldname (with fieldname 12 12 % ListVarName....) 13 13 % … … 42 42 % .MovieObject: current movie object 43 43 % .TimeUnit: unit for time 44 % .XmlData: cell array of 1 or 2 structures representing the xml files associated with the input field s(containing timing and geometry calibration)44 % .XmlData: cell array of 1 or 2 structures representing the xml files associated with the input fieldname (containing timing and geometry calibration) 45 45 % .Field: cell array of 1 or 2 structures representing the current input field(s) 46 46 % .PlotAxes: field structure representing the current field plotted on the main axes (used for mouse operations) … … 54 54 % 2) These functions call 'uvmat/display_file_name.m' which detects the file series, and fills the file index boxes 55 55 % 3) Then 'uvmat/update_rootinfo.m' Updates information about a new field series (indices to scan, timing, calibration from an xml file) 56 % 4) Then field sare opened and visualised by the main sub-function 'uvmat/refresh_field.m'56 % 4) Then fieldname are opened and visualised by the main sub-function 'uvmat/refresh_field.m' 57 57 % The function first reads the name of the input file(s) (one or two) from the edit boxes of the GUI 58 58 % It then reads the input file(s) with the function read_field.m and perform the following list of operations: … … 66 66 % Field{1} Field{2} 67 67 % | | 68 % --->transform fct<--- transform (e.g. phys.m) and combine input field s68 % --->transform fct<--- transform (e.g. phys.m) and combine input fieldname 69 69 % | 70 70 % (calc_tps.m) calculate tps coefficients (for filter projection or spatial derivatives). … … 77 77 % UvData.PlotAxes ViewData.PlotAxes (on view_field) 78 78 % | | 79 % plot_field.m (uvmat) plot_field.m (view_field) plot the projected field s79 % plot_field.m (uvmat) plot_field.m (view_field) plot the projected fieldname 80 80 % 81 81 % … … 200 200 % set(handles.ListObject_1,'Value',1)% default: empty projection objectproj_field 201 201 % set(handles.ListObject_1,'String',{''}) 202 set(handles.Field s,'Value',1)203 set(handles.Field s,'string',{''})202 set(handles.FieldName,'Value',1) 203 set(handles.FieldName,'string',{''}) 204 204 UvData.Object={[]}; 205 205 … … 294 294 testinputfield=1; 295 295 end 296 297 %% plot input field if exists298 % if testinputfield299 % %delete drawn objects300 % hother=findobj(handles.PlotAxes,'Tag','proj_object');%find all the proj objects301 % for iobj=1:length(hother)302 % delete_object(hother(iobj))303 % end304 % if isempty(inputfile)305 % errormsg=refresh_field(handles,[],[],[],[],[],[],{Field});306 % set(handles.MenuTools,'Enable','on')307 % set(handles.OBJECT_txt,'Visible','on')308 % set(handles.edit_object,'Visible','on')309 % % set(handles.ListObject_1,'Visible','on')310 % set(handles.frame_object,'Visible','on')311 % if ~isempty(errormsg)312 % msgbox_uvmat('ERROR',errormsg)313 % end314 % end315 % end316 296 317 297 set_vec_col_bar(handles) %update the display of color code for vectors … … 530 510 function SubDir_Callback(hObject, eventdata, handles) 531 511 %------------------------------------------------------------------------ 532 %refresh the menu of input field s512 %refresh the menu of input fieldname 533 513 Fields_Callback(hObject, eventdata, handles); 534 514 % refresh the current field view … … 779 759 if index==1 780 760 handles_RootPath=handles.RootPath; 781 handles_Fields=handles.Field s;761 handles_Fields=handles.FieldName; 782 762 elseif index==2 783 763 handles_RootPath=handles.RootPath_1; 784 handles_Fields=handles.Field s_1;764 handles_Fields=handles.FieldName_1; 785 765 end 786 766 787 767 set(handles_RootPath,'BackgroundColor',[1 1 0]) 788 768 drawnow 789 set(handles.Field s,'UserData',[])% reinialize data from uvmat opening769 set(handles.FieldName,'UserData',[])% reinialize data from uvmat opening 790 770 UvData=get(handles.uvmat,'UserData');%huvmat=handles of the uvmat interface 791 771 UvData.NewSeries=1; %flag for run0: begin a new series … … 990 970 end 991 971 992 %% set default options in menu 'Field s'972 %% set default options in menu 'FieldName' 993 973 switch FileType 994 974 case {'civx','civdata'} … … 1426 1406 %------------------------------------------------------------------------ 1427 1407 % --- Executes on button press in runplus: make one step forward and call 1428 % --- run0. The step forward is along the field sseries 1 or 2 depending on1408 % --- run0. The step forward is along the fieldname series 1 or 2 depending on 1429 1409 % --- the scan_i and scan_j check box (exclusive each other) 1430 1410 function runplus_Callback(hObject, eventdata, handles) … … 1446 1426 %------------------------------------------------------------------------ 1447 1427 % --- Executes on button press in runmin: make one step backward and call 1448 % --- run0. The step backward is along the field sseries 1 or 2 depending on1428 % --- run0. The step backward is along the fieldname series 1 or 2 depending on 1449 1429 % --- the scan_i and scan_j check box (exclusive each other) 1450 1430 function runmin_Callback(hObject, eventdata, handles) … … 1783 1763 set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow 1784 1764 drawnow 1785 list_fields=get(handles.Field s,'String');% list menu fields1786 index_fields=get(handles.Field s,'Value');% selected string index1765 list_fields=get(handles.FieldName,'String');% list menu fields 1766 index_fields=get(handles.FieldName,'Value');% selected string index 1787 1767 FieldName=list_fields{index_fields}; % selected field 1788 1768 UvData=get(handles.uvmat,'UserData'); … … 1792 1772 NomType=get(handles.NomType,'String'); 1793 1773 else 1794 list_fields=get(handles.Field s_1,'String');% list menu fields1795 index_fields=get(handles.Field s_1,'Value');% selected string index1774 list_fields=get(handles.FieldName_1,'String');% list menu fields 1775 index_fields=get(handles.FieldName_1,'Value');% selected string index 1796 1776 FieldName=list_fields{index_fields}; % selected field 1797 1777 if isequal(FieldName,'image') … … 2026 2006 ParamIn.ColorVar='';%default variable name for vector color 2027 2007 frame_index=1;%default 2028 % if ~isempty(FileName)2029 2008 FieldName='';%default 2030 2009 VelType='';%default 2031 % FileType=UvData.FileType{1};2032 2010 switch UvData.FileType{1} 2033 2011 case {'civx','civdata','netcdf'}; 2034 list_fields=get(handles.Field s,'String');% list menu fields2035 FieldName= list_fields{get(handles.Field s,'Value')}; % selected field2012 list_fields=get(handles.FieldName,'String');% list menu fields 2013 FieldName= list_fields{get(handles.FieldName,'Value')}; % selected field 2036 2014 if ~strcmp(FieldName,'get_field...') 2037 2015 if get(handles.FixVelType,'Value') … … 2075 2053 ParamIn.VelType=VelType; 2076 2054 XNameMenu=get(handles.Coord_x,'String'); 2077 ParamIn.Coord Name=XNameMenu{get(handles.Coord_x,'Value')};2055 ParamIn.Coord_x=XNameMenu(get(handles.Coord_x,'Value')); 2078 2056 YNameMenu=get(handles.Coord_y,'String'); 2079 ParamIn.Coord Name={ParamIn.CoordName, YNameMenu{get(handles.Coord_y,'Value')}};2057 ParamIn.Coord_y=YNameMenu(get(handles.Coord_y,'Value')); 2080 2058 end 2081 2059 check_tps = 0; … … 2115 2093 switch UvData.FileType{2} 2116 2094 case {'civx','civdata','netcdf'}; 2117 list_fields=get(handles.Field s_1,'String');% list menu fields2095 list_fields=get(handles.FieldName_1,'String');% list menu fields 2118 2096 if ischar(list_fields),list_fields={list_fields};end 2119 FieldName_1= list_fields{get(handles.Field s_1,'Value')}; % selected field2097 FieldName_1= list_fields{get(handles.FieldName_1,'Value')}; % selected field 2120 2098 if ~strcmp(FieldName,'get_field...') 2121 2099 if get(handles.FixVelType,'Value') … … 2220 2198 set(handles.VelType,'Visible','off') 2221 2199 end 2222 % display the Field smenu from the input file and pick the selected one:2200 % display the FieldName menu from the input file and pick the selected one: 2223 2201 % if isstruct(ParamOut) 2224 2202 % field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList); 2225 % set(handles.Field s,'String',ParamOut.FieldList); %update the field menu2226 % set(handles.Field s,'Value',find(field_index,1))2203 % set(handles.FieldName,'String',ParamOut.FieldList); %update the field menu 2204 % set(handles.FieldName,'Value',find(field_index,1)) 2227 2205 % end 2228 2206 … … 2230 2208 test_veltype_1=0; 2231 2209 if isempty(FileName_1) 2232 % set(handles.Field s_1,'Value',1); %update the field menu2210 % set(handles.FieldName_1,'Value',1); %update the field menu 2233 2211 % if isstruct(ParamOut) 2234 % set(handles.Field s_1,'String',[{''};ParamOut.FieldList]); %update the field menu2212 % set(handles.FieldName_1,'String',[{''};ParamOut.FieldList]); %update the field menu 2235 2213 % end 2236 2214 elseif ~test_keepdata_1 … … 2247 2225 % update the second field menu: the same quantity 2248 2226 if isstruct(ParamOut_1) 2249 set(handles.Field s_1,'String',[{''};ParamOut_1.FieldList]); %update the field menu2250 % display the Field smenu from the input file and pick the selected one:2227 set(handles.FieldName_1,'String',[{''};ParamOut_1.FieldList]); %update the field menu 2228 % display the FieldName menu from the input file and pick the selected one: 2251 2229 field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList); 2252 set(handles.Field s_1,'Value',find(field_index,1)+1)2230 set(handles.FieldName_1,'Value',find(field_index,1)+1) 2253 2231 end 2254 2232 … … 2261 2239 2262 2240 % field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList); 2263 % set(handles.Field s,'String',ParamOut.FieldList); %update the field menu2264 % set(handles.Field s,'Value',find(field_index,1))2241 % set(handles.FieldName,'String',ParamOut.FieldList); %update the field menu 2242 % set(handles.FieldName,'Value',find(field_index,1)) 2265 2243 2266 2244 %% introduce w as background image by default for a new series (only for nbdim=2) … … 2277 2255 set(handles.FileIndex_1,'String',indices) 2278 2256 set(handles.FileExt_1,'String','"'); 2279 set(handles.Field s_1,'Visible','on');2280 set(handles.Field s_1,'Visible','on');2257 set(handles.FieldName_1,'Visible','on'); 2258 set(handles.FieldName_1,'Visible','on'); 2281 2259 set(handles.RootPath_1,'Visible','on') 2282 2260 set(handles.RootFile_1,'Visible','on') … … 2284 2262 set(handles.FileIndex_1,'Visible','on'); 2285 2263 set(handles.FileExt_1,'Visible','on'); 2286 set(handles.Field s_1,'Visible','on');2264 set(handles.FieldName_1,'Visible','on'); 2287 2265 Field{1}.AName='w'; 2288 2266 end … … 2364 2342 2365 2343 2366 %% store the current open names, field sand vel types in uvmat interface2344 %% store the current open names, fieldname and vel types in uvmat interface 2367 2345 UvData.FileName_1=FileName_1; 2368 2346 UvData.ParamOut_1=ParamOut_1; … … 2589 2567 write_plot_param(handles,PlotParamOut) %update the auto plot parameters 2590 2568 2591 %% 2D or 3D field sare generally projected2569 %% 2D or 3D fieldname are generally projected 2592 2570 else 2593 2571 set(handles.Objects,'Visible','on') … … 3010 2988 set(handles.FileIndex_1,'Visible','off'); 3011 2989 set(handles.FileExt_1,'Visible','off'); 3012 set(handles.Field s_1,'Value',1);%set to blank state2990 set(handles.FieldName_1,'Value',1);%set to blank state 3013 2991 set(handles.VelType_1,'Value',1);%set to blank state 3014 2992 set(handles.num_Opacity,'String','')% desactivate opacity setting … … 3076 3054 end 3077 3055 %------------------------------------------------------------------------ 3078 % --- Executes on menu selection Field s3079 function Field s_Callback(hObject, eventdata, handles)3080 %------------------------------------------------------------------------ 3081 list_fields=get(handles.Field s,'String');% list menu fields3082 index_fields=get(handles.Field s,'Value');% selected string index3056 % --- Executes on menu selection FieldName 3057 function FieldName_Callback(hObject, eventdata, handles) 3058 %------------------------------------------------------------------------ 3059 list_fields=get(handles.FieldName,'String');% list menu fields 3060 index_fields=get(handles.FieldName,'Value');% selected string index 3083 3061 field= list_fields{index_fields(1)}; % selected string 3084 3062 if isequal(field,'get_field...') … … 3092 3070 delete(hget_field) 3093 3071 end 3094 hget_field=get_field(FileName); 3095 % set(hget_field,'Name','get_field') 3096 % hhget_field=guidata(hget_field); 3097 % set(hhget_field.list_fig,'Value',1) 3098 % set(hhget_field.list_fig,'String',{'uvmat'}) 3099 % set(handles.transform_fct,'Value',1)% no transform by default 3100 % set(handles.path_transform,'String','') 3072 get_field(FileName); 3101 3073 return %no further action 3102 3074 end … … 3151 3123 3152 3124 %common to Fields_1_Callback 3153 list_fields_1=get(handles.Field s_1,'String');% list menu fields3125 list_fields_1=get(handles.FieldName_1,'String');% list menu fields 3154 3126 field_1=''; 3155 3127 if ~isempty(list_fields_1) 3156 field_1= list_fields_1{get(handles.Field s_1,'Value')}; % selected string3128 field_1= list_fields_1{get(handles.FieldName_1,'Value')}; % selected string 3157 3129 end 3158 3130 if isequal(field,'image')||isequal(field_1,'image') … … 3172 3144 3173 3145 %--------------------------------------------------- 3174 % --- Executes on menu selection Field s3175 function Field s_1_Callback(hObject, eventdata, handles)3146 % --- Executes on menu selection FieldName 3147 function FieldName_1_Callback(hObject, eventdata, handles) 3176 3148 %------------------------------------------------- 3177 3149 %% read input data … … 3185 3157 end 3186 3158 UvData.FileName_1='';% desactivate the use of a constant second file 3187 list_fields=get(handles.Field s,'String');% list menu fields3188 field= list_fields{get(handles.Field s,'Value')}; % selected string3189 list_fields=get(handles.Field s_1,'String');% list menu fields3190 field_1= list_fields{get(handles.Field s_1,'Value')}; % selected string for the second field3159 list_fields=get(handles.FieldName,'String');% list menu fields 3160 field= list_fields{get(handles.FieldName,'Value')}; % selected string 3161 list_fields=get(handles.FieldName_1,'String');% list menu fields 3162 field_1= list_fields{get(handles.FieldName_1,'Value')}; % selected string for the second field 3191 3163 if isempty(field_1)%||(numel(UvData.FileType)>=2 && strcmp(UvData.FileType{2},'image')) 3192 3164 set(handles.SubField,'Value',0) … … 4837 4809 series; %first display of the GUI to fill waiting time 4838 4810 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 4839 param.FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 4811 Param.FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];%first input file name 4840 4812 if isequal(get(handles.SubField,'Value'),1) 4841 4813 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles); 4842 4814 FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; 4843 if ~isequal(FileName_1,param.FileName) 4844 param.FileName_1=FileName_1; 4845 end 4846 end 4847 param.NomType=get(handles.NomType,'String'); 4848 param.NomType_1=get(handles.NomType_1,'String'); 4849 param.CheckFixPair=get(handles.CheckFixPair,'Value'); 4850 huvmat=get(handles.MenuSeries,'parent'); 4851 UvData=get(huvmat,'UserData'); 4815 if ~isequal(FileName_1,Param.FileName) 4816 Param.FileName_1=FileName_1;%second input file name if relevant 4817 end 4818 end 4819 Param.NomType=get(handles.NomType,'String'); 4820 Param.NomType_1=get(handles.NomType_1,'String'); 4821 Param.CheckFixPair=get(handles.CheckFixPair,'Value'); 4822 UvData=get(handles.uvmat,'UserData'); 4852 4823 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'Time') 4853 param.Time=UvData.XmlData{1}.Time;4824 Param.Time=UvData.XmlData{1}.Time; 4854 4825 end 4855 4826 if isequal(get(handles.scan_i,'Value'),1) 4856 param.incr_i=str2num(get(handles.num_IndexIncrement,'String'));4827 Param.incr_i=str2num(get(handles.num_IndexIncrement,'String')); 4857 4828 elseif isequal(get(handles.scan_j,'Value'),1) 4858 param.incr_j=str2num(get(handles.num_IndexIncrement,'String')); 4859 end 4860 param.list_fields=get(handles.Fields,'String');% list menu fields 4861 FieldName=param.list_fields{get(handles.Fields,'Value')}; 4862 ind_image=find(strcmp('image',param.list_fields)); 4863 if ~isempty(ind_image) && numel(param.list_fields)>1 4864 param.list_fields(ind_image)=[]; %suppress 'image' option 4865 end 4866 param.index_fields=find(strcmp(FieldName,param.list_fields));% selected string index 4867 % if param.index_fields>1 4868 % param.index_fields=param.index_fields-1; 4869 % end 4870 param.list_fields_1=get(handles.Fields_1,'String');% list menu fields 4871 if ischar(param.list_fields_1),param.list_fields_1={param.list_fields_1};end 4872 FieldName_1=param.list_fields_1{get(handles.Fields_1,'Value')}; 4873 ind_image=find(strcmp('image',param.list_fields_1)); 4874 if ~isempty(ind_image) && numel(param.list_fields_1)>1 4875 param.list_fields_1(ind_image)=[]; %suppress 'image' option 4876 end 4877 param.index_fields_1=find(strcmp(FieldName_1,param.list_fields_1));% selected string index 4878 %param.index_fields=find(strcmp(FieldName,param.list_fields));% selected string index 4879 % param.index_fields_1=get(handles.Fields_1,'Value')-1;% selected string index 4880 % if param.index_fields_1>1 4881 % param.index_fields_1=param.index_fields_1-1; 4882 % end 4883 param.menu_coord_str=get(handles.transform_fct,'String'); 4884 param.menu_coord_val=get(handles.transform_fct,'Value'); 4885 series(param); %run the series interface 4829 Param.incr_j=str2num(get(handles.num_IndexIncrement,'String')); 4830 end 4831 4832 %% transfer fields and coordinate names 4833 Param.list_fields=get(handles.FieldName,'String');% list menu fields 4834 FieldName=Param.list_fields{get(handles.FieldName,'Value')}; 4835 ind_image=find(strcmp('image',Param.list_fields)); 4836 if ~isempty(ind_image) && numel(Param.list_fields)>1 4837 Param.list_fields(ind_image)=[]; %suppress 'image' option 4838 end 4839 Param.index_fields=find(strcmp(FieldName,Param.list_fields));% selected string index 4840 Param.list_fields_1=get(handles.FieldName_1,'String');% list menu fields 4841 if ischar(Param.list_fields_1),Param.list_fields_1={Param.list_fields_1};end 4842 FieldName_1=Param.list_fields_1{get(handles.FieldName_1,'Value')}; 4843 ind_image=find(strcmp('image',Param.list_fields_1)); 4844 if ~isempty(ind_image) && numel(Param.list_fields_1)>1 4845 Param.list_fields_1(ind_image)=[]; %suppress 'image' option 4846 end 4847 Param.index_fields_1=find(strcmp(FieldName_1,Param.list_fields_1));% selected string index 4848 Param.transform_str=get(handles.transform_fct,'String'); 4849 Param.transform_val=get(handles.transform_fct,'Value'); 4850 Param.Coord_x_str=get(handles.Coord_x,'String'); 4851 Param.Coord_x_val=get(handles.Coord_x,'Value'); 4852 Param.Coord_y_str=get(handles.Coord_y,'String'); 4853 Param.Coord_y_val=get(handles.Coord_y,'Value'); 4854 series(Param); %run the series interface 4886 4855 4887 4856 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.