Changeset 109 for trunk/src/proj_field.m


Ignore:
Timestamp:
Oct 4, 2010, 10:39:11 PM (14 years ago)
Author:
sommeria
Message:

merge_proj.m, proj_field.m: bugs repaired merging of images
plot_field.m: minor cleaning
imadoc2struct: introduce the possibility of readying the calibration point coordinates
sub_field.m:bugs repaired
geometry_calib, create_grid: introduction of new calibration methods, improvement of detect_grid

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r77 r109  
    1212%  .NbPix;
    1313%  .DimName=  names of the matrix dimensions (matlab cell)
    14 %  .DimValue= values of the matricx dimensions (matlab vector, same length as .DimName);
    1514%  .VarName= names of the variables [ProjData.VarName {'A','AMean','AMin','AMax'}];
    1615%  .VarDimNameIndex= dimensions of the variables, indicated by indices in the list .DimName;
     
    3433%         .ListGlobalAttribute: cell listing the names of the global attributes
    3534%        .Att_1,Att_2... : values of the global attributes
    36 %            .ListDimName: cell listing the names of the array dimensions
    37 %               .DimValue: array dimension values (Matlab vector with the same length as .ListDimName
    3835%            .ListVarName: cell listing the names of the variables
    39 %            .VarDimIndex: cell containing the set of dimension indices (in list .ListDimName) for each variable of .ListVarName
    4036%           .VarAttribute: cell of structures s containing names and values of variable attributes (s.name=value) for each variable of .ListVarName
    4137%        .Var1, .Var2....: variables (Matlab arrays) with names listed in .ListVarName
     
    391387%A REVOIR, GENERALISER: UTILISER proj_line
    392388ProjData.NbDim=1;
    393 ProjData.ListDimName={};%name of dimension
    394 ProjData.DimValue=[];%values of dimension (nbre of vectors)
     389%ProjData.ListDimName={};%name of dimension
     390%ProjData.DimValue=[];%values of dimension (nbre of vectors)
    395391ProjData.ListVarName={};
    396392%ProjData.VarDimIndex={};
     
    966962     DY=abs(ObjectData.DY);%mesh of interpolation points
    967963end
    968 if  ~isequal(ProjMode,'projection') & (DX==0|DY==0)
     964if  ~strcmp(ProjMode,'projection') && (DX==0||DY==0)
    969965        errormsg='DX or DY missing';
    970966        display(errormsg)
     
    997993ProjData=proj_heading(FieldData,ObjectData);
    998994ProjData.NbDim=2;
    999 ProjData.ListDimName={};%name of dimension
    1000 ProjData.DimValue=[];%values of dimension (nbre of vectors)
    1001995ProjData.ListVarName={};
    1002996ProjData.VarDimName={};
     
    10451039        DimCell={DimCell};%name of dimensions
    10461040    end
    1047    
     1041
    10481042%case of input fields with unstructured coordinates
    10491043    if testX
     
    11341128        if isequal(ObjectData.ProjMode,'projection')
    11351129            %the list of dimension
    1136             ProjData.ListDimName=[ProjData.ListDimName FieldData.VarDimName(VarIndex(1))];%add the point index to the list of dimensions
    1137             ProjData.DimValue=[ProjData.DimValue length(coord_X)];
     1130            %ProjData.ListDimName=[ProjData.ListDimName FieldData.VarDimName(VarIndex(1))];%add the point index to the list of dimensions
     1131            %ProjData.DimValue=[ProjData.
     1132             %length(coord_X)];
    11381133            nbvar=0;
    11391134            for ivar=VarIndex %transfer variables to the projection plane
     
    11811176            testFF=0;
    11821177            for ivar=VarIndex
    1183                 VarName=FieldData.ListVarName{ivar}; 
     1178                VarName=FieldData.ListVarName{ivar};
    11841179                if ~( ivar==ivar_X || ivar==ivar_Y || ivar==ivar_Z || ivar==ivar_F || ivar==ivar_FF || test_anc(ivar)==1)                 
    11851180                    ivar_new=ivar_new+1;
     
    12201215            end
    12211216        end
    1222 %case of fields defined on a structured  grid
     1217%case of input fields defined on a structured  grid
    12231218    else 
    1224         AYName=FieldData.ListVarName{VarType.coord(1)};
    1225         AXName=FieldData.ListVarName{VarType.coord(2)};
     1219        AYName=FieldData.ListVarName{VarType.coord(1)};%name of input x coordinate (name preserved on projection)
     1220        AXName=FieldData.ListVarName{VarType.coord(2)};%name of input y coordinate (name preserved on projection)
    12261221        eval(['AX=FieldData.' AXName ';'])
    12271222        eval(['AY=FieldData.' AYName ';'])
    1228         VarName=FieldData.ListVarName{VarIndex(1)};
    1229         eval(['DimValue=size(FieldData.' VarName ');'])
     1223        VarName=FieldData.ListVarName{VarIndex(1)};%get the first variable of the cell to get the input matrix dimensions
     1224        eval(['DimValue=size(FieldData.' VarName ');'])%input matrix dimensions
    12301225        ListDimName=FieldData.VarDimName{VarIndex(1)};
    12311226        ProjData.ListVarName=[{AYName} {AXName} ProjData.ListVarName]; %TODO: check if it already exists in Projdata (several cells)
     
    12341229        for idim=1:length(ListDimName)
    12351230            DimName=ListDimName{idim};
    1236             if isequal(DimName,'rgb')|isequal(DimName,'nb_coord')|isequal(DimName,'nb_coord_i')
     1231            if strcmp(DimName,'rgb')||strcmp(DimName,'nb_coord')||strcmp(DimName,'nb_coord_i')
    12371232               nbcolor=DimValue(idim);
    1238                DimIndices(idim)=[];
    12391233               DimValue(idim)=[];
    12401234            end
    12411235            if isequal(DimName,'nb_coord_j')% NOTE: CASE OF TENSOR NOT TREATED
    1242                 DimIndices(idim)=[];
    12431236                DimValue(idim)=[];
    12441237            end
    12451238        end 
    12461239        ind_1=find(DimValue==1);
    1247         DimIndices(ind_1)=[]; %suppress singleton dimensions
    1248 %         indxy=find(DimVarIndex(DimIndices));%select dimension variables (DimIndices non zero)
    1249         nb_dim=length(DimIndices);%number of space dimensions
    12501240        Coord_z=[];
    12511241        Coord_y=[];
    12521242        Coord_x=[];   
    1253    
     1243        nb_dim=numel(size(DimValue));
    12541244        for idim=1:nb_dim %loop on space dimensions
    12551245            test_interp(idim)=0;%test for coordiate interpolation (non regular grid), =0 by default
    1256             test_coord(idim)=0;%test for defined coordinates, =0 by default
    1257             ivar=DimVarIndex(DimIndices(idim));% index of the variable corresponding to the current dimension
    1258             if ~isequal(ivar,0)%  a variable corresponds to the current dimension
    1259                 eval(['Coord{idim}=FieldData.' FieldData.ListVarName{ivar} ';']) ;% position for the first index
    1260                 DCoord=diff(Coord{idim});
    1261                 DCoord_min(idim)=min(DCoord);
    1262                 DCoord_max=max(DCoord);
    1263                 test_direct(idim)=DCoord_max>0;% =1 for increasing values, 0 otherwise
    1264                 test_direct_min=DCoord_min(idim)>0;% =1 for increasing values, 0 otherwise
    1265                 if ~isequal(test_direct(idim),test_direct_min)
    1266                      msgbox_uvmat('ERROR',['non monotonic dimension variable # ' num2str(idim)  ' in proj_field.m'])
     1246            ivar=VarType.coord(idim);% index of the variable corresponding to the current dimension
     1247            if ~isequal(ivar,0)%  a variable corresponds to the dimension #idim
     1248                eval(['Coord{idim}=FieldData.' FieldData.ListVarName{ivar} ';']) ;% coord values for the input field
     1249                if numel(Coord{idim})==2 %input array defined on a regular grid
     1250                   DCoord_min(idim)=(Coord{idim}(2)-Coord{idim}(1))/DimValue(idim);
     1251                else
     1252                    DCoord=diff(Coord{idim});%array of coordinate derivatives for the input field
     1253                    DCoord_min(idim)=min(DCoord);
     1254                    DCoord_max=max(DCoord);
     1255                %    test_direct(idim)=DCoord_max>0;% =1 for increasing values, 0 otherwise
     1256                    if ~isequal(DCoord_max,DCoord_min(idim)>0)
     1257                        msgbox_uvmat('ERROR',['non monotonic dimension variable # ' num2str(idim)  ' in proj_field.m'])
    12671258                                return
    1268                 end               
    1269                 test_interp(idim)=(DCoord_max-DCoord_min(idim))> 0.0001*abs(DCoord_max);% test grid regularity
    1270                 test_coord(idim)=1;
    1271 
    1272             else  % no variable associated with the first dimension, look for variable  attributes Coord_1, _2 or _3
     1259                    end               
     1260                    test_interp(idim)=(DCoord_max-DCoord_min(idim))> 0.0001*abs(DCoord_max);% test grid regularity
     1261                end
     1262                test_direct(idim)=(DCoord_min(idim)>0);
     1263            else  % no variable associated with the  dimension #idim, the coordinate value is set equal to the matrix index by default
    12731264                Coord_i_str=['Coord_' num2str(idim)];
    12741265                DCoord_min(idim)=1;%default
     
    12771268            end
    12781269        end
    1279         if nb_dim==2
    1280             if DY==0
    1281                 DY=abs(DCoord_min(1));
    1282             end
    1283             npY=1+round(abs(Coord{1}(end)-Coord{1}(1))/DY);%nbre of points after interpolation
    1284             npy=1+round(abs(Coord{1}(end)-Coord{1}(1))/abs(DCoord_min(1)));%nbre of points after possible interpolation on a regular grid
    1285             if DX==0
    1286                 DX=abs(DCoord_min(2));
    1287             end
    1288             npX=1+round(abs(Coord{2}(end)-Coord{2}(1))/DX);%nbre of points after interpol 
    1289             npx=1+round(abs(Coord{2}(end)-Coord{2}(1))/abs(DCoord_min(2)));%nbre of points after possible interpolation on a regular grid
    1290             Coord_y=linspace(Coord{1}(1),Coord{1}(end),npY);
    1291             test_direct_y=test_direct(1);
    1292             Coord_x=linspace(Coord{2}(1),Coord{2}(end),npX);
    1293             test_direct_x=test_direct(2);
    1294             DAX=DCoord_min(2);
    1295             DAY=DCoord_min(1);
    1296         elseif nb_dim==3
     1270        if DY==0
     1271            DY=abs(DCoord_min(nb_dim-1));
     1272        end
     1273        npY=1+round(abs(Coord{nb_dim-1}(end)-Coord{nb_dim-1}(1))/DY);%nbre of points after interpol
     1274        if DX==0
     1275            DX=abs(DCoord_min(nb_dim));
     1276        end
     1277        npX=1+round(abs(Coord{nb_dim}(end)-Coord{nb_dim}(1))/DX);%nbre of points after interpol
     1278        for idim=[1:nb_dim]
     1279            if test_interp(idim)
     1280                DimValue(idim)=1+round(abs(Coord{idim}(end)-Coord{idim}(1))/abs(DCoord_min(idim)));%nbre of points after possible interpolation on a regular gri
     1281            end
     1282        end       
     1283        Coord_y=linspace(Coord{nb_dim-1}(1),Coord{nb_dim-1}(end),npY);
     1284        test_direct_y=test_direct(nb_dim-1);
     1285        Coord_x=linspace(Coord{nb_dim}(1),Coord{nb_dim}(end),npX);
     1286        test_direct_x=test_direct(nb_dim);
     1287        DAX=DCoord_min(nb_dim);
     1288        DAY=DCoord_min(nb_dim-1);
     1289        if nb_dim==3
    12971290            DZ=abs(DCoord_min(1));
    1298             npz=1+round(abs(Coord{1}(end)-Coord{1}(1))/DZ);%nbre of points after interpolation
    1299             if DY==0
    1300                 DY=abs(DCoord_min(2));
    1301             end
    1302             npY=1+round(abs(Coord{2}(end)-Coord{2}(1))/DY);%nbre of points after interpol
    1303             npy=1+round(abs(Coord{2}(end)-Coord{2}(1))/abs(DCoord_min(2)));%nbre of points before interpol
    1304             if DX==0
    1305                 DX=abs(DCoord_min(3));
    1306             end
    1307             npX=1+round(abs(Coord{3}(end)-Coord{3}(1))/DX);%nbre of points after interpol
    1308             npx=1+round(abs(Coord{3}(end)-Coord{3}(1))/abs(DCoord_min(3)));%nbre of points before interpol
    13091291            Coord_z=linspace(Coord{1}(1),Coord{1}(end),npz);
    13101292            test_direct_z=test_direct(1);
    1311             Coord_y=linspace(Coord{2}(1),Coord{2}(end),npY);
    1312             test_direct_y=test_direct(2);
    1313             Coord_x=linspace(Coord{3}(1),Coord{3}(end),npX);
    1314             test_direct_x=test_direct(3);
    13151293        end 
    13161294        minAX=min(Coord_x);
     
    13341312            YMin=min(ycor_new);
    13351313        end
    1336         DXinit=(maxAX-minAX)/(npx-1);
    1337         DYinit=(maxAY-minAY)/(npy-1);
     1314        DXinit=(maxAX-minAX)/(DimValue(2)-1);
     1315        DYinit=(maxAY-minAY)/(DimValue(1)-1);
    13381316        if DX==0
    13391317            DX=DXinit;
     
    13431321        end
    13441322        npX=floor((XMax-XMin)/DX+1);
    1345         npY=floor((YMax-YMin)/DY+1);    
     1323        npY=floor((YMax-YMin)/DY+1);   
    13461324        if test_direct_y
    13471325            coord_y_proj=linspace(YMin,YMax,npY);%abscissa of the new pixels along the line
     
    13811359            min_ind1=max(min_ind1,1);% deals with margin (bound lower than the first index)
    13821360            min_ind2=max(min_ind2,1);
    1383             max_ind1=min(max_ind1,npy);
    1384             max_ind2=min(max_ind2,npx);
     1361            max_ind1=min(max_ind1,DimValue(1));
     1362            max_ind2=min(max_ind2,DimValue(2));
    13851363            for ivar=VarIndex
    13861364                VarName=FieldData.ListVarName{ivar};
    13871365                ProjData.ListVarName=[ProjData.ListVarName VarName];
    1388                 ProjData.VarDimIndex=[ProjData.VarDimIndex [nb_dim-1 nb_dim]];
     1366                ProjData.VarDimName=[ProjData.VarDimName {DimCell}];
    13891367                if length(FieldData.VarAttribute)>=ivar
    13901368                    ProjData.VarAttribute{length(ProjData.ListVarName)}=FieldData.VarAttribute{ivar};
     
    13921370                eval(['ProjData.' VarName '=FieldData.' VarName '(min_ind1:max_ind1,min_ind2:max_ind2) ;']);
    13931371            end         
    1394         else
    1395         % case with rotation and/or interpolation
     1372        else       % case with rotation and/or interpolation
    13961373            if isempty(Coord_z) %2D case
    13971374                [X,Y]=meshgrid(coord_x_proj,coord_y_proj);%grid in the new coordinates
     
    14021379                XIMA=reshape(round(XIMA),1,npX*npY);%indices reorganized in 'line'
    14031380                YIMA=reshape(round(YIMA),1,npX*npY);
    1404                 flagin=XIMA>=1 & XIMA<=npx & YIMA >=1 & YIMA<=npy;%flagin=1 inside the original image
     1381                flagin=XIMA>=1 & XIMA<=DimValue(2) & YIMA >=1 & YIMA<=DimValue(1);%flagin=1 inside the original image
    14051382                if isequal(ObjectData.ProjMode,'filter')
    14061383                    npx_filter=ceil(abs(DX/DAX));
     
    14111388                    test_filter=0;
    14121389                end
     1390                eval(['ProjData.' AYName '=[coord_y_proj(1) coord_y_proj(end)];']) %record the new (projected ) y coordinates
     1391                eval(['ProjData.' AXName '=[coord_x_proj(1) coord_x_proj(end)];']) %record the new (projected ) x coordinates
    14131392                for ivar=VarIndex
    1414                     VarName=FieldData.ListVarName{ivar} ;
    1415                     if test_interp(1) | test_interp(2)%interpolate on a regular grid        
    1416                           eval(['FieldData.' VarName '=interp2(Coord{2},Coord{1},FieldData.' VarName ',Coord_x,Coord_y'');']) %TO TEST
     1393                    VarName=FieldData.ListVarName{ivar};
     1394                    if test_interp(1) || test_interp(2)%interpolate on a regular grid       
     1395                          eval(['ProjData.' VarName '=interp2(Coord{2},Coord{1},FieldData.' VarName ',Coord_x,Coord_y'');']) %TO TEST
    14171396                    end
    14181397                    %filter the field (image) if option 'filter' is used
    14191398                    if test_filter 
    14201399                         Aclass=class(FieldData.A);
    1421                          eval(['FieldData.' VarName '=filter2(Mfilter,FieldData.' VarName ',''valid'');'])
     1400                         eval(['ProjData.' VarName '=filter2(Mfilter,FieldData.' VarName ',''valid'');'])
    14221401                         if ~isequal(Aclass,'double')
    1423                              eval(['FieldData.' VarName '=' Aclass '(FieldData.' VarName ');'])%revert to integer values
     1402                             eval(['ProjData.' VarName '=' Aclass '(FieldData.' VarName ');'])%revert to integer values
    14241403                         end
    14251404                    end
    1426                     eval(['vec_A=reshape(FieldData.' VarName ',npx*npy,nbcolor);'])%put the original image in line             
     1405                    eval(['vec_A=reshape(FieldData.' VarName ',[],nbcolor);'])%put the original image in line             
    14271406                    ind_in=find(flagin);
    14281407                    ind_out=find(~flagin);
    1429                     ICOMB=(XIMA-1)*npy+YIMA;
     1408                    ICOMB=(XIMA-1)*DimValue(1)+YIMA;
    14301409                    ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A
    14311410                    vec_B(ind_in,[1:nbcolor])=vec_A(ICOMB,:);
     
    14331412                        vec_B(ind_out,icolor)=zeros(size(ind_out));
    14341413                    end
    1435                     ProjData.ListVarName=[ProjData.ListVarName VarName];                 
    1436                     if length(FieldData.VarAttribute)>=ivar
     1414                    ProjData.ListVarName=[ProjData.ListVarName VarName];
     1415                    ProjData.VarDimName=[ProjData.VarDimName {DimCell}];
     1416                    if isfield(FieldData,'VarAttribute')&&length(FieldData.VarAttribute)>=ivar
    14371417                        ProjData.VarAttribute{length(ProjData.ListVarName)+nbcoord}=FieldData.VarAttribute{ivar};
    14381418                    end     
     
    14411421                ProjData.FF=reshape(~flagin,npY,npX);%false flag A FAIRE: tenir compte d'un flga antérieur 
    14421422                ProjData.ListVarName=[ProjData.ListVarName 'FF'];
     1423                ProjData.VarDimName=[ProjData.VarDimName {DimCell}];
    14431424                ProjData.VarAttribute{length(ProjData.ListVarName)}.Role='errorflag';
    14441425            else %3D case
     
    14481429                    iz=iz_sup(1);
    14491430                    if iz>=1 & iz<=npz
    1450                         ProjData.ListDimName=[ProjData.ListDimName ListDimName(2:end)];
    1451                         ProjData.DimValue=[ProjData.DimValue npY npX];
     1431                        %ProjData.ListDimName=[ProjData.ListDimName ListDimName(2:end)];
     1432                        %ProjData.DimValue=[ProjData.DimValue npY npX];
    14521433                        for ivar=VarIndex
    14531434                            VarName=FieldData.ListVarName{ivar};
     
    15821563ProjData=proj_heading(FieldData,ObjectData);
    15831564ProjData.NbDim=3;
    1584 ProjData.ListDimName={};%name of dimension
    1585 ProjData.DimValue=[];%values of dimension (nbre of vectors)
     1565%ProjData.ListDimName={};%name of dimension
     1566%ProjData.DimValue=[];%values of dimension (nbre of vectors)
    15861567ProjData.ListVarName={};
    15871568ProjData.VarDimName={};
     
    17171698        if isequal(ObjectData.ProjMode,'projection')
    17181699            %the list of dimension
    1719             ProjData.ListDimName=[ProjData.ListDimName FieldData.VarDimName(VarIndex(1))];%add the point index to the list of dimensions
    1720             ProjData.DimValue=[ProjData.DimValue length(coord_X)];
     1700            %ProjData.ListDimName=[ProjData.ListDimName FieldData.VarDimName(VarIndex(1))];%add the point index to the list of dimensions
     1701            %ProjData.DimValue=[ProjData.DimValue length(coord_X)];
    17211702            nbvar=0;
    17221703            for ivar=VarIndex %transfer variables to the projection plane
     
    18431824        for idim=1:nb_dim %loop on space dimensions
    18441825            test_interp(idim)=0;%test for coordiate interpolation (non regular grid), =0 by default
    1845             test_coord(idim)=0;%test for defined coordinates, =0 by default
    18461826            ivar=DimVarIndex(DimIndices(idim));% index of the variable corresponding to the current dimension
    18471827            if ~isequal(ivar,0)%  a variable corresponds to the current dimension
     
    18571837                end               
    18581838                test_interp(idim)=(DCoord_max-DCoord_min(idim))> 0.0001*abs(DCoord_max);% test grid regularity
    1859                 test_coord(idim)=1;
    1860 
    18611839            else  % no variable associated with the first dimension, look for variable  attributes Coord_1, _2 or _3
    18621840                Coord_i_str=['Coord_' num2str(idim)];
     
    18711849            end
    18721850            npY=1+round(abs(Coord{1}(end)-Coord{1}(1))/DY);%nbre of points after interpolation
    1873             npy=1+round(abs(Coord{1}(end)-Coord{1}(1))/abs(DCoord_min(1)));%nbre of points after possible interpolation on a regular grid
     1851            DimValue(1)=1+round(abs(Coord{1}(end)-Coord{1}(1))/abs(DCoord_min(1)));%nbre of points after possible interpolation on a regular grid
    18741852            if DX==0
    18751853                DX=abs(DCoord_min(2));
    18761854            end
    18771855            npX=1+round(abs(Coord{2}(end)-Coord{2}(1))/DX);%nbre of points after interpol 
    1878             npx=1+round(abs(Coord{2}(end)-Coord{2}(1))/abs(DCoord_min(2)));%nbre of points after possible interpolation on a regular grid
     1856            DimValue(2)=1+round(abs(Coord{2}(end)-Coord{2}(1))/abs(DCoord_min(2)));%nbre of points after possible interpolation on a regular grid
    18791857            Coord_y=linspace(Coord{1}(1),Coord{1}(end),npY);
    18801858            test_direct_y=test_direct(1);
     
    18901868            end
    18911869            npY=1+round(abs(Coord{2}(end)-Coord{2}(1))/DY);%nbre of points after interpol
    1892             npy=1+round(abs(Coord{2}(end)-Coord{2}(1))/abs(DCoord_min(2)));%nbre of points before interpol
     1870            DimValue(1)=1+round(abs(Coord{2}(end)-Coord{2}(1))/abs(DCoord_min(2)));%nbre of points before interpol
    18931871            if DX==0
    18941872                DX=abs(DCoord_min(3));
    18951873            end
    18961874            npX=1+round(abs(Coord{3}(end)-Coord{3}(1))/DX);%nbre of points after interpol
    1897             npx=1+round(abs(Coord{3}(end)-Coord{3}(1))/abs(DCoord_min(3)));%nbre of points before interpol
     1875            DimValue(2)=1+round(abs(Coord{3}(end)-Coord{3}(1))/abs(DCoord_min(3)));%nbre of points before interpol
    18981876            Coord_z=linspace(Coord{1}(1),Coord{1}(end),npz);
    18991877            test_direct_z=test_direct(1);
     
    19231901            YMin=min(ycor_new);
    19241902        end
    1925         DXinit=(maxAX-minAX)/(npx-1);
    1926         DYinit=(maxAY-minAY)/(npy-1);
     1903        DXinit=(maxAX-minAX)/(DimValue(2)-1);
     1904        DYinit=(maxAY-minAY)/(DimValue(1)-1);
    19271905        if DX==0
    19281906            DX=DXinit;
     
    19701948            min_ind1=max(min_ind1,1);% deals with margin (bound lower than the first index)
    19711949            min_ind2=max(min_ind2,1);
    1972             max_ind1=min(max_ind1,npy);
    1973             max_ind2=min(max_ind2,npx);
     1950            max_ind1=min(max_ind1,DimValue(1));
     1951            max_ind2=min(max_ind2,DimValue(2));
    19741952            for ivar=VarIndex
    19751953                VarName=FieldData.ListVarName{ivar};
    19761954                ProjData.ListVarName=[ProjData.ListVarName VarName];
    1977                 ProjData.VarDimIndex=[ProjData.VarDimIndex [nb_dim-1 nb_dim]];
     1955                %ProjData.VarDimIndex=[ProjData.VarDimIndex [nb_dim-1 nb_dim]];
    19781956                if length(FieldData.VarAttribute)>=ivar
    19791957                    ProjData.VarAttribute{length(ProjData.ListVarName)}=FieldData.VarAttribute{ivar};
     
    19911969                XIMA=reshape(round(XIMA),1,npX*npY);%indices reorganized in 'line'
    19921970                YIMA=reshape(round(YIMA),1,npX*npY);
    1993                 flagin=XIMA>=1 & XIMA<=npx & YIMA >=1 & YIMA<=npy;%flagin=1 inside the original image
     1971                flagin=XIMA>=1 & XIMA<=DimValue(2) & YIMA >=1 & YIMA<=DimValue(1);%flagin=1 inside the original image
    19941972                if isequal(ObjectData.ProjMode,'filter')
    19951973                    npx_filter=ceil(abs(DX/DAX));
     
    20131991                         end
    20141992                    end
    2015                     eval(['vec_A=reshape(FieldData.' VarName ',npx*npy,nbcolor);'])%put the original image in line             
     1993                    eval(['vec_A=reshape(FieldData.' VarName ',[],nbcolor);'])%put the original image in line             
    20161994                    ind_in=find(flagin);
    20171995                    ind_out=find(~flagin);
    2018                     ICOMB=(XIMA-1)*npy+YIMA;
     1996                    ICOMB=(XIMA-1)*DimValue(1)+YIMA;
    20191997                    ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A
    20201998                    vec_B(ind_in,[1:nbcolor])=vec_A(ICOMB,:);
     
    20372015                    iz=iz_sup(1);
    20382016                    if iz>=1 & iz<=npz
    2039                         ProjData.ListDimName=[ProjData.ListDimName ListDimName(2:end)];
    2040                         ProjData.DimValue=[ProjData.DimValue npY npX];
     2017                        %ProjData.ListDimName=[ProjData.ListDimName ListDimName(2:end)];
     2018                        %ProjData.DimValue=[ProjData.DimValue npY npX];
    20412019                        for ivar=VarIndex
    20422020                            VarName=FieldData.ListVarName{ivar};
Note: See TracChangeset for help on using the changeset viewer.