From f591df5ff62deb8de2956cc8200db4034fb6ea05 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 14 Feb 2017 14:10:08 +0100 Subject: Fix FDK shortscan weighting It was computing weights for angles in [0,2pi) but using them on angles in (-2pi,0]. --- cuda/3d/fdk.cu | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'cuda/3d/fdk.cu') diff --git a/cuda/3d/fdk.cu b/cuda/3d/fdk.cu index bf41b62..27357ad 100644 --- a/cuda/3d/fdk.cu +++ b/cuda/3d/fdk.cu @@ -121,14 +121,8 @@ __global__ void devFDK_ParkerWeight(void* D_projData, unsigned int projPitch, un // TODO: Detector pixel size const float fU = (detectorU - 0.5f*dims.iProjU + 0.5f) * fDetUSize; - //const float fGamma = atanf(fU / fCentralRayLength); - //const float fBeta = gC_angle[angle]; const float fGamma = atanf(fU / fCentralRayLength); - float fBeta = -gC_angle[angle]; - if (fBeta < 0.0f) - fBeta += 2*M_PI; - if (fBeta >= 2*M_PI) - fBeta -= 2*M_PI; + float fBeta = gC_angle[angle]; // compute the weight depending on the location in the central fan's radon // space @@ -195,24 +189,23 @@ bool FDK_PreWeight(cudaPitchedPtr D_projData, float fAngleBase; if (fdA >= 0.0f) { // going up from angles[0] - fAngleBase = angles[dims.iProjAngles - 1]; + fAngleBase = angles[0]; } else { // going down from angles[0] - fAngleBase = angles[0]; + fAngleBase = angles[dims.iProjAngles - 1]; } - // We pick the highest end of the range, and then - // move all angles so they fall in (-2pi,0] + // We pick the lowest end of the range, and then + // move all angles so they fall in [0,2pi) float *fRelAngles = new float[dims.iProjAngles]; for (unsigned int i = 0; i < dims.iProjAngles; ++i) { float f = angles[i] - fAngleBase; - while (f > 0) + while (f >= 2*M_PI) f -= 2*M_PI; - while (f <= -2*M_PI) + while (f < 0) f += 2*M_PI; fRelAngles[i] = f; - } cudaError_t e1 = cudaMemcpyToSymbol(gC_angle, fRelAngles, -- cgit v1.2.3