diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CompositeGeometryManager.cpp | 50 | ||||
| -rw-r--r-- | src/CudaFDKAlgorithm3D.cpp | 20 | 
2 files changed, 67 insertions, 3 deletions
diff --git a/src/CompositeGeometryManager.cpp b/src/CompositeGeometryManager.cpp index c63faaa..7c4f8e6 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()); @@ -1039,6 +1040,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"); @@ -1232,7 +1252,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())); @@ -1241,7 +1263,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())); @@ -1250,7 +1275,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 b5ce545..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" @@ -81,6 +82,17 @@ bool CCudaFDKAlgorithm3D::_check()  	const CProjectionGeometry3D* projgeom = m_pSinogram->getGeometry();  	ASTRA_CONFIG_CHECK(dynamic_cast<const CConeProjectionGeometry3D*>(projgeom), "CUDA_FDK", "Error setting FDK geometry"); + +	const CVolumeGeometry3D* volgeom = m_pReconstruction->getGeometry(); +	bool cube = true; +	if (abs(volgeom->getPixelLengthX() / volgeom->getPixelLengthY() - 1.0) > 0.00001) +		cube = false; +	if (abs(volgeom->getPixelLengthX() / volgeom->getPixelLengthZ() - 1.0) > 0.00001) +		cube = false; +	ASTRA_CONFIG_CHECK(cube, "CUDA_FDK", "Voxels must be cubes for FDK"); + + +  	return true;  } @@ -195,6 +207,7 @@ void CCudaFDKAlgorithm3D::run(int _iNrIterations)  	ASTRA_ASSERT(pReconMem); +#if 0  	bool ok = true;  	ok = astraCudaFDK(pReconMem->getData(), pSinoMem->getDataConst(), @@ -202,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); + +  }  //----------------------------------------------------------------------------------------  | 
