Shepp-Logan filtering (spatial domain)
71 views (last 30 days)
Show older comments
Hey there,
I got a school assignment where I have to re-construct a CT image, using filtered backprojection.
It is specified that the filtering has to be done in the spatial domain (probably because it's more challenging). I have succeeded (I think?) creating the filter in the frequency domain, but attempting to convert it to the spatial domain, fails miserably. Here is the code I got:
% Create Shepp-Logan filter in frequency domain
frqFit = linspace(-2*pi*B, 2*pi*B, 256);
frqFilt = abs(frqFilt);
frqFilt = frqFilt.* (sin(frqFilt/(4*B)) ./ (frqFilt/(4*B)) ) ;
filtWin = hanning(length(frqFilt));
frqFilt = win'.*frqFilt;
% Convert filter to spatial domain
sptFilt = ifftshift(frqFilt,1);
sptFilt = ifft(sptFilt);
sptFilt = sptFilt(1:round(end/2));
sptFilt = real(sptFilt);
%Use filter
result = conv(test_line, sptFilt); % test_line is one of the projections
This is not the full code (since that is kinda messy), but it should be the important part. What the duck am I doing wrong?
0 Comments
Answers (1)
Matt J
on 13 Nov 2012
Edited: Matt J
on 13 Nov 2012
I doubt you're meant to be using FFTs to build the filter. There are direct formulas for the ramp filter in the space domain and more than likely, you're meant to be using those.
Apart from that, the following line will not create a frequency axis that includes DC (frqFit=0) as one of its samples.
frqFit = linspace(-2*pi*B, 2*pi*B, 256);
2 Comments
Matt J
on 15 Nov 2012
Edited: Matt J
on 15 Nov 2012
One can only guess what's causing you problems. You haven't actually described the problems you're experiencing.
If you create the filter in the frequency domain and then ifft to the spatial domain, you will introduce aliasing and other discrete sampling errors into the filter. (Remember, the ifft is only a discrete approximation to the continuous IFT).
If your prof. told you to perform the filtering in the non-Fourier domain, it's hard to imagine why he wouldn't want you to construct the filter there as well. There is nothing to be learned purely from performing the convolution in the space domain. It produces the same result, but less efficiently, than fft-based convolution.
See Also
Categories
Find more on Biomedical Imaging in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!