1 /*****************************************************************************
5 ** Purpose: Display linogram sampling
6 ** Programmer: Kevin Rosenberg
7 ** Date Started: April 2003
9 ** This is part of the CTSim program
10 ** Copyright (C) 1983-2000 Kevin Rosenberg
12 ** $Id: linogram.cpp,v 1.1 2003/04/01 18:34:42 kevin Exp $
14 ** This program is free software; you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License (version 2) as
16 ** published by the Free Software Foundation.
18 ** This program is distributed in the hope that it will be useful,
19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ** GNU General Public License for more details.
23 ** You should have received a copy of the GNU General Public License
24 ** along with this program; if not, write to the Free Software
25 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 ******************************************************************************/
30 enum { O_LABELS,, O_VERBOSE, O_HELP, O_VERSION, O_DEBUG };
32 static struct option my_options[] =
34 {"debug", 0, 0, O_DEBUG},
35 {"verbose", 0, 0, O_VERBOSE},
36 {"help", 0, 0, O_HELP},
37 {"version", 0, 0, O_VERSION},
41 static const char* g_szIdStr = "$Id: linogram.cpp,v 1.1 2003/04/01 18:34:42 kevin Exp $";
45 linogram_usage (const char *program)
47 std::cout << "usage: " << fileBasename(program) << " n d [OPTIONS]\n";
48 std::cout << "Imagefile information\n";
49 std::cout << std::endl;
50 std::cout << " infile Name of input IF file\n";
51 std::cout << " --debug Debug mode\n";
52 std::cout << " --verbose Verbose mode\n";
53 std::cout << " --version Print version\n";
54 std::cout << " --help Print this help message\n";
58 linogram_main (int argc, char *const argv[])
66 int c = getopt_long (argc, argv, "", my_options, NULL);
81 std::cout << "Version " << VERSION << std::endl << g_szIdStr << std::endl;
83 std::cout << "Unknown version number\n";
88 linogram_usage(argv[0]);
91 linogram_usage(argv[0]);
96 if (optind + 2 != argc) {
97 linogram_usage (argv[0]);
102 in_d = argv[optind+1];
105 double n = atof (in_d);
106 int size = 2 * (2 * n - 1) + 1;
107 double divisor = 4 * n + 3;
109 for (int itheta = 0; itheta < size; itheta++) {
110 double theta = atan (2 * itheta / division);
111 printf ("%lf: ", theta);
112 double step = d * cos(theta);
113 for (int id = 0; id < size; id++) {
114 printf ("%lf ", id * step);
124 main (int argc, char *const argv[])
129 retval = linogram_main(argc, argv);
130 } catch (exception e) {
131 std::cerr << "Exception: " << e.what() << std::endl;
133 std::cerr << "Unknown exception\n";