Changeset 1002 for trunk/src/proj_field.m
- Timestamp:
- Feb 28, 2017, 10:41:54 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/proj_field.m
r977 r1002 730 730 if strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_x'); 731 731 ivar_U=nbvar+ivar; 732 elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y'); 732 elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y');TriScatteredInterp 733 733 ivar_V=nbvar+ivar; 734 734 end 735 735 end 736 ProjData.VarAttribute{ivar+nbvar}.Role='discrete';% will promote plots of the profiles with continuo us lines736 ProjData.VarAttribute{ivar+nbvar}.Role='discrete';% will promote plots of the profiles with continuoval(['us lines 737 737 end 738 738 elseif isequal(ProjMode,'interp_lin') %filtering %linear interpolation: 739 739 if ~check_abscissa 740 740 XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)}; 741 ProjData.ListVarName=[ProjData.ListVarName {XName}]; 741 ProjData.ListVarName=[ProjData.ListVarName {XName}];TriScatteredInterp 742 742 ProjData.VarDimName=[ProjData.VarDimName {XName}]; 743 743 nbvar=numel(ProjData.ListVarName); … … 811 811 end% 812 812 test_interp2=0;%default 813 AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)}; 814 AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)}; 815 AX=FieldData.(AXName);% set of x positions 816 AY=FieldData.(AYName);% set of y positions 817 AName=FieldData.ListVarName{VarIndex(1)}; 818 npxy=size(FieldData.(AName)); 813 819 814 if max(NbDim)==3 % 3D case 815 AZName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)}; 816 AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)}; 817 AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-2)}; 818 AX=FieldData.(AXName);% set of x positions 819 AY=FieldData.(AYName);% set of y positions 820 AZ=FieldData.(AZName);% set of z positions 821 AName=FieldData.ListVarName{VarIndex(1)}; 822 npxy=size(FieldData.(AName)); 823 npz=npxy(1); 824 npy=npxy(2); 825 npx=npxy(1); 826 AXI=linspace(AX(1),AX(end), npx);%set of x positions for the interpolated input data 827 AYI=linspace(AY(1),AY(end), npy);%set of x positions for the interpolated input data 828 AZI=linspace(AZ(1),AZ(end), npy);%set of x positions for the interpolated input data 829 for ivar=VarIndex 830 VarName=FieldData.ListVarName{ivar}; 831 FieldData.(VarName)=interp3(FieldData.(AXName),FieldData.(AYName),FieldData.(AZName),FieldData.(VarName),AXI,AYI,AZI); 832 833 % vec_A=reshape(squeeze(FieldData.(FieldData.ListVarName{ivar})),npx*npy,nbcolor); %put the original image in colum 834 % if nbcolor==1 835 % vec_B(ind_in)=vec_A(ICOMB); 836 % vec_B(ind_out)=zeros(size(ind_out)); 837 % A_out=reshape(vec_B,npY,npX); 838 % ProjData.(FieldData.ListVarName{ivar}) =sum(A_out,1)/npY; 839 % elseif nbcolor==3 840 % vec_B(ind_in,1:3)=vec_A(ICOMB,:); 841 % vec_B(ind_out,1)=zeros(size(ind_out)); 842 % vec_B(ind_out,2)=zeros(size(ind_out)); 843 % vec_B(ind_out,3)=zeros(size(ind_out)); 844 % A_out=reshape(vec_B,npY,npX,nbcolor); 845 % ProjData.(FieldData.ListVarName{ivar})=squeeze(sum(A_out,1)/npY); 846 % end 847 ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName{ivar}]; 848 ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate 849 ProjData.VarAttribute{ivar}.Role='continuous';% for plot with continuous line 850 end 851 852 853 854 820 855 821 856 else 857 AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)}; 858 AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)}; 859 AX=FieldData.(AXName);% set of x positions 860 AY=FieldData.(AYName);% set of y positions 861 AName=FieldData.ListVarName{VarIndex(1)}; 862 npxy=size(FieldData.(AName)); 822 863 npx=npxy(2); 823 864 npy=npxy(1); … … 860 901 XMin=0; 861 902 end 862 eval(['ProjData.' AXName '=linspace(XMin,XMin+linelength,linelength/DXY_line+1);'])%abscissa of the new pixels along the line903 ProjData.(AXName)=linspace(XMin,XMin+linelength,linelength/DXY_line+1);%abscissa of the new pixels along the line 863 904 y=linspace(-width,width,2*width/DXY_line+1);%ordintes of the new pixels (coordinate across the line) 864 eval(['npX=length(ProjData.' AXName ');'])905 npX=length(ProjData.(AXName)); 865 906 npY=length(y); %TODO: utiliser proj_grid 866 eval(['[X,Y]=meshgrid(ProjData.' AXName ',y);'])%grid in the line coordinates907 [X,Y]=meshgrid(ProjData.(AXName),y);%grid in the line coordinates 867 908 XIMA=ObjectData.Coord(1,1)+(X-XMin)*cos(theta)-Y*sin(theta); 868 909 YIMA=ObjectData.Coord(1,2)+(X-XMin)*sin(theta)+Y*cos(theta); … … 876 917 ICOMB=(XIMA-1)*npy+YIMA; 877 918 ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A 878 nbcolor=1; %color images879 919 if numel(npxy)==2 880 920 nbcolor=1; … … 886 926 return 887 927 end 888 nbvar=length(ProjData.ListVarName);% number of var from previous cells889 928 ProjData.ListVarName=[ProjData.ListVarName {AXName}]; 890 929 ProjData.VarDimName=[ProjData.VarDimName {AXName}]; … … 916 955 end 917 956 end 918 919 end957 958 end 920 959 if ~isempty(ivar_U) && ~isempty(ivar_V) 921 960 vector_x =ProjData.(ProjData.ListVarName{ivar_U});
Note: See TracChangeset
for help on using the changeset viewer.