Changeset 654 for trunk/src/proj_field.m


Ignore:
Timestamp:
Jun 30, 2013, 11:16:45 PM (10 years ago)
Author:
sommeria
Message:

various bugs corrected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r653 r654  
    893893    norm_plane(3)=OmAxis(3)*coeff+cos_om;
    894894end
    895 testangle=~isequal(PlaneAngle,[0 0 0]);% && ~test90y && ~test90x;%=1 for slanted plane
     895testangle=~isequal(PlaneAngle,[0 0 0])||~isequal(ObjectData.Coord(1:2),[0 0 ]) ;% && ~test90y && ~test90x;%=1 for slanted plane
    896896
    897897%% mesh sizes DX and DY
     
    984984%% group the variables (fields of 'FieldData') in cells of variables with the same dimensions
    985985[CellInfo,NbDimArray,errormsg]=find_field_cells(FieldData);
     986
    986987if ~isempty(errormsg)
    987988    errormsg=['error in proj_field/proj_plane:' errormsg];
    988989    return
    989990end
    990 
    991 %% projection modes
    992 check_grid=0;
     991check_grid=zeros(size(CellInfo));% =1 if a grid is needed , =0 otherwise, for each field cell
     992
    993993ProjMode=cell(size(CellInfo));
    994 for icell=1:numel(CellInfo)% TODO: recalculate coordinates here to get the bounds in the rotated coordinates
    995     ProjMode{icell}=ObjectData.ProjMode;
    996     if isfield(CellInfo{icell},'ProjModeRequest')
    997         switch CellInfo{icell}.ProjModeRequest
    998             case 'interp_lin'
    999                 ProjMode{icell}='interp_lin';
    1000             case 'interp_tps'
    1001                 ProjMode{icell}='interp_tps';
    1002         end
    1003     end
    1004     if strcmp(ProjMode{icell},'interp_lin')||strcmp(ProjMode{icell},'interp_tps')
    1005         check_grid=1;
    1006     end
    1007 end
    1008 
    1009 %% define the new coordinates in case of interpolation on a grid
    1010 if check_grid
    1011     AYName='coord_y';
    1012     AXName='coord_x';
    1013     ProjData.ListVarName={'coord_y','coord_x'};
    1014     ProjData.VarDimName={'coord_y','coord_x'};
    1015     ProjData.VarAttribute={[],[]};
     994for icell=1:numel(CellInfo)
     995    ProjMode{icell}=ObjectData.ProjMode;% projection mode of the plane object
     996end
     997    icell_grid=[];% field cell index which defines the grid
     998if ~strcmp(ObjectData.ProjMode,'projection')
     999    %% define the new coordinates in case of interpolation on a imposed grid
    10161000    if ~testYMin
    10171001        errormsg='min Y value not defined for the projection grid';return
     
    10261010        errormsg='max X value not defined for the projection grid';return
    10271011    end
    1028     ProjData.coord_y=[YMin YMax];%note that if projection is done on a grid, the Min and Max along each direction must have been defined
    1029     ProjData.coord_x=[XMin XMax];
    1030     coord_x_proj=XMin:DX:XMax;
    1031     coord_y_proj=YMin:DY:YMax;
    1032     [X,YI]=meshgrid(coord_x_proj,coord_y_proj);%grid in the new coordinates
    1033     XI=ObjectData.Coord(1,1)+(X)*cos(PlaneAngle(3))-YI*sin(PlaneAngle(3));%corresponding coordinates in the original system
    1034     YI=ObjectData.Coord(1,2)+(X)*sin(PlaneAngle(3))+YI*cos(PlaneAngle(3));
    1035 end
    1036 
     1012else
     1013    %% case of a grid requested by the input field
     1014
     1015    for icell=1:numel(CellInfo)% TODO: recalculate coordinates here to get the bounds in the rotated coordinates
     1016        if isfield(CellInfo{icell},'ProjModeRequest')
     1017            switch CellInfo{icell}.ProjModeRequest
     1018                case 'interp_lin'
     1019                    ProjMode{icell}='interp_lin';
     1020                case 'interp_tps'
     1021                    ProjMode{icell}='interp_tps';
     1022            end
     1023        end
     1024        if strcmp(ProjMode{icell},'interp_lin')||strcmp(ProjMode{icell},'interp_tps')
     1025            check_grid(icell)=1;
     1026        end
     1027        if strcmp(CellInfo{icell}.CoordType,'grid')&&NbDimArray(icell)>=2
     1028            if ~testangle && isempty(icell_grid)% if the input gridded data is not modified, choose the first one in case of multiple gridded field cells
     1029                icell_grid=icell;
     1030                ProjMode{icell}='projection';
     1031            end
     1032            check_grid(icell)=1;
     1033        end
     1034    end
     1035    if ~isempty(find(check_grid))% if a grid is requested by the input field
     1036        if isempty(icell_grid)%  if the grid is not given by cell #icell_grid
     1037            if ~isfield(FieldData,'XMax')
     1038                FieldData=find_field_bounds(FieldData);
     1039%             CellIndex=find(check_grid);
     1040%             for igrid=1:numel(CellIndex)
     1041%                 icell=CellIndex(igrid);% TODO: recalculate coordinates here to get the bounds in the rotated coordinates
     1042%                 NbDim=NbDimArray(icell);
     1043%                 for idim=1:NbDim %loop on space dimensions
     1044%                     ivar=CellInfo{icell}.CoordIndex(idim);% index of the variable corresponding to the current dimension
     1045%                     Coord{idim}=FieldData.(FieldData.ListVarName{ivar});% coord values for the input field
     1046%                     if ~isequal(ivar,0)%  a variable corresponds to the dimension #idim
     1047%                         
     1048%                         
     1049%                         
     1050%                     else
     1051%                                                     Coord_i_str=['Coord_' num2str(idim)];
     1052%                             DCoord_min(idim)=1;%default
     1053%                             Coord{idim}=[0.5 DimValue(idim)-0.5];
     1054%                             test_direct(idim)=1;
     1055%                     end
     1056%                 % default bounds, case of gridded data
     1057%                 if strcmp(CellInfo{icell}.CoordType,'grid')
     1058%                     % find default mesh
     1059%                     for idim=1:NbDim %loop on space dimensions
     1060%                         test_interp(idim)=0;%test for coordiate interpolation (non regular grid), =0 by default
     1061%                         ivar=CellInfo{icell}.CoordIndex(idim);% index of the variable corresponding to the current dimension
     1062%                         DimValue=size(FieldData.(FieldData.ListVarName{ivar}));
     1063%                         if ~isequal(ivar,0)%  a variable corresponds to the dimension #idim
     1064%                             Coord{idim}=FieldData.(FieldData.ListVarName{ivar});% coord values for the input field
     1065%                             if numel(Coord{idim})==2 %input array defined on a regular grid
     1066%                                 DCoord_min(idim)=(Coord{idim}(2)-Coord{idim}(1))/DimValue(idim);
     1067%                                 Coord{idim}=linspace(Coord{idim}(1),Coord{idim}(2),DimValue(idim));
     1068%                             else
     1069%                                 DCoord=diff(Coord{idim});%array of coordinate derivatives for the input field
     1070%                                 DCoord_min(idim)=min(DCoord);
     1071%                                 DCoord_max=max(DCoord);
     1072%                                 if abs(DCoord_max-DCoord_min(idim))>abs(DCoord_max/1000)
     1073%                                     msgbox_uvmat('ERROR',['non monotonic dimension variable # ' num2str(idim)  ' in proj_field.m'])
     1074%                                     return
     1075%                                 end
     1076%                                 test_interp(idim)=(DCoord_max-DCoord_min(idim))> 0.0001*abs(DCoord_max);% test grid regularity
     1077%                             end
     1078%                             test_direct(idim)=(DCoord_min(idim)>0);
     1079%                         else  % no variable associated with the  dimension #idim, the coordinate value is set equal to the matrix index by default
     1080% %                             Coord_i_str=['Coord_' num2str(idim)];
     1081% %                             DCoord_min(idim)=1;%default
     1082% %                             Coord{idim}=[0.5 DimValue(idim)-0.5];
     1083% %                             test_direct(idim)=1;
     1084%                         end
     1085%                     end
     1086%                     if isempty(DY)
     1087%                         DY=abs(DCoord_min(NbDim-1));
     1088%                     end
     1089%                     npY=1+round(abs(Coord{NbDim-1}(end)-Coord{NbDim-1}(1))/DY);%nbre of points after interpol
     1090%                     if isempty(DX)
     1091%                         DX=abs(DCoord_min(NbDim));
     1092%                     end
     1093%                     npX=1+round(abs(Coord{NbDim}(end)-Coord{NbDim}(1))/DX);%nbre of points after interpol
     1094%                     for idim=1:NbDim
     1095%                         if test_interp(idim)
     1096%                             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
     1097%                         end
     1098%                     end
     1099%                     Coord_y=linspace(Coord{NbDim-1}(1),Coord{NbDim-1}(end),npY);
     1100%                     test_direct_y=test_direct(NbDim-1);
     1101%                     Coord_x=linspace(Coord{NbDim}(1),Coord{NbDim}(end),npX);
     1102%                     test_direct_x=test_direct(NbDim);
     1103%                     DAX=DCoord_min(NbDim);
     1104%                     DAY=DCoord_min(NbDim-1);
     1105%                     minAX=min(Coord_x);
     1106%                     maxAX=max(Coord_x);
     1107%                     minAY=min(Coord_y);
     1108%                     maxAY=max(Coord_y);
     1109%                     xcorner=[minAX maxAX minAX maxAX]-ObjectData.Coord(1,1);% image corners in the new coordiantes
     1110%                     ycorner=[maxAY maxAY minAY minAY]-ObjectData.Coord(1,2);
     1111%                     xcor_new=xcorner*cos_om+ycorner*sin_om;%coord new frame
     1112%                     ycor_new=-xcorner*sin_om+ycorner*cos_om;
     1113%                     if ~testXMax
     1114%                         XMax(igrid)=max(xcor_new);
     1115%                     end
     1116%                     if ~testXMin
     1117%                         XMin(igrid)=min(xcor_new);
     1118%                     end
     1119%                     if ~testYMax
     1120%                         YMax(igrid)=max(ycor_new);
     1121%                     end
     1122%                     if ~testYMin
     1123%                         YMin(igrid)=min(ycor_new);
     1124%                     end
     1125%                     DX(igrid)=(maxAX-minAX)/(DimValue(NbDim)-1);
     1126%                     DY(igrid)=(maxAY-minAY)/(DimValue(NbDim-1)-1);
     1127%                     if NbDim==3
     1128%                         DZ(igrid)=(Coord{1}(end)-Coord{1}(1))/(DimValue(1)-1);
     1129%                         if ~test_direct(1)
     1130%                             DZ=-DZ;
     1131%                         end
     1132%                         Coord_z=linspace(Coord{1}(1),Coord{1}(end),DimValue(1));
     1133%                         test_direct_z=test_direct(1);
     1134%                     end
     1135%                 else
     1136%                     
     1137%                 end
     1138%                 YMax=max(YMax);
     1139%                 YMin=min(YMin);
     1140%                 XMax=max(XMax);
     1141%                 XMin=min(XMin);
     1142            end
     1143        end
     1144    end
     1145end
     1146if ~isempty(find(check_grid))||~strcmp(ObjectData.ProjMode,'projection')%no existing gridded data used
     1147    if isempty(icell_grid)||~strcmp(ObjectData.ProjMode,'projection')%no existing gridded data used
     1148        AYName='coord_y';
     1149        AXName='coord_x';
     1150        if ~strcmp(ObjectData.ProjMode,'projection')
     1151            ProjData.coord_y=[ObjectData.RangeY(1) ObjectData.RangeY(2)];%note that if projection is done on a grid, the Min and Max along each direction must have been defined
     1152        ProjData.coord_x=[ObjectData.RangeX(1) ObjectData.RangeX(2)];
     1153        coord_x_proj=ObjectData.RangeX(1):ObjectData.DX:ObjectData.RangeX(2);
     1154        coord_y_proj=ObjectData.RangeY(1):ObjectData.DY:ObjectData.RangeY(2);
     1155        else
     1156        ProjData.coord_y=[FieldData.YMin FieldData.YMax];%note that if projection is done on a grid, the Min and Max along each direction must have been defined
     1157        ProjData.coord_x=[FieldData.XMin FieldData.XMax];
     1158        coord_x_proj=FieldData.XMin:FieldData.CoordMesh:FieldData.XMax;
     1159        coord_y_proj=FieldData.YMin:FieldData.CoordMesh:FieldData.YMax;
     1160        end
     1161        [X,YI]=meshgrid(coord_x_proj,coord_y_proj);%grid in the new coordinates
     1162        XI=ObjectData.Coord(1,1)+(X)*cos(PlaneAngle(3))-YI*sin(PlaneAngle(3));%corresponding coordinates in the original system
     1163        YI=ObjectData.Coord(1,2)+(X)*sin(PlaneAngle(3))+YI*cos(PlaneAngle(3));
     1164    else% we use the existing grid from field cell #icell_grid
     1165        NbDim=NbDimArray(icell_grid);
     1166        AYName=FieldData.ListVarName{CellInfo{icell_grid}.CoordIndex(NbDim-1)};%name of input x coordinate (name preserved on projection)
     1167        AXName=FieldData.ListVarName{CellInfo{icell_grid}.CoordIndex(NbDim)};%name of input y coordinate (name preserved on projection)
     1168        ProjData.(AYName)=FieldData.(AYName); % new (projected ) y coordinates
     1169        ProjData.(AXName)=FieldData.(AXName); % new (projected ) y coordinates
     1170    end
     1171            ProjData.ListVarName={AYName,AXName};
     1172        ProjData.VarDimName={AYName,AXName};
     1173        ProjData.VarAttribute={[],[]};
     1174end
     1175   
    10371176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1038 % LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS
     1177% LOOP ON FIELD CELLS, PROJECT VARIABLES
    10391178% CellVarIndex=cells of variable index arrays
    10401179%ivar_new=0; % index of the current variable in the projected field
     
    10501189    end
    10511190    VarIndex=CellInfo{icell}.VarIndex;%  indices of the selected variables in the list FieldData.ListVarName
    1052 %     ivar_U=[];ivar_V=[];ivar_W=[];
    1053 %     if isfield(CellInfo{icell},'VarIndex_vector_x_tps')&&isfield(CellInfo{icell},'VarIndex_vector_y_tps')
    1054 %         ivar_U=CellInfo{icell}.VarIndex_vector_x_tps;
    1055 %         ivar_V=CellInfo{icell}.VarIndex_vector_y_tps;
    1056 %     elseif isfield(CellInfo{icell},'VarIndex_vector_x')&&isfield(CellInfo{icell},'VarIndex_vector_y')
    1057 %         ivar_U=CellInfo{icell}.VarIndex_vector_x;
    1058 %         ivar_V=CellInfo{icell}.VarIndex_vector_y;
    1059 %     end
    1060 %     if isfield(CellInfo{icell},'VarIndex_vector_z')
    1061 %         ivar_W=CellInfo{icell}.VarIndex_vector_z;
    1062 %     end
     1191    %     ivar_U=[];ivar_V=[];ivar_W=[];
     1192    %     if isfield(CellInfo{icell},'VarIndex_vector_x_tps')&&isfield(CellInfo{icell},'VarIndex_vector_y_tps')
     1193    %         ivar_U=CellInfo{icell}.VarIndex_vector_x_tps;
     1194    %         ivar_V=CellInfo{icell}.VarIndex_vector_y_tps;
     1195    %     elseif isfield(CellInfo{icell},'VarIndex_vector_x')&&isfield(CellInfo{icell},'VarIndex_vector_y')
     1196    %         ivar_U=CellInfo{icell}.VarIndex_vector_x;
     1197    %         ivar_V=CellInfo{icell}.VarIndex_vector_y;
     1198    %     end
     1199    %     if isfield(CellInfo{icell},'VarIndex_vector_z')
     1200    %         ivar_W=CellInfo{icell}.VarIndex_vector_z;
     1201    %     end
    10631202    %dimensions
    10641203    DimCell=FieldData.VarDimName{VarIndex(1)};
     
    12521391            Coord_x=[];
    12531392           
    1254             % find default mesh
    1255             for idim=1:NbDim %loop on space dimensions
    1256                 test_interp(idim)=0;%test for coordiate interpolation (non regular grid), =0 by default
    1257                 ivar=CellInfo{icell}.CoordIndex(idim);% index of the variable corresponding to the current dimension
    1258                 if ~isequal(ivar,0)%  a variable corresponds to the dimension #idim
    1259                     Coord{idim}=FieldData.(FieldData.ListVarName{ivar});% coord values for the input field
    1260                     if numel(Coord{idim})==2 %input array defined on a regular grid
    1261                         DCoord_min(idim)=(Coord{idim}(2)-Coord{idim}(1))/DimValue(idim);
    1262                         Coord{idim}=linspace(Coord{idim}(1),Coord{idim}(2),DimValue(idim));
    1263                     else
    1264                         DCoord=diff(Coord{idim});%array of coordinate derivatives for the input field
    1265                         DCoord_min(idim)=min(DCoord);
    1266                         DCoord_max=max(DCoord);
    1267                         if abs(DCoord_max-DCoord_min(idim))>abs(DCoord_max/1000)
    1268                             msgbox_uvmat('ERROR',['non monotonic dimension variable # ' num2str(idim)  ' in proj_field.m'])
    1269                             return
    1270                         end
    1271                         test_interp(idim)=(DCoord_max-DCoord_min(idim))> 0.0001*abs(DCoord_max);% test grid regularity
    1272                     end
    1273                     test_direct(idim)=(DCoord_min(idim)>0);
    1274                 else  % no variable associated with the  dimension #idim, the coordinate value is set equal to the matrix index by default
    1275                     Coord_i_str=['Coord_' num2str(idim)];
    1276                     DCoord_min(idim)=1;%default
    1277                     Coord{idim}=[0.5 DimValue(idim)-0.5];
    1278                     test_direct(idim)=1;
    1279                 end
    1280             end
    1281             if isempty(DY)
    1282                 DY=abs(DCoord_min(NbDim-1));
    1283             end
    1284             npY=1+round(abs(Coord{NbDim-1}(end)-Coord{NbDim-1}(1))/DY);%nbre of points after interpol
    1285             if isempty(DX)
    1286                 DX=abs(DCoord_min(NbDim));
    1287             end
    1288             npX=1+round(abs(Coord{NbDim}(end)-Coord{NbDim}(1))/DX);%nbre of points after interpol
    1289             for idim=1:NbDim
    1290                 if test_interp(idim)
    1291                     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
    1292                 end
    1293             end
    1294             Coord_y=linspace(Coord{NbDim-1}(1),Coord{NbDim-1}(end),npY);
    1295             test_direct_y=test_direct(NbDim-1);
    1296             Coord_x=linspace(Coord{NbDim}(1),Coord{NbDim}(end),npX);
    1297             test_direct_x=test_direct(NbDim);
    1298             DAX=DCoord_min(NbDim);
    1299             DAY=DCoord_min(NbDim-1);
    13001393           
    1301             % default bounds
    1302             minAX=min(Coord_x);
    1303             maxAX=max(Coord_x);
    1304             minAY=min(Coord_y);
    1305             maxAY=max(Coord_y);
    1306             xcorner=[minAX maxAX minAX maxAX]-ObjectData.Coord(1,1);% image corners in the new coordiantes
    1307             ycorner=[maxAY maxAY minAY minAY]-ObjectData.Coord(1,2);
    1308             xcor_new=xcorner*cos_om+ycorner*sin_om;%coord new frame
    1309             ycor_new=-xcorner*sin_om+ycorner*cos_om;
    1310             if ~testXMax
    1311                 XMax=max(xcor_new);
    1312             end
    1313             if ~testXMin
    1314                 XMin=min(xcor_new);
    1315             end
    1316             if ~testYMax
    1317                 YMax=max(ycor_new);
    1318             end
    1319             if ~testYMin
    1320                 YMin=min(ycor_new);
    1321             end
    1322             DXinit=(maxAX-minAX)/(DimValue(NbDim)-1);
    1323             DYinit=(maxAY-minAY)/(DimValue(NbDim-1)-1);
    1324             if DX==0
    1325                 DX=DXinit;
    1326             end
    1327             if DY==0
    1328                 DY=DYinit;
    1329             end
    1330             if NbDim==3
    1331                 DZ=(Coord{1}(end)-Coord{1}(1))/(DimValue(1)-1);
    1332                 if ~test_direct(1)
    1333                     DZ=-DZ;
    1334                 end
    1335                 Coord_z=linspace(Coord{1}(1),Coord{1}(end),DimValue(1));
    1336                 test_direct_z=test_direct(1);
    1337             end
     1394           
     1395            %             % default bounds
     1396            %             minAX=min(Coord_x);
     1397            %             maxAX=max(Coord_x);
     1398            %             minAY=min(Coord_y);
     1399            %             maxAY=max(Coord_y);
     1400            %             xcorner=[minAX maxAX minAX maxAX]-ObjectData.Coord(1,1);% image corners in the new coordiantes
     1401            %             ycorner=[maxAY maxAY minAY minAY]-ObjectData.Coord(1,2);
     1402            %             xcor_new=xcorner*cos_om+ycorner*sin_om;%coord new frame
     1403            %             ycor_new=-xcorner*sin_om+ycorner*cos_om;
     1404            %             if ~testXMax
     1405            %                 XMax=max(xcor_new);
     1406            %             end
     1407            %             if ~testXMin
     1408            %                 XMin=min(xcor_new);
     1409            %             end
     1410            %             if ~testYMax
     1411            %                 YMax=max(ycor_new);
     1412            %             end
     1413            %             if ~testYMin
     1414            %                 YMin=min(ycor_new);
     1415            %             end
     1416            %             DXinit=(maxAX-minAX)/(DimValue(NbDim)-1);
     1417            %             DYinit=(maxAY-minAY)/(DimValue(NbDim-1)-1);
     1418            %             if DX==0
     1419            %                 DX=DXinit;
     1420            %             end
     1421            %             if DY==0
     1422            %                 DY=DYinit;
     1423            %             end
     1424            %             if NbDim==3
     1425            %                 DZ=(Coord{1}(end)-Coord{1}(1))/(DimValue(1)-1);
     1426            %                 if ~test_direct(1)
     1427            %                     DZ=-DZ;
     1428            %                 end
     1429            %                 Coord_z=linspace(Coord{1}(1),Coord{1}(end),DimValue(1));
     1430            %                 test_direct_z=test_direct(1);
     1431            %             end
    13381432            %define new coordiantes if not already done by the definition of a projection grid
    13391433            if ~check_grid
    1340                 AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(NbDim-1)};%name of input x coordinate (name preserved on projection)
    1341                 AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(NbDim)};%name of input y coordinate (name preserved on projection)
    1342                 ListVarName=[ListVarName {AYName} {AXName}];% update the list of projected variables
    1343                 VarDimName=[VarDimName {AYName} {AXName}];% update the corresponding list of dimensions
    1344                 VarAttribute=[VarAttribute {[]} {[]}];% update the list of attributes
    1345                 ProjData.(AYName)=[YMin YMax]; % new (projected ) y coordinates
    1346                 ProjData.(AXName)=[XMin XMax]; % new (projected ) y coordinates
     1434               
     1435               
    13471436            end
    13481437           
     
    13701459                        VarAttribute=[VarAttribute FieldData.VarAttribute(VarIndex)];
    13711460                    end
     1461                   
    13721462                    ProjData.(AYName)=FieldData.(AYName);
    13731463                    ProjData.(AXName)=FieldData.(AXName);
     
    15401630                    eval(['ProjData.' WName '=NormVec_X*ProjData.' UName '+ NormVec_Y*ProjData.' VName '+ NormVec_Z* ProjData.' WName ';']);
    15411631                end
    1542 %                 if ~isequal(Psi,0)
    1543 %                     eval(['ProjData.' UName '=cos(Psi)* ProjData.' UName '- sin(Psi)*ProjData.' VName ';']);
    1544 %                     eval(['ProjData.' VName '=sin(Psi)* ProjData.' UName '+ cos(Psi)*ProjData.' VName ';']);
    1545 %                 end
     1632                %                 if ~isequal(Psi,0)
     1633                %                     eval(['ProjData.' UName '=cos(Psi)* ProjData.' UName '- sin(Psi)*ProjData.' VName ';']);
     1634                %                     eval(['ProjData.' VName '=sin(Psi)* ProjData.' UName '+ cos(Psi)*ProjData.' VName ';']);
     1635                %                 end
    15461636            end
    15471637        end
     
    15521642% SubData.VarDimName={};
    15531643% SubData.VarAttribute={};
    1554 % check_remove=zeros(size(ProjData.ListVarName)); 
     1644% check_remove=zeros(size(ProjData.ListVarName));
    15551645% for iproj=1:numel(ProjData.VarAttribute)
    15561646%     if isfield(ProjData.VarAttribute{iproj},'CheckSub')&&isequal(ProjData.VarAttribute{iproj}.CheckSub,1)
     
    15601650%         SubData.VarAttribute=[SubData.VarAttribute ProjData.VarAttribute{iproj}];
    15611651%         SubData.(VarName)=ProjData.(VarName);
    1562 %         check_remove(iproj)=1;       
     1652%         check_remove(iproj)=1;
    15631653%     end
    15641654% end
     
    15691659%     ProjData.VarAttribute(ind_remove)=[];
    15701660%     ProjData=sub_field(ProjData,[],SubData);
    1571 % end   
     1661% end
    15721662
    15731663%-----------------------------------------------------------------
    1574 %projection in a volume
    1575  function  [ProjData,errormsg] = proj_volume(FieldData, ObjectData)
     1664%projection in a volume
     1665function  [ProjData,errormsg] = proj_volume(FieldData, ObjectData)
     1666
    15761667%-----------------------------------------------------------------
    15771668ProjData=FieldData;%default output
     
    15841675end
    15851676
    1586 %% rotation angles 
    1587 VolumeAngle=[0 0 0]; 
     1677%% rotation angles
     1678VolumeAngle=[0 0 0];
    15881679norm_plane=[0 0 1];
    15891680if isfield(ObjectData,'Angle')&& isequal(size(ObjectData.Angle),[1 3])&& ~isequal(ObjectData.Angle,[0 0 0])
Note: See TracChangeset for help on using the changeset viewer.