From 7c97471bd0b1184e75f06340045a884955353fdc Mon Sep 17 00:00:00 2001 From: Tomoyuki SADAKANE <40597344+tsadakane@users.noreply.github.com> Date: Thu, 2 Feb 2023 23:02:45 +0900 Subject: [PATCH] Fix FDK option usegpufft option not working --- MATLAB/Algorithms/FDK.m | 2 +- MATLAB/Utilities/filtering.m | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/MATLAB/Algorithms/FDK.m b/MATLAB/Algorithms/FDK.m index 900af71a..00500523 100644 --- a/MATLAB/Algorithms/FDK.m +++ b/MATLAB/Algorithms/FDK.m @@ -71,7 +71,7 @@ proj(:,:,ii) = w.*proj(:,:,ii); end %% Fourier transform based filtering -proj = filtering(proj,geo,angles,parker); % Not sure if offsets are good in here +proj = filtering(proj,geo,angles,parker, 'usegpufft', usegpufft); % Not sure if offsets are good in here % RMFIELD Remove fields from a structure array. geo=rmfield(geo,'filter'); diff --git a/MATLAB/Utilities/filtering.m b/MATLAB/Utilities/filtering.m index 0a550cb4..7a8cc874 100644 --- a/MATLAB/Utilities/filtering.m +++ b/MATLAB/Utilities/filtering.m @@ -68,11 +68,13 @@ fproj = (zeros(filt_len,geo.nDetector(2),'single')); fproj(round(filt_len/2-geo.nDetector(1)/2+1):round(filt_len/2+geo.nDetector(1)/2),:) = proj(:,:,ii); - - fproj = fft(fproj); - fproj = fproj.*filt; - fproj = (real(ifft(fproj))); - + if usegpufft==1 + fproj = ApplyFbpFiltration(fproj, filt, gpuids); + else + fproj = fft(fproj); + fproj = fproj.*filt; + fproj = (real(ifft(fproj))); + end if parker proj(:,:,ii) = fproj(round(end/2-geo.nDetector(1)/2+1):round(end/2+geo.nDetector(1)/2),:)/2/geo.dDetector(1)*(2*pi/ (pi/angle_step) )/2*(geo.DSD(ii)/geo.DSO(ii)); else