r623: no message
[ctsim.git] / libctsim / backprojectors.cpp
index fc3c95882dd768458613be752749c10e759978a9..bfd594e8697ef0075b98ce6bce5b325261b4b082 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backprojectors.cpp,v 1.28 2001/02/23 02:06:01 kevin Exp $
+**  $Id: backprojectors.cpp,v 1.30 2001/03/07 19:02:44 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
@@ -289,6 +289,7 @@ Backproject::Backproject (const Projections& proj, ImageFile& im, int interpType
   yInc = (yMax - yMin) / ny;
   
   m_dFocalLength = proj.focalLength();
+  m_dSourceDetectorLength = proj.sourceDetectorLength();
 }
 
 Backproject::~Backproject ()
@@ -364,7 +365,7 @@ BackprojectTrig::BackprojectView (const double* const filteredProj, const double
         double frac = p - pFloor;      // fraction distance from det
         if (iDetPos >= 0 && iDetPos < nDet - 1)
           v[ix][iy] += rotScale * ((1-frac) * filteredProj[iDetPos] + frac * filteredProj[iDetPos+1]);
-      } else if (interpType = Backprojector::INTERP_CUBIC) {
+      } else if (interpType == Backprojector::INTERP_CUBIC) {
         double p = iDetCenter + (L / detInc);  // position along detector
         if (p >= 0 && p < nDet)
           v[ix][iy] += rotScale * pCubicInterp->interpolate (p);
@@ -440,7 +441,7 @@ BackprojectTable::BackprojectView (const double* const filteredProj, const doubl
         double frac = dPos - dPosFloor;        // fraction distance from det 
         if (iDetPos >= 0 && iDetPos < nDet - 1)
           pImCol[iy] += ((1-frac) * filteredProj[iDetPos] + frac * filteredProj[iDetPos+1]);
-      } else if (interpType = Backprojector::INTERP_CUBIC) {
+      } else if (interpType == Backprojector::INTERP_CUBIC) {
         double p = iDetCenter + (L / detInc);  // position along detector
         if (p >= 0 && p < nDet)
           pImCol[iy] += pCubicInterp->interpolate (p);
@@ -517,7 +518,7 @@ BackprojectDiff::BackprojectView (const double* const filteredProj, const double
         double frac = curDetPos - detPosFloor; // fraction distance from det 
         if (iDetPos > 0 && iDetPos < nDet - 1)
           *pImCol++ += filteredProj[iDetPos] + (frac * (filteredProj[iDetPos+1] - filteredProj[iDetPos]));
-      } else if (interpType = Backprojector::INTERP_CUBIC) {
+      } else if (interpType == Backprojector::INTERP_CUBIC) {
         double p = iDetCenter + curDetPos;     // position along detector
         if (p >= 0 && p < nDet)
           *pImCol++  += pCubicInterp->interpolate (p);
@@ -588,7 +589,7 @@ BackprojectIntDiff::BackprojectView (const double* const filteredProj, const dou
         if (iDetPos >= 0 && iDetPos <= iLastDet)
           *pImCol++ += filteredProj[iDetPos] + (detRemainder * deltaFilteredProj[iDetPos]);
       }        // end for iy
-    } else if (interpType = Backprojector::INTERP_CUBIC) {
+    } else if (interpType == Backprojector::INTERP_CUBIC) {
       for (int iy = 0; iy < ny; iy++, curDetPos += det_dy) {
         *pImCol++ += pCubicInterp->interpolate (static_cast<double>(curDetPos) / 65536);
       }
@@ -664,10 +665,8 @@ BackprojectEquilinear::BackprojectView (const double* const filteredProj, const
       
       double dU = (m_dFocalLength + rsin_t) / m_dFocalLength;
       double dDetPos =  rcos_t / dU;
-      // double to scale for imaginary detector that passes through origin
-      // of phantom, see Kak-Slaney Figure 3.22. This assumes that the detector is also
-      // located focal-length away from the origin.
-      dDetPos *= 2; 
+      // Scale for imaginary detector that passes through origin of phantom, see Kak-Slaney Figure 3.22. 
+      dDetPos *= m_dSourceDetectorLength / m_dFocalLength; 
       double dPos = dDetPos / detInc;  // position along detector array 
 
       if (interpType == Backprojector::INTERP_NEAREST) {