-3.0.0alpha4
+3.0.0alpha5 - Released
+
+ * ctsimtext: Fixed bugs for MSVC and with empty input lines
+
+ * syserror.cpp: fixed reporting for fatal errors
+
+ * projections.cpp: fixed MSVC failure with std:: namespace
+
+3.0.0alpha4 - Released 1/09/01
* ctsim: Added reset to full-intensity scale menu item
dnl CDPATH=
AC_INIT(src/ctsim.cpp)
-AM_INIT_AUTOMAKE(ctsim,3.0.0alpha4)
+AM_INIT_AUTOMAKE(ctsim,3.0.0alpha5)
AM_CONFIG_HEADER(config.h)
dnl Checks for programs.
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: projections.cpp,v 1.41 2001/01/07 23:18:13 kevin Exp $
+** $Id: projections.cpp,v 1.42 2001/01/10 21:21:53 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
bool
Projections::copyViewData (const char* const filename, std::ostream& os, int startView, int endView)
{
- frnetorderstream is (filename, ios::in | ios::binary);
+ frnetorderstream is (filename, std::ios::in | std::ios::binary);
kuint16 sizeHeader, signature;
kuint32 _nView, _nDet;
+ is.seekg (0);
+ if (is.fail()) {
+ sys_error (ERR_SEVERE, "Unable to read projection file %s", filename);
+ return false;
+ }
+
is.readInt16 (sizeHeader);
is.readInt16 (signature);
is.readInt32 (_nView);
int nDet = _nDet;
if (signature != m_signature) {
- sys_error (ERR_FATAL, "Illegal signature in projection file %s", filename);
+ sys_error (ERR_SEVERE, "Illegal signature in projection file %s", filename);
return false;
}
delete pViewData;
if (is.fail())
- sys_error (ERR_FATAL, "Error reading projection file");
+ sys_error (ERR_SEVERE, "Error reading projection file");
if (os.fail())
- sys_error (ERR_FATAL, "Error writing projection file");
+ sys_error (ERR_SEVERE, "Error writing projection file");
return (! (is.fail() | os.fail()));
}
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: syserror.cpp,v 1.12 2001/01/02 16:02:13 kevin Exp $
+** $Id: syserror.cpp,v 1.13 2001/01/10 21:21:53 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
os << errStr << "\n";
strOutput = os.str();
- if (severity == ERR_FATAL)
- throw std::runtime_error (errStr);
+ if (severity == ERR_FATAL) {
+ std::cerr << strOutput;
+ throw std::runtime_error (strOutput);
+ }
#if INTERACTIVE_ERROR_DISPLAY
std::cout << "A - Abort C - Continue W - Turn off warnings? ";
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ctsimtext.cpp,v 1.7 2001/01/10 21:02:41 kevin Exp $
+** $Id: ctsimtext.cpp,v 1.8 2001/01/10 21:21:53 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
// If linked to ctsimtext, but executed as another name, eg pjrec, then program will use that
// linked name as name of function.
-static const char* const g_szIdStr = "$Id: ctsimtext.cpp,v 1.7 2001/01/10 21:02:41 kevin Exp $";
+static const char* const g_szIdStr = "$Id: ctsimtext.cpp,v 1.8 2001/01/10 21:21:53 kevin Exp $";
static const char* const s_szProgramName = "ctsimtext";
extern int if1_main (int argc, char* const argv[]);
static bool s_bInteractive = false;
-
-#define DEBUG 1
-
int
ctsimtext_main (int argc, char * argv[])
{
- int iReturn = 0;
-
+ int iReturn = 0;
if (argc > 1 && strcmp(argv[0], fileBasename (s_szProgramName)) == 0) {
argv = &argv[1];
char* pszInputLine = new char [s_MaxLineLength+1];
std::cout << szPrompt;
std::cin.getline (pszInputLine, s_MaxLineLength);
-
+
#ifdef DEBUG
std::cout << "#" << pszInputLine << "#\n";
#endif
}
*piArgc = nTokens;
- *pppArgv = new char* [nTokens];
- for (unsigned int iToken = 0; iToken < vecpszToken.size(); iToken++)
- (*pppArgv)[iToken] = vecpszToken[iToken];
+ if (nTokens > 0) {
+ *pppArgv = new char* [nTokens];
+ for (unsigned int iToken = 0; iToken < vecpszToken.size(); iToken++)
+ (*pppArgv)[iToken] = vecpszToken[iToken];
+ } else
+ *pppArgv = NULL;
}
static int
processCommand (int argc, char* const argv[])
{
+ if (argc < 1)
+ return 1;
+
const char* const pszFunction = fileBasename (argv[0]);
if (strcasecmp (pszFunction, "if1") == 0)
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: pjinfo.cpp,v 1.4 2000/12/17 22:30:34 kevin Exp $
+** $Id: pjinfo.cpp,v 1.5 2001/01/10 21:21:53 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
******************************************************************************/
/* FILE
- * pjinfo.c Convert Raysum to image
- *
- * DATE
- * August 2000
- */
+* pjinfo.c Convert Raysum to image
+*
+* DATE
+* August 2000
+*/
#include "ct.h"
#include "timer.h"
{0, 0, 0, 0}
};
-static const char* g_szIdStr = "$Id: pjinfo.cpp,v 1.4 2000/12/17 22:30:34 kevin Exp $";
+static const char* g_szIdStr = "$Id: pjinfo.cpp,v 1.5 2001/01/10 21:21:53 kevin Exp $";
void
pjinfo_usage (const char *program)
std::cout << " --help Print this help message\n";
}
-
+
int
pjinfo_main (const int argc, char *const argv[])
int optStartView = 0;
int optEndView = -1; // tells copyViewData to use default last view
extern int optind;
-
+
while (1)
+ {
+ char *endptr, *endstr;
+ int c = getopt_long (argc, argv, "", my_options, NULL);
+ if (c == -1)
+ break;
+
+ switch (c)
{
- char *endptr, *endstr;
- int c = getopt_long (argc, argv, "", my_options, NULL);
- if (c == -1)
- break;
-
- switch (c)
- {
- case O_DUMP:
- optDump = true;
- break;
- case O_BINARYHEADER:
- optBinaryHeader = true;
- break;
- case O_BINARYVIEWS:
- optBinaryViews = true;
- break;
- case O_STARTVIEW:
- optStartView = strtol(optarg, &endptr, 10);
- endstr = optarg + strlen(optarg);
- if (endptr != endstr) {
- std::cerr << "Error setting --startview to %s" << optarg << std::endl;
- pjinfo_usage(argv[0]);
- return (1);
- }
- break;
- case O_ENDVIEW:
- optEndView = strtol(optarg, &endptr, 10);
- endstr = optarg + strlen(optarg);
- if (endptr != endstr) {
- std::cerr << "Error setting --endview to %s" << optarg << std::endl;
- pjinfo_usage(argv[0]);
- return (1);
- }
- break;
- case O_VERSION:
+ case O_DUMP:
+ optDump = true;
+ break;
+ case O_BINARYHEADER:
+ optBinaryHeader = true;
+ break;
+ case O_BINARYVIEWS:
+ optBinaryViews = true;
+ break;
+ case O_STARTVIEW:
+ optStartView = strtol(optarg, &endptr, 10);
+ endstr = optarg + strlen(optarg);
+ if (endptr != endstr) {
+ std::cerr << "Error setting --startview to %s" << optarg << std::endl;
+ pjinfo_usage(argv[0]);
+ return (1);
+ }
+ break;
+ case O_ENDVIEW:
+ optEndView = strtol(optarg, &endptr, 10);
+ endstr = optarg + strlen(optarg);
+ if (endptr != endstr) {
+ std::cerr << "Error setting --endview to %s" << optarg << std::endl;
+ pjinfo_usage(argv[0]);
+ return (1);
+ }
+ break;
+ case O_VERSION:
#ifdef VERSION
- std::cout << "Version " << VERSION << std::endl << g_szIdStr << std::endl;
+ std::cout << "Version " << VERSION << std::endl << g_szIdStr << std::endl;
#else
- std::cout << "Unknown version number\n";
+ std::cout << "Unknown version number\n";
#endif
- return (0);
- case O_HELP:
- case '?':
- pjinfo_usage(argv[0]);
- return (0);
- default:
- pjinfo_usage(argv[0]);
- return (1);
- }
+ return (0);
+ case O_HELP:
+ case '?':
+ pjinfo_usage(argv[0]);
+ return (0);
+ default:
+ pjinfo_usage(argv[0]);
+ return (1);
}
+ }
if (argc - optind != 1) {
pjinfo_usage(argv[0]);
return (1);
}
-
+
pj_name = argv[optind];
-
+
if (optBinaryHeader)
Projections::copyHeader (pj_name, std::cout);
else if (optBinaryViews)
sys_error (ERR_SEVERE, "Can not open projection file %s", pj_name.c_str());
return (1);
}
-
+
if (optDump) {
pj.printProjectionData (optStartView, optEndView);
} else {
main (const int argc, char *const argv[])
{
int retval = 1;
-
+
try {
retval = pjinfo_main(argc, argv);
} catch (exception e) {
- std::cerr << "Exception: " << e.what() << std::endl;
+ std::cerr << "Exception: " << e.what() << std::endl;
} catch (...) {
- std::cerr << "Unknown exception\n";
+ std::cerr << "Unknown exception\n";
}
-
+
return (retval);
}
#endif