projects
/
ctsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Version 6.0.2 - new release
[ctsim.git]
/
tools
/
ifinfo.cpp
diff --git
a/tools/ifinfo.cpp
b/tools/ifinfo.cpp
index 1e0aa38569e2371232788e0e89edabf461303f4a..e2e522e79972a45268f3d2621e8b9671fd1d0d57 100644
(file)
--- a/
tools/ifinfo.cpp
+++ b/
tools/ifinfo.cpp
@@
-7,9
+7,7
@@
** Date Started: April 2000
**
** This is part of the CTSim program
** Date Started: April 2000
**
** This is part of the CTSim program
-** Copyright (C) 1983-2000 Kevin Rosenberg
-**
-** $Id: ifinfo.cpp,v 1.4 2000/12/16 07:28:25 kevin Exp $
+** Copyright (C) 1983-2009 Kevin Rosenberg
**
** 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
**
** 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
@@
-46,10
+44,10
@@
static struct option my_options[] =
{0, 0, 0, 0}
};
{0, 0, 0, 0}
};
-static const char* g_szIdStr = "$Id
: ifinfo.cpp,v 1.4 2000/12/16 07:28:25 kevin Exp
$";
+static const char* g_szIdStr = "$Id$";
-void
+void
ifinfo_usage (const char *program)
{
std::cout << "usage: " << fileBasename(program) << " image-filename [OPTIONS]\n";
ifinfo_usage (const char *program)
{
std::cout << "usage: " << fileBasename(program) << " image-filename [OPTIONS]\n";
@@
-67,7
+65,7
@@
ifinfo_usage (const char *program)
std::cout << " --help Print this help message\n";
}
std::cout << " --help Print this help message\n";
}
-int
+int
ifinfo_main (int argc, char *const argv[])
{
ImageFile *im = NULL;
ifinfo_main (int argc, char *const argv[])
{
ImageFile *im = NULL;
@@
-76,56
+74,58
@@
ifinfo_main (int argc, char *const argv[])
int opt_stats = 1;
int opt_labels = 1;
int opt_debug = 0;
int opt_stats = 1;
int opt_labels = 1;
int opt_debug = 0;
-
+ UNUSED(opt_verbose);
+ UNUSED(opt_debug);
+
while (1)
{
int c = getopt_long (argc, argv, "", my_options, NULL);
while (1)
{
int c = getopt_long (argc, argv, "", my_options, NULL);
-
+
if (c == -1)
if (c == -1)
- break;
-
+
break;
+
switch (c)
switch (c)
- {
- case O_LABELS:
- opt_labels = 1;
- break;
- case O_STATS:
- opt_stats = 1;
- break;
- case O_NO_LABELS:
- opt_labels = 0;
- break;
- case O_NO_STATS:
- opt_stats = 0;
- break;
- case O_VERBOSE:
- opt_verbose = 1;
- break;
- case O_DEBUG:
- opt_debug = 0;
- break;
+
{
+
case O_LABELS:
+
opt_labels = 1;
+
break;
+
case O_STATS:
+
opt_stats = 1;
+
break;
+
case O_NO_LABELS:
+
opt_labels = 0;
+
break;
+
case O_NO_STATS:
+
opt_stats = 0;
+
break;
+
case O_VERBOSE:
+
opt_verbose = 1;
+
break;
+
case O_DEBUG:
+
opt_debug = 0;
+
break;
case O_VERSION:
#ifdef VERSION
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";
#endif
#else
std::cout << "Unknown version number\n";
#endif
- return (0);
- case O_HELP:
- case '?':
- ifinfo_usage(argv[0]);
- return (0);
- default:
- ifinfo_usage(argv[0]);
- return (1);
- }
+
return (0);
+
case O_HELP:
+
case '?':
+
ifinfo_usage(argv[0]);
+
return (0);
+
default:
+
ifinfo_usage(argv[0]);
+
return (1);
+
}
}
if (optind + 1 != argc) {
ifinfo_usage (argv[0]);
return (1);
}
}
if (optind + 1 != argc) {
ifinfo_usage (argv[0]);
return (1);
}
-
+
in_file = argv[optind];
im = new ImageFile ();
in_file = argv[optind];
im = new ImageFile ();
@@
-134,11
+134,17
@@
ifinfo_main (int argc, char *const argv[])
return (1);
}
return (1);
}
- if (opt_labels)
+ if (opt_labels)
im->printLabels (std::cout);
if (opt_stats) {
std::cout << "Size: (" << im->nx() << "," << im->ny() << ")\n";
im->printLabels (std::cout);
if (opt_stats) {
std::cout << "Size: (" << im->nx() << "," << im->ny() << ")\n";
+ std::cout << "Data type: ";
+ if (im->dataType() == Array2dFile::DATA_TYPE_COMPLEX)
+ std::cout << "Complex\n";
+ else
+ std::cout << "Real\n";
+
im->printStatistics (std::cout);
}
im->printStatistics (std::cout);
}
@@
-146,7
+152,7
@@
ifinfo_main (int argc, char *const argv[])
}
#ifndef NO_MAIN
}
#ifndef NO_MAIN
-int
+int
main (int argc, char *const argv[])
{
int retval = 1;
main (int argc, char *const argv[])
{
int retval = 1;
@@
-154,9
+160,9
@@
main (int argc, char *const argv[])
try {
retval = ifinfo_main(argc, argv);
} catch (exception e) {
try {
retval = ifinfo_main(argc, argv);
} catch (exception e) {
- cerr << "Exception: " << e.what() << std::endl;
+
std::
cerr << "Exception: " << e.what() << std::endl;
} catch (...) {
} catch (...) {
- cerr << "Unknown exception\n";
+
std::
cerr << "Unknown exception\n";
}
return (retval);
}
return (retval);