function RT = myRadon(im, thetas, rotMethod)
%MYRADON my Radon Tranform
%   computes the Radon Transform of a square image embedded into the square
%   [-1,1]^2. 
%   INPUT ARGS: im        - initial image
%               thetas    - angles at which to compute the Radon Transform
%               rotMethod - method used for rotating image
%   OUTPUT ARGS: RT       - the Radon data
%   See also ROTATEIMAGE, MYIRADON

% Author: Francois Monard
% Date: 06/24/2011

n = size(im,1); % image size
nth = size(thetas,2); % number of angles
RT = zeros(n, nth); % initialize Radon Transform

% for each angle \theta, rotate the image so that the rows are aligned with
% the direction \theta^\perp = (-\sin\theta, \cos\theta), and sum over the
% rows
for th=1:nth,
    RT(:,th) = (2/n)*sum(rotateImage(im,thetas(th)+pi/2,rotMethod),2);
end

% zero-padding so that the range of t is [-\sqrt(2),\sqrt(2)]
zp = ceil( (sqrt(2)-1)*n/2 );
RT = [zeros(zp,nth); RT; zeros(zp,nth)];

end
