Skip to content

Commit a9e6852

Browse files
author
hanyoseob
committed
Update function details.
1 parent b664486 commit a9e6852

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

demo_parallelbeam_ct.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
param.dOffsetDctY = [];
3838
param.dOffsetDctX = 20;
3939

40-
param.compute_filtering = 'conv';
40+
param.compute_filtering = 'fft';
4141

4242
%% Image Object parameters
4343
% dImgY, dImgX, dImgZ : Pixel resolution [mm; (float)]

lib/filtering.m

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
% Filtering operator is implemented by both convolution and FFT versions.
55
function [pdOut, pdFlt] = filtering(pdIn, param)
66

7-
pdOut = zeros(param.nDctX, param.nView);
7+
pdOut = zeros(param.nDctX, param.nView, 'like', pdIn);
88

99
% Filter is generated based on Ch.3 Equation (3.29)
1010
pdFlt = generate_filter(param.dDctX, param.nDctX);
@@ -14,33 +14,30 @@
1414
% Ch.3 Equation (3.30)
1515
% CONVOLUTION ver.
1616
for iview = 0:param.nView-1
17-
% pdFltY(:, iview+1) = convolution1d(pdY(:, iview+1), pdFlt, param.nDctX);
17+
% pdOut(:, iview+1) = convolution1d(pdIn(:, iview+1), pdFlt, param.nDctX);
1818
pdOut(:, iview+1) = conv(pdIn(:, iview+1), pdFlt, 'same');
1919
end
2020

2121
case 'fft'
2222
% Ch.3 Equation (3.21)
2323
% FFT ver.
24-
pdOut_ = zeros(param.nDctX, 1);
25-
2624
nFlt = length(pdFlt);
27-
pdFlt_ = pdFlt;
28-
pdFlt_(nFlt) = 0;
29-
pdFlt_ = fft(pdFlt_);
25+
26+
len = 2^(ceil(log2(2*param.nDctX)));
27+
pdFlt(len) = 0;
28+
pdFlt_ = fft(pdFlt);
3029

3130
for iview = 0:param.nView-1
32-
pdOut_(:) = 0;
3331

3432
pdIn_ = pdIn(:, iview+1);
35-
pdIn_(nFlt) = 0;
33+
pdIn_(len) = 0;
3634
pdIn_ = fft(pdIn_);
3735

38-
for iflt = 0:nFlt-1
39-
pdOut_(iflt+1) = pdFlt_(iflt+1)*pdIn_(iflt+1);
40-
end
36+
pdOut_ = pdFlt_.*pdIn_;
4137

4238
pdOut_ = ifft(pdOut_, 'symmetric');
43-
pdOut(:, iview+1) = pdOut_(nFlt - param.nDctX + 1: nFlt);
39+
% pdOut(:, iview+1) = pdOut_(nFlt - param.nDctX + 1: nFlt);
40+
pdOut(:, iview+1) = pdOut_(param.nDctX:2*param.nDctX - 1);
4441
end
4542
end
4643

0 commit comments

Comments
 (0)