summaryrefslogtreecommitdiffstats
path: root/src/CudaFDKAlgorithm3D.cpp
diff options
context:
space:
mode:
authorDaniel M. Pelt <D.M.Pelt@cwi.nl>2016-05-20 15:10:03 +0200
committerDaniel M. Pelt <D.M.Pelt@cwi.nl>2016-05-20 15:10:03 +0200
commit399422985fd27a1e6a1f8cea3642402128b050fa (patch)
tree4898e3470bbd2b81bc378df1c3b8c14654eb3ba5 /src/CudaFDKAlgorithm3D.cpp
parent844a9f71fba18c76d6b3566b78908877a0a1a9c8 (diff)
downloadastra-399422985fd27a1e6a1f8cea3642402128b050fa.tar.gz
astra-399422985fd27a1e6a1f8cea3642402128b050fa.tar.bz2
astra-399422985fd27a1e6a1f8cea3642402128b050fa.tar.xz
astra-399422985fd27a1e6a1f8cea3642402128b050fa.zip
Add option to specify custom filter for FDK
Diffstat (limited to 'src/CudaFDKAlgorithm3D.cpp')
-rw-r--r--src/CudaFDKAlgorithm3D.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/CudaFDKAlgorithm3D.cpp b/src/CudaFDKAlgorithm3D.cpp
index b5ce545..bc15a3d 100644
--- a/src/CudaFDKAlgorithm3D.cpp
+++ b/src/CudaFDKAlgorithm3D.cpp
@@ -36,8 +36,11 @@ $Id$
#include "astra/Logging.h"
#include "../cuda/3d/astra3d.h"
+#include "../cuda/2d/fft.h"
+#include "../cuda/3d/util3d.h"
using namespace std;
+using namespace astraCUDA3d;
namespace astra {
@@ -129,6 +132,28 @@ bool CCudaFDKAlgorithm3D::initialize(const Config& _cfg)
CC.markOptionParsed("GPUIndex");
if (!_cfg.self.hasOption("GPUIndex"))
CC.markOptionParsed("GPUindex");
+
+ // filter
+ if (_cfg.self.hasOption("FilterSinogramId")){
+ m_iFilterDataId = (int)_cfg.self.getOptionInt("FilterSinogramId");
+ const CFloat32ProjectionData2D * pFilterData = dynamic_cast<CFloat32ProjectionData2D*>(CData2DManager::getSingleton().get(m_iFilterDataId));
+ if (!pFilterData){
+ ASTRA_ERROR("Incorrect FilterSinogramId");
+ return false;
+ }
+ const CProjectionGeometry3D* projgeom = m_pSinogram->getGeometry();
+ const CProjectionGeometry2D* filtgeom = pFilterData->getGeometry();
+ int iPaddedDetCount = calcNextPowerOfTwo(2 * projgeom->getDetectorColCount());
+ int iHalfFFTSize = calcFFTFourSize(iPaddedDetCount);
+ if(filtgeom->getDetectorCount()!=iHalfFFTSize || filtgeom->getProjectionAngleCount()!=projgeom->getProjectionCount()){
+ ASTRA_ERROR("Filter size does not match required size (%i angles, %i detectors)",projgeom->getProjectionCount(),iHalfFFTSize);
+ return false;
+ }
+ }else
+ {
+ m_iFilterDataId = -1;
+ }
+ CC.markOptionParsed("FilterSinogramId");
@@ -196,10 +221,16 @@ void CCudaFDKAlgorithm3D::run(int _iNrIterations)
bool ok = true;
+
+ const float *filter = NULL;
+ if(m_iFilterDataId!=-1){
+ const CFloat32ProjectionData2D * pFilterData = dynamic_cast<CFloat32ProjectionData2D*>(CData2DManager::getSingleton().get(m_iFilterDataId));
+ filter = pFilterData->getDataConst();
+ }
ok = astraCudaFDK(pReconMem->getData(), pSinoMem->getDataConst(),
&volgeom, conegeom,
- m_bShortScan, m_iGPUIndex, m_iVoxelSuperSampling);
+ m_bShortScan, m_iGPUIndex, m_iVoxelSuperSampling, filter);
ASTRA_ASSERT(ok);