How to do the filtered back projection?

Dear all,
I want to do the filtered back projection. Here is my code:
First, I created the phantom:
%create the phantom
Z = zeros(99); % create square matrix of zeroes
origin = [round((size(Z,2)-1)/2+1) round((size(Z,1)-1)/2+1)]; % "center" of the matrix
radius = round(sqrt(numel(Z)/(2*pi))); % radius for a circle that fills half the area of the matrix
[xx,yy] = meshgrid((1:size(Z,2))-origin(1),(1:size(Z,1))-origin(2)); % create x and y grid
Z(sqrt(xx.^2 + yy.^2) <= radius) = 1; % set points inside the radius equal to one
imshow(Z); % show the "image"
Second, I transform to frequency domain:
j = fftshift(fft2(Z));
figure, imshow(j)
j1 = log(1+abs(j));
figure ,imshow(j1)
j2 = bar(j1);
Third, should be I multiply my frequency domain with my Ramp Filter. My Ramp filter as here:
% Define parameters
N = 512; % Number of points in the filter
fs = 1000; % Sampling freq. in Hz
f = fs * (-N/2:N/2-1)/N; % Freq. vector
% Creating the ramp filter in the freq. domain
rampFilter = abs(f);
% Plot
figure;
plot(f, rampFilter);
title('Ramp Filter');
xlabel('Frequency (Hz)');
ylabel('Amplitude');
grid on;
But, my problem is I dont know how to multiply my frequency domain with Ramp Filter, as the step number 2 in picture below.
ANYONE CAN HELP ME?

7 commentaires

Rik
Rik le 20 Mai 2024
Your ramp filter is 1D, while the Fourier of your image is 2D, so you can't multiply them yet. You need to make it 2D. I would suggest using pol2cart to do the heavy lifting.
Just a note: did you have a look at the radon function?
mohd akmal masud
mohd akmal masud le 20 Mai 2024
Dear @Rik,
I can use radon function. But I just to show one by one step to my student how the filter backprojection working. Can you help me?
Rik
Rik le 21 Mai 2024
Did you already try to convert to 2D?
mohd akmal masud
mohd akmal masud le 21 Mai 2024
Not yet. Because I dont know how to convert it into 2D.can help me?
Rik
Rik le 21 Mai 2024
You have a vector with respect to f. You need a matrix with respect to two spatial frequencies. That means you need to treat your vector as the rho in a polar coordinate system. Did you read the documentation for the pol2cart function?
mohd akmal masud
mohd akmal masud le 21 Mai 2024
I have not yet read the documentation for the pol2cart function.
Rik
Rik le 21 Mai 2024
Did nobody in your previous 219 questions suggest reading the documentation? In my personal opinion that is (together with debugging tools) one of the main advantages of Matlab over alternatives like Python.

Connectez-vous pour commenter.

Réponses (0)

Produits

Version

R2023a

Commenté :

Rik
le 21 Mai 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by