** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: phm2pj.cpp,v 1.12 2000/08/31 08:38:58 kevin Exp $
+** $Id: phm2pj.cpp,v 1.17 2000/12/16 07:28: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
{0, 0, 0, 0}
};
-static const char* g_szIdStr = "$Id: phm2pj.cpp,v 1.12 2000/08/31 08:38:58 kevin Exp $";
+static const char* g_szIdStr = "$Id: phm2pj.cpp,v 1.17 2000/12/16 07:28:25 kevin Exp $";
void
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 projections\n";
- cout << " ndet Number of detectors\n";
- cout << " nview Number of rotated views\n";
- cout << " --phantom Phantom to use for projection\n";
- cout << " herman Herman head phantom\n";
- cout << " herman-b Herman head phantom (Bordered)\n";
- cout << " shepp-logan Shepp-Logan head phantom\n";
- cout << " shepp-logan-b Shepp-Logan head phantom (Bordered)\n";
- cout << " unitpulse Unit pulse phantom\n";
- cout << " --phmfile Get Phantom from phantom file\n";
- cout << " --desc Description of raysum\n";
- cout << " --nray Number of rays per detector (default = 1)\n";
- cout << " --rotangle Degrees to rotate view through (multiple of PI)\n";
- cout << " (default = 1)\n";
- cout << " --focal-length Focal length ratio (ratio to radius of phantom)\n";
- cout << " (default = 1)\n";
- cout << " --field-of-view Field of view (ratio to diameter of phantom square)\n";
- cout << " (default = 1)\n";
- cout << " --trace Trace level to use\n";
- cout << " none No tracing (default)\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";
- cout << " --debug Debug mode\n";
- cout << " --version Print version\n";
- cout << " --help Print this help message\n";
+ std::cout << "usage: " << fileBasename(program) << " outfile ndet nview [--phantom phantom-name] [--phmfile filename] [OPTIONS]\n";
+ std::cout << "Calculate (projections) through phantom object, either a predefined --phantom or a --phmfile\n\n";
+ std::cout << " outfile Name of output file for projections\n";
+ std::cout << " ndet Number of detectors\n";
+ std::cout << " nview Number of rotated views\n";
+ std::cout << " --phantom Phantom to use for projection\n";
+ std::cout << " herman Herman head phantom\n";
+ std::cout << " herman-b Herman head phantom (Bordered)\n";
+ std::cout << " shepp-logan Shepp-Logan head phantom\n";
+ std::cout << " shepp-logan-b Shepp-Logan head phantom (Bordered)\n";
+ std::cout << " unitpulse Unit pulse phantom\n";
+ std::cout << " --phmfile Get Phantom from phantom file\n";
+ std::cout << " --desc Description of raysum\n";
+ std::cout << " --nray Number of rays per detector (default = 1)\n";
+ std::cout << " --rotangle Degrees to rotate view through (multiple of PI)\n";
+ std::cout << " (default = 1)\n";
+ std::cout << " --geometry Geometry of scanning\n";
+ std::cout << " parallel Parallel scan beams (default)\n";
+ std::cout << " equilinear Equilinear divergent scan beams\n";
+ std::cout << " equiangular Equiangular divergent scan beams\n";
+ std::cout << " --focal-length Focal length ratio (ratio to radius of phantom)\n";
+ std::cout << " (default = 1)\n";
+ std::cout << " --field-of-view Field of view (ratio to diameter of phantom square)\n";
+ std::cout << " (default = 1)\n";
+ std::cout << " --trace Trace level to use\n";
+ std::cout << " none No tracing (default)\n";
+ std::cout << " console Trace text level\n";
+ std::cout << " phantom Trace phantom image\n";
+ std::cout << " proj Trace projections\n";
+ std::cout << " plot Trace plot\n";
+ std::cout << " clipping Trace clipping\n";
+ std::cout << " --verbose Verbose mode\n";
+ std::cout << " --debug Debug mode\n";
+ std::cout << " --version Print version\n";
+ std::cout << " --help Print this help message\n";
}
#ifdef HAVE_MPI
phm2pj_main (int argc, char* argv[])
{
Phantom phm;
- string optGeometryName = Scanner::convertGeometryIDToName(Scanner::GEOMETRY_PARALLEL);
+ std::string optGeometryName = Scanner::convertGeometryIDToName(Scanner::GEOMETRY_PARALLEL);
char *opt_outfile = NULL;
- string opt_desc;
- string optPhmFileName;
+ std::string opt_desc;
+ std::string optPhmName;
+ std::string optPhmFileName;
int opt_ndet;
int opt_nview;
int opt_nray = 1;
double dOptFocalLength = 1.;
double dOptFieldOfView = 1.;
int opt_trace = Trace::TRACE_NONE;
- string optPhmName (Phantom::convertPhantomIDToName(Phantom::PHM_HERMAN));
int opt_verbose = 0;
int opt_debug = 0;
double opt_rotangle = 1;
break;
case O_VERSION:
#ifdef VERSION
- cout << "Version: " << VERSION << endl << g_szIdStr << endl;
+ std::cout << "Version: " << VERSION << endl << g_szIdStr << endl;
#else
- cout << "Unknown version number\n";
+ std::cout << "Unknown version number\n";
#endif
return (0);
case O_HELP:
return (1);
}
- ostringstream desc;
+ std::ostringstream desc;
desc << "phm2pj: NDet=" << opt_ndet << ", Nview=" << opt_nview << ", NRay=" << opt_nray << ", RotAngle=" << opt_rotangle << ", Geometry=" << optGeometryName << ", ";
if (optPhmFileName.length()) {
desc << "PhantomFile=" << optPhmFileName;
if (optPhmName != "") {
phm.createFromPhantom (optPhmName.c_str());
if (phm.fail()) {
- cout << phm.failMessage() << endl << endl;
+ std::cout << phm.failMessage() << endl << endl;
phm2pj_usage(argv[0]);
return (1);
}
opt_rotangle *= PI;
Scanner scanner (phm, optGeometryName.c_str(), opt_ndet, opt_nview, opt_nray, opt_rotangle, dOptFocalLength, dOptFieldOfView);
if (scanner.fail()) {
- cout << "Scanner Creation Error: " << scanner.failMessage() << endl;
+ std::cout << "Scanner Creation Error: " << scanner.failMessage() << endl;
return (1);
}
#ifdef HAVE_MPI
pjGlobal.initFromScanner (scanner);
if (opt_verbose) {
- ostringstream os;
+ std::ostringstream os;
pjGlobal.printScanInfo(os);
- cout << os;
+ std::cout << os.str();
}
Projections pjLocal (scanner);
pjLocal.setNView (mpiWorld.getMyLocalWorkUnits());
if (opt_debug)
- cout << "pjLocal->nview = " << pjLocal.nView() << " (process " << mpiWorld.getRank() << ")\n";;
+ std::cout << "pjLocal->nview = " << pjLocal.nView() << " (process " << mpiWorld.getRank() << ")\n";;
TimerCollectiveMPI timerProject (mpiWorld.getComm());
scanner.collectProjections (pjLocal, phm, mpiWorld.getMyStartWorkUnit(), mpiWorld.getMyLocalWorkUnits(), false, opt_trace);
}
scanner.collectProjections (pjGlobal, phm, opt_trace, pSGP);
if (opt_trace >= Trace::TRACE_PHANTOM) {
- cout << "Press enter to continue\n";
+ std::cout << "Press enter to continue\n";
cio_kb_getc();
delete pSGP; pSGP = NULL;
delete pSGPDriver; pSGPDriver = NULL;
pjGlobal.write (opt_outfile);
if (opt_verbose) {
phm.print();
- cout << endl;
+ std::cout << endl;
ostringstream os;
pjGlobal.printScanInfo (os);
- cout << os.str() << endl;
- cout << " Remark: " << pjGlobal.remark() << endl;
- cout << "Run time: " << pjGlobal.calcTime() << " seconds\n";
+ std::cout << os.str() << endl;
+ std::cout << " Remark: " << pjGlobal.remark() << endl;
+ std::cout << "Run time: " << pjGlobal.calcTime() << " seconds\n";
}
}