r262: Make std:: namespace explicit
[ctsim.git] / tools / if2img.cpp
index d17409e29f75e6dcb95d26437f0b9be95fc264f3..61937040847ed6bb9eec94a343f1d7fbd216f1d6 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: if2img.cpp,v 1.6 2000/08/25 15:59:13 kevin Exp $
+**  $Id: if2img.cpp,v 1.7 2000/12/16 07:28:25 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
@@ -48,7 +48,7 @@ static struct option my_options[] =
   {0, 0, 0, 0}
 };
 
-static const char* g_szIdStr = "$Id: if2img.cpp,v 1.6 2000/08/25 15:59:13 kevin Exp $";
+static const char* g_szIdStr = "$Id: if2img.cpp,v 1.7 2000/12/16 07:28:25 kevin Exp $";
 
 enum { O_AUTO_FULL, O_AUTO_STD0_1, O_AUTO_STD0_5, O_AUTO_STD1, O_AUTO_STD2, O_AUTO_STD3 };
 static const char O_AUTO_FULL_STR[]="full";
@@ -74,42 +74,42 @@ static const char O_FORMAT_DISP_STR[]="disp";
 void 
 if2img_usage (const char *program)
 {
-  cout << "usage: " << fileBasename(program) << " ifname outfile [OPTIONS]" << endl;
-  cout << "Convert IF file to an image file" << endl;
-  cout << endl;
-  cout << "     ifname     Name of input file" << endl;
-  cout << "     outfile    Name of output file" << endl;
-  cout << "     --format   Output format" << endl;
-  cout << "         pgm    PGM (portable graymap) format (default)" << endl;
-  cout << "         pgmasc PGM (portable graymap) ASCII format" << endl;
+  std::cout << "usage: " << fileBasename(program) << " ifname outfile [OPTIONS]\n";
+  std::cout << "Convert IF file to an image file\n";
+  std::cout << std::endl;
+  std::cout << "     ifname     Name of input file\n";
+  std::cout << "     outfile    Name of output file\n";
+  std::cout << "     --format   Output format\n";
+  std::cout << "         pgm    PGM (portable graymap) format (default)\n";
+  std::cout << "         pgmasc PGM (portable graymap) ASCII format\n";
 #ifdef HAVE_PNG
-  cout << "         png    PNG (8-bit) format" << endl;
-  cout << "         png16  PNG (16-bit) format" << endl;
+  std::cout << "         png    PNG (8-bit) format\n";
+  std::cout << "         png16  PNG (16-bit) format\n";
 #endif
 #if HAVE_G2
-  cout << "         gif    GIF format" << endl;
+  std::cout << "         gif    GIF format\n";
 #endif
-  cout << "         disp   Display on screen" << endl;
-  cout << "     --center   Center of window" << endl;
-  cout << "         median Median is center of window (default)" << endl;
-  cout << "         mode   Mode is center of window" << endl;
-  cout << "         mean   Mean is center of window" << endl;
-  cout << "     --auto     Set auto window" << endl;
-  cout << "         full   Use full window (default)" << endl;
-  cout << "         std0.1 Use 0.1 standard deviation about center" << endl;
-  cout << "         std0.5 Use 0.5 standard deviation about center" << endl;
-  cout << "         std1   Use one standard deviation about center" << endl;
-  cout << "         std2   Use two standard deviations about center" << endl;
-  cout << "         std3   Use three standard deviations about center" << endl;
-  cout << "     --scale    Scaling factor for output size" << endl;
-  cout << "     --min      Set minimum intensity" << endl;
-  cout << "     --max      Set maximum intensity" << endl;
-  cout << "     --stats    Print image statistics" << endl;
-  cout << "     --labels   Print image labels" << endl;
-  cout << "     --debug    Set debug mode" << endl;
-  cout << "     --verbose  Set verbose mode" << endl;
-  cout << "     --version  Print version" << endl;
-  cout << "     --help     Print this help message" << endl;
+  std::cout << "         disp   Display on screen\n";
+  std::cout << "     --center   Center of window\n";
+  std::cout << "         median Median is center of window (default)\n";
+  std::cout << "         mode   Mode is center of window\n";
+  std::cout << "         mean   Mean is center of window\n";
+  std::cout << "     --auto     Set auto window\n";
+  std::cout << "         full   Use full window (default)\n";
+  std::cout << "         std0.1 Use 0.1 standard deviation about center\n";
+  std::cout << "         std0.5 Use 0.5 standard deviation about center\n";
+  std::cout << "         std1   Use one standard deviation about center\n";
+  std::cout << "         std2   Use two standard deviations about center\n";
+  std::cout << "         std3   Use three standard deviations about center\n";
+  std::cout << "     --scale    Scaling factor for output size\n";
+  std::cout << "     --min      Set minimum intensity\n";
+  std::cout << "     --max      Set maximum intensity\n";
+  std::cout << "     --stats    Print image statistics\n";
+  std::cout << "     --labels   Print image labels\n";
+  std::cout << "     --debug    Set debug mode\n";
+  std::cout << "     --verbose  Set verbose mode\n";
+  std::cout << "     --version  Print version\n";
+  std::cout << "     --help     Print this help message\n";
 }
 
 
