diff options
author | Willem Jan Palenstijn <wjp@usecode.org> | 2016-04-14 13:12:51 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <wjp@usecode.org> | 2016-04-14 13:12:51 +0200 |
commit | 7633a0f48ce030413642627f16e50d27da4cf709 (patch) | |
tree | 53150eade1dd920644c690a1d9da741cedcefdf6 /src/CudaSirtAlgorithm.cpp | |
parent | a7c4275ee8cd90b4ecf7fbca5d9571aae62a2931 (diff) | |
parent | 16430239d04ff738a21146c410918c285552543f (diff) | |
download | astra-7633a0f48ce030413642627f16e50d27da4cf709.tar.gz astra-7633a0f48ce030413642627f16e50d27da4cf709.tar.bz2 astra-7633a0f48ce030413642627f16e50d27da4cf709.tar.xz astra-7633a0f48ce030413642627f16e50d27da4cf709.zip |
Merge pull request #35 from wjp/relaxation
Add relaxation factor option to SIRT, SART
Diffstat (limited to 'src/CudaSirtAlgorithm.cpp')
-rw-r--r-- | src/CudaSirtAlgorithm.cpp | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/src/CudaSirtAlgorithm.cpp b/src/CudaSirtAlgorithm.cpp index 33e381a..c8dc677 100644 --- a/src/CudaSirtAlgorithm.cpp +++ b/src/CudaSirtAlgorithm.cpp @@ -50,6 +50,8 @@ CCudaSirtAlgorithm::CCudaSirtAlgorithm() m_pMinMask = 0; m_pMaxMask = 0; + + m_fLambda = 1.0f; } //---------------------------------------------------------------------------------------- @@ -86,6 +88,8 @@ bool CCudaSirtAlgorithm::initialize(const Config& _cfg) } CC.markOptionParsed("MaxMaskId"); + m_fLambda = _cfg.self.getOptionNumerical("Relaxation", 1.0f); + CC.markOptionParsed("Relaxation"); m_pAlgo = new astraCUDA::SIRT(); m_bAlgoInit = false; @@ -108,41 +112,30 @@ bool CCudaSirtAlgorithm::initialize(CProjector2D* _pProjector, m_pAlgo = new astraCUDA::SIRT(); m_bAlgoInit = false; + m_fLambda = 1.0f; return true; } //---------------------------------------------------------------------------------------- -// Iterate -void CCudaSirtAlgorithm::run(int _iNrIterations) + +void CCudaSirtAlgorithm::initCUDAAlgorithm() { - // check initialized - ASTRA_ASSERT(m_bIsInitialized); + CCudaReconstructionAlgorithm2D::initCUDAAlgorithm(); - if (!m_bAlgoInit) { - // We only override the initialisation step to copy the min/max masks + astraCUDA::SIRT* pSirt = dynamic_cast<astraCUDA::SIRT*>(m_pAlgo); - bool ok = setupGeometry(); + if (m_pMinMask || m_pMaxMask) { + const CVolumeGeometry2D& volgeom = *m_pReconstruction->getGeometry(); + const float *pfMinMaskData = 0; + const float *pfMaxMaskData = 0; + if (m_pMinMask) pfMinMaskData = m_pMinMask->getDataConst(); + if (m_pMaxMask) pfMaxMaskData = m_pMaxMask->getDataConst(); + bool ok = pSirt->uploadMinMaxMasks(pfMinMaskData, pfMaxMaskData, volgeom.getGridColCount()); ASTRA_ASSERT(ok); - - ok = m_pAlgo->allocateBuffers(); - ASTRA_ASSERT(ok); - - if (m_pMinMask || m_pMaxMask) { - const CVolumeGeometry2D& volgeom = *m_pReconstruction->getGeometry(); - astraCUDA::SIRT* pSirt = dynamic_cast<astraCUDA::SIRT*>(m_pAlgo); - const float *pfMinMaskData = 0; - const float *pfMaxMaskData = 0; - if (m_pMinMask) pfMinMaskData = m_pMinMask->getDataConst(); - if (m_pMaxMask) pfMaxMaskData = m_pMaxMask->getDataConst(); - ok = pSirt->uploadMinMaxMasks(pfMinMaskData, pfMaxMaskData, volgeom.getGridColCount()); - ASTRA_ASSERT(ok); - } - - m_bAlgoInit = true; } - CCudaReconstructionAlgorithm2D::run(_iNrIterations); + pSirt->setRelaxation(m_fLambda); } |