X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Fprojections.cpp;h=e9e053d96cd0d19b357fa2efe2b5125ff465a07c;hp=970b437f6552143074786c921ccfd106ed7e8874;hb=9776c9a12ba53419d34563a5ec57c90e3d6798f4;hpb=c5e7140bd08b8c8f527713e8dc861bcb7ee5f633 diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index 970b437..e9e053d 100644 --- a/libctsim/projections.cpp +++ b/libctsim/projections.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: projections.cpp,v 1.47 2001/02/08 06:25:07 kevin Exp $ +** $Id: projections.cpp,v 1.49 2001/02/22 18:22:40 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 @@ -33,14 +33,14 @@ const int Projections::POLAR_INTERP_NEAREST = 0; const int Projections::POLAR_INTERP_BILINEAR = 1; const int Projections::POLAR_INTERP_BICUBIC = 2; -const char* Projections::s_aszInterpName[] = +const char* const Projections::s_aszInterpName[] = { {"nearest"}, {"bilinear"}, // {"bicubic"}, }; -const char* Projections::s_aszInterpTitle[] = +const char* const Projections::s_aszInterpTitle[] = { {"Nearest"}, {"Bilinear"}, @@ -687,7 +687,8 @@ Projections::convertPolar (ImageFile& rIF, int iInterpolationID) double** ppdView = adView.getArray(); double** ppdDet = adDet.getArray(); - calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet); + if (! calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet)) + return false; std::complex** ppcDetValue = new std::complex* [m_nView]; unsigned int iView; @@ -750,20 +751,21 @@ Projections::convertFFTPolar (ImageFile& rIF, int iInterpolationID, int iZeropad fftw_destroy_plan (plan); delete [] pcIn; - calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet); + bool bError = calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet); - interpolatePolar (v, vImag, nx, ny, ppcDetValue, ppdView, ppdDet, m_nView, m_nDet, iInterpolationID); + if (! bError) + 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; - return true; + return bError; #endif } -void +bool Projections::calcArrayPolarCoordinates (unsigned int nx, unsigned int ny, double** ppdView, double** ppdDet) { double xMin = -phmLen() / 2; @@ -778,7 +780,7 @@ Projections::calcArrayPolarCoordinates (unsigned int nx, unsigned int ny, double if (m_geometry != Scanner::GEOMETRY_PARALLEL) { sys_error (ERR_WARNING, "convertPolar supports Parallel only"); - return; + return false; } // Calculates polar coordinates (view#, det#) for each point on phantom grid @@ -800,6 +802,8 @@ Projections::calcArrayPolarCoordinates (unsigned int nx, unsigned int ny, double ppdDet[ix][iy] = (r / m_detInc) + iDetCenter; } } + + return true; } void