r204: *** empty log message ***
[ctsim.git] / tools / phm2pj.cpp
index 2bc4d98a4ffa351b02638ceb5cea87f126db6add..af8e1f9448b6fcbc488d1ff5723fccd5bb2614a2 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: phm2pj.cpp,v 1.10 2000/08/25 15:59:13 kevin Exp $
+**  $Id: phm2pj.cpp,v 1.13 2000/11/09 00:12:25 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
@@ -50,7 +50,7 @@ static struct option phm2pj_options[] =
   {0, 0, 0, 0}
 };
 
-static const char* g_szIdStr = "$Id: phm2pj.cpp,v 1.10 2000/08/25 15:59:13 kevin Exp $";
+static const char* g_szIdStr = "$Id: phm2pj.cpp,v 1.13 2000/11/09 00:12:25 kevin Exp $";
 
 
 void 
@@ -58,7 +58,7 @@ phm2pj_usage (const char *program)
 {
   cout << "usage: " << fileBasename(program) << " outfile ndet nview [--phantom phantom-name] [--phmfile filename] [OPTIONS]\n";
   cout << "Calculate (projections) through phantom object, either a predefined --phantom or a --phmfile\n\n";
-  cout << "     outfile          Name of output file for raysums\n";
+  cout << "     outfile          Name of output file for projections\n";
   cout << "     ndet             Number of detectors\n";
   cout << "     nview            Number of rotated views\n";
   cout << "     --phantom        Phantom to use for projection\n";
@@ -78,9 +78,9 @@ phm2pj_usage (const char *program)
   cout << "                      (default = 1)\n";
   cout << "     --trace          Trace level to use\n";
   cout << "        none          No tracing (default)\n";
-  cout << "        text          Trace text level\n";
-  cout << "        phm           Trace phantom image\n";
-  cout << "        rays          Trace rays\n";
+  cout << "        console       Trace text level\n";
+  cout << "        phantom       Trace phantom image\n";
+  cout << "        proj          Trace projections\n";
   cout << "        plot          Trace plot\n";
   cout << "        clipping      Trace clipping\n";
   cout << "     --verbose        Verbose mode\n";
@@ -100,14 +100,14 @@ phm2pj_main (int argc, char* argv[])
   string optGeometryName = Scanner::convertGeometryIDToName(Scanner::GEOMETRY_PARALLEL);
   char *opt_outfile = NULL;
   string opt_desc;
+  string optPhmName;
   string optPhmFileName;
   int opt_ndet;
   int opt_nview;
   int opt_nray = 1;
   double dOptFocalLength = 1.;
   double dOptFieldOfView = 1.;
-  int opt_trace = 0;
-  string optPhmName (Phantom::convertPhantomIDToName(Phantom::PHM_HERMAN));
+  int opt_trace = Trace::TRACE_NONE;
   int opt_verbose = 0;
   int opt_debug = 0;
   double opt_rotangle = 1;
@@ -144,7 +144,7 @@ phm2pj_main (int argc, char* argv[])
        break;
        break;
       case O_TRACE:
-       if ((opt_trace = TraceLevel::convertTraceNameToID(optarg)) == TRACE_INVALID) {
+       if ((opt_trace = Trace::convertTraceNameToID(optarg)) == Trace::TRACE_INVALID) {
          phm2pj_usage(argv[0]);
          return (1);
        }
@@ -235,7 +235,7 @@ phm2pj_main (int argc, char* argv[])
     }
 
     ostringstream desc;
-    desc << "phm2pj: NDet=" << opt_ndet << ", Nview=" << opt_nview << ", NRay=" << opt_nray << ", RotAngle=" << opt_rotangle << ", ";
+    desc << "phm2pj: NDet=" << opt_ndet << ", Nview=" << opt_nview << ", NRay=" << opt_nray << ", RotAngle=" << opt_rotangle << ", Geometry=" << optGeometryName << ", ";
     if (optPhmFileName.length()) {
       desc << "PhantomFile=" << optPhmFileName;
     } else if (optPhmName != "") {
@@ -296,8 +296,11 @@ phm2pj_main (int argc, char* argv[])
   if (mpiWorld.getRank() == 0)
     pjGlobal.initFromScanner (scanner);
   
-  if (opt_verbose)
-    pjGlobal.printScanInfo();
+  if (opt_verbose) {
+    ostringstream os;
+    pjGlobal.printScanInfo(os);
+    cout << os;
+  }
 
   Projections pjLocal (scanner);
   pjLocal.setNView (mpiWorld.getMyLocalWorkUnits());
@@ -320,12 +323,12 @@ phm2pj_main (int argc, char* argv[])
 #if HAVE_SGP
   SGPDriver* pSGPDriver = NULL;
   SGP* pSGP = NULL;
-  if (opt_trace >= TRACE_PHM) {
+  if (opt_trace >= Trace::TRACE_PHANTOM) {
     pSGPDriver = new SGPDriver ("phm2pj", 600, 600);
     pSGP = new SGP (*pSGPDriver);
   }
   scanner.collectProjections (pjGlobal, phm, opt_trace, pSGP);
-  if (opt_trace >= TRACE_PHM) {
+  if (opt_trace >= Trace::TRACE_PHANTOM) {
     cout << "Press enter to continue\n";
     cio_kb_getc();
     delete pSGP;  pSGP = NULL;
@@ -348,8 +351,9 @@ phm2pj_main (int argc, char* argv[])
       if (opt_verbose) {
        phm.print();
        cout << endl;
-       pjGlobal.printScanInfo();
-       cout << endl;
+       ostringstream os;
+       pjGlobal.printScanInfo (os);
+       cout << os.str() << endl;
        cout << "  Remark: " << pjGlobal.remark() << endl;
        cout << "Run time: " << pjGlobal.calcTime() << " seconds\n";
       }