X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tools%2Fif1.cpp;fp=tools%2Fif1.cpp;h=dcd1dc1a3ac25eb0144d11a7ac7041610477aa86;hb=2a3686d3bd1f690d318b81766c261da785cf9b57;hp=b961c0e92473fea4b7b135d087b2dfbdd2d98d6b;hpb=c551b53b39a7571cf52831f5e117be1cca95c420;p=ctsim.git diff --git a/tools/if1.cpp b/tools/if1.cpp index b961c0e..dcd1dc1 100644 --- a/tools/if1.cpp +++ b/tools/if1.cpp @@ -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++) + if (vIn[ix][iy] < 0) + vOut[ix][iy] = 0; + else + 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++) + if (vIn[ix][iy] < 0) + vOut[ix][iy] = sqrt (-vIn[ix][iy]); + else + vOut[ix][iy] = sqrt (vIn[ix][iy]); + histString = "Square root transformation"; } im_out->labelsCopy (*im_in);