@@ -244,9 +244,9 @@ if2img_main (int argc, char *const argv[])
          break;
         case O_VERSION:
 #ifdef VERSION
-         cout << "Version " << VERSION << endl << g_szIdStr << endl;
+         std::cout << "Version " << VERSION << std::endl << g_szIdStr << std::endl;
 #else
-          cout << "Unknown version number" << endl;
+          std::cout << "Unknown version number\n";
 #endif
          return (0);
        case O_HELP:
@@ -284,7 +284,7 @@ if2img_main (int argc, char *const argv[])
   }
 
   if (opt_labels)
-    im.printLabels(cout);
+    im.printLabels(std::cout);
 
   if (opt_stats || (! (opt_set_max && opt_set_min))) {
       double min, max, mean, mode, median, stddev;
@@ -317,13 +317,13 @@ if2img_main (int argc, char *const argv[])
          }
       }
       if (opt_stats) {
-         cout <<"nx: " << im.nx() << endl;
-         cout <<"ny: " << im.ny() << endl;
-         cout <<"min: " << min << endl;
-         cout <<"max: " << max << endl;
-         cout <<"mean: " << mean << endl;
-         cout <<"mode: " << mode << endl;
-         cout <<"stddev: " << stddev << endl;
+         std::cout <<"nx: " << im.nx() << std::endl;
+         std::cout <<"ny: " << im.ny() << std::endl;
+         std::cout <<"min: " << min << std::endl;
+         std::cout <<"max: " << max << std::endl;
+         std::cout <<"mean: " << mean << std::endl;
+         std::cout <<"mode: " << mode << std::endl;
+         std::cout <<"stddev: " << stddev << std::endl;
       }
       if (opt_auto != O_AUTO_FULL) {
          double center;
@@ -346,8 +346,8 @@ if2img_main (int argc, char *const argv[])
   }
   
   if (opt_stats) {
-    cout << "min display: " << densmin << endl;
-    cout << "max display: " << densmax << endl;
+    std::cout << "min display: " << densmin << std::endl;
+    std::cout << "max display: " << densmax << std::endl;
   }
   
   if (opt_format == O_FORMAT_PGM)
@@ -367,7 +367,7 @@ if2img_main (int argc, char *const argv[])
   else if (opt_format == O_FORMAT_DISP) {
 #if HAVE_SGP
     im.displayScaling (opt_scale, densmin, densmax);
-    cout << "Press enter to continue\n";
+    std::cout << "Press enter to continue\n";
     cio_kb_getc();
 #endif
   }
@@ -389,9 +389,9 @@ main (int argc, char *const argv[])
   try {
     retval = if2img_main(argc, argv);
   } catch (exception e) {
-    cerr << "Exception: " << e.what() << endl;
+    cerr << "Exception: " << e.what() << std::endl;
   } catch (...) {
-    cerr << "Unknown exception" << endl;
+    cerr << "Unknown exception\n";
   }
 
   return (retval);