Changeset 399


Ignore:
Timestamp:
Apr 27, 2012, 12:28:47 PM (12 years ago)
Author:
sommeria
Message:

implementation of thin plate interpolation (proj on planes with mode 'filter'), rationalisation of variable formats in civ_matlab

Location:
trunk/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/calc_field.m

    r397 r399  
    11%'calc_field': defines fields (velocity, vort, div...) from civx data and calculate them
    22%---------------------------------------------------------------------
    3 % [DataOut,errormsg]=calc_field(FieldName,DataIn)
     3% [DataOut,errormsg]=calc_field(FieldList,DataIn,Coord_interp)
    44%
    55% OUTPUT:
     
    1616%
    1717% INPUT:
    18 % FieldName: string representing the name of the field
     18% FieldList: cell array of strings representing the name(s) of the field(s) to calculate
    1919% DataIn: structure representing the field, as defined in check_field_srtructure.m
     20% Coord_interp(:,nb_coord) optional set of coordinates to interpolate the field (use with thin plate shell)
    2021%
    2122% FUNCTION related
     
    2324% file, depending on the scalar
    2425
    25 function [DataOut,errormsg]=calc_field(FieldName,DataIn,Coord_interp)
     26function [DataOut,errormsg]=calc_field(FieldList,DataIn,Coord_interp)
    2627
    2728%list of defined scalars to display in menus (in addition to 'ima_cor').
     
    4647    'error'}; %error associated to a vector (for stereo or patch)
    4748errormsg=[]; %default error message
    48 if ~exist('FieldName','var')
     49if ~exist('FieldList','var')
    4950    DataOut=list_field;% gives the list of possible fields in the absence of input
    5051else
     
    5253        DataIn=[];
    5354    end
    54     if ischar(FieldName)
    55         FieldName={FieldName};%convert a string input to a cell with one string element
     55    if ischar(FieldList)
     56        FieldList={FieldList};%convert a string input to a cell with one string element
    5657    end
    5758    if isfield(DataIn,'Z')&& isequal(size(DataIn.Z),size(DataIn.X))
     
    7879        XMin=min(min(DataIn.SubRange(1,:,:)));
    7980        YMin=min(min(DataIn.SubRange(2,:,:)));
    80         %         if ~exist('Coord_interp','var')
    81         %             Mesh=sqrt((YMax-YMin)*(XMax-XMin)/numel(DataIn.Coord_tps(:,1,:)));%2D
    82         %             xI=XMin:Mesh:XMax;
    83         %             yI=YMin:Mesh:YMax;
    84         %             [XI,YI]=meshgrid(xI,yI);% interpolation grid
    85         %             Coord_interp(:,1)=reshape(XI,[],1);
    86         %             Coord_interp(:,2)=reshape(YI,[],1);
    87         %             DataOut.coord_y=[yI(1) yI(end)];
    88         %             DataOut.coord_x=[xI(1) xI(end)];
    89         %      end
    9081        check_der=0;
    9182        check_val=0;
    92         for ilist=1:length(FieldName)
    93             switch FieldName{ilist}
     83        nb_sites=size(Coord_interp,1);
     84        nb_coord=size(Coord_interp,2);
     85        for ilist=1:length(FieldList)
     86            switch FieldList{ilist}
    9487                case 'velocity'
    9588                    check_val=1;
    96                     DataOut.U=zeros(size(Coord_interp,1));
    97                     DataOut.V=zeros(size(Coord_interp,1));
     89                    DataOut.U=zeros(nb_sites,1);
     90                    DataOut.V=zeros(nb_sites,1);
    9891                case{'vort','div','strain'}% case of spatial derivatives
    9992                    check_der=1;
    100                     DataOut.(FieldName{ilist})=zeros(size(Coord_interp,1));
    101                 otherwise % case of a scalar
    102                     check_val=1;
    103                     DataOut.(FieldName{ilist})=zeros(size(Coord_interp,1));
    104             end
    105         end
    106         nbval=zeros(size(Coord_interp,1));
     93                    DataOut.(FieldList{ilist})=zeros(nb_sites,1);
     94%                 otherwise % case of a scalar
     95%                     check_val=1;
     96%                     DataOut.(FieldList{ilist})=zeros(size(Coord_interp,1));
     97            end
     98        end
     99        nbval=zeros(nb_sites,1);
    107100        NbSubDomain=size(DataIn.SubRange,3);
     101        %DataIn.Coord_tps=DataIn.Coord_tps(1:end-3,:,:);% suppress the 3 zeros used to fit with the dimensions of variables
    108102        for isub=1:NbSubDomain
    109             if isfield(DataIn,'NbSites')
    110                 nbvec_sub=DataIn.NbSites(isub);
    111             else
    112                 nbvec_sub=numel(find(DataIn.Indices_tps(:,isub)));
    113             end
    114             ind_sel=find(Coord_interp>=DataIn.SubRange(:,1,isub) & Coord_interp<=DataIn.SubRange(:,2,isub));
     103            nbvec_sub=DataIn.NbSites(isub);
     104            check_range=(Coord_interp >=ones(nb_sites,1)*DataIn.SubRange(:,1,isub)' & Coord_interp<=ones(nb_sites,1)*DataIn.SubRange(:,2,isub)');
     105            ind_sel=find(sum(check_range,2)==nb_coord);
    115106            %rho smoothing parameter
    116107            %                 epoints = Coord_interp(ind_sel) ;% coordinates of interpolation sites
     
    118109            nbval(ind_sel)=nbval(ind_sel)+1;% records the number of values for eacn interpolation point (in case of subdomain overlap)
    119110            if check_val
    120                 EM = tps_eval(Coord_interp(ind_sel),DataIn.Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the velocity from tps 'sources'
     111                EM = tps_eval(Coord_interp(ind_sel,:),DataIn.Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the velocity from tps 'sources'
    121112            end
    122113            if check_der
    123                 [EMDX,EMDY] = tps_eval_dxy(Coord_interp(ind_sel),DataIn.Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the spatial derivatives from tps 'sources'
    124             end
    125             for ilist=1:length(FieldName)
    126                 switch FieldName{ilist}
     114                [EMDX,EMDY] = tps_eval_dxy(Coord_interp(ind_sel,:),DataIn.Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the spatial derivatives from tps 'sources'
     115            end
     116            for ilist=1:length(FieldList)
     117                switch FieldList{ilist}
    127118                    case 'velocity'
    128119                        ListFields={'U', 'V'};
     
    154145            end
    155146            DataOut.FF=nbval==0; %put errorflag to 1 for points outside the interpolation rang
    156             DataOut.FF=reshape(DataOut.FF,numel(yI),numel(xI));
     147%            DataOut.FF=reshape(DataOut.FF,numel(yI),numel(xI));
    157148            nbval(nbval==0)=1;
    158             switch FieldName{1}
    159                 case {'velocity','u','v'}
    160                     DataOut.U=reshape(DataOut.U./nbval,numel(yI),numel(xI));
    161                     DataOut.V=reshape(DataOut.V./nbval,numel(yI),numel(xI));
    162                 case 'vort'
    163                     DataOut.vort=reshape(DataOut.vort,numel(yI),numel(xI));
    164                 case 'div'
    165                     DataOut.div=reshape(DataOut.div,numel(yI),numel(xI));
    166                 case 'strain'
    167                     DataOut.strain=reshape(DataOut.strain,numel(yI),numel(xI));
    168             end
     149%             switch FieldList{1}
     150%                 case {'velocity','u','v'}
     151%                     DataOut.U=reshape(DataOut.U./nbval,numel(yI),numel(xI));
     152%                     DataOut.V=reshape(DataOut.V./nbval,numel(yI),numel(xI));
     153%                 case 'vort'
     154%                     DataOut.vort=reshape(DataOut.vort,numel(yI),numel(xI));
     155%                 case 'div'
     156%                     DataOut.div=reshape(DataOut.div,numel(yI),numel(xI));
     157%                 case 'strain'
     158%                     DataOut.strain=reshape(DataOut.strain,numel(yI),numel(xI));
     159%             end
    169160            DataOut.ListVarName=[DataOut.ListVarName ListFields];
    170161            for ilist=3:numel(DataOut.ListVarName)
     
    179170        %% civx data
    180171        DataOut=DataIn;
    181         for ilist=1:length(FieldName)
    182             if ~isempty(FieldName{ilist})
    183                 [VarName,Value,Role,units]=feval(FieldName{ilist},DataIn);%calculate field with appropriate function named FieldName{ilist}
     172        for ilist=1:length(FieldList)
     173            if ~isempty(FieldList{ilist})
     174                [VarName,Value,Role,units]=feval(FieldList{ilist},DataIn);%calculate field with appropriate function named FieldList{ilist}
    184175                ListVarName=[ListVarName VarName];
    185176                ValueList=[ValueList Value];
  • trunk/src/civ.m

    r398 r399  
    12391239            end
    12401240            Param.Civ1.Time=((time(i2_civ1(ifile)+1,j2_civ1(j)+1)+time(i1_civ1(ifile)+1,j1_civ1(j)+1))/2);
     1241            if strcmp(CivMode,'CivX')
    12411242            Param.Civ1.term_a=num2stra(j1_civ1(j),nom_type_nc);%UTILITE?
    12421243            Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);%
     1244            end
    12431245            form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats
    12441246            if isempty(form)
     
    13901392            end
    13911393            Param.Civ2.Time=(time(i2_civ2(ifile)+1,j2_civ2(j)+1)+time(i1_civ2(ifile)+1,j1_civ2(j)+1))/2;
     1394            if strcmp(CivMode,'CivX')
    13921395            Param.Civ2.term_a=num2stra(j1_civ2(j),nom_type_nc);
    13931396            Param.Civ2.term_b=num2stra(j2_civ2(j),nom_type_nc);
     1397            end
    13941398            Param.Civ2.filename_nc1=filecell.nc.civ1{ifile,j};
    13951399            Param.Civ2.filename_nc1(end-2:end)=[]; % remove '.nc'
  • trunk/src/civ_matlab.m

    r397 r399  
    108108    Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param];% {'Civ1_Time','Civ1_Dt'}];
    109109    Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_F','Civ1_C'};%  cell array containing the names of the fields to record
    110     Data.VarDimName={'NbVec1','NbVec1','NbVec1','NbVec1','NbVec1','NbVec1'};
     110    Data.VarDimName={'nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1'};
    111111    Data.VarAttribute{1}.Role='coord_x';
    112112    Data.VarAttribute{2}.Role='coord_y';
     
    159159    else
    160160        Data.ListVarName=[Data.ListVarName {'Civ1_FF'}];
    161         Data.VarDimName=[Data.VarDimName {'NbVec1'}];
     161        Data.VarDimName=[Data.VarDimName {'nb_vec_1'}];
    162162        nbvar=length(Data.ListVarName);
    163163        Data.VarAttribute{nbvar}.Role='errorflag';   
     
    179179    nbvar=length(Data.ListVarName);
    180180    Data.ListVarName=[Data.ListVarName {'Civ1_U_smooth','Civ1_V_smooth','Civ1_SubRange','Civ1_NbSites','Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps'}];
    181     Data.VarDimName=[Data.VarDimName {'NbVec1','NbVec1',{'NbCoord','Two','NbSubDomain1'},{'NbSubDomain1'},...
    182              {'NbVec1Sub','NbCoord','NbSubDomain1'},{'Nbtps1','NbSubDomain1'},{'Nbtps1','NbSubDomain1'}}];
     181        Data.VarDimName=[Data.VarDimName {'nb_vec_1','nb_vec_1',{'nb_coord','nb_bounds','nb_subdomain_1'},{'nb_subdomain_1'},...
     182             {'nb_tps_1','nb_coord','nb_subdomain_1'},{'nb_tps_1','nb_subdomain_1'},{'nb_tps_1','nb_subdomain_1'}}];
    183183    Data.VarAttribute{nbvar+1}.Role='vector_x';
    184184    Data.VarAttribute{nbvar+2}.Role='vector_y';
     
    195195    [Data.Civ1_SubRange,Data.Civ1_NbSites,Data.Civ1_Coord_tps,Data.Civ1_U_tps,Data.Civ1_V_tps,tild,Ures, Vres,tild,FFres]=...
    196196            filter_tps([Data.Civ1_X(ind_good) Data.Civ1_Y(ind_good)],Data.Civ1_U(ind_good),Data.Civ1_V(ind_good),[],Data.Patch1_SubDomain,Data.Patch1_Rho,Data.Patch1_Threshold);
    197 %       Data.Civ1_U_Diff(ind_good)=Data.Civ1_U(ind_good)-Ures;
    198 %       Data.Civ1_V_Diff(ind_good)=Data.Civ1_V(ind_good)-Vres;
     197      fill=zeros(3,2,size(Data.Civ1_SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
     198      Data.Civ1_Coord_tps=cat(1,Data.Civ1_Coord_tps,fill);
    199199      Data.Civ1_U_smooth(ind_good)=Ures;
    200200      Data.Civ1_V_smooth(ind_good)=Vres;
     
    305305    nbvar=numel(Data.ListVarName);
    306306    Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_F','Civ2_C'}];%  cell array containing the names of the fields to record
    307     Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2','NbVec2','NbVec2','NbVec2','NbVec2'}];
     307    Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2'}];
    308308    Data.VarAttribute{nbvar+1}.Role='coord_x';
    309309    Data.VarAttribute{nbvar+2}.Role='coord_y';
     
    339339    else
    340340        Data.ListVarName=[Data.ListVarName {'Civ2_FF'}];
    341         Data.VarDimName=[Data.VarDimName {'NbVec2'}];
     341        Data.VarDimName=[Data.VarDimName {'nb_vec_2'}];
    342342        nbvar=length(Data.ListVarName);
    343343        Data.VarAttribute{nbvar}.Role='errorflag';   
     
    356356    nbvar=length(Data.ListVarName);
    357357    Data.ListVarName=[Data.ListVarName {'Civ2_U_smooth','Civ2_V_smooth','Civ2_SubRange','Civ2_NbSites','Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps'}];
    358     Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2',{'NbCoord','Two','NbSubDomain2'},{'NbSubDomain2'},...
    359              {'NbVec2Sub','NbCoord','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'Nbtps2','NbSubDomain2'}}];
    360 %     Data.ListVarName=[Data.ListVarName {'Civ2_U_Diff','Civ2_V_Diff','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_X_tps','Civ2_Y_tps','Civ2_U_tps','Civ2_V_tps','Civ2_Indices_tps'}];
    361 %     Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2',{'NbSubDomain2','Two'},{'NbSubDomain2','Two'},...
    362 %              {'NbVec2Sub','NbSubDomain2'},{'NbVec2Sub','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'NbVec2Sub','NbSubDomain2'}}];
     358    Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2',{'nb_coord','nb_bounds','nb_subdomain_2'},{'nb_subdomain_2'},...
     359             {'nb_tps_2','nb_coord','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'}}];
    363360
    364361        Data.VarAttribute{nbvar+1}.Role='vector_x';
     
    376373    [Data.Civ2_SubRange,Data.Civ2_NbSites,Data.Civ2_Coord_tps,Data.Civ2_U_tps,Data.Civ2_V_tps,tild,Ures, Vres,tild,FFres]=...
    377374         filter_tps([Data.Civ2_X(ind_good) Data.Civ2_Y(ind_good)],Data.Civ2_U(ind_good),Data.Civ2_V(ind_good),[],Data.Patch2_SubDomain,Data.Patch2_Rho,Data.Patch2_Threshold);
     375           fill=zeros(3,2,size(Data.Civ2_SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
     376      Data.Civ2_Coord_tps=cat(1,Data.Civ2_Coord_tps,fill);
    378377    Data.Civ2_U_smooth(ind_good)=Ures;
    379378    Data.Civ2_V_smooth(ind_good)=Vres;
  • trunk/src/find_field_indices.m

    r397 r399  
    5858VarDimIndex=[];
    5959VarDimName={};
    60 
    6160if ~isfield(Data,'VarDimName')
    6261    errormsg='missing .VarDimName';
     
    6463end
    6564
    66 %loop on the list of variables
     65%% loop on the list of variables, group them by common dimensions
    6766for ivar=1:nbvar
    6867    DimCell=Data.VarDimName{ivar}; %dimensions associated with the variable #ivar
     
    8584        CellVarIndex{icell}=ivar;%put the current variabl index in the new cell
    8685    end
    87     
     86   
    8887    %look for dimension variables
    8988    if numel(DimCell)==1% if the variable has a single dimension
     
    10099end
    101100
    102 % find the spatial dimensions and vector components
     101%% find the spatial dimensions and vector components
    103102ListRole={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','warnflag','errorflag',...
    104103    'ancillary','image','color','discrete','scalar','coord_tps'};
     104NbDim=zeros(size(CellVarIndex));%default
    105105for icell=1:length(CellVarIndex)
    106106    for ilist=1:numel(ListRole)
     
    142142        return
    143143    end
    144 %     if ivar_vector_x>1
    145 %         ivar_vector_x=ivar_vector_x(1);
    146 %     end
    147 %     if ivar_vector_y>1
    148 %         ivar_vector_y=ivar_vector_y(1);
    149 %     end
    150 %     if ivar_vector_z>1
    151 %         ivar_vector_z=ivar_vector_z(1);
    152 %     end
    153144    if numel(ivar_errorflag)>1
    154145        errormsg='multiply defined error flag in the same cell';
     
    159150        return
    160151    end
    161     %NbDim(icell)=0;% nbre of space dimensions
    162 %     NbDim(icell)=numel(DimCell);
    163     NbDim(icell)=0;
    164152    test_coord=0;
    165153    if numel(VarIndex)>1     
     
    193181        NbDim(icell)=2;
    194182    end
     183    %look for tps data
     184    if ~isempty(VarType{icell}.coord_tps)
     185        VarType{icell}.var_tps=[];
     186        tps_dimnames=Data.VarDimName{VarType{icell}.coord_tps};
     187        if length(tps_dimnames)==3
     188            for ilist=1:length(Data.VarDimName)
     189                if strcmp(tps_dimnames{1},Data.VarDimName{ilist}{1}) && strcmp(tps_dimnames{3},Data.VarDimName{ilist}{2})% identify the variables corresponding to the tps site coordinates coord_tps
     190                    VarType{icell}.var_tps=[VarType{icell}.var_tps ilist];
     191                elseif length(Data.VarDimName{ilist})==1 && strcmp(tps_dimnames{3},Data.VarDimName{ilist}{1})% identify the variable corresponding to nbsites
     192                    VarType{icell}.nbsites_tps= ilist;
     193                elseif length(Data.VarDimName{ilist})==3 && strcmp(tps_dimnames{2},Data.VarDimName{ilist}{1})&& strcmp(tps_dimnames{3},Data.VarDimName{ilist}{3})% identify the variable subrange
     194                    VarType{icell}.subrange_tps= ilist;
     195                end
     196            end
     197        end
     198        NbDim(icell)=2;
     199    end 
    195200end
  • trunk/src/find_file_series.m

    r398 r399  
    110110    if ~isempty(r)
    111111        sep1=r.sep1;
    112         if strcmp(lower(r.j1),r.j1)
     112        i1_str='(?<i1>\d+)';
     113        if strcmp(lower(r.j1),r.j1)% lower case index
    113114            j1_str='(?<j1>[a-z])';
    114115        else
    115            j1_str='(?<j1>[A-Z])';
     116           j1_str='(?<j1>[A-Z])'; % upper case index
    116117        end
    117118        j1_star='*';
  • trunk/src/griddata_uvmat.m

    r236 r399  
    11%'griddata_uvmat': function griddata_uvmat(vec2_X,vec2_Y,vec2_U,vec_X,vec_Y,'linear')
    22%adapt the input of the matlab function griddata to the appropriate version of Matlab
    3 function ZI = griddata_uvmat(X,Y,Z,XI,YI,rho)
    4 if ~exist('rho','var')|| isequal(rho,0)
     3function ZI = griddata_uvmat(X,Y,Z,XI,YI)
     4% if ~exist('rho','var')|| isequal(rho,0)
    55    txt=ver('MATLAB');
    66    Release=txt.Release;
     
    1313        ZI=griddata(X,Y,Z,XI,YI,'linear');
    1414    end
    15 else %smooth with thin plate spline
    16     [ZI,Z_diff]=patch_uvmat(X,Y,Z,XI,YI,rho);
    17     diff_norm=mean(Z_diff.*Z_diff)
    18     ind_good=find(abs(Z_diff)<5*diff_norm);
    19     nb_remove=numel(Z_diff)-numel(ind_good)
    20     if nb_remove>0
    21     X=X(ind_good);
    22     Y=Y(ind_good);
    23     Z=Z(ind_good);
    24     [ZI,Z_diff]=patch_uvmat(X,Y,Z,XI,YI,rho);
    25     diff_norm_new=mean(Z_diff.*Z_diff)
    26     end
    27 end
     15% else %smooth with thin plate spline
     16%     [ZI,Z_diff]=patch_uvmat(X,Y,Z,XI,YI,rho);
     17%     diff_norm=mean(Z_diff.*Z_diff)
     18%     ind_good=find(abs(Z_diff)<5*diff_norm);
     19%     nb_remove=numel(Z_diff)-numel(ind_good)
     20%     if nb_remove>0
     21%     X=X(ind_good);
     22%     Y=Y(ind_good);
     23%     Z=Z(ind_good);
     24%     [ZI,Z_diff]=patch_uvmat(X,Y,Z,XI,YI,rho);
     25%     diff_norm_new=mean(Z_diff.*Z_diff)
     26%     end
     27% end
  • trunk/src/mouse_motion.m

    r388 r399  
    151151                                    end
    152152                                end
    153                             elseif numel(VarType{icell}.coord) >=2 %structured coordinates
     153                            elseif numel(VarType{icell}.coord) >=2 & VarType{icell}.coord > 0 %structured coordinates
    154154                                yName=Field.ListVarName{VarType{icell}.coord(1)};
    155155                                xName=Field.ListVarName{VarType{icell}.coord(2)};
  • trunk/src/proj_field.m

    r397 r399  
    11%'proj_field': projects the field on a projection object
    22%--------------------------------------------------------------------------
    3 %  function [ProjData,errormsg]=proj_field(FieldData,ObjectData,FieldName)
     3%  function [ProjData,errormsg]=proj_field(FieldData,ObjectData)
    44%
    55% OUTPUT:
     
    2727%FieldData: data of the field to be projected on the projection object, with optional fields
    2828%    .Txt: error message, transmitted to the projection
    29 %    .CoordType: 'px' or 'phys' type of coordinates of the field, must be the same as for the projection object, transmitted
     29%    .FieldList: cell array of strings representing the fields to calculate
    3030%    .Mesh: typical distance between data points (used for mouse action or display), transmitted
    3131%    .CoordUnit, .TimeUnit, .dt: transmitted
     
    8080%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    8181
    82 function [ProjData,errormsg]=proj_field(FieldData,ObjectData,FieldName)
     82function [ProjData,errormsg]=proj_field(FieldData,ObjectData)
    8383errormsg='';%default
    8484if ~exist('FieldName','var')
     
    8787%% case of no projection (object is used only as graph display)
    8888if isfield(ObjectData,'ProjMode') && (isequal(ObjectData.ProjMode,'none')||isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside'))
    89     if ~isempty(FieldName)
    90         [ProjData,errormsg]=calc_field(FieldName,FieldData);
    91     else
    9289    ProjData=[];
    93     end
    9490    return
    9591end
     
    143139        end
    144140    case 'plane'
    145             [ProjData,errormsg] = proj_plane(FieldData,ObjectData,FieldName);
     141            [ProjData,errormsg] = proj_plane(FieldData,ObjectData);
    146142    case 'volume'
    147143        [ProjData,errormsg] = proj_volume(FieldData,ObjectData);
     
    892888%project on a plane
    893889% AJOUTER flux,circul,error
    894  function  [ProjData,errormsg] = proj_plane(FieldData, ObjectData,FieldName)
     890 function  [ProjData,errormsg] = proj_plane(FieldData, ObjectData)
    895891%-----------------------------------------------------------------
    896892
     
    994990% CellVarIndex=cells of variable index arrays
    995991ivar_new=0; % index of the current variable in the projected field
    996 icoord=0;
     992% icoord=0;
    997993nbcoord=0;%number of added coordinate variables brought by projection
    998994nbvar=0;
     
    1000996    NbDim=NbDimVec(icell);
    1001997    if NbDim<2
    1002         continue
     998        continue % only cells represnting 2D or 3D fields are involved
    1003999    end
    10041000    VarIndex=CellVarIndex{icell};%  indices of the selected variables in the list FieldData.ListVarName
     
    10101006    ivar_V=VarType.vector_y;
    10111007    ivar_W=VarType.vector_z;
    1012     ivar_C=VarType.scalar ;
     1008    %    ivar_C=VarType.scalar ;
    10131009    ivar_Anc=VarType.ancillary;
    10141010    test_anc=zeros(size(VarIndex));
     
    10161012    ivar_F=VarType.warnflag;
    10171013    ivar_FF=VarType.errorflag;
    1018     testX=~isempty(ivar_X) && ~isempty(ivar_Y);
     1014    check_unstructured_coord=(~isempty(ivar_X) && ~isempty(ivar_Y))||~isempty(VarType.coord_tps);
    10191015    DimCell=FieldData.VarDimName{VarIndex(1)};
    10201016    if ischar(DimCell)
     
    10241020    %% case of input fields with unstructured coordinates
    10251021    coord_z=0;%default
    1026     if testX
    1027         XName=FieldData.ListVarName{ivar_X};
    1028         YName=FieldData.ListVarName{ivar_Y};
    1029         coord_x=FieldData.(XName);
    1030         coord_y=FieldData.(YName);
    1031         if length(ivar_Z)==1
    1032             ZName=FieldData.ListVarName{ivar_Z};
    1033             coord_z=FieldData.(ZName);
    1034         end
    1035        
    1036         % translate  initial coordinates
    1037         coord_x=coord_x-ObjectData.Coord(1,1);
    1038         coord_y=coord_y-ObjectData.Coord(1,2);
    1039         if ~isempty(ivar_Z)
    1040             coord_z=coord_z-ObjectData.Coord(1,3);
    1041         end
    1042        
    1043         % selection of the vectors in the projection range (3D case)
    1044         if length(ivar_Z)==1 &&  width > 0
    1045             %components of the unitiy vector normal to the projection plane
    1046             fieldZ=norm_plane(1)*coord_x + norm_plane(2)*coord_y+ norm_plane(3)*coord_z;% distance to the plane
    1047             indcut=find(abs(fieldZ) <= width);
    1048             size(indcut)
    1049             for ivar=VarIndex
    1050                 VarName=FieldData.ListVarName{ivar};
    1051                 eval(['FieldData.' VarName '=FieldData.' VarName '(indcut);'])
    1052                 % A VOIR : CAS DE VAR STRUCTUREE MAIS PAS GRILLE REGULIERE : INTERPOLER SUR GRILLE REGULIERE
    1053             end
    1054             coord_x=coord_x(indcut);
    1055             coord_y=coord_y(indcut);
    1056             coord_z=coord_z(indcut);
    1057         end
    1058        
    1059         %rotate coordinates if needed:
    1060         Psi=PlaneAngle(1);
    1061         Theta=PlaneAngle(2);
    1062         Phi=PlaneAngle(3);
    1063         if testangle && ~test90y && ~test90x;%=1 for slanted plane
    1064             coord_X=(coord_x *cos(Phi) + coord_y* sin(Phi));
    1065             coord_Y=(-coord_x *sin(Phi) + coord_y *cos(Phi))*cos(Theta);
    1066             coord_Y=coord_Y+coord_z *sin(Theta);
    1067             coord_X=(coord_X *cos(Psi) - coord_Y* sin(Psi));%A VERIFIER
    1068 
    1069             coord_Y=(coord_X *sin(Psi) + coord_Y* cos(Psi));
    1070         else
    1071             coord_X=coord_x;
    1072             coord_Y=coord_y;
    1073         end
    1074        
    1075         %restriction to the range of x and y if imposed
    1076         testin=ones(size(coord_X)); %default
    1077         testbound=0;
    1078         if testXMin
    1079             testin=testin & (coord_X >= XMin);
    1080             testbound=1;
    1081         end
    1082         if testXMax
    1083             testin=testin & (coord_X <= XMax);
    1084             testbound=1;
    1085         end
    1086         if testYMin
    1087             testin=testin & (coord_Y >= YMin);
    1088             testbound=1;
    1089         end
    1090         if testYMin
    1091             testin=testin & (coord_Y <= YMax);
    1092             testbound=1;
    1093         end
    1094         if testbound
    1095             indcut=find(testin);
    1096             for ivar=VarIndex
    1097                 VarName=FieldData.ListVarName{ivar};
    1098                 eval(['FieldData.' VarName '=FieldData.' VarName '(indcut);'])
    1099             end
    1100             coord_X=coord_X(indcut);
    1101             coord_Y=coord_Y(indcut);
     1022    if check_unstructured_coord
     1023        if ~isempty(ivar_X)% case of tps excluded. TODO similar procedure
     1024            XName=FieldData.ListVarName{ivar_X};
     1025            YName=FieldData.ListVarName{ivar_Y};
     1026            coord_x=FieldData.(XName);
     1027            coord_y=FieldData.(YName);
    11021028            if length(ivar_Z)==1
    1103                 coord_Z=coord_Z(indcut);
     1029                ZName=FieldData.ListVarName{ivar_Z};
     1030                coord_z=FieldData.(ZName);
     1031            end
     1032           
     1033            % translate  initial coordinates
     1034            coord_x=coord_x-ObjectData.Coord(1,1);
     1035            coord_y=coord_y-ObjectData.Coord(1,2);
     1036            if ~isempty(ivar_Z)
     1037                coord_z=coord_z-ObjectData.Coord(1,3);
     1038            end
     1039           
     1040            % selection of the vectors in the projection range (3D case)
     1041            if length(ivar_Z)==1 &&  width > 0
     1042                %components of the unitiy vector normal to the projection plane
     1043                fieldZ=norm_plane(1)*coord_x + norm_plane(2)*coord_y+ norm_plane(3)*coord_z;% distance to the plane
     1044                indcut=find(abs(fieldZ) <= width);
     1045                size(indcut)
     1046                for ivar=VarIndex
     1047                    VarName=FieldData.ListVarName{ivar};
     1048                    eval(['FieldData.' VarName '=FieldData.' VarName '(indcut);'])
     1049                    % A VOIR : CAS DE VAR STRUCTUREE MAIS PAS GRILLE REGULIERE : INTERPOLER SUR GRILLE REGULIERE
     1050                end
     1051                coord_x=coord_x(indcut);
     1052                coord_y=coord_y(indcut);
     1053                coord_z=coord_z(indcut);
     1054            end
     1055           
     1056            %rotate coordinates if needed:
     1057            Psi=PlaneAngle(1);
     1058            Theta=PlaneAngle(2);
     1059            Phi=PlaneAngle(3);
     1060            if testangle && ~test90y && ~test90x;%=1 for slanted plane
     1061                coord_X=(coord_x *cos(Phi) + coord_y* sin(Phi));
     1062                coord_Y=(-coord_x *sin(Phi) + coord_y *cos(Phi))*cos(Theta);
     1063                coord_Y=coord_Y+coord_z *sin(Theta);
     1064                coord_X=(coord_X *cos(Psi) - coord_Y* sin(Psi));%A VERIFIER
     1065               
     1066                coord_Y=(coord_X *sin(Psi) + coord_Y* cos(Psi));
     1067            else
     1068                coord_X=coord_x;
     1069                coord_Y=coord_y;
     1070            end
     1071           
     1072            %restriction to the range of x and y if imposed
     1073            testin=ones(size(coord_X)); %default
     1074            testbound=0;
     1075            if testXMin
     1076                testin=testin & (coord_X >= XMin);
     1077                testbound=1;
     1078            end
     1079            if testXMax
     1080                testin=testin & (coord_X <= XMax);
     1081                testbound=1;
     1082            end
     1083            if testYMin
     1084                testin=testin & (coord_Y >= YMin);
     1085                testbound=1;
     1086            end
     1087            if testYMin
     1088                testin=testin & (coord_Y <= YMax);
     1089                testbound=1;
     1090            end
     1091            if testbound
     1092                indcut=find(testin);
     1093                for ivar=VarIndex
     1094                    VarName=FieldData.ListVarName{ivar};
     1095                    eval(['FieldData.' VarName '=FieldData.' VarName '(indcut);'])
     1096                end
     1097                coord_X=coord_X(indcut);
     1098                coord_Y=coord_Y(indcut);
     1099                if length(ivar_Z)==1
     1100                    coord_Z=coord_Z(indcut);
     1101                end
    11041102            end
    11051103        end
    11061104        % different cases of projection
    1107         if isequal(ObjectData.ProjMode,'projection')
    1108             %the list of dimension
    1109             %ProjData.ListDimName=[ProjData.ListDimName FieldData.VarDimName(VarIndex(1))];%add the point index to the list of dimensions
    1110             %ProjData.DimValue=[ProjData.
    1111             %length(coord_X)];
    1112            
    1113             for ivar=VarIndex %transfer variables to the projection plane
    1114                 VarName=FieldData.ListVarName{ivar};
    1115                 if ivar==ivar_X %x coordinate
    1116                     eval(['ProjData.' VarName '=coord_X;'])
    1117                 elseif ivar==ivar_Y % y coordinate
    1118                     eval(['ProjData.' VarName '=coord_Y;'])
    1119                 elseif isempty(ivar_Z) || ivar~=ivar_Z % other variables (except Z coordinate wyhich is not reproduced)
    1120                     eval(['ProjData.' VarName '=FieldData.' VarName ';'])
    1121                 end
    1122                 if isempty(ivar_Z) || ivar~=ivar_Z
    1123                     ProjData.ListVarName=[ProjData.ListVarName VarName];
    1124                     ProjData.VarDimName=[ProjData.VarDimName DimCell];
    1125                     nbvar=nbvar+1;
    1126                     if isfield(FieldData,'VarAttribute') && length(FieldData.VarAttribute) >=ivar
    1127                         ProjData.VarAttribute{nbvar}=FieldData.VarAttribute{ivar};
    1128                     end
    1129                 end
    1130             end
    1131         elseif isequal(ObjectData.ProjMode,'interp')||isequal(ObjectData.ProjMode,'filter')%interpolate data on a regular grid
    1132             if isequal(ObjectData.ProjMode,'filter')
    1133                 rho=1000;%smoothing parameter, (small for strong smoothing)
    1134             else
    1135                 rho=0;
    1136             end
    1137             coord_x_proj=XMin:DX:XMax;
    1138             coord_y_proj=YMin:DY:YMax;
    1139             if isfield(FieldData,[VarName '_tps'])
    1140                 [XI,YI]=meshgrid(coord_x_proj,coord_y_proj');
    1141                 XI=reshape(XI,[],1);
    1142                 YI=reshape(YI,[],1);         
    1143             end
    1144             DimCell={'coord_y','coord_x'};
    1145             ProjData.ListVarName={'coord_y','coord_x'};
    1146             ProjData.VarDimName={'coord_y','coord_x'};
    1147             nbcoord=2;
    1148             ProjData.coord_y=[YMin YMax];
    1149             ProjData.coord_x=[XMin XMax];
    1150             if isempty(ivar_X), ivar_X=0; end;
    1151             if isempty(ivar_Y), ivar_Y=0; end;
    1152             if isempty(ivar_Z), ivar_Z=0; end;
    1153             if isempty(ivar_U), ivar_U=0; end;
    1154             if isempty(ivar_V), ivar_V=0; end;
    1155             if isempty(ivar_W), ivar_W=0; end;
    1156             if isempty(ivar_F), ivar_F=0; end;
    1157             if isempty(ivar_FF), ivar_FF=0; end;
    1158             if ~isequal(ivar_FF,0)
    1159                 VarName_FF=FieldData.ListVarName{ivar_FF};
    1160                 eval(['indsel=find(FieldData.' VarName_FF '==0);'])
    1161                 coord_X=coord_X(indsel);
    1162                 coord_Y=coord_Y(indsel);
    1163             end
    1164             FF=zeros(1,length(coord_y_proj)*length(coord_x_proj));
    1165             testFF=0;
    1166             FieldName
    1167             if ~isempty(FieldName)
    1168                 ProjData=calc_field(FieldName,FieldData,[XI YI]);
    1169             else
     1105        switch ObjectData.ProjMode
     1106            case 'projection'
     1107                %the list of dimension
     1108                %ProjData.ListDimName=[ProjData.ListDimName FieldData.VarDimName(VarIndex(1))];%add the point index to the list of dimensions
     1109                %ProjData.DimValue=[ProjData.
     1110                %length(coord_X)];
     1111               
     1112                for ivar=VarIndex %transfer variables to the projection plane
     1113                    VarName=FieldData.ListVarName{ivar};
     1114                    if ivar==ivar_X %x coordinate
     1115                        eval(['ProjData.' VarName '=coord_X;'])
     1116                    elseif ivar==ivar_Y % y coordinate
     1117                        eval(['ProjData.' VarName '=coord_Y;'])
     1118                    elseif isempty(ivar_Z) || ivar~=ivar_Z % other variables (except Z coordinate wyhich is not reproduced)
     1119                        eval(['ProjData.' VarName '=FieldData.' VarName ';'])
     1120                    end
     1121                    if isempty(ivar_Z) || ivar~=ivar_Z
     1122                        ProjData.ListVarName=[ProjData.ListVarName VarName];
     1123                        ProjData.VarDimName=[ProjData.VarDimName DimCell];
     1124                        nbvar=nbvar+1;
     1125                        if isfield(FieldData,'VarAttribute') && length(FieldData.VarAttribute) >=ivar
     1126                            ProjData.VarAttribute{nbvar}=FieldData.VarAttribute{ivar};
     1127                        end
     1128                    end
     1129                end
     1130            case 'interp'%interpolate data on a regular grid
     1131                coord_x_proj=XMin:DX:XMax;
     1132                coord_y_proj=YMin:DY:YMax;
     1133                DimCell={'coord_y','coord_x'};
     1134                ProjData.ListVarName={'coord_y','coord_x'};
     1135                ProjData.VarDimName={'coord_y','coord_x'};
     1136                nbcoord=2;
     1137                ProjData.coord_y=[YMin YMax];
     1138                ProjData.coord_x=[XMin XMax];
     1139                if isempty(ivar_X), ivar_X=0; end;
     1140                if isempty(ivar_Y), ivar_Y=0; end;
     1141                if isempty(ivar_Z), ivar_Z=0; end;
     1142                if isempty(ivar_U), ivar_U=0; end;
     1143                if isempty(ivar_V), ivar_V=0; end;
     1144                if isempty(ivar_W), ivar_W=0; end;
     1145                if isempty(ivar_F), ivar_F=0; end;
     1146                if isempty(ivar_FF), ivar_FF=0; end;
     1147                if ~isequal(ivar_FF,0)
     1148                    VarName_FF=FieldData.ListVarName{ivar_FF};
     1149                    eval(['indsel=find(FieldData.' VarName_FF '==0);'])
     1150                    coord_X=coord_X(indsel);
     1151                    coord_Y=coord_Y(indsel);
     1152                end
     1153               
     1154                FF=zeros(1,length(coord_y_proj)*length(coord_x_proj));
     1155                testFF=0;
    11701156                for ivar=VarIndex
    11711157                    VarName=FieldData.ListVarName{ivar};
     
    11801166                            FieldData.(VarName)=FieldData.(VarName)(indsel);
    11811167                        end
    1182                         %                     if isfield(FieldData,[VarName '_tps'])
    1183                         %                         [XI,YI]=meshgrid(coord_x_proj,coord_y_proj');
    1184                         %                         XI=reshape(XI,[],1);
    1185                         %                         YI=reshape(YI,[],1);
    1186                         %
    1187                         ProjData.(VarName)=griddata_uvmat(double(coord_X),double(coord_Y),double(FieldData.(VarName)),coord_x_proj,coord_y_proj',rho);
     1168                        ProjData.(VarName)=griddata_uvmat(double(coord_X),double(coord_Y),double(FieldData.(VarName)),coord_x_proj,coord_y_proj');
    11881169                        varline=reshape(ProjData.(VarName),1,length(coord_y_proj)*length(coord_x_proj));
    11891170                        FFlag= isnan(varline); %detect undefined values NaN
     
    12121193                    ProjData.VarAttribute{ivar_new+1+nbcoord}.Role='errorflag';
    12131194                end
    1214             end
    1215         end
    1216        
     1195            case 'filter'
     1196                if ~isempty(VarType.coord_tps)
     1197                    VarType.coord_tps
     1198                    coord_x_proj=XMin:DX:XMax;
     1199                    coord_y_proj=YMin:DY:YMax;
     1200                    np_x=numel(coord_x_proj);
     1201                    np_y=numel(coord_y_proj);
     1202                    [XI,YI]=meshgrid(coord_x_proj,coord_y_proj');
     1203                    XI=reshape(XI,[],1);
     1204                    YI=reshape(YI,[],1);
     1205                    ProjData=calc_field(FieldData.FieldList,FieldData,[XI YI]);
     1206                    for ilist=3:length(ProjData.ListVarName)% reshape data, excluding coordinates (ilist=1-2), TODO: rationalise
     1207                        VarName=ProjData.ListVarName{ilist};
     1208                        ProjData.(VarName)=reshape(ProjData.(VarName),np_y,np_x);
     1209                    end
     1210                    ProjData.coord_x=[XMin XMax];
     1211                    ProjData.coord_y=[YMin YMax];
     1212                end
     1213        end
    12171214        %% case of input fields defined on a structured  grid
    12181215    else
     
    13521349        % case with no  interpolation
    13531350        if isequal(ProjMode,'projection') && (~testangle || test90y || test90x)
    1354             if  NbDim==2 && ~testXMin && ~testXMax && ~testYMin && ~testYMax 
     1351            if  NbDim==2 && ~testXMin && ~testXMax && ~testYMin && ~testYMax
    13551352                ProjData=FieldData;% no change by projection
    13561353            else
     
    13751372                    min_indx=ceil((Coord{NbDim}(1)-XMax)/DXinit)+1;
    13761373                    max_indx=floor((Coord{NbDim}(1)-XMin)/DXinit)+1;
    1377                     Xbound(2)=Coord{NbDim}(1)+DXinit*(max_indx-1);                         
     1374                    Xbound(2)=Coord{NbDim}(1)+DXinit*(max_indx-1);
    13781375                    Xbound(1)=Coord{NbDim}(1)+DXinit*(min_indx-1);
    13791376                end
    13801377                min_indy=max(min_indy,1);% deals with margin (bound lower than the first index)
    13811378                min_indx=max(min_indx,1);
    1382 
     1379               
    13831380                if test90y
    13841381                    ind_new=[3 2 1];
    13851382                    DimCell={AYProjName,AXProjName};
    1386 %                     DimValue=DimValue(ind_new);
     1383                    %                     DimValue=DimValue(ind_new);
    13871384                    iz=ceil((ObjectData.Coord(1,1)-Coord{3}(1))/DX)+1;
    13881385                    for ivar=VarIndex
     
    16561653    ivar_F=VarType.warnflag;
    16571654    ivar_FF=VarType.errorflag;
    1658     testX=~isempty(ivar_X) && ~isempty(ivar_Y);
     1655    check_unstructured_coord=~isempty(ivar_X) && ~isempty(ivar_Y);
    16591656    DimCell=FieldData.VarDimName{VarIndex(1)};
    16601657    if ischar(DimCell)
     
    16631660
    16641661%% case of input fields with unstructured coordinates
    1665     if testX
     1662    if check_unstructured_coord
    16661663        XName=FieldData.ListVarName{ivar_X};
    16671664        YName=FieldData.ListVarName{ivar_Y};
  • trunk/src/series.m

    r398 r399  
    10541054if ~isempty(SeriesData.i2_series)||~isempty(SeriesData.j2_series)
    10551055    if isequal(mode,'series(Di)')
    1056         find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files
     1056        find_netcpair_civ(handles);% update the menu of pairs depending on the available netcdf files
    10571057    end
    10581058end
     
    10691069if ~isempty(SeriesData.i2_series)||~isempty(SeriesData.j2_series)
    10701070    if isequal(mode,'series(Di)')
    1071         find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files
     1071        find_netcpair_civ(handles);% update the menu of pairs depending on the available netcdf files
    10721072    end
    10731073end
  • trunk/src/uvmat.m

    r398 r399  
    310310        end
    311311        if isfield(input,'FieldsString')
    312 %             set(handles.Fields,'Value',1)
    313312            UvData.FieldsString=input.FieldsString;
    314313        end
     
    486485    handles_NomType=handles.NomType;
    487486    handles_FileExt=handles.FileExt;
    488     handles_Fields=handles.Fields;
     487%     handles_Fields=handles.Fields;
    489488elseif index==2
    490489    handles_RootPath=handles.RootPath_1;
     
    494493    handles_NomType=handles.NomType_1;
    495494    handles_FileExt=handles.FileExt_1;
    496     handles_Fields=handles.Fields_1;
     495%     handles_Fields=handles.Fields_1;
    497496    set(handles.RootPath_1,'Visible','on')
    498497    set(handles.RootFile_1,'Visible','on')
     
    504503
    505504%% detect root name, nomenclature and indices in the input file name:
    506 %[RootPath,SubDir]=fileparts_uvmat(fileinput);
    507505[FilePath,FileName,FileExt]=fileparts(fileinput);
    508506% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    509507% the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
    510508[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]);
    511 % if strcmp(NomType,'*')% movies will be opened at the first frame
    512 %     i1=1;
    513 %     i2=[];
    514 %     j1=[];
    515 %     j2=[];
    516 % end 
    517509
    518510%% open the file or fill the GUI uvmat according to the detected file type
     
    19641956    FieldName=[];%default
    19651957    VelType=[];%default
    1966     FileExt=get(handles.FileExt,'String');
     1958   % FileExt=get(handles.FileExt,'String');
    19671959    FileType=UvData.FileType{1};
    19681960    switch FileType
     
    22342226   UvData.Field=Field{1};
    22352227end
     2228UvData.Field.FieldList={FieldName}; % TODO: to generalise, used for proj_field with tps interpolation
    22362229
    22372230%% get bounds and mesh (needed for mouse action and to open set_object)
     
    38183811AxeData=UvData.axes3;% retrieve the current plotted data
    38193812PlotParam=read_GUI(handles.uvmat);
    3820 [PP,PlotParamOut]= plot_field(AxeData,handles.axes3,PlotParam);
     3813[tild,PlotParamOut]= plot_field(AxeData,handles.axes3,PlotParam);
    38213814write_plot_param(handles,PlotParamOut); %update the auto plot parameters
    38223815
     
    38263819%-------------------------------------------------------------------
    38273820UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    3828 test=get(handles.edit_object,'Value');
    3829 if test
     3821if get(handles.edit_object,'Value')
    38303822    set(handles.edit_object,'BackgroundColor',[1,1,0]) 
    38313823    %suppress the other options
     
    38383830        set(hhgeometry_calib.edit_append,'BackgroundColor',[0.7 0.7 0.7])
    38393831    end
     3832    hset_object=findobj(allchild(0),'Tag','set_object');
     3833    if isempty(hset_object)% open the GUI set_object with data of the currently selected object
     3834        ViewObject_Callback(hObject, eventdata, handles)
     3835        hset_object=findobj(allchild(0),'Tag','set_object');
     3836    end
     3837    hhset_object=guidata(hset_object);
     3838    set(hhset_object.PLOT,'enable','on');
    38403839else
    38413840    UvData.MouseAction='none';
    3842     set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7])   
    3843 end
    3844 set(handles.uvmat,'UserData',UvData);
    3845 hset_object=findobj(allchild(0),'Tag','set_object');
    3846 if ~isempty(hset_object)
    3847     hhset_object=guidata(hset_object);
    3848     if test
    3849         set(hhset_object.PLOT,'enable','on');
    3850     else
    3851        set(hhset_object.PLOT,'enable','off');
     3841    set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 
     3842    hset_object=findobj(allchild(0),'Tag','set_object');
     3843    if ~isempty(hset_object)% open the
     3844        hhset_object=guidata(hset_object);
     3845        set(hhset_object.PLOT,'enable','off');
    38523846    end
    38533847end
     
    45674561end
    45684562
     4563%------------------------------------------------------------------------
    45694564% --- Executes on button press in ViewObject.
    45704565function ViewObject_Callback(hObject, eventdata, handles)
     4566%------------------------------------------------------------------------
    45714567IndexObj=get(handles.ListObject,'Value');
    45724568IndexObj=IndexObj(end); %keeps only the secodn value
Note: See TracChangeset for help on using the changeset viewer.