r7061: initial property settings
[ctsim.git] / tools / if2.cpp
index 2b69d27f12fb1e05ad4cd5b9b1df8d47d390af5a..b2105e28dc26fe6a0af5bb348bfa84f177f32192 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: if2.cpp,v 1.7 2001/01/09 22:31:47 kevin Exp $
+**  $Id$
 **
 **  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
@@ -36,7 +36,7 @@ static struct option my_options[] =
   {"add", 0, 0, O_ADD},
   {"sub", 0, 0, O_SUB},
   {"multiply", 0, 0, O_MUL},
-  {"divide", 0, 0, O_DIVIDE},\r
+  {"divide", 0, 0, O_DIVIDE},
   {"comp", 0, 0, O_COMP},
   {"column-plot", 1, 0, O_COLUMN_PLOT},
   {"row-plot", 1, 0, O_ROW_PLOT},
@@ -46,7 +46,7 @@ static struct option my_options[] =
   {0, 0, 0, 0}
 };
 
-static const char* g_szIdStr = "$Id: if2.cpp,v 1.7 2001/01/09 22:31:47 kevin Exp $";
+static const char* g_szIdStr = "$Id$";
 
 void 
 if2_usage (const char *program)
@@ -80,7 +80,7 @@ if2_main (int argc, char *const argv[])
   int opt_verbose = 0;
   int opt_add = 0;
   int opt_sub = 0;
-  int opt_mul = 0;\r
+  int opt_mul = 0;
   bool opt_divide = false;
   int opt_comp = 0;
   bool opt_bImageOutputFile = false;
@@ -105,14 +105,14 @@ if2_main (int argc, char *const argv[])
       opt_sub = 1;
       opt_bImageOutputFile = true;
       break;
-    case O_MUL:\r
-      opt_mul = 1;\r
-      opt_bImageOutputFile = true;\r
-      break;\r
-    case O_DIVIDE:\r
-      opt_divide = true;\r
-      opt_bImageOutputFile = true;\r
-      break;\r
+    case O_MUL:
+      opt_mul = 1;
+      opt_bImageOutputFile = true;
+      break;
+    case O_DIVIDE:
+      opt_divide = true;
+      opt_bImageOutputFile = true;
+      break;
     case O_ROW_PLOT:
       opt_rowPlot = strtol(optarg, &endptr, 10);
       if (endptr != optarg + strlen(optarg)) {
@@ -205,23 +205,23 @@ if2_main (int argc, char *const argv[])
   
   if (opt_add) {
     strOperation = "Add Images";
-    im_in1.addImages (im_in2, *pim_out);\r
+    im_in1.addImages (im_in2, *pim_out);
   } else if (opt_sub) {
-    strOperation = "Subtract Images";\r
-    im_in1.subtractImages (im_in2, *pim_out);\r
-  } else if (opt_mul) {\r
-    strOperation = "Multiply Images";\r
-    im_in1.multiplyImages (im_in2, *pim_out);\r
-  } else if (opt_divide) {\r
-    strOperation = "Divide Images";\r
-    im_in1.divideImages (im_in2, *pim_out);\r
-  }\r
+    strOperation = "Subtract Images";
+    im_in1.subtractImages (im_in2, *pim_out);
+  } else if (opt_mul) {
+    strOperation = "Multiply Images";
+    im_in1.multiplyImages (im_in2, *pim_out);
+  } else if (opt_divide) {
+    strOperation = "Divide Images";
+    im_in1.divideImages (im_in2, *pim_out);
+  }
   if (opt_comp) {
     double d, r, e;
     im_in1.comparativeStatistics (im_in2, d, r, e);
     std::cout << "d=" << d << ", r=" << r << ", e=" << e << std::endl;
   }
