I know MATLAB has a built in Radon function, but I am working on implementing the radon transform in order to perform filtered back projection. As I started, my idea was multiple nested for loops for the summations at different theta values, this became pretty complex. I am not looking for source code, just suggestions on an approach. Any ideas are welcome.

Edit: Here is what I have come up with so far, it works fairly well to perform the radon transform and create a sinogram

%%%This function takes an image, theta max and theta step  %%%
%%%and returns a 2D matrix where each row is the projection%%%
%%%of the original image at different angles               %%%
%%%by rotating the image and summing the pixels            %%%
function [R] = RadonTransform(img, theta, thetaStep)

    %Obtain the image size in the x-direction
    [x,y] = size(img);
    %Set a matrix R to hold the projection data
    R = zeros((theta/thetaStep)+1,x);
    %Set vector for the angles to take projections at
    angles = 0:thetaStep:theta;
    %Matrix to hold all the rotated images separately to prevent blurring
    rotatedImage = zeros(x,y,length(angles));

    %Loop to rotate image and add up values for the projections
    for i = 1:(length(angles))
        %rotate the image starting with theta = 0 degrees
        rotatedImage(:,:,i) = imrotate(img,angles(i),'nearest', 'crop');
        %Sum the columns of img to get projection data
        %Each row of R contains a projection at a certain theta
        R(i,:) = sum(rotatedImage(:,:,i),1);

    %Convert the matrix to a gray scale image in the range 0 to 255
    R = mat2gray(R);

    title('My Sinogram')

  • $\begingroup$ Why do you want to rotate the image? The Radon transformation is about shooting beams through the image at different angles, see here de.mathworks.com/help/images/…, check which pixels are hit, calculate the length of intersection with each hit pixel and summing up all intersection lengths weighted by the value of the pixel. Computationally, rotating the image is far more costly than this little trigonometry exercise. I'll gladly extend my answer or give you more advice. But this question actually lacks the question part. $\endgroup$ – Frederik Heber Jul 22 '15 at 8:21
  • $\begingroup$ Frederik, I'm going to convert this question to a comment because it seems to be more comment-like than answer-like. But, if the OP gives more detail, please feel free to post your answer! $\endgroup$ – Peter K. Jul 22 '15 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.