r480: no message
[ctsim.git] / libctsim / scanner.cpp
index 30b75d25535a2b0ac4e472c7604f59ed63002f0d..120ddb515dc44080148cb054984befe2d0f543e0 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: scanner.cpp,v 1.27 2001/01/28 19:10:18 kevin Exp $
+**  $Id: scanner.cpp,v 1.28 2001/02/02 00:46:38 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
@@ -132,9 +132,8 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName, int nDet,
     m_initPos.yd2 = m_dYCenter - m_dFocalLength;
     m_initPos.angle = 0.0;
   } else if (m_idGeometry == GEOMETRY_EQUILINEAR) {
-#if 0
-    double dAngle = (m_dFieldOfView / 2) / cos (asin (m_dFieldOfView / 2 / m_dFocalLength));
-#else
+
+    double dAngle1 = atan ((m_dFieldOfView / 2) / m_dFocalLength);
     double dHalfSquare = m_dFieldOfView / SQRT2 / 2;
     double dFocalPastPhm = m_dFocalLength - dHalfSquare;
     if (dFocalPastPhm <= 0.) {
@@ -142,8 +141,12 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName, int nDet,
       m_failMessage = "Focal Point inside of phantom";
       return;
     }
-    double dAngle = atan( dHalfSquare / dFocalPastPhm );
-#endif
+    double dAngle2 = atan( dHalfSquare / dFocalPastPhm );
+    double dAngle = maxValue<double> (dAngle1, dAngle2);
+#if 0
+    double dAngle = (m_dFieldOfView / 2) / cos (asin (m_dFieldOfView / 2 / m_dFocalLength));
+#endif    
+
     double dHalfDetLen = 2 * m_dFocalLength * tan (dAngle);
     
     m_detLen = dHalfDetLen * 2;
@@ -162,9 +165,8 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName, int nDet,
     m_initPos.yd2 = m_dYCenter - m_dFocalLength;
     m_initPos.angle = 0.0;
   } else if (m_idGeometry == GEOMETRY_EQUIANGULAR) {
-#if 0
-    double dAngle = atan ((m_dFieldOfView / 2) / m_dFocalLength);
-#else
+    double dAngle1 = atan ((m_dFieldOfView / 2) / m_dFocalLength);
+
     double dHalfSquare = m_dFieldOfView / SQRT2 / 2;
     double dFocalPastPhm = m_dFocalLength - dHalfSquare;
     if (dFocalPastPhm <= 0.) {
@@ -172,8 +174,9 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName, int nDet,
       m_failMessage = "Focal Point inside of phantom";
       return;
     }
-    double dAngle =  atan ( dHalfSquare / dFocalPastPhm ); 
-#endif
+    double dAngle2 =  atan ( dHalfSquare / dFocalPastPhm ); 
+    double dAngle = maxValue<double> (dAngle1, dAngle2);
+
     m_detLen = 2 * dAngle;
     m_detInc = m_detLen / m_nDet;
     if (m_nDet % 2 == 0) // Adjust for Even number of detectors