summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cuda/2d/algo.cu18
-rw-r--r--cuda/2d/fbp.cu15
-rw-r--r--cuda/2d/sart.cu8
-rw-r--r--include/astra/cuda/2d/algo.h2
-rw-r--r--include/astra/cuda/2d/fbp.h6
5 files changed, 29 insertions, 20 deletions
diff --git a/cuda/2d/algo.cu b/cuda/2d/algo.cu
index 59ea984..be15b25 100644
--- a/cuda/2d/algo.cu
+++ b/cuda/2d/algo.cu
@@ -134,8 +134,8 @@ bool ReconAlgo::setGeometry(const astra::CVolumeGeometry2D* pVolGeom,
delete[] fanProjs;
fanProjs = 0;
- fOutputScale = 1.0f;
- ok = convertAstraGeometry(pVolGeom, pProjGeom, parProjs, fanProjs, fOutputScale);
+ fProjectorScale = 1.0f;
+ ok = convertAstraGeometry(pVolGeom, pProjGeom, parProjs, fanProjs, fProjectorScale);
if (!ok)
return false;
@@ -153,12 +153,6 @@ bool ReconAlgo::setSuperSampling(int raysPerDet, int raysPerPixelDim)
return true;
}
-bool ReconAlgo::setReconstructionScale(float fScale)
-{
- fOutputScale *= fScale;
- return true;
-}
-
bool ReconAlgo::setVolumeMask(float* _D_maskData, unsigned int _maskPitch)
{
assert(useVolumeMask);
@@ -317,11 +311,11 @@ bool ReconAlgo::callFP(float* D_volumeData, unsigned int volumePitch,
if (parProjs) {
assert(!fanProjs);
return FP(D_volumeData, volumePitch, D_projData, projPitch,
- dims, parProjs, fOutputScale * outputScale);
+ dims, parProjs, fProjectorScale * outputScale);
} else {
assert(fanProjs);
return FanFP(D_volumeData, volumePitch, D_projData, projPitch,
- dims, fanProjs, fOutputScale * outputScale);
+ dims, fanProjs, fProjectorScale * outputScale);
}
}
@@ -332,11 +326,11 @@ bool ReconAlgo::callBP(float* D_volumeData, unsigned int volumePitch,
if (parProjs) {
assert(!fanProjs);
return BP(D_volumeData, volumePitch, D_projData, projPitch,
- dims, parProjs, fOutputScale * outputScale);
+ dims, parProjs, fProjectorScale * outputScale);
} else {
assert(fanProjs);
return FanBP(D_volumeData, volumePitch, D_projData, projPitch,
- dims, fanProjs, fOutputScale * outputScale);
+ dims, fanProjs, fProjectorScale * outputScale);
}
}
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)
{
diff --git a/cuda/2d/sart.cu b/cuda/2d/sart.cu
index 64973ba..aff77a3 100644
--- a/cuda/2d/sart.cu
+++ b/cuda/2d/sart.cu
@@ -254,11 +254,11 @@ bool SART::callFP_SART(float* D_volumeData, unsigned int volumePitch,
if (parProjs) {
assert(!fanProjs);
return FP(D_volumeData, volumePitch, D_projData, projPitch,
- d, &parProjs[angle], outputScale);
+ d, &parProjs[angle], outputScale * fProjectorScale);
} else {
assert(fanProjs);
return FanFP(D_volumeData, volumePitch, D_projData, projPitch,
- d, &fanProjs[angle], outputScale);
+ d, &fanProjs[angle], outputScale * fProjectorScale);
}
}
@@ -269,11 +269,11 @@ bool SART::callBP_SART(float* D_volumeData, unsigned int volumePitch,
if (parProjs) {
assert(!fanProjs);
return BP_SART(D_volumeData, volumePitch, D_projData, projPitch,
- angle, dims, parProjs, outputScale);
+ angle, dims, parProjs, outputScale * fProjectorScale);
} else {
assert(fanProjs);
return FanBP_SART(D_volumeData, volumePitch, D_projData, projPitch,
- angle, dims, fanProjs, outputScale);
+ angle, dims, fanProjs, outputScale * fProjectorScale);
}
}
diff --git a/include/astra/cuda/2d/algo.h b/include/astra/cuda/2d/algo.h
index b6ec231..b670b8b 100644
--- a/include/astra/cuda/2d/algo.h
+++ b/include/astra/cuda/2d/algo.h
@@ -136,7 +136,7 @@ protected:
SDimensions dims;
SParProjection* parProjs;
SFanProjection* fanProjs;
- float fOutputScale;
+ float fProjectorScale;
bool freeGPUMemory;
diff --git a/include/astra/cuda/2d/fbp.h b/include/astra/cuda/2d/fbp.h
index 1adf3b1..3aa4741 100644
--- a/include/astra/cuda/2d/fbp.h
+++ b/include/astra/cuda/2d/fbp.h
@@ -79,6 +79,11 @@ public:
bool setShortScan(bool ss) { m_bShortScan = ss; return true; }
+ // Scale the final reconstruction.
+ // May be called at any time before iterate().
+ bool setReconstructionScale(float fScale);
+
+
virtual bool init();
virtual bool iterate(unsigned int iterations);
@@ -90,6 +95,7 @@ protected:
void* D_filter; // cufftComplex*
bool m_bShortScan;
+ float fReconstructionScale;
};
}