r318: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 29 Dec 2000 15:45:06 +0000 (15:45 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 29 Dec 2000 15:45:06 +0000 (15:45 +0000)
22 files changed:
ChangeLog
TODO
include/ctsupport.h
include/ezplot.h
include/imagefile.h
include/pol.h
include/procsignal.h
libctgraphics/ezplot.cpp
libctgraphics/ezset.cpp
libctgraphics/pol.cpp
libctsim/imagefile.cpp
libctsim/procsignal.cpp
libctsim/reconstruct.cpp
libctsupport/syserror.cpp
msvc/ctsim/ctsim.plg
src/ctsim.h
src/dlgprojections.cpp
src/docs.cpp
src/views.cpp
src/views.h
tools/if1.cpp
tools/if2.cpp

index 894573e2ec55892cce0d498458d6326d231f82ff..91c26bc6a0f406557ff52fd68fb1cfb579ebde47 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,13 +1,6 @@
 TODO
        Read PlotFile's.
 
-       Add help button onto dialog's for reconstruction & projections.
-       Consider use of wxWindows help file classes.
-
-       Consider changing POL to to read tag tokens.
-
-       Consider being able to write Phantom files as text and view as
-       text in ctsim.
        
 3.0alpha1 - Released 12/30/00
 
@@ -21,6 +14,9 @@ TODO
        * ctsim: Added row and column plot comparisons between two image
        files.
 
+       * ctsim: Added "Process" menu to image file display with math
+       functions. Added 2-dimensional inverse Fourier to math functions.
+
        * mathfuncs.cpp: Reworked statistics algorithm to share between
        imagefile and plotfile classes.
 
@@ -29,7 +25,7 @@ TODO
        if1.cpp and if2.cpp to imagefile.cpp
 
        * if1: Updated to handle error conditions, such as sqrt of a
-       negative number.
+       negative number. Converted to use new ImageFile math functions.
        
        * if2: Updated to output plot files and use new ImageFile class
        math functions
@@ -40,7 +36,8 @@ TODO
        individual curves. Improved display of labels and ticks. Updated
        to use POL class member variable. Updated to more C++ conventions.
 
-       * pol: converted to C++ class
+       * pol: converted to C++ class. Extracted HashTable to separate
+       class.
        
        * sgp: Added linestyle settings
        
diff --git a/TODO b/TODO
index ad5017045ce898f50706ea4fa91e738c0ad3ef56..69aa21773e87a5bc5b0ddcef17c4c46987e0862f 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,10 @@
-Convert pol to C++ object.
+Add help button onto dialog's for reconstruction & projections.
+Consider use of wxWindows help file classes.
+
+Consider changing POL to to read tag tokens.
+
+Consider being able to write Phantom files as text and view as
+text in ctsim.
 
 FFT filtering requires FFTW library. Add a basic FFT routine.
 
index 55c25d50c53f71be0616109e4f572d9db25083cd..9a9ca835303e465999a1d1f3534f141c18cdb1e6 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsupport.h,v 1.17 2000/12/27 20:09:19 kevin Exp $
+**  $Id: ctsupport.h,v 1.18 2000/12/29 15:45:06 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
@@ -148,7 +148,7 @@ char *str_upper(char *str);
 
 /* syserror.cpp */
 void sys_error(int severity, const char *msg, ...);
-void sys_verror(int severity, const char *msg, va_list arg);
+void sys_verror (std::string& strOutput, int severity, const char *msg, va_list arg);
 void sys_error_level(int severity);
 
 // Math Section
index b2512aab987e21ec0aa43b3c1408b65651bf7ae7..f6dbf77af635c943fa2f2fd18aa5110fb6fe7393 100644 (file)
@@ -7,7 +7,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ezplot.h,v 1.22 2000/12/27 03:16:02 kevin Exp $
+**  $Id: ezplot.h,v 1.23 2000/12/29 15:45:06 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
@@ -319,7 +319,7 @@ private:
   void make_numfmt(char *fmtstr, int *fldwid, int *nfrac, double min, double max, int nint);
   int axis_scale (double min, double max, int nint, double *minp, double *maxp, int *nintp);
   
-  SGP& rSGP;
+  SGP* m_pSGP;
   POL m_pol;\r
   
   void clearCurves ();
@@ -338,7 +338,7 @@ private:
   { return ygn_min + (y - ygw_min) * m_yWorldScale; }
   
  public:
-   EZPlot (SGP& sgp);
+   EZPlot ();
    ~EZPlot ();
    
    bool ezset (const std::string& command);\r
@@ -350,7 +350,7 @@ private:
    void addCurve (const double* y, int n);
    void addCurve (const float* y, int n);
    
-   void plot ();
+   void plot (SGP* pSGP);
 };     
 
 #endif
index a7e69d75f54dba97efacc239d0de3ec7b57cfbb7..7c7daba56eae43d69172b47763cbb2dd69fa7a28 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: imagefile.h,v 1.23 2000/12/22 04:18:00 kevin Exp $
+**  $Id: imagefile.h,v 1.24 2000/12/29 15:45:06 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
@@ -120,25 +120,25 @@ class ImageFile : public ImageFileBase
   void filterResponse (const char* const domainName, double bw, const char* const filterName, double filt_param);
 
   void statistics (double& min, double& max, double& mean, double& mode, double& median, double& stddev) const;
-
   void getMinMax (double& min, double& max) const;
-
   void printStatistics (std::ostream& os) const;
-
   bool comparativeStatistics (const ImageFile& imComp, double& d, double& r, double& e) const;
-
   bool printComparativeStatistics (const ImageFile& imComp, std::ostream& os) const;
 \r
-  bool subtractImages (const ImageFile& rRHS, ImageFile& result) const;\r
-
+  bool subtractImages (const ImageFile& rRHS, ImageFile& result) const;
   bool addImages (const ImageFile& rRHS, ImageFile& result) const;\r
-\r
   bool multiplyImages (const ImageFile& rRHS, ImageFile& result) const;\r
-\r
   bool divideImages (const ImageFile& rRHS, ImageFile& result) const;\r
 \r
+  bool invertPixelValues (ImageFile& result) const;\r
+  bool sqrt (ImageFile& result) const;\r
+  bool square (ImageFile& result) const;\r
+  bool log (ImageFile& result) const;\r
+  bool exp (ImageFile& result) const;\r
+  bool FFTMagnitude (ImageFile& result) const;\r
+  bool FFTPhase (ImageFile& result) const;\r
+\r
   int display (void) const;
-
   int displayScaling (const int scaleFactor, ImageFileValue pmin, ImageFileValue pmax) const;
 
 #if HAVE_PNG
index 262cccbc1c93aa557ac4374d66733c04db7e7e58..808b3803a45ea85282eb2cec78ef3b8656483e0f 100644 (file)
@@ -2,7 +2,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: pol.h,v 1.8 2000/12/27 20:09:19 kevin Exp $
+**  $Id: pol.h,v 1.9 2000/12/29 15:45:06 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
@@ -21,7 +21,7 @@
 #define __H_POL
 \r
 #include "hashtable.h"\r
-\r
+#include <stack>\r
 
 class POL {
   
@@ -167,6 +167,17 @@ private:
       PC_DUMP,\r
   };\r
   \r
+  enum {\r
+    INPUT_STREAM = 1,\r
+    INPUT_FILE,\r
+    INPUT_STRING,\r
+  };\r
+\r
+  int m_iInputType;\r
+  std::istream* m_pInputStream;\r
+  FILE* m_pInputFile;\r
+  char* m_pszInputString;\r
+\r
   enum {\r
     MAXFILE = 8,\r
   };\r
@@ -178,12 +189,8 @@ private:
   char inputline[MAXLINE];             /* current input line */\r
   int lineptr;                 /* current position in inputline */\r
   \r
-  enum {\r
-    BUFSIZE = 100,\r
-  };\r
-  int bp;              // pointer to next free position \r
-  int buf[BUFSIZE];    // pushed back input characters \r
-  \r
+  std::stack<int> m_stackPushBackInput;\r
+\r
   bool skipSingleToken (char term[]);\r
   int tok (struct token_st *token);\r
   void dumptok (struct token_st *token);\r
