** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: scanner.cpp,v 1.1 2000/06/19 02:59:34 kevin Exp $
+** $Id: scanner.cpp,v 1.2 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
* int nSample Number of rays per detector
*/
-Scanner::Scanner (const Phantom& phm, const ScannerGeometry geometry, int nDet, int nView, int nSample, const double rot_anglen)
+Scanner::Scanner (const Phantom& phm, const char* const geometryName, int nDet, int nView, int nSample, const double rot_anglen)
{
m_phmLen = phm.maxAxisLength(); // maximal length along an axis
+ m_fail = false;
+ m_idGeometry = convertGeometryNameToID (geometryName);
+ if (m_idGeometry == GEOMETRY_INVALID) {
+ m_fail = true;
+ m_failMessage = "Invalid geometry name ";
+ m_failMessage += geometryName;
+ return;
+ }
+
if (nView < 1)
nView = 1;
if (nSample < 1)
if ((nDet % 2) == 0)
++nDet; // ensure odd number of detectors
- m_geometry = geometry;
m_nDet = nDet;
m_nView = nView;
m_nSample = nSample;
}
+Scanner::GeometryID
+Scanner::convertGeometryNameToID (const char* const geometryName)
+{
+ GeometryID geometryID = GEOMETRY_INVALID;
+
+ if (strcasecmp (geometryName, GEOMETRY_PARALLEL_STR) == 0)
+ geometryID = GEOMETRY_PARALLEL;
+ else if (strcasecmp (geometryName, GEOMETRY_EQUILINEAR_STR) == 0)
+ geometryID = GEOMETRY_EQUILINEAR;
+ else if (strcasecmp (geometryName, GEOMETRY_EQUIANGLE_STR) == 0)
+ geometryID = GEOMETRY_EQUIANGLE;
+
+ return (geometryID);
+}
+
+
/* NAME
* raysum_collect Calculate ray sums for a Phantom