-  \r
+  
   int i;
   if (opt_columnPlot > 0) {
     if (opt_columnPlot >= nx || opt_columnPlot >= nx2) {
@@ -231,26 +231,26 @@ if2_main (int argc, char *const argv[])
     double* plot_xaxis = new double [nx];
     for (i = 0; i < nx; i++)
       plot_xaxis[i] = i;
-    \r
-    PlotFile plotFile (3, nx);\r
-    \r
-    plotFile.addColumn (0, plot_xaxis);\r
-    plotFile.addColumn (1, v1[opt_columnPlot]);\r
-    plotFile.addColumn (2, v2[opt_columnPlot]);\r
-    std::ostringstream os;\r
-    os << "Column " << opt_columnPlot << " Comparison";\r
-    plotFile.addDescription (os.str().c_str());\r
-    std::string title("title ");\r
-    title += os.str();\r
-    plotFile.addEzsetCommand (title.c_str());\r
-    plotFile.addEzsetCommand ("xlabel Column");\r
-    plotFile.addEzsetCommand ("ylabel Pixel Value");\r
-    plotFile.addEzsetCommand ("box");\r
-    plotFile.addEzsetCommand ("grid");\r
-    plotFile.addEzsetCommand ("xticks major 5");\r
-\r
-    plotFile.fileWrite (strOutFile.c_str());\r
-    \r
+    
+    PlotFile plotFile (3, nx);
+    
+    plotFile.addColumn (0, plot_xaxis);
+    plotFile.addColumn (1, v1[opt_columnPlot]);
+    plotFile.addColumn (2, v2[opt_columnPlot]);
+    std::ostringstream os;
+    os << "Column " << opt_columnPlot << " Comparison";
+    plotFile.addDescription (os.str().c_str());
+    std::string title("title ");
+    title += os.str();
+    plotFile.addEzsetCommand (title.c_str());
+    plotFile.addEzsetCommand ("xlabel Column");
+    plotFile.addEzsetCommand ("ylabel Pixel Value");
+    plotFile.addEzsetCommand ("box");
+    plotFile.addEzsetCommand ("grid");
+    plotFile.addEzsetCommand ("xticks major 5");
+
+    plotFile.fileWrite (strOutFile.c_str());
+    
     delete plot_xaxis;
   }
   
@@ -260,7 +260,7 @@ if2_main (int argc, char *const argv[])
       return (1);
     }
     double* plot_xaxis = new double [ny];
-    double* v1Row = new double [ny];\r
+    double* v1Row = new double [ny];
     double* v2Row = new double [ny2];
     
     for (i = 0; i < ny; i++)
@@ -275,23 +275,23 @@ if2_main (int argc, char *const argv[])
     plotFile.addColumn (0, plot_xaxis);
     plotFile.addColumn (1, v1Row);
     plotFile.addColumn (2, v2Row);
-    std::ostringstream os;\r
-    os << "Row " << opt_rowPlot << " Comparison";\r
-    plotFile.addDescription (os.str().c_str());\r
-    std::string title("title ");\r
-    title += os.str();\r
-    plotFile.addEzsetCommand (title.c_str());\r
-    plotFile.addEzsetCommand ("xlabel Row");\r
-    plotFile.addEzsetCommand ("ylabel Pixel Value");\r
-    plotFile.addEzsetCommand ("box");\r
-    plotFile.addEzsetCommand ("grid");\r
-    plotFile.addEzsetCommand ("xticks major 5");\r
+    std::ostringstream os;
+    os << "Row " << opt_rowPlot << " Comparison";
+    plotFile.addDescription (os.str().c_str());
+    std::string title("title ");
+    title += os.str();
+    plotFile.addEzsetCommand (title.c_str());
+    plotFile.addEzsetCommand ("xlabel Row");
+    plotFile.addEzsetCommand ("ylabel Pixel Value");
+    plotFile.addEzsetCommand ("box");
+    plotFile.addEzsetCommand ("grid");
+    plotFile.addEzsetCommand ("xticks major 5");
     
     plotFile.fileWrite (strOutFile.c_str());
     
-    delete plot_xaxis;\r
-    delete v1Row;\r
-    delete v2Row;\r
+    delete plot_xaxis;
+    delete v1Row;
+    delete v2Row;
   }
   
   if (opt_bImageOutputFile) {
@@ -300,7 +300,7 @@ if2_main (int argc, char *const argv[])
     pim_out->labelAdd (Array2dFileLabel::L_HISTORY, strOperation.c_str(), timerProgram.timerEnd());
     pim_out->fileWrite (strOutFile);
   }
-  \r
+  
   return (0);
 }