Skip to content

Commit

Permalink
Merge pull request #415 from twhitbread/FDKOffsetWeightControl
Browse files Browse the repository at this point in the history
Restore control over wang weights in FDK
  • Loading branch information
AnderBiguri authored Dec 1, 2022
2 parents c42b0a0 + 1361fb8 commit 2057fd2
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions MATLAB/Algorithms/FDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,21 @@
% Codes: https://github.com/CERN/TIGRE/
% Coded by: Kyungsang Kim, modified by Ander Biguri, Brandon Nelson
%--------------------------------------------------------------------------
[filter,parker,gpuids]=parse_inputs(proj,geo,angles,varargin);
[filter,parker,dowang,gpuids]=parse_inputs(angles,varargin);

geo=checkGeo(geo,angles);
geo.filter=filter;

% Zero-padding to avoid FFT-induced aliasing %TODO: should't this be
% for all cases, not just wang?
[zproj, zgeo] = zeropadding(proj, geo);
% Preweighting using Wang function
proj=zproj.*redundancy_weighting(zgeo);
% Replace original proj and geo
% proj = proj_w;
geo = zgeo;
if dowang
% Zero-padding to avoid FFT-induced aliasing %TODO: should't this be
% for all cases, not just wang?
[zproj, zgeo] = zeropadding(proj, geo);
% Preweighting using Wang function
proj=zproj.*redundancy_weighting(zgeo);
% Replace original proj and geo
% proj = proj_w;
geo = zgeo;
end

if size(geo.offDetector,2)==1
offset=repmat(geo.offDetector,[1 size(angles,2)]);
Expand Down Expand Up @@ -99,8 +101,6 @@
zgeo.nDetector(1) = abs(padwidth) + geo.nDetector(1);
zgeo.sDetector(1) = zgeo.nDetector(1) * zgeo.dDetector(1);

theta = (geo.sDetector(1)/2 - abs(offset))...
* sign(offset);
% Pad on the left size when offset >0
if(offset>0)
for ii = 1:size(proj,3)
Expand All @@ -115,9 +115,9 @@
end


function [filter, parker, gpuids]=parse_inputs(proj,geo,angles,argin)
function [filter, parker, wang, gpuids]=parse_inputs(angles,argin)

opts = {'filter','parker', 'gpuids'};
opts = {'filter','parker','wang','gpuids'};
defaults=ones(length(opts),1);

% Check inputs
Expand All @@ -144,7 +144,7 @@
ind=find(isequal(opt,lower(argin{jj})));
jj=jj+1;
end
if isempty(ind)
if isempty(ind)
error('CBCT:FDK:InvalidInput',['Optional parameter "' argin{jj} '" does not exist' ]);
end
val=argin{jj};
Expand All @@ -161,11 +161,17 @@
else
parker=val;
end
case 'wang'
if default
wang=true;
else
wang=val;
end
case 'filter'
if default
filter='ram-lak';
else
if ~ischar( val)
if ~ischar(val)
error('CBCT:FDK:InvalidInput','Invalid filter')
end
filter=val;
Expand Down

0 comments on commit 2057fd2

Please sign in to comment.