--- /dev/null
+/*****************************************************************************
+** FILE IDENTIFICATION
+**
+** Name: ctsimtext.cpp
+** Purpose: Text mode shell for CTSim
+** Programmer: Kevin Rosenberg
+** Date Started: Jan 2001
+**
+** This is part of the CTSim program
+** Copyright (C) 1983-2000 Kevin Rosenberg
+**
+** $Id: ctsimtext.cpp,v 1.1 2001/01/07 22:19:44 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"
+
+static const char* g_szIdStr = "$Id: ctsimtext.cpp,v 1.1 2001/01/07 22:19:44 kevin Exp $";
+
+extern if1_main (int argc, char* const argv[]);
+extern if2_main (int argc, char* const argv[]);
+extern ifexport_main (int argc, char* const argv[]);
+extern ifinfo_main (int argc, char* const argv[]);
+extern phm2if_main (int argc, char* const argv[]);
+extern phm2pj_main (int argc, char* const argv[]);
+extern pj2if_main (int argc, char* const argv[]);
+extern pjinfo_main (int argc, char* const argv[]);
+extern pjrec_main (int argc, char* const argv[]);
+
+
+void
+ctsimtext_usage (const char *program)
+{
+ std::cout << "usage: " << fileBasename(program) << " ctsim-function-name ctstim-function-parameters...\n";
+ std::cout << "CTSim text shell\n\n";
+ std::cout << " ifinfo Image file information\n";
+ std::cout << " if1 Single image file conversion\n";
+ std::cout << " if2 Dual image file conversions\n";
+ std::cout << " pjrec Projection reconstruction\n";
+ std::cout << " pjinfo Projection file information\n";
+ std::cout << " phm2if Convert a geometric phantom into an imagefile\n";
+ std::cout << " phm2pj Take projections of a phantom object\n";
+ std::cout << " ifexport Export an imagefile to a graphics file\n";
+ std::cout << " pj2if Convert an projection file into an imagefile\n";
+}
+
+
+int
+ctsimtext_main (int argc, char * argv[])
+{
+ if (argc < 2) {
+ ctsimtext_usage (argv[0]);
+ return (1);
+ }
+
+ const char* const pszFunction = argv[1];
+ argv = &argv[1];
+ argc--;
+
+ if (strcasecmp (pszFunction, "if1") == 0)
+ return if1_main (argc, argv);
+ else if (strcasecmp (pszFunction, "if2") == 0)
+ return if2_main (argc, argv);
+ else if (strcasecmp (pszFunction, "ifexport") == 0)
+ return ifexport_main (argc, argv);
+ else if (strcasecmp (pszFunction, "ifinfo") == 0)
+ return ifinfo_main (argc, argv);
+ else if (strcasecmp (pszFunction, "phm2if") == 0)
+ return phm2if_main (argc, argv);
+ else if (strcasecmp (pszFunction, "phm2pj") == 0)
+ return phm2pj_main (argc, argv);
+ else if (strcasecmp (pszFunction, "pj2if") == 0)
+ return pj2if_main (argc, argv);
+ else if (strcasecmp (pszFunction, "pjinfo") == 0)
+ return pjinfo_main (argc, argv);
+ else if (strcasecmp (pszFunction, "pjrec") == 0)
+ return pjrec_main (argc, argv);
+ else {
+ std::cout << "Unknown function name" << pszFunction << "\n\n";
+ ctsimtext_usage (argv[0]);
+ return 1;
+ }
+}
+
+int
+main (int argc, char* argv[])
+{
+ int retval = 1;
+
+ try {
+ retval = ctsimtext_main(argc, argv);
+ } catch (exception e) {
+ std::cerr << "Exception: " << e.what() << std::endl;
+ } catch (...) {
+ std::cerr << "Unknown exception\n";
+ }
+
+ return (retval);
+}
+