r97: Converted Scanner and Projections to C++
[ctsim.git] / src / rs2if.cpp
diff --git a/src/rs2if.cpp b/src/rs2if.cpp
deleted file mode 100644 (file)
index d82ee09..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*****************************************************************************
-** FILE IDENTIFICATION
-**
-**   Name:          rs2if.cpp
-**   Purpose:       Convert an projection data file to an image file
-**   Programmer:    Kevin Rosenberg
-**   Date Started:  April 2000
-**
-**  This is part of the CTSim program
-**  Copyright (C) 1983-2000 Kevin Rosenberg
-**
-**  $Id: rs2if.cpp,v 1.6 2000/06/15 19:07:10 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
-******************************************************************************/
-
-/* FILE
- *   rs2if.c                   Convert Raysum to image
- *
- * DATE
- *   Apr 1999
- */
-
-#include "ct.h"
-
-
-enum { O_VERBOSE, O_HELP, O_VERSION };
-
-static struct option my_options[] =
-{
-  {"verbose", 0, 0, O_VERBOSE},
-  {"help", 0, 0, O_HELP},
-  {"version", 0, 0, O_VERSION},
-  {0, 0, 0, 0}
-};
-
-
-void 
-rs2if_usage (const char *program)
-{
-  fprintf(stdout, "usage: %s in-rs-file out-if-file [OPTIONS]\n", fileBasename(program));
-  fprintf(stdout, "This program converts a raysum file to a IF file\n");
-  fprintf(stdout, "\n");
-  fprintf(stdout, "   --verbose   Verbose mode\n");
-  fprintf(stdout, "   --version   Print version\n");
-  fprintf(stdout, "   --help      Print this help message\n");
-}
-
-         
-
-int 
-rs2if_main (const int argc, char *const argv[])
-{
-  ImageFile *im;
-  RAYSUM *rs;
-  DETARRAY *detarray;
-  char *rs_name, *im_name;
-  int ix, iy;
-  int opt_v = 0;
-  extern int optind;
-  
-  while (1)
-    {
-      int c = getopt_long (argc, argv, "", my_options, NULL);
-      if (c == -1)
-       break;
-      
-      switch (c)
-       {
-       case O_VERBOSE:
-         opt_v = 1;
-         break;
-        case O_VERSION:
-#ifdef VERSION
-         fprintf(stdout, "Version %s\n", VERSION);
-#else
-         fprintf(stderr, "Unknown version number");
-#endif
-         exit(0);
-       case O_HELP:
-       case '?':
-         rs2if_usage(argv[0]);
-         return (0);
-       default:
-         rs2if_usage(argv[0]);
-         return (1);
-       }
-    }
-  
-  if (argc - optind != 2) {
-    rs2if_usage(argv[0]);
-    return (1);
-  }
-
-  rs_name = argv[optind];
-  im_name = argv[optind + 1];
-
-  if (file_exists(rs_name) == FALSE) {
-    fprintf (stderr, "Raysum file %s does not exist\n", rs_name);
-    return (1);
-  }
-  
-  rs = raysum_open (rs_name);
-
-  if (opt_v)
-    {
-      printf ("Number of detectors: %d\n", rs->ndet);
-      printf ("    Number of views: %d\n", rs->nview);
-      printf ("             Remark: %s\n", rs->remark.c_str());
-    }
-  
-  im = new ImageFile (im_name, rs->ndet, rs->nview);
-  
-  detarray = detarray_alloc (rs->ndet);
-  ImageFileArray v = im->getArray();
-
-  for (iy = 0; iy < rs->nview; iy++)
-    {
-      detarray_read (rs, detarray, iy);
-      for (ix = 0; ix < rs->ndet; ix++)
-       {
-         v[ix][iy] = detarray->detval[ix];
-       }
-    }
-  detarray_free (detarray);
-  raysum_close (rs);
-
-  im->fileCreate ();
-  im->arrayDataWrite ();
-  im->labelAdd (Array2dFileLabel::L_HISTORY, rs->remark.c_str(), rs->calctime);
-  im->labelAdd (Array2dFileLabel::L_HISTORY, "Conversion from .rs to .idf");
-  im->fileClose ();
-  
-  return(0);
-}
-
-
-#ifndef NO_MAIN
-int 
-main (const int argc, char *const argv[])
-{
-  return (rs2if_main(argc, argv));
-}
-#endif