diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2016-03-08 15:41:38 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2016-04-18 11:54:31 +0200 |
commit | 048755bab6b77c1da0050ed091e5007a60564adf (patch) | |
tree | 4f0f2f1dabbf5d5fc01191c54fccd5a0f8eb3757 /src | |
parent | b474576d36554f9322b57fedeeae493d88491f31 (diff) | |
download | astra-048755bab6b77c1da0050ed091e5007a60564adf.tar.gz astra-048755bab6b77c1da0050ed091e5007a60564adf.tar.bz2 astra-048755bab6b77c1da0050ed091e5007a60564adf.tar.xz astra-048755bab6b77c1da0050ed091e5007a60564adf.zip |
Use CompositeGeometryManager for FDK
Also fix a number of scaling/weighting issues in FDK, and
switch to standard cone_bp with FDKWeighting for the BP step.
Diffstat (limited to 'src')
-rw-r--r-- | src/CompositeGeometryManager.cpp | 50 | ||||
-rw-r--r-- | src/CudaFDKAlgorithm3D.cpp | 9 |
2 files changed, 56 insertions, 3 deletions
diff --git a/src/CompositeGeometryManager.cpp b/src/CompositeGeometryManager.cpp index 084ba8c..c5b4d3b 100644 --- a/src/CompositeGeometryManager.cpp +++ b/src/CompositeGeometryManager.cpp @@ -146,6 +146,7 @@ bool CCompositeGeometryManager::splitJobs(TJobSet &jobs, size_t maxSize, int div newjob.eType = j->eType; newjob.eMode = j->eMode; newjob.pProjector = j->pProjector; + newjob.FDKSettings = j->FDKSettings; CPart* input = job.pInput->reduce(outputPart.get()); @@ -992,6 +993,25 @@ bool CCompositeGeometryManager::doBP(CProjector3D *pProjector, CFloat32VolumeDat return doJobs(L); } + +bool CCompositeGeometryManager::doFDK(CProjector3D *pProjector, CFloat32VolumeData3DMemory *pVolData, + CFloat32ProjectionData3DMemory *pProjData, bool bShortScan) +{ + if (!dynamic_cast<CConeProjectionGeometry3D*>(pProjData->getGeometry())) { + ASTRA_ERROR("CCompositeGeometryManager::doFDK: cone geometry required"); + return false; + } + + SJob job = createJobBP(pProjector, pVolData, pProjData); + job.eType = SJob::JOB_FDK; + job.FDKSettings.bShortScan = bShortScan; + + TJobList L; + L.push_back(job); + + return doJobs(L); +} + bool CCompositeGeometryManager::doFP(CProjector3D *pProjector, const std::vector<CFloat32VolumeData3DMemory *>& volData, const std::vector<CFloat32ProjectionData3DMemory *>& projData) { ASTRA_DEBUG("CCompositeGeometryManager::doFP, multi-volume"); @@ -1185,7 +1205,9 @@ static bool doJob(const CCompositeGeometryManager::TJobSet::const_iterator& iter ok = astraCUDA3d::copyToGPUMemory(src, inputMem, srcdims); if (!ok) ASTRA_ERROR("Error copying input data to GPU"); - if (j.eType == CCompositeGeometryManager::SJob::JOB_FP) { + switch (j.eType) { + case CCompositeGeometryManager::SJob::JOB_FP: + { assert(dynamic_cast<CCompositeGeometryManager::CVolumePart*>(j.pInput.get())); assert(dynamic_cast<CCompositeGeometryManager::CProjectionPart*>(j.pOutput.get())); @@ -1194,7 +1216,10 @@ static bool doJob(const CCompositeGeometryManager::TJobSet::const_iterator& iter ok = astraCUDA3d::FP(((CCompositeGeometryManager::CProjectionPart*)j.pOutput.get())->pGeom, outputMem, ((CCompositeGeometryManager::CVolumePart*)j.pInput.get())->pGeom, inputMem, detectorSuperSampling, projKernel); if (!ok) ASTRA_ERROR("Error performing sub-FP"); ASTRA_DEBUG("CCompositeGeometryManager::doJobs: FP done"); - } else if (j.eType == CCompositeGeometryManager::SJob::JOB_BP) { + } + break; + case CCompositeGeometryManager::SJob::JOB_BP: + { assert(dynamic_cast<CCompositeGeometryManager::CVolumePart*>(j.pOutput.get())); assert(dynamic_cast<CCompositeGeometryManager::CProjectionPart*>(j.pInput.get())); @@ -1203,7 +1228,26 @@ static bool doJob(const CCompositeGeometryManager::TJobSet::const_iterator& iter ok = astraCUDA3d::BP(((CCompositeGeometryManager::CProjectionPart*)j.pInput.get())->pGeom, inputMem, ((CCompositeGeometryManager::CVolumePart*)j.pOutput.get())->pGeom, outputMem, voxelSuperSampling); if (!ok) ASTRA_ERROR("Error performing sub-BP"); ASTRA_DEBUG("CCompositeGeometryManager::doJobs: BP done"); - } else { + } + break; + case CCompositeGeometryManager::SJob::JOB_FDK: + { + assert(dynamic_cast<CCompositeGeometryManager::CVolumePart*>(j.pOutput.get())); + assert(dynamic_cast<CCompositeGeometryManager::CProjectionPart*>(j.pInput.get())); + + if (srcdims.subx || srcdims.suby) { + ASTRA_ERROR("CCompositeGeometryManager::doJobs: data too large for FDK"); + ok = false; + } else { + ASTRA_DEBUG("CCompositeGeometryManager::doJobs: doing FDK"); + + ok = astraCUDA3d::FDK(((CCompositeGeometryManager::CProjectionPart*)j.pInput.get())->pGeom, inputMem, ((CCompositeGeometryManager::CVolumePart*)j.pOutput.get())->pGeom, outputMem, j.FDKSettings.bShortScan); + if (!ok) ASTRA_ERROR("Error performing sub-FDK"); + ASTRA_DEBUG("CCompositeGeometryManager::doJobs: FDK done"); + } + } + break; + default: assert(false); } diff --git a/src/CudaFDKAlgorithm3D.cpp b/src/CudaFDKAlgorithm3D.cpp index e101a42..c7c8ed5 100644 --- a/src/CudaFDKAlgorithm3D.cpp +++ b/src/CudaFDKAlgorithm3D.cpp @@ -32,6 +32,7 @@ $Id$ #include "astra/CudaProjector3D.h" #include "astra/ConeProjectionGeometry3D.h" +#include "astra/CompositeGeometryManager.h" #include "astra/Logging.h" @@ -206,6 +207,7 @@ void CCudaFDKAlgorithm3D::run(int _iNrIterations) ASTRA_ASSERT(pReconMem); +#if 0 bool ok = true; ok = astraCudaFDK(pReconMem->getData(), pSinoMem->getDataConst(), @@ -213,6 +215,13 @@ void CCudaFDKAlgorithm3D::run(int _iNrIterations) m_bShortScan, m_iGPUIndex, m_iVoxelSuperSampling); ASTRA_ASSERT(ok); +#endif + + CCompositeGeometryManager cgm; + + cgm.doFDK(m_pProjector, pReconMem, pSinoMem, m_bShortScan); + + } //---------------------------------------------------------------------------------------- |