** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: projections.cpp,v 1.38 2001/01/06 15:33:15 kevin Exp $
+** $Id: projections.cpp,v 1.41 2001/01/07 23:18:13 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
if (! v || nx == 0 || ny == 0)
return false;
+#ifndef HAVE_FFT
+ return false;
+#else
Array2d<double> adView (nx, ny);
Array2d<double> adDet (nx, ny);
double** ppdView = adView.getArray();
fftw_plan plan = fftw_create_plan (m_nDet, FFTW_FORWARD, FFTW_IN_PLACE);
for (iView = 0; iView < m_nView; iView++) {
- ppcDetValue[iView] = new std::complex<double> [m_nDet];
unsigned int iDet;
for (iDet = 0; iDet < m_nDet; iDet++) {
pcIn[iDet].re = getDetectorArray(iView).detValues()[iDet];
pcIn[iDet].im = 0;
}
fftw_one (plan, pcIn, NULL);
+ ppcDetValue[iView] = new std::complex<double> [m_nDet];
for (iDet = 0; iDet < m_nDet; iDet++)
- ppcDetValue[iView][iDet] = std::complex<double> (pcIn[iDet].re, pcIn[iDet].im);
- Fourier::shuffleFourierToNaturalOrder (ppcDetValue[iView], m_nDet);
+ ppcDetValue[iView][iDet] = std::complex<double> (pcIn[iDet].re, pcIn[iDet].im);
+ Fourier::shuffleFourierToNaturalOrder (ppcDetValue[iView], m_nDet);
}
fftw_destroy_plan (plan);
delete [] ppcDetValue;
return true;
+#endif
}
+
void
Projections::calcArrayPolarCoordinates (unsigned int nx, unsigned int ny, double** ppdView, double** ppdDet)
{
if (m_geometry != Scanner::GEOMETRY_PARALLEL) {
sys_error (ERR_WARNING, "convertPolar supports Parallel only");
+ return;
}
+ // Calculates polar coordinates (view#, det#) for each point on phantom grid
double x = xMin + xInc / 2; // Rectang coords of center of pixel
for (unsigned int ix = 0; ix < nx; x += xInc, ix++) {
double y = yMin + yInc / 2;
v[ix][iy] = 0;
}
} else if (iInterpolationID == POLAR_INTERP_BILINEAR) {
- int iFloorView = ppdView[ix][iy];
+ int iFloorView = static_cast<int>(ppdView[ix][iy]);
double dFracView = ppdView[ix][iy] - iFloorView;
- int iFloorDet = ppdDet[ix][iy];
+ int iFloorDet = static_cast<int>(ppdDet[ix][iy]);
double dFracDet = ppdDet[ix][iy] - iFloorDet;
if (iFloorDet >= 0 && iFloorView >= 0) {