X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;ds=sidebyside;f=libctsim%2Fbackprojectors.cpp;h=5f674ec48b9a287345d5d2adfbca537ee6bdc975;hb=806adf54f5b8d061662696b3b498bfab3cd8b2e6;hp=8c785ac45bdfbe38b7fccb5358241c8096468723;hpb=bfcc769cf8019eabc8c65c07257c8dbee4b4c977;p=ctsim.git diff --git a/libctsim/backprojectors.cpp b/libctsim/backprojectors.cpp index 8c785ac..5f674ec 100644 --- a/libctsim/backprojectors.cpp +++ b/libctsim/backprojectors.cpp @@ -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.16 2000/12/04 19:50:57 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 @@ -256,13 +256,14 @@ Backprojector::convertInterpIDToTitle (const int interpID) // PURPOSE // Pure virtual base class for all backprojectors. -Backproject::Backproject (const Projections& proj, ImageFile& im, const int interpType, const int interpFactor) +Backproject::Backproject (const Projections& proj, ImageFile& im, int interpType, const int interpFactor) : proj(proj), im(im), interpType(interpType), m_interpFactor(interpFactor) { 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; @@ -598,7 +599,7 @@ BackprojectIntDiff3::BackprojectView (const double* const filteredProj, const do kint32 detPosColStart = nearest ((start_r * cos (theta - start_phi) / detInc + iDetCenter) * scale); // precalculate scaled difference for linear interpolation - double deltaFilteredProj [nDet]; + double* deltaFilteredProj = new double [nDet]; if (interpType == Backprojector::INTERP_LINEAR) { for (int i = 0; i < nDet - 1; i++) deltaFilteredProj[i] = (filteredProj[i+1] - filteredProj[i]) * dInvScale; @@ -630,7 +631,9 @@ BackprojectIntDiff3::BackprojectView (const double* const filteredProj, const do *pImCol++ += filteredProj[iDetPos] + (detRemainder * deltaFilteredProj[iDetPos]); } // end for iy } //end linear - } // end for ix + } // end for ix + + delete deltaFilteredProj; }