** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ctrec.cpp,v 1.11 2000/06/18 10:27:11 kevin Exp $
+** $Id: ctrec.cpp,v 1.12 2000/06/19 17:58:13 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
break;
case O_VERSION:
#ifdef VERSION
- cout << "Version " << VERSION << endl;
+ cout << "Version " << VERSION << endl;
#else
- cout << "Unknown version number" << endl;
+ cout << "Unknown version number" << endl;
#endif
- exit(0);
+ return (0);
case O_HELP:
case '?':
ctrec_usage(argv[0]);
int
main (int argc, char* argv[])
{
- return (ctrec_main(argc, argv));
+ int retval = 1;
+
+ try {
+ retval = ctrec_main(argc, argv);
+ } catch (exception e) {
+ cerr << "Exception: " << e.what() << endl;
+ } catch (...) {
+ cerr << "Unknown exception" << endl;
+ }
+
+ return (retval);
}
#endif
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: if-1.cpp,v 1.7 2000/06/18 10:27:11 kevin Exp $
+** $Id: if-1.cpp,v 1.8 2000/06/19 17:58:13 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
main (int argc, char *const argv[])
{
- return (if1_main(argc, argv));
+ int retval = 1;
+
+ try {
+ retval = if1_main(argc, argv);
+ } catch (exception e) {
+ cerr << "Exception: " << e.what() << endl;
+ } catch (...) {
+ cerr << "Unknown exception" << endl;
+ }
+
+ return (retval);
}
#endif
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: if-2.cpp,v 1.5 2000/06/18 10:27:11 kevin Exp $
+** $Id: if-2.cpp,v 1.6 2000/06/19 17:58:13 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
main (int argc, char *const argv[])
{
- return (if2_main(argc, argv));
+ int retval = 1;
+
+ try {
+ retval = if2_main(argc, argv);
+ } catch (exception e) {
+ cerr << "Exception: " << e.what() << endl;
+ } catch (...) {
+ cerr << "Unknown exception" << endl;
+ }
+
+ return (retval);
}
#endif
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: if2img.cpp,v 1.6 2000/06/18 10:27:11 kevin Exp $
+** $Id: if2img.cpp,v 1.7 2000/06/19 17:58:13 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
#else
cout << "Unknown version number" << endl;
#endif
- exit(0);
+ return (0);
case O_HELP:
case '?':
if2img_usage(argv[0]);
pim = new ImageFile (in_file);
ImageFile& im = *pim;
if (! im.fileRead()) {
- sys_error (ERR_SEVERE, "File %s does not exist", in_file);
+ sys_error (ERR_FATAL, "File %s does not exist", in_file);
return (1);
}
delete rowp;
if ((out = fopen(outfile,"w")) == NULL) {
- sys_error(ERR_SEVERE,"Error opening output file %s for writing", outfile);
- exit(1);
+ sys_error(ERR_FATAL, "Error opening output file %s for writing", outfile);
+ return (1);
}
gdImageGif(gif,out);
fclose(out);
int
main (int argc, char *const argv[])
{
- return (if2img_main(argc, argv));
+ int retval = 1;
+
+ try {
+ retval = if2img_main(argc, argv);
+ } catch (exception e) {
+ cerr << "Exception: " << e.what() << endl;
+ } catch (...) {
+ cerr << "Unknown exception" << endl;
+ }
+
+ return (retval);
}
#endif
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ifinfo.cpp,v 1.8 2000/06/18 10:27:11 kevin Exp $
+** $Id: ifinfo.cpp,v 1.9 2000/06/19 17:58:13 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
main (int argc, char *const argv[])
{
- return (ifinfo_main(argc, argv));
+ int retval = 1;
+
+ try {
+ retval = ifinfo_main(argc, argv);
+ } catch (exception e) {
+ cerr << "Exception: " << e.what() << endl;
+ } catch (...) {
+ cerr << "Unknown exception" << endl;
+ }
+
+ return (retval);
}
#endif
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: phm2if.cpp,v 1.10 2000/06/18 10:27:11 kevin Exp $
+** $Id: phm2if.cpp,v 1.11 2000/06/19 17:58:13 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
#endif
#ifdef HAVE_MPI
- TimerMPI timerBcast (mpiWorld.getComm());
+ TimerCollectiveMPI timerBcast (mpiWorld.getComm());
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);
else {
if (mpiWorld.getRank() == 0)
cerr << "phmnum < 0" << endl;
- exit(1);
+ return (1);
}
#endif
image_filter_response (*imGlobal, opt_filter_domain, opt_filter_bw, opt_filter, opt_filter_param, opt_trace);
}
} else {
- TimerMPI timerRasterize (mpiWorld.getComm());
+ TimerCollectiveMPI timerRasterize (mpiWorld.getComm());
phm_to_imagefile (phm, *imLocal, mpiWorld.getMyStartWorkUnit(), mpiWorld.getMyLocalWorkUnits(), opt_nsample, opt_trace);
if (opt_verbose)
timerRasterize.timerEndAndReport ("Time to rasterize phantom");
- TimerMPI timerGather (mpiWorld.getComm());
+ TimerCollectiveMPI timerGather (mpiWorld.getComm());
mpi_gather_image (mpiWorld, imGlobal, imLocal, opt_debug);
if (opt_verbose)
timerGather.timerEndAndReport ("Time to gather image");
int
main (int argc, char* argv[])
{
- return (phm2if_main(argc, argv));
+ int retval = 1;
+
+ try {
+ retval = phm2if_main(argc, argv);
+ } catch (exception e) {
+ cerr << "Exception: " << e.what() << endl;
+ } catch (...) {
+ cerr << "Unknown exception" << endl;
+ }
+
+ return (retval);
}
#endif
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: phm2pj.cpp,v 1.1 2000/06/17 20:12:15 kevin Exp $
+** $Id: phm2pj.cpp,v 1.2 2000/06/19 17:58:13 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
char *opt_outfile = NULL;
string opt_desc;
string opt_phmfilename;
- int opt_ndet, opt_nview;
+ int opt_ndet;
+ int opt_nview;
int opt_nray = 1;
int opt_trace = 0;
- int opt_phmnum = -1;
+ int optPhmNum = -1;
int opt_verbose = 0;
int opt_debug = 0;
double opt_rotangle = 1;
switch (c) {
case O_PHANTOM:
- if ((opt_phmnum = opt_set_phantom (optarg)) < 0) {
+ if ((optPhmNum = opt_set_phantom (optarg)) < 0) {
phm2pj_usage(argv[0]);
return (1);
}
- phm.create (opt_phmnum);
+ phm.create (optPhmNum);
break;
case O_PHMFILE:
#ifdef HAVE_MPI
break;
case O_VERSION:
#ifdef VERSION
- cout << "Version: " << VERSION << endl;
+ cout << "Version: " << VERSION << endl;
#else
- cout << "Unknown version number" << endl;
+ cout << "Unknown version number" << endl;
#endif
- exit(0);
+ return (0);
case O_HELP:
case '?':
phm2pj_usage(argv[0]);
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 (opt_phmnum != -1) {
- desc << "Phantom=" << name_of_phantom(opt_phmnum);
+ } else if (optPhmNum != -1) {
+ desc << "Phantom=" << name_of_phantom(optPhmNum);
}
if (opt_desc.length()) {
desc << ": " << opt_desc;
#endif
#ifdef HAVE_MPI
+ TimerCollectiveMPI timerBcast(mpiWorld.getComm());
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_phmnum, 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");
- if (mpiWorld.getRank() > 0 && opt_phmnum >= 0)
- phm.create (opt_phmnum);
+ if (mpiWorld.getRank() > 0 && optPhmNum >= 0)
+ phm.create (optPhmNum);
#endif
opt_rotangle *= PI;
mpiWorld.setTotalWorkUnits (opt_nview);
Projections pjGlobal;
- if (mpiWorld.getRank() == 0) {
- pjGlobal = Projections (scanner);
- }
+ if (mpiWorld.getRank() == 0)
+ pjGlobal.initFromScanner (scanner);
- Scanner localScanner (phm, opt_geometry, opt_ndet, mpiWorld.getMyLocalWorkUnits(), opt_nray, opt_rotangle);
- Projections pjLocal (localScanner);
+ if (opt_verbose)
+ pjGlobal.printScanInfo();
+
+ Projections pjLocal (scanner);
+ pjLocal.setNView (mpiWorld.getMyLocalWorkUnits());
+
if (opt_debug)
cout << "pjLocal->nview = " << pjLocal.nView() << " (process " << mpiWorld.getRank() << ")" << endl;;
- TimerMPI timerProject (mpiWorld.getComm());
- localScanner.collectProjections (pjLocal, phm, mpiWorld.getMyStartWorkUnit(), opt_trace);
+ TimerCollectiveMPI timerProject (mpiWorld.getComm());
+ scanner.collectProjections (pjLocal, phm, mpiWorld.getMyStartWorkUnit(), opt_trace);
if (opt_verbose)
timerProject.timerEndAndReport ("Time to collect projections");
- TimerMPI timerGather (mpiWorld.getComm());
+ TimerCollectiveMPI timerGather (mpiWorld.getComm());
GatherProjectionsMPI (mpiWorld, pjGlobal, pjLocal, opt_debug);
- if (opt_verbose)
- timerGather.timerEndAndReport ("Time to gather projections");
+ if (opt_verbose)
+ timerGather.timerEndAndReport ("Time to gather projections");
+
#else
Projections pjGlobal (scanner);
scanner.collectProjections (pjGlobal, phm, 0, opt_trace);
cout << endl;
pjGlobal.printScanInfo();
cout << endl;
- cout << "Remark: " << pjGlobal.remark() << endl;
+ cout << " Remark: " << pjGlobal.remark() << endl;
cout << "Run time: " << pjGlobal.calcTime() << " seconds" << endl;
}
}
MPI::Status status;
double viewAngle;
int nDet;
- DetectorArray detArray = pjGlobal.getDetectorArray(iw);
+ DetectorArray& detArray = pjGlobal.getDetectorArray(iw);
DetectorValue* detval = detArray.detValues();
mpiWorld.getComm().Recv(&viewAngle, 1, MPI::DOUBLE, iProc, 0, status);
}
}
}
-
}
#endif
int
main (int argc, char* argv[])
{
- return (phm2pj_main(argc, argv));
+ int retval = 1;
+
+ try {
+ retval = phm2pj_main(argc, argv);
+ } catch (exception e) {
+ cerr << "Exception: " << e.what() << endl;
+ } catch (...) {
+ cerr << "Unknown exception" << endl;
+ }
+
+ return (retval);
}
#endif
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: pj2if.cpp,v 1.2 2000/06/18 10:27:11 kevin Exp $
+** $Id: pj2if.cpp,v 1.3 2000/06/19 17:58:13 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
main (const int argc, char *const argv[])
{
- return (pj2if_main(argc, argv));
+ int retval = 1;
+
+ try {
+ retval = pj2if_main(argc, argv);
+ } catch (exception e) {
+ cerr << "Exception: " << e.what() << endl;
+ } catch (...) {
+ cerr << "Unknown exception" << endl;
+ }
+
+ return (retval);
}
#endif