r632: Added Clipboard functions to image files
[ctsim.git] / libctsim / projections.cpp
index 85933de143d64d86e7f820d2415305bc9c7ee323..27d5b69ffa7516d5435ce0406068b61fd94bbeea 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: projections.cpp,v 1.58 2001/03/11 12:37:34 kevin Exp $
+**  $Id: projections.cpp,v 1.60 2001/03/11 17:55:29 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
@@ -688,17 +688,16 @@ Projections::convertPolar (ImageFile& rIF, int iInterpolationID)
   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];
@@ -709,12 +708,15 @@ Projections::convertPolar (ImageFile& rIF, int iInterpolationID)
       ppcDetValue[iView][iDet] = std::complex<double>(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, m_nView, 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;
 }
 
@@ -885,15 +887,14 @@ Projections::interpolatePolar (ImageFileArray& v, ImageFileArray& vImag,
   }
 }
 
-
 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);