r312: *** empty log message ***
[ctsim.git] / tools / if1.cpp
index b961c0e92473fea4b7b135d087b2dfbdd2d98d6b..dcd1dc1a3ac25eb0144d11a7ac7041610477aa86 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: if1.cpp,v 1.1 2000/12/18 00:24:28 kevin Exp $
+**  $Id: if1.cpp,v 1.2 2000/12/23 18:12:35 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
@@ -46,7 +46,7 @@ static struct option my_options[] =
   {0, 0, 0, 0}
 };
 
-static const char* g_szIdStr = "$Id: if1.cpp,v 1.1 2000/12/18 00:24:28 kevin Exp $";
+static const char* g_szIdStr = "$Id: if1.cpp,v 1.2 2000/12/23 18:12:35 kevin Exp $";
 
 void 
 if1_usage (const char *program)
@@ -154,27 +154,33 @@ if1_main (int argc, char *const argv[])
     }
     if (opt_log) {
       for (ix = 0; ix < nx; ix++)
-        for (iy = 0; iy < ny; iy++)
-          vOut[ix][iy] = log (vIn[ix][iy]);
-      histString = "Log transformation";
+        for (iy = 0; iy < ny; iy++)\r
+          if (vIn[ix][iy] < 0)\r
+            vOut[ix][iy] = 0;
+          else\r
+            vOut[ix][iy] = log (vIn[ix][iy]);
+      histString = "Logrithmic transformation";
     }
     if (opt_exp) {
       for (ix = 0; ix < nx; ix++)
         for (iy = 0; iy < ny; iy++)
           vOut[ix][iy] = exp (vIn[ix][iy]);
-      histString = "Exp transformation";
+      histString = "Exponential transformation";
     }
     if (opt_sqr) {
       for (ix = 0; ix < nx; ix++)
         for (iy = 0; iy < ny; iy++)
           vOut[ix][iy] = vIn[ix][iy] * vIn[ix][iy];
-      histString = "Sqr transformation";
+      histString = "Square transformation";
     }
     if (opt_sqrt) {
       for (ix = 0; ix < nx; ix++)
-        for (iy = 0; iy < ny; iy++)
-          vOut[ix][iy] = sqrt (vIn[ix][iy]);
-      histString = "Sqrt transformation";
+        for (iy = 0; iy < ny; iy++)\r
+          if (vIn[ix][iy] < 0)
+              vOut[ix][iy] = sqrt (-vIn[ix][iy]);\r
+          else\r
+              vOut[ix][iy] = sqrt (vIn[ix][iy]);\r
+      histString = "Square root transformation";
     }
 
     im_out->labelsCopy (*im_in);