r138: *** empty log message ***
[ctsim.git] / libctsim / backprojectors.cpp
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:         backprojectors.cpp         Classes for backprojection
5 **   Programmer:   Kevin Rosenberg
6 **   Date Started: June 2000
7 **
8 **  This is part of the CTSim program
9 **  Copyright (C) 1983-2000 Kevin Rosenberg
10 **
11 **  $Id: backprojectors.cpp,v 1.5 2000/07/07 15:30:59 kevin Exp $
12 **
13 **  This program is free software; you can redistribute it and/or modify
14 **  it under the terms of the GNU General Public License (version 2) as
15 **  published by the Free Software Foundation.
16 **
17 **  This program is distributed in the hope that it will be useful,
18 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
19 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 **  GNU General Public License for more details.
21 **
22 **  You should have received a copy of the GNU General Public License
23 **  along with this program; if not, write to the Free Software
24 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25 ******************************************************************************/
26
27 #include "ct.h"
28
29 Backprojector::Backprojector (const Projections& proj, ImageFile& im, const char* const backprojName, const char* const interpName)
30 {
31   m_fail = false;
32   m_pBackprojectImplem = NULL;
33
34   initBackprojector (proj, im, backprojName, interpName);
35 }
36
37 void 
38 Backprojector::BackprojectView (const double* const viewData, const double viewAngle)
39 {
40   if (m_pBackprojectImplem)
41     m_pBackprojectImplem->BackprojectView (viewData, viewAngle);
42 }
43
44 Backprojector::~Backprojector (void)
45 {
46   delete m_pBackprojectImplem;
47 }
48
49 // FUNCTION IDENTIFICATION
50 //     Backproject* projector = selectBackprojector (...)
51 //
52 // PURPOSE
53 //     Selects a backprojector based on BackprojType 
54 //     and initializes the backprojector
55
56 bool
57 Backprojector::initBackprojector (const Projections& proj, ImageFile& im, const char* const backprojName, const char* const interpName)
58 {
59   m_nameBackproject = backprojName;
60   m_nameInterpolation = interpName;
61   m_pBackprojectImplem = NULL;
62   m_idBackproject = convertBackprojectNameToID (backprojName);
63   if (m_idBackproject == BPROJ_INVALID) {
64     m_fail = true;
65     m_failMessage = "Invalid backprojection name ";
66     m_failMessage += backprojName;
67   }
68   m_idInterpolation = convertInterpolationNameToID (interpName);
69   if (m_idInterpolation == INTERP_INVALID) {
70     m_fail = true;
71     m_failMessage = "Invalid interpolation name ";
72     m_failMessage += interpName;
73   }
74
75   if (m_fail || m_idBackproject == BPROJ_INVALID || m_idInterpolation == INTERP_INVALID) {
76     m_fail = true;
77     return false;
78   }
79
80   if (m_idBackproject == BPROJ_TRIG)
81     m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectTrig (proj, im, m_idInterpolation));
82   else if (m_idBackproject == BPROJ_TABLE)
83     m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectTable (proj, im, m_idInterpolation));
84   else if (m_idBackproject == BPROJ_DIFF)
85     m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectDiff (proj, im, m_idInterpolation));
86   else if (m_idBackproject == BPROJ_DIFF2)
87     m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectDiff2 (proj, im, m_idInterpolation));
88   else if (m_idBackproject == BPROJ_IDIFF2)
89     m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectIntDiff2 (proj, im, m_idInterpolation));
90   else if (m_idBackproject == BPROJ_IDIFF3)
91     m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectIntDiff3 (proj, im, m_idInterpolation));
92   else {
93     m_fail = true;
94     m_failMessage = "Unable to select a backprojection method [Backprojector::initBackprojector]";
95     return false;
96   }
97
98   return true;
99 }
100
101
102 const Backprojector::BackprojectID
103 Backprojector::convertBackprojectNameToID (const char* const backprojName)
104 {
105   BackprojectID backprojID = BPROJ_INVALID;
106
107   if (strcasecmp (backprojName, BPROJ_TRIG_STR) == 0)
108     backprojID = BPROJ_TRIG;
109   else if (strcasecmp (backprojName, BPROJ_TABLE_STR) == 0)
110     backprojID = BPROJ_TABLE;
111   else if (strcasecmp (backprojName, BPROJ_DIFF_STR) == 0)
112     backprojID = BPROJ_DIFF;
113   else if (strcasecmp (backprojName, BPROJ_DIFF2_STR) == 0)
114     backprojID = BPROJ_DIFF2;
115   else if (strcasecmp (backprojName, BPROJ_IDIFF2_STR) == 0)
116     backprojID = BPROJ_IDIFF2;
117   else if (strcasecmp (backprojName, BPROJ_IDIFF3_STR) == 0)
118     backprojID = BPROJ_IDIFF3;
119
120   return (backprojID);
121 }
122
123 const char*
124 Backprojector::convertBackprojectIDToName (const BackprojectID bprojID)
125 {
126   const char *bprojName = "";
127
128   if (bprojID == BPROJ_TRIG)
129     bprojName = BPROJ_TRIG_STR;
130   else if (bprojID == BPROJ_TABLE)
131     bprojName = BPROJ_TABLE_STR;
132   else if (bprojID == BPROJ_DIFF)
133     bprojName = BPROJ_DIFF_STR;
134   else if (bprojID == BPROJ_DIFF2)
135     bprojName = BPROJ_DIFF2_STR;
136   else if (bprojID == BPROJ_IDIFF2)
137     bprojName = BPROJ_IDIFF2_STR;
138   else if (bprojID == BPROJ_IDIFF3)
139     bprojName = BPROJ_IDIFF3_STR;
140
141   return (bprojName);
142 }
143
144
145
146 const Backprojector::InterpolationID
147 Backprojector::convertInterpolationNameToID (const char* const interpName)
148 {
149   InterpolationID interpID = INTERP_INVALID;
150
151   if (strcasecmp (interpName, INTERP_NEAREST_STR) == 0)
152     interpID = INTERP_NEAREST;
153   else if (strcasecmp (interpName, INTERP_LINEAR_STR) == 0)
154     interpID = INTERP_LINEAR;
155 #if HAVE_BSPLINE_INTERP
156   else if (strcasecmp (interpName, INTERP_BSPLINE_STR) == 0)
157     interpID = INTERP_BSPLINE;
158 #endif
159
160   return (interpID);
161 }
162
163
164 /* NAME
165  *      name_of_interp                  Return name of interpolation method
166  *
167  * SYNOPSIS
168  *      name = name_of_interp (interp_type)
169  *      char *name                      Name of interpolation method
170  *      int interp_type                 Method of interpolation
171  *
172  * NOTES
173  *      Returns NULL if interp_type is invalid
174  */
175
176 const char*
177 Backprojector::convertInterpolationIDToName (const InterpolationID interpID)
178 {
179   if (interpID == INTERP_NEAREST)
180     return (INTERP_NEAREST_STR);
181   else if (interpID == INTERP_LINEAR)
182     return (INTERP_LINEAR_STR);
183 #if HAVE_BSPLINE_INTERP
184   else if (interpID == INTERP_BSPLINE)
185     return (INTERP_BSPLINE_STR);
186 #endif
187   else
188     return ("");
189 }
190
191
192 // CLASS IDENTICATION
193 //   Backproject
194 //
195 // PURPOSE
196 //   Pure virtual base class for all backprojectors.
197
198 Backproject::Backproject (const Projections& proj, ImageFile& im, const Backprojector::InterpolationID interpType)
199   : proj(proj), im(im), interpType(interpType)
200 {
201   detInc = proj.detInc();
202   nDet = proj.nDet();
203   iDetCenter = (nDet - 1) / 2;  // index refering to L=0 projection 
204   rotInc = proj.rotInc();
205
206   v = im.getArray();
207   nx = im.nx();
208   ny = im.ny();
209   im.arrayDataClear();
210
211   xMin = -proj.phmLen() / 2;      // Retangular coords of phantom
212   xMax = xMin + proj.phmLen();
213   yMin = -proj.phmLen() / 2;
214   yMax = yMin + proj.phmLen();
215
216   xInc = (xMax - xMin) / nx;    // size of cells
217   yInc = (yMax - yMin) / ny;
218
219   if (interpType != Backprojector::INTERP_NEAREST && interpType != Backprojector::INTERP_LINEAR)
220     sys_error (ERR_WARNING, "Illegal interpType %d [selectBackprojector]", interpType);
221 }
222
223 Backproject::~Backproject (void)
224 {}
225
226 void
227 Backproject::ScaleImageByRotIncrement (void)
228 {
229   for (int ix = 0; ix < nx; ix++)
230     for (int iy = 0; iy < ny; iy++)
231       v[ix][iy] *= rotInc;
232 }
233
234 void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double r, double phi, double L, int iDetPos)
235 {
236     printf ("r=%f, phi=%f\n", r, phi);
237     errorIndexOutsideDetector (ix, iy, theta, L, iDetPos);
238 }
239
240 void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double L, int iDetPos)
241 {
242     printf ("ix=%d, iy=%d\n", ix, iy);
243     printf ("theta=%f, L=%f, detInc=%f\n", theta, L, detInc);
244     printf ("proj.ndet=%d, proj.detInc=%.4f, iDetCenter=%d\n", nDet, detInc, iDetCenter);
245     printf ("xMin=%15.8f, xMax=%15.8f, xInc=%15.8f\n", xMin, xMax, xInc);
246     printf ("yMin=%15.8f, yMax=%15.8f, yInc=%15.8f\n", yMin, yMax, yInc);
247     sys_error (ERR_WARNING, "iDetPos index outside bounds: %d [backprojector]", iDetPos);
248 }
249
250
251 // CLASS IDENTICATION
252 //   BackprojectTrig
253 //
254 // PURPOSE
255 //   Uses trigometric functions at each point in image for backprojection.
256
257 void
258 BackprojectTrig::BackprojectView (const double* const filteredProj, const double view_angle)
259 {
260   double theta = HALFPI + view_angle;   // Add PI/2 to get perpendicular angle to detector      
261   int ix, iy;
262   double x, y;                  // Rectang coords of center of pixel 
263
264   for (x = xMin + xInc / 2, ix = 0; ix < nx; x += xInc, ix++)
265     for (y = yMin + yInc / 2, iy = 0; iy < ny; y += yInc, iy++) {
266       double r = sqrt (x * x + y * y);   // distance of cell from center
267       double phi = atan2 (y, x);         // angle of cell from center
268       double L = r * cos (theta - phi);  // position on detector
269
270       if (interpType == Backprojector::INTERP_NEAREST) {
271         int iDetPos = iDetCenter + nearest<int> (L / detInc); // calc'd index in the filter raysum array
272
273         if (iDetPos < 0 || iDetPos >= nDet)     // check for impossible: index outside of raysum pos 
274             errorIndexOutsideDetector (ix, iy, theta, r, phi, L, iDetPos);
275         else
276           v[ix][iy] += rotInc * filteredProj[iDetPos];
277       } else if (interpType == Backprojector::INTERP_LINEAR) {
278           double p = L / detInc;        // position along detector
279           double pFloor = floor (p);
280           int iDetPos = iDetCenter + static_cast<int>(pFloor);
281           double frac = p - pFloor;     // fraction distance from det
282           if (iDetPos < 0 || iDetPos >= nDet - 1)       // check for impossible: index outside of raysum pos 
283             errorIndexOutsideDetector (ix, iy, theta, r, phi, L, iDetPos);
284           else
285             v[ix][iy] += rotInc * ((1-frac) * filteredProj[iDetPos] + frac * filteredProj[iDetPos+1]);
286       }
287     }
288 }  
289
290
291 // CLASS IDENTICATION
292 //   BackprojectTable
293 //
294 // PURPOSE
295 //   Precalculates trigometric function value for each point in image for backprojection.
296
297 BackprojectTable::BackprojectTable (const Projections& proj, ImageFile& im, Backprojector::InterpolationID interpType)
298   : Backproject::Backproject (proj, im, interpType)
299 {
300   arrayR.initSetSize (nx, ny);
301   arrayPhi.initSetSize (nx, ny);
302   r = arrayR.getArray();
303   phi = arrayPhi.getArray();
304
305   double x, y;                  // Rectang coords of center of pixel 
306   int ix, iy;
307   for (x = xMin + xInc / 2, ix = 0; ix < nx; x += xInc, ix++)
308     for (y = yMin + yInc / 2, iy = 0; iy < ny; y += yInc, iy++) {
309       r[ix][iy] = sqrt (x * x + y * y);
310       phi[ix][iy] = atan2 (y, x);
311     }
312 }
313
314 BackprojectTable::~BackprojectTable (void)
315 {
316   ScaleImageByRotIncrement();
317 }
318
319 void
320 BackprojectTable::BackprojectView (const double* const filteredProj, const double view_angle)
321 {
322   double theta = HALFPI + view_angle;  // add half PI to view angle to get perpendicular theta angle
323
324   for (int ix = 0; ix < nx; ix++) {
325     ImageFileColumn pImCol = v[ix];
326
327     for (int iy = 0; iy < ny; iy++) {
328       double L = r[ix][iy] * cos (theta - phi[ix][iy]);
329
330       if (interpType == Backprojector::INTERP_NEAREST) {
331         int iDetPos = iDetCenter + nearest<int>(L / detInc);    // calc index in the filtered raysum vector 
332
333         if (iDetPos < 0 || iDetPos >= nDet)     // check for impossible: index outside of raysum pos 
334           errorIndexOutsideDetector (ix, iy, theta, r[ix][iy], phi[ix][iy], L, iDetPos);
335         else
336           pImCol[iy] += filteredProj[iDetPos];
337       } else if (interpType == Backprojector::INTERP_LINEAR) {
338         double dPos = L / detInc;               // position along detector 
339         double dPosFloor = floor (dPos);
340         int iDetPos = iDetCenter + static_cast<int>(dPosFloor);
341         double frac = dPos - dPosFloor; // fraction distance from det 
342         if (iDetPos < 0 || iDetPos >= nDet - 1)
343             errorIndexOutsideDetector (ix, iy, theta, r[ix][iy], phi[ix][iy], L, iDetPos);
344         else
345           pImCol[iy] += ((1-frac) * filteredProj[iDetPos] + frac * filteredProj[iDetPos+1]);
346       }
347     }   // end for y 
348   }     // end for x 
349 }
350
351
352 // CLASS IDENTICATION
353 //   BackprojectDiff
354 //
355 // PURPOSE
356 //   Backprojects by precalculating the change in L position for each x & y step in the image.
357 //   Iterates in x & y direction by adding difference in L position
358
359 BackprojectDiff::BackprojectDiff (const Projections& proj, ImageFile& im, Backprojector::InterpolationID interpType)
360   :  Backproject::Backproject (proj, im, interpType)
361 {
362   // calculate center of first pixel v[0][0] 
363   double x = xMin + xInc / 2;
364   double y = yMin + yInc / 2;
365   start_r = sqrt (x * x + y * y);
366   start_phi = atan2 (y, x);
367
368   im.arrayDataClear();
369 }
370
371 BackprojectDiff::~BackprojectDiff()
372 {
373   ScaleImageByRotIncrement();
374 }
375
376 void
377 BackprojectDiff::BackprojectView (const double* const filteredProj, const double view_angle)
378 {
379   double theta = - view_angle;  // add half PI to view angle to get perpendicular theta angle
380   double det_dx = xInc * sin (theta);
381   double det_dy = yInc * cos (theta);
382   double lColStart = start_r * cos (theta - start_phi);  // calculate L for first point in image
383         
384   for (int ix = 0; ix < nx; ix++, lColStart += det_dx) {
385     double curDetPos = lColStart;
386     ImageFileColumn pImCol = v[ix];
387   
388     for (int iy = 0; iy < ny; iy++, curDetPos += det_dy) {
389 #ifdef DEBUG
390       printf ("[%2d,%2d]:  %8.5lf  ", ix, iy, curDetPos);
391 #endif
392       if (interpType == Backprojector::INTERP_NEAREST) {
393         int iDetPos = iDetCenter + nearest<int>(curDetPos / detInc);    // calc index in the filtered raysum vector 
394
395         if (iDetPos < 0 || iDetPos >= nDet)     // check for impossible: index outside of raysum pos 
396             errorIndexOutsideDetector (ix, iy, theta, curDetPos, iDetPos);
397         else
398           pImCol[iy] += filteredProj[iDetPos];
399       } else if (interpType == Backprojector::INTERP_LINEAR) {
400         double detPos = curDetPos / detInc;             // position along detector 
401         double detPosFloor = floor (detPos);
402         int iDetPos = iDetCenter + static_cast<int>(detPosFloor);
403         double frac = detPos - detPosFloor;     // fraction distance from det 
404         if (iDetPos < 0 || iDetPos >= nDet - 1)
405             errorIndexOutsideDetector (ix, iy, theta, curDetPos, iDetPos);
406         else
407           pImCol[iy] += ((1-frac) * filteredProj[iDetPos] + frac * filteredProj[iDetPos+1]);
408       }
409     }   // end for y 
410   }     // end for x 
411 }
412
413
414 // CLASS IDENTICATION
415 //   BackprojectDiff2
416 //
417 // PURPOSE
418 //   Optimized version of BackprojectDiff
419
420 void
421 BackprojectDiff2::BackprojectView (const double* const filteredProj, const double view_angle)
422 {
423   double theta = - view_angle;  // add half PI to view angle to get perpendicular theta angle
424
425   // Distance betw. detectors for an angle given in units of detectors 
426   double det_dx = xInc * sin (theta) / detInc;
427   double det_dy = yInc * cos (theta) / detInc;
428
429   // calculate detPosition for first point in image (ix=0, iy=0) 
430   double detPosColStart = start_r * cos (theta - start_phi) / detInc;
431         
432 #ifdef DEBUG
433   printf ("start_r=%8.5f, start_phi=%8.5f, rotInc=%8.5f\n", start_r, start_phi, rotInc);
434 #endif
435   for (int ix = 0; ix < nx; ix++, detPosColStart += det_dx) {
436     double curDetPos = detPosColStart;
437     ImageFileColumn pImCol = v[ix];
438
439     for (int iy = 0; iy < ny; iy++, curDetPos += det_dy) {
440 #ifdef DEBUG
441       printf ("[%2d,%2d]: %8.5f %8.5f\n", ix, iy, curDetPos, filteredProj[iDetCenter + nearest<int>(L))]);
442 #endif
443       if (interpType == Backprojector::INTERP_NEAREST) {
444         int iDetPos = iDetCenter + nearest<int> (curDetPos);    // calc index in the filtered raysum vector 
445         
446         if (iDetPos < 0 || iDetPos >= nDet)     // check for impossible: index outside of raysum pos 
447             errorIndexOutsideDetector (ix, iy, theta, curDetPos, iDetPos);
448         else
449           *pImCol++ += filteredProj[iDetPos];
450       } else if (interpType == Backprojector::INTERP_LINEAR) {
451         double detPosFloor = floor (curDetPos);
452         int iDetPos = iDetCenter + static_cast<int>(detPosFloor);
453         double frac = curDetPos - detPosFloor;  // fraction distance from det 
454         if (iDetPos < 0 || iDetPos >= nDet - 1)
455             errorIndexOutsideDetector (ix, iy, theta, curDetPos, iDetPos);
456         else
457           *pImCol++ += ((1-frac) * filteredProj[iDetPos] + frac * filteredProj[iDetPos+1]);
458       }
459     }   // end for y
460   }     // end for x
461 }
462
463 // CLASS IDENTICATION
464 //   BackprojectIntDiff2
465 //
466 // PURPOSE
467 //   Integer version of BackprojectDiff2
468
469 void
470 BackprojectIntDiff2::BackprojectView (const double* const filteredProj, const double view_angle)
471 {
472   double theta = - view_angle;  // add half PI to view angle to get perpendicular theta angle
473
474   kint32 scale = 1 << 16;
475   double dScale = scale;
476   kint32 halfScale = scale / 2;
477
478   kint32 det_dx = nearest<kint32> (xInc * sin (theta) / detInc * scale);
479   kint32 det_dy = nearest<kint32> (yInc * cos (theta) / detInc * scale);
480
481   // calculate L for first point in image (0, 0) 
482   kint32 detPosColStart = nearest<kint32> (start_r * cos (theta - start_phi) / detInc * scale);
483         
484   for (int ix = 0; ix < nx; ix++, detPosColStart += det_dx) {
485     kint32 curDetPos = detPosColStart;
486     ImageFileColumn pImCol = v[ix];
487
488     for (int iy = 0; iy < ny; iy++, curDetPos += det_dy) {
489       if (interpType == Backprojector::INTERP_NEAREST) {
490         int detPosNearest = (curDetPos >= 0 ? ((curDetPos + halfScale) / scale) : ((curDetPos - halfScale) / scale));
491         int iDetPos = iDetCenter + detPosNearest;       // calc index in the filtered raysum vector 
492
493         if (iDetPos < 0 || iDetPos >= nDet)  // check for impossible: index outside of raysum pos 
494             errorIndexOutsideDetector (ix, iy, theta, curDetPos, iDetPos);
495         else
496           *pImCol++ += filteredProj[iDetPos];
497       } else if (interpType == Backprojector::INTERP_LINEAR) {
498         kint32 detPosFloor = curDetPos / scale;
499         kint32 detPosRemainder = curDetPos % scale;
500         if (detPosRemainder < 0) {
501           detPosFloor--;
502           detPosRemainder += scale;
503         }
504         int iDetPos = iDetCenter + detPosFloor;
505         double frac = detPosRemainder / dScale;
506         if (iDetPos < 0 || iDetPos >= nDet - 1)
507             errorIndexOutsideDetector (ix, iy, theta, curDetPos, iDetPos);
508         else
509           *pImCol++ += ((1.-frac) * filteredProj[iDetPos] + frac * filteredProj[iDetPos+1]);
510       }
511     }   // end for y
512   }     // end for x
513 }
514
515 // CLASS IDENTICATION
516 //   BackprojectIntDiff3
517 //
518 // PURPOSE
519 //   Highly optimized version of BackprojectIntDiff2
520
521 void
522 BackprojectIntDiff3::BackprojectView (const double* const filteredProj, const double view_angle)
523 {
524   double theta = - view_angle;  // add half PI to view angle to get perpendicular theta angle
525   static const int scaleShift = 16;
526   static const kint32 scale = (1 << scaleShift);
527   static const double dScale = scale;
528   static const kint32 halfScale = scale / 2;
529
530   const kint32 det_dx = nearest<kint32> (xInc * sin (theta) / detInc * scale);
531   const kint32 det_dy = nearest<kint32> (yInc * cos (theta) / detInc * scale);
532
533   // calculate L for first point in image (0, 0) 
534   kint32 detPosColStart = nearest<kint32> ((start_r * cos (theta - start_phi) / detInc + iDetCenter) * scale);
535         
536   for (int ix = 0; ix < nx; ix++, detPosColStart += det_dx) {
537     kint32 curDetPos = detPosColStart;
538     ImageFileColumn pImCol = v[ix];
539
540     for (int iy = 0; iy < ny; iy++, curDetPos += det_dy) {
541       if (interpType == Backprojector::INTERP_NEAREST) {
542         int iDetPos = (curDetPos + halfScale) >> scaleShift;
543
544         if (iDetPos < 0 || iDetPos >= nDet)  // check for impossible: index outside of raysum pos 
545             errorIndexOutsideDetector (ix, iy, theta, curDetPos, iDetPos);
546         else
547           *pImCol++ += filteredProj[iDetPos];
548       } else if (interpType == Backprojector::INTERP_LINEAR) {
549         kint32 detPosFloor = curDetPos / scale;
550         kint32 detPosRemainder = curDetPos % scale;
551         if (detPosRemainder < 0) {
552           detPosFloor--;
553           detPosRemainder += scale;
554         }
555         int iDetPos = iDetCenter + detPosFloor;
556         double frac = detPosRemainder / dScale;
557         if (iDetPos < 0 || iDetPos >= nDet - 1)
558             errorIndexOutsideDetector (ix, iy, theta, curDetPos, iDetPos);
559         else
560           *pImCol++ += ((1.-frac) * filteredProj[iDetPos] + frac * filteredProj[iDetPos+1]);
561       }
562     }   // end for y
563   }     // end for x
564 }