X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=libctsim%2Fscanner.cpp;h=6e2e57ad48bf962af80a9219c9638947f21bc713;hb=1f72f3289ee6be64ec607ea93b4fcfe8b5dff3eb;hp=d577ebb293cd45f11646e7241dd5a90af106c815;hpb=4a5567b8df652cc3168bb9d439bc23f973a2b5ea;p=ctsim.git diff --git a/libctsim/scanner.cpp b/libctsim/scanner.cpp index d577ebb..6e2e57a 100644 --- a/libctsim/scanner.cpp +++ b/libctsim/scanner.cpp @@ -7,9 +7,9 @@ ** Date Started: 1984 ** ** This is part of the CTSim program -** Copyright (C) 1983-2000 Kevin Rosenberg +** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: scanner.cpp,v 1.26 2001/01/27 21:02:20 kevin Exp $ +** $Id: scanner.cpp,v 1.29 2001/02/04 21:28:19 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 @@ -133,8 +133,7 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName, int nDet, 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,18 @@ 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 (dAngle1, dAngle2); + //double dAngle = (m_dFieldOfView / 2) / cos (asin (m_dFieldOfView / 2 / m_dFocalLength)); +#else + if (m_dFieldOfView/2 >= m_dFocalLength) { + m_fail = true; + m_failMessage = "Invalid geometry: Focal length must be larger than field of view"; + return; + } + double dAngle = asin ((m_dFieldOfView/2) / m_dFocalLength); +#endif + double dHalfDetLen = 2 * m_dFocalLength * tan (dAngle); m_detLen = dHalfDetLen * 2; @@ -162,18 +171,13 @@ 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 dHalfSquare = m_dFieldOfView / SQRT2 / 2; - double dFocalPastPhm = m_dFocalLength - dHalfSquare; - if (dFocalPastPhm <= 0.) { + if (m_dFieldOfView/2 > m_dFocalLength) { m_fail = true; - m_failMessage = "Focal Point inside of phantom"; + m_failMessage = "Invalid geometry: Focal length must be larger than field of view"; return; } - double dAngle = atan ( dHalfSquare / dFocalPastPhm ); -#endif + double dAngle = asin ((m_dFieldOfView/2) / m_dFocalLength); + m_detLen = 2 * dAngle; m_detInc = m_detLen / m_nDet; if (m_nDet % 2 == 0) // Adjust for Even number of detectors