Changeset 517


Ignore:
Timestamp:
Aug 17, 2012, 11:47:16 PM (12 years ago)
Author:
sommeria
Message:

various bugs corrected. get_field now used in a passive way from uvmat: variable names are transferred from get_field to uvmat.

Location:
trunk/src
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/calc_field.m

    r515 r517  
    2525% varname_generator.m: determines the field names to read in the netcdf
    2626% file, depending on the scalar
    27 
    28 function [DataOut,errormsg]=calc_field(FieldList,DataIn,Coord_interp)
     27function [FieldOptions,ColorList]=calc_field
     28%function [DataOut,errormsg]=calc_field(FieldList,DataIn,Coord_interp)
    2929
    3030%list of defined scalars to display in menus (in addition to 'ima_cor').
     
    4949    'w_normal';... %w velocity component normal to the plane
    5050    'error'}; %error associated to a vector (for stereo or patch)
    51 errormsg=[]; %default error message
    52 if ~exist('FieldList','var')
    53     DataOut=FieldOptions;% gives the list of possible field inputs in the absence of input
    54     return
    55 end
    56 
     51ColorList={'C';...%image correlation corresponding to a vel vector
     52    'norm(U,V)';...%norm of the velocity
     53    'U';... %u velocity component
     54    'V';... %v velocity component
     55    }
     56% errormsg=[]; %default error message
     57% if ~exist('FieldList','var')
     58%     DataOut=FieldOptions;% gives the list of possible field inputs in the absence of input
     59%     return
     60% end
     61return
    5762%% check input
    5863if ~exist('DataIn','var')
  • trunk/src/calc_field_interp.m

    r516 r517  
    11
    2 %'calc_field': defines fields (velocity, vort, div...) from civx data and calculate them
     2%'calc_field': defines fields (velocity, vort, div...) from civ data and calculate them
    33%---------------------------------------------------------------------
    44% [DataOut,VarAttribute,errormsg]=calc_field_interp(Coord_tps,NbSites,SubRange,FieldVar,Operation,Coord_interp)
     
    1515% Coord_interp: coordiantes of sites on which the fields need to be calculated
    1616
    17 function [VarVal,ListVarName,VarAttribute,errormsg]=calc_field_interp(Coord,FieldVar,Operation,XI,YI)
     17function [VarVal,ListVarName,VarAttribute,errormsg]=calc_field_interp(Coord,Data,Operation,XI,YI)
    1818
    1919VarVal=[];
     
    2121VarAttribute={};
    2222errormsg='';
    23 check_u=0;
    24 check_v=0;
    25 for ilist=1:length(Operation)
    26     switch Operation{ilist}
    27         case {'U'}
    28            check_u=1;
    29         case {'V'}
    30             check_v=1;
    31           case {'vec(U,V)','norm(U,V)'} 
    32              check_u=1;
    33              check_v=1;
     23InputVarList={};
     24if ischar(Operation),Operation={Operation};end
     25for ilist=1:numel(Operation)
     26    r=regexp(Operation{ilist},'(?<Operator>(^vec|^norm))\((?<UName>.+),(?<VName>.+)\)$','names');
     27    if isempty(r) % the operation is the variable
     28        if isempty(find(strcmp(Operation{ilist},InputVarList)));
     29            InputVarList=[InputVarList Operation{ilist}];
     30        end
     31        Operator{ilist}='';
     32    else
     33        UName{ilist}=r.UName;
     34        VName{ilist}=r.VName;
     35        if isempty(find(strcmp(r.UName,InputVarList)));
     36            InputVarList=[InputVarList UName{ilist}];
     37        end
     38        if isempty(find(strcmp(r.VName,InputVarList)));
     39            InputVarList=[InputVarList VName{ilist}];
     40        end
     41        Operator{ilist}=r.Operator;
    3442    end
    3543end
    36 if check_u
    37     F_u = TriScatteredInterp(Coord,FieldVar(:,1),'linear');
     44%create interpolator for linear interpolation
     45if exist('XI','var')
     46    for ilist=1:numel(InputVarList)
     47        F.(InputVarList{ilist})=TriScatteredInterp(Coord,Data.(InputVarList{ilist}),'linear');
     48    end
    3849end
    39 if check_v
    40     F_v = TriScatteredInterp(Coord,FieldVar(:,2),'linear');
    41 end
    42 for ilist=1:length(Operation)
     50for ilist=1:numel(Operation)
    4351    nbvar=numel(ListVarName);
    44     switch Operation{ilist}
    45         case 'vec(U,V)'
    46             VarVal{nbvar+1}=F_u(XI,YI);
    47             VarVal{nbvar+2}=F_v(XI,YI);
    48             ListVarName{nbvar+1}='U';
    49             ListVarName{nbvar+2}='V';
     52    switch Operator{ilist}
     53        case 'vec'
     54            if exist('XI','var')
     55                VarVal{nbvar+1}=F.(UName{ilist})(XI,YI);
     56                VarVal{nbvar+2}=F.(VName{ilist})(XI,YI);
     57            else
     58                VarVal{nbvar+1}=Data.(UName{ilist});
     59                VarVal{nbvar+2}=Data.(VName{ilist});
     60            end
     61            ListVarName{nbvar+1}=UName{ilist};
     62            ListVarName{nbvar+2}=VName{ilist};
    5063            VarAttribute{nbvar+1}.Role='vector_x';
    5164            VarAttribute{nbvar+2}.Role='vector_y';
    52         case 'U'
    53             VarVal{nbvar+1}=F_u(XI,YI);
    54             ListVarName{nbvar+1}='U';
     65            %         case 'U'
     66            %             VarVal{nbvar+1}=F_u(XI,YI);
     67            %             ListVarName{nbvar+1}='U';
     68            %             VarAttribute{nbvar+1}.Role='scalar';
     69            %         case 'V'
     70            %             VarVal{nbvar+1}=F_v(XI,YI);
     71            %             ListVarName{nbvar+1}='V';
     72            %             VarAttribute{nbvar+1}.Role='scalar';
     73        case 'norm'
     74            if exist('XI','var')
     75                U2=F.(UName{ilist})(XI,YI).*F.(UName{ilist})(XI,YI);
     76                V2=F.(VName{ilist})(XI,YI).*F.(VName{ilist})(XI,YI);
     77            else
     78                U2=Data.(UName{ilist}).*Data.(UName{ilist});
     79                V2=Data.(VName{ilist}).*Data.(VName{ilist});
     80            end
     81            VarVal{nbvar+1}=sqrt(U2+V2);
     82            ListVarName{nbvar+1}='norm';
    5583            VarAttribute{nbvar+1}.Role='scalar';
    56         case 'V'
    57             VarVal{nbvar+1}=F_v(XI,YI);
    58             ListVarName{nbvar+1}='V';
    59             VarAttribute{nbvar+1}.Role='scalar';
    60         case 'norm(U,V)'
    61             VarVal{nbvar+1}=sqrt(F_u(XI,YI).*F_u(XI,YI)+F_v(XI,YI).*F_v(XI,YI));
    62             ListVarName{nbvar+1}='norm(U,V)';
    63             VarAttribute{nbvar+1}.Role='scalar';
     84        otherwise
     85            if ~isempty(Operation{ilist})
     86                if exist('XI','var')
     87                    VarVal{nbvar+1}=F.(Operation{ilist})(XI,YI);
     88                else
     89                    VarVal{nbvar+1}= Data.(Operation{ilist});
     90                end
     91                ListVarName{nbvar+1}=Operation{ilist};
     92                VarAttribute{nbvar+1}.Role='scalar';
     93            end
    6494    end
    6595end
     96% put an error flag to indicate NaN data
     97if exist('XI','var')
    6698nbvar=numel(ListVarName);
    6799ListVarName{nbvar+1}='FF';
    68100VarVal{nbvar+1}=isnan(VarVal{nbvar});
    69101VarAttribute{nbvar+1}.Role='errorflag';
     102end
    70103
    71104% Attr_FF.Role='errorflag';
  • trunk/src/geometry_calib.m

    r507 r517  
    10001000%axes(hhuvmat.axes3)
    10011001set(0,'CurrentFigure',huvmat)
    1002 set(huvmat,'CurrentAxes',hhuvmat.axes3)
     1002set(huvmat,'CurrentAxes',hhuvmat.PlotAxes)
    10031003hh=findobj('Tag','calib_points');
    10041004if  ~isempty(ObjectData.Coord) && isempty(hh)
  • trunk/src/get_field.m

    r512 r517  
    6060%% prepare the list of RUN fcts and set their paths
    6161% functions included by default in 'get_field.m
    62 menu_str={'PLOT';'FFT';'filter_band'};
    63 nb_builtin=numel(menu_str);
    64 path_uvmat=fileparts(which('uvmat'));%path of the function 'uvmat'
    65 addpath(fullfile(path_uvmat,'get_field'))
    66 testexist=zeros(size(menu_str'));%default
    67 for ilist=1:length(menu_str)
    68     if exist(menu_str{ilist},'file')
    69         fct_handle{ilist,1}=str2func(menu_str{ilist});
    70         testexist(ilist)=1;
    71     else
    72         fct_handle{ilist,1}=[];
    73         testexist(ilist)=0;
    74     end
    75 end
    76 rmpath(fullfile(path_uvmat,'get_field'))
    77 dir_perso=prefdir;
     62% menu_str={'PLOT';'FFT';'filter_band'};
     63% nb_builtin=numel(menu_str);
     64% path_uvmat=fileparts(which('uvmat'));%path of the function 'uvmat'
     65% addpath(fullfile(path_uvmat,'get_field'))
     66% testexist=zeros(size(menu_str'));%default
     67% for ilist=1:length(menu_str)
     68%     if exist(menu_str{ilist},'file')
     69%         fct_handle{ilist,1}=str2func(menu_str{ilist});
     70%         testexist(ilist)=1;
     71%     else
     72%         fct_handle{ilist,1}=[];
     73%         testexist(ilist)=0;
     74%     end
     75% end
     76% rmpath(fullfile(path_uvmat,'get_field'))
     77% dir_perso=prefdir;
    7878
    7979% look for functions previously used (names and paths saved in the personal file uvmat_perso.mat):
    80 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    81 if exist(profil_perso,'file')
    82       h=load (profil_perso);
    83      if isfield(h,'get_field_fct') && iscell(h.get_field_fct)
    84          for ilist=1:length(h.get_field_fct)
    85             [path,file]=fileparts(h.get_field_fct{ilist});
    86             addpath(path)       
    87             if exist(file,'file')
    88                 h_func=str2func(file);
    89                 testexist=[testexist 1];
    90              else
    91                 h_func=[];
    92                 testexist=[testexist 0];
    93              end
    94              fct_handle=[fct_handle; {h_func}]; %concatene the list of paths
    95              rmpath(path)
    96              menu_str=[menu_str; {file}];
    97          end
    98      end
    99 end
    100 
    101 menu_str=menu_str(testexist==1);%=menu_str(testexist~=0)
    102 fct_handle=fct_handle(testexist==1);
    103 menu_str=[menu_str;{'more...'}];
    104 set(handles.ACTION,'String',menu_str)
    105 set(handles.ACTION,'UserData',fct_handle)% store the list of path in UserData of ACTION
    106 set(handles.path_action,'String',fullfile(path_uvmat,'get_field'))
    107 set(handles.ACTION,'Value',1)% PLOT option selected
     80% profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     81% if exist(profil_perso,'file')
     82%       h=load (profil_perso);
     83%      if isfield(h,'get_field_fct') && iscell(h.get_field_fct)
     84%          for ilist=1:length(h.get_field_fct)
     85%             [path,file]=fileparts(h.get_field_fct{ilist});
     86%             addpath(path)       
     87%             if exist(file,'file')
     88%                 h_func=str2func(file);
     89%                 testexist=[testexist 1];
     90%              else
     91%                 h_func=[];
     92%                 testexist=[testexist 0];
     93%              end
     94%              fct_handle=[fct_handle; {h_func}]; %concatene the list of paths
     95%              rmpath(path)
     96%              menu_str=[menu_str; {file}];
     97%          end
     98%      end
     99% end
     100
     101% menu_str=menu_str(testexist==1);%=menu_str(testexist~=0)
     102% fct_handle=fct_handle(testexist==1);
     103% menu_str=[menu_str;{'more...'}];
     104% set(handles.ACTION,'String',menu_str)
     105% set(handles.ACTION,'UserData',fct_handle)% store the list of path in UserData of ACTION
     106% set(handles.path_action,'String',fullfile(path_uvmat,'get_field'))
     107% set(handles.ACTION,'Value',1)% PLOT option selected
    108108
    109109%% settings for 'slave' mode, called by uvamt, or 'master' mode
     
    122122
    123123%% load the list of previously browsed files for the upper bar menu Open
    124 dir_perso=prefdir;
    125 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');%
    126 if exist(profil_perso,'file')
    127     h=load (profil_perso);
    128     if isfield(h,'MenuFile_1')
    129         set(handles.MenuFile_1,'Label',h.MenuFile_1);
    130     end
    131     if isfield(h,'MenuFile_1')
    132         set(handles.MenuFile_2,'Label',h.MenuFile_2);
    133     end
    134     if isfield(h,'MenuFile_1')
    135         set(handles.MenuFile_3,'Label',h.MenuFile_3);
    136     end
    137     if isfield(h,'MenuFile_1')
    138         set(handles.MenuFile_4,'Label',h.MenuFile_4);
    139     end
    140     if isfield(h,'MenuFile_1')
    141         set(handles.MenuFile_5,'Label',h.MenuFile_5);
    142     end
    143 end
     124% dir_perso=prefdir;
     125% profil_perso=fullfile(dir_perso,'uvmat_perso.mat');%
     126% if exist(profil_perso,'file')
     127%     h=load (profil_perso);
     128%     if isfield(h,'MenuFile_1')
     129%         set(handles.MenuFile_1,'Label',h.MenuFile_1);
     130%     end
     131%     if isfield(h,'MenuFile_1')
     132%         set(handles.MenuFile_2,'Label',h.MenuFile_2);
     133%     end
     134%     if isfield(h,'MenuFile_1')
     135%         set(handles.MenuFile_3,'Label',h.MenuFile_3);
     136%     end
     137%     if isfield(h,'MenuFile_1')
     138%         set(handles.MenuFile_4,'Label',h.MenuFile_4);
     139%     end
     140%     if isfield(h,'MenuFile_1')
     141%         set(handles.MenuFile_5,'Label',h.MenuFile_5);
     142%     end
     143% end
    144144
    145145%% put the GUI on the lower right of the sceen
     
    831831function RUN_Callback(hObject, eventdata, handles)
    832832%---------------------------------------------------------
    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% 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])
     869huvmat=findobj(allchild(0),'tag','uvmat');
     870if ~isempty(huvmat)
     871         set(huvmat,'Visible','on')%make uvmat visible (bugs can hide it in some cases)
     872         hhuvmat=guidata(huvmat);
     873         get_field_GUI=read_GUI(handles.get_field);
     874         if isfield(get_field_GUI,'PanelVectors')
     875             set(hhuvmat.Coord_x,'value',1)
     876             set(hhuvmat.Coord_y,'value',1)
     877             set(hhuvmat.Coord_x,'String',{get_field_GUI.PanelVectors.coord_x_vectors})
     878             set(hhuvmat.Coord_y,'String',{get_field_GUI.PanelVectors.coord_y_vectors})
     879             UName=get_field_GUI.PanelVectors.vector_x;
     880             VName=get_field_GUI.PanelVectors.vector_y;
     881             menu_str=[{['vec(' UName ',' VName ')']};{UName};{VName};{['norm(' UName ',' VName ')']};{'get_field...'}];
     882             menu_color=[{''};{UName};{VName};{['norm(' UName ',' VName ')']}];
     883             FieldsMenu=get(hhuvmat.Fields,'String');
     884             Fields=FieldsMenu{get(hhuvmat.Fields,'Value')};
     885             if strcmp(Fields,'get_field...')
     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         end
     900end
     901delete(handles.get_field)
     902%         set(hhuvmat.Fields,'String',{'get_field...'})
     903%         uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat
     904%     end
    869905
    870906%------------------------------------------------------------------------
  • trunk/src/nc2struct.m

    r421 r517  
    145145        Data.ListVarName=ListVarNameNetcdf;
    146146    else   %select input variables, if requested by the input ListVarName
     147        ind_remove=[];
     148        for ivar=1:numel(ListVarName) % check redondancy
     149            if ~isempty(find(strcmp(ListVarName{ivar},ListVarName(1:ivar-1))))
     150                ind_remove=[ind_remove ivar];
     151            end
     152        end
     153        if ~isempty(ind_remove)
     154            ListVarName(ind_remove)=[];
     155        end           
    147156        sizvar=size(ListVarName);
    148157        testmulti=(sizvar(1)>1);%test for multiple choice of variable ranked by order of priority
  • trunk/src/plot_field.m

    r515 r517  
    540540for icell=1:length(CellVarIndex) % length(CellVarIndex) =1 or 2 (from the calling function)
    541541    VarType=VarTypeCell{icell};
    542     if ~isempty(VarType.coord_tps)
     542    if ~isempty(VarType.coord_tps) %do not plot directly tps data (used for projection only)
    543543        continue
    544544    end
     
    566566            vec_U=Data.(Data.ListVarName{ivar_U});
    567567            vec_V=Data.(Data.ListVarName{ivar_V});
    568             if ~isempty(ivar_X) && ~isempty(ivar_Y)% 2D field (with unstructured coordinates or structured ones (then ivar_X and ivar_Y empty)
     568            if ~isempty(ivar_X) && ~isempty(ivar_Y)% 2D field with unstructured coordinates
    569569                XName=Data.ListVarName{ivar_X};
    570570                YName=Data.ListVarName{ivar_Y};
    571                 eval(['vec_X=reshape(Data.' XName ',[],1);'])
    572                 eval(['vec_Y=reshape(Data.' YName ',[],1);'])
     571                vec_X=reshape(Data.(XName),[],1); %transform vectors in column matlab vectors
     572                vec_Y=reshape(Data.(YName),[],1);
    573573            elseif numel(VarType.coord)==2 && ~isequal(VarType.coord,[0 0]);%coordinates defines by dimension variables
    574                 eval(['y=Data.' Data.ListVarName{VarType.coord(1)} ';'])
    575                 eval(['x=Data.' Data.ListVarName{VarType.coord(2)} ';'])
     574                y=Data.(Data.ListVarName{VarType.coord(1)});
     575                x=Data.(Data.ListVarName{VarType.coord(2)});
    576576                if numel(y)==2 % y defined by first and last values on aregular mesh
    577577                    y=linspace(y(1),y(2),size(vec_U,1));
     
    585585                return
    586586            end
    587             if ~isempty(ivar_C)
    588                  eval(['vec_C=Data.' Data.ListVarName{ivar_C} ';']) ;
    589                  vec_C=reshape(vec_C,1,numel(vec_C));
     587            if isfield(PlotParam.Vectors,'ColorScalar') && ~isempty(PlotParam.Vectors.ColorScalar)
     588                [VarVal,ListVarName,VarAttribute,errormsg]=calc_field_interp([],Data,PlotParam.Vectors.ColorScalar);
     589%             if ~isempty(ivar_C)
     590                 %vec_C=Data.(Data.ListVarName{ivar_C});
     591                 if ~isempty(VarVal)
     592                 vec_C=reshape(VarVal{1},1,numel(VarVal{1}));
    590593                 test_C=1;
     594                 end
    591595            end
    592596            if ~isempty(ivar_F)%~(isfield(PlotParam.Vectors,'HideWarning')&& isequal(PlotParam.Vectors.HideWarning,1))
  • trunk/src/proj_field.m

    r516 r517  
    11811181                        FieldVar=FieldData.(VarName_scalar);
    11821182                    end
    1183                     [VarVal,ListFieldProj,VarAttribute,errormsg]=calc_field_interp([coord_X coord_Y],FieldVar,VarType.Operation,XI,YI);
     1183                    [VarVal,ListFieldProj,VarAttribute,errormsg]=calc_field_interp([coord_X coord_Y],FieldData,VarType.Operation,XI,YI);
    11841184                    if isfield(VarType,'CheckSub') && VarType.CheckSub && ~isempty(vector_x_proj)
    11851185                        ProjData.(ProjData.ListVarName{vector_x_proj})=ProjData.(ProjData.ListVarName{vector_x_proj})-VarVal{1};
  • trunk/src/read_GUI.m

    r516 r517  
    6060                                    input=listinput;
    6161                                else
    62                             input=listinput{value};
     62                                    input=listinput{value};
    6363                                end
    6464                            else % multiple selection
    65                               input=listinput(value); 
     65                                input=listinput(value);
    6666                            end
    6767                        else
  • trunk/src/read_civdata.m

    r516 r517  
    4747% 'nc2struct': reads a netcdf file
    4848
    49 function [Field,VelTypeOut,errormsg]=read_civdata(filename,FieldNames,VelType,CivStage)
     49function [Field,VelTypeOut,errormsg]=read_civdata(filename,FieldNames,VelType)
    5050
    5151%% default input
     
    7777
    7878%% reading data
    79 [varlist,role,VelTypeOut]=varcivx_generator(FieldRequest,VelType,CivStage);
     79Data=nc2struct(filename,'ListGlobalAttribute','CivStage');
     80[varlist,role,VelTypeOut]=varcivx_generator(FieldRequest,VelType,Data.CivStage);
    8081if isempty(varlist)
    8182    erromsg=['error in read_civdata: unknow velocity type ' VelType];
  • trunk/src/read_field.m

    r516 r517  
    4242try
    4343    switch FileType
    44         case {'civx','civdata','netcdf'}  %read the first nc field
    45             GUIName='get_field'; %default name of the GUI get_field
    46             if isfield(ParamIn,'GUIName')
    47                 GUIName=ParamIn.GUIName;
    48             end
    49             CivStage=0;
    50             if ~strcmp(ParamIn.FieldName,'get_field...')% if get_field is not requested, look for Civx data
    51                 FieldList=calc_field;%list of possible fields for Civx data
    52                 ParamOut.ColorVar='';%default
    53                 if ischar(ParamIn.FieldName)
    54                     FieldName=ParamIn.FieldName;
    55                 else
    56                     FieldName=ParamIn.FieldName{1};
    57                 end
    58                 field_index=strcmp(FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data
    59                 if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist
    60                     Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage');
    61                     % case of new civdata conventions
    62                     if isequal(Data.Conventions,'uvmat/civdata')
    63                         ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default
    64                         ParamOut.ColorVar='ima_cor';
    65                         InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}];
    66                         [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType,Data.CivStage);
     44        case 'civdata'
     45%             ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default
     46%                         ParamOut.ColorVar='ima_cor';
     47                        InputField=[{ParamIn.FieldName} {ParamIn.ColorVar}];
     48                        [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType);
    6749                        if ~isempty(errormsg),errormsg=['read_civdata:' errormsg];return,end
    68                         CivStage=Field.CivStage;
    6950                        ParamOut.CivStage=Field.CivStage;
    70                         %case of old civx conventions
    71                     elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)
    72                         ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default
     51         case 'civx'
     52            ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default
    7353                        ParamOut.ColorVar='ima_cor';
    7454                        InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}];
    7555                        [Field,ParamOut.VelType]=read_civxdata(FileName,InputField,ParamIn.VelType);
    7656                        if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end
    77                         CivStage=Field.CivStage;
    7857                        ParamOut.CivStage=Field.CivStage;
    79                         % not cvix file, fields will be chosen through the GUI get_field
    80                     else
    81                         ParamOut.FieldName='get_field...';
    82                         hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI
    83                         if ~isempty(hget_field)
    84                             delete(hget_field)%delete  get_field for reinitialisation
    85                         end
    86                     end
    87                 else             
    88                     InputField=ParamOut.FieldName;
    89                     if ischar(InputField)
    90                         InputField={InputField};
    91                     end
    92                     if isfield(ParamIn,'ColorVar')
    93                         ParamOut.ColorVar=ParamIn.ColorVar;
    94                         InputField=[InputField {ParamOut.ColorVar}];
    95                     end
    96                     [Field,ParamOut.VelType,errormsg]=read_civxdata(FileName,InputField,ParamIn.VelType);
    97                     if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end
    98                     CivStage=Field.CivStage;
    99                     ParamOut.CivStage=Field.CivStage;
     58        case 'netcdf'
     59            r=regexp(ParamIn.FieldName,'(^vec|^norm)\((?<UName>.+),(?<VName>.+)\)$','names');
     60            if isempty(r)
     61                ListVar={ParamIn.FieldName};
     62                input='scalar';
     63            else
     64                ListVar={r.UName,r.VName};
     65                input='vectors';
     66            end
     67            if ~isempty(ParamIn.ColorVar)
     68                r=regexp(ParamIn.ColorVar,'(^vec|^norm)\((?<UName>.+),(?<VName>.+)\)$','names');
     69                if isempty(r)
     70                    ListVar=[ListVar {ParamIn.ColorVar}];
     71                else
     72                    ListVar=[ListVar {r.UName,r.VName}];
    10073                end
    101                 ParamOut.FieldList=[{'image'};FieldList;{'get_field...'}];
    102             end
    103             if CivStage==0% read the field names on the interface get_field.
    104                 hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI
    105                 if isempty(hget_field)% open the GUI get_field if it is not found
    106                     hget_field= get_field(FileName);%open the get_field GUI
    107                     set(hget_field,'Name',GUIName)%update the name of get_field (e.g. get_field_1)
     74            end
     75                [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.CoordName ListVar]);
     76                if strcmp(input,'vectors')
     77                    Field.VarAttribute{3}.Role='vector_x';
     78                    Field.VarAttribute{4}.Role='vector_y';
     79                else
     80                    Field.VarAttribute{3}.Role='scalar';
    10881                end
    109                 hhget_field=guidata(hget_field);
    110                 %% update  the get_field GUI
    111                 set(hhget_field.inputfile,'String',FileName)
    112                 set(hhget_field.list_fig,'Value',1)
    113                 if exist('num','var')&&~isnan(num)
    114                     set(hhget_field.TimeIndexValue,'String',num2str(num))
    115                 end
    116 %                 funct_list=get(hhget_field.ACTION,'UserData');
    117 %                 funct_index=get(hhget_field.ACTION,'Value');
    118 %                 funct=funct_list{funct_index};%select  the current action in get_field, e;g. PLOT
    119 %                 Field=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot
    120                 [Field,errormsg]=read_get_field(hget_field);
    121                 Tabchar={''};%default
    122                 Tabcell=[];
    123                 set(hhget_field.inputfile,'String',FileName)
    124                 if isfield(Field,'ListGlobalAttribute')&& ~isempty(Field.ListGlobalAttribute)
    125                     for iline=1:length(Field.ListGlobalAttribute)
    126                         Tabcell{iline,1}=Field.ListGlobalAttribute{iline};
    127                         if isfield(Field, Field.ListGlobalAttribute{iline})
    128                             val=Field.(Field.ListGlobalAttribute{iline});
    129                             if ischar(val);
    130                                 Tabcell{iline,2}=val;
    131                             else
    132                                 Tabcell{iline,2}=num2str(val);
    133                             end
    134                         end
    135                     end
    136                     if ~isempty(Tabcell)
    137                         Tabchar=cell2tab(Tabcell,'=');
    138                         Tabchar=[{''};Tabchar];
    139                     end
    140                 end
    141                 ParamOut.CivStage=0;
    142                 ParamOut.VelType=[];
    143                 if isfield(Field,'TimeIndex')
    144                     ParamOut.TimeIndex=Field.TimeIndex;
    145                 end
    146                 if isfield(Field,'TimeValue')
    147                     ParamOut.TimeValue=Field.TimeValue;
    148                 end
    149                 ParamOut.FieldList={'get_field...'};
    150             end
     82%             GUIName='get_field'; %default name of the GUI get_field
     83%             if isfield(ParamIn,'GUIName')
     84%                 GUIName=ParamIn.GUIName;
     85%             end
     86%             CivStage=0;
     87% %             if ~strcmp(ParamIn.FieldName,'get_field...')% if get_field is not requested, look for Civx data
     88%                 FieldList=calc_field;%list of possible fields for Civx data
     89%                 ParamOut.ColorVar='';%default
     90%                 if ischar(ParamIn.FieldName)
     91%                     FieldName=ParamIn.FieldName;
     92%                 else
     93%                     FieldName=ParamIn.FieldName{1};
     94%                 end
     95%                 field_index=strcmp(FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data
     96%                 if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist
     97%                     Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage');
     98%                     % case of new civdata conventions
     99%                     if isequal(Data.Conventions,'uvmat/civdata')
     100%                         
     101%                         %case of old civx conventions
     102%                     elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)
     103%                         ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default
     104%                         ParamOut.ColorVar='ima_cor';
     105%                         InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}];
     106%                         [Field,ParamOut.VelType]=read_civxdata(FileName,InputField,ParamIn.VelType);
     107%                         if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end
     108%                         CivStage=Field.CivStage;
     109%                         ParamOut.CivStage=Field.CivStage;
     110%                         % not cvix file, fields will be chosen through the GUI get_field
     111%                     else
     112%                         ParamOut.FieldName='get_field...';
     113%                         hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI
     114%                         if ~isempty(hget_field)
     115%                             delete(hget_field)%delete  get_field for reinitialisation
     116%                         end
     117%                     end
     118%                 else             
     119%                     InputField=ParamOut.FieldName;
     120%                     if ischar(InputField)
     121%                         InputField={InputField};
     122%                     end
     123%                     if isfield(ParamIn,'ColorVar')
     124%                         ParamOut.ColorVar=ParamIn.ColorVar;
     125%                         InputField=[InputField {ParamOut.ColorVar}];
     126%                     end
     127%                     [Field,ParamOut.VelType,errormsg]=read_civxdata(FileName,InputField,ParamIn.VelType);
     128%                     if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end
     129%                     CivStage=Field.CivStage;
     130%                     ParamOut.CivStage=Field.CivStage;
     131%                 end
     132%                 ParamOut.FieldList=[{'image'};FieldList;{'get_field...'}];
     133%             end
     134%             if CivStage==0% read the field names on the interface get_field.
     135%                 hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI
     136%                 if isempty(hget_field)% open the GUI get_field if it is not found
     137%                     hget_field= get_field(FileName);%open the get_field GUI
     138%                     set(hget_field,'Name',GUIName)%update the name of get_field (e.g. get_field_1)
     139%                 end
     140%                 hhget_field=guidata(hget_field);
     141%                 %% update  the get_field GUI
     142%                 set(hhget_field.inputfile,'String',FileName)
     143%                 set(hhget_field.list_fig,'Value',1)
     144%                 if exist('num','var')&&~isnan(num)
     145%                     set(hhget_field.TimeIndexValue,'String',num2str(num))
     146%                 end
     147% %                 funct_list=get(hhget_field.ACTION,'UserData');
     148% %                 funct_index=get(hhget_field.ACTION,'Value');
     149% %                 funct=funct_list{funct_index};%select  the current action in get_field, e;g. PLOT
     150% %                 Field=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot
     151%                 [Field,errormsg]=read_get_field(hget_field);
     152%                 Tabchar={''};%default
     153%                 Tabcell=[];
     154%                 set(hhget_field.inputfile,'String',FileName)
     155%                 if isfield(Field,'ListGlobalAttribute')&& ~isempty(Field.ListGlobalAttribute)
     156%                     for iline=1:length(Field.ListGlobalAttribute)
     157%                         Tabcell{iline,1}=Field.ListGlobalAttribute{iline};
     158%                         if isfield(Field, Field.ListGlobalAttribute{iline})
     159%                             val=Field.(Field.ListGlobalAttribute{iline});
     160%                             if ischar(val);
     161%                                 Tabcell{iline,2}=val;
     162%                             else
     163%                                 Tabcell{iline,2}=num2str(val);
     164%                             end
     165%                         end
     166%                     end
     167%                     if ~isempty(Tabcell)
     168%                         Tabchar=cell2tab(Tabcell,'=');
     169%                         Tabchar=[{''};Tabchar];
     170%                     end
     171%                 end
     172%                 ParamOut.CivStage=0;
     173%                 ParamOut.VelType=[];
     174%                 if isfield(Field,'TimeIndex')
     175%                     ParamOut.TimeIndex=Field.TimeIndex;
     176%                 end
     177%                 if isfield(Field,'TimeValue')
     178%                     ParamOut.TimeValue=Field.TimeValue;
     179%                 end
     180%                 ParamOut.FieldList={'get_field...'};
     181
    151182        case 'video'
    152183            if strcmp(class(ParamIn),'VideoReader')
  • trunk/src/set_col_vec.m

    r405 r517  
    2121% vec_C: matlab vector representing the scalar setting the color
    2222function [colorlist,col_vec,colcode_out]=set_col_vec(colcode,vec_C)
    23 col_vec=[];
     23col_vec=ones(size(vec_C));%all vectors at color#1 by default
     24
    2425if ~isstruct(colcode),colcode=[];end;
    2526colcode_out=colcode;%default
    2627if isempty(vec_C) || ~isnumeric(vec_C)
    2728    colorlist=[0 0 1]; %blue
    28     col_vec=ones(size(vec_C));
    2929    return
    3030end
    3131
    32 
    33 
    34 % colcode_out.ColCode1=ColCode1;
    35 % colcode_out.ColCode2=ColCode2;
    3632%% uniform color plot
    3733check_multicolors=0;
    38 col_vec=ones(size(vec_C));%all vectors at color#1 by default
    3934%default input parameters
    4035if ~isfield(colcode,'ColorCode') || isempty(colcode.ColorCode)
  • trunk/src/uvmat.m

    r516 r517  
    180180UvData.OpenParam.PosColorbar=[0.805 0.022 0.019 0.445];
    181181UvData.OpenParam.PosSetObject=[-0.05 -0.03 0.3 0.7]; %position for set_object
    182 UvData.OpenParam.PosGeometryCalic=[0.95 -0.03 0.28 1 ];%position for geometry_calib (TO IMPROVE)
     182UvData.OpenParam.PosGeometryCalib=[0.95 -0.03 0.28 1 ];%position for geometry_calib (TO IMPROVE)
    183183% UvData.OpenParam.CalSize=[0.28 1];
    184184% UvData.PlotAxes=[];%initiate the record of plotted field
     
    990990
    991991%% set default options in menu 'Fields'
    992 if ~testima
    993     testcivx=0;
    994     if isfield(UvData,'FieldsString') && isequal(UvData.FieldsString,{'get_field...'})% field menu defined as input (from get_field)
     992switch FileType
     993    case {'civx','civdata'}
     994            [FieldList,ColorList]=calc_field;
     995            set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data
     996            set(handles_Fields,'Value',2) % set menu to 'velocity
     997          %  col_vec=FieldList;
     998           % col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar)
     999           set(handles.ColorScalar,'Value',1)
     1000            set(handles.ColorScalar,'String',ColorList)
     1001            set(handles.Coord_x,'Value',1);
     1002           set(handles.Coord_x,'String',{'X'});
     1003           set(handles.Coord_y,'Value',1);
     1004           set(handles.Coord_y,'String',{'Y'});
     1005    case 'netcdf'
    9951006        set(handles_Fields,'Value',1)
    9961007        set(handles_Fields,'String',{'get_field...'})
    997         UvData=rmfield(UvData,'FieldsString');
    998     else
    999         Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ');
    1000         if strcmp(Data.Conventions,'uvmat/civdata') ||( ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0))%if the new input is Civx
    1001             FieldList=calc_field;
    1002             set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data
    1003             set(handles_Fields,'Value',2) % set menu to 'velocity'
    1004             col_vec=FieldList;
    1005             col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar)
    1006             testcivx=1;
    1007         end
    1008         if ~testcivx
    1009             set(handles_Fields,'Value',1) % set menu to 'get_field...
    1010             set(handles_Fields,'String',{'get_field...'})
    1011             col_vec={'get_field...'};
    1012         end
    1013         set(handles.ColorScalar,'String',col_vec)
    1014     end
     1008        hget_field=get_field(FileName);
     1009        hhget_field=guidata(hget_field);
     1010        get_field('RUN_Callback',hhget_field.RUN,[],hhget_field);
     1011%             set(handles_Fields,'Value',1) % set menu to 'get_field...
     1012%             set(handles_Fields,'String',{'get_field...'})
     1013%             col_vec={'get_field...'};
     1014%
     1015%         set(handles.ColorScalar,'String',col_vec)
     1016    otherwise
     1017        set(handles_Fields,'Value',1) % set menu to 'image'
     1018        set(handles_Fields,'String',{'image'})
     1019                    set(handles.Coord_x,'Value',1);
     1020           set(handles.Coord_x,'String',{'AX'});
     1021           set(handles.Coord_y,'Value',1);
     1022           set(handles.Coord_y,'String',{'AY'});
    10151023end
    10161024set(handles.uvmat,'UserData',UvData)
     
    20382046            end
    20392047        end
    2040         if strcmp(FieldName,'velocity')
     2048        if ~isempty(regexp(FieldName,'^vec('))
    20412049            list_code=get(handles.ColorCode,'String');% list menu fields
    20422050            index_code=get(handles.ColorCode,'Value');% selected string index
     
    20702078end
    20712079if isstruct (ParamIn)
    2072 ParamIn.FieldName=FieldName;
    2073 ParamIn.VelType=VelType;
    2074 ParamIn.GUIName='get_field';
    2075 end
    2076 check_tps=0;         
     2080    ParamIn.FieldName=FieldName;
     2081    ParamIn.VelType=VelType;
     2082    XNameMenu=get(handles.Coord_x,'String');
     2083    ParamIn.CoordName=XNameMenu{get(handles.Coord_x,'Value')};
     2084    YNameMenu=get(handles.Coord_y,'String');
     2085    ParamIn.CoordName={ParamIn.CoordName, YNameMenu{get(handles.Coord_y,'Value')}};
     2086end
     2087check_tps = 0;         
    20772088if strcmp(UvData.FileType{1},'civdata')&&~strcmp(ParamIn.FieldName,'velocity')&&~strcmp(ParamIn.FieldName,'get_field...')
    20782089       check_tps=1;%tps needed to get the requested field
     
    22152226end
    22162227% display the Fields menu from the input file and pick the selected one:
    2217 if isstruct(ParamOut)
    2218     field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList);
    2219     set(handles.Fields,'String',ParamOut.FieldList); %update the field menu
    2220     set(handles.Fields,'Value',find(field_index,1))
    2221 end
     2228% if isstruct(ParamOut)
     2229%     field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList);
     2230%     set(handles.Fields,'String',ParamOut.FieldList); %update the field menu
     2231%     set(handles.Fields,'Value',find(field_index,1))
     2232% end
    22222233
    22232234%% update the display menu for the second velocity type (second menuline)
    22242235test_veltype_1=0;
    22252236if isempty(FileName_1)
    2226     set(handles.Fields_1,'Value',1); %update the field menu
    2227     if isstruct(ParamOut)
    2228     set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu
    2229     end
     2237%     set(handles.Fields_1,'Value',1); %update the field menu
     2238%     if isstruct(ParamOut)
     2239%     set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu
     2240%     end
    22302241elseif ~test_keepdata_1
    22312242    if (~strcmp(UvData.FileType{2},'netcdf')&&~strcmp(UvData.FileType{2},'civdata')&&~strcmp(UvData.FileType{2},'civx'))|| isequal(FieldName_1,'get_field...')
     
    26252636        PlotParam{1}.Vectors.ColCode1=0.33;
    26262637        PlotParam{1}.Vectors.ColCode2=0.66;
    2627         PlotParam{1}.Vectors.ColorScalar={'ima_cor'};
     2638        PlotParam{1}.Vectors.ColorScalar={''};
    26282639        PlotParam{1}.Vectors.ColorCode= {'rgb'};
    26292640    end
     
    30823093    [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    30833094    FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    3084     %FileName=read_file_boxes(handles);
    30853095    hget_field=findobj(allchild(0),'name','get_field');
    30863096    if ~isempty(hget_field)
     
    30883098    end
    30893099    hget_field=get_field(FileName);
    3090     set(hget_field,'Name','get_field')
    3091     hhget_field=guidata(hget_field);
    3092     set(hhget_field.list_fig,'Value',1)
    3093     set(hhget_field.list_fig,'String',{'uvmat'})
     3100%     set(hget_field,'Name','get_field')
     3101%     hhget_field=guidata(hget_field);
     3102%     set(hhget_field.list_fig,'Value',1)
     3103%     set(hhget_field.list_fig,'String',{'uvmat'})
    30943104  %  set(handles.transform_fct,'Value',1)% no transform by default
    30953105  %  set(handles.path_transform,'String','')
    3096     return %no action
    3097 end
    3098 list_fields=get(handles.Fields_1,'String');% list menu fields
    3099 index_fields=get(handles.Fields_1,'Value');% selected string index
    3100 field_1= list_fields{index_fields(1)}; % selected string
     3106    return %no further action
     3107end
     3108
    31013109UvData=get(handles.uvmat,'UserData');
    31023110
     
    31483156
    31493157%common to Fields_1_Callback
     3158list_fields_1=get(handles.Fields_1,'String');% list menu fields
     3159field_1='';
     3160if ~isempty(list_fields_1)
     3161field_1= list_fields_1{get(handles.Fields_1,'Value')}; % selected string
     3162end
    31503163if isequal(field,'image')||isequal(field_1,'image')
    31513164    set(handles.TitleNpx,'Visible','on')% visible npx,pxcm... buttons
     
    46694682    data.CoordType=UvData.CoordType;
    46704683end
    4671 pos=get(handles.uvmat,'Position');
    4672 pos(1)=pos(1)+pos(3)-0.311+0.04; %0.311= width of the geometry_calib interface (units relative to the srcreen)
    4673 pos(2)=pos(2)-0.02;
     4684% pos=get(handles.uvmat,'Position');
     4685% pos(1)=pos(1)+pos(3)-0.311+0.04; %0.311= width of the geometry_calib interface (units relative to the srcreen)
     4686% pos(2)=pos(2)-0.02;
    46744687[RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
    46754688FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];
    46764689set(handles.view_xml,'Backgroundcolor',[1 1 0])%indicate the reading of the current xml file by geometry_calib
    4677 if isfield(UvData.OpenParam,'CalOrigin')
    4678     pos_uvmat=get(handles.uvmat,'Position');
    4679     pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.PosGeometryCalib(1)*pos_uvmat(3);
    4680     pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.PosGeometryCalib(2)*pos_uvmat(4);
    4681     pos_cal(3:4)=UvData.OpenParam.PosGeometryCalib(3:4).* pos_uvmat(3:4);
    4682 end
     4690pos_uvmat=get(handles.uvmat,'Position');
     4691pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.PosGeometryCalib(1)*pos_uvmat(3);
     4692pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.PosGeometryCalib(2)*pos_uvmat(4);
     4693pos_cal(3:4)=UvData.OpenParam.PosGeometryCalib(3:4).* pos_uvmat(3:4);
    46834694geometry_calib(FileName,pos_cal);% call the geometry_calib interface   
    46844695set(handles.view_xml,'Backgroundcolor',[1 1 1])%indicate the end of reading of the current xml file by geometry_calib
     
    49024913ProjectDir = uigetdir(fileparts(fileparts(RootPath)), 'select the project directory');
    49034914datatree_browser(ProjectDir)
     4915
     4916
     4917% --- Executes on selection change in Coord_y.
     4918function Coord_y_Callback(hObject, eventdata, handles)
     4919
     4920% --- Executes on selection change in Coord_x.
     4921function Coord_x_Callback(hObject, eventdata, handles)
Note: See TracChangeset for help on using the changeset viewer.