index 7a3cb62fde6725b8221e01895e0a0da01d182129..a16015402705fa47e09e26a919d20cdf55581dde 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: procsignal.h,v 1.8 2000/12/16 06:12:47 kevin Exp $
+**  $Id: procsignal.h,v 1.9 2000/12/29 15:45:06 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
@@ -57,6 +57,11 @@ class ProcessSignal {
     static const int FILTER_GENERATION_INVALID;
     static const int FILTER_GENERATION_DIRECT;
     static const int FILTER_GENERATION_INVERSE_FOURIER;
+\r
+    enum {\r
+      FORWARD = -1,\r
+      BACKWARD = 1,\r
+    };\r
 
     ProcessSignal (const char* szFilterName, const char* szFilterMethodName,double bw, double signalIncrement, int n, double param, const char* szDomainName, const char* szFilterGenerationName, const int zeropad = 0, const int preinterpolationFactor = 1, const int iTraceLevel = Trace::TRACE_NONE, int iGeometry = Scanner::GEOMETRY_PARALLEL, double dFocalLength = 1., SGP* pSGP = NULL);
 
@@ -99,9 +104,10 @@ class ProcessSignal {
     static void finiteFourierTransform (const std::complex<double> input[], double output[], const int n, const int direction);
 
 
-    static void shuffleNaturalToFourierOrder (double* pdVector, const int n);
-
-    static void shuffleFourierToNaturalOrder (double* pdVector, const int n);
+    static void shuffleNaturalToFourierOrder (double* pdVector, const int n);\r
+    static void shuffleNaturalToFourierOrder (std::complex<double>* pdVector, const int n);\r
+    static void shuffleFourierToNaturalOrder (double* pdVector, const int n);\r
+    static void shuffleFourierToNaturalOrder (std::complex<double>* pdVector, const int n);\r
 
  private:
         std::string m_nameFilterMethod;
index 72f7e5149fbbfdbc9ff0ea53b4b5ed810db6e397..e4537f01cd47d3e3861ef725e777811c68a74720 100644 (file)
@@ -6,7 +6,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ezplot.cpp,v 1.25 2000/12/27 20:09:19 kevin Exp $
+**  $Id: ezplot.cpp,v 1.26 2000/12/29 15:45:06 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
@@ -134,8 +134,7 @@ EZPlot::clearCurves ()
 }
 
 
-EZPlot::EZPlot (SGP& sgp)
-: rSGP (sgp)
+EZPlot::EZPlot ()
 {
     initKeywords();\r
     m_pol.addSkipWord ("please");\r
@@ -158,10 +157,8 @@ EZPlot::EZPlot (SGP& sgp)
 void
 EZPlot::initPlotSettings ()
 {
-  charheight = rSGP.getCharHeight();
-  charwidth = rSGP.getCharWidth();
-\r
   m_iCurrentCurve = -1;\r
+  m_pSGP = NULL;\r
 
   c_xlabel = "";
   c_ylabel =  "";
@@ -340,17 +337,19 @@ EZPlot::getLegend (unsigned int iCurve) const
 */
 
 void
-EZPlot::plot ()
+EZPlot::plot (SGP* pSGP)
 {\r
   if (m_vecCurves.size() <= 0)
     return;
-  
-  rSGP.setWindow (0., 0., 1., 1.);
+  \r
+  m_pSGP = pSGP;\r
+
+  m_pSGP->setWindow (0., 0., 1., 1.);
   
   if (s_textsize == TRUE)
-    rSGP.setTextPointSize (v_textsize);\r
-  charheight = rSGP.getCharHeight();
-  charwidth = rSGP.getCharWidth();
+    m_pSGP->setTextPointSize (v_textsize);\r
+  charheight = m_pSGP->getCharHeight();
+  charwidth = m_pSGP->getCharWidth();
  
   const EZPlotCurve& firstCurve = *m_vecCurves[0];\r
   double xmin = firstCurve.x[0];   // extent of curves in world coord
@@ -457,6 +456,8 @@ EZPlot::plot ()
   title_row = ya_max;;\r
   if (c_title.length() > 0)
     ya_max -= 2 * charheight;\r
+  else\r
+    ya_max -= 0.7 * charheight;  // allow room for yaxis ticklabel\r
 
   // calculate legend box boundaries 
   int max_leg = 0;                     // longest legend in characters 
@@ -493,8 +494,8 @@ EZPlot::plot ()
     
     yl_min = yl_max - leg_height;
     
-    rSGP.setColor (clr_legend);
-    rSGP.drawRect (xl_min, yl_min, xl_max, yl_max);
+    m_pSGP->setColor (clr_legend);
+    m_pSGP->drawRect (xl_min, yl_min, xl_max, yl_max);
     
     int iLegend = 0;                   // current legend position \r
     for (iCurve = 0; iCurve < m_vecCurves.size(); iCurve++) {
@@ -506,21 +507,21 @@ EZPlot::plot ()
       double xmax = xl_max - 1.0 * charwidth;
       double y = yl_max - (2.0 + iLegend * 3) * charheight;
       
-      rSGP.moveAbs (xmin, y + 0.5 * charheight);\r
-      rSGP.drawText (pstrLegend->c_str());
-      rSGP.setColor (getColor (iCurve));\r
+      m_pSGP->moveAbs (xmin, y + 0.5 * charheight);\r
+      m_pSGP->drawText (pstrLegend->c_str());
+      m_pSGP->setColor (getColor (iCurve));\r
       int iLS = getLinestyle (iCurve);
       if (iLS != SGP::LS_NOLINE) {
-        rSGP.setLineStyle (iLS);
-        rSGP.moveAbs (xmin, y);
-        rSGP.lineAbs (xmax, y);
+        m_pSGP->setLineStyle (iLS);
+        m_pSGP->moveAbs (xmin, y);
+        m_pSGP->lineAbs (xmax, y);
       }\r
       int iSymbol = getSymbol (iCurve);
       if (iSymbol > 0) {
         double xinc = (xmax - xmin) / (5 - 1);
-        rSGP.setLineStyle (SGP::LS_SOLID);
+        m_pSGP->setLineStyle (SGP::LS_SOLID);
         for (int j = 0; j < 5; j++) {
-          rSGP.moveAbs (xmin + j * xinc, y);
+          m_pSGP->moveAbs (xmin + j * xinc, y);
           symbol(iSymbol, 0.5 * charwidth, 0.5 * charheight);
         }
       }
@@ -541,13 +542,13 @@ EZPlot::plot ()
   
   // Y-Label 
   if (c_ylabel.length() > 0) {\r
-    rSGP.setTextAngle (HALFPI);\r
-    rSGP.setTextSize (1.5 * charheight);\r
+    m_pSGP->setTextAngle (HALFPI);\r
+    m_pSGP->setTextSize (1.5 * charheight);\r
     double xExtent, yExtent;\r
-    rSGP.getTextExtent (c_ylabel.c_str(), &xExtent, &yExtent);\r
-    rSGP.setTextSize (charheight);\r
+    m_pSGP->getTextExtent (c_ylabel.c_str(), &xExtent, &yExtent);\r
+    m_pSGP->setTextSize (charheight);\r
     xa_min += xExtent;\r
-    rSGP.setTextAngle (0.0);\r
+    m_pSGP->setTextAngle (0.0);\r
   }
   ylbl_col = xp_min;
   
@@ -650,7 +651,7 @@ EZPlot::plot ()
   
   // PLOT CURVES 
   
-  rSGP.setLineStyle (SGP::LS_SOLID);
+  m_pSGP->setLineStyle (SGP::LS_SOLID);
   drawAxes();
   
   // size of symbol in NDC 
@@ -663,12 +664,12 @@ EZPlot::plot ()
   for (iCurve = 0; iCurve < m_vecCurves.size(); iCurve++) {
     const EZPlotCurve* const pCurve = m_vecCurves [iCurve];
     \r
-    rSGP.setColor (getColor (iCurve));\r
+    m_pSGP->setColor (getColor (iCurve));\r
     int iSym = getSymbol (iCurve);\r
     int iLS = getLinestyle (iCurve);\r
 \r
     if (iLS != SGP::LS_NOLINE) {
-      rSGP.setLineStyle (iLS);
+      m_pSGP->setLineStyle (iLS);
       double x1 = convertWorldToNDC_X (pCurve->x[0]);
       double y1 = convertWorldToNDC_Y (pCurve->y[0]);\r
       for (int i = 1; i < pCurve->m_iPointCount; i++) {
@@ -677,8 +678,8 @@ EZPlot::plot ()
         double x2Clip = x2;\r
         double y2Clip = y2;\r
         if (clip_rect (x1, y1, x2Clip, y2Clip, clipRect)) {\r
-          rSGP.moveAbs (x1, y1);\r
-          rSGP.lineAbs (x2Clip, y2Clip);\r
+          m_pSGP->moveAbs (x1, y1);\r
+          m_pSGP->lineAbs (x2Clip, y2Clip);\r
         }\r
         x1 = x2;\r
         y1 = y2;\r
@@ -686,17 +687,17 @@ EZPlot::plot ()
     }
     if (iSym > 0) {\r
       int iSymFreq = getSymbolFreq (iCurve);
-      rSGP.setLineStyle (SGP::LS_SOLID);
+      m_pSGP->setLineStyle (SGP::LS_SOLID);
       double x = convertWorldToNDC_X (pCurve->x[0]);
       double y = convertWorldToNDC_Y (pCurve->y[0]);
-      rSGP.moveAbs (x, y);
+      m_pSGP->moveAbs (x, y);
       symbol (iSym, symwidth, symheight);
       for (int i = 1; i < pCurve->m_iPointCount; i++)
         if (i % iSymFreq == 0 || i == pCurve->m_iPointCount - 1) {
           x = convertWorldToNDC_X (pCurve->x[i]);
           y = convertWorldToNDC_Y (pCurve->y[i]);\r
           if (y >= ygn_min && y <= ygn_max) {
-            rSGP.moveAbs (x, y);
+            m_pSGP->moveAbs (x, y);
             symbol (iSym, symwidth, symheight);\r
           }
         }
@@ -726,8 +727,8 @@ EZPlot::drawAxes()
   char str[256];
   char *numstr;
   
-  rSGP.setTextSize (charheight);
-  rSGP.setTextColor (1, -1);
+  m_pSGP->setTextSize (charheight);
+  m_pSGP->setTextColor (1, -1);
   
   if (o_xticks == ABOVE)
     xticklen = 0.5 * charheight;
@@ -741,21 +742,21 @@ EZPlot::drawAxes()
   
   if (c_title.length() > 0) {
     double wText, hText;
-    rSGP.setTextSize (charheight * 2.0);
-    rSGP.getTextExtent (c_title.c_str(), &wText, &hText);
-    rSGP.moveAbs (xa_min + (xa_max-xa_min)/2 - wText/2, title_row);
-    rSGP.setTextColor (clr_title, -1);
-    rSGP.drawText (c_title);
-    rSGP.setTextSize (charheight);
+    m_pSGP->setTextSize (charheight * 2.0);
+    m_pSGP->getTextExtent (c_title.c_str(), &wText, &hText);
+    m_pSGP->moveAbs (xa_min + (xa_max-xa_min)/2 - wText/2, title_row);
+    m_pSGP->setTextColor (clr_title, -1);
+    m_pSGP->drawText (c_title);
+    m_pSGP->setTextSize (charheight);
   }
   
   if (o_grid == TRUE || o_box == TRUE) {
-    rSGP.setColor (clr_axis);
-    rSGP.moveAbs (xa_min, ya_min);
-    rSGP.lineAbs (xa_max, ya_min);
-    rSGP.lineAbs (xa_max, ya_max);
-    rSGP.lineAbs (xa_min, ya_max);
-    rSGP.lineAbs (xa_min, ya_min);
+    m_pSGP->setColor (clr_axis);
+    m_pSGP->moveAbs (xa_min, ya_min);
+    m_pSGP->lineAbs (xa_max, ya_min);
+    m_pSGP->lineAbs (xa_max, ya_max);
+    m_pSGP->lineAbs (xa_min, ya_max);
+    m_pSGP->lineAbs (xa_min, ya_min);
   }
   
   // calculate position of axes 
@@ -781,44 +782,44 @@ EZPlot::drawAxes()
   if (o_xaxis == LINEAR) {
     // draw axis line 
     
-    rSGP.setColor (clr_axis);
+    m_pSGP->setColor (clr_axis);
     if (o_tag && !o_grid && !o_box && s_xcross) {
-      rSGP.moveAbs (xa_min, xaxispos - charheight);
-      rSGP.lineAbs (xa_min, xaxispos + charheight);
+      m_pSGP->moveAbs (xa_min, xaxispos - charheight);
+      m_pSGP->lineAbs (xa_min, xaxispos + charheight);
     }
-    rSGP.moveAbs (xa_min, xaxispos);
-    rSGP.lineAbs (xa_max, xaxispos);
+    m_pSGP->moveAbs (xa_min, xaxispos);
+    m_pSGP->lineAbs (xa_max, xaxispos);
     if (o_tag && !o_grid && !o_box) {
-      rSGP.moveAbs (xa_max, xaxispos - charheight);
-      rSGP.lineAbs (xa_max, xaxispos + charheight);
+      m_pSGP->moveAbs (xa_max, xaxispos - charheight);
+      m_pSGP->lineAbs (xa_max, xaxispos + charheight);
     }
     
     if (o_grid == TRUE) {
-      rSGP.setColor (clr_grid);
+      m_pSGP->setColor (clr_grid);
       for (i = 0; i <= x_nint; i++) {
-        rSGP.moveAbs (xt_min + xn_tickinc * i, ya_max);
-        rSGP.lineAbs (xt_min + xn_tickinc * i, ya_min);
+        m_pSGP->moveAbs (xt_min + xn_tickinc * i, ya_max);
+        m_pSGP->lineAbs (xt_min + xn_tickinc * i, ya_min);
       }
     }
-    rSGP.setTextSize (charheight * 1.5);
-    rSGP.setTextColor (clr_label, -1);\r
+    m_pSGP->setTextSize (charheight * 1.5);
+    m_pSGP->setTextColor (clr_label, -1);\r
     double wText, hText;\r
-    rSGP.getTextExtent (c_xlabel.c_str(), &wText, &hText);
-    rSGP.moveAbs (xa_min + (xa_max-xa_min)/2 - wText / 2, xlbl_row +  charheight * 1.5);\r
-    rSGP.drawText (c_xlabel);
-    rSGP.setTextSize (charheight);
+    m_pSGP->getTextExtent (c_xlabel.c_str(), &wText, &hText);
+    m_pSGP->moveAbs (xa_min + (xa_max-xa_min)/2 - wText / 2, xlbl_row +  charheight * 1.5);\r
+    m_pSGP->drawText (c_xlabel);
+    m_pSGP->setTextSize (charheight);
     minorinc = xn_tickinc / (o_xminortick + 1);
     
     for (i = 0; i <= x_nint; i++) {
       x = xt_min + xn_tickinc * i;
-      rSGP.setColor (clr_axis);
-      rSGP.moveAbs (x, xaxispos);
-      rSGP.lineAbs (x, xaxispos + xticklen);
+      m_pSGP->setColor (clr_axis);
+      m_pSGP->moveAbs (x, xaxispos);
+      m_pSGP->lineAbs (x, xaxispos + xticklen);
       if (i != x_nint)
         for (j = 1; j <= o_xminortick; j++) {
           x2 = x + minorinc * j;
-          rSGP.moveAbs (x2, xaxispos);
-          rSGP.lineAbs (x2, xaxispos + TICKRATIO * xticklen);
+          m_pSGP->moveAbs (x2, xaxispos);
+          m_pSGP->lineAbs (x2, xaxispos + TICKRATIO * xticklen);
         }
         axis_near = FALSE;
         if (xaxispos + xtl_ofs > ya_min && o_yaxis != NOAXIS) {
@@ -834,9 +835,9 @@ EZPlot::drawAxes()
         if (o_xtlabel == TRUE && axis_near == FALSE) {
           snprintf (str, sizeof(str), x_numfmt, xgw_min + xw_tickinc * i);
           numstr = str_skip_head (str, " ");
-          rSGP.moveAbs (x-strlen(numstr)*charwidth/2, xaxispos + xtl_ofs);
-          rSGP.setTextColor (clr_number, -1);
-          rSGP.drawText (numstr);
+          m_pSGP->moveAbs (x-strlen(numstr)*charwidth/2, xaxispos + xtl_ofs);
+          m_pSGP->setTextColor (clr_number, -1);
+          m_pSGP->drawText (numstr);
         }
     }
   }            // X - Axis 
@@ -848,47 +849,47 @@ EZPlot::drawAxes()
   
   if (o_yaxis == LINEAR) {
     
-    rSGP.setColor (clr_axis);
+    m_pSGP->setColor (clr_axis);
     if (o_tag && !o_grid && !o_box && s_ycross) {
-      rSGP.moveAbs (yaxispos - charwidth, ya_min);
-      rSGP.lineAbs (yaxispos + charwidth, ya_min);
+      m_pSGP->moveAbs (yaxispos - charwidth, ya_min);
+      m_pSGP->lineAbs (yaxispos + charwidth, ya_min);
     }
-    rSGP.moveAbs (yaxispos, ya_min);
-    rSGP.lineAbs (yaxispos, ya_max);
+    m_pSGP->moveAbs (yaxispos, ya_min);
+    m_pSGP->lineAbs (yaxispos, ya_max);
     if (o_tag && !o_grid && !o_box) {
-      rSGP.moveAbs (yaxispos - charwidth, ya_max);
-      rSGP.lineAbs (yaxispos + charwidth, ya_max);
+      m_pSGP->moveAbs (yaxispos - charwidth, ya_max);
+      m_pSGP->lineAbs (yaxispos + charwidth, ya_max);
     }
     
     if (o_grid == TRUE) {
-      rSGP.setColor (clr_grid);
+      m_pSGP->setColor (clr_grid);
       for (i = 0; i <= y_nint; i++) {
         y = yt_min + yn_tickinc * i;
-        rSGP.moveAbs (xa_max, y);
-        rSGP.lineAbs (xa_min, y);
+        m_pSGP->moveAbs (xa_max, y);
+        m_pSGP->lineAbs (xa_min, y);
       }
     }\r
-    rSGP.setTextAngle (HALFPI);
-    rSGP.setTextSize (1.5 * charheight);
-    rSGP.setTextColor (clr_label, -1);\r
+    m_pSGP->setTextAngle (HALFPI);
+    m_pSGP->setTextSize (1.5 * charheight);
+    m_pSGP->setTextColor (clr_label, -1);\r
     double xExtent, yExtent;\r
-    rSGP.getTextExtent (c_ylabel.c_str(), &xExtent, &yExtent);\r
-    rSGP.moveAbs (ylbl_col, ya_min + (ya_max-ya_min)/2 - yExtent / 2);\r
-    rSGP.drawText (c_ylabel);\r
-    rSGP.setTextAngle (0.0);
-    rSGP.setTextSize (charheight);
+    m_pSGP->getTextExtent (c_ylabel.c_str(), &xExtent, &yExtent);\r
+    m_pSGP->moveAbs (ylbl_col, ya_min + (ya_max-ya_min)/2 - yExtent / 2);\r
+    m_pSGP->drawText (c_ylabel);\r
+    m_pSGP->setTextAngle (0.0);
+    m_pSGP->setTextSize (charheight);
     minorinc = yn_tickinc / (o_yminortick + 1);
     
     for (i = 0; i <= y_nint; i++) {
       y = yt_min + yn_tickinc * i;
-      rSGP.setColor (clr_axis);
-      rSGP.moveAbs (yaxispos, y);
-      rSGP.lineAbs (yaxispos + yticklen, y);
+      m_pSGP->setColor (clr_axis);
+      m_pSGP->moveAbs (yaxispos, y);
+      m_pSGP->lineAbs (yaxispos + yticklen, y);
       if (i != y_nint)
         for (j = 1; j <= o_yminortick; j++) {
           y2 = y + minorinc * j;
-          rSGP.moveAbs (yaxispos, y2);
-          rSGP.lineAbs (yaxispos + TICKRATIO * yticklen, y2);
+          m_pSGP->moveAbs (yaxispos, y2);
+          m_pSGP->lineAbs (yaxispos + TICKRATIO * yticklen, y2);
         }
         axis_near = FALSE;
         if (yaxispos + ytl_ofs > xa_min && o_xaxis != NOAXIS) {
@@ -902,9 +903,9 @@ EZPlot::drawAxes()
         }
         if (o_ytlabel == TRUE && axis_near == FALSE) {
           snprintf (str, sizeof(str), y_numfmt, ygw_min + yw_tickinc * i);\r
-          rSGP.moveAbs (yaxispos + ytl_ofs, y + 0.5 * charheight);\r
-          rSGP.setTextColor (clr_number, -1);\r
-          rSGP.drawText (str);
+          m_pSGP->moveAbs (yaxispos + ytl_ofs, y + 0.5 * charheight);\r
+          m_pSGP->setTextColor (clr_number, -1);\r
+          m_pSGP->drawText (str);
         }
     }
   }            // Y - Axis
@@ -918,34 +919,34 @@ EZPlot::symbol (int sym, double symwidth, double symheight)
     return;
   
   if (sym == SB_CROSS) {
-    rSGP.moveRel (-0.5 * symwidth, -0.5 * symheight);
-    rSGP.lineRel (symwidth, symheight);
-    rSGP.moveRel (-symwidth, 0.0);
-    rSGP.lineRel (symwidth, -symheight);
-    rSGP.moveRel (-0.5 * symwidth, 0.5 * symheight);
+    m_pSGP->moveRel (-0.5 * symwidth, -0.5 * symheight);
+    m_pSGP->lineRel (symwidth, symheight);
+    m_pSGP->moveRel (-symwidth, 0.0);
+    m_pSGP->lineRel (symwidth, -symheight);
+    m_pSGP->moveRel (-0.5 * symwidth, 0.5 * symheight);
   } else if (sym == SB_PLUS) {
-    rSGP.moveRel (-0.5 * symwidth, 0.0);
-    rSGP.lineRel (symwidth, 0.0);
-    rSGP.moveRel (-0.5 * symwidth, -0.5 * symheight);
-    rSGP.lineRel (0.0, symheight);
-    rSGP.moveRel (0.0, -0.5 * symheight);
+    m_pSGP->moveRel (-0.5 * symwidth, 0.0);
+    m_pSGP->lineRel (symwidth, 0.0);
+    m_pSGP->moveRel (-0.5 * symwidth, -0.5 * symheight);
+    m_pSGP->lineRel (0.0, symheight);
+    m_pSGP->moveRel (0.0, -0.5 * symheight);
   } else if (sym == SB_BOX) {
-    rSGP.moveRel (-0.5 * symwidth, -0.5 * symheight);
-    rSGP.lineRel (symwidth, 0.0);
-    rSGP.lineRel (0.0, symheight);
-    rSGP.lineRel (-symwidth, 0.0);
-    rSGP.lineRel (0.0, -symheight);
-    rSGP.moveRel (0.5 * symwidth, 0.5 * symheight);
+    m_pSGP->moveRel (-0.5 * symwidth, -0.5 * symheight);
+    m_pSGP->lineRel (symwidth, 0.0);
+    m_pSGP->lineRel (0.0, symheight);
+    m_pSGP->lineRel (-symwidth, 0.0);
+    m_pSGP->lineRel (0.0, -symheight);
+    m_pSGP->moveRel (0.5 * symwidth, 0.5 * symheight);
   } else if (sym == SB_CIRCLE) {
-    rSGP.drawCircle (symwidth);
+    m_pSGP->drawCircle (symwidth);
   } else if (sym == SB_ERRORBAR) {
-    rSGP.moveRel (-0.5 * symwidth, 0.5 * symheight);
-    rSGP.lineRel (symwidth, 0.0);
-    rSGP.moveRel (-0.5 * symwidth, 0.0);
-    rSGP.lineRel (0.0, -symheight);
-    rSGP.moveRel (-0.5 * symwidth, 0.0);
-    rSGP.lineRel (symwidth, 0.0);
-    rSGP.moveRel (-0.5 * symwidth, 0.5 * symheight);
+    m_pSGP->moveRel (-0.5 * symwidth, 0.5 * symheight);
+    m_pSGP->lineRel (symwidth, 0.0);
+    m_pSGP->moveRel (-0.5 * symwidth, 0.0);
+    m_pSGP->lineRel (0.0, -symheight);
+    m_pSGP->moveRel (-0.5 * symwidth, 0.0);
+    m_pSGP->lineRel (symwidth, 0.0);
+    m_pSGP->moveRel (-0.5 * symwidth, 0.5 * symheight);
   }
 }
 
index 718b2504ec77df2504035502c599ebcf9fea8d9f..222b3cd5a77c08d1986847f7b0be87cf9002a160 100644 (file)
@@ -6,7 +6,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ezset.cpp,v 1.14 2000/12/27 20:09:19 kevin Exp $
+**  $Id: ezset.cpp,v 1.15 2000/12/29 15:45:06 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
@@ -81,7 +81,7 @@ EZPlot::do_cmd (int lx)
     }
     break;
   case S_REPLOT:
-    plot ();
+    plot (m_pSGP);
     break;
   case S_CLEAR:
     clearCurves ();
index 1d1a13ab31470cd7bb71fdf560204a3d87cbdfb5..9c0e4278b61b951e7490d9c9e0981eaddcaccfed 100644 (file)
@@ -6,7 +6,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: pol.cpp,v 1.7 2000/12/27 20:09:19 kevin Exp $
+**  $Id: pol.cpp,v 1.8 2000/12/29 15:45:06 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
@@ -54,7 +54,6 @@ const unsigned int POL::NUMCMD = (sizeof(POL::cmdlist) / sizeof (struct POL::Key
 
 POL::POL()
 {
-  bp = 0;
   currentf = -1;\r
   m_bTrace = false;
   init();
@@ -832,9 +831,10 @@ POL::usefile (int source, char *fn)
     sys_error (ERR_SEVERE, "files nested too deeply");
     return;
   }
-  
-  bp = 0;                              /* clear any pushed back input */
-  
+  \r
+  while (! m_stackPushBackInput.empty())\r
+    m_stackPushBackInput.pop();\r
+
   if (source == P_USE_STR) {
     filep[currentf] = NULL;
   } else if (source == P_USE_FILE) {
@@ -898,11 +898,13 @@ POL::inchar()
 int 
 POL::getch (FILE *fp)
 {
-  int c;
-  
-  if (bp > 0)
-    return (buf[--bp]);
-  
+  int c;\r
+  if (m_stackPushBackInput.size() > 0) {\r
+    c = m_stackPushBackInput.top();\r
+    m_stackPushBackInput.pop();\r
+    return c;\r
+  }\r
+
   if (fp == NULL) {
     if ((c = inputline[lineptr]) == EOS)
       return (EOF);
@@ -916,22 +918,21 @@ POL::getch (FILE *fp)
   return (c);
 }
 
-/* push character back on input */
+// push character back on input 
 void 
 POL::ungetch (int c)
 {
-  if (bp > BUFSIZE)
-    sys_error (ERR_SEVERE, "too many characters pushed back [ungetch]");
-  else
-    buf[bp++] = c;
+  m_stackPushBackInput.push (c);\r
 }
 
 
 int 
 POL::get_inputline (FILE *fp)
 {
-  lineptr = 0;
-  bp = 0;
+  while (! m_stackPushBackInput.empty())\r
+    m_stackPushBackInput.pop();\r
+\r
+  lineptr = 0;\r
   if (fgets (inputline, MAXLINE, fp) == NULL)
     return (EOF);
   else
@@ -941,7 +942,9 @@ POL::get_inputline (FILE *fp)
 void 
 POL::set_inputline (const char* const line)
 {
-  lineptr = 0;
-  bp = 0;
+  while (! m_stackPushBackInput.empty())\r
+    m_stackPushBackInput.pop();\r
+\r
   strncpy (inputline, line, MAXLINE);
+  lineptr = 0;\r
 }
index a5e9bec75e34ea2442152be631e318c1a93b897f..54f38a18550998ee53bfd6b0af12b55bfbeaa55e 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: imagefile.cpp,v 1.24 2000/12/22 04:18:00 kevin Exp $
+**  $Id: imagefile.cpp,v 1.25 2000/12/29 15:45:06 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
@@ -62,7 +62,7 @@ ImageFile::filterResponse (const char* const domainName, double bw, const char*
        
        for (int i = -hx; i <= hx; i++) {
                for (int j = -hy; j <= hy; j++) {
-                       double r = sqrt (i * i + j * j);
+      double r = ::sqrt (i * i + j * j);
                        
                        v[i+hx][j+hy] = filter.response (r);
                }
@@ -170,7 +170,7 @@ ImageFile::comparativeStatistics (const ImageFile& imComp, double& d, double& r,
                }
     }
        
-    d = sqrt (sqErrorSum / sqDiffFromMeanSum);
+    d = ::sqrt (sqErrorSum / sqDiffFromMeanSum);
     r = absErrorSum / absValueSum;
        
     int hx = m_nx / 2;
@@ -364,6 +364,242 @@ ImageFile::divideImages (const ImageFile& rRHS, ImageFile& result) const
 }\r
 \r
 \r
+bool\r
+ImageFile::invertPixelValues (ImageFile& result) const\r
+{\r
+  if (m_nx != result.nx() || m_ny != result.ny()) {\r
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+    return false;\r
+  }\r
+\r
+  ImageFileArrayConst vLHS = getArray();\r
+  ImageFileArray vResult = result.getArray();\r
+\r
+  for (int ix = 0; ix < m_nx; ix++) {\r
+    ImageFileColumnConst in = vLHS[ix];\r
+    ImageFileColumn out = vResult[ix];\r
+    for (int iy = 0; iy < m_ny; iy++)\r
+        *out++ = - *in++;\r
+  }\r
+\r
+  return true;\r
+}\r
+\r
+bool\r
+ImageFile::sqrt (ImageFile& result) const\r
+{\r
+  if (m_nx != result.nx() || m_ny != result.ny()) {\r
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+    return false;\r
+  }\r
+\r
+  ImageFileArrayConst vLHS = getArray();\r
+  ImageFileArray vResult = result.getArray();\r
+\r
+  for (int ix = 0; ix < m_nx; ix++) {\r
+    ImageFileColumnConst in = vLHS[ix];\r
+    ImageFileColumn out = vResult[ix];\r
+    for (int iy = 0; iy < m_ny; iy++)\r
+      if (*in < 0)\r
+        *out++ = -::sqrt(-*in++);\r
+      else\r
+        *out++ = ::sqrt(*in++);\r
+  }\r
+\r
+  return true;\r
+}\r
+\r
+bool\r
+ImageFile::log (ImageFile& result) const\r
+{\r
+  if (m_nx != result.nx() || m_ny != result.ny()) {\r
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+    return false;\r
+  }\r
+\r
+  ImageFileArrayConst vLHS = getArray();\r
+  ImageFileArray vResult = result.getArray();\r
+\r
+  for (int ix = 0; ix < m_nx; ix++) {\r
+    ImageFileColumnConst in = vLHS[ix];\r
+    ImageFileColumn out = vResult[ix];\r
+    for (int iy = 0; iy < m_ny; iy++)\r
+      if (*in <= 0)\r
+        *out++ = 0;\r
+      else\r
+        *out++ = ::log(*in++);\r
+  }\r
+\r
+  return true;\r
+}\r
+\r
+bool\r
+ImageFile::exp (ImageFile& result) const\r
+{\r
+  if (m_nx != result.nx() || m_ny != result.ny()) {\r
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+    return false;\r
+  }\r
+\r
+  ImageFileArrayConst vLHS = getArray();\r
+  ImageFileArray vResult = result.getArray();\r
+\r
+  for (int ix = 0; ix < m_nx; ix++) {\r
+    ImageFileColumnConst in = vLHS[ix];\r
+    ImageFileColumn out = vResult[ix];\r
+    for (int iy = 0; iy < m_ny; iy++)\r
+      *out++ = ::exp (*in++);\r
+  }\r
+\r
+  return true;\r
+}\r
+\r
+bool\r
+ImageFile::FFTMagnitude (ImageFile& result) const\r
+{\r
+  if (m_nx != result.nx() || m_ny != result.ny()) {\r
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+    return false;\r
+  }\r
+\r
+  ImageFileArrayConst vLHS = getArray();\r
+  ImageFileArray vResult = result.getArray();\r
+\r
+  int ix, iy;\r
+  double* pY = new double [m_ny];\r
+  std::complex<double>** complexOut = new std::complex<double>* [m_nx];\r
+  for (ix = 0; ix < m_nx; ix++)\r
+    complexOut[ix] = new std::complex<double> [m_ny];\r
+\r
+  for (ix = 0; ix < m_nx; ix++) {\r
+    for (iy = 0; iy < m_ny; iy++)\r
+      pY[iy] = vLHS[ix][iy];\r
+    ProcessSignal::finiteFourierTransform (pY, complexOut[ix], m_ny,  ProcessSignal::FORWARD);\r
+  }\r
+  delete pY;\r
+\r
+  std::complex<double>* pX = new std::complex<double> [m_nx];\r
+  std::complex<double>* complexOutCol = new std::complex<double> [m_nx];\r
+  for (iy = 0; iy < m_ny; iy++) {\r
+    for (ix = 0; ix < m_nx; ix++)\r
+      pX[ix] = complexOut[ix][iy];\r
+    ProcessSignal::finiteFourierTransform (pX, complexOutCol, m_nx, ProcessSignal::FORWARD);\r
+    for (ix = 0; ix < m_nx; ix++)\r
+      complexOut[ix][iy] = complexOutCol[ix];\r
+  }\r
+  delete [] pX;\r
+\r
+  for (ix = 0; ix < m_nx; ix++)\r
+    ProcessSignal::shuffleFourierToNaturalOrder (complexOut[ix], m_ny);\r
+\r
+  \r
+  for (iy = 0; iy < m_ny; iy++) {\r
+    for (ix = 0; ix < m_nx; ix++)\r
+      complexOutCol[ix] = complexOut[ix][iy];\r
+    ProcessSignal::shuffleFourierToNaturalOrder (complexOutCol, m_nx);;\r
+    for (ix = 0; ix < m_nx; ix++)\r
+      complexOut[ix][iy] = complexOutCol[ix];\r
+\r
+  }\r
+  delete [] complexOutCol;\r
+\r
+  for (ix = 0; ix < m_nx; ix++)\r
+    for (iy = 0; iy < m_ny; iy++)\r
+      vResult[ix][iy] = std::abs (complexOut[ix][iy]);\r
+\r
+  for (ix = 0; ix < m_nx; ix++)\r
+    delete [] complexOut[ix];\r
+\r
+  delete [] complexOut;\r
+\r
+  return true;\r
+}\r
+\r
+bool\r
+ImageFile::FFTPhase (ImageFile& result) const\r
+{\r
+  if (m_nx != result.nx() || m_ny != result.ny()) {\r
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+    return false;\r
+  }\r
+\r
+  ImageFileArrayConst vLHS = getArray();\r
+  ImageFileArray vResult = result.getArray();\r
+\r
+  int ix, iy;\r
+  double* pY = new double [m_ny];\r
+  std::complex<double>** complexOut = new std::complex<double>* [m_nx];\r
+  for (ix = 0; ix < m_nx; ix++)\r
+    complexOut[ix] = new std::complex<double> [m_ny];\r
+\r
+  for (ix = 0; ix < m_nx; ix++) {\r
+    for (iy = 0; iy < m_ny; iy++)\r
+      pY[iy] = vLHS[ix][iy];\r
+    ProcessSignal::finiteFourierTransform (pY, complexOut[ix], m_ny,  ProcessSignal::FORWARD);\r
+  }\r
+  delete pY;\r
+\r
+  std::complex<double>* pX = new std::complex<double> [m_nx];\r
+  std::complex<double>* complexOutCol = new std::complex<double> [m_nx];\r
+  for (iy = 0; iy < m_ny; iy++) {\r
+    for (ix = 0; ix < m_nx; ix++)\r
+      pX[ix] = complexOut[ix][iy];\r
+    ProcessSignal::finiteFourierTransform (pX, complexOutCol, m_nx, ProcessSignal::FORWARD);\r
+    for (ix = 0; ix < m_nx; ix++)\r
+      complexOut[ix][iy] = complexOutCol[ix];\r
+  }\r
+  delete [] pX;\r
+\r
+  for (ix = 0; ix < m_nx; ix++)\r
+    ProcessSignal::shuffleFourierToNaturalOrder (complexOut[ix], m_ny);\r
+\r
+  \r
+  for (iy = 0; iy < m_ny; iy++) {\r
+    for (ix = 0; ix < m_nx; ix++)\r
+      complexOutCol[ix] = complexOut[ix][iy];\r
+    ProcessSignal::shuffleFourierToNaturalOrder (complexOutCol, m_nx);;\r
+    for (ix = 0; ix < m_nx; ix++)\r
+      complexOut[ix][iy] = complexOutCol[ix];\r
+\r
+  }\r
+  delete [] complexOutCol;\r
+\r
+  for (ix = 0; ix < m_nx; ix++)\r
+    for (iy = 0; iy < m_ny; iy++)\r
+      vResult[ix][iy] = atan (complexOut[ix][iy].imag / complexOut[ix][iy].real);\r
+\r
+  for (ix = 0; ix < m_nx; ix++)\r
+    delete [] complexOut[ix];\r
+\r
+  delete [] complexOut;\r
+\r
+  return true;\r
+}\r
+\r
+bool\r
+ImageFile::square (ImageFile& result) const\r
+{\r
+  if (m_nx != result.nx() || m_ny != result.ny()) {\r
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");\r
+    return false;\r
+  }\r
+\r
+  ImageFileArrayConst vLHS = getArray();\r
+  ImageFileArray vResult = result.getArray();\r
+\r
+  for (int ix = 0; ix < m_nx; ix++) {\r
+    ImageFileColumnConst in = vLHS[ix];\r
+    ImageFileColumn out = vResult[ix];\r
+    for (int iy = 0; iy < m_ny; iy++) {\r
+        *out++ = *in * *in;\r
+        in++;\r
+    }\r
+  }\r
+\r
+  return true;\r
+}\r
+\r
+\r
 void 
 ImageFile::writeImagePGM (const char *outfile, int nxcell, int nycell, double densmin, double densmax)
 {
index 7bf2711f0a626190dd01fa297d478b0d5c1a1431..a7933b21eb2a4ffb508c88d5caa35ffc834d3723 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: procsignal.cpp,v 1.10 2000/12/16 06:12:47 kevin Exp $
+**  $Id: procsignal.cpp,v 1.11 2000/12/29 15:45:06 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
@@ -78,7 +78,7 @@ const int ProcessSignal::s_iFilterGenerationCount = sizeof(s_aszFilterGeneration
 //   ProcessSignal
 //
 ProcessSignal::ProcessSignal (const char* szFilterName, const char* szFilterMethodName, double dBandwidth, double dSignalIncrement, int nSignalPoints, double dFilterParam, const char* szDomainName, const char* szFilterGenerationName, int iZeropad, int iPreinterpolationFactor, int iTraceLevel, int iGeometry, double dFocalLength, SGP* pSGP)
-    : m_adFourierCosTable(NULL), m_adFourierSinTable(NULL), m_adFilter(NULL), m_fail(false)
+: m_adFourierCosTable(NULL), m_adFourierSinTable(NULL), m_adFilter(NULL), m_fail(false)
 {
   m_idFilterMethod = convertFilterMethodNameToID (szFilterMethodName);
   if (m_idFilterMethod == FILTER_METHOD_INVALID) {
@@ -108,7 +108,7 @@ ProcessSignal::ProcessSignal (const char* szFilterName, const char* szFilterMeth
     m_failMessage += szDomainName;
     return;
   }
-
+  
   init (m_idFilter, m_idFilterMethod, dBandwidth, dSignalIncrement, nSignalPoints, dFilterParam, m_idDomain, m_idFilterGeneration, iZeropad, iPreinterpolationFactor, iTraceLevel, iGeometry, dFocalLength, pSGP);
 }
 
@@ -123,7 +123,7 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw
   m_idFilterGeneration = idFilterGeneration;
   m_idGeometry = iGeometry;
   m_dFocalLength = dFocalLength;
-
+  
   if (m_idFilter == SignalFilter::FILTER_INVALID || m_idDomain == SignalFilter::DOMAIN_INVALID || m_idFilterMethod == FILTER_METHOD_INVALID || m_idFilterGeneration == FILTER_GENERATION_INVALID) {
     m_fail = true;
     return;
@@ -137,14 +137,14 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw
   m_dFilterParam = dFilterParam;  
   m_iZeropad = iZeropad;
   m_iPreinterpolationFactor = iPreinterpolationFactor;
-
+  
   // scale signalInc/BW to signalInc/2 to adjust for imaginary detector
   // through origin of phantom, see Kak-Slaney Fig 3.22, for Collinear
   if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) {
     m_dSignalInc /= 2;
     m_dBandwidth *= 2;
   }
-
+  
   if (m_idFilterMethod == FILTER_METHOD_FFT) {
 #if HAVE_FFTW
     m_idFilterMethod = FILTER_METHOD_RFFTW;
@@ -154,165 +154,165 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw
     return;
 #endif
   }
-
+  
   bool m_bFrequencyFiltering = true;
   if (m_idFilterMethod == FILTER_METHOD_CONVOLUTION)
     m_bFrequencyFiltering = false;
-
+  
   // Spatial-based filtering
   if (! m_bFrequencyFiltering) {
-
+    
     if (m_idFilterGeneration == FILTER_GENERATION_DIRECT) {
-       m_nFilterPoints = 2 * (m_nSignalPoints - 1) + 1;
-       m_dFilterMin = -m_dSignalInc * (m_nSignalPoints - 1);
-       m_dFilterMax = m_dSignalInc * (m_nSignalPoints - 1);
-       m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (m_nFilterPoints - 1);
-       SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, m_nFilterPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_SPATIAL);
-       m_adFilter = new double[ m_nFilterPoints ];
-       filter.copyFilterData (m_adFilter, 0, m_nFilterPoints);
+      m_nFilterPoints = 2 * (m_nSignalPoints - 1) + 1;
+      m_dFilterMin = -m_dSignalInc * (m_nSignalPoints - 1);
+      m_dFilterMax = m_dSignalInc * (m_nSignalPoints - 1);
+      m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (m_nFilterPoints - 1);
+      SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, m_nFilterPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_SPATIAL);
+      m_adFilter = new double[ m_nFilterPoints ];
+      filter.copyFilterData (m_adFilter, 0, m_nFilterPoints);
     } else if (m_idFilterGeneration == FILTER_GENERATION_INVERSE_FOURIER) {
-       m_nFilterPoints = 2 * (m_nSignalPoints - 1) + 1;
-       m_dFilterMin = -1. / (2 * m_dSignalInc);
-       m_dFilterMax = 1. / (2 * m_dSignalInc);
-       m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (m_nFilterPoints - 1);
-       SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, m_nFilterPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_FREQUENCY);
-       m_adFilter = new double[ m_nFilterPoints ];
-       double* adFrequencyFilter = new double [m_nFilterPoints];
-       filter.copyFilterData (adFrequencyFilter, 0, m_nFilterPoints);
+      m_nFilterPoints = 2 * (m_nSignalPoints - 1) + 1;
+      m_dFilterMin = -1. / (2 * m_dSignalInc);
+      m_dFilterMax = 1. / (2 * m_dSignalInc);
+      m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (m_nFilterPoints - 1);
+      SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, m_nFilterPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_FREQUENCY);
+      m_adFilter = new double[ m_nFilterPoints ];
+      double* adFrequencyFilter = new double [m_nFilterPoints];
+      filter.copyFilterData (adFrequencyFilter, 0, m_nFilterPoints);
 #ifdef HAVE_SGP
-       EZPlot* pEZPlot = NULL;
-       if (pSGP && m_traceLevel >= Trace::TRACE_PLOT) {
-         pEZPlot = new EZPlot (*pSGP);
-         pEZPlot->ezset ("title Filter Response: Natural Order");
-         pEZPlot->ezset ("ylength 0.25");
-         pEZPlot->addCurve (adFrequencyFilter, m_nFilterPoints);
-         pEZPlot->plot();
-       }
+      EZPlot* pEZPlot = NULL;
+      if (pSGP && m_traceLevel >= Trace::TRACE_PLOT) {
+        pEZPlot = new EZPlot ();
+        pEZPlot->ezset ("title Filter Response: Natural Order");
+        pEZPlot->ezset ("ylength 0.25");
+        pEZPlot->addCurve (adFrequencyFilter, m_nFilterPoints);
+        pEZPlot->plot (pSGP);
+      }
 #endif     
-       shuffleNaturalToFourierOrder (adFrequencyFilter, m_nFilterPoints);
+      shuffleNaturalToFourierOrder (adFrequencyFilter, m_nFilterPoints);
 #ifdef HAVE_SGP
-       if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
-         pEZPlot->ezset ("title Filter Response: Fourier Order");
-         pEZPlot->ezset ("ylength 0.25");
-         pEZPlot->ezset ("yporigin 0.25");
-         pEZPlot->addCurve (adFrequencyFilter, m_nFilterPoints);
-         pEZPlot->plot();
-       }
+      if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
+        pEZPlot->ezset ("title Filter Response: Fourier Order");
+        pEZPlot->ezset ("ylength 0.25");
+        pEZPlot->ezset ("yporigin 0.25");
+        pEZPlot->addCurve (adFrequencyFilter, m_nFilterPoints);
+        pEZPlot->plot (pSGP);
+      }
 #endif
-       ProcessSignal::finiteFourierTransform (adFrequencyFilter, m_adFilter, m_nFilterPoints, -1);
-       delete adFrequencyFilter;\r
+      ProcessSignal::finiteFourierTransform (adFrequencyFilter, m_adFilter, m_nFilterPoints, -1);
+      delete adFrequencyFilter;\r
 #ifdef HAVE_SGP
-       if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
-         pEZPlot->ezset ("title Inverse Fourier Frequency: Fourier Order");
-         pEZPlot->ezset ("ylength 0.25");
-         pEZPlot->ezset ("yporigin 0.50");
-         pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
-         pEZPlot->plot();
-       }
+      if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
+        pEZPlot->ezset ("title Inverse Fourier Frequency: Fourier Order");
+        pEZPlot->ezset ("ylength 0.25");
+        pEZPlot->ezset ("yporigin 0.50");
+        pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
+        pEZPlot->plot (pSGP);
+      }
 #endif
-       shuffleFourierToNaturalOrder (m_adFilter, m_nFilterPoints);
+      shuffleFourierToNaturalOrder (m_adFilter, m_nFilterPoints);
 #ifdef HAVE_SGP
-       if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
-         pEZPlot->ezset ("title Inverse Fourier Frequency: Natural Order");
-         pEZPlot->ezset ("ylength 0.25");
-         pEZPlot->ezset ("yporigin 0.75");
-         pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
-         pEZPlot->plot();
-         delete pEZPlot;
-       }
+      if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
+        pEZPlot->ezset ("title Inverse Fourier Frequency: Natural Order");
+        pEZPlot->ezset ("ylength 0.25");
+        pEZPlot->ezset ("yporigin 0.75");
+        pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
+        pEZPlot->plot (pSGP);
+        delete pEZPlot;
+      }
 #endif
-       for (i = 0; i < m_nFilterPoints; i++) {
-           m_adFilter[i] /= m_dSignalInc;
-       }
+      for (i = 0; i < m_nFilterPoints; i++) {
+        m_adFilter[i] /= m_dSignalInc;
+      }
     }
     if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) {
-       for (i = 0; i < m_nFilterPoints; i++)
-           m_adFilter[i] *= 0.5;
+      for (i = 0; i < m_nFilterPoints; i++)
+        m_adFilter[i] *= 0.5;
     } else if (m_idGeometry == Scanner::GEOMETRY_EQUIANGULAR) {
-       for (i = 0; i < m_nFilterPoints; i++) {
-         int iDetFromZero = i - ((m_nFilterPoints - 1) / 2);
-         double sinScale = sin (iDetFromZero * m_dSignalInc);
-         if (fabs(sinScale) < 1E-7)
-             sinScale = 1;
-         else
-             sinScale = (iDetFromZero * m_dSignalInc) / sinScale;
-         double dScale = 0.5 * sinScale * sinScale;
-         m_adFilter[i] *= dScale;
-       }
+      for (i = 0; i < m_nFilterPoints; i++) {
+        int iDetFromZero = i - ((m_nFilterPoints - 1) / 2);
+        double sinScale = sin (iDetFromZero * m_dSignalInc);
+        if (fabs(sinScale) < 1E-7)
+          sinScale = 1;
+        else
+          sinScale = (iDetFromZero * m_dSignalInc) / sinScale;
+        double dScale = 0.5 * sinScale * sinScale;
+        m_adFilter[i] *= dScale;
+      }
     } // if (geometry)
   } // if (spatial filtering)
-
+  
   else if (m_bFrequencyFiltering) {  // Frequency-based filtering
-
+    
     if (m_idFilterGeneration == FILTER_GENERATION_DIRECT) {
       // calculate number of filter points with zeropadding
       m_nFilterPoints = m_nSignalPoints;
       if (m_iZeropad > 0) {
-       double logBase2 = log(m_nFilterPoints) / log(2);
-       int nextPowerOf2 = static_cast<int>(floor(logBase2));
-       if (logBase2 != floor(logBase2))
-         nextPowerOf2++;
-       nextPowerOf2 += (m_iZeropad - 1);
-       m_nFilterPoints = 1 << nextPowerOf2;
+        double logBase2 = log(m_nFilterPoints) / log(2);
+        int nextPowerOf2 = static_cast<int>(floor(logBase2));
+        if (logBase2 != floor(logBase2))
+          nextPowerOf2++;
+        nextPowerOf2 += (m_iZeropad - 1);
+        m_nFilterPoints = 1 << nextPowerOf2;
 #ifdef DEBUG
-       if (m_traceLevel >= Trace::TRACE_CONSOLE)
-               std::cout << "nFilterPoints = " << m_nFilterPoints << endl;
+        if (m_traceLevel >= Trace::TRACE_CONSOLE)
+          std::cout << "nFilterPoints = " << m_nFilterPoints << endl;
 #endif
       }
       m_nOutputPoints = m_nFilterPoints * m_iPreinterpolationFactor;
-
+      
       if (m_nFilterPoints % 2) { // Odd
-       m_dFilterMin = -1. / (2 * m_dSignalInc);
-       m_dFilterMax = 1. / (2 * m_dSignalInc);
-       m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (m_nFilterPoints - 1);
+        m_dFilterMin = -1. / (2 * m_dSignalInc);
+        m_dFilterMax = 1. / (2 * m_dSignalInc);
+        m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (m_nFilterPoints - 1);
       } else { // Even
-       m_dFilterMin = -1. / (2 * m_dSignalInc);
-       m_dFilterMax = 1. / (2 * m_dSignalInc);
-       m_dFilterInc = (m_dFilterMax - m_dFilterMin) / m_nFilterPoints;
-       m_dFilterMax -= m_dFilterInc;
+        m_dFilterMin = -1. / (2 * m_dSignalInc);
+        m_dFilterMax = 1. / (2 * m_dSignalInc);
+        m_dFilterInc = (m_dFilterMax - m_dFilterMin) / m_nFilterPoints;
+        m_dFilterMax -= m_dFilterInc;
       }
-
+      
       SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, m_nFilterPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_FREQUENCY);
       m_adFilter = new double [m_nFilterPoints];
       filter.copyFilterData (m_adFilter, 0, m_nFilterPoints);
-
+      
       // This doesn't work!
       // Need to add filtering for divergent geometries & Frequency/Direct filtering
       if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) {
-       for (i = 0; i < m_nFilterPoints; i++)
-         m_adFilter[i] *= 0.5;
+        for (i = 0; i < m_nFilterPoints; i++)
+          m_adFilter[i] *= 0.5;
       } else if (m_idGeometry == Scanner::GEOMETRY_EQUIANGULAR) {
-       for (i = 0; i < m_nFilterPoints; i++) {
-         int iDetFromZero = i - ((m_nFilterPoints - 1) / 2);
-         double sinScale = sin (iDetFromZero * m_dSignalInc);
-         if (fabs(sinScale) < 1E-7)
-           sinScale = 1;
-         else
-           sinScale = (iDetFromZero * m_dSignalInc) / sinScale;
-         double dScale = 0.5 * sinScale * sinScale;
-         m_adFilter[i] *= dScale;
-       }
+        for (i = 0; i < m_nFilterPoints; i++) {
+          int iDetFromZero = i - ((m_nFilterPoints - 1) / 2);
+          double sinScale = sin (iDetFromZero * m_dSignalInc);
+          if (fabs(sinScale) < 1E-7)
+            sinScale = 1;
+          else
+            sinScale = (iDetFromZero * m_dSignalInc) / sinScale;
+          double dScale = 0.5 * sinScale * sinScale;
+          m_adFilter[i] *= dScale;
+        }
       }
 #ifdef HAVE_SGP
       EZPlot* pEZPlot = NULL;
       if (pSGP && m_traceLevel >= Trace::TRACE_PLOT) {
-       pEZPlot = new EZPlot (*pSGP);
-       pEZPlot->ezset ("title Filter Filter: Natural Order");
-       pEZPlot->ezset ("ylength 0.50");
-       pEZPlot->ezset ("yporigin 0.00");
-       pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
-       pEZPlot->plot();
+        pEZPlot = new EZPlot;
+        pEZPlot->ezset ("title Filter Filter: Natural Order");
+        pEZPlot->ezset ("ylength 0.50");
+        pEZPlot->ezset ("yporigin 0.00");
+        pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
+        pEZPlot->plot (pSGP);
       }
 #endif
       shuffleNaturalToFourierOrder (m_adFilter, m_nFilterPoints);
 #ifdef HAVE_SGP
       if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
-       pEZPlot->ezset ("title Filter Filter: Fourier Order");
-       pEZPlot->ezset ("ylength 0.50");
-       pEZPlot->ezset ("yporigin 0.50");
-       pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
-       pEZPlot->plot();
-       delete pEZPlot;
+        pEZPlot->ezset ("title Filter Filter: Fourier Order");
+        pEZPlot->ezset ("ylength 0.50");
+        pEZPlot->ezset ("yporigin 0.50");
+        pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
+        pEZPlot->plot (pSGP);
+        delete pEZPlot;
       }
 #endif
     } else if (m_idFilterGeneration == FILTER_GENERATION_INVERSE_FOURIER) {
@@ -323,17 +323,17 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw
       m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (nSpatialPoints - 1);
       m_nFilterPoints = nSpatialPoints;
       if (m_iZeropad > 0) {
-       double logBase2 = log(nSpatialPoints) / log(2);
-       int nextPowerOf2 = static_cast<int>(floor(logBase2));
-       if (logBase2 != floor(logBase2))
-         nextPowerOf2++;
-       nextPowerOf2 += (m_iZeropad - 1);
-       m_nFilterPoints = 1 << nextPowerOf2;
+        double logBase2 = log(nSpatialPoints) / log(2);
+        int nextPowerOf2 = static_cast<int>(floor(logBase2));
+        if (logBase2 != floor(logBase2))
+          nextPowerOf2++;
+        nextPowerOf2 += (m_iZeropad - 1);
+        m_nFilterPoints = 1 << nextPowerOf2;
       }
       m_nOutputPoints = m_nFilterPoints * m_iPreinterpolationFactor;
 #ifdef DEBUG
       if (m_traceLevel >= Trace::TRACE_CONSOLE)
-                 std::cout << "nFilterPoints = " << m_nFilterPoints << endl;
+        std::cout << "nFilterPoints = " << m_nFilterPoints << endl;
 #endif
       double* adSpatialFilter = new double [m_nFilterPoints];\r
       SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, nSpatialPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_SPATIAL);
@@ -341,48 +341,48 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw
 #ifdef HAVE_SGP
       EZPlot* pEZPlot = NULL;
       if (pSGP && m_traceLevel >= Trace::TRACE_PLOT) {
-       pEZPlot = new EZPlot (*pSGP);
-       pEZPlot->ezset ("title Spatial Filter: Natural Order");
-       pEZPlot->ezset ("ylength 0.50");
-       pEZPlot->ezset ("yporigin 0.00");
-       pEZPlot->addCurve (adSpatialFilter, nSpatialPoints);
-       pEZPlot->plot();
-       delete pEZPlot;
+        pEZPlot = new EZPlot;
+        pEZPlot->ezset ("title Spatial Filter: Natural Order");
+        pEZPlot->ezset ("ylength 0.50");
+        pEZPlot->ezset ("yporigin 0.00");
+        pEZPlot->addCurve (adSpatialFilter, nSpatialPoints);
+        pEZPlot->plot (pSGP);
+        delete pEZPlot;
       }
 #endif
       if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) {
-       for (i = 0; i < m_nFilterPoints; i++)
-         adSpatialFilter[i] *= 0.5;
+        for (i = 0; i < m_nFilterPoints; i++)
+          adSpatialFilter[i] *= 0.5;
       } else if (m_idGeometry == Scanner::GEOMETRY_EQUIANGULAR) {
-       for (i = 0; i < m_nFilterPoints; i++) {
-         int iDetFromZero = i - ((m_nFilterPoints - 1) / 2);
-         double sinScale = sin (iDetFromZero * m_dSignalInc);
-         if (fabs(sinScale) < 1E-7)
-           sinScale = 1;
-         else
-           sinScale = (iDetFromZero * m_dSignalInc) / sinScale;
-         double dScale = 0.5 * sinScale * sinScale;
-         adSpatialFilter[i] *= dScale;
-       }
+        for (i = 0; i < m_nFilterPoints; i++) {
+          int iDetFromZero = i - ((m_nFilterPoints - 1) / 2);
+          double sinScale = sin (iDetFromZero * m_dSignalInc);
+          if (fabs(sinScale) < 1E-7)
+            sinScale = 1;
+          else
+            sinScale = (iDetFromZero * m_dSignalInc) / sinScale;
+          double dScale = 0.5 * sinScale * sinScale;
+          adSpatialFilter[i] *= dScale;
+        }
       }\r
       for (i = nSpatialPoints; i < m_nFilterPoints; i++)
-       adSpatialFilter[i] = 0;
-
+        adSpatialFilter[i] = 0;
+      
       m_adFilter = new double [m_nFilterPoints];
       std::complex<double>* acInverseFilter = new std::complex<double> [m_nFilterPoints];\r
       finiteFourierTransform (adSpatialFilter, acInverseFilter, m_nFilterPoints, 1);
-       delete adSpatialFilter;\r
-       for (i = 0; i < m_nFilterPoints; i++)
-               m_adFilter[i] = std::abs(acInverseFilter[i]) * m_dSignalInc;
-       delete acInverseFilter;\r
+      delete adSpatialFilter;\r
+      for (i = 0; i < m_nFilterPoints; i++)
+        m_adFilter[i] = std::abs(acInverseFilter[i]) * m_dSignalInc;
+      delete acInverseFilter;\r
 #ifdef HAVE_SGP
       if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
-       pEZPlot->ezset ("title Spatial Filter: Inverse");
-       pEZPlot->ezset ("ylength 0.50");
-       pEZPlot->ezset ("yporigin 0.50");
-       pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
-       pEZPlot->plot();
-       delete pEZPlot;\r
+        pEZPlot->ezset ("title Spatial Filter: Inverse");
+        pEZPlot->ezset ("ylength 0.50");
+        pEZPlot->ezset ("yporigin 0.50");
+        pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
+        pEZPlot->plot (pSGP);
+        delete pEZPlot;\r
       }
 #endif
     }
@@ -401,13 +401,13 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw
       angle += angleIncrement;
     }
   }
-
+  
 #if HAVE_FFTW
   if (m_idFilterMethod == FILTER_METHOD_FFTW || m_idFilterMethod == FILTER_METHOD_RFFTW) {
     for (i = 0; i < m_nFilterPoints; i++)  //fftw uses unnormalized fft
       m_adFilter[i] /= m_nFilterPoints;
   }
-
+  
   if (m_idFilterMethod == FILTER_METHOD_RFFTW) {
     m_realPlanForward = rfftw_create_plan (m_nFilterPoints, FFTW_REAL_TO_COMPLEX, FFTW_ESTIMATE);
     m_realPlanBackward = rfftw_create_plan (m_nOutputPoints, FFTW_COMPLEX_TO_REAL, FFTW_ESTIMATE);
@@ -431,23 +431,23 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw
 
 ProcessSignal::~ProcessSignal (void)
 {
-    delete [] m_adFourierSinTable;
-    delete [] m_adFourierCosTable;
-    delete [] m_adFilter;
-
+  delete [] m_adFourierSinTable;
+  delete [] m_adFourierCosTable;
+  delete [] m_adFilter;
+  
 #if HAVE_FFTW
-    if (m_idFilterMethod == FILTER_METHOD_FFTW) {
-       fftw_destroy_plan(m_complexPlanForward);
-       fftw_destroy_plan(m_complexPlanBackward);
-       delete [] m_adComplexFftInput;
-       delete [] m_adComplexFftSignal;
-    }
-    if (m_idFilterMethod == FILTER_METHOD_RFFTW) {
-       rfftw_destroy_plan(m_realPlanForward);
-       rfftw_destroy_plan(m_realPlanBackward);
-       delete [] m_adRealFftInput;
-       delete [] m_adRealFftSignal;
-    }
+  if (m_idFilterMethod == FILTER_METHOD_FFTW) {
+    fftw_destroy_plan(m_complexPlanForward);
+    fftw_destroy_plan(m_complexPlanBackward);
+    delete [] m_adComplexFftInput;
+    delete [] m_adComplexFftSignal;
+  }
+  if (m_idFilterMethod == FILTER_METHOD_RFFTW) {
+    rfftw_destroy_plan(m_realPlanForward);
+    rfftw_destroy_plan(m_realPlanBackward);
+    delete [] m_adRealFftInput;
+    delete [] m_adRealFftSignal;
+  }
 #endif
 }
 
@@ -455,24 +455,24 @@ int
 ProcessSignal::convertFilterMethodNameToID (const char* const filterMethodName)
 {
   int fmID = FILTER_METHOD_INVALID;
-
+  
   for (int i = 0; i < s_iFilterMethodCount; i++)
-   if (strcasecmp (filterMethodName, s_aszFilterMethodName[i]) == 0) {
+    if (strcasecmp (filterMethodName, s_aszFilterMethodName[i]) == 0) {
       fmID = i;
       break;
     }
-
-  return (fmID);
+    
+    return (fmID);
 }
 
 const char *
 ProcessSignal::convertFilterMethodIDToName (const int fmID)
 {
   static const char *name = "";
-
+  
   if (fmID >= 0 && fmID < s_iFilterMethodCount)
-      return (s_aszFilterMethodName [fmID]);
-
+    return (s_aszFilterMethodName [fmID]);
+  
   return (name);
 }
 
@@ -480,10 +480,10 @@ const char *
 ProcessSignal::convertFilterMethodIDToTitle (const int fmID)
 {
   static const char *title = "";
-
+  
   if (fmID >= 0 && fmID < s_iFilterMethodCount)
-      return (s_aszFilterMethodTitle [fmID]);
-
+    return (s_aszFilterMethodTitle [fmID]);
+  
   return (title);
 }
 
@@ -492,24 +492,24 @@ int
 ProcessSignal::convertFilterGenerationNameToID (const char* const fgName)
 {
   int fgID = FILTER_GENERATION_INVALID;
-
+  
   for (int i = 0; i < s_iFilterGenerationCount; i++)
-   if (strcasecmp (fgName, s_aszFilterGenerationName[i]) == 0) {
+    if (strcasecmp (fgName, s_aszFilterGenerationName[i]) == 0) {
       fgID = i;
       break;
     }
-
-  return (fgID);
+    
+    return (fgID);
 }
 
 const char *
 ProcessSignal::convertFilterGenerationIDToName (const int fgID)
 {
   static const char *name = "";
-
+  
   if (fgID >= 0 && fgID < s_iFilterGenerationCount)
-      return (s_aszFilterGenerationName [fgID]);
-
+    return (s_aszFilterGenerationName [fgID]);
+  
   return (name);
 }
 
@@ -517,10 +517,10 @@ const char *
 ProcessSignal::convertFilterGenerationIDToTitle (const int fgID)
 {
   static const char *name = "";
-
+  
   if (fgID >= 0 && fgID < s_iFilterGenerationCount)
-      return (s_aszFilterGenerationTitle [fgID]);
-
+    return (s_aszFilterGenerationTitle [fgID]);
+  
   return (name);
 }
 
@@ -531,7 +531,7 @@ ProcessSignal::filterSignal (const float constInput[], double output[]) const
   int i;\r
   for (i = 0; i < m_nSignalPoints; i++)
     input[i] = constInput[i];
-
+  
   if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) {
     for (int i = 0; i < m_nSignalPoints; i++) {
       int iDetFromCenter = i - (m_nSignalPoints / 2);
@@ -544,8 +544,8 @@ ProcessSignal::filterSignal (const float constInput[], double output[]) const
     }
   }\r
   if (m_idFilterMethod == FILTER_METHOD_CONVOLUTION) {
-      for (i = 0; i < m_nSignalPoints; i++)
-       output[i] = convolve (input, m_dSignalInc, i, m_nSignalPoints);
+    for (i = 0; i < m_nSignalPoints; i++)
+      output[i] = convolve (input, m_dSignalInc, i, m_nSignalPoints);
   } else if (m_idFilterMethod == FILTER_METHOD_FOURIER) {
     double* inputSignal = new double [m_nFilterPoints];
     for (i = 0; i < m_nSignalPoints; i++)
@@ -554,15 +554,15 @@ ProcessSignal::filterSignal (const float constInput[], double output[]) const
       inputSignal[i] = 0;  // zeropad
     std::complex<double>* fftSignal = new std::complex<double> [m_nFilterPoints];
     finiteFourierTransform (inputSignal, fftSignal, m_nFilterPoints, -1);\r
-       delete inputSignal;
+    delete inputSignal;
     for (i = 0; i < m_nFilterPoints; i++)
       fftSignal[i] *= m_adFilter[i];
     double* inverseFourier = new double [m_nFilterPoints];
     finiteFourierTransform (fftSignal, inverseFourier, m_nFilterPoints, 1);\r
-       delete fftSignal;
+    delete fftSignal;
     for (i = 0; i < m_nSignalPoints; i++) 
       output[i] = inverseFourier[i];\r
-       delete inverseFourier;
+    delete inverseFourier;
   } else if (m_idFilterMethod == FILTER_METHOD_FOURIER_TABLE) {
     double* inputSignal = new double [m_nFilterPoints];
     for (i = 0; i < m_nSignalPoints; i++)
@@ -571,50 +571,50 @@ ProcessSignal::filterSignal (const float constInput[], double output[]) const
       inputSignal[i] = 0;  // zeropad
     std::complex<double>* fftSignal = new std::complex<double> [m_nFilterPoints];
     finiteFourierTransform (inputSignal, fftSignal, -1);\r
-       delete inputSignal;
+    delete inputSignal;
     for (i = 0; i < m_nFilterPoints; i++)
       fftSignal[i] *= m_adFilter[i];
     double* inverseFourier = new double [m_nFilterPoints];
     finiteFourierTransform (fftSignal, inverseFourier, 1);\r
-       delete fftSignal;
+    delete fftSignal;
     for (i = 0; i < m_nSignalPoints; i++) 
       output[i] = inverseFourier[i];\r
-       delete inverseFourier;
+    delete inverseFourier;
   }
 #if HAVE_FFTW
   else if (m_idFilterMethod == FILTER_METHOD_RFFTW) {
-      for (i = 0; i < m_nSignalPoints; i++)
-         m_adRealFftInput[i] = input[i];
-
-      fftw_real* fftOutput = new fftw_real [ m_nFilterPoints ];
-      rfftw_one (m_realPlanForward, m_adRealFftInput, fftOutput);
-      for (i = 0; i < m_nFilterPoints; i++)
-           m_adRealFftSignal[i] = m_adFilter[i] * fftOutput[i];\r
-         delete [] fftOutput;
-      for (i = m_nFilterPoints; i < m_nOutputPoints; i++)
+    for (i = 0; i < m_nSignalPoints; i++)
+      m_adRealFftInput[i] = input[i];
+    
+    fftw_real* fftOutput = new fftw_real [ m_nFilterPoints ];
+    rfftw_one (m_realPlanForward, m_adRealFftInput, fftOutput);
+    for (i = 0; i < m_nFilterPoints; i++)
+      m_adRealFftSignal[i] = m_adFilter[i] * fftOutput[i];\r
+    delete [] fftOutput;
+    for (i = m_nFilterPoints; i < m_nOutputPoints; i++)
             m_adRealFftSignal[i] = 0;
-
-      fftw_real* ifftOutput = new fftw_real [ m_nOutputPoints ];
-      rfftw_one (m_realPlanBackward, m_adRealFftSignal, ifftOutput);
-      for (i = 0; i < m_nSignalPoints * m_iPreinterpolationFactor; i++)
-           output[i] = ifftOutput[i];\r
-         delete [] ifftOutput;
+    
+    fftw_real* ifftOutput = new fftw_real [ m_nOutputPoints ];
+    rfftw_one (m_realPlanBackward, m_adRealFftSignal, ifftOutput);
+    for (i = 0; i < m_nSignalPoints * m_iPreinterpolationFactor; i++)
+      output[i] = ifftOutput[i];\r
+    delete [] ifftOutput;
   } else if (m_idFilterMethod == FILTER_METHOD_FFTW) {
-      for (i = 0; i < m_nSignalPoints; i++)
-         m_adComplexFftInput[i].re = input[i];
-
-      fftw_complex* fftOutput = new fftw_complex [ m_nFilterPoints ];
-      fftw_one (m_complexPlanForward, m_adComplexFftInput, fftOutput);
-      for (i = 0; i < m_nFilterPoints; i++) {
-         m_adComplexFftSignal[i].re = m_adFilter[i] * fftOutput[i].re;
-         m_adComplexFftSignal[i].im = m_adFilter[i] * fftOutput[i].im;
-      }\r
-         delete [] fftOutput;
-      fftw_complex* ifftOutput = new fftw_complex [ m_nOutputPoints ];
-      fftw_one (m_complexPlanBackward, m_adComplexFftSignal, ifftOutput);
-      for (i = 0; i < m_nSignalPoints * m_iPreinterpolationFactor; i++) 
-         output[i] = ifftOutput[i].re;\r
-         delete [] ifftOutput;
+    for (i = 0; i < m_nSignalPoints; i++)
+      m_adComplexFftInput[i].re = input[i];
+    
+    fftw_complex* fftOutput = new fftw_complex [ m_nFilterPoints ];
+    fftw_one (m_complexPlanForward, m_adComplexFftInput, fftOutput);
+    for (i = 0; i < m_nFilterPoints; i++) {
+      m_adComplexFftSignal[i].re = m_adFilter[i] * fftOutput[i].re;
+      m_adComplexFftSignal[i].im = m_adFilter[i] * fftOutput[i].im;
+    }\r
+    delete [] fftOutput;
+    fftw_complex* ifftOutput = new fftw_complex [ m_nOutputPoints ];
+    fftw_one (m_complexPlanBackward, m_adComplexFftSignal, ifftOutput);
+    for (i = 0; i < m_nSignalPoints * m_iPreinterpolationFactor; i++) 
+      output[i] = ifftOutput[i].re;\r
+    delete [] ifftOutput;
   }
 #endif\r
   delete input;
@@ -622,36 +622,36 @@ ProcessSignal::filterSignal (const float constInput[], double output[]) const
 
 
 /* NAME
- *    convolve                 Discrete convolution of two functions
- *
- * SYNOPSIS
- *    r = convolve (f1, f2, dx, n, np, func_type)
- *    double r                 Convolved result
- *    double f1[], f2[]                Functions to be convolved
- *    double dx                        Difference between successive x values
- *    int n                    Array index to center convolution about
- *    int np                   Number of points in f1 array
- *    int func_type            EVEN or ODD or EVEN_AND_ODD function f2
- *
- * NOTES
- *    f1 is the projection data, its indices range from 0 to np - 1.
- *    The index for f2, the filter, ranges from -(np-1) to (np-1).
- *    There are 3 ways to handle the negative vertices of f2:
- *     1. If we know f2 is an EVEN function, then f2[-n] = f2[n].
- *        All filters used in reconstruction are even.
- *      2. If we know f2 is an ODD function, then f2[-n] = -f2[n] 
- *      3. If f2 is both ODD AND EVEN, then we must store the value of f2
- *        for negative indices.  Since f2 must range from -(np-1) to (np-1),
- *        if we add (np - 1) to f2's array index, then f2's index will
- *        range from 0 to 2 * (np - 1), and the origin, x = 0, will be
- *        stored at f2[np-1].
- */
+*    convolve                  Discrete convolution of two functions
+*
+* SYNOPSIS
+*    r = convolve (f1, f2, dx, n, np, func_type)
+*    double r                  Convolved result
+*    double f1[], f2[]         Functions to be convolved
+*    double dx                 Difference between successive x values
+*    int n                     Array index to center convolution about
+*    int np                    Number of points in f1 array
+*    int func_type             EVEN or ODD or EVEN_AND_ODD function f2
+*
+* NOTES
+*    f1 is the projection data, its indices range from 0 to np - 1.
+*    The index for f2, the filter, ranges from -(np-1) to (np-1).
+*    There are 3 ways to handle the negative vertices of f2:
+     1. If we know f2 is an EVEN function, then f2[-n] = f2[n].
+        All filters used in reconstruction are even.
+*      2. If we know f2 is an ODD function, then f2[-n] = -f2[n] 
+*      3. If f2 is both ODD AND EVEN, then we must store the value of f2
+        for negative indices.  Since f2 must range from -(np-1) to (np-1),
+        if we add (np - 1) to f2's array index, then f2's index will
+        range from 0 to 2 * (np - 1), and the origin, x = 0, will be
+        stored at f2[np-1].
+*/
 
 double 
 ProcessSignal::convolve (const double func[], const double dx, const int n, const int np) const
 {
   double sum = 0.0;
-
+  
 #if UNOPTIMIZED_CONVOLUTION
   for (int i = 0; i < np; i++)
     sum += func[i] * m_adFilter[n - i + (np - 1)];
@@ -660,7 +660,7 @@ ProcessSignal::convolve (const double func[], const double dx, const int n, cons
   for (int i = 0; i < np; i++)
     sum += *func++ * *f2--;
 #endif
-
+  
   return (sum * dx);
 }
 
@@ -669,16 +669,16 @@ double
 ProcessSignal::convolve (const float func[], const double dx, const int n, const int np) const
 {
   double sum = 0.0;
-
+  
 #if UNOPTIMIZED_CONVOLUTION
-for (int i = 0; i < np; i++)
-  sum += func[i] * m_adFilter[n - i + (np - 1)];
+  for (int i = 0; i < np; i++)
+    sum += func[i] * m_adFilter[n - i + (np - 1)];
 #else
-double* f2 = m_adFilter + n + (np - 1);
-for (int i = 0; i < np; i++)
-  sum += *func++ * *f2--;
+  double* f2 = m_adFilter + n + (np - 1);
+  for (int i = 0; i < np; i++)
+    sum += *func++ * *f2--;
 #endif
-
+  
   return (sum * dx);
 }
 
@@ -686,12 +686,12 @@ for (int i = 0; i < np; i++)
 void
 ProcessSignal::finiteFourierTransform (const double input[], double output[], const int n, int direction)
 {
-    std::complex<double>* complexOutput = new std::complex<double> [n];
-
-    finiteFourierTransform (input, complexOutput, n, direction);
-    for (int i = 0; i < n; i++)
-       output[i] = complexOutput[i].real();\r
-       delete [] complexOutput;
+  std::complex<double>* complexOutput = new std::complex<double> [n];
+  
+  finiteFourierTransform (input, complexOutput, n, direction);
+  for (int i = 0; i < n; i++)
+    output[i] = complexOutput[i].real();\r
+  delete [] complexOutput;
 }
 
 void
@@ -701,7 +701,7 @@ ProcessSignal::finiteFourierTransform (const double input[], std::complex<double
     direction = -1;
   else 
     direction = 1;
-    
+  
   double angleIncrement = direction * 2 * PI / n;
   for (int i = 0; i < n; i++) {
     double sumReal = 0;
@@ -727,7 +727,7 @@ ProcessSignal::finiteFourierTransform (const std::complex<double> input[], std::
     direction = -1;
   else 
     direction = 1;
-    
+  
   double angleIncrement = direction * 2 * PI / n;
   for (int i = 0; i < n; i++) {
     std::complex<double> sum (0,0);
@@ -750,10 +750,10 @@ ProcessSignal::finiteFourierTransform (const std::complex<double> input[], doubl
     direction = -1;
   else 
     direction = 1;
-    
+  
   double angleIncrement = direction * 2 * PI / n;
   for (int i = 0; i < n; i++) {
-      double sumReal = 0;
+    double sumReal = 0;
     for (int j = 0; j < n; j++) {
       double angle = i * j * angleIncrement;
       sumReal += input[j].real() * cos(angle) - input[j].imag() * sin(angle);
@@ -774,17 +774,17 @@ ProcessSignal::finiteFourierTransform (const double input[], std::complex<double
     direction = -1;
   else 
     direction = 1;
-    
+  
   for (int i = 0; i < m_nFilterPoints; i++) {
     double sumReal = 0, sumImag = 0;
     for (int j = 0; j < m_nFilterPoints; j++) {
       int tableIndex = i * j;
       if (direction > 0) {
-       sumReal += input[j] * m_adFourierCosTable[tableIndex];
-       sumImag += input[j] * m_adFourierSinTable[tableIndex];
+        sumReal += input[j] * m_adFourierCosTable[tableIndex];
+        sumImag += input[j] * m_adFourierSinTable[tableIndex];
       } else {
-       sumReal += input[j] * m_adFourierCosTable[tableIndex];
-       sumImag -= input[j] * m_adFourierSinTable[tableIndex];
+        sumReal += input[j] * m_adFourierCosTable[tableIndex];
+        sumImag -= input[j] * m_adFourierSinTable[tableIndex];
       }
     }
     if (direction < 0) {
@@ -803,21 +803,21 @@ ProcessSignal::finiteFourierTransform (const std::complex<double> input[], std::
     direction = -1;
   else 
     direction = 1;
-    
+  
   for (int i = 0; i < m_nFilterPoints; i++) {
     double sumReal = 0, sumImag = 0;
     for (int j = 0; j < m_nFilterPoints; j++) {
       int tableIndex = i * j;
       if (direction > 0) {
-       sumReal += input[j].real() * m_adFourierCosTable[tableIndex] 
-         - input[j].imag() * m_adFourierSinTable[tableIndex];
-       sumImag += input[j].real() * m_adFourierSinTable[tableIndex]
-         + input[j].imag() * m_adFourierCosTable[tableIndex];
+        sumReal += input[j].real() * m_adFourierCosTable[tableIndex] 
+          - input[j].imag() * m_adFourierSinTable[tableIndex];
+        sumImag += input[j].real() * m_adFourierSinTable[tableIndex]
+          + input[j].imag() * m_adFourierCosTable[tableIndex];
       } else {
-       sumReal += input[j].real() * m_adFourierCosTable[tableIndex] 
-         - input[j].imag() * -m_adFourierSinTable[tableIndex];
-       sumImag += input[j].real() * -m_adFourierSinTable[tableIndex]
-         + input[j].imag() * m_adFourierCosTable[tableIndex];
+        sumReal += input[j].real() * m_adFourierCosTable[tableIndex] 
+          - input[j].imag() * -m_adFourierSinTable[tableIndex];
+        sumImag += input[j].real() * -m_adFourierSinTable[tableIndex]
+          + input[j].imag() * m_adFourierCosTable[tableIndex];
       }
     }
     if (direction < 0) {
@@ -835,17 +835,17 @@ ProcessSignal::finiteFourierTransform (const std::complex<double> input[], doubl
     direction = -1;
   else 
     direction = 1;
-    
+  
   for (int i = 0; i < m_nFilterPoints; i++) {
-      double sumReal = 0;
+    double sumReal = 0;
     for (int j = 0; j < m_nFilterPoints; j++) {
       int tableIndex = i * j;
       if (direction > 0) {
-       sumReal += input[j].real() * m_adFourierCosTable[tableIndex] 
-         - input[j].imag() * m_adFourierSinTable[tableIndex];
+        sumReal += input[j].real() * m_adFourierCosTable[tableIndex] 
+          - input[j].imag() * m_adFourierSinTable[tableIndex];
       } else {
-       sumReal += input[j].real() * m_adFourierCosTable[tableIndex] 
-         - input[j].imag() * -m_adFourierSinTable[tableIndex];
+        sumReal += input[j].real() * m_adFourierCosTable[tableIndex] 
+          - input[j].imag() * -m_adFourierSinTable[tableIndex];
       }
     }
     if (direction < 0) {
@@ -862,58 +862,112 @@ ProcessSignal::finiteFourierTransform (const std::complex<double> input[], doubl
 //   Natural Frequency Order: -n/2...-1,0,1...((n/2)-1)
 //   Fourier Frequency Order: 0,1...((n/2)-1),-n/2...-1
 
-void
-ProcessSignal::shuffleNaturalToFourierOrder (double* pdVector, const int n)
-{
+void\r
+ProcessSignal::shuffleNaturalToFourierOrder (double* pdVector, const int n)\r
+{\r
   double* pdTemp = new double [n];\r
-  int i;
-  if (n % 2) { // Odd
-    int iHalfN = (n - 1) / 2;
-    
-    pdTemp[0] = pdVector[iHalfN];
-    for (i = 0; i < iHalfN; i++)
-      pdTemp[i + 1] = pdVector[i + 1 + iHalfN];
-    for (i = 0; i < iHalfN; i++)
-      pdTemp[i + iHalfN + 1] = pdVector[i];
-  } else {     // Even
-      int iHalfN = n / 2;
-      pdTemp[0] = pdVector[iHalfN];
-      for (i = 0; i < iHalfN; i++)
-       pdTemp[i + 1] = pdVector[i + iHalfN];
-      for (i = 0; i < iHalfN - 1; i++)
-       pdTemp[i + iHalfN + 1] = pdVector[i];
-  }
-
-  for (i = 0; i < n; i++)
-    pdVector[i] = pdTemp[i];
-  delete pdTemp;
-}
-
-
-void
-ProcessSignal::shuffleFourierToNaturalOrder (double* pdVector, const int n)
-{
+  int i;\r
+  if (n % 2) { // Odd\r
+    int iHalfN = (n - 1) / 2;\r
+    \r
+    pdTemp[0] = pdVector[iHalfN];\r
+    for (i = 0; i < iHalfN; i++)\r
+      pdTemp[i + 1] = pdVector[i + 1 + iHalfN];\r
+    for (i = 0; i < iHalfN; i++)\r
+      pdTemp[i + iHalfN + 1] = pdVector[i];\r
+  } else {     // Even\r
+    int iHalfN = n / 2;\r
+    pdTemp[0] = pdVector[iHalfN];\r
+    for (i = 0; i < iHalfN; i++)\r
+      pdTemp[i + 1] = pdVector[i + iHalfN];\r
+    for (i = 0; i < iHalfN - 1; i++)\r
+      pdTemp[i + iHalfN + 1] = pdVector[i];\r
+  }\r
+  \r
+  for (i = 0; i < n; i++)\r
+    pdVector[i] = pdTemp[i];\r
+  delete pdTemp;\r
+}\r
+\r
+void\r
+ProcessSignal::shuffleNaturalToFourierOrder (std::complex<double>* pdVector, const int n)\r
+{\r
+  std::complex<double>* pdTemp = new std::complex<double> [n];\r
+  int i;\r
+  if (n % 2) { // Odd\r
+    int iHalfN = (n - 1) / 2;\r
+    \r
+    pdTemp[0] = pdVector[iHalfN];\r
+    for (i = 0; i < iHalfN; i++)\r
+      pdTemp[i + 1] = pdVector[i + 1 + iHalfN];\r
+    for (i = 0; i < iHalfN; i++)\r
+      pdTemp[i + iHalfN + 1] = pdVector[i];\r
+  } else {     // Even\r
+    int iHalfN = n / 2;\r
+    pdTemp[0] = pdVector[iHalfN];\r
+    for (i = 0; i < iHalfN; i++)\r
+      pdTemp[i + 1] = pdVector[i + iHalfN];\r
+    for (i = 0; i < iHalfN - 1; i++)\r
+      pdTemp[i + iHalfN + 1] = pdVector[i];\r
+  }\r
+  \r
+  for (i = 0; i < n; i++)\r
+    pdVector[i] = pdTemp[i];\r
+  delete [] pdTemp;\r
+}\r
+\r
+
+void\r
+ProcessSignal::shuffleFourierToNaturalOrder (double* pdVector, const int n)\r
+{\r
   double* pdTemp = new double [n];\r
-  int i;
-  if (n % 2) { // Odd
-    int iHalfN = (n - 1) / 2;
-    
+  int i;\r
+  if (n % 2) { // Odd\r
+    int iHalfN = (n - 1) / 2;\r
+    \r
     pdTemp[iHalfN] = pdVector[0];\r
-       for (i = 0; i < iHalfN; i++)
-      pdTemp[i + 1 + iHalfN] = pdVector[i + 1];
-    for (i = 0; i < iHalfN; i++)
-      pdTemp[i] = pdVector[i + iHalfN + 1];
-  } else {     // Even
-      int iHalfN = n / 2;
-      pdTemp[iHalfN] = pdVector[0];
-      for (i = 0; i < iHalfN; i++)
-       pdTemp[i] = pdVector[i + iHalfN];
-      for (i = 0; i < iHalfN - 1; i++)
-       pdTemp[i + iHalfN + 1] = pdVector[i+1];
-  }
-
-  for (i = 0; i < n; i++)
-    pdVector[i] = pdTemp[i];
-  delete pdTemp;
-}
-
+    for (i = 0; i < iHalfN; i++)\r
+      pdTemp[i + 1 + iHalfN] = pdVector[i + 1];\r
+    for (i = 0; i < iHalfN; i++)\r
+      pdTemp[i] = pdVector[i + iHalfN + 1];\r
+  } else {     // Even\r
+    int iHalfN = n / 2;\r
+    pdTemp[iHalfN] = pdVector[0];\r
+    for (i = 0; i < iHalfN; i++)\r
+      pdTemp[i] = pdVector[i + iHalfN];\r
+    for (i = 0; i < iHalfN - 1; i++)\r
+      pdTemp[i + iHalfN + 1] = pdVector[i+1];\r
+  }\r
+  \r
+  for (i = 0; i < n; i++)\r
+    pdVector[i] = pdTemp[i];\r
+  delete pdTemp;\r
+}\r
+\r
+void\r
+ProcessSignal::shuffleFourierToNaturalOrder (std::complex<double>* pdVector, const int n)\r
+{\r
+  std::complex<double>* pdTemp = new std::complex<double> [n];\r
+  int i;\r
+  if (n % 2) { // Odd\r
+    int iHalfN = (n - 1) / 2;\r
+    \r
+    pdTemp[iHalfN] = pdVector[0];\r
+    for (i = 0; i < iHalfN; i++)\r
+      pdTemp[i + 1 + iHalfN] = pdVector[i + 1];\r
+    for (i = 0; i < iHalfN; i++)\r
+      pdTemp[i] = pdVector[i + iHalfN + 1];\r
+  } else {     // Even\r
+    int iHalfN = n / 2;\r
+    pdTemp[iHalfN] = pdVector[0];\r
+    for (i = 0; i < iHalfN; i++)\r
+      pdTemp[i] = pdVector[i + iHalfN];\r
+    for (i = 0; i < iHalfN - 1; i++)\r
+      pdTemp[i + iHalfN + 1] = pdVector[i+1];\r
+  }\r
+  \r
+  for (i = 0; i < n; i++)\r
+    pdVector[i] = pdTemp[i];\r
+  delete [] pdTemp;\r
+}\r
+\r
index ded9420ca6c6ef30477ff73c2e708ff2f6866410..df456214c7b2a4066e7d9caa986c5eff9591d352 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: reconstruct.cpp,v 1.5 2000/12/17 22:30:34 kevin Exp $
+**  $Id: reconstruct.cpp,v 1.6 2000/12/29 15:45:06 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
@@ -117,11 +117,11 @@ Reconstructor::plotFilter (SGP* pSGP)
       adPlotXAxis[i] = f;
 
     if (m_pProcessSignal->getFilter()) {
-      EZPlot ezplot (*pSGP);
+      EZPlot ezplot;
 
       ezplot.ezset ("title Filter Response");
       ezplot.addCurve (adPlotXAxis, m_pProcessSignal->getFilter(), nVecFilter);
-      ezplot.plot();
+      ezplot.plot (pSGP);
     }
   }\r
   delete adPlotXAxis;
@@ -171,7 +171,7 @@ Reconstructor::reconstructView (int iStartView, int iViewCount, SGP* pSGP, bool
 
 #ifdef HAVE_SGP
     if (m_iTrace >= Trace::TRACE_PLOT && pSGP) {
-      EZPlot ezplotProj (*pSGP);
+      EZPlot ezplotProj;
 
       ezplotProj.ezset ("clear");
       ezplotProj.ezset ("title Raw Projection");
@@ -183,7 +183,7 @@ Reconstructor::reconstructView (int iStartView, int iViewCount, SGP* pSGP, bool
       ezplotProj.ezset ("box.");
       ezplotProj.ezset ("grid.");
       ezplotProj.addCurve (m_adPlotXAxis, detval, m_rProj.nDet());
-      ezplotProj.plot();
+      ezplotProj.plot (pSGP);
       ezplotProj.ezset ("clear");
       ezplotProj.ezset ("title Filtered Projection");
       ezplotProj.ezset ("xticks major 5");
@@ -193,7 +193,7 @@ Reconstructor::reconstructView (int iStartView, int iViewCount, SGP* pSGP, bool
       ezplotProj.ezset ("box");
       ezplotProj.ezset ("grid");
       ezplotProj.addCurve (m_adPlotXAxis, adFilteredProj,  m_nFilteredProjections);
-      ezplotProj.plot();
+      ezplotProj.plot (pSGP);
     } 
 #endif  //HAVE_SGP
   }
index 8721de2e9ecfa668bb43527089254289f43dae7c..8468f820743affdc535a49a4809fabcf1d2a94c2 100644 (file)
@@ -2,7 +2,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: syserror.cpp,v 1.9 2000/12/27 20:09:19 kevin Exp $
+**  $Id: syserror.cpp,v 1.10 2000/12/29 15:45:06 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
 #include <exception>
 #include <stdexcept>
 #include <stdarg.h>
-#include <ctype.h>
-#include "ctsupport.h"
+#include <ctype.h>\r
+#include <string>
+#include "ct.h"
 
 
 /* NAME
- *   sys_error                 System error handler
- *
- * SYNOPSIS
- *   sys_error (severity, msg, args . . .)
- *   int severity              Severity of error
- *   char *msg                 Error message
- *   args                      Argument list, direct transfer to printf stack
- *                             Can take 24 byte transfer
- */
-
-static int errorlevel = ERR_WARNING;   /* Set error reporting level */
-
+*   sys_error                  System error handler
+*
+* SYNOPSIS
+*   sys_error (severity, msg, args . . .)
+*   int severity               Severity of error
+*   char *msg                  Error message
+*   args                       Argument list, direct transfer to printf stack
+*                              Can take 24 byte transfer
+*/
+
+static int s_reportErrorLevel = ERR_WARNING;   // Set error reporting level 
+\r
+bool g_bRunningWXWindows = false;
 
 void sys_error (int severity, const char *msg, ...)
 {
   va_list arg;
-
+  
   va_start(arg, msg);
-
-  sys_verror (severity, msg, arg);
+  \r
+  std::string strOutput;
+  sys_verror (strOutput, severity, msg, arg);
+  \r
+//  if (g_bRunningWXWindows)\r
+//    theApp->getLog() << strOutput.c_str();\r
+//  else\r
+    std::cout << strOutput;\r
 
   va_end(arg);
 }
 
-static int nErrorCount = 0;
+static int s_nErrorCount = 0;
 const static int MAX_ERROR_COUNT = 20;
 
 
-void sys_verror (int severity, const char *msg, va_list arg)
+void sys_verror (std::string& strOutput, int severity, const char *msg, va_list arg)
 {
-  if (severity < errorlevel)
-    return;    // ignore error if less than max level
+  if (severity < s_reportErrorLevel)
+    return;    // ignore error if less than reporting level
+  
+  std::ostringstream os;\r
 
-  nErrorCount++;
+  s_nErrorCount++;\r
   if (severity != ERR_FATAL) {
-    if (nErrorCount > MAX_ERROR_COUNT)
+    if (s_nErrorCount > MAX_ERROR_COUNT)
       return;
-    else if (nErrorCount == MAX_ERROR_COUNT) {
-               std::cout << "*****************************************************************\n";
-               std::cout << "***   M A X I M U M   E R R O R   C O U N T   R E A C H E D   ***\n";
-               std::cout << "***                                                           ***\n";
-               std::cout << "***           No further errors will be reported              ***\n";
-               std::cout << "*****************************************************************\n";
+    else if (s_nErrorCount == MAX_ERROR_COUNT) {
+      os << "*****************************************************************\n";
+      os << "***   M A X I M U M   E R R O R   C O U N T   R E A C H E D   ***\n";
+      os << "***                                                           ***\n";
+      os << "***           No further errors will be reported              ***\n";
+      os << "*****************************************************************\n";\r
+      strOutput = os.str();
       return;
     }
   }
-    
+  
   switch (severity) {
   case ERR_FATAL:
-         std::cout << "FATAL ERROR: ";
+    os << "FATAL ERROR: ";
     break;
   case ERR_SEVERE:
-         std::cout << "SEVERE ERROR: ";
+    os << "SEVERE ERROR: ";
     break;
   case ERR_WARNING:
-         std::cout << "WARNING ERROR: ";
+    os << "WARNING ERROR: ";
     break;\r
   case ERR_TRACE:\r
-    std::cout << "Trace: ";\r
+    os << "Trace: ";\r
     break;
   default:
-         std::cout << "Illegal error code #" << severity << ": ";
+    os << "Illegal error severity #" << severity << ": ";
   }
   
-  char errStr[512];\r
+  char errStr[2000];\r
   
 #if HAVE_VSNPRINTF
   vsnprintf (errStr, sizeof(errStr), msg, arg);
@@ -100,57 +111,59 @@ void sys_verror (int severity, const char *msg, va_list arg)
 #else\r
   strncpy (errStr, sizeof(errStr), "Error message not available on this platform.");
 #endif
-
-  std::cout << errStr << std::endl;
+  
+  os << errStr << std::endl;
+  strOutput = os.str();\r
   
   if (severity == ERR_FATAL)
-         throw std::runtime_error (errStr);
+    throw std::runtime_error (errStr);
   
 #if INTERACTIVE_ERROR_DISPLAY
   std::cout << "A - Abort  C - Continue  W - Turn off warnings? ";
   //  fflush(stderr);
   do 
-   {
-      int c = cio_kb_waitc("AaBbCcWw", TRUE);    /* get code from keyboard */
-      c = tolower (c);
-      fputc (c, stderr);
-      fputc (NEWLINE, stderr);
-      
-      if (c == 'a')
-       exit (1);
-      else if (c == 'c')
-       return;
-      else if (c == 'w') 
-       {
-         sys_error_level (ERR_SEVERE); /* report severe & fatal errors */
-         break;
-       }
-    } while (TRUE);
+  {
+    int c = cio_kb_waitc("AaBbCcWw", TRUE);      /* get code from keyboard */
+    c = tolower (c);
+    fputc (c, stderr);
+    fputc (NEWLINE, stderr);
+    
+    if (c == 'a')
+      exit (1);
+    else if (c == 'c')
+      return;
+    else if (c == 'w') 
+    {
+      sys_error_level (ERR_SEVERE);    /* report severe & fatal errors */
+      break;
+    }
+  } while (TRUE);
 #endif
 }
 
 
 /* NAME
- *   sys_error_level                   Set error reporting level
- *
- * SYNOPSIS
- *   sys_error_level (severity)
- *   int severity              Report all error as serious as severity and beyond
- *
- * DESCRIPTION
- *   Causes the system to ignore all error below the level of severity
- *   For example, if severity == ERR_SEVERE, then report severe & fatal
- *   error and ignore warnings
- */
+*   sys_error_level                    Set error reporting level
+*
+* SYNOPSIS
+*   sys_error_level (severity)
+*   int severity               Report all error as serious as severity and beyond
+*
+* DESCRIPTION
+*   Causes the system to ignore all error below the level of severity
+*   For example, if severity == ERR_SEVERE, then report severe & fatal
+*   error and ignore warnings
+*/
 
 void 
 sys_error_level (int severity)
 {
   if (severity == ERR_FATAL ||
-      severity == ERR_SEVERE ||
-      severity == ERR_WARNING)
-    errorlevel = severity;
+    severity == ERR_SEVERE ||
+    severity == ERR_WARNING ||\r
+    severity == ERR_TRACE)
+    s_reportErrorLevel = severity;
   else
-    errorlevel = ERR_WARNING;
+    s_reportErrorLevel = ERR_WARNING;
 }
 
index d695bc3ea1dc801f6939aba9027a15c1b02e8640..1487b055d23143556a8cf1f8d642358934518654 100644 (file)
@@ -6,13 +6,13 @@
 --------------------Configuration: libctsim - Win32 Debug--------------------\r
 </h3>\r
 <h3>Command Lines</h3>\r
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7B.tmp" with contents\r
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP34.tmp" with contents\r
 [\r
 /nologo /G6 /MTd /W3 /Gm /GR /GX /ZI /Od /I "..\..\..\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2\include" /D "_DEBUG" /D "HAVE_WXWIN" /D "HAVE_STRING_H" /D "HAVE_GETOPT_H" /D "WIN32" /D "_MBCS" /D "_LIB" /D "MSVC" /D "HAVE_FFTW" /D "HAVE_PNG" /D "HAVE_SGP" /D "HAVE_WXWINDOWS" /D "__WXMSW__" /FR"Debug/" /Fp"Debug/libctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c \r
-"C:\ctsim-2.0.6\libctgraphics\pol.cpp"\r
+"C:\ctsim-2.0.6\libctsim\imagefile.cpp"\r
 ]\r
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7B.tmp" \r
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7C.tmp" with contents\r
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP34.tmp" \r
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP35.tmp" with contents\r
 [\r
 /nologo /out:"Debug\libctsim.lib" \r
 ".\Debug\array2dfile.obj"\r
@@ -26,6 +26,7 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7C.tmp" with content
 ".\Debug\fnetorderstream.obj"\r
 ".\Debug\getopt.obj"\r
 ".\Debug\getopt1.obj"\r
+".\Debug\hashtable.obj"\r
 ".\Debug\imagefile.obj"\r
 ".\Debug\mathfuncs.obj"\r
 ".\Debug\phantom.obj"\r
@@ -41,24 +42,17 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7C.tmp" with content
 ".\Debug\trace.obj"\r
 ".\Debug\transformmatrix.obj"\r
 ".\Debug\xform.obj"\r
-".\Debug\hashtable.obj"\r
 ]\r
-Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7C.tmp"\r
+Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP35.tmp"\r
 <h3>Output Window</h3>\r
 Compiling...\r
-pol.cpp\r
+imagefile.cpp\r
 Creating library...\r
 <h3>\r
 --------------------Configuration: ctsim - Win32 Debug--------------------\r
 </h3>\r
 <h3>Command Lines</h3>\r
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7D.tmp" with contents\r
-[\r
-/nologo /G6 /MTd /W3 /Gm /GR /GX /ZI /Od /I "\wx2\include" /I "." /I "..\..\include" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\zlib" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /D VERSION=\"2.5.0\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"2.5.0\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c \r
-"C:\ctsim-2.0.6\src\ctsim.cpp"\r
-]\r
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7D.tmp" \r
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7E.tmp" with contents\r
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP36.tmp" with contents\r
 [\r
 comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libctsim/Debug/libctsim.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\lpng108\msvc\win32\libpng\lib_dbg\libpng.lib ..\..\..\lpng108\msvc\win32\zlib\lib_dbg\zlib.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib ../../../wx2/lib/wxd.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrtd.lib" /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"..\..\..\lpng108\msvc\win32\libpng\lib" /libpath:"..\..\..\lpng108\msvc\win32\zlib\lib" \r
 ".\Debug\ctsim.obj"\r
@@ -73,14 +67,9 @@ comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib w
 "\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib"\r
 "\wx2\lib\wxd.lib"\r
 ]\r
-Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7E.tmp"\r
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP36.tmp"\r
 <h3>Output Window</h3>\r
-Compiling...\r
-ctsim.cpp\r
 Linking...\r
-Creating command line "bscmake.exe /nologo /o"Debug/ctsim.bsc"  ".\Debug\ctsim.sbr" ".\Debug\dialogs.sbr" ".\Debug\dlgprojections.sbr" ".\Debug\dlgreconstruct.sbr" ".\Debug\docs.sbr" ".\Debug\views.sbr""\r
-Creating browse info file...\r
-<h3>Output Window</h3>\r
 \r
 \r
 \r
index 24ef0a299f716cbaca41b4660d955e95e5a12055..bbd7f83d55b4b2a59ffbc351da00538fc6f86e6c 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsim.h,v 1.13 2000/12/25 21:54:26 kevin Exp $
+**  $Id: ctsim.h,v 1.14 2000/12/29 15:45:06 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
@@ -147,6 +147,13 @@ enum {
        IFMENU_COMPARE_IMAGES,\r
        IFMENU_COMPARE_ROW,\r
        IFMENU_COMPARE_COL,\r
+  IFMENU_PROCESS_INVERTVALUES,\r
+  IFMENU_PROCESS_SQRT,\r
+  IFMENU_PROCESS_SQUARE,\r
+  IFMENU_PROCESS_LOG,\r
+  IFMENU_PROCESS_EXP,\r
+  IFMENU_PROCESS_FFT_MAGNITUDE,\r
+  IFMENU_PROCESS_FFT_PHASE,\r
     PHMMENU_PROCESS_RASTERIZE,
     PHMMENU_PROCESS_PROJECTIONS,\r
        PLOTMENU_VIEW_SCALE_MINMAX,\r
index a169de8cd6d22018e66931c760b7ec25cfcad77a..489d912b99097fb16eaddef99bac7057f52b3dfb 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: dlgprojections.cpp,v 1.13 2000/12/18 12:29:41 kevin Exp $
+**  $Id: dlgprojections.cpp,v 1.14 2000/12/29 15:45:06 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
@@ -163,13 +163,13 @@ ProjectionsDialog::showView (int iViewNumber)
                        double* detPos = new double [detArray.nDet()];
                        for (int i = 0; i < detArray.nDet(); i++)
                                detPos[i] = i;
-                       EZPlot ezplot (*m_pSGP);
-                       ezplot.ezset("grid");
-                       ezplot.ezset("box");\r
-                       ezplot.ezset("yticks left");
+                       EZPlot ezplot;
+                       ezplot.ezset ("grid");
+                       ezplot.ezset ("box");\r
+                       ezplot.ezset ("yticks left");
                        ezplot.addCurve (detValues, detPos, detArray.nDet());\r
                        m_pSGP->setViewport (0.67, 0.1, 1., 1.);
-                       ezplot.plot();\r
+                       ezplot.plot (m_pSGP);\r
                        delete detPos;
                }
     }
index ac7e3a69c08b3c156767ecf13c70f3127e16b205..bab1d1348183eb7ce4e494c19740ae5fbbce665d 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: docs.cpp,v 1.8 2000/12/27 03:16:02 kevin Exp $
+**  $Id: docs.cpp,v 1.9 2000/12/29 15:45:06 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
@@ -81,9 +81,7 @@ bool ImageFileDocument::OnOpenDocument(const wxString& filename)
   }
   Modify(false);
   UpdateAllViews();\r
-  ImageFileView* ifView = dynamic_cast<ImageFileView*>(GetFirstView());\r
-  if (ifView)\r
-         ifView->OnUpdate(ifView, NULL);\r
+  GetFirstView()->OnUpdate (GetFirstView(), NULL);\r
 
   return true;
 }
@@ -133,7 +131,8 @@ bool ProjectionFileDocument::OnOpenDocument(const wxString& filename)
     SetFilename(filename, true);
   }
   Modify(false);
-  UpdateAllViews();
+  UpdateAllViews();\r
+
   return true;
 }
 
@@ -176,7 +175,8 @@ bool PhantomDocument::OnOpenDocument(const wxString& filename)
   }
   m_idPhantom = m_phantom.id();
   Modify(false);
-  UpdateAllViews();
+  UpdateAllViews();\r
+
   return true;
 }
 
@@ -224,14 +224,11 @@ bool PlotFileDocument::OnOpenDocument(const wxString& filename)
       return false;
     }
     *theApp->getLog() << "Read plot file " << filename << "\n";
-    SetFilename(filename, true);\r
+    SetFilename (filename, true);\r
     m_namePlot = filename.c_str();
   }
-  Modify(false);
+  Modify (false);
   UpdateAllViews();\r
-  PlotFileView* ifView = dynamic_cast<PlotFileView*>(GetFirstView());\r
-  if (ifView)\r
-         ifView->OnUpdate(ifView, NULL);\r
 
   return true;
 }
index 465990360c18f9dc160ff598a4e48bca40db67ac..8c53e4ced61bf734570a557db7ee14d1fd75f7ff 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.39 2000/12/27 03:16:02 kevin Exp $
+**  $Id: views.cpp,v 1.40 2000/12/29 15:45:06 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
@@ -164,6 +164,13 @@ EVT_MENU(IFMENU_VIEW_SCALE_AUTO, ImageFileView::OnScaleAuto)
 EVT_MENU(IFMENU_COMPARE_IMAGES, ImageFileView::OnCompare)\r
 EVT_MENU(IFMENU_COMPARE_ROW, ImageFileView::OnCompareRow)\r
 EVT_MENU(IFMENU_COMPARE_COL, ImageFileView::OnCompareCol)\r
+EVT_MENU(IFMENU_PROCESS_INVERTVALUES, ImageFileView::OnInvertValues)\r
+EVT_MENU(IFMENU_PROCESS_SQUARE, ImageFileView::OnSquare)\r
+EVT_MENU(IFMENU_PROCESS_SQRT, ImageFileView::OnSquareRoot)\r
+EVT_MENU(IFMENU_PROCESS_LOG, ImageFileView::OnLog)\r
+EVT_MENU(IFMENU_PROCESS_EXP, ImageFileView::OnExp)\r
+EVT_MENU(IFMENU_PROCESS_FFT_MAGNITUDE, ImageFileView::OnFFTMagnitude)\r
+EVT_MENU(IFMENU_PROCESS_FFT_PHASE, ImageFileView::OnFFTPhase)\r
 EVT_MENU(IFMENU_PLOT_ROW, ImageFileView::OnPlotRow)\r
 EVT_MENU(IFMENU_PLOT_COL, ImageFileView::OnPlotCol)\r
 END_EVENT_TABLE()
@@ -245,15 +252,15 @@ ImageFileView::OnCompare (wxCommandEvent& event)
 {\r
   std::vector<ImageFileDocument*> vecIF;\r
   theApp->getCompatibleImages (GetDocument(), vecIF);\r
-\r
+  \r
   if (vecIF.size() == 0) {\r
     wxMessageBox("There are no compatible image files open for comparision", "No comparison images");\r
   } else {\r
     DialogGetComparisonImage dialogGetCompare(m_frame, "Get Comparison Image", vecIF, true);\r
-\r
+    \r
     if (dialogGetCompare.ShowModal() == wxID_OK) {\r
-      ImageFileDocument* pCompareDoc = dialogGetCompare.getImageFileDocument();\r
       const ImageFile& rIF = GetDocument()->getImageFile();\r
+      ImageFileDocument* pCompareDoc = dialogGetCompare.getImageFileDocument();\r
       const ImageFile& rCompareIF = pCompareDoc->getImageFile();\r
       std::ostringstream os;\r
       double min, max, mean, mode, median, stddev;\r
@@ -273,13 +280,13 @@ ImageFileView::OnCompare (wxCommandEvent& event)
           return;\r
         }\r
         ImageFile& differenceImage = pDifferenceDoc->getImageFile();\r
-      \r
+        \r
         differenceImage.setArraySize (rIF.nx(), rIF.ny());\r
         if (! rIF.subtractImages (rCompareIF, differenceImage)) {\r
           pDifferenceDoc->DeleteAllViews();\r
           return;\r
         }\r
-\r
+        \r
         if (theApp->getSetModifyNewDocs())\r
           pDifferenceDoc->Modify(true);\r
         pDifferenceDoc->UpdateAllViews(this);\r
@@ -290,6 +297,77 @@ ImageFileView::OnCompare (wxCommandEvent& event)
   }\r
 }
 
+void\r
+ImageFileView::OnInvertValues (wxCommandEvent& event)\r
+{\r
+  ImageFile& rIF = GetDocument()->getImageFile();\r
+  rIF.invertPixelValues (rIF);\r
+  if (theApp->getSetModifyNewDocs())\r
+    GetDocument()->Modify(TRUE);\r
+  GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+void\r
+ImageFileView::OnSquare (wxCommandEvent& event)\r
+{\r
+  ImageFile& rIF = GetDocument()->getImageFile();\r
+  rIF.square (rIF);\r
+  if (theApp->getSetModifyNewDocs())\r
+    GetDocument()->Modify(TRUE);\r
+  GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+void\r
+ImageFileView::OnSquareRoot (wxCommandEvent& event)\r
+{\r
+  ImageFile& rIF = GetDocument()->getImageFile();\r
+  rIF.sqrt (rIF);\r
+  if (theApp->getSetModifyNewDocs())\r
+    GetDocument()->Modify(TRUE);\r
+  GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+void\r
+ImageFileView::OnLog (wxCommandEvent& event)\r
+{\r
+  ImageFile& rIF = GetDocument()->getImageFile();\r
+  rIF.log (rIF);\r
+  if (theApp->getSetModifyNewDocs())\r
+    GetDocument()->Modify(TRUE);\r
+  GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+void\r
+ImageFileView::OnExp (wxCommandEvent& event)\r
+{\r
+  ImageFile& rIF = GetDocument()->getImageFile();\r
+  rIF.exp (rIF);\r
+  if (theApp->getSetModifyNewDocs())\r
+    GetDocument()->Modify(TRUE);\r
+  GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+void\r
+ImageFileView::OnFFTMagnitude (wxCommandEvent& event)\r
+{\r
+  ImageFile& rIF = GetDocument()->getImageFile();\r
+  rIF.FFTMagnitude (rIF);\r
+  if (theApp->getSetModifyNewDocs())\r
+    GetDocument()->Modify(TRUE);\r
+  GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+void\r
+ImageFileView::OnFFTPhase (wxCommandEvent& event)\r
+{\r
+  ImageFile& rIF = GetDocument()->getImageFile();\r
+  rIF.FFTPhase (rIF);\r
+  if (theApp->getSetModifyNewDocs())\r
+    GetDocument()->Modify(TRUE);\r
+  GetDocument()->UpdateAllViews(this);\r
+}\r
+\r
+\r
 ImageFileCanvas* 
 ImageFileView::CreateCanvas (wxView *view, wxFrame *parent)
 {
@@ -331,6 +409,15 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   view_menu->Append(IFMENU_VIEW_SCALE_MINMAX, "Display Scale &Set...");
   view_menu->Append(IFMENU_VIEW_SCALE_AUTO, "Display Scale &Auto...");
   \r
+  wxMenu* process_menu = new wxMenu;\r
+  process_menu->Append (IFMENU_PROCESS_INVERTVALUES, "&Invert Values");\r
+  process_menu->Append (IFMENU_PROCESS_SQUARE, "&Square");\r
+  process_menu->Append (IFMENU_PROCESS_SQRT, "Square &Root");\r
+  process_menu->Append (IFMENU_PROCESS_LOG, "&Log");\r
+  process_menu->Append (IFMENU_PROCESS_EXP, "&Exp");\r
+  process_menu->Append (IFMENU_PROCESS_FFT_MAGNITUDE, "&FFT Magnitude");\r
+  process_menu->Append (IFMENU_PROCESS_FFT_PHASE, "FFT &Phase");\r
+\r
   wxMenu *plot_menu = new wxMenu;\r
   plot_menu->Append (IFMENU_PLOT_ROW, "Plot &Row");\r
   plot_menu->Append (IFMENU_PLOT_COL, "Plot &Column");\r
@@ -339,7 +426,7 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   compare_menu->Append (IFMENU_COMPARE_IMAGES, "Compare &Images...");\r
   compare_menu->Append (IFMENU_COMPARE_ROW, "Compare &Row");\r
   compare_menu->Append (IFMENU_COMPARE_COL, "Compare &Column");\r
-\r
+  \r
   wxMenu *help_menu = new wxMenu;
   help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
   
@@ -347,7 +434,8 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   
   menu_bar->Append(file_menu, "&File");
   menu_bar->Append(view_menu, "&View");\r
-  menu_bar->Append(plot_menu, "&Plot");\r
+  menu_bar->Append(process_menu, "&Process");\r
+  menu_bar->Append(plot_menu, "P&lot");\r
   menu_bar->Append(compare_menu, "&Compare");
   menu_bar->Append(help_menu, "&Help");
   
@@ -507,9 +595,9 @@ ImageFileView::OnPlotRow (wxCommandEvent& event)
     delete pX;\r
     delete pY;\r
     if (theApp->getSetModifyNewDocs())\r
-       pPlotDoc->Modify(true);\r
+      pPlotDoc->Modify(true);\r
+    pPlotDoc->UpdateAllViews();\r
   }\r
-  \r
 }\r
 
 void\r
@@ -556,6 +644,7 @@ ImageFileView::OnPlotCol (wxCommandEvent& event)
     delete pY;\r
     if (theApp->getSetModifyNewDocs())\r
       pPlotDoc->Modify(true);\r
+    pPlotDoc->UpdateAllViews();\r
   }\r
 }\r
 \r
@@ -625,6 +714,7 @@ ImageFileView::OnCompareCol (wxCommandEvent& event)
       delete pY2;\r
       if (theApp->getSetModifyNewDocs())\r
         pPlotDoc->Modify(true);\r
+      pPlotDoc->UpdateAllViews();\r
     }\r
   }\r
 }\r
@@ -645,7 +735,7 @@ ImageFileView::OnCompareRow (wxCommandEvent& event)
     wxMessageBox ("No compatible images for Row Comparison", "Error");\r
     return;\r
   }\r
-\r
+  \r
   DialogGetComparisonImage dialogGetCompare (m_frame, "Get Comparison Image", vecIFDoc, false);\r
   \r
   if (dialogGetCompare.ShowModal() == wxID_OK) {\r
@@ -697,6 +787,7 @@ ImageFileView::OnCompareRow (wxCommandEvent& event)
       delete pY2;\r
       if (theApp->getSetModifyNewDocs())\r
         pPlotDoc->Modify(true);\r
+      pPlotDoc->UpdateAllViews();\r
     }\r
   }\r
 }\r
@@ -1371,12 +1462,14 @@ EVT_MENU(PLOTMENU_VIEW_SCALE_AUTO, PlotFileView::OnScaleAuto)
 END_EVENT_TABLE()
 
 PlotFileView::PlotFileView(void) 
-: wxView(), m_canvas(NULL), m_frame(NULL)
+: wxView(), m_canvas(NULL), m_frame(NULL), m_pEZPlot(NULL)
 {
 }
 
 PlotFileView::~PlotFileView(void)
-{
+{\r
+  if (m_pEZPlot)\r
+    delete m_pEZPlot;
 }
 
 void
@@ -1502,7 +1595,7 @@ PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view)
 
 
 bool 
-PlotFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
+PlotFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) )
 {
   m_frame = CreateChildFrame(doc, this);
   SetFrame(m_frame);
@@ -1524,7 +1617,7 @@ PlotFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
   
   m_frame->Show(true);
   Activate(true);
-  
+   
   return true;
 }
 
@@ -1540,48 +1633,58 @@ PlotFileView::OnDraw (wxDC* dc)
     m_canvas->GetClientSize (&xsize, &ysize);\r
     SGPDriver driver (dc, xsize, ysize);\r
     SGP sgp (driver);\r
-    EZPlot plot (sgp);\r
-\r
-    for (int iEzset = 0; iEzset < rPlotFile.getNumEzsetCommands(); iEzset++)\r
-       plot.ezset (rPlotFile.getEzsetCommand (iEzset));\r
-\r
-    if (m_bMinSpecified) {\r
-      std::ostringstream os;\r
-      os << "ymin " << m_dMinPixel;\r
-      plot.ezset (os.str());\r
-    }\r
-    \r
-    if (m_bMaxSpecified) {\r
-      std::ostringstream os;\r
-      os << "ymax " << m_dMaxPixel;\r
-      plot.ezset (os.str());\r
-    }\r
-    \r
-    plot.ezset("box");\r
-    plot.ezset("grid");\r
-    \r
-    double* pdXaxis = new double [iNRecords];\r
-    rPlotFile.getColumn (0, pdXaxis);\r
-    \r
-    double* pdY = new double [iNRecords];\r
-    for (int iCol = 1; iCol < iNColumns; iCol++) {\r
-      rPlotFile.getColumn (iCol, pdY);\r
-      plot.addCurve (pdXaxis, pdY, iNRecords);\r
-    }\r
-    \r
-    delete pdXaxis;\r
-    delete pdY;\r
-    \r
-    plot.plot();\r
+    if (m_pEZPlot)\r
+      m_pEZPlot->plot (&sgp);\r
   }\r
 }
 
 
 void 
-PlotFileView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
+PlotFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
 {
-  if (m_canvas)
-    m_canvas->Refresh();
+  if (m_canvas) {
+    const PlotFile& rPlotFile = GetDocument()->getPlotFile();\r
+    const int iNColumns = rPlotFile.getNumColumns();\r
+    const int iNRecords = rPlotFile.getNumRecords();\r
+    \r
+    if (iNColumns > 0 && iNRecords > 0) {\r
+      if (m_pEZPlot)\r
+        delete m_pEZPlot;\r
+      m_pEZPlot = new EZPlot;\r
+      \r
+      for (int iEzset = 0; iEzset < rPlotFile.getNumEzsetCommands(); iEzset++)\r
+        m_pEZPlot->ezset (rPlotFile.getEzsetCommand (iEzset));\r
+      \r
+      if (m_bMinSpecified) {\r
+        std::ostringstream os;\r
+        os << "ymin " << m_dMinPixel;\r
+        m_pEZPlot->ezset (os.str());\r
+      }\r
+      \r
+      if (m_bMaxSpecified) {\r
+        std::ostringstream os;\r
+        os << "ymax " << m_dMaxPixel;\r
+        m_pEZPlot->ezset (os.str());\r
+      }\r
+      \r
+      m_pEZPlot->ezset("box");\r
+      m_pEZPlot->ezset("grid");\r
+      \r
+      double* pdXaxis = new double [iNRecords];\r
+      rPlotFile.getColumn (0, pdXaxis);\r
+      \r
+      double* pdY = new double [iNRecords];\r
+      for (int iCol = 1; iCol < iNColumns; iCol++) {\r
+        rPlotFile.getColumn (iCol, pdY);\r
+        m_pEZPlot->addCurve (pdXaxis, pdY, iNRecords);\r
+      }\r
+      \r
+      delete pdXaxis;\r
+      delete pdY;\r
+    }\r
+    \r
+    m_canvas->Refresh();\r
+  }
 }
 
 bool 
index 1457e8431b7a598328aa0e78682240bb81498f26..8bb5e6d82a414fadadd7f556f7025e56eeb4d894 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: views.h,v 1.16 2000/12/22 04:18:00 kevin Exp $
+**  $Id: views.h,v 1.17 2000/12/29 15:45:06 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
@@ -66,6 +66,13 @@ public:
     bool OnClose (bool deleteWindow = true);
     void OnProperties (wxCommandEvent& event);
     void OnCompare (wxCommandEvent& event);\r
+    void OnInvertValues (wxCommandEvent& event);\r
+    void OnSquare (wxCommandEvent& event);\r
+    void OnSquareRoot (wxCommandEvent& event);\r
+    void OnLog (wxCommandEvent& event);\r
+    void OnExp (wxCommandEvent& event);\r
+    void OnFFTMagnitude (wxCommandEvent& event);\r
+    void OnFFTPhase (wxCommandEvent& event);\r
     void OnScaleAuto (wxCommandEvent& event);
     void OnScaleMinMax (wxCommandEvent& event);
          void OnPlotRow (wxCommandEvent& event);\r
@@ -217,6 +224,7 @@ private:
     PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
 
+    EZPlot* m_pEZPlot;\r
     PlotFileCanvas *m_canvas;
     wxFrame *m_frame;
     bool m_bMinSpecified;\r
index dcd1dc1a3ac25eb0144d11a7ac7041610477aa86..9e4c1694f5a70746f853633402ab5ca14685911e 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: if1.cpp,v 1.2 2000/12/23 18:12:35 kevin Exp $
+**  $Id: if1.cpp,v 1.3 2000/12/29 15:45:06 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.2 2000/12/23 18:12:35 kevin Exp $";
+static const char* g_szIdStr = "$Id: if1.cpp,v 1.3 2000/12/29 15:45:06 kevin Exp $";
 
 void 
 if1_usage (const char *program)
@@ -67,8 +67,6 @@ if1_usage (const char *program)
 int 
 if1_main (int argc, char *const argv[])
 {
-  ImageFile *im_in;
-  ImageFile *im_out;
   char *in_file;
   char *out_file;
   int opt_verbose = 0;
@@ -131,61 +129,39 @@ if1_main (int argc, char *const argv[])
   in_file = argv[optind];
   out_file = argv[optind + 1];
 
-
   std::string histString;
 
   if (opt_invert || opt_log || opt_exp || opt_sqr || opt_sqrt) {
-    int ix, iy;
-
-    im_in = new ImageFile ();
-    im_in->fileRead (in_file);
-    int nx = im_in->nx();
-    int ny = im_in->ny();
-    im_out = new ImageFile (nx, ny);
-
-    ImageFileArray vIn = im_in->getArray();
-    ImageFileArray vOut = im_out->getArray();
-
-    if (opt_invert) {
-      for (ix = 0; ix < nx; ix++)
-        for (iy = 0; iy < ny; iy++)
-          vOut[ix][iy] = - vIn[ix][iy];
+    ImageFile im_in;
+    im_in.fileRead (in_file);
+    int nx = im_in.nx();
+    int ny = im_in.ny();
+    ImageFile im_out (nx, ny);
+
+    if (opt_invert) {\r
+      im_in.invertPixelValues (im_out);
       histString = "Invert transformation";
     }
-    if (opt_log) {
-      for (ix = 0; ix < nx; ix++)
-        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]);
+    if (opt_log) {\r
+      im_in.log (im_out);
       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]);
+    if (opt_exp) {\r
+      im_in.exp (im_out);
       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];
+    if (opt_sqr) {\r
+      im_in.square (im_out);
       histString = "Square transformation";
     }
-    if (opt_sqrt) {
-      for (ix = 0; ix < nx; ix++)
-        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
+    if (opt_sqrt) {\r
+      im_in.sqrt (im_out);
       histString = "Square root transformation";
     }
 
-    im_out->labelsCopy (*im_in);
-    im_out->labelAdd (Array2dFileLabel::L_HISTORY, histString.c_str());
-    im_out->fileWrite (out_file);
+    im_out.labelsCopy (im_in);
+    im_out.labelAdd (Array2dFileLabel::L_HISTORY, histString.c_str());
+    im_out.fileWrite (out_file);
   }
 
   return (0);
index 571e8d63294ca1ad6947e0b7fae136139c647030..0f36b595f02beb734cbeba00b6ef0fcbb8d9b4eb 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: if2.cpp,v 1.5 2000/12/23 18:12:35 kevin Exp $
+**  $Id: if2.cpp,v 1.6 2000/12/29 15:45:06 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: if2.cpp,v 1.5 2000/12/23 18:12:35 kevin Exp $";
+static const char* g_szIdStr = "$Id: if2.cpp,v 1.6 2000/12/29 15:45:06 kevin Exp $";
 
 void 
 if2_usage (const char *program)
@@ -254,7 +254,7 @@ if2_main (int argc, char *const argv[])
 #if HAVE_SGP
     SGPDriver driver ("Column Plot");
     SGP sgp (driver);
-    EZPlot ezplot (sgp);
+    EZPlot ezplot;
     ezplot.ezset ("clear.");
     ezplot.ezset ("xticks major 5.");
     ezplot.ezset ("xlabel Column");
@@ -264,7 +264,7 @@ if2_main (int argc, char *const argv[])
     ezplot.ezset ("grid.");
     ezplot.addCurve (plot_xaxis, v1[opt_columnPlot], im_in1.ny());
     ezplot.addCurve (plot_xaxis, v2[opt_columnPlot], im_in2.ny());
-    ezplot.plot();
+    ezplot.plot (&sgp);
     std::cout << "Press enter to continue" << flush;
     cio_kb_getc();
 #endif
@@ -309,7 +309,7 @@ if2_main (int argc, char *const argv[])
 #if HAVE_SGP
     SGPDriver driver ("Row Plot");
     SGP sgp (driver);
-    EZPlot ezplot (sgp);
+    EZPlot ezplot;
     ezplot.ezset ("clear.");
     ezplot.ezset ("xticks major 5.");
     ezplot.ezset ("title Row Plot");
@@ -319,7 +319,7 @@ if2_main (int argc, char *const argv[])
     ezplot.ezset ("grid.");
     ezplot.addCurve (plot_xaxis, v1Row, im_in1.nx());
     ezplot.addCurve (plot_xaxis, v2Row, im_in2.nx());
-    ezplot.plot();
+    ezplot.plot (&sgp);
     std::cout << "Press enter to continue" << flush;
     cio_kb_getc();
 #endif