X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fphm2if.cpp;h=91d052107d6ad648acac62334e4d073998a12148;hp=75119c9642b2fab18ffe01fdb1f50c1cff78f4e1;hb=08f34bf3ba14d4f436f4d2ef0ee5af1d6eb266ac;hpb=6e9304595677d093974038ffad44f8d54178e741 diff --git a/src/phm2if.cpp b/src/phm2if.cpp index 75119c9..91d0521 100644 --- a/src/phm2if.cpp +++ b/src/phm2if.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: phm2if.cpp,v 1.13 2000/06/22 10:17:28 kevin Exp $ +** $Id: phm2if.cpp,v 1.14 2000/06/25 17:32:24 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 @@ -108,13 +108,13 @@ phm2if_main (int argc, char* argv[]) Phantom phm; int opt_nx = 0, opt_ny = 0; int opt_nsample = 1; - string optPhmName; + string optPhmName = Phantom::PHM_HERMAN_STR; string optFilterName; - string optDomainName = "spatial"; + string optDomainName = SignalFilter::DOMAIN_SPATIAL_STR; char *opt_outfile = NULL; int opt_debug = 0; string opt_desc; - string opt_phmfilename; + string opt_phmFileName; char *endstr, *endptr; double opt_filter_param = 1; double opt_filter_bw = 1.; @@ -141,20 +141,9 @@ phm2if_main (int argc, char* argv[]) switch (c) { case O_PHANTOM: optPhmName = optarg; - if (! phm.createFromPhantom (optPhmName.c_str())) { - cout << "Invalid phantom name " << optPhmName << endl << endl; - phm2if_usage(argv[0]); - return (1); - } break; case O_PHMFILE: - opt_phmfilename = optarg; - phm.createFromFile(opt_phmfilename.c_str()); -#ifdef HAVE_MPI - if (mpiWorld.getRank() == 0) - cerr << "Can't use phantom from file in MPI mode" << endl; - return (1); -#endif + opt_phmFileName = optarg; break; case O_VERBOSE: opt_verbose = true; @@ -220,8 +209,8 @@ phm2if_main (int argc, char* argv[]) } } - if (phm.nPElem() == 0 && optPhmName == "" && optFilterName == "") { - cerr << "No phantom defined" << endl; + if (optPhmName == "" && optFilterName == "" && opt_phmFileName == "") { + cerr << "No phantom defined" << endl << endl; phm2if_usage(argv[0]); return (1); } @@ -248,17 +237,35 @@ phm2if_main (int argc, char* argv[]) ostringstream oss; oss << "nx=" << opt_nx << ", ny=" << opt_ny << ", nsample=" << opt_nsample << ", "; - if (opt_phmfilename.length()) - oss << "phantom=" << opt_phmfilename; + if (opt_phmFileName != "") + oss << "phantom=" << opt_phmFileName; else if (optPhmName != "") oss << "phantom=" << optPhmName; else if (optFilterName != "") { oss << "filter=" << optFilterName << " - " << optDomainName; } - if (opt_desc.length()) + if (opt_desc != "") oss << ": " << opt_desc; opt_desc = oss.str(); + if (optPhmName != "") { + phm.createFromPhantom (optPhmName.c_str()); + if (phm.fail()) { + cout << phm.failMessage() << endl << endl; + phm2if_usage(argv[0]); + return (1); + } + } + + if (opt_phmFileName != "") { + phm.createFromFile(opt_phmFileName.c_str()); +#ifdef HAVE_MPI + if (mpiWorld.getRank() == 0) + cerr << "Can't use phantom from file in MPI mode" << endl; + return (1); +#endif + } + if (opt_verbose) cout << "Rasterize Phantom to Image" << endl << endl; #ifdef HAVE_MPI @@ -309,7 +316,7 @@ phm2if_main (int argc, char* argv[]) } } else if (optFilterName != "") { if (mpiWorld.getRank() == 0) { - image_filter_response (*imGlobal, optDomainName.c_str(), opt_filter_bw, optFilterName.c_str(), opt_filter_param, opt_trace); + imGlobal->filterResponse (optDomainName.c_str(), opt_filter_bw, optFilterName.c_str(), opt_filter_param); } } else { TimerCollectiveMPI timerRasterize (mpiWorld.getComm()); @@ -327,7 +334,7 @@ phm2if_main (int argc, char* argv[]) if (phm.getComposition() == P_UNIT_PULSE) { v[opt_nx/2][opt_ny/2] = 1.; } else if (optFilterName != "") { - image_filter_response (*imGlobal, optDomainName.c_str(), opt_filter_bw, optFilterName.c_str(), opt_filter_param, opt_trace); + imGlobal->filterResponse (optDomainName.c_str(), opt_filter_bw, optFilterName.c_str(), opt_filter_param); } else { #if HAVE_SGP if (opt_trace >= TRACE_PHM) @@ -356,7 +363,7 @@ phm2if_main (int argc, char* argv[]) scanf ("%d", &nscale); printf ("Enter minimum and maximum densities (min, max): "); scanf ("%lf %lf", &dmin, &dmax); - image_display_scale (*imGlobal, nscale, dmin, dmax); + imGlobal->displayScaling (nscale, dmin, dmax); } }