+
+ fs.writeFloat64 (view_angle);
+ fs.writeInt32 (nDet);
+
+ for (unsigned int i = 0; i < nDet; i++) {
+ kfloat32 detval = detval_ptr[i];
+ fs.writeFloat32 (detval);
+ }
+
+ if (! fs)
+ return (false);
+
+ return true;
+}
+
+/* NAME
+* printProjectionData Print projections data
+*
+* SYNOPSIS
+* printProjectionData ()
+*/
+
+void
+Projections::printProjectionData ()
+{
+ printProjectionData (0, nView() - 1);
+}
+
+void
+Projections::printProjectionData (int startView, int endView)
+{
+ printf("Projections Data\n\n");
+ printf("Description: %s\n", m_remark.c_str());
+ printf("Geometry: %s\n", Scanner::convertGeometryIDToName (m_geometry));
+ printf("nView = %8d nDet = %8d\n", m_nView, m_nDet);
+ printf("focalLength = %8.4f ViewDiameter = %8.4f\n", m_dFocalLength, m_dViewDiameter);
+ printf("fanBeamAngle= %8.4f SourceDetector = %8.4f\n", convertRadiansToDegrees(m_dFanBeamAngle), m_dSourceDetectorLength);
+ printf("rotStart = %8.4f rotInc = %8.4f\n", m_rotStart, m_rotInc);
+ printf("detStart = %8.4f detInc = %8.4f\n", m_detStart, m_detInc);
+ if (m_projData != NULL) {
+ if (startView < 0)
+ startView = 0;
+ if (endView < 0)
+ endView = m_nView - 1;
+ if (startView > m_nView - 1)
+ startView = m_nView - 1;
+ if (endView > m_nView - 1)
+ endView = m_nView - 1;
+ for (int ir = startView; ir <= endView - 1; ir++) {
+ printf("View %d: angle %f\n", ir, m_projData[ir]->viewAngle());
+ DetectorValue* detval = m_projData[ir]->detValues();
+ for (int id = 0; id < m_projData[ir]->nDet(); id++)
+ printf("%8.4f ", detval[id]);
+ printf("\n");
+ }
+ }
+}
+
+void
+Projections::printScanInfo (std::ostringstream& os) const
+{
+ os << "Number of detectors: " << m_nDet << "\n";
+ os << "Number of views: " << m_nView<< "\n";
+ os << "Description: " << m_remark.c_str()<< "\n";
+ os << "Geometry: " << Scanner::convertGeometryIDToName (m_geometry)<< "\n";
+ os << "Focal Length: " << m_dFocalLength<< "\n";
+ os << "Source Detector Length: " << m_dSourceDetectorLength << "\n";
+ os << "View Diameter: " << m_dViewDiameter<< "\n";
+ os << "Fan Beam Angle: " << convertRadiansToDegrees(m_dFanBeamAngle) << "\n";
+ os << "detStart: " << m_detStart<< "\n";
+ os << "detInc: " << m_detInc<< "\n";
+ os << "rotStart: " << m_rotStart<< "\n";
+ os << "rotInc: " << m_rotInc<< "\n";
+}
+
+
+bool
+Projections::convertPolar (ImageFile& rIF, int iInterpolationID)
+{
+ unsigned int nx = rIF.nx();
+ unsigned int ny = rIF.ny();
+ ImageFileArray v = rIF.getArray();
+ ImageFileArray vImag = rIF.getImaginaryArray();
+
+ if (! v || nx == 0 || ny == 0)
+ 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 (! pProj->calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet))
+ return false;
+
+ std::complex<double>** ppcDetValue = new std::complex<double>* [m_nView];
+ unsigned int iView;
+ 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>(pProj->getDetectorArray (iView).detValues()[iDet], 0);
+ }
+
+ 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::convertFFTPolar (ImageFile& rIF, int iInterpolationID, int iZeropad)
+{
+ unsigned int nx = rIF.nx();
+ unsigned int ny = rIF.ny();
+ ImageFileArray v = rIF.getArray();
+ if (! rIF.isComplex())
+ rIF.convertRealToComplex();
+ ImageFileArray vImag = rIF.getImaginaryArray();