From da434892133fe0979c5e8ef8be277673452e7728 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 13 Jul 2018 14:48:19 +0200 Subject: Add filter size error reporting --- cuda/2d/fbp.cu | 7 ++++--- cuda/2d/fft.cu | 11 ----------- cuda/3d/fdk.cu | 2 +- 3 files changed, 5 insertions(+), 15 deletions(-) (limited to 'cuda') diff --git a/cuda/2d/fbp.cu b/cuda/2d/fbp.cu index 1574ccc..e8a224e 100644 --- a/cuda/2d/fbp.cu +++ b/cuda/2d/fbp.cu @@ -35,6 +35,7 @@ along with the ASTRA Toolbox. If not, see . #include "astra/cuda/3d/fdk.h" #include "astra/Logging.h" +#include "astra/Filters.h" #include @@ -55,7 +56,7 @@ static int calcNextPowerOfTwo(int n) int FBP::calcFourierFilterSize(int _iDetectorCount) { int iFFTRealDetCount = calcNextPowerOfTwo(2 * _iDetectorCount); - int iFreqBinCount = calcFFTFourierSize(iFFTRealDetCount); + int iFreqBinCount = astra::calcFFTFourierSize(iFFTRealDetCount); // CHECKME: Matlab makes this at least 64. Do we also need to? return iFreqBinCount; @@ -101,7 +102,7 @@ bool FBP::setFilter(const astra::SFilterConfig &_cfg) int iFFTRealDetCount = calcNextPowerOfTwo(2 * dims.iProjDets); - int iFreqBinCount = calcFFTFourierSize(iFFTRealDetCount); + int iFreqBinCount = astra::calcFFTFourierSize(iFFTRealDetCount); cufftComplex * pHostFilter = new cufftComplex[dims.iProjAngles * iFreqBinCount]; memset(pHostFilter, 0, sizeof(cufftComplex) * dims.iProjAngles * iFreqBinCount); @@ -311,7 +312,7 @@ bool FBP::iterate(unsigned int iterations) if (D_filter) { int iFFTRealDetCount = calcNextPowerOfTwo(2 * dims.iProjDets); - int iFFTFourDetCount = calcFFTFourierSize(iFFTRealDetCount); + int iFFTFourDetCount = astra::calcFFTFourierSize(iFFTRealDetCount); cufftComplex * pDevComplexSinogram = NULL; diff --git a/cuda/2d/fft.cu b/cuda/2d/fft.cu index 864e325..dc0edc3 100644 --- a/cuda/2d/fft.cu +++ b/cuda/2d/fft.cu @@ -275,17 +275,6 @@ bool runCudaIFFT(int _iProjectionCount, const cufftComplex* _pDevSourceComplex, return true; } - -// Because the input is real, the Fourier transform is symmetric. -// CUFFT only outputs the first half (ignoring the redundant second half), -// and expects the same as input for the IFFT. -int calcFFTFourierSize(int _iFFTRealSize) -{ - int iFFTFourierSize = _iFFTRealSize / 2 + 1; - - return iFFTFourierSize; -} - void genIdenFilter(int _iProjectionCount, cufftComplex * _pFilter, int _iFFTRealDetectorCount, int _iFFTFourierDetectorCount) { diff --git a/cuda/3d/fdk.cu b/cuda/3d/fdk.cu index 014529b..1294721 100644 --- a/cuda/3d/fdk.cu +++ b/cuda/3d/fdk.cu @@ -246,7 +246,7 @@ bool FDK_Filter(cudaPitchedPtr D_projData, // Generate filter // TODO: Check errors int iPaddedDetCount = calcNextPowerOfTwo(2 * dims.iProjU); - int iHalfFFTSize = astraCUDA::calcFFTFourierSize(iPaddedDetCount); + int iHalfFFTSize = astra::calcFFTFourierSize(iPaddedDetCount); cufftComplex *pHostFilter = new cufftComplex[dims.iProjAngles * iHalfFFTSize]; -- cgit v1.2.3