** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: projections.cpp,v 1.57 2001/03/11 06:34:37 kevin Exp $
+** $Id: projections.cpp,v 1.61 2001/03/11 18:52:03 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;
- if (m_geometry != Scanner::GEOMETRY_PARALLEL) {
- sys_error (ERR_WARNING, "convertPolar supports Parallel only");
- return false;
- }
+ Projections* pProj = this;
+ if (m_geometry == Scanner::GEOMETRY_EQUIANGULAR || m_geometry == Scanner::GEOMETRY_EQUILINEAR)
+ pProj = interpolateToParallel();
Array2d<double> adView (nx, ny);
Array2d<double> adDet (nx, ny);
double** ppdView = adView.getArray();
double** ppdDet = adDet.getArray();
- if (! calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet))
+ if (! pProj->calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet))
return false;
std::complex<double>** ppcDetValue = new std::complex<double>* [m_nView];
for (iView = 0; iView < m_nView; iView++) {
ppcDetValue[iView] = new std::complex<double> [m_nDet];
for (unsigned int iDet = 0; iDet < m_nDet; iDet++)
- ppcDetValue[iView][iDet] = std::complex<double>(getDetectorArray (iView).detValues()[iDet], 0);
+ ppcDetValue[iView][iDet] = std::complex<double>(pProj->getDetectorArray (iView).detValues()[iDet], 0);
}
- interpolatePolar (v, vImag, nx, ny, ppcDetValue, ppdView, ppdDet, m_nView, m_nDet, iInterpolationID);
+ pProj->interpolatePolar (v, vImag, nx, ny, ppcDetValue, ppdView, ppdDet, pProj->m_nView, pProj->m_nDet, iInterpolationID);
for (iView = 0; iView < m_nView; iView++)
delete [] ppcDetValue[iView];
delete [] ppcDetValue;
+ if (m_geometry == Scanner::GEOMETRY_EQUIANGULAR || m_geometry == Scanner::GEOMETRY_EQUILINEAR)
+ delete pProj;
+
return true;
}
}
}
-
bool
Projections::initFromSomatomAR_STAR (int iNViews, int iNDets, unsigned char* pData, unsigned long lDataLength)
{
init (iNViews, iNDets);
m_geometry = Scanner::GEOMETRY_EQUIANGULAR;
m_dFanBeamAngle = iNDets * convertDegreesToRadians (3.06976 / 60);
- m_dFocalLength = 51;
- m_dSourceDetectorLength = 89;
+ m_dFocalLength = 510;
+ m_dSourceDetectorLength = 890;
m_detInc = convertDegreesToRadians (3.06976 / 60);
m_detStart = -m_dFanBeamAngle / 2;
m_rotInc = TWOPI / static_cast<double>(iNViews);
pProjNew->m_label.setDateTime (pProjNew->m_year, pProjNew->m_month, pProjNew->m_day, pProjNew->m_hour, pProjNew->m_minute, pProjNew->m_second);
pProjNew->m_rotStart = 0;
+#ifdef CONVERT_PARALLEL_PI
pProjNew->m_rotInc = PI / nView;;
+#else
+ pProjNew->m_rotInc = TWOPI / nView;
+#endif
pProjNew->m_detStart = -m_dViewDiameter / 2;
pProjNew->m_detInc = m_dViewDiameter / nDet;
if (nDet % 2 == 0) // even
pC->m_dTheta = normalizeAngle (dViewAngle + dDetPos);
pC->m_dT = dFocalLength * sin (dDetPos);
}
+#ifdef CONVERT_PARALLEL_PI
if (pC->m_dTheta >= PI) { // convert T/Theta to 0-PI interval
pC->m_dTheta -= PI;
- pC->m_dT = -pC->m_dT - pProjections->detInc();
+ pC->m_dT = -pC->m_dT;
}
+#endif
pC->m_dRaysum = detValues[iD];
dDetPos += dDetInc;
}