** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: projections.cpp,v 1.69 2001/03/22 02:30:00 kevin Exp $
+** $Id: projections.cpp,v 1.70 2001/03/24 05:28:28 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
std::complex<double>** ppcDetValue = new std::complex<double>* [m_nView];
double dInterpScale = (m_nDet-1) / static_cast<double>(iInterpDet-1) / SQRT2;
+ double dFFTScale = 1. / static_cast<double>(iInterpDet * iInterpDet);
+ dFFTScale /= 2; // Not sure why this scaling is necessary
for (unsigned int iView = 0; iView < m_nView; iView++) {
DetectorValue* detval = getDetectorArray(iView).detValues();
LinearInterpolator<DetectorValue> projInterp (detval, m_nDet);
ppcDetValue[iView] = new std::complex<double> [iNumInterpDetWithZeros];
for (unsigned int iD = 0; iD < iNumInterpDetWithZeros; iD++)
- ppcDetValue[iView][iD] = std::complex<double> (pcIn[iD].re / iInterpDet / (iInterpDet/2), pcIn[iD].im / iInterpDet / (iInterpDet/2));
+ ppcDetValue[iView][iD] = std::complex<double> (pcIn[iD].re * dFFTScale, pcIn[iD].im * dFFTScale);
Fourier::shuffleFourierToNaturalOrder (ppcDetValue[iView], iNumInterpDetWithZeros);
}
if (phi < 0)
phi += TWOPI;
-
if (phi >= PI) {
phi -= PI;
r = -r;
double** ppdDet, unsigned int nView, unsigned int nDet, unsigned int nDetWithZeros, int iInterpolationID)
{
typedef std::complex<double> complexValue;
- BilinearInterpolator<complexValue> bilinear (ppcDetValue, nView, nDetWithZeros);
+
+ BilinearInterpolator<complexValue>* pBilinear;
+ if (iInterpolationID == POLAR_INTERP_BILINEAR)
+ pBilinear = new BilinearInterpolator<complexValue> (ppcDetValue, nView, nDetWithZeros);
+
+ BicubicPolyInterpolator<complexValue>* pBicubic;
+ if (iInterpolationID == POLAR_INTERP_BICUBIC)
+ pBicubic = new BicubicPolyInterpolator<complexValue> (ppcDetValue, nView, nDetWithZeros);
for (unsigned int ix = 0; ix < ny; ix++) {
for (unsigned int iy = 0; iy < ny; iy++) {
v[ix][iy] = 0;
} else if (iInterpolationID == POLAR_INTERP_BILINEAR) {
-#if 1
- std::complex<double> vInterp = bilinear.interpolate (ppdView[ix][iy], ppdDet[ix][iy]);
+ std::complex<double> vInterp = pBilinear->interpolate (ppdView[ix][iy], ppdDet[ix][iy]);
v[ix][iy] = vInterp.real();
if (vImag)
vImag[ix][iy] = vInterp.imag();
-#else
- int iFloorView = ::floor (ppdView[ix][iy]);
- double dFracView = ppdView[ix][iy] - iFloorView;
- int iFloorDet = ::floor (ppdDet[ix][iy]);
- double dFracDet = ppdDet[ix][iy] - iFloorDet;
-
- if (iFloorDet >= 0 && iFloorView >= 0) {
- std::complex<double> v1 = ppcDetValue[iFloorView][iFloorDet];
- std::complex<double> v2, v3, v4;
- if (iFloorView < nView - 1)
- v2 = ppcDetValue[iFloorView + 1][iFloorDet];
- else
- v2 = ppcDetValue[0][iFloorDet];
- if (iFloorDet < nDetWithZeros - 1)
- v4 = ppcDetValue[iFloorView][iFloorDet+1];
- else
- v4 = v1;
- if (iFloorView < nView - 1 && iFloorDet < nDetWithZeros - 1)
- v3 = ppcDetValue [iFloorView+1][iFloorDet+1];
- else if (iFloorView < nView - 1)
- v3 = v2;
- else
- v3 = ppcDetValue[0][iFloorDet+1];
-
- std::complex<double> vInterp = (1 - dFracView) * (1 - dFracDet) * v1 +
- dFracView * (1 - dFracDet) * v2 + dFracView * dFracDet * v3 +
- dFracDet * (1 - dFracView) * v4;
- v[ix][iy] = vInterp.real();
- if (vImag)
- vImag[ix][iy] = vInterp.imag();
- } else {
- // sys_error (ERR_SEVERE, "Can't find projection data for ix=%d,iy=%d with radView=%f and radDet=%f", ix, iy, ppdView[ix][iy], ppdDet[ix][iy]);
- v[ix][iy] = 0;
- if (vImag)
- vImag[ix][iy] = 0;
- }
-#endif
} else if (iInterpolationID == POLAR_INTERP_BICUBIC) {
- v[ix][iy] =0;
- if (vImag)
- vImag[ix][iy] = 0;
+ std::complex<double> vInterp = pBicubic->interpolate (ppdView[ix][iy], ppdDet[ix][iy]);
+ v[ix][iy] = vInterp.real();
+ if (vImag)
+ vImag[ix][iy] = vInterp.imag();
}
}
}