MATLAB如何在频域中实现Ram-Lak滤波器(斜坡滤波器)?

时间:2011-07-15 15:59:01

标签: matlab filter fft

我有一个实现Ram-Lak过滤器的任务,但几乎没有给出任何信息(除了fft,ifft,fftshift,ifftshift)。

我有一个sinogram,我必须通过Ram-Lak过滤。还给出了预测的数量。

我尝试使用过滤器

                      1/4              if I == 0

(b^2)/(2*pi^2)  *     0                if I even

                      -1/(pi^2 * I^2)  if I odd

b似乎是截止频率,我与采样率有关?

据说两个函数的卷积是傅立叶空间中的简单乘法。

我根本不明白如何实现过滤器,特别是没有给出b,没有告诉我是什么,也不知道如何将其应用于sinogram,我希望有人可以帮助我。我花了两个小时谷歌搜索并试图了解这里需要做什么,但我无法理解如何实现它。

1 个答案:

答案 0 :(得分:10)

如果您想在傅立叶域中进行无需过滤的反Radon变换,则列出的公式是中间结果。另一种方法是使用空间域中的卷积来完成整个滤波反投影算法,这可能在40年前更快;你最终会重新发布你发布的公式。但是,我现在不建议,特别是不适合你的第一次重建;你应该先了解希尔伯特变换。

无论如何,这里有一些Matlab代码执行强制性的Shepp-Logan模拟滤波反投影重建。我将展示如何使用Ram-Lak过滤器进行自己的过滤。如果我真的很有动力,我会用一些interp2命令和总结代替radon / iradon。

phantomData=phantom();

N=size(phantomData,1);

theta = 0:179;
N_theta = length(theta);
[R,xp] = radon(phantomData,theta);

% make a Ram-Lak filter. it's just abs(f).
N1 = length(xp);
freqs=linspace(-1, 1, N1).';
myFilter = abs( freqs );
myFilter = repmat(myFilter, [1 N_theta]);

% do my own FT domain filtering
ft_R = fftshift(fft(R,[],1),1);
filteredProj = ft_R .* myFilter;
filteredProj = ifftshift(filteredProj,1);
ift_R = real(ifft(filteredProj,[],1));

% tell matlab to do inverse FBP without a filter
I1 = iradon(ift_R, theta, 'linear', 'none', 1.0, N);

subplot(1,3,1);imagesc( real(I1) ); title('Manual filtering')
colormap(gray(256)); axis image; axis off

% for comparison, ask matlab to use their Ram-Lak filter implementation
I2 = iradon(R, theta, 'linear', 'Ram-Lak', 1.0, N);

subplot(1,3,2);imagesc( real(I2) ); title('Matlab filtering')
colormap(gray(256)); axis image; axis off

% for fun, redo the filtering wrong on purpose
% exclude high frequencies to create a low-resolution reconstruction
myFilter( myFilter > 0.1 ) = 0;
ift_R = real(ifft(ifftshift(ft_R .* myFilter,1),[],1));
I3 = iradon(ift_R, theta, 'linear', 'none', 1.0, N);

subplot(1,3,3);imagesc( real(I3) ); title('Low resolution filtering')
colormap(gray(256)); axis image; axis off

N=size(phantomData,1); theta = 0:179; N_theta = length(theta); [R,xp] = radon(phantomData,theta); % make a Ram-Lak filter. it's just abs(f). N1 = length(xp); freqs=linspace(-1, 1, N1).'; myFilter = abs( freqs ); myFilter = repmat(myFilter, [1 N_theta]); % do my own FT domain filtering ft_R = fftshift(fft(R,[],1),1); filteredProj = ft_R .* myFilter; filteredProj = ifftshift(filteredProj,1); ift_R = real(ifft(filteredProj,[],1)); % tell matlab to do inverse FBP without a filter I1 = iradon(ift_R, theta, 'linear', 'none', 1.0, N); subplot(1,3,1);imagesc( real(I1) ); title('Manual filtering') colormap(gray(256)); axis image; axis off % for comparison, ask matlab to use their Ram-Lak filter implementation I2 = iradon(R, theta, 'linear', 'Ram-Lak', 1.0, N); subplot(1,3,2);imagesc( real(I2) ); title('Matlab filtering') colormap(gray(256)); axis image; axis off % for fun, redo the filtering wrong on purpose % exclude high frequencies to create a low-resolution reconstruction myFilter( myFilter > 0.1 ) = 0; ift_R = real(ifft(ifftshift(ft_R .* myFilter,1),[],1)); I3 = iradon(ift_R, theta, 'linear', 'none', 1.0, N); subplot(1,3,3);imagesc( real(I3) ); title('Low resolution filtering') colormap(gray(256)); axis image; axis off Demonstration of manual filtering