r117: *** empty log message ***
[ctsim.git] / src / phm2pj.cpp
index fa8d0a98dc1e82ad9d3614e3bd40e221eca47df0..a4510c40bb3b09312325570cae510776cf0ab143 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: phm2pj.cpp,v 1.2 2000/06/19 17:58:13 kevin Exp $
+**  $Id: phm2pj.cpp,v 1.3 2000/06/22 10:17:28 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
 **
 **  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
@@ -59,6 +59,7 @@ phm2pj_usage (const char *program)
   cout << "     nview        Number of rotated views" << endl;
   cout << "     --phantom    Phantom to use for projection" << endl;
   cout << "        herman    Herman head phantom" << endl;
   cout << "     nview        Number of rotated views" << endl;
   cout << "     --phantom    Phantom to use for projection" << endl;
   cout << "        herman    Herman head phantom" << endl;
+  cout << "        bherman   Bordered herman head phantom" << endl;
   cout << "        rowland   Rowland head phantom" << endl;
   cout << "        browland  Bordered Rowland head phantom" << endl;
   cout << "        unitpulse Unit pulse phantom" << endl;
   cout << "        rowland   Rowland head phantom" << endl;
   cout << "        browland  Bordered Rowland head phantom" << endl;
   cout << "        unitpulse Unit pulse phantom" << endl;
@@ -95,7 +96,7 @@ phm2pj_main (int argc, char* argv[])
   int opt_nview;
   int opt_nray = 1;
   int opt_trace = 0;
   int opt_nview;
   int opt_nray = 1;
   int opt_trace = 0;
-  int optPhmNum = -1;
+  string optPhmName;
   int opt_verbose = 0;
   int opt_debug = 0;
   double opt_rotangle = 1;
   int opt_verbose = 0;
   int opt_debug = 0;
   double opt_rotangle = 1;
@@ -119,11 +120,12 @@ phm2pj_main (int argc, char* argv[])
       
       switch (c) {
       case O_PHANTOM:
       
       switch (c) {
       case O_PHANTOM:
-       if ((optPhmNum = opt_set_phantom (optarg)) < 0) {
+       optPhmName = optarg;
+       if (! phm.createFromPhantom (optPhmName.c_str())) {
+         cout << "ERROR: Invalid phantom name " << optPhmName << endl << endl;
          phm2pj_usage(argv[0]);
          return (1);
        }
          phm2pj_usage(argv[0]);
          return (1);
        }
-       phm.create (optPhmNum);
        break;
       case O_PHMFILE:
 #ifdef HAVE_MPI
        break;
       case O_PHMFILE:
 #ifdef HAVE_MPI
@@ -215,8 +217,8 @@ phm2pj_main (int argc, char* argv[])
     desc << "Raysum_Collect: NDet=" << opt_ndet << ", Nview=" << opt_nview << ", NRay=" << opt_nray << ", RotAngle=" << opt_rotangle << ", ";
     if (opt_phmfilename.length()) {
       desc << "PhantomFile=" << opt_phmfilename;
     desc << "Raysum_Collect: NDet=" << opt_ndet << ", Nview=" << opt_nview << ", NRay=" << opt_nray << ", RotAngle=" << opt_rotangle << ", ";
     if (opt_phmfilename.length()) {
       desc << "PhantomFile=" << opt_phmfilename;
-    } else if (optPhmNum != -1) {
-      desc << "Phantom=" << name_of_phantom(optPhmNum);
+    } else if (optPhmName != "") {
+      desc << "Phantom=" << optPhmName;
     }
     if (opt_desc.length()) {
       desc << ": " << opt_desc;
     }
     if (opt_desc.length()) {
       desc << ": " << opt_desc;
@@ -228,18 +230,18 @@ phm2pj_main (int argc, char* argv[])
 
 #ifdef HAVE_MPI
   TimerCollectiveMPI timerBcast(mpiWorld.getComm());
 
 #ifdef HAVE_MPI
   TimerCollectiveMPI timerBcast(mpiWorld.getComm());
+  mpiWorld.BcastString (optPhmName);
   mpiWorld.getComm().Bcast (&opt_rotangle, 1, MPI::DOUBLE, 0);
   mpiWorld.getComm().Bcast (&opt_nview, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_ndet, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_nray, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_rotangle, 1, MPI::DOUBLE, 0);
   mpiWorld.getComm().Bcast (&opt_nview, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_ndet, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_nray, 1, MPI::INT, 0);
-  mpiWorld.getComm().Bcast (&optPhmNum, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_verbose, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_debug, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_trace, 1, MPI::INT, 0);
   timerBcast.timerEndAndReport ("Time to broadcast variables");
 
   mpiWorld.getComm().Bcast (&opt_verbose, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_debug, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_trace, 1, MPI::INT, 0);
   timerBcast.timerEndAndReport ("Time to broadcast variables");
 
-  if (mpiWorld.getRank() > 0 && optPhmNum >= 0)
-    phm.create (optPhmNum);
+  if (mpiWorld.getRank() > 0 && optPhmName != "")
+    phm.createFromPhantom (optPhmName.c_str());
 #endif
 
   opt_rotangle *= PI;
 #endif
 
   opt_rotangle *= PI;