r632: Added Clipboard functions to image files
[ctsim.git] / libctsim / projections.cpp
index dc7248e62b9f3e42c86561612e99233c1bd6c245..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.59 2001/03/11 15:27:30 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;
 }