X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=tools%2Fphm2pj.cpp;fp=tools%2Fphm2pj.cpp;h=f32f5c57cb7422c4273a6a940242dda9483464f6;hp=34557af8a08e0ca40b331b4a53fa335bb9648a7c;hb=c5e7140bd08b8c8f527713e8dc861bcb7ee5f633;hpb=167d23fb037a032e3a3db3607af6d8be603dca0d diff --git a/tools/phm2pj.cpp b/tools/phm2pj.cpp index 34557af..f32f5c5 100644 --- a/tools/phm2pj.cpp +++ b/tools/phm2pj.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: phm2pj.cpp,v 1.23 2001/01/17 06:25:15 kevin Exp $ +** $Id: phm2pj.cpp,v 1.24 2001/02/08 06:25:07 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 @@ -29,7 +29,7 @@ #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[] = @@ -41,7 +41,8 @@ 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}, @@ -50,7 +51,7 @@ static struct option phm2pj_options[] = {0, 0, 0, 0} }; -static const char* g_szIdStr = "$Id: phm2pj.cpp,v 1.23 2001/01/17 06:25:15 kevin Exp $"; +static const char* g_szIdStr = "$Id: phm2pj.cpp,v 1.24 2001/02/08 06:25:07 kevin Exp $"; void @@ -78,7 +79,9 @@ phm2pj_usage (const char *program) 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"; @@ -110,7 +113,8 @@ phm2pj_main (int argc, char* const argv[]) int opt_nview; int opt_nray = 1; double dOptFocalLength = 1.; - double dOptFieldOfView = 1.; + double dOptViewRatio = 1.; + double dOptScanRatio = 1.; int opt_trace = Trace::TRACE_NONE; int opt_verbose = 0; int opt_debug = 0; @@ -177,11 +181,20 @@ phm2pj_main (int argc, char* const argv[]) 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 --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 --field-of-view to " << optarg << std::endl; + std::cerr << "Error setting --scan-ratio to " << optarg << std::endl; phm2pj_usage(argv[0]); return (1); } @@ -275,6 +288,9 @@ phm2pj_main (int argc, char* const argv[]) 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); @@ -289,7 +305,7 @@ phm2pj_main (int argc, char* const argv[]) #endif opt_rotangle *= PI; - Scanner scanner (phm, optGeometryName.c_str(), opt_ndet, opt_nview, opt_nray, opt_rotangle, dOptFocalLength, dOptFieldOfView); + 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);