From 48f4e7b165404a0375db300b9fe59da92edf1cce Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 30 Mar 2019 20:49:42 +0100 Subject: Adjust FBP to line integral scaling --- cuda/2d/fbp.cu | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'cuda/2d/fbp.cu') diff --git a/cuda/2d/fbp.cu b/cuda/2d/fbp.cu index a5b8a7a..65f1d68 100644 --- a/cuda/2d/fbp.cu +++ b/cuda/2d/fbp.cu @@ -321,15 +321,14 @@ bool FBP::iterate(unsigned int iterations) if (fanProjs) { float fOutputScale = 1.0 / (/*fPixelSize * fPixelSize * fPixelSize * */ fFanDetSize * fFanDetSize); - ok = FanBP_FBPWeighted(D_volumeData, volumePitch, D_sinoData, sinoPitch, dims, fanProjs, fOutputScale); + ok = FanBP_FBPWeighted(D_volumeData, volumePitch, D_sinoData, sinoPitch, dims, fanProjs, fOutputScale * this->fOutputScale); } else { // scale by number of angles. For the fan-beam case, this is already // handled by FDK_PreWeight float fOutputScale = (M_PI / 2.0f) / (float)dims.iProjAngles; - //fOutputScale /= fDetSize * fDetSize; - ok = BP(D_volumeData, volumePitch, D_sinoData, sinoPitch, dims, parProjs, fOutputScale); + ok = BP(D_volumeData, volumePitch, D_sinoData, sinoPitch, dims, parProjs, fOutputScale * this->fOutputScale); } if(!ok) { -- cgit v1.2.3 From 11114e33fb504b0b74f3d239e77fe248a027cc23 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 30 Mar 2019 21:12:01 +0100 Subject: Clean up outputscale naming confusion in cuda::algo --- cuda/2d/fbp.cu | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'cuda/2d/fbp.cu') diff --git a/cuda/2d/fbp.cu b/cuda/2d/fbp.cu index 65f1d68..f0edc19 100644 --- a/cuda/2d/fbp.cu +++ b/cuda/2d/fbp.cu @@ -58,7 +58,8 @@ int FBP::calcFourierFilterSize(int _iDetectorCount) FBP::FBP() : ReconAlgo() { D_filter = 0; - + m_bShortScan = false; + fReconstructionScale = 1.0f; } FBP::~FBP() @@ -72,6 +73,8 @@ void FBP::reset() freeComplexOnDevice((cufftComplex *)D_filter); D_filter = 0; } + m_bShortScan = false; + fReconstructionScale = 1.0f; } bool FBP::init() @@ -79,6 +82,12 @@ bool FBP::init() return true; } +bool FBP::setReconstructionScale(float fScale) +{ + fReconstructionScale = fScale; + return true; +} + bool FBP::setFilter(const astra::SFilterConfig &_cfg) { if (D_filter) @@ -321,14 +330,14 @@ bool FBP::iterate(unsigned int iterations) if (fanProjs) { float fOutputScale = 1.0 / (/*fPixelSize * fPixelSize * fPixelSize * */ fFanDetSize * fFanDetSize); - ok = FanBP_FBPWeighted(D_volumeData, volumePitch, D_sinoData, sinoPitch, dims, fanProjs, fOutputScale * this->fOutputScale); + ok = FanBP_FBPWeighted(D_volumeData, volumePitch, D_sinoData, sinoPitch, dims, fanProjs, fOutputScale * fProjectorScale * fReconstructionScale); } else { // scale by number of angles. For the fan-beam case, this is already // handled by FDK_PreWeight float fOutputScale = (M_PI / 2.0f) / (float)dims.iProjAngles; - ok = BP(D_volumeData, volumePitch, D_sinoData, sinoPitch, dims, parProjs, fOutputScale * this->fOutputScale); + ok = BP(D_volumeData, volumePitch, D_sinoData, sinoPitch, dims, parProjs, fOutputScale * fProjectorScale * fReconstructionScale); } if(!ok) { -- cgit v1.2.3 From 975537c8c68b115399af522cb1a0a1e731eca576 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 2 Apr 2019 15:56:57 +0200 Subject: Fix fan-beam FBP scaling --- cuda/2d/fbp.cu | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'cuda/2d/fbp.cu') diff --git a/cuda/2d/fbp.cu b/cuda/2d/fbp.cu index f0edc19..28cdd92 100644 --- a/cuda/2d/fbp.cu +++ b/cuda/2d/fbp.cu @@ -301,7 +301,7 @@ bool FBP::iterate(unsigned int iterations) astraCUDA3d::FDK_PreWeight(tmp, fOriginSource, fOriginDetector, 0.0f, - fFanDetSize, 1.0f, /* fPixelSize */ 1.0f, + fFanDetSize, 1.0f, /* fPixelSize, but is normalized */ 1.0f, m_bShortScan, dims3d, pfAngles); } else { // TODO: How should different detector pixel size in different @@ -328,9 +328,7 @@ bool FBP::iterate(unsigned int iterations) } if (fanProjs) { - float fOutputScale = 1.0 / (/*fPixelSize * fPixelSize * fPixelSize * */ fFanDetSize * fFanDetSize); - - ok = FanBP_FBPWeighted(D_volumeData, volumePitch, D_sinoData, sinoPitch, dims, fanProjs, fOutputScale * fProjectorScale * fReconstructionScale); + ok = FanBP_FBPWeighted(D_volumeData, volumePitch, D_sinoData, sinoPitch, dims, fanProjs, fProjectorScale * fReconstructionScale); } else { // scale by number of angles. For the fan-beam case, this is already -- cgit v1.2.3 From 9950fc9bf91073c0168c8847a8f6a8814690f97c Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 4 Apr 2019 12:09:07 +0200 Subject: Small clean up of factors --- cuda/2d/fbp.cu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cuda/2d/fbp.cu') diff --git a/cuda/2d/fbp.cu b/cuda/2d/fbp.cu index 28cdd92..4fc3983 100644 --- a/cuda/2d/fbp.cu +++ b/cuda/2d/fbp.cu @@ -301,7 +301,7 @@ bool FBP::iterate(unsigned int iterations) astraCUDA3d::FDK_PreWeight(tmp, fOriginSource, fOriginDetector, 0.0f, - fFanDetSize, 1.0f, /* fPixelSize, but is normalized */ 1.0f, + fFanDetSize, 1.0f, m_bShortScan, dims3d, pfAngles); } else { // TODO: How should different detector pixel size in different -- cgit v1.2.3