Prev: Find angle between two lines
Next: REG:ROC
From: Alistair Templeton on 16 Mar 2010 11:31 Way simple question, it's totally stumped me. I'm playing with iradon, but would like to try filtering the sinogram first but I can't figure out how to design the 1D filter to apply to the columns. If I just have a 1-D array of numbers, how would I apply a simple ramp filter to it?
From: Matt J on 16 Mar 2010 11:42 "Alistair Templeton" <bigalt2000(a)yahoo.com> wrote in message <hno888$jjp$1(a)fred.mathworks.com>... > Way simple question, it's totally stumped me. > > I'm playing with iradon, but would like to try filtering the sinogram first but I can't figure out how to design the 1D filter to apply to the columns. > > If I just have a 1-D array of numbers, how would I apply a simple ramp filter to it? help conv help fft help filter
From: Alistair Templeton on 16 Mar 2010 12:25 > help conv > help fft > help filter apologies, I should have indicated that I've found my way to the above commands but am having trouble getting through. I've tried the following: a = [ 1 5 6 2 6 3 4 5]; %nonsense sample data fa = fft(a); ramp = (1:8) / 8; % what i'm hoping is a basic ramp filter. filtered_a = ifft(fa.*ramp); % gives me the wrong result This isn't homework, it's just a side thing I'd like to add to a presentation so I'd very much appreciated being given the fish as I know this is trivial for someone who knows how to do it! cheers
From: Matt J on 16 Mar 2010 13:05 "Alistair Templeton" <bigalt2000(a)yahoo.com> wrote in message <hnobeb$hii$1(a)fred.mathworks.com>... > apologies, I should have indicated that I've found my way to the above commands but am having trouble getting through. > > I've tried the following: > > a = [ 1 5 6 2 6 3 4 5]; %nonsense sample data > fa = fft(a); > ramp = (1:8) / 8; % what i'm hoping is a basic ramp filter. > filtered_a = ifft(fa.*ramp); % gives me the wrong result =============== This is only a 1-sided ramp. What you really would need is something like ramp=abs((1:8)-5); Incidentally, even though both you in the above and also iradon design the filter kernel in the frequency domain, it is a bad idea to do so. There are closed form formulas for the ramp and other common filter kernels in the non-Fourier domain. It is therefore recommendable to build the filter kernel in the non-Fourier domain first and then take its FFT later for the purpose of executing the convolution efficiently. This greatly cuts down on aliasing and the need for zero-padding. For details, see Section 3.3.3 in @BOOK{ kak:88, author = {A. C. Kak and M. Slaney}, title = {Principles of computerized tomographic imaging}, publisher = {IEEE Press}, address = {New York}, year = 1988 }
From: Matt J on 16 Mar 2010 13:57
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hnodor$pqd$1(a)fred.mathworks.com>... > This is only a 1-sided ramp. What you really would need is something like > > ramp=abs((1:8)-5); Actually, you would want ramp=ifftshift( abs((1:8)-5) ); so as to deal with FFT circulancy issues. |