function wfs=WFS_resample(beta,k, para);
%
% function wfs=WFS_resample(beta,k, para);
%
% Resample the Cosine series representation at points given in para.
%
% beta : coefficient of cosine series expansion
% k    : degree of cosine series expansion
% para : x-coordinates where the cosine series expansion will be constructed
%
%
% The technical detail and explanation on paramters are given in [1] and [2]
% 
% [1] Chung, M.K., Adluru, N., Lee, J.E., Lazar, M.,Lainhart, J.E., Alexander, A.L.
%     2010. Cosine series representation of 3D curves and its application to white 
%     matter fiber bundles in diffusion tensor imaging. Statistics and Its Interface. 
%     3:69-80. http://www.stat.wisc.edu/~mchung/papers/chung.2010.SII.pdf
%
% [2] Chung, M.K., Singh, V., Kim, P.T., Dalton, K.M., Davidson, R.J. 2009.
%     Topological characterization of signal in brain images using the min-max diagram.
%     12th International Conference on Medical Image Computing and Computer Assisted 
%     Intervention (MICCAI). Lecture Notes in Computer Science (LNCS). 5762:158-166.
%     http://www.stat.wisc.edu/~mchung/papers/miccai.2009.pdf 
%
% (c) Moo K. Chung, 2009
%      mkchung@wisc.edu
%      University of Wisconsin-Madison
%    
%     Histroy: 2009 created
%              2015 05/30 Documentation


%para=0:0.01:1;
%para=0:0.005:1;
n_vertex=length(para);

%para_even=[-para(n_vertex:-1:2) para];

psi1=inline('sqrt(2)*cos(pi*l.*x)');



%Y= psi*beta
% inv(psi)*Y = psi \ Y= beta

Y=[];
for i=0:k
    psi=psi1(i,para');
    Y=[Y psi];
end

%beta=inv(Y'*Y)*Y'*track_even';

wfs= Y*beta;



