X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fctrec.cpp;h=2d94be905dfe2f61a1c75e88740bdc74144233f1;hb=e289f8ecb69ba183b32e32ff20f1679f4b62194d;hp=0ec840217f0944b6a759c9235a57913c116dea91;hpb=f4a23943110823118f35756dd41fbd6707f04511;p=ctsim.git diff --git a/src/ctrec.cpp b/src/ctrec.cpp index 0ec8402..2d94be9 100644 --- a/src/ctrec.cpp +++ b/src/ctrec.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctrec.cpp,v 1.10 2000/06/17 20:12:15 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 @@ -107,7 +107,6 @@ ctrec_main (int argc, char * argv[]) Projections projGlobal; char *pj_name, *im_filename = NULL; string remark; - char filt_name[80]; char *endptr; int opt_verbose = 0; int opt_debug = 0; @@ -177,11 +176,11 @@ ctrec_main (int argc, char * argv[]) 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]); @@ -204,14 +203,14 @@ ctrec_main (int argc, char * argv[]) nx = strtol(argv[optind + 2], &endptr, 10); ny = strtol(argv[optind + 3], &endptr, 10); + ostringstream filt_name; if (opt_filter == FILTER_G_HAMMING || opt_filter == FILTER_ABS_G_HAMMING) - snprintf (filt_name, sizeof(filt_name), "%s: alpha = %.2f", - name_of_filter (opt_filter), opt_filter_param); + filt_name << name_of_filter (opt_filter) << ": alpha=" << opt_filter_param; else - snprintf (filt_name, sizeof(filt_name), "%s", name_of_filter (opt_filter)); + filt_name << name_of_filter (opt_filter); ostringstream label; - label << "Reconstruct: " << nx << "x" << ny << ", " << filt_name << ", " << name_of_interpolation (opt_interp) << ", " << name_of_backproj(opt_backproj); + label << "Reconstruct: " << nx << "x" << ny << ", " << filt_name.str() << ", " << name_of_interpolation (opt_interp) << ", " << name_of_backproj(opt_backproj); remark = label.str(); if (opt_verbose) @@ -371,7 +370,17 @@ ReduceImageMPI (MPIWorld& mpiWorld, ImageFile* imLocal, ImageFile* imGlobal) 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