diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2014-10-06 11:46:53 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2014-10-06 13:23:40 +0200 |
commit | 5d5f27a910d1fa63974cf4f4dc2485c60906441c (patch) | |
tree | 9cb52f6eaedf74a8998c76d03c82edb0c988f5b2 /src | |
parent | 52d34e926ee5a42d875dede9303ae898548fdc85 (diff) | |
download | astra-5d5f27a910d1fa63974cf4f4dc2485c60906441c.tar.gz astra-5d5f27a910d1fa63974cf4f4dc2485c60906441c.tar.bz2 astra-5d5f27a910d1fa63974cf4f4dc2485c60906441c.tar.xz astra-5d5f27a910d1fa63974cf4f4dc2485c60906441c.zip |
Start supporting flexible 2D volume geometry in Cuda FBP too
Diffstat (limited to 'src')
-rw-r--r-- | src/CudaFilteredBackProjectionAlgorithm.cpp | 61 |
1 files changed, 47 insertions, 14 deletions
diff --git a/src/CudaFilteredBackProjectionAlgorithm.cpp b/src/CudaFilteredBackProjectionAlgorithm.cpp index 39740c8..63f4f40 100644 --- a/src/CudaFilteredBackProjectionAlgorithm.cpp +++ b/src/CudaFilteredBackProjectionAlgorithm.cpp @@ -32,6 +32,7 @@ $Id$ #include <cstring> #include "astra/AstraObjectManager.h" +#include "../cuda/2d/astra.h" #include <astra/Logger.h> @@ -241,28 +242,65 @@ void CCudaFilteredBackProjectionAlgorithm::run(int _iNrIterations /* = 0 */) bool ok = true; - // TODO: off-center geometry, non-square pixels + // TODO: non-square pixels? ok &= m_pFBP->setReconstructionGeometry(volgeom.getGridColCount(), volgeom.getGridRowCount(), volgeom.getPixelLengthX()); - // TODO: off-center geometry int iDetectorCount; if (parprojgeom) { + + float *offsets, *angles, detSize, outputScale; + + ok = convertAstraGeometry(&volgeom, parprojgeom, offsets, angles, detSize, outputScale); + + ok &= m_pFBP->setProjectionGeometry(parprojgeom->getProjectionAngleCount(), parprojgeom->getDetectorCount(), - parprojgeom->getProjectionAngles(), + angles, parprojgeom->getDetectorWidth()); iDetectorCount = parprojgeom->getDetectorCount(); + + // TODO: Are detSize and outputScale handled correctly? + + if (offsets) + ok &= m_pFBP->setTOffsets(offsets); + ASTRA_ASSERT(ok); + + delete[] offsets; + delete[] angles; + } else if (fanprojgeom) { + + astraCUDA::SFanProjection* projs; + float outputScale; + + // FIXME: Implement this, and clean up the interface to AstraFBP. + if (abs(volgeom.getWindowMinX() + volgeom.getWindowMaxX()) > 0.00001 * volgeom.getPixelLengthX()) { + // Off-center volume geometry isn't supported yet + ASTRA_ASSERT(false); + } + if (abs(volgeom.getWindowMinY() + volgeom.getWindowMaxY()) > 0.00001 * volgeom.getPixelLengthY()) { + // Off-center volume geometry isn't supported yet + ASTRA_ASSERT(false); + } + + ok = convertAstraGeometry(&volgeom, fanprojgeom, projs, outputScale); + + // CHECKME: outputScale? + ok &= m_pFBP->setFanGeometry(fanprojgeom->getProjectionAngleCount(), - fanprojgeom->getDetectorCount(), - fanprojgeom->getProjectionAngles(), - fanprojgeom->getOriginSourceDistance(), - fanprojgeom->getOriginDetectorDistance(), - fanprojgeom->getDetectorWidth(), - m_bShortScan); + fanprojgeom->getDetectorCount(), + projs, + fanprojgeom->getProjectionAngles(), + fanprojgeom->getOriginSourceDistance(), + fanprojgeom->getOriginDetectorDistance(), + + fanprojgeom->getDetectorWidth(), + m_bShortScan); iDetectorCount = fanprojgeom->getDetectorCount(); + + delete[] projs; } else { assert(false); } @@ -271,11 +309,6 @@ void CCudaFilteredBackProjectionAlgorithm::run(int _iNrIterations /* = 0 */) ASTRA_ASSERT(ok); - const float *pfTOffsets = m_pSinogram->getGeometry()->getExtraDetectorOffset(); - if (pfTOffsets) - ok &= m_pFBP->setTOffsets(pfTOffsets); - ASTRA_ASSERT(ok); - ok &= m_pFBP->init(m_iGPUIndex); ASTRA_ASSERT(ok); |