r234: Fixed scaling bug with redundant rotations around phantom
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 3 Dec 2000 15:16:18 +0000 (15:16 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 3 Dec 2000 15:16:18 +0000 (15:16 +0000)
ChangeLog
include/backprojectors.h
libctsim/backprojectors.cpp

index 582e251e912f3391963d2bba78bd976d14f29c03..876515c403a2ed78be9b6f936e4341dd405040cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
    Fixed minor compilation problem with procsignal.h
    Updated README file
    Fixed bug when simulating projections and Trace == CONSOLE
+   Fixed scaling bug when performing redundant rotations around object
        
 2.0.5 - 12/01/00
    Improved compilation on RedHat 7
index ef70d0581657f58ea6e10d6389027a178071282c..e3418dfe192d783c165d4db6be4b8ec2c20a8939 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: backprojectors.h,v 1.15 2000/09/02 05:10:39 kevin Exp $
+**  $Id: backprojectors.h,v 1.16 2000/12/03 15:16:17 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -126,7 +126,7 @@ class Backproject
     kint32 nx;
     kint32 ny;
     double detInc;
-    double rotInc;
+    double rotScale;
     int iDetCenter;            // index refering to L=0 projection 
     int nDet;
     double xMin, xMax, yMin, yMax;     // Retangular coords of phantom
index 8c785ac45bdfbe38b7fccb5358241c8096468723..152e026770059dcee869e6161d6d373639b85f5a 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: backprojectors.cpp,v 1.14 2000/09/02 05:10:39 kevin Exp $
+**  $Id: backprojectors.cpp,v 1.15 2000/12/03 15:16:18 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -262,7 +262,8 @@ Backproject::Backproject (const Projections& proj, ImageFile& im, const int inte
   detInc = proj.detInc();
   nDet = proj.nDet();
   iDetCenter = (nDet - 1) / 2; // index refering to L=0 projection 
-  rotInc = proj.rotInc();
+  rotScale = proj.rotInc();
+  rotScale /= (proj.nView() * proj.rotInc() / PI); // scale by number of PI rotations
 
   v = im.getArray();
   nx = im.nx();
@@ -288,7 +289,7 @@ Backproject::ScaleImageByRotIncrement ()
 {
   for (int ix = 0; ix < nx; ix++)
     for (int iy = 0; iy < ny; iy++)
-      v[ix][iy] *= rotInc;
+      v[ix][iy] *= rotScale;
 }
 
 void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double r, double phi, double L, int iDetPos)
@@ -335,7 +336,7 @@ BackprojectTrig::BackprojectView (const double* const filteredProj, const double
        if (iDetPos < 0 || iDetPos >= nDet)     // check for impossible: index outside of raysum pos 
            errorIndexOutsideDetector (ix, iy, theta, r, phi, L, iDetPos);
        else
-         v[ix][iy] += rotInc * filteredProj[iDetPos];
+         v[ix][iy] += rotScale * filteredProj[iDetPos];
       } else if (interpType == Backprojector::INTERP_LINEAR) {
          double p = L / detInc;        // position along detector
          double pFloor = floor (p);
@@ -344,7 +345,7 @@ BackprojectTrig::BackprojectView (const double* const filteredProj, const double
          if (iDetPos < 0 || iDetPos >= nDet - 1)       // check for impossible: index outside of raysum pos 
            errorIndexOutsideDetector (ix, iy, theta, r, phi, L, iDetPos);
          else
-           v[ix][iy] += rotInc * ((1-frac) * filteredProj[iDetPos] + frac * filteredProj[iDetPos+1]);
+           v[ix][iy] += rotScale * ((1-frac) * filteredProj[iDetPos] + frac * filteredProj[iDetPos+1]);
       }
     }
   }
@@ -493,7 +494,7 @@ BackprojectDiff2::BackprojectView (const double* const filteredProj, const doubl
   double detPosColStart = start_r * cos (theta - start_phi) / detInc;
        
 #ifdef DEBUG
-  printf ("start_r=%8.5f, start_phi=%8.5f, rotInc=%8.5f\n", start_r, start_phi, rotInc);
+  printf ("start_r=%8.5f, start_phi=%8.5f, rotScale=%8.5f\n", start_r, start_phi, rotScale);
 #endif
   for (int ix = 0; ix < nx; ix++, detPosColStart += det_dx) {
     double curDetPos = detPosColStart;