From 0c77eee16e2f4161c1ebc110b15ce6563d4a96c2 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 16 Apr 2014 11:13:22 +0000 Subject: Add fan beam support to FBP_CUDA --- src/CudaFilteredBackProjectionAlgorithm.cpp | 30 +++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/CudaFilteredBackProjectionAlgorithm.cpp b/src/CudaFilteredBackProjectionAlgorithm.cpp index 3656f3f..c53ac2d 100644 --- a/src/CudaFilteredBackProjectionAlgorithm.cpp +++ b/src/CudaFilteredBackProjectionAlgorithm.cpp @@ -27,6 +27,7 @@ $Id$ */ #include +#include #include #include @@ -226,7 +227,8 @@ void CCudaFilteredBackProjectionAlgorithm::run(int _iNrIterations /* = 0 */) if (!m_bAstraFBPInit) { const CVolumeGeometry2D& volgeom = *m_pReconstruction->getGeometry(); - const CParallelProjectionGeometry2D& projgeom = *dynamic_cast(m_pSinogram->getGeometry()); + const CParallelProjectionGeometry2D* parprojgeom = dynamic_cast(m_pSinogram->getGeometry()); + const CFanFlatProjectionGeometry2D* fanprojgeom = dynamic_cast(m_pSinogram->getGeometry()); bool ok = true; @@ -235,10 +237,26 @@ void CCudaFilteredBackProjectionAlgorithm::run(int _iNrIterations /* = 0 */) volgeom.getGridRowCount(), volgeom.getPixelLengthX()); // TODO: off-center geometry - ok &= m_pFBP->setProjectionGeometry(projgeom.getProjectionAngleCount(), - projgeom.getDetectorCount(), - projgeom.getProjectionAngles(), - projgeom.getDetectorWidth()); + int iDetectorCount; + if (parprojgeom) { + ok &= m_pFBP->setProjectionGeometry(parprojgeom->getProjectionAngleCount(), + parprojgeom->getDetectorCount(), + parprojgeom->getProjectionAngles(), + parprojgeom->getDetectorWidth()); + iDetectorCount = parprojgeom->getDetectorCount(); + } else if (fanprojgeom) { + ok &= m_pFBP->setFanGeometry(fanprojgeom->getProjectionAngleCount(), + fanprojgeom->getDetectorCount(), + fanprojgeom->getProjectionAngles(), + fanprojgeom->getOriginSourceDistance(), + fanprojgeom->getOriginDetectorDistance(), + fanprojgeom->getDetectorWidth(), + false); // TODO: Support short-scan + + iDetectorCount = fanprojgeom->getDetectorCount(); + } else { + assert(false); + } ok &= m_pFBP->setPixelSuperSampling(m_iPixelSuperSampling); @@ -252,7 +270,7 @@ void CCudaFilteredBackProjectionAlgorithm::run(int _iNrIterations /* = 0 */) ok &= m_pFBP->init(m_iGPUIndex); ASTRA_ASSERT(ok); - ok &= m_pFBP->setSinogram(m_pSinogram->getDataConst(), projgeom.getDetectorCount()); + ok &= m_pFBP->setSinogram(m_pSinogram->getDataConst(), iDetectorCount); ASTRA_ASSERT(ok); ok &= m_pFBP->setFilter(m_eFilter, m_pfFilter, m_iFilterWidth, m_fFilterD, m_fFilterParameter); -- cgit v1.2.3