diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2018-01-16 09:33:15 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2018-06-29 17:25:10 +0200 |
commit | b3822b778c2f8684217957c966dddfee178c926c (patch) | |
tree | 7064a450262ba88d319ab7246294920730145c65 /cuda/3d | |
parent | f294563a9e52d704c32f82d80b90eb53be030295 (diff) | |
download | astra-b3822b778c2f8684217957c966dddfee178c926c.tar.gz astra-b3822b778c2f8684217957c966dddfee178c926c.tar.bz2 astra-b3822b778c2f8684217957c966dddfee178c926c.tar.xz astra-b3822b778c2f8684217957c966dddfee178c926c.zip |
Expose FDK_Filter function
Diffstat (limited to 'cuda/3d')
-rw-r--r-- | cuda/3d/fdk.cu | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/cuda/3d/fdk.cu b/cuda/3d/fdk.cu index 8aea84d..46c07e7 100644 --- a/cuda/3d/fdk.cu +++ b/cuda/3d/fdk.cu @@ -238,14 +238,39 @@ bool FDK_PreWeight(cudaPitchedPtr D_projData, } bool FDK_Filter(cudaPitchedPtr D_projData, - cufftComplex * D_filter, + const float *pfFilter, const SDimensions3D& dims) { - // The filtering is a regular ramp filter per detector line. + // Generate filter + // TODO: Check errors int iPaddedDetCount = calcNextPowerOfTwo(2 * dims.iProjU); int iHalfFFTSize = astraCUDA::calcFFTFourierSize(iPaddedDetCount); + + + cufftComplex *pHostFilter = new cufftComplex[dims.iProjAngles * iHalfFFTSize]; + memset(pHostFilter, 0, sizeof(cufftComplex) * dims.iProjAngles * iHalfFFTSize); + + if (pfFilter == 0){ + astraCUDA::genFilter(astra::FILTER_RAMLAK, 1.0f, dims.iProjAngles, pHostFilter, iPaddedDetCount, iHalfFFTSize); + } else { + for (int i = 0; i < dims.iProjAngles * iHalfFFTSize; i++) { + pHostFilter[i].x = pfFilter[i]; + pHostFilter[i].y = 0; + } + } + + cufftComplex * D_filter; + + astraCUDA::allocateComplexOnDevice(dims.iProjAngles, iHalfFFTSize, &D_filter); + astraCUDA::uploadComplexArrayToDevice(dims.iProjAngles, iHalfFFTSize, pHostFilter, D_filter); + + delete [] pHostFilter; + + + + int projPitch = D_projData.pitch/sizeof(float); @@ -277,6 +302,7 @@ bool FDK_Filter(cudaPitchedPtr D_projData, } astraCUDA::freeComplexOnDevice(D_sinoFFT); + astraCUDA::freeComplexOnDevice(D_filter); return ok; } @@ -289,12 +315,6 @@ bool FDK(cudaPitchedPtr D_volumeData, const float* pfFilter) { bool ok; - // Generate filter - // TODO: Check errors - cufftComplex * D_filter; - int iPaddedDetCount = calcNextPowerOfTwo(2 * dims.iProjU); - int iHalfFFTSize = astraCUDA::calcFFTFourierSize(iPaddedDetCount); - // NB: We don't support arbitrary cone_vec geometries here. // Only those that are vertical sub-geometries @@ -335,33 +355,8 @@ bool FDK(cudaPitchedPtr D_volumeData, return false; #if 1 - cufftComplex *pHostFilter = new cufftComplex[dims.iProjAngles * iHalfFFTSize]; - memset(pHostFilter, 0, sizeof(cufftComplex) * dims.iProjAngles * iHalfFFTSize); - - if (pfFilter == 0){ - astraCUDA::genFilter(astra::FILTER_RAMLAK, 1.0f, dims.iProjAngles, pHostFilter, iPaddedDetCount, iHalfFFTSize); - } else { - for (int i = 0; i < dims.iProjAngles * iHalfFFTSize; i++) { - pHostFilter[i].x = pfFilter[i]; - pHostFilter[i].y = 0; - } - } - - - astraCUDA::allocateComplexOnDevice(dims.iProjAngles, iHalfFFTSize, &D_filter); - astraCUDA::uploadComplexArrayToDevice(dims.iProjAngles, iHalfFFTSize, pHostFilter, D_filter); - - delete [] pHostFilter; - - // Perform filtering - - - - ok = FDK_Filter(D_projData, D_filter, dims); - - // Clean up filter - astraCUDA::freeComplexOnDevice(D_filter); + ok = FDK_Filter(D_projData, pfFilter, dims); #endif if (!ok) |