Changeset 109 for trunk/src/proj_field.m
- Timestamp:
- Oct 4, 2010, 10:39:11 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/proj_field.m
r77 r109 12 12 % .NbPix; 13 13 % .DimName= names of the matrix dimensions (matlab cell) 14 % .DimValue= values of the matricx dimensions (matlab vector, same length as .DimName);15 14 % .VarName= names of the variables [ProjData.VarName {'A','AMean','AMin','AMax'}]; 16 15 % .VarDimNameIndex= dimensions of the variables, indicated by indices in the list .DimName; … … 34 33 % .ListGlobalAttribute: cell listing the names of the global attributes 35 34 % .Att_1,Att_2... : values of the global attributes 36 % .ListDimName: cell listing the names of the array dimensions37 % .DimValue: array dimension values (Matlab vector with the same length as .ListDimName38 35 % .ListVarName: cell listing the names of the variables 39 % .VarDimIndex: cell containing the set of dimension indices (in list .ListDimName) for each variable of .ListVarName40 36 % .VarAttribute: cell of structures s containing names and values of variable attributes (s.name=value) for each variable of .ListVarName 41 37 % .Var1, .Var2....: variables (Matlab arrays) with names listed in .ListVarName … … 391 387 %A REVOIR, GENERALISER: UTILISER proj_line 392 388 ProjData.NbDim=1; 393 ProjData.ListDimName={};%name of dimension394 ProjData.DimValue=[];%values of dimension (nbre of vectors)389 %ProjData.ListDimName={};%name of dimension 390 %ProjData.DimValue=[];%values of dimension (nbre of vectors) 395 391 ProjData.ListVarName={}; 396 392 %ProjData.VarDimIndex={}; … … 966 962 DY=abs(ObjectData.DY);%mesh of interpolation points 967 963 end 968 if ~ isequal(ProjMode,'projection') & (DX==0|DY==0)964 if ~strcmp(ProjMode,'projection') && (DX==0||DY==0) 969 965 errormsg='DX or DY missing'; 970 966 display(errormsg) … … 997 993 ProjData=proj_heading(FieldData,ObjectData); 998 994 ProjData.NbDim=2; 999 ProjData.ListDimName={};%name of dimension1000 ProjData.DimValue=[];%values of dimension (nbre of vectors)1001 995 ProjData.ListVarName={}; 1002 996 ProjData.VarDimName={}; … … 1045 1039 DimCell={DimCell};%name of dimensions 1046 1040 end 1047 1041 1048 1042 %case of input fields with unstructured coordinates 1049 1043 if testX … … 1134 1128 if isequal(ObjectData.ProjMode,'projection') 1135 1129 %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)]; 1138 1133 nbvar=0; 1139 1134 for ivar=VarIndex %transfer variables to the projection plane … … 1181 1176 testFF=0; 1182 1177 for ivar=VarIndex 1183 VarName=FieldData.ListVarName{ivar}; 1178 VarName=FieldData.ListVarName{ivar}; 1184 1179 if ~( ivar==ivar_X || ivar==ivar_Y || ivar==ivar_Z || ivar==ivar_F || ivar==ivar_FF || test_anc(ivar)==1) 1185 1180 ivar_new=ivar_new+1; … … 1220 1215 end 1221 1216 end 1222 %case of fields defined on a structured grid1217 %case of input fields defined on a structured grid 1223 1218 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) 1226 1221 eval(['AX=FieldData.' AXName ';']) 1227 1222 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 1230 1225 ListDimName=FieldData.VarDimName{VarIndex(1)}; 1231 1226 ProjData.ListVarName=[{AYName} {AXName} ProjData.ListVarName]; %TODO: check if it already exists in Projdata (several cells) … … 1234 1229 for idim=1:length(ListDimName) 1235 1230 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') 1237 1232 nbcolor=DimValue(idim); 1238 DimIndices(idim)=[];1239 1233 DimValue(idim)=[]; 1240 1234 end 1241 1235 if isequal(DimName,'nb_coord_j')% NOTE: CASE OF TENSOR NOT TREATED 1242 DimIndices(idim)=[];1243 1236 DimValue(idim)=[]; 1244 1237 end 1245 1238 end 1246 1239 ind_1=find(DimValue==1); 1247 DimIndices(ind_1)=[]; %suppress singleton dimensions1248 % indxy=find(DimVarIndex(DimIndices));%select dimension variables (DimIndices non zero)1249 nb_dim=length(DimIndices);%number of space dimensions1250 1240 Coord_z=[]; 1251 1241 Coord_y=[]; 1252 1242 Coord_x=[]; 1253 1243 nb_dim=numel(size(DimValue)); 1254 1244 for idim=1:nb_dim %loop on space dimensions 1255 1245 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']) 1267 1258 return 1268 end1269 test_interp(idim)=(DCoord_max-DCoord_min(idim))> 0.0001*abs(DCoord_max);% test grid regularity1270 test_coord(idim)=1;1271 1272 else % no variable associated with the first dimension, look for variable attributes Coord_1, _2 or _31259 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 1273 1264 Coord_i_str=['Coord_' num2str(idim)]; 1274 1265 DCoord_min(idim)=1;%default … … 1277 1268 end 1278 1269 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 1297 1290 DZ=abs(DCoord_min(1)); 1298 npz=1+round(abs(Coord{1}(end)-Coord{1}(1))/DZ);%nbre of points after interpolation1299 if DY==01300 DY=abs(DCoord_min(2));1301 end1302 npY=1+round(abs(Coord{2}(end)-Coord{2}(1))/DY);%nbre of points after interpol1303 npy=1+round(abs(Coord{2}(end)-Coord{2}(1))/abs(DCoord_min(2)));%nbre of points before interpol1304 if DX==01305 DX=abs(DCoord_min(3));1306 end1307 npX=1+round(abs(Coord{3}(end)-Coord{3}(1))/DX);%nbre of points after interpol1308 npx=1+round(abs(Coord{3}(end)-Coord{3}(1))/abs(DCoord_min(3)));%nbre of points before interpol1309 1291 Coord_z=linspace(Coord{1}(1),Coord{1}(end),npz); 1310 1292 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);1315 1293 end 1316 1294 minAX=min(Coord_x); … … 1334 1312 YMin=min(ycor_new); 1335 1313 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); 1338 1316 if DX==0 1339 1317 DX=DXinit; … … 1343 1321 end 1344 1322 npX=floor((XMax-XMin)/DX+1); 1345 npY=floor((YMax-YMin)/DY+1); 1323 npY=floor((YMax-YMin)/DY+1); 1346 1324 if test_direct_y 1347 1325 coord_y_proj=linspace(YMin,YMax,npY);%abscissa of the new pixels along the line … … 1381 1359 min_ind1=max(min_ind1,1);% deals with margin (bound lower than the first index) 1382 1360 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)); 1385 1363 for ivar=VarIndex 1386 1364 VarName=FieldData.ListVarName{ivar}; 1387 1365 ProjData.ListVarName=[ProjData.ListVarName VarName]; 1388 ProjData.VarDim Index=[ProjData.VarDimIndex [nb_dim-1 nb_dim]];1366 ProjData.VarDimName=[ProjData.VarDimName {DimCell}]; 1389 1367 if length(FieldData.VarAttribute)>=ivar 1390 1368 ProjData.VarAttribute{length(ProjData.ListVarName)}=FieldData.VarAttribute{ivar}; … … 1392 1370 eval(['ProjData.' VarName '=FieldData.' VarName '(min_ind1:max_ind1,min_ind2:max_ind2) ;']); 1393 1371 end 1394 else 1395 % case with rotation and/or interpolation 1372 else % case with rotation and/or interpolation 1396 1373 if isempty(Coord_z) %2D case 1397 1374 [X,Y]=meshgrid(coord_x_proj,coord_y_proj);%grid in the new coordinates … … 1402 1379 XIMA=reshape(round(XIMA),1,npX*npY);%indices reorganized in 'line' 1403 1380 YIMA=reshape(round(YIMA),1,npX*npY); 1404 flagin=XIMA>=1 & XIMA<= npx & YIMA >=1 & YIMA<=npy;%flagin=1 inside the original image1381 flagin=XIMA>=1 & XIMA<=DimValue(2) & YIMA >=1 & YIMA<=DimValue(1);%flagin=1 inside the original image 1405 1382 if isequal(ObjectData.ProjMode,'filter') 1406 1383 npx_filter=ceil(abs(DX/DAX)); … … 1411 1388 test_filter=0; 1412 1389 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 1413 1392 for ivar=VarIndex 1414 VarName=FieldData.ListVarName{ivar} ;1415 if test_interp(1) | test_interp(2)%interpolate on a regular grid1416 eval([' FieldData.' VarName '=interp2(Coord{2},Coord{1},FieldData.' VarName ',Coord_x,Coord_y'');']) %TO TEST1393 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 1417 1396 end 1418 1397 %filter the field (image) if option 'filter' is used 1419 1398 if test_filter 1420 1399 Aclass=class(FieldData.A); 1421 eval([' FieldData.' VarName '=filter2(Mfilter,FieldData.' VarName ',''valid'');'])1400 eval(['ProjData.' VarName '=filter2(Mfilter,FieldData.' VarName ',''valid'');']) 1422 1401 if ~isequal(Aclass,'double') 1423 eval([' FieldData.' VarName '=' Aclass '(FieldData.' VarName ');'])%revert to integer values1402 eval(['ProjData.' VarName '=' Aclass '(FieldData.' VarName ');'])%revert to integer values 1424 1403 end 1425 1404 end 1426 eval(['vec_A=reshape(FieldData.' VarName ', npx*npy,nbcolor);'])%put the original image in line1405 eval(['vec_A=reshape(FieldData.' VarName ',[],nbcolor);'])%put the original image in line 1427 1406 ind_in=find(flagin); 1428 1407 ind_out=find(~flagin); 1429 ICOMB=(XIMA-1)* npy+YIMA;1408 ICOMB=(XIMA-1)*DimValue(1)+YIMA; 1430 1409 ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A 1431 1410 vec_B(ind_in,[1:nbcolor])=vec_A(ICOMB,:); … … 1433 1412 vec_B(ind_out,icolor)=zeros(size(ind_out)); 1434 1413 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 1437 1417 ProjData.VarAttribute{length(ProjData.ListVarName)+nbcoord}=FieldData.VarAttribute{ivar}; 1438 1418 end … … 1441 1421 ProjData.FF=reshape(~flagin,npY,npX);%false flag A FAIRE: tenir compte d'un flga antérieur 1442 1422 ProjData.ListVarName=[ProjData.ListVarName 'FF']; 1423 ProjData.VarDimName=[ProjData.VarDimName {DimCell}]; 1443 1424 ProjData.VarAttribute{length(ProjData.ListVarName)}.Role='errorflag'; 1444 1425 else %3D case … … 1448 1429 iz=iz_sup(1); 1449 1430 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]; 1452 1433 for ivar=VarIndex 1453 1434 VarName=FieldData.ListVarName{ivar}; … … 1582 1563 ProjData=proj_heading(FieldData,ObjectData); 1583 1564 ProjData.NbDim=3; 1584 ProjData.ListDimName={};%name of dimension1585 ProjData.DimValue=[];%values of dimension (nbre of vectors)1565 %ProjData.ListDimName={};%name of dimension 1566 %ProjData.DimValue=[];%values of dimension (nbre of vectors) 1586 1567 ProjData.ListVarName={}; 1587 1568 ProjData.VarDimName={}; … … 1717 1698 if isequal(ObjectData.ProjMode,'projection') 1718 1699 %the list of dimension 1719 ProjData.ListDimName=[ProjData.ListDimName FieldData.VarDimName(VarIndex(1))];%add the point index to the list of dimensions1720 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)]; 1721 1702 nbvar=0; 1722 1703 for ivar=VarIndex %transfer variables to the projection plane … … 1843 1824 for idim=1:nb_dim %loop on space dimensions 1844 1825 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 default1846 1826 ivar=DimVarIndex(DimIndices(idim));% index of the variable corresponding to the current dimension 1847 1827 if ~isequal(ivar,0)% a variable corresponds to the current dimension … … 1857 1837 end 1858 1838 test_interp(idim)=(DCoord_max-DCoord_min(idim))> 0.0001*abs(DCoord_max);% test grid regularity 1859 test_coord(idim)=1;1860 1861 1839 else % no variable associated with the first dimension, look for variable attributes Coord_1, _2 or _3 1862 1840 Coord_i_str=['Coord_' num2str(idim)]; … … 1871 1849 end 1872 1850 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 grid1851 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 1874 1852 if DX==0 1875 1853 DX=abs(DCoord_min(2)); 1876 1854 end 1877 1855 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 grid1856 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 1879 1857 Coord_y=linspace(Coord{1}(1),Coord{1}(end),npY); 1880 1858 test_direct_y=test_direct(1); … … 1890 1868 end 1891 1869 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 interpol1870 DimValue(1)=1+round(abs(Coord{2}(end)-Coord{2}(1))/abs(DCoord_min(2)));%nbre of points before interpol 1893 1871 if DX==0 1894 1872 DX=abs(DCoord_min(3)); 1895 1873 end 1896 1874 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 interpol1875 DimValue(2)=1+round(abs(Coord{3}(end)-Coord{3}(1))/abs(DCoord_min(3)));%nbre of points before interpol 1898 1876 Coord_z=linspace(Coord{1}(1),Coord{1}(end),npz); 1899 1877 test_direct_z=test_direct(1); … … 1923 1901 YMin=min(ycor_new); 1924 1902 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); 1927 1905 if DX==0 1928 1906 DX=DXinit; … … 1970 1948 min_ind1=max(min_ind1,1);% deals with margin (bound lower than the first index) 1971 1949 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)); 1974 1952 for ivar=VarIndex 1975 1953 VarName=FieldData.ListVarName{ivar}; 1976 1954 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]]; 1978 1956 if length(FieldData.VarAttribute)>=ivar 1979 1957 ProjData.VarAttribute{length(ProjData.ListVarName)}=FieldData.VarAttribute{ivar}; … … 1991 1969 XIMA=reshape(round(XIMA),1,npX*npY);%indices reorganized in 'line' 1992 1970 YIMA=reshape(round(YIMA),1,npX*npY); 1993 flagin=XIMA>=1 & XIMA<= npx & YIMA >=1 & YIMA<=npy;%flagin=1 inside the original image1971 flagin=XIMA>=1 & XIMA<=DimValue(2) & YIMA >=1 & YIMA<=DimValue(1);%flagin=1 inside the original image 1994 1972 if isequal(ObjectData.ProjMode,'filter') 1995 1973 npx_filter=ceil(abs(DX/DAX)); … … 2013 1991 end 2014 1992 end 2015 eval(['vec_A=reshape(FieldData.' VarName ', npx*npy,nbcolor);'])%put the original image in line1993 eval(['vec_A=reshape(FieldData.' VarName ',[],nbcolor);'])%put the original image in line 2016 1994 ind_in=find(flagin); 2017 1995 ind_out=find(~flagin); 2018 ICOMB=(XIMA-1)* npy+YIMA;1996 ICOMB=(XIMA-1)*DimValue(1)+YIMA; 2019 1997 ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A 2020 1998 vec_B(ind_in,[1:nbcolor])=vec_A(ICOMB,:); … … 2037 2015 iz=iz_sup(1); 2038 2016 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]; 2041 2019 for ivar=VarIndex 2042 2020 VarName=FieldData.ListVarName{ivar};
Note: See TracChangeset
for help on using the changeset viewer.