X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=libctsim%2Fbackprojectors.cpp;h=2d0d60cc718263746866659b727ba5ed7b28feeb;hb=b3db4c787d9180525a56306d8e91553d81def8b8;hp=d38b7189f6b6c878b09ec0549dca5daf242ce24e;hpb=e46615378520c3e801074560ebdc36be9558c6dd;p=ctsim.git diff --git a/libctsim/backprojectors.cpp b/libctsim/backprojectors.cpp index d38b718..2d0d60c 100644 --- a/libctsim/backprojectors.cpp +++ b/libctsim/backprojectors.cpp @@ -270,12 +270,11 @@ Backproject::Backproject (const Projections& proj, ImageFile& im, int interpType detInc = proj.detInc(); nDet = proj.nDet(); iDetCenter = (nDet - 1) / 2; // index refering to L=0 projection - rotScale = proj.rotInc(); if (proj.geometry() == Scanner::GEOMETRY_PARALLEL) - rotScale /= (proj.nView() * proj.rotInc() / PI); // scale by number of PI rotations + rotScale = PI / proj.nView(); // scale by number of PI rotations else if (proj.geometry() == Scanner::GEOMETRY_EQUIANGULAR || proj.geometry() == Scanner::GEOMETRY_EQUILINEAR) - rotScale /= (proj.nView() * proj.rotInc() / (2 * PI)); // scale by number of 2PI rotations + rotScale = (2 * PI) / proj.nView(); // scale by number of 2PI rotations else sys_error (ERR_SEVERE, "Invalid geometry type %d [Backproject::Backproject]", proj.geometry()); @@ -588,7 +587,7 @@ BackprojectIntDiff::BackprojectView (const double* const filteredProj, const dou #elif SIZEOF_LONG == 8 static const int scaleShift = 32; #endif - static const long scale = (1 << scaleShift); + static const long scale = (1L << scaleShift); static const long scaleBitmask = scale - 1; static const long halfScale = scale / 2; static const double dInvScale = 1. / scale; @@ -621,20 +620,26 @@ BackprojectIntDiff::BackprojectView (const double* const filteredProj, const dou const int iDetPos = (curDetPos + halfScale) >> scaleShift; if (iDetPos >= 0 && iDetPos <= iLastDet) *pImCol++ += filteredProj[iDetPos]; + else + pImCol++; + } // end for iy } else if (interpType == Backprojector::INTERP_FREQ_PREINTERPOLATION) { for (int iy = 0; iy < ny; iy++, curDetPos += det_dy) { const int iDetPos = ((curDetPos + halfScale) >> scaleShift) * m_interpFactor; if (iDetPos >= 0 && iDetPos <= iLastDet) *pImCol++ += filteredProj[iDetPos]; + else + pImCol++; } // end for iy } else if (interpType == Backprojector::INTERP_LINEAR) { for (int iy = 0; iy < ny; iy++, curDetPos += det_dy) { const long iDetPos = curDetPos >> scaleShift; - const long detRemainder = curDetPos & scaleBitmask; - if (iDetPos >= 0 && iDetPos <= iLastDet) - *pImCol++ += filteredProj[iDetPos] + (detRemainder * deltaFilteredProj[iDetPos]); - + if (iDetPos >= 0 && iDetPos <= iLastDet) { + const long detRemainder = curDetPos & scaleBitmask; + *pImCol++ += filteredProj[iDetPos] + (detRemainder * deltaFilteredProj[iDetPos]); + } else + pImCol++; } // end for iy } else if (interpType == Backprojector::INTERP_CUBIC) { for (int iy = 0; iy < ny; iy++, curDetPos += det_dy) {