r120: *** empty log message ***
[ctsim.git] / libctsim / backprojectors.cpp
index 9e350923ab4594287c868e21ee4c8f4b371bf8a0..1f6e92c1bece4c526d80abdad76e47d1d70a7f75 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: backprojectors.cpp,v 1.3 2000/06/22 10:17:28 kevin Exp $
+**  $Id: backprojectors.cpp,v 1.4 2000/06/25 17:32:24 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
@@ -58,11 +58,21 @@ Backprojector::initBackprojector (const Projections& proj, ImageFile& im, const
 {
   m_nameBackproject = backprojName;
   m_nameInterpolation = interpName;
+  m_pBackprojectImplem = NULL;
   m_idBackproject = convertBackprojectNameToID (backprojName);
+  if (m_idBackproject == BPROJ_INVALID) {
+    m_fail = true;
+    m_failMessage = "Invalid backprojection name ";
+    m_failMessage += backprojName;
+  }
   m_idInterpolation = convertInterpolationNameToID (interpName);
-  m_pBackprojectImplem = NULL;
+  if (m_idInterpolation == INTERP_INVALID) {
+    m_fail = true;
+    m_failMessage = "Invalid interpolation name ";
+    m_failMessage += interpName;
+  }
 
-  if (m_idBackproject == BPROJ_INVALID || m_idInterpolation == INTERP_INVALID) {
+  if (m_fail || m_idBackproject == BPROJ_INVALID || m_idInterpolation == INTERP_INVALID) {
     m_fail = true;
     return false;
   }
@@ -79,6 +89,7 @@ Backprojector::initBackprojector (const Projections& proj, ImageFile& im, const
     m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectIntDiff2 (proj, im, m_idInterpolation));
   else {
     m_fail = true;
+    m_failMessage = "Unable to select a backprojection method [Backprojector::initBackprojector]";
     return false;
   }
 
@@ -139,7 +150,7 @@ Backprojector::convertInterpolationNameToID (const char* const interpName)
   else if (strcasecmp (interpName, INTERP_BSPLINE_STR) == 0)
     interpID = INTERP_BSPLINE;
 #endif
-    
+
   return (interpID);
 }