r4311: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 1 Apr 2003 18:34:42 +0000 (18:34 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 1 Apr 2003 18:34:42 +0000 (18:34 +0000)
tools/Makefile.am
tools/linogram.cpp [new file with mode: 0644]

index 32f6d09c833d7582560addd22681d1e5a4b0ddce..871e23750765bfaa9ffb3848a52c3eaba798ec09 100644 (file)
@@ -20,15 +20,16 @@ install-exec-hook:
        ln -sf ctsimtext $(bindir)/pjinfo
        ln -sf ctsimtext $(bindir)/pjrec
        ln -sf ctsimtext $(bindir)/pjHinterp
+       ln -sf linogram $(bindir)/linogram
 
-ctsimtext_SOURCES = ctsimtext.cpp if1.cpp if2.cpp ifinfo.cpp ifexport.cpp phm2if.cpp phm2pj.cpp pj2if.cpp pjinfo.cpp pjrec.cpp nographics.cpp phm2helix.cpp pjHinterp.cpp
+ctsimtext_SOURCES = ctsimtext.cpp if1.cpp if2.cpp ifinfo.cpp ifexport.cpp phm2if.cpp phm2pj.cpp pj2if.cpp pjinfo.cpp pjrec.cpp nographics.cpp phm2helix.cpp pjHinterp.cpp linogram.cpp
 ctsimtext_LDADD=@ctlibs@
 ctsimtext_DEPENDENCIES=$(SOURCE_DEPEND)
 
 realclean:
        rm -f *.pgm *.if *~ *.pj
 
-ctsimtext_lam_SOURCES = ctsimtext.cpp if1.cpp if2.cpp ifinfo.cpp ifexport.cpp phm2if.cpp phm2pj.cpp pj2if.cpp pjinfo.cpp pjrec.cpp nographics.cpp mpiworld.cpp phm2helix.cpp pjHinterp.cpp
+ctsimtext_lam_SOURCES = ctsimtext.cpp if1.cpp if2.cpp ifinfo.cpp ifexport.cpp phm2if.cpp phm2pj.cpp pj2if.cpp pjinfo.cpp pjrec.cpp nographics.cpp mpiworld.cpp phm2helix.cpp pjHinterp.cpp linogram.cpp
 ctsimtext_lam_LDADD=@ctlamlibs@
 
 if USE_LAM
@@ -37,7 +38,7 @@ LAM_EXTRA_SRC = mpiworld.cpp
 
 ctsimtext_lam_DEPENDENCIES=$(SOURCE_DEPEND)
 
-ctsimtext-lam$(EXEEXT): ctsimtext.cpp if1.cpp if2.cpp ifinfo.cpp ifexport.cpp phm2if.cpp phm2pj.cpp pj2if.cpp pjinfo.cpp pjrec.cpp mpiworld.cpp ../include/ct.h ../libctsim/libctsim.a ../libctsupport/libctsupport.a
+ctsimtext-lam$(EXEEXT): ctsimtext.cpp if1.cpp if2.cpp ifinfo.cpp ifexport.cpp phm2if.cpp phm2pj.cpp pj2if.cpp pjinfo.cpp pjrec.cpp mpiworld.cpp linogram.cpp ../include/ct.h ../libctsim/libctsim.a ../libctsupport/libctsupport.a
        $(CC_LAM) @DEFS@ @lamdefs@ $(CFLAGS) $(INCLUDES) -DHAVE_MPI -DNO_MAIN ctsimtext.cpp if1.cpp if2.cpp ifinfo.cpp ifexport.cpp phm2if.cpp phm2pj.cpp pj2if.cpp pjinfo.cpp pjrec.cpp -o ctsimtext-lam $(LDFLAGS) $(LAM_EXTRA_SRC) @ctlibs@
 
 endif
diff --git a/tools/linogram.cpp b/tools/linogram.cpp
new file mode 100644 (file)
index 0000000..a244c0d
--- /dev/null
@@ -0,0 +1,138 @@
+/*****************************************************************************
+** FILE IDENTIFICATION
+**
+**   Name:          linogram.cpp
+**   Purpose:       Display linogram sampling
+**   Programmer:    Kevin Rosenberg
+**   Date Started:  April 2003
+**
+**  This is part of the CTSim program
+**  Copyright (C) 1983-2000 Kevin Rosenberg
+**
+**  $Id: linogram.cpp,v 1.1 2003/04/01 18:34:42 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
+**  published by the Free Software Foundation.
+**
+**  This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with this program; if not, write to the Free Software
+**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+******************************************************************************/
+
+#include "ct.h"
+
+enum { O_LABELS,, O_VERBOSE, O_HELP, O_VERSION, O_DEBUG };
+
+static struct option my_options[] =
+{
+   {"debug", 0, 0, O_DEBUG},
+  {"verbose", 0, 0, O_VERBOSE},
+  {"help", 0, 0, O_HELP},
+  {"version", 0, 0, O_VERSION},
+  {0, 0, 0, 0}
+};
+
+static const char* g_szIdStr = "$Id: linogram.cpp,v 1.1 2003/04/01 18:34:42 kevin Exp $";
+
+
+void 
+linogram_usage (const char *program)
+{
+  std::cout << "usage: " << fileBasename(program) << " n d [OPTIONS]\n";
+  std::cout << "Imagefile information\n";
+  std::cout << std::endl;
+  std::cout << "     infile       Name of input IF file\n";
+   std::cout << "     --debug      Debug mode\n";
+  std::cout << "     --verbose    Verbose mode\n";
+  std::cout << "     --version    Print version\n";
+  std::cout << "     --help       Print this help message\n";
+}
+
+int 
+linogram_main (int argc, char *const argv[])
+{
+  std::string in_n;
+  int opt_verbose = 0;
+  int opt_debug = 0;
+
+  while (1)
+    {
+      int c = getopt_long (argc, argv, "", my_options, NULL);
+      
+      if (c == -1)
+       break;
+      
+      switch (c)
+       {
+       case O_VERBOSE:
+         opt_verbose = 1;
+         break;
+       case O_DEBUG:
+         opt_debug = 0;
+         break;
+        case O_VERSION:
+#ifdef VERSION
+         std::cout << "Version " << VERSION << std::endl << g_szIdStr << std::endl;
+#else
+          std::cout << "Unknown version number\n";
+#endif
+         return (0);
+       case O_HELP:
+       case '?':
+         linogram_usage(argv[0]);
+         return (0);
+       default:
+         linogram_usage(argv[0]);
+         return (1);
+       }
+    }
+
+  if (optind + 2 != argc) {
+    linogram_usage (argv[0]);
+    return (1);
+  }
+  
+  in_n = argv[optind];
+  in_d = argv[optind+1];
+
+  int n = atol (in_n);
+  double n = atof (in_d);
+  int size = 2 * (2 * n - 1) + 1;
+  double divisor = 4 * n + 3;
+  
+  for (int itheta = 0; itheta < size; itheta++) {
+    double theta = atan (2 * itheta / division);
+    printf ("%lf: ", theta);
+    double step = d * cos(theta);
+    for (int id = 0; id < size; id++) {
+      printf ("%lf ", id * step);
+    }
+    printf ("\n");
+  }
+  
+  return (0);
+}
+
+#ifndef NO_MAIN
+int 
+main (int argc, char *const argv[])
+{
+  int retval = 1;
+
+  try {
+    retval = linogram_main(argc, argv);
+  } catch (exception e) {
+         std::cerr << "Exception: " << e.what() << std::endl;
+  } catch (...) {
+         std::cerr << "Unknown exception\n";
+  }
+
+  return (retval);
+}
+#endif