Wrong object reconstruction in Projection Slice Theorem - aliasing or sampling problem?

Hello. I'm working with the Projection Slice Theorem. Here is some theory about it: Link Page 12 upper slide. I find a problem which I try to solve for 3 days and I have no idea what is wrong. I managed to locate where the problem is. Please look at this code:
clear all
clc
a = [zeros(1,412) ones(1,200) zeros(1,412)];
adft = fftshift(fft(a)) ;
my_spectrum = zeros(1024,1024);
for k=1:1024
my_spectrum(k,k) = (adft(k)) ;
end
recon = (ifft2(ifftshift(my_spectrum))) ;
imagesc(abs(recon)) ;
I take 1 dimensional projection (here as an example rectangular function), then I calculate its FT. I fftshift it so that 0 freq. is in the middle. I create empty 2 dimensional spectrum, and I put "adft" diagonally in this spectrum (from upper left corner to lower right). Now I ifftshift my spectrum, so that it's 0 freq. will move to the corners and I ifft2 it. As I understand I should get as a reconstruction a rectangular function "projected" diagonally thgrough the center. But instead I get 2 such functions - non of which goes through the center. Is it some kind of aliasing or am I just doing something wrong? I will be very grateful for your help!

 採用された回答

Matt J
Matt J 2012 年 12 月 28 日
adft = fftshift(fft(ifftshift(a))) ;

4 件のコメント

Wojtek
Wojtek 2012 年 12 月 28 日
編集済み: Wojtek 2012 年 12 月 28 日
Thank for the answer! It works. But could you please explain why should I ifftshift an image before calculating its fft? I thought that fftshift is supposed to be used only in the freq. domain.
Matt J
Matt J 2012 年 12 月 28 日
Both FFT and IFFT expect the time (resp. frequency) origin to be at the beginning of the array, a(1).
When you built the rectangular function, however, you put the origin in the middle of the array. IFFTSHIFT shifts it to the beginning of the array appropriately.
Wojtek
Wojtek 2012 年 12 月 28 日
I see. Thank you once again!
Renyuan Zhang
Renyuan Zhang 2016 年 2 月 27 日
Thanks, Matt. Really helped me on my inverse radon transform program. It works better than the iradon() in Matlab. Thanks for mention the ifftshift().

サインインしてコメントする。

その他の回答 (0 件)

質問済み:

2012 年 12 月 28 日

コメント済み:

2016 年 2 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by