** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: phm2pj.cpp,v 1.20 2001/01/02 05:34:57 kevin Exp $
+** $Id: phm2pj.cpp,v 1.27 2001/02/19 20:23:17 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
#include "timer.h"
-enum { O_PHANTOM, O_DESC, O_NRAY, O_ROTANGLE, O_PHMFILE, O_GEOMETRY, O_FOCAL_LENGTH, O_FIELD_OF_VIEW,
+enum { O_PHANTOM, O_DESC, O_NRAY, O_ROTANGLE, O_PHMFILE, O_GEOMETRY, O_FOCAL_LENGTH, O_VIEW_RATIO, O_SCAN_RATIO,
O_TRACE, O_VERBOSE, O_HELP, O_DEBUG, O_VERSION };
static struct option phm2pj_options[] =
{"rotangle", 1, 0, O_ROTANGLE},
{"geometry", 1, 0, O_GEOMETRY},
{"focal-length", 1, 0, O_FOCAL_LENGTH},
- {"field-of-view", 1, 0, O_FIELD_OF_VIEW},
+ {"view-ratio", 1, 0, O_VIEW_RATIO},
+ {"scan-ratio", 1, 0, O_SCAN_RATIO},
{"trace", 1, 0, O_TRACE},
{"verbose", 0, 0, O_VERBOSE},
{"help", 0, 0, O_HELP},
{0, 0, 0, 0}
};
-static const char* g_szIdStr = "$Id: phm2pj.cpp,v 1.20 2001/01/02 05:34:57 kevin Exp $";
+static const char* g_szIdStr = "$Id: phm2pj.cpp,v 1.27 2001/02/19 20:23:17 kevin Exp $";
void
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 << " --rotangle Angle to rotate view through (fraction of a circle)\n";
+ std::cout << " (default = select appropriate for geometry)\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 << " --view-ratio Length to view (view diameter to phantom diameter)\n";
+ std::cout << " (default = 1)\n";
+ std::cout << " --scan-ratio Length to scan (scan diameter to view diameter)\n";
std::cout << " (default = 1)\n";
std::cout << " --trace Trace level to use\n";
std::cout << " none No tracing (default)\n";
#endif
int
-phm2pj_main (int argc, char* argv[])
+phm2pj_main (int argc, char* const argv[])
{
Phantom phm;
std::string optGeometryName = Scanner::convertGeometryIDToName(Scanner::GEOMETRY_PARALLEL);
int opt_ndet;
int opt_nview;
int opt_nray = 1;
- double dOptFocalLength = 1.;
- double dOptFieldOfView = 1.;
+ double dOptFocalLength = 2.;
+ double dOptViewRatio = 1.;
+ double dOptScanRatio = 1.;
int opt_trace = Trace::TRACE_NONE;
int opt_verbose = 0;
int opt_debug = 0;
- double opt_rotangle = 1;
+ double opt_rotangle = -1;
char* endptr = NULL;
char* endstr;
return (1);
}
break;
- case O_FIELD_OF_VIEW:
- dOptFieldOfView = strtod(optarg, &endptr);
+ case O_VIEW_RATIO:
+ dOptViewRatio = strtod(optarg, &endptr);
endstr = optarg + strlen(optarg);
if (endptr != endstr) {
- std::cerr << "Error setting --field-of-view to " << optarg << std::endl;
+ std::cerr << "Error setting --view-ratio to " << optarg << std::endl;
+ phm2pj_usage(argv[0]);
+ return (1);
+ }
+ break;
+ case O_SCAN_RATIO:
+ dOptScanRatio = strtod(optarg, &endptr);
+ endstr = optarg + strlen(optarg);
+ if (endptr != endstr) {
+ std::cerr << "Error setting --scan-ratio to " << optarg << std::endl;
phm2pj_usage(argv[0]);
return (1);
}
return (1);
}
+ if (opt_rotangle < 0) {
+ if (optGeometryName.compare ("parallel") == 0)
+ opt_rotangle = 0.5;
+ else
+ opt_rotangle = 1.0;
+ }
+
std::ostringstream desc;
desc << "phm2pj: NDet=" << opt_ndet << ", Nview=" << opt_nview << ", NRay=" << opt_nray << ", RotAngle=" << opt_rotangle << ", Geometry=" << optGeometryName << ", ";
if (optPhmFileName.length()) {
TimerCollectiveMPI timerBcast(mpiWorld.getComm());
mpiWorld.BcastString (optPhmName);
mpiWorld.getComm().Bcast (&opt_rotangle, 1, MPI::DOUBLE, 0);
+ mpiWorld.getComm().Bcast (&dOptFocalLength, 1, MPI::DOUBLE, 0);
+ mpiWorld.getComm().Bcast (&dOptViewRatio, 1, MPI::DOUBLE, 0);
+ mpiWorld.getComm().Bcast (&dOptScanRatio, 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_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 (opt_verbose)
+ timerBcast.timerEndAndReport ("Time to broadcast variables");
if (mpiWorld.getRank() > 0 && optPhmName != "")
phm.createFromPhantom (optPhmName.c_str());
#endif
- opt_rotangle *= PI;
- Scanner scanner (phm, optGeometryName.c_str(), opt_ndet, opt_nview, opt_nray, opt_rotangle, dOptFocalLength, dOptFieldOfView);
+ opt_rotangle *= TWOPI;
+ Scanner scanner (phm, optGeometryName.c_str(), opt_ndet, opt_nview, opt_nray, opt_rotangle, dOptFocalLength, dOptViewRatio, dOptScanRatio);
if (scanner.fail()) {
std::cout << "Scanner Creation Error: " << scanner.failMessage() << std::endl;
return (1);
#else
Projections pjGlobal (scanner);
-#if HAVE_SGP
- SGPDriver* pSGPDriver = NULL;
- SGP* pSGP = NULL;
- 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::TRACE_PHANTOM) {
- std::cout << "Press enter to continue\n";
- cio_kb_getc();
- delete pSGP; pSGP = NULL;
- delete pSGPDriver; pSGPDriver = NULL;
- }
-
-#else
scanner.collectProjections (pjGlobal, phm, opt_trace);
#endif
-
-#endif
#ifdef HAVE_MPI
if (mpiWorld.getRank() == 0)