From 1361fb8fa7e06388e0a6d1432d223369106f96f8 Mon Sep 17 00:00:00 2001 From: twhitbread Date: Thu, 1 Dec 2022 12:03:39 +0000 Subject: [PATCH] Restore control over wang weights --- MATLAB/Algorithms/FDK.m | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/MATLAB/Algorithms/FDK.m b/MATLAB/Algorithms/FDK.m index f326144b..d0832e6f 100644 --- a/MATLAB/Algorithms/FDK.m +++ b/MATLAB/Algorithms/FDK.m @@ -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)]); @@ -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) @@ -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 @@ -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}; @@ -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;