1 /*****************************************************************************
5 ** Purpose: Text mode shell for CTSim
6 ** Programmer: Kevin Rosenberg
7 ** Date Started: Jan 2001
9 ** This is part of the CTSim program
10 ** Copyright (C) 1983-2000 Kevin Rosenberg
12 ** $Id: ctsimtext.cpp,v 1.2 2001/01/08 03:06:37 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 static const char* g_szIdStr = "$Id: ctsimtext.cpp,v 1.2 2001/01/08 03:06:37 kevin Exp $";
32 extern int if1_main (int argc, char* const argv[]);
33 extern int if2_main (int argc, char* const argv[]);
34 extern int ifexport_main (int argc, char* const argv[]);
35 extern int ifinfo_main (int argc, char* const argv[]);
36 extern int phm2if_main (int argc, char* const argv[]);
37 extern int phm2pj_main (int argc, char* const argv[]);
38 extern int pj2if_main (int argc, char* const argv[]);
39 extern int pjinfo_main (int argc, char* const argv[]);
40 extern int pjrec_main (int argc, char* const argv[]);
44 ctsimtext_usage (const char *program)
46 std::cout << "usage: " << fileBasename(program) << " ctsim-function-name ctstim-function-parameters...\n";
47 std::cout << "CTSim text shell\n\n";
48 std::cout << " ifinfo Image file information\n";
49 std::cout << " if1 Single image file conversion\n";
50 std::cout << " if2 Dual image file conversions\n";
51 std::cout << " pjrec Projection reconstruction\n";
52 std::cout << " pjinfo Projection file information\n";
53 std::cout << " phm2if Convert a geometric phantom into an imagefile\n";
54 std::cout << " phm2pj Take projections of a phantom object\n";
55 std::cout << " ifexport Export an imagefile to a graphics file\n";
56 std::cout << " pj2if Convert an projection file into an imagefile\n";
61 ctsimtext_main (int argc, char * argv[])
64 ctsimtext_usage (argv[0]);
68 const char* const pszFunction = argv[1];
72 if (strcasecmp (pszFunction, "if1") == 0)
73 return if1_main (argc, argv);
74 else if (strcasecmp (pszFunction, "if2") == 0)
75 return if2_main (argc, argv);
76 else if (strcasecmp (pszFunction, "ifexport") == 0)
77 return ifexport_main (argc, argv);
78 else if (strcasecmp (pszFunction, "ifinfo") == 0)
79 return ifinfo_main (argc, argv);
80 else if (strcasecmp (pszFunction, "phm2if") == 0)
81 return phm2if_main (argc, argv);
82 else if (strcasecmp (pszFunction, "phm2pj") == 0)
83 return phm2pj_main (argc, argv);
84 else if (strcasecmp (pszFunction, "pj2if") == 0)
85 return pj2if_main (argc, argv);
86 else if (strcasecmp (pszFunction, "pjinfo") == 0)
87 return pjinfo_main (argc, argv);
88 else if (strcasecmp (pszFunction, "pjrec") == 0)
89 return pjrec_main (argc, argv);
91 std::cout << "Unknown function name" << pszFunction << "\n\n";
92 ctsimtext_usage (argv[0]);
98 main (int argc, char* argv[])
103 retval = ctsimtext_main(argc, argv);
104 } catch (exception e) {
105 std::cerr << "Exception: " << e.what() << std::endl;
107 std::cerr << "Unknown exception